changeset 2187:3a5a895ce665 trunk

[svn] - allow changing the colourtheme from preferences
author nenolod
date Wed, 20 Dec 2006 07:57:56 -0800
parents 7be793a34b48
children 9d06e177eeb1
files ChangeLog audacious/glade/prefswin.glade audacious/prefswin.c
diffstat 3 files changed, 376 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Dec 20 07:09:22 2006 -0800
+++ b/ChangeLog	Wed Dec 20 07:57:56 2006 -0800
@@ -1,3 +1,13 @@
+2006-12-20 15:09:22 +0000  William Pitcock <nenolod@nenolod.net>
+  revision [3377]
+  - add ability to colourtheme the UI
+  
+  trunk/audacious/main.c         |    4 ++++
+  trunk/audacious/main.h         |    1 +
+  trunk/audacious/widgets/skin.c |    9 ++++++---
+  3 files changed, 11 insertions(+), 3 deletions(-)
+
+
 2006-12-20 14:59:23 +0000  William Pitcock <nenolod@nenolod.net>
   revision [3375]
   - add pixbuf_effects.c, containing various routines to alter images used by the skinengine
--- a/audacious/glade/prefswin.glade	Wed Dec 20 07:09:22 2006 -0800
+++ b/audacious/glade/prefswin.glade	Wed Dec 20 07:57:56 2006 -0800
@@ -767,6 +767,33 @@
 			      </child>
 
 			      <child>
+				<widget class="GtkButton" id="colorspace_button">
+				  <property name="visible">True</property>
+				  <property name="can_focus">True</property>
+				  <property name="relief">GTK_RELIEF_NORMAL</property>
+				  <property name="focus_on_click">True</property>
+				  <signal name="clicked" handler="on_colorize_button_clicked" last_modification_time="Wed, 20 Dec 2006 16:32:25 GMT"/>
+
+				  <child>
+				    <widget class="GtkImage" id="image9">
+				      <property name="visible">True</property>
+				      <property name="stock">gtk-properties</property>
+				      <property name="icon_size">4</property>
+				      <property name="xalign">0.5</property>
+				      <property name="yalign">0.5</property>
+				      <property name="xpad">0</property>
+				      <property name="ypad">0</property>
+				    </widget>
+				  </child>
+				</widget>
+				<packing>
+				  <property name="padding">0</property>
+				  <property name="expand">False</property>
+				  <property name="fill">False</property>
+				</packing>
+			      </child>
+
+			      <child>
 				<widget class="GtkButton" id="skin_refresh_button">
 				  <property name="visible">True</property>
 				  <property name="tooltip">Refresh skin list</property>
@@ -4601,4 +4628,243 @@
   </child>
 </widget>
 
