📄 menu.c
字号:
menu_autorejoin, 0, 0, 0, 0, 0, 0, 0}, { GNOME_APP_UI_TOGGLEITEM, N_("Auto ReConnect to Server"), 0, menu_autoreconnect, 0, 0, 0, 0, 0, 0, 0}, { GNOME_APP_UI_TOGGLEITEM, N_("Never-give-up ReConnect"), 0, menu_autoreconnectonfail, 0, 0, 0, 0, 0, 0, 0}, GNOMEUIINFO_SEPARATOR, { GNOME_APP_UI_TOGGLEITEM, N_("Auto Open Dialog Windows"), 0, menu_autodialog, 0, 0, 0, 0, 0, 0, 0}, { GNOME_APP_UI_TOGGLEITEM, N_("Auto Accept DCC Chat"), 0, menu_autodccchat, 0, 0, 0, 0, 0, 0, 0}, { GNOME_APP_UI_TOGGLEITEM, N_("Auto Accept DCC Send"), 0, menu_autodccsend, 0, 0, 0, 0, 0, 0, 0}, GNOMEUIINFO_END};static GnomeUIInfo settingsmenu[] = { { GNOME_APP_UI_ITEM, N_("Setup.."), 0, menu_settings, 0, 0, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_PREF, 0, 0, 0}, { GNOME_APP_UI_ITEM, N_("Palette.."), 0, palette_edit, 0, 0, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_PIXMAP_COLORSELECTOR, 0, 0, 0}, { GNOME_APP_UI_ITEM, N_("User Commands.."), 0, menu_usercommands, 0, 0, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_EXEC, 0, 0, 0}, { GNOME_APP_UI_ITEM, N_("CTCP Replies.."), 0, menu_ctcpguiopen, 0, 0, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_REFRESH, 0, 0, 0}, { GNOME_APP_UI_ITEM, N_("Userlist Buttons.."), 0, menu_ulbuttons, 0, 0, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_STOP, 0, 0, 0}, { GNOME_APP_UI_ITEM, N_("Userlist Popup.."), 0, menu_ulpopup, 0, 0, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_INDEX, 0, 0, 0}, { GNOME_APP_UI_ITEM, N_("Dialog Buttons.."), 0, menu_dlgbuttons, 0, 0, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_STOP, 0, 0, 0}, { GNOME_APP_UI_ITEM, N_("Replace Popup.."), 0, menu_rpopup, 0, 0, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_ALIGN_LEFT, 0, 0, 0}, { GNOME_APP_UI_ITEM, N_("URL Handlers.."), 0, menu_urlhandlers, 0, 0, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_HOME, 0, 0, 0}, { GNOME_APP_UI_ITEM, N_("Edit Event Texts.."), 0, menu_evtpopup, 0, 0, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_ALIGN_JUSTIFY, 0, 0, 0}, { GNOME_APP_UI_ITEM, N_("Edit Key Bindings.."), 0, menu_keypopup, 0, 0, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_FONT, 0, 0, 0}, GNOMEUIINFO_SEPARATOR, { GNOME_APP_UI_ITEM, N_("Reload Settings"), 0, menu_reload, 0, 0, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_REVERT, 0, 0, 0}, GNOMEUIINFO_SEPARATOR, { GNOME_APP_UI_ITEM, N_("Save Settings now"), 0, menu_savedefault, 0, 0, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_SAVE, 0, 0, 0}, { GNOME_APP_UI_TOGGLEITEM, N_("Save Settings on exit"), 0, menu_saveexit, 0, 0, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_SAVE, 0, 0, 0}, GNOMEUIINFO_END};static GnomeUIInfo helpmenu[] = { { GNOME_APP_UI_ITEM, N_("X-Chat Homepage.."), 0, menu_webpage, 0, 0, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_HOME, 0, 0, 0}, { GNOME_APP_UI_ITEM, N_("Online Docs.."), 0, menu_docs, 0, 0, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_BOOK_OPEN, 0, 0, 0}, GNOMEUIINFO_SEPARATOR, { GNOME_APP_UI_ITEM, N_("About X-Chat.."), 0, menu_about, 0, 0, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_ABOUT, 0, 0, 0}, GNOMEUIINFO_END};static GnomeUIInfo loadmenu[] = { { GNOME_APP_UI_ITEM, N_("Perl Script.."), 0, menu_loadperl, 0, 0, 0, 0, 0, 0, 0}, { GNOME_APP_UI_ITEM, N_("Python Script.."), 0, menu_loadpython, 0, 0, 0, 0, 0, 0, 0}, { GNOME_APP_UI_ITEM, N_("Plugin.."), 0, menu_loadplugin, 0, 0, 0, 0, 0, 0, 0}, GNOMEUIINFO_END};static GnomeUIInfo infomenu[] = { { GNOME_APP_UI_ITEM, N_("Perl List"), 0, menu_perllist, 0, 0, 0, 0, 0, 0, 0}, { GNOME_APP_UI_ITEM, N_("Python List"), 0, menu_pythonlist, 0, 0, 0, 0, 0, 0, 0}, { GNOME_APP_UI_ITEM, N_("Plugin List"), 0, menu_pluginlist, 0, 0, 0, 0, 0, 0, 0}, GNOMEUIINFO_END};static GnomeUIInfo killmenu[] = { { GNOME_APP_UI_ITEM, N_("All Perl Scripts"), 0, menu_unloadall, 0, 0, 0, 0, 0, 0, 0}, { GNOME_APP_UI_ITEM, N_("All Python Scripts"), 0, 0, 0, 0, 0, 0, 0, 0, 0}, { GNOME_APP_UI_ITEM, N_("All Plugins"), 0, menu_unloadallplugins, 0, 0, 0, 0, 0, 0, 0}, GNOMEUIINFO_END};static GnomeUIInfo scriptsmenu[] = { GNOMEUIINFO_SUBTREE_STOCK (N_("Load"), loadmenu, GNOME_STOCK_MENU_SAVE), GNOMEUIINFO_SUBTREE_STOCK (N_("Info"), infomenu, GNOME_STOCK_MENU_BOOK_GREEN), GNOMEUIINFO_SUBTREE_STOCK (N_("Kill"), killmenu, GNOME_STOCK_MENU_CLOSE), GNOMEUIINFO_END};static GnomeUIInfo usermenu[] = { { GNOME_APP_UI_ITEM, N_("Edit User Menu.."), 0, menu_usermenu, 0, 0, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_PREF, 0, 0, 0}, GNOMEUIINFO_SEPARATOR, GNOMEUIINFO_END};static GnomeUIInfo mainmenu[] = { GNOMEUIINFO_SUBTREE (N_("_X-Chat"), xchatmenu), GNOMEUIINFO_SUBTREE (N_("_Windows"), windowsmenu), GNOMEUIINFO_SUBTREE (N_("User _Modes"), usermodesmenu), GNOMEUIINFO_SUBTREE (N_("_Settings"), settingsmenu), GNOMEUIINFO_SUBTREE (N_("S_cripts & Plugins"), scriptsmenu), GNOMEUIINFO_SUBTREE (N_("Use_r Menu"), usermenu), GNOMEUIINFO_SUBTREE (N_("_Help"), helpmenu), GNOMEUIINFO_END};GtkWidget *createmenus (void *app, struct session *sess, int bar){ GtkWidget *menu; if (!menu_sess) menu_sess = sess; if (bar) { gnome_app_create_menus (GNOME_APP (app), mainmenu); menu = GNOME_APP (app)->menubar; gtk_menu_item_right_justify (GTK_MENU_ITEM (mainmenu[6].widget)); } else { menu = gnome_popup_menu_new (mainmenu); } /* is it legal to poke in the initial values?? */ ((GtkCheckMenuItem *) (usermodesmenu[0].widget))->active = prefs.invisible; ((GtkCheckMenuItem *) (usermodesmenu[1].widget))->active = prefs.wallops; ((GtkCheckMenuItem *) (usermodesmenu[2].widget))->active = prefs.servernotice; ((GtkCheckMenuItem *) (usermodesmenu[4].widget))->active = sess->server->is_away; ((GtkCheckMenuItem *) (usermodesmenu[6].widget))->active = prefs.autorejoin; ((GtkCheckMenuItem *) (usermodesmenu[7].widget))->active = prefs.autoreconnect; ((GtkCheckMenuItem *) (usermodesmenu[8].widget))->active = prefs.autoreconnectonfail; ((GtkCheckMenuItem *) (usermodesmenu[10].widget))->active = prefs.autodialog; ((GtkCheckMenuItem *) (usermodesmenu[11].widget))->active = prefs.autodccchat; ((GtkCheckMenuItem *) (usermodesmenu[12].widget))->active = prefs.autodccsend; ((GtkCheckMenuItem *) (settingsmenu[15].widget))->active = prefs.autosave;#ifndef USE_PERL gtk_widget_set_sensitive (loadmenu[0].widget, FALSE); gtk_widget_set_sensitive (infomenu[0].widget, FALSE); gtk_widget_set_sensitive (killmenu[0].widget, FALSE);#endif#ifndef USE_PYTHON gtk_widget_set_sensitive (loadmenu[1].widget, FALSE); gtk_widget_set_sensitive (infomenu[1].widget, FALSE);#endif gtk_widget_set_sensitive (killmenu[1].widget, FALSE); /* unimplemented */#ifndef USE_PLUGIN gtk_widget_set_sensitive (loadmenu[2].widget, FALSE); gtk_widget_set_sensitive (infomenu[2].widget, FALSE); gtk_widget_set_sensitive (killmenu[2].widget, FALSE);#endif#ifndef USE_ZVT gtk_widget_set_sensitive (xchatmenu[7].widget, FALSE);#endif if (bar) /* popup menus can't alter sess->gui, only a menubar! */ { sess->gui->usermenu = GTK_MENU_ITEM (mainmenu[5].widget)->submenu; sess->gui->awaymenuitem = usermodesmenu[4].widget; } usermenu_create (GTK_MENU_ITEM (mainmenu[5].widget)->submenu); return menu;}#elsestatic struct mymenu mymenu[] = { {M_NEWMENU, N_("X-Chat"), 0, 0, 1}, {M_MENU, N_("Server List.."), (menucallback) menu_open_server_list, 0, 1}, {M_SEP, 0, 0, 0, 0}, {M_MENU, N_("New Server Tab.."), (menucallback) menu_newserver_tab, 0, 1}, {M_MENU, N_("New Server Window.."), (menucallback) menu_newserver_window, 0, 1}, {M_MENU, N_("New Channel Tab.."), (menucallback) menu_newchannel_tab, 0, 1}, {M_MENU, N_("New Channel Window.."), (menucallback) menu_newchannel_window, 0, 1}, {M_SEP, 0, 0, 0, 0},#ifdef USE_ZVT {M_MENU, N_("New Shell Tab.."), (menucallback) menu_newshell_tab, 0, 1}, {M_SEP, 0, 0, 0, 0},#define menuoffset 0#else#define menuoffset 2#endif {M_MENU, N_("Close"), (menucallback) menu_close, 0, 1}, {M_SEP, 0, 0, 0, 0}, {M_MENU, N_("Quit"), (menucallback) xchat_exit, 0, 1}, /* 12 */ {M_NEWMENU, N_("Windows"), 0, 0, 1}, {M_MENU, N_("Channel List Window.."), (menucallback) menu_chanlist, 0, 1}, {M_MENU, N_("File Send Window.."), (menucallback) menu_dcc_send_win, 0, 1}, {M_MENU, N_("File Receive Window.."), (menucallback) menu_dcc_recv_win, 0, 1}, {M_MENU, N_("DCC Chat Window.."), (menucallback) menu_dcc_chat_win, 0, 1}, {M_MENU, N_("Raw Log Window.."), (menucallback) menu_rawlog, 0, 1}, {M_MENU, N_("URL Grabber Window.."), (menucallback) url_opengui, 0, 1}, {M_MENU, N_("Notify List Window.."), (menucallback) notify_opengui, 0, 1}, {M_MENU, N_("Ignore Window.."), (menucallback) ignore_gui_open, 0, 1}, {M_MENU, N_("Ban List Window.."), (menucallback) menu_banlist, 0, 1}, {M_SEP, 0, 0, 0, 0}, {M_MENU, N_("Flush Buffer"), (menucallback) menu_flushbuffer, 0, 1}, {M_MENU, N_("Search Buffer.."), (menucallback) menu_search, 0, 1}, {M_MENU, N_("Save Buffer.."), (menucallback) menu_savebuffer, 0, 1}, /* 26 */ {M_NEWMENU, N_("User Modes"), 0, 0, 1}, {M_MENUTOG, N_("Invisible"), (menucallback) menu_invisible, 1, 1}, {M_MENUTOG, N_("Receive Wallops"), (menucallback) menu_wallops, 1, 1}, {M_MENUTOG, N_("Receive Server Notices"), (menucallback) menu_servernotice, 1, 1}, {M_SEP, 0, 0, 0, 0}, {M_MENUTOG, N_("Marked Away"), (menucallback) menu_away, 0, 1}, {M_SEP, 0, 0, 0, 0}, /* 33 */ {M_MENUTOG, N_("Auto ReJoin on Kick"), (menucallback) menu_autorejoin, 0, 1}, {M_MENUTOG, N_("Auto ReConnect to Server"), (menucallback) menu_autoreconnect, 0, 1}, {M_MENUTOG, N_("Never-give-up ReConnect"), (menucallback) menu_autoreconnectonfail, 0, 1}, {M_SEP, 0, 0, 0, 0}, /* 37 */ {M_MENUTOG, N_("Auto Open Dialog Windows"), (menucallback) menu_autodialog, 0, 1}, {M_MENUTOG, N_("Auto Accept DCC Chat"), (menucallback) menu_autodccchat, 0, 1}, {M_MENUTOG, N_("Auto Accept DCC Send"), (menucallback) menu_autodccsend, 0, 1}, {M_NEWMENU, N_("Settings"), 0, 0, 1}, /* 41 */ {M_MENU, N_("Setup.."), (menucallback) menu_settings, 0, 1}, {M_MENU, N_("Palette.."), (menucallback) palette_edit, 0, 1}, {M_MENU, N_("User Commands.."), (menucallback) menu_usercommands, 0, 1}, {M_MENU, N_("CTCP Replies.."), (menucallback) menu_ctcpguiopen, 0, 1}, {M_MENU, N_("Userlist Buttons.."), (menucallback) menu_ulbuttons, 0, 1}, {M_MENU, N_("Userlist Popup.."), (menucallback) menu_ulpopup, 0, 1}, {M_MENU, N_("Dialog Buttons.."), (menucallback) menu_dlgbuttons, 0, 1}, {M_MENU, N_("Replace.."), (menucallback) menu_rpopup, 0, 1}, {M_MENU, N_("URL Handlers.."), (menucallback) menu_urlhandlers, 0, 1}, {M_MENU, N_("Edit Event Texts.."), (menucallback) menu_evtpopup, 0, 1}, /* 51 */ {M_MENU, N_("Edit Key Bindings.."), (menucallback) menu_keypopup, 0, 1}, {M_SEP, 0, 0, 0, 0}, {M_MENU, N_("Reload Settings"), (menucallback) menu_reload, 0, 1}, {M_SEP, 0, 0, 0, 0}, {M_MENU, N_("Save Settings now"), (menucallback) menu_savedefault, 0, 1}, {M_MENUTOG, N_("Save Settings on exit"), (menucallback) menu_saveexit, 1, 1}, {M_NEWMENU, N_("Scripts & Plugins"), 0, 0, 1}, /* 58 */#ifdef USE_PERL {M_MENU, N_("Load Perl Script.."), (menucallback) menu_loadperl, 0, 1}, {M_MENU, N_("Unload All Scripts"), (menucallback) menu_unloadall, 0, 1}, {M_MENU, N_("Perl List"), (menucallback) menu_perllist, 0, 1},#else {M_MENU, N_("Load Perl Script.."), 0, 0, 0}, {M_MENU, N_("Unload All Scripts"), 0, 0, 0}, {M_MENU, N_("Perl List"), 0, 0, 0},#endif {M_SEP, 0, 0, 0, 0},#ifdef USE_PLUGIN {M_MENU, N_("Load Plugin (*.so).."), (menucallback) menu_loadplugin, 0, 1}, {M_MENU, N_("Unload All Plugins"), (menucallback) menu_unloadallplugins, 0, 1}, {M_MENU, N_("Plugin List"), (menucallback) menu_pluginlist, 0, 1},#else {M_MENU, N_("Load Plugin (*.so).."), 0, 0, 0}, {M_MENU, N_("Unload All Plugins"), 0, 0, 0}, {M_MENU, N_("Plugin List"), 0, 0, 0},#endif {M_SEP, 0, 0, 0, 0},#ifdef USE_PYTHON {M_MENU, N_("Load Python Script.."), (menucallback) menu_loadpython, 0, 1}, {M_MENU, N_("Python List"), (menucallback) menu_pythonlist, 0, 1},#else {M_MENU, N_("Load Python Script.."), 0, 0, 0}, {M_MENU, N_("Python List"), 0, 0, 0},#endif {M_NEWMENU, N_("User Menu"), (menucallback) - 1, 0, 1}, {M_MENU, N_("Edit User Menu"), (menucallback) menu_usermenu, 0, 1}, {M_SEP, 0, 0, 0, 0}, {M_NEWMENURIGHT, N_("Help"), 0, 0, 1}, {M_MENU, N_("X-Chat Homepage.."), (menucallback) menu_webpage, 0, 1}, {M_MENU, N_("Online Docs.."), (menucallback) menu_docs, 0, 1}, {M_SEP, 0, 0, 0, 0}, {M_MENU, N_("About X-Chat.."), (menucallback) menu_about, 0, 1}, {M_END, 0, 0, 0, 0},};GtkWidget *createmenus (void *app, struct session *sess, int bar){ int i = 0; GtkWidget *item; GtkWidget *menu = 0; GtkWidget *menu_item = 0; GtkWidget *menu_bar; GtkWidget *usermenu = 0; if (bar) menu_bar = gtk_menu_bar_new (); else menu_bar = gtk_menu_new (); if (!menu_sess) menu_sess = sess; mymenu[28-menuoffset].state = prefs.invisible; mymenu[29-menuoffset].state = prefs.wallops; mymenu[30-menuoffset].state = prefs.servernotice; mymenu[32-menuoffset].state = sess->server->is_away; mymenu[34-menuoffset].state = prefs.autorejoin; mymenu[35-menuoffset].state = prefs.autoreconnect; mymenu[36-menuoffset].state = prefs.autoreconnectonfail; mymenu[38-menuoffset].state = prefs.autodialog; mymenu[39-menuoffset].state = prefs.autodccchat; mymenu[40-menuoffset].state = prefs.autodccsend; mymenu[57-menuoffset].state = prefs.autosave; while (1) { switch (mymenu[i].type) { case M_NEWMENURIGHT: case M_NEWMENU: if (menu) gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_item), menu); menu = gtk_menu_new (); if (mymenu[i].callback == (void *) -1) usermenu = menu; menu_item = gtk_menu_item_new_with_label (mymenu[i].text); if (mymenu[i].type == M_NEWMENURIGHT) gtk_menu_item_right_justify ((GtkMenuItem *) menu_item); if (bar) gtk_menu_bar_append (GTK_MENU_BAR (menu_bar), menu_item); else gtk_menu_append (GTK_MENU (menu_bar), menu_item); gtk_widget_show (menu_item); break; case M_MENU: item = gtk_menu_item_new_with_label (mymenu[i].text); if (mymenu[i].callback) gtk_signal_connect_object (GTK_OBJECT (item), "activate", GTK_SIGNAL_FUNC (mymenu[i].callback), (gpointer)sess); gtk_menu_append (GTK_MENU (menu), item); gtk_widget_show (item); gtk_widget_set_sensitive (item, mymenu[i].activate); break; case M_MENUTOG: item = gtk_check_menu_item_new_with_label (mymenu[i].text); /* Always show checkbox, not just when it is moused over. */ gtk_check_menu_item_set_show_toggle ((GtkCheckMenuItem*)item, TRUE); gtk_check_menu_item_set_state (GTK_CHECK_MENU_ITEM (item), mymenu[i].state); if (mymenu[i].callback) gtk_signal_connect (GTK_OBJECT (item), "toggled", GTK_SIGNAL_FUNC (mymenu[i].callback), (gpointer)sess); gtk_menu_append (GTK_MENU (menu), item); gtk_widget_show (item); gtk_widget_set_sensitive (item, mymenu[i].activate); if (bar && i == 32 - menuoffset) sess->gui->awaymenuitem = item; break; case M_SEP: item = gtk_menu_item_new (); gtk_widget_set_sensitive (item, FALSE); gtk_menu_append (GTK_MENU (menu), item); gtk_widget_show (item); break; case M_END: if (menu) gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_item), menu); if (usermenu) usermenu_create (usermenu); if (bar) sess->gui->usermenu = usermenu; return (menu_bar); } i++; }}#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -