annotate src/audacious/ui_skinned_equalizer_slider.c @ 4596:a77d02342ee1

change visualization timeout; export calc_stereo_pcm, calc_mono_pcm and calc_mono_freq to PAPI
author Tomasz Mon <desowin@gmail.com>
date Sat, 31 May 2008 14:17:15 +0200
parents cc6255f8b568
children
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
4508
246244ead30e renamed skin.* to ui_skin.* and moved ui_skinned_widget_draw() to it
mf0102 <0102@gmx.at>
parents: 4413
diff changeset
24 #include "ui_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 "ui_equalizer.h"
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
27 #include "ui_main.h"
4306
172d49b1200b - equalizer sliders range changed to -12..12 dB
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4217
diff changeset
28 #include "equalizer_flow.h"
3098
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
29 #include <glib/gi18n.h>
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
30
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
31 #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
32 #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
33 typedef struct _UiSkinnedEqualizerSliderPrivate UiSkinnedEqualizerSliderPrivate;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
34
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
35 enum {
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
36 DOUBLED,
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
37 LAST_SIGNAL
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
38 };
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 struct _UiSkinnedEqualizerSliderPrivate {
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
41 SkinPixmapId skin_index;
4217
742f00832961 some more progress, but still broken
Cristi Magherusan <majeru@atheme.org>
parents: 4212
diff changeset
42 gboolean scaled;
3098
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
43 gint position;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
44 gint width, height;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
45 gboolean pressed;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
46 gint drag_y;
4312
45505a00a6cf store sliders' values as is
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4306
diff changeset
47 gfloat value; /* store gain as is to prevent truncation --asphyx */
3098
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
48 };
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 static void ui_skinned_equalizer_slider_class_init (UiSkinnedEqualizerSliderClass *klass);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
51 static void ui_skinned_equalizer_slider_init (UiSkinnedEqualizerSlider *equalizer_slider);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
52 static void ui_skinned_equalizer_slider_destroy (GtkObject *object);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
53 static void ui_skinned_equalizer_slider_realize (GtkWidget *widget);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
54 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
55 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
56 static gboolean ui_skinned_equalizer_slider_expose (GtkWidget *widget, GdkEventExpose *event);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
57 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
58 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
59 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
60 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
61 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
62 void ui_skinned_equalizer_slider_set_mainwin_text (UiSkinnedEqualizerSlider * es);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
63
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
64 static GtkWidgetClass *parent_class = NULL;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
65 static guint equalizer_slider_signals[LAST_SIGNAL] = { 0 };
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
66
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
67 GType ui_skinned_equalizer_slider_get_type() {
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
68 static GType equalizer_slider_type = 0;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
69 if (!equalizer_slider_type) {
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
70 static const GTypeInfo equalizer_slider_info = {
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
71 sizeof (UiSkinnedEqualizerSliderClass),
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
72 NULL,
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 (GClassInitFunc) ui_skinned_equalizer_slider_class_init,
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
75 NULL,
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 sizeof (UiSkinnedEqualizerSlider),
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
78 0,
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
79 (GInstanceInitFunc) ui_skinned_equalizer_slider_init,
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
80 };
4561
cc6255f8b568 Suffix all type names in core with _
Tomasz Mon <desowin@gmail.com>
parents: 4508
diff changeset
81 equalizer_slider_type = g_type_register_static (GTK_TYPE_WIDGET, "UiSkinnedEqualizerSlider_", &equalizer_slider_info, 0);
3098
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
82 }
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 return equalizer_slider_type;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
85 }
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 static void ui_skinned_equalizer_slider_class_init(UiSkinnedEqualizerSliderClass *klass) {
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
88 GObjectClass *gobject_class;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
89 GtkObjectClass *object_class;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
90 GtkWidgetClass *widget_class;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
91
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
92 gobject_class = G_OBJECT_CLASS(klass);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
93 object_class = (GtkObjectClass*) klass;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
94 widget_class = (GtkWidgetClass*) klass;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
95 parent_class = gtk_type_class (gtk_widget_get_type ());
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
96
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
97 object_class->destroy = ui_skinned_equalizer_slider_destroy;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
98
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
99 widget_class->realize = ui_skinned_equalizer_slider_realize;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
100 widget_class->expose_event = ui_skinned_equalizer_slider_expose;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
101 widget_class->size_request = ui_skinned_equalizer_slider_size_request;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
102 widget_class->size_allocate = ui_skinned_equalizer_slider_size_allocate;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
103 widget_class->button_press_event = ui_skinned_equalizer_slider_button_press;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
104 widget_class->button_release_event = ui_skinned_equalizer_slider_button_release;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
105 widget_class->motion_notify_event = ui_skinned_equalizer_slider_motion_notify;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
106 widget_class->scroll_event = ui_skinned_equalizer_slider_scroll;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
107
4217
742f00832961 some more progress, but still broken
Cristi Magherusan <majeru@atheme.org>
parents: 4212
diff changeset
108 klass->scaled = ui_skinned_equalizer_slider_toggle_scaled;
3098
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
109
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
110 equalizer_slider_signals[DOUBLED] =
4217
742f00832961 some more progress, but still broken
Cristi Magherusan <majeru@atheme.org>
parents: 4212
diff changeset
111 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
112 G_STRUCT_OFFSET (UiSkinnedEqualizerSliderClass, scaled), NULL, NULL,
3098
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
113 gtk_marshal_VOID__VOID, G_TYPE_NONE, 0);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
114
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
115 g_type_class_add_private (gobject_class, sizeof (UiSkinnedEqualizerSliderPrivate));
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
116 }
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 static void ui_skinned_equalizer_slider_init(UiSkinnedEqualizerSlider *equalizer_slider) {
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
119 UiSkinnedEqualizerSliderPrivate *priv = UI_SKINNED_EQUALIZER_SLIDER_GET_PRIVATE(equalizer_slider);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
120 priv->pressed = FALSE;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
121 }
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 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
124 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
125 UiSkinnedEqualizerSliderPrivate *priv = UI_SKINNED_EQUALIZER_SLIDER_GET_PRIVATE(es);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
126
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
127 es->x = x;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
128 es->y = y;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
129 priv->width = 14;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
130 priv->height = 63;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
131 priv->skin_index = SKIN_EQMAIN;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
132
3939
d46d60247826 we don't need to store GtkFixed pointer, do we?
Tomasz Mon <desowin@gmail.com>
parents: 3933
diff changeset
133 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
134
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
135 return GTK_WIDGET(es);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
136 }
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 static void ui_skinned_equalizer_slider_destroy(GtkObject *object) {
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
139 UiSkinnedEqualizerSlider *equalizer_slider;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
140
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
141 g_return_if_fail (object != NULL);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
142 g_return_if_fail (UI_SKINNED_IS_EQUALIZER_SLIDER (object));
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
143
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
144 equalizer_slider = UI_SKINNED_EQUALIZER_SLIDER (object);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
145
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
146 if (GTK_OBJECT_CLASS (parent_class)->destroy)
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
147 (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
148 }
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 static void ui_skinned_equalizer_slider_realize(GtkWidget *widget) {
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
151 UiSkinnedEqualizerSlider *equalizer_slider;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
152 GdkWindowAttr attributes;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
153 gint attributes_mask;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
154
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
155 g_return_if_fail (widget != NULL);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
156 g_return_if_fail (UI_SKINNED_IS_EQUALIZER_SLIDER(widget));
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
157
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
158 GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
159 equalizer_slider = UI_SKINNED_EQUALIZER_SLIDER(widget);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
160
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
161 attributes.x = widget->allocation.x;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
162 attributes.y = widget->allocation.y;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
163 attributes.width = widget->allocation.width;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
164 attributes.height = widget->allocation.height;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
165 attributes.wclass = GDK_INPUT_OUTPUT;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
166 attributes.window_type = GDK_WINDOW_CHILD;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
167 attributes.event_mask = gtk_widget_get_events(widget);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
168 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
169 GDK_POINTER_MOTION_MASK | GDK_SCROLL_MASK;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
170 attributes.visual = gtk_widget_get_visual(widget);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
171 attributes.colormap = gtk_widget_get_colormap(widget);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
172
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
173 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
174 widget->window = gdk_window_new(widget->parent->window, &attributes, attributes_mask);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
175
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
176 widget->style = gtk_style_attach(widget->style, widget->window);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
177 gdk_window_set_user_data(widget->window, widget);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
178 }
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 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
181 UiSkinnedEqualizerSliderPrivate *priv = UI_SKINNED_EQUALIZER_SLIDER_GET_PRIVATE(widget);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
182
4217
742f00832961 some more progress, but still broken
Cristi Magherusan <majeru@atheme.org>
parents: 4212
diff changeset
183 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
184 requisition->height = priv->height*(priv->scaled ? cfg.scale_factor : 1);
3098
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
185 }
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 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
188 UiSkinnedEqualizerSlider *equalizer_slider = UI_SKINNED_EQUALIZER_SLIDER (widget);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
189 UiSkinnedEqualizerSliderPrivate *priv = UI_SKINNED_EQUALIZER_SLIDER_GET_PRIVATE(equalizer_slider);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
190
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
191 widget->allocation = *allocation;
4217
742f00832961 some more progress, but still broken
Cristi Magherusan <majeru@atheme.org>
parents: 4212
diff changeset
192 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
193 widget->allocation.y *= (priv->scaled ? cfg.scale_factor : 1);
3098
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
194 if (GTK_WIDGET_REALIZED (widget))
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
195 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
196
4217
742f00832961 some more progress, but still broken
Cristi Magherusan <majeru@atheme.org>
parents: 4212
diff changeset
197 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
198 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
199 }
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 static gboolean ui_skinned_equalizer_slider_expose(GtkWidget *widget, GdkEventExpose *event) {
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
202 g_return_val_if_fail (widget != NULL, FALSE);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
203 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
204 g_return_val_if_fail (event != NULL, FALSE);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
205
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
206 UiSkinnedEqualizerSlider *es = UI_SKINNED_EQUALIZER_SLIDER (widget);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
207 UiSkinnedEqualizerSliderPrivate *priv = UI_SKINNED_EQUALIZER_SLIDER_GET_PRIVATE(es);
4119
9d4b5cdae3ba oops, fix previous commit
Tomasz Mon <desowin@gmail.com>
parents: 4118
diff changeset
208 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
209
4195
2281da647da9 beggining of GdkPixbuf transition
Tomasz Mon <desowin@gmail.com>
parents: 4119
diff changeset
210 GdkPixbuf *obj = NULL;
2281da647da9 beggining of GdkPixbuf transition
Tomasz Mon <desowin@gmail.com>
parents: 4119
diff changeset
211 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
212
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
213 gint frame;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
214 frame = 27 - ((priv->position * 27) / 50);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
215 if (frame < 14)
4413
de33c83aa06f Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents: 4313
diff changeset
216 skin_draw_pixbuf(widget, aud_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
217 else
4413
de33c83aa06f Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents: 4313
diff changeset
218 skin_draw_pixbuf(widget, aud_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
219
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
220 if (priv->pressed)
4413
de33c83aa06f Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents: 4313
diff changeset
221 skin_draw_pixbuf(widget, aud_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
222 else
4413
de33c83aa06f Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents: 4313
diff changeset
223 skin_draw_pixbuf(widget, aud_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
224
4217
742f00832961 some more progress, but still broken
Cristi Magherusan <majeru@atheme.org>
parents: 4212
diff changeset
225 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
226
4195
2281da647da9 beggining of GdkPixbuf transition
Tomasz Mon <desowin@gmail.com>
parents: 4119
diff changeset
227 g_object_unref(obj);
3098
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
228
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
229 return FALSE;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
230 }
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 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
233 g_return_val_if_fail (widget != NULL, FALSE);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
234 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
235 g_return_val_if_fail (event != NULL, FALSE);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
236
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
237 UiSkinnedEqualizerSlider *es = UI_SKINNED_EQUALIZER_SLIDER (widget);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
238 UiSkinnedEqualizerSliderPrivate *priv = UI_SKINNED_EQUALIZER_SLIDER_GET_PRIVATE(es);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
239
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
240 gint y;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
241
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
242 if (event->type == GDK_BUTTON_PRESS) {
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
243 if (event->button == 1) {
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
244 priv->pressed = TRUE;
4217
742f00832961 some more progress, but still broken
Cristi Magherusan <majeru@atheme.org>
parents: 4212
diff changeset
245 y = event->y/(priv->scaled ? cfg.scale_factor : 1);
3098
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
246
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
247 if (y >= priv->position && y < priv->position + 11)
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
248 priv->drag_y = y - priv->position;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
249 else {
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
250 priv->position = y - 5;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
251 priv->drag_y = 5;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
252 if (priv->position < 0)
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
253 priv->position = 0;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
254 if (priv->position > 50)
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
255 priv->position = 50;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
256 if (priv->position >= 24 && priv->position <= 26)
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
257 priv->position = 25;
4312
45505a00a6cf store sliders' values as is
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4306
diff changeset
258
45505a00a6cf store sliders' values as is
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4306
diff changeset
259 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
260 equalizerwin_eq_changed();
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
261 }
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 ui_skinned_equalizer_slider_set_mainwin_text(es);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
264 gtk_widget_queue_draw(widget);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
265 }
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 return TRUE;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
269 }
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 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
272 UiSkinnedEqualizerSliderPrivate *priv = UI_SKINNED_EQUALIZER_SLIDER_GET_PRIVATE(widget);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
273
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
274 if (event->button == 1) {
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
275 priv->pressed = FALSE;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
276 mainwin_release_info_text();
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
277 gtk_widget_queue_draw(widget);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
278 }
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
279 return TRUE;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
280 }
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 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
283 g_return_val_if_fail (widget != NULL, FALSE);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
284 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
285 g_return_val_if_fail (event != NULL, FALSE);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
286 UiSkinnedEqualizerSlider *es = UI_SKINNED_EQUALIZER_SLIDER(widget);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
287 UiSkinnedEqualizerSliderPrivate *priv = UI_SKINNED_EQUALIZER_SLIDER_GET_PRIVATE(widget);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
288
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
289 if (priv->pressed) {
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
290 gint y;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
291
4217
742f00832961 some more progress, but still broken
Cristi Magherusan <majeru@atheme.org>
parents: 4212
diff changeset
292 y = event->y/(priv->scaled ? cfg.scale_factor : 1);
3098
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
293 priv->position = y - priv->drag_y;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
294
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
295 if (priv->position < 0)
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
296 priv->position = 0;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
297 if (priv->position > 50)
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
298 priv->position = 50;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
299 if (priv->position >= 24 && priv->position <= 26)
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
300 priv->position = 25;
4312
45505a00a6cf store sliders' values as is
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4306
diff changeset
301
45505a00a6cf store sliders' values as is
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4306
diff changeset
302 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
303 ui_skinned_equalizer_slider_set_mainwin_text(es);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
304 equalizerwin_eq_changed();
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
305 gtk_widget_queue_draw(widget);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
306 }
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 return TRUE;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
309 }
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 static gboolean ui_skinned_equalizer_slider_scroll(GtkWidget *widget, GdkEventScroll *event) {
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
312 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
313 g_return_val_if_fail (event != NULL, FALSE);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
314 UiSkinnedEqualizerSliderPrivate *priv = UI_SKINNED_EQUALIZER_SLIDER_GET_PRIVATE(widget);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
315
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
316 if (event->direction == GDK_SCROLL_UP) {
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
317 priv->position -= 2;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
318
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
319 if (priv->position < 0)
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
320 priv->position = 0;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
321 }
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
322 else {
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
323 priv->position += 2;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
324
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
325 if (priv->position > 50)
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
326 priv->position = 50;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
327 }
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
328
4312
45505a00a6cf store sliders' values as is
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4306
diff changeset
329 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
330 equalizerwin_eq_changed();
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
331 gtk_widget_queue_draw(widget);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
332 return TRUE;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
333 }
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
334
4217
742f00832961 some more progress, but still broken
Cristi Magherusan <majeru@atheme.org>
parents: 4212
diff changeset
335 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
336 GtkWidget *widget = GTK_WIDGET (equalizer_slider);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
337 UiSkinnedEqualizerSliderPrivate *priv = UI_SKINNED_EQUALIZER_SLIDER_GET_PRIVATE(equalizer_slider);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
338
4217
742f00832961 some more progress, but still broken
Cristi Magherusan <majeru@atheme.org>
parents: 4212
diff changeset
339 priv->scaled = !priv->scaled;
3098
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
340
4217
742f00832961 some more progress, but still broken
Cristi Magherusan <majeru@atheme.org>
parents: 4212
diff changeset
341 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
342 priv->height*(priv->scaled ? cfg.scale_factor : 1));
3098
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
343
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
344 gtk_widget_queue_draw(GTK_WIDGET(equalizer_slider));
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
345 }
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
346
4312
45505a00a6cf store sliders' values as is
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4306
diff changeset
347 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
348 g_return_if_fail (UI_SKINNED_IS_EQUALIZER_SLIDER (widget));
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
349 UiSkinnedEqualizerSliderPrivate *priv = UI_SKINNED_EQUALIZER_SLIDER_GET_PRIVATE(widget);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
350
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
351 if (priv->pressed)
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
352 return;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
353
4313
772de6f365cf little fix
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4312
diff changeset
354 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
355 priv->position = 25 - (gint) ((pos * 25.0) / EQUALIZER_MAX_GAIN);
3098
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
356
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
357 if (priv->position < 0)
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
358 priv->position = 0;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
359
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
360 if (priv->position > 50)
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
361 priv->position = 50;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
362
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
363 if (priv->position >= 24 && priv->position <= 26)
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
364 priv->position = 25;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
365
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
366 gtk_widget_queue_draw(widget);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
367 }
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 gfloat ui_skinned_equalizer_slider_get_position(GtkWidget *widget) {
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
370 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
371 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
372 return priv->value;
3098
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
373 }
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 void ui_skinned_equalizer_slider_set_mainwin_text(UiSkinnedEqualizerSlider * es) {
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
376 gint band = 0;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
377 const gchar *bandname[11] = { N_("PREAMP"), N_("60HZ"), N_("170HZ"),
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
378 N_("310HZ"), N_("600HZ"), N_("1KHZ"),
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
379 N_("3KHZ"), N_("6KHZ"), N_("12KHZ"),
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
380 N_("14KHZ"), N_("16KHZ")
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
381 };
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
382 gchar *tmp;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
383
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
384 if (es->x > 21)
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
385 band = ((es->x - 78) / 18) + 1;
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
386
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
387 tmp =
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
388 g_strdup_printf("EQ: %s: %+.1f DB", _(bandname[band]),
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
389 ui_skinned_equalizer_slider_get_position(GTK_WIDGET(es)));
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
390 mainwin_lock_info_text(tmp);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
391 g_free(tmp);
821a712c08a3 replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
392 }