+<widget class="GtkWindow" id="colorize_popup">
+  <property name="border_width">12</property>
+  <property name="title" translatable="yes">Color Adjustment</property>
+  <property name="type">GTK_WINDOW_TOPLEVEL</property>
+  <property name="window_position">GTK_WIN_POS_NONE</property>
+  <property name="modal">False</property>
+  <property name="resizable">True</property>
+  <property name="destroy_with_parent">False</property>
+  <property name="decorated">True</property>
+  <property name="skip_taskbar_hint">False</property>
+  <property name="skip_pager_hint">False</property>
+  <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+  <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+  <property name="focus_on_map">True</property>
+  <property name="urgency_hint">False</property>
+
+  <child>
+    <widget class="GtkVBox" id="vbox36">
+      <property name="visible">True</property>
+      <property name="homogeneous">False</property>
+      <property name="spacing">12</property>
+
+      <child>
+	<widget class="GtkLabel" id="label89">
+	  <property name="visible">True</property>
+	  <property name="label" translatable="yes">Audacious allows you to alter the color balance of the skinned UI. The sliders below will allow you to do this.</property>
+	  <property name="use_underline">False</property>
+	  <property name="use_markup">False</property>
+	  <property name="justify">GTK_JUSTIFY_LEFT</property>
+	  <property name="wrap">True</property>
+	  <property name="selectable">False</property>
+	  <property name="xalign">0</property>
+	  <property name="yalign">0</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="padding">0</property>
+	  <property name="expand">False</property>
+	  <property name="fill">False</property>
+	</packing>
+      </child>
+
+      <child>
+	<widget class="GtkTable" id="table13">
+	  <property name="visible">True</property>
+	  <property name="n_rows">3</property>
+	  <property name="n_columns">2</property>
+	  <property name="homogeneous">False</property>
+	  <property name="row_spacing">6</property>
+	  <property name="column_spacing">12</property>
+
+	  <child>
+	    <widget class="GtkHScale" id="red_scale">
+	      <property name="visible">True</property>
+	      <property name="can_focus">True</property>
+	      <property name="draw_value">False</property>
+	      <property name="value_pos">GTK_POS_TOP</property>
+	      <property name="digits">3</property>
+	      <property name="update_policy">GTK_UPDATE_CONTINUOUS</property>
+	      <property name="inverted">False</property>
+	      <property name="adjustment">0 0 255 0 0 0</property>
+	      <signal name="value_changed" handler="on_red_scale_value_changed" last_modification_time="Wed, 20 Dec 2006 16:09:54 GMT"/>
+	    </widget>
+	    <packing>
+	      <property name="left_attach">1</property>
+	      <property name="right_attach">2</property>
+	      <property name="top_attach">0</property>
+	      <property name="bottom_attach">1</property>
+	    </packing>
+	  </child>
+
+	  <child>
+	    <widget class="GtkHScale" id="green_scale">
+	      <property name="visible">True</property>
+	      <property name="can_focus">True</property>
+	      <property name="draw_value">False</property>
+	      <property name="value_pos">GTK_POS_TOP</property>
+	      <property name="digits">1</property>
+	      <property name="update_policy">GTK_UPDATE_CONTINUOUS</property>
+	      <property name="inverted">False</property>
+	      <property name="adjustment">0 0 255 0 0 0</property>
+	      <signal name="value_changed" handler="on_green_scale_value_changed" last_modification_time="Wed, 20 Dec 2006 16:10:29 GMT"/>
+	    </widget>
+	    <packing>
+	      <property name="left_attach">1</property>
+	      <property name="right_attach">2</property>
+	      <property name="top_attach">1</property>
+	      <property name="bottom_attach">2</property>
+	      <property name="x_options">fill</property>
+	    </packing>
+	  </child>
+
+	  <child>
+	    <widget class="GtkHScale" id="blue_scale">
+	      <property name="visible">True</property>
+	      <property name="can_focus">True</property>
+	      <property name="draw_value">False</property>
+	      <property name="value_pos">GTK_POS_TOP</property>
+	      <property name="digits">1</property>
+	      <property name="update_policy">GTK_UPDATE_CONTINUOUS</property>
+	      <property name="inverted">False</property>
+	      <property name="adjustment">0 0 255 0 0 0</property>
+	      <signal name="value_changed" handler="on_blue_scale_value_changed" last_modification_time="Wed, 20 Dec 2006 16:10:49 GMT"/>
+	    </widget>
+	    <packing>
+	      <property name="left_attach">1</property>
+	      <property name="right_attach">2</property>
+	      <property name="top_attach">2</property>
+	      <property name="bottom_attach">3</property>
+	      <property name="x_options">fill</property>
+	    </packing>
+	  </child>
+
+	  <child>
+	    <widget class="GtkLabel" id="label92">
+	      <property name="visible">True</property>
+	      <property name="label" translatable="yes">Red</property>
+	      <property name="use_underline">False</property>
+	      <property name="use_markup">False</property>
+	      <property name="justify">GTK_JUSTIFY_RIGHT</property>
+	      <property name="wrap">False</property>
+	      <property name="selectable">False</property>
+	      <property name="xalign">1</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">0</property>
+	      <property name="right_attach">1</property>
+	      <property name="top_attach">0</property>
+	      <property name="bottom_attach">1</property>
+	      <property name="x_options">fill</property>
+	      <property name="y_options"></property>
+	    </packing>
+	  </child>
+
+	  <child>
+	    <widget class="GtkLabel" id="label93">
+	      <property name="visible">True</property>
+	      <property name="label" translatable="yes">Green</property>
+	      <property name="use_underline">False</property>
+	      <property name="use_markup">False</property>
+	      <property name="justify">GTK_JUSTIFY_RIGHT</property>
+	      <property name="wrap">False</property>
+	      <property name="selectable">False</property>
+	      <property name="xalign">1</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">0</property>
+	      <property name="right_attach">1</property>
+	      <property name="top_attach">1</property>
+	      <property name="bottom_attach">2</property>
+	      <property name="x_options">fill</property>
+	      <property name="y_options"></property>
+	    </packing>
+	  </child>
+
+	  <child>
+	    <widget class="GtkLabel" id="label94">
+	      <property name="visible">True</property>
+	      <property name="label" translatable="yes">Blue</property>
+	      <property name="use_underline">False</property>
+	      <property name="use_markup">False</property>
+	      <property name="justify">GTK_JUSTIFY_RIGHT</property>
+	      <property name="wrap">False</property>
+	      <property name="selectable">False</property>
+	      <property name="xalign">1</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">0</property>
+	      <property name="right_attach">1</property>
+	      <property name="top_attach">2</property>
+	      <property name="bottom_attach">3</property>
+	      <property name="x_options">fill</property>
+	      <property name="y_options"></property>
+	    </packing>
+	  </child>
+	</widget>
+	<packing>
+	  <property name="padding">0</property>
+	  <property name="expand">True</property>
+	  <property name="fill">True</property>
+	</packing>
+      </child>
+
+      <child>
+	<widget class="GtkHButtonBox" id="hbuttonbox11">
+	  <property name="visible">True</property>
+	  <property name="layout_style">GTK_BUTTONBOX_END</property>
+	  <property name="spacing">6</property>
+
+	  <child>
+	    <widget class="GtkButton" id="colorize_close">
+	      <property name="visible">True</property>
+	      <property name="can_default">True</property>
+	      <property name="has_default">True</property>
+	      <property name="can_focus">True</property>
+	      <property name="label">gtk-close</property>
+	      <property name="use_stock">True</property>
+	      <property name="relief">GTK_RELIEF_NORMAL</property>
+	      <property name="focus_on_click">True</property>
+	      <signal name="clicked" handler="on_colorize_close_clicked" last_modification_time="Wed, 20 Dec 2006 16:12:55 GMT"/>
+	    </widget>
+	  </child>
+	</widget>
+	<packing>
+	  <property name="padding">0</property>
+	  <property name="expand">False</property>
+	  <property name="fill">False</property>
+	</packing>
+      </child>
+    </widget>
+  </child>
+</widget>
+
 </glade-interface>
