Add Move document first/last keybindings (patch by Catalin Marinas, thank you).

Add toolbar items to increase/decrease indentation (closes #1850697).	     


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2104 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Enrico Tröger 2007-12-16 16:54:47 +00:00
parent 639e23effa
commit 47c7c69214
12 changed files with 168 additions and 12 deletions

View File

@ -10,6 +10,12 @@
* plugins/pluginmacros.h, src/plugindata.h, src/plugins.c:
Add highlighting_get_style() to the plugin API.
Rename DocumentFuncs field in GeanyData struct to avoid name clashes.
* doc/geany.html, doc/geany.txt, src/kebindings.c, src/keybindings.h:
Add Move document first/last keybindings
(patch by Catalin Marinas, thank you).
* geany.glade, src/interface.c, src/keyfile.c, src/plugindata.h,
src/prefs.c, src/prefs.h, src/ui_utils.c:
Add toolbar items to increase/decrease indentation (closes #1850697).
2007-12-14 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>

View File

@ -6,7 +6,7 @@
<meta name="generator" content="Docutils 0.4.1: http://docutils.sourceforge.net/" />
<title>Geany</title>
<meta name="authors" content="Enrico Tröger Nick Treleaven Frank Lanitz" />
<meta name="date" content="2007-11-29" />
<meta name="date" content="2007-12-07" />
<style type="text/css">
/*
@ -133,7 +133,7 @@ dt {
<br />Nick Treleaven
<br />Frank Lanitz</td></tr>
<tr><th class="docinfo-name">Date:</th>
<td>2007-11-29</td></tr>
<td>2007-12-07</td></tr>
<tr><th class="docinfo-name">Version:</th>
<td>0.13</td></tr>
</tbody>
@ -1854,6 +1854,20 @@ visible).</td>
<tr><td>Switch to last used document</td>
<td>Switches to the previously selected open document.</td>
</tr>
<tr><td>Move document left</td>
<td>Changes the current document with the left hand
one.</td>
</tr>
<tr><td>Move document right</td>
<td>Changes the current document with the right hand
one.</td>
</tr>
<tr><td>Move document first</td>
<td>Moves the current document to the first position.</td>
</tr>
<tr><td>Move document last</td>
<td>Moves the current document to the last position.</td>
</tr>
<tr><td>Navigate forward a location</td>
<td>Switches to the next location in the navigation
history. See the section called <a class="reference" href="#code-navigation-history">Code Navigation
@ -3211,7 +3225,7 @@ USE OR PERFORMANCE OF THIS SOFTWARE.</p>
<div class="footer">
<hr class="footer" />
<a class="reference" href="geany.txt">View document source</a>.
Generated on: 2007-12-07 14:10 UTC.
Generated on: 2007-12-16 16:51 UTC.
Generated by <a class="reference" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
</div>

View File

@ -1685,6 +1685,16 @@ Switch to right document Switches to the next open document.
Switch to last used document Switches to the previously selected open document.
Move document left Changes the current document with the left hand
one.
Move document right Changes the current document with the right hand
one.
Move document first Moves the current document to the first position.
Move document last Moves the current document to the last position.
Navigate forward a location Switches to the next location in the navigation
history. See the section called `Code Navigation
History`_.

View File

@ -1844,7 +1844,52 @@
</child>
<child>
<widget class="GtkToolItem" id="toolitem18">
<widget class="GtkToolButton" id="toolbutton_indent_dec">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Decrease indentation</property>
<property name="stock_id">gtk-unindent</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
<property name="is_important">False</property>
<signal name="clicked" handler="on_menu_decrease_indent1_activate" last_modification_time="Sun, 16 Dec 2007 16:48:25 GMT"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<widget class="GtkToolButton" id="toolbutton_indent_inc">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Increase indentation</property>
<property name="stock_id">gtk-indent</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
<property name="is_important">False</property>
<signal name="clicked" handler="on_menu_increase_indent1_activate" last_modification_time="Sun, 16 Dec 2007 16:48:14 GMT"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<widget class="GtkSeparatorToolItem" id="separatortoolitem11">
<property name="visible">True</property>
<property name="draw">True</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">False</property>
</packing>
</child>
<child>
<widget class="GtkToolItem" id="toolitem19">
<property name="visible">True</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
@ -4689,6 +4734,25 @@ Bottom
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="check_toolbar_indent">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Display the Zoom In and Zoom Out buttons in the toolbar</property>
<property name="label" translatable="yes">Show Increase and Decrease Indentation buttons</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">False</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="check_toolbar_search">
<property name="visible">True</property>

View File

@ -232,7 +232,10 @@ create_window1 (void)
GtkWidget *toolbutton20;
GtkWidget *toolbutton21;
GtkWidget *separatortoolitem4;
GtkWidget *toolitem18;
GtkWidget *toolbutton_indent_dec;
GtkWidget *toolbutton_indent_inc;
GtkWidget *separatortoolitem11;
GtkWidget *toolitem19;
GtkWidget *entry1;
GtkWidget *toolbutton18;
GtkWidget *separatortoolitem5;
@ -1136,13 +1139,27 @@ create_window1 (void)
gtk_widget_show (separatortoolitem4);
gtk_container_add (GTK_CONTAINER (toolbar1), separatortoolitem4);
toolitem18 = (GtkWidget*) gtk_tool_item_new ();
gtk_widget_show (toolitem18);
gtk_container_add (GTK_CONTAINER (toolbar1), toolitem18);
toolbutton_indent_dec = (GtkWidget*) gtk_tool_button_new_from_stock ("gtk-unindent");
gtk_widget_show (toolbutton_indent_dec);
gtk_container_add (GTK_CONTAINER (toolbar1), toolbutton_indent_dec);
gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (toolbutton_indent_dec), tooltips, _("Decrease indentation"), NULL);
toolbutton_indent_inc = (GtkWidget*) gtk_tool_button_new_from_stock ("gtk-indent");
gtk_widget_show (toolbutton_indent_inc);
gtk_container_add (GTK_CONTAINER (toolbar1), toolbutton_indent_inc);
gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (toolbutton_indent_inc), tooltips, _("Increase indentation"), NULL);
separatortoolitem11 = (GtkWidget*) gtk_separator_tool_item_new ();
gtk_widget_show (separatortoolitem11);
gtk_container_add (GTK_CONTAINER (toolbar1), separatortoolitem11);
toolitem19 = (GtkWidget*) gtk_tool_item_new ();
gtk_widget_show (toolitem19);
gtk_container_add (GTK_CONTAINER (toolbar1), toolitem19);
entry1 = gtk_entry_new ();
gtk_widget_show (entry1);
gtk_container_add (GTK_CONTAINER (toolitem18), entry1);
gtk_container_add (GTK_CONTAINER (toolitem19), entry1);
gtk_tooltips_set_tip (tooltips, entry1, _("Find the entered text in the current file"), NULL);
toolbutton18 = (GtkWidget*) gtk_tool_button_new_from_stock ("gtk-find");
@ -1612,6 +1629,12 @@ create_window1 (void)
g_signal_connect ((gpointer) toolbutton21, "clicked",
G_CALLBACK (on_zoom_out1_activate),
NULL);
g_signal_connect ((gpointer) toolbutton_indent_dec, "clicked",
G_CALLBACK (on_menu_decrease_indent1_activate),
NULL);
g_signal_connect ((gpointer) toolbutton_indent_inc, "clicked",
G_CALLBACK (on_menu_increase_indent1_activate),
NULL);
g_signal_connect ((gpointer) entry1, "activate",
G_CALLBACK (on_entry1_activate),
NULL);
@ -1852,7 +1875,10 @@ create_window1 (void)
GLADE_HOOKUP_OBJECT (window1, toolbutton20, "toolbutton20");
GLADE_HOOKUP_OBJECT (window1, toolbutton21, "toolbutton21");
GLADE_HOOKUP_OBJECT (window1, separatortoolitem4, "separatortoolitem4");
GLADE_HOOKUP_OBJECT (window1, toolitem18, "toolitem18");
GLADE_HOOKUP_OBJECT (window1, toolbutton_indent_dec, "toolbutton_indent_dec");
GLADE_HOOKUP_OBJECT (window1, toolbutton_indent_inc, "toolbutton_indent_inc");
GLADE_HOOKUP_OBJECT (window1, separatortoolitem11, "separatortoolitem11");
GLADE_HOOKUP_OBJECT (window1, toolitem19, "toolitem19");
GLADE_HOOKUP_OBJECT (window1, entry1, "entry1");
GLADE_HOOKUP_OBJECT (window1, toolbutton18, "toolbutton18");
GLADE_HOOKUP_OBJECT (window1, separatortoolitem5, "separatortoolitem5");
@ -2537,6 +2563,7 @@ create_prefs_dialog (void)
GtkWidget *check_toolbar_compile;
GtkWidget *check_toolbar_colour;
GtkWidget *check_toolbar_zoom;
GtkWidget *check_toolbar_indent;
GtkWidget *check_toolbar_search;
GtkWidget *check_toolbar_goto;
GtkWidget *check_toolbar_quit;
@ -3279,6 +3306,13 @@ create_prefs_dialog (void)
gtk_tooltips_set_tip (tooltips, check_toolbar_zoom, _("Display the Zoom In and Zoom Out buttons in the toolbar"), NULL);
gtk_button_set_focus_on_click (GTK_BUTTON (check_toolbar_zoom), FALSE);
check_toolbar_indent = gtk_check_button_new_with_mnemonic (_("Show Increase and Decrease Indentation buttons"));
gtk_widget_show (check_toolbar_indent);
gtk_box_pack_start (GTK_BOX (vbox16), check_toolbar_indent, FALSE, FALSE, 0);
GTK_WIDGET_UNSET_FLAGS (check_toolbar_indent, GTK_CAN_FOCUS);
gtk_tooltips_set_tip (tooltips, check_toolbar_indent, _("Display the Zoom In and Zoom Out buttons in the toolbar"), NULL);
gtk_button_set_focus_on_click (GTK_BUTTON (check_toolbar_indent), FALSE);
check_toolbar_search = gtk_check_button_new_with_mnemonic (_("Show Search field"));
gtk_widget_show (check_toolbar_search);
gtk_box_pack_start (GTK_BOX (vbox16), check_toolbar_search, FALSE, FALSE, 0);
@ -4493,6 +4527,7 @@ create_prefs_dialog (void)
GLADE_HOOKUP_OBJECT (prefs_dialog, check_toolbar_compile, "check_toolbar_compile");
GLADE_HOOKUP_OBJECT (prefs_dialog, check_toolbar_colour, "check_toolbar_colour");
GLADE_HOOKUP_OBJECT (prefs_dialog, check_toolbar_zoom, "check_toolbar_zoom");
GLADE_HOOKUP_OBJECT (prefs_dialog, check_toolbar_indent, "check_toolbar_indent");
GLADE_HOOKUP_OBJECT (prefs_dialog, check_toolbar_search, "check_toolbar_search");
GLADE_HOOKUP_OBJECT (prefs_dialog, check_toolbar_goto, "check_toolbar_goto");
GLADE_HOOKUP_OBJECT (prefs_dialog, check_toolbar_quit, "check_toolbar_quit");

View File

@ -230,6 +230,10 @@ static void init_default_kb()
GDK_Page_Up, GDK_MOD1_MASK, "move_tableft", _("Move document left"));
keys[GEANY_KEYS_MOVE_TABRIGHT] = fill(cb_func_move_tab,
GDK_Page_Down, GDK_MOD1_MASK, "move_tabright", _("Move document right"));
keys[GEANY_KEYS_MOVE_TABFIRST] = fill(cb_func_move_tab,
0, 0, "move_tabfirst", _("Move document first"));
keys[GEANY_KEYS_MOVE_TABLAST] = fill(cb_func_move_tab,
0, 0, "move_tablast", _("Move document last"));
keys[GEANY_KEYS_NAV_BACK] = fill(cb_func_nav_back,
0, 0, "nav_back", _("Navigate back a location"));
keys[GEANY_KEYS_NAV_FORWARD] = fill(cb_func_nav_forward,
@ -1060,7 +1064,7 @@ static void cb_func_switch_tablastused(G_GNUC_UNUSED guint key_id)
document_get_notebook_page(last_doc_idx));
}
// move document left/right
// move document left/right/first/last
static void cb_func_move_tab(guint key_id)
{
gint idx = document_get_cur_idx();
@ -1083,6 +1087,14 @@ static void cb_func_move_tab(guint key_id)
npage = 0; // wraparound
gtk_notebook_reorder_child(nb, sci, npage);
}
else if (key_id == GEANY_KEYS_MOVE_TABFIRST)
{
gtk_notebook_reorder_child(nb, sci, (prefs.tab_order_ltr) ? -1 : 0);
}
else if (key_id == GEANY_KEYS_MOVE_TABLAST)
{
gtk_notebook_reorder_child(nb, sci, (prefs.tab_order_ltr) ? 0 : -1);
}
return;
}

View File

@ -123,6 +123,8 @@ typedef enum
GEANY_KEYS_SWITCH_TABLASTUSED,
GEANY_KEYS_MOVE_TABLEFT,
GEANY_KEYS_MOVE_TABRIGHT,
GEANY_KEYS_MOVE_TABFIRST,
GEANY_KEYS_MOVE_TABLAST,
GEANY_KEYS_GROUP_EDITING,
GEANY_KEYS_EDIT_TOGGLECASE = GEANY_KEYS_GROUP_EDITING,

View File

@ -242,6 +242,7 @@ static void save_dialog_prefs(GKeyFile *config)
g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_search", prefs.toolbar_show_search);
g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_goto", prefs.toolbar_show_goto);
g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_zoom", prefs.toolbar_show_zoom);
g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_indent", prefs.toolbar_show_indent);
g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_undo", prefs.toolbar_show_undo);
g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_navigation", prefs.toolbar_show_navigation);
g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_compile", prefs.toolbar_show_compile);
@ -564,6 +565,7 @@ static void load_dialog_prefs(GKeyFile *config)
prefs.toolbar_show_search = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_search", TRUE);
prefs.toolbar_show_goto = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_goto", TRUE);
prefs.toolbar_show_zoom = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_zoom", FALSE);
prefs.toolbar_show_indent = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_indent", FALSE);
prefs.toolbar_show_compile = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_compile", TRUE);
prefs.toolbar_show_undo = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_undo", FALSE);
prefs.toolbar_show_navigation = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_navigation", TRUE);

View File

@ -98,7 +98,7 @@ static const gint api_version = 35;
/* The ABI version should be incremented whenever existing fields in the plugin
* data types below have to be changed or reordered. It should stay the same if fields
* are only appended, as this doesn't affect existing fields. */
static const gint abi_version = 17;
static const gint abi_version = 18;
/* This performs runtime checks that try to ensure:
* 1. Geany ABI data types are compatible with this plugin.

View File

@ -272,6 +272,9 @@ void prefs_init_dialog(void)
widget = lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_zoom");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), prefs.toolbar_show_zoom);
widget = lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_indent");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), prefs.toolbar_show_indent);
widget = lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_undo");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), prefs.toolbar_show_undo);
@ -644,6 +647,9 @@ on_prefs_button_clicked(GtkDialog *dialog, gint response, gpointer user_data)
widget = lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_zoom");
prefs.toolbar_show_zoom = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
widget = lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_indent");
prefs.toolbar_show_indent = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
widget = lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_undo");
prefs.toolbar_show_undo = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));

View File

@ -63,6 +63,7 @@ typedef struct GeanyPrefs
gboolean toolbar_show_navigation;
gboolean toolbar_show_compile;
gboolean toolbar_show_zoom;
gboolean toolbar_show_indent;
gboolean toolbar_show_colour;
gboolean toolbar_show_fileops;
gboolean toolbar_show_quit;

View File

@ -758,6 +758,10 @@ void ui_update_toolbar_items()
ui_widget_show_hide(lookup_widget(app->window, "toolbutton20"), prefs.toolbar_show_zoom);
ui_widget_show_hide(lookup_widget(app->window, "toolbutton21"), prefs.toolbar_show_zoom);
ui_widget_show_hide(lookup_widget(app->window, "separatortoolitem4"), prefs.toolbar_show_zoom);
// indent
ui_widget_show_hide(lookup_widget(app->window, "toolbutton_indent_dec"), prefs.toolbar_show_indent);
ui_widget_show_hide(lookup_widget(app->window, "toolbutton_indent_inc"), prefs.toolbar_show_indent);
ui_widget_show_hide(lookup_widget(app->window, "separatortoolitem11"), prefs.toolbar_show_indent);
// undo
ui_widget_show_hide(lookup_widget(app->window, "toolbutton_undo"), prefs.toolbar_show_undo);
ui_widget_show_hide(lookup_widget(app->window, "toolbutton_redo"), prefs.toolbar_show_undo);