Changeset 3021
- Timestamp:
- 09/20/07 19:09:14 (6 years ago)
- Location:
- trunk/src/target/OM-2007.2/libraries/moko-gtk-engine
- Files:
-
- 5 edited
-
ChangeLog (modified) (1 diff)
-
data/gtkrc (modified) (1 diff)
-
src/moko-draw.c (modified) (3 diffs)
-
src/moko-style.c (modified) (3 diffs)
-
src/moko-style.h (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/target/OM-2007.2/libraries/moko-gtk-engine/ChangeLog
r3008 r3021 1 2007-09-20 Thomas Wood <thomas@openedhand.com> 2 3 * data/gtkrc: 4 * src/moko-draw.c: (moko_gradient), (moko_draw_box): 5 * src/moko-style.c: (moko_style_class_init): 6 * src/moko-style.h: 7 8 Add initial support for "border" and "gradient" boolean engine options 9 10 2007-09-20 Thomas Wood <thomas@openedhand.com> 11 12 * moko-gtk-engine/src/moko-draw.c: 13 14 - Adjust gradient stops to give glossed appearance. 15 - Add gradient to "inactive" tabs 16 17 * moko-gtk-engine/src/moko-utils.h: rename from sato-utils.h 18 19 * moko-gtk-engine/data/openmoko-contacts 20 * moko-gtk-engine/data/openmoko-panel-plugins 21 * moko-gtk-engine/data/matchboxpanel 22 * moko-gtk-engine/data/openmoko-dialer 23 * moko-gtk-engine/data/gtkrc 24 * moko-gtk-engine/data/openmoko-calculator 25 * moko-gtk-engine/Makefile.am 26 27 - Add application specific rc files 28 - Tweak colours 29 30 31 2007-09-18 Thomas Wood <thomas@openedhand.com> 32 33 * Rename Sato to Moko 34 * Adjust gradients and remove rounded corners 35 1 36 2007-07-30 Thomas Wood <thomas@openedhand.com> 2 37 -
trunk/src/target/OM-2007.2/libraries/moko-gtk-engine/data/gtkrc
r3012 r3021 85 85 class "GtkWidget" style "default" 86 86 87 style "button" 88 { 89 engine "moko-engine" { 90 border = TRUE 91 } 92 } 93 class "GtkButton" style "button" 94 87 95 style "combo-fix" { 96 bg[NORMAL] = "#ff7d00" 88 97 text[NORMAL] = "white" 89 98 text[PRELIGHT] = "white" 90 99 } 91 class " GtkComboBox" style "combo-fix"100 class "*Combo*" style "combo-fix" 92 101 93 102 style "toolbar" -
trunk/src/target/OM-2007.2/libraries/moko-gtk-engine/src/moko-draw.c
r3012 r3021 59 59 60 60 /* get the start and end colours */ 61 moko_shade_colour (&style->bg[state_type], &c1, 1. 6);61 moko_shade_colour (&style->bg[state_type], &c1, 1.8); 62 62 moko_shade_colour (&style->bg[state_type], &c2, 1.4); 63 moko_shade_colour (&style->bg[state_type], &c3, 1. 2);63 moko_shade_colour (&style->bg[state_type], &c3, 1.3); 64 64 moko_shade_colour (&style->bg[state_type], &c4, 1.0); 65 65 … … 157 157 if (!DETAIL ("menu") && !DETAIL ("trough")) 158 158 moko_gradient (style, window, state_type, x+1, y+1, width-2, height-2); 159 160 161 162 /*** treeview headers ***/163 if (widget && GTK_IS_TREE_VIEW (widget->parent))164 {165 goto exit;166 }167 159 168 160 … … 185 177 186 178 /*** draw the border ***/ 187 if ( !DETAIL ("bar"))179 if (MOKO_RC_STYLE (style->rc_style)->has_border) 188 180 { 189 181 gdk_draw_rectangle (window, gc, FALSE, x + 1, y + 1, width - 2, height - 2); -
trunk/src/target/OM-2007.2/libraries/moko-gtk-engine/src/moko-style.c
r3008 r3021 61 61 { 62 62 GtkStyleClass *style_class = GTK_STYLE_CLASS (klass); 63 63 64 moko_draw_style_class_init (style_class); 64 65 } … … 68 69 /*** Gtk Style RC Class *******************************************************/ 69 70 71 static struct 72 { 73 gchar *name; 74 guint token; 75 } 76 moko_rc_symbols[] = 77 { 78 { "border", TOKEN_HAS_BORDER }, 79 { "gradient", TOKEN_HAS_GRADIENT }, 80 81 { "TRUE", TOKEN_TRUE }, 82 { "FALSE", TOKEN_FALSE } 83 }; 84 70 85 GType moko_type_rc_style = 0; 86 static GtkRcStyleClass *moko_parent_rc_style_class; 71 87 72 88 static GtkStyle *moko_rc_style_create_style (GtkRcStyle *rc_style); 89 static void moko_rc_style_merge (GtkRcStyle *dest, GtkRcStyle *src); 90 static guint moko_rc_style_parse (GtkRcStyle *rc_style, GtkSettings *settings, GScanner *scanner); 73 91 74 92 static void … … 76 94 { 77 95 GtkRcStyleClass *rc_style_class = GTK_RC_STYLE_CLASS (klass); 96 97 moko_parent_rc_style_class = g_type_class_peek_parent (klass); 98 78 99 rc_style_class->create_style = moko_rc_style_create_style; 100 rc_style_class->parse = moko_rc_style_parse; 101 rc_style_class->merge = moko_rc_style_merge; 102 } 103 104 105 static void 106 moko_rc_style_merge (GtkRcStyle *dest, GtkRcStyle *src) 107 { 108 if (MOKO_IS_RC_STYLE (src)) 109 { 110 MokoRcStyle *src_data = MOKO_RC_STYLE (src); 111 MokoRcStyle *dest_data = MOKO_RC_STYLE (dest); 112 113 dest_data->has_border = src_data->has_border; 114 dest_data->has_gradient = src_data->has_gradient; 115 } 116 117 moko_parent_rc_style_class->merge (dest, src); 118 } 119 120 static guint 121 moko_rc_parse_boolean(GScanner *scanner, GTokenType wanted_token, guint *retval) 122 { 123 guint token; 124 125 token = g_scanner_get_next_token(scanner); 126 if (token != wanted_token) 127 return wanted_token; 128 129 token = g_scanner_get_next_token(scanner); 130 if (token != G_TOKEN_EQUAL_SIGN) 131 return G_TOKEN_EQUAL_SIGN; 132 133 token = g_scanner_get_next_token(scanner); 134 if (token == TOKEN_TRUE) 135 *retval = TRUE; 136 else if (token == TOKEN_FALSE) 137 *retval = FALSE; 138 else 139 return TOKEN_TRUE; 140 141 return G_TOKEN_NONE; 142 } 143 144 static guint 145 moko_rc_style_parse (GtkRcStyle *rc_style, GtkSettings *settings, GScanner *scanner) 146 { 147 static GQuark scope_id = 0; 148 MokoRcStyle *theme_data = MOKO_RC_STYLE (rc_style); 149 guint old_scope; 150 guint token; 151 152 /* Set up a our own scope for this scanner */ 153 154 if (!scope_id) 155 scope_id = g_quark_from_string ("moko_gtk_engine"); 156 157 old_scope = g_scanner_set_scope (scanner, scope_id); 158 159 /* check we haven't already added the moko symbols to this scanner */ 160 161 if (!g_scanner_lookup_symbol (scanner, moko_rc_symbols[0].name)) 162 { 163 gint i; 164 for (i = 0; i < G_N_ELEMENTS (moko_rc_symbols); i++) 165 { 166 g_scanner_scope_add_symbol (scanner, scope_id, moko_rc_symbols[i].name, 167 GINT_TO_POINTER (moko_rc_symbols[i].token)); 168 } 169 } 170 171 172 token = g_scanner_peek_next_token (scanner); 173 174 while (token != G_TOKEN_RIGHT_CURLY) 175 { 176 guint i; 177 178 switch (token) 179 { 180 case TOKEN_HAS_BORDER: 181 token = moko_rc_parse_boolean (scanner, TOKEN_HAS_BORDER, &i); 182 if (token != G_TOKEN_NONE) 183 break; 184 theme_data->has_border = i; 185 break; 186 case TOKEN_HAS_GRADIENT: 187 token = moko_rc_parse_boolean (scanner, TOKEN_HAS_GRADIENT, &i); 188 if (token != G_TOKEN_NONE) 189 break; 190 theme_data->has_gradient = i; 191 break; 192 193 default: 194 g_scanner_get_next_token (scanner); 195 token = G_TOKEN_RIGHT_CURLY; 196 break; 197 198 } 199 200 if (token != G_TOKEN_NONE) 201 { 202 return token; 203 } 204 token = g_scanner_peek_next_token (scanner); 205 } 206 207 g_scanner_get_next_token (scanner); 208 g_scanner_set_scope (scanner, old_scope); 209 210 return G_TOKEN_NONE; 79 211 } 80 212 -
trunk/src/target/OM-2007.2/libraries/moko-gtk-engine/src/moko-style.h
r3008 r3021 39 39 40 40 #define MOKO_TYPE_STYLE moko_type_style 41 #define MOKO_STYLE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), POKY_TYPE_STYLE, MokoStyle))42 #define MOKO_STYLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), POKY_TYPE_STYLE, MokoStyleClass))43 #define MOKO_IS_STYLE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), POKY_TYPE_STYLE))44 #define MOKO_IS_STYLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), POKY_TYPE_STYLE))45 #define MOKO_STYLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), POKY_TYPE_STYLE, MokoStyleClass))41 #define MOKO_STYLE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), MOKO_TYPE_STYLE, MokoStyle)) 42 #define MOKO_STYLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOKO_TYPE_STYLE, MokoStyleClass)) 43 #define MOKO_IS_STYLE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), MOKO_TYPE_STYLE)) 44 #define MOKO_IS_STYLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOKO_TYPE_STYLE)) 45 #define MOKO_STYLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOKO_TYPE_STYLE, MokoStyleClass)) 46 46 47 47 typedef struct _MokoStyle MokoStyle; … … 67 67 68 68 #define MOKO_TYPE_RC_STYLE moko_type_rc_style 69 #define MOKO_RC_STYLE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), POKY_TYPE_RC_STYLE, MokoRcStyle))70 #define MOKO_RC_STYLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), POKY_TYPE_RC_STYLE, MokoRcStyleClass))71 #define MOKO_IS_RC_STYLE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), POKY_TYPE_RC_STYLE))72 #define MOKO_IS_RC_STYLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), POKY_TYPE_RC_STYLE))73 #define MOKO_RC_STYLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), POKY_TYPE_RC_STYLE, MokoRcStyleClass))69 #define MOKO_RC_STYLE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), MOKO_TYPE_RC_STYLE, MokoRcStyle)) 70 #define MOKO_RC_STYLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOKO_TYPE_RC_STYLE, MokoRcStyleClass)) 71 #define MOKO_IS_RC_STYLE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), MOKO_TYPE_RC_STYLE)) 72 #define MOKO_IS_RC_STYLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOKO_TYPE_RC_STYLE)) 73 #define MOKO_RC_STYLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOKO_TYPE_RC_STYLE, MokoRcStyleClass)) 74 74 75 75 typedef struct _MokoRcStyle MokoRcStyle; … … 79 79 { 80 80 GtkRcStyle parent_instance; 81 82 gboolean has_border; 83 gboolean has_gradient; 81 84 }; 82 85 … … 84 87 { 85 88 GtkRcStyleClass parent_class; 89 86 90 }; 87 91 88 92 void moko_rc_style_register_type (GTypeModule *engine); 93 94 enum 95 { 96 TOKEN_HAS_BORDER = G_TOKEN_LAST + 1, 97 TOKEN_HAS_GRADIENT, 98 99 TOKEN_TRUE, 100 TOKEN_FALSE 101 }; 89 102 90 103 /******************************************************************************/
Note: See TracChangeset
for help on using the changeset viewer.
