annotate src/audacious/ui_skinned_equalizer_slider.c @ 4325:309e8f970517

removed report_error() and reimplemented some error routines
author mf0102 <0102@gmx.at>
date Thu, 13 Mar 2008 16:31:48 +0100
parents 772de6f365cf
children de33c83aa06f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3098
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1 /*
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
2 * Audacious - a cross-platform multimedia player
3840
46591501603e Add my name in few places
Tomasz Mon <desowin@gmail.com>
parents: 3251
diff changeset
3 * Copyright (c) 2007 Tomasz Moń
3098
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
4 *
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
5 * Based on:
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
6 * BMP - Cross-platform multimedia player
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
7 * Copyright (C) 2003-2004 BMP development team.
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
8 * XMMS:
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
9 * Copyright (C) 1998-2003 XMMS development team.
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
10 *
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
11 * This program is free software; you can redistribute it and/or modify
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
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: 3100
diff changeset
13 * the Free Software Foundation; under version 3 of the License.
3098
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
14 *
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
15 * This program is distributed in the hope that it will be useful,
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
18 * GNU General Public License for more details.
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
19 *
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
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: 3100
diff changeset
21 * along with this program; If not, see <http://www.gnu.org/licenses>.
3098
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
22 */
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
23
3251
f02623377013 goodbye widgets directory
Tomasz Mon <desowin@gmail.com>
parents: 3121
diff changeset
24 #include "skin.h"
3098
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
25 #include "ui_skinned_equalizer_slider.h"
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
26 #include "util.h"
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
27 #include "ui_equalizer.h"
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
28 #include "ui_main.h"
4306
172d49b1200b - equalizer sliders range changed to -12..12 dB
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4217
diff changeset
29 #include "equalizer_flow.h"
3098
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
30 #include <glib/gi18n.h>
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
31
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
32 #define UI_TYPE_SKINNED_EQUALIZER_SLIDER (ui_skinned_equalizer_slider_get_type())
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
33 #define UI_SKINNED_EQUALIZER_SLIDER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UI_TYPE_SKINNED_EQUALIZER_SLIDER, UiSkinnedEqualizerSliderPrivate))
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
34 typedef struct _UiSkinnedEqualizerSliderPrivate UiSkinnedEqualizerSliderPrivate;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
35
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
36 enum {
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
37 DOUBLED,
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
38 LAST_SIGNAL
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
39 };
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
40
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
41 struct _UiSkinnedEqualizerSliderPrivate {
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
42 SkinPixmapId skin_index;
4217
742f00832961 some more progress, but still broken
Cristi Magherusan <majeru@atheme.org>
parents: 4212
diff changeset
43 gboolean scaled;
3098
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
44 gint position;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
45 gint width, height;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
46 gboolean pressed;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
47 gint drag_y;
4312
45505a00a6cf store sliders' values as is
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4306
diff changeset
48 gfloat value; /* store gain as is to prevent truncation --asphyx */
3098
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
49 };
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
50
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
51 static void ui_skinned_equalizer_slider_class_init (UiSkinnedEqualizerSliderClass *klass);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
52 static void ui_skinned_equalizer_slider_init (UiSkinnedEqualizerSlider *equalizer_slider);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
53 static void ui_skinned_equalizer_slider_destroy (GtkObject *object);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
54 static void ui_skinned_equalizer_slider_realize (GtkWidget *widget);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
55 static void ui_skinned_equalizer_slider_size_request (GtkWidget *widget, GtkRequisition *requisition);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
56 static void ui_skinned_equalizer_slider_size_allocate (GtkWidget *widget, GtkAllocation *allocation);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
57 static gboolean ui_skinned_equalizer_slider_expose (GtkWidget *widget, GdkEventExpose *event);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
58 static gboolean ui_skinned_equalizer_slider_button_press (GtkWidget *widget, GdkEventButton *event);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
59 static gboolean ui_skinned_equalizer_slider_button_release (GtkWidget *widget, GdkEventButton *event);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
60 static gboolean ui_skinned_equalizer_slider_motion_notify (GtkWidget *widget, GdkEventMotion *event);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
61 static gboolean ui_skinned_equalizer_slider_scroll (GtkWidget *widget, GdkEventScroll *event);
4217
742f00832961 some more progress, but still broken
Cristi Magherusan <majeru@atheme.org>
parents: 4212
diff changeset
62 static void ui_skinned_equalizer_slider_toggle_scaled (UiSkinnedEqualizerSlider *equalizer_slider);
3098
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
63 void ui_skinned_equalizer_slider_set_mainwin_text (UiSkinnedEqualizerSlider * es);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
64
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
65 static GtkWidgetClass *parent_class = NULL;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
66 static guint equalizer_slider_signals[LAST_SIGNAL] = { 0 };
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
67
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
68 GType ui_skinned_equalizer_slider_get_type() {
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
69 static GType equalizer_slider_type = 0;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
70 if (!equalizer_slider_type) {
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
71 static const GTypeInfo equalizer_slider_info = {
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
72 sizeof (UiSkinnedEqualizerSliderClass),
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
73 NULL,
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
74 NULL,
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
75 (GClassInitFunc) ui_skinned_equalizer_slider_class_init,
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
76 NULL,
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
77 NULL,
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
78 sizeof (UiSkinnedEqualizerSlider),
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
79 0,
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
80 (GInstanceInitFunc) ui_skinned_equalizer_slider_init,
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
81 };
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
82 equalizer_slider_type = g_type_register_static (GTK_TYPE_WIDGET, "UiSkinnedEqualizerSlider", &equalizer_slider_info, 0);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
83 }
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
84
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
85 return equalizer_slider_type;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
86 }
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
87
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
88 static void ui_skinned_equalizer_slider_class_init(UiSkinnedEqualizerSliderClass *klass) {
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
89 GObjectClass *gobject_class;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
90 GtkObjectClass *object_class;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
91 GtkWidgetClass *widget_class;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
92
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
93 gobject_class = G_OBJECT_CLASS(klass);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
94 object_class = (GtkObjectClass*) klass;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
95 widget_class = (GtkWidgetClass*) klass;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
96 parent_class = gtk_type_class (gtk_widget_get_type ());
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
97
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
98 object_class->destroy = ui_skinned_equalizer_slider_destroy;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
99
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
100 widget_class->realize = ui_skinned_equalizer_slider_realize;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
101 widget_class->expose_event = ui_skinned_equalizer_slider_expose;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
102 widget_class->size_request = ui_skinned_equalizer_slider_size_request;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
103 widget_class->size_allocate = ui_skinned_equalizer_slider_size_allocate;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
104 widget_class->button_press_event = ui_skinned_equalizer_slider_button_press;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
105 widget_class->button_release_event = ui_skinned_equalizer_slider_button_release;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
106 widget_class->motion_notify_event = ui_skinned_equalizer_slider_motion_notify;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
107 widget_class->scroll_event = ui_skinned_equalizer_slider_scroll;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
108
4217
742f00832961 some more progress, but still broken
Cristi Magherusan <majeru@atheme.org>
parents: 4212
diff changeset
109 klass->scaled = ui_skinned_equalizer_slider_toggle_scaled;
3098
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
110
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
111 equalizer_slider_signals[DOUBLED] =
4217
742f00832961 some more progress, but still broken
Cristi Magherusan <majeru@atheme.org>
parents: 4212
diff changeset
112 g_signal_new ("toggle-scaled", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
742f00832961 some more progress, but still broken
Cristi Magherusan <majeru@atheme.org>
parents: 4212
diff changeset
113 G_STRUCT_OFFSET (UiSkinnedEqualizerSliderClass, scaled), NULL, NULL,
3098
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
114 gtk_marshal_VOID__VOID, G_TYPE_NONE, 0);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
115
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
116 g_type_class_add_private (gobject_class, sizeof (UiSkinnedEqualizerSliderPrivate));
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
117 }
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
118
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
119 static void ui_skinned_equalizer_slider_init(UiSkinnedEqualizerSlider *equalizer_slider) {
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
120 UiSkinnedEqualizerSliderPrivate *priv = UI_SKINNED_EQUALIZER_SLIDER_GET_PRIVATE(equalizer_slider);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
121 priv->pressed = FALSE;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
122 }
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
123
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
124 GtkWidget* ui_skinned_equalizer_slider_new(GtkWidget *fixed, gint x, gint y) {
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
125 UiSkinnedEqualizerSlider *es = g_object_new (ui_skinned_equalizer_slider_get_type (), NULL);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
126 UiSkinnedEqualizerSliderPrivate *priv = UI_SKINNED_EQUALIZER_SLIDER_GET_PRIVATE(es);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
127
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
128 es->x = x;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
129 es->y = y;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
130 priv->width = 14;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
131 priv->height = 63;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
132 priv->skin_index = SKIN_EQMAIN;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
133
3939
d46d60247826 we don't need to store GtkFixed pointer, do we?
Tomasz Mon <desowin@gmail.com>
parents: 3933
diff changeset
134 gtk_fixed_put(GTK_FIXED(fixed), GTK_WIDGET(es), es->x, es->y);
3098
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
135
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
136 return GTK_WIDGET(es);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
137 }
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
138
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
139 static void ui_skinned_equalizer_slider_destroy(GtkObject *object) {
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
140 UiSkinnedEqualizerSlider *equalizer_slider;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
141
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
142 g_return_if_fail (object != NULL);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
143 g_return_if_fail (UI_SKINNED_IS_EQUALIZER_SLIDER (object));
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
144
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
145 equalizer_slider = UI_SKINNED_EQUALIZER_SLIDER (object);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
146
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
147 if (GTK_OBJECT_CLASS (parent_class)->destroy)
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
148 (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
149 }
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
150
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
151 static void ui_skinned_equalizer_slider_realize(GtkWidget *widget) {
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
152 UiSkinnedEqualizerSlider *equalizer_slider;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
153 GdkWindowAttr attributes;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
154 gint attributes_mask;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
155
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
156 g_return_if_fail (widget != NULL);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
157 g_return_if_fail (UI_SKINNED_IS_EQUALIZER_SLIDER(widget));
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
158
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
159 GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
160 equalizer_slider = UI_SKINNED_EQUALIZER_SLIDER(widget);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
161
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
162 attributes.x = widget->allocation.x;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
163 attributes.y = widget->allocation.y;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
164 attributes.width = widget->allocation.width;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
165 attributes.height = widget->allocation.height;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
166 attributes.wclass = GDK_INPUT_OUTPUT;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
167 attributes.window_type = GDK_WINDOW_CHILD;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
168 attributes.event_mask = gtk_widget_get_events(widget);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
169 attributes.event_mask |= GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
170 GDK_POINTER_MOTION_MASK | GDK_SCROLL_MASK;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
171 attributes.visual = gtk_widget_get_visual(widget);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
172 attributes.colormap = gtk_widget_get_colormap(widget);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
173
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
174 attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
175 widget->window = gdk_window_new(widget->parent->window, &attributes, attributes_mask);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
176
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
177 widget->style = gtk_style_attach(widget->style, widget->window);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
178 gdk_window_set_user_data(widget->window, widget);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
179 }
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
180
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
181 static void ui_skinned_equalizer_slider_size_request(GtkWidget *widget, GtkRequisition *requisition) {
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
182 UiSkinnedEqualizerSliderPrivate *priv = UI_SKINNED_EQUALIZER_SLIDER_GET_PRIVATE(widget);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
183
4217
742f00832961 some more progress, but still broken
Cristi Magherusan <majeru@atheme.org>
parents: 4212
diff changeset
184 requisition->width = priv->width*(priv->scaled ? cfg.scale_factor : 1);
742f00832961 some more progress, but still broken
Cristi Magherusan <majeru@atheme.org>
parents: 4212
diff changeset
185 requisition->height = priv->height*(priv->scaled ? cfg.scale_factor : 1);
3098
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
186 }
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
187
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
188 static void ui_skinned_equalizer_slider_size_allocate(GtkWidget *widget, GtkAllocation *allocation) {
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
189 UiSkinnedEqualizerSlider *equalizer_slider = UI_SKINNED_EQUALIZER_SLIDER (widget);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
190 UiSkinnedEqualizerSliderPrivate *priv = UI_SKINNED_EQUALIZER_SLIDER_GET_PRIVATE(equalizer_slider);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
191
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
192 widget->allocation = *allocation;
4217
742f00832961 some more progress, but still broken
Cristi Magherusan <majeru@atheme.org>
parents: 4212
diff changeset
193 widget->allocation.x *= (priv->scaled ? cfg.scale_factor : 1);
742f00832961 some more progress, but still broken
Cristi Magherusan <majeru@atheme.org>
parents: 4212
diff changeset
194 widget->allocation.y *= (priv->scaled ? cfg.scale_factor : 1);
3098
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
195 if (GTK_WIDGET_REALIZED (widget))
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
196 gdk_window_move_resize(widget->window, widget->allocation.x, widget->allocation.y, allocation->width, allocation->height);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
197
4217
742f00832961 some more progress, but still broken
Cristi Magherusan <majeru@atheme.org>
parents: 4212
diff changeset
198 equalizer_slider->x = widget->allocation.x/(priv->scaled ? cfg.scale_factor : 1);
742f00832961 some more progress, but still broken
Cristi Magherusan <majeru@atheme.org>
parents: 4212
diff changeset
199 equalizer_slider->y = widget->allocation.y/(priv->scaled ? cfg.scale_factor : 1);
3098
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
200 }
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
201
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
202 static gboolean ui_skinned_equalizer_slider_expose(GtkWidget *widget, GdkEventExpose *event) {
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
203 g_return_val_if_fail (widget != NULL, FALSE);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
204 g_return_val_if_fail (UI_SKINNED_IS_EQUALIZER_SLIDER (widget), FALSE);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
205 g_return_val_if_fail (event != NULL, FALSE);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
206
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
207 UiSkinnedEqualizerSlider *es = UI_SKINNED_EQUALIZER_SLIDER (widget);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
208 UiSkinnedEqualizerSliderPrivate *priv = UI_SKINNED_EQUALIZER_SLIDER_GET_PRIVATE(es);
4119
9d4b5cdae3ba oops, fix previous commit
Tomasz Mon <desowin@gmail.com>
parents: 4118
diff changeset
209 g_return_val_if_fail (priv->width > 0 && priv->height > 0, FALSE);
3098
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
210
4195
2281da647da9 beggining of GdkPixbuf transition
Tomasz Mon <desowin@gmail.com>
parents: 4119
diff changeset
211 GdkPixbuf *obj = NULL;
2281da647da9 beggining of GdkPixbuf transition
Tomasz Mon <desowin@gmail.com>
parents: 4119
diff changeset
212 obj = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, priv->width, priv->height);
3098
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
213
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
214 gint frame;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
215 frame = 27 - ((priv->position * 27) / 50);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
216 if (frame < 14)
4195
2281da647da9 beggining of GdkPixbuf transition
Tomasz Mon <desowin@gmail.com>
parents: 4119
diff changeset
217 skin_draw_pixbuf(widget, bmp_active_skin, obj, priv->skin_index, (frame * 15) + 13, 164, 0, 0, priv->width, priv->height);
3098
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
218 else
4195
2281da647da9 beggining of GdkPixbuf transition
Tomasz Mon <desowin@gmail.com>
parents: 4119
diff changeset
219 skin_draw_pixbuf(widget, bmp_active_skin, obj, priv->skin_index, ((frame - 14) * 15) + 13, 229, 0, 0, priv->width, priv->height);
3098
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
220
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
221 if (priv->pressed)
4195
2281da647da9 beggining of GdkPixbuf transition
Tomasz Mon <desowin@gmail.com>
parents: 4119
diff changeset
222 skin_draw_pixbuf(widget, bmp_active_skin, obj, priv->skin_index, 0, 176, 1, priv->position, 11, 11);
3098
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
223 else
4195
2281da647da9 beggining of GdkPixbuf transition
Tomasz Mon <desowin@gmail.com>
parents: 4119
diff changeset
224 skin_draw_pixbuf(widget, bmp_active_skin, obj, priv->skin_index, 0, 164, 1, priv->position, 11, 11);
3098
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
225
4217
742f00832961 some more progress, but still broken
Cristi Magherusan <majeru@atheme.org>
parents: 4212
diff changeset
226 ui_skinned_widget_draw(widget, obj, priv->width, priv->height, priv->scaled);
3098
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
227
4195
2281da647da9 beggining of GdkPixbuf transition
Tomasz Mon <desowin@gmail.com>
parents: 4119
diff changeset
228 g_object_unref(obj);
3098
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
229
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
230 return FALSE;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
231 }
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
232
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
233 static gboolean ui_skinned_equalizer_slider_button_press(GtkWidget *widget, GdkEventButton *event) {
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
234 g_return_val_if_fail (widget != NULL, FALSE);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
235 g_return_val_if_fail (UI_SKINNED_IS_EQUALIZER_SLIDER (widget), FALSE);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
236 g_return_val_if_fail (event != NULL, FALSE);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
237
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
238 UiSkinnedEqualizerSlider *es = UI_SKINNED_EQUALIZER_SLIDER (widget);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
239 UiSkinnedEqualizerSliderPrivate *priv = UI_SKINNED_EQUALIZER_SLIDER_GET_PRIVATE(es);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
240
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
241 gint y;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
242
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
243 if (event->type == GDK_BUTTON_PRESS) {
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
244 if (event->button == 1) {
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
245 priv->pressed = TRUE;
4217
742f00832961 some more progress, but still broken
Cristi Magherusan <majeru@atheme.org>
parents: 4212
diff changeset
246 y = event->y/(priv->scaled ? cfg.scale_factor : 1);
3098
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
247
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
248 if (y >= priv->position && y < priv->position + 11)
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
249 priv->drag_y = y - priv->position;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
250 else {
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
251 priv->position = y - 5;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
252 priv->drag_y = 5;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
253 if (priv->position < 0)
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
254 priv->position = 0;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
255 if (priv->position > 50)
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
256 priv->position = 50;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
257 if (priv->position >= 24 && priv->position <= 26)
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
258 priv->position = 25;
4312
45505a00a6cf store sliders' values as is
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4306
diff changeset
259
45505a00a6cf store sliders' values as is
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4306
diff changeset
260 priv->value = ((gfloat) (25 - priv->position) * EQUALIZER_MAX_GAIN / 25.0 );
3098
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
261 equalizerwin_eq_changed();
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
262 }
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
263
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
264 ui_skinned_equalizer_slider_set_mainwin_text(es);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
265 gtk_widget_queue_draw(widget);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
266 }
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
267 }
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
268
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
269 return TRUE;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
270 }
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
271
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
272 static gboolean ui_skinned_equalizer_slider_button_release(GtkWidget *widget, GdkEventButton *event) {
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
273 UiSkinnedEqualizerSliderPrivate *priv = UI_SKINNED_EQUALIZER_SLIDER_GET_PRIVATE(widget);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
274
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
275 if (event->button == 1) {
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
276 priv->pressed = FALSE;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
277 mainwin_release_info_text();
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
278 gtk_widget_queue_draw(widget);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
279 }
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
280 return TRUE;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
281 }
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
282
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
283 static gboolean ui_skinned_equalizer_slider_motion_notify(GtkWidget *widget, GdkEventMotion *event) {
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
284 g_return_val_if_fail (widget != NULL, FALSE);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
285 g_return_val_if_fail (UI_SKINNED_IS_EQUALIZER_SLIDER (widget), FALSE);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
286 g_return_val_if_fail (event != NULL, FALSE);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
287 UiSkinnedEqualizerSlider *es = UI_SKINNED_EQUALIZER_SLIDER(widget);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
288 UiSkinnedEqualizerSliderPrivate *priv = UI_SKINNED_EQUALIZER_SLIDER_GET_PRIVATE(widget);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
289
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
290 if (priv->pressed) {
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
291 gint y;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
292
4217
742f00832961 some more progress, but still broken
Cristi Magherusan <majeru@atheme.org>
parents: 4212
diff changeset
293 y = event->y/(priv->scaled ? cfg.scale_factor : 1);
3098
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
294 priv->position = y - priv->drag_y;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
295
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
296 if (priv->position < 0)
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
297 priv->position = 0;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
298 if (priv->position > 50)
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
299 priv->position = 50;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
300 if (priv->position >= 24 && priv->position <= 26)
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
301 priv->position = 25;
4312
45505a00a6cf store sliders' values as is
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4306
diff changeset
302
45505a00a6cf store sliders' values as is
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4306
diff changeset
303 priv->value = ((gfloat) (25 - priv->position) * EQUALIZER_MAX_GAIN / 25.0 );
3098
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
304 ui_skinned_equalizer_slider_set_mainwin_text(es);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
305 equalizerwin_eq_changed();
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
306 gtk_widget_queue_draw(widget);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
307 }
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
308
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
309 return TRUE;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
310 }
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
311
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
312 static gboolean ui_skinned_equalizer_slider_scroll(GtkWidget *widget, GdkEventScroll *event) {
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
313 g_return_val_if_fail (UI_SKINNED_IS_EQUALIZER_SLIDER (widget), FALSE);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
314 g_return_val_if_fail (event != NULL, FALSE);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
315 UiSkinnedEqualizerSliderPrivate *priv = UI_SKINNED_EQUALIZER_SLIDER_GET_PRIVATE(widget);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
316
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
317 if (event->direction == GDK_SCROLL_UP) {
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
318 priv->position -= 2;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
319
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
320 if (priv->position < 0)
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
321 priv->position = 0;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
322 }
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
323 else {
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
324 priv->position += 2;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
325
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
326 if (priv->position > 50)
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
327 priv->position = 50;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
328 }
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
329
4312
45505a00a6cf store sliders' values as is
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4306
diff changeset
330 priv->value = ((gfloat) (25 - priv->position) * EQUALIZER_MAX_GAIN / 25.0 );
3098
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
331 equalizerwin_eq_changed();
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
332 gtk_widget_queue_draw(widget);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
333 return TRUE;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
334 }
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
335
4217
742f00832961 some more progress, but still broken
Cristi Magherusan <majeru@atheme.org>
parents: 4212
diff changeset
336 static void ui_skinned_equalizer_slider_toggle_scaled(UiSkinnedEqualizerSlider *equalizer_slider) {
3098
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
337 GtkWidget *widget = GTK_WIDGET (equalizer_slider);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
338 UiSkinnedEqualizerSliderPrivate *priv = UI_SKINNED_EQUALIZER_SLIDER_GET_PRIVATE(equalizer_slider);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
339
4217
742f00832961 some more progress, but still broken
Cristi Magherusan <majeru@atheme.org>
parents: 4212
diff changeset
340 priv->scaled = !priv->scaled;
3098
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
341
4217
742f00832961 some more progress, but still broken
Cristi Magherusan <majeru@atheme.org>
parents: 4212
diff changeset
342 gtk_widget_set_size_request(widget, priv->width*(priv->scaled ? cfg.scale_factor : 1),
742f00832961 some more progress, but still broken
Cristi Magherusan <majeru@atheme.org>
parents: 4212
diff changeset
343 priv->height*(priv->scaled ? cfg.scale_factor : 1));
3098
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
344
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
345 gtk_widget_queue_draw(GTK_WIDGET(equalizer_slider));
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
346 }
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
347
4312
45505a00a6cf store sliders' values as is
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4306
diff changeset
348 void ui_skinned_equalizer_slider_set_position(GtkWidget *widget, gfloat pos) {
3098
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
349 g_return_if_fail (UI_SKINNED_IS_EQUALIZER_SLIDER (widget));
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
350 UiSkinnedEqualizerSliderPrivate *priv = UI_SKINNED_EQUALIZER_SLIDER_GET_PRIVATE(widget);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
351
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
352 if (priv->pressed)
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
353 return;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
354
4313
772de6f365cf little fix
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4312
diff changeset
355 priv->value = (pos > EQUALIZER_MAX_GAIN) ? EQUALIZER_MAX_GAIN : ((pos < -EQUALIZER_MAX_GAIN) ? -EQUALIZER_MAX_GAIN : pos);
4306
172d49b1200b - equalizer sliders range changed to -12..12 dB
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4217
diff changeset
356 priv->position = 25 - (gint) ((pos * 25.0) / EQUALIZER_MAX_GAIN);
3098
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
357
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
358 if (priv->position < 0)
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
359 priv->position = 0;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
360
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
361 if (priv->position > 50)
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
362 priv->position = 50;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
363
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
364 if (priv->position >= 24 && priv->position <= 26)
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
365 priv->position = 25;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
366
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
367 gtk_widget_queue_draw(widget);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
368 }
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
369
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
370 gfloat ui_skinned_equalizer_slider_get_position(GtkWidget *widget) {
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
371 g_return_val_if_fail (UI_SKINNED_IS_EQUALIZER_SLIDER (widget), -1);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
372 UiSkinnedEqualizerSliderPrivate *priv = UI_SKINNED_EQUALIZER_SLIDER_GET_PRIVATE(widget);
4312
45505a00a6cf store sliders' values as is
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4306
diff changeset
373 return priv->value;
3098
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
374 }
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
375
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
376 void ui_skinned_equalizer_slider_set_mainwin_text(UiSkinnedEqualizerSlider * es) {
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
377 gint band = 0;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
378 const gchar *bandname[11] = { N_("PREAMP"), N_("60HZ"), N_("170HZ"),
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
379 N_("310HZ"), N_("600HZ"), N_("1KHZ"),
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
380 N_("3KHZ"), N_("6KHZ"), N_("12KHZ"),
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
381 N_("14KHZ"), N_("16KHZ")
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
382 };
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
383 gchar *tmp;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
384
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
385 if (es->x > 21)
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
386 band = ((es->x - 78) / 18) + 1;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
387
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
388 tmp =
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
389 g_strdup_printf("EQ: %s: %+.1f DB", _(bandname[band]),
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
390 ui_skinned_equalizer_slider_get_position(GTK_WIDGET(es)));
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
391 mainwin_lock_info_text(tmp);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
392 g_free(tmp);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
393 }