1
1
/* Murrine theme engine
2
* Copyright (C) 2007 Andrea Cimitan
2
* Copyright (C) 2006-2007-2008-2009 Andrea Cimitan
4
4
* This library is free software; you can redistribute it and/or
5
5
* modify it under the terms of the GNU Library General Public
84
91
{ "animation", TOKEN_ANIMATION },
85
92
{ "colorize_scrollbar", TOKEN_COLORIZE_SCROLLBAR },
86
93
{ "contrast", TOKEN_CONTRAST },
94
{ "focus_color", TOKEN_FOCUS_COLOR },
87
95
{ "glazestyle", TOKEN_GLAZESTYLE },
96
{ "glow_shade", TOKEN_GLOW_SHADE },
97
{ "glowstyle", TOKEN_GLOWSTYLE },
88
98
{ "gradient_shades", TOKEN_GRADIENT_SHADES },
89
99
{ "gradients", TOKEN_GRADIENTS },
90
{ "highlight_ratio", TOKEN_HIGHLIGHT_RATIO },
91
{ "lightborder_ratio", TOKEN_LIGHTBORDER_RATIO },
100
{ "highlight_shade", TOKEN_HIGHLIGHT_SHADE },
101
{ "lightborder_shade", TOKEN_LIGHTBORDER_SHADE },
92
102
{ "lightborderstyle", TOKEN_LIGHTBORDERSTYLE },
93
103
{ "listviewheaderstyle", TOKEN_LISTVIEWHEADERSTYLE },
94
104
{ "listviewstyle", TOKEN_LISTVIEWSTYLE },
96
106
{ "menubarstyle", TOKEN_MENUBARSTYLE },
97
107
{ "menuitemstyle", TOKEN_MENUITEMSTYLE },
98
108
{ "menustyle", TOKEN_MENUSTYLE },
109
{ "profile", TOKEN_PROFILE },
110
{ "progressbarstyle", TOKEN_PROGRESSBARSTYLE },
99
111
{ "reliefstyle", TOKEN_RELIEFSTYLE },
100
112
{ "rgba", TOKEN_RGBA },
101
113
{ "roundness", TOKEN_ROUNDNESS },
103
115
{ "scrollbarstyle", TOKEN_SCROLLBARSTYLE },
104
116
{ "sliderstyle", TOKEN_SLIDERSTYLE },
105
117
{ "stepperstyle", TOKEN_STEPPERSTYLE },
106
{ "style", TOKEN_STYLE },
107
118
{ "toolbarstyle", TOKEN_TOOLBARSTYLE },
109
120
{ "CANDIDO", TOKEN_CANDIDO },
118
129
/* stuff to ignore */
119
130
{ "hilight_ratio", TOKEN_HILIGHT_RATIO },
120
{ "squaredstyle", TOKEN_SQUAREDSTYLE }
131
{ "highlight_ratio", TOKEN_HIGHLIGHT_RATIO },
132
{ "lightborder_ratio", TOKEN_LIGHTBORDER_RATIO },
133
{ "squaredstyle", TOKEN_SQUAREDSTYLE },
134
{ "style", TOKEN_STYLE }
123
137
G_DEFINE_DYNAMIC_TYPE (MurrineRcStyle, murrine_rc_style, GTK_TYPE_RC_STYLE)
136
150
murrine_rc->animation = FALSE;
137
151
murrine_rc->colorize_scrollbar = TRUE;
138
152
murrine_rc->contrast = 1.0;
153
murrine_rc->has_focus_color = FALSE;
139
154
murrine_rc->glazestyle = 1;
155
murrine_rc->glow_shade = 1.0;
156
murrine_rc->glowstyle = 0;
140
157
murrine_rc->gradient_shades[0] = 1.1;
141
158
murrine_rc->gradient_shades[1] = 1.0;
142
159
murrine_rc->gradient_shades[2] = 1.0;
143
160
murrine_rc->gradient_shades[3] = 1.1;
144
161
murrine_rc->gradients = TRUE;
145
162
murrine_rc->has_scrollbar_color = FALSE;
146
murrine_rc->highlight_ratio = 1.1;
147
murrine_rc->lightborder_ratio = 1.1;
163
murrine_rc->highlight_shade = 1.1;
164
murrine_rc->lightborder_shade = 1.1;
148
165
murrine_rc->lightborderstyle = 0;
149
166
murrine_rc->listviewheaderstyle = 1;
150
167
murrine_rc->listviewstyle = 0;
152
169
murrine_rc->menubarstyle = 0;
153
170
murrine_rc->menuitemstyle = 1;
154
171
murrine_rc->menustyle = 1;
172
murrine_rc->progressbarstyle = 1;
155
173
murrine_rc->reliefstyle = 2;
156
174
murrine_rc->rgba = FALSE;
157
175
murrine_rc->roundness = 1;
158
176
murrine_rc->scrollbarstyle = 0;
159
177
murrine_rc->sliderstyle = 0;
160
178
murrine_rc->stepperstyle = 0;
161
murrine_rc->style = MRN_STYLE_MURRINE;
179
murrine_rc->profile = MRN_PROFILE_MURRINE;
162
180
murrine_rc->toolbarstyle = 0;
236
255
if (token != G_TOKEN_EQUAL_SIGN)
237
256
return G_TOKEN_EQUAL_SIGN;
239
return gtk_rc_parse_color (scanner, color);
258
return gtk_rc_parse_color_full (scanner, style, color);
243
theme_parse_ratio (GtkSettings *settings,
262
theme_parse_shade (GtkSettings *settings,
244
263
GScanner *scanner,
289
theme_parse_style (GtkSettings *settings,
291
MurrineStyles *style)
308
theme_parse_profile (GtkSettings *settings,
310
MurrineProfiles *profile)
295
g_assert (MRN_NUM_STYLES == MRN_STYLE_CLEARLOOKS + 1); /* so that people don't forget ;-) */
314
g_assert (MRN_NUM_PROFILES == MRN_PROFILE_CLEARLOOKS + 1); /* so that people don't forget ;-) */
298
317
token = g_scanner_get_next_token (scanner);
300
319
token = g_scanner_get_next_token (scanner);
301
320
if (token != G_TOKEN_EQUAL_SIGN)
302
return G_TOKEN_EQUAL_SIGN;
321
return G_TOKEN_EQUAL_SIGN;
304
323
token = g_scanner_get_next_token (scanner);
308
327
case TOKEN_MURRINE:
309
*style = MRN_STYLE_MURRINE;
328
*profile = MRN_PROFILE_MURRINE;
311
330
case TOKEN_NODOKA:
312
*style = MRN_STYLE_NODOKA;
331
*profile = MRN_PROFILE_NODOKA;
315
*style = MRN_STYLE_MIST;
334
*profile = MRN_PROFILE_MIST;
317
336
case TOKEN_CANDIDO:
318
*style = MRN_STYLE_CANDIDO;
337
*profile = MRN_PROFILE_CANDIDO;
320
339
case TOKEN_CLEARLOOKS:
321
*style = MRN_STYLE_CLEARLOOKS;
340
*profile = MRN_PROFILE_CLEARLOOKS;
324
return TOKEN_MURRINE;
343
return TOKEN_MURRINE;
327
346
return G_TOKEN_NONE;
457
476
murrine_style->flags |= MRN_FLAG_COLORIZE_SCROLLBAR;
459
478
case TOKEN_CONTRAST:
460
token = theme_parse_ratio (settings, scanner, &murrine_style->contrast);
479
token = theme_parse_shade (settings, scanner, &murrine_style->contrast);
461
480
murrine_style->flags |= MRN_FLAG_CONTRAST;
482
case TOKEN_FOCUS_COLOR:
483
token = theme_parse_color (settings, scanner, rc_style, &murrine_style->focus_color);
484
murrine_style->flags |= MRN_FLAG_FOCUS_COLOR;
485
murrine_style->has_focus_color = TRUE;
463
487
case TOKEN_GLAZESTYLE:
464
488
token = theme_parse_int (settings, scanner, &murrine_style->glazestyle);
465
489
murrine_style->flags |= MRN_FLAG_GLAZESTYLE;
491
case TOKEN_GLOW_SHADE:
492
token = theme_parse_shade (settings, scanner, &murrine_style->glow_shade);
493
murrine_style->flags |= MRN_FLAG_GLOW_SHADE;
495
case TOKEN_GLOWSTYLE:
496
token = theme_parse_int (settings, scanner, &murrine_style->glowstyle);
497
murrine_style->flags |= MRN_FLAG_GLOWSTYLE;
467
499
case TOKEN_GRADIENT_SHADES:
468
500
token = theme_parse_gradient (settings, scanner, murrine_style->gradient_shades);
469
501
murrine_style->flags |= MRN_FLAG_GRADIENT_SHADES;
472
504
token = theme_parse_boolean (settings, scanner, &murrine_style->gradients);
473
505
murrine_style->flags |= MRN_FLAG_GRADIENTS;
475
case TOKEN_HIGHLIGHT_RATIO:
476
token = theme_parse_ratio (settings, scanner, &murrine_style->highlight_ratio);
477
murrine_style->flags |= MRN_FLAG_HIGHLIGHT_RATIO;
507
case TOKEN_HIGHLIGHT_SHADE:
508
token = theme_parse_shade (settings, scanner, &murrine_style->highlight_shade);
509
murrine_style->flags |= MRN_FLAG_HIGHLIGHT_SHADE;
479
case TOKEN_LIGHTBORDER_RATIO:
480
token = theme_parse_ratio (settings, scanner, &murrine_style->lightborder_ratio);
481
murrine_style->flags |= MRN_FLAG_LIGHTBORDER_RATIO;
511
case TOKEN_LIGHTBORDER_SHADE:
512
token = theme_parse_shade (settings, scanner, &murrine_style->lightborder_shade);
513
murrine_style->flags |= MRN_FLAG_LIGHTBORDER_SHADE;
483
515
case TOKEN_LIGHTBORDERSTYLE:
484
516
token = theme_parse_int (settings, scanner, &murrine_style->lightborderstyle);
508
540
token = theme_parse_int (settings, scanner, &murrine_style->menustyle);
509
541
murrine_style->flags |= MRN_FLAG_MENUSTYLE;
544
token = theme_parse_profile (settings, scanner, &murrine_style->profile);
545
murrine_style->flags |= MRN_FLAG_PROFILE;
547
case TOKEN_PROGRESSBARSTYLE:
548
token = theme_parse_int (settings, scanner, &murrine_style->progressbarstyle);
549
murrine_style->flags |= MRN_FLAG_PROGRESSBARSTYLE;
511
551
case TOKEN_RELIEFSTYLE:
512
552
token = theme_parse_int (settings, scanner, &murrine_style->reliefstyle);
513
553
murrine_style->flags |= MRN_FLAG_RELIEFSTYLE;
521
561
murrine_style->flags |= MRN_FLAG_ROUNDNESS;
523
563
case TOKEN_SCROLLBAR_COLOR:
524
token = theme_parse_color (settings, scanner, &murrine_style->scrollbar_color);
564
token = theme_parse_color (settings, scanner, rc_style, &murrine_style->scrollbar_color);
525
565
murrine_style->flags |= MRN_FLAG_SCROLLBAR_COLOR;
526
566
murrine_style->has_scrollbar_color = TRUE;
537
577
token = theme_parse_int (settings, scanner, &murrine_style->stepperstyle);
538
578
murrine_style->flags |= MRN_FLAG_STEPPERSTYLE;
541
token = theme_parse_style (settings, scanner, &murrine_style->style);
542
murrine_style->flags |= MRN_FLAG_STYLE;
544
580
case TOKEN_TOOLBARSTYLE:
545
581
token = theme_parse_int (settings, scanner, &murrine_style->toolbarstyle);
546
582
murrine_style->flags |= MRN_FLAG_TOOLBARSTYLE;
549
585
/* stuff to ignore */
550
586
case TOKEN_HILIGHT_RATIO:
551
g_scanner_warn (scanner, "Murrine configuration option \"hilight_ratio\" will be deprecated in future releases. Please update this theme to get rid of this warning.", "hilight_ratio");
587
g_scanner_warn (scanner, "Murrine configuration option \"hilight_ratio\" will be deprecated in future releases. Please use \"highlight_shade\" instead.", "hilight_ratio");
552
588
double hilight_ratio;
553
token = theme_parse_ratio (settings, scanner, &hilight_ratio);
554
murrine_style->highlight_ratio = hilight_ratio/0.909090;
555
murrine_style->flags |= MRN_FLAG_HIGHLIGHT_RATIO;
589
token = theme_parse_shade (settings, scanner, &hilight_ratio);
590
murrine_style->highlight_shade = hilight_ratio/0.909090;
591
murrine_style->flags |= MRN_FLAG_HIGHLIGHT_SHADE;
593
case TOKEN_HIGHLIGHT_RATIO:
594
g_scanner_warn (scanner, "Murrine configuration option \"highlight_ratio\" will be deprecated in future releases. Please use \"highlight_shade\" instead.", "highlight_ratio");
595
token = theme_parse_shade (settings, scanner, &murrine_style->highlight_shade);
596
murrine_style->flags |= MRN_FLAG_HIGHLIGHT_SHADE;
598
case TOKEN_LIGHTBORDER_RATIO:
599
g_scanner_warn (scanner, "Murrine configuration option \"lightborder_ratio\" will be deprecated in future releases. Please use \"lightborder_shade\" instead.", "lightborder_ratio");
600
token = theme_parse_shade (settings, scanner, &murrine_style->lightborder_shade);
601
murrine_style->flags |= MRN_FLAG_LIGHTBORDER_SHADE;
557
603
case TOKEN_SQUAREDSTYLE:
558
604
token = murrine_gtk2_rc_parse_dummy (settings, scanner, "squaredstyle");
607
token = murrine_gtk2_rc_parse_dummy (settings, scanner, "style");
562
611
g_scanner_get_next_token(scanner);
600
649
dest_w->colorize_scrollbar = src_w->colorize_scrollbar;
601
650
if (flags & MRN_FLAG_CONTRAST)
602
651
dest_w->contrast = src_w->contrast;
652
if (flags & MRN_FLAG_FOCUS_COLOR)
654
dest_w->has_focus_color = TRUE;
655
dest_w->focus_color = src_w->focus_color;
603
657
if (flags & MRN_FLAG_GLAZESTYLE)
604
658
dest_w->glazestyle = src_w->glazestyle;
659
if (flags & MRN_FLAG_GLOW_SHADE)
660
dest_w->glow_shade = src_w->glow_shade;
661
if (flags & MRN_FLAG_GLOWSTYLE)
662
dest_w->glowstyle = src_w->glowstyle;
605
663
if (flags & MRN_FLAG_GRADIENT_SHADES)
607
665
dest_w->gradient_shades[0] = src_w->gradient_shades[0];
612
670
if (flags & MRN_FLAG_GRADIENTS)
613
671
dest_w->gradients = src_w->gradients;
614
if (flags & MRN_FLAG_HIGHLIGHT_RATIO)
615
dest_w->highlight_ratio = src_w->highlight_ratio;
616
if (flags & MRN_FLAG_LIGHTBORDER_RATIO)
617
dest_w->lightborder_ratio = src_w->lightborder_ratio;
672
if (flags & MRN_FLAG_HIGHLIGHT_SHADE)
673
dest_w->highlight_shade = src_w->highlight_shade;
674
if (flags & MRN_FLAG_LIGHTBORDER_SHADE)
675
dest_w->lightborder_shade = src_w->lightborder_shade;
618
676
if (flags & MRN_FLAG_LIGHTBORDERSTYLE)
619
677
dest_w->lightborderstyle = src_w->lightborderstyle;
620
678
if (flags & MRN_FLAG_LISTVIEWHEADERSTYLE)
629
687
dest_w->menuitemstyle = src_w->menuitemstyle;
630
688
if (flags & MRN_FLAG_MENUSTYLE)
631
689
dest_w->menustyle = src_w->menustyle;
690
if (flags & MRN_FLAG_PROFILE)
691
dest_w->profile = src_w->profile;
692
if (flags & MRN_FLAG_PROGRESSBARSTYLE)
693
dest_w->progressbarstyle = src_w->progressbarstyle;
632
694
if (flags & MRN_FLAG_RELIEFSTYLE)
633
695
dest_w->reliefstyle = src_w->reliefstyle;
634
696
if (flags & MRN_FLAG_RGBA)
646
708
dest_w->sliderstyle = src_w->sliderstyle;
647
709
if (flags & MRN_FLAG_STEPPERSTYLE)
648
710
dest_w->stepperstyle = src_w->stepperstyle;
649
if (flags & MRN_FLAG_STYLE)
650
dest_w->style = src_w->style;
651
711
if (flags & MRN_FLAG_TOOLBARSTYLE)
652
712
dest_w->toolbarstyle = src_w->toolbarstyle;