2 * Copyright 2006, ComArch S.A
14 #include <hildon-widgets/hildon-program.h>
15 #include <hildon-widgets/hildon-window.h>
16 #include <hildon-widgets/hildon-banner.h>
17 #include <hildon-widgets/hildon-find-toolbar.h>
18 #include <gdk/gdkkeysyms.h>
20 #include <hildon-widgets/gtk-infoprint.h>
21 #include <gdk/gdkkeysyms.h>
23 #include <gtkhtml/gtkhtml.h>
25 #include <glib/gprintf.h>
31 //============================
32 #include <sys/types.h>
35 //============================
38 #define SCROLL_STEP_H 50
39 #define SCROLL_STEP_V 20
42 typedef struct WSGuiAppData WSGuiApp;
50 /** \brief struct which contains components of menu
52 * here are placed all components of application menu and popup menu
56 GtkWidget *ws_gui_main_menu; ///< application submenu
57 GtkWidget *ws_gui_menu_edit; ///< edit submenu(connected with text editing)
58 GtkWidget *ws_gui_menu_copy; ///< menuitem in edit submenu; copy selected text to the clipboard
59 GtkWidget *ws_gui_menu_select_all; ///< menuitem in edit submenu; select whole text in the translation (html) area
60 GtkWidget *ws_gui_menu_view; ///< view submenu
61 GtkWidget *ws_gui_menu_hide_list; ///< menuitem which allows to hide/show words list
62 GtkWidget *ws_gui_menu_zoom_in; ///< menuitem which allows to zoom in text in the translation area
63 GtkWidget *ws_gui_menu_zoom_out; ///< menuitem which allows to zoom out text in the translation area
64 GtkWidget *ws_gui_menu_full_screen; ///< menuitem which allows to switch between fullscreen and normal mode
65 GtkWidget *ws_gui_menu_search; ///< search submenu (connected with searching)
66 GtkWidget *ws_gui_menu_find_word; ///< menuitem which allows to start searching
67 GtkWidget *ws_gui_menu_find_prev; ///< menuitem which allows to find previous word from the history
68 GtkWidget *ws_gui_menu_find_next; ///< menuitem which allows to find next word in the history
69 GtkWidget *ws_gui_menu_stop; ///< menuitem which stops search
70 GtkWidget *ws_gui_menu_close; ///< menuitem which closes the application
72 GtkWidget *ws_gui_submenu_1; ///< submenu which is necessary to build edit submenu
73 GtkWidget *ws_gui_submenu_2; ///< submenu which is necessary to build view submenu
74 GtkWidget *ws_gui_submenu_3; ///< submenu which is necessary to build search submenu
75 GtkWidget *ws_gui_separator; ///< separator, it is used to provide nice layout
78 GtkWidget *ws_gui_popup_menu; ///< popup menu
79 GtkWidget *ws_gui_popup_edit; ///< edit submenu
80 GtkWidget *ws_gui_popup_submenu; ///< submenu (necessary to create edit submenu)
81 GtkWidget *ws_gui_popup_copy; ///< menuitem which allows to copy selected to the clipboard
82 GtkWidget *ws_gui_popup_select_all; ///<menuitem which allows to select whole text in translation area
83 GtkWidget *ws_gui_popup_zoom_in; ///< menuitem which allows to zoom in text in translation area
84 GtkWidget *ws_gui_popup_zoom_out; ///< menuitem which allows to zoom in text in translation area
87 /** \brief struct which contains components of words list
89 * here are placed all components of words list (inside left scrollwindow)
92 GtkWidget *ws_gui_list; ///< list which contains words
93 GtkWidget *ws_gui_list_item; ///< item in words list (each word)
94 GtkWidget *ws_gui_list_label; ///< label, necessary to place word in words list
96 GtkObject *ws_gui_list_item_object; ///< object which stores data of selected item (from words list)
97 gchar *ws_gui_list_item_data_string; ///< variable which stores translation of word (html content)
98 GList *ws_gui_dlist; ///< variable, which is necessary to get selected item (from words list)
100 GtkListStore *ws_gui_store;
101 GtkTreeIter ws_gui_iter;
102 GtkCellRenderer *ws_gui_renderer;
103 GtkTreeModel *ws_gui_model;
104 GtkWidget *ws_gui_view;
105 GtkTreeSelection *ws_gui_selection;
109 /** \brief struct which contains all components of application
111 * here are placed all components of main window, toolbar, structures responsible for menus and variables responsible for adjustments, words history, banners, message dialogs and everything what user can see and use
113 struct WSGuiAppData {
114 HildonProgram *ws_gui_hildon_program; ///< handle to hildon program
115 HildonWindow *ws_gui_hildon_window; ///< handle to hildon window
116 GtkWidget *ws_gui_html; ///< translation (html) area
117 GtkWidget *ws_gui_hpane; ///< pane; it allows to divide window into two separate panels
118 HildonFindToolbar *ws_gui_hildon_find_toolbar; ///< find toolbar (placed at the bottom of the window)
119 GtkToolItem *ws_gui_toobar_button_close; ///< close button at the find toolbar
120 GtkToolItem *ws_gui_toobar_button_back; ///< back button at the find toolbar (history navigator)
121 GtkToolItem *ws_gui_toobar_button_forward; ///< next button at the find toolbar (history navigator)
122 GtkToolItem *ws_gui_toobar_button_stop; ///< stop butoon at the find toolbar (allows to stop searching)
123 GtkWidget *ws_gui_banner; ///< banner, displays message that searching is in progress
124 GtkWidget *ws_gui_banner_caching; ///< banner, displays message that caching is in progress
125 GtkToolItem *ws_gui_toobar_button_hide; ///< button hide, allows to hide/show words list with button placed at find toolbar
126 GtkWidget *ws_gui_scrolledwindow_right; ///< right scrolledwindow (placed in right pane), necessary to provide scrollbars)
127 GtkWidget *ws_gui_scrolledwindow_left; ///< scrollwindow (placed in left pane), necessary to provide scrollbars)
128 gchar *ws_gui_html_source; ///< string which contains html content (translation of word)
130 GtkAdjustment* ws_gui_vadj; ///< vertical adjustment of left scrolledwindow (necessary to provide navigation (kardware keys) inside words list)
131 GtkAdjustment* ws_gui_hadj; ///< horizontal adjustment of left scrolledwindow (necessary to provide navigation (kardware keys) inside words list)
132 gdouble v_delta; ///< variable used for moving vertical scrollbar in words list
133 gdouble v_new_value; ///< variable used for moving vertical scrollbar in words list
134 gdouble h_delta; ///< variable used for moving horizontal scrollbar in words list
135 gdouble h_new_value; ///< variable used for moving horizontal scrollbar in words list
136 gdouble cur_vadj; ///< current vertical adjustment of vertical scrollbar in words list
137 gdouble prev_vadj; ///< previous vertical adjustment of vertical scrollbar in words list
138 gdouble cur_hadj; ///< current vertical adjustment of horizontal scrollbar in words list
139 gdouble prev_hadj; ///< previous vertical adjustment of horizontal scrollbar in words list
141 GArray *ws_gui_history; ///< words history
142 gint ws_gui_history_cur_pos; ///< current position in words history array
143 struct WSGuiMenu *ws_gui_menu; ///< structure responsible for menus
144 struct WSGuiList *ws_gui_w_list; ///< structure responsible for words list
146 gboolean ws_gui_banner_flag; ///< flag; used for notifing if searching is in progress and banner has to be displaying
147 gboolean ws_gui_full_screen_flag; ///< flag; used for informing if fullscreen mode is active
149 WSDBusData *dbus_data; ///< DBUS declaration
151 GtkWidget* ws_message_dialog; ///< message dialogs; used for informing user about errors