~ubuntu-branches/ubuntu/lucid/gtk2-engines-murrine/lucid

« back to all changes in this revision

Viewing changes to src/murrine_style.c

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche, Didier Roche, Khashayar Naderehvandi
  • Date: 2009-03-18 21:48:08 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20090318214808-0n7qxpyukzd2ru8r
Tags: 0.90.2-0ubuntu1
[Didier Roche]
* New upstream release (LP: #344154)
  - High roundness values are now correctly limited.
  - Use focus_color in draw_entry if the theme uses it.
  - Removed shadows from GtkCombo and GtkComboBoxEntry.
  - Code polishing and bugfixing.
  - Fixed a crash when using focus_color.
  - Now focus_color and scrollbar_color accept symbolic colors.
* debian/control:
  - add Vcs-Bzr tag
  - bump libgtk2.0-dev to 2.12.0
  - update Homepage field
* Rewrite debian/watch to get murrine from its new location

[Khashayar Naderehvandi]
* debian/control: remove quilt dependency
* debian/rules: remove "patch: patch-stamp" and all patch related stuff

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* Murrine theme engine
2
 
 * Copyright (C) 2007 Andrea Cimitan
 
2
 * Copyright (C) 2006-2007-2008-2009-2009 Andrea Cimitan
3
3
 *
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
68
68
#include "animation.h"
69
69
#endif
70
70
 
71
 
#define STYLE_FUNCTION(function) (MURRINE_STYLE_GET_CLASS (style)->style_functions[params.drawstyle].function)
 
71
#define STYLE_FUNCTION(function) (MURRINE_STYLE_GET_CLASS (style)->style_functions[params.style].function)
72
72
 
73
73
G_DEFINE_DYNAMIC_TYPE (MurrineStyle, murrine_style, GTK_TYPE_STYLE)
74
74
 
95
95
static
96
96
boolean murrine_widget_is_rgba (GtkWidget *widget)
97
97
{
98
 
        GdkScreen *screen = gtk_widget_get_screen (widget);
99
98
        boolean use_rgba = FALSE;
 
99
        GdkScreen *screen;
 
100
 
 
101
        if (widget)
 
102
                screen = gtk_widget_get_screen (widget);
 
103
        else
 
104
                return use_rgba;
100
105
 
101
106
#ifdef HAVE_RGBA
102
 
        if (gdk_screen_is_composited(screen) && gdk_screen_get_rgba_colormap (screen))
 
107
        if (gdk_screen_is_composited(screen) &&
 
108
            gdk_screen_get_rgba_colormap (screen))
103
109
                use_rgba = (gtk_widget_get_colormap (widget) ==
104
110
                            gdk_screen_get_rgba_colormap (screen));
105
111
#endif
130
136
        params->xthickness = style->xthickness;
131
137
        params->ythickness = style->ythickness;
132
138
 
133
 
        params->lightborder_ratio = murrine_style->lightborder_ratio;
 
139
        params->glazestyle        = murrine_style->glazestyle;
 
140
        params->glow_shade        = murrine_style->glow_shade;
 
141
        params->glowstyle         = murrine_style->glowstyle;
 
142
        params->highlight_shade   = murrine_style->highlight_shade;
 
143
        params->lightborder_shade = murrine_style->lightborder_shade;
134
144
        params->lightborderstyle  = murrine_style->lightborderstyle;
135
 
        params->glazestyle        = murrine_style->glazestyle;
136
145
        params->reliefstyle       = murrine_style->reliefstyle;
137
146
        params->roundness         = murrine_style->roundness;
138
 
        params->highlight_ratio   = murrine_style->highlight_ratio;
139
147
 
140
148
        MurrineGradients mrn_gradient;
141
149
        if (murrine_style->gradients)
153
161
                mrn_gradient.gradient_shades[3] = 1.0;
154
162
        }
155
163
        mrn_gradient.gradients = murrine_style->gradients;
156
 
        mrn_gradient.use_rgba = (murrine_widget_is_rgba ((GtkWidget*) widget) && murrine_style->rgba);
 
164
        mrn_gradient.use_rgba = (murrine_widget_is_rgba ((GtkWidget*) widget) &&
 
165
                                 murrine_style->rgba);
157
166
        mrn_gradient.rgba_opacity = GRADIENT_OPACITY;
158
167
 
159
 
        MurrineDrawStyles drawstyle = MRN_DRAW_STYLE_MURRINE;
 
168
        MurrineStyles mrn_style = MRN_STYLE_MURRINE;
160
169
        if (mrn_gradient.use_rgba)
161
170
        {
162
 
                drawstyle = MRN_DRAW_STYLE_RGBA;
 
171
                mrn_style = MRN_STYLE_RGBA;
163
172
        }
164
173
        params->mrn_gradient = mrn_gradient;
165
 
        params->drawstyle = drawstyle;
166
 
        params->style_functions = &(MURRINE_STYLE_GET_CLASS (style)->style_functions[drawstyle]);
 
174
        params->style = mrn_style;
 
175
        params->style_functions = &(MURRINE_STYLE_GET_CLASS (style)->style_functions[mrn_style]);
167
176
 
168
177
        /* I want to avoid to have to do this. I need it for GtkEntry, unless I
169
178
           find out why it doesn't behave the way I expect it to. */
214
223
                murrine_set_widget_parameters (widget, style, state_type, &params);
215
224
                if (params.mrn_gradient.use_rgba)
216
225
                {
217
 
                        params.corners = MRN_CORNER_ALL;
218
226
                        params.mrn_gradient.rgba_opacity = TOOLTIP_OPACITY;
219
227
                }
220
228
 
282
290
                                        cairo_paint (cr);
283
291
                                        cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
284
292
 
285
 
                                        cairo_pattern_t *pattern;
 
293
                                        cairo_pattern_t *pat;
286
294
 
287
 
                                        pattern = cairo_pattern_create_linear (0, 0, width, 0);
288
 
                                        cairo_pattern_add_color_stop_rgba (pattern, 0.0, colors->bg[0].r,
289
 
                                                                                         colors->bg[0].g,
290
 
                                                                                         colors->bg[0].b, WINDOW_OPACITY);
291
 
                                        cairo_pattern_add_color_stop_rgba (pattern, 0.5, colors->bg[0].r,
292
 
                                                                                         colors->bg[0].g,
293
 
                                                                                         colors->bg[0].b, (WINDOW_OPACITY-0.04));
294
 
                                        cairo_pattern_add_color_stop_rgba (pattern, 1.0, colors->bg[0].r,
295
 
                                                                                         colors->bg[0].g,
296
 
                                                                                         colors->bg[0].b, WINDOW_OPACITY);
297
 
                                        cairo_set_source (cr, pattern);
 
295
                                        pat = cairo_pattern_create_linear (0, 0, width, 0);
 
296
                                        murrine_pattern_add_color_stop_rgba (pat, 0.0, &colors->bg[0], WINDOW_OPACITY);
 
297
                                        murrine_pattern_add_color_stop_rgba (pat, 0.5, &colors->bg[0], (WINDOW_OPACITY-0.04));
 
298
                                        murrine_pattern_add_color_stop_rgba (pat, 1.0, &colors->bg[0], WINDOW_OPACITY);
 
299
                                        cairo_set_source (cr, pat);
298
300
                                        cairo_rectangle  (cr, 0, 0, width, height);
299
301
                                        cairo_fill       (cr);
300
 
                                        cairo_pattern_destroy (pattern);
 
302
                                        cairo_pattern_destroy (pat);
301
303
                                }
302
304
 
303
305
                                cairo_destroy (cr);
360
362
        if (DETAIL ("entry") && !(widget && widget->parent && MRN_IS_TREE_VIEW (widget->parent)))
361
363
        {
362
364
                WidgetParameters params;
 
365
                FocusParameters  focus;
363
366
 
364
367
                /* Override the entries state type, because we are too lame to handle this via
365
368
                 * the focus ring, and GtkEntry doesn't even set the INSENSITIVE state ... */
382
385
                                params.corners = MRN_CORNER_TOPRIGHT | MRN_CORNER_BOTTOMRIGHT;
383
386
                }
384
387
 
385
 
                STYLE_FUNCTION(draw_entry) (cr, &murrine_style->colors, &params,
386
 
                                    x, y, width, height);
 
388
                /* Fill the background as it is initilized to base[NORMAL].
 
389
                 * Relevant GTK+ bug: http://bugzilla.gnome.org/show_bug.cgi?id=513471
 
390
                 * The fill only happens if no hint has been added by some application
 
391
                 * that is faking GTK+ widgets. */
 
392
                if (!widget || !g_object_get_data(G_OBJECT (widget), "transparent-bg-hint"))
 
393
                {
 
394
                        cairo_rectangle (cr, 0, 0, width, height);
 
395
                        if (!params.mrn_gradient.use_rgba)
 
396
                        {
 
397
                                murrine_set_color_rgb (cr, &params.parentbg);
 
398
                                cairo_fill(cr);
 
399
                        }
 
400
                        else
 
401
                        {
 
402
                                cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
 
403
                                murrine_set_color_rgba (cr, &params.parentbg, WINDOW_OPACITY);
 
404
                                cairo_fill(cr);
 
405
                                cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
 
406
                        }
 
407
                }
 
408
 
 
409
                /* Focus color */
 
410
                if (murrine_style->has_focus_color)
 
