aboutsummaryrefslogtreecommitdiff
path: root/ide/undo.ml
diff options
context:
space:
mode:
authorpboutill2012-05-02 17:11:16 +0000
committerpboutill2012-05-02 17:11:16 +0000
commit9d246ebacd101c1688bb5b39d88f2501b3e01090 (patch)
tree374daa8c4825b0763332f56b680a40c7852a471a /ide/undo.ml
parent2178e3a87ca9216e2584c040a1b15fc7423f4b65 (diff)
undoable_view is a source_view
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@15266 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'ide/undo.ml')
-rw-r--r--ide/undo.ml26
1 files changed, 13 insertions, 13 deletions
diff --git a/ide/undo.ml b/ide/undo.ml
index 57724297dc..cb3f455d1e 100644
--- a/ide/undo.ml
+++ b/ide/undo.ml
@@ -16,10 +16,10 @@ let neg act = match act with
| Insert (s,i,l) -> Delete (s,i,l)
| Delete (s,i,l) -> Insert (s,i,l)
-class undoable_view (tv:[>Gtk.text_view] Gtk.obj) =
+class undoable_view (tv:GtkSourceView2_types.source_view Gtk.obj) =
let undo_lock = ref true in
object(self)
- inherit GText.view tv as super
+ inherit GSourceView2.source_view tv as super
val history = (Stack.create () : action Stack.t)
val redo = (Queue.create () : action Queue.t)
val nredo = (Stack.create () : action Stack.t)
@@ -162,14 +162,14 @@ object(self)
))
end
-let undoable_view ?(buffer:GText.buffer option) =
- GtkText.View.make_params []
- ~cont:(GContainer.pack_container
- ~create:
- (fun pl -> let w = match buffer with
- | None -> GtkText.View.create []
- | Some b -> GtkText.View.create_with_buffer b#as_buffer
- in
- Gobject.set_params w pl; ((new undoable_view w):undoable_view)))
-
-
+let undoable_view ?(source_buffer:GSourceView2.source_buffer option) ?draw_spaces =
+ GtkSourceView2.SourceView.make_params [] ~cont:(
+ GtkText.View.make_params ~cont:(
+ GContainer.pack_container ~create:
+ (fun pl -> let w = match source_buffer with
+ | None -> GtkSourceView2.SourceView.new_ ()
+ | Some buf -> GtkSourceView2.SourceView.new_with_buffer
+ (Gobject.try_cast buf#as_buffer "GtkSourceBuffer") in
+ Gobject.set_params (Gobject.try_cast w "GtkSourceView") pl;
+ Gaux.may (GtkSourceView2.SourceView.set_draw_spaces w) draw_spaces;
+ ((new undoable_view w):undoable_view))))