diff options
Diffstat (limited to 'src/fe-gtk/menu.c')
-rw-r--r-- | src/fe-gtk/menu.c | 84 |
1 files changed, 78 insertions, 6 deletions
diff --git a/src/fe-gtk/menu.c b/src/fe-gtk/menu.c index d04be222..4760ba93 100644 --- a/src/fe-gtk/menu.c +++ b/src/fe-gtk/menu.c @@ -20,10 +20,11 @@ #include <stdlib.h> #include <fcntl.h> #include <string.h> -#include <unistd.h> #ifdef WIN32 #include <windows.h> +#else +#include <unistd.h> #endif #include "fe-gtk.h" @@ -1122,6 +1123,23 @@ usermenu_update (void) } } +#if 0 +static void +menu_saveconf (void) +{ + session *sess = current_sess; + + if (save_config ()) + { + PrintText (sess, "Settings have been saved successfully.\n"); + } + else + { + PrintText (sess, "Error saving settings.\n"); + } +} +#endif + static void menu_newserver_window (GtkWidget * wid, gpointer none) { @@ -1198,12 +1216,53 @@ menu_search () } static void +menu_search_next () +{ + GtkXText *xtext = GTK_XTEXT (current_sess->gui->xtext); + xtext_buffer *buf = xtext->buffer; + + if (!gtk_xtext_search (xtext, buf->search_text, + (buf->search_flags & (case_match | follow | regexp)), NULL)) + { + fe_message (_("Search hit end, not found."), FE_MSG_ERROR); + } +} + +static void +menu_search_prev () +{ + GtkXText *xtext = GTK_XTEXT (current_sess->gui->xtext); + xtext_buffer *buf = xtext->buffer; + + if (!gtk_xtext_search(xtext, buf->search_text, + (buf->search_flags & (case_match | follow | regexp) | backward), NULL)) + { + fe_message (_("Search hit end, not found."), FE_MSG_ERROR); + } +} + +static void +menu_search_reset () +{ + GtkXText *xtext = GTK_XTEXT (current_sess->gui->xtext); + xtext_buffer *buf = xtext->buffer; + + gtk_xtext_search (xtext, "", 0, NULL); +} + +static void menu_resetmarker (GtkWidget * wid, gpointer none) { gtk_xtext_reset_marker_pos (GTK_XTEXT (current_sess->gui->xtext)); } static void +menu_copy_selection (GtkWidget * wid, gpointer none) +{ + gtk_xtext_copy_selection (GTK_XTEXT (current_sess->gui->xtext)); +} + +static void menu_flushbuffer (GtkWidget * wid, gpointer none) { fe_text_clear (current_sess, 0); @@ -1580,7 +1639,7 @@ static struct mymenu mymenu[] = { #endif {0, 0, 0, M_SEP, 0, 0, 0}, /* 11 */ #define DETACH_OFFSET (12) - {0, menu_detach, GTK_STOCK_REDO, M_MENUSTOCK, 0, 0, 1, GDK_I}, /* 12 */ + {0, menu_detach, GTK_STOCK_REDO, M_MENUSTOCK, 0, 0, 1, GDK_i}, /* 12 */ #define CLOSE_OFFSET (13) {0, menu_close, GTK_STOCK_CLOSE, M_MENUSTOCK, 0, 0, 1, GDK_w}, {0, 0, 0, M_SEP, 0, 0, 0}, @@ -1633,6 +1692,10 @@ static struct mymenu mymenu[] = { {N_("Userlist Popup..."), menu_ulpopup, 0, M_MENUITEM, 0, 0, 1}, {0, 0, 0, M_END, 0, 0, 0}, /* 53 */ +#if 0 + {N_("Save Settings to Disk"), menu_saveconf, GTK_STOCK_SAVE, M_MENUSTOCK, 0, 0, 1}, /* don't use this, a /set auto-save approach will be added instead */ +#endif + {N_("_Window"), 0, 0, M_NEWMENU, 0, 0, 1}, {N_("Ban List..."), menu_banlist, 0, M_MENUITEM, 0, 0, 1}, {N_("Character Chart..."), ascii_open, 0, M_MENUITEM, 0, 0, 1}, @@ -1645,12 +1708,19 @@ static struct mymenu mymenu[] = { {N_("URL Grabber..."), url_opengui, 0, M_MENUITEM, 0, 0, 1}, {0, 0, 0, M_SEP, 0, 0, 0}, {N_("Reset Marker Line"), menu_resetmarker, 0, M_MENUITEM, 0, 0, 1, GDK_m}, + {N_("_Copy Selection"), menu_copy_selection, 0, M_MENUITEM, 0, 0, 1, GDK_C}, {N_("C_lear Text"), menu_flushbuffer, GTK_STOCK_CLEAR, M_MENUSTOCK, 0, 0, 1, GDK_l}, -#define SEARCH_OFFSET 67 - {N_("Search Text..."), menu_search, GTK_STOCK_FIND, M_MENUSTOCK, 0, 0, 1, GDK_f}, {N_("Save Text..."), menu_savebuffer, GTK_STOCK_SAVE, M_MENUSTOCK, 0, 0, 1}, +#define SEARCH_OFFSET 70 + {N_("Search"), 0, GTK_STOCK_JUSTIFY_LEFT, M_MENUSUB, 0, 0, 1}, + {N_("Search Text..."), menu_search, GTK_STOCK_FIND, M_MENUSTOCK, 0, 0, 1, GDK_f}, + {N_("Reset Search"), menu_search_reset, GTK_STOCK_FIND, M_MENUSTOCK, 0, 0, 1, GDK_F}, + {N_("Search Next" ), menu_search_next, GTK_STOCK_FIND, M_MENUSTOCK, 0, 0, 1, GDK_g}, + {N_("Search Previous" ), menu_search_prev, GTK_STOCK_FIND, M_MENUSTOCK, 0, 0, 1, GDK_G}, + {0, 0, 0, M_END, 0, 0, 0}, + + {N_("_Help"), 0, 0, M_NEWMENU, 0, 0, 1}, /* 74 */ - {N_("_Help"), 0, 0, M_NEWMENU, 0, 0, 1}, /* 69 */ {N_("_Contents"), menu_docs, GTK_STOCK_HELP, M_MENUSTOCK, 0, 0, 1, GDK_F1}, #if 0 {N_("Check for updates"), menu_update, 0, M_MENUITEM, 0, 1}, @@ -2188,7 +2258,9 @@ normalitem: mymenu[i].key, mymenu[i].key == GDK_F1 ? 0 : mymenu[i].key == GDK_w ? close_mask : - GDK_CONTROL_MASK, + (g_ascii_isupper (mymenu[i].key)) ? + GDK_SHIFT_MASK | GDK_CONTROL_MASK : + GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); if (mymenu[i].callback) g_signal_connect (G_OBJECT (item), "activate", |