[gtksourceviewmm] Added SourceUndoManager.



commit 5f18f9a603458aabeb1703f63ac2caafcead979d
Author: Krzesimir Nowak <qdlacz gmail com>
Date:   Thu Feb 25 01:12:18 2010 +0100

    Added SourceUndoManager.
    
    * gtksourceview/src/sourceundomanager.ccg:
    * gtksourceview/src/sourceundomanager.hg: New files wrapping
    GtkSourceUndoManager.
    * gtksourceview/src/sourcebuffer.hg:
    * gtksourceview/src/sourcebuffer.ccg: Wrapped new methods getting
    or setting SourceUndoManager.
    * gtksourceview/src/gtksourceview_vfuncs.defs: Added vfuncs defs
    for SourceUndoManager.
    * gtksourceview/src/filelist.am: Added sourceundomanager.(hg|ccg)
    to build system. Also sorted the list of files.
    * codegen/m4/convert_gtksourceview.m4: Added some needed
    conversions.
    * gtksourceview/gtksourceviewmm/.gitignore: Added
    sourceundomanager.* to ignore. Sorted the list.

 codegen/m4/convert_gtksourceview.m4         |    8 +++
 gtksourceview/gtksourceviewmm/.gitignore    |   19 +++---
 gtksourceview/src/filelist.am               |   27 +++++----
 gtksourceview/src/gtksourceview_vfuncs.defs |   31 ++++++++++
 gtksourceview/src/sourcebuffer.ccg          |    6 ++
 gtksourceview/src/sourcebuffer.hg           |    9 +++
 gtksourceview/src/sourceundomanager.ccg     |   19 ++++++
 gtksourceview/src/sourceundomanager.hg      |   80 +++++++++++++++++++++++++++
 8 files changed, 177 insertions(+), 22 deletions(-)
---
diff --git a/codegen/m4/convert_gtksourceview.m4 b/codegen/m4/convert_gtksourceview.m4
index f1157dd..59388ce 100644
--- a/codegen/m4/convert_gtksourceview.m4
+++ b/codegen/m4/convert_gtksourceview.m4
@@ -137,6 +137,14 @@ _CONVERSION(`const Glib::RefPtr<SourceStyleScheme>&',`GtkSourceStyleScheme*',`Gl
 _CONVERSION(`GtkSourceStyleSchemeManager*',`Glib::RefPtr<SourceStyleSchemeManager>',`Glib::wrap($3)')
 
 
+# GtkSourceUndoManager -> gtksourceview::SourceUndoManager
+_CONVERSION(`GtkSourceUndoManager*',`Glib::RefPtr<SourceUndoManager>',`Glib::wrap($3)')
+
+
+# gtksourceview::SourceUndoManager -> GtkSourceUndoManager
+_CONVERSION(`const Glib::RefPtr<const SourceUndoManager>&',`GtkSourceUndoManager*',`const_cast<GtkSourceUndoManager*>(Glib::unwrap($3))')
+
+
 # GtkSourceView -> Gtk::SourceView
 _CONVERSION(`GtkSourceView*',`SourceView*',`Glib::wrap($3)')
 
diff --git a/gtksourceview/gtksourceviewmm/.gitignore b/gtksourceview/gtksourceviewmm/.gitignore
index f114316..3c9ff6a 100644
--- a/gtksourceview/gtksourceviewmm/.gitignore
+++ b/gtksourceview/gtksourceviewmm/.gitignore
@@ -1,19 +1,20 @@
 /sourcebuffer.*
+/sourcecompletion.*
+/sourcecompletionactivation.*
+/sourcecompletioncontext.*
+/sourcecompletioninfo.*
+/sourcecompletionitem.*
+/sourcecompletionproposal.*
+/sourcecompletionprovider.*
+/sourcegutter.*
 /sourceiter.*
 /sourcelanguage.*
 /sourcelanguagemanager.*
 /sourcemark.*
+/sourceprintcompositor.*
 /sourcestyle.*
 /sourcestylescheme.*
 /sourcestyleschememanager.*
+/sourceundomanager.*
 /sourceview.*
 /wrap_init.cc
-/sourcegutter.*
-/sourcecompletionproposal.*
-/sourcecompletioninfo.*
-/sourcecompletion.*
-/sourcecompletioncontext.*
-/sourcecompletionitem.*
-/sourcecompletionprovider.*
-/sourceprintcompositor.*
-/sourcecompletionactivation.*
diff --git a/gtksourceview/src/filelist.am b/gtksourceview/src/filelist.am
index 402a720..e9ac23d 100644
--- a/gtksourceview/src/filelist.am
+++ b/gtksourceview/src/filelist.am
@@ -9,23 +9,24 @@ files_defs =				\
 	gtksourceview_docs_override.xml
 
 files_hg =				\
-	sourcestyle.hg			\
-	sourcestylescheme.hg		\
-	sourcelanguage.hg		\
-	sourcelanguagemanager.hg	\
-	sourceview.hg			\
 	sourcebuffer.hg			\
-	sourceiter.hg			\
-	sourcemark.hg			\
-	sourcestyleschememanager.hg	\
-	sourcegutter.hg			\
+	sourcecompletion.hg		\
+	sourcecompletionactivation.hg   \
+	sourcecompletioncontext.hg	\
 	sourcecompletioninfo.hg		\
-	sourcecompletionproposal.hg	\
 	sourcecompletionitem.hg		\
-	sourcecompletioncontext.hg	\
-	sourcecompletion.hg		\
+	sourcecompletionproposal.hg	\
 	sourcecompletionprovider.hg	\
+	sourcegutter.hg			\
+	sourceiter.hg			\
+	sourcelanguage.hg		\
+	sourcelanguagemanager.hg	\
+	sourcemark.hg			\
 	sourceprintcompositor.hg	\
-	sourcecompletionactivation.hg
+	sourcestyle.hg			\
+	sourcestylescheme.hg		\
+	sourcestyleschememanager.hg	\
+	sourceundomanager.hg            \
+	sourceview.hg
 
 files_ccg = $(files_hg:.hg=.ccg)
diff --git a/gtksourceview/src/gtksourceview_vfuncs.defs b/gtksourceview/src/gtksourceview_vfuncs.defs
index da87b10..dddf132 100644
--- a/gtksourceview/src/gtksourceview_vfuncs.defs
+++ b/gtksourceview/src/gtksourceview_vfuncs.defs
@@ -117,3 +117,34 @@
   (return-type "int")
 )
 
+; GtkSourceUndoManager
+
+(define-vfunc can_undo
+  (of-object "GtkSourceUndoManager")
+  (return-type "gboolean")
+)
+
+(define-vfunc can_redo
+  (of-object "GtkSourceUndoManager")
+  (return-type "gboolean")
+)
+
+(define-vfunc undo
+  (of-object "GtkSourceUndoManager")
+  (return-type "void")
+)
+
+(define-vfunc redo
+  (of-object "GtkSourceUndoManager")
+  (return-type "void")
+)
+
+(define-vfunc begin_not_undoable_action
+  (of-object "GtkSourceUndoManager")
+  (return-type "void")
+)
+
+(define-vfunc end_not_undoable_action
+  (of-object "GtkSourceUndoManager")
+  (return-type "void")
+)
diff --git a/gtksourceview/src/sourcebuffer.ccg b/gtksourceview/src/sourcebuffer.ccg
index 335c98c..994b7f5 100644
--- a/gtksourceview/src/sourcebuffer.ccg
+++ b/gtksourceview/src/sourcebuffer.ccg
@@ -90,6 +90,12 @@ SourceBuffer::unset_style_scheme()
   gtk_source_buffer_set_style_scheme(gobj(), 0);
 }
 
+void
+SourceBuffer::set_default_undo_manager()
+{
+  gtk_source_buffer_set_undo_manager(gobj(), 0);
+}
+
 }//end namespace gtksourceview
 
 
diff --git a/gtksourceview/src/sourcebuffer.hg b/gtksourceview/src/sourcebuffer.hg
index 62194f0..e46087f 100644
--- a/gtksourceview/src/sourcebuffer.hg
+++ b/gtksourceview/src/sourcebuffer.hg
@@ -23,6 +23,7 @@
 #include <gtkmm/textbuffer.h>
 #include <gtksourceviewmm/sourcelanguage.h>
 #include <gtksourceviewmm/sourcemark.h>
+#include <gtksourceviewmm/sourceundomanager.h>
 
 _DEFS(gtksourceviewmm,gtksourceview)
 _PINCLUDE(gtkmm/private/textbuffer_p.h)
@@ -393,6 +394,14 @@ public:
    */
   _WRAP_METHOD(Glib::StringArrayHandle get_context_classes_at_iter(const Gtk::TextIter& iter) const, gtk_source_buffer_get_context_classes_at_iter)
 
+  _WRAP_METHOD(Glib::RefPtr<SourceUndoManager> get_undo_manager(), gtk_source_buffer_get_undo_manager)
+
+  _WRAP_METHOD(Glib::RefPtr<const SourceUndoManager> get_undo_manager() const, gtk_source_buffer_get_undo_manager, constversion)
+
+  _WRAP_METHOD(void set_undo_manager(const Glib::RefPtr<const SourceUndoManager>& undo_manager), gtk_source_buffer_set_undo_manager)
+
+  void set_default_undo_manager();
+
   _WRAP_PROPERTY("highlight-syntax", bool)
   _WRAP_PROPERTY("highlight-matching-brackets", bool)
   _WRAP_PROPERTY("max-undo-levels", int)
diff --git a/gtksourceview/src/sourceundomanager.ccg b/gtksourceview/src/sourceundomanager.ccg
new file mode 100644
index 0000000..bfb54e6
--- /dev/null
+++ b/gtksourceview/src/sourceundomanager.ccg
@@ -0,0 +1,19 @@
+/* sourceundomanager.cc
+ *
+ * Copyright (C) 2010 Krzesimir Nowak
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
diff --git a/gtksourceview/src/sourceundomanager.hg b/gtksourceview/src/sourceundomanager.hg
new file mode 100644
index 0000000..86fa2d3
--- /dev/null
+++ b/gtksourceview/src/sourceundomanager.hg
@@ -0,0 +1,80 @@
+/* sourceundomanager.h
+ *
+ * Copyright (C) 2010 Krzesimir Nowak
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <glibmm/interface.h>
+#include <glibmm/ustring.h>
+#include <gdkmm/pixbuf.h>
+#include <gtksourceview/gtksourceundomanager.h>
+
+_DEFS(gtksourceviewmm,gtksourceview)
+_PINCLUDE(glibmm/private/interface_p.h)
+
+namespace gtksourceview
+{
+
+/** Completion proposal object.
+ *
+ * The proposal interface represents a completion item in the completion window.
+ * It provides information on how to display the completion item and what action
+ * should be taken when the completion item is activated.
+ *
+ * @newin{2,10}
+ */
+class SourceUndoManager : public Glib::Interface
+{
+  _CLASS_INTERFACE(SourceUndoManager, GtkSourceUndoManager, GTK_SOURCE_UNDO_MANAGER, GtkSourceUndoManagerIface)
+
+public:
+
+  _WRAP_METHOD(bool can_undo() const, gtk_source_undo_manager_can_undo)
+
+  _WRAP_METHOD(bool can_redo() const, gtk_source_undo_manager_can_redo)
+
+  _WRAP_METHOD(void undo(), gtk_source_undo_manager_undo)
+
+  _WRAP_METHOD(void redo(), gtk_source_undo_manager_redo)
+
+  _WRAP_METHOD(void begin_not_undoable_action(), gtk_source_undo_manager_begin_not_undoable_action)
+
+  _WRAP_METHOD(void end_not_undoable_action(), gtk_source_undo_manager_end_not_undoable_action)
+
+  _WRAP_METHOD(void can_undo_changed(), gtk_source_undo_manager_can_undo_changed)
+
+  _WRAP_METHOD(void can_redo_changed(), gtk_source_undo_manager_can_redo_changed)
+
+  _WRAP_SIGNAL(void can_undo_changed(), "can-undo-changed")
+
+  _WRAP_SIGNAL(void can_redo_changed(), "can-redo-changed")
+
+  _WRAP_VFUNC(bool can_undo() const, can_undo)
+
+  _WRAP_VFUNC(bool can_redo() const, can_redo)
+
+  _WRAP_VFUNC(void undo(), undo)
+
+  _WRAP_VFUNC(void redo(), redo)
+
+  _WRAP_VFUNC(void begin_not_undoable_action(), begin_not_undoable_action)
+
+  _WRAP_VFUNC(void end_not_undoable_action(), end_not_undoable_action)
+};
+
+} // namespace gtksourceview
+
+



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]