annotate src/skins/ui_skinned_equalizer_graph.c @ 2888:7c7471554d88

convert some widgets into windowless ones
author Tomasz Mon <desowin@gmail.com>
date Tue, 12 Aug 2008 15:50:01 +0200
parents e6f015ac0421
children 3134a0987162
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2591
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1 /*
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
2 * Audacious - a cross-platform multimedia player
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
3 * Copyright (c) 2007 Tomasz Moń
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
4 *
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
5 * Based on:
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
6 * BMP - Cross-platform multimedia player
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
7 * Copyright (C) 2003-2004 BMP development team.
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
8 * XMMS:
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
9 * Copyright (C) 1998-2003 XMMS development team.
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
10 *
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
11 * This program is free software; you can redistribute it and/or modify
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
12 * it under the terms of the GNU General Public License as published by
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
13 * the Free Software Foundation; under version 3 of the License.
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
14 *
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
15 * This program is distributed in the hope that it will be useful,
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
18 * GNU General Public License for more details.
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
19 *
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
20 * You should have received a copy of the GNU General Public License
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
21 * along with this program; If not, see <http://www.gnu.org/licenses>.
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
22 */
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
23
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
24 #include "ui_skin.h"
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
25 #include "ui_skinned_equalizer_graph.h"
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
26 #include "skins_cfg.h"
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
27 #include <audacious/plugin.h>
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
28
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
29 #define UI_TYPE_SKINNED_EQUALIZER_GRAPH (ui_skinned_equalizer_graph_get_type())
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
30
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
31 enum {
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
32 DOUBLED,
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
33 LAST_SIGNAL
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
34 };
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
35
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
36 static void ui_skinned_equalizer_graph_class_init (UiSkinnedEqualizerGraphClass *klass);
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
37 static void ui_skinned_equalizer_graph_init (UiSkinnedEqualizerGraph *equalizer_graph);
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
38 static void ui_skinned_equalizer_graph_destroy (GtkObject *object);
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
39 static void ui_skinned_equalizer_graph_realize (GtkWidget *widget);
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
40 static void ui_skinned_equalizer_graph_size_request (GtkWidget *widget, GtkRequisition *requisition);
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
41 static void ui_skinned_equalizer_graph_size_allocate (GtkWidget *widget, GtkAllocation *allocation);
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
42 static gboolean ui_skinned_equalizer_graph_expose (GtkWidget *widget, GdkEventExpose *event);
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
43 static void ui_skinned_equalizer_graph_toggle_scaled (UiSkinnedEqualizerGraph *equalizer_graph);
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
44
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
45 static GtkWidgetClass *parent_class = NULL;
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
46 static guint equalizer_graph_signals[LAST_SIGNAL] = { 0 };
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
47
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
48 GType ui_skinned_equalizer_graph_get_type() {
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
49 static GType equalizer_graph_type = 0;
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
50 if (!equalizer_graph_type) {
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
51 static const GTypeInfo equalizer_graph_info = {
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
52 sizeof (UiSkinnedEqualizerGraphClass),
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
53 NULL,
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
54 NULL,
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
55 (GClassInitFunc) ui_skinned_equalizer_graph_class_init,
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
56 NULL,
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
57 NULL,
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
58 sizeof (UiSkinnedEqualizerGraph),
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
59 0,
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
60 (GInstanceInitFunc) ui_skinned_equalizer_graph_init,
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
61 };
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
62 equalizer_graph_type = g_type_register_static (GTK_TYPE_WIDGET, "UiSkinnedEqualizerGraph", &equalizer_graph_info, 0);
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
63 }
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
64
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
65 return equalizer_graph_type;
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
66 }
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
67
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
68 static void ui_skinned_equalizer_graph_class_init(UiSkinnedEqualizerGraphClass *klass) {
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
69 GObjectClass *gobject_class;
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
70 GtkObjectClass *object_class;
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
71 GtkWidgetClass *widget_class;
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
72
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
73 gobject_class = G_OBJECT_CLASS(klass);
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
74 object_class = (GtkObjectClass*) klass;
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
75 widget_class = (GtkWidgetClass*) klass;
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
76 parent_class = gtk_type_class (gtk_widget_get_type ());
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
77
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
78 object_class->destroy = ui_skinned_equalizer_graph_destroy;
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
79
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
80 widget_class->realize = ui_skinned_equalizer_graph_realize;
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
81 widget_class->expose_event = ui_skinned_equalizer_graph_expose;
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
82 widget_class->size_request = ui_skinned_equalizer_graph_size_request;
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
83 widget_class->size_allocate = ui_skinned_equalizer_graph_size_allocate;
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
84
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
85 klass->scaled = ui_skinned_equalizer_graph_toggle_scaled;
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
86
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
87 equalizer_graph_signals[DOUBLED] =
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
88 g_signal_new ("toggle-scaled", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
89 G_STRUCT_OFFSET (UiSkinnedEqualizerGraphClass, scaled), NULL, NULL,
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
90 gtk_marshal_VOID__VOID, G_TYPE_NONE, 0);
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
91 }
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
92
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
93 static void ui_skinned_equalizer_graph_init(UiSkinnedEqualizerGraph *equalizer_graph) {
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
94 equalizer_graph->width = 113;
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
95 equalizer_graph->height = 19;
2888
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2591
diff changeset
96
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2591
diff changeset
97 GTK_WIDGET_SET_FLAGS(equalizer_graph, GTK_NO_WINDOW);
2591
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
98 }
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
99
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
100 GtkWidget* ui_skinned_equalizer_graph_new(GtkWidget *fixed, gint x, gint y) {
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
101 UiSkinnedEqualizerGraph *equalizer_graph = g_object_new (ui_skinned_equalizer_graph_get_type (), NULL);
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
102
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
103 equalizer_graph->x = x;
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
104 equalizer_graph->y = y;
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
105 equalizer_graph->skin_index = SKIN_EQMAIN;
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
106 equalizer_graph->scaled = FALSE;
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
107
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
108 gtk_fixed_put(GTK_FIXED(fixed), GTK_WIDGET(equalizer_graph), equalizer_graph->x, equalizer_graph->y);
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
109
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
110 return GTK_WIDGET(equalizer_graph);
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
111 }
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
112
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
113 static void ui_skinned_equalizer_graph_destroy(GtkObject *object) {
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
114 UiSkinnedEqualizerGraph *equalizer_graph;
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
115
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
116 g_return_if_fail (object != NULL);
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
117 g_return_if_fail (UI_SKINNED_IS_EQUALIZER_GRAPH (object));
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
118
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
119 equalizer_graph = UI_SKINNED_EQUALIZER_GRAPH (object);
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
120
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
121 if (GTK_OBJECT_CLASS (parent_class)->destroy)
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
122 (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
123 }
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
124
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
125 static void ui_skinned_equalizer_graph_realize(GtkWidget *widget) {
2888
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2591
diff changeset
126 if (GTK_WIDGET_CLASS (parent_class)->realize)
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2591
diff changeset
127 (* GTK_WIDGET_CLASS (parent_class)->realize) (widget);
2591
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
128 }
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
129
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
130 static void ui_skinned_equalizer_graph_size_request(GtkWidget *widget, GtkRequisition *requisition) {
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
131 UiSkinnedEqualizerGraph *equalizer_graph = UI_SKINNED_EQUALIZER_GRAPH(widget);
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
132
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
133 requisition->width = equalizer_graph->width*(equalizer_graph->scaled ? config.scale_factor : 1);
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
134 requisition->height = equalizer_graph->height*(equalizer_graph->scaled ? config.scale_factor : 1);
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
135 }
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
136
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
137 static void ui_skinned_equalizer_graph_size_allocate(GtkWidget *widget, GtkAllocation *allocation) {
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
138 UiSkinnedEqualizerGraph *equalizer_graph = UI_SKINNED_EQUALIZER_GRAPH (widget);
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
139
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
140 widget->allocation = *allocation;
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
141 widget->allocation.x *= (equalizer_graph->scaled ? config.scale_factor : 1);
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
142 widget->allocation.y *= (equalizer_graph->scaled ? config.scale_factor : 1);
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
143
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
144 equalizer_graph->x = widget->allocation.x/(equalizer_graph->scaled ? config.scale_factor : 1);
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
145 equalizer_graph->y = widget->allocation.y/(equalizer_graph->scaled ? config.scale_factor : 1);
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
146 }
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
147
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
148 void
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
149 init_spline(gfloat * x, gfloat * y, gint n, gfloat * y2)
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
150 {
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
151 gint i, k;
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
152 gfloat p, qn, sig, un, *u;
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
153
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
154 u = (gfloat *) g_malloc(n * sizeof(gfloat));
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
155
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
156 y2[0] = u[0] = 0.0;
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
157
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
158 for (i = 1; i < n - 1; i++) {
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
159 sig = ((gfloat) x[i] - x[i - 1]) / ((gfloat) x[i + 1] - x[i - 1]);
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
160 p = sig * y2[i - 1] + 2.0;
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
161 y2[i] = (sig - 1.0) / p;
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
162 u[i] =
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
163 (((gfloat) y[i + 1] - y[i]) / (x[i + 1] - x[i])) -
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
164 (((gfloat) y[i] - y[i - 1]) / (x[i] - x[i - 1]));
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
165 u[i] = (6.0 * u[i] / (x[i + 1] - x[i - 1]) - sig * u[i - 1]) / p;
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
166 }
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
167 qn = un = 0.0;
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
168
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
169 y2[n - 1] = (un - qn * u[n - 2]) / (qn * y2[n - 2] + 1.0);
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
170 for (k = n - 2; k >= 0; k--)
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
171 y2[k] = y2[k] * y2[k + 1] + u[k];
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
172 g_free(u);
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
173 }
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
174
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
175 gfloat
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
176 eval_spline(gfloat xa[], gfloat ya[], gfloat y2a[], gint n, gfloat x)
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
177 {
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
178 gint klo, khi, k;
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
179 gfloat h, b, a;
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
180
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
181 klo = 0;
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
182 khi = n - 1;
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
183 while (khi - klo > 1) {
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
184 k = (khi + klo) >> 1;
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
185 if (xa[k] > x)
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
186 khi = k;
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
187 else
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
188 klo = k;
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
189 }
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
190 h = xa[khi] - xa[klo];
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
191 a = (xa[khi] - x) / h;
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
192 b = (x - xa[klo]) / h;
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
193 return (a * ya[klo] + b * ya[khi] +
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
194 ((a * a * a - a) * y2a[klo] +
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
195 (b * b * b - b) * y2a[khi]) * (h * h) / 6.0);
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
196 }
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
197
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
198 static gboolean ui_skinned_equalizer_graph_expose(GtkWidget *widget, GdkEventExpose *event) {
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
199 g_return_val_if_fail (widget != NULL, FALSE);
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
200 g_return_val_if_fail (UI_SKINNED_IS_EQUALIZER_GRAPH (widget), FALSE);
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
201 g_return_val_if_fail (event != NULL, FALSE);
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
202
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
203 UiSkinnedEqualizerGraph *equalizer_graph = UI_SKINNED_EQUALIZER_GRAPH (widget);
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
204 g_return_val_if_fail (equalizer_graph->width > 0 && equalizer_graph->height > 0, FALSE);
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
205
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
206 GdkPixbuf *obj = NULL;
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
207
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
208 obj = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, equalizer_graph->width, equalizer_graph->height);
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
209
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
210 guint32 cols[19], rowstride;
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
211 gint i, y, ymin, ymax, py = 0;
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
212 gfloat x[] = { 0, 11, 23, 35, 47, 59, 71, 83, 97, 109 }, yf[10];
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
213 guchar* pixels, *p;
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
214 gint n_channels;
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
215 /*
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
216 * This avoids the init_spline() function to be inlined.
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
217 * Inlining the function caused troubles when compiling with
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
218 * `-O' (at least on FreeBSD).
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
219 */
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
220 void (*__init_spline) (gfloat *, gfloat *, gint, gfloat *) = init_spline;
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
221
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
222 skin_draw_pixbuf(widget, aud_active_skin, obj, equalizer_graph->skin_index, 0, 294, 0, 0,
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
223 equalizer_graph->width, equalizer_graph->height);
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
224 skin_draw_pixbuf(widget, aud_active_skin, obj, equalizer_graph->skin_index, 0, 314,
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
225 0, 9 + ((aud_cfg->equalizer_preamp * 9) / 20),
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
226 equalizer_graph->width, 1);
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
227
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
228 skin_get_eq_spline_colors(aud_active_skin, cols);
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
229
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
230 __init_spline(x, aud_cfg->equalizer_bands, 10, yf);
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
231 for (i = 0; i < 109; i++) {
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
232 y = 9 -
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
233 (gint) ((eval_spline(x, aud_cfg->equalizer_bands, yf, 10, i) *
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
234 9.0) / EQUALIZER_MAX_GAIN);
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
235 if (y < 0)
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
236 y = 0;
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
237 if (y > 18)
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
238 y = 18;
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
239 if (!i)
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
240 py = y;
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
241 if (y < py) {
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
242 ymin = y;
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
243 ymax = py;
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
244 }
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
245 else {
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
246 ymin = py;
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
247 ymax = y;
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
248 }
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
249 py = y;
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
250
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
251 pixels = gdk_pixbuf_get_pixels(obj);
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
252 rowstride = gdk_pixbuf_get_rowstride(obj);
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
253 n_channels = gdk_pixbuf_get_n_channels(obj);
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
254
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
255 for (y = ymin; y <= ymax; y++)
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
256 {
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
257 p = pixels + (y * rowstride) + (( i + 2) * n_channels);
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
258 p[0] = (cols[y] & 0xff0000) >> 16;
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
259 p[1] = (cols[y] & 0x00ff00) >> 8;
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
260 p[2] = (cols[y] & 0x0000ff);
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
261 /* do we really need to treat the alpha channel? */
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
262 /*if (n_channels == 4)
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
263 p[3] = cols[y] >> 24;*/
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
264 }
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
265 }
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
266
2888
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2591
diff changeset
267 ui_skinned_widget_draw_with_coordinates(widget, obj, equalizer_graph->width, equalizer_graph->height,
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2591
diff changeset
268 widget->allocation.x,
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2591
diff changeset
269 widget->allocation.y,
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2591
diff changeset
270 equalizer_graph->scaled);
2591
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
271
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
272 g_object_unref(obj);
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
273
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
274 return FALSE;
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
275 }
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
276
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
277 static void ui_skinned_equalizer_graph_toggle_scaled(UiSkinnedEqualizerGraph *equalizer_graph) {
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
278 GtkWidget *widget = GTK_WIDGET (equalizer_graph);
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
279
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
280 equalizer_graph->scaled = !equalizer_graph->scaled;
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
281 gtk_widget_set_size_request(widget, equalizer_graph->width*(equalizer_graph->scaled ? config.scale_factor : 1),
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
282 equalizer_graph->height*(equalizer_graph->scaled ? config.scale_factor : 1));
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
283
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
284 gtk_widget_queue_draw(GTK_WIDGET(equalizer_graph));
e6f015ac0421 add ui_skinned_equalizer_graph
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
285 }