(labels ((set-properties ()
(status-bar-pop status-bar "filename")
(status-bar-push status-bar "filename" (format nil "~A~:[~; *~]" (or file-name "Untitled") modified-p)))
- (new (&rest args)
+ (new (&rest args) (declare (ignore args))
(setf file-name nil
modified-p t
(text-buffer-text (text-view-buffer text-view)) "")
(set-properties))
- (cb-open (&rest args)
+ (cb-open (&rest args) (declare (ignore args))
(let ((d (make-instance 'file-chooser-dialog :action :open :title "Open file")))
(when file-name (setf (file-chooser-filename d) file-name))
(dialog-add-button d "gtk-open" :accept)
modified-p nil)
(set-properties))
(object-destroy d)))
- (save (&rest args)
+ (save (&rest args) (declare (ignore args))
(if file-name
(progn
(with-open-file (file file-name :direction :output :if-exists :supersede)
(setf modified-p nil)
(set-properties))
(save-as)))
- (save-as (&rest args)
+ (save-as (&rest args) (declare (ignore args))
(let ((d (make-instance 'file-chooser-dialog :action :save :title "Save file")))
(when file-name (setf (file-chooser-filename d) file-name))
(dialog-add-button d "gtk-save" :accept)
(object-destroy d)
(save))
(object-destroy d))))
- (cut (&rest args)
+ (cut (&rest args) (declare (ignore args))
(text-buffer-cut-clipboard (text-view-buffer text-view) (get-clipboard "CLIPBOARD")))
- (copy (&rest args)
+ (copy (&rest args) (declare (ignore args))
(text-buffer-copy-clipboard (text-view-buffer text-view) (get-clipboard "CLIPBOARD")))
- (paste (&rest args)
+ (paste (&rest args) (declare (ignore args))
(text-buffer-paste-clipboard (text-view-buffer text-view) (get-clipboard "CLIPBOARD")))
- (cb-delete (&rest args)
+ (cb-delete (&rest args) (declare (ignore args))
(let ((buffer (text-view-buffer text-view)))
(multiple-value-bind (i1 i2) (text-buffer-get-selection-bounds buffer)
(when (and i1 i2)
(text-buffer-delete buffer i1 i2)))))
- (about (&rest args)
+ (about (&rest args) (declare (ignore args))
(let ((d (make-instance 'about-dialog
:program-name "Lisp Gtk+ Binding Demo Text Editor"
:version (format nil "0.0.0.1 ~A" #\GREEK_SMALL_LETTER_ALPHA)
:logo-icon-name "accessories-text-editor")))
(dialog-run d)
(object-destroy d)))
- (quit (&rest args) (object-destroy window))
- (cb-eval (&rest args)
+ (quit (&rest args) (declare (ignore args)) (object-destroy window))
+ (cb-eval (&rest args) (declare (ignore args))
(let ((buffer (text-view-buffer text-view)))
(multiple-value-bind (i1 i2) (text-buffer-get-selection-bounds buffer)
(when (and i1 i2)
(with-gtk-message-error-handler
(let* ((text (text-buffer-slice buffer i1 i2))
(value (eval (read-from-string text)))
- (value-str (format nil "~A" value)))
- (text-buffer-delete buffer i1 i2)
- (text-buffer-insert buffer value-str))))))))
+ (value-str (format nil "~A" value))
+ (pos (max (text-iter-offset i1) (text-iter-offset i2))))
+ (text-buffer-insert buffer " => " :position (text-buffer-get-iter-at-offset buffer pos))
+ (incf pos (length " => "))
+ (text-buffer-insert buffer value-str :position (text-buffer-get-iter-at-offset buffer pos)))))))))
(builder-connect-signals-simple builder `(("new" ,#'new)
("open" ,#'cb-open)
("save" ,#'save)