Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Updates wording of word wraping feature to "enclose words" from "wrap…

… words", to make its function more clear.
  • Loading branch information...
commit 9abd2edaf7c1b90a8f99d1c7cff8629deff9404a 1 parent ebd8010
@pzoxiuv pzoxiuv authored frlan committed
View
8 addons/README
@@ -26,7 +26,7 @@ Features
* Highlighting all occurrences of a word when double-clicking it
* Strip trailing blank lines when saving
* XMLtagging
- * Wrap selected text with characters
+ * Enclose selected text with characters
Usage
-----
@@ -80,14 +80,14 @@ XML tagging allows to easy tag a selected text, by checking for a
selection, offering a little dialog for inserting a tag and
replacing a selection.
-*Wrapping selected text*
+*Enclosing selected text*
^^^^^^^^^^^^^^^^^^^^^^^^
-Provides two methods for wrapping selected text in characters. If the 'Wrap
+Provides two methods for enclosing selected text in characters. If the 'Enclose
selection automatically' option is checked in Preferences, selected text will
be surrounded when certain characters are pressed (e.g. highlight a string and
press ", the string will be surrounded in double quotes). Also allows you to
define up to eight of your own opening and closing character pairs, which can
-then be linked to a keybinding (e.g. set [ and ] to be Wrap Pair 1 and the
+then be linked to a keybinding (e.g. set [ and ] to be Enclose Pair 1 and the
keybinding to ctrl+[ , highlight some text and press ctrl+[ to surround the
selected text in brackets).
View
72 addons/src/addons.c
@@ -77,8 +77,8 @@ typedef struct
gboolean enable_bookmarklist;
gboolean enable_markword;
gboolean enable_xmltagging;
- gboolean enable_wrapwords;
- gboolean enable_wrapwords_auto;
+ gboolean enable_enclose_words;
+ gboolean enable_enclose_words_auto;
gboolean strip_trailing_blank_lines;
gchar *tasks_token_list;
@@ -273,10 +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);
+ ao_info->enable_enclose_words = utils_get_setting_boolean(config, "addons",
+ "enable_enclose_words", FALSE);
+ ao_info->enable_enclose_words_auto = utils_get_setting_boolean(config, "addons",
+ "enable_enclose_words_auto", FALSE);
plugin_module_make_resident(geany_plugin);
@@ -301,8 +301,8 @@ 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);
+ ao_enclose_words_init(ao_info->config_file, key_group);
+ ao_enclose_words_set_enabled (ao_info->enable_enclose_words, ao_info->enable_enclose_words_auto);
g_key_file_free(config);
}
@@ -368,12 +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_info->enable_enclose_words = (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(
+ g_object_get_data(G_OBJECT(dialog), "check_enclose_words"))));
+ ao_info->enable_enclose_words_auto = (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(
+ g_object_get_data(G_OBJECT(dialog), "check_enclose_words_auto"))));
- ao_wrapwords_set_enabled (ao_info->enable_wrapwords, ao_info->enable_wrapwords_auto);
+ ao_enclose_words_set_enabled (ao_info->enable_enclose_words, ao_info->enable_enclose_words_auto);
g_key_file_load_from_file(config, ao_info->config_file, G_KEY_FILE_NONE, NULL);
g_key_file_set_boolean(config, "addons",
@@ -392,10 +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_key_file_set_boolean(config, "addons", "enable_enclose_words",
+ ao_info->enable_enclose_words);
+ g_key_file_set_boolean(config, "addons", "enable_enclose_words_auto",
+ ao_info->enable_enclose_words_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);
@@ -437,7 +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;
- GtkWidget *check_wrapwords, *check_wrapwords_auto, *wrapwords_config_button, *wrapwords_hbox;
+ GtkWidget *check_enclose_words, *check_enclose_words_auto, *enclose_words_config_button, *enclose_words_hbox;
vbox = gtk_vbox_new(FALSE, 6);
@@ -557,23 +557,23 @@ GtkWidget *plugin_configure(GtkDialog *dialog)
ao_info->enable_xmltagging);
gtk_box_pack_start(GTK_BOX(vbox), check_xmltagging, FALSE, FALSE, 3);
- check_wrapwords = gtk_check_button_new_with_label(
- _("Wrap selection on configurable keybindings"));
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_wrapwords),
- ao_info->enable_wrapwords);
+ check_enclose_words = gtk_check_button_new_with_label(
+ _("Enclose selection on configurable keybindings"));
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_enclose_words),
+ ao_info->enable_enclose_words);
- wrapwords_config_button = gtk_button_new_with_label ("Configure wrap pairs");
- g_signal_connect(wrapwords_config_button, "clicked", G_CALLBACK(ao_wrapwords_config), dialog);
- wrapwords_hbox = gtk_hbox_new(FALSE, 0);
- gtk_box_pack_start(GTK_BOX(wrapwords_hbox), check_wrapwords, FALSE, FALSE, 3);
- gtk_box_pack_start(GTK_BOX(wrapwords_hbox), wrapwords_config_button, TRUE, TRUE, 3);
- gtk_box_pack_start(GTK_BOX(vbox), wrapwords_hbox, FALSE, FALSE, 3);
+ enclose_words_config_button = gtk_button_new_with_label ("Configure enclose pairs");
+ g_signal_connect(enclose_words_config_button, "clicked", G_CALLBACK(ao_enclose_words_config), dialog);
+ enclose_words_hbox = gtk_hbox_new(FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(enclose_words_hbox), check_enclose_words, FALSE, FALSE, 3);
+ gtk_box_pack_start(GTK_BOX(enclose_words_hbox), enclose_words_config_button, TRUE, TRUE, 3);
+ gtk_box_pack_start(GTK_BOX(vbox), enclose_words_hbox, FALSE, FALSE, 3);
- check_wrapwords_auto = gtk_check_button_new_with_label(
- _("Wrap selection automatically (without having to press a keybinding)"));
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_wrapwords_auto),
- ao_info->enable_wrapwords_auto);
- gtk_box_pack_start(GTK_BOX(vbox), check_wrapwords_auto, FALSE, FALSE, 3);
+ check_enclose_words_auto = gtk_check_button_new_with_label(
+ _("Enclose selection automatically (without having to press a keybinding)"));
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_enclose_words_auto),
+ ao_info->enable_enclose_words_auto);
+ gtk_box_pack_start(GTK_BOX(vbox), check_enclose_words_auto, FALSE, FALSE, 3);
g_object_set_data(G_OBJECT(dialog), "check_doclist", check_doclist);
@@ -590,9 +590,9 @@ GtkWidget *plugin_configure(GtkDialog *dialog)
g_object_set_data(G_OBJECT(dialog), "check_markword", check_markword);
g_object_set_data(G_OBJECT(dialog), "check_blanklines", check_blanklines);
g_object_set_data(G_OBJECT(dialog), "check_xmltagging", check_xmltagging);
- g_object_set_data(G_OBJECT(dialog), "check_wrapwords", check_wrapwords);
- g_object_set_data(G_OBJECT(dialog), "check_wrapwords_auto", check_wrapwords_auto);
- g_object_set_data(G_OBJECT(dialog), "wrapwords_config_button", wrapwords_config_button);
+ g_object_set_data(G_OBJECT(dialog), "check_enclose_words", check_enclose_words);
+ g_object_set_data(G_OBJECT(dialog), "check_enclose_words_auto", check_enclose_words_auto);
+ g_object_set_data(G_OBJECT(dialog), "enclose_words_config_button", enclose_words_config_button);
g_signal_connect(dialog, "response", G_CALLBACK(ao_configure_response_cb), NULL);
ao_configure_tasks_toggled_cb(GTK_TOGGLE_BUTTON(check_tasks), dialog);
View
74 addons/src/ao_wrapwords.c
@@ -30,25 +30,25 @@ enum
NUM_COLUMNS
};
-void wrap_text_action (guint);
+void enclose_text_action (guint);
gboolean on_key_press (GtkWidget *, GdkEventKey *, gpointer);
void configure_response (GtkDialog *, gint, gpointer);
-void wrap_chars_changed (GtkCellRendererText *, gchar *, gchar *, gpointer);
+void enclose_chars_changed (GtkCellRendererText *, gchar *, gchar *, gpointer);
-gchar *wrap_chars [8];
+gchar *enclose_chars [8];
gboolean auto_enabled = FALSE;
-gboolean wrap_enabled = FALSE;
+gboolean enclose_enabled = FALSE;
gchar *config_file;
GtkListStore *chars_list;
/*
- * Called when a keybinding associated with the plugin is pressed. Wraps the selected text in
+ * Called when a keybinding associated with the plugin is pressed. Encloses the selected text in
* the characters associated with this keybinding.
*/
-void wrap_text_action (guint key_id)
+void enclose_text_action (guint key_id)
{
- if (!wrap_enabled)
+ if (!enclose_enabled)
return;
gint selection_end;
@@ -62,16 +62,16 @@ void wrap_text_action (guint key_id)
selection_end = sci_get_selection_end (sci_obj);
sci_start_undo_action (sci_obj);
- insert_chars [0] = *wrap_chars [key_id];
+ insert_chars [0] = *enclose_chars [key_id];
sci_insert_text (sci_obj, sci_get_selection_start (sci_obj), insert_chars);
- insert_chars [0] = *(wrap_chars [key_id] + 1);
+ insert_chars [0] = *(enclose_chars [key_id] + 1);
sci_insert_text (sci_obj, selection_end + 1, insert_chars);
sci_set_current_position (sci_obj, selection_end + 2, TRUE);
sci_end_undo_action (sci_obj);
}
/*
- * Captures keypresses, if auto-wrapping automatically wraps selected text when certain
+ * Captures keypresses, if auto-enclosing automatically encloses selected text when certain
* characters are pressed.
*/
@@ -131,26 +131,26 @@ gboolean on_key_press (GtkWidget *widget, GdkEventKey *event, gpointer user_data
}
/*
- * Loads the wrapping characters from the config file and sets keybindings.
+ * Loads the enclosing characters from the config file and sets keybindings.
*/
-void ao_wrapwords_init (gchar *config_file_name, GeanyKeyGroup *key_group)
+void ao_enclose_words_init (gchar *config_file_name, GeanyKeyGroup *key_group)
{
GKeyFile *config = g_key_file_new();
- gchar *key_name = g_malloc0 (6);
+ gchar *key_name = g_malloc0 (9);
gint i;
config_file = g_strdup (config_file_name);
- g_key_file_load_from_file(config, config_file, G_KEY_FILE_NONE, NULL);
+ g_key_file_load_from_file (config, config_file, G_KEY_FILE_NONE, NULL);
- g_stpcpy (key_name, "Wrap_x");
+ g_stpcpy (key_name, "Enclose_x");
for (i = 0; i < 8; i++)
{
- key_name [5] = (gchar) (i + '0');
- wrap_chars [i] = utils_get_setting_string (config, "addons", key_name, " ");
- key_name [5] = (gchar) ((i + 1) + '0');
- keybindings_set_item (key_group, i+4, (GeanyKeyCallback) wrap_text_action, 0, 0, key_name,
+ key_name [8] = (gchar) (i + '0');
+ enclose_chars [i] = utils_get_setting_string (config, "addons", key_name, " ");
+ key_name [8] = (gchar) ((i + 1) + '0');
+ keybindings_set_item (key_group, i+4, (GeanyKeyCallback) enclose_text_action, 0, 0, key_name,
key_name, NULL);
}
@@ -161,15 +161,15 @@ void ao_wrapwords_init (gchar *config_file_name, GeanyKeyGroup *key_group)
g_free (key_name);
}
-void ao_wrapwords_set_enabled (gboolean enabled_w, gboolean enabled_a)
+void ao_enclose_words_set_enabled (gboolean enabled_w, gboolean enabled_a)
{
auto_enabled = enabled_a;
- wrap_enabled = enabled_w;
+ enclose_enabled = enabled_w;
}
/*
* Called when the user closes the plugin preferences dialog. If the user accepted or ok'd,
- * update the array of wrapping characters and config file with the new wrapping characters
+ * update the array of enclosing characters and config file with the new enclosing characters
*/
void configure_response (GtkDialog *dialog, gint response, gpointer char_tree_view)
@@ -178,7 +178,7 @@ void configure_response (GtkDialog *dialog, gint response, gpointer char_tree_vi
GKeyFile *config = g_key_file_new();
gchar *config_data = NULL;
gchar *prior_char_str, *end_char_str;
- gchar *key_name = g_malloc0 (6);
+ gchar *key_name = g_malloc0 (9);
gint i;
if (response != GTK_RESPONSE_OK && response != GTK_RESPONSE_ACCEPT) {
@@ -190,19 +190,19 @@ void configure_response (GtkDialog *dialog, gint response, gpointer char_tree_vi
g_key_file_load_from_file(config, config_file, G_KEY_FILE_NONE, NULL);
- g_stpcpy (key_name, "Wrap_x");
+ g_stpcpy (key_name, "Enclose_x");
for (i = 0; i < 8; i++)
{
- key_name [5] = (gchar) (i + '0');
+ key_name [8] = (gchar) (i + '0');
gtk_tree_model_get (GTK_TREE_MODEL(chars_list), &char_iter,
COLUMN_PRIOR_CHAR, &prior_char_str, COLUMN_END_CHAR, &end_char_str, -1);
- *wrap_chars [i] = prior_char_str [0];
- *(wrap_chars [i] + 1) = end_char_str [0];
+ *enclose_chars [i] = prior_char_str [0];
+ *(enclose_chars [i] + 1) = end_char_str [0];
gtk_tree_model_iter_next (GTK_TREE_MODEL(chars_list), &char_iter);
- g_key_file_set_string (config, "addons", key_name, wrap_chars [i]);
+ g_key_file_set_string (config, "addons", key_name, enclose_chars [i]);
}
config_data = g_key_file_to_data (config, NULL, NULL);
@@ -217,10 +217,10 @@ void configure_response (GtkDialog *dialog, gint response, gpointer char_tree_vi
/*
* When the user changes an entry in the preferences dialog, this updates the list of
- * wrapping characters with the new entry
+ * enclosing characters with the new entry
*/
-void wrap_chars_changed (GtkCellRendererText *renderer, gchar *path, gchar *new_char_str,
+void enclose_chars_changed (GtkCellRendererText *renderer, gchar *path, gchar *new_char_str,
gpointer column_num)
{
GtkTreeIter chars_iter;
@@ -231,10 +231,10 @@ void wrap_chars_changed (GtkCellRendererText *renderer, gchar *path, gchar *new_
}
/*
- * Dialog box for setting wrap characters
+ * Dialog box for setting enclose characters
*/
-void ao_wrapwords_config (GtkButton *button, GtkWidget *config_window)
+void ao_enclose_words_config (GtkButton *button, GtkWidget *config_window)
{
GtkWidget *dialog;
GtkWidget *vbox;
@@ -258,11 +258,11 @@ void ao_wrapwords_config (GtkButton *button, GtkWidget *config_window)
for (i = 0; i < 8; i++)
{
gtk_list_store_append (chars_list, &chars_iter);
- title = g_strdup_printf (_("Wrap combo %d"), i + 1);
+ title = g_strdup_printf (_("Enclose combo %d"), i + 1);
gtk_list_store_set (chars_list, &chars_iter, COLUMN_TITLE, title, -1);
- insert_chars [0] = *wrap_chars [i];
+ insert_chars [0] = *enclose_chars [i];
gtk_list_store_set (chars_list, &chars_iter, COLUMN_PRIOR_CHAR, insert_chars, -1);
- insert_chars [0] = *(wrap_chars [i] + 1);
+ insert_chars [0] = *(enclose_chars [i] + 1);
gtk_list_store_set (chars_list, &chars_iter, COLUMN_END_CHAR, insert_chars, -1);
}
@@ -272,14 +272,14 @@ void ao_wrapwords_config (GtkButton *button, GtkWidget *config_window)
g_object_set (renderer, "editable", TRUE, NULL);
char_one_column = gtk_tree_view_column_new_with_attributes (_("Opening Character"), renderer,
"text", COLUMN_PRIOR_CHAR, NULL);
- g_signal_connect (renderer, "edited", G_CALLBACK (wrap_chars_changed),
+ g_signal_connect (renderer, "edited", G_CALLBACK (enclose_chars_changed),
GINT_TO_POINTER (COLUMN_PRIOR_CHAR));
renderer = gtk_cell_renderer_text_new ();
g_object_set (renderer, "editable", TRUE, NULL);
char_two_column = gtk_tree_view_column_new_with_attributes (_("Closing Character"), renderer,
"text", COLUMN_END_CHAR, NULL);
- g_signal_connect (renderer, "edited", G_CALLBACK (wrap_chars_changed),
+ g_signal_connect (renderer, "edited", G_CALLBACK (enclose_chars_changed),
GINT_TO_POINTER (COLUMN_END_CHAR));
gtk_tree_view_append_column (chars_tree_view, label_column);
View
6 addons/src/ao_wrapwords.h
@@ -21,9 +21,9 @@
#define __AO_WRAPWORDS_H__
-void ao_wrapwords_init(gchar *, GeanyKeyGroup *);
-void ao_wrapwords_config(GtkButton *, GtkWidget *);
-void ao_wrapwords_set_enabled(gboolean, gboolean);
+void ao_enclose_words_init(gchar *, GeanyKeyGroup *);
+void ao_enclose_words_config(GtkButton *, GtkWidget *);
+void ao_enclose_words_set_enabled(gboolean, gboolean);
#endif
Please sign in to comment.
Something went wrong with that request. Please try again.