[Geany-devel] Writing a plugin, not sure what to do with it

2011-11-15 Thread Meyer
Hi all,

I was looking for some programming to do recently and found this feature
request:
https://sourceforge.net/tracker/?func=detailaid=3383201group_id=153444atid=787794.
 I tried writing a plugin which implements the feature, and it seems
to
work, but now I'm not sure what to do with it now.  I've pasted the code
here: http://pastebin.com/549Dazj0.  My main concerns are that it seems
very hack-ish, and seems too simple to be a full plugin.

Any advice regarding the code, what to do with it, etc. would be much
appreciated.

Thanks,
Alex
___
Geany-devel mailing list
Geany-devel@uvena.de
https://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel


Re: [Geany-devel] Writing a plugin, not sure what to do with it

2011-11-16 Thread Meyer
Hi,

Thanks very much for the input!  I've pasted an updated version here [1]
which should implement your suggestions (assuming I understand them
correctly).

Cheers
Alex

[1] http://pastebin.com/WJXYQm1N

On Tue, Nov 15, 2011 at 6:45 PM, Lex Trotman ele...@gmail.com wrote:

 On Wed, Nov 16, 2011 at 8:29 AM, Meyer 3m.me...@gmail.com wrote:
  Hi all,
 
  I was looking for some programming to do recently and found this feature
  request:
 
 https://sourceforge.net/tracker/?func=detailaid=3383201group_id=153444atid=787794
  .  I tried writing a plugin which implements the feature, and it seems to
  work, but now I'm not sure what to do with it now.  I've pasted the code
  here: http://pastebin.com/549Dazj0.  My main concerns are that it seems
 very
  hack-ish, and seems too simple to be a full plugin.
 
  Any advice regarding the code, what to do with it, etc. would be much
  appreciated.

 Hi,

 Nice simple plugin, but very fixed in operation, I have a couple of
 suggestions.

 1. Use keybindings rather than the editor notify. This lets you catch
 the key before it is inserted in Scintilla and allows the user to set
 the trigger keycode (for me the actual characters would not be
 appropriate, but ctrlshiftchar would be, but different users would
 have different use-cases).  See for eg addons plugin for how to use
 keybindings.
 2. Group the changes you make into one undo group, see the scintilla docs.
 3. Add a preferences dialog to allow the opening and the respective
 closing character(s) to be set for each trigger keycode.  It would of
 course default to your current pairs but would allow updating for
 other languages and multi character sequences.  See again for eg
 addons.
 4. Have 1 and 3 allow up to say eight codes/pairs to be defined.

 The plugins infrastructure is about to get moved to Github and some
 new processes are being defined, see

 http://news.gmane.org/find-root.php?message_id=%3c4EC29977.1030802%40frank.uvena.de%3e
 so keep an eye on that thread and you can be the first new plugin
 using the new process :)

 Cheers
 Lex

 
  Thanks,
  Alex
 
  ___
  Geany-devel mailing list
  Geany-devel@uvena.de
  https://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel
 
 
 ___
 Geany-devel mailing list
 Geany-devel@uvena.de
 https://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel

___
Geany-devel mailing list
Geany-devel@uvena.de
https://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel


Re: [Geany-devel] Writing a plugin, not sure what to do with it

2011-11-17 Thread Meyer
I've never used a version control system before for my own code, but I
think I it up correctly: https://github.com/pzoxiuv/Geany-Plugins

Cheers,
Alex

On Thu, Nov 17, 2011 at 4:01 AM, Frank Lanitz fr...@frank.uvena.de wrote:

 Am 17.11.2011 02:49, schrieb Meyer:

  Thanks very much for the input!  I've pasted an updated version here [1]
  which should implement your suggestions (assuming I understand them
  correctly).

 Didn't check the source code but maybe you can put it into some version
 control system. Maybe at github or gitourios. Would make things for us a
 bit easier.

 Cheers,
 Frank

 ___
 Geany-devel mailing list
 Geany-devel@uvena.de
 https://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel

___
Geany-devel mailing list
Geany-devel@uvena.de
https://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel


Re: [Geany-devel] Writing a plugin, not sure what to do with it

2011-11-18 Thread Meyer
On Thu, Nov 17, 2011 at 8:31 PM, Matthew Brush mbr...@codebrainz.ca wrote:

 On 11/17/2011 10:01 AM, Meyer wrote:

 I've never used a version control system before for my own code, but I
 think I it up correctly: 
 https://github.com/pzoxiuv/**Geany-Pluginshttps://github.com/pzoxiuv/Geany-Plugins


 Yep, I just cloned it and had a quick look.  I left some comments on the
 github commit.


 We could add this to the geany-plugins project if you want, but it seems a
 bit on the small side, IMO.  Maybe the code would fit better in the
 Addons plugin?


Thanks for looking at it, I've fixed the g_strdup_printf stuff.  I agree
it's too small to be its own plugin, and if you thought it could be put in
with the Addons plugin that would be great.  How would that happen?

Cheers,
Alex


 Cheers,
 Matthew Brush


  Cheers,
 Alex

 On Thu, Nov 17, 2011 at 4:01 AM, Frank Lanitz fr...@frank.uvena.de
 mailto:fr...@frank.uvena.de wrote:

Am 17.11.2011 02:49, schrieb Meyer:

  Thanks very much for the input!  I've pasted an updated version
here [1]
  which should implement your suggestions (assuming I understand them
  correctly).

Didn't check the source code but maybe you can put it into some version
control system. Maybe at github or gitourios. Would make things for us
 a
bit easier.

Cheers,
Frank

__**_
Geany-devel mailing list
Geany-devel@uvena.de mailto:Geany-devel@uvena.de

 https://lists.uvena.de/cgi-**bin/mailman/listinfo/geany-**develhttps://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel





 __**_
 Geany-devel mailing list
 Geany-devel@uvena.de
 https://lists.uvena.de/cgi-**bin/mailman/listinfo/geany-**develhttps://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel


 __**_
 Geany-devel mailing list
 Geany-devel@uvena.de
 https://lists.uvena.de/cgi-**bin/mailman/listinfo/geany-**develhttps://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel

___
Geany-devel mailing list
Geany-devel@uvena.de
https://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel


[Geany-devel] (no subject)

2011-12-01 Thread Meyer
Hi,

I have two possible situations that I need to differentiate between, and
I'm not sure how to do it - The first situation is the user deletes
selected text by overwriting it with a new character.  The second is the
user deletes selected text by pressing backspace/delete, and then enters a
new character.  I thought this would be fairly easy, but I've been trying
to figure it out for awhile and haven't gotten anywhere. Does anyone have
any ideas for how I could accomplish this?

Thanks,
Alex
___
Geany-devel mailing list
Geany-devel@uvena.de
https://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel


Re: [Geany-devel] (no subject)

2011-12-01 Thread Meyer
Sure.  I want to be able to select text, and then insert a character (e.g.
an apostrophe) before and after the selection just by pressing the
apostrophe key.  Since the normal behavior when a character is pressed
while text is selected is to delete the text and insert a character, I need
to know when that happens - then I could undo the delete and insert my
characters.  If it was two separate events though - delete then insert - I
won't want to do anything.

I have it working now, but it seems awfully hackish:  when one of the
characters I might insert is pressed, I store the current position of the
cursor and undo the last event.  If the new cursor position is the same
place as the old one, then it was a overwrite event.  Otherwise, it was
delete then insert.

So, any ideas for how I could do this would be much appreciated!

Alex

On Thu, Dec 1, 2011 at 3:40 PM, Frank Lanitz fr...@frank.uvena.de wrote:

 Am 01.12.2011 20:57, schrieb Meyer:
  I have two possible situations that I need to differentiate between, and
  I'm not sure how to do it - The first situation is the user deletes
  selected text by overwriting it with a new character.  The second is the
  user deletes selected text by pressing backspace/delete, and then enters
  a new character.  I thought this would be fairly easy, but I've been
  trying to figure it out for awhile and haven't gotten anywhere. Does
  anyone have any ideas for how I could accomplish this?

 Can you go into more details in which context you need that information?

 Cheers,
 Frank



 ___
 Geany-devel mailing list
 Geany-devel@uvena.de
 https://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel


___
Geany-devel mailing list
Geany-devel@uvena.de
https://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel


Re: [Geany-devel] (no subject)

2011-12-01 Thread Meyer
D'oh.  I had tried that first, but incorrectly I guess and came to the
conclusion that you couldn't use keybindings with just a single character.
I suppose I shouldn't have given up so quickly, it's working perfectly now.

Thanks!
Alex

On Thu, Dec 1, 2011 at 7:20 PM, Lex Trotman ele...@gmail.com wrote:

 On Fri, Dec 2, 2011 at 10:54 AM, Meyer 3m.me...@gmail.com wrote:
  Sure.  I want to be able to select text, and then insert a character
 (e.g.
  an apostrophe) before and after the selection just by pressing the
  apostrophe key.  Since the normal behavior when a character is pressed
 while
  text is selected is to delete the text and insert a character, I need to
  know when that happens - then I could undo the delete and insert my
  characters.  If it was two separate events though - delete then insert -
 I
  won't want to do anything.
 
  I have it working now, but it seems awfully hackish:  when one of the
  characters I might insert is pressed, I store the current position of the
  cursor and undo the last event.  If the new cursor position is the same
  place as the old one, then it was a overwrite event.  Otherwise, it was
  delete then insert.
 
  So, any ideas for how I could do this would be much appreciated!

 I assume you are writing a plugin.

 You should use the keybinding system to capture the apostrophe before
 it goes to scintilla so you can detect and do anything you want.

 Cheers
 Lex

 
  Alex
 
  On Thu, Dec 1, 2011 at 3:40 PM, Frank Lanitz fr...@frank.uvena.de
 wrote:
 
  Am 01.12.2011 20:57, schrieb Meyer:
   I have two possible situations that I need to differentiate between,
 and
   I'm not sure how to do it - The first situation is the user deletes
   selected text by overwriting it with a new character.  The second is
 the
   user deletes selected text by pressing backspace/delete, and then
 enters
   a new character.  I thought this would be fairly easy, but I've been
   trying to figure it out for awhile and haven't gotten anywhere. Does
   anyone have any ideas for how I could accomplish this?
 
  Can you go into more details in which context you need that information?
 
  Cheers,
  Frank
 
 
 
  ___
  Geany-devel mailing list
  Geany-devel@uvena.de
  https://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel
 
 
 
  ___
  Geany-devel mailing list
  Geany-devel@uvena.de
  https://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel
 
 ___
 Geany-devel mailing list
 Geany-devel@uvena.de
 https://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel

___
Geany-devel mailing list
Geany-devel@uvena.de
https://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel


Re: [Geany-devel] (no subject)

2011-12-01 Thread Meyer
Hi,

I've started integrating my plugin into the Addons plugin.  As of now, it
adds two check boxes to the Addons preferences to enable wrapping text
automatically (just by hitting apostrophe) and wrapping text by hitting a
key combo.  The first method seems to work, the second should work but you
can't define the wrap combos yet.  I've just put that on my github repo,
and should have time tomorrow to finish it up.

Cheers,
Alex


On Thu, Dec 1, 2011 at 10:44 PM, Nathan Broadbent nathan@gmail.comwrote:

 Hi Alex,

 I'm also really keen for this feature, so could I please request a recent
 copy of the plugin? Perhaps you could update your repo on github?
 I'd like to start using it right away, and could help to fix any bugs.

 I also really think that this should to be added to the 'Auto-close quotes
 and brackets' feature in core Geany, since it is the expected behavior for
 any user coming from TextMate or Gedit.


 Regards,
 Nathan



 On Thu, Dec 1, 2011 at 7:20 PM, Lex Trotman ele...@gmail.com wrote:

 On Fri, Dec 2, 2011 at 10:54 AM, Meyer 3m.me...@gmail.com wrote:
  Sure.  I want to be able to select text, and then insert a character
 (e.g.
  an apostrophe) before and after the selection just by pressing the
  apostrophe key.  Since the normal behavior when a character is pressed
 while
  text is selected is to delete the text and insert a character, I need
 to
  know when that happens - then I could undo the delete and insert my
  characters.  If it was two separate events though - delete then insert
 - I
  won't want to do anything.
 
  I have it working now, but it seems awfully hackish:  when one of the
  characters I might insert is pressed, I store the current position of
 the
  cursor and undo the last event.  If the new cursor position is the same
  place as the old one, then it was a overwrite event.  Otherwise, it
 was
  delete then insert.
 
  So, any ideas for how I could do this would be much appreciated!

 I assume you are writing a plugin.

 You should use the keybinding system to capture the apostrophe before
 it goes to scintilla so you can detect and do anything you want.

 Cheers
 Lex

 
  Alex
 
  On Thu, Dec 1, 2011 at 3:40 PM, Frank Lanitz fr...@frank.uvena.de
 wrote:
 
  Am 01.12.2011 20:57, schrieb Meyer:
   I have two possible situations that I need to differentiate
 between, and
   I'm not sure how to do it - The first situation is the user deletes
   selected text by overwriting it with a new character.  The second
 is the
   user deletes selected text by pressing backspace/delete, and then
 enters
   a new character.  I thought this would be fairly easy, but I've been
   trying to figure it out for awhile and haven't gotten anywhere. Does
   anyone have any ideas for how I could accomplish this?
 
  Can you go into more details in which context you need that
 information?
 
  Cheers,
  Frank
 
 
 
  ___
  Geany-devel mailing list
  Geany-devel@uvena.de
  https://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel
 
 
 
  ___
  Geany-devel mailing list
  Geany-devel@uvena.de
  https://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel
 
 ___
 Geany-devel mailing list
 Geany-devel@uvena.de
 https://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel



 ___
 Geany-devel mailing list
 Geany-devel@uvena.de
 https://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel



 ___
 Geany-devel mailing list
 Geany-devel@uvena.de
 https://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel


