Mercurial > audlegacy
annotate src/audacious/ui_skinned_equalizer_slider.c @ 3284:70789a2a5a65 trunk
documentation fixes
author | William Pitcock <nenolod@atheme-project.org> |
---|---|
date | Thu, 09 Aug 2007 06:21:09 -0500 |
parents | f02623377013 |
children | 46591501603e |
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 |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
3 * Copyright (c) 2007 Audacious development team. |
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 | 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" |
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 GtkWidget *fixed; |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
42 SkinPixmapId skin_index; |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
43 gboolean double_size; |
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; |
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); |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
61 static void ui_skinned_equalizer_slider_toggle_doublesize (UiSkinnedEqualizerSlider *equalizer_slider); |
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 }; |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
81 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
|
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 |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
108 klass->doubled = ui_skinned_equalizer_slider_toggle_doublesize; |
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] = |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
111 g_signal_new ("toggle-double-size", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
112 G_STRUCT_OFFSET (UiSkinnedEqualizerSliderClass, doubled), NULL, NULL, |
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 priv->fixed = fixed; |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
133 |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
134 gtk_fixed_put(GTK_FIXED(priv->fixed), GTK_WIDGET(es), es->x, es->y); |
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 |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
184 requisition->width = priv->width*(1+priv->double_size); |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
185 requisition->height = priv->height*(1+priv->double_size); |
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; |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
193 widget->allocation.x *= (1+priv->double_size); |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
194 widget->allocation.y *= (1+priv->double_size); |
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 |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
198 equalizer_slider->x = widget->allocation.x/(priv->double_size ? 2 : 1); |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
199 equalizer_slider->y = widget->allocation.y/(priv->double_size ? 2 : 1); |
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); |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
209 |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
210 GdkPixmap *obj = NULL; |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
211 GdkGC *gc; |
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 obj = gdk_pixmap_new(NULL, priv->width, priv->height, gdk_rgb_get_visual()->depth); |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
214 gc = gdk_gc_new(obj); |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
215 |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
216 gint frame; |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
217 frame = 27 - ((priv->position * 27) / 50); |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
218 if (frame < 14) |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
219 skin_draw_pixmap(bmp_active_skin, obj, gc, priv->skin_index, (frame * 15) + 13, 164, 0, 0, priv->width, priv->height); |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
220 else |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
221 skin_draw_pixmap(bmp_active_skin, obj, gc, priv->skin_index, ((frame - 14) * 15) + 13, 229, 0, 0, priv->width, priv->height); |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
222 |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
223 if (priv->pressed) |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
224 skin_draw_pixmap(bmp_active_skin, obj, gc, priv->skin_index, 0, 176, 1, priv->position, 11, 11); |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
225 else |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
226 skin_draw_pixmap(bmp_active_skin, obj, gc, priv->skin_index, 0, 164, 1, priv->position, 11, 11); |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
227 |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
228 GdkPixmap *image = NULL; |
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 if (priv->double_size) { |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
231 image = create_dblsize_pixmap(obj); |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
232 } else { |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
233 image = gdk_pixmap_new(NULL, priv->width, priv->height, gdk_rgb_get_visual()->depth); |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
234 gdk_draw_drawable (image, gc, obj, 0, 0, 0, 0, priv->width, priv->height); |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
235 } |
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 g_object_unref(obj); |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
238 |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
239 gdk_draw_drawable (widget->window, gc, image, 0, 0, 0, 0, |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
240 priv->width*(1+priv->double_size), priv->height*(1+priv->double_size)); |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
241 g_object_unref(gc); |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
242 g_object_unref(image); |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
243 |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
244 return FALSE; |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
245 } |
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 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
|
248 g_return_val_if_fail (widget != NULL, FALSE); |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
249 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
|
250 g_return_val_if_fail (event != NULL, FALSE); |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
251 |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
252 UiSkinnedEqualizerSlider *es = UI_SKINNED_EQUALIZER_SLIDER (widget); |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
253 UiSkinnedEqualizerSliderPrivate *priv = UI_SKINNED_EQUALIZER_SLIDER_GET_PRIVATE(es); |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
254 |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
255 gint y; |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
256 |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
257 if (event->type == GDK_BUTTON_PRESS) { |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
258 if (event->button == 1) { |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
259 priv->pressed = TRUE; |
3100 | 260 y = event->y/(priv->double_size ? 2 : 1); |
3098
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 if (y >= priv->position && y < priv->position + 11) |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
263 priv->drag_y = y - priv->position; |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
264 else { |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
265 priv->position = y - 5; |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
266 priv->drag_y = 5; |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
267 if (priv->position < 0) |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
268 priv->position = 0; |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
269 if (priv->position > 50) |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
270 priv->position = 50; |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
271 if (priv->position >= 24 && priv->position <= 26) |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
272 priv->position = 25; |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
273 equalizerwin_eq_changed(); |
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 |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
276 ui_skinned_equalizer_slider_set_mainwin_text(es); |
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 } |
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 return TRUE; |
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 |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
284 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
|
285 UiSkinnedEqualizerSliderPrivate *priv = UI_SKINNED_EQUALIZER_SLIDER_GET_PRIVATE(widget); |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
286 |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
287 if (event->button == 1) { |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
288 priv->pressed = FALSE; |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
289 mainwin_release_info_text(); |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
290 gtk_widget_queue_draw(widget); |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
291 } |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
292 return TRUE; |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
293 } |
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 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
|
296 g_return_val_if_fail (widget != NULL, FALSE); |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
297 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
|
298 g_return_val_if_fail (event != NULL, FALSE); |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
299 UiSkinnedEqualizerSlider *es = UI_SKINNED_EQUALIZER_SLIDER(widget); |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
300 UiSkinnedEqualizerSliderPrivate *priv = UI_SKINNED_EQUALIZER_SLIDER_GET_PRIVATE(widget); |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
301 |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
302 if (priv->pressed) { |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
303 gint y; |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
304 |
3100 | 305 y = event->y/(priv->double_size ? 2 : 1); |
3098
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
306 priv->position = y - priv->drag_y; |
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 if (priv->position < 0) |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
309 priv->position = 0; |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
310 if (priv->position > 50) |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
311 priv->position = 50; |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
312 if (priv->position >= 24 && priv->position <= 26) |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
313 priv->position = 25; |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
314 |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
315 ui_skinned_equalizer_slider_set_mainwin_text(es); |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
316 equalizerwin_eq_changed(); |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
317 gtk_widget_queue_draw(widget); |
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 |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
320 return TRUE; |
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 |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
323 static gboolean ui_skinned_equalizer_slider_scroll(GtkWidget *widget, GdkEventScroll *event) { |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
324 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
|
325 g_return_val_if_fail (event != NULL, FALSE); |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
326 UiSkinnedEqualizerSliderPrivate *priv = UI_SKINNED_EQUALIZER_SLIDER_GET_PRIVATE(widget); |
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 if (event->direction == GDK_SCROLL_UP) { |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
329 priv->position -= 2; |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
330 |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
331 if (priv->position < 0) |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
332 priv->position = 0; |
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 else { |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
335 priv->position += 2; |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
336 |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
337 if (priv->position > 50) |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
338 priv->position = 50; |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
339 } |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
340 |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
341 equalizerwin_eq_changed(); |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
342 gtk_widget_queue_draw(widget); |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
343 return TRUE; |
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 |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
346 static void ui_skinned_equalizer_slider_toggle_doublesize(UiSkinnedEqualizerSlider *equalizer_slider) { |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
347 GtkWidget *widget = GTK_WIDGET (equalizer_slider); |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
348 UiSkinnedEqualizerSliderPrivate *priv = UI_SKINNED_EQUALIZER_SLIDER_GET_PRIVATE(equalizer_slider); |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
349 |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
350 priv->double_size = !priv->double_size; |
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 gtk_widget_set_size_request(widget, priv->width*(1+priv->double_size), priv->height*(1+priv->double_size)); |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
353 |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
354 gtk_widget_queue_draw(GTK_WIDGET(equalizer_slider)); |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
355 } |
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 void ui_skinned_equalizer_slider_set_position(GtkWidget *widget, gint pos) { |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
358 g_return_if_fail (UI_SKINNED_IS_EQUALIZER_SLIDER (widget)); |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
359 UiSkinnedEqualizerSliderPrivate *priv = UI_SKINNED_EQUALIZER_SLIDER_GET_PRIVATE(widget); |
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->pressed) |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
362 return; |
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 priv->position = 25 - (gint) ((pos * 25.0) / 20.0); |
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 if (priv->position < 0) |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
367 priv->position = 0; |
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 if (priv->position > 50) |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
370 priv->position = 50; |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
371 |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
372 if (priv->position >= 24 && priv->position <= 26) |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
373 priv->position = 25; |
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 gtk_widget_queue_draw(widget); |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
376 } |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
377 |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
378 gfloat ui_skinned_equalizer_slider_get_position(GtkWidget *widget) { |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
379 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
|
380 UiSkinnedEqualizerSliderPrivate *priv = UI_SKINNED_EQUALIZER_SLIDER_GET_PRIVATE(widget); |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
381 return (20.0 - (((gfloat) priv->position * 20.0) / 25.0)); |
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 |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
384 void ui_skinned_equalizer_slider_set_mainwin_text(UiSkinnedEqualizerSlider * es) { |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
385 gint band = 0; |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
386 const gchar *bandname[11] = { N_("PREAMP"), N_("60HZ"), N_("170HZ"), |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
387 N_("310HZ"), N_("600HZ"), N_("1KHZ"), |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
388 N_("3KHZ"), N_("6KHZ"), N_("12KHZ"), |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
389 N_("14KHZ"), N_("16KHZ") |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
390 }; |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
391 gchar *tmp; |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
392 |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
393 if (es->x > 21) |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
394 band = ((es->x - 78) / 18) + 1; |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
395 |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
396 tmp = |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
397 g_strdup_printf("EQ: %s: %+.1f DB", _(bandname[band]), |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
398 ui_skinned_equalizer_slider_get_position(GTK_WIDGET(es))); |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
399 mainwin_lock_info_text(tmp); |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
400 g_free(tmp); |
821a712c08a3
replace EqSlider with UiSkinnedEqualizerSlider
Tomasz Mon <desowin@gmail.com>
parents:
diff
changeset
|
401 } |