Added custom commands to send selected text through some definable commands and replace the selection with the output.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@1334 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Enrico Tröger 2007-02-25 14:26:55 +00:00
parent 955f8488cb
commit 549f19444e
12 changed files with 777 additions and 183 deletions

View File

@ -1,3 +1,12 @@
2007-02-25 Enrico Tröger <enrico.troeger@uvena.de>
* geany.glade, doc/geany.docbook, src/geany.h, src/interface.c,
src/keybindings.c, src/keybindings.h, src/keyfile.c, src/main.c,
src/tools.c, src/tools.h:
Added custom commands to send selected text through some definable
commands and replace the selection with the output.
2007-02-25 Nick Treleaven <nick.treleaven@btinternet.com>
* src/build.c:
@ -6,7 +15,7 @@
Should close #1668017.
2007-02-24 Enrico Troeger <enrico.troeger@uvena.de>
2007-02-24 Enrico Tröger <enrico.troeger@uvena.de>
* configure.in, Makefile.am, README.I18N, po/intl_stats.sh, po/LINGUAS:
Moved list of available translations to new file po/LINGUAS.
@ -36,9 +45,9 @@
Don't include filetype.none in the new file template menus.
2007-02-20 Enrico Troeger <enrico.troeger@uvena.de>
2007-02-20 Enrico Tröger <enrico.troeger@uvena.de>
* src/sci_cb.c, src/sci_cb.c:
* src/sci_cb.c, src/sci_cb.h:
Made auto_close_bracket() static and auto close brackets only when
auto completion of constructs is enabled (closes #1665015).
* doc/geany.1.in: Fixed typo.

View File

@ -421,6 +421,28 @@
</para>
</note>
</section>
<section id="general_cc">
<title>Send text through definable commands</title>
<para>
You can define several custom commands in <application>Geany</application> and
send the current selection to one of these commands. The output of the command
will be used to replace the current selection. So, it is possible to use text
formatting tools with Geany in a general way.
The selected text will be sent to the standard input of the executed command,
so the command should be able to read from it and it should print all results
to its standard output which will be read by <application>Geany</application>.
To help finding errors in executing the command, the output of the program's
standard error will be printed on <application>Geany</application>'s standard
output.
</para>
<para>
To add a custom command, just go to the Set Custom Commands dialog in the
Format sub menu of the Edit and Popup menu. Then click on Add to get a new
text entry and type the command. You can also specify some command line options.
To delete a command, just clear the text entry and press Ok. It will be deleted
automatically.
</para>
</section>
</section>
<section id="charset">
<title>Character sets and Unicode Byte-Order-Mark (BOM)</title>

View File

@ -57,7 +57,7 @@
<property name="use_underline">True</property>
<child internal-child="image">
<widget class="GtkImage" id="image1537">
<widget class="GtkImage" id="image1676">
<property name="visible">True</property>
<property name="stock">gtk-new</property>
<property name="icon_size">1</property>
@ -147,7 +147,7 @@
<signal name="activate" handler="on_save_all1_activate" last_modification_time="Thu, 02 Jun 2005 14:15:30 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1538">
<widget class="GtkImage" id="image1677">
<property name="visible">True</property>
<property name="stock">gtk-save</property>
<property name="icon_size">1</property>
@ -168,7 +168,7 @@
<signal name="activate" handler="on_toolbutton23_clicked" last_modification_time="Mon, 24 Jul 2006 19:26:04 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1539">
<widget class="GtkImage" id="image1678">
<property name="visible">True</property>
<property name="stock">gtk-revert-to-saved</property>
<property name="icon_size">1</property>
@ -188,7 +188,7 @@
<property name="use_underline">True</property>
<child internal-child="image">
<widget class="GtkImage" id="image1540">
<widget class="GtkImage" id="image1679">
<property name="visible">True</property>
<property name="stock">gtk-revert-to-saved</property>
<property name="icon_size">1</property>
@ -268,7 +268,7 @@
<signal name="activate" handler="on_close_all1_activate" last_modification_time="Thu, 02 Jun 2005 14:15:30 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1541">
<widget class="GtkImage" id="image1680">
<property name="visible">True</property>
<property name="stock">gtk-close</property>
<property name="icon_size">1</property>
@ -476,7 +476,7 @@
<signal name="activate" handler="on_menu_increase_indent1_activate" last_modification_time="Tue, 01 Aug 2006 10:28:54 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1542">
<widget class="GtkImage" id="image1681">
<property name="visible">True</property>
<property name="stock">gtk-indent</property>
<property name="icon_size">1</property>
@ -497,7 +497,7 @@
<signal name="activate" handler="on_menu_decrease_indent1_activate" last_modification_time="Tue, 01 Aug 2006 10:28:54 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1543">
<widget class="GtkImage" id="image1682">
<property name="visible">True</property>
<property name="stock">gtk-unindent</property>
<property name="icon_size">1</property>
@ -509,6 +509,32 @@
</child>
</widget>
</child>
<child>
<widget class="GtkSeparatorMenuItem" id="separator37">
<property name="visible">True</property>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="send_selection_to2">
<property name="visible">True</property>
<property name="label" translatable="yes">_Send Selection to</property>
<property name="use_underline">True</property>
<child>
<widget class="GtkMenu" id="send_selection_to2_menu">
<child>
<widget class="GtkMenuItem" id="invisible13">
<property name="label" translatable="yes">invisible</property>
<property name="use_underline">True</property>
</widget>
</child>
</widget>
</child>
</widget>
</child>
</widget>
</child>
</widget>
@ -527,7 +553,7 @@
<property name="use_underline">True</property>
<child internal-child="image">
<widget class="GtkImage" id="image1544">
<widget class="GtkImage" id="image1683">
<property name="visible">True</property>
<property name="stock">gtk-add</property>
<property name="icon_size">1</property>
@ -559,7 +585,7 @@
<property name="use_underline">True</property>
<child internal-child="image">
<widget class="GtkImage" id="image1545">
<widget class="GtkImage" id="image1684">
<property name="visible">True</property>
<property name="stock">gtk-add</property>
<property name="icon_size">1</property>
@ -638,11 +664,23 @@
</child>
<child>
<widget class="GtkMenuItem" id="insert_date1">
<widget class="GtkImageMenuItem" id="insert_date1">
<property name="visible">True</property>
<property name="label" translatable="yes">Insert Dat_e</property>
<property name="use_underline">True</property>
<child internal-child="image">
<widget class="GtkImage" id="image1685">
<property name="visible">True</property>
<property name="stock">gtk-add</property>
<property name="icon_size">1</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
</child>
<child>
<widget class="GtkMenu" id="insert_date1_menu">
@ -729,7 +767,7 @@
<signal name="activate" handler="on_replace1_activate" last_modification_time="Sun, 23 Oct 2005 13:22:36 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1546">
<widget class="GtkImage" id="image1686">
<property name="visible">True</property>
<property name="stock">gtk-find-and-replace</property>
<property name="icon_size">1</property>
@ -795,7 +833,7 @@
<signal name="activate" handler="on_go_to_line1_activate" last_modification_time="Tue, 23 May 2006 17:10:49 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1547">
<widget class="GtkImage" id="image1687">
<property name="visible">True</property>
<property name="stock">gtk-jump-to</property>
<property name="icon_size">1</property>
@ -830,7 +868,7 @@
<signal name="activate" handler="on_change_font1_activate" last_modification_time="Fri, 22 Apr 2005 18:58:45 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1548">
<widget class="GtkImage" id="image1688">
<property name="visible">True</property>
<property name="stock">gtk-select-font</property>
<property name="icon_size">1</property>
@ -1061,7 +1099,7 @@
<property name="visible">True</property>
<property name="label" translatable="yes">Convert and Set to _CR/LF (Win)</property>
<property name="use_underline">True</property>
<property name="active">True</property>
<property name="active">False</property>
<signal name="activate" handler="on_crlf_activate" last_modification_time="Thu, 28 Apr 2005 16:27:24 GMT"/>
</widget>
</child>
@ -1071,7 +1109,7 @@
<property name="visible">True</property>
<property name="label" translatable="yes">Convert and Set to _LF (Unix)</property>
<property name="use_underline">True</property>
<property name="active">True</property>
<property name="active">False</property>
<property name="group">crlf</property>
<signal name="activate" handler="on_lf_activate" last_modification_time="Thu, 28 Apr 2005 16:27:24 GMT"/>
</widget>
@ -1181,7 +1219,7 @@
<signal name="activate" handler="on_project_new1_activate" last_modification_time="Thu, 18 Jan 2007 22:16:24 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1549">
<widget class="GtkImage" id="image1689">
<property name="visible">True</property>
<property name="stock">gtk-new</property>
<property name="icon_size">1</property>
@ -1202,7 +1240,7 @@
<signal name="activate" handler="on_project_open1_activate" last_modification_time="Mon, 15 Jan 2007 17:34:17 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1550">
<widget class="GtkImage" id="image1690">
<property name="visible">True</property>
<property name="stock">gtk-open</property>
<property name="icon_size">1</property>
@ -1223,7 +1261,7 @@
<signal name="activate" handler="on_project_close1_activate" last_modification_time="Mon, 15 Jan 2007 17:34:17 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1551">
<widget class="GtkImage" id="image1691">
<property name="visible">True</property>
<property name="stock">gtk-close</property>
<property name="icon_size">1</property>
@ -1281,7 +1319,7 @@
<signal name="activate" handler="on_show_color_chooser1_activate" last_modification_time="Wed, 22 Jun 2005 18:10:21 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1552">
<widget class="GtkImage" id="image1692">
<property name="visible">True</property>
<property name="stock">gtk-select-color</property>
<property name="icon_size">1</property>
@ -2531,7 +2569,7 @@
<signal name="activate" handler="on_menu_increase_indent1_activate" last_modification_time="Tue, 01 Aug 2006 10:31:38 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1516">
<widget class="GtkImage" id="image1669">
<property name="visible">True</property>
<property name="stock">gtk-indent</property>
<property name="icon_size">1</property>
@ -2552,7 +2590,7 @@
<signal name="activate" handler="on_menu_decrease_indent1_activate" last_modification_time="Tue, 01 Aug 2006 10:31:38 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1517">
<widget class="GtkImage" id="image1670">
<property name="visible">True</property>
<property name="stock">gtk-unindent</property>
<property name="icon_size">1</property>
@ -2564,6 +2602,32 @@
</child>
</widget>
</child>
<child>
<widget class="GtkSeparatorMenuItem" id="separator38">
<property name="visible">True</property>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="send_selection_to1">
<property name="visible">True</property>
<property name="label" translatable="yes">_Send Selection to</property>
<property name="use_underline">True</property>
<child>
<widget class="GtkMenu" id="send_selection_to1_menu">
<child>
<widget class="GtkMenuItem" id="invisible12">
<property name="label" translatable="yes">invisible</property>
<property name="use_underline">True</property>
</widget>
</child>
</widget>
</child>
</widget>
</child>
</widget>
</child>
</widget>
@ -2582,7 +2646,7 @@
<property name="use_underline">True</property>
<child internal-child="image">
<widget class="GtkImage" id="image1518">
<widget class="GtkImage" id="image1671">
<property name="visible">True</property>
<property name="stock">gtk-add</property>
<property name="icon_size">1</property>
@ -2614,7 +2678,7 @@
<property name="use_underline">True</property>
<child internal-child="image">
<widget class="GtkImage" id="image1519">
<widget class="GtkImage" id="image1672">
<property name="visible">True</property>
<property name="stock">gtk-add</property>
<property name="icon_size">1</property>
@ -2693,11 +2757,23 @@
</child>
<child>
<widget class="GtkMenuItem" id="insert_date2">
<widget class="GtkImageMenuItem" id="insert_date2">
<property name="visible">True</property>
<property name="label" translatable="yes">Insert Dat_e</property>
<property name="use_underline">True</property>
<child internal-child="image">
<widget class="GtkImage" id="image1673">
<property name="visible">True</property>
<property name="stock">gtk-add</property>
<property name="icon_size">1</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
</child>
<child>
<widget class="GtkMenu" id="insert_date2_menu">
@ -2726,7 +2802,7 @@
<signal name="activate" handler="on_find_usage1_activate" last_modification_time="Fri, 27 May 2005 21:55:12 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1520">
<widget class="GtkImage" id="image1674">
<property name="visible">True</property>
<property name="stock">gtk-find</property>
<property name="icon_size">1</property>
@ -2772,7 +2848,7 @@
<signal name="activate" handler="on_go_to_line_activate" last_modification_time="Sat, 16 Jul 2005 11:20:32 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1521">
<widget class="GtkImage" id="image1675">
<property name="visible">True</property>
<property name="stock">gtk-jump-to</property>
<property name="icon_size">1</property>

View File

@ -2086,8 +2086,6 @@ on_menu_insert_date_activate (GtkMenuItem *menuitem,
}
void
on_project_new1_activate (GtkMenuItem *menuitem,
gpointer user_data)

View File

@ -154,6 +154,7 @@ typedef struct MyApp
gchar *datadir;
gchar *docdir;
gchar *custom_date_format;
gchar **custom_commands;
gchar *tools_browser_cmd;
gchar *tools_make_cmd;
gchar *tools_term_cmd;

View File

@ -37,7 +37,7 @@ create_window1 (void)
GtkWidget *menuitem1_menu;
GtkWidget *menu_new1;
GtkWidget *menu_new_with_template1;
GtkWidget *image1537;
GtkWidget *image1676;
GtkWidget *menu_new_with_template1_menu;
GtkWidget *invisible2;
GtkWidget *separator12;
@ -48,11 +48,11 @@ create_window1 (void)
GtkWidget *menu_save1;
GtkWidget *menu_save_as1;
GtkWidget *menu_save_all1;
GtkWidget *image1538;
GtkWidget *image1677;
GtkWidget *menu_reload1;
GtkWidget *image1539;
GtkWidget *image1678;
GtkWidget *menu_reload_as1;
GtkWidget *image1540;
GtkWidget *image1679;
GtkWidget *menu_reload_as1_menu;
GtkWidget *invisible7;
GtkWidget *separator21;
@ -62,7 +62,7 @@ create_window1 (void)
GtkWidget *separator14;
GtkWidget *menu_close1;
GtkWidget *menu_close_all1;
GtkWidget *image1541;
GtkWidget *image1680;
GtkWidget *menu_separatormenuitem1;
GtkWidget *menu_quit1;
GtkWidget *edit1;
@ -88,16 +88,20 @@ create_window1 (void)
GtkWidget *menu_duplicate_line1;
GtkWidget *separator29;
GtkWidget *menu_increase_indent1;
GtkWidget *image1542;
GtkWidget *image1681;
GtkWidget *menu_decrease_indent1;
GtkWidget *image1543;
GtkWidget *image1682;
GtkWidget *separator37;
GtkWidget *send_selection_to2;
GtkWidget *send_selection_to2_menu;
GtkWidget *invisible13;
GtkWidget *separator18;
GtkWidget *insert_include2;
GtkWidget *image1544;
GtkWidget *image1683;
GtkWidget *insert_include2_menu;
GtkWidget *invisible4;
GtkWidget *add_comments1;
GtkWidget *image1545;
GtkWidget *image1684;
GtkWidget *add_comments1_menu;
GtkWidget *menu_add_changelog_entry1;
GtkWidget *insert_file_header1;
@ -106,6 +110,7 @@ create_window1 (void)
GtkWidget *insert_gpl_notice2;
GtkWidget *insert_bsd_license_notice2;
GtkWidget *insert_date1;
GtkWidget *image1685;
GtkWidget *insert_date1_menu;
GtkWidget *invisible8;
GtkWidget *separator9;
@ -117,7 +122,7 @@ create_window1 (void)
GtkWidget *find_previous1;
GtkWidget *find_in_files1;
GtkWidget *replace1;
GtkWidget *image1546;
GtkWidget *image1686;
GtkWidget *separator33;
GtkWidget *find_nextsel1;
GtkWidget *find_prevsel1;
@ -125,11 +130,11 @@ create_window1 (void)
GtkWidget *next_message1;
GtkWidget *separator32;
GtkWidget *go_to_line1;
GtkWidget *image1547;
GtkWidget *image1687;
GtkWidget *menuitem3;
GtkWidget *menuitem3_menu;
GtkWidget *menu_change_font1;
GtkWidget *image1548;
GtkWidget *image1688;
GtkWidget *menu_separator4;
GtkWidget *menu_fullscreen1;
GtkWidget *menu_show_messages_window1;
@ -171,18 +176,18 @@ create_window1 (void)
GtkWidget *menu_project1;
GtkWidget *menu_project1_menu;
GtkWidget *project_new1;
GtkWidget *image1549;
GtkWidget *image1689;
GtkWidget *project_open1;
GtkWidget *image1550;
GtkWidget *image1690;
GtkWidget *project_close1;
GtkWidget *image1551;
GtkWidget *image1691;
GtkWidget *separator34;
GtkWidget *project_properties1;
GtkWidget *menu_build1;
GtkWidget *tools1;
GtkWidget *tools1_menu;
GtkWidget *menu_choose_color1;
GtkWidget *image1552;
GtkWidget *image1692;
GtkWidget *menu_count_words1;
GtkWidget *menu_insert_special_chars1;
GtkWidget *menu_item5;
@ -283,9 +288,9 @@ create_window1 (void)
gtk_widget_show (menu_new_with_template1);
gtk_container_add (GTK_CONTAINER (menuitem1_menu), menu_new_with_template1);
image1537 = gtk_image_new_from_stock ("gtk-new", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1537);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_new_with_template1), image1537);
image1676 = gtk_image_new_from_stock ("gtk-new", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1676);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_new_with_template1), image1676);
menu_new_with_template1_menu = gtk_menu_new ();
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_new_with_template1), menu_new_with_template1_menu);
@ -328,25 +333,25 @@ create_window1 (void)
gtk_container_add (GTK_CONTAINER (menuitem1_menu), menu_save_all1);
gtk_tooltips_set_tip (tooltips, menu_save_all1, _("Saves all open files"), NULL);
image1538 = gtk_image_new_from_stock ("gtk-save", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1538);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_save_all1), image1538);
image1677 = gtk_image_new_from_stock ("gtk-save", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1677);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_save_all1), image1677);
menu_reload1 = gtk_image_menu_item_new_with_mnemonic (_("_Reload"));
gtk_widget_show (menu_reload1);
gtk_container_add (GTK_CONTAINER (menuitem1_menu), menu_reload1);
image1539 = gtk_image_new_from_stock ("gtk-revert-to-saved", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1539);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_reload1), image1539);
image1678 = gtk_image_new_from_stock ("gtk-revert-to-saved", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1678);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_reload1), image1678);
menu_reload_as1 = gtk_image_menu_item_new_with_mnemonic (_("R_eload As"));
gtk_widget_show (menu_reload_as1);
gtk_container_add (GTK_CONTAINER (menuitem1_menu), menu_reload_as1);
image1540 = gtk_image_new_from_stock ("gtk-revert-to-saved", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1540);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_reload_as1), image1540);
image1679 = gtk_image_new_from_stock ("gtk-revert-to-saved", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1679);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_reload_as1), image1679);
menu_reload_as1_menu = gtk_menu_new ();
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_reload_as1), menu_reload_as1_menu);
@ -387,9 +392,9 @@ create_window1 (void)
gtk_container_add (GTK_CONTAINER (menuitem1_menu), menu_close_all1);
gtk_tooltips_set_tip (tooltips, menu_close_all1, _("Closes all open files"), NULL);
image1541 = gtk_image_new_from_stock ("gtk-close", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1541);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_close_all1), image1541);
image1680 = gtk_image_new_from_stock ("gtk-close", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1680);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_close_all1), image1680);
menu_separatormenuitem1 = gtk_separator_menu_item_new ();
gtk_widget_show (menu_separatormenuitem1);
@ -497,17 +502,32 @@ create_window1 (void)
gtk_widget_show (menu_increase_indent1);
gtk_container_add (GTK_CONTAINER (menu_format1_menu), menu_increase_indent1);
image1542 = gtk_image_new_from_stock ("gtk-indent", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1542);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_increase_indent1), image1542);
image1681 = gtk_image_new_from_stock ("gtk-indent", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1681);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_increase_indent1), image1681);
menu_decrease_indent1 = gtk_image_menu_item_new_with_mnemonic (_("_Decrease Indent"));
gtk_widget_show (menu_decrease_indent1);
gtk_container_add (GTK_CONTAINER (menu_format1_menu), menu_decrease_indent1);
image1543 = gtk_image_new_from_stock ("gtk-unindent", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1543);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_decrease_indent1), image1543);
image1682 = gtk_image_new_from_stock ("gtk-unindent", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1682);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_decrease_indent1), image1682);
separator37 = gtk_separator_menu_item_new ();
gtk_widget_show (separator37);
gtk_container_add (GTK_CONTAINER (menu_format1_menu), separator37);
gtk_widget_set_sensitive (separator37, FALSE);
send_selection_to2 = gtk_menu_item_new_with_mnemonic (_("_Send Selection to"));
gtk_widget_show (send_selection_to2);
gtk_container_add (GTK_CONTAINER (menu_format1_menu), send_selection_to2);
send_selection_to2_menu = gtk_menu_new ();
gtk_menu_item_set_submenu (GTK_MENU_ITEM (send_selection_to2), send_selection_to2_menu);
invisible13 = gtk_menu_item_new_with_mnemonic (_("invisible"));
gtk_container_add (GTK_CONTAINER (send_selection_to2_menu), invisible13);
separator18 = gtk_separator_menu_item_new ();
gtk_widget_show (separator18);
@ -518,9 +538,9 @@ create_window1 (void)
gtk_widget_show (insert_include2);
gtk_container_add (GTK_CONTAINER (edit1_menu), insert_include2);
image1544 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1544);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (insert_include2), image1544);
image1683 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1683);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (insert_include2), image1683);
insert_include2_menu = gtk_menu_new ();
gtk_menu_item_set_submenu (GTK_MENU_ITEM (insert_include2), insert_include2_menu);
@ -532,9 +552,9 @@ create_window1 (void)
gtk_widget_show (add_comments1);
gtk_container_add (GTK_CONTAINER (edit1_menu), add_comments1);
image1545 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1545);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (add_comments1), image1545);
image1684 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1684);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (add_comments1), image1684);
add_comments1_menu = gtk_menu_new ();
gtk_menu_item_set_submenu (GTK_MENU_ITEM (add_comments1), add_comments1_menu);
@ -569,10 +589,14 @@ create_window1 (void)
gtk_container_add (GTK_CONTAINER (add_comments1_menu), insert_bsd_license_notice2);
gtk_tooltips_set_tip (tooltips, insert_bsd_license_notice2, _("Inserts a BSD licence notice (should be done at the beginning of the file)"), NULL);
insert_date1 = gtk_menu_item_new_with_mnemonic (_("Insert Dat_e"));
insert_date1 = gtk_image_menu_item_new_with_mnemonic (_("Insert Dat_e"));
gtk_widget_show (insert_date1);
gtk_container_add (GTK_CONTAINER (edit1_menu), insert_date1);
image1685 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1685);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (insert_date1), image1685);
insert_date1_menu = gtk_menu_new ();
gtk_menu_item_set_submenu (GTK_MENU_ITEM (insert_date1), insert_date1_menu);
@ -615,9 +639,9 @@ create_window1 (void)
gtk_widget_show (replace1);
gtk_container_add (GTK_CONTAINER (search1_menu), replace1);
image1546 = gtk_image_new_from_stock ("gtk-find-and-replace", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1546);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (replace1), image1546);
image1686 = gtk_image_new_from_stock ("gtk-find-and-replace", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1686);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (replace1), image1686);
separator33 = gtk_separator_menu_item_new ();
gtk_widget_show (separator33);
@ -650,9 +674,9 @@ create_window1 (void)
gtk_widget_show (go_to_line1);
gtk_container_add (GTK_CONTAINER (search1_menu), go_to_line1);
image1547 = gtk_image_new_from_stock ("gtk-jump-to", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1547);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (go_to_line1), image1547);
image1687 = gtk_image_new_from_stock ("gtk-jump-to", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1687);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (go_to_line1), image1687);
menuitem3 = gtk_menu_item_new_with_mnemonic (_("_View"));
gtk_widget_show (menuitem3);
@ -666,9 +690,9 @@ create_window1 (void)
gtk_container_add (GTK_CONTAINER (menuitem3_menu), menu_change_font1);
gtk_tooltips_set_tip (tooltips, menu_change_font1, _("Change the default font"), NULL);
image1548 = gtk_image_new_from_stock ("gtk-select-font", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1548);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_change_font1), image1548);
image1688 = gtk_image_new_from_stock ("gtk-select-font", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1688);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_change_font1), image1688);
menu_separator4 = gtk_separator_menu_item_new ();
gtk_widget_show (menu_separator4);
@ -788,13 +812,11 @@ create_window1 (void)
crlf_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (crlf));
gtk_widget_show (crlf);
gtk_container_add (GTK_CONTAINER (menu_line_endings1_menu), crlf);
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (crlf), TRUE);
lf = gtk_radio_menu_item_new_with_mnemonic (crlf_group, _("Convert and Set to _LF (Unix)"));
crlf_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (lf));
gtk_widget_show (lf);
gtk_container_add (GTK_CONTAINER (menu_line_endings1_menu), lf);
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (lf), TRUE);
cr = gtk_radio_menu_item_new_with_mnemonic (crlf_group, _("Convert and Set to CR (_Mac)"));
crlf_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (cr));
@ -852,25 +874,25 @@ create_window1 (void)
gtk_widget_show (project_new1);
gtk_container_add (GTK_CONTAINER (menu_project1_menu), project_new1);
image1549 = gtk_image_new_from_stock ("gtk-new", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1549);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (project_new1), image1549);
image1689 = gtk_image_new_from_stock ("gtk-new", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1689);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (project_new1), image1689);
project_open1 = gtk_image_menu_item_new_with_mnemonic (_("_Open"));
gtk_widget_show (project_open1);
gtk_container_add (GTK_CONTAINER (menu_project1_menu), project_open1);
image1550 = gtk_image_new_from_stock ("gtk-open", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1550);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (project_open1), image1550);
image1690 = gtk_image_new_from_stock ("gtk-open", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1690);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (project_open1), image1690);
project_close1 = gtk_image_menu_item_new_with_mnemonic (_("_Close"));
gtk_widget_show (project_close1);
gtk_container_add (GTK_CONTAINER (menu_project1_menu), project_close1);
image1551 = gtk_image_new_from_stock ("gtk-close", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1551);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (project_close1), image1551);
image1691 = gtk_image_new_from_stock ("gtk-close", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1691);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (project_close1), image1691);
separator34 = gtk_separator_menu_item_new ();
gtk_widget_show (separator34);
@ -897,9 +919,9 @@ create_window1 (void)
gtk_container_add (GTK_CONTAINER (tools1_menu), menu_choose_color1);
gtk_tooltips_set_tip (tooltips, menu_choose_color1, _("Open a color chooser dialog, to interactively pick colors from a palette."), NULL);
image1552 = gtk_image_new_from_stock ("gtk-select-color", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1552);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_choose_color1), image1552);
image1692 = gtk_image_new_from_stock ("gtk-select-color", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1692);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_choose_color1), image1692);
menu_count_words1 = gtk_menu_item_new_with_mnemonic (_("_Word Count"));
gtk_widget_show (menu_count_words1);
@ -1524,7 +1546,7 @@ create_window1 (void)
GLADE_HOOKUP_OBJECT (window1, menuitem1_menu, "menuitem1_menu");
GLADE_HOOKUP_OBJECT (window1, menu_new1, "menu_new1");
GLADE_HOOKUP_OBJECT (window1, menu_new_with_template1, "menu_new_with_template1");
GLADE_HOOKUP_OBJECT (window1, image1537, "image1537");
GLADE_HOOKUP_OBJECT (window1, image1676, "image1676");
GLADE_HOOKUP_OBJECT (window1, menu_new_with_template1_menu, "menu_new_with_template1_menu");
GLADE_HOOKUP_OBJECT (window1, invisible2, "invisible2");
GLADE_HOOKUP_OBJECT (window1, separator12, "separator12");
@ -1535,11 +1557,11 @@ create_window1 (void)
GLADE_HOOKUP_OBJECT (window1, menu_save1, "menu_save1");
GLADE_HOOKUP_OBJECT (window1, menu_save_as1, "menu_save_as1");
GLADE_HOOKUP_OBJECT (window1, menu_save_all1, "menu_save_all1");
GLADE_HOOKUP_OBJECT (window1, image1538, "image1538");
GLADE_HOOKUP_OBJECT (window1, image1677, "image1677");
GLADE_HOOKUP_OBJECT (window1, menu_reload1, "menu_reload1");
GLADE_HOOKUP_OBJECT (window1, image1539, "image1539");
GLADE_HOOKUP_OBJECT (window1, image1678, "image1678");
GLADE_HOOKUP_OBJECT (window1, menu_reload_as1, "menu_reload_as1");
GLADE_HOOKUP_OBJECT (window1, image1540, "image1540");
GLADE_HOOKUP_OBJECT (window1, image1679, "image1679");
GLADE_HOOKUP_OBJECT (window1, menu_reload_as1_menu, "menu_reload_as1_menu");
GLADE_HOOKUP_OBJECT (window1, invisible7, "invisible7");
GLADE_HOOKUP_OBJECT (window1, separator21, "separator21");
@ -1549,7 +1571,7 @@ create_window1 (void)
GLADE_HOOKUP_OBJECT (window1, separator14, "separator14");
GLADE_HOOKUP_OBJECT (window1, menu_close1, "menu_close1");
GLADE_HOOKUP_OBJECT (window1, menu_close_all1, "menu_close_all1");
GLADE_HOOKUP_OBJECT (window1, image1541, "image1541");
GLADE_HOOKUP_OBJECT (window1, image1680, "image1680");
GLADE_HOOKUP_OBJECT (window1, menu_separatormenuitem1, "menu_separatormenuitem1");
GLADE_HOOKUP_OBJECT (window1, menu_quit1, "menu_quit1");
GLADE_HOOKUP_OBJECT (window1, edit1, "edit1");
@ -1575,16 +1597,20 @@ create_window1 (void)
GLADE_HOOKUP_OBJECT (window1, menu_duplicate_line1, "menu_duplicate_line1");
GLADE_HOOKUP_OBJECT (window1, separator29, "separator29");
GLADE_HOOKUP_OBJECT (window1, menu_increase_indent1, "menu_increase_indent1");
GLADE_HOOKUP_OBJECT (window1, image1542, "image1542");
GLADE_HOOKUP_OBJECT (window1, image1681, "image1681");
GLADE_HOOKUP_OBJECT (window1, menu_decrease_indent1, "menu_decrease_indent1");
GLADE_HOOKUP_OBJECT (window1, image1543, "image1543");
GLADE_HOOKUP_OBJECT (window1, image1682, "image1682");
GLADE_HOOKUP_OBJECT (window1, separator37, "separator37");
GLADE_HOOKUP_OBJECT (window1, send_selection_to2, "send_selection_to2");
GLADE_HOOKUP_OBJECT (window1, send_selection_to2_menu, "send_selection_to2_menu");
GLADE_HOOKUP_OBJECT (window1, invisible13, "invisible13");
GLADE_HOOKUP_OBJECT (window1, separator18, "separator18");
GLADE_HOOKUP_OBJECT (window1, insert_include2, "insert_include2");
GLADE_HOOKUP_OBJECT (window1, image1544, "image1544");
GLADE_HOOKUP_OBJECT (window1, image1683, "image1683");
GLADE_HOOKUP_OBJECT (window1, insert_include2_menu, "insert_include2_menu");
GLADE_HOOKUP_OBJECT (window1, invisible4, "invisible4");
GLADE_HOOKUP_OBJECT (window1, add_comments1, "add_comments1");
GLADE_HOOKUP_OBJECT (window1, image1545, "image1545");
GLADE_HOOKUP_OBJECT (window1, image1684, "image1684");
GLADE_HOOKUP_OBJECT (window1, add_comments1_menu, "add_comments1_menu");
GLADE_HOOKUP_OBJECT (window1, menu_add_changelog_entry1, "menu_add_changelog_entry1");
GLADE_HOOKUP_OBJECT (window1, insert_file_header1, "insert_file_header1");
@ -1593,6 +1619,7 @@ create_window1 (void)
GLADE_HOOKUP_OBJECT (window1, insert_gpl_notice2, "insert_gpl_notice2");
GLADE_HOOKUP_OBJECT (window1, insert_bsd_license_notice2, "insert_bsd_license_notice2");
GLADE_HOOKUP_OBJECT (window1, insert_date1, "insert_date1");
GLADE_HOOKUP_OBJECT (window1, image1685, "image1685");
GLADE_HOOKUP_OBJECT (window1, insert_date1_menu, "insert_date1_menu");
GLADE_HOOKUP_OBJECT (window1, invisible8, "invisible8");
GLADE_HOOKUP_OBJECT (window1, separator9, "separator9");
@ -1604,7 +1631,7 @@ create_window1 (void)
GLADE_HOOKUP_OBJECT (window1, find_previous1, "find_previous1");
GLADE_HOOKUP_OBJECT (window1, find_in_files1, "find_in_files1");
GLADE_HOOKUP_OBJECT (window1, replace1, "replace1");
GLADE_HOOKUP_OBJECT (window1, image1546, "image1546");
GLADE_HOOKUP_OBJECT (window1, image1686, "image1686");
GLADE_HOOKUP_OBJECT (window1, separator33, "separator33");
GLADE_HOOKUP_OBJECT (window1, find_nextsel1, "find_nextsel1");
GLADE_HOOKUP_OBJECT (window1, find_prevsel1, "find_prevsel1");
@ -1612,11 +1639,11 @@ create_window1 (void)
GLADE_HOOKUP_OBJECT (window1, next_message1, "next_message1");
GLADE_HOOKUP_OBJECT (window1, separator32, "separator32");
GLADE_HOOKUP_OBJECT (window1, go_to_line1, "go_to_line1");
GLADE_HOOKUP_OBJECT (window1, image1547, "image1547");
GLADE_HOOKUP_OBJECT (window1, image1687, "image1687");
GLADE_HOOKUP_OBJECT (window1, menuitem3, "menuitem3");
GLADE_HOOKUP_OBJECT (window1, menuitem3_menu, "menuitem3_menu");
GLADE_HOOKUP_OBJECT (window1, menu_change_font1, "menu_change_font1");
GLADE_HOOKUP_OBJECT (window1, image1548, "image1548");
GLADE_HOOKUP_OBJECT (window1, image1688, "image1688");
GLADE_HOOKUP_OBJECT (window1, menu_separator4, "menu_separator4");
GLADE_HOOKUP_OBJECT (window1, menu_fullscreen1, "menu_fullscreen1");
GLADE_HOOKUP_OBJECT (window1, menu_show_messages_window1, "menu_show_messages_window1");
@ -1657,18 +1684,18 @@ create_window1 (void)
GLADE_HOOKUP_OBJECT (window1, menu_project1, "menu_project1");
GLADE_HOOKUP_OBJECT (window1, menu_project1_menu, "menu_project1_menu");
GLADE_HOOKUP_OBJECT (window1, project_new1, "project_new1");
GLADE_HOOKUP_OBJECT (window1, image1549, "image1549");
GLADE_HOOKUP_OBJECT (window1, image1689, "image1689");
GLADE_HOOKUP_OBJECT (window1, project_open1, "project_open1");
GLADE_HOOKUP_OBJECT (window1, image1550, "image1550");
GLADE_HOOKUP_OBJECT (window1, image1690, "image1690");
GLADE_HOOKUP_OBJECT (window1, project_close1, "project_close1");
GLADE_HOOKUP_OBJECT (window1, image1551, "image1551");
GLADE_HOOKUP_OBJECT (window1, image1691, "image1691");
GLADE_HOOKUP_OBJECT (window1, separator34, "separator34");
GLADE_HOOKUP_OBJECT (window1, project_properties1, "project_properties1");
GLADE_HOOKUP_OBJECT (window1, menu_build1, "menu_build1");
GLADE_HOOKUP_OBJECT (window1, tools1, "tools1");
GLADE_HOOKUP_OBJECT (window1, tools1_menu, "tools1_menu");
GLADE_HOOKUP_OBJECT (window1, menu_choose_color1, "menu_choose_color1");
GLADE_HOOKUP_OBJECT (window1, image1552, "image1552");
GLADE_HOOKUP_OBJECT (window1, image1692, "image1692");
GLADE_HOOKUP_OBJECT (window1, menu_count_words1, "menu_count_words1");
GLADE_HOOKUP_OBJECT (window1, menu_insert_special_chars1, "menu_insert_special_chars1");
GLADE_HOOKUP_OBJECT (window1, menu_item5, "menu_item5");
@ -1866,16 +1893,20 @@ create_edit_menu1 (void)
GtkWidget *menu_duplicate_line2;
GtkWidget *separator31;
GtkWidget *menu_increase_indent2;
GtkWidget *image1516;
GtkWidget *image1669;
GtkWidget *menu_decrease_indent2;
GtkWidget *image1517;
GtkWidget *image1670;
GtkWidget *separator38;
GtkWidget *send_selection_to1;
GtkWidget *send_selection_to1_menu;
GtkWidget *invisible12;
GtkWidget *separator17;
GtkWidget *insert_include1;
GtkWidget *image1518;
GtkWidget *image1671;
GtkWidget *insert_include1_menu;
GtkWidget *invisible3;
GtkWidget *comments;
GtkWidget *image1519;
GtkWidget *image1672;
GtkWidget *comments_menu;
GtkWidget *add_changelog_entry2;
GtkWidget *insert_file_header2;
@ -1884,16 +1915,17 @@ create_edit_menu1 (void)
GtkWidget *insert_gpl_notice1;
GtkWidget *insert_bsd_license_notice1;
GtkWidget *insert_date2;
GtkWidget *image1673;
GtkWidget *insert_date2_menu;
GtkWidget *invisible10;
GtkWidget *separator7;
GtkWidget *find_usage1;
GtkWidget *image1520;
GtkWidget *image1674;
GtkWidget *goto_tag_definition1;
GtkWidget *goto_tag_declaration1;
GtkWidget *separator15;
GtkWidget *go_to_line;
GtkWidget *image1521;
GtkWidget *image1675;
GtkAccelGroup *accel_group;
GtkTooltips *tooltips;
@ -2000,17 +2032,32 @@ create_edit_menu1 (void)
gtk_widget_show (menu_increase_indent2);
gtk_container_add (GTK_CONTAINER (menu_format2_menu), menu_increase_indent2);
image1516 = gtk_image_new_from_stock ("gtk-indent", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1516);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_increase_indent2), image1516);
image1669 = gtk_image_new_from_stock ("gtk-indent", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1669);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_increase_indent2), image1669);
menu_decrease_indent2 = gtk_image_menu_item_new_with_mnemonic (_("_Decrease Indent"));
gtk_widget_show (menu_decrease_indent2);
gtk_container_add (GTK_CONTAINER (menu_format2_menu), menu_decrease_indent2);
image1517 = gtk_image_new_from_stock ("gtk-unindent", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1517);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_decrease_indent2), image1517);
image1670 = gtk_image_new_from_stock ("gtk-unindent", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1670);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_decrease_indent2), image1670);
separator38 = gtk_separator_menu_item_new ();
gtk_widget_show (separator38);
gtk_container_add (GTK_CONTAINER (menu_format2_menu), separator38);
gtk_widget_set_sensitive (separator38, FALSE);
send_selection_to1 = gtk_menu_item_new_with_mnemonic (_("_Send Selection to"));
gtk_widget_show (send_selection_to1);
gtk_container_add (GTK_CONTAINER (menu_format2_menu), send_selection_to1);
send_selection_to1_menu = gtk_menu_new ();
gtk_menu_item_set_submenu (GTK_MENU_ITEM (send_selection_to1), send_selection_to1_menu);
invisible12 = gtk_menu_item_new_with_mnemonic (_("invisible"));
gtk_container_add (GTK_CONTAINER (send_selection_to1_menu), invisible12);
separator17 = gtk_separator_menu_item_new ();
gtk_widget_show (separator17);
@ -2021,9 +2068,9 @@ create_edit_menu1 (void)
gtk_widget_show (insert_include1);
gtk_container_add (GTK_CONTAINER (edit_menu1), insert_include1);
image1518 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1518);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (insert_include1), image1518);
image1671 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1671);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (insert_include1), image1671);
insert_include1_menu = gtk_menu_new ();
gtk_menu_item_set_submenu (GTK_MENU_ITEM (insert_include1), insert_include1_menu);
@ -2035,9 +2082,9 @@ create_edit_menu1 (void)
gtk_widget_show (comments);
gtk_container_add (GTK_CONTAINER (edit_menu1), comments);
image1519 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1519);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (comments), image1519);
image1672 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1672);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (comments), image1672);
comments_menu = gtk_menu_new ();
gtk_menu_item_set_submenu (GTK_MENU_ITEM (comments), comments_menu);
@ -2072,10 +2119,14 @@ create_edit_menu1 (void)
gtk_container_add (GTK_CONTAINER (comments_menu), insert_bsd_license_notice1);
gtk_tooltips_set_tip (tooltips, insert_bsd_license_notice1, _("Inserts a BSD licence notice (should be done at the beginning of the file)"), NULL);
insert_date2 = gtk_menu_item_new_with_mnemonic (_("Insert Dat_e"));
insert_date2 = gtk_image_menu_item_new_with_mnemonic (_("Insert Dat_e"));
gtk_widget_show (insert_date2);
gtk_container_add (GTK_CONTAINER (edit_menu1), insert_date2);
image1673 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1673);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (insert_date2), image1673);
insert_date2_menu = gtk_menu_new ();
gtk_menu_item_set_submenu (GTK_MENU_ITEM (insert_date2), insert_date2_menu);
@ -2091,9 +2142,9 @@ create_edit_menu1 (void)
gtk_widget_show (find_usage1);
gtk_container_add (GTK_CONTAINER (edit_menu1), find_usage1);
image1520 = gtk_image_new_from_stock ("gtk-find", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1520);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (find_usage1), image1520);
image1674 = gtk_image_new_from_stock ("gtk-find", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1674);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (find_usage1), image1674);
goto_tag_definition1 = gtk_menu_item_new_with_mnemonic (_("Go to Tag Definition"));
gtk_widget_show (goto_tag_definition1);
@ -2113,9 +2164,9 @@ create_edit_menu1 (void)
gtk_container_add (GTK_CONTAINER (edit_menu1), go_to_line);
gtk_tooltips_set_tip (tooltips, go_to_line, _("Goto to the entered line"), NULL);
image1521 = gtk_image_new_from_stock ("gtk-jump-to", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1521);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (go_to_line), image1521);
image1675 = gtk_image_new_from_stock ("gtk-jump-to", GTK_ICON_SIZE_MENU);
gtk_widget_show (image1675);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (go_to_line), image1675);
g_signal_connect ((gpointer) undo1, "activate",
G_CALLBACK (on_undo1_activate),
@ -2221,16 +2272,20 @@ create_edit_menu1 (void)
GLADE_HOOKUP_OBJECT (edit_menu1, menu_duplicate_line2, "menu_duplicate_line2");
GLADE_HOOKUP_OBJECT (edit_menu1, separator31, "separator31");
GLADE_HOOKUP_OBJECT (edit_menu1, menu_increase_indent2, "menu_increase_indent2");
GLADE_HOOKUP_OBJECT (edit_menu1, image1516, "image1516");
GLADE_HOOKUP_OBJECT (edit_menu1, image1669, "image1669");
GLADE_HOOKUP_OBJECT (edit_menu1, menu_decrease_indent2, "menu_decrease_indent2");
GLADE_HOOKUP_OBJECT (edit_menu1, image1517, "image1517");
GLADE_HOOKUP_OBJECT (edit_menu1, image1670, "image1670");
GLADE_HOOKUP_OBJECT (edit_menu1, separator38, "separator38");
GLADE_HOOKUP_OBJECT (edit_menu1, send_selection_to1, "send_selection_to1");
GLADE_HOOKUP_OBJECT (edit_menu1, send_selection_to1_menu, "send_selection_to1_menu");
GLADE_HOOKUP_OBJECT (edit_menu1, invisible12, "invisible12");
GLADE_HOOKUP_OBJECT (edit_menu1, separator17, "separator17");
GLADE_HOOKUP_OBJECT (edit_menu1, insert_include1, "insert_include1");
GLADE_HOOKUP_OBJECT (edit_menu1, image1518, "image1518");
GLADE_HOOKUP_OBJECT (edit_menu1, image1671, "image1671");
GLADE_HOOKUP_OBJECT (edit_menu1, insert_include1_menu, "insert_include1_menu");
GLADE_HOOKUP_OBJECT (edit_menu1, invisible3, "invisible3");
GLADE_HOOKUP_OBJECT (edit_menu1, comments, "comments");
GLADE_HOOKUP_OBJECT (edit_menu1, image1519, "image1519");
GLADE_HOOKUP_OBJECT (edit_menu1, image1672, "image1672");
GLADE_HOOKUP_OBJECT (edit_menu1, comments_menu, "comments_menu");
GLADE_HOOKUP_OBJECT (edit_menu1, add_changelog_entry2, "add_changelog_entry2");
GLADE_HOOKUP_OBJECT (edit_menu1, insert_file_header2, "insert_file_header2");
@ -2239,16 +2294,17 @@ create_edit_menu1 (void)
GLADE_HOOKUP_OBJECT (edit_menu1, insert_gpl_notice1, "insert_gpl_notice1");
GLADE_HOOKUP_OBJECT (edit_menu1, insert_bsd_license_notice1, "insert_bsd_license_notice1");
GLADE_HOOKUP_OBJECT (edit_menu1, insert_date2, "insert_date2");
GLADE_HOOKUP_OBJECT (edit_menu1, image1673, "image1673");
GLADE_HOOKUP_OBJECT (edit_menu1, insert_date2_menu, "insert_date2_menu");
GLADE_HOOKUP_OBJECT (edit_menu1, invisible10, "invisible10");
GLADE_HOOKUP_OBJECT (edit_menu1, separator7, "separator7");
GLADE_HOOKUP_OBJECT (edit_menu1, find_usage1, "find_usage1");
GLADE_HOOKUP_OBJECT (edit_menu1, image1520, "image1520");
GLADE_HOOKUP_OBJECT (edit_menu1, image1674, "image1674");
GLADE_HOOKUP_OBJECT (edit_menu1, goto_tag_definition1, "goto_tag_definition1");
GLADE_HOOKUP_OBJECT (edit_menu1, goto_tag_declaration1, "goto_tag_declaration1");
GLADE_HOOKUP_OBJECT (edit_menu1, separator15, "separator15");
GLADE_HOOKUP_OBJECT (edit_menu1, go_to_line, "go_to_line");
GLADE_HOOKUP_OBJECT (edit_menu1, image1521, "image1521");
GLADE_HOOKUP_OBJECT (edit_menu1, image1675, "image1675");
GLADE_HOOKUP_OBJECT_NO_REF (edit_menu1, tooltips, "tooltips");
gtk_menu_set_accel_group (GTK_MENU (edit_menu1), accel_group);

View File

@ -39,6 +39,7 @@
#include "sci_cb.h"
#include "sciwrappers.h"
#include "build.h"
#include "tools.h"
// include vte.h on non-Win32 systems, else define fake vte_init
#ifdef HAVE_VTE
# include "vte.h"
@ -226,6 +227,12 @@ void keybindings_init(void)
GDK_i, GDK_CONTROL_MASK, "edit_increaseindent", _("Increase indent"));
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"));
keys[GEANY_KEYS_EDIT_SENDTOCMD2] = fill(cb_func_edit,
GDK_2, GDK_CONTROL_MASK, "edit_sendtocmd2", _("Send Selection 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"));
keys[GEANY_KEYS_EDIT_GOTOMATCHINGBRACE] = fill(cb_func_edit,
GDK_less, GDK_SHIFT_MASK | GDK_CONTROL_MASK, "edit_gotomatchingbrace",
_("Goto matching brace"));
@ -846,6 +853,18 @@ static void cb_func_edit(guint key_id)
case GEANY_KEYS_EDIT_TOUPPERCASE:
on_to_upper_case1_activate(NULL, NULL);
break;
case GEANY_KEYS_EDIT_SENDTOCMD1:
if (g_strv_length(app->custom_commands) > 0)
tools_execute_custom_command(idx, app->custom_commands[0]);
break;
case GEANY_KEYS_EDIT_SENDTOCMD2:
if (g_strv_length(app->custom_commands) > 1)
tools_execute_custom_command(idx, app->custom_commands[1]);
break;
case GEANY_KEYS_EDIT_SENDTOCMD3:
if (g_strv_length(app->custom_commands) > 2)
tools_execute_custom_command(idx, app->custom_commands[2]);
break;
}
}

