diff -ur xfce4-xkb-plugin-0.5.3.3/panel-plugin/xfce4-xkb-plugin.c xfce4-xkb-plugin-0.5.3.3-mod//panel-plugin/xfce4-xkb-plugin.c --- xfce4-xkb-plugin-0.5.3.3/panel-plugin/xfce4-xkb-plugin.c 2009-03-06 16:16:03.000000000 +0300 +++ xfce4-xkb-plugin-0.5.3.3-mod//panel-plugin/xfce4-xkb-plugin.c 2010-06-12 21:38:27.575044293 +0400 @@ -259,6 +259,7 @@ xfce_rc_set_group (rcfile, NULL); xfce_rc_write_int_entry (rcfile, "display_type", xkb->display_type); + xfce_rc_write_int_entry (rcfile, "display_textsize", xkb->display_textsize); xfce_rc_write_int_entry (rcfile, "group_policy", xkb->settings->group_policy); xfce_rc_write_int_entry (rcfile, "default_group", xkb->settings->default_group); xfce_rc_write_bool_entry (rcfile, "never_modify_config", xkb->settings->never_modify_config); @@ -291,6 +292,7 @@ xfce_rc_set_group (rcfile, NULL); xkb->display_type = xfce_rc_read_int_entry (rcfile, "display_type", DISPLAY_TYPE_IMAGE); + xkb->display_textsize = xfce_rc_read_int_entry (rcfile, "display_textsize", DISPLAY_TEXTSIZE_SMALL); xkb->settings->group_policy = xfce_rc_read_int_entry (rcfile, "group_policy", GROUP_POLICY_PER_APPLICATION); if (xkb->settings->group_policy != GROUP_POLICY_GLOBAL) @@ -322,6 +324,7 @@ xkb_load_default (t_xkb *xkb) { xkb->display_type = DISPLAY_TYPE_IMAGE; + xkb->display_textsize = DISPLAY_TEXTSIZE_SMALL; xkb->settings->group_policy = GROUP_POLICY_PER_APPLICATION; xkb->settings->default_group = 0; xkb->settings->kbd_config = NULL; diff -ur xfce4-xkb-plugin-0.5.3.3/panel-plugin/xfce4-xkb-plugin.h xfce4-xkb-plugin-0.5.3.3-mod//panel-plugin/xfce4-xkb-plugin.h --- xfce4-xkb-plugin-0.5.3.3/panel-plugin/xfce4-xkb-plugin.h 2009-03-06 16:16:03.000000000 +0300 +++ xfce4-xkb-plugin-0.5.3.3-mod//panel-plugin/xfce4-xkb-plugin.h 2010-06-12 21:40:53.015045394 +0400 @@ -42,6 +42,13 @@ DISPLAY_TYPE_TEXT = 1 } t_display_type; +typedef enum +{ + DISPLAY_TEXTSIZE_SMALL = 0, + DISPLAY_TEXTSIZE_MEDIUM = 1, + DISPLAY_TEXTSIZE_LARGE = 2 +} t_display_textsize; + typedef struct { XfcePanelPlugin *plugin; @@ -53,6 +60,7 @@ gint button_vsize; /* read allocated button size - see below */ t_display_type display_type; /* display layout as image ot text */ + t_display_textsize display_textsize; /* text size when layout displayed as text */ t_xkb_settings *settings; /* per-app setting and default group */ gint button_state; /* gtk state of the button */ diff -ur xfce4-xkb-plugin-0.5.3.3/panel-plugin/xkb-cairo.c xfce4-xkb-plugin-0.5.3.3-mod//panel-plugin/xkb-cairo.c --- xfce4-xkb-plugin-0.5.3.3/panel-plugin/xkb-cairo.c 2009-03-06 16:16:03.000000000 +0300 +++ xfce4-xkb-plugin-0.5.3.3-mod//panel-plugin/xkb-cairo.c 2010-06-12 22:14:36.167045431 +0400 @@ -31,6 +31,7 @@ #include "xkb-cairo.h" #include "xkb-util.h" +#include "xfce4-xkb-plugin.h" #define XKB_PREFERRED_FONT "Courier New, Courier 10 Pitch, Monospace Bold %d" @@ -50,23 +51,6 @@ cairo_device_to_user (cr, &xx, &yy); \ cairo_move_to (cr, xx, yy); -gint font_sizes[113] = { - 6, 6, 6, 6, 6, 6, 6, 6, - 7, 7, 8, 8, 8, 8, 8, 8, - 10, 10, 10, 10, 12, 12, 14, 14, - 14, 14, 14, 14, 16, 16, 16, 16, - 18, 18, 18, 18, 20, 20, 20, 20, - 20, 20, 22, 22, 22, 22, 24, 24, - 24, 24, 26, 26, 26, 26, 28, 28, - 28, 28, 30, 30, 30, 30, 30, 30, - 32, 32, 32, 32, 34, 34, 34, 34, - 34, 34, 36, 36, 36, 36, 36, 36, - 38, 38, 38, 38, 38, 38, 38, 38, - 40, 40, 40, 40, 40, 40, 42, 42, - 42, 42, 42, 42, 44, 44, 44, 44, - 44, 44, 46, 46, 46, 46, 46, 46, - 48 -}; void xkb_cairo_draw_flag (cairo_t *cr, @@ -98,6 +82,7 @@ actual_width, actual_height, width, height, variant_markers_count, + DISPLAY_TEXTSIZE_SMALL, fgcolor); return; } @@ -151,6 +136,7 @@ gint width, gint height, gint variant_markers_count, + gint textsize, GdkColor fgcolor) { g_assert (cr != NULL); @@ -170,7 +156,19 @@ layout = pango_cairo_create_layout (cr); pango_layout_set_text (layout, normalized_group_name, -1); - g_sprintf (font_str, XKB_PREFERRED_FONT, font_sizes[panel_size - 16]); + switch (textsize){ + case DISPLAY_TEXTSIZE_SMALL: + default: /* catch misconfiguration */ + g_sprintf (font_str, XKB_PREFERRED_FONT, (int)(0.375 * panel_size) ); + break; + case DISPLAY_TEXTSIZE_MEDIUM: + g_sprintf (font_str, XKB_PREFERRED_FONT, (int)(0.600 * panel_size) ); + break; + case DISPLAY_TEXTSIZE_LARGE: + g_sprintf (font_str, XKB_PREFERRED_FONT, (int)(0.900 * panel_size) ); + break; + } + desc = pango_font_description_from_string (font_str); pango_layout_set_font_description (layout, desc); pango_font_description_free (desc); diff -ur xfce4-xkb-plugin-0.5.3.3/panel-plugin/xkb-cairo.h xfce4-xkb-plugin-0.5.3.3-mod//panel-plugin/xkb-cairo.h --- xfce4-xkb-plugin-0.5.3.3/panel-plugin/xkb-cairo.h 2009-03-06 16:16:03.000000000 +0300 +++ xfce4-xkb-plugin-0.5.3.3-mod//panel-plugin/xkb-cairo.h 2010-06-12 22:00:22.930047850 +0400 @@ -48,6 +48,7 @@ gint width, gint height, gint variant_markers_count, + gint textsize, GdkColor fgcolor); #endif diff -ur xfce4-xkb-plugin-0.5.3.3/panel-plugin/xkb-callbacks.c xfce4-xkb-plugin-0.5.3.3-mod//panel-plugin/xkb-callbacks.c --- xfce4-xkb-plugin-0.5.3.3/panel-plugin/xkb-callbacks.c 2009-03-06 16:16:03.000000000 +0300 +++ xfce4-xkb-plugin-0.5.3.3-mod//panel-plugin/xkb-callbacks.c 2010-06-12 22:01:59.887046026 +0400 @@ -132,7 +132,8 @@ xfce_panel_plugin_get_size (xkb->plugin), actual_hsize, actual_vsize, xkb->hsize, xkb->vsize, - xkb_config_variant_index_for_group (-1), + xkb_config_variant_index_for_group (-1), + xkb->display_textsize, fgcolor ); } diff -ur xfce4-xkb-plugin-0.5.3.3/panel-plugin/xkb-settings-dialog.c xfce4-xkb-plugin-0.5.3.3-mod//panel-plugin/xkb-settings-dialog.c --- xfce4-xkb-plugin-0.5.3.3/panel-plugin/xkb-settings-dialog.c 2009-03-06 16:16:03.000000000 +0300 +++ xfce4-xkb-plugin-0.5.3.3-mod//panel-plugin/xkb-settings-dialog.c 2010-06-12 21:43:31.391043889 +0400 @@ -88,6 +88,13 @@ xkb_refresh_gui (xkb); } +void +on_display_textsize_changed (GtkComboBox *cb, t_xkb *xkb) +{ + xkb->display_textsize = gtk_combo_box_get_active (cb); + xkb_refresh_gui (xkb); +} + void on_group_policy_changed (GtkComboBox *cb, t_xkb *xkb) { @@ -448,6 +455,7 @@ { GtkWidget *display_type_optmenu, *group_policy_combo; GtkWidget *vbox, *display_type_frame, *group_policy_frame; + GtkWidget *display_textsize_frame, *display_textsize_optmenu; GtkCellRenderer *renderer, *renderer2; @@ -639,6 +647,18 @@ gtk_combo_box_append_text (GTK_COMBO_BOX (display_type_optmenu), _("text")); gtk_widget_set_size_request (display_type_optmenu, 230, -1); xfce_framebox_add (XFCE_FRAMEBOX (display_type_frame), display_type_optmenu); + + /* text size option */ + display_textsize_frame = xfce_framebox_new (_("Text size:"), TRUE); + gtk_widget_show (display_textsize_frame); + gtk_box_pack_start (GTK_BOX (vbox), display_textsize_frame, TRUE, TRUE, 2); + display_textsize_optmenu = gtk_combo_box_new_text (); + gtk_combo_box_append_text (GTK_COMBO_BOX (display_textsize_optmenu), _("small")); + gtk_combo_box_append_text (GTK_COMBO_BOX (display_textsize_optmenu), _("medium")); + gtk_combo_box_append_text (GTK_COMBO_BOX (display_textsize_optmenu), _("large")); + gtk_widget_set_size_request(display_textsize_optmenu, 230, -1); + xfce_framebox_add (XFCE_FRAMEBOX (display_textsize_frame), display_textsize_optmenu); + group_policy_frame = xfce_framebox_new (_("Manage layout:"), TRUE); gtk_widget_show (group_policy_frame); @@ -658,10 +678,11 @@ G_CALLBACK (on_settings_close), xkb); gtk_combo_box_set_active (GTK_COMBO_BOX (display_type_optmenu), xkb->display_type); - + gtk_combo_box_set_active (GTK_COMBO_BOX (display_textsize_optmenu), xkb->display_textsize); gtk_combo_box_set_active (GTK_COMBO_BOX (group_policy_combo), xkb->settings->group_policy); g_signal_connect (display_type_optmenu, "changed", G_CALLBACK (on_display_type_changed), xkb); + g_signal_connect (display_textsize_optmenu, "changed", G_CALLBACK (on_display_textsize_changed), xkb); g_signal_connect (group_policy_combo, "changed", G_CALLBACK (on_group_policy_changed), xkb); g_signal_connect (xkb->add_layout_btn, "clicked", G_CALLBACK (xkb_settings_add_layout), xkb);