___
Geany-devel mailing list
Geany-devel@uvena.de
https://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel


[Geany-devel] Additions to Addon plugin

2011-12-05 Thread Meyer
Hi all,

I've been working on an addition to the Addons plugin that gives a couple
options for wrapping text with characters.  It adds two check boxes to the
plugin's preferences, one to enable auto wrapping and one to enable
keybinded wrapping.  Auto wrapping automatically wraps selected text as
soon as a certain character is pressed (apostrophe, quote, back tick, left
parenthesis, or left square/curly bracket) and keybinded wrapping provides
eight keybindings which correspond to eight user-set pairs of characters,
which will surround selected text when the keybinding is pressed.

The code (two new files and modified addons.c) is here -
https://github.com/pzoxiuv/Geany-Plugins/tree/master/geany-plugins-0.21.1/addons/src.
 Is there any way this could be eventually added to the Addons plugin?

(And thanks Dimitar Zhekov for the advice you gave me in my previous
thread, it was very helpful).

Cheers,
Alex
___
Geany-devel mailing list
Geany-devel@uvena.de
https://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel


[Geany-devel] Wrap words Addon patch

2011-12-11 Thread Meyer
Now that the geany-plugins has been converted to Git, I thought I'd post
this patch that adds the feature I've been working on (wrapping text with
characters) to the Addons plugin.  Any chance of it being added?

And I've never really used Git before too, so please let me know if the
patch is incorrectly made or something.

Cheers
Alex
From e0027703185c7952d9d5e8d4f9477c542c73f6a6 Mon Sep 17 00:00:00 2001
From: Alex M 3m.me...@gmail.com
Date: Sat, 10 Dec 2011 17:40:16 -0500
Subject: [PATCH] Adds wrap words feature to Addons plugin.

---
 addons/src/Makefile.am|4 +-
 addons/src/addons.c   |   48 +++-
 addons/src/ao_wrapwords.c |  300 +
 addons/src/ao_wrapwords.h |   28 
 4 files changed, 376 insertions(+), 4 deletions(-)
 create mode 100644 addons/src/ao_wrapwords.c
 create mode 100644 addons/src/ao_wrapwords.h

diff --git a/addons/src/Makefile.am b/addons/src/Makefile.am
index 2a386d5..eabb6e8 100644
--- a/addons/src/Makefile.am
+++ b/addons/src/Makefile.am
@@ -16,6 +16,7 @@ addons_la_SOURCES = \
 	ao_markword.h \
 	ao_tasks.h \
 	ao_xmltagging.h \
+	ao_wrapwords.h \
 	addons.c \
 	ao_blanklines.c \
 	ao_doclist.c \
@@ -24,7 +25,8 @@ addons_la_SOURCES = \
 	ao_bookmarklist.c \
 	ao_markword.c \
 	ao_tasks.c \
-	ao_xmltagging.c
+	ao_xmltagging.c \
+	ao_wrapwords.c
 
 addons_la_LIBADD = $(COMMONLIBS)
 
diff --git a/addons/src/addons.c b/addons/src/addons.c
index 73a5840..93c81d0 100644
--- a/addons/src/addons.c
+++ b/addons/src/addons.c
@@ -37,7 +37,7 @@
 #include ao_markword.h
 #include ao_tasks.h
 #include ao_xmltagging.h
