Commit 7162468b49a98d57b84c48ee9f2ac985b37b2579

Authored by perry.werneck@gmail.com
1 parent aba7601f

Implementando suporte para o toggle bold, atualizando actions de seleção para o novo formato

src/gtk/actions.c
... ... @@ -201,7 +201,7 @@ static void lib3270_toggle_action(GtkToggleAction *action,GtkWidget *widget)
201 201  
202 202 static void selection_move_action(GtkAction *action, GtkWidget *widget)
203 203 {
204   - trace("Action %s activated on widget %p dir=%s",gtk_action_get_name(action),widget,(const gchar *) g_object_get_data(G_OBJECT(action),"direction"));
  204 + trace("Action %s activated on widget %p",gtk_action_get_name(action),widget);
205 205 lib3270_move_selection(GTK_V3270(widget)->host,(LIB3270_DIRECTION) g_object_get_data(G_OBJECT(action),"direction"));
206 206 }
207 207  
... ... @@ -266,6 +266,26 @@ static void action_reset_toggle(GtkAction *action, GtkWidget *widget)
266 266 lib3270_set_toggle(GTK_V3270(widget)->host,id,0);
267 267 }
268 268  
  269 +static void action_select_all(GtkAction *action, GtkWidget *widget)
  270 +{
  271 + lib3270_selectall(GTK_V3270(widget)->host);
  272 +}
  273 +
  274 +static void action_select_field(GtkAction *action, GtkWidget *widget)
  275 +{
  276 + lib3270_selectfield(GTK_V3270(widget)->host);
  277 +}
  278 +
  279 +static void action_select_none(GtkAction *action, GtkWidget *widget)
  280 +{
  281 + lib3270_unselect(GTK_V3270(widget)->host);
  282 +}
  283 +
  284 +static void action_select_last(GtkAction *action, GtkWidget *widget)
  285 +{
  286 + lib3270_reselect(GTK_V3270(widget)->host);
  287 +}
  288 +
