annotate src/audacious/ui_skinned_playlist_slider.c @ 4519:fcd7a800dcd7

remove needless gtk_window_get_position call
author Tomasz Mon <desowin@gmail.com>
date Sun, 27 Apr 2008 23:56:32 +0200
parents 246244ead30e
children cc6255f8b568
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3136
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
1 /*
cfd7f8d144fa forgot new files
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ń
3136
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
4 *
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
5 * Based on:
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
6 * BMP - Cross-platform multimedia player
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
7 * Copyright (C) 2003-2004 BMP development team.
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
8 * XMMS:
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
9 * Copyright (C) 1998-2003 XMMS development team.
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
10 *
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
11 * This program is free software; you can redistribute it and/or modify
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
12 * it under the terms of the GNU General Public License as published by
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
13 * the Free Software Foundation; under version 3 of the License.
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
14 *
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
15 * This program is distributed in the hope that it will be useful,
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
18 * GNU General Public License for more details.
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
19 *
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
20 * You should have received a copy of the GNU General Public License
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
21 * along with this program. If not, see <http://www.gnu.org/licenses>.
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
22 *
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
23 * The Audacious team does not consider modular code linking to
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
24 * Audacious or using our public API to be a derived work.
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
25 */
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
26
4508
246244ead30e renamed skin.* to ui_skin.* and moved ui_skinned_widget_draw() to it
mf0102 <0102@gmx.at>
parents: 4413
diff changeset
27 #include "ui_skin.h"
3136
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
28 #include "ui_skinned_playlist_slider.h"
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
29 #include "main.h"
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
30 #include "ui_playlist.h"
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
31
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
32 #define UI_SKINNED_PLAYLIST_SLIDER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), ui_skinned_playlist_slider_get_type(), UiSkinnedPlaylistSliderPrivate))
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
33 typedef struct _UiSkinnedPlaylistSliderPrivate UiSkinnedPlaylistSliderPrivate;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
34
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
35 enum {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
36 REDRAW,
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
37 LAST_SIGNAL
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
38 };
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
39
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
40 struct _UiSkinnedPlaylistSliderPrivate {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
41 SkinPixmapId skin_index;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
42 gint width, height;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
43
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
44 gint resize_height;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
45 gint move_x;
3146
670c41ca0147 few alternations to scrolling
Tomasz Mon <desowin@gmail.com>
parents: 3137
diff changeset
46 gint prev_y;
670c41ca0147 few alternations to scrolling
Tomasz Mon <desowin@gmail.com>
parents: 3137
diff changeset
47 gint drag_y;
3136
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
48 };
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
49
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
50 static void ui_skinned_playlist_slider_class_init (UiSkinnedPlaylistSliderClass *klass);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
51 static void ui_skinned_playlist_slider_init (UiSkinnedPlaylistSlider *playlist_slider);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
52 static void ui_skinned_playlist_slider_destroy (GtkObject *object);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
53 static void ui_skinned_playlist_slider_realize (GtkWidget *widget);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
54 static void ui_skinned_playlist_slider_size_request (GtkWidget *widget, GtkRequisition *requisition);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
55 static void ui_skinned_playlist_slider_size_allocate (GtkWidget *widget, GtkAllocation *allocation);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
56 static gboolean ui_skinned_playlist_slider_expose (GtkWidget *widget, GdkEventExpose *event);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
57 static void ui_skinned_playlist_slider_set_position (GtkWidget *widget, gint y);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
58 static gboolean ui_skinned_playlist_slider_button_press (GtkWidget *widget, GdkEventButton *event);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
59 static gboolean ui_skinned_playlist_slider_button_release (GtkWidget *widget, GdkEventButton *event);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
60 static gboolean ui_skinned_playlist_slider_motion_notify (GtkWidget *widget, GdkEventMotion *event);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
61 static void ui_skinned_playlist_slider_redraw (UiSkinnedPlaylistSlider *playlist_slider);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
62
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
63 static GtkWidgetClass *parent_class = NULL;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
64 static guint playlist_slider_signals[LAST_SIGNAL] = { 0 };
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
65
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
66 GType ui_skinned_playlist_slider_get_type() {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
67 static GType playlist_slider_type = 0;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
68 if (!playlist_slider_type) {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
69 static const GTypeInfo playlist_slider_info = {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
70 sizeof (UiSkinnedPlaylistSliderClass),
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
71 NULL,
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
72 NULL,
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
73 (GClassInitFunc) ui_skinned_playlist_slider_class_init,
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
74 NULL,
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
75 NULL,
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
76 sizeof (UiSkinnedPlaylistSlider),
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
77 0,
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
78 (GInstanceInitFunc) ui_skinned_playlist_slider_init,
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
79 };
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
80 playlist_slider_type = g_type_register_static (GTK_TYPE_WIDGET, "UiSkinnedPlaylistSlider", &playlist_slider_info, 0);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
81 }
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
82
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
83 return playlist_slider_type;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
84 }
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
85
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
86 static void ui_skinned_playlist_slider_class_init(UiSkinnedPlaylistSliderClass *klass) {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
87 GObjectClass *gobject_class;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
88 GtkObjectClass *object_class;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
89 GtkWidgetClass *widget_class;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
90
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
91 gobject_class = G_OBJECT_CLASS(klass);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
92 object_class = (GtkObjectClass*) klass;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
93 widget_class = (GtkWidgetClass*) klass;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
94 parent_class = gtk_type_class (gtk_widget_get_type ());
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
95
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
96 object_class->destroy = ui_skinned_playlist_slider_destroy;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
97
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
98 widget_class->realize = ui_skinned_playlist_slider_realize;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
99 widget_class->expose_event = ui_skinned_playlist_slider_expose;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
100 widget_class->size_request = ui_skinned_playlist_slider_size_request;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
101 widget_class->size_allocate = ui_skinned_playlist_slider_size_allocate;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
102 widget_class->button_press_event = ui_skinned_playlist_slider_button_press;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
103 widget_class->button_release_event = ui_skinned_playlist_slider_button_release;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
104 widget_class->motion_notify_event = ui_skinned_playlist_slider_motion_notify;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
105
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
106 klass->redraw = ui_skinned_playlist_slider_redraw;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
107
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
108 playlist_slider_signals[REDRAW] =
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
109 g_signal_new ("redraw", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
110 G_STRUCT_OFFSET (UiSkinnedPlaylistSliderClass, redraw), NULL, NULL,
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
111 gtk_marshal_VOID__VOID, G_TYPE_NONE, 0);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
112
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
113 g_type_class_add_private (gobject_class, sizeof (UiSkinnedPlaylistSliderPrivate));
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
114 }
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
115
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
116 static void ui_skinned_playlist_slider_init(UiSkinnedPlaylistSlider *playlist_slider) {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
117 UiSkinnedPlaylistSliderPrivate *priv = UI_SKINNED_PLAYLIST_SLIDER_GET_PRIVATE(playlist_slider);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
118 playlist_slider->pressed = FALSE;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
119 priv->resize_height = 0;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
120 priv->move_x = 0;
3146
670c41ca0147 few alternations to scrolling
Tomasz Mon <desowin@gmail.com>
parents: 3137
diff changeset
121 priv->drag_y = 0;
670c41ca0147 few alternations to scrolling
Tomasz Mon <desowin@gmail.com>
parents: 3137
diff changeset
122 priv->prev_y = 0;
3136
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
123 }
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
124
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
125 GtkWidget* ui_skinned_playlist_slider_new(GtkWidget *fixed, gint x, gint y, gint h) {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
126
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
127 UiSkinnedPlaylistSlider *hs = g_object_new (ui_skinned_playlist_slider_get_type (), NULL);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
128 UiSkinnedPlaylistSliderPrivate *priv = UI_SKINNED_PLAYLIST_SLIDER_GET_PRIVATE(hs);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
129
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
130 hs->x = x;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
131 hs->y = y;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
132 priv->width = 8;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
133 priv->height = h;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
134 priv->skin_index = SKIN_PLEDIT;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
135
3939
d46d60247826 we don't need to store GtkFixed pointer, do we?
Tomasz Mon <desowin@gmail.com>
parents: 3933
diff changeset
136 gtk_fixed_put(GTK_FIXED(fixed), GTK_WIDGET(hs), hs->x, hs->y);
3136
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
137
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
138 return GTK_WIDGET(hs);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
139 }
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
140
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
141 static void ui_skinned_playlist_slider_destroy(GtkObject *object) {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
142 UiSkinnedPlaylistSlider *playlist_slider;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
143
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
144 g_return_if_fail (object != NULL);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
145 g_return_if_fail (UI_SKINNED_IS_PLAYLIST_SLIDER (object));
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
146
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
147 playlist_slider = UI_SKINNED_PLAYLIST_SLIDER (object);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
148
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
149 if (GTK_OBJECT_CLASS (parent_class)->destroy)
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
150 (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
151 }
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
152
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
153 static void ui_skinned_playlist_slider_realize(GtkWidget *widget) {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
154 UiSkinnedPlaylistSlider *playlist_slider;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
155 GdkWindowAttr attributes;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
156 gint attributes_mask;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
157
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
158 g_return_if_fail (widget != NULL);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
159 g_return_if_fail (UI_SKINNED_IS_PLAYLIST_SLIDER(widget));
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
160
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
161 GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
162 playlist_slider = UI_SKINNED_PLAYLIST_SLIDER(widget);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
163
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
164 attributes.x = widget->allocation.x;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
165 attributes.y = widget->allocation.y;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
166 attributes.width = widget->allocation.width;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
167 attributes.height = widget->allocation.height;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
168 attributes.wclass = GDK_INPUT_OUTPUT;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
169 attributes.window_type = GDK_WINDOW_CHILD;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
170 attributes.event_mask = gtk_widget_get_events(widget);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
171 attributes.event_mask |= GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK |
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
172 GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
173 attributes.visual = gtk_widget_get_visual(widget);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
174 attributes.colormap = gtk_widget_get_colormap(widget);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
175
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
176 attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
177 widget->window = gdk_window_new(widget->parent->window, &attributes, attributes_mask);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
178
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
179 widget->style = gtk_style_attach(widget->style, widget->window);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
180 gdk_window_set_user_data(widget->window, widget);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
181 }
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
182
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
183 static void ui_skinned_playlist_slider_size_request(GtkWidget *widget, GtkRequisition *requisition) {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
184 UiSkinnedPlaylistSliderPrivate *priv = UI_SKINNED_PLAYLIST_SLIDER_GET_PRIVATE(widget);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
185
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
186 requisition->width = priv->width;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
187 requisition->height = priv->height;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
188 }
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
189
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
190 static void ui_skinned_playlist_slider_size_allocate(GtkWidget *widget, GtkAllocation *allocation) {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
191 UiSkinnedPlaylistSlider *playlist_slider = UI_SKINNED_PLAYLIST_SLIDER (widget);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
192 UiSkinnedPlaylistSliderPrivate *priv = UI_SKINNED_PLAYLIST_SLIDER_GET_PRIVATE(playlist_slider);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
193
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
194 widget->allocation = *allocation;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
195 if (GTK_WIDGET_REALIZED (widget))
cfd7f8d144fa forgot new files
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);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
197
3137
19908efce4e5 one mutex is enough for resizing
Tomasz Mon <desowin@gmail.com>
parents: 3136
diff changeset
198 if (playlist_slider->x + priv->move_x == widget->allocation.x)
19908efce4e5 one mutex is enough for resizing
Tomasz Mon <desowin@gmail.com>
parents: 3136
diff changeset
199 priv->move_x = 0;
3136
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
200 playlist_slider->x = widget->allocation.x;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
201 playlist_slider->y = widget->allocation.y;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
202
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
203 if (priv->height != widget->allocation.height) {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
204 priv->height = priv->height + priv->resize_height;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
205 priv->resize_height = 0;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
206 gtk_widget_queue_draw(widget);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
207 }
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
208 }
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
209
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
210 static gboolean ui_skinned_playlist_slider_expose(GtkWidget *widget, GdkEventExpose *event) {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
211 g_return_val_if_fail (widget != NULL, FALSE);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
212 g_return_val_if_fail (UI_SKINNED_IS_PLAYLIST_SLIDER (widget), FALSE);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
213 g_return_val_if_fail (event != NULL, FALSE);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
214
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
215 UiSkinnedPlaylistSlider *ps = UI_SKINNED_PLAYLIST_SLIDER (widget);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
216 UiSkinnedPlaylistSliderPrivate *priv = UI_SKINNED_PLAYLIST_SLIDER_GET_PRIVATE(ps);
4119
9d4b5cdae3ba oops, fix previous commit
Tomasz Mon <desowin@gmail.com>
parents: 4118
diff changeset
217 g_return_val_if_fail (priv->width > 0 && priv->height > 0, FALSE);
3136
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
218
4195
2281da647da9 beggining of GdkPixbuf transition
Tomasz Mon <desowin@gmail.com>
parents: 4119
diff changeset
219 GdkPixbuf *obj = NULL;
2281da647da9 beggining of GdkPixbuf transition
Tomasz Mon <desowin@gmail.com>
parents: 4119
diff changeset
220 obj = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, priv->width, priv->height);
3136
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
221
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
222 gint num_visible;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
223 num_visible = playlistwin_list_get_visible_count();
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
224
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
225
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
226 Playlist *playlist = playlist_get_active();
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
227
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
228 gint y;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
229 if (playlist_get_length(playlist) > num_visible)
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
230 y = (playlistwin_list_get_first() * (priv->height - 19)) /
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
231 (playlist_get_length(playlist) - num_visible);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
232 else
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
233 y = 0;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
234
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
235 if (y < 0) y=0;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
236 if (y > priv->height - 19) y = priv->height - 19;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
237
3146
670c41ca0147 few alternations to scrolling
Tomasz Mon <desowin@gmail.com>
parents: 3137
diff changeset
238 priv->prev_y = y;
670c41ca0147 few alternations to scrolling
Tomasz Mon <desowin@gmail.com>
parents: 3137
diff changeset
239
4413
de33c83aa06f Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents: 4212
diff changeset
240 /* FIXME: uses aud_active_skin->pixmaps directly and may need calibration */
3136
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
241 /* drawing background */
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
242 gint c;
4195
2281da647da9 beggining of GdkPixbuf transition
Tomasz Mon <desowin@gmail.com>
parents: 4119
diff changeset
243 for (c = 0; c < priv->height / 29; c++) {
4413
de33c83aa06f Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents: 4212
diff changeset
244 gdk_pixbuf_copy_area(aud_active_skin->pixmaps[SKIN_PLEDIT].pixbuf,
4195
2281da647da9 beggining of GdkPixbuf transition
Tomasz Mon <desowin@gmail.com>
parents: 4119
diff changeset
245 36, 42, priv->width, 29, obj, 0, c*29);
3136
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
246 }
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
247
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
248 /* drawing knob */
4413
de33c83aa06f Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents: 4212
diff changeset
249 skin_draw_pixbuf(widget, aud_active_skin, obj, priv->skin_index, ps->pressed ? 61 : 52, 53, 0, y, priv->width, 18);
3136
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
250
4212
47352b34dbdf introduce ui_skinned_widget_draw
Tomasz Mon <desowin@gmail.com>
parents: 4195
diff changeset
251 ui_skinned_widget_draw(widget, obj, priv->width, priv->height, FALSE);
47352b34dbdf introduce ui_skinned_widget_draw
Tomasz Mon <desowin@gmail.com>
parents: 4195
diff changeset
252
3136
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
253 g_object_unref(obj);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
254
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
255 return FALSE;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
256 }
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
257
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
258 static void ui_skinned_playlist_slider_set_position(GtkWidget *widget, gint y) {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
259 gint pos;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
260 Playlist *playlist = playlist_get_active();
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
261 UiSkinnedPlaylistSliderPrivate *priv = UI_SKINNED_PLAYLIST_SLIDER_GET_PRIVATE(widget);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
262
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
263 y = CLAMP(y, 0, priv->height - 19);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
264
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
265 pos = (y * (playlist_get_length(playlist) - playlistwin_list_get_visible_count())) / (priv->height - 19);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
266 playlistwin_set_toprow(pos);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
267
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
268 gtk_widget_queue_draw(widget);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
269 }
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
270
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
271 static gboolean ui_skinned_playlist_slider_button_press(GtkWidget *widget, GdkEventButton *event) {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
272 UiSkinnedPlaylistSlider *ps = UI_SKINNED_PLAYLIST_SLIDER (widget);
3146
670c41ca0147 few alternations to scrolling
Tomasz Mon <desowin@gmail.com>
parents: 3137
diff changeset
273 UiSkinnedPlaylistSliderPrivate *priv = UI_SKINNED_PLAYLIST_SLIDER_GET_PRIVATE(widget);
3136
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
274
3146
670c41ca0147 few alternations to scrolling
Tomasz Mon <desowin@gmail.com>
parents: 3137
diff changeset
275 if (event->button != 1 && event->button != 2)
670c41ca0147 few alternations to scrolling
Tomasz Mon <desowin@gmail.com>
parents: 3137
diff changeset
276 return TRUE;
670c41ca0147 few alternations to scrolling
Tomasz Mon <desowin@gmail.com>
parents: 3137
diff changeset
277
670c41ca0147 few alternations to scrolling
Tomasz Mon <desowin@gmail.com>
parents: 3137
diff changeset
278 gint y = event->y;
3136
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
279 if (event->type == GDK_BUTTON_PRESS) {
3146
670c41ca0147 few alternations to scrolling
Tomasz Mon <desowin@gmail.com>
parents: 3137
diff changeset
280 ps->pressed = TRUE;
670c41ca0147 few alternations to scrolling
Tomasz Mon <desowin@gmail.com>
parents: 3137
diff changeset
281 if ((y >= priv->prev_y && y < priv->prev_y + 18)) {
670c41ca0147 few alternations to scrolling
Tomasz Mon <desowin@gmail.com>
parents: 3137
diff changeset
282 priv->drag_y = y - priv->prev_y;
670c41ca0147 few alternations to scrolling
Tomasz Mon <desowin@gmail.com>
parents: 3137
diff changeset
283 } else if (event->button == 2) {
3136
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
284 ui_skinned_playlist_slider_set_position(widget, y);
3146
670c41ca0147 few alternations to scrolling
Tomasz Mon <desowin@gmail.com>
parents: 3137
diff changeset
285 priv->drag_y = 0;
670c41ca0147 few alternations to scrolling
Tomasz Mon <desowin@gmail.com>
parents: 3137
diff changeset
286 } else {
670c41ca0147 few alternations to scrolling
Tomasz Mon <desowin@gmail.com>
parents: 3137
diff changeset
287 gint n = playlistwin_list_get_visible_count() / 2;
670c41ca0147 few alternations to scrolling
Tomasz Mon <desowin@gmail.com>
parents: 3137
diff changeset
288 if (y < priv->prev_y)
670c41ca0147 few alternations to scrolling
Tomasz Mon <desowin@gmail.com>
parents: 3137
diff changeset
289 n *= -1;
670c41ca0147 few alternations to scrolling
Tomasz Mon <desowin@gmail.com>
parents: 3137
diff changeset
290 playlistwin_scroll(n);
3136
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
291 }
3146
670c41ca0147 few alternations to scrolling
Tomasz Mon <desowin@gmail.com>
parents: 3137
diff changeset
292 gtk_widget_queue_draw(widget);
3136
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
293 }
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
294 return TRUE;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
295 }
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
296
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
297 static gboolean ui_skinned_playlist_slider_button_release(GtkWidget *widget, GdkEventButton *event) {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
298 UiSkinnedPlaylistSlider *ps = UI_SKINNED_PLAYLIST_SLIDER(widget);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
299
3146
670c41ca0147 few alternations to scrolling
Tomasz Mon <desowin@gmail.com>
parents: 3137
diff changeset
300 if (event->button == 1 || event->button == 2) {
3136
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
301 ps->pressed = FALSE;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
302 gtk_widget_queue_draw(widget);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
303 }
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
304 return TRUE;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
305 }
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
306
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
307 static gboolean ui_skinned_playlist_slider_motion_notify(GtkWidget *widget, GdkEventMotion *event) {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
308 UiSkinnedPlaylistSlider *ps = UI_SKINNED_PLAYLIST_SLIDER(widget);
3146
670c41ca0147 few alternations to scrolling
Tomasz Mon <desowin@gmail.com>
parents: 3137
diff changeset
309 UiSkinnedPlaylistSliderPrivate *priv = UI_SKINNED_PLAYLIST_SLIDER_GET_PRIVATE(widget);
3136
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
310
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
311 if (ps->pressed) {
3146
670c41ca0147 few alternations to scrolling
Tomasz Mon <desowin@gmail.com>
parents: 3137
diff changeset
312 gint y = event->y - priv->drag_y;
3136
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
313 ui_skinned_playlist_slider_set_position(widget, y);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
314 }
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
315 return TRUE;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
316 }
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
317
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
318 static void ui_skinned_playlist_slider_redraw(UiSkinnedPlaylistSlider *playlist_slider) {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
319 UiSkinnedPlaylistSliderPrivate *priv = UI_SKINNED_PLAYLIST_SLIDER_GET_PRIVATE(playlist_slider);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
320
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
321 if (priv->resize_height)
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
322 gtk_widget_set_size_request(GTK_WIDGET(playlist_slider), priv->width, priv->height+priv->resize_height);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
323 if (priv->move_x)
3939
d46d60247826 we don't need to store GtkFixed pointer, do we?
Tomasz Mon <desowin@gmail.com>
parents: 3933
diff changeset
324 gtk_fixed_move(GTK_FIXED(gtk_widget_get_parent(GTK_WIDGET(playlist_slider))), GTK_WIDGET(playlist_slider),
d46d60247826 we don't need to store GtkFixed pointer, do we?
Tomasz Mon <desowin@gmail.com>
parents: 3933
diff changeset
325 playlist_slider->x+priv->move_x, playlist_slider->y);
3136
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
326
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
327 gtk_widget_queue_draw(GTK_WIDGET(playlist_slider));
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
328 }
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
329
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
330 void ui_skinned_playlist_slider_move_relative(GtkWidget *widget, gint x) {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
331 UiSkinnedPlaylistSliderPrivate *priv = UI_SKINNED_PLAYLIST_SLIDER_GET_PRIVATE(widget);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
332 priv->move_x += x;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
333 }
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
334
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
335 void ui_skinned_playlist_slider_resize_relative(GtkWidget *widget, gint h) {
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
336 UiSkinnedPlaylistSliderPrivate *priv = UI_SKINNED_PLAYLIST_SLIDER_GET_PRIVATE(widget);
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
337 priv->resize_height += h;
cfd7f8d144fa forgot new files
Tomasz Mon <desowin@gmail.com>
parents:
diff changeset
338 }