annotate src/skins/ui_skinned_equalizer_slider.c @ 3103:b562bc52a93e

ported OSS
author Michal Lipski <tallica@o2.pl>
date Thu, 30 Apr 2009 18:06:46 +0200
parents 6baa6eaf8290
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2605
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1 /*
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
2 * Audacious - a cross-platform multimedia player
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
3 * Copyright (c) 2007 Tomasz Moń
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
4 *
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
5 * Based on:
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
6 * BMP - Cross-platform multimedia player
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
7 * Copyright (C) 2003-2004 BMP development team.
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
8 * XMMS:
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
9 * Copyright (C) 1998-2003 XMMS development team.
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
10 *
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
11 * This program is free software; you can redistribute it and/or modify
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
12 * it under the terms of the GNU General Public License as published by
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
13 * the Free Software Foundation; under version 3 of the License.
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
14 *
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
15 * This program is distributed in the hope that it will be useful,
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
18 * GNU General Public License for more details.
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
19 *
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
20 * You should have received a copy of the GNU General Public License
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
21 * along with this program; If not, see <http://www.gnu.org/licenses>.
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
22 */
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
23
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
24 #include "ui_skin.h"
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
25 #include "ui_equalizer.h"
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
26 #include "ui_main.h"
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
27 #include "skins_cfg.h"
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
28 #include "ui_skinned_equalizer_slider.h"
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
29 #include <glib/gi18n.h>
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
30
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
31 #define UI_TYPE_SKINNED_EQUALIZER_SLIDER (ui_skinned_equalizer_slider_get_type())
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
32 #define UI_SKINNED_EQUALIZER_SLIDER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UI_TYPE_SKINNED_EQUALIZER_SLIDER, UiSkinnedEqualizerSliderPrivate))
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
33 typedef struct _UiSkinnedEqualizerSliderPrivate UiSkinnedEqualizerSliderPrivate;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
34
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
35 enum {
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
36 DOUBLED,
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
37 LAST_SIGNAL
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
38 };
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
39
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
40 struct _UiSkinnedEqualizerSliderPrivate {
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
41 SkinPixmapId skin_index;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
42 gboolean scaled;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
43 gint position;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
44 gint width, height;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
45 gboolean pressed;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
46 gint drag_y;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
47 gfloat value; /* store gain as is to prevent truncation --asphyx */
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
48 };
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
49
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
50 static void ui_skinned_equalizer_slider_class_init (UiSkinnedEqualizerSliderClass *klass);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
51 static void ui_skinned_equalizer_slider_init (UiSkinnedEqualizerSlider *equalizer_slider);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
52 static void ui_skinned_equalizer_slider_destroy (GtkObject *object);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
53 static void ui_skinned_equalizer_slider_realize (GtkWidget *widget);
2888
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
54 static void ui_skinned_equalizer_slider_unrealize (GtkWidget *widget);
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
55 static void ui_skinned_equalizer_slider_map (GtkWidget *widget);
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
56 static void ui_skinned_equalizer_slider_unmap (GtkWidget *widget);
2605
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
57 static void ui_skinned_equalizer_slider_size_request (GtkWidget *widget, GtkRequisition *requisition);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
58 static void ui_skinned_equalizer_slider_size_allocate (GtkWidget *widget, GtkAllocation *allocation);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
59 static gboolean ui_skinned_equalizer_slider_expose (GtkWidget *widget, GdkEventExpose *event);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
60 static gboolean ui_skinned_equalizer_slider_button_press (GtkWidget *widget, GdkEventButton *event);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
61 static gboolean ui_skinned_equalizer_slider_button_release (GtkWidget *widget, GdkEventButton *event);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
62 static gboolean ui_skinned_equalizer_slider_motion_notify (GtkWidget *widget, GdkEventMotion *event);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
63 static gboolean ui_skinned_equalizer_slider_scroll (GtkWidget *widget, GdkEventScroll *event);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
64 static void ui_skinned_equalizer_slider_toggle_scaled (UiSkinnedEqualizerSlider *equalizer_slider);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
65 void ui_skinned_equalizer_slider_set_mainwin_text (UiSkinnedEqualizerSlider * es);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
66
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
67 static GtkWidgetClass *parent_class = NULL;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
68 static guint equalizer_slider_signals[LAST_SIGNAL] = { 0 };
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
69
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
70 GType ui_skinned_equalizer_slider_get_type() {
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
71 static GType equalizer_slider_type = 0;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
72 if (!equalizer_slider_type) {
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
73 static const GTypeInfo equalizer_slider_info = {
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
74 sizeof (UiSkinnedEqualizerSliderClass),
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
75 NULL,
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
76 NULL,
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
77 (GClassInitFunc) ui_skinned_equalizer_slider_class_init,
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
78 NULL,
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
79 NULL,
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
80 sizeof (UiSkinnedEqualizerSlider),
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
81 0,
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
82 (GInstanceInitFunc) ui_skinned_equalizer_slider_init,
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
83 };
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
84 equalizer_slider_type = g_type_register_static (GTK_TYPE_WIDGET, "UiSkinnedEqualizerSlider", &equalizer_slider_info, 0);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
85 }
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
86
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
87 return equalizer_slider_type;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
88 }
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
89
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
90 static void ui_skinned_equalizer_slider_class_init(UiSkinnedEqualizerSliderClass *klass) {
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
91 GObjectClass *gobject_class;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
92 GtkObjectClass *object_class;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
93 GtkWidgetClass *widget_class;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
94
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
95 gobject_class = G_OBJECT_CLASS(klass);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
96 object_class = (GtkObjectClass*) klass;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
97 widget_class = (GtkWidgetClass*) klass;
3032
6baa6eaf8290 Don't use deprecated gtk_type_class()
Tomasz Mon <desowin@gmail.com>
parents: 3017
diff changeset
98 parent_class = g_type_class_peek_parent(klass);
2605
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
99
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
100 object_class->destroy = ui_skinned_equalizer_slider_destroy;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
101
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
102 widget_class->realize = ui_skinned_equalizer_slider_realize;
2888
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
103 widget_class->unrealize = ui_skinned_equalizer_slider_unrealize;
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
104 widget_class->map = ui_skinned_equalizer_slider_map;
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
105 widget_class->unmap = ui_skinned_equalizer_slider_unmap;
2605
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
106 widget_class->expose_event = ui_skinned_equalizer_slider_expose;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
107 widget_class->size_request = ui_skinned_equalizer_slider_size_request;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
108 widget_class->size_allocate = ui_skinned_equalizer_slider_size_allocate;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
109 widget_class->button_press_event = ui_skinned_equalizer_slider_button_press;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
110 widget_class->button_release_event = ui_skinned_equalizer_slider_button_release;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
111 widget_class->motion_notify_event = ui_skinned_equalizer_slider_motion_notify;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
112 widget_class->scroll_event = ui_skinned_equalizer_slider_scroll;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
113
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
114 klass->scaled = ui_skinned_equalizer_slider_toggle_scaled;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
115
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
116 equalizer_slider_signals[DOUBLED] =
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
117 g_signal_new ("toggle-scaled", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
118 G_STRUCT_OFFSET (UiSkinnedEqualizerSliderClass, scaled), NULL, NULL,
3017
963796db51ea Don't use deprecated gtk macros and types
Tomasz Mon <desowin@gmail.com>
parents: 2888
diff changeset
119 g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
2605
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
120
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
121 g_type_class_add_private (gobject_class, sizeof (UiSkinnedEqualizerSliderPrivate));
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
122 }
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
123
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
124 static void ui_skinned_equalizer_slider_init(UiSkinnedEqualizerSlider *equalizer_slider) {
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
125 UiSkinnedEqualizerSliderPrivate *priv = UI_SKINNED_EQUALIZER_SLIDER_GET_PRIVATE(equalizer_slider);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
126 priv->pressed = FALSE;
2888
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
127
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
128 equalizer_slider->event_window = NULL;
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
129 GTK_WIDGET_SET_FLAGS(equalizer_slider, GTK_NO_WINDOW);
2605
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
130 }
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
131
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
132 GtkWidget* ui_skinned_equalizer_slider_new(GtkWidget *fixed, gint x, gint y) {
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
133 UiSkinnedEqualizerSlider *es = g_object_new (ui_skinned_equalizer_slider_get_type (), NULL);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
134 UiSkinnedEqualizerSliderPrivate *priv = UI_SKINNED_EQUALIZER_SLIDER_GET_PRIVATE(es);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
135
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
136 es->x = x;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
137 es->y = y;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
138 priv->width = 14;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
139 priv->height = 63;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
140 priv->skin_index = SKIN_EQMAIN;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
141
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
142 gtk_fixed_put(GTK_FIXED(fixed), GTK_WIDGET(es), es->x, es->y);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
143
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
144 return GTK_WIDGET(es);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
145 }
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
146
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
147 static void ui_skinned_equalizer_slider_destroy(GtkObject *object) {
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
148 UiSkinnedEqualizerSlider *equalizer_slider;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
149
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
150 g_return_if_fail (object != NULL);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
151 g_return_if_fail (UI_SKINNED_IS_EQUALIZER_SLIDER (object));
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
152
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
153 equalizer_slider = UI_SKINNED_EQUALIZER_SLIDER (object);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
154
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
155 if (GTK_OBJECT_CLASS (parent_class)->destroy)
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
156 (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
157 }
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
158
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
159 static void ui_skinned_equalizer_slider_realize(GtkWidget *widget) {
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
160 UiSkinnedEqualizerSlider *equalizer_slider;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
161 GdkWindowAttr attributes;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
162 gint attributes_mask;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
163
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
164 g_return_if_fail (widget != NULL);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
165 g_return_if_fail (UI_SKINNED_IS_EQUALIZER_SLIDER(widget));
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
166
2888
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
167 if (GTK_WIDGET_CLASS (parent_class)->realize)
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
168 (* GTK_WIDGET_CLASS (parent_class)->realize) (widget);
2605
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
169 equalizer_slider = UI_SKINNED_EQUALIZER_SLIDER(widget);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
170
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
171 attributes.x = widget->allocation.x;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
172 attributes.y = widget->allocation.y;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
173 attributes.width = widget->allocation.width;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
174 attributes.height = widget->allocation.height;
2888
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
175 attributes.wclass = GDK_INPUT_ONLY;
2605
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
176 attributes.window_type = GDK_WINDOW_CHILD;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
177 attributes.event_mask = gtk_widget_get_events(widget);
2888
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
178 attributes.event_mask |= GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
2605
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
179 GDK_POINTER_MOTION_MASK | GDK_SCROLL_MASK;
2888
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
180
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
181 attributes_mask = GDK_WA_X | GDK_WA_Y;
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
182 equalizer_slider->event_window = gdk_window_new(widget->parent->window, &attributes, attributes_mask);
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
183
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
184 gdk_window_set_user_data(equalizer_slider->event_window, widget);
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
185 }
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
186
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
187 static void ui_skinned_equalizer_slider_unrealize(GtkWidget *widget) {
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
188 UiSkinnedEqualizerSlider *equalizer_slider = UI_SKINNED_EQUALIZER_SLIDER(widget);
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
189
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
190 if ( equalizer_slider->event_window != NULL )
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
191 {
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
192 gdk_window_set_user_data( equalizer_slider->event_window , NULL );
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
193 gdk_window_destroy( equalizer_slider->event_window );
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
194 equalizer_slider->event_window = NULL;
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
195 }
2605
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
196
2888
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
197 if (GTK_WIDGET_CLASS (parent_class)->unrealize)
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
198 (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
199 }
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
200
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
201 static void ui_skinned_equalizer_slider_map (GtkWidget *widget)
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
202 {
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
203 UiSkinnedEqualizerSlider *equalizer_slider = UI_SKINNED_EQUALIZER_SLIDER(widget);
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
204
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
205 if (equalizer_slider->event_window != NULL)
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
206 gdk_window_show (equalizer_slider->event_window);
2605
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
207
2888
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
208 if (GTK_WIDGET_CLASS (parent_class)->map)
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
209 (* GTK_WIDGET_CLASS (parent_class)->map) (widget);
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
210 }
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
211
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
212 static void ui_skinned_equalizer_slider_unmap (GtkWidget *widget)
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
213 {
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
214 UiSkinnedEqualizerSlider *equalizer_slider = UI_SKINNED_EQUALIZER_SLIDER(widget);
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
215
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
216 if (equalizer_slider->event_window != NULL)
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
217 gdk_window_hide (equalizer_slider->event_window);
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
218
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
219 if (GTK_WIDGET_CLASS (parent_class)->unmap)
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
220 (* GTK_WIDGET_CLASS (parent_class)->unmap) (widget);
2605
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
221 }
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
222
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
223 static void ui_skinned_equalizer_slider_size_request(GtkWidget *widget, GtkRequisition *requisition) {
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
224 UiSkinnedEqualizerSliderPrivate *priv = UI_SKINNED_EQUALIZER_SLIDER_GET_PRIVATE(widget);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
225
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
226 requisition->width = priv->width*(priv->scaled ? config.scale_factor : 1);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
227 requisition->height = priv->height*(priv->scaled ? config.scale_factor : 1);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
228 }
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
229
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
230 static void ui_skinned_equalizer_slider_size_allocate(GtkWidget *widget, GtkAllocation *allocation) {
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
231 UiSkinnedEqualizerSlider *equalizer_slider = UI_SKINNED_EQUALIZER_SLIDER (widget);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
232 UiSkinnedEqualizerSliderPrivate *priv = UI_SKINNED_EQUALIZER_SLIDER_GET_PRIVATE(equalizer_slider);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
233
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
234 widget->allocation = *allocation;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
235 widget->allocation.x *= (priv->scaled ? config.scale_factor : 1);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
236 widget->allocation.y *= (priv->scaled ? config.scale_factor : 1);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
237 if (GTK_WIDGET_REALIZED (widget))
2888
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
238 if (equalizer_slider->event_window)
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
239 gdk_window_move_resize(equalizer_slider->event_window, widget->allocation.x, widget->allocation.y, allocation->width, allocation->height);
2605
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
240
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
241 equalizer_slider->x = widget->allocation.x/(priv->scaled ? config.scale_factor : 1);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
242 equalizer_slider->y = widget->allocation.y/(priv->scaled ? config.scale_factor : 1);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
243 }
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
244
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
245 static gboolean ui_skinned_equalizer_slider_expose(GtkWidget *widget, GdkEventExpose *event) {
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
246 g_return_val_if_fail (widget != NULL, FALSE);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
247 g_return_val_if_fail (UI_SKINNED_IS_EQUALIZER_SLIDER (widget), FALSE);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
248 g_return_val_if_fail (event != NULL, FALSE);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
249
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
250 UiSkinnedEqualizerSlider *es = UI_SKINNED_EQUALIZER_SLIDER (widget);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
251 UiSkinnedEqualizerSliderPrivate *priv = UI_SKINNED_EQUALIZER_SLIDER_GET_PRIVATE(es);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
252 g_return_val_if_fail (priv->width > 0 && priv->height > 0, FALSE);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
253
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
254 GdkPixbuf *obj = NULL;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
255 obj = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, priv->width, priv->height);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
256
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
257 gint frame;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
258 frame = 27 - ((priv->position * 27) / 50);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
259 if (frame < 14)
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
260 skin_draw_pixbuf(widget, aud_active_skin, obj, priv->skin_index, (frame * 15) + 13, 164, 0, 0, priv->width, priv->height);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
261 else
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
262 skin_draw_pixbuf(widget, aud_active_skin, obj, priv->skin_index, ((frame - 14) * 15) + 13, 229, 0, 0, priv->width, priv->height);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
263
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
264 if (priv->pressed)
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
265 skin_draw_pixbuf(widget, aud_active_skin, obj, priv->skin_index, 0, 176, 1, priv->position, 11, 11);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
266 else
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
267 skin_draw_pixbuf(widget, aud_active_skin, obj, priv->skin_index, 0, 164, 1, priv->position, 11, 11);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
268
2888
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
269 ui_skinned_widget_draw_with_coordinates(widget, obj, priv->width, priv->height,
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
270 widget->allocation.x,
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
271 widget->allocation.y,
7c7471554d88 convert some widgets into windowless ones
Tomasz Mon <desowin@gmail.com>
parents: 2641
diff changeset
272 priv->scaled);
2605
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
273
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
274 g_object_unref(obj);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
275
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
276 return FALSE;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
277 }
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
278
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
279 static gboolean ui_skinned_equalizer_slider_button_press(GtkWidget *widget, GdkEventButton *event) {
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
280 g_return_val_if_fail (widget != NULL, FALSE);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
281 g_return_val_if_fail (UI_SKINNED_IS_EQUALIZER_SLIDER (widget), FALSE);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
282 g_return_val_if_fail (event != NULL, FALSE);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
283
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
284 UiSkinnedEqualizerSlider *es = UI_SKINNED_EQUALIZER_SLIDER (widget);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
285 UiSkinnedEqualizerSliderPrivate *priv = UI_SKINNED_EQUALIZER_SLIDER_GET_PRIVATE(es);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
286
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
287 gint y;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
288
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
289 if (event->type == GDK_BUTTON_PRESS) {
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
290 if (event->button == 1) {
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
291 priv->pressed = TRUE;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
292 y = event->y/(priv->scaled ? config.scale_factor : 1);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
293
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
294 if (y >= priv->position && y < priv->position + 11)
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
295 priv->drag_y = y - priv->position;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
296 else {
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
297 priv->position = y - 5;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
298 priv->drag_y = 5;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
299 if (priv->position < 0)
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
300 priv->position = 0;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
301 if (priv->position > 50)
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
302 priv->position = 50;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
303 if (priv->position >= 24 && priv->position <= 26)
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
304 priv->position = 25;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
305
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
306 priv->value = ((gfloat) (25 - priv->position) * EQUALIZER_MAX_GAIN / 25.0 );
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
307 equalizerwin_eq_changed();
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
308 }
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
309
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
310 ui_skinned_equalizer_slider_set_mainwin_text(es);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
311 gtk_widget_queue_draw(widget);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
312 }
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
313 }
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
314
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
315 return TRUE;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
316 }
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
317
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
318 static gboolean ui_skinned_equalizer_slider_button_release(GtkWidget *widget, GdkEventButton *event) {
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
319 UiSkinnedEqualizerSliderPrivate *priv = UI_SKINNED_EQUALIZER_SLIDER_GET_PRIVATE(widget);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
320
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
321 if (event->button == 1) {
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
322 priv->pressed = FALSE;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
323 mainwin_release_info_text();
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
324 gtk_widget_queue_draw(widget);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
325 }
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
326 return TRUE;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
327 }
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
328
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
329 static gboolean ui_skinned_equalizer_slider_motion_notify(GtkWidget *widget, GdkEventMotion *event) {
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
330 g_return_val_if_fail (widget != NULL, FALSE);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
331 g_return_val_if_fail (UI_SKINNED_IS_EQUALIZER_SLIDER (widget), FALSE);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
332 g_return_val_if_fail (event != NULL, FALSE);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
333 UiSkinnedEqualizerSlider *es = UI_SKINNED_EQUALIZER_SLIDER(widget);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
334 UiSkinnedEqualizerSliderPrivate *priv = UI_SKINNED_EQUALIZER_SLIDER_GET_PRIVATE(widget);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
335
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
336 if (priv->pressed) {
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
337 gint y;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
338
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
339 y = event->y/(priv->scaled ? config.scale_factor : 1);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
340 priv->position = y - priv->drag_y;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
341
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
342 if (priv->position < 0)
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
343 priv->position = 0;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
344 if (priv->position > 50)
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
345 priv->position = 50;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
346 if (priv->position >= 24 && priv->position <= 26)
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
347 priv->position = 25;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
348
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
349 priv->value = ((gfloat) (25 - priv->position) * EQUALIZER_MAX_GAIN / 25.0 );
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
350 ui_skinned_equalizer_slider_set_mainwin_text(es);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
351 equalizerwin_eq_changed();
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
352 gtk_widget_queue_draw(widget);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
353 }
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
354
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
355 return TRUE;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
356 }
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
357
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
358 static gboolean ui_skinned_equalizer_slider_scroll(GtkWidget *widget, GdkEventScroll *event) {
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
359 g_return_val_if_fail (UI_SKINNED_IS_EQUALIZER_SLIDER (widget), FALSE);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
360 g_return_val_if_fail (event != NULL, FALSE);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
361 UiSkinnedEqualizerSliderPrivate *priv = UI_SKINNED_EQUALIZER_SLIDER_GET_PRIVATE(widget);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
362
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
363 if (event->direction == GDK_SCROLL_UP) {
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
364 priv->position -= 2;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
365
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
366 if (priv->position < 0)
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
367 priv->position = 0;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
368 }
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
369 else {
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
370 priv->position += 2;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
371
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
372 if (priv->position > 50)
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
373 priv->position = 50;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
374 }
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
375
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
376 priv->value = ((gfloat) (25 - priv->position) * EQUALIZER_MAX_GAIN / 25.0 );
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
377 equalizerwin_eq_changed();
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
378 gtk_widget_queue_draw(widget);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
379 return TRUE;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
380 }
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
381
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
382 static void ui_skinned_equalizer_slider_toggle_scaled(UiSkinnedEqualizerSlider *equalizer_slider) {
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
383 GtkWidget *widget = GTK_WIDGET (equalizer_slider);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
384 UiSkinnedEqualizerSliderPrivate *priv = UI_SKINNED_EQUALIZER_SLIDER_GET_PRIVATE(equalizer_slider);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
385
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
386 priv->scaled = !priv->scaled;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
387
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
388 gtk_widget_set_size_request(widget, priv->width*(priv->scaled ? config.scale_factor : 1),
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
389 priv->height*(priv->scaled ? config.scale_factor : 1));
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
390
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
391 gtk_widget_queue_draw(GTK_WIDGET(equalizer_slider));
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
392 }
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
393
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
394 void ui_skinned_equalizer_slider_set_position(GtkWidget *widget, gfloat pos) {
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
395 g_return_if_fail (UI_SKINNED_IS_EQUALIZER_SLIDER (widget));
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
396 UiSkinnedEqualizerSliderPrivate *priv = UI_SKINNED_EQUALIZER_SLIDER_GET_PRIVATE(widget);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
397
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
398 if (priv->pressed)
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
399 return;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
400
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
401 priv->value = (pos > EQUALIZER_MAX_GAIN) ? EQUALIZER_MAX_GAIN : ((pos < -EQUALIZER_MAX_GAIN) ? -EQUALIZER_MAX_GAIN : pos);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
402 priv->position = 25 - (gint) ((pos * 25.0) / EQUALIZER_MAX_GAIN);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
403
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
404 if (priv->position < 0)
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
405 priv->position = 0;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
406
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
407 if (priv->position > 50)
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
408 priv->position = 50;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
409
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
410 if (priv->position >= 24 && priv->position <= 26)
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
411 priv->position = 25;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
412
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
413 gtk_widget_queue_draw(widget);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
414 }
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
415
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
416 gfloat ui_skinned_equalizer_slider_get_position(GtkWidget *widget) {
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
417 g_return_val_if_fail (UI_SKINNED_IS_EQUALIZER_SLIDER (widget), -1);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
418 UiSkinnedEqualizerSliderPrivate *priv = UI_SKINNED_EQUALIZER_SLIDER_GET_PRIVATE(widget);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
419 return priv->value;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
420 }
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
421
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
422 void ui_skinned_equalizer_slider_set_mainwin_text(UiSkinnedEqualizerSlider * es) {
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
423 gint band = 0;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
424 const gchar *bandname[11] = { N_("PREAMP"), N_("60HZ"), N_("170HZ"),
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
425 N_("310HZ"), N_("600HZ"), N_("1KHZ"),
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
426 N_("3KHZ"), N_("6KHZ"), N_("12KHZ"),
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
427 N_("14KHZ"), N_("16KHZ")
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
428 };
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
429 gchar *tmp;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
430
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
431 if (es->x > 21)
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
432 band = ((es->x - 78) / 18) + 1;
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
433
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
434 tmp =
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
435 g_strdup_printf("EQ: %s: %+.1f DB", _(bandname[band]),
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
436 ui_skinned_equalizer_slider_get_position(GTK_WIDGET(es)));
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
437 mainwin_lock_info_text(tmp);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
438 g_free(tmp);
ecd8b5653c30 add ui_skinned_equalizer_slider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
439 }