411
                {
 
412
                        murrine_gdk_color_to_rgb (&murrine_style->focus_color, &focus.color.r, 
 
413
                                                                               &focus.color.g,
 
414
                                                                               &focus.color.b);
 
415
                        focus.has_color = TRUE;
 
416
                }
 
417
                else
 
418
                        focus.color = colors->spot[2];
 
419
 
 
420
                STYLE_FUNCTION(draw_entry) (cr, &murrine_style->colors, &params, &focus,
 
421
                                            x, y, width, height);
387
422
        }
388
423
        else if (DETAIL ("frame") && widget && MRN_IS_STATUSBAR (widget->parent))
389
424
        {
397
432
                                                            area, x, y, width, height);
398
433
                }
399
434
 
400
 
                STYLE_FUNCTION(draw_statusbar) (cr, colors, &params,
401
 
                                                x, y, width, height);
 
435
                if (shadow_type != GTK_SHADOW_NONE)
 
436
                        STYLE_FUNCTION(draw_statusbar) (cr, colors, &params,
 
437
                                                        x, y, width, height);
402
438
        }
403
 
        else if (DETAIL ("frame"))
 
439
        else if (DETAIL ("frame") || DETAIL ("calendar"))
404
440
        {
405
441
                WidgetParameters params;
406
442
                FrameParameters  frame;
417
453
        }
418
454
        else if (DETAIL ("scrolled_window") || DETAIL ("viewport") || detail == NULL)
419
455
        {
420
 
                MurrineRGB *border = (MurrineRGB*)&colors->shade[5];
421
456
                cairo_rectangle (cr, x+0.5, y+0.5, width-1, height-1);
422
 
                murrine_set_color_rgb (cr, border);
423
 
                cairo_set_line_width (cr, 1);
 
457
                murrine_set_color_rgb (cr, &colors->shade[5]);
 
458
                cairo_stroke (cr);
 
459
        }
 
460
        else if (DETAIL ("pager") || DETAIL ("pager-frame"))
 
461
        {
 
462
                murrine_rounded_rectangle (cr, x+0.5, y+0.5, width-1, height-1,
 
463
                                           CLAMP (murrine_style->roundness, 0, 3),
 
464
                                           MRN_CORNER_ALL);
 
465
                murrine_set_color_rgb (cr, &colors->shade[5]);
424
466
                cairo_stroke (cr);
425
467
        }
426
468
        else
429
471
                FrameParameters frame;
430
472
 
431
473
                frame.shadow = shadow_type;
432
 
                frame.gap_x  = -1;
 
474
                frame.gap_x  = -1; /* No gap will be drawn */
433
475
                frame.border = &colors->shade[4];
434
476
 
435
477
                murrine_set_widget_parameters (widget, style, state_type, &params);
436
478
 
437
 
                params.corners = MRN_CORNER_ALL;
438
479
                if (params.roundness < 2)
439
480
                        params.corners = MRN_CORNER_NONE;
440
481
 
475
516
 
476
517
                murrine_get_notebook_tab_position (widget, &start, &end);
477
518
 
478
 
                params.corners = MRN_CORNER_ALL;
479
519
                switch (gap_side)
480
520
                {
481
521
                        case GTK_POS_TOP:
526
566
                if (params.roundness < 2)
527
567
                        params.corners = MRN_CORNER_NONE;
528
568
 
529
 
                if (params.mrn_gradient.use_rgba)
530
 
                        cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
531
 
 
532
569
                /* Fill the background with bg[NORMAL] */
533
 
                murrine_rounded_rectangle (cr, x, y, width, height, params.roundness, params.corners);
 
570
                clearlooks_rounded_rectangle (cr, x, y, width, height, params.roundness, params.corners);
 
571
 
534
572
                if (!params.mrn_gradient.use_rgba)
 
573
                {
535
574
                        murrine_set_color_rgb (cr, &colors->bg[0]);
 
575
                        cairo_fill (cr);
 
576
                }
536
577
                else
 
578
                {
 
579
                        cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
537
580
                        murrine_set_color_rgba (cr, &colors->bg[0], NOTEBOOK_OPACITY);
538
 
                cairo_fill(cr);
539
 
 
540
 
                if (params.mrn_gradient.use_rgba)
 
581
                        cairo_fill(cr);
541
582
                        cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
 
583
                }
542
584
 
543
585
                STYLE_FUNCTION(draw_frame) (cr, colors, &params, &frame,
544
586
                                            x, y, width, height);
665
707
 
666
708
        cr = murrine_begin_paint (window, area);
667
709
 
668
 
        if ((width == -1) && (height == -1))
669
 
                gdk_window_get_size (window, &width, &height);
670
 
        else if (width == -1)
671
 
                gdk_window_get_size (window, &width, NULL);
672
 
        else if (height == -1)
673
 
                gdk_window_get_size (window, NULL, &height);
674
 
 
675
710
        if (DETAIL ("menubar") &&
676
711
            !(widget && (murrine_is_panel_widget (widget->parent))))
677
712
        {
695
730
                horizontal = height < 2*width;
696
731
 
697
732
                /* This is not that great. Ideally we would have a nice vertical menubar. */
698
 
                if (params.mrn_gradient.use_rgba || ((shadow_type != GTK_SHADOW_NONE) && horizontal))
 
733
                if (params.mrn_gradient.use_rgba ||
 
734
                    ((shadow_type != GTK_SHADOW_NONE) && horizontal))
699
735
                        STYLE_FUNCTION(draw_menubar) (cr, colors, &params, x, y,
700
736
                                                      width, height+offset, menubarstyle);
701
737
        }
702
738
        else if (DETAIL ("button") && widget && widget->parent &&
703
 
                         (MRN_IS_TREE_VIEW(widget->parent) ||
 
739
                         (MRN_IS_TREE_VIEW (widget->parent) ||
704
740
                          MRN_IS_CLIST (widget->parent)))
705
741
        {
706
742
                WidgetParameters params;
710
746
                gint columns, column_index;
711
747
                gboolean resizable = TRUE;
712
748
 
 
749
                /* XXX: This makes unknown treeview header "middle", in need for something nicer */
 
750
                columns = 3;
 
751
                column_index = 1;
 
752
 
713
753
                murrine_set_widget_parameters (widget, style, state_type, &params);
714
754
                params.corners = MRN_CORNER_NONE;
715
755
 
727
767
 
728
768
                header.resizable = resizable;
729
769
 
 
770
                header.order = 0;
730
771
                if (column_index == 0)
731
 
                        header.order = params.ltr ? MRN_ORDER_FIRST : MRN_ORDER_LAST;
732
 
                else if (column_index == columns-1)
733
 
                        header.order = params.ltr ? MRN_ORDER_LAST : MRN_ORDER_FIRST;
734
 
                else
735
 
                        header.order = MRN_ORDER_MIDDLE;
 
772
                        header.order |= params.ltr ? MRN_ORDER_FIRST : MRN_ORDER_LAST;
 
773
                if (column_index == columns-1)
 
774
                        header.order |= params.ltr ? MRN_ORDER_LAST : MRN_ORDER_FIRST;
736
775
 
737
776
                gtk_style_apply_default_background (style, window, FALSE, state_type, area, x, y, width, height);
738
777
 
739
778
                STYLE_FUNCTION(draw_list_view_header) (cr, colors, &params, &header, x, y, width, height);
740
779
        }
741
 
        else if (DETAIL ("button") || DETAIL ("buttondefault"))
 
780
        else if (DETAIL ("buttondefault"))
 
781
        {
 
782
                /* We are already checking the default button with the
 
783
                * "murrine_set_widget_parameters" function, so we may occur
 
784
                * in drawing the button two times. Do nothing.
 
785
                */
 
786
        }
 
787
        else if (DETAIL ("button"))
742
788
        {
743
789
                WidgetParameters params;
744
790
 
745
791
                murrine_set_widget_parameters (widget, style, state_type, &params);
746
 
                params.roundness = murrine_style->roundness;
 
792
                params.active = shadow_type == GTK_SHADOW_IN;
747
793
 
748
794
                boolean horizontal = TRUE;
749
 
                if (((float)width/height<0.5)|| (murrine_style->glazestyle > 0 && width<height))
 
795
                if (((float)width/height < 0.5) ||
 
796
                    (murrine_style->glazestyle > 0 && width<height))
750
797
                        horizontal = FALSE;
751
798
 
752
799
                if ((widget && (MRN_IS_COMBO_BOX_ENTRY (widget->parent) || MRN_IS_COMBO (widget->parent))))
766
813
                                                params.corners = MRN_CORNER_BOTTOMRIGHT | MRN_CORNER_BOTTOMLEFT;
767
814
                                }
768
815
                        }
769
 
                        else
770
 
                                params.corners = MRN_CORNER_NONE;
771
 
 
772
 
                        /* Seriously, why can't non-gtk-apps at least try to be decent citizens?
773
 
                           Take this fucking OpenOffice.org 1.9 for example. The morons responsible
774
 
                           for this utter piece of crap gave the clip size wrong values! :'(  */
775
 
/*                      cairo_reset_clip (cr);
776
 
                        cairo_rectangle (cr, x+ 0.5, y+ 0.5, 10, 10);
777
 
                        cairo_clip (cr);
778
 
                        cairo_new_path (cr);
779
 
*/
 
816
 
 
817
 
780
818
                        if (params.xthickness > 1)
781
819
                        {
782
820
                                if (params.ltr)
783
821
                                        x--;
784
822
                                width++;
785
823
                        }
 
824
 
 
825
                        if (murrine_style->reliefstyle > 1)
 
826
                                params.reliefstyle = 1;
786
827
                }