View File

@ -100,6 +100,9 @@ enum
GEANY_KEYS_EDIT_UNCOMMENTLINE,
GEANY_KEYS_EDIT_INCREASEINDENT,
GEANY_KEYS_EDIT_DECREASEINDENT,
GEANY_KEYS_EDIT_SENDTOCMD1,
GEANY_KEYS_EDIT_SENDTOCMD2,
GEANY_KEYS_EDIT_SENDTOCMD3,
GEANY_KEYS_EDIT_GOTOMATCHINGBRACE,
GEANY_KEYS_EDIT_AUTOCOMPLETE,
GEANY_KEYS_EDIT_CALLTIP,

View File

@ -150,6 +150,12 @@ void configuration_save()
}
#endif
g_key_file_set_string(config, PACKAGE, "custom_date_format", app->custom_date_format);
if (app->custom_commands != NULL)
{
g_key_file_set_string_list(config, PACKAGE, "custom_commands",
(const gchar**) app->custom_commands, g_strv_length(app->custom_commands));
}
g_key_file_set_string(config, PACKAGE, "editor_font", app->editor_font);
g_key_file_set_string(config, PACKAGE, "tagbar_font", app->tagbar_font);
g_key_file_set_string(config, PACKAGE, "msgwin_font", app->msgwin_font);
@ -335,6 +341,7 @@ gboolean configuration_load()
app->brace_match_ltgt = utils_get_setting_boolean(config, PACKAGE, "brace_match_ltgt", FALSE);
app->switch_msgwin_pages = utils_get_setting_boolean(config, PACKAGE, "switch_msgwin_pages", FALSE);
app->custom_date_format = utils_get_setting_string(config, PACKAGE, "custom_date_format", "");
app->custom_commands = g_key_file_get_string_list(config, PACKAGE, "custom_commands", NULL, NULL);
app->editor_font = utils_get_setting_string(config, PACKAGE, "editor_font", GEANY_DEFAULT_FONT_EDITOR);
app->tagbar_font = utils_get_setting_string(config, PACKAGE, "tagbar_font", GEANY_DEFAULT_FONT_SYMBOL_LIST);
app->msgwin_font = utils_get_setting_string(config, PACKAGE, "msgwin_font", GEANY_DEFAULT_FONT_MSG_WINDOW);

