Revision: 1429 http://svn.sourceforge.net/geany/?rev=1429&view=rev Author: ntrel Date: 2007-03-29 07:39:04 -0700 (Thu, 29 Mar 2007)
Log Message: ----------- Add headings for the Keyboard Shortcuts dialog to group related commands. Shorten the 'Send to custom command' labels slightly.
Modified Paths: -------------- trunk/ChangeLog trunk/src/keybindings.c trunk/src/keybindings.h
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2007-03-29 11:12:48 UTC (rev 1428) +++ trunk/ChangeLog 2007-03-29 14:39:04 UTC (rev 1429) @@ -4,6 +4,10 @@ Check size of construct completion buffer, remove unneeded static in sci_cb_auto_forif(). Reorder some of sci_cb_close_block(). + * src/keybindings.c, src/keybindings.h: + Add headings for the Keyboard Shortcuts dialog to group related + commands. + Shorten the 'Send to custom command' labels slightly.
2007-03-28 Nick Treleaven nick.treleaven@btinternet.com
Modified: trunk/src/keybindings.c =================================================================== --- trunk/src/keybindings.c 2007-03-29 11:12:48 UTC (rev 1428) +++ trunk/src/keybindings.c 2007-03-29 14:39:04 UTC (rev 1429) @@ -231,11 +231,11 @@ keys[GEANY_KEYS_EDIT_DECREASEINDENT] = fill(cb_func_edit, GDK_i, GDK_SHIFT_MASK | GDK_CONTROL_MASK, "edit_decreaseindent", _("Decrease indent")); keys[GEANY_KEYS_EDIT_SENDTOCMD1] = fill(cb_func_edit, - GDK_1, GDK_CONTROL_MASK, "edit_sendtocmd1", _("Send Selection to custom command 1")); + GDK_1, GDK_CONTROL_MASK, "edit_sendtocmd1", _("Send to Custom Command 1")); keys[GEANY_KEYS_EDIT_SENDTOCMD2] = fill(cb_func_edit, - GDK_2, GDK_CONTROL_MASK, "edit_sendtocmd2", _("Send Selection to custom command 2")); + GDK_2, GDK_CONTROL_MASK, "edit_sendtocmd2", _("Send to Custom Command 2")); keys[GEANY_KEYS_EDIT_SENDTOCMD3] = fill(cb_func_edit, - GDK_3, GDK_CONTROL_MASK, "edit_sendtocmd3", _("Send Selection to custom command 3")); + GDK_3, GDK_CONTROL_MASK, "edit_sendtocmd3", _("Send to Custom Command 3")); keys[GEANY_KEYS_EDIT_GOTOMATCHINGBRACE] = fill(cb_func_edit, 0, 0, "edit_gotomatchingbrace", _("Goto matching brace")); @@ -418,13 +418,78 @@ }
+static void get_shortcut_labels_text(GString **text_names_str, GString **text_keys_str) +{ + guint i; + GString *text_names = g_string_sized_new(600); + GString *text_keys = g_string_sized_new(600); + + *text_names_str = text_names; + *text_keys_str = text_keys; + + for (i = 0; i < GEANY_MAX_KEYS; i++) + { + gchar *shortcut; + + switch (i) + { + case GEANY_KEYS_MENU_NEW: + g_string_append(text_names, _("<b>File menu</b>\n")); + g_string_append(text_keys, "\n"); + break; + case GEANY_KEYS_MENU_UNDO: + g_string_append(text_names, _("\n<b>Edit menu</b>\n")); + g_string_append(text_keys, "\n\n"); + break; + case GEANY_KEYS_MENU_FINDNEXT: + g_string_append(text_names, _("\n<b>Search menu</b>\n")); + g_string_append(text_keys, "\n\n"); + break; + case GEANY_KEYS_MENU_FULLSCREEN: + g_string_append(text_names, _("\n<b>View menu</b>\n")); + g_string_append(text_keys, "\n\n"); + break; + case GEANY_KEYS_MENU_REPLACETABS: + g_string_append(text_names, _("\n<b>Document menu</b>\n")); + g_string_append(text_keys, "\n\n"); + break; + case GEANY_KEYS_BUILD_COMPILE: + g_string_append(text_names, _("\n<b>Build menu</b>\n")); + g_string_append(text_keys, "\n\n"); + break; + case GEANY_KEYS_MENU_OPENCOLORCHOOSER: + g_string_append(text_names, _("\n<b>Tools menu</b>\n")); + g_string_append(text_keys, "\n\n"); + break; + case GEANY_KEYS_SWITCH_EDITOR: + g_string_append(text_names, _("\n<b>Focus commands</b>\n")); + g_string_append(text_keys, "\n\n"); + break; + case GEANY_KEYS_EDIT_TOLOWERCASE: + g_string_append(text_names, _("\n<b>Editing commands</b>\n")); + g_string_append(text_keys, "\n\n"); + break; + case GEANY_KEYS_EDIT_AUTOCOMPLETE: + g_string_append(text_names, _("\n<b>Tag commands</b>\n")); + g_string_append(text_keys, "\n\n"); + break; + } + + shortcut = gtk_accelerator_get_label(keys[i]->key, keys[i]->mods); + g_string_append(text_names, keys[i]->label); + g_string_append(text_names, "\n"); + g_string_append(text_keys, shortcut); + g_string_append(text_keys, "\n"); + g_free(shortcut); + } +} + + void keybindings_show_shortcuts() { GtkWidget *dialog, *hbox, *label1, *label2, *label3, *swin, *vbox; - GString *text_names = g_string_sized_new(600); - GString *text_keys = g_string_sized_new(600); - gchar *shortcut; - guint i; + GString *text_names; + GString *text_keys; gint height, response;
dialog = gtk_dialog_new_with_buttons(_("Keyboard shortcuts"), GTK_WINDOW(app->window), @@ -447,19 +512,14 @@
label2 = gtk_label_new(NULL);
- for (i = 0; i < GEANY_MAX_KEYS; i++) - { - shortcut = gtk_accelerator_get_label(keys[i]->key, keys[i]->mods); - g_string_append(text_names, keys[i]->label); - g_string_append(text_names, "\n"); - g_string_append(text_keys, shortcut); - g_string_append(text_keys, "\n"); - g_free(shortcut); - } + get_shortcut_labels_text(&text_names, &text_keys);
- gtk_label_set_text(GTK_LABEL(label1), text_names->str); + gtk_label_set_markup(GTK_LABEL(label1), text_names->str); gtk_label_set_text(GTK_LABEL(label2), text_keys->str);
+ g_string_free(text_names, TRUE); + g_string_free(text_keys, TRUE); + gtk_container_add(GTK_CONTAINER(hbox), label1); gtk_container_add(GTK_CONTAINER(hbox), label2);
@@ -490,9 +550,6 @@ }
gtk_widget_destroy(dialog); - - g_string_free(text_names, TRUE); - g_string_free(text_keys, TRUE); }
Modified: trunk/src/keybindings.h =================================================================== --- trunk/src/keybindings.h 2007-03-29 11:12:48 UTC (rev 1428) +++ trunk/src/keybindings.h 2007-03-29 14:39:04 UTC (rev 1429) @@ -54,11 +54,13 @@ GEANY_KEYS_MENU_CLOSE, GEANY_KEYS_MENU_CLOSEALL, GEANY_KEYS_MENU_RELOADFILE, + GEANY_KEYS_MENU_UNDO, GEANY_KEYS_MENU_REDO, GEANY_KEYS_MENU_SELECTALL, GEANY_KEYS_MENU_INSERTDATE, GEANY_KEYS_MENU_PREFERENCES, + GEANY_KEYS_MENU_FINDNEXT, GEANY_KEYS_MENU_FINDPREVIOUS, GEANY_KEYS_MENU_FINDINFILES, @@ -67,16 +69,21 @@ GEANY_KEYS_MENU_FINDPREVSEL, GEANY_KEYS_MENU_NEXTMESSAGE, GEANY_KEYS_MENU_GOTOLINE, - GEANY_KEYS_MENU_OPENCOLORCHOOSER, + GEANY_KEYS_POPUP_FINDUSAGE, + GEANY_KEYS_POPUP_GOTOTAGDEFINITION, + GEANY_KEYS_POPUP_GOTOTAGDECLARATION, + GEANY_KEYS_MENU_FULLSCREEN, GEANY_KEYS_MENU_MESSAGEWINDOW, GEANY_KEYS_MENU_SIDEBAR, GEANY_KEYS_MENU_ZOOMIN, GEANY_KEYS_MENU_ZOOMOUT, + GEANY_KEYS_MENU_REPLACETABS, GEANY_KEYS_MENU_FOLDALL, GEANY_KEYS_MENU_UNFOLDALL, - GEANY_KEYS_MENU_INSERTSPECIALCHARS, + GEANY_KEYS_RELOADTAGLIST, + GEANY_KEYS_BUILD_COMPILE, GEANY_KEYS_BUILD_LINK, GEANY_KEYS_BUILD_MAKE, @@ -86,13 +93,17 @@ GEANY_KEYS_BUILD_RUN, GEANY_KEYS_BUILD_RUN2, GEANY_KEYS_BUILD_OPTIONS, - GEANY_KEYS_RELOADTAGLIST, + + GEANY_KEYS_MENU_OPENCOLORCHOOSER, + GEANY_KEYS_MENU_INSERTSPECIALCHARS, + GEANY_KEYS_SWITCH_EDITOR, GEANY_KEYS_SWITCH_SCRIBBLE, GEANY_KEYS_SWITCH_VTE, GEANY_KEYS_SWITCH_TABLEFT, GEANY_KEYS_SWITCH_TABRIGHT, GEANY_KEYS_SWITCH_TABLASTUSED, + GEANY_KEYS_EDIT_TOLOWERCASE, GEANY_KEYS_EDIT_TOUPPERCASE, GEANY_KEYS_EDIT_DUPLICATELINE, @@ -108,16 +119,14 @@ GEANY_KEYS_EDIT_TOGGLEMARKER, GEANY_KEYS_EDIT_GOTONEXTMARKER, GEANY_KEYS_EDIT_GOTOPREVIOUSMARKER, + GEANY_KEYS_EDIT_SELECTWORD, + GEANY_KEYS_EDIT_INSERTALTWHITESPACE, + GEANY_KEYS_EDIT_AUTOCOMPLETE, GEANY_KEYS_EDIT_CALLTIP, GEANY_KEYS_EDIT_MACROLIST, GEANY_KEYS_EDIT_COMPLETECONSTRUCT, GEANY_KEYS_EDIT_SUPPRESSCOMPLETION, - GEANY_KEYS_EDIT_SELECTWORD, - GEANY_KEYS_EDIT_INSERTALTWHITESPACE, - GEANY_KEYS_POPUP_FINDUSAGE, - GEANY_KEYS_POPUP_GOTOTAGDEFINITION, - GEANY_KEYS_POPUP_GOTOTAGDECLARATION, GEANY_MAX_KEYS };
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.