[maemo-commits] [maemo-commits] r9310 - in projects/haf/trunk/sapwood: . src
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Wed Jan 24 17:23:13 EET 2007
- Previous message: [maemo-commits] r9309 - projects/haf/branches/hildon-fm/1.x/hildon-fm
- Next message: [maemo-commits] r9311 - in projects/haf/trunk/hildon-initscripts: . debian
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: tko Date: 2007-01-24 17:23:10 +0200 (Wed, 24 Jan 2007) New Revision: 9310 Modified: projects/haf/trunk/sapwood/ChangeLog projects/haf/trunk/sapwood/src/sapwood-draw.c projects/haf/trunk/sapwood/src/sapwood-rc-style.c projects/haf/trunk/sapwood/src/theme-pixbuf.h Log: Implement dialog buttons using explicit "position" keyword. 2007-01-24 Tommi Komulainen <tommi.komulainen at nokia.com> Implement dialog buttons using explicit "position" keyword. The position is calculated only for buttons in button boxes for now. Specific graphics can be applied with something like: position = LEFT,TOP,RIGHT,BOTTOM (solitary) position = TOP,LEFT,BOTTOM (leftmost) position = TOP,BOTTOM (middle) position = TOP,RIGHT,BOTTOM (rightmost) * src/sapwood-draw.c (match_theme_image): check position flags (maybe_set_dialog_button_details, draw_simple_image): rename maybe_set_dialog_button_details to maybe_check_button_position (maybe_check_button_position): don't check or modify the detail, instead use the position match flags * src/sapwood-rc-style.c (theme_symbols): add "position" (theme_parse_position): parse "position = LEFT,RIGHT,TOP,BOTTOM" (theme_parse_image): parse "position" * src/theme-pixbuf.h: add TOKEN_POSITION and ThemePositionfFlags (ThemeMatchFlags): add THEME_MATCH_POSITION (ThemeMatchData): increase the flags size to hold 'THEME_MATCH_POSITION' and add ThemePositionfFlags Modified: projects/haf/trunk/sapwood/ChangeLog =================================================================== --- projects/haf/trunk/sapwood/ChangeLog 2007-01-24 15:17:55 UTC (rev 9309) +++ projects/haf/trunk/sapwood/ChangeLog 2007-01-24 15:23:10 UTC (rev 9310) @@ -1,5 +1,28 @@ 2007-01-24 Tommi Komulainen <tommi.komulainen at nokia.com> + Implement dialog buttons using explicit "position" keyword. The + position is calculated only for buttons in button boxes for now. + Specific graphics can be applied with something like: + position = LEFT,TOP,RIGHT,BOTTOM (solitary) + position = TOP,LEFT,BOTTOM (leftmost) + position = TOP,BOTTOM (middle) + position = TOP,RIGHT,BOTTOM (rightmost) + + * src/sapwood-draw.c (match_theme_image): check position flags + (maybe_set_dialog_button_details, draw_simple_image): rename + maybe_set_dialog_button_details to maybe_check_button_position + (maybe_check_button_position): don't check or modify the detail, + instead use the position match flags + * src/sapwood-rc-style.c (theme_symbols): add "position" + (theme_parse_position): parse "position = LEFT,RIGHT,TOP,BOTTOM" + (theme_parse_image): parse "position" + * src/theme-pixbuf.h: add TOKEN_POSITION and ThemePositionfFlags + (ThemeMatchFlags): add THEME_MATCH_POSITION + (ThemeMatchData): increase the flags size to hold + 'THEME_MATCH_POSITION' and add ThemePositionfFlags + +2007-01-24 Tommi Komulainen <tommi.komulainen at nokia.com> + Adjust the detail for buttons in button boxes depending on the button position inside the button box for enhanced theming (special rounding for outmost button edges.) For horizontal button box we use the Modified: projects/haf/trunk/sapwood/src/sapwood-draw.c =================================================================== --- projects/haf/trunk/sapwood/src/sapwood-draw.c 2007-01-24 15:17:55 UTC (rev 9309) +++ projects/haf/trunk/sapwood/src/sapwood-draw.c 2007-01-24 15:23:10 UTC (rev 9310) @@ -61,6 +61,10 @@ match_data->state != image->match_data.state) continue; + if ((flags & THEME_MATCH_POSITION) && + match_data->position != image->match_data.position) + continue; + if ((flags & THEME_MATCH_SHADOW) && match_data->shadow != image->match_data.shadow) continue; @@ -103,7 +107,7 @@ } static void -maybe_set_dialog_button_details (GtkWidget *button, ThemeMatchData *match_data) +maybe_check_button_position (GtkWidget *button, ThemeMatchData *match_data) { GtkWidget *bbox; gboolean secondary; @@ -112,11 +116,6 @@ GtkWidget *last = NULL; GList *list; - if (!match_data->detail || - (strcmp (match_data->detail, "button") != 0 && - strcmp (match_data->detail, "buttondefault") != 0)) - return; - bbox = gtk_widget_get_ancestor (button, GTK_TYPE_BUTTON_BOX); if (!bbox) return; @@ -151,27 +150,22 @@ } } + match_data->flags |= THEME_MATCH_POSITION; if (horizontal) { - if (first == button && button == last) /* solitary */ - match_data->detail = "osso_button_nesw"; - else if (first == button) /* left */ - match_data->detail = "osso_button_nsw"; - else if (last == button) /* right */ - match_data->detail = "osso_button_nes"; - else /* middle */ - match_data->detail = "osso_button_ns"; + match_data->position = THEME_POS_TOP | THEME_POS_BOTTOM; + if (first == button) + match_data->position |= THEME_POS_LEFT; + if (last == button) + match_data->position |= THEME_POS_RIGHT; } else { - if (first == button && button == last) /* solitary */ - match_data->detail = "osso_button_nesw"; - else if (first == button) /* top */ - match_data->detail = "osso_button_new"; - else if (last == button) /* bottom */ - match_data->detail = "osso_button_esw"; - else /* middle */ - match_data->detail = "osso_button_ew"; + match_data->position = THEME_POS_LEFT | THEME_POS_RIGHT; + if (first == button) + match_data->position |= THEME_POS_TOP; + if (last == button) + match_data->position |= THEME_POS_BOTTOM; } } @@ -208,7 +202,7 @@ /* Special handling for buttons in dialogs */ if (GTK_IS_BUTTON (widget)) - maybe_set_dialog_button_details (widget, match_data); + maybe_check_button_position (widget, match_data); image = match_theme_image (style, match_data); if (image) Modified: projects/haf/trunk/sapwood/src/sapwood-rc-style.c =================================================================== --- projects/haf/trunk/sapwood/src/sapwood-rc-style.c 2007-01-24 15:17:55 UTC (rev 9309) +++ projects/haf/trunk/sapwood/src/sapwood-rc-style.c 2007-01-24 15:23:10 UTC (rev 9310) @@ -67,6 +67,7 @@ { "overlay_stretch", TOKEN_OVERLAY_STRETCH }, { "arrow_direction", TOKEN_ARROW_DIRECTION }, { "orientation", TOKEN_ORIENTATION }, + { "position", TOKEN_POSITION }, { "HLINE", TOKEN_D_HLINE }, { "VLINE", TOKEN_D_VLINE }, @@ -337,6 +338,45 @@ } static guint +theme_parse_position(GScanner * scanner, + ThemeImage * data) +{ + guint token; + + token = g_scanner_get_next_token(scanner); + if (token != TOKEN_POSITION) + return TOKEN_POSITION; + + token = g_scanner_get_next_token(scanner); + if (token != G_TOKEN_EQUAL_SIGN) + return G_TOKEN_EQUAL_SIGN; + + do + { + token = g_scanner_get_next_token(scanner); + if (token == TOKEN_LEFT) + data->match_data.position |= THEME_POS_LEFT; + else if (token == TOKEN_RIGHT) + data->match_data.position |= THEME_POS_RIGHT; + else if (token == TOKEN_TOP) + data->match_data.position |= THEME_POS_TOP; + else if (token == TOKEN_BOTTOM) + data->match_data.position |= THEME_POS_BOTTOM; + else + return TOKEN_LEFT; + + data->match_data.flags |= THEME_MATCH_POSITION; + + token = g_scanner_peek_next_token(scanner); + if (token == G_TOKEN_COMMA) + token = g_scanner_get_next_token(scanner); + } + while (token == G_TOKEN_COMMA); + + return G_TOKEN_NONE; +} + +static guint theme_parse_state(GScanner * scanner, ThemeImage * data) { @@ -596,6 +636,9 @@ case TOKEN_ORIENTATION: token = theme_parse_orientation(scanner, data); break; + case TOKEN_POSITION: + token = theme_parse_position(scanner, data); + break; case TOKEN_FILE: token = theme_parse_file(settings, scanner, &data->background); break; Modified: projects/haf/trunk/sapwood/src/theme-pixbuf.h =================================================================== --- projects/haf/trunk/sapwood/src/theme-pixbuf.h 2007-01-24 15:17:55 UTC (rev 9309) +++ projects/haf/trunk/sapwood/src/theme-pixbuf.h 2007-01-24 15:23:10 UTC (rev 9310) @@ -98,7 +98,8 @@ TOKEN_ETCHED_OUT, TOKEN_ORIENTATION, TOKEN_HORIZONTAL, - TOKEN_VERTICAL + TOKEN_VERTICAL, + TOKEN_POSITION }; typedef enum @@ -120,9 +121,17 @@ THEME_MATCH_ORIENTATION = 1 << 1, THEME_MATCH_STATE = 1 << 2, THEME_MATCH_SHADOW = 1 << 3, - THEME_MATCH_ARROW_DIRECTION = 1 << 4 + THEME_MATCH_ARROW_DIRECTION = 1 << 4, + THEME_MATCH_POSITION = 1 << 5 } ThemeMatchFlags; +typedef enum { + THEME_POS_LEFT = 1 << 0, /* GTK_POS_LEFT */ + THEME_POS_RIGHT = 1 << 1, /* GTK_POS_RIGHT */ + THEME_POS_TOP = 1 << 2, /* GTK_POS_TOP */ + THEME_POS_BOTTOM = 1 << 3 /* GTK_POS_BOTTOM */ +} ThemePositionFlags; + struct _ThemePixbuf { const char *dirname; @@ -143,7 +152,8 @@ gchar *detail; guint16 function; /* Mandatory */ - ThemeMatchFlags flags : 5; + ThemeMatchFlags flags : 6; + ThemePositionFlags position : 4; GtkStateType state : 3; GtkShadowType shadow : 3; GtkPositionType gap_side : 2;
- Previous message: [maemo-commits] r9309 - projects/haf/branches/hildon-fm/1.x/hildon-fm
- Next message: [maemo-commits] r9311 - in projects/haf/trunk/hildon-initscripts: . debian
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]