summaryrefslogtreecommitdiff
path: root/plugins/gtkui
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2011-03-23 21:18:26 +0100
committerGravatar waker <wakeroid@gmail.com>2011-03-23 21:18:26 +0100
commit4a0f3f780b88e3db50acc1fb4750657a79342eb7 (patch)
treeaaf777103de671ead61ecafa84964c83e6f861ea /plugins/gtkui
parent103185d504ad26cde11889618722e6e7881384d0 (diff)
customizable tabstrip text color
Diffstat (limited to 'plugins/gtkui')
-rw-r--r--plugins/gtkui/callbacks.c1
-rw-r--r--plugins/gtkui/callbacks.h4
-rw-r--r--plugins/gtkui/ddbtabstrip.c15
-rw-r--r--plugins/gtkui/deadbeef.glade48
-rw-r--r--plugins/gtkui/drawing.h3
-rw-r--r--plugins/gtkui/gdkdrawing.c11
-rw-r--r--plugins/gtkui/interface.c22
-rw-r--r--plugins/gtkui/prefwin.c15
8 files changed, 110 insertions, 9 deletions
diff --git a/plugins/gtkui/callbacks.c b/plugins/gtkui/callbacks.c
index 00ff70c6..71ad353f 100644
--- a/plugins/gtkui/callbacks.c
+++ b/plugins/gtkui/callbacks.c
@@ -1170,4 +1170,3 @@ create_plugin_weblink (gchar *widget_name, gchar *string1, gchar *string2,
gtk_widget_set_sensitive (link, FALSE);
return link;
}
-
diff --git a/plugins/gtkui/callbacks.h b/plugins/gtkui/callbacks.h
index b5aff3e3..de5bfd75 100644
--- a/plugins/gtkui/callbacks.h
+++ b/plugins/gtkui/callbacks.h
@@ -1103,3 +1103,7 @@ on_prefwin_map_event (GtkWidget *widget,
void
on_replaygain_preamp_value_changed (GtkRange *range,
gpointer user_data);
+
+void
+on_tabstrip_text_color_set (GtkColorButton *colorbutton,
+ gpointer user_data);
diff --git a/plugins/gtkui/ddbtabstrip.c b/plugins/gtkui/ddbtabstrip.c
index 435b6946..325f7a25 100644
--- a/plugins/gtkui/ddbtabstrip.c
+++ b/plugins/gtkui/ddbtabstrip.c
@@ -520,8 +520,9 @@ tabstrip_render (DdbTabStrip *ts) {
ddb_tabstrip_draw_tab (widget, backbuf, idx == tab_selected, x, y, w, h);
char tab_title[100];
plt_get_title_wrapper (idx, tab_title, sizeof (tab_title));
- GdkColor *color = &widget->style->text[GTK_STATE_NORMAL];
- float fg[3] = {(float)color->red/0xffff, (float)color->green/0xffff, (float)color->blue/0xffff};
+ GdkColor color;
+ gtkui_get_tabstrip_text_color (&color);
+ float fg[3] = {(float)color.red/0xffff, (float)color.green/0xffff, (float)color.blue/0xffff};
draw_set_fg_color (fg);
draw_text (x + text_left_padding, y + h/2 - draw_get_font_size()/2 + text_vert_offset, w, 0, tab_title);
}
@@ -547,8 +548,9 @@ tabstrip_render (DdbTabStrip *ts) {
ddb_tabstrip_draw_tab (widget, backbuf, 1, x, y, w, h);
char tab_title[100];
plt_get_title_wrapper (idx, tab_title, sizeof (tab_title));
- GdkColor *color = &widget->style->text[GTK_STATE_NORMAL];
- float fg[3] = {(float)color->red/0xffff, (float)color->green/0xffff, (float)color->blue/0xffff};
+ GdkColor color;
+ gtkui_get_tabstrip_text_color (&color);
+ float fg[3] = {(float)color.red/0xffff, (float)color.green/0xffff, (float)color.blue/0xffff};
draw_set_fg_color (fg);
draw_text (x + text_left_padding, y + h/2 - draw_get_font_size()/2 + text_vert_offset, w, 0, tab_title);
}
@@ -568,8 +570,9 @@ tabstrip_render (DdbTabStrip *ts) {
ddb_tabstrip_draw_tab (widget, backbuf, 1, x, y, w, h);
char tab_title[100];
plt_get_title_wrapper (idx, tab_title, sizeof (tab_title));
- GdkColor *color = &widget->style->text[GTK_STATE_NORMAL];
- float fg[3] = {(float)color->red/0xffff, (float)color->green/0xffff, (float)color->blue/0xffff};
+ GdkColor color;
+ gtkui_get_tabstrip_text_color (&color);
+ float fg[3] = {(float)color.red/0xffff, (float)color.green/0xffff, (float)color.blue/0xffff};
draw_set_fg_color (fg);
draw_text (x + text_left_padding, y + h/2 - draw_get_font_size()/2 + text_vert_offset, w, 0, tab_title);
}
diff --git a/plugins/gtkui/deadbeef.glade b/plugins/gtkui/deadbeef.glade
index a9fbf8ba..b9535fd8 100644
--- a/plugins/gtkui/deadbeef.glade
+++ b/plugins/gtkui/deadbeef.glade
@@ -3610,7 +3610,7 @@ Album</property>
<widget class="GtkTable" id="tabstrip_colors_group">
<property name="visible">True</property>
<property name="n_rows">2</property>
- <property name="n_columns">4</property>
+ <property name="n_columns">5</property>
<property name="homogeneous">True</property>
<property name="row_spacing">0</property>
<property name="column_spacing">8</property>
@@ -3798,6 +3798,52 @@ Album</property>
<property name="y_options"></property>
</packing>
</child>
+
+ <child>
+ <widget class="GtkLabel" id="label127">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Text</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">4</property>
+ <property name="right_attach">5</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">expand</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkColorButton" id="tabstrip_text">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="use_alpha">False</property>
+ <property name="focus_on_click">True</property>
+ <signal name="color_set" handler="on_tabstrip_text_color_set" last_modification_time="Wed, 23 Mar 2011 20:09:34 GMT"/>
+ </widget>
+ <packing>
+ <property name="left_attach">4</property>
+ <property name="right_attach">5</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">expand</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="padding">0</property>
diff --git a/plugins/gtkui/drawing.h b/plugins/gtkui/drawing.h
index 953a9847..b73c9f97 100644
--- a/plugins/gtkui/drawing.h
+++ b/plugins/gtkui/drawing.h
@@ -97,6 +97,9 @@ void
gtkui_get_tabstrip_base_color (GdkColor *clr);
void
+gtkui_get_tabstrip_text_color (GdkColor *clr);
+
+void
gtkui_get_listview_even_row_color (GdkColor *clr);
void
diff --git a/plugins/gtkui/gdkdrawing.c b/plugins/gtkui/gdkdrawing.c
index 1893cdd1..e9d496f4 100644
--- a/plugins/gtkui/gdkdrawing.c
+++ b/plugins/gtkui/gdkdrawing.c
@@ -197,6 +197,7 @@ static GdkColor gtkui_tabstrip_dark_color;
static GdkColor gtkui_tabstrip_mid_color;
static GdkColor gtkui_tabstrip_light_color;
static GdkColor gtkui_tabstrip_base_color;
+static GdkColor gtkui_tabstrip_text_color;
static GdkColor gtkui_listview_even_row_color;
static GdkColor gtkui_listview_odd_row_color;
@@ -255,6 +256,7 @@ gtkui_init_theme_colors (void) {
memcpy (&gtkui_tabstrip_mid_color, &style->mid[GTK_STATE_NORMAL], sizeof (GdkColor));
memcpy (&gtkui_tabstrip_light_color, &style->light[GTK_STATE_NORMAL], sizeof (GdkColor));
memcpy (&gtkui_tabstrip_base_color, &style->bg[GTK_STATE_NORMAL], sizeof (GdkColor));
+ memcpy (&gtkui_tabstrip_text_color, &style->text[GTK_STATE_NORMAL], sizeof (GdkColor));
}
else {
snprintf (color_text, sizeof (color_text), "%hd %hd %hd", style->dark[GTK_STATE_NORMAL].red, style->dark[GTK_STATE_NORMAL].green, style->dark[GTK_STATE_NORMAL].blue);
@@ -272,6 +274,10 @@ gtkui_init_theme_colors (void) {
snprintf (color_text, sizeof (color_text), "%hd %hd %hd", style->bg[GTK_STATE_NORMAL].red, style->bg[GTK_STATE_NORMAL].green, style->bg[GTK_STATE_NORMAL].blue);
clr = deadbeef->conf_get_str ("gtkui.color.tabstrip_base", color_text);
sscanf (clr, "%hd %hd %hd", &gtkui_tabstrip_base_color.red, &gtkui_tabstrip_base_color.green, &gtkui_tabstrip_base_color.blue);
+
+ snprintf (color_text, sizeof (color_text), "%hd %hd %hd", style->text[GTK_STATE_NORMAL].red, style->text[GTK_STATE_NORMAL].green, style->text[GTK_STATE_NORMAL].blue);
+ clr = deadbeef->conf_get_str ("gtkui.color.tabstrip_text", color_text);
+ sscanf (clr, "%hd %hd %hd", &gtkui_tabstrip_text_color.red, &gtkui_tabstrip_text_color.green, &gtkui_tabstrip_text_color.blue);
}
if (!override_listview_colors) {
@@ -340,6 +346,11 @@ gtkui_get_tabstrip_base_color (GdkColor *clr) {
}
void
+gtkui_get_tabstrip_text_color (GdkColor *clr) {
+ memcpy (clr, &gtkui_tabstrip_text_color, sizeof (GdkColor));
+}
+
+void
gtkui_get_listview_even_row_color (GdkColor *clr) {
memcpy (clr, &gtkui_listview_even_row_color, sizeof (GdkColor));
}
diff --git a/plugins/gtkui/interface.c b/plugins/gtkui/interface.c
index 9240a0fb..71113e3a 100644
--- a/plugins/gtkui/interface.c
+++ b/plugins/gtkui/interface.c
@@ -1717,6 +1717,8 @@ create_prefwin (void)
GtkWidget *tabstrip_dark;
GtkWidget *tabstrip_base;
GtkWidget *label76;
+ GtkWidget *label127;
+ GtkWidget *tabstrip_text;
GtkWidget *label74;
GtkWidget *vbox23;
GtkWidget *override_listview_colors;
@@ -2086,7 +2088,7 @@ create_prefwin (void)
gtk_widget_show (override_tabstrip_colors);
gtk_box_pack_start (GTK_BOX (vbox22), override_tabstrip_colors, FALSE, FALSE, 0);
- tabstrip_colors_group = gtk_table_new (2, 4, TRUE);
+ tabstrip_colors_group = gtk_table_new (2, 5, TRUE);
gtk_widget_show (tabstrip_colors_group);
gtk_box_pack_start (GTK_BOX (vbox22), tabstrip_colors_group, TRUE, TRUE, 0);
gtk_table_set_col_spacings (GTK_TABLE (tabstrip_colors_group), 8);
@@ -2143,6 +2145,19 @@ create_prefwin (void)
(GtkAttachOptions) (0), 0, 0);
gtk_misc_set_alignment (GTK_MISC (label76), 0, 0.5);
+ label127 = gtk_label_new (_("Text"));
+ gtk_widget_show (label127);
+ gtk_table_attach (GTK_TABLE (tabstrip_colors_group), label127, 4, 5, 0, 1,
+ (GtkAttachOptions) (GTK_EXPAND),
+ (GtkAttachOptions) (0), 0, 0);
+ gtk_misc_set_alignment (GTK_MISC (label127), 0, 0.5);
+
+ tabstrip_text = gtk_color_button_new ();
+ gtk_widget_show (tabstrip_text);
+ gtk_table_attach (GTK_TABLE (tabstrip_colors_group), tabstrip_text, 4, 5, 1, 2,
+ (GtkAttachOptions) (GTK_EXPAND),
+ (GtkAttachOptions) (0), 0, 0);
+
label74 = gtk_label_new (_("Tab strip colors"));
gtk_widget_show (label74);
gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook4), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook4), 1), label74);
@@ -2534,6 +2549,9 @@ create_prefwin (void)
g_signal_connect ((gpointer) tabstrip_base, "color_set",
G_CALLBACK (on_tabstrip_base_color_set),
NULL);
+ g_signal_connect ((gpointer) tabstrip_text, "color_set",
+ G_CALLBACK (on_tabstrip_text_color_set),
+ NULL);
g_signal_connect ((gpointer) override_listview_colors, "toggled",
G_CALLBACK (on_override_listview_colors_toggled),
NULL);
@@ -2661,6 +2679,8 @@ create_prefwin (void)
GLADE_HOOKUP_OBJECT (prefwin, tabstrip_dark, "tabstrip_dark");
GLADE_HOOKUP_OBJECT (prefwin, tabstrip_base, "tabstrip_base");
GLADE_HOOKUP_OBJECT (prefwin, label76, "label76");
+ GLADE_HOOKUP_OBJECT (prefwin, label127, "label127");
+ GLADE_HOOKUP_OBJECT (prefwin, tabstrip_text, "tabstrip_text");
GLADE_HOOKUP_OBJECT (prefwin, label74, "label74");
GLADE_HOOKUP_OBJECT (prefwin, vbox23, "vbox23");
GLADE_HOOKUP_OBJECT (prefwin, override_listview_colors, "override_listview_colors");
diff --git a/plugins/gtkui/prefwin.c b/plugins/gtkui/prefwin.c
index 980f5765..57e817d1 100644
--- a/plugins/gtkui/prefwin.c
+++ b/plugins/gtkui/prefwin.c
@@ -251,6 +251,7 @@ prefwin_init_theme_colors (void) {
gtk_color_button_set_color (GTK_COLOR_BUTTON (lookup_widget (prefwin, "tabstrip_mid")), (gtkui_get_tabstrip_mid_color (&clr), &clr));
gtk_color_button_set_color (GTK_COLOR_BUTTON (lookup_widget (prefwin, "tabstrip_light")), (gtkui_get_tabstrip_light_color (&clr), &clr));
gtk_color_button_set_color (GTK_COLOR_BUTTON (lookup_widget (prefwin, "tabstrip_base")), (gtkui_get_tabstrip_base_color (&clr), &clr));
+ gtk_color_button_set_color (GTK_COLOR_BUTTON (lookup_widget (prefwin, "tabstrip_text")), (gtkui_get_tabstrip_text_color (&clr), &clr));
gtk_color_button_set_color (GTK_COLOR_BUTTON (lookup_widget (prefwin, "listview_even_row")), (gtkui_get_listview_even_row_color (&clr), &clr));
gtk_color_button_set_color (GTK_COLOR_BUTTON (lookup_widget (prefwin, "listview_odd_row")), (gtkui_get_listview_odd_row_color (&clr), &clr));
gtk_color_button_set_color (GTK_COLOR_BUTTON (lookup_widget (prefwin, "listview_selected_row")), (gtkui_get_listview_selection_color (&clr), &clr));
@@ -874,6 +875,20 @@ on_tabstrip_base_color_set (GtkColorButton *colorbutton,
tabstrip_redraw ();
}
+void
+on_tabstrip_text_color_set (GtkColorButton *colorbutton,
+ gpointer user_data)
+{
+ GdkColor clr;
+ gtk_color_button_get_color (colorbutton, &clr);
+ char str[100];
+ snprintf (str, sizeof (str), "%d %d %d", clr.red, clr.green, clr.blue);
+ deadbeef->conf_set_str ("gtkui.color.tabstrip_text", str);
+ deadbeef->sendmessage (M_CONFIG_CHANGED, 0, 0, 0);
+ gtkui_init_theme_colors ();
+ redraw_headers ();
+ tabstrip_redraw ();
+}
void
on_bar_foreground_color_set (GtkColorButton *colorbutton,