diff options
Diffstat (limited to 'ide')
| -rw-r--r-- | ide/undo.ml | 9 | ||||
| -rw-r--r-- | ide/undo.mli | 4 |
2 files changed, 9 insertions, 4 deletions
diff --git a/ide/undo.ml b/ide/undo.ml index cb3f455d1e..9b33c11e5e 100644 --- a/ide/undo.ml +++ b/ide/undo.ml @@ -16,10 +16,12 @@ 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:GtkSourceView2_types.source_view Gtk.obj) = +type source_view = [ Gtk.text_view | `sourceview ] Gtk.obj + +class undoable_view (tv : source_view) = let undo_lock = ref true in object(self) - inherit GSourceView2.source_view tv as super + inherit GSourceView2.source_view (Gobject.unsafe_cast tv) as super val history = (Stack.create () : action Stack.t) val redo = (Queue.create () : action Queue.t) val nredo = (Stack.create () : action Stack.t) @@ -170,6 +172,7 @@ let undoable_view ?(source_buffer:GSourceView2.source_buffer option) ?draw_spac | None -> GtkSourceView2.SourceView.new_ () | Some buf -> GtkSourceView2.SourceView.new_with_buffer (Gobject.try_cast buf#as_buffer "GtkSourceBuffer") in + let w = Gobject.unsafe_cast w 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)))) + ((new undoable_view w) : undoable_view)))) diff --git a/ide/undo.mli b/ide/undo.mli index 03e2885cde..b6a59ba756 100644 --- a/ide/undo.mli +++ b/ide/undo.mli @@ -8,7 +8,9 @@ (* An undoable view class *) -class undoable_view : GtkSourceView2_types.source_view Gtk.obj -> +type source_view = [ Gtk.text_view | `sourceview ] Gtk.obj + +class undoable_view : source_view -> object inherit GSourceView2.source_view method undo : bool |
