Update of /project/cells-gtk/cvsroot/root/cells-gtk In directory common-lisp.net:/tmp/cvs-serv15045/root/cells-gtk
Modified Files: textview.lisp Log Message: Added textview-scroll-to-position (but see discussion in FAQ about connecting a stream to textview for a better approach). Date: Sat Oct 8 16:31:24 2005 Author: pdenno
Index: root/cells-gtk/textview.lisp diff -u root/cells-gtk/textview.lisp:1.4 root/cells-gtk/textview.lisp:1.5 --- root/cells-gtk/textview.lisp:1.4 Sun Mar 6 17:58:51 2005 +++ root/cells-gtk/textview.lisp Sat Oct 8 16:31:24 2005 @@ -130,6 +130,16 @@ (gtk-text-buffer-get-iter-at-offset buf e-iter end) (gtk-text-buffer-delete buf s-iter e-iter))))
+;;; This isn't working perfectly. Might be better to use gtk-text-view-scroll-mark-onscreen +;;; I do just that in one of my applications, but since it requires a mark, I didn't write +;;; an exported function for it. +(defun text-view-scroll-to-position (textview pos) + (let* ((view (id textview)) + (buf (gtk-text-view-get-buffer view))) + (with-text-iters (s-iter) + (gtk-text-buffer-get-iter-at-offset buf s-iter pos) + (gtk-text-view-scroll-to-iter view s-iter 0.0 nil 0.0 0.0)))) + ;;; The next two can be used to check and clear the the modified flag. ;;; The event is registered when you use :on-modified-changed on a text-buffer. ;;; The def-c-output text ((text-buffer)) clears the flag so as to distinguish @@ -143,7 +153,10 @@
(eval-when (:compile-toplevel :load-toplevel :execute) (export '(def-populate-adds populate-adds with-text-iters text-buffer-get-text - text-buffer-delete-text text-buffer-insert-text text-buffer-modified-p))) + text-buffer-delete-text text-buffer-insert-text text-buffer-modified-p + text-view-scroll-to-position gtk-text-buffer-get-iter-at-offset + gtk-text-buffer-create-mark gtk-text-view-set-wrap-mode gtk-text-view-set-editable + gtk-text-buffer-move-mark gtk-text-view-scroll-mark-onscreen)))