Browse code

add menu options for file browser open/save

D Herring authored on 2012-05-13 13:58:20
Showing 2 changed files
... ...
@@ -51,10 +51,12 @@
51 51
 
52 52
 (defparameter *key-new-file* "<Control-n>" "Create a new file")
53 53
 (defparameter *key-open-file* "<Control-o>" "Open a new file")
54
+(defparameter *key-open-file-browser* "<Control-Alt-o>" "Open a new file, with browser GUI")
54 55
 (defparameter *key-load-file* "<Control-l>" "Load a file from disc")
55 56
 (defparameter *key-close-file* "<Control-w>" "Close a file")
56 57
 (defparameter *key-save-file* "<Control-s>" "Save the current file")
57 58
 (defparameter *key-save-as-file* "<Control-S>" "Save the current file under a new name")
59
+(defparameter *key-save-as-file-browser* "<Control-Alt-s>" "Save the current file under a new name, with browser GUI")
58 60
 (defparameter *key-reload-file* "<Control-r>" "Re-load the current file")
59 61
 (defparameter *key-compile-file* "<Control-k>" "Compile the current file")
60 62
 (defparameter *key-next-file* "<Control-b>" "Cycle through open files")
... ...
@@ -964,8 +964,10 @@
964 964
      (list *key-new-file* 'on-new-file)
965 965
      (list *key-close-file* 'on-close-file)
966 966
      (list *key-open-file* 'on-open-file)
967
+     (list *key-open-file-browser* 'on-open-file-browser)
967 968
      (list *key-save-file* 'on-save-file)
968 969
      (list *key-save-as-file* 'on-save-as-file)
970
+     (list *key-save-as-file-browser* 'on-save-as-file-browser)
969 971
      (list *key-load-file* 'on-load-file)
970 972
      (list *key-find* 'on-search)
971 973
      (list *key-find-again* 'on-search-again)
... ...
@@ -1024,9 +1026,11 @@
1024 1026
       (with-menu mfile
1025 1027
         (action "New file" on-new-file)
1026 1028
         (action "Open file" on-open-file)
1029
+	(action "Open file browser" on-open-file-browser)
1027 1030
         (separator)
1028 1031
         (action "Save file" on-save-file)
1029 1032
         (action "Save as file" on-save-as-file)
1033
+	(action "Save as file browser" on-save-as-file-browser)
1030 1034
         (separator)
1031 1035
         (action "Exit" on-quit))
1032 1036
       (with-menu medit
... ...
@@ -1101,6 +1105,10 @@
1101 1105
   (let ((filepath (get-filename *listener*)))
1102 1106
     (open-file filepath)))
1103 1107
 
1108
+(defun on-open-file-browser (&optional event)
1109
+  (declare (ignore event))
1110
+  (open-file (ltk:get-open-file)))
1111
+
1104 1112
 (defun on-load-file (&optional event)
1105 1113
   (let* ((filepath (get-filename *listener* "load:"))
1106 1114
          (pathname (open-file filepath)))
... ...
@@ -1133,6 +1141,11 @@
1133 1141
          (path (get-filename *listener* "save:")))
1134 1142
     (save-file file path)))
1135 1143
 
1144
+(defun on-save-as-file-browser (&optional event)
1145
+  (save-file
1146
+    (selected-buffer *buffer-manager*)
1147
+    (ltk:get-save-file)))
1148
+
1136 1149
 (defun on-reload-file (&optional event)
1137 1150
   (let* ((buffer (selected-buffer *buffer-manager*))
1138 1151
          (file-path (file-path buffer)))