787
 
                else
788
 
                        if (murrine_style->roundness > 0)
789
 
                                params.corners = MRN_CORNER_ALL;
790
 
                        else
791
 
                                params.corners = MRN_CORNER_NONE;
792
 
 
793
 
                if (MRN_IS_TOGGLE_BUTTON (widget) &&
794
 
                    gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
795
 
                        params.active = TRUE;
796
828
 
797
829
                STYLE_FUNCTION(draw_button) (cr, &murrine_style->colors, &params, x, y, width, height, horizontal);
798
830
        }
839
871
                        state_type = GTK_WIDGET_STATE (widget);
840
872
 
841
873
                murrine_set_widget_parameters (widget, style, state_type, &params);
842
 
                params.roundness = murrine_style->roundness;
843
874
 
844
875
                boolean horizontal = TRUE;
845
876
                if (((float)width/height<0.5)|| (murrine_style->glazestyle > 0 && width<height))
860
891
                                        params.corners = MRN_CORNER_BOTTOMRIGHT | MRN_CORNER_BOTTOMLEFT;
861
892
                        }
862
893
                }
863
 
                else
864
 
                        params.corners = MRN_CORNER_NONE;
865
894
 
866
895
                if (style->xthickness > 1)
867
896
                {
873
902
                /* draw_spinbutton (cr, &murrine_style->colors, &params, x, y, width, height); */
874
903
                STYLE_FUNCTION(draw_button) (cr, &murrine_style->colors, &params, x, y, width, height, horizontal);
875
904
        }
876
 
        else if (DETAIL ("trough") && widget && MRN_IS_SCALE (widget))
 
905
        else if (detail && g_str_has_prefix (detail, "trough") && widget && MRN_IS_SCALE (widget))
877
906
        {
878
 
                GtkAdjustment *adjustment = gtk_range_get_adjustment (GTK_RANGE (widget));
879
907
                WidgetParameters params;
880
908
                SliderParameters slider;
881
 
                gint slider_length;
882
 
 
883
 
                gtk_widget_style_get (widget, "slider-length", &slider_length, NULL);
884
 
 
885
 
                slider.inverted   = gtk_range_get_inverted (GTK_RANGE (widget));
 
909
 
 
910
                slider.lower = DETAIL ("trough-lower");
 
911
                slider.fill_level = DETAIL ("trough-fill-level") || DETAIL ("trough-fill-level-full");
886
912
                slider.horizontal = (GTK_RANGE (widget)->orientation == GTK_ORIENTATION_HORIZONTAL);
887
 
                slider.fill_size  = ((slider.horizontal ? width : height) - slider_length) *
888
 
                                     (1 / ((adjustment->upper - adjustment->lower) / (adjustment->value - adjustment->lower)))
889
 
                                     + slider_length / 2;
890
 
                if (slider.horizontal)
891
 
                        slider.inverted = slider.inverted != (murrine_get_direction (widget) == GTK_TEXT_DIR_RTL);
892
913
 
893
914
                murrine_set_widget_parameters (widget, style, state_type, &params);
894
 
                params.corners    = MRN_CORNER_NONE;
 
915
                params.corners = MRN_CORNER_NONE;
895
916
 
896
917
                STYLE_FUNCTION(draw_scale_trough) (cr, &murrine_style->colors,
897
918
                                                   &params, &slider,
903
924
 
904
925
                murrine_set_widget_parameters (widget, style, state_type, &params);
905
926
 
 
927
                /* Fill the background as it is initilized to base[NORMAL].
 
928
                 * Relevant GTK+ bug: http://bugzilla.gnome.org/show_bug.cgi?id=513471
 
929
                 * The fill only happens if no hint has been added by some application
 
930
                 * that is faking GTK+ widgets. */
 
931
                if (!widget || !g_object_get_data(G_OBJECT (widget), "transparent-bg-hint"))
 
932
                {
 
933
                        cairo_rectangle (cr, 0, 0, width, height);
 
934
                        if (!params.mrn_gradient.use_rgba)
 
935
                        {
 
936
                                murrine_set_color_rgb (cr, &params.parentbg);
 
937
                                cairo_fill(cr);
 
938
                        }
 
939
                        else
 
940
                        {
 
941
                                cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
 
942
                                murrine_set_color_rgba (cr, &params.parentbg, WINDOW_OPACITY);
 
943
                                cairo_fill(cr);
 
944
                                cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
 
945
                        }
 
946
                }
 
947
 
906
948
                STYLE_FUNCTION(draw_progressbar_trough) (cr, colors, &params, x, y, width, height);
907
949
        }
908
950
        else if (DETAIL ("trough") && widget && (MRN_IS_VSCROLLBAR (widget) || MRN_IS_HSCROLLBAR (widget)))
917
959
 
918
960
                murrine_set_widget_parameters (widget, style, state_type, &params);
919
961
 
920
 
                if (murrine_style->roundness > 0)
921
 
                        params.corners = MRN_CORNER_ALL;
922
 
                else
923
 
                        params.corners = MRN_CORNER_NONE;
924
 
 
925
962
                if (MRN_IS_RANGE (widget))
926
963
                        scrollbar.horizontal = GTK_RANGE (widget)->orientation == GTK_ORIENTATION_HORIZONTAL;
927
964
 
944
981
        else if (DETAIL ("bar"))
945
982
        {
946
983
                WidgetParameters      params;
947
 
 
948
984
                ProgressBarParameters progressbar;
949
985
                gdouble               elapsed = 0.0;
950
986
 
 
987
                murrine_set_widget_parameters (widget, style, state_type, &params);
 
988
                progressbar.style = murrine_style->progressbarstyle;
 
989
 
951
990
                if (widget && MRN_IS_PROGRESS_BAR (widget))
952
991
                        progressbar.orientation = gtk_progress_bar_get_orientation (GTK_PROGRESS_BAR (widget));
953
992
                else
973
1012
                elapsed = murrine_animation_elapsed (widget);
974
1013
#endif
975
1014
 
976
 
                murrine_set_widget_parameters (widget, style, state_type, &params);
977
 
                params.roundness = murrine_style->roundness;
978
 
 
979
 
                /* cairo_reset_clip (cr); */
980
 
 
981
1015
                /* The x-1 and width+2 are to make the fill cover the left and
982
1016
                 * right-hand sides of the trough box */
983
1017
 
984
1018
#ifndef HAVE_ANIMATIONRTL
985
1019
                STYLE_FUNCTION(draw_progressbar_fill) (cr, colors, &params, &progressbar,
986
1020
                                                       x-1, y, width+2, height,
987
 
                                                       10 - (int)(elapsed * 10.0) % 10);
 
1021
                                                       10-(int)(elapsed*10.0) % 10);
988
1022
#else
989
1023
                STYLE_FUNCTION(draw_progressbar_fill) (cr, colors, &params, &progressbar,
990
1024
                                                       x-1, y, width+2, height,
991
 
                                                       10 + (int)(elapsed * 10.0) % 10);
 
1025
                                                       10+(int)(elapsed*10.0) % 10);
992
1026
#endif
993
1027
        }
 
1028
        else if (DETAIL ("entry-progress"))
 
