r3021 - in trunk/src/target/OM-2007.2/libraries/moko-gtk-engine: . data src
thomas at sita.openmoko.org
thomas at sita.openmoko.org
Thu Sep 20 19:09:16 CEST 2007
Author: thomas
Date: 2007-09-20 19:09:14 +0200 (Thu, 20 Sep 2007)
New Revision: 3021
Modified:
trunk/src/target/OM-2007.2/libraries/moko-gtk-engine/ChangeLog
trunk/src/target/OM-2007.2/libraries/moko-gtk-engine/data/gtkrc
trunk/src/target/OM-2007.2/libraries/moko-gtk-engine/src/moko-draw.c
trunk/src/target/OM-2007.2/libraries/moko-gtk-engine/src/moko-style.c
trunk/src/target/OM-2007.2/libraries/moko-gtk-engine/src/moko-style.h
Log:
* data/gtkrc:
* src/moko-draw.c: (moko_gradient), (moko_draw_box):
* src/moko-style.c: (moko_style_class_init):
* src/moko-style.h:
Add initial support for "border" and "gradient" boolean engine options
Modified: trunk/src/target/OM-2007.2/libraries/moko-gtk-engine/ChangeLog
===================================================================
--- trunk/src/target/OM-2007.2/libraries/moko-gtk-engine/ChangeLog 2007-09-20 14:00:55 UTC (rev 3020)
+++ trunk/src/target/OM-2007.2/libraries/moko-gtk-engine/ChangeLog 2007-09-20 17:09:14 UTC (rev 3021)
@@ -1,3 +1,38 @@
+2007-09-20 Thomas Wood <thomas at openedhand.com>
+
+ * data/gtkrc:
+ * src/moko-draw.c: (moko_gradient), (moko_draw_box):
+ * src/moko-style.c: (moko_style_class_init):
+ * src/moko-style.h:
+
+ Add initial support for "border" and "gradient" boolean engine options
+
+2007-09-20 Thomas Wood <thomas at openedhand.com>
+
+ * moko-gtk-engine/src/moko-draw.c:
+
+ - Adjust gradient stops to give glossed appearance.
+ - Add gradient to "inactive" tabs
+
+ * moko-gtk-engine/src/moko-utils.h: rename from sato-utils.h
+
+ * moko-gtk-engine/data/openmoko-contacts
+ * moko-gtk-engine/data/openmoko-panel-plugins
+ * moko-gtk-engine/data/matchboxpanel
+ * moko-gtk-engine/data/openmoko-dialer
+ * moko-gtk-engine/data/gtkrc
+ * moko-gtk-engine/data/openmoko-calculator
+ * moko-gtk-engine/Makefile.am
+
+ - Add application specific rc files
+ - Tweak colours
+
+
+2007-09-18 Thomas Wood <thomas at openedhand.com>
+
+ * Rename Sato to Moko
+ * Adjust gradients and remove rounded corners
+
2007-07-30 Thomas Wood <thomas at openedhand.com>
* COPYING: Added LGPL version
Modified: trunk/src/target/OM-2007.2/libraries/moko-gtk-engine/data/gtkrc
===================================================================
--- trunk/src/target/OM-2007.2/libraries/moko-gtk-engine/data/gtkrc 2007-09-20 14:00:55 UTC (rev 3020)
+++ trunk/src/target/OM-2007.2/libraries/moko-gtk-engine/data/gtkrc 2007-09-20 17:09:14 UTC (rev 3021)
@@ -84,11 +84,20 @@
class "GtkWidget" style "default"
+style "button"
+{
+ engine "moko-engine" {
+ border = TRUE
+ }
+}
+class "GtkButton" style "button"
+
style "combo-fix" {
+ bg[NORMAL] = "#ff7d00"
text[NORMAL] = "white"
text[PRELIGHT] = "white"
}
-class "GtkComboBox" style "combo-fix"
+class "*Combo*" style "combo-fix"
style "toolbar"
{
Modified: trunk/src/target/OM-2007.2/libraries/moko-gtk-engine/src/moko-draw.c
===================================================================
--- trunk/src/target/OM-2007.2/libraries/moko-gtk-engine/src/moko-draw.c 2007-09-20 14:00:55 UTC (rev 3020)
+++ trunk/src/target/OM-2007.2/libraries/moko-gtk-engine/src/moko-draw.c 2007-09-20 17:09:14 UTC (rev 3021)
@@ -58,9 +58,9 @@
gc = gdk_gc_new (window);
/* get the start and end colours */
- moko_shade_colour (&style->bg[state_type], &c1, 1.6);
+ moko_shade_colour (&style->bg[state_type], &c1, 1.8);
moko_shade_colour (&style->bg[state_type], &c2, 1.4);
- moko_shade_colour (&style->bg[state_type], &c3, 1.2);
+ moko_shade_colour (&style->bg[state_type], &c3, 1.3);
moko_shade_colour (&style->bg[state_type], &c4, 1.0);
/* set line for 1px */
@@ -158,14 +158,6 @@
moko_gradient (style, window, state_type, x+1, y+1, width-2, height-2);
-
- /*** treeview headers ***/
- if (widget && GTK_IS_TREE_VIEW (widget->parent))
- {
- goto exit;
- }
-
-
if (DETAIL ("trough"))
{
if (widget && GTK_IS_HSCALE (widget))
@@ -184,7 +176,7 @@
}
/*** draw the border ***/
- if (!DETAIL ("bar"))
+ if (MOKO_RC_STYLE (style->rc_style)->has_border)
{
gdk_draw_rectangle (window, gc, FALSE, x + 1, y + 1, width - 2, height - 2);
}
Modified: trunk/src/target/OM-2007.2/libraries/moko-gtk-engine/src/moko-style.c
===================================================================
--- trunk/src/target/OM-2007.2/libraries/moko-gtk-engine/src/moko-style.c 2007-09-20 14:00:55 UTC (rev 3020)
+++ trunk/src/target/OM-2007.2/libraries/moko-gtk-engine/src/moko-style.c 2007-09-20 17:09:14 UTC (rev 3021)
@@ -60,6 +60,7 @@
moko_style_class_init (MokoStyleClass *klass)
{
GtkStyleClass *style_class = GTK_STYLE_CLASS (klass);
+
moko_draw_style_class_init (style_class);
}
@@ -67,17 +68,148 @@
/*** Gtk Style RC Class *******************************************************/
+static struct
+{
+ gchar *name;
+ guint token;
+}
+moko_rc_symbols[] =
+{
+ { "border", TOKEN_HAS_BORDER },
+ { "gradient", TOKEN_HAS_GRADIENT },
+
+ { "TRUE", TOKEN_TRUE },
+ { "FALSE", TOKEN_FALSE }
+};
+
GType moko_type_rc_style = 0;
+static GtkRcStyleClass *moko_parent_rc_style_class;
static GtkStyle *moko_rc_style_create_style (GtkRcStyle *rc_style);
+static void moko_rc_style_merge (GtkRcStyle *dest, GtkRcStyle *src);
+static guint moko_rc_style_parse (GtkRcStyle *rc_style, GtkSettings *settings, GScanner *scanner);
static void
moko_rc_style_class_init (MokoRcStyleClass *klass)
{
GtkRcStyleClass *rc_style_class = GTK_RC_STYLE_CLASS (klass);
+
+ moko_parent_rc_style_class = g_type_class_peek_parent (klass);
+
rc_style_class->create_style = moko_rc_style_create_style;
+ rc_style_class->parse = moko_rc_style_parse;
+ rc_style_class->merge = moko_rc_style_merge;
}
+
+static void
+moko_rc_style_merge (GtkRcStyle *dest, GtkRcStyle *src)
+{
+ if (MOKO_IS_RC_STYLE (src))
+ {
+ MokoRcStyle *src_data = MOKO_RC_STYLE (src);
+ MokoRcStyle *dest_data = MOKO_RC_STYLE (dest);
+
+ dest_data->has_border = src_data->has_border;
+ dest_data->has_gradient = src_data->has_gradient;
+ }
+
+ moko_parent_rc_style_class->merge (dest, src);
+}
+
+static guint
+moko_rc_parse_boolean(GScanner *scanner, GTokenType wanted_token, guint *retval)
+{
+ guint token;
+
+ token = g_scanner_get_next_token(scanner);
+ if (token != wanted_token)
+ return wanted_token;
+
+ token = g_scanner_get_next_token(scanner);
+ if (token != G_TOKEN_EQUAL_SIGN)
+ return G_TOKEN_EQUAL_SIGN;
+
+ token = g_scanner_get_next_token(scanner);
+ if (token == TOKEN_TRUE)
+ *retval = TRUE;
+ else if (token == TOKEN_FALSE)
+ *retval = FALSE;
+ else
+ return TOKEN_TRUE;
+
+ return G_TOKEN_NONE;
+}
+
+static guint
+moko_rc_style_parse (GtkRcStyle *rc_style, GtkSettings *settings, GScanner *scanner)
+{
+ static GQuark scope_id = 0;
+ MokoRcStyle *theme_data = MOKO_RC_STYLE (rc_style);
+ guint old_scope;
+ guint token;
+
+ /* Set up a our own scope for this scanner */
+
+ if (!scope_id)
+ scope_id = g_quark_from_string ("moko_gtk_engine");
+
+ old_scope = g_scanner_set_scope (scanner, scope_id);
+
+ /* check we haven't already added the moko symbols to this scanner */
+
+ if (!g_scanner_lookup_symbol (scanner, moko_rc_symbols[0].name))
+ {
+ gint i;
+ for (i = 0; i < G_N_ELEMENTS (moko_rc_symbols); i++)
+ {
+ g_scanner_scope_add_symbol (scanner, scope_id, moko_rc_symbols[i].name,
+ GINT_TO_POINTER (moko_rc_symbols[i].token));
+ }
+ }
+
+
+ token = g_scanner_peek_next_token (scanner);
+
+ while (token != G_TOKEN_RIGHT_CURLY)
+ {
+ guint i;
+
+ switch (token)
+ {
+ case TOKEN_HAS_BORDER:
+ token = moko_rc_parse_boolean (scanner, TOKEN_HAS_BORDER, &i);
+ if (token != G_TOKEN_NONE)
+ break;
+ theme_data->has_border = i;
+ break;
+ case TOKEN_HAS_GRADIENT:
+ token = moko_rc_parse_boolean (scanner, TOKEN_HAS_GRADIENT, &i);
+ if (token != G_TOKEN_NONE)
+ break;
+ theme_data->has_gradient = i;
+ break;
+
+ default:
+ g_scanner_get_next_token (scanner);
+ token = G_TOKEN_RIGHT_CURLY;
+ break;
+
+ }
+
+ if (token != G_TOKEN_NONE)
+ {
+ return token;
+ }
+ token = g_scanner_peek_next_token (scanner);
+ }
+
+ g_scanner_get_next_token (scanner);
+ g_scanner_set_scope (scanner, old_scope);
+
+ return G_TOKEN_NONE;
+}
+
void
moko_rc_style_register_type (GTypeModule *module)
{
Modified: trunk/src/target/OM-2007.2/libraries/moko-gtk-engine/src/moko-style.h
===================================================================
--- trunk/src/target/OM-2007.2/libraries/moko-gtk-engine/src/moko-style.h 2007-09-20 14:00:55 UTC (rev 3020)
+++ trunk/src/target/OM-2007.2/libraries/moko-gtk-engine/src/moko-style.h 2007-09-20 17:09:14 UTC (rev 3021)
@@ -38,11 +38,11 @@
extern GType moko_type_style;
#define MOKO_TYPE_STYLE moko_type_style
-#define MOKO_STYLE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), POKY_TYPE_STYLE, MokoStyle))
-#define MOKO_STYLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), POKY_TYPE_STYLE, MokoStyleClass))
-#define MOKO_IS_STYLE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), POKY_TYPE_STYLE))
-#define MOKO_IS_STYLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), POKY_TYPE_STYLE))
-#define MOKO_STYLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), POKY_TYPE_STYLE, MokoStyleClass))
+#define MOKO_STYLE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), MOKO_TYPE_STYLE, MokoStyle))
+#define MOKO_STYLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOKO_TYPE_STYLE, MokoStyleClass))
+#define MOKO_IS_STYLE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), MOKO_TYPE_STYLE))
+#define MOKO_IS_STYLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOKO_TYPE_STYLE))
+#define MOKO_STYLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOKO_TYPE_STYLE, MokoStyleClass))
typedef struct _MokoStyle MokoStyle;
typedef struct _MokoStyleClass MokoStyleClass;
@@ -66,11 +66,11 @@
extern GType moko_type_rc_style;
#define MOKO_TYPE_RC_STYLE moko_type_rc_style
-#define MOKO_RC_STYLE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), POKY_TYPE_RC_STYLE, MokoRcStyle))
-#define MOKO_RC_STYLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), POKY_TYPE_RC_STYLE, MokoRcStyleClass))
-#define MOKO_IS_RC_STYLE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), POKY_TYPE_RC_STYLE))
-#define MOKO_IS_RC_STYLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), POKY_TYPE_RC_STYLE))
-#define MOKO_RC_STYLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), POKY_TYPE_RC_STYLE, MokoRcStyleClass))
+#define MOKO_RC_STYLE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), MOKO_TYPE_RC_STYLE, MokoRcStyle))
+#define MOKO_RC_STYLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOKO_TYPE_RC_STYLE, MokoRcStyleClass))
+#define MOKO_IS_RC_STYLE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), MOKO_TYPE_RC_STYLE))
+#define MOKO_IS_RC_STYLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOKO_TYPE_RC_STYLE))
+#define MOKO_RC_STYLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOKO_TYPE_RC_STYLE, MokoRcStyleClass))
typedef struct _MokoRcStyle MokoRcStyle;
typedef struct _MokoRcStyleClass MokoRcStyleClass;
@@ -78,15 +78,28 @@
struct _MokoRcStyle
{
GtkRcStyle parent_instance;
+
+ gboolean has_border;
+ gboolean has_gradient;
};
struct _MokoRcStyleClass
{
GtkRcStyleClass parent_class;
+
};
void moko_rc_style_register_type (GTypeModule *engine);
+enum
+{
+ TOKEN_HAS_BORDER = G_TOKEN_LAST + 1,
+ TOKEN_HAS_GRADIENT,
+
+ TOKEN_TRUE,
+ TOKEN_FALSE
+};
+
/******************************************************************************/
G_END_DECLS
More information about the commitlog
mailing list