annotate src/audacious/legacy/ui_skinned_monostereo.c @ 4707:512217ec24cc

removed some UI calls from the prefs code
author mf0102 <0102@gmx.at>
date Mon, 07 Jul 2008 23:13:55 +0200
parents 3a56d2786063
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4700
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
1 /*
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
2 * Audacious - a cross-platform multimedia player
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
3 * Copyright (c) 2007 Tomasz Moń
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
4 *
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
5 * Based on:
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
6 * BMP - Cross-platform multimedia player
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
7 * Copyright (C) 2003-2004 BMP development team.
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
8 * XMMS:
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
9 * Copyright (C) 1998-2003 XMMS development team.
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
10 *
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
11 * This program is free software; you can redistribute it and/or modify
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
12 * it under the terms of the GNU General Public License as published by
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
13 * the Free Software Foundation; under version 3 of the License.
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
14 *
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
15 * This program is distributed in the hope that it will be useful,
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
18 * GNU General Public License for more details.
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
19 *
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
20 * You should have received a copy of the GNU General Public License
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
21 * along with this program. If not, see <http://www.gnu.org/licenses>.
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
22 *
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
23 * The Audacious team does not consider modular code linking to
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
24 * Audacious or using our public API to be a derived work.
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
25 */
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
26
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
27 #include "ui_skin.h"
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
28 #include "ui_skinned_monostereo.h"
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
29 #include "main.h"
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
30
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
31 enum {
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
32 DOUBLED,
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
33 LAST_SIGNAL
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
34 };
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
35
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
36 static void ui_skinned_monostereo_class_init (UiSkinnedMonoStereoClass *klass);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
37 static void ui_skinned_monostereo_init (UiSkinnedMonoStereo *monostereo);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
38 static void ui_skinned_monostereo_destroy (GtkObject *object);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
39 static void ui_skinned_monostereo_realize (GtkWidget *widget);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
40 static void ui_skinned_monostereo_size_request (GtkWidget *widget, GtkRequisition *requisition);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
41 static void ui_skinned_monostereo_size_allocate (GtkWidget *widget, GtkAllocation *allocation);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
42 static gboolean ui_skinned_monostereo_expose (GtkWidget *widget, GdkEventExpose *event);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
43 static void ui_skinned_monostereo_toggle_scaled (UiSkinnedMonoStereo *monostereo);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
44
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
45 static GtkWidgetClass *parent_class = NULL;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
46 static guint monostereo_signals[LAST_SIGNAL] = { 0 };
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
47
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
48 GType ui_skinned_monostereo_get_type() {
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
49 static GType monostereo_type = 0;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
50 if (!monostereo_type) {
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
51 static const GTypeInfo monostereo_info = {
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
52 sizeof (UiSkinnedMonoStereoClass),
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
53 NULL,
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
54 NULL,
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
55 (GClassInitFunc) ui_skinned_monostereo_class_init,
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
56 NULL,
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
57 NULL,
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
58 sizeof (UiSkinnedMonoStereo),
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
59 0,
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
60 (GInstanceInitFunc) ui_skinned_monostereo_init,
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
61 };
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
62 monostereo_type = g_type_register_static (GTK_TYPE_WIDGET, "UiSkinnedMonoStereo_", &monostereo_info, 0);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
63 }
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
64
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
65 return monostereo_type;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
66 }
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
67
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
68 static void ui_skinned_monostereo_class_init(UiSkinnedMonoStereoClass *klass) {
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
69 GObjectClass *gobject_class;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
70 GtkObjectClass *object_class;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
71 GtkWidgetClass *widget_class;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
72
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
73 gobject_class = G_OBJECT_CLASS(klass);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
74 object_class = (GtkObjectClass*) klass;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
75 widget_class = (GtkWidgetClass*) klass;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
76 parent_class = gtk_type_class (gtk_widget_get_type ());
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
77
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
78 object_class->destroy = ui_skinned_monostereo_destroy;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
79
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
80 widget_class->realize = ui_skinned_monostereo_realize;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
81 widget_class->expose_event = ui_skinned_monostereo_expose;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
82 widget_class->size_request = ui_skinned_monostereo_size_request;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
83 widget_class->size_allocate = ui_skinned_monostereo_size_allocate;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
84
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
85 klass->scaled = ui_skinned_monostereo_toggle_scaled;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
86
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
87 monostereo_signals[DOUBLED] =
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
88 g_signal_new ("toggle-scaled", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
89 G_STRUCT_OFFSET (UiSkinnedMonoStereoClass, scaled), NULL, NULL,
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
90 gtk_marshal_VOID__VOID, G_TYPE_NONE, 0);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
91 }
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
92
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
93 static void ui_skinned_monostereo_init(UiSkinnedMonoStereo *monostereo) {
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
94 monostereo->width = 56;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
95 monostereo->height = 12;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
96 }
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
97
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
98 GtkWidget* ui_skinned_monostereo_new(GtkWidget *fixed, gint x, gint y, SkinPixmapId si) {
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
99 UiSkinnedMonoStereo *monostereo = g_object_new (ui_skinned_monostereo_get_type (), NULL);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
100
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
101 monostereo->x = x;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
102 monostereo->y = y;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
103 monostereo->skin_index = si;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
104 monostereo->scaled = FALSE;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
105
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
106 gtk_fixed_put(GTK_FIXED(fixed), GTK_WIDGET(monostereo), monostereo->x, monostereo->y);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
107
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
108 return GTK_WIDGET(monostereo);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
109 }
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
110
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
111 static void ui_skinned_monostereo_destroy(GtkObject *object) {
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
112 UiSkinnedMonoStereo *monostereo;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
113
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
114 g_return_if_fail (object != NULL);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
115 g_return_if_fail (UI_SKINNED_IS_MONOSTEREO (object));
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
116
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
117 monostereo = UI_SKINNED_MONOSTEREO (object);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
118
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
119 if (GTK_OBJECT_CLASS (parent_class)->destroy)
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
120 (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
121 }
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
122
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
123 static void ui_skinned_monostereo_realize(GtkWidget *widget) {
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
124 UiSkinnedMonoStereo *monostereo;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
125 GdkWindowAttr attributes;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
126 gint attributes_mask;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
127
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
128 g_return_if_fail (widget != NULL);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
129 g_return_if_fail (UI_SKINNED_IS_MONOSTEREO(widget));
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
130
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
131 GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
132 monostereo = UI_SKINNED_MONOSTEREO(widget);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
133
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
134 attributes.x = widget->allocation.x;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
135 attributes.y = widget->allocation.y;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
136 attributes.width = widget->allocation.width;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
137 attributes.height = widget->allocation.height;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
138 attributes.wclass = GDK_INPUT_OUTPUT;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
139 attributes.window_type = GDK_WINDOW_CHILD;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
140 attributes.event_mask = gtk_widget_get_events(widget);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
141 attributes.event_mask |= GDK_EXPOSURE_MASK;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
142 attributes.visual = gtk_widget_get_visual(widget);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
143 attributes.colormap = gtk_widget_get_colormap(widget);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
144
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
145 attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
146 widget->window = gdk_window_new(widget->parent->window, &attributes, attributes_mask);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
147
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
148 widget->style = gtk_style_attach(widget->style, widget->window);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
149
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
150 gdk_window_set_user_data(widget->window, widget);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
151 }
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
152
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
153 static void ui_skinned_monostereo_size_request(GtkWidget *widget, GtkRequisition *requisition) {
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
154 UiSkinnedMonoStereo *monostereo = UI_SKINNED_MONOSTEREO(widget);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
155
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
156 requisition->width = monostereo->width*(monostereo->scaled ? cfg.scale_factor : 1);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
157 requisition->height = monostereo->height*(monostereo->scaled ? cfg.scale_factor : 1);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
158 }
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
159
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
160 static void ui_skinned_monostereo_size_allocate(GtkWidget *widget, GtkAllocation *allocation) {
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
161 UiSkinnedMonoStereo *monostereo = UI_SKINNED_MONOSTEREO (widget);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
162
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
163 widget->allocation = *allocation;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
164 widget->allocation.x *= (monostereo->scaled ? cfg.scale_factor : 1);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
165 widget->allocation.y *= (monostereo->scaled ? cfg.scale_factor : 1);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
166 if (GTK_WIDGET_REALIZED (widget))
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
167 gdk_window_move_resize(widget->window, widget->allocation.x, widget->allocation.y, allocation->width, allocation->height);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
168
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
169 monostereo->x = widget->allocation.x/(monostereo->scaled ? cfg.scale_factor : 1);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
170 monostereo->y = widget->allocation.y/(monostereo->scaled ? cfg.scale_factor : 1);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
171 }
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
172
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
173 static gboolean ui_skinned_monostereo_expose(GtkWidget *widget, GdkEventExpose *event) {
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
174 g_return_val_if_fail (widget != NULL, FALSE);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
175 g_return_val_if_fail (UI_SKINNED_IS_MONOSTEREO (widget), FALSE);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
176 g_return_val_if_fail (event != NULL, FALSE);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
177
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
178 UiSkinnedMonoStereo *monostereo = UI_SKINNED_MONOSTEREO (widget);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
179 g_return_val_if_fail (monostereo->width > 0 && monostereo->height > 0, FALSE);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
180
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
181 GdkPixbuf *obj = NULL;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
182 obj = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, monostereo->width, monostereo->height);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
183
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
184 switch (monostereo->num_channels) {
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
185 case 1:
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
186 skin_draw_pixbuf(widget, aud_active_skin, obj, monostereo->skin_index, 29, 0, 0, 0, 27, 12);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
187 skin_draw_pixbuf(widget, aud_active_skin, obj, monostereo->skin_index, 0, 12, 27, 0, 29, 12);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
188 break;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
189 case 2:
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
190 skin_draw_pixbuf(widget, aud_active_skin, obj, monostereo->skin_index, 29, 12, 0, 0, 27, 12);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
191 skin_draw_pixbuf(widget, aud_active_skin, obj, monostereo->skin_index, 0, 0, 27, 0, 29, 12);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
192 break;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
193 default:
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
194 case 0:
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
195 skin_draw_pixbuf(widget, aud_active_skin, obj, monostereo->skin_index, 29, 12, 0, 0, 27, 12);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
196 skin_draw_pixbuf(widget, aud_active_skin, obj, monostereo->skin_index, 0, 12, 27, 0, 29, 12);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
197 break;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
198 }
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
199
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
200 ui_skinned_widget_draw(widget, obj, monostereo->width, monostereo->height, monostereo->scaled);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
201
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
202 g_object_unref(obj);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
203
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
204 return FALSE;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
205 }
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
206
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
207 static void ui_skinned_monostereo_toggle_scaled(UiSkinnedMonoStereo *monostereo) {
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
208 GtkWidget *widget = GTK_WIDGET (monostereo);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
209
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
210 monostereo->scaled = !monostereo->scaled;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
211 gtk_widget_set_size_request(widget, monostereo->width*(monostereo->scaled ? cfg.scale_factor : 1), monostereo->height*(monostereo->scaled ? cfg.scale_factor : 1));
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
212
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
213 gtk_widget_queue_draw(GTK_WIDGET(monostereo));
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
214 }
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
215
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
216 void ui_skinned_monostereo_set_num_channels(GtkWidget *widget, gint nch) {
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
217 g_return_if_fail (UI_SKINNED_IS_MONOSTEREO (widget));
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
218 UiSkinnedMonoStereo *monostereo = UI_SKINNED_MONOSTEREO (widget);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
219
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
220 monostereo->num_channels = nch;
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
221 gtk_widget_queue_draw(widget);
3a56d2786063 move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
diff changeset
222 }