1 /** 2 * @file gui-main.h 3 * @brief 4 * 5 * Copyright (C) 2009 Gummi Developers 6 * All Rights reserved. 7 * 8 * Permission is hereby granted, free of charge, to any person 9 * obtaining a copy of this software and associated documentation 10 * files (the "Software"), to deal in the Software without 11 * restriction, including without limitation the rights to use, 12 * copy, modify, merge, publish, distribute, sublicense, and/or sell 13 * copies of the Software, and to permit persons to whom the 14 * Software is furnished to do so, subject to the following 15 * conditions: 16 * 17 * The above copyright notice and this permission notice shall be 18 * included in all copies or substantial portions of the Software. 19 * 20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 * OTHER DEALINGS IN THE SOFTWARE. 28 */ 29 30 31 #ifndef __GUMMI_GUI_MAIN_H__ 32 #define __GUMMI_GUI_MAIN_H__ 33 34 #include <glib.h> 35 #include <gtk/gtk.h> 36 37 #include "gui-import.h" 38 #include "gui-prefs.h" 39 #include "gui-preview.h" 40 #include "gui-search.h" 41 #include "gui-snippets.h" 42 #include "gui-tabmanager.h" 43 #include "gui-infoscreen.h" 44 #include "gui-menu.h" 45 #include "gui-project.h" 46 47 #define RECENT_FILES_NUM 5 48 #define TEXCOUNT_OUTPUT_LINES 7 49 50 /* These macros should be only used in GUI related classes 51 * which acted as syntax sugar */ 52 /* These macros should be only used in GUI related classes 53 * which acted as syntax sugar */ 54 #define g_e_buffer GTK_TEXT_BUFFER (g_active_editor->buffer) 55 #define g_e_view GTK_TEXT_VIEW (g_active_editor->view) 56 #define g_active_tab gummi->tabmanager->active_tab 57 #define g_active_editor gummi->tabmanager->active_editor 58 #define g_tabs gummi->tabmanager->tabs 59 60 61 #define GUMMI_GUI(x) ((GummiGui*)x) 62 typedef struct _GummiGui GummiGui; 63 64 struct _GummiGui { 65 GuMenuGui* menugui; 66 GuImportGui* importgui; 67 GuPrefsGui* prefsgui; 68 GuPreviewGui* previewgui; 69 GuSearchGui* searchgui; 70 GuSnippetsGui* snippetsgui; 71 GuTabmanagerGui* tabmanagergui; 72 GuInfoscreenGui* infoscreengui; 73 GuProjectGui* projectgui; 74 75 GtkWindow* mainwindow; 76 GtkTextBuffer* errorbuff; 77 GtkTextView* errorview; 78 GtkBox* rightpane; 79 80 GtkWidget* toolbar; 81 GtkStatusbar* statusbar; 82 GtkCheckMenuItem* menu_spelling; 83 GtkCheckMenuItem* menu_snippets; 84 GtkCheckMenuItem* menu_toolbar; 85 GtkCheckMenuItem* menu_statusbar; 86 GtkCheckMenuItem* menu_autosync; 87 GtkMenuItem* recent[5]; 88 gint insens_widget_size; 89 GtkWidget** insens_widgets; 90 GtkBuilder *builder; 91 GtkWidget *docstatswindow; 92 GtkWidget *bibcompile; 93 94 GtkMenuItem* menu_runbibtex; 95 GtkMenuItem* menu_runmakeindex; 96 97 guint statusid; 98 gchar* recent_list[5]; 99 }; 100 101 typedef enum _GuFilterType { 102 TYPE_LATEX = 0, 103 TYPE_LATEX_SAVEAS, 104 TYPE_PDF, 105 TYPE_IMAGE, 106 TYPE_BIBLIO, 107 TYPE_PROJECT 108 } GuFilterType; 109 110 /* Main GUI */ 111 GummiGui* gui_init (GtkBuilder* builder); 112 void gui_main (GtkBuilder* builder); 113 gboolean gui_quit (void); 114 115 116 void gui_set_filename_display (GuTabContext* tc, 117 gboolean title, gboolean label); 118 void gui_set_window_title (const gchar* filename, const gchar* text); 119 120 121 void gui_open_file (const gchar* filename); 122 void gui_save_file (GuTabContext* tab, gboolean saveas); 123 void gui_set_hastabs_sensitive (gboolean enable); 124 125 void on_tab_notebook_switch_page (GtkNotebook *notebook, GtkWidget* nbpage, int pagenr, void* data); 126 void on_tool_textstyle_bold_activate (GtkWidget* widget, void* user); 127 void on_tool_textstyle_italic_activate (GtkWidget* widget, void* user); 128 void on_tool_textstyle_underline_activate (GtkWidget* widget, void* user); 129 void on_tool_textstyle_left_activate (GtkWidget* widget, void* user); 130 void on_tool_textstyle_center_activate (GtkWidget* widget, void* user); 131 void on_tool_textstyle_right_activate (GtkWidget* widget, void* user); 132 void on_button_template_add_clicked (GtkWidget* widget, void* user); 133 void on_button_template_remove_clicked (GtkWidget* widget, void* user); 134 void on_button_template_open_clicked (GtkWidget* widget, void* user); 135 void on_button_template_close_clicked (GtkWidget* widget, void* user); 136 void on_template_rowitem_edited (GtkWidget* widget, gchar *path, gchar* filenm, 137 void* user); 138 void gui_recover_from_swapfile (const gchar* filename); 139 void on_menu_autosync_toggled (GtkCheckMenuItem *menu_autosync, void* user); 140 141 void on_button_biblio_compile_clicked (GtkWidget* widget, void* user); 142 void on_button_biblio_detect_clicked (GtkWidget* widget, void* user); 143 void on_bibreference_clicked (GtkTreeView* view, GtkTreePath* Path, 144 GtkTreeViewColumn* column, void* user); 145 void on_biblio_filter_changed (GtkWidget* widget, void* user); 146 gboolean on_bibprogressbar_update (void* data); 147 148 void on_recovery_infobar_response (GtkInfoBar* bar, gint res, gpointer filename); 149 void gui_recovery_mode_enable (GuTabContext* tab, const gchar* filename); 150 void gui_recovery_mode_disable (GtkInfoBar *infobar); 151 152 /* misc functions */ 153 gchar* get_open_filename (GuFilterType type); 154 gchar* get_save_filename (GuFilterType type); 155 void file_dialog_set_filter (GtkFileChooser* dialog, GuFilterType type); 156 gint check_for_save (GuEditor* editor); 157 158 void add_to_recent_list (const gchar* filename); 159 void display_recent_files (GummiGui* gui); 160 161 void gui_buildlog_set_text (const gchar *message); 162 void statusbar_set_message (const gchar* message); 163 gboolean statusbar_del_message (void* user); 164 165 void typesetter_setup (void); 166 167 void check_preview_timer (void); 168 169 #endif /* __GUMMI_GUI_MAIN_H__ */ 170