/* Copyright (C) 2001-2002 Kenichi Suto * * 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. * * 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 General Public License for more details. * * You should have received a copy of the GNU 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 "defs.h" #include "global.h" #include "dictbar.h" #include "statusbar.h" #include extern GList *group_list; extern GtkWidget *combo_group; void next_dict_group(){ GList *group_item; DICT_GROUP *group; group_item = g_list_first(group_list); while(group_item != NULL){ group = (DICT_GROUP *)(group_item->data); if(group->active == TRUE){ if(g_list_next(group_item) == NULL){ group_item = g_list_first(group_list); } else { group_item = g_list_next(group_item); } break; } group_item = g_list_next(group_item); } if(group_item == NULL) return; group = (DICT_GROUP *)(group_item->data); gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(combo_group)->entry), group->name); } void previous_dict_group(){ GList *group_item; DICT_GROUP *group; group_item = g_list_first(group_list); while(group_item != NULL){ group = (DICT_GROUP *)(group_item->data); if(group->active == TRUE){ if(g_list_previous(group_item) == NULL){ group_item = g_list_last(group_list); } else { group_item = g_list_previous(group_item); } break; } group_item = g_list_next(group_item); } if(group_item == NULL) return; group = (DICT_GROUP *)(group_item->data); gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(combo_group)->entry), group->name); } extern GtkWidget *dict_box; void toggle_dictionary(gint number){ GList *children, *child; GtkWidget *w; gint idx; gboolean active; children = gtk_container_children(GTK_CONTAINER(dict_box)); idx = 0; child = g_list_first(children); while(child != NULL){ w = (GtkWidget *)(child->data); if(GTK_IS_BUTTON(w)){ if((number - 1) == idx){ active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w)); if(active == TRUE) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w), FALSE); else gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w), TRUE); break; } else idx ++; } child = g_list_next(child); } } void toggle_dictionary1(){ toggle_dictionary(1); } void toggle_dictionary2(){ toggle_dictionary(2); } void toggle_dictionary3(){ toggle_dictionary(3); } void toggle_dictionary4(){ toggle_dictionary(4); } void toggle_dictionary5(){ toggle_dictionary(5); } void toggle_dictionary6(){ toggle_dictionary(6); } void toggle_dictionary7(){ toggle_dictionary(7); } void toggle_dictionary8(){ toggle_dictionary(8); } void toggle_dictionary9(){ toggle_dictionary(9); } void toggle_dictionary10(){ toggle_dictionary(10); } extern CONTENT_AREA *dict_area; void go_back(){ history_back(dict_area); } void go_forward(){ history_forward(dict_area); } void clear_word(){ gtk_entry_set_text(GTK_ENTRY(word_entry), ""); } void quit(){ exit_program(NULL, NULL); } void iconify(){ XIconifyWindow (GDK_DISPLAY (), GDK_WINDOW_XWINDOW(window->window), DefaultScreen (GDK_DISPLAY ())); }