1029
        {
 
1030
                WidgetParameters params;
 
1031
                EntryProgressParameters progress;
 
1032
 
 
1033
                murrine_set_widget_parameters (widget, style, state_type, &params);
 
1034
 
 
1035
                progress.max_size_known = FALSE;
 
1036
                progress.max_size.x = 0;
 
1037
                progress.max_size.y = 0;
 
1038
                progress.max_size.width = 0;
 
1039
                progress.max_size.height = 0;
 
1040
                progress.border.left = style->xthickness;
 
1041
                progress.border.right = style->xthickness;
 
1042
                progress.border.top = style->ythickness;
 
1043
                progress.border.bottom = style->ythickness;
 
1044
 
 
1045
                if (MRN_IS_ENTRY (widget))
 
1046
                {
 
1047
                        GtkBorder *border;
 
1048
                        /* Try to retrieve the style property. */
 
1049
                        gtk_widget_style_get (widget,
 
1050
                                              "progress-border", &border,
 
1051
                                              NULL);
 
1052
 
 
1053
                        if (border)
 
1054
                        {
 
1055
                                progress.border = *border;
 
1056
                                gtk_border_free (border);
 
1057
                        }
 
1058
 
 
1059
                        /* We got an entry, but well, we may not be drawing to
 
1060
                         * this particular widget ... it may not even be realized.
 
1061
                         * Also, we need to be drawing on a window obviously ... */
 
1062
                        if (GTK_WIDGET_REALIZED (widget) &&
 
1063
                            GDK_IS_WINDOW (window) &&
 
1064
                            gdk_window_is_visible (widget->window))
 
1065
                        {
 
1066
                                /* Assumptions done by this code:
 
1067
                                 *  - GtkEntry has some nested windows.
 
1068
                                 *  - widget->window is the entries window
 
1069
                                 *  - widget->window is the size of the entry part
 
1070
                                 *    (and not larger)
 
1071
                                 *  - only one layer of subwindows
 
1072
                                 * These should be true with any GTK+ 2.x version.
 
1073
                                 */
 
1074
 
 
1075
                                if (widget->window == window)
 
1076
                                {
 
1077
                                        progress.max_size_known = TRUE;
 
1078
                                        gdk_drawable_get_size (widget->window,
 
1079
                                                               &progress.max_size.width,
 
1080
                                                               &progress.max_size.height);
 
1081
 
 
1082
                                }
 
1083
                                else
 
1084
                                {
 
1085
                                        GdkWindow *parent;
 
1086
                                        parent = gdk_window_get_parent (window);
 
1087
                                        if (widget->window == parent)
 
1088
                                        {
 
1089
                                                gint pos_x, pos_y;
 
1090
                                                /* widget->window is the parent window
 
1091
                                                 * of the current one. This means we can
 
1092
                                                 * calculate the correct offsets. */
 
1093
                                                gdk_window_get_position (window, &pos_x, &pos_y);
 
1094
                                                progress.max_size.x = -pos_x;
 
1095
                                                progress.max_size.y = -pos_y;
 
1096
 
 
1097
                                                progress.max_size_known = TRUE;
 
1098
                                                gdk_drawable_get_size (widget->window,
 
1099
                                                                       &progress.max_size.width,
 
1100
                                                                       &progress.max_size.height);
 
1101
                                        } /* Nothing we can do in this case ... */
 
1102
                                }
 
1103
 
 
1104
                                /* Now, one more thing needs to be done. If interior-focus
 
1105
                                 * is off, then the entry may be a bit smaller. */
 
1106
                                if (progress.max_size_known && GTK_WIDGET_HAS_FOCUS (widget))
 
1107
                                {
 
1108
                                        gboolean interior_focus = TRUE;
 
1109
                                        gint focus_line_width = 1;
 
1110
 
 
1111
                                        gtk_widget_style_get (widget,
 
1112
                                                              "interior-focus", &interior_focus,
 
1113
                                                              "focus-line-width", &focus_line_width,
 
1114
                                                              NULL);
 
1115
 
 
1116
                                        if (!interior_focus)
 
1117
                                        {
 
1118
                                                progress.max_size.x += focus_line_width;
 
1119
                                                progress.max_size.y += focus_line_width;
 
1120
                                                progress.max_size.width -= 2*focus_line_width;
 
1121
                                                progress.max_size.height -= 2*focus_line_width;
 
1122
                                        }
 
1123
                                }
 
1124
                                
 
1125
                                if (progress.max_size_known)
 
1126
                                {
 
1127
                                        progress.max_size.x += progress.border.left;
 
1128
                                        progress.max_size.y += progress.border.top;
 
1129
                                        progress.max_size.width -= progress.border.left + progress.border.right;
 
1130
                                        progress.max_size.height -= progress.border.top + progress.border.bottom;
 
1131
 
 
1132
                                        /* Now test that max_size.height == height, if that
 
1133
                                         * fails, something has gone wrong ... so then throw away
 
1134
                                         * the max_size information. */
 
1135
                                        if (progress.max_size.height != height)
 
1136
                                        {
 
1137
                                                progress.max_size_known = FALSE;
 
1138
                                                progress.max_size.x = 0;
 
1139
                                                progress.max_size.y = 0;
 
1140
                                                progress.max_size.width = 0;
 
1141
                                                progress.max_size.height = 0;
 
1142
                                        }
 
1143
                                }
 
1144
                        }
 
1145
                }
 
1146
 
 
1147
                STYLE_FUNCTION(draw_entry_progress) (cr, colors, &params, &progress,
 
1148
                                                     x, y, width, height);
 
1149
        }
994
1150
        else if (DETAIL ("hscale") || DETAIL ("vscale"))
995
1151
        {
996
1152
                WidgetParameters params;
1002
1158
                if (DETAIL ("vscale"))
1003
1159
                        horizontal = FALSE;
1004
1160
 
1005
 
                if (murrine_style->roundness > 0)
1006
 
                        params.corners = MRN_CORNER_ALL;
1007
 
                else
1008
 
                        params.corners = MRN_CORNER_NONE;
1009
 
 
1010
1161
                /* Use reliefstyle to remove inset on disabled slider button */
1011
1162
                if (params.disabled)
1012
1163
                        params.reliefstyle = 0;
1027
1178
                murrine_option_menu_get_props (widget, &indicator_size, &indicator_spacing);
1028
1179
 
1029
1180
                if (widget && murrine_get_direction (widget) == GTK_TEXT_DIR_RTL)
1030
 
                        optionmenu.linepos = (indicator_size.width + indicator_spacing.left + indicator_spacing.right) + style->xthickness;
 
1181
                        optionmenu.linepos = (indicator_size.width+indicator_spacing.left+indicator_spacing.right)+style->xthickness;
1031
1182
                else
1032
 
                        optionmenu.linepos = width - (indicator_size.width + indicator_spacing.left + indicator_spacing.right) - style->xthickness;
 
1183
                        optionmenu.linepos = width-(indicator_size.width+indicator_spacing.left+indicator_spacing.right)-style->xthickness;
1033
1184
 
1034
1185
                murrine_set_widget_parameters (widget, style, state_type, &params);
1035
1186
 
1036
 
                if (murrine_style->roundness > 0)
1037
 
                        params.corners = MRN_CORNER_ALL;
1038
 
                else
1039
 
                        params.corners = MRN_CORNER_NONE;
1040
 
 
1041
1187
                STYLE_FUNCTION(draw_optionmenu) (cr, colors, &params, &optionmenu, x, y, width, height);
1042
1188
        }
1043
1189
        else if (DETAIL ("menuitem"))
1046
1192
 
1047
1193
                murrine_set_widget_parameters (widget, style, state_type, &params);
1048
1194
 
1049
 
                if (murrine_style->roundness > 0)
1050
 
                        params.corners = MRN_CORNER_ALL;
1051
 
                else
1052
 
                        params.corners = MRN_CORNER_NONE;
1053
 
 
1054
1195
                if (widget && !(MRN_IS_MENU_BAR (widget->parent) && murrine_style->menubaritemstyle))
1055
1196
                {
1056
1197
                        if (murrine_style->menustyle != 1 || (MRN_IS_MENU_BAR (widget->parent) && !murrine_style->menubaritemstyle))
1057
1198
                                STYLE_FUNCTION(draw_menuitem) (cr, colors, &params, x, y, width, height, murrine_style->menuitemstyle);
1058
1199
                        else
1059
 
                                /* little translation */
 
1200
                                /* little translation */ /* XXX: RTL */
1060
1201
                                STYLE_FUNCTION(draw_menuitem) (cr, colors, &params, x+3, y, width-3, height, murrine_style->menuitemstyle);
1061
1202
                }
1062
1203
 
1069
1210
                        params.xthickness = 2;
1070
1211
                        params.ythickness = 2;
1071
1212
                        params.reliefstyle = 0;
1072
 
 
1073
 
                        if (murrine_style->roundness > 0)
1074
 
                                params.corners = MRN_CORNER_TOPRIGHT | MRN_CORNER_TOPLEFT;
1075
 
                        else
1076
 
                                params.corners = MRN_CORNER_NONE;
1077
 
 
1078
 
                                STYLE_FUNCTION(draw_button) (cr, colors, &params, x, y, width, height+1, TRUE);
 
1213
                        params.corners = MRN_CORNER_TOPRIGHT | MRN_CORNER_TOPLEFT;
 
1214
 
 
1215
                        STYLE_FUNCTION(draw_button) (cr, colors, &params, x, y, width, height+1, TRUE);
1079
1216
                }
1080
1217
        }
1081
1218
        else if (DETAIL ("hscrollbar") || DETAIL ("vscrollbar") || DETAIL ("slider") || DETAIL ("stepper"))
1104
1241
 
1105
1242
                if (murrine_style->has_scrollbar_color)
1106
1243
                {
1107
 
                        murrine_gdk_color_to_rgb (&murrine_style->scrollbar_color, &scrollbar.color.r, &scrollbar.color.g, &scrollbar.color.b);
 
1244
                        murrine_gdk_color_to_rgb (&murrine_style->scrollbar_color, &scrollbar.color.r,
 
1245
                                                                                   &scrollbar.color.g,
 
1246
                                                                                   &scrollbar.color.b);
1108
1247
                        scrollbar.has_color = TRUE;
1109
1248
                }
1110
1249
 
1111
1250
                murrine_set_widget_parameters (widget, style, state_type, &params);
1112
 
 
1113
1251
                params.corners = MRN_CORNER_NONE;
1114
1252
 
1115
1253
                if (DETAIL ("slider"))
1116
1254
                {
1117
 
                        if (murrine_style->roundness == 1)
 
1255
                        int trough_border = 0;
 
1256
                        int trough_under_steppers = 1;
 
1257
 
 
1258
                        gtk_widget_style_get (widget,
 
1259
                                              "trough-border", &trough_border,
 
1260
                                              "trough-under-steppers", &trough_under_steppers,
 
1261
                                              NULL);
 
1262
 
 
1263
                        if (trough_border > 0 ||
 
1264
                            trough_under_steppers == 0 ||
 
1265
                            murrine_style->roundness == 1)
1118
1266
                                params.corners = MRN_CORNER_ALL;
1119
1267
                        else
1120
1268
                                params.corners = MRN_CORNER_NONE;
1156
1304
        }
1157
1305
        else if (DETAIL ("toolbar") || DETAIL ("handlebox_bin") || DETAIL ("dockitem_bin"))
1158
1306
        {
1159
 
                /* Only draw the shadows on horizontal toolbars */
1160
 
                if (shadow_type != GTK_SHADOW_NONE && height < 2*width )
 
1307
                WidgetParameters params;
 
1308
                ToolbarParameters toolbar;
 
1309
                gboolean horizontal;
 
1310
 
 
1311
                murrine_set_widget_parameters (widget, style, state_type, &params);
 
1312
 
 
1313
                murrine_set_toolbar_parameters (&toolbar, widget, window, x, y);
 
1314
                toolbar.style = murrine_style->toolbarstyle;
 
1315
 
 
1316
                if ((DETAIL ("handlebox_bin") || DETAIL ("dockitem_bin")) && MRN_IS_BIN (widget))
1161
1317
                {
1162
 
                        WidgetParameters params;
1163
 
                        ToolbarParameters toolbar;
1164
 
                        gboolean horizontal;
1165
 
 
1166
 
                        murrine_set_widget_parameters (widget, style, state_type, &params);
1167
 
 
1168
 
                        murrine_set_toolbar_parameters (&toolbar, widget, window, x, y);
1169
 
                        toolbar.style = murrine_style->toolbarstyle;
1170
 
                        if ((DETAIL ("handlebox_bin") || DETAIL ("dockitem_bin")) && MRN_IS_BIN (widget))
1171
 
                        {
1172
 
                                GtkWidget* child = gtk_bin_get_child ((GtkBin*) widget);
1173
 
                                /* This is to draw the correct shadow on the handlebox.
1174
 
                                 * We need to draw it here, as otherwise the handle will not get the
1175
 
                                 * background. */
1176
 
                                if (MRN_IS_TOOLBAR (child))
1177
 
                                        gtk_widget_style_get (child, "shadow-type", &shadow_type, NULL);
1178
 
                        }
1179
 
 
1180
 
                        horizontal = height < 2*width;
1181
 
                        /* This is not that great. Ideally we would have a nice vertical toolbar. */
1182
 
                        if ((shadow_type != GTK_SHADOW_NONE) && horizontal)
1183
 
                                STYLE_FUNCTION(draw_toolbar) (cr, colors, &params, &toolbar, x, y, width, height);
 
1318
                        GtkWidget* child = gtk_bin_get_child ((GtkBin*) widget);
 
1319
                        /* This is to draw the correct shadow on the handlebox.
 
1320
                         * We need to draw it here, as otherwise the handle will not get the
 
1321
                         * background. */
 
1322
                        if (MRN_IS_TOOLBAR (child))
 
1323
                                gtk_widget_style_get (child, "shadow-type", &shadow_type, NULL);
1184
1324
                }
 
1325
 
 
1326
                horizontal = height < 2*width;
 
1327
 
 
1328
                /* This is not that great. Ideally we would have a nice vertical toolbar. */
 
1329
                if ((shadow_type != GTK_SHADOW_NONE) && horizontal)
 
1330
                        STYLE_FUNCTION(draw_toolbar) (cr, colors, &params, &toolbar, x, y, width, height);
1185
1331
        }
1186
1332
        else if (DETAIL ("trough"))
1187
1333
        {
1209
1355
                if (DETAIL ("hseparator"))
1210
1356
                {
1211
1357
                        gtk_paint_hline (style, window, state_type, area, widget, new_detail,
1212
 
                                         x, x + width - 1, y + height/2);
 
1358
                                         x, x+width-1, y+height/2);
1213
1359
                }
1214
1360
                else
1215
1361
                        gtk_paint_vline (style, window, state_type, area, widget, new_detail,
1216
 
                                         y, y + height - 1, x + width/2);
 
1362
                                         y, y+height-1, x+width/2);
1217
1363
        }
1218
1364
        else
1219
1365
        {
 
1366
                //printf( "draw_box: %s %s\n", detail, G_OBJECT_TYPE_NAME (widget));
1220
1367
                GTK_STYLE_CLASS (murrine_style_parent_class)->draw_box (style, window, state_type, shadow_type, area,
1221
1368
                                                                        widget, detail, x, y, width, height);
1222
1369
        }
1269
1416
            !gtk_toggle_button_get_inconsistent (GTK_TOGGLE_BUTTON (widget)))
1270
1417
        {
1271
1418
                gfloat elapsed = murrine_animation_elapsed (widget);
1272
 
                trans = sqrt (sqrt (MIN(elapsed / CHECK_ANIMATION_TIME, 1.0)));
 
1419
                trans = sqrt (sqrt (MIN (elapsed/CHECK_ANIMATION_TIME, 1.0)));
1273
1420
        }
1274
1421
#endif
1275
1422
 
1310
1457
            !gtk_toggle_button_get_inconsistent (GTK_TOGGLE_BUTTON (widget)))
1311
1458
        {
1312
1459
                gfloat elapsed = murrine_animation_elapsed (widget);
1313
 
                trans = sqrt (sqrt (MIN(elapsed / CHECK_ANIMATION_TIME, 1.0)));
 
1460
                trans = sqrt (sqrt (MIN (elapsed/CHECK_ANIMATION_TIME, 1.0)));
1314
1461
        }
1315
1462
#endif
1316
1463
 
1372
1519
 
1373
1520
        WidgetParameters params;
1374
1521
 
1375
 
        params.drawstyle = MRN_DRAW_STYLE_MURRINE;
 
1522
        params.style = MRN_STYLE_MURRINE;
1376
1523
        if (murrine_widget_is_rgba (toplevel))
1377
1524
        {
1378
 
                params.drawstyle = MRN_DRAW_STYLE_RGBA;
 
1525
                params.style = MRN_STYLE_RGBA;
1379
1526
        }
1380
1527
 
1381
1528
        if (!(widget &&
1418
1565
 
1419
1566
        WidgetParameters params;
1420
1567
 
1421
 
        params.drawstyle = MRN_DRAW_STYLE_MURRINE;
 
1568
        params.style = MRN_STYLE_MURRINE;
1422
1569
        if (murrine_widget_is_rgba (toplevel))
1423
1570
        {
1424
 
                params.drawstyle = MRN_DRAW_STYLE_RGBA;
 
1571
                params.style = MRN_STYLE_RGBA;
1425
1572
        }
1426
1573
 
1427
1574
        STYLE_FUNCTION(draw_separator) (cr, colors, NULL, &separator, x1, y, x2-x1, 2);
1457
1604
 
1458
1605
                murrine_set_widget_parameters (widget, style, state_type, &params);
1459
1606
 
1460
 
                params.corners = MRN_CORNER_ALL;
1461
 
 
1462
1607
                if (params.roundness < 2)
1463
1608
                        params.corners = MRN_CORNER_NONE;
1464
1609
 
1609
1754
                MurrineRGB temp;
1610
1755
 
1611
1756
                if (GTK_WIDGET_NO_WINDOW (widget))
1612
 
                        murrine_shade (&params.parentbg, 1.2, &temp);
 
1757
                        murrine_shade (&params.parentbg, 1.12, &temp);
1613
1758
                else
1614
 
                        murrine_shade (&colors->bg[widget->state], 1.2, &temp);
1615
 
 
1616
 
                etched.red = (int) (temp.r * 65535);
1617
 
                etched.green = (int) (temp.g * 65535);
1618
 
                etched.blue = (int) (temp.b * 65535);
1619
 
 
1620
 
                gdk_draw_layout_with_colors (window, gc, x + 1, y + 1, layout, &etched, NULL);
 
1759
                        murrine_shade (&colors->bg[widget->state], 1.12, &temp);
 
1760
 
 
1761
                etched.red = (int) (temp.r*65535);
 
1762
                etched.green = (int) (temp.g*65535);
 
1763
                etched.blue = (int) (temp.b*65535);
 
1764
 
 
1765
                gdk_draw_layout_with_colors (window, gc, x+1, y+1, layout, &etched, NULL);
1621
1766
                gdk_draw_layout (window, gc, x, y, layout);
1622
1767
        }
1623
1768
        else
1638
1783
        GTK_STYLE_CLASS (murrine_style_parent_class)->init_from_rc (style, rc_style);
1639
1784
 
1640
1785
        /* Shades/Colors/Ratio */
1641
 
        murrine_style->highlight_ratio    = MURRINE_RC_STYLE (rc_style)->highlight_ratio;
 
1786
        murrine_style->glow_shade         = MURRINE_RC_STYLE (rc_style)->glow_shade;
 
1787
        murrine_style->highlight_shade    = MURRINE_RC_STYLE (rc_style)->highlight_shade;
1642
1788
        murrine_style->gradient_shades[0] = MURRINE_RC_STYLE (rc_style)->gradient_shades[0];
1643
1789
        murrine_style->gradient_shades[1] = MURRINE_RC_STYLE (rc_style)->gradient_shades[1];
1644
1790
        murrine_style->gradient_shades[2] = MURRINE_RC_STYLE (rc_style)->gradient_shades[2];
1651
1797
                murrine_style->gradient_shades[1] = gradient_stop_mid;
1652
1798
                murrine_style->gradient_shades[2] = gradient_stop_mid;
1653
1799
        }
1654
 
        /* Adjust lightborder_ratio reading contrast */
1655
 
        murrine_style->lightborder_ratio = get_contrast(MURRINE_RC_STYLE (rc_style)->lightborder_ratio,
 
1800
        /* Adjust lightborder_shade reading contrast */
 
1801
        murrine_style->lightborder_shade = get_contrast(MURRINE_RC_STYLE (rc_style)->lightborder_shade,
1656
1802
                                                        MURRINE_RC_STYLE (rc_style)->contrast);
1657
1803
 
1658
1804
        /* Widget styles */
1665
1811
                        murrine_style->roundness = 0;
1666
1812
        }
1667
1813
        else
1668
 
                murrine_style->roundness       = MURRINE_RC_STYLE (rc_style)->roundness;
 
1814
                murrine_style->roundness = MURRINE_RC_STYLE (rc_style)->roundness;
 
1815
        murrine_style->animation           = MURRINE_RC_STYLE (rc_style)->animation;
 
1816
        murrine_style->colorize_scrollbar  = MURRINE_RC_STYLE (rc_style)->colorize_scrollbar;
 
1817
        murrine_style->has_focus_color     = MURRINE_RC_STYLE (rc_style)->has_focus_color;
 
1818
        murrine_style->glowstyle           = MURRINE_RC_STYLE (rc_style)->glowstyle;
 
1819
        murrine_style->gradients           = MURRINE_RC_STYLE (rc_style)->gradients;
 
1820
        murrine_style->has_scrollbar_color = MURRINE_RC_STYLE (rc_style)->has_scrollbar_color;
 
1821
        murrine_style->lightborderstyle    = MURRINE_RC_STYLE (rc_style)->lightborderstyle;
 
1822
        murrine_style->listviewheaderstyle = MURRINE_RC_STYLE (rc_style)->listviewheaderstyle;
 
1823
        murrine_style->listviewstyle       = MURRINE_RC_STYLE (rc_style)->listviewstyle;
1669
1824
        murrine_style->menubarstyle        = MURRINE_RC_STYLE (rc_style)->menubarstyle;
1670
1825
        murrine_style->menubaritemstyle    = MURRINE_RC_STYLE (rc_style)->menubaritemstyle;
 
1826
        murrine_style->menuitemstyle       = MURRINE_RC_STYLE (rc_style)->menuitemstyle;
1671
1827
        murrine_style->menustyle           = MURRINE_RC_STYLE (rc_style)->menustyle;
1672
 
        murrine_style->menuitemstyle       = MURRINE_RC_STYLE (rc_style)->menuitemstyle;
1673
 
        murrine_style->lightborderstyle    = MURRINE_RC_STYLE (rc_style)->lightborderstyle;
1674
 
        murrine_style->listviewheaderstyle = MURRINE_RC_STYLE (rc_style)->listviewheaderstyle;
1675
 
        murrine_style->listviewstyle       = MURRINE_RC_STYLE (rc_style)->listviewstyle;
 
1828
        murrine_style->progressbarstyle    = MURRINE_RC_STYLE (rc_style)->progressbarstyle;
 
1829
        murrine_style->reliefstyle         = MURRINE_RC_STYLE (rc_style)->reliefstyle;
 
1830
        murrine_style->rgba                = MURRINE_RC_STYLE (rc_style)->rgba;
 
1831
        murrine_style->scrollbarstyle      = MURRINE_RC_STYLE (rc_style)->scrollbarstyle;
1676
1832
        murrine_style->sliderstyle         = MURRINE_RC_STYLE (rc_style)->sliderstyle;
1677
 
        murrine_style->scrollbarstyle      = MURRINE_RC_STYLE (rc_style)->scrollbarstyle;
1678
 
        murrine_style->has_scrollbar_color = MURRINE_RC_STYLE (rc_style)->has_scrollbar_color;
1679
1833
        murrine_style->stepperstyle        = MURRINE_RC_STYLE (rc_style)->stepperstyle;
1680
1834
        murrine_style->toolbarstyle        = MURRINE_RC_STYLE (rc_style)->toolbarstyle;
1681
 
        murrine_style->animation           = MURRINE_RC_STYLE (rc_style)->animation;
1682
 
        murrine_style->gradients           = MURRINE_RC_STYLE (rc_style)->gradients;
1683
 
        murrine_style->colorize_scrollbar  = MURRINE_RC_STYLE (rc_style)->colorize_scrollbar;
1684
 
        murrine_style->rgba                = MURRINE_RC_STYLE (rc_style)->rgba;
1685
 
        murrine_style->reliefstyle         = MURRINE_RC_STYLE (rc_style)->reliefstyle;
1686
1835
 
 
1836
        if (murrine_style->has_focus_color)
 
1837
                murrine_style->focus_color = MURRINE_RC_STYLE (rc_style)->focus_color;
1687
1838
        if (murrine_style->has_scrollbar_color)
1688
1839
                murrine_style->scrollbar_color = MURRINE_RC_STYLE (rc_style)->scrollbar_color;
1689
1840
 
1690
 
        g_assert ((MURRINE_RC_STYLE (rc_style)->style >= 0) &&
1691
 
                  (MURRINE_RC_STYLE (rc_style)->style < MRN_NUM_STYLES));
1692
 
        murrine_style->style               = MURRINE_RC_STYLE (rc_style)->style;
 
1841
        g_assert ((MURRINE_RC_STYLE (rc_style)->profile >= 0) &&
 
1842
                  (MURRINE_RC_STYLE (rc_style)->profile < MRN_NUM_PROFILES));
 
1843
        murrine_style->profile             = MURRINE_RC_STYLE (rc_style)->profile;
1693
1844
 
1694
 
        switch (murrine_style->style)
 
1845
        switch (murrine_style->profile)
1695
1846
        {
1696
 
                case (MRN_STYLE_NODOKA):
1697
 
                        murrine_style->highlight_ratio = 1.0;
 
1847
                case (MRN_PROFILE_NODOKA):
 
1848
                        murrine_style->highlight_shade = 1.0;
1698
1849
                        murrine_style->gradients = TRUE;
1699
1850
                        murrine_style->gradient_shades[0] = 1.1;
1700
1851
                        murrine_style->gradient_shades[1] = 1.0;
1706
1857
                        murrine_style->colorize_scrollbar = FALSE;
1707
1858
                        murrine_style->has_scrollbar_color = FALSE;
1708
1859
                        break;
1709
 
                case (MRN_STYLE_MIST):
1710
 
                        murrine_style->highlight_ratio = 1.0;
 
1860
                case (MRN_PROFILE_MIST):
 
1861
                        murrine_style->highlight_shade = 1.0;
1711
1862
                        murrine_style->glazestyle = 0;
1712
1863
                        murrine_style->gradients = FALSE;
1713
1864
                        murrine_style->gradient_shades[0] = 1.0;
1714
1865
                        murrine_style->gradient_shades[1] = 1.0;
1715
1866
                        murrine_style->gradient_shades[2] = 1.0;
1716
1867
                        murrine_style->gradient_shades[3] = 1.0;
1717
 
                        murrine_style->lightborder_ratio = 1.00;
 
1868
                        murrine_style->lightborder_shade = 1.00;
1718
1869
                        murrine_style->sliderstyle = 1;
1719
1870
                        murrine_style->scrollbarstyle = 0;
1720
1871
                        murrine_style->stepperstyle = 0;
1723
1874
                        murrine_style->reliefstyle = 0;
1724
1875
                        murrine_style->roundness = 0;
1725
1876
                        break;
1726
 
                case (MRN_STYLE_CANDIDO):
1727
 
                        murrine_style->highlight_ratio = 1.0;
1728
 
                        murrine_style->lightborder_ratio = 1.06;
 
1877
                case (MRN_PROFILE_CANDIDO):
 
1878
                        murrine_style->highlight_shade = 1.0;
 
1879
                        murrine_style->lightborder_shade = 1.06;
1729
1880
                        murrine_style->glazestyle = 0;
1730
1881
                        murrine_style->gradients = TRUE;
1731
1882
                        murrine_style->gradient_shades[0] = 1.01;
1734
1885
                        murrine_style->gradient_shades[3] = 0.97;
1735
1886
                        murrine_style->reliefstyle = 0;
1736
1887
                        break;
1737
 
                case (MRN_STYLE_CLEARLOOKS):
 
1888
                case (MRN_PROFILE_CLEARLOOKS):
1738
1889
                        murrine_style->glazestyle = 0;
1739
1890
                        murrine_style->gradient_shades[0] = 1.08;
1740
1891
                        murrine_style->gradient_shades[1] = 1.02;
1741
1892
                        murrine_style->gradient_shades[2] = 1.00;
1742
1893
                        murrine_style->gradient_shades[3] = 0.94;
1743
1894
                        murrine_style->gradients = TRUE;
1744
 
                        murrine_style->highlight_ratio = 1.0;
 
1895
                        murrine_style->highlight_shade = 1.0;
1745
1896
                        murrine_style->toolbarstyle = 1;
1746
 
                        murrine_style->lightborder_ratio = 1.02;
 
1897
                        murrine_style->lightborder_shade = 1.02;
1747
1898
                        murrine_style->listviewheaderstyle = 1;
1748
1899
                        murrine_style->menustyle = 0;
1749
1900
                        murrine_style->sliderstyle = 1;
1753
1904
}
1754
1905
 
1755
1906
static void
1756
 
murrine_style_realize (GtkStyle * style)
 
1907
murrine_style_realize (GtkStyle *style)
1757
1908
{
1758
1909
        MurrineStyle *murrine_style = MURRINE_STYLE (style);
1759
1910
        double shades[] = {1.065, 0.95, 0.896, 0.82, 0.75, 0.665, 0.5, 0.45, 0.4};
1767
1918
 
1768
1919
        contrast = MURRINE_RC_STYLE (style->rc_style)->contrast;
1769
1920
 
1770
 
        bg_normal.r = style->bg[0].red   / 65535.0;
1771
 
        bg_normal.g = style->bg[0].green / 65535.0;
1772
 
        bg_normal.b = style->bg[0].blue  / 65535.0;
 
1921
        bg_normal.r = style->bg[0].red/65535.0;
 
1922
        bg_normal.g = style->bg[0].green/65535.0;
 
1923
        bg_normal.b = style->bg[0].blue/65535.0;
1773
1924
 
1774
1925
        /* Apply contrast */
1775
1926
        for (i = 0; i < 9; i++)
1778
1929
                               get_contrast(shades[i], contrast),
1779
1930
                               &murrine_style->colors.shade[i]);
1780
1931
        }
1781
 
        spots[2]=get_contrast(spots[2], contrast);
 
1932
        spots[2] = get_contrast(spots[2], contrast);
1782
1933
 
1783
 
        spot_color.r = style->bg[GTK_STATE_SELECTED].red   / 65535.0;
1784
 
        spot_color.g = style->bg[GTK_STATE_SELECTED].green / 65535.0;
1785
 
        spot_color.b = style->bg[GTK_STATE_SELECTED].blue  / 65535.0;
 
1934
        spot_color.r = style->bg[GTK_STATE_SELECTED].red/65535.0;
 
1935
        spot_color.g = style->bg[GTK_STATE_SELECTED].green/65535.0;
 
1936
        spot_color.b = style->bg[GTK_STATE_SELECTED].blue/65535.0;
1786
1937
 
1787
1938
        murrine_shade (&spot_color, spots[0], &murrine_style->colors.spot[0]);
1788
1939
        murrine_shade (&spot_color, spots[1], &murrine_style->colors.spot[1]);
1821
1972
        g_return_if_fail (color != NULL);
1822
1973
 
1823
1974
        cairo_set_source_rgba (cr,
1824
 
                               color->red / 65535.,
1825
 
                               color->green / 65535.,
1826
 
                               color->blue / 65535.,
 
1975
                               color->red/65535.,
 
1976
                               color->green/65535.,
 
1977
                               color->blue/65535.,
1827
1978
                               alpha);
1828
1979
}
1829
1980
 
1832
1983
                          GdkRectangle *area, GtkWidget *widget, const gchar *detail,
1833
1984
                          gint x, gint y, gint width, gint height)
1834
1985
{
 
1986
        MurrineStyle *murrine_style = MURRINE_STYLE (style);
 
1987
        MurrineColors *colors = &murrine_style->colors;
 
1988
        WidgetParameters params;
 
1989
        FocusParameters focus;
 
1990
        guint8* dash_list;
 
1991
 
1835
1992
        cairo_t *cr;
1836
1993
 
1837
1994
        CHECK_ARGS
1839
1996
 
1840
1997
        cr = gdk_cairo_create (window);
1841
1998
 
1842
 
        gboolean free_dash_list = FALSE;
1843
 
        gint line_width = 1;
1844
 
        gint8 *dash_list = "\1\1";
 
1999
        murrine_set_widget_parameters (widget, style, state_type, &params);
 
2000
 
 
2001
        /* Corners */
 
2002
        if (widget && widget->parent && MRN_IS_COMBO_BOX_ENTRY(widget->parent))
 
2003
        {
 
2004
                if (params.ltr)
 
2005
                        params.corners = MRN_CORNER_TOPRIGHT | MRN_CORNER_BOTTOMRIGHT;
 
2006
                else
 
2007
                        params.corners = MRN_CORNER_TOPLEFT | MRN_CORNER_BOTTOMLEFT;
 
2008
 
 
2009
                if (params.xthickness > 2)
 
2010
                {
 
2011
                        if (params.ltr)
 
2012
                                x--;
 
2013
                        width++;
 
2014
                }
 
2015
        }
 
2016
 
 
2017
        focus.has_color = FALSE;
 
2018
        focus.interior = FALSE;
 
2019
        focus.line_width = 1;
 
2020
        focus.padding = 1;
 
2021
        dash_list = NULL;
1845
2022
 
1846
2023
        if (widget)
1847
2024
        {
1848
2025
                gtk_widget_style_get (widget,
1849
 
                                     "focus-line-width", &line_width,
1850
 
                                     "focus-line-pattern",
1851
 
                                     (gchar *) & dash_list, NULL);
1852
 
 
1853
 
                free_dash_list = TRUE;
1854
 
        }
1855
 
 
1856
 
        if (detail && !strcmp (detail, "add-mode"))
1857
 
        {
1858
 
                if (free_dash_list)
1859
 
                        g_free (dash_list);
1860
 
 
1861
 
                dash_list = "\4\4";
1862
 
                free_dash_list = FALSE;
1863
 
        }
1864
 
 
1865
 
        if (detail && !strcmp (detail, "colorwheel_light"))
1866
 
                cairo_set_source_rgb (cr, 0., 0., 0.);
1867
 
        else if (detail && !strcmp (detail, "colorwheel_dark"))
1868
 
                cairo_set_source_rgb (cr, 1., 1., 1.);
1869
 
        else
1870
 
                gdk_cairo_set_source_color_alpha (cr, &style->fg[state_type], 0.7);
1871
 
 
1872
 
        cairo_set_line_width (cr, line_width);
1873
 
 
1874
 
        if (dash_list[0])
1875
 
        {
1876
 
                gint n_dashes = strlen (dash_list);
1877
 
                gdouble *dashes = g_new (gdouble, n_dashes);
1878
 
                gdouble total_length = 0;
1879
 
                gdouble dash_offset;
1880
 
                gint i;
1881
 
 
1882
 
                for (i = 0; i < n_dashes; i++)
1883
 
                {
1884
 
                        dashes[i] = dash_list[i];
1885
 
                        total_length += dash_list[i];
1886
 
                }
1887
 
 
1888
 
                dash_offset = -line_width / 2.;
1889
 
                while (dash_offset < 0)
1890
 
                        dash_offset += total_length;
1891
 
 
1892
 
                cairo_set_dash (cr, dashes, n_dashes, dash_offset);
1893
 
                g_free (dashes);
1894
 
        }
1895
 
 
1896
 
        if (area)
1897
 
        {
1898
 
                gdk_cairo_rectangle (cr, area);
1899
 
                cairo_clip (cr);
1900
 
        }
1901
 
 
1902
 
        cairo_rectangle (cr, x + line_width / 2., y + line_width / 2., width - line_width, height - line_width);
1903
 
        cairo_stroke (cr);
 
2026
                                      "focus-line-width", &focus.line_width,
 
2027
                                      "focus-line-pattern", &dash_list,
 
2028
                                      "focus-padding", &focus.padding,
 
2029
                                      "interior-focus", &focus.interior,
 
2030
                                      NULL);
 
2031
        }
 
2032
        if (dash_list)
 
2033
                focus.dash_list = dash_list;
 
2034
        else
 
2035
                focus.dash_list = (guint8*) g_strdup ("\1\1");
 
2036
 
 
2037
        /* Focus type */
 
2038
        if (DETAIL("button"))
 
2039
        {
 
2040
                if (widget && widget->parent &&
 
2041
                         (MRN_IS_TREE_VIEW (widget->parent) ||
 
2042
                          MRN_IS_CLIST (widget->parent)))
 
2043
                {
 
2044
                        focus.type = MRN_FOCUS_TREEVIEW_HEADER;
 
2045
                }
 
2046
                else
 
2047
                {
 
2048
                        GtkReliefStyle relief = GTK_RELIEF_NORMAL;
 
2049
                        /* Check for the shadow type. */
 
2050
                        if (widget && GTK_IS_BUTTON (widget))
 
2051
                                g_object_get (G_OBJECT (widget), "relief", &relief, NULL);
 
2052
 
 
2053
                        if (relief == GTK_RELIEF_NORMAL)
 
2054
                                focus.type = MRN_FOCUS_BUTTON;
 
2055
                        else
 
2056
                                focus.type = MRN_FOCUS_BUTTON_FLAT;
 
2057
 
 
2058
                        /* Workaround for the panel. */
 
2059
                        if (murrine_object_is_a (G_OBJECT (widget), "ButtonWidget"))
 
2060
                                focus.type = MRN_FOCUS_LABEL;
 
2061
                }
 
2062
        }
 
2063
        else if (detail && g_str_has_prefix (detail, "treeview"))
 