View File

@ -58,6 +58,7 @@
#include "highlighting.h"
#include "symbols.h"
#include "project.h"
#include "tools.h"
#ifdef HAVE_SOCKET
# include "socket.h"
@ -602,6 +603,7 @@ gint main(gint argc, gchar **argv)
ui_create_insert_menu_items();
ui_create_insert_date_menu_items();
keybindings_init();
tools_create_insert_custom_command_menu_items();
notebook_init();
filetypes_init_types();
#ifdef GEANY_DEBUG
@ -745,6 +747,7 @@ void main_quit()
g_free(app->tools_browser_cmd);
g_free(app->tools_print_cmd);
g_free(app->tools_grep_cmd);
g_strfreev(app->custom_commands);
while (! g_queue_is_empty(app->recent_queue))
{
g_free(g_queue_pop_tail(app->recent_queue));

View File

@ -27,10 +27,25 @@
#include "geany.h"
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#ifdef G_OS_UNIX
# include <sys/types.h>
# include <sys/wait.h>
# include <signal.h>
#endif
#include "tools.h"
#include "support.h"
#include "document.h"
#include "sciwrappers.h"
#include "utils.h"
#include "ui_utils.h"
#include "callbacks.h"
#include "msgwindow.h"
#include "keybindings.h"
enum
@ -40,88 +55,88 @@ enum
N_COLUMNS
};
static GtkWidget *special_characters_dialog = NULL;
static GtkTreeStore *special_characters_store = NULL;
static GtkTreeView *special_characters_tree = NULL;
static GtkWidget *sc_dialog = NULL;
static GtkTreeStore *sc_store = NULL;
static GtkTreeView *sc_tree = NULL;
static void on_tools_show_dialog_insert_special_chars_response
static void sc_on_tools_show_dialog_insert_special_chars_response
(GtkDialog *dialog, gint response, gpointer user_data);
static void on_special_characters_tree_row_activated
static void sc_on_tree_row_activated
(GtkTreeView *treeview, GtkTreePath *path, GtkTreeViewColumn *col, gpointer user_data);
static void special_characters_fill_store(GtkTreeStore *store);
static gboolean special_characters_insert(GtkTreeModel *model, GtkTreeIter *iter);
static void sc_fill_store(GtkTreeStore *store);
static gboolean sc_insert(GtkTreeModel *model, GtkTreeIter *iter);
void tools_show_dialog_insert_special_chars()
{
if (special_characters_dialog == NULL)
if (sc_dialog == NULL)
{
gint height;
GtkCellRenderer *renderer;
GtkTreeViewColumn *column;
GtkWidget *swin, *vbox, *label;
special_characters_dialog = gtk_dialog_new_with_buttons(
sc_dialog = gtk_dialog_new_with_buttons(
_("Special characters"), GTK_WINDOW(app->window),
GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
_("_Insert"), GTK_RESPONSE_OK, NULL);
vbox = ui_dialog_vbox_new(GTK_DIALOG(special_characters_dialog));
vbox = ui_dialog_vbox_new(GTK_DIALOG(sc_dialog));
gtk_box_set_spacing(GTK_BOX(vbox), 6);
height = GEANY_WINDOW_MINIMAL_HEIGHT;
gtk_window_set_default_size(GTK_WINDOW(special_characters_dialog), height * 0.8, height);
gtk_dialog_set_default_response(GTK_DIALOG(special_characters_dialog), GTK_RESPONSE_CANCEL);
gtk_window_set_default_size(GTK_WINDOW(sc_dialog), height * 0.8, height);
gtk_dialog_set_default_response(GTK_DIALOG(sc_dialog), GTK_RESPONSE_CANCEL);
label = gtk_label_new(_("Choose a special character from the list below and double click on it or use the button to insert it at the current cursor position."));
gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
special_characters_tree = GTK_TREE_VIEW(gtk_tree_view_new());
sc_tree = GTK_TREE_VIEW(gtk_tree_view_new());
special_characters_store = gtk_tree_store_new(N_COLUMNS, G_TYPE_STRING, G_TYPE_STRING);
gtk_tree_view_set_model(GTK_TREE_VIEW(special_characters_tree),
GTK_TREE_MODEL(special_characters_store));
sc_store = gtk_tree_store_new(N_COLUMNS, G_TYPE_STRING, G_TYPE_STRING);
gtk_tree_view_set_model(GTK_TREE_VIEW(sc_tree),
GTK_TREE_MODEL(sc_store));
renderer = gtk_cell_renderer_text_new();
column = gtk_tree_view_column_new_with_attributes(
_("Character"), renderer, "text", COLUMN_CHARACTER, NULL);
gtk_tree_view_column_set_resizable(column, TRUE);
gtk_tree_view_append_column(GTK_TREE_VIEW(special_characters_tree), column);
gtk_tree_view_append_column(GTK_TREE_VIEW(sc_tree), column);
renderer = gtk_cell_renderer_text_new();
column = gtk_tree_view_column_new_with_attributes(
_("HTML (name)"), renderer, "text", COLUMN_HTML_NAME, NULL);
gtk_tree_view_column_set_resizable(column, TRUE);
gtk_tree_view_append_column(GTK_TREE_VIEW(special_characters_tree), column);
gtk_tree_view_append_column(GTK_TREE_VIEW(sc_tree), column);
swin = gtk_scrolled_window_new(NULL, NULL);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(swin), GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_add_with_viewport(
GTK_SCROLLED_WINDOW(swin), GTK_WIDGET(special_characters_tree));
GTK_SCROLLED_WINDOW(swin), GTK_WIDGET(sc_tree));
gtk_box_pack_start(GTK_BOX(vbox), swin, TRUE, TRUE, 0);
g_signal_connect((gpointer) special_characters_tree, "row-activated",
G_CALLBACK(on_special_characters_tree_row_activated), NULL);
g_signal_connect((gpointer) sc_tree, "row-activated",
G_CALLBACK(sc_on_tree_row_activated), NULL);
g_signal_connect((gpointer) special_characters_dialog, "response",
G_CALLBACK(on_tools_show_dialog_insert_special_chars_response), NULL);
g_signal_connect((gpointer) sc_dialog, "response",
G_CALLBACK(sc_on_tools_show_dialog_insert_special_chars_response), NULL);
special_characters_fill_store(special_characters_store);
sc_fill_store(sc_store);
//gtk_tree_view_expand_all(special_characters_tree);
gtk_tree_view_set_search_column(special_characters_tree, COLUMN_HTML_NAME);
gtk_tree_view_set_search_column(sc_tree, COLUMN_HTML_NAME);
}
gtk_widget_show_all(special_characters_dialog);
gtk_widget_show_all(sc_dialog);
}
// fill the tree model with data
/// TODO move this in a file and make it extendable for more data types
static void special_characters_fill_store(GtkTreeStore *store)
static void sc_fill_store(GtkTreeStore *store)
{
GtkTreeIter iter;
GtkTreeIter *parent_iter = NULL;
@ -411,7 +426,7 @@ static void special_characters_fill_store(GtkTreeStore *store)
/* just inserts the HTML_NAME coloumn of the selected row at current position
* returns only TRUE if a valid selection(i.e. no category) could be found */
static gboolean special_characters_insert(GtkTreeModel *model, GtkTreeIter *iter)
static gboolean sc_insert(GtkTreeModel *model, GtkTreeIter *iter)
{
gint idx = document_get_cur_idx();
gboolean result = FALSE;
@ -433,7 +448,7 @@ static gboolean special_characters_insert(GtkTreeModel *model, GtkTreeIter *iter
}
static void on_tools_show_dialog_insert_special_chars_response(GtkDialog *dialog, gint response,
static void sc_on_tools_show_dialog_insert_special_chars_response(GtkDialog *dialog, gint response,
gpointer user_data)
{
if (response == GTK_RESPONSE_OK)
@ -442,12 +457,12 @@ static void on_tools_show_dialog_insert_special_chars_response(GtkDialog *dialog
GtkTreeModel *model;
GtkTreeIter iter;
selection = gtk_tree_view_get_selection(special_characters_tree);
selection = gtk_tree_view_get_selection(sc_tree);
if (gtk_tree_selection_get_selected(selection, &model, &iter))
{
// only hide dialog if selection was not a category
if (special_characters_insert(model, &iter))
if (sc_insert(model, &iter))
gtk_widget_hide(GTK_WIDGET(dialog));
}
}
@ -456,23 +471,404 @@ static void on_tools_show_dialog_insert_special_chars_response(GtkDialog *dialog
}
static void on_special_characters_tree_row_activated(GtkTreeView *treeview, GtkTreePath *path,
static void sc_on_tree_row_activated(GtkTreeView *treeview, GtkTreePath *path,
GtkTreeViewColumn *col, gpointer user_data)
{
GtkTreeIter iter;
GtkTreeModel *model = GTK_TREE_MODEL(special_characters_store);
GtkTreeModel *model = GTK_TREE_MODEL(sc_store);
if (gtk_tree_model_get_iter(model, &iter, path))
{
// only hide dialog if selection was not a category
if (special_characters_insert(model, &iter))
gtk_widget_hide(special_characters_dialog);
if (sc_insert(model, &iter))
gtk_widget_hide(sc_dialog);
else
{ // double click on a category to toggle the expand or collapse it
if (gtk_tree_view_row_expanded(special_characters_tree, path))
gtk_tree_view_collapse_row(special_characters_tree, path);
if (gtk_tree_view_row_expanded(sc_tree, path))
gtk_tree_view_collapse_row(sc_tree, path);
else
gtk_tree_view_expand_row(special_characters_tree, path, FALSE);
gtk_tree_view_expand_row(sc_tree, path, FALSE);
}
}
}
/* custom commands code*/
struct cc_dialog
{
gint count;
GtkWidget *box;
};
static void cc_add_command(struct cc_dialog *cc, gint index)
{
GtkWidget *label, *entry, *hbox;
gchar str[6];
hbox = gtk_hbox_new(FALSE, 5);
g_snprintf(str, 5, "%d:", cc->count);
label = gtk_label_new(str);
entry = gtk_entry_new();
if (index >= 0)
gtk_entry_set_text(GTK_ENTRY(entry), app->custom_commands[index]);
gtk_entry_set_max_length(GTK_ENTRY(entry), 255);
gtk_entry_set_width_chars(GTK_ENTRY(entry), 30);
gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(hbox), entry, TRUE, TRUE, 0);
gtk_widget_show_all(hbox);
gtk_container_add(GTK_CONTAINER(cc->box), hbox);
cc->count++;
}
static void cc_on_custom_commands_dlg_add_clicked(GtkToolButton *toolbutton, struct cc_dialog *cc)
{
cc_add_command(cc, -1);
}
static gboolean cc_iofunc(GIOChannel *ioc, GIOCondition cond, gpointer data)
{
if (cond & (G_IO_IN | G_IO_PRI))
{
gint idx = GPOINTER_TO_INT(data);
gchar *msg = NULL;
GString *str = g_string_sized_new(256);
while (g_io_channel_read_line(ioc, &msg, NULL, NULL, NULL) && msg != NULL)
{
g_string_append(str, msg);
g_free(msg);
}
/// without the following if we replace the selection several hundred times with "" because
/// we get to often in this callback but I don't know why
if (str->len > 0)
{
sci_replace_sel(doc_list[idx].sci, str->str);
}
g_string_free(str, TRUE);
return TRUE;
}
return FALSE;
}
static gboolean cc_iofunc_err(GIOChannel *ioc, GIOCondition cond, gpointer data)
{
if (cond & (G_IO_IN | G_IO_PRI))
{
gchar *msg = NULL;
while (g_io_channel_read_line(ioc, &msg, NULL, NULL, NULL) && msg != NULL)
{
g_warning("%s: %s", (const gchar*) data, g_strstrip(msg));
g_free(msg);
}
return TRUE;
}
return FALSE;
}
/* Executes command (which should include all necessary command line args) and passes the current
* selection through the standard input of command. The whole output of command replaces the
* current selection. */
void tools_execute_custom_command(gint idx, const gchar *command)
{
GError *error = NULL;
GPid pid;
gchar **argv;
gint stdin_fd;
gint stdout_fd;
gint stderr_fd;
g_return_if_fail(DOC_IDX_VALID(idx) && command != NULL);
if (! sci_can_copy(doc_list[idx].sci))
return;
argv = g_strsplit(command, " ", -1);
msgwin_status_add(_("Passing data and executing custom command: %s"), command);
if (g_spawn_async_with_pipes(NULL, argv, NULL, G_SPAWN_SEARCH_PATH,
NULL, NULL, &pid, &stdin_fd, &stdout_fd, &stderr_fd, &error))
{
gchar *sel;
gint len;
// use GIOChannel to monitor stdout
/// TODO there is something wrong with the whole channel code because the callback is
/// called about several hundred times
utils_set_up_io_channel(stdout_fd, G_IO_IN|G_IO_PRI|G_IO_ERR|G_IO_HUP|G_IO_NVAL,
cc_iofunc, GINT_TO_POINTER(idx));
// copy program's stderr to Geany's stdout to help error tracking
utils_set_up_io_channel(stderr_fd, G_IO_IN|G_IO_PRI|G_IO_ERR|G_IO_HUP|G_IO_NVAL,
cc_iofunc_err, (gpointer)command);
// get selection
len = sci_get_selected_text_length(doc_list[idx].sci);
sel = g_malloc0(len);
sci_get_selected_text(doc_list[idx].sci, sel);
// write data to the command
write(stdin_fd, sel, len - 1);
close(stdin_fd);
g_free(sel);
}
else
{
geany_debug("g_spawn_async_with_pipes() failed: %s", error->message);
g_error_free(error);
}
g_strfreev(argv);
}
static void cc_show_dialog_custom_commands()
{
GtkWidget *dialog, *label, *vbox, *button;
gint i;
struct cc_dialog cc;
dialog = gtk_dialog_new_with_buttons(_("Set Custom Commands"), GTK_WINDOW(app->window),
GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL);
vbox = ui_dialog_vbox_new(GTK_DIALOG(dialog));
gtk_box_set_spacing(GTK_BOX(vbox), 6);
label = gtk_label_new(_("You can send the current selection to any of these commands and the output of the command replaces the current selection."));
gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
gtk_container_add(GTK_CONTAINER(vbox), label);
cc.count = 1;
cc.box = gtk_vbox_new(FALSE, 0);
gtk_container_add(GTK_CONTAINER(vbox), cc.box);
if (app->custom_commands == NULL || g_strv_length(app->custom_commands) == 0)
{
cc_add_command(&cc, -1);
}
else
{
for (i = 0; i < g_strv_length(app->custom_commands); i++)
{
if (app->custom_commands[i][0] == '\0')
continue; // skip empty fields
cc_add_command(&cc, i);
}
}
button = gtk_button_new_from_stock("gtk-add");
g_signal_connect((gpointer) button, "clicked",
G_CALLBACK(cc_on_custom_commands_dlg_add_clicked), &cc);
gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0);
gtk_widget_show_all(vbox);
if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT)
{
// get all hboxes which contain a label and an entry element
GList *children = gtk_container_get_children(GTK_CONTAINER(cc.box));
GList *tmp;
GSList *result_list = NULL;
gint i = 0;
gint len = 0;
gchar **result;
const gchar *text;
while (children != NULL)
{
// get the contents of each hbox
tmp = gtk_container_get_children(GTK_CONTAINER(children->data));
// first element of the list is the label, so skip it and get the entry element
tmp = tmp->next;
text = gtk_entry_get_text(GTK_ENTRY(tmp->data));
// if the content of the entry is non-empty, add it to the result array
if (text[0] != '\0')
{
result_list = g_slist_append(result_list, g_strdup(text));
len++;
}
children = children->next;
}
// create a new null-terminated array
result = g_new(gchar*, len + 1);
while (result_list != NULL)
{
result[i] = (gchar*) result_list->data;
result_list = result_list->next;
i++;
}
g_slist_free(result_list);
g_list_free(children);
result[len] = NULL; // null-terminate the array
g_strfreev(app->custom_commands);
app->custom_commands = result;
tools_create_insert_custom_command_menu_items();
}
gtk_widget_destroy(dialog);
}
/* enable or disable all custom command menu items when the sub menu is opened */
static void cc_on_custom_command_menu_activate(GtkMenuItem *menuitem, gpointer user_data)
{
gint idx = document_get_cur_idx();
gint i, len;
gboolean enable;
GList *children;
if (! DOC_IDX_VALID(idx)) return;
enable = sci_can_copy(doc_list[idx].sci);
children = gtk_container_get_children(GTK_CONTAINER(user_data));
len = g_list_length(children);
i = 0;
while (children != NULL)
{
if (i == (len - 2))
break; // stop before the last two elements (the seperator and the set entry)
gtk_widget_set_sensitive(GTK_WIDGET(children->data), enable);
children = children->next;
i++;
}
}
static void cc_on_custom_command_activate(GtkMenuItem *menuitem, gpointer user_data)
{
gint idx = document_get_cur_idx();
gint command_idx;
if (! DOC_IDX_VALID(idx)) return;
command_idx = GPOINTER_TO_INT(user_data);
if (app->custom_commands == NULL ||
command_idx < 0 || command_idx > g_strv_length(app->custom_commands))
{
cc_show_dialog_custom_commands();
return;
}
// send it through the command and when the command returned the output the current selection
// will be replaced
tools_execute_custom_command(idx, app->custom_commands[command_idx]);
}
static void cc_insert_custom_command_items(GtkMenu *me, GtkMenu *mp, gchar *label, gint idx)
{
GtkWidget *item;
gint key_idx = -1;
switch (idx)
{
case 0: key_idx = GEANY_KEYS_EDIT_SENDTOCMD1; break;
case 1: key_idx = GEANY_KEYS_EDIT_SENDTOCMD2; break;
case 2: key_idx = GEANY_KEYS_EDIT_SENDTOCMD3; break;
}
item = gtk_menu_item_new_with_label(label);
if (key_idx != -1)
gtk_widget_add_accelerator(item, "activate", gtk_accel_group_new(),
keys[key_idx]->key, keys[key_idx]->mods, GTK_ACCEL_VISIBLE);
gtk_container_add(GTK_CONTAINER(me), item);
gtk_widget_show(item);
g_signal_connect((gpointer) item, "activate", G_CALLBACK(cc_on_custom_command_activate),
GINT_TO_POINTER(idx));
item = gtk_menu_item_new_with_label(label);
if (key_idx != -1)
gtk_widget_add_accelerator(item, "activate", gtk_accel_group_new(),
keys[key_idx]->key, keys[key_idx]->mods, GTK_ACCEL_VISIBLE);
gtk_container_add(GTK_CONTAINER(mp), item);
gtk_widget_show(item);
g_signal_connect((gpointer) item, "activate", G_CALLBACK(cc_on_custom_command_activate),
GINT_TO_POINTER(idx));
}
void tools_create_insert_custom_command_menu_items()
{
GtkMenu *menu_edit = GTK_MENU(lookup_widget(app->window, "send_selection_to2_menu"));
GtkMenu *menu_popup = GTK_MENU(lookup_widget(app->popup_menu, "send_selection_to1_menu"));
GtkWidget *item;
GList *me_children;
GList *mp_children;
static gboolean signal_set = FALSE;
// first clean the menus to be able to rebuild them
me_children = gtk_container_get_children(GTK_CONTAINER(menu_edit));
mp_children = gtk_container_get_children(GTK_CONTAINER(menu_popup));
while (me_children != NULL)
{
gtk_widget_destroy(GTK_WIDGET(me_children->data));
gtk_widget_destroy(GTK_WIDGET(mp_children->data));
me_children = me_children->next;
mp_children = mp_children->next;
}
if (app->custom_commands == NULL || g_strv_length(app->custom_commands) == 0)
{
item = gtk_menu_item_new_with_label(_("No custom commands defined."));
gtk_container_add(GTK_CONTAINER(menu_edit), item);
gtk_widget_set_sensitive(item, FALSE);
gtk_widget_show(item);
item = gtk_menu_item_new_with_label(_("No custom commands defined."));
gtk_container_add(GTK_CONTAINER(menu_popup), item);
gtk_widget_set_sensitive(item, FALSE);
gtk_widget_show(item);
}
else
{
gint i;
gint idx = 0;
for (i = 0; i < g_strv_length(app->custom_commands); i++)
{
if (app->custom_commands[i][0] != '\0') // skip empty fields
{
cc_insert_custom_command_items(menu_edit, menu_popup, app->custom_commands[i], idx);
idx++;
}
}
}
// separator and Set menu item
item = gtk_separator_menu_item_new();
gtk_container_add(GTK_CONTAINER(menu_edit), item);
gtk_widget_show(item);
item = gtk_separator_menu_item_new();
gtk_container_add(GTK_CONTAINER(menu_popup), item);
gtk_widget_show(item);
cc_insert_custom_command_items(menu_edit, menu_popup, _("Set Custom Commands"), -1);
if (! signal_set)
{
g_signal_connect((gpointer) lookup_widget(app->popup_menu, "send_selection_to1"),
"activate", G_CALLBACK(cc_on_custom_command_menu_activate), menu_popup);
g_signal_connect((gpointer) lookup_widget(app->window, "send_selection_to2"),
"activate", G_CALLBACK(cc_on_custom_command_menu_activate), menu_edit);
signal_set = TRUE;
}
}

View File

@ -27,4 +27,8 @@
void tools_show_dialog_insert_special_chars();
void tools_create_insert_custom_command_menu_items();
void tools_execute_custom_command(gint idx, const gchar *command);
#endif