annotate src/audacious/ui_skinned_monostereo.c @ 3729:61bd79ce977a

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