📄 menu_popup.c
字号:
/*************************************************************************** * Copyright (C) 2003 by zhong * * zhongz@163.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/#include <gtk/gtk.h>#include "interface.h"#include "html.h"static void chmsee_html_reload_to_gbk(ChmSee *window);static void chmsee_html_reload_to_gb18030(ChmSee *window);static void chmsee_html_reload_to_gb2312(ChmSee *window);static void chmsee_html_reload_to_big5(ChmSee *window);static void chmsee_html_reload_to_hz(ChmSee *window);static void chmsee_html_reload_to_iso(ChmSee *window);static void chmsee_html_reload_to_window(ChmSee *window);static void chmsee_html_reload_to_none(ChmSee *window);static voidchmsee_html_reload_to_gbk(ChmSee *window){ window->current_codeset = "GBK"; chmsee_html_reload (window, window->current_link);}static voidchmsee_html_reload_to_gb18030(ChmSee *window){ window->current_codeset = "GB18030"; chmsee_html_reload (window, window->current_link);}static voidchmsee_html_reload_to_gb2312(ChmSee *window){ window->current_codeset = "GB2312"; chmsee_html_reload (window, window->current_link);}static voidchmsee_html_reload_to_big5(ChmSee *window){ window->current_codeset = "BIG5"; chmsee_html_reload (window, window->current_link); }static voidchmsee_html_reload_to_hz(ChmSee *window){ window->current_codeset = "ISO-8859-1"; chmsee_html_reload (window, window->current_link);}static voidchmsee_html_reload_to_iso(ChmSee *window){ window->current_codeset = "ISO-8859-15"; chmsee_html_reload (window, window->current_link);}static voidchmsee_html_reload_to_window(ChmSee *window){ window->current_codeset = "Windows-1252"; chmsee_html_reload (window, window->current_link);}static voidchmsee_html_reload_to_none(ChmSee *window){ window->current_codeset = "NONE"; chmsee_html_reload (window, window->current_link); }void chmsee_menu_popup (GdkEventButton *event, ChmSee *window) { GtkWidget *menu; GtkWidget *menu_name; GtkWidget *menu_gb18030; GtkWidget *menu_gb2312; GtkWidget *menu_gbk; GtkWidget *menu_big5; GtkWidget *menu_hz; GtkWidget *menu_iso; GtkWidget *menu_window; GtkWidget *menu_none; GtkWidget *menu_separator; menu = gtk_menu_new (); menu_name = gtk_menu_item_new_with_label ("设置编码"); gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_name); gtk_widget_show (menu_name); gtk_widget_set_sensitive (menu_name, FALSE); menu_separator = gtk_separator_menu_item_new (); gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_separator); gtk_widget_show (menu_separator); menu_gb18030 = gtk_menu_item_new_with_label ("简体中文(GB18030)"); gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_gb18030); g_signal_connect_swapped (G_OBJECT (menu_gb18030), "activate", G_CALLBACK (chmsee_html_reload_to_gb18030), window); gtk_widget_show (menu_gb18030); menu_gb2312 = gtk_menu_item_new_with_label ("简体中文(GB2312)"); gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_gb2312); g_signal_connect_swapped (G_OBJECT (menu_gb2312), "activate", G_CALLBACK (chmsee_html_reload_to_gb2312), window); gtk_widget_show (menu_gb2312); menu_gbk = gtk_menu_item_new_with_label ("简体中文(GBK)"); gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_gbk); g_signal_connect_swapped (G_OBJECT (menu_gbk), "activate", G_CALLBACK (chmsee_html_reload_to_gbk), window); gtk_widget_show (menu_gbk); menu_big5 = gtk_menu_item_new_with_label ("繁体中文(BIG5)"); gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_big5); g_signal_connect_swapped (G_OBJECT (menu_big5), "activate", G_CALLBACK (chmsee_html_reload_to_big5), window); gtk_widget_show (menu_big5); menu_hz = gtk_menu_item_new_with_label ("西方英文(ISO-8859-1)"); gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_hz); g_signal_connect_swapped (G_OBJECT (menu_hz), "activate", G_CALLBACK (chmsee_html_reload_to_hz), window); gtk_widget_show (menu_hz); menu_iso = gtk_menu_item_new_with_label ("西方英文(ISO-8859-15)"); gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_iso); g_signal_connect_swapped (G_OBJECT (menu_iso), "activate", G_CALLBACK (chmsee_html_reload_to_iso), window); gtk_widget_show (menu_iso); menu_window = gtk_menu_item_new_with_label ("西方英文(Windows-1252)"); gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_window); g_signal_connect_swapped (G_OBJECT (menu_window), "activate", G_CALLBACK (chmsee_html_reload_to_window), window); gtk_widget_show (menu_window); menu_none = gtk_menu_item_new_with_label ("不转换原编码"); gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_none); g_signal_connect_swapped (G_OBJECT (menu_none), "activate", G_CALLBACK (chmsee_html_reload_to_none), window); gtk_widget_show (menu_none); gtk_menu_popup (GTK_MENU(menu), NULL, NULL, NULL, NULL, event->button, event->time);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -