Add toolbar buttons for Cut, Copy, Paste and Delete (#2161750).

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@3147 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Enrico Tröger 2008-10-23 20:55:55 +00:00
parent c946d4ef91
commit d3ee6f48ca
11 changed files with 224 additions and 9 deletions

View File

@ -8,6 +8,10 @@
Remove dialogs_show_goto_line(), use the more generic
dialogs_show_input_numeric() instead.
Increase limit of the maximum line number from 99999 to 100000000.
* doc/geany.html, doc/geany.txt, geany.glade, src/callbacks.c,
src/interface.c, src/keyfile.c, src/plugindata.h, src/prefs.c,
src/ui_utils.c, src/ui_utils.h:
Add toolbar buttons for Cut, Copy, Paste and Delete (#2161750).
2008-10-22 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>

View File

@ -6,7 +6,7 @@
<meta name="generator" content="Docutils 0.5: http://docutils.sourceforge.net/" />
<title>Geany</title>
<meta name="authors" content="Enrico Tröger Nick Treleaven Frank Lanitz" />
<meta name="date" content="2008-10-19" />
<meta name="date" content="$Date$" />
<style type="text/css">
/*
@ -139,7 +139,7 @@ Stylesheet for Geany's documentation based on a version of John Gabriele.
<br />Nick Treleaven
<br />Frank Lanitz</td></tr>
<tr><th class="docinfo-name">Date:</th>
<td>2008-10-19</td></tr>
<td>$Date$</td></tr>
<tr><th class="docinfo-name">Version:</th>
<td>0.16</td></tr>
</tbody>
@ -1685,9 +1685,13 @@ modifications were done, the file encoding, the filetype and other information.<
<div class="section" id="items">
<h4><a class="toc-backref" href="#id83">Items</a></h4>
<dl class="docutils">
<dt>Show file operation buttons</dt>
<dt>Show File Operation buttons</dt>
<dd>Show the buttons to open a new file, open an existing file, save a file,
and save all files.</dd>
<dt>Show Cut and Delete buttons</dt>
<dd>Show buttons to cut and delete the current selection.</dd>
<dt>Show Copy and Paste buttons</dt>
<dd>Show buttons to copy the current selection and paste the contents of the clipboard.</dd>
<dt>Show Redo and Undo buttons</dt>
<dd>Show the undo/redo change buttons.</dd>
<dt>Show Back and Forward buttons</dt>
@ -4399,7 +4403,7 @@ USE OR PERFORMANCE OF THIS SOFTWARE.</p>
<div class="footer">
<hr class="footer" />
<a class="reference external" href="geany.txt">View document source</a>.
Generated on: 2008-10-19 13:50 UTC.
Generated on: 2008-10-23 20:49 UTC.
Generated by <a class="reference external" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference external" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
</div>

View File

@ -1429,10 +1429,16 @@ Show Toolbar
Items
`````
Show file operation buttons
Show File Operation buttons
Show the buttons to open a new file, open an existing file, save a file,
and save all files.
Show Cut and Delete buttons
Show buttons to cut and delete the current selection.
Show Copy and Paste buttons
Show buttons to copy the current selection and paste the contents of the clipboard.
Show Redo and Undo buttons
Show the undo/redo change buttons.

View File

@ -1715,6 +1715,83 @@
</packing>
</child>
<child>
<widget class="GtkToolButton" id="toolbutton_cut">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Cut the current selection</property>
<property name="stock_id">gtk-cut</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
<property name="is_important">False</property>
<signal name="clicked" handler="on_cut1_activate" last_modification_time="Mon, 10 Jul 2006 19:52:02 GMT"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<widget class="GtkToolButton" id="toolbutton_copy">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Copy the current selection</property>
<property name="stock_id">gtk-copy</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
<property name="is_important">False</property>
<signal name="clicked" handler="on_copy1_activate" last_modification_time="Mon, 10 Jul 2006 19:52:02 GMT"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<widget class="GtkToolButton" id="toolbutton_paste">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Paste the contents of the clipboard</property>
<property name="stock_id">gtk-paste</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
<property name="is_important">False</property>
<signal name="clicked" handler="on_paste1_activate" last_modification_time="Mon, 10 Jul 2006 19:52:02 GMT"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<widget class="GtkToolButton" id="toolbutton_delete">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Delete the current selection</property>
<property name="stock_id">gtk-delete</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
<property name="is_important">False</property>
<signal name="clicked" handler="on_delete1_activate" last_modification_time="Thu, 23 Oct 2008 20:48:07 GMT"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<widget class="GtkSeparatorToolItem" id="separatortoolitem12">
<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="GtkToolButton" id="toolbutton_undo">
<property name="visible">True</property>
@ -4881,7 +4958,47 @@ Bottom
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Display the New, Open, Close, Save and Reload buttons in the toolbar</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Show file operation buttons</property>
<property name="label" translatable="yes">Show File Operation buttons</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</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_cutdelete">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Display the Cut and Delete buttons in the toolbar</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Show Cut and Delete buttons</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</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_copypaste">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Display the Copy and Paste buttons in the toolbar</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Show Copy and Paste buttons</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>

View File

@ -382,7 +382,7 @@ on_delete1_activate (GtkMenuItem *menuitem,
if (GTK_IS_EDITABLE(focusw))
gtk_editable_delete_selection(GTK_EDITABLE(focusw));
else
if (IS_SCINTILLA(focusw) && doc != NULL)
if (IS_SCINTILLA(focusw) && doc != NULL && sci_has_selection(doc->editor->sci))
sci_clear(doc->editor->sci);
else
if (GTK_IS_TEXT_VIEW(focusw))

View File

@ -225,6 +225,11 @@ create_window1 (void)
GtkWidget *toolbutton_reload;
GtkWidget *toolbutton_close;
GtkWidget *separatortoolitem2;
GtkWidget *toolbutton_cut;
GtkWidget *toolbutton_copy;
GtkWidget *toolbutton_paste;
GtkWidget *toolbutton_delete;
GtkWidget *separatortoolitem12;
GtkWidget *toolbutton_undo;
GtkWidget *toolbutton_redo;
GtkWidget *separatortoolitem9;
@ -1112,6 +1117,30 @@ create_window1 (void)
gtk_widget_show (separatortoolitem2);
gtk_container_add (GTK_CONTAINER (toolbar1), separatortoolitem2);
toolbutton_cut = (GtkWidget*) gtk_tool_button_new_from_stock ("gtk-cut");
gtk_widget_show (toolbutton_cut);
gtk_container_add (GTK_CONTAINER (toolbar1), toolbutton_cut);
gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (toolbutton_cut), tooltips, _("Cut the current selection"), NULL);
toolbutton_copy = (GtkWidget*) gtk_tool_button_new_from_stock ("gtk-copy");
gtk_widget_show (toolbutton_copy);
gtk_container_add (GTK_CONTAINER (toolbar1), toolbutton_copy);
gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (toolbutton_copy), tooltips, _("Copy the current selection"), NULL);
toolbutton_paste = (GtkWidget*) gtk_tool_button_new_from_stock ("gtk-paste");
gtk_widget_show (toolbutton_paste);
gtk_container_add (GTK_CONTAINER (toolbar1), toolbutton_paste);
gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (toolbutton_paste), tooltips, _("Paste the contents of the clipboard"), NULL);
toolbutton_delete = (GtkWidget*) gtk_tool_button_new_from_stock ("gtk-delete");
gtk_widget_show (toolbutton_delete);
gtk_container_add (GTK_CONTAINER (toolbar1), toolbutton_delete);
gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (toolbutton_delete), tooltips, _("Delete the current selection"), NULL);
separatortoolitem12 = (GtkWidget*) gtk_separator_tool_item_new ();
gtk_widget_show (separatortoolitem12);
gtk_container_add (GTK_CONTAINER (toolbar1), separatortoolitem12);
toolbutton_undo = (GtkWidget*) gtk_tool_button_new_from_stock ("gtk-undo");
gtk_widget_show (toolbutton_undo);
gtk_container_add (GTK_CONTAINER (toolbar1), toolbutton_undo);
@ -1673,6 +1702,18 @@ create_window1 (void)
g_signal_connect ((gpointer) toolbutton_close, "clicked",
G_CALLBACK (on_toolbutton_close_clicked),
NULL);
g_signal_connect ((gpointer) toolbutton_cut, "clicked",
G_CALLBACK (on_cut1_activate),
NULL);
g_signal_connect ((gpointer) toolbutton_copy, "clicked",
G_CALLBACK (on_copy1_activate),
NULL);
g_signal_connect ((gpointer) toolbutton_paste, "clicked",
G_CALLBACK (on_paste1_activate),
NULL);
g_signal_connect ((gpointer) toolbutton_delete, "clicked",
G_CALLBACK (on_delete1_activate),
NULL);
g_signal_connect ((gpointer) toolbutton_undo, "clicked",
G_CALLBACK (on_undo1_activate),
NULL);
@ -1937,6 +1978,11 @@ create_window1 (void)
GLADE_HOOKUP_OBJECT (window1, toolbutton_reload, "toolbutton_reload");
GLADE_HOOKUP_OBJECT (window1, toolbutton_close, "toolbutton_close");
GLADE_HOOKUP_OBJECT (window1, separatortoolitem2, "separatortoolitem2");
GLADE_HOOKUP_OBJECT (window1, toolbutton_cut, "toolbutton_cut");
GLADE_HOOKUP_OBJECT (window1, toolbutton_copy, "toolbutton_copy");
GLADE_HOOKUP_OBJECT (window1, toolbutton_paste, "toolbutton_paste");
GLADE_HOOKUP_OBJECT (window1, toolbutton_delete, "toolbutton_delete");
GLADE_HOOKUP_OBJECT (window1, separatortoolitem12, "separatortoolitem12");
GLADE_HOOKUP_OBJECT (window1, toolbutton_undo, "toolbutton_undo");
GLADE_HOOKUP_OBJECT (window1, toolbutton_redo, "toolbutton_redo");
GLADE_HOOKUP_OBJECT (window1, separatortoolitem9, "separatortoolitem9");
@ -2658,6 +2704,8 @@ create_prefs_dialog (void)
GtkWidget *alignment14;
GtkWidget *vbox16;
GtkWidget *check_toolbar_fileops;
GtkWidget *check_toolbar_cutdelete;
GtkWidget *check_toolbar_copypaste;
GtkWidget *check_toolbar_undo;
GtkWidget *check_toolbar_navigation;
GtkWidget *check_toolbar_compile;
@ -3437,11 +3485,21 @@ create_prefs_dialog (void)
gtk_widget_show (vbox16);
gtk_container_add (GTK_CONTAINER (alignment14), vbox16);
check_toolbar_fileops = gtk_check_button_new_with_mnemonic (_("Show file operation buttons"));
check_toolbar_fileops = gtk_check_button_new_with_mnemonic (_("Show File Operation buttons"));
gtk_widget_show (check_toolbar_fileops);
gtk_box_pack_start (GTK_BOX (vbox16), check_toolbar_fileops, FALSE, FALSE, 0);
gtk_tooltips_set_tip (tooltips, check_toolbar_fileops, _("Display the New, Open, Close, Save and Reload buttons in the toolbar"), NULL);
check_toolbar_cutdelete = gtk_check_button_new_with_mnemonic (_("Show Cut and Delete buttons"));
gtk_widget_show (check_toolbar_cutdelete);
gtk_box_pack_start (GTK_BOX (vbox16), check_toolbar_cutdelete, FALSE, FALSE, 0);
gtk_tooltips_set_tip (tooltips, check_toolbar_cutdelete, _("Display the Cut and Delete buttons in the toolbar"), NULL);
check_toolbar_copypaste = gtk_check_button_new_with_mnemonic (_("Show Copy and Paste buttons"));
gtk_widget_show (check_toolbar_copypaste);
gtk_box_pack_start (GTK_BOX (vbox16), check_toolbar_copypaste, FALSE, FALSE, 0);
gtk_tooltips_set_tip (tooltips, check_toolbar_copypaste, _("Display the Copy and Paste buttons in the toolbar"), NULL);
check_toolbar_undo = gtk_check_button_new_with_mnemonic (_("Show Redo and Undo buttons"));
gtk_widget_show (check_toolbar_undo);
gtk_box_pack_start (GTK_BOX (vbox16), check_toolbar_undo, FALSE, FALSE, 0);
@ -4891,6 +4949,8 @@ create_prefs_dialog (void)
GLADE_HOOKUP_OBJECT (prefs_dialog, alignment14, "alignment14");
GLADE_HOOKUP_OBJECT (prefs_dialog, vbox16, "vbox16");
GLADE_HOOKUP_OBJECT (prefs_dialog, check_toolbar_fileops, "check_toolbar_fileops");
GLADE_HOOKUP_OBJECT (prefs_dialog, check_toolbar_cutdelete, "check_toolbar_cutdelete");
GLADE_HOOKUP_OBJECT (prefs_dialog, check_toolbar_copypaste, "check_toolbar_copypaste");
GLADE_HOOKUP_OBJECT (prefs_dialog, check_toolbar_undo, "check_toolbar_undo");
GLADE_HOOKUP_OBJECT (prefs_dialog, check_toolbar_navigation, "check_toolbar_navigation");
GLADE_HOOKUP_OBJECT (prefs_dialog, check_toolbar_compile, "check_toolbar_compile");

View File

@ -374,6 +374,8 @@ static void save_dialog_prefs(GKeyFile *config)
g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_compile", toolbar_prefs.show_compile);
g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_colour", toolbar_prefs.show_colour);
g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_fileops", toolbar_prefs.show_fileops);
g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_cutdelete", toolbar_prefs.show_cutdelete);
g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_copypaste", toolbar_prefs.show_copypaste);
g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_quit", toolbar_prefs.show_quit);
g_key_file_set_integer(config, PACKAGE, "pref_toolbar_icon_style", toolbar_prefs.icon_style);
g_key_file_set_integer(config, PACKAGE, "pref_toolbar_icon_size", toolbar_prefs.icon_size);
@ -703,6 +705,8 @@ static void load_dialog_prefs(GKeyFile *config)
toolbar_prefs.show_navigation = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_navigation", TRUE);
toolbar_prefs.show_colour = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_colour", TRUE);
toolbar_prefs.show_fileops = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_fileops", TRUE);
toolbar_prefs.show_cutdelete = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_cutdelete", FALSE);
toolbar_prefs.show_copypaste = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_copypaste", FALSE);
toolbar_prefs.show_quit = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_quit", TRUE);
{
GtkIconSize tb_iconsize;

View File

@ -41,7 +41,7 @@
enum {
/** The Application Programming Interface (API) version, incremented
* whenever any plugin data types are modified or appended to. */
GEANY_API_VERSION = 101,
GEANY_API_VERSION = 102,
/** The Application Binary Interface (ABI) version, incremented whenever
* existing fields in the plugin data types have to be changed or reordered. */

View File

@ -467,6 +467,12 @@ void prefs_init_dialog(void)
widget = lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_fileops");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), toolbar_prefs.show_fileops);
widget = lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_cutdelete");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), toolbar_prefs.show_cutdelete);
widget = lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_copypaste");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), toolbar_prefs.show_copypaste);
widget = lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_quit");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), toolbar_prefs.show_quit);
@ -873,6 +879,12 @@ on_prefs_button_clicked(GtkDialog *dialog, gint response, gpointer user_data)
widget = lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_fileops");
toolbar_prefs.show_fileops = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
widget = lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_cutdelete");
toolbar_prefs.show_cutdelete = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
widget = lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_copypaste");
toolbar_prefs.show_copypaste = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
widget = lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_quit");
toolbar_prefs.show_quit = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));

View File

@ -848,6 +848,12 @@ void ui_update_toolbar_items(void)
ui_widget_show_hide(lookup_widget(main_widgets.window, "toolbutton_undo"), toolbar_prefs.show_undo);
ui_widget_show_hide(lookup_widget(main_widgets.window, "toolbutton_redo"), toolbar_prefs.show_undo);
ui_widget_show_hide(lookup_widget(main_widgets.window, "separatortoolitem9"), toolbar_prefs.show_undo);
/* C&P */
ui_widget_show_hide(lookup_widget(main_widgets.window, "toolbutton_copy"), toolbar_prefs.show_copypaste);
ui_widget_show_hide(lookup_widget(main_widgets.window, "toolbutton_paste"), toolbar_prefs.show_copypaste);
ui_widget_show_hide(lookup_widget(main_widgets.window, "toolbutton_cut"), toolbar_prefs.show_cutdelete);
ui_widget_show_hide(lookup_widget(main_widgets.window, "toolbutton_delete"), toolbar_prefs.show_cutdelete);
ui_widget_show_hide(lookup_widget(main_widgets.window, "separatortoolitem12"), toolbar_prefs.show_cutdelete || toolbar_prefs.show_copypaste);
/* navigation */
ui_widget_show_hide(lookup_widget(main_widgets.window, "toolbutton_back"), toolbar_prefs.show_navigation);
ui_widget_show_hide(lookup_widget(main_widgets.window, "toolbutton_forward"), toolbar_prefs.show_navigation);

View File

@ -59,6 +59,8 @@ typedef struct GeanyToolbarPrefs
gboolean show_quit;
GtkIconSize icon_size;
gint icon_style;
gboolean show_cutdelete;
gboolean show_copypaste;
}
GeanyToolbarPrefs;