Commit 42bf282b35adda105a30e5cd0e6af0bf56233d59

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

Reimplementando a barra de funcoes

pw3270.cbp
... ... @@ -347,6 +347,7 @@
347 347 </Unit>
348 348 <Unit filename="src\tools\Makefile.in" />
349 349 <Unit filename="ui\00default.xml" />
  350 + <Unit filename="ui\10functions.xml" />
350 351 <Unit filename="ui\10keypad.xml" />
351 352 <Unit filename="ui\99debug.xml" />
352 353 <Unit filename="updateChangeLog.sh" />
... ...
src/pw3270/Makefile.in
... ... @@ -191,6 +191,7 @@ $(DEBDIR)/pw3270.install: Makefile
191 191 @echo "$(libdir)/@DLLPREFIX@$(PACKAGE_TARNAME)@DLLEXT@" >> $@
192 192 @echo "$(datarootdir)/$(PACKAGE_NAME)/ui/00default.xml" >> $@
193 193 @echo "$(datarootdir)/$(PACKAGE_NAME)/ui/10keypad.xml" >> $@
  194 + @echo "$(datarootdir)/$(PACKAGE_NAME)/ui/10functions.xml" >> $@
194 195 @echo "$(datarootdir)/$(PACKAGE_NAME)/$(PACKAGE_NAME).png" >> $@
195 196 @echo "$(datarootdir)/$(PACKAGE_NAME)/$(PACKAGE_NAME)-logo.png" >> $@
196 197  
... ...
src/pw3270/uiparser/keypad.c
... ... @@ -210,6 +210,24 @@
210 210  
211 211 }
212 212  
  213 + UI_ATTR_DIRECTION ui_get_position_attribute(const gchar **names, const gchar **values)
  214 + {
  215 + static const gchar * posname[] = { "top", "bottom", "left", "right" };
  216 + const gchar * dir = ui_get_attribute("position",names,values);
  217 + int f;
  218 +
  219 + if(dir)
  220 + {
  221 + for(f=0;f<G_N_ELEMENTS(posname);f++)
  222 + {
  223 + if(!g_ascii_strcasecmp(dir,posname[f]))
  224 + return f;
  225 + }
  226 + }
  227 +
  228 + return UI_ATTR_DIRECTION_NONE;
  229 + }
  230 +
213 231 GObject * ui_create_keypad(GMarkupParseContext *context,GtkAction *action,struct parser *info,const gchar **names, const gchar **values, GError **error)
214 232 {
215 233 static const GMarkupParser parser =
... ... @@ -244,7 +262,7 @@
244 262  
245 263 keypad->parser = info;
246 264 keypad->handle = gtk_handle_box_new();
247   - keypad->pos = ui_get_dir_attribute(names,values);
  265 + keypad->pos = ui_get_position_attribute(names,values);
248 266 keypad->relief = get_relief(names, values, GTK_RELIEF_NORMAL);
249 267  
250 268 switch(keypad->pos)
... ... @@ -284,7 +302,6 @@
284 302 }
285 303 }
286 304  
287   -
288 305 gtk_handle_box_set_shadow_type(GTK_HANDLE_BOX(keypad->handle),GTK_SHADOW_ETCHED_IN);
289 306 gtk_container_add(GTK_CONTAINER(keypad->handle),keypad->box);
290 307  
... ... @@ -297,7 +314,6 @@
297 314 {
298 315 if(widget)
299 316 {
300   - gtk_widget_show_all(widget);
301 317 gtk_table_attach( GTK_TABLE(keypad->table),
302 318 widget,
303 319 keypad->col,keypad->col+keypad->button_width,
... ... @@ -350,8 +366,6 @@
350 366 gtk_box_pack_start(GTK_BOX(keypad->box),keypad->table,FALSE,FALSE,0);
351 367  
352 368 gtk_widget_show_all(keypad->box);
353   - gtk_widget_show_all(keypad->table);
354   - gtk_widget_show_all(keypad->handle);
355 369 }
356 370  
357 371 g_free(keypad);
... ...
src/pw3270/uiparser/parser.c
... ... @@ -85,7 +85,6 @@ static void pack_keypad(gpointer key, GtkWidget *widget, struct keypad *k)
85 85 if(gtk_handle_box_get_handle_position(GTK_HANDLE_BOX(widget)) != k->filter)
86 86 return;
87 87  
88   - gtk_widget_show_all(widget);
89 88 k->pack(GTK_BOX(k->box),widget,FALSE,FALSE,0);
90 89 }
91 90  
... ... @@ -189,9 +188,11 @@ void parser_build(struct parser *p, GtkWidget *widget)
189 188 struct action_info a_info;
190 189  
191 190 #if GTK_CHECK_VERSION(3,0,0)
  191 + GtkWidget * mainBox = gtk_box_new(GTK_ORIENTATION_VERTICAL,0);
192 192 GtkWidget * vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL,0);
193 193 GtkWidget * hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0);
194 194 #else
  195 + GtkWidget * mainBox = gtk_vbox_new(FALSE,0);