--- a/audacious/prefswin.c	Wed Dec 20 07:09:22 2006 -0800
+++ b/audacious/prefswin.c	Wed Dec 20 07:57:56 2006 -0800
@@ -89,6 +89,7 @@
 
 static GtkWidget *prefswin = NULL;
 static GtkWidget *filepopup_settings = NULL;
+static GtkWidget *colorize_settings = NULL;
 static GtkWidget *category_treeview = NULL;
 static GtkWidget *category_notebook = NULL;
 GtkWidget *filepopupbutton = NULL;
@@ -2066,6 +2067,93 @@
 }
 
 static void
+on_colorize_button_clicked(GtkButton *button, gpointer data)
+{
+	GladeXML *xml = prefswin_get_xml();
+	GtkWidget *widget;
+
+	widget = glade_xml_get_widget(xml, "red_scale");
+	gtk_range_set_value(GTK_RANGE(widget), cfg.colorize_r);
+
+	widget = glade_xml_get_widget(xml, "green_scale");
+	gtk_range_set_value(GTK_RANGE(widget), cfg.colorize_g);
+
+	widget = glade_xml_get_widget(xml, "blue_scale");
+	gtk_range_set_value(GTK_RANGE(widget), cfg.colorize_b);
+
+	gtk_widget_show(colorize_settings);
+}
+
+static void
+on_red_scale_value_changed(GtkHScale *scale, gpointer data)
+{
+	GladeXML *xml = prefswin_get_xml();
+	GtkWidget *widget;
+	gint value;
+
+	value = gtk_range_get_value(GTK_RANGE(scale));
+
+	if (value != cfg.colorize_r)
+	{
+		cfg.colorize_r = value;
+
+		/* reload the skin to apply the change */
+		skin_reload_forced();
+		draw_main_window(TRUE);
+		draw_equalizer_window(TRUE);
+		draw_playlist_window(TRUE);
+	}
+}
+
+static void
+on_green_scale_value_changed(GtkHScale *scale, gpointer data)
+{
+	GladeXML *xml = prefswin_get_xml();
+	GtkWidget *widget;
+	gint value;
+
+	value = gtk_range_get_value(GTK_RANGE(scale));
+
+	if (value != cfg.colorize_r)
+	{
+		cfg.colorize_g = value;
+
+		/* reload the skin to apply the change */
+		skin_reload_forced();
+		draw_main_window(TRUE);
+		draw_equalizer_window(TRUE);
+		draw_playlist_window(TRUE);
+	}
+}
+
+static void
+on_blue_scale_value_changed(GtkHScale *scale, gpointer data)
+{
+	GladeXML *xml = prefswin_get_xml();
+	GtkWidget *widget;
+	gint value;
+
+	value = gtk_range_get_value(GTK_RANGE(scale));
+
+	if (value != cfg.colorize_r)
+	{
+		cfg.colorize_b = value;
+
+		/* reload the skin to apply the change */
+		skin_reload_forced();
+		draw_main_window(TRUE);
+		draw_equalizer_window(TRUE);
+		draw_playlist_window(TRUE);
+	}
+}
+
+static void
+on_colorize_close_clicked(GtkButton *button, gpointer data)
+{
+	gtk_widget_hide(colorize_settings);
+}
+
+static void
 on_filepopup_for_tuple_settings_clicked(GtkButton *button, gpointer data)
 {
 	GladeXML *xml = prefswin_get_xml();
@@ -2248,6 +2336,13 @@
     /* show window manager decorations */
     FUNC_MAP_ENTRY(on_show_wm_decorations_toggled)
     FUNC_MAP_ENTRY(on_show_wm_decorations_realize)
+
+    /* colorize */
+    FUNC_MAP_ENTRY(on_colorize_button_clicked)
+    FUNC_MAP_ENTRY(on_red_scale_value_changed)
+    FUNC_MAP_ENTRY(on_green_scale_value_changed)
+    FUNC_MAP_ENTRY(on_blue_scale_value_changed)
+    FUNC_MAP_ENTRY(on_colorize_close_clicked)
 FUNC_MAP_END
 
 void
@@ -2482,6 +2577,11 @@
 	g_signal_connect(G_OBJECT(widget2), "toggled",
 		G_CALLBACK(on_recurse_for_cover_toggled),
 		widget);
+
+	/* Create window for filepopup settings */
+	colorize_settings = glade_xml_get_widget(xml, "colorize_popup");
+	gtk_window_set_transient_for(GTK_WINDOW(colorize_settings), GTK_WINDOW(prefswin));
+	gtk_widget_hide(colorize_settings);
 }
 
 void