-
+#include ao_wrapwords.h
 
 
 GeanyPlugin		*geany_plugin;
@@ -77,6 +77,8 @@ typedef struct
 	gboolean enable_bookmarklist;
 	gboolean enable_markword;
 	gboolean enable_xmltagging;
+	gboolean enable_wrapwords;
+	gboolean enable_wrapwords_auto;
 	gboolean strip_trailing_blank_lines;
 
 	gchar *tasks_token_list;
@@ -271,6 +273,10 @@ void plugin_init(GeanyData *data)
 		addons, strip_trailing_blank_lines, FALSE);
 	ao_info-enable_xmltagging = utils_get_setting_boolean(config, addons,
 		enable_xmltagging, FALSE);
+	ao_info-enable_wrapwords = utils_get_setting_boolean(config, addons,
+		enable_wrapwords, FALSE);
+	ao_info-enable_wrapwords_auto = utils_get_setting_boolean(config, addons,
+		enable_wrapwords_auto, FALSE);
 
 	plugin_module_make_resident(geany_plugin);
 
@@ -283,9 +289,9 @@ void plugin_init(GeanyData *data)
 		ao_info-tasks_token_list, ao_info-tasks_scan_all_documents);
 
 	ao_blanklines_set_enable(ao_info-strip_trailing_blank_lines);
-
+	
 	/* setup keybindings */
-	key_group = plugin_set_key_group(geany_plugin, addons, KB_COUNT, NULL);
+	key_group = plugin_set_key_group(geany_plugin, addons, KB_COUNT+8, NULL);
 	keybindings_set_item(key_group, KB_FOCUS_BOOKMARK_LIST, kb_bmlist_activate,
 		0, 0, focus_bookmark_list, _(Focus Bookmark List), NULL);
 	keybindings_set_item(key_group, KB_FOCUS_TASKS, kb_tasks_activate,
@@ -295,6 +301,9 @@ void plugin_init(GeanyData *data)
 	keybindings_set_item(key_group, KB_XMLTAGGING, kb_ao_xmltagging,
 		0, 0, xml_tagging, _(Run XML tagging), NULL);
 
+	ao_wrapwords_init(ao_info-config_file, key_group);
+	ao_wrapwords_set_enabled (ao_info-enable_wrapwords, ao_info-enable_wrapwords_auto);
+
 	g_key_file_free(config);
 }
 
@@ -359,6 +368,12 @@ static void ao_configure_response_cb(GtkDialog *dialog, gint response, gpointer
 			g_object_get_data(G_OBJECT(dialog), check_blanklines;
 		ao_info-enable_xmltagging = (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(
 			g_object_get_data(G_OBJECT(dialog), check_xmltagging;
+		ao_info-enable_wrapwords = (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(
+			g_object_get_data(G_OBJECT(dialog), check_wrapwords;
+		ao_info-enable_wrapwords_auto = (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(
+			g_object_get_data(G_OBJECT(dialog), check_wrapwords_auto;
+			
+		ao_wrapwords_set_enabled (ao_info-enable_wrapwords, ao_info-enable_wrapwords_auto);
 
 		g_key_file_load_from_file(config, ao_info-config_file, G_KEY_FILE_NONE, NULL);
 		g_key_file_set_boolean(config, addons,
@@ -377,6 +392,10 @@ static void ao_configure_response_cb(GtkDialog *dialog, gint response, gpointer
 		  ao_info-strip_trailing_blank_lines);
 		g_key_file_set_boolean(config, addons, enable_xmltagging,
 			ao_info-enable_xmltagging);
+		g_key_file_set_boolean(config, addons, enable_wrapwords,
+			ao_info-enable_wrapwords);
+		g_key_file_set_boolean(config, addons, enable_wrapwords_auto,
+			ao_info-enable_wrapwords_auto);
 
 		g_object_set(ao_info-doclist, enable-doclist, ao_info-enable_doclist, NULL);
 		g_object_set(ao_info-doclist, sort-mode, ao_info-doclist_sort_mode, NULL);
@@ -418,6 +437,7 @@ GtkWidget *plugin_configure(GtkDialog *dialog)
 	GtkWidget *check_bookmarklist, *check_markword, *frame_tasks, *vbox_tasks;
 	GtkWidget *check_tasks_scan_mode, *entry_tasks_tokens, *label_tasks_tokens, *tokens_hbox;
 	GtkWidget *check_blanklines, *check_xmltagging;