195 196 GtkWidget * vbox = gtk_vbox_new(FALSE,0);
196 197 GtkWidget * hbox = gtk_hbox_new(FALSE,0);
197 198 #endif // GTK(3,0,0)
... ... @@ -224,7 +225,7 @@ void parser_build(struct parser *p, GtkWidget *widget)
224 225 g_hash_table_foreach(p->actions,(GHFunc) action_group_setup, &a_info);
225 226  
226 227 // Pack menubars
227   - p->element = G_OBJECT(vbox);
  228 + p->element = G_OBJECT(mainBox);
228 229 g_hash_table_foreach(p->element_list[UI_ELEMENT_MENUBAR],(GHFunc) pack_start, p);
229 230  
230 231 // Pack top toolbars
... ... @@ -247,9 +248,10 @@ void parser_build(struct parser *p, GtkWidget *widget)
247 248 if(widget)
248 249 {
249 250 ui_set_scroll_actions(widget,p->scroll_action);
250   - gtk_box_pack_start(GTK_BOX(hbox),widget,TRUE,TRUE,0);
  251 + gtk_box_pack_start(GTK_BOX(vbox),widget,TRUE,TRUE,0);
251 252 gtk_widget_show(widget);
252 253 }
  254 + gtk_box_pack_start(GTK_BOX(hbox),vbox,TRUE,TRUE,0);
253 255  
254 256 // Pack right keypads
255 257 keypad.filter = GTK_POS_LEFT;
... ... @@ -262,11 +264,12 @@ void parser_build(struct parser *p, GtkWidget *widget)
262 264 g_hash_table_foreach(p->element_list[UI_ELEMENT_KEYPAD],(GHFunc) pack_keypad, &keypad);
263 265  
264 266 // Finish building
265   - gtk_box_pack_start(GTK_BOX(vbox),hbox,TRUE,TRUE,0);
266   - gtk_container_add(GTK_CONTAINER(p->toplevel),vbox);
  267 + gtk_box_pack_start(GTK_BOX(mainBox),hbox,TRUE,TRUE,0);
  268 + gtk_container_add(GTK_CONTAINER(p->toplevel),mainBox);
267 269  
268 270 gtk_widget_show(hbox);
269 271 gtk_widget_show(vbox);
  272 + gtk_widget_show(mainBox);
270 273  
271 274 gtk_window_add_accel_group(GTK_WINDOW(p->toplevel),a_info.accel_group);
272 275  
... ...
ui/10functions.xml 0 → 100644
... ... @@ -0,0 +1,65 @@
  1 +<!-----------------------------------------------------------------------------
  2 +
  3 + "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
  4 + (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
  5 + aplicativos mainframe. Registro no INPI sob o nome G3270.
  6 +
  7 + Copyright (C) <2008> <Banco do Brasil S.A.>
  8 +
  9 + Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
  10 + os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
  11 + Free Software Foundation.
  12 +
  13 + Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
  14 + GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
  15 + A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
  16 + obter mais detalhes.
  17 +
  18 + Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
  19 + programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple
  20 + Place, Suite 330, Boston, MA, 02111-1307, USA
  21 +
  22 + Contatos:
  23 +
  24 + perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
  25 + erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
  26 + licinio@bb.com.br (Licínio Luis Branco)
  27 + kraucer@bb.com.br (Kraucer Fernandes Mazuco)
  28 +
  29 +------------------------------------------------------------------------------>
  30 +
  31 +<ui>
  32 +
  33 + <keypad name="FunctionBar" label="Function bar" position="bottom" relief='half' >
  34 + <row>
  35 + <button action='pfkey' id='1' label='PF1' />
  36 + <button action='pfkey' id='2' label='PF2' />
  37 + <button action='pfkey' id='3' label='PF3' />
  38 + <button action='pfkey' id='4' label='PF4' />
  39 + <button action='pfkey' id='5' label='PF5' />
  40 + <button action='pfkey' id='6' label='PF6' />
  41 + <button action='pfkey' id='7' label='PF7' />
  42 + <button action='pfkey' id='8' label='PF8' />
  43 + <button action='pfkey' id='9' label='PF9' />
  44 + <button action='pfkey' id='10' label='PF10' />
  45 + <button action='pfkey' id='11' label='PF11' />
  46 + <button action='pfkey' id='12' label='PF12' />
  47 + </row>
  48 + <row>
  49 + <button action='pfkey' id='13' label='PF13' />
  50 + <button action='pfkey' id='14' label='PF14' />
  51 + <button action='pfkey' id='15' label='PF15' />
  52 + <button action='pfkey' id='16' label='PF16' />
  53 + <button action='pfkey' id='17' label='PF17' />
  54 + <button action='pfkey' id='18' label='PF18' />
  55 + <button action='pfkey' id='19' label='PF19' />
  56 + <button action='pfkey' id='20' label='PF20' />
  57 + <button action='pfkey' id='21' label='PF21' />
  58 + <button action='pfkey' id='22' label='PF22' />
  59 + <button action='pfkey' id='23' label='PF23' />
  60 + <button action='pfkey' id='24' label='PF24' />
  61 + </row>
  62 +
  63 + </keypad>
  64 +
  65 +</ui>
... ...