⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 spelling-window.c

📁 一个功能全面的电子邮件客户端
💻 C
字号:
/* TradeClient <http://tradeclient.sourceforge.net> * $Id: spelling-window.c,v 1.5 2001/03/20 22:19:33 ttabner Exp $ * * Copyright (C) 1999-2000 Bynari Inc. * Copyright (C) 2001 Project TradeClient * * LGPL * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Library General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library * General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */#include "puma.h"GtkWidget *create_spelling_window (void) {  GtkWidget *spelling_window;  GtkWidget *frame1;  GtkWidget *table1;  GtkWidget *vbox1;  GtkWidget *done_button ;  GtkWidget *skip_button;  GtkWidget *replace_button;  GtkWidget *insert_button;  GtkWidget *stop_button;  GtkWidget *scrolledwindow1;  GtkWidget *spell_text;  GtkWidget *spell_word;  GtkWidget *scrolledwindow2;  GtkWidget *spell_correct_clist;  GtkWidget *label1;  GtkTooltips *tooltips;  tooltips = gtk_tooltips_new ();  spelling_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);  gtk_widget_set_name (spelling_window, "spelling_window");  gtk_object_set_data (GTK_OBJECT (spelling_window), "spelling_window", spelling_window);  gtk_window_set_title (GTK_WINDOW (spelling_window), _("Spelling"));  gtk_window_set_default_size (GTK_WINDOW (spelling_window), 350, 277);  gtk_window_set_policy (GTK_WINDOW (spelling_window), TRUE, TRUE, TRUE);  frame1 = gtk_frame_new (NULL);  gtk_widget_set_name (frame1, "frame1");  gtk_widget_ref (frame1);  gtk_object_set_data_full (GTK_OBJECT (spelling_window), "frame1", frame1,                            (GtkDestroyNotify) gtk_widget_unref);  gtk_widget_show (frame1);  gtk_container_add (GTK_CONTAINER (spelling_window), frame1);  gtk_container_set_border_width (GTK_CONTAINER (frame1), 2);  table1 = gtk_table_new (3, 2, FALSE);  gtk_widget_set_name (table1, "table1");  gtk_widget_ref (table1);  gtk_object_set_data_full (GTK_OBJECT (spelling_window), "table1", table1,                            (GtkDestroyNotify) gtk_widget_unref);  gtk_widget_show (table1);  gtk_container_add (GTK_CONTAINER (frame1), table1);  gtk_container_set_border_width (GTK_CONTAINER (table1), 2);  gtk_table_set_row_spacings (GTK_TABLE (table1), 1);  gtk_table_set_col_spacings (GTK_TABLE (table1), 1);  vbox1 = gtk_vbox_new (FALSE, 1);  gtk_widget_set_name (vbox1, "vbox1");  gtk_widget_ref (vbox1);  gtk_object_set_data_full (GTK_OBJECT (spelling_window), "vbox1", vbox1,                            (GtkDestroyNotify) gtk_widget_unref);  gtk_widget_show (vbox1);  gtk_table_attach (GTK_TABLE (table1), vbox1, 1, 2, 0, 3,                    (GtkAttachOptions) (GTK_FILL),                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);  gtk_container_set_border_width (GTK_CONTAINER (vbox1), 2);  done_button = gtk_button_new_with_label (_("Done"));  gtk_widget_set_name (done_button, "done_button");  gtk_widget_ref (done_button);  gtk_object_set_data_full (GTK_OBJECT (spelling_window), "done_button", done_button,                            (GtkDestroyNotify) gtk_widget_unref);  gtk_widget_show (done_button);  gtk_box_pack_start (GTK_BOX (vbox1), done_button, TRUE, FALSE, 0);  gtk_tooltips_set_tip (tooltips, done_button, _("Click when finished with spell checking"), NULL);  skip_button = gtk_button_new_with_label (_("Skip"));  gtk_widget_set_name (skip_button, "skip_button");  gtk_widget_ref (skip_button);  gtk_object_set_data_full (GTK_OBJECT (spelling_window), "skip_button", skip_button,                            (GtkDestroyNotify) gtk_widget_unref);  gtk_widget_show (skip_button);  gtk_box_pack_start (GTK_BOX (vbox1), skip_button, TRUE, FALSE, 0);  gtk_tooltips_set_tip (tooltips, skip_button, _("Skip This word"), NULL);  replace_button = gtk_button_new_with_label (_("Replace"));  gtk_widget_set_name (replace_button, "replace_button");  gtk_widget_ref (replace_button);  gtk_object_set_data_full (GTK_OBJECT (spelling_window), "replace_button", replace_button,                            (GtkDestroyNotify) gtk_widget_unref);  gtk_widget_show (replace_button);  gtk_box_pack_start (GTK_BOX (vbox1), replace_button, TRUE, FALSE, 0);  gtk_tooltips_set_tip (tooltips, replace_button, _("Replace with correct word"), NULL);  insert_button = gtk_button_new_with_label (_("Insert"));  gtk_widget_set_name (insert_button, "insert_button");  gtk_widget_ref (insert_button);  gtk_object_set_data_full (GTK_OBJECT (spelling_window), "insert_button", insert_button,                            (GtkDestroyNotify) gtk_widget_unref);  gtk_widget_show (insert_button);  gtk_box_pack_start (GTK_BOX (vbox1), insert_button, TRUE, FALSE, 0);  gtk_tooltips_set_tip (tooltips, insert_button, _("Insert word into dictionary"), NULL);  stop_button = gtk_button_new_with_label (_("Stop"));  gtk_widget_set_name (stop_button, "stop_button");  gtk_widget_ref (stop_button);  gtk_object_set_data_full (GTK_OBJECT (spelling_window), "stop_button", stop_button,                            (GtkDestroyNotify) gtk_widget_unref);  gtk_widget_show (stop_button);  gtk_box_pack_start (GTK_BOX (vbox1), stop_button, TRUE, FALSE, 0);  gtk_tooltips_set_tip (tooltips, stop_button, _("Stop spell checking"), NULL);  scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL);  gtk_widget_set_name (scrolledwindow1, "scrolledwindow1");  gtk_widget_ref (scrolledwindow1);  gtk_object_set_data_full (GTK_OBJECT (spelling_window), "scrolledwindow1", scrolledwindow1,                            (GtkDestroyNotify) gtk_widget_unref);  gtk_widget_show (scrolledwindow1);  gtk_table_attach (GTK_TABLE (table1), scrolledwindow1, 0, 1, 0, 1,                    (GtkAttachOptions) (GTK_FILL),                    (GtkAttachOptions) (GTK_FILL), 0, 0);  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow1), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);  spell_text = gtk_text_new (NULL, NULL);  gtk_widget_set_name (spell_text, "spell_text");  gtk_widget_ref (spell_text);  gtk_object_set_data_full (GTK_OBJECT (spelling_window), "spell_text", spell_text,                            (GtkDestroyNotify) gtk_widget_unref);  gtk_widget_show (spell_text);  gtk_container_add (GTK_CONTAINER (scrolledwindow1), spell_text);  gtk_widget_set_usize (spell_text, -2, 50);  spell_word = gtk_entry_new ();  gtk_widget_set_name (spell_word, "spell_word");  gtk_widget_ref (spell_word);  gtk_object_set_data_full (GTK_OBJECT (spelling_window), "spell_word", spell_word,                            (GtkDestroyNotify) gtk_widget_unref);  gtk_widget_show (spell_word);  gtk_table_attach (GTK_TABLE (table1), spell_word, 0, 1, 1, 2,                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),                    (GtkAttachOptions) (0), 0, 0);  gtk_widget_set_usize (spell_word, -2, 22);  scrolledwindow2 = gtk_scrolled_window_new (NULL, NULL);  gtk_widget_set_name (scrolledwindow2, "scrolledwindow2");  gtk_widget_ref (scrolledwindow2);  gtk_object_set_data_full (GTK_OBJECT (spelling_window), "scrolledwindow2", scrolledwindow2,                            (GtkDestroyNotify) gtk_widget_unref);  gtk_widget_show (scrolledwindow2);  gtk_table_attach (GTK_TABLE (table1), scrolledwindow2, 0, 1, 2, 3,                    (GtkAttachOptions) (GTK_FILL),                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow2), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);  spell_correct_clist = gtk_clist_new (1);  gtk_widget_set_name (spell_correct_clist, "spell_correct_clist");  gtk_widget_ref (spell_correct_clist);  gtk_object_set_data_full (GTK_OBJECT (spelling_window), "spell_correct_clist", spell_correct_clist,                            (GtkDestroyNotify) gtk_widget_unref);  gtk_widget_show (spell_correct_clist);  gtk_container_add (GTK_CONTAINER (scrolledwindow2), spell_correct_clist);  gtk_clist_set_column_width (GTK_CLIST (spell_correct_clist), 0, 80);  gtk_clist_column_titles_show (GTK_CLIST (spell_correct_clist));  label1 = gtk_label_new (_("Suggestions"));  gtk_widget_set_name (label1, "label1");  gtk_widget_ref (label1);  gtk_object_set_data_full (GTK_OBJECT (spelling_window), "label1", label1,                            (GtkDestroyNotify) gtk_widget_unref);  gtk_widget_show (label1);  gtk_clist_set_column_widget (GTK_CLIST (spell_correct_clist), 0, label1);  gtk_object_set_data (GTK_OBJECT (spelling_window), "tooltips", tooltips);  return spelling_window;}GtkWidget *spelling_widget_create (GtkWidget *wid) {	GtkWidget *widget=create_spelling_window ();	char *text;	CheckSpelling *cs;	Misspelled *msw;		text=gtk_editable_get_chars (GTK_EDITABLE (lw (wid, "body_textbox")), 0, -1);	cs=spell_check_spelling (text);	g_free (text);	cs->extra=(void *)wid;	msw=spell_getnext_misspelled (cs);	if (!msw || !spelling_populate_window (widget, cs)) {		spelling_done (widget);	}		clip_handle_editable (lw (widget, "spell_text"));	clip_handle_editable (lw (widget, "spell_word"));	gtk_signal_connect (GTK_OBJECT (widget), "delete_event",	                    GTK_SIGNAL_FUNC (spelling_widget_destroy), cs);	gtk_signal_connect (GTK_OBJECT (lw (widget, "done_button")), "clicked",	                    GTK_SIGNAL_FUNC (spelling_widget_stop), cs);	gtk_signal_connect (GTK_OBJECT (lw (widget, "skip_button")), "clicked",	                    GTK_SIGNAL_FUNC (spelling_widget_skip), cs);	gtk_signal_connect (GTK_OBJECT (lw (widget, "replace_button")), "clicked",	                    GTK_SIGNAL_FUNC (spelling_widget_replace), cs);	gtk_signal_connect (GTK_OBJECT (lw (widget, "insert_button")), "clicked",	                    GTK_SIGNAL_FUNC (spelling_widget_insert), cs);	gtk_signal_connect (GTK_OBJECT (lw (widget, "stop_button")), "clicked",	                    GTK_SIGNAL_FUNC (spelling_widget_stop), cs);	gtk_signal_connect (GTK_OBJECT (lw (widget, "spell_correct_clist")), "select_row",	                    GTK_SIGNAL_FUNC (spelling_widget_suggestion_selected), NULL);	gtk_signal_connect (GTK_OBJECT (lw (widget, "spell_correct_clist")), "unselect_row",	                    GTK_SIGNAL_FUNC (spelling_widget_suggestion_unselected), NULL);	gtk_signal_connect (GTK_OBJECT (lw (widget, "spell_word")), "changed",	                    GTK_SIGNAL_FUNC (spelling_entry_changed), cs);	gtk_widget_show (widget);	return widget;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -