[gtksourceviewmm] Implement Gsv::SearchSettings
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceviewmm] Implement Gsv::SearchSettings
- Date: Wed, 3 Aug 2016 10:24:23 +0000 (UTC)
commit e8af9b9f80290eec1232e461c602167df5541b82
Author: Christoph Brill <egore911 gmail com>
Date: Sun May 10 09:41:23 2015 +0200
Implement Gsv::SearchSettings
The implementation needs gtksourceview 3.10 (or later) and depends on
the previous two commits adding the necessary definitions.
.../extradefs/generate_extra_defs_gtksourceview.cc | 1 +
codegen/m4/convert_gtksourceview.m4 | 8 ++
gtksourceview/gtksourceviewmm.h | 1 +
gtksourceview/src/filelist.am | 1 +
gtksourceview/src/searchsettings.ccg | 20 +++
gtksourceview/src/searchsettings.hg | 130 ++++++++++++++++++++
6 files changed, 161 insertions(+), 0 deletions(-)
---
diff --git a/codegen/extradefs/generate_extra_defs_gtksourceview.cc
b/codegen/extradefs/generate_extra_defs_gtksourceview.cc
index f39c375..09097ff 100644
--- a/codegen/extradefs/generate_extra_defs_gtksourceview.cc
+++ b/codegen/extradefs/generate_extra_defs_gtksourceview.cc
@@ -43,6 +43,7 @@ int main (int argc, char *argv[])
<< get_defs (GTK_SOURCE_TYPE_MARK)
<< get_defs (GTK_SOURCE_TYPE_MARK_ATTRIBUTES)
<< get_defs (GTK_SOURCE_TYPE_PRINT_COMPOSITOR)
+ << get_defs (GTK_SOURCE_TYPE_SEARCH_SETTINGS)
<< get_defs (GTK_SOURCE_TYPE_STYLE)
<< get_defs (GTK_SOURCE_TYPE_STYLE_SCHEME)
<< get_defs (GTK_SOURCE_TYPE_STYLE_SCHEME_MANAGER)
diff --git a/codegen/m4/convert_gtksourceview.m4 b/codegen/m4/convert_gtksourceview.m4
index d160f6b..1ea4cde 100644
--- a/codegen/m4/convert_gtksourceview.m4
+++ b/codegen/m4/convert_gtksourceview.m4
@@ -91,6 +91,14 @@ _CONVERSION(`'GtkSourceMarkAttributes*,`Glib::RefPtr<MarkAttributes>',`Glib::wra
_CONVERSION(`const Glib::RefPtr<MarkAttributes>&',`GtkSourceMarkAttributes*',`Glib::unwrap($3)')
+# GtkSourceSearchSettings -> Gsv::SearchSettings
+_CONVERSION(`GtkSourceSearchSettings*',`Glib::RefPtr<SearchSettings>',`Glib::wrap($3)')
+
+
+# Gsv::SearchSettings -> GtkSourceSearchSettings
+_CONVERSION(`const Glib::RefPtr<SearchSettings>&',`GtkSourceSearchSettings*',`Glib::unwrap($3)')
+
+
# GtkSourceStyle -> Gsv::Style
_CONVERSION(`GtkSourceStyle*',`Glib::RefPtr<Style>',`Glib::wrap($3)')
diff --git a/gtksourceview/gtksourceviewmm.h b/gtksourceview/gtksourceviewmm.h
index 346f9b7..377b0a3 100644
--- a/gtksourceview/gtksourceviewmm.h
+++ b/gtksourceview/gtksourceviewmm.h
@@ -192,6 +192,7 @@
#include <gtksourceviewmm/markattributes.h>
#include <gtksourceviewmm/markup.h>
#include <gtksourceviewmm/printcompositor.h>
+#include <gtksourceviewmm/searchsettings.h>
#include <gtksourceviewmm/style.h>
#include <gtksourceviewmm/stylescheme.h>
#include <gtksourceviewmm/styleschememanager.h>
diff --git a/gtksourceview/src/filelist.am b/gtksourceview/src/filelist.am
index 8f9f1e2..4430a74 100644
--- a/gtksourceview/src/filelist.am
+++ b/gtksourceview/src/filelist.am
@@ -27,6 +27,7 @@ files_hg = \
mark.hg \
markattributes.hg \
printcompositor.hg \
+ searchsettings.hg \
style.hg \
stylescheme.hg \
styleschememanager.hg \
diff --git a/gtksourceview/src/searchsettings.ccg b/gtksourceview/src/searchsettings.ccg
new file mode 100644
index 0000000..a644b41
--- /dev/null
+++ b/gtksourceview/src/searchsettings.ccg
@@ -0,0 +1,20 @@
+/* searchsettings.cc
+ *
+ * Copyright (C) 2015 Christoph Brill
+ *
+ * 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 <gtksourceview/gtksourcesearchsettings.h>
\ No newline at end of file
diff --git a/gtksourceview/src/searchsettings.hg b/gtksourceview/src/searchsettings.hg
new file mode 100644
index 0000000..e9a5387
--- /dev/null
+++ b/gtksourceview/src/searchsettings.hg
@@ -0,0 +1,130 @@
+/* searchsettings.h
+ *
+ * Copyright (C) 2015 Christoph Brill
+ *
+ * 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 <gtksourceview/gtksourcesearchsettings.h>
+
+_DEFS(gtksourceviewmm,gtksourceview)
+_PINCLUDE(glibmm/private/object_p.h)
+
+namespace Gsv
+{
+
+/** A GtkSourceSearchSettings object represents the settings of a search. The search settings can be
associated with one or
+ * several GtkSourceSearchContexts.
+ *
+ * @newin{3,10}
+ */
+class SearchSettings : public Glib::Object
+{
+ _CLASS_GOBJECT(SearchSettings, GtkSourceSearchSettings, GTK_SOURCE_SEARCH_SETTINGS, Glib::Object, GObject)
+public:
+ _CTOR_DEFAULT()
+
+ /** Sets the text to search. If text is NULL or is empty, the search will be disabled. A copy of text will
be made, so
+ * you can safely free text after a call to this function.
+ *
+ * You may be interested to call gtk_source_utils_unescape_search_text() before this function.
+ *
+ * @param search_text the nul-terminated text to search, or NULL to disable the search.
+ *
+ * @newin{3,10}
+ */
+ _WRAP_METHOD(void set_search_text(const Glib::ustring& search_text),
gtk_source_search_settings_set_search_text)
+
+ /** Gets the text to search. The return value must not be freed.
+ *
+ * You may be interested to call gtk_source_utils_escape_search_text() after this function.
+ *
+ * @return the text to search, or NULL if the search is disabled.
+ *
+ * @newin{3,10}
+ */
+ _WRAP_METHOD(Glib::ustring get_search_text(), gtk_source_search_settings_get_search_text)
+
+ /** Enables or disables the case sensitivity for the search.
+ *
+ * @param case_sensitive the setting.
+ *
+ * @newin{3,10}
+ */
+ _WRAP_METHOD(void set_case_sensitive(bool case_sensitive), gtk_source_search_settings_set_case_sensitive)
+
+ /**
+ * @return whether the search is case sensitive.
+ *
+ * @newin{3,10}
+ */
+ _WRAP_METHOD(bool get_case_sensitive(), gtk_source_search_settings_get_case_sensitive)
+
+ /** Change whether the search is done at word boundaries. If at_word_boundaries is TRUE, a search match
must start and end
+ * a word. The match can span multiple words. See also gtk_text_iter_starts_word() and
gtk_text_iter_ends_word().
+ *
+ * @param at_word_boundaries the setting.
+ *
+ * @newin{3,10}
+ */
+ _WRAP_METHOD(void set_at_word_boundaries(bool at_word_boundaries),
gtk_source_search_settings_set_at_word_boundaries)
+
+ /**
+ * @return whether to search at word boundaries.
+ *
+ * @newin{3,10}
+ */
+ _WRAP_METHOD(bool get_at_word_boundaries(), gtk_source_search_settings_get_at_word_boundaries)
+
+ /** Enables or disables the wrap around search. If wrap_around is TRUE, the forward search continues at
the beginning of the
+ * buffer if no search occurrences are found. Similarly, the backward search continues to search at the
end of the buffer.
+ *
+ * @param wrap_around the setting.
+ *
+ * @newin{3,10}
+ */
+ _WRAP_METHOD(void set_wrap_around(bool wrap_around), gtk_source_search_settings_set_wrap_around)
+
+ /**
+ * @return whether to wrap around the search.
+ *
+ * @newin{3,10}
+ */
+ _WRAP_METHOD(bool get_wrap_around(), gtk_source_search_settings_get_wrap_around)
+
+ /** Enables or disables whether to search by regular expressions. If enabled, the "search-text" property
contains the pattern of
+ * the regular expression.
+ *
+ * @param regex_enabled the setting.
+ *
+ * @newin{3,10}
+ */
+ _WRAP_METHOD(void set_regex_enabled(bool regex_enabled), gtk_source_search_settings_set_regex_enabled)
+
+ /**
+ * @param whether to search by regular expressions.
+ *
+ * @newin{3,10}
+ */
+ _WRAP_METHOD(bool get_regex_enabled(), gtk_source_search_settings_get_regex_enabled)
+ _WRAP_PROPERTY("at-word-boundaries", bool)
+ _WRAP_PROPERTY("case-sensitive", bool)
+ _WRAP_PROPERTY("regex-enabled", bool)
+ _WRAP_PROPERTY("search-text", Glib::ustring)
+ _WRAP_PROPERTY("wrap-around", bool)
+
+};
+
+} /* namespace Gsv */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]