Revision: 1422 http://svn.sourceforge.net/geany/?rev=1422&view=rev Author: eht16 Date: 2007-03-25 13:51:45 -0700 (Sun, 25 Mar 2007)
Log Message: ----------- Use Ctrl+Shift+Space always for showing calltips because Alt+Space is used often by window managers (not only under Windows). Added keybinding for inserting alternative whitespace characters.
Modified Paths: -------------- trunk/ChangeLog trunk/doc/geany.docbook trunk/src/keybindings.c trunk/src/keybindings.h trunk/src/sci_cb.c trunk/src/sci_cb.h trunk/src/utils.c trunk/src/utils.h
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2007-03-24 16:27:19 UTC (rev 1421) +++ trunk/ChangeLog 2007-03-25 20:51:45 UTC (rev 1422) @@ -1,3 +1,12 @@ +2007-03-25 Enrico Tröger enrico.troeger@uvena.de + + * doc/geany.docbook, src/keybindings.c, src/keybindings.h, + src/sci_cb.c, src/sci_cb.h, src/utils.c, src/utils.h: + Use Ctrl+Shift+Space always for showing calltips because Alt+Space is + used often by window managers (not only under Windows). + Added keybinding for inserting alternative whitespace characters. + + 2007-03-24 Nick Treleaven nick.treleaven@btinternet.com
* src/sci_cb.c, src/symbols.c:
Modified: trunk/doc/geany.docbook =================================================================== --- trunk/doc/geany.docbook 2007-03-24 16:27:19 UTC (rev 1421) +++ trunk/doc/geany.docbook 2007-03-25 20:51:45 UTC (rev 1422) @@ -1515,6 +1515,14 @@ </entry> </row> <row> + <entry>Insert alternative whitespace</entry> + <entry>Inserts a tabulator character when spaces should be used for + indentation and inserts space characters of the amount of a + tabulator width when tabulators should be used for + indentation. + </entry> + </row> + <row> <entry>Find Usage</entry> <entry>Finds all occurrences of the current word (near the keyboard cursor) and displays them in the messages window.
Modified: trunk/src/keybindings.c =================================================================== --- trunk/src/keybindings.c 2007-03-24 16:27:19 UTC (rev 1421) +++ trunk/src/keybindings.c 2007-03-25 20:51:45 UTC (rev 1422) @@ -250,14 +250,8 @@ _("Goto previous marker")); keys[GEANY_KEYS_EDIT_AUTOCOMPLETE] = fill(cb_func_edit, GDK_space, GDK_CONTROL_MASK, "edit_autocomplete", _("Complete word")); -#ifdef G_OS_WIN32 - // on windows alt-space is taken by the window manager keys[GEANY_KEYS_EDIT_CALLTIP] = fill(cb_func_edit, GDK_space, GDK_CONTROL_MASK | GDK_SHIFT_MASK, "edit_calltip", _("Show calltip")); -#else - keys[GEANY_KEYS_EDIT_CALLTIP] = fill(cb_func_edit, - GDK_space, GDK_MOD1_MASK, "edit_calltip", _("Show calltip")); -#endif keys[GEANY_KEYS_EDIT_MACROLIST] = fill(cb_func_edit, GDK_Return, GDK_CONTROL_MASK, "edit_macrolist", _("Show macro list")); keys[GEANY_KEYS_EDIT_SUPPRESSCOMPLETION] = fill(cb_func_edit, @@ -266,6 +260,9 @@ keys[GEANY_KEYS_EDIT_SELECTWORD] = fill(cb_func_edit, 0, 0, "edit_selectword", _("Select current word"));
+ keys[GEANY_KEYS_EDIT_INSERTALTWHITESPACE] = fill(cb_func_edit, + 0, 0, "edit_insertwhitespace", _("Insert alternative whitespace")); + keys[GEANY_KEYS_POPUP_FINDUSAGE] = fill(cb_func_current_word, 0, 0, "popup_findusage", _("Find Usage")); keys[GEANY_KEYS_POPUP_GOTOTAGDEFINITION] = fill(cb_func_current_word, @@ -948,6 +945,9 @@ case GEANY_KEYS_EDIT_SELECTWORD: sci_cb_select_word(doc_list[idx].sci); break; + case GEANY_KEYS_EDIT_INSERTALTWHITESPACE: + sci_cb_insert_alternative_whitespace(doc_list[idx].sci); + break; case GEANY_KEYS_EDIT_INCREASEINDENT: on_menu_increase_indent1_activate(NULL, NULL); break;
Modified: trunk/src/keybindings.h =================================================================== --- trunk/src/keybindings.h 2007-03-24 16:27:19 UTC (rev 1421) +++ trunk/src/keybindings.h 2007-03-25 20:51:45 UTC (rev 1422) @@ -113,6 +113,7 @@ GEANY_KEYS_EDIT_MACROLIST, GEANY_KEYS_EDIT_SUPPRESSCOMPLETION, GEANY_KEYS_EDIT_SELECTWORD, + GEANY_KEYS_EDIT_INSERTALTWHITESPACE, GEANY_KEYS_POPUP_FINDUSAGE, GEANY_KEYS_POPUP_GOTOTAGDEFINITION, GEANY_KEYS_POPUP_GOTOTAGDECLARATION,
Modified: trunk/src/sci_cb.c =================================================================== --- trunk/src/sci_cb.c 2007-03-24 16:27:19 UTC (rev 1421) +++ trunk/src/sci_cb.c 2007-03-25 20:51:45 UTC (rev 1422) @@ -347,7 +347,7 @@ sci_get_style_at(sci, pos - 2) == SCE_P_OPERATOR) { // creates and inserts one tabulator sign or whitespace of the amount of the tab width - gchar *text = utils_get_whitespace(app->pref_editor_tab_width); + gchar *text = utils_get_whitespace(app->pref_editor_tab_width, FALSE); sci_add_text(sci, text); g_free(text); } @@ -993,7 +993,7 @@ }
// get the whitespace for additional indentation - space = utils_get_whitespace(app->pref_editor_tab_width); + space = utils_get_whitespace(app->pref_editor_tab_width, FALSE); space_len = strlen(space);
// "pattern", buf + x, y -> x + y = 15, because buf is (pos - 16)...(pos - 1) = 15 @@ -2144,6 +2144,15 @@ }
+void sci_cb_insert_alternative_whitespace(ScintillaObject *sci) +{ + // creates and inserts one tabulator sign or whitespace of the amount of the tab width + gchar *text = utils_get_whitespace(app->pref_editor_tab_width, TRUE); + sci_add_text(sci, text); + g_free(text); +} + + void sci_cb_select_word(ScintillaObject *sci) { gint pos;
Modified: trunk/src/sci_cb.h =================================================================== --- trunk/src/sci_cb.h 2007-03-24 16:27:19 UTC (rev 1421) +++ trunk/src/sci_cb.h 2007-03-25 20:51:45 UTC (rev 1422) @@ -88,4 +88,6 @@
void sci_cb_select_word(ScintillaObject *sci);
+void sci_cb_insert_alternative_whitespace(ScintillaObject *sci); + #endif
Modified: trunk/src/utils.c =================================================================== --- trunk/src/utils.c 2007-03-24 16:27:19 UTC (rev 1421) +++ trunk/src/utils.c 2007-03-25 20:51:45 UTC (rev 1422) @@ -1449,14 +1449,18 @@ /* Returns a string containing whitespace of the amount a according to the * setting app->pref_editor_use_tabs filled with simple space characters or with the right amount * of tabulator characters (a is filled with tabulators *and* spaces if a isn't a multiple of - * app->pref_editor_tab_width) */ -gchar *utils_get_whitespace(gint a) + * app->pref_editor_tab_width). + * If alternative is set to TRUE, it returns the opposite of app->pref_editor_use_tabs. */ +gchar *utils_get_whitespace(gint a, gboolean alternative) { gchar *str; + gboolean use_tabs;
g_return_val_if_fail(a > 0, NULL);
- if (app->pref_editor_use_tabs) + use_tabs = (alternative) ? ! app->pref_editor_use_tabs : app->pref_editor_use_tabs; + + if (use_tabs) { // first fill text with tabluators and fill the rest with spaces gint tabs = a / app->pref_editor_tab_width; gint spaces = a % app->pref_editor_tab_width;
Modified: trunk/src/utils.h =================================================================== --- trunk/src/utils.h 2007-03-24 16:27:19 UTC (rev 1421) +++ trunk/src/utils.h 2007-03-25 20:51:45 UTC (rev 1422) @@ -148,8 +148,9 @@ /* Returns a string containing whitespace of the amount a according to the * setting app->pref_editor_use_tabs filled with simple space characters or with the right amount * of tabulator characters (a is filled with tabulators *and* spaces if a isn't a multiple of - * app->pref_editor_tab_width) */ -gchar *utils_get_whitespace(gint amount); + * app->pref_editor_tab_width). + * If alternative is set to TRUE, it returns the opposite of app->pref_editor_use_tabs. */ +gchar *utils_get_whitespace(gint amount, gboolean alternative);
/* frees all passed pointers if they are non-NULL, the first argument is nothing special, * it will also be freed, the list should be ended with NULL */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.