lists.geany.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
List overview
Plugins-Commits
May 2013
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
plugins-commits@lists.geany.org
1 participants
26 discussions
Start a n
N
ew thread
[geany/geany-plugins] a4ceb9: scope - fixed config reload, last version before Registers
by Dimitar Zhekov
17 May '13
17 May '13
Branch: refs/heads/master Author: Dimitar Zhekov <dimitar.zhekov(a)gmail.com> Committer: Dimitar Zhekov <dimitar.zhekov(a)gmail.com> Date: Fri, 17 May 2013 17:21:14 UTC Commit: a4ceb98ae1dffee440bd24f4ab62a9720820acc6
https://github.com/geany/geany-plugins/commit/a4ceb98ae1dffee440bd24f4ab62a…
Log Message: ----------- scope - fixed config reload, last version before Registers Modified Paths: -------------- scope/ChangeLog scope/NEWS scope/src/prefs.c scope/src/program.c Modified: scope/ChangeLog 10 files changed, 10 insertions(+), 0 deletions(-) =================================================================== @@ -1,3 +1,13 @@ +2013-05-17 Dimitar Zhekov <dimitar.zhekov(a)gmail.com> + + * scope/src/prefs.c: + Fixed config reload when a file other than scope.conf is saved. + * src/program.c: + Use scp_tree_store_traverse() to search recent programs. + * docs/scope.html, src/scope.c: + Increased version to 0.89. + + 2013-05-16 Dimitar Zhekov <dimitar.zhekov(a)gmail.com> * src/store/ChangeLog: Modified: scope/NEWS 9 files changed, 8 insertions(+), 1 deletions(-) =================================================================== @@ -1,6 +1,13 @@ +Scope 0.89 (2013-05-17) + + * Small fixes and improvements. This should be the last version + before a Registers view is added. + + Scope 0.87 (2013-04-14) - * Switched to ScpTreeStore. + * Performance improvements for large Inspect tree and large number + of Threads, Breakpoints etc. * Added GTK+ 3 support. Modified: scope/src/prefs.c 2 files changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -203,7 +203,7 @@ static void on_document_save(G_GNUC_UNUSED GObject *obj, GeanyDocument *doc, { char *configfile = prefs_file_name(); - if (doc->real_path && utils_filenamecmp(doc->real_path, configfile)) + if (doc->real_path && !utils_filenamecmp(doc->real_path, configfile)) { GKeyFile *config = g_key_file_new(); Modified: scope/src/program.c 20 files changed, 7 insertions(+), 13 deletions(-) =================================================================== @@ -135,23 +135,17 @@ static char *recent_file_name(gint id) gboolean program_temp_breakpoint; gchar *program_temp_break_location; -static gboolean program_find(GtkTreeIter *iter, const char *name) +static gint program_compare(ScpTreeStore *store, GtkTreeIter *iter, const char *name) { - gboolean valid = scp_tree_store_get_iter_first(recent_programs, iter); + const char *name1; - while (valid) - { - const char *name1; - - scp_tree_store_get(recent_programs, iter, PROGRAM_NAME, &name1, -1); - if (!utils_filenamecmp(name1, name)) - break; - valid = scp_tree_store_iter_next(recent_programs, iter); - } - - return valid; + scp_tree_store_get(store, iter, PROGRAM_NAME, &name1, -1); + return !utils_filenamecmp(name1, name); } +#define program_find(iter, name) scp_tree_store_traverse(recent_programs, FALSE, (iter), \ + NULL, (ScpTreeStoreTraverseFunc) program_compare, (gpointer) (name)) + static void save_program_settings(void) { const gchar *program_name = *program_executable ? program_executable : -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany-plugins] a4ceb9: scope - fixed config reload, last version before Registers
by Dimitar Zhekov
17 May '13
17 May '13
Branch: refs/heads/master Author: Dimitar Zhekov <dimitar.zhekov(a)gmail.com> Committer: Dimitar Zhekov <dimitar.zhekov(a)gmail.com> Date: Fri, 17 May 2013 17:21:14 UTC Commit: a4ceb98ae1dffee440bd24f4ab62a9720820acc6
https://github.com/geany/geany-plugins/commit/a4ceb98ae1dffee440bd24f4ab62a…
Log Message: ----------- scope - fixed config reload, last version before Registers Modified Paths: -------------- scope/ChangeLog scope/NEWS scope/src/prefs.c scope/src/program.c Modified: scope/ChangeLog 10 files changed, 10 insertions(+), 0 deletions(-) =================================================================== @@ -1,3 +1,13 @@ +2013-05-17 Dimitar Zhekov <dimitar.zhekov(a)gmail.com> + + * scope/src/prefs.c: + Fixed config reload when a file other than scope.conf is saved. + * src/program.c: + Use scp_tree_store_traverse() to search recent programs. + * docs/scope.html, src/scope.c: + Increased version to 0.89. + + 2013-05-16 Dimitar Zhekov <dimitar.zhekov(a)gmail.com> * src/store/ChangeLog: Modified: scope/NEWS 9 files changed, 8 insertions(+), 1 deletions(-) =================================================================== @@ -1,6 +1,13 @@ +Scope 0.89 (2013-05-17) + + * Small fixes and improvements. This should be the last version + before a Registers view is added. + + Scope 0.87 (2013-04-14) - * Switched to ScpTreeStore. + * Performance improvements for large Inspect tree and large number + of Threads, Breakpoints etc. * Added GTK+ 3 support. Modified: scope/src/prefs.c 2 files changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -203,7 +203,7 @@ static void on_document_save(G_GNUC_UNUSED GObject *obj, GeanyDocument *doc, { char *configfile = prefs_file_name(); - if (doc->real_path && utils_filenamecmp(doc->real_path, configfile)) + if (doc->real_path && !utils_filenamecmp(doc->real_path, configfile)) { GKeyFile *config = g_key_file_new(); Modified: scope/src/program.c 20 files changed, 7 insertions(+), 13 deletions(-) =================================================================== @@ -135,23 +135,17 @@ static char *recent_file_name(gint id) gboolean program_temp_breakpoint; gchar *program_temp_break_location; -static gboolean program_find(GtkTreeIter *iter, const char *name) +static gint program_compare(ScpTreeStore *store, GtkTreeIter *iter, const char *name) { - gboolean valid = scp_tree_store_get_iter_first(recent_programs, iter); + const char *name1; - while (valid) - { - const char *name1; - - scp_tree_store_get(recent_programs, iter, PROGRAM_NAME, &name1, -1); - if (!utils_filenamecmp(name1, name)) - break; - valid = scp_tree_store_iter_next(recent_programs, iter); - } - - return valid; + scp_tree_store_get(store, iter, PROGRAM_NAME, &name1, -1); + return !utils_filenamecmp(name1, name); } +#define program_find(iter, name) scp_tree_store_traverse(recent_programs, FALSE, (iter), \ + NULL, (ScpTreeStoreTraverseFunc) program_compare, (gpointer) (name)) + static void save_program_settings(void) { const gchar *program_name = *program_executable ? program_executable : -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany-plugins] d3b344: scope - added scp_tree_store_traverse()
by Dimitar Zhekov
16 May '13
16 May '13
Branch: refs/heads/master Author: Dimitar Zhekov <dimitar.zhekov(a)gmail.com> Committer: Dimitar Zhekov <dimitar.zhekov(a)gmail.com> Date: Thu, 16 May 2013 18:12:25 UTC Commit: d3b344de660620ce85847b1ed72a75587735d485
https://github.com/geany/geany-plugins/commit/d3b344de660620ce85847b1ed72a7…
Log Message: ----------- scope - added scp_tree_store_traverse() Modified Paths: -------------- scope/ChangeLog scope/src/store/ChangeLog scope/src/store/scptreestore.c scope/src/store/scptreestore.h scope/src/store/scptreestore.html scope/src/views.c scope/src/views.h Modified: scope/ChangeLog 8 files changed, 7 insertions(+), 1 deletions(-) =================================================================== @@ -1,3 +1,9 @@ +2013-05-16 Dimitar Zhekov <dimitar.zhekov(a)gmail.com> + + * src/store/ChangeLog: + Separate change log for ScpTreeStore - initial release. + + 2013-05-08 Dimitar Zhekov <dimitar.zhekov(a)gmail.com> * src/conterm.c: @@ -8,7 +14,7 @@ * src/view.c: Small improvements. * docs/scope.html, src/scope.c: - Increased version to 0.87. + Increased version to 0.88. 2013-05-04 Dimitar Zhekov <dimitar.zhekov(a)gmail.com> Modified: scope/src/store/ChangeLog 9 files changed, 9 insertions(+), 0 deletions(-) =================================================================== @@ -0,0 +1,9 @@ +2013-05-16 Dimitar Zhekov <dimitar.zhekov(a)gmail.com> + + * scptreestore.c, scptreestore.h: + Added scp_tree_store_traverse(). + Moved scp_tree_store_iter_tell() from Extra to Store, it's required + to insert before/after and move. + * scptreestore.html: + Documentation and speed test results for scp_tree_store_traverse(). + Increased version to 0.84. Modified: scope/src/store/scptreestore.c 84 files changed, 75 insertions(+), 9 deletions(-) =================================================================== @@ -821,6 +821,15 @@ void scp_tree_store_move(ScpTreeStore *store, GtkTreeIter *iter, gint position) scp_move_element(store, array, iter, position, TRUE); } +gint scp_tree_store_iter_tell(VALIDATE_ONLY ScpTreeStore *store, GtkTreeIter *iter) +{ + g_return_val_if_fail(SCP_IS_TREE_STORE(store), -1); + g_return_val_if_fail(VALID_ITER(iter, store), -1); + g_return_val_if_fail((guint) ITER_INDEX(iter) < ITER_ARRAY(iter)->len, -1); + + return ITER_INDEX(iter); +} + /* Model */ static gint scp_ptr_array_find(GPtrArray *array, AElem *elem) @@ -1531,15 +1540,6 @@ gboolean scp_tree_store_iter_seek(VALIDATE_ONLY ScpTreeStore *store, GtkTreeIter return TRUE; } -gint scp_tree_store_iter_tell(VALIDATE_ONLY ScpTreeStore *store, GtkTreeIter *iter) -{ - g_return_val_if_fail(SCP_IS_TREE_STORE(store), -1); - g_return_val_if_fail(VALID_ITER(iter, store), -1); - g_return_val_if_fail((guint) ITER_INDEX(iter) < ITER_ARRAY(iter)->len, -1); - - return ITER_INDEX(iter); -} - static gint scp_collate_data(const gchar *key, const gchar *data) { gchar *key1 = g_utf8_collate_key(data, -1); @@ -1663,6 +1663,72 @@ gboolean scp_tree_store_search(ScpTreeStore *store, gboolean sublevels, gboolean return found; } +static gboolean scp_traverse(ScpTreeStore *store, GPtrArray *array, GtkTreeIter *iter, + gboolean sublevels, ScpTreeStoreTraverseFunc func, gpointer gdata) +{ + if (array) + { + guint i = 0; + + iter->user_data = array; + iter->user_data2 = GINT_TO_POINTER(0); + + while (i < array->len) + { + gint result = func(store, iter, gdata); + + if (result > 0) + return TRUE; + + if (!result) + { + if (sublevels) + { + if (scp_traverse(store, ((AElem *) array->pdata[i])->children, + iter, TRUE, func, gdata) > 0) + { + return TRUE; + } + + iter->user_data = array; + } + + iter->user_data2 = GINT_TO_POINTER(++i); + } + else + scp_tree_store_remove(store, iter); + } + } + + return FALSE; +} + +gboolean scp_tree_store_traverse(ScpTreeStore *store, gboolean sublevels, GtkTreeIter *iter, + GtkTreeIter *parent, ScpTreeStoreTraverseFunc func, gpointer gdata) +{ + ScpTreeStorePrivate *priv = store->priv; + GtkTreeIter iter1; + + g_return_val_if_fail(SCP_IS_TREE_STORE(store), FALSE); + g_return_val_if_fail(VALID_ITER_OR_NULL(parent, store), FALSE); + g_return_val_if_fail(sublevels == FALSE || priv->sublevels == TRUE, FALSE); + g_return_val_if_fail(func != NULL, FALSE); + + if (!iter) + iter = &iter1; + + iter->stamp = priv->stamp; + + if (!scp_traverse(store, (parent ? ITER_ELEM(parent) : priv->root)->children, iter, + sublevels, func, gdata)) + { + iter->stamp = 0; + return FALSE; + } + + return TRUE; +} + /* Class */ static void scp_tree_store_tree_model_init(GtkTreeModelIface *iface) Modified: scope/src/store/scptreestore.h 6 files changed, 5 insertions(+), 1 deletions(-) =================================================================== @@ -98,6 +98,7 @@ void scp_tree_store_clear_children(ScpTreeStore *store, GtkTreeIter *parent, void scp_tree_store_reorder(ScpTreeStore *store, GtkTreeIter *parent, gint *new_order); void scp_tree_store_swap(ScpTreeStore *store, GtkTreeIter *a, GtkTreeIter *b); void scp_tree_store_move(ScpTreeStore *store, GtkTreeIter *iter, gint position); +gint scp_tree_store_iter_tell(ScpTreeStore *store, GtkTreeIter *iter); /* Model */ GtkTreeModelFlags scp_tree_store_get_flags(ScpTreeStore *store); @@ -149,9 +150,12 @@ void scp_tree_store_set_allocation(ScpTreeStore *store, guint toplevel_reserved, gint scp_tree_store_compare_func(ScpTreeStore *store, GtkTreeIter *a, GtkTreeIter *b, gpointer data); gboolean scp_tree_store_iter_seek(ScpTreeStore *store, GtkTreeIter *iter, gint position); -gint scp_tree_store_iter_tell(ScpTreeStore *store, GtkTreeIter *iter); gboolean scp_tree_store_search(ScpTreeStore *store, gboolean sublevels, gboolean linear_order, GtkTreeIter *iter, GtkTreeIter *parent, gint column, ...); +typedef gint (*ScpTreeStoreTraverseFunc)(ScpTreeStore *store, GtkTreeIter *iter, + gpointer gdata); +gboolean scp_tree_store_traverse(ScpTreeStore *store, gboolean sublevels, GtkTreeIter *iter, + GtkTreeIter *parent, ScpTreeStoreTraverseFunc func, gpointer gdata); G_END_DECLS Modified: scope/src/store/scptreestore.html 65 files changed, 55 insertions(+), 10 deletions(-) =================================================================== @@ -55,9 +55,9 @@ #include "scptreestore.h"</p> <p>/* Store */<br> -ScpTreeStore *<a href="scp_tree_store_new">scp_tree_store_new</a>(gboolean sublevels, gint +ScpTreeStore *<a href="#scp_tree_store_new">scp_tree_store_new</a>(gboolean sublevels, gint n_columns, ...);<br> -ScpTreeStore *<a href="scp_tree_store_newv">scp_tree_store_newv</a>(gboolean sublevels, gint +ScpTreeStore *<a href="#scp_tree_store_newv">scp_tree_store_newv</a>(gboolean sublevels, gint n_columns, GType *types);<br> gboolean scp_tree_store_set_column_types(ScpTreeStore *store, gint n_columns, GType *types);<br> #define scp_tree_store_set_utf8_collate(store, utf8_collate) @@ -85,16 +85,16 @@ *parent, gint position, ...);<br> #define scp_tree_store_prepend_with_values(store, iter, parent, ...)<br> #define scp_tree_store_append_with_values(store, iter, parent, ...)<br> -void <a href="scp_tree_store_get_valist">scp_tree_store_get_valist</a>(ScpTreeStore *store, +void <a href="#scp_tree_store_get_valist">scp_tree_store_get_valist</a>(ScpTreeStore *store, GtkTreeIter *iter, va_list var_args);<br> -void <a href="scp_tree_store_get">scp_tree_store_get</a>(ScpTreeStore *store, GtkTreeIter +void <a href="#scp_tree_store_get">scp_tree_store_get</a>(ScpTreeStore *store, GtkTreeIter *iter, ...);<br> gboolean scp_tree_store_is_ancestor(ScpTreeStore *store, GtkTreeIter *iter, GtkTreeIter *descendant);<br> gint scp_tree_store_iter_depth(ScpTreeStore *store, GtkTreeIter *iter);<br> -void <a href="scp_tree_store_clear_children">scp_tree_store_clear_children</a>(ScpTreeStore +void <a href="#scp_tree_store_clear_children">scp_tree_store_clear_children</a>(ScpTreeStore *store, GtkTreeIter *parent, gboolean emit_subsignals);<br> -#define <a href="scp_tree_store_clear">scp_tree_store_clear(store)</a><br> +#define <a href="#scp_tree_store_clear">scp_tree_store_clear(store)</a><br> gboolean scp_tree_store_iter_is_valid(ScpTreeStore *store, GtkTreeIter *iter);<br> void scp_tree_store_reorder(ScpTreeStore *store, GtkTreeIter *parent, gint *new_order);<br> void scp_tree_store_swap(ScpTreeStore *store, GtkTreeIter *a, GtkTreeIter *b);<br> @@ -148,7 +148,7 @@ </p> <p>/* Extra */<br> -void <a href="scp_tree_store_set_allocation">scp_tree_store_set_allocation</a>(ScpTreeStore +void <a href="#scp_tree_store_set_allocation">scp_tree_store_set_allocation</a>(ScpTreeStore *store, guint toplevel_reserved, guint sublevel_reserved, gboolean sublevel_discard);<br> gint <a href="#scp_tree_store_compare_func">scp_tree_store_compare_func</a>(ScpTreeStore *store, GtkTreeIter *a, GtkTreeIter *b, gpointer data);<br> @@ -157,7 +157,12 @@ gint scp_tree_store_iter_tell(ScpTreeStore *store, GtkTreeIter *iter);<br> gboolean <a href="#scp_tree_store_search">scp_tree_store_search</a>(ScpTreeStore *store, gboolean sublevels, gboolean linear_order, GtkTreeIter *iter, GtkTreeIter *parent, gint column, -...); +...);<br> +typedef gint (*<a href="#ScpTreeStoreTraverseFunc">ScpTreeStoreTraverseFunc</a>)(ScpTreeStore +*store, GtkTreeIter *iter, gpointer gdata);<br> +gboolean <a href="#scp_tree_store_traverse">scp_tree_store_traverse</a>(ScpTreeStore *store, +gboolean sublevels, GtkTreeIter *iter, GtkTreeIter *parent, ScpTreeStoreTraverseFunc func, +gpointer gdata); </p> <hr> @@ -331,6 +336,30 @@ compare function is ignored, because it requires an iterator, not a value. For string columns, utf8_collate is taken into account.</p> +<h3><a name="ScpTreeStoreTraverseFunc">ScpTreeStoreTraverseFunc()</a></h3> + +<p><b>gint ScpTreeStoreTraverseFunc(ScpTreeStore *store, GtkTreeIter *iter, gpointer gdata); +</b></p> + +<div>The callback function type for scp_tree_store_traverse(). Return values:</div> +<div class="tab"><tt>TRUE</tt> (or another positive value): stop iterating<br> +<tt>FALSE</tt>: continue iterating<br> +<tt>-1</tt> (or another negative value): remove the current element and continue.</div> + +<h3><a name="scp_tree_store_traverse">scp_tree_store_traverse()</a></h3> + +<p><b>gboolean scp_tree_store_traverse(ScpTreeStore *store, gboolean sublevels, GtkTreeIter +*iter, GtkTreeIter *parent, ScpTreeStoreTraverseFunc func, gpointer gdata);</b></p> + +<div>Traverse the rows under parent.</div> +<div class="tab">iter: optional, may be NULL<br> +parent = NULL: traverse the top-level rows.</div> +<br> +<div>Return values:</div> +<div class="tab"><tt>TRUE</tt> and valid iter if func returns <tt>TRUE</tt> (or +another positive value)<br> +<tt>FALSE</tt> and invalid iter otherwise.</div><br> + <hr> <h3><a name="properties">Properties</a></h3> @@ -404,6 +433,8 @@ <tr><td>top-level iter search string</td><td>25</td><td>0.003</td><td>0.002</td><td>25</td></tr> <tr><td>top-level linear search double</td><td>25</td><td>n/a</td><td>0.000</td><td>25</td></tr> <tr><td>top-level linear search string</td><td>25</td><td>n/a</td><td>0.001</td><td>25</td></tr> +<tr><td>both levels model foreach</td><td>25</td><td>0.000</td><td>0.000</td><td>25</td></tr> +<tr><td>both levels store traverse</td><td>25</td><td>n/a</td><td>0.000</td><td>25</td></tr> <tr><td>top-level quick sort double</td><td>25</td><td>0.000</td><td>0.000</td><td></td></tr> <tr><td>top-level quick sort string</td><td>25</td><td>0.001</td><td>0.000</td><td></td></tr> <tr><td>sublevel 1 insert</td><td>25</td><td>0.000</td><td>0.000</td><td></td></tr> @@ -422,6 +453,8 @@ <tr><td>top-level iter search string</td><td>100</td><td>0.034</td><td>0.027</td><td>100</td></tr> <tr><td>top-level linear search double</td><td>100</td><td>n/a</td><td>0.000</td><td>100</td></tr> <tr><td>top-level linear search string</td><td>100</td><td>n/a</td><td>0.015</td><td>100</td></tr> +<tr><td>both levels model foreach</td><td>100</td><td>0.003</td><td>0.003</td><td>100</td></tr> +<tr><td>both levels store traverse</td><td>100</td><td>n/a</td><td>0.000</td><td>100</td></tr> <tr><td>top-level quick sort double</td><td>100</td><td>0.000</td><td>0.000</td><td></td></tr> <tr><td>top-level quick sort string</td><td>100</td><td>0.003</td><td>0.002</td><td></td></tr> <tr><td>sublevel 1 insert</td><td>100</td><td>0.000</td><td>0.000</td><td></td></tr> @@ -440,6 +473,8 @@ <tr><td>top-level iter search string</td><td>250</td><td>0.224</td><td>0.183</td><td>250</td></tr> <tr><td>top-level linear search double</td><td>250</td><td>n/a</td><td>0.001</td><td>250</td></tr> <tr><td>top-level linear search string</td><td>250</td><td>n/a</td><td>0.109</td><td>250</td></tr> +<tr><td>both levels model foreach</td><td>250</td><td>0.018</td><td>0.018</td><td>250</td></tr> +<tr><td>both levels store traverse</td><td>250</td><td>n/a</td><td>0.001</td><td>250</td></tr> <tr><td>top-level quick sort double</td><td>250</td><td>0.001</td><td>0.000</td><td></td></tr> <tr><td>top-level quick sort string</td><td>250</td><td>0.009</td><td>0.008</td><td></td></tr> <tr><td>sublevel 1 insert</td><td>250</td><td>0.001</td><td>0.001</td><td></td></tr> @@ -449,7 +484,7 @@ <tr><td>sublevel 1 quick sort double</td><td>250</td><td>0.002</td><td>0.000</td><td></td></tr> <tr><td>sublevel 1 quick sort string</td><td>250</td><td>0.015</td><td>0.012</td><td></td></tr> -<tr><td> </td><td>500</td><td></td><td></td><td></td></tr> +<tr><td> </td><td></td><td></td><td></td><td></td></tr> <tr><td>top-level insert</td><td>500</td><td>0.002</td><td>0.002</td><td></td></tr> <tr><td>top-level set</td><td>500</td><td>0.003</td><td>0.002</td><td></td></tr> <tr><td>top-level remove</td><td>500</td><td>0.002</td><td>0.001</td><td></td></tr> @@ -458,6 +493,8 @@ <tr><td>top-level iter search string</td><td>500</td><td>0.909</td><td>0.722</td><td>500</td></tr> <tr><td>top-level linear search double</td><td>500</td><td>n/a</td><td>0.005</td><td>500</td></tr> <tr><td>top-level linear search string</td><td>500</td><td>n/a</td><td>0.443</td><td>500</td></tr> +<tr><td>both levels model foreach</td><td>500</td><td>0.077</td><td>0.076</td><td>500</td></tr> +<tr><td>both levels store traverse</td><td>500</td><td>n/a</td><td>0.003</td><td>500</td></tr> <tr><td>top-level quick sort double</td><td>500</td><td>0.003</td><td>0.001</td><td></td></tr> <tr><td>top-level quick sort string</td><td>500</td><td>0.022</td><td>0.018</td><td></td></tr> <tr><td>sublevel 1 insert</td><td>500</td><td>0.002</td><td>0.002</td><td></td></tr> @@ -476,6 +513,8 @@ <tr><td>top-level iter search string</td><td>1000</td><td>0.370</td><td>0.273</td><td>100</td></tr> <tr><td>top-level linear search double</td><td>1000</td><td>n/a</td><td>0.002</td><td>100</td></tr> <tr><td>top-level linear search string</td><td>1000</td><td>n/a</td><td>0.182</td><td>100</td></tr> +<tr><td>both levels model foreach</td><td>1000</td><td>0.033</td><td>0.030</td><td>100</td></tr> +<tr><td>both levels store traverse</td><td>1000</td><td>n/a</td><td>0.001</td><td>100</td></tr> <tr><td>top-level quick sort double</td><td>1000</td><td>0.007</td><td>0.002</td><td></td></tr> <tr><td>top-level quick sort string</td><td>1000</td><td>0.050</td><td>0.040</td><td></td></tr> <tr><td>sublevel 1 insert</td><td>1000</td><td>0.006</td><td>0.004</td><td></td></tr> @@ -494,6 +533,8 @@ <tr><td>top-level iter search string</td><td>2500</td><td>2.273</td><td>1.859</td><td>250</td></tr> <tr><td>top-level linear search double</td><td>2500</td><td>n/a</td><td>0.015</td><td>250</td></tr> <tr><td>top-level linear search string</td><td>2500</td><td>n/a</td><td>1.137</td><td>250</td></tr> +<tr><td>both levels model foreach</td><td>2500</td><td>0.182</td><td>0.188</td><td>250</td></tr> +<tr><td>both levels store traverse</td><td>2500</td><td>n/a</td><td>0.009</td><td>250</td></tr> <tr><td>top-level quick sort double</td><td>2500</td><td>0.021</td><td>0.004</td><td></td></tr> <tr><td>top-level quick sort string</td><td>2500</td><td>0.146</td><td>0.117</td><td></td></tr> <tr><td>sublevel 1 insert</td><td>2500</td><td>0.035</td><td>0.014</td><td></td></tr> @@ -512,6 +553,8 @@ <tr><td>top-level iter search string</td><td>5000</td><td>8.775</td><td>7.787</td><td>500</td></tr> <tr><td>top-level linear search double</td><td>5000</td><td>n/a</td><td>0.060</td><td>500</td></tr> <tr><td>top-level linear search string</td><td>5000</td><td>n/a</td><td>4.351</td><td>500</td></tr> +<tr><td>both levels model foreach</td><td>5000</td><td>0.741</td><td>0.754</td><td>500</td></tr> +<tr><td>both levels store traverse</td><td>5000</td><td>n/a</td><td>0.042</td><td>500</td></tr> <tr><td>top-level quick sort double</td><td>5000</td><td>0.046</td><td>0.010</td><td></td></tr> <tr><td>top-level quick sort string</td><td>5000</td><td>0.325</td><td>0.264</td><td></td></tr> <tr><td>sublevel 1 insert</td><td>5000</td><td>0.168</td><td>0.040</td><td></td></tr> @@ -530,6 +573,8 @@ <tr><td>top-level iter search string</td><td>10000</td><td>37.555</td><td>31.020</td><td>1000</td></tr> <tr><td>top-level linear search double</td><td>10000</td><td>n/a</td><td>0.304</td><td>1000</td></tr> <tr><td>top-level linear search string</td><td>10000</td><td>n/a</td><td>18.896</td><td>1000</td></tr> +<tr><td>both levels model foreach</td><td>10000</td><td>2.969</td><td>3.136</td><td>1000</td></tr> +<tr><td>both levels store traverse</td><td>10000</td><td>n/a</td><td>0.238</td><td>1000</td></tr> <tr><td>top-level quick sort double</td><td>10000</td><td>0.112</td><td>0.022</td><td></td></tr> <tr><td>top-level quick sort string</td><td>10000</td><td>0.720</td><td>0.580</td><td></td></tr> <tr><td>sublevel 1 insert</td><td>10000</td><td>1.152</td><td>0.132</td><td></td></tr> @@ -647,7 +692,7 @@ <p>ScpTreeStore was initially written for the Scope plugin of Geany light IDE, which relies heavily on stores.</p> -<p><b>ScpTreeStore 0.83, Copyright (C) 2013 Dimitar Toshkov Zhekov</b></p> +<p><b>ScpTreeStore 0.84, Copyright (C) 2013 Dimitar Toshkov Zhekov</b></p> <p>ScpTreeStore is distributed under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any Modified: scope/src/views.c 6 files changed, 3 insertions(+), 3 deletions(-) =================================================================== @@ -263,7 +263,7 @@ static void on_display_editing_started(G_GNUC_UNUSED GtkCellRenderer *cell, } GtkTreeView *view_connect(const char *name, ScpTreeStore **store, GtkTreeSelection **selection, - const TreeCell *cell_info, const char *window, GObject **display) + const TreeCell *cell_info, const char *window, GObject **display_cell) { guint i; GtkScrolledWindow *scrolled = GTK_SCROLLED_WINDOW(get_widget(window)); @@ -284,11 +284,11 @@ GtkTreeView *view_connect(const char *name, ScpTreeStore **store, GtkTreeSelecti g_signal_connect(cell, "editing-started", G_CALLBACK(on_editing_started), hadjustment); - if (display && i == 0) + if (display_cell && i == 0) { g_signal_connect(cell, "editing-started", G_CALLBACK(on_display_editing_started), *store); - *display = G_OBJECT(cell); + *display_cell = G_OBJECT(cell); } } else Modified: scope/src/views.h 2 files changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -64,7 +64,7 @@ enum GtkTreeView *view_create(const char *name, ScpTreeStore **store, GtkTreeSelection **selection); GtkTreeView *view_connect(const char *name, ScpTreeStore **store, GtkTreeSelection **selection, - const TreeCell *cell_info, const char *window, GObject **display); + const TreeCell *cell_info, const char *window, GObject **display_cell); /* note: 2 references to column */ #define view_set_sort_func(store, column, compare) \ scp_tree_store_set_sort_func((store), (column), (GtkTreeIterCompareFunc) (compare), \ -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany-plugins] d3b344: scope - added scp_tree_store_traverse()
by Dimitar Zhekov
16 May '13
16 May '13
Branch: refs/heads/master Author: Dimitar Zhekov <dimitar.zhekov(a)gmail.com> Committer: Dimitar Zhekov <dimitar.zhekov(a)gmail.com> Date: Thu, 16 May 2013 18:12:25 UTC Commit: d3b344de660620ce85847b1ed72a75587735d485
https://github.com/geany/geany-plugins/commit/d3b344de660620ce85847b1ed72a7…
Log Message: ----------- scope - added scp_tree_store_traverse() Modified Paths: -------------- scope/ChangeLog scope/src/store/ChangeLog scope/src/store/scptreestore.c scope/src/store/scptreestore.h scope/src/store/scptreestore.html scope/src/views.c scope/src/views.h Modified: scope/ChangeLog 8 files changed, 7 insertions(+), 1 deletions(-) =================================================================== @@ -1,3 +1,9 @@ +2013-05-16 Dimitar Zhekov <dimitar.zhekov(a)gmail.com> + + * src/store/ChangeLog: + Separate change log for ScpTreeStore - initial release. + + 2013-05-08 Dimitar Zhekov <dimitar.zhekov(a)gmail.com> * src/conterm.c: @@ -8,7 +14,7 @@ * src/view.c: Small improvements. * docs/scope.html, src/scope.c: - Increased version to 0.87. + Increased version to 0.88. 2013-05-04 Dimitar Zhekov <dimitar.zhekov(a)gmail.com> Modified: scope/src/store/ChangeLog 9 files changed, 9 insertions(+), 0 deletions(-) =================================================================== @@ -0,0 +1,9 @@ +2013-05-16 Dimitar Zhekov <dimitar.zhekov(a)gmail.com> + + * scptreestore.c, scptreestore.h: + Added scp_tree_store_traverse(). + Moved scp_tree_store_iter_tell() from Extra to Store, it's required + to insert before/after and move. + * scptreestore.html: + Documentation and speed test results for scp_tree_store_traverse(). + Increased version to 0.84. Modified: scope/src/store/scptreestore.c 84 files changed, 75 insertions(+), 9 deletions(-) =================================================================== @@ -821,6 +821,15 @@ void scp_tree_store_move(ScpTreeStore *store, GtkTreeIter *iter, gint position) scp_move_element(store, array, iter, position, TRUE); } +gint scp_tree_store_iter_tell(VALIDATE_ONLY ScpTreeStore *store, GtkTreeIter *iter) +{ + g_return_val_if_fail(SCP_IS_TREE_STORE(store), -1); + g_return_val_if_fail(VALID_ITER(iter, store), -1); + g_return_val_if_fail((guint) ITER_INDEX(iter) < ITER_ARRAY(iter)->len, -1); + + return ITER_INDEX(iter); +} + /* Model */ static gint scp_ptr_array_find(GPtrArray *array, AElem *elem) @@ -1531,15 +1540,6 @@ gboolean scp_tree_store_iter_seek(VALIDATE_ONLY ScpTreeStore *store, GtkTreeIter return TRUE; } -gint scp_tree_store_iter_tell(VALIDATE_ONLY ScpTreeStore *store, GtkTreeIter *iter) -{ - g_return_val_if_fail(SCP_IS_TREE_STORE(store), -1); - g_return_val_if_fail(VALID_ITER(iter, store), -1); - g_return_val_if_fail((guint) ITER_INDEX(iter) < ITER_ARRAY(iter)->len, -1); - - return ITER_INDEX(iter); -} - static gint scp_collate_data(const gchar *key, const gchar *data) { gchar *key1 = g_utf8_collate_key(data, -1); @@ -1663,6 +1663,72 @@ gboolean scp_tree_store_search(ScpTreeStore *store, gboolean sublevels, gboolean return found; } +static gboolean scp_traverse(ScpTreeStore *store, GPtrArray *array, GtkTreeIter *iter, + gboolean sublevels, ScpTreeStoreTraverseFunc func, gpointer gdata) +{ + if (array) + { + guint i = 0; + + iter->user_data = array; + iter->user_data2 = GINT_TO_POINTER(0); + + while (i < array->len) + { + gint result = func(store, iter, gdata); + + if (result > 0) + return TRUE; + + if (!result) + { + if (sublevels) + { + if (scp_traverse(store, ((AElem *) array->pdata[i])->children, + iter, TRUE, func, gdata) > 0) + { + return TRUE; + } + + iter->user_data = array; + } + + iter->user_data2 = GINT_TO_POINTER(++i); + } + else + scp_tree_store_remove(store, iter); + } + } + + return FALSE; +} + +gboolean scp_tree_store_traverse(ScpTreeStore *store, gboolean sublevels, GtkTreeIter *iter, + GtkTreeIter *parent, ScpTreeStoreTraverseFunc func, gpointer gdata) +{ + ScpTreeStorePrivate *priv = store->priv; + GtkTreeIter iter1; + + g_return_val_if_fail(SCP_IS_TREE_STORE(store), FALSE); + g_return_val_if_fail(VALID_ITER_OR_NULL(parent, store), FALSE); + g_return_val_if_fail(sublevels == FALSE || priv->sublevels == TRUE, FALSE); + g_return_val_if_fail(func != NULL, FALSE); + + if (!iter) + iter = &iter1; + + iter->stamp = priv->stamp; + + if (!scp_traverse(store, (parent ? ITER_ELEM(parent) : priv->root)->children, iter, + sublevels, func, gdata)) + { + iter->stamp = 0; + return FALSE; + } + + return TRUE; +} + /* Class */ static void scp_tree_store_tree_model_init(GtkTreeModelIface *iface) Modified: scope/src/store/scptreestore.h 6 files changed, 5 insertions(+), 1 deletions(-) =================================================================== @@ -98,6 +98,7 @@ void scp_tree_store_clear_children(ScpTreeStore *store, GtkTreeIter *parent, void scp_tree_store_reorder(ScpTreeStore *store, GtkTreeIter *parent, gint *new_order); void scp_tree_store_swap(ScpTreeStore *store, GtkTreeIter *a, GtkTreeIter *b); void scp_tree_store_move(ScpTreeStore *store, GtkTreeIter *iter, gint position); +gint scp_tree_store_iter_tell(ScpTreeStore *store, GtkTreeIter *iter); /* Model */ GtkTreeModelFlags scp_tree_store_get_flags(ScpTreeStore *store); @@ -149,9 +150,12 @@ void scp_tree_store_set_allocation(ScpTreeStore *store, guint toplevel_reserved, gint scp_tree_store_compare_func(ScpTreeStore *store, GtkTreeIter *a, GtkTreeIter *b, gpointer data); gboolean scp_tree_store_iter_seek(ScpTreeStore *store, GtkTreeIter *iter, gint position); -gint scp_tree_store_iter_tell(ScpTreeStore *store, GtkTreeIter *iter); gboolean scp_tree_store_search(ScpTreeStore *store, gboolean sublevels, gboolean linear_order, GtkTreeIter *iter, GtkTreeIter *parent, gint column, ...); +typedef gint (*ScpTreeStoreTraverseFunc)(ScpTreeStore *store, GtkTreeIter *iter, + gpointer gdata); +gboolean scp_tree_store_traverse(ScpTreeStore *store, gboolean sublevels, GtkTreeIter *iter, + GtkTreeIter *parent, ScpTreeStoreTraverseFunc func, gpointer gdata); G_END_DECLS Modified: scope/src/store/scptreestore.html 65 files changed, 55 insertions(+), 10 deletions(-) =================================================================== @@ -55,9 +55,9 @@ #include "scptreestore.h"</p> <p>/* Store */<br> -ScpTreeStore *<a href="scp_tree_store_new">scp_tree_store_new</a>(gboolean sublevels, gint +ScpTreeStore *<a href="#scp_tree_store_new">scp_tree_store_new</a>(gboolean sublevels, gint n_columns, ...);<br> -ScpTreeStore *<a href="scp_tree_store_newv">scp_tree_store_newv</a>(gboolean sublevels, gint +ScpTreeStore *<a href="#scp_tree_store_newv">scp_tree_store_newv</a>(gboolean sublevels, gint n_columns, GType *types);<br> gboolean scp_tree_store_set_column_types(ScpTreeStore *store, gint n_columns, GType *types);<br> #define scp_tree_store_set_utf8_collate(store, utf8_collate) @@ -85,16 +85,16 @@ *parent, gint position, ...);<br> #define scp_tree_store_prepend_with_values(store, iter, parent, ...)<br> #define scp_tree_store_append_with_values(store, iter, parent, ...)<br> -void <a href="scp_tree_store_get_valist">scp_tree_store_get_valist</a>(ScpTreeStore *store, +void <a href="#scp_tree_store_get_valist">scp_tree_store_get_valist</a>(ScpTreeStore *store, GtkTreeIter *iter, va_list var_args);<br> -void <a href="scp_tree_store_get">scp_tree_store_get</a>(ScpTreeStore *store, GtkTreeIter +void <a href="#scp_tree_store_get">scp_tree_store_get</a>(ScpTreeStore *store, GtkTreeIter *iter, ...);<br> gboolean scp_tree_store_is_ancestor(ScpTreeStore *store, GtkTreeIter *iter, GtkTreeIter *descendant);<br> gint scp_tree_store_iter_depth(ScpTreeStore *store, GtkTreeIter *iter);<br> -void <a href="scp_tree_store_clear_children">scp_tree_store_clear_children</a>(ScpTreeStore +void <a href="#scp_tree_store_clear_children">scp_tree_store_clear_children</a>(ScpTreeStore *store, GtkTreeIter *parent, gboolean emit_subsignals);<br> -#define <a href="scp_tree_store_clear">scp_tree_store_clear(store)</a><br> +#define <a href="#scp_tree_store_clear">scp_tree_store_clear(store)</a><br> gboolean scp_tree_store_iter_is_valid(ScpTreeStore *store, GtkTreeIter *iter);<br> void scp_tree_store_reorder(ScpTreeStore *store, GtkTreeIter *parent, gint *new_order);<br> void scp_tree_store_swap(ScpTreeStore *store, GtkTreeIter *a, GtkTreeIter *b);<br> @@ -148,7 +148,7 @@ </p> <p>/* Extra */<br> -void <a href="scp_tree_store_set_allocation">scp_tree_store_set_allocation</a>(ScpTreeStore +void <a href="#scp_tree_store_set_allocation">scp_tree_store_set_allocation</a>(ScpTreeStore *store, guint toplevel_reserved, guint sublevel_reserved, gboolean sublevel_discard);<br> gint <a href="#scp_tree_store_compare_func">scp_tree_store_compare_func</a>(ScpTreeStore *store, GtkTreeIter *a, GtkTreeIter *b, gpointer data);<br> @@ -157,7 +157,12 @@ gint scp_tree_store_iter_tell(ScpTreeStore *store, GtkTreeIter *iter);<br> gboolean <a href="#scp_tree_store_search">scp_tree_store_search</a>(ScpTreeStore *store, gboolean sublevels, gboolean linear_order, GtkTreeIter *iter, GtkTreeIter *parent, gint column, -...); +...);<br> +typedef gint (*<a href="#ScpTreeStoreTraverseFunc">ScpTreeStoreTraverseFunc</a>)(ScpTreeStore +*store, GtkTreeIter *iter, gpointer gdata);<br> +gboolean <a href="#scp_tree_store_traverse">scp_tree_store_traverse</a>(ScpTreeStore *store, +gboolean sublevels, GtkTreeIter *iter, GtkTreeIter *parent, ScpTreeStoreTraverseFunc func, +gpointer gdata); </p> <hr> @@ -331,6 +336,30 @@ compare function is ignored, because it requires an iterator, not a value. For string columns, utf8_collate is taken into account.</p> +<h3><a name="ScpTreeStoreTraverseFunc">ScpTreeStoreTraverseFunc()</a></h3> + +<p><b>gint ScpTreeStoreTraverseFunc(ScpTreeStore *store, GtkTreeIter *iter, gpointer gdata); +</b></p> + +<div>The callback function type for scp_tree_store_traverse(). Return values:</div> +<div class="tab"><tt>TRUE</tt> (or another positive value): stop iterating<br> +<tt>FALSE</tt>: continue iterating<br> +<tt>-1</tt> (or another negative value): remove the current element and continue.</div> + +<h3><a name="scp_tree_store_traverse">scp_tree_store_traverse()</a></h3> + +<p><b>gboolean scp_tree_store_traverse(ScpTreeStore *store, gboolean sublevels, GtkTreeIter +*iter, GtkTreeIter *parent, ScpTreeStoreTraverseFunc func, gpointer gdata);</b></p> + +<div>Traverse the rows under parent.</div> +<div class="tab">iter: optional, may be NULL<br> +parent = NULL: traverse the top-level rows.</div> +<br> +<div>Return values:</div> +<div class="tab"><tt>TRUE</tt> and valid iter if func returns <tt>TRUE</tt> (or +another positive value)<br> +<tt>FALSE</tt> and invalid iter otherwise.</div><br> + <hr> <h3><a name="properties">Properties</a></h3> @@ -404,6 +433,8 @@ <tr><td>top-level iter search string</td><td>25</td><td>0.003</td><td>0.002</td><td>25</td></tr> <tr><td>top-level linear search double</td><td>25</td><td>n/a</td><td>0.000</td><td>25</td></tr> <tr><td>top-level linear search string</td><td>25</td><td>n/a</td><td>0.001</td><td>25</td></tr> +<tr><td>both levels model foreach</td><td>25</td><td>0.000</td><td>0.000</td><td>25</td></tr> +<tr><td>both levels store traverse</td><td>25</td><td>n/a</td><td>0.000</td><td>25</td></tr> <tr><td>top-level quick sort double</td><td>25</td><td>0.000</td><td>0.000</td><td></td></tr> <tr><td>top-level quick sort string</td><td>25</td><td>0.001</td><td>0.000</td><td></td></tr> <tr><td>sublevel 1 insert</td><td>25</td><td>0.000</td><td>0.000</td><td></td></tr> @@ -422,6 +453,8 @@ <tr><td>top-level iter search string</td><td>100</td><td>0.034</td><td>0.027</td><td>100</td></tr> <tr><td>top-level linear search double</td><td>100</td><td>n/a</td><td>0.000</td><td>100</td></tr> <tr><td>top-level linear search string</td><td>100</td><td>n/a</td><td>0.015</td><td>100</td></tr> +<tr><td>both levels model foreach</td><td>100</td><td>0.003</td><td>0.003</td><td>100</td></tr> +<tr><td>both levels store traverse</td><td>100</td><td>n/a</td><td>0.000</td><td>100</td></tr> <tr><td>top-level quick sort double</td><td>100</td><td>0.000</td><td>0.000</td><td></td></tr> <tr><td>top-level quick sort string</td><td>100</td><td>0.003</td><td>0.002</td><td></td></tr> <tr><td>sublevel 1 insert</td><td>100</td><td>0.000</td><td>0.000</td><td></td></tr> @@ -440,6 +473,8 @@ <tr><td>top-level iter search string</td><td>250</td><td>0.224</td><td>0.183</td><td>250</td></tr> <tr><td>top-level linear search double</td><td>250</td><td>n/a</td><td>0.001</td><td>250</td></tr> <tr><td>top-level linear search string</td><td>250</td><td>n/a</td><td>0.109</td><td>250</td></tr> +<tr><td>both levels model foreach</td><td>250</td><td>0.018</td><td>0.018</td><td>250</td></tr> +<tr><td>both levels store traverse</td><td>250</td><td>n/a</td><td>0.001</td><td>250</td></tr> <tr><td>top-level quick sort double</td><td>250</td><td>0.001</td><td>0.000</td><td></td></tr> <tr><td>top-level quick sort string</td><td>250</td><td>0.009</td><td>0.008</td><td></td></tr> <tr><td>sublevel 1 insert</td><td>250</td><td>0.001</td><td>0.001</td><td></td></tr> @@ -449,7 +484,7 @@ <tr><td>sublevel 1 quick sort double</td><td>250</td><td>0.002</td><td>0.000</td><td></td></tr> <tr><td>sublevel 1 quick sort string</td><td>250</td><td>0.015</td><td>0.012</td><td></td></tr> -<tr><td> </td><td>500</td><td></td><td></td><td></td></tr> +<tr><td> </td><td></td><td></td><td></td><td></td></tr> <tr><td>top-level insert</td><td>500</td><td>0.002</td><td>0.002</td><td></td></tr> <tr><td>top-level set</td><td>500</td><td>0.003</td><td>0.002</td><td></td></tr> <tr><td>top-level remove</td><td>500</td><td>0.002</td><td>0.001</td><td></td></tr> @@ -458,6 +493,8 @@ <tr><td>top-level iter search string</td><td>500</td><td>0.909</td><td>0.722</td><td>500</td></tr> <tr><td>top-level linear search double</td><td>500</td><td>n/a</td><td>0.005</td><td>500</td></tr> <tr><td>top-level linear search string</td><td>500</td><td>n/a</td><td>0.443</td><td>500</td></tr> +<tr><td>both levels model foreach</td><td>500</td><td>0.077</td><td>0.076</td><td>500</td></tr> +<tr><td>both levels store traverse</td><td>500</td><td>n/a</td><td>0.003</td><td>500</td></tr> <tr><td>top-level quick sort double</td><td>500</td><td>0.003</td><td>0.001</td><td></td></tr> <tr><td>top-level quick sort string</td><td>500</td><td>0.022</td><td>0.018</td><td></td></tr> <tr><td>sublevel 1 insert</td><td>500</td><td>0.002</td><td>0.002</td><td></td></tr> @@ -476,6 +513,8 @@ <tr><td>top-level iter search string</td><td>1000</td><td>0.370</td><td>0.273</td><td>100</td></tr> <tr><td>top-level linear search double</td><td>1000</td><td>n/a</td><td>0.002</td><td>100</td></tr> <tr><td>top-level linear search string</td><td>1000</td><td>n/a</td><td>0.182</td><td>100</td></tr> +<tr><td>both levels model foreach</td><td>1000</td><td>0.033</td><td>0.030</td><td>100</td></tr> +<tr><td>both levels store traverse</td><td>1000</td><td>n/a</td><td>0.001</td><td>100</td></tr> <tr><td>top-level quick sort double</td><td>1000</td><td>0.007</td><td>0.002</td><td></td></tr> <tr><td>top-level quick sort string</td><td>1000</td><td>0.050</td><td>0.040</td><td></td></tr> <tr><td>sublevel 1 insert</td><td>1000</td><td>0.006</td><td>0.004</td><td></td></tr> @@ -494,6 +533,8 @@ <tr><td>top-level iter search string</td><td>2500</td><td>2.273</td><td>1.859</td><td>250</td></tr> <tr><td>top-level linear search double</td><td>2500</td><td>n/a</td><td>0.015</td><td>250</td></tr> <tr><td>top-level linear search string</td><td>2500</td><td>n/a</td><td>1.137</td><td>250</td></tr> +<tr><td>both levels model foreach</td><td>2500</td><td>0.182</td><td>0.188</td><td>250</td></tr> +<tr><td>both levels store traverse</td><td>2500</td><td>n/a</td><td>0.009</td><td>250</td></tr> <tr><td>top-level quick sort double</td><td>2500</td><td>0.021</td><td>0.004</td><td></td></tr> <tr><td>top-level quick sort string</td><td>2500</td><td>0.146</td><td>0.117</td><td></td></tr> <tr><td>sublevel 1 insert</td><td>2500</td><td>0.035</td><td>0.014</td><td></td></tr> @@ -512,6 +553,8 @@ <tr><td>top-level iter search string</td><td>5000</td><td>8.775</td><td>7.787</td><td>500</td></tr> <tr><td>top-level linear search double</td><td>5000</td><td>n/a</td><td>0.060</td><td>500</td></tr> <tr><td>top-level linear search string</td><td>5000</td><td>n/a</td><td>4.351</td><td>500</td></tr> +<tr><td>both levels model foreach</td><td>5000</td><td>0.741</td><td>0.754</td><td>500</td></tr> +<tr><td>both levels store traverse</td><td>5000</td><td>n/a</td><td>0.042</td><td>500</td></tr> <tr><td>top-level quick sort double</td><td>5000</td><td>0.046</td><td>0.010</td><td></td></tr> <tr><td>top-level quick sort string</td><td>5000</td><td>0.325</td><td>0.264</td><td></td></tr> <tr><td>sublevel 1 insert</td><td>5000</td><td>0.168</td><td>0.040</td><td></td></tr> @@ -530,6 +573,8 @@ <tr><td>top-level iter search string</td><td>10000</td><td>37.555</td><td>31.020</td><td>1000</td></tr> <tr><td>top-level linear search double</td><td>10000</td><td>n/a</td><td>0.304</td><td>1000</td></tr> <tr><td>top-level linear search string</td><td>10000</td><td>n/a</td><td>18.896</td><td>1000</td></tr> +<tr><td>both levels model foreach</td><td>10000</td><td>2.969</td><td>3.136</td><td>1000</td></tr> +<tr><td>both levels store traverse</td><td>10000</td><td>n/a</td><td>0.238</td><td>1000</td></tr> <tr><td>top-level quick sort double</td><td>10000</td><td>0.112</td><td>0.022</td><td></td></tr> <tr><td>top-level quick sort string</td><td>10000</td><td>0.720</td><td>0.580</td><td></td></tr> <tr><td>sublevel 1 insert</td><td>10000</td><td>1.152</td><td>0.132</td><td></td></tr> @@ -647,7 +692,7 @@ <p>ScpTreeStore was initially written for the Scope plugin of Geany light IDE, which relies heavily on stores.</p> -<p><b>ScpTreeStore 0.83, Copyright (C) 2013 Dimitar Toshkov Zhekov</b></p> +<p><b>ScpTreeStore 0.84, Copyright (C) 2013 Dimitar Toshkov Zhekov</b></p> <p>ScpTreeStore is distributed under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any Modified: scope/src/views.c 6 files changed, 3 insertions(+), 3 deletions(-) =================================================================== @@ -263,7 +263,7 @@ static void on_display_editing_started(G_GNUC_UNUSED GtkCellRenderer *cell, } GtkTreeView *view_connect(const char *name, ScpTreeStore **store, GtkTreeSelection **selection, - const TreeCell *cell_info, const char *window, GObject **display) + const TreeCell *cell_info, const char *window, GObject **display_cell) { guint i; GtkScrolledWindow *scrolled = GTK_SCROLLED_WINDOW(get_widget(window)); @@ -284,11 +284,11 @@ GtkTreeView *view_connect(const char *name, ScpTreeStore **store, GtkTreeSelecti g_signal_connect(cell, "editing-started", G_CALLBACK(on_editing_started), hadjustment); - if (display && i == 0) + if (display_cell && i == 0) { g_signal_connect(cell, "editing-started", G_CALLBACK(on_display_editing_started), *store); - *display = G_OBJECT(cell); + *display_cell = G_OBJECT(cell); } } else Modified: scope/src/views.h 2 files changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -64,7 +64,7 @@ enum GtkTreeView *view_create(const char *name, ScpTreeStore **store, GtkTreeSelection **selection); GtkTreeView *view_connect(const char *name, ScpTreeStore **store, GtkTreeSelection **selection, - const TreeCell *cell_info, const char *window, GObject **display); + const TreeCell *cell_info, const char *window, GObject **display_cell); /* note: 2 references to column */ #define view_set_sort_func(store, column, compare) \ scp_tree_store_set_sort_func((store), (column), (GtkTreeIterCompareFunc) (compare), \ -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany-plugins] 1083fe: pohelper: Make menu sensitivity depend on current document
by Colomban Wendling
12 May '13
12 May '13
Branch: refs/heads/master Author: Colomban Wendling <ban(a)herbesfolles.org> Committer: Colomban Wendling <ban(a)herbesfolles.org> Date: Sat, 11 May 2013 23:02:47 UTC Commit: 1083fee4f0d8345c9cb4f57c691f8e43756c15a3
https://github.com/geany/geany-plugins/commit/1083fee4f0d8345c9cb4f57c691f8…
Log Message: ----------- pohelper: Make menu sensitivity depend on current document Modified Paths: -------------- pohelper/src/gph-plugin.c Modified: pohelper/src/gph-plugin.c 39 files changed, 39 insertions(+), 0 deletions(-) =================================================================== @@ -472,6 +472,39 @@ enum { } static void +update_menus (GeanyDocument *doc) +{ + if (plugin.menu_item) { + gtk_widget_set_sensitive (plugin.menu_item, doc_is_po (doc)); + } +} + +static void +on_document_activate (GObject *obj, + GeanyDocument *doc, + gpointer user_data) +{ + update_menus (doc); +} + +static void +on_document_filetype_set (GObject *obj, + GeanyDocument *doc, + GeanyFiletype *old_ft, + gpointer user_data) +{ + update_menus (doc); +} + +static void +on_document_close (GObject *obj, + GeanyDocument *doc, + gpointer user_data) +{ + update_menus (NULL); +} + +static void on_kb_goto_prev (guint key_id) { goto_prev (document_get_current ()); @@ -1159,6 +1192,12 @@ enum { } /* signal handlers */ + plugin_signal_connect (geany_plugin, NULL, "document-activate", TRUE, + G_CALLBACK (on_document_activate), NULL); + plugin_signal_connect (geany_plugin, NULL, "document-filetype-set", TRUE, + G_CALLBACK (on_document_filetype_set), NULL); + plugin_signal_connect (geany_plugin, NULL, "document-close", TRUE, + G_CALLBACK (on_document_close), NULL); plugin_signal_connect (geany_plugin, NULL, "document-before-save", TRUE, G_CALLBACK (on_document_save), NULL); -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany-plugins] adc625: pohelper: Fix message fuzziness toggling on plural forms
by Colomban Wendling
11 May '13
11 May '13
Branch: refs/heads/master Author: Colomban Wendling <ban(a)herbesfolles.org> Committer: Colomban Wendling <ban(a)herbesfolles.org> Date: Sat, 11 May 2013 21:55:18 UTC Commit: adc625e18826dd401ab5cc3bc094f2b72957fcf5
https://github.com/geany/geany-plugins/commit/adc625e18826dd401ab5cc3bc094f…
Log Message: ----------- pohelper: Fix message fuzziness toggling on plural forms Modified Paths: -------------- pohelper/src/gph-plugin.c Modified: pohelper/src/gph-plugin.c 17 files changed, 17 insertions(+), 0 deletions(-) =================================================================== @@ -800,6 +800,22 @@ enum { return style; } +/* checks whether @line is a primary msgid line, e.g. not a plural form */ +static gboolean +line_is_primary_msgid (ScintillaObject *sci, + gint line) +{ + gint pos = (gint) scintilla_send_message (sci, SCI_GETLINEINDENTPOSITION, + (uptr_t) line, 0); + + return (sci_get_char_at (sci, pos++) == 'm' && + sci_get_char_at (sci, pos++) == 's' && + sci_get_char_at (sci, pos++) == 'g' && + sci_get_char_at (sci, pos++) == 'i' && + sci_get_char_at (sci, pos++) == 'd' && + g_ascii_isspace (sci_get_char_at (sci, pos))); +} + /* parse flags line @line and puts the read flags in @flags * a flags line looks like: * #, flag-1, flag-2, flag-2, ... */ @@ -908,6 +924,7 @@ enum { /* find the msgid for the current line */ while (line > 0 && (style == SCE_PO_DEFAULT || + (style == SCE_PO_MSGID && ! line_is_primary_msgid (sci, line)) || style == SCE_PO_MSGID_TEXT || style == SCE_PO_MSGSTR || style == SCE_PO_MSGSTR_TEXT)) { -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany-plugins] cc7f87: pohelper: Fix message fuzziness toggling with empty lines
by Colomban Wendling
11 May '13
11 May '13
Branch: refs/heads/master Author: Colomban Wendling <ban(a)herbesfolles.org> Committer: Colomban Wendling <ban(a)herbesfolles.org> Date: Sat, 11 May 2013 21:33:39 UTC Commit: cc7f87e4a335b0572369f1634dbacf5af07d48bd
https://github.com/geany/geany-plugins/commit/cc7f87e4a335b0572369f1634dbac…
Log Message: ----------- pohelper: Fix message fuzziness toggling with empty lines Modified Paths: -------------- pohelper/src/gph-plugin.c Modified: pohelper/src/gph-plugin.c 3 files changed, 2 insertions(+), 1 deletions(-) =================================================================== @@ -907,7 +907,8 @@ enum { /* find the msgid for the current line */ while (line > 0 && - (style == SCE_PO_MSGID_TEXT || + (style == SCE_PO_DEFAULT || + style == SCE_PO_MSGID_TEXT || style == SCE_PO_MSGSTR || style == SCE_PO_MSGSTR_TEXT)) { line--; -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany-plugins] de8c24: Markdown: Add support for GTK3
by Matthew Brush
10 May '13
10 May '13
Branch: refs/heads/master Author: Matthew Brush <matt(a)geany.org> Committer: Matthew Brush <matt(a)geany.org> Date: Tue, 19 Mar 2013 20:42:35 UTC Commit: de8c24d096d52e74b9f41a99890f2b04b3469a98
https://github.com/geany/geany-plugins/commit/de8c24d096d52e74b9f41a99890f2…
Log Message: ----------- Markdown: Add support for GTK3 Modified Paths: -------------- build/markdown.m4 markdown/src/Makefile.am markdown/src/conf.c markdown/src/markdown-gtk-compat.c markdown/src/markdown-gtk-compat.h Modified: build/markdown.m4 7 files changed, 5 insertions(+), 2 deletions(-) =================================================================== @@ -49,9 +49,12 @@ AC_DEFUN([GP_CHECK_MARKDOWN], GTK_VERSION=2.16 WEBKIT_VERSION=1.1.13 + GP_CHECK_GTK3([webkit_package=webkitgtk-3.0], + [webkit_package=webkit-1.0]) + GP_CHECK_PLUGIN_DEPS([markdown], [MARKDOWN], - [gtk+-2.0 >= ${GTK_VERSION} - webkit-1.0 >= ${WEBKIT_VERSION} + [$GP_GTK_PACKAGE >= ${GTK_VERSION} + $webkit_package >= ${WEBKIT_VERSION} gthread-2.0]) GP_COMMIT_PLUGIN_STATUS([Markdown]) Modified: markdown/src/Makefile.am 6 files changed, 4 insertions(+), 2 deletions(-) =================================================================== @@ -7,11 +7,13 @@ geanyplugins_LTLIBRARIES = markdown.la markdown_la_SOURCES = \ conf.c \ plugin.c \ - viewer.c + viewer.c \ + markdown-gtk-compat.c noinst_HEADERS = \ conf.h \ - viewer.h + viewer.h \ + markdown-gtk-compat.h markdown_la_CFLAGS = \ $(AM_CFLAGS) \ Modified: markdown/src/conf.c 62 files changed, 26 insertions(+), 36 deletions(-) =================================================================== @@ -26,6 +26,7 @@ #include <gtk/gtk.h> #include <geanyplugin.h> #include "conf.h" +#include "markdown-gtk-compat.h" #define FONT_NAME_MAX 256 #define COLOR_CODE_MAX 8 @@ -470,18 +471,11 @@ static gboolean on_idle_timeout(MarkdownConfig *conf) static gchar * color_button_get_color(GtkColorButton *color_button) { - GdkColor color; - guint r, g, b; - gchar *color_str; + MarkdownColor color; - gtk_color_button_get_color(color_button, &color); + markdown_gtk_color_button_get_color(color_button, &color); - r = color.red / 256; - g = color.green / 256; - b = color.blue / 256; - color_str = g_strdup_printf("#%02x%02x%02x", r, g, b); - - return color_str; + return g_strdup_printf("#%02x%02x%02x", color.red, color.green, color.blue); } static gboolean @@ -563,15 +557,16 @@ GtkWidget *markdown_config_gui(MarkdownConfig *conf, GtkDialog *dialog) "template-file", &tmpl_file, NULL); - table = gtk_table_new(6, 2, FALSE); - gtk_table_set_col_spacings(GTK_TABLE(table), 6); - gtk_table_set_row_spacings(GTK_TABLE(table), 6); + table = markdown_gtk_table_new(6, 2, FALSE); + markdown_gtk_table_set_col_spacing(MARKDOWN_GTK_TABLE(table), 6); + markdown_gtk_table_set_row_spacing(MARKDOWN_GTK_TABLE(table), 6); + conf->priv->widgets.table = table; { /* POSITION OF VIEW */ label = gtk_label_new(_("Position:")); gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 0, 0); + markdown_gtk_table_attach(MARKDOWN_GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, GTK_FILL); hbox = gtk_hbox_new(FALSE, 6); @@ -591,7 +586,7 @@ GtkWidget *markdown_config_gui(MarkdownConfig *conf, GtkDialog *dialog) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(wid), TRUE); } - gtk_table_attach(GTK_TABLE(table), hbox, 1, 2, 0, 1, GTK_FILL, GTK_FILL, 0, 0); + markdown_gtk_table_attach(MARKDOWN_GTK_TABLE(table), hbox, 1, 2, 0, 1, GTK_FILL, GTK_FILL); } { /* FONT BUTTON */ @@ -599,15 +594,14 @@ GtkWidget *markdown_config_gui(MarkdownConfig *conf, GtkDialog *dialog) label = gtk_label_new(_("Font:")); gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, GTK_FILL, GTK_FILL, 0, 0); + markdown_gtk_table_attach(MARKDOWN_GTK_TABLE(table), label, 0, 1, 1, 2, GTK_FILL, GTK_FILL); font_desc = g_strdup_printf("%s %d", fnt, fnt_sz); wid = gtk_font_button_new_with_font(font_desc); conf->priv->widgets.font_button = wid; g_free(font_desc); - gtk_table_attach(GTK_TABLE(table), wid, 1, 2, 1, 2, GTK_FILL | GTK_EXPAND, - GTK_FILL, 0, 0); + markdown_gtk_table_attach(MARKDOWN_GTK_TABLE(table), wid, 1, 2, 1, 2, GTK_FILL | GTK_EXPAND, GTK_FILL); g_free(fnt); } @@ -617,49 +611,46 @@ GtkWidget *markdown_config_gui(MarkdownConfig *conf, GtkDialog *dialog) label = gtk_label_new(_("Code Font:")); gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, 2, 3, GTK_FILL, GTK_FILL, 0, 0); + markdown_gtk_table_attach(MARKDOWN_GTK_TABLE(table), label, 0, 1, 2, 3, GTK_FILL, GTK_FILL); font_desc = g_strdup_printf("%s %d", code_fnt, code_fnt_sz); wid = gtk_font_button_new_with_font(font_desc); conf->priv->widgets.code_font_button = wid; g_free(font_desc); - gtk_table_attach(GTK_TABLE(table), wid, 1, 2, 2, 3, GTK_FILL | GTK_EXPAND, - GTK_FILL, 0, 0); + markdown_gtk_table_attach(MARKDOWN_GTK_TABLE(table), wid, 1, 2, 2, 3, GTK_FILL | GTK_EXPAND, GTK_FILL); g_free(code_fnt); } { /* BG COLOR */ - GdkColor bgclr; + MarkdownColor bgclr; label = gtk_label_new(_("BG Color:")); gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, 3, 4, GTK_FILL, GTK_FILL, 0, 0); + markdown_gtk_table_attach(MARKDOWN_GTK_TABLE(table), label, 0, 1, 3, 4, GTK_FILL, GTK_FILL); - gdk_color_parse(bg, &bgclr); + markdown_color_parse(bg, &bgclr); - wid = gtk_color_button_new_with_color(&bgclr); + wid = markdown_gtk_color_button_new_with_color(&bgclr); conf->priv->widgets.bg_color_button = wid; - gtk_table_attach(GTK_TABLE(table), wid, 1, 2, 3, 4, GTK_FILL | GTK_EXPAND, - GTK_FILL, 0, 0); + markdown_gtk_table_attach(MARKDOWN_GTK_TABLE(table), wid, 1, 2, 3, 4, GTK_FILL | GTK_EXPAND, GTK_FILL); g_free(bg); } { /* FG COLOR */ - GdkColor fgclr; + MarkdownColor fgclr; label = gtk_label_new(_("FG Color:")); gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, 4, 5, GTK_FILL, GTK_FILL, 0, 0); + markdown_gtk_table_attach(MARKDOWN_GTK_TABLE(table), label, 0, 1, 4, 5, GTK_FILL, GTK_FILL); - gdk_color_parse(fg, &fgclr); + markdown_color_parse(fg, &fgclr); - wid = gtk_color_button_new_with_color(&fgclr); + wid = markdown_gtk_color_button_new_with_color(&fgclr); conf->priv->widgets.fg_color_button = wid; - gtk_table_attach(GTK_TABLE(table), wid, 1, 2, 4, 5, GTK_FILL | GTK_EXPAND, - GTK_FILL, 0, 0); + markdown_gtk_table_attach(MARKDOWN_GTK_TABLE(table), wid, 1, 2, 4, 5, GTK_FILL | GTK_EXPAND, GTK_FILL); g_free(fg); } @@ -667,7 +658,7 @@ GtkWidget *markdown_config_gui(MarkdownConfig *conf, GtkDialog *dialog) { /* TEMPLATE FILE */ label = gtk_label_new(_("Template:")); gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, 5, 6, GTK_FILL, GTK_FILL, 0, 0); + markdown_gtk_table_attach(MARKDOWN_GTK_TABLE(table), label, 0, 1, 5, 6, GTK_FILL, GTK_FILL); wid = gtk_file_chooser_button_new(_("Select Template File"), GTK_FILE_CHOOSER_ACTION_OPEN); @@ -676,8 +667,7 @@ GtkWidget *markdown_config_gui(MarkdownConfig *conf, GtkDialog *dialog) if (tmpl_file && tmpl_file[0]) { gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(wid), tmpl_file); } - gtk_table_attach(GTK_TABLE(table), wid, 1, 2, 5, 6, GTK_FILL | GTK_EXPAND, - GTK_FILL, 0, 0); + markdown_gtk_table_attach(MARKDOWN_GTK_TABLE(table), wid, 1, 2, 5, 6, GTK_FILL | GTK_EXPAND, GTK_FILL); g_free(tmpl_file); } Modified: markdown/src/markdown-gtk-compat.c 147 files changed, 147 insertions(+), 0 deletions(-) =================================================================== @@ -0,0 +1,147 @@ +/* + * markdown-gtk-compat.c - Part of the Geany Markdown plugin + * + * Copyright 2012 Matthew Brush <mbrush(a)codebrainz.ca> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + * + * + */ + +#include <gtk/gtk.h> +#include "markdown-gtk-compat.h" + +GtkWidget *markdown_gtk_table_new(guint rows, guint columns, gboolean homogeneous) +{ + GtkWidget *table; + +#if !GTK_CHECK_VERSION(3, 4, 0) + table = gtk_table_new(rows, columns, homogeneous); +#else + guint row_cnt, col_cnt; + + table = gtk_grid_new(); + + gtk_grid_set_row_homogeneous(MARKDOWN_GTK_TABLE(table), homogeneous); + gtk_grid_set_column_homogeneous(MARKDOWN_GTK_TABLE(table), homogeneous); + + for (row_cnt=0; row_cnt < rows; row_cnt++) + gtk_grid_insert_row(MARKDOWN_GTK_TABLE(table), row_cnt); + + for (col_cnt=0; col_cnt < columns; col_cnt++) + gtk_grid_insert_column(MARKDOWN_GTK_TABLE(table), col_cnt); +#endif + + return table; +} + +void markdown_gtk_table_attach(MarkdownGtkTable *table, GtkWidget *child, + guint left_attach, guint right_attach, guint top_attach, guint bottom_attach, + GtkAttachOptions xoptions, GtkAttachOptions yoptions) +{ +#if !GTK_CHECK_VERSION(3, 4, 0) + gtk_table_attach(table, child, left_attach, right_attach, top_attach, + bottom_attach, xoptions, yoptions, 0, 0); +#else + gtk_grid_attach(table, child, left_attach, top_attach, + right_attach - left_attach, bottom_attach - top_attach); +#endif +} + +GtkWidget *markdown_gtk_color_button_new_with_color(MarkdownColor *color) +{ + GtkWidget *btn; + + btn = gtk_color_button_new(); + +#if !GTK_CHECK_VERSION(3, 0, 0) +{ + GdkColor clr; + clr.red = color->red * 256; + clr.green = color->green * 256; + clr.blue = color->blue * 256; + gtk_color_button_set_color(GTK_COLOR_BUTTON(btn), &clr); +} +#else +{ + GdkRGBA clr; + clr.red = color->red / 256.0; + clr.green = color->green / 256.0; + clr.blue = color->blue / 256.0; +# if !GTK_CHECK_VERSION(3, 4, 0) + gtk_color_button_set_rgba(GTK_COLOR_BUTTON(btn), &clr); +# else + gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(btn), &clr); +# endif +} +#endif + + return btn; +} + +gboolean markdown_color_parse(const gchar *spec, MarkdownColor *color) +{ + gboolean result; + g_return_val_if_fail(spec && color, FALSE); + +#if !GTK_CHECK_VERSION(3, 0, 0) +{ + GdkColor clr; + result = gdk_color_parse(spec, &clr); + if (result) { + color->red = clr.red / 256; + color->green = clr.green / 256; + color->blue = clr.blue / 256; + } +} +#else +{ + GdkRGBA clr; + result = gdk_rgba_parse(&clr, spec); + if (result) { + color->red = (guint8) (clr.red * 256.0); + color->green = (guint8) (clr.green * 256.0); + color->blue = (guint8) (clr.blue * 256.0); + } +} +#endif + + return result; +} + +void markdown_gtk_color_button_get_color(GtkColorButton *button, MarkdownColor *color) +{ + g_return_if_fail(button); + g_return_if_fail(color); + +#if !GTK_CHECK_VERSION(3, 0, 0) + GdkColor clr; + gtk_color_button_get_color(button, &clr); + color->red = clr.red / 256; + color->green = clr.green / 256; + color->blue = clr.blue / 256; +#else + GdkRGBA clr; +# if !GTK_CHECK_VERSION(3, 4, 0) + gtk_color_button_get_rgba(button, &clr); +# else + gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(button), &clr); +# endif + color->red = (guint8) (clr.red * 256.0); + color->green = (guint8) (clr.green * 256.0); + color->blue = (guint8) (clr.blue * 256.0); +#endif +} Modified: markdown/src/markdown-gtk-compat.h 61 files changed, 61 insertions(+), 0 deletions(-) =================================================================== @@ -0,0 +1,61 @@ +/* + * markdown-gtk-compat.h - Part of the Geany Markdown plugin + * + * Copyright 2012 Matthew Brush <mbrush(a)codebrainz.ca> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + * + * + */ + +#ifndef MARKDOWN_GTK_COMPAT_H_ +#define MARKDOWN_GTK_COMPAT_H_ + +#if !GTK_CHECK_VERSION(3, 4, 0) +# define MarkdownGtkTable GtkTable +# define MARKDOWN_GTK_TABLE GTK_TABLE +# define markdown_gtk_table_set_row_spacing(table, spacing) \ + gtk_table_set_row_spacings(table, spacing) +# define markdown_gtk_table_set_col_spacing(table, spacing) \ + gtk_table_set_col_spacings(table, spacing) +#else +# define MarkdownGtkTable GtkGrid +# define MARKDOWN_GTK_TABLE GTK_GRID +# define markdown_gtk_table_set_row_spacing(table, spacing) \ + gtk_grid_set_row_spacing(table, spacing) +# define markdown_gtk_table_set_col_spacing(table, spacing) \ + gtk_grid_set_column_spacing(table, spacing) +#endif + +typedef struct { + guint8 red; + guint8 green; + guint8 blue; +} MarkdownColor; + +GtkWidget *markdown_gtk_table_new(guint rows, guint columns, gboolean homogeneous); + +void markdown_gtk_table_attach(MarkdownGtkTable *table, GtkWidget *child, + guint left_attach, guint right_attach, guint top_attach, guint bottom_attach, + GtkAttachOptions xoptions, GtkAttachOptions yoptions); + +GtkWidget *markdown_gtk_color_button_new_with_color(MarkdownColor *color); + +gboolean markdown_color_parse(const gchar *spec, MarkdownColor *color); + +void markdown_gtk_color_button_get_color(GtkColorButton *button, MarkdownColor *color); + +#endif /* MARKDOWN_GTK_COMPAT_H_ */ -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany-plugins] 8e6adf: Merge pull request #94 from codebrainz/markdown-gtk3
by Frank Lanitz
10 May '13
10 May '13
Branch: refs/heads/master Author: Frank Lanitz <frank(a)frank.uvena.de> Committer: Frank Lanitz <frank(a)frank.uvena.de> Date: Fri, 10 May 2013 06:39:20 UTC Commit: 8e6adf353a8a24ead7bb0cb7d69cc92cfc74c590
https://github.com/geany/geany-plugins/commit/8e6adf353a8a24ead7bb0cb7d69cc…
Log Message: ----------- Merge pull request #94 from codebrainz/markdown-gtk3 Markdown: Add support for GTK3 Modified Paths: -------------- build/markdown.m4 markdown/src/Makefile.am markdown/src/conf.c markdown/src/markdown-gtk-compat.c markdown/src/markdown-gtk-compat.h Modified: build/markdown.m4 7 files changed, 5 insertions(+), 2 deletions(-) =================================================================== @@ -49,9 +49,12 @@ AC_DEFUN([GP_CHECK_MARKDOWN], GTK_VERSION=2.16 WEBKIT_VERSION=1.1.13 + GP_CHECK_GTK3([webkit_package=webkitgtk-3.0], + [webkit_package=webkit-1.0]) + GP_CHECK_PLUGIN_DEPS([markdown], [MARKDOWN], - [gtk+-2.0 >= ${GTK_VERSION} - webkit-1.0 >= ${WEBKIT_VERSION} + [$GP_GTK_PACKAGE >= ${GTK_VERSION} + $webkit_package >= ${WEBKIT_VERSION} gthread-2.0]) GP_COMMIT_PLUGIN_STATUS([Markdown]) Modified: markdown/src/Makefile.am 6 files changed, 4 insertions(+), 2 deletions(-) =================================================================== @@ -7,11 +7,13 @@ geanyplugins_LTLIBRARIES = markdown.la markdown_la_SOURCES = \ conf.c \ plugin.c \ - viewer.c + viewer.c \ + markdown-gtk-compat.c noinst_HEADERS = \ conf.h \ - viewer.h + viewer.h \ + markdown-gtk-compat.h markdown_la_CFLAGS = \ $(AM_CFLAGS) \ Modified: markdown/src/conf.c 62 files changed, 26 insertions(+), 36 deletions(-) =================================================================== @@ -26,6 +26,7 @@ #include <gtk/gtk.h> #include <geanyplugin.h> #include "conf.h" +#include "markdown-gtk-compat.h" #define FONT_NAME_MAX 256 #define COLOR_CODE_MAX 8 @@ -470,18 +471,11 @@ static gboolean on_idle_timeout(MarkdownConfig *conf) static gchar * color_button_get_color(GtkColorButton *color_button) { - GdkColor color; - guint r, g, b; - gchar *color_str; + MarkdownColor color; - gtk_color_button_get_color(color_button, &color); + markdown_gtk_color_button_get_color(color_button, &color); - r = color.red / 256; - g = color.green / 256; - b = color.blue / 256; - color_str = g_strdup_printf("#%02x%02x%02x", r, g, b); - - return color_str; + return g_strdup_printf("#%02x%02x%02x", color.red, color.green, color.blue); } static gboolean @@ -563,15 +557,16 @@ GtkWidget *markdown_config_gui(MarkdownConfig *conf, GtkDialog *dialog) "template-file", &tmpl_file, NULL); - table = gtk_table_new(6, 2, FALSE); - gtk_table_set_col_spacings(GTK_TABLE(table), 6); - gtk_table_set_row_spacings(GTK_TABLE(table), 6); + table = markdown_gtk_table_new(6, 2, FALSE); + markdown_gtk_table_set_col_spacing(MARKDOWN_GTK_TABLE(table), 6); + markdown_gtk_table_set_row_spacing(MARKDOWN_GTK_TABLE(table), 6); + conf->priv->widgets.table = table; { /* POSITION OF VIEW */ label = gtk_label_new(_("Position:")); gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 0, 0); + markdown_gtk_table_attach(MARKDOWN_GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, GTK_FILL); hbox = gtk_hbox_new(FALSE, 6); @@ -591,7 +586,7 @@ GtkWidget *markdown_config_gui(MarkdownConfig *conf, GtkDialog *dialog) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(wid), TRUE); } - gtk_table_attach(GTK_TABLE(table), hbox, 1, 2, 0, 1, GTK_FILL, GTK_FILL, 0, 0); + markdown_gtk_table_attach(MARKDOWN_GTK_TABLE(table), hbox, 1, 2, 0, 1, GTK_FILL, GTK_FILL); } { /* FONT BUTTON */ @@ -599,15 +594,14 @@ GtkWidget *markdown_config_gui(MarkdownConfig *conf, GtkDialog *dialog) label = gtk_label_new(_("Font:")); gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, GTK_FILL, GTK_FILL, 0, 0); + markdown_gtk_table_attach(MARKDOWN_GTK_TABLE(table), label, 0, 1, 1, 2, GTK_FILL, GTK_FILL); font_desc = g_strdup_printf("%s %d", fnt, fnt_sz); wid = gtk_font_button_new_with_font(font_desc); conf->priv->widgets.font_button = wid; g_free(font_desc); - gtk_table_attach(GTK_TABLE(table), wid, 1, 2, 1, 2, GTK_FILL | GTK_EXPAND, - GTK_FILL, 0, 0); + markdown_gtk_table_attach(MARKDOWN_GTK_TABLE(table), wid, 1, 2, 1, 2, GTK_FILL | GTK_EXPAND, GTK_FILL); g_free(fnt); } @@ -617,49 +611,46 @@ GtkWidget *markdown_config_gui(MarkdownConfig *conf, GtkDialog *dialog) label = gtk_label_new(_("Code Font:")); gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, 2, 3, GTK_FILL, GTK_FILL, 0, 0); + markdown_gtk_table_attach(MARKDOWN_GTK_TABLE(table), label, 0, 1, 2, 3, GTK_FILL, GTK_FILL); font_desc = g_strdup_printf("%s %d", code_fnt, code_fnt_sz); wid = gtk_font_button_new_with_font(font_desc); conf->priv->widgets.code_font_button = wid; g_free(font_desc); - gtk_table_attach(GTK_TABLE(table), wid, 1, 2, 2, 3, GTK_FILL | GTK_EXPAND, - GTK_FILL, 0, 0); + markdown_gtk_table_attach(MARKDOWN_GTK_TABLE(table), wid, 1, 2, 2, 3, GTK_FILL | GTK_EXPAND, GTK_FILL); g_free(code_fnt); } { /* BG COLOR */ - GdkColor bgclr; + MarkdownColor bgclr; label = gtk_label_new(_("BG Color:")); gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, 3, 4, GTK_FILL, GTK_FILL, 0, 0); + markdown_gtk_table_attach(MARKDOWN_GTK_TABLE(table), label, 0, 1, 3, 4, GTK_FILL, GTK_FILL); - gdk_color_parse(bg, &bgclr); + markdown_color_parse(bg, &bgclr); - wid = gtk_color_button_new_with_color(&bgclr); + wid = markdown_gtk_color_button_new_with_color(&bgclr); conf->priv->widgets.bg_color_button = wid; - gtk_table_attach(GTK_TABLE(table), wid, 1, 2, 3, 4, GTK_FILL | GTK_EXPAND, - GTK_FILL, 0, 0); + markdown_gtk_table_attach(MARKDOWN_GTK_TABLE(table), wid, 1, 2, 3, 4, GTK_FILL | GTK_EXPAND, GTK_FILL); g_free(bg); } { /* FG COLOR */ - GdkColor fgclr; + MarkdownColor fgclr; label = gtk_label_new(_("FG Color:")); gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, 4, 5, GTK_FILL, GTK_FILL, 0, 0); + markdown_gtk_table_attach(MARKDOWN_GTK_TABLE(table), label, 0, 1, 4, 5, GTK_FILL, GTK_FILL); - gdk_color_parse(fg, &fgclr); + markdown_color_parse(fg, &fgclr); - wid = gtk_color_button_new_with_color(&fgclr); + wid = markdown_gtk_color_button_new_with_color(&fgclr); conf->priv->widgets.fg_color_button = wid; - gtk_table_attach(GTK_TABLE(table), wid, 1, 2, 4, 5, GTK_FILL | GTK_EXPAND, - GTK_FILL, 0, 0); + markdown_gtk_table_attach(MARKDOWN_GTK_TABLE(table), wid, 1, 2, 4, 5, GTK_FILL | GTK_EXPAND, GTK_FILL); g_free(fg); } @@ -667,7 +658,7 @@ GtkWidget *markdown_config_gui(MarkdownConfig *conf, GtkDialog *dialog) { /* TEMPLATE FILE */ label = gtk_label_new(_("Template:")); gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, 5, 6, GTK_FILL, GTK_FILL, 0, 0); + markdown_gtk_table_attach(MARKDOWN_GTK_TABLE(table), label, 0, 1, 5, 6, GTK_FILL, GTK_FILL); wid = gtk_file_chooser_button_new(_("Select Template File"), GTK_FILE_CHOOSER_ACTION_OPEN); @@ -676,8 +667,7 @@ GtkWidget *markdown_config_gui(MarkdownConfig *conf, GtkDialog *dialog) if (tmpl_file && tmpl_file[0]) { gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(wid), tmpl_file); } - gtk_table_attach(GTK_TABLE(table), wid, 1, 2, 5, 6, GTK_FILL | GTK_EXPAND, - GTK_FILL, 0, 0); + markdown_gtk_table_attach(MARKDOWN_GTK_TABLE(table), wid, 1, 2, 5, 6, GTK_FILL | GTK_EXPAND, GTK_FILL); g_free(tmpl_file); } Modified: markdown/src/markdown-gtk-compat.c 147 files changed, 147 insertions(+), 0 deletions(-) =================================================================== @@ -0,0 +1,147 @@ +/* + * markdown-gtk-compat.c - Part of the Geany Markdown plugin + * + * Copyright 2012 Matthew Brush <mbrush(a)codebrainz.ca> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + * + * + */ + +#include <gtk/gtk.h> +#include "markdown-gtk-compat.h" + +GtkWidget *markdown_gtk_table_new(guint rows, guint columns, gboolean homogeneous) +{ + GtkWidget *table; + +#if !GTK_CHECK_VERSION(3, 4, 0) + table = gtk_table_new(rows, columns, homogeneous); +#else + guint row_cnt, col_cnt; + + table = gtk_grid_new(); + + gtk_grid_set_row_homogeneous(MARKDOWN_GTK_TABLE(table), homogeneous); + gtk_grid_set_column_homogeneous(MARKDOWN_GTK_TABLE(table), homogeneous); + + for (row_cnt=0; row_cnt < rows; row_cnt++) + gtk_grid_insert_row(MARKDOWN_GTK_TABLE(table), row_cnt); + + for (col_cnt=0; col_cnt < columns; col_cnt++) + gtk_grid_insert_column(MARKDOWN_GTK_TABLE(table), col_cnt); +#endif + + return table; +} + +void markdown_gtk_table_attach(MarkdownGtkTable *table, GtkWidget *child, + guint left_attach, guint right_attach, guint top_attach, guint bottom_attach, + GtkAttachOptions xoptions, GtkAttachOptions yoptions) +{ +#if !GTK_CHECK_VERSION(3, 4, 0) + gtk_table_attach(table, child, left_attach, right_attach, top_attach, + bottom_attach, xoptions, yoptions, 0, 0); +#else + gtk_grid_attach(table, child, left_attach, top_attach, + right_attach - left_attach, bottom_attach - top_attach); +#endif +} + +GtkWidget *markdown_gtk_color_button_new_with_color(MarkdownColor *color) +{ + GtkWidget *btn; + + btn = gtk_color_button_new(); + +#if !GTK_CHECK_VERSION(3, 0, 0) +{ + GdkColor clr; + clr.red = color->red * 256; + clr.green = color->green * 256; + clr.blue = color->blue * 256; + gtk_color_button_set_color(GTK_COLOR_BUTTON(btn), &clr); +} +#else +{ + GdkRGBA clr; + clr.red = color->red / 256.0; + clr.green = color->green / 256.0; + clr.blue = color->blue / 256.0; +# if !GTK_CHECK_VERSION(3, 4, 0) + gtk_color_button_set_rgba(GTK_COLOR_BUTTON(btn), &clr); +# else + gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(btn), &clr); +# endif +} +#endif + + return btn; +} + +gboolean markdown_color_parse(const gchar *spec, MarkdownColor *color) +{ + gboolean result; + g_return_val_if_fail(spec && color, FALSE); + +#if !GTK_CHECK_VERSION(3, 0, 0) +{ + GdkColor clr; + result = gdk_color_parse(spec, &clr); + if (result) { + color->red = clr.red / 256; + color->green = clr.green / 256; + color->blue = clr.blue / 256; + } +} +#else +{ + GdkRGBA clr; + result = gdk_rgba_parse(&clr, spec); + if (result) { + color->red = (guint8) (clr.red * 256.0); + color->green = (guint8) (clr.green * 256.0); + color->blue = (guint8) (clr.blue * 256.0); + } +} +#endif + + return result; +} + +void markdown_gtk_color_button_get_color(GtkColorButton *button, MarkdownColor *color) +{ + g_return_if_fail(button); + g_return_if_fail(color); + +#if !GTK_CHECK_VERSION(3, 0, 0) + GdkColor clr; + gtk_color_button_get_color(button, &clr); + color->red = clr.red / 256; + color->green = clr.green / 256; + color->blue = clr.blue / 256; +#else + GdkRGBA clr; +# if !GTK_CHECK_VERSION(3, 4, 0) + gtk_color_button_get_rgba(button, &clr); +# else + gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(button), &clr); +# endif + color->red = (guint8) (clr.red * 256.0); + color->green = (guint8) (clr.green * 256.0); + color->blue = (guint8) (clr.blue * 256.0); +#endif +} Modified: markdown/src/markdown-gtk-compat.h 61 files changed, 61 insertions(+), 0 deletions(-) =================================================================== @@ -0,0 +1,61 @@ +/* + * markdown-gtk-compat.h - Part of the Geany Markdown plugin + * + * Copyright 2012 Matthew Brush <mbrush(a)codebrainz.ca> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + * + * + */ + +#ifndef MARKDOWN_GTK_COMPAT_H_ +#define MARKDOWN_GTK_COMPAT_H_ + +#if !GTK_CHECK_VERSION(3, 4, 0) +# define MarkdownGtkTable GtkTable +# define MARKDOWN_GTK_TABLE GTK_TABLE +# define markdown_gtk_table_set_row_spacing(table, spacing) \ + gtk_table_set_row_spacings(table, spacing) +# define markdown_gtk_table_set_col_spacing(table, spacing) \ + gtk_table_set_col_spacings(table, spacing) +#else +# define MarkdownGtkTable GtkGrid +# define MARKDOWN_GTK_TABLE GTK_GRID +# define markdown_gtk_table_set_row_spacing(table, spacing) \ + gtk_grid_set_row_spacing(table, spacing) +# define markdown_gtk_table_set_col_spacing(table, spacing) \ + gtk_grid_set_column_spacing(table, spacing) +#endif + +typedef struct { + guint8 red; + guint8 green; + guint8 blue; +} MarkdownColor; + +GtkWidget *markdown_gtk_table_new(guint rows, guint columns, gboolean homogeneous); + +void markdown_gtk_table_attach(MarkdownGtkTable *table, GtkWidget *child, + guint left_attach, guint right_attach, guint top_attach, guint bottom_attach, + GtkAttachOptions xoptions, GtkAttachOptions yoptions); + +GtkWidget *markdown_gtk_color_button_new_with_color(MarkdownColor *color); + +gboolean markdown_color_parse(const gchar *spec, MarkdownColor *color); + +void markdown_gtk_color_button_get_color(GtkColorButton *button, MarkdownColor *color); + +#endif /* MARKDOWN_GTK_COMPAT_H_ */ -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany-plugins] 22bec4: Merge pull request #100 from b4n/fixes/pair-tag-highlighter
by Frank Lanitz
10 May '13
10 May '13
Branch: refs/heads/master Author: Frank Lanitz <frank(a)frank.uvena.de> Committer: Frank Lanitz <frank(a)frank.uvena.de> Date: Fri, 10 May 2013 06:36:30 UTC Commit: 22bec45559dad767df53dbfd945f139b30f34ba1
https://github.com/geany/geany-plugins/commit/22bec45559dad767df53dbfd945f1…
Log Message: ----------- Merge pull request #100 from b4n/fixes/pair-tag-highlighter Fix crash on unloading plugin PairTagHighlighter Modified Paths: -------------- pairtaghighlighter/src/pair_tag_highlighter.c Modified: pairtaghighlighter/src/pair_tag_highlighter.c 84 files changed, 42 insertions(+), 42 deletions(-) =================================================================== @@ -24,8 +24,6 @@ GeanyData *geany_data; GeanyFunctions *geany_functions; -static ScintillaObject *sci; - /* Is needed for clearing highlighting after moving cursor out * from the tag */ static gint highlightedBrackets[] = {0, 0, 0, 0}; @@ -43,7 +41,7 @@ * FALSE - to the left * from the current cursor position to the start of the line. */ -static gint findBracket(gint position, gint endOfSearchPos, +static gint findBracket(ScintillaObject *sci, gint position, gint endOfSearchPos, gchar searchedBracket, gchar breakBracket, gboolean direction) { gint foundBracket = -1; @@ -84,7 +82,7 @@ static gint findBracket(gint position, gint endOfSearchPos, } -static void highlight_tag(gint openingBracket, gint closingBracket) +static void highlight_tag(ScintillaObject *sci, gint openingBracket, gint closingBracket) { scintilla_send_message(sci, SCI_SETINDICATORCURRENT, INDICATOR_TAGMATCH, 0); scintilla_send_message(sci, SCI_INDICSETSTYLE, @@ -96,14 +94,14 @@ static void highlight_tag(gint openingBracket, gint closingBracket) } -static void clear_previous_highlighting(gint rangeStart, gint rangeEnd) +static void clear_previous_highlighting(ScintillaObject *sci, gint rangeStart, gint rangeEnd) { scintilla_send_message(sci, SCI_SETINDICATORCURRENT, INDICATOR_TAGMATCH, 0); scintilla_send_message(sci, SCI_INDICATORCLEARRANGE, rangeStart, rangeEnd+1); } -static gboolean is_tag_self_closing(gint closingBracket) +static gboolean is_tag_self_closing(ScintillaObject *sci, gint closingBracket) { gboolean isTagSelfClosing = FALSE; gchar charBeforeBracket = sci_get_char_at(sci, closingBracket-1); @@ -114,7 +112,7 @@ static gboolean is_tag_self_closing(gint closingBracket) } -static gboolean is_tag_opening(gint openingBracket) +static gboolean is_tag_opening(ScintillaObject *sci, gint openingBracket) { gboolean isTagOpening = TRUE; gchar charAfterBracket = sci_get_char_at(sci, openingBracket+1); @@ -125,7 +123,7 @@ static gboolean is_tag_opening(gint openingBracket) } -static void get_tag_name(gint openingBracket, gint closingBracket, +static void get_tag_name(ScintillaObject *sci, gint openingBracket, gint closingBracket, gchar tagName[], gboolean isTagOpening) { gint nameStart = openingBracket + (TRUE == isTagOpening ? 1 : 2); @@ -144,7 +142,7 @@ static void get_tag_name(gint openingBracket, gint closingBracket, } -static void findMatchingOpeningTag(gchar *tagName, gint openingBracket) +static void findMatchingOpeningTag(ScintillaObject *sci, gchar *tagName, gint openingBracket) { gint pos; gint openingTagsCount = 0; @@ -155,16 +153,16 @@ static void findMatchingOpeningTag(gchar *tagName, gint openingBracket) /* are we inside tag? */ gint lineNumber = sci_get_line_from_position(sci, pos); gint lineStart = sci_get_position_from_line(sci, lineNumber); - gint matchingOpeningBracket = findBracket(pos, lineStart, '<', '\0', FALSE); - gint matchingClosingBracket = findBracket(pos, lineStart, '>', '\0', FALSE); + gint matchingOpeningBracket = findBracket(sci, pos, lineStart, '<', '\0', FALSE); + gint matchingClosingBracket = findBracket(sci, pos, lineStart, '>', '\0', FALSE); if(-1 != matchingOpeningBracket && -1 != matchingClosingBracket && (matchingClosingBracket > matchingOpeningBracket)) { /* we are inside of some tag. Let us check what tag*/ gchar matchingTagName[MAX_TAG_NAME]; - gboolean isMatchingTagOpening = is_tag_opening(matchingOpeningBracket); - get_tag_name(matchingOpeningBracket, matchingClosingBracket, + gboolean isMatchingTagOpening = is_tag_opening(sci, matchingOpeningBracket); + get_tag_name(sci, matchingOpeningBracket, matchingClosingBracket, matchingTagName, isMatchingTagOpening); if(strcmp(tagName, matchingTagName) == 0) { @@ -186,7 +184,7 @@ static void findMatchingOpeningTag(gchar *tagName, gint openingBracket) if(openingTagsCount == closingTagsCount) { /* matching tag is found */ - highlight_tag(matchingOpeningBracket, matchingClosingBracket); + highlight_tag(sci, matchingOpeningBracket, matchingClosingBracket); highlightedBrackets[2] = matchingOpeningBracket; highlightedBrackets[3] = matchingClosingBracket; break; @@ -195,7 +193,7 @@ static void findMatchingOpeningTag(gchar *tagName, gint openingBracket) } -static void findMatchingClosingTag(gchar *tagName, gint closingBracket) +static void findMatchingClosingTag(ScintillaObject *sci, gchar *tagName, gint closingBracket) { gint pos; gint linesInDocument = sci_get_line_count(sci); @@ -208,16 +206,16 @@ static void findMatchingClosingTag(gchar *tagName, gint closingBracket) /* are we inside tag? */ gint lineNumber = sci_get_line_from_position(sci, pos); gint lineEnd = sci_get_line_end_position(sci, lineNumber); - gint matchingOpeningBracket = findBracket(pos, endOfDocument, '<', '\0', TRUE); - gint matchingClosingBracket = findBracket(pos, endOfDocument, '>', '\0', TRUE); + gint matchingOpeningBracket = findBracket(sci, pos, endOfDocument, '<', '\0', TRUE); + gint matchingClosingBracket = findBracket(sci, pos, endOfDocument, '>', '\0', TRUE); if(-1 != matchingOpeningBracket && -1 != matchingClosingBracket && (matchingClosingBracket > matchingOpeningBracket)) { /* we are inside of some tag. Let us check what tag*/ gchar matchingTagName[64]; - gboolean isMatchingTagOpening = is_tag_opening(matchingOpeningBracket); - get_tag_name(matchingOpeningBracket, matchingClosingBracket, + gboolean isMatchingTagOpening = is_tag_opening(sci, matchingOpeningBracket); + get_tag_name(sci, matchingOpeningBracket, matchingClosingBracket, matchingTagName, isMatchingTagOpening); if(strcmp(tagName, matchingTagName) == 0) { @@ -239,7 +237,7 @@ static void findMatchingClosingTag(gchar *tagName, gint closingBracket) if(openingTagsCount == closingTagsCount) { /* matching tag is found */ - highlight_tag(matchingOpeningBracket, matchingClosingBracket); + highlight_tag(sci, matchingOpeningBracket, matchingClosingBracket); highlightedBrackets[2] = matchingOpeningBracket; highlightedBrackets[3] = matchingClosingBracket; break; @@ -248,33 +246,33 @@ static void findMatchingClosingTag(gchar *tagName, gint closingBracket) } -static void findMatchingTag(gint openingBracket, gint closingBracket) +static void findMatchingTag(ScintillaObject *sci, gint openingBracket, gint closingBracket) { gchar tagName[MAX_TAG_NAME]; - gboolean isTagOpening = is_tag_opening(openingBracket); - get_tag_name(openingBracket, closingBracket, tagName, isTagOpening); + gboolean isTagOpening = is_tag_opening(sci, openingBracket); + get_tag_name(sci, openingBracket, closingBracket, tagName, isTagOpening); if(TRUE == isTagOpening) - findMatchingClosingTag(tagName, closingBracket); + findMatchingClosingTag(sci, tagName, closingBracket); else - findMatchingOpeningTag(tagName, openingBracket); + findMatchingOpeningTag(sci, tagName, openingBracket); } -static void run_tag_highlighter(void) +static void run_tag_highlighter(ScintillaObject *sci) { gint position = sci_get_current_position(sci); gint lineNumber = sci_get_current_line(sci); gint lineStart = sci_get_position_from_line(sci, lineNumber); gint lineEnd = sci_get_line_end_position(sci, lineNumber); - gint openingBracket = findBracket(position, lineStart, '<', '>', FALSE); - gint closingBracket = findBracket(position, lineEnd, '>', '<', TRUE); + gint openingBracket = findBracket(sci, position, lineStart, '<', '>', FALSE); + gint closingBracket = findBracket(sci, position, lineEnd, '>', '<', TRUE); int i; if(-1 == openingBracket || -1 == closingBracket) { - clear_previous_highlighting(highlightedBrackets[0], highlightedBrackets[1]); - clear_previous_highlighting(highlightedBrackets[2], highlightedBrackets[3]); + clear_previous_highlighting(sci, highlightedBrackets[0], highlightedBrackets[1]); + clear_previous_highlighting(sci, highlightedBrackets[2], highlightedBrackets[3]); for(i=0; i<3; i++) highlightedBrackets[i] = 0; return; @@ -285,8 +283,8 @@ static void run_tag_highlighter(void) if(openingBracket != highlightedBrackets[0] || closingBracket != highlightedBrackets[1]) { - clear_previous_highlighting(highlightedBrackets[0], highlightedBrackets[1]); - clear_previous_highlighting(highlightedBrackets[2], highlightedBrackets[3]); + clear_previous_highlighting(sci, highlightedBrackets[0], highlightedBrackets[1]); + clear_previous_highlighting(sci, highlightedBrackets[2], highlightedBrackets[3]); } highlightedBrackets[0] = openingBracket; @@ -294,11 +292,11 @@ static void run_tag_highlighter(void) /* Highlight current tag. Matching tag will be highlighted from * findMatchingTag() functiong */ - highlight_tag(openingBracket, closingBracket); + highlight_tag(sci, openingBracket, closingBracket); /* Find matching tag only if a tag is not self-closing */ - if(FALSE == is_tag_self_closing(closingBracket)) - findMatchingTag(openingBracket, closingBracket); + if(FALSE == is_tag_self_closing(sci, closingBracket)) + findMatchingTag(sci, openingBracket, closingBracket); } @@ -308,10 +306,7 @@ static gboolean on_editor_notify(GObject *obj, GeanyEditor *editor, { gint lexer; - /* setting global sci variable to be available in other functions */ - sci = editor->sci; - - lexer = sci_get_lexer(sci); + lexer = sci_get_lexer(editor->sci); if(lexer != SCLEX_HTML) { return FALSE; @@ -321,7 +316,7 @@ static gboolean on_editor_notify(GObject *obj, GeanyEditor *editor, switch (nt->nmhdr.code) { case SCN_UPDATEUI: - run_tag_highlighter(); + run_tag_highlighter(editor->sci); break; } @@ -344,6 +339,11 @@ void plugin_init(GeanyData *data) void plugin_cleanup(void) { - clear_previous_highlighting(highlightedBrackets[0], highlightedBrackets[1]); - clear_previous_highlighting(highlightedBrackets[2], highlightedBrackets[3]); + GeanyDocument *doc = document_get_current(); + + if (doc) + { + clear_previous_highlighting(doc->editor->sci, highlightedBrackets[0], highlightedBrackets[1]); + clear_previous_highlighting(doc->editor->sci, highlightedBrackets[2], highlightedBrackets[3]); + } } -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
← Newer
1
2
3
Older →
Jump to page:
1
2
3
Results per page:
10
25
50
100
200