1 /* 2 * 3 * tabs.c 4 * 5 * Copyright 2010 Alexander Petukhov <devel(at)apetukhov.ru> 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation; either version 2 of the License, or 10 * (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 20 * MA 02110-1301, USA. 21 */ 22 23 /* 24 * tabs widgets 25 */ 26 27 #ifdef HAVE_CONFIG_H 28 #include "config.h" 29 #endif 30 #include <geanyplugin.h> 31 32 extern GeanyData *geany_data; 33 34 #include "tabs.h" 35 36 /* tab widgets */ 37 GtkWidget *tab_target = NULL; 38 GtkWidget *tab_breaks = NULL; 39 GtkWidget *tab_watch = NULL; 40 GtkWidget *tab_autos = NULL; 41 GtkWidget *tab_call_stack = NULL; 42 GtkWidget *tab_terminal = NULL; 43 GtkWidget *tab_messages = NULL; 44 45 /* 46 * searches ID for a given widget 47 * arguments: 48 * tab - widget to search an id for 49 */ tabs_get_tab_id(GtkWidget * tab)50tab_id tabs_get_tab_id(GtkWidget* tab) 51 { 52 tab_id id = TID_TARGET; 53 if (tab_target == tab) 54 { 55 id = TID_TARGET; 56 } 57 else if (tab_breaks == tab) 58 { 59 id = TID_BREAKS; 60 } 61 else if (tab_watch == tab) 62 { 63 id = TID_WATCH; 64 } 65 else if (tab_autos == tab) 66 { 67 id = TID_AUTOS; 68 } 69 else if (tab_call_stack == tab) 70 { 71 id = TID_STACK; 72 } 73 else if (tab_terminal == tab) 74 { 75 id = TID_TERMINAL; 76 } 77 else if (tab_messages == tab) 78 { 79 id = TID_MESSAGES; 80 } 81 82 return id; 83 } 84 85 /* 86 * searches a widget for a given ID 87 * arguments: 88 * id - ID to search a widget for 89 */ tabs_get_tab(tab_id id)90GtkWidget* tabs_get_tab(tab_id id) 91 { 92 GtkWidget *tab = NULL; 93 switch(id) 94 { 95 case TID_TARGET: 96 tab = tab_target; 97 break; 98 case TID_BREAKS: 99 tab = tab_breaks; 100 break; 101 case TID_WATCH: 102 tab = tab_watch; 103 break; 104 case TID_AUTOS: 105 tab = tab_autos; 106 break; 107 case TID_STACK: 108 tab = tab_call_stack; 109 break; 110 case TID_TERMINAL: 111 tab = tab_terminal; 112 break; 113 case TID_MESSAGES: 114 tab = tab_messages; 115 break; 116 } 117 return tab; 118 } 119 120 /* 121 * searches a label for a given ID 122 * arguments: 123 * id - ID to search a label for 124 */ tabs_get_label(tab_id id)125const gchar* tabs_get_label(tab_id id) 126 { 127 const gchar *label = NULL; 128 switch(id) 129 { 130 case TID_TARGET: 131 label = _("Target"); 132 break; 133 case TID_BREAKS: 134 label = _("Breakpoints"); 135 break; 136 case TID_WATCH: 137 label = _("Watch"); 138 break; 139 case TID_AUTOS: 140 label = _("Autos"); 141 break; 142 case TID_STACK: 143 label = _("Call Stack"); 144 break; 145 case TID_TERMINAL: 146 label = _("Debug Terminal"); 147 break; 148 case TID_MESSAGES: 149 label = _("Debugger Messages"); 150 break; 151 } 152 return label; 153 } 154