1 /* 2 * Copyright (C) 2007 Ignacio Casal Quinteiro <nacho.resa@gmail.com> 3 * 2008 Igalia 4 * 5 * This program is free software: you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation, either version 3 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 * 18 * Authors: 19 * Ignacio Casal Quinteiro <nacho.resa@gmail.com> 20 * Pablo Sanxiao <psanxiao@gmail.com> 21 */ 22 23 #ifndef __TAB_H__ 24 #define __TAB_H__ 25 26 #include <glib.h> 27 #include <glib-object.h> 28 #include <gtk/gtk.h> 29 30 #include "gtr-context.h" 31 #include "gtr-msg.h" 32 #include "gtr-po.h" 33 #include "gtr-view.h" 34 #include "gtr-message-table-model.h" 35 #include "gtr-search-bar.h" 36 37 G_BEGIN_DECLS 38 /* 39 * Type checking and casting macros 40 */ 41 #define GTR_TYPE_TAB (gtr_tab_get_type ()) 42 #define GTR_TAB(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GTR_TYPE_TAB, GtrTab)) 43 #define GTR_TAB_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GTR_TYPE_TAB, GtrTabClass)) 44 #define GTR_IS_TAB(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GTR_TYPE_TAB)) 45 #define GTR_IS_TAB_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GTR_TYPE_TAB)) 46 #define GTR_TAB_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GTR_TYPE_TAB, GtrTabClass)) 47 48 /* 49 * Main object structure 50 */ 51 typedef struct _GtrTab GtrTab; 52 53 struct _GtrTab 54 { 55 GtkBox parent_instance; 56 }; 57 58 /* 59 * Class definition 60 */ 61 typedef struct _GtrTabClass GtrTabClass; 62 63 struct _GtrTabClass 64 { 65 GtkBoxClass parent_class; 66 67 void (*showed_message) (GtrTab * tab, GtrMsg * msg); 68 void (*message_changed) (GtrTab * tab, GtrMsg * msg); 69 void (*message_edition_finished) (GtrTab * tab, GtrMsg * msg); 70 void (*selection_changed) (GtrTab * tab); 71 }; 72 73 typedef enum 74 { 75 GTR_TAB_MOVE_NONE, 76 GTR_TAB_MOVE_NEXT, 77 GTR_TAB_MOVE_PREV 78 } GtrTabMove; 79 80 typedef enum 81 { 82 GTR_TAB_PLACEMENT_NONE = 0, 83 GTR_TAB_PLACEMENT_TOP, 84 GTR_TAB_PLACEMENT_BOTTOM, 85 GTR_TAB_PLACEMENT_RIGHT, 86 GTR_TAB_PLACEMENT_LEFT, 87 GTR_TAB_PLACEMENT_CENTER, 88 GTR_TAB_PLACEMENT_FLOATING 89 } GtrTabPlacement; 90 91 /* 92 * Public methods 93 */ 94 GType gtr_tab_get_type (void) G_GNUC_CONST; 95 96 GtrTab *gtr_tab_new (GtrPo * po, GtkWindow *window); 97 98 GtrPo *gtr_tab_get_po (GtrTab * tab); 99 100 gint gtr_tab_get_active_trans_tab (GtrTab * tab); 101 102 GtrContextPanel *gtr_tab_get_context_panel (GtrTab * tab); 103 104 GtrView *gtr_tab_get_active_view (GtrTab * tab); 105 106 GList *gtr_tab_get_all_views (GtrTab * tab, 107 gboolean original, gboolean translated); 108 109 void gtr_tab_message_go_to (GtrTab * tab, 110 GtrMsg * to_go, 111 gboolean searching, GtrTabMove move); 112 113 GtrTab *gtr_tab_get_from_document (GtrPo * po); 114 115 gboolean gtr_tab_get_autosave_enabled (GtrTab * tab); 116 117 void gtr_tab_set_autosave_enabled (GtrTab * tab, gboolean enable); 118 119 gint gtr_tab_get_autosave_interval (GtrTab * tab); 120 121 void gtr_tab_set_autosave_interval (GtrTab * tab, gint interval); 122 123 void gtr_tab_clear_msgstr_views (GtrTab * tab); 124 125 void gtr_tab_copy_to_translation (GtrTab * tab); 126 127 void gtr_tab_block_movement (GtrTab * tab); 128 129 void gtr_tab_unblock_movement (GtrTab * tab); 130 131 void gtr_tab_go_to_next (GtrTab * tab); 132 133 void gtr_tab_go_to_prev (GtrTab * tab); 134 135 void gtr_tab_go_to_first (GtrTab * tab); 136 137 void gtr_tab_go_to_last (GtrTab * tab); 138 139 gboolean gtr_tab_go_to_next_fuzzy (GtrTab * tab); 140 141 gboolean gtr_tab_go_to_prev_fuzzy (GtrTab * tab); 142 143 gboolean gtr_tab_go_to_next_untrans (GtrTab * tab); 144 145 gboolean gtr_tab_go_to_prev_untrans (GtrTab * tab); 146 147 gboolean gtr_tab_go_to_next_fuzzy_or_untrans (GtrTab * tab); 148 149 gboolean gtr_tab_go_to_prev_fuzzy_or_untrans (GtrTab * tab); 150 151 void gtr_tab_go_to_number (GtrTab * tab, gint number); 152 153 void gtr_tab_set_info_bar (GtrTab * tab, GtkWidget * infobar); 154 155 void gtr_tab_set_info (GtrTab * tab, const char * primary, const char * secondary); 156 157 GtrMsg * gtr_tab_get_msg (GtrTab *tab); 158 159 void gtr_tab_set_progress (GtrTab *tab, gint trans, gint untrans, gint fuzzy); 160 161 void gtr_tab_sort_by (GtrTab *tab, GtrMessageTableSortBy sort); 162 163 void gtr_tab_find_replace (GtrTab *tab, gboolean set); 164 165 void gtr_tab_show_hide_search_bar (GtrTab * tab, gboolean show); 166 void gtr_tab_find_next (GtrTab * tab); 167 void gtr_tab_find_prev (GtrTab * tab); 168 void gtr_tab_find_set_replace (GtrTab * tab, gboolean replace); 169 170 /* Semi-public methods */ 171 172 gchar *_gtr_tab_get_name (GtrTab * tab); 173 174 gchar *_gtr_tab_get_tooltips (GtrTab *tab); 175 176 gboolean _gtr_tab_can_close (GtrTab * tab); 177 178 G_END_DECLS 179 180 #endif /* __TAB_H__ */ 181