269 289 static int id_from_array(const gchar *key, const gchar **array, GError **error)
270 290 {
271 291 int f;
... ... @@ -452,6 +472,26 @@ GtkAction * ui_get_action(GtkWidget *widget, const gchar *name, GHashTable *hash
452 472 if(id < 0)
453 473 return NULL;
454 474 }
  475 + else if(!g_strcasecmp(name,"select"))
  476 + {
  477 + static const gchar * src[] = { "all",
  478 + "field",
  479 + "none",
  480 + "last",
  481 + NULL
  482 + };
  483 +
  484 + static const GCallback cbk[] = { G_CALLBACK(action_select_all),
  485 + G_CALLBACK(action_select_field),
  486 + G_CALLBACK(action_select_none),
  487 + G_CALLBACK(action_select_last)
  488 + };
  489 + callback = cbk;
  490 + action_type = ACTION_TYPE_TABLE;
  491 + id = get_attribute_id(name,"target",&nm,src,names,values,error);
  492 + if(id < 0)
  493 + return NULL;
  494 + }
455 495 else if(!g_strcasecmp(name,"save"))
456 496 {
457 497 static const GCallback cbk[] = { G_CALLBACK(save_all_action),
... ...
src/gtk/main.c
... ... @@ -73,10 +73,44 @@ static int popup_handler(H3270 *session, LIB3270_NOTIFY type, const char *title,
73 73 return 0;
74 74 }
75 75  
  76 +static int initialize(void)
  77 +{
  78 + const gchar * msg = gtk_check_version(GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
  79 +
  80 + if(msg)
  81 + {
  82 + // Invalid GTK version, notify user
  83 + int rc;
  84 + GtkWidget *dialog = gtk_message_dialog_new( NULL,
  85 + GTK_DIALOG_DESTROY_WITH_PARENT,
  86 + GTK_MESSAGE_WARNING,
  87 + GTK_BUTTONS_OK_CANCEL,
  88 + _( "This program requires GTK version %d.%d.%d" ),GTK_MAJOR_VERSION,GTK_MINOR_VERSION,GTK_MICRO_VERSION );
  89 +
  90 +
  91 + gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),"%s",msg);
  92 + gtk_window_set_title(GTK_WINDOW(dialog),_( "GTK Version mismatch" ));
  93 +
  94 +#if GTK_CHECK_VERSION(2,10,0)
  95 + gtk_window_set_deletable(GTK_WINDOW(dialog),FALSE);
  96 +#endif
  97 +
  98 + rc = gtk_dialog_run(GTK_DIALOG (dialog));
  99 + gtk_widget_destroy(dialog);
  100 +
  101 + if(rc != GTK_RESPONSE_OK)
  102 + return EINVAL;
  103 + }
  104 +
  105 +}
  106 +
76 107 int main (int argc, char *argv[])
77 108 {
78 109 gtk_init(&argc, &argv);
79 110  
  111 + if(!initialize())
  112 + return -1;
  113 +
80 114 configuration_init();
81 115 lib3270_set_popup_handler(popup_handler);
82 116  
... ...
src/gtk/v3270/draw.c
... ... @@ -18,7 +18,7 @@
18 18 * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple
19 19 * Place, Suite 330, Boston, MA, 02111-1307, USA
20 20 *
21   - * Este programa está nomeado como widget.c e possui - linhas de código.
  21 + * Este programa está nomeado como draw.c e possui - linhas de código.
22 22 *
23 23 * Contatos:
24 24 *
... ...
src/gtk/v3270/widget.c
... ... @@ -115,6 +115,12 @@ static void v3270_toggle_changed(v3270 *widget,LIB3270_TOGGLE toggle_id, gboolea
115 115 v3270_cursor_draw(widget);
116 116 break;
117 117  
  118 + case LIB3270_TOGGLE_BOLD:
  119 + widget->font_weight = lib3270_get_toggle(widget->host,LIB3270_TOGGLE_BOLD) ? CAIRO_FONT_WEIGHT_BOLD : CAIRO_FONT_WEIGHT_NORMAL;
  120 + v3270_reload(GTK_WIDGET(widget));
  121 + gtk_widget_queue_draw(GTK_WIDGET(widget));
  122 + break;
  123 +
118 124 default:
119 125 return;
120 126  
... ... @@ -860,7 +866,7 @@ void v3270_set_font_family(GtkWidget *widget, const gchar *name)
860 866 trace("%s(%s)",__FUNCTION__,name);
861 867  
862 868 terminal->font_family = g_strdup(name);
863   - terminal->font_weight = CAIRO_FONT_WEIGHT_NORMAL;
  869 + terminal->font_weight = lib3270_get_toggle(terminal->host,LIB3270_TOGGLE_BOLD) ? CAIRO_FONT_WEIGHT_BOLD : CAIRO_FONT_WEIGHT_NORMAL;
864 870  
865 871 g_signal_emit(widget,v3270_widget_signal[SIGNAL_UPDATE_CONFIG], 0, "font-family", name);
866 872  
... ...
src/include/lib3270.h
... ... @@ -18,7 +18,7 @@
18 18 * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple
19 19 * Place, Suite 330, Boston, MA, 02111-1307, USA
20 20 *
21   - * Este programa está nomeado como lib3270.h e possui 38 linhas de código.
  21 + * Este programa está nomeado como lib3270.h e possui - linhas de código.
22 22 *
23 23 * Contatos:
24 24 *
... ...
src/include/lib3270/config.h.in
... ... @@ -40,6 +40,8 @@
40 40 #undef HAVE_GNUC_VISIBILITY
41 41 #undef HAVE_LIBM
42 42  
  43 + #undef HAVE_GNOME
  44 +
43 45 #undef HAVE_LIBSSL
44 46  
45 47 /* Optional parts. */
... ...
ui/00default.xml
... ... @@ -25,7 +25,6 @@
25 25 erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
26 26 licinio@bb.com.br (Licínio Luis Branco)
27 27 kraucer@bb.com.br (Kraucer Fernandes Mazuco)
28   - macmiranda@bb.com.br (Marco Aurélio Caldas Miranda)
29 28  
30 29 ------------------------------------------------------------------------------>
31 30  
... ... @@ -50,19 +49,20 @@
50 49  
51 50 <menu name='EditMenu' label='_Edit' >
52 51 <menuitem action='copy' mode='begin' key='<ctrl>c' icon='copy' group='selection' label='Copy' />
53   - <menuitem action='copy' mode='table' key='<ctrl><alt>c' group='selection' label='Copy as table' />
54   - <menuitem action='copy' mode='image' group='selection' label='Copy as image' />
  52 + <!-- menuitem action='copy' mode='table' key='<ctrl><alt>c' group='selection' label='Copy as table' /-->
  53 + <!-- menuitem action='copy' mode='image' group='selection' label='Copy as image' /-->
55 54 <menuitem action='copy' mode='append' key='<shift><ctrl>c' group='selection' label='Add to copy' />
56 55 <menuitem action='paste' src='clipboard' key='<ctrl>v' icon='paste' group='paste' label='Paste' />
57 56 <menuitem action='paste' src='next' key='<shift><ctrl>v' label='Paste next' />
  57 +
  58 + <!-- If you want to paste a predefined file use the attribute filename='FULL_PATH' -->
58 59 <menuitem action='paste' src='file' group='online' label='Paste text file' />
59 60  
60 61 <separator/>
61   - <menuitem action='selectall' key='<ctrl>a' icon='select-all' group='online' label='Select all' />
62   -
63   - <menuitem action='selectfield' key='<Ctrl>f' group='online' label='Select Field' />
64   - <menuitem action='unselect' group='selection' label='Remove selection' />
65   - <menuitem action='reselect' key='<Ctrl>r' group='online' label='Reselect' />
  62 + <menuitem action='select' target='all' key='<ctrl>a' icon='select-all' group='online' label='Select all' />
  63 + <menuitem action='select' target='field' key='<Ctrl>f' group='online' label='Select Field' />
  64 + <menuitem action='select' target='none' group='selection' label='Remove selection' />
  65 + <menuitem action='select' target='last' key='<Ctrl>r' group='online' label='Reselect' />
66 66  
67 67 <separator/>
68 68 <menuitem action='clear' group='online' key='Pause' label='Clear' />
... ... @@ -154,8 +154,8 @@
154 154 <popup name='selectionpopup' type='selection'>
155 155 <menuitem action='copy' mode='begin' />
156 156 <menuitem action='copy' mode='append' />
157   - <menuitem action='unselect'/>
158   - <menuitem action='selectall'/>
  157 + <menuitem action='select' target='none'/>
  158 + <menuitem action='select' target='all'/>
159 159  
160 160 <separator />
161 161 <menuitem action='print' src='all'/>
... ... @@ -169,26 +169,33 @@
169 169 <popup name='defaultpopup' type='default'>
170 170 <menuitem action='paste' src='clipboard'/>
171 171 <menuitem action='paste' src='next'/>
172   - <menuitem action='selectall'/>
  172 + <menuitem action='select' target='all'/>
173 173 <menuitem action='print' src='all'/>
174 174 <menuitem action='print' src='copy'/>
175 175  
176 176 <separator />
177 177 <menuitem action='backtab' label='Previous field' />
178 178 <menuitem action='tab' label='Next field'/>
179   - <menuitem action='activate' label='Return' />
  179 + <menuitem name="return" action='activate' label='Return' key='return' />
180 180  
181 181 <separator />
182 182 <menuitem action='Quit'/>
183 183  
184 184 </popup>
185 185  
  186 + <popup name='connectpopup' type='offline'>
  187 +
  188 + <menuitem action='connect' />
  189 + <menuitem action='Quit'/>
  190 +
  191 + </popup>
  192 +
186 193 <accelerator action='toggle' id='insert' key='Insert' group='online' />
187 194  
188 195 <accelerator action='Home' key='Home' group='online' />
189 196 <!-- accelerator action='Reset' key='<Shift><Ctrl>r' group='online' /-->
190   - <accelerator action='Return' key='Return' />
191   - <accelerator action='Enter' key='KP_Enter' />
  197 + <!-- accelerator name="return" action='activate' key='return' /-->
  198 + <accelerator name="KP_enter" action='activate' key='KP_Enter' />
192 199 <accelerator action='Break' key='Escape' group='online' />
193 200 <accelerator action='Attn' key='<shift>Escape' group='online' />
194 201  
... ... @@ -215,8 +222,8 @@
215 222 <accelerator action='move' target='cursor' direction='up' key='Up' group='online' />
216 223 <accelerator action='move' target='cursor' direction='down' key='Down' group='online' />
217 224  
218   - <accelerator action='PreviousField' key='ISO_Left_Tab' group='online' />
219   - <accelerator action='NextField' key='Tab' group='online' />
  225 + <accelerator action='PreviousField' key='ISO_Left_Tab' group='online' label='Previous field' />
  226 + <accelerator action='NextField' key='Tab' group='online' label='Next field'/>
220 227  
221 228 <accelerator action='dup' key='<Shift>KP_Multiply' group='online' />
222 229  
... ...