Changeset 3021


Ignore:
Timestamp:
09/20/07 19:09:14 (6 years ago)
Author:
thomas
Message:
  • 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

Location:
trunk/src/target/OM-2007.2/libraries/moko-gtk-engine
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/target/OM-2007.2/libraries/moko-gtk-engine/ChangeLog

    r3008 r3021  
     12007-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 
     102007-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 
     312007-09-18  Thomas Wood  <thomas@openedhand.com> 
     32 
     33        * Rename Sato to Moko 
     34        * Adjust gradients and remove rounded corners 
     35 
    1362007-07-30  Thomas Wood  <thomas@openedhand.com> 
    237 
  • trunk/src/target/OM-2007.2/libraries/moko-gtk-engine/data/gtkrc

    r3012 r3021  
    8585class "GtkWidget" style "default" 
    8686 
     87style "button" 
     88{ 
     89  engine "moko-engine" { 
     90    border = TRUE 
     91  } 
     92} 
     93class "GtkButton" style "button" 
     94 
    8795style "combo-fix" { 
     96  bg[NORMAL] = "#ff7d00" 
    8897  text[NORMAL] = "white" 
    8998  text[PRELIGHT] = "white" 
    9099} 
    91 class "GtkComboBox" style "combo-fix" 
     100class "*Combo*" style "combo-fix" 
    92101 
    93102style "toolbar" 
  • trunk/src/target/OM-2007.2/libraries/moko-gtk-engine/src/moko-draw.c

    r3012 r3021  
    5959 
    6060  /* 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); 
    6262  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); 
    6464  moko_shade_colour (&style->bg[state_type], &c4, 1.0); 
    6565 
     
    157157  if (!DETAIL ("menu") && !DETAIL ("trough")) 
    158158   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   } 
    167159 
    168160 
     
    185177 
    186178  /*** draw the border ***/ 
    187   if (!DETAIL ("bar")) 
     179  if (MOKO_RC_STYLE (style->rc_style)->has_border) 
    188180  { 
    189181    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  
    6161{ 
    6262  GtkStyleClass *style_class = GTK_STYLE_CLASS (klass); 
     63 
    6364  moko_draw_style_class_init (style_class); 
    6465} 
     
    6869/*** Gtk Style RC Class *******************************************************/ 
    6970 
     71static struct 
     72{ 
     73  gchar *name; 
     74  guint token; 
     75} 
     76moko_rc_symbols[] =  
     77{ 
     78  { "border", TOKEN_HAS_BORDER }, 
     79  { "gradient", TOKEN_HAS_GRADIENT }, 
     80 
     81  { "TRUE", TOKEN_TRUE }, 
     82  { "FALSE", TOKEN_FALSE } 
     83}; 
     84 
    7085GType moko_type_rc_style = 0; 
     86static GtkRcStyleClass *moko_parent_rc_style_class; 
    7187 
    7288static GtkStyle *moko_rc_style_create_style (GtkRcStyle *rc_style); 
     89static void moko_rc_style_merge (GtkRcStyle *dest, GtkRcStyle *src); 
     90static guint moko_rc_style_parse (GtkRcStyle *rc_style, GtkSettings *settings, GScanner *scanner); 
    7391 
    7492static void 
     
    7694{ 
    7795        GtkRcStyleClass *rc_style_class = GTK_RC_STYLE_CLASS (klass); 
     96 
     97  moko_parent_rc_style_class = g_type_class_peek_parent (klass); 
     98 
    7899        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 
     105static void 
     106moko_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 
     120static guint 
     121moko_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 
     144static guint  
     145moko_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; 
    79211} 
    80212 
  • trunk/src/target/OM-2007.2/libraries/moko-gtk-engine/src/moko-style.h

    r3008 r3021  
    3939 
    4040#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)) 
    4646 
    4747typedef struct _MokoStyle MokoStyle; 
     
    6767 
    6868#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)) 
    7474 
    7575typedef struct _MokoRcStyle MokoRcStyle; 
     
    7979{ 
    8080  GtkRcStyle parent_instance; 
     81 
     82  gboolean has_border; 
     83  gboolean has_gradient; 
    8184}; 
    8285 
     
    8487{ 
    8588  GtkRcStyleClass parent_class; 
     89 
    8690}; 
    8791 
    8892void moko_rc_style_register_type (GTypeModule *engine); 
     93 
     94enum 
     95{ 
     96  TOKEN_HAS_BORDER = G_TOKEN_LAST + 1, 
     97  TOKEN_HAS_GRADIENT, 
     98 
     99  TOKEN_TRUE, 
     100  TOKEN_FALSE 
     101}; 
    89102 
    90103/******************************************************************************/ 
Note: See TracChangeset for help on using the changeset viewer.