Commit 3798a669aa7799d6b0647dd5d60b866748d25cd5
1 parent
25c36ce4
Exists in
master
and in
5 other branches
Criando dialogo para configuracao de fonte
Showing
5 changed files
with
55 additions
and
17 deletions
Show diff stats
src/pw3270/actions.c
... | ... | @@ -246,19 +246,20 @@ static void connect_standard_action(GtkAction *action, GtkWidget *widget, const |
246 | 246 | } |
247 | 247 | gtk_action[] = |
248 | 248 | { |
249 | - { "activate", activate_action }, | |
250 | - { "reload", reload_action }, | |
251 | - { "connect", connect_action }, | |
252 | - { "disconnect", disconnect_action }, | |
253 | - { "hostname", hostname_action }, | |
254 | - { "editcolors", editcolors_action }, | |
255 | - { "about", about_dialog_action }, | |
256 | - { "kpsubtract", kp_subtract_action }, | |
257 | - { "kpadd", kp_add_action }, | |
258 | - { "download", download_action }, | |
259 | - { "upload", upload_action }, | |
249 | + { "activate", activate_action }, | |
250 | + { "reload", reload_action }, | |
251 | + { "connect", connect_action }, | |
252 | + { "disconnect", disconnect_action }, | |
253 | + { "hostname", hostname_action }, | |
254 | + { "editcolors", editcolors_action }, | |
255 | + { "printsettings", print_settings_action }, | |
256 | + { "about", about_dialog_action }, | |
257 | + { "kpsubtract", kp_subtract_action }, | |
258 | + { "kpadd", kp_add_action }, | |
259 | + { "download", download_action }, | |
260 | + { "upload", upload_action }, | |
260 | 261 | #ifdef DEBUG |
261 | - { "copyashtml", copy_as_html_action }, | |
262 | + { "copyashtml", copy_as_html_action }, | |
262 | 263 | #endif // DEBUG |
263 | 264 | }; |
264 | 265 | ... | ... |
src/pw3270/colors.c
... | ... | @@ -411,7 +411,7 @@ static void load_color_scheme(GKeyFile *conf, const gchar *group, GdkColor *clr) |
411 | 411 | |
412 | 412 | const gchar * title = g_object_get_data(G_OBJECT(action),"title"); |
413 | 413 | GtkWidget * dialog = gtk_dialog_new_with_buttons ( gettext(title ? title : N_( "Color setup") ), |
414 | - NULL, | |
414 | + gtk_widget_get_toplevel(widget), | |
415 | 415 | GTK_DIALOG_DESTROY_WITH_PARENT, |
416 | 416 | GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, |
417 | 417 | GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, | ... | ... |
src/pw3270/globals.h
... | ... | @@ -76,6 +76,7 @@ |
76 | 76 | G_GNUC_INTERNAL void about_dialog_action(GtkAction *action, GtkWidget *widget); |
77 | 77 | G_GNUC_INTERNAL void download_action(GtkAction *action, GtkWidget *widget); |
78 | 78 | G_GNUC_INTERNAL void upload_action(GtkAction *action, GtkWidget *widget); |
79 | + G_GNUC_INTERNAL void print_settings_action(GtkAction *action, GtkWidget *widget); | |
79 | 80 | |
80 | 81 | // plugins |
81 | 82 | G_GNUC_INTERNAL void init_plugins(GtkWidget *widget); | ... | ... |
src/pw3270/print.c
... | ... | @@ -289,6 +289,9 @@ static gchar * enum_to_string(GType type, guint enum_value) |
289 | 289 | pango_font_description_free(descr); |
290 | 290 | |
291 | 291 | set_string_to_config("print","font",name); |
292 | + set_integer_to_config("print","fontsize",info->fontsize); | |
293 | + set_integer_to_config("print","fontweight",info->fontweight); | |
294 | + | |
292 | 295 | trace("Font set to \"%s\" with size %d",info->font,info->fontsize); |
293 | 296 | } |
294 | 297 | |
... | ... | @@ -299,16 +302,18 @@ static gchar * enum_to_string(GType type, guint enum_value) |
299 | 302 | set_boolean_to_config("print","selection",active); |
300 | 303 | } |
301 | 304 | |
302 | - static void load_settings(PRINT_INFO *i) | |
305 | + static void load_settings(PRINT_INFO *info) | |
303 | 306 | { |
304 | 307 | gchar *ptr = get_string_from_config("print","colors",""); |
305 | 308 | |
306 | - i->font = get_string_from_config("print","font","Courier 10"); | |
309 | + info->font = get_string_from_config("print","font","Courier New 10"); | |
310 | + info->fontsize = get_integer_from_config("print","fontsize",10240); | |
311 | + info->fontweight = get_integer_from_config("print","fontweight",0); | |
307 | 312 | |
308 | 313 | if(*ptr) |
309 | - v3270_set_color_table(i->color,ptr); | |
314 | + v3270_set_color_table(info->color,ptr); | |
310 | 315 | else |
311 | - v3270_set_mono_color_table(i->color,"black","white"); | |
316 | + v3270_set_mono_color_table(info->color,"black","white"); | |
312 | 317 | g_free(ptr); |
313 | 318 | } |
314 | 319 | |
... | ... | @@ -639,3 +644,33 @@ static gchar * enum_to_string(GType type, guint enum_value) |
639 | 644 | gtk_print_operation_run(print,oper,GTK_WINDOW(gtk_widget_get_toplevel(widget)),NULL); |
640 | 645 | g_object_unref(print); |
641 | 646 | } |
647 | + | |
648 | +void print_settings_action(GtkAction *action, GtkWidget *terminal) | |
649 | +{ | |
650 | + const gchar * title = g_object_get_data(G_OBJECT(action),"title"); | |
651 | + PRINT_INFO info; | |
652 | + GtkWidget * widget; | |
653 | + GtkWidget * dialog = gtk_dialog_new_with_buttons ( gettext(title ? title : N_( "Print settings") ), | |
654 | + gtk_widget_get_toplevel(terminal), | |
655 | + GTK_DIALOG_DESTROY_WITH_PARENT, | |
656 | + GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, | |
657 | + GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, | |
658 | + NULL ); | |
659 | + | |
660 | + memset(&info,0,sizeof(info)); | |
661 | + | |
662 | + widget = create_custom_widget(NULL,&info); | |
663 | + | |
664 | + gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),GTK_WIDGET(widget),TRUE,TRUE,2); | |
665 | + | |
666 | + if(gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) | |
667 | + { | |
668 | + // Accepted, save settings | |
669 | + custom_widget_apply(NULL,widget,&info); | |
670 | + } | |
671 | + | |
672 | + gtk_widget_destroy(dialog); | |
673 | + | |
674 | +} | |
675 | + | |
676 | + | ... | ... |
ui/99debug.xml
... | ... | @@ -48,6 +48,7 @@ |
48 | 48 | <menuitem action='testpattern' group='offline' label='Show test pattern' /> |
49 | 49 | <menuitem action='reload' label='Reload buffer contents' /> |
50 | 50 | <menuitem action='toggle' id='gdkdebug' label='Debug window updates' /> |
51 | + <menuitem action='printsettings' label='Print settings' /> | |
51 | 52 | </menu> |
52 | 53 | |
53 | 54 | </menubar> | ... | ... |