2064
        {
 
2065
                /* Focus in a treeview, and that means a lot of different detail strings. */
 
2066
                if (g_str_has_prefix (detail, "treeview-drop-indicator"))
 
2067
                        focus.type = MRN_FOCUS_TREEVIEW_DND;
 
2068
                else
 
2069
                        focus.type = MRN_FOCUS_TREEVIEW_ROW;
 
2070
 
 
2071
                if (g_str_has_suffix (detail, "left"))
 
2072
                {
 
2073
                        focus.continue_side = MRN_CONT_RIGHT;
 
2074
                }
 
2075
                else if (g_str_has_suffix (detail, "right"))
 
2076
                {
 
2077
                        focus.continue_side = MRN_CONT_LEFT;
 
2078
                }
 
2079
                else if (g_str_has_suffix (detail, "middle"))
 
2080
                {
 
2081
                        focus.continue_side = MRN_CONT_LEFT | MRN_CONT_RIGHT;
 
2082
                }
 
2083
                else
 
2084
                {
 
2085
                        /* This may either mean no continuation, or unknown ...
 
2086
                         * if it is unknown we assume it continues on both sides */
 
2087
                        gboolean row_ending_details = FALSE;
 
2088
 
 
2089
                        /* Try to get the style property. */
 
2090
                        if (widget)
 
2091
                                gtk_widget_style_get (widget,
 
2092
                                                      "row-ending-details", &row_ending_details,
 
2093
                                                      NULL);
 
2094
 
 
2095
                        if (row_ending_details)
 
2096
                                focus.continue_side = MRN_CONT_NONE;
 
2097
                        else
 
2098
                                focus.continue_side = MRN_CONT_LEFT | MRN_CONT_RIGHT;
 
2099
                }
 
2100
 
 
2101
        }
 
2102
        else if (detail && g_str_has_prefix (detail, "trough") && MRN_IS_SCALE (widget))
 
2103
        {
 
2104
                focus.type = MRN_FOCUS_SCALE;
 
2105
        }
 
2106
        else if (DETAIL("tab"))
 
2107
        {
 
2108
                focus.type = MRN_FOCUS_TAB;
 
2109
        }
 
2110
        else if (detail && g_str_has_prefix (detail, "colorwheel"))
 
2111
        {
 
2112
                if (DETAIL ("colorwheel_dark"))
 
2113
                        focus.type = MRN_FOCUS_COLOR_WHEEL_DARK;
 
2114
                else
 
2115
                        focus.type = MRN_FOCUS_COLOR_WHEEL_LIGHT;
 
2116
        }
 
2117
        else if (DETAIL("checkbutton") || DETAIL("radiobutton") || DETAIL("expander"))
 
2118
        {
 
2119
                focus.type = MRN_FOCUS_LABEL; /* Let's call it "LABEL" :) */
 
2120
        }
 
2121
        else if (widget && MRN_IS_TREE_VIEW (widget))
 
2122
        {
 
2123
                focus.type = MRN_FOCUS_TREEVIEW; /* Treeview without content is focused. */
 
2124
        }
 
2125
        else if (DETAIL("icon_view"))
 
2126
        {
 
2127
                focus.type = MRN_FOCUS_ICONVIEW;
 
2128
        }
 
2129
        else
 
2130
        {
 
2131
                focus.type = MRN_FOCUS_UNKNOWN; /* Custom widgets (Beagle) and something unknown */
 
2132
        }
 
2133
 
 
2134
        /* Focus color */
 
2135
        if (murrine_style->has_focus_color)
 
2136
        {
 
2137
                murrine_gdk_color_to_rgb (&murrine_style->focus_color, &focus.color.r,
 
2138
                                                                       &focus.color.g,
 
2139
                                                                       &focus.color.b);
 
2140
                focus.has_color = TRUE;
 
2141
        }
 
2142
        else
 
2143
                focus.color = colors->bg[GTK_STATE_SELECTED];
 
2144
 
 
2145
        STYLE_FUNCTION(draw_focus) (cr, colors, &params, &focus, x, y, width, height);
 
2146
 
 
2147
        g_free (focus.dash_list);
 
2148
 
1904
2149
        cairo_destroy (cr);
1905
 
 
1906
 
        if (free_dash_list)
1907
 
                g_free (dash_list);
1908
2150
}
1909
2151
 
1910
2152
static void
1911
 
murrine_style_copy (GtkStyle * style, GtkStyle * src)
 
2153
murrine_style_copy (GtkStyle *style, GtkStyle *src)
1912
2154
{
1913
 
        MurrineStyle * mrn_style = MURRINE_STYLE (style);
1914
 
        MurrineStyle * mrn_src = MURRINE_STYLE (src);
 
2155
        MurrineStyle *mrn_style = MURRINE_STYLE (style);
 
2156
        MurrineStyle *mrn_src = MURRINE_STYLE (src);
1915
2157
 
1916
2158
        mrn_style->animation           = mrn_src->animation;
1917
2159
        mrn_style->colorize_scrollbar  = mrn_src->colorize_scrollbar;
1918
2160
        mrn_style->colors              = mrn_src->colors;
 
2161
        mrn_style->focus_color         = mrn_src->focus_color;  
1919
2162
        mrn_style->glazestyle          = mrn_src->glazestyle;
 
2163
        mrn_style->glow_shade          = mrn_src->glow_shade;
 
2164
        mrn_style->glowstyle           = mrn_src->glowstyle;
1920
2165
        mrn_style->gradient_shades[0]  = mrn_src->gradient_shades[0];
1921
2166
        mrn_style->gradient_shades[1]  = mrn_src->gradient_shades[1];
1922
2167
        mrn_style->gradient_shades[2]  = mrn_src->gradient_shades[2];
1923
2168
        mrn_style->gradient_shades[3]  = mrn_src->gradient_shades[3];
1924
2169
        mrn_style->gradients           = mrn_src->gradients;
 
2170
        mrn_style->has_focus_color     = mrn_src->has_focus_color;
1925
2171
        mrn_style->has_scrollbar_color = mrn_src->has_scrollbar_color;
1926
 
        mrn_style->highlight_ratio     = mrn_src->highlight_ratio;
1927
 
        mrn_style->lightborder_ratio   = mrn_src->lightborder_ratio;
 
2172
        mrn_style->highlight_shade     = mrn_src->highlight_shade;
 
2173
        mrn_style->lightborder_shade   = mrn_src->lightborder_shade;
1928
2174
        mrn_style->lightborderstyle    = mrn_src->lightborderstyle;
1929
2175
        mrn_style->listviewheaderstyle = mrn_src->listviewheaderstyle;
1930
2176
        mrn_style->listviewstyle       = mrn_src->listviewstyle;
1932
2178
        mrn_style->menubarstyle        = mrn_src->menubarstyle;
1933
2179
        mrn_style->menuitemstyle       = mrn_src->menuitemstyle;
1934
2180
        mrn_style->menustyle           = mrn_src->menustyle;
 
2181
        mrn_style->profile             = mrn_src->profile;
 
2182
        mrn_style->progressbarstyle    = mrn_src->progressbarstyle;
1935
2183
        mrn_style->reliefstyle         = mrn_src->reliefstyle;
1936
2184
        mrn_style->rgba                = mrn_src->rgba;
1937
2185
        mrn_style->roundness           = mrn_src->roundness;
1939
2187
        mrn_style->scrollbarstyle      = mrn_src->scrollbarstyle;
1940
2188
        mrn_style->sliderstyle         = mrn_src->sliderstyle;
1941
2189
        mrn_style->stepperstyle        = mrn_src->stepperstyle;
1942
 
        mrn_style->style               = mrn_src->style;
1943
2190
        mrn_style->toolbarstyle        = mrn_src->toolbarstyle;
1944
2191
 
1945
2192
        GTK_STYLE_CLASS (murrine_style_parent_class)->copy (style, src);
1946
2193
}
1947
2194
 
1948
2195
static void
1949
 
murrine_style_unrealize (GtkStyle * style)
 
2196
murrine_style_unrealize (GtkStyle *style)
1950
2197
{
1951
2198
        GTK_STYLE_CLASS (murrine_style_parent_class)->unrealize (style);
1952
2199
}
1979
2226
                {
1980
2227
                        /* The "4" is the number of chars per pixel, in this case, RGBA,
1981
2228
                           the 3 means "skip to the alpha" */
1982
 
                        current = data + (y * rowstride) + (x * 4) + 3;
1983
 
                        *(current) = (guchar) (*(current) * alpha_percent);
 
2229
                        current = data+(y*rowstride)+(x*4)+3;
 
2230
                        *(current) = (guchar) (*(current)*alpha_percent);
1984
2231
                }
1985
2232
        }
1986
2233
 
2107
2354
 
2108
2355
 
2109
2356
static void
2110
 
murrine_style_init (MurrineStyle * style)
 
2357
murrine_style_init (MurrineStyle *style)
2111
2358
{
2112
2359
}
2113
2360
 
2114
2361
static void
2115
 
murrine_style_class_init (MurrineStyleClass * klass)
 
2362
murrine_style_class_init (MurrineStyleClass *klass)
2116
2363
{
2117
2364
        GtkStyleClass *style_class = GTK_STYLE_CLASS (klass);
2118
2365
 
2139
2386
        style_class->draw_layout      = murrine_style_draw_layout;
2140
2387
        style_class->render_icon      = murrine_style_draw_render_icon;
2141
2388
 
2142
 
        murrine_register_style_murrine (&klass->style_functions[MRN_DRAW_STYLE_MURRINE]);
2143
 
        klass->style_functions[MRN_DRAW_STYLE_RGBA] = klass->style_functions[MRN_DRAW_STYLE_MURRINE];
2144
 
        murrine_register_style_rgba (&klass->style_functions[MRN_DRAW_STYLE_RGBA]);
 
2389
        murrine_register_style_murrine (&klass->style_functions[MRN_STYLE_MURRINE]);
 
2390
        klass->style_functions[MRN_STYLE_RGBA] = klass->style_functions[MRN_STYLE_MURRINE];
 
2391
        murrine_register_style_rgba (&klass->style_functions[MRN_STYLE_RGBA]);
2145
2392
}
2146
2393
 
2147
2394
static void