Mercurial > audlegacy
annotate src/audacious/ui_playlist.c @ 3006:3c4ed53a685f trunk
use ui_skinned_set_push_button_data instead accessing values directly
author | Tomasz Mon <desowin@gmail.com> |
---|---|
date | Sun, 08 Jul 2007 20:33:32 +0200 |
parents | 3db40ad79fd9 |
children | 0ed10679834b |
rev | line source |
---|---|
2313 | 1 /* Audacious - Cross-platform multimedia player |
2 * Copyright (C) 2005-2006 Audacious development team. | |
3 * | |
4 * BMP - Cross-platform multimedia player | |
5 * Copyright (C) 2003-2004 BMP development team. | |
6 * | |
7 * Based on XMMS: | |
8 * Copyright (C) 1998-2003 XMMS development team. | |
9 * | |
10 * This program is free software; you can redistribute it and/or modify | |
11 * it under the terms of the GNU General Public License as published by | |
12 * the Free Software Foundation; under version 2 of the License. | |
13 * | |
14 * This program is distributed in the hope that it will be useful, | |
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 * GNU General Public License for more details. | |
18 * | |
19 * You should have received a copy of the GNU General Public License | |
20 * along with this program; if not, write to the Free Software | |
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
22 */ | |
23 | |
24 #include "ui_playlist.h" | |
25 | |
26 #include <glib.h> | |
27 #include <glib/gi18n.h> | |
28 #include <gdk/gdk.h> | |
29 #include <gdk/gdkkeysyms.h> | |
30 #include <gtk/gtk.h> | |
31 #include <string.h> | |
32 | |
33 #include "platform/smartinclude.h" | |
34 | |
35 #include <unistd.h> | |
36 #include <errno.h> | |
37 | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
38 #include "actions-playlist.h" |
2313 | 39 #include "dnd.h" |
40 #include "dock.h" | |
41 #include "hints.h" | |
42 #include "input.h" | |
43 #include "main.h" | |
44 #include "playback.h" | |
45 #include "playlist.h" | |
46 #include "playlist_container.h" | |
2499
15a1f5ee4d1c
[svn] - playlist_manager -> ui_playlist_manager, since it's a UI component.
nenolod
parents:
2495
diff
changeset
|
47 #include "ui_playlist_manager.h" |
2373
ad1d7687814c
[svn] made strings.h for existing strings.c, cleanups
mf0102
parents:
2363
diff
changeset
|
48 #include "strings.h" |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
49 #include "ui_equalizer.h" |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
50 #include "ui_fileopener.h" |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
51 #include "ui_fileinfopopup.h" |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
52 #include "ui_main.h" |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
53 #include "ui_manager.h" |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
54 #include "util.h" |
2313 | 55 |
2494
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
2492
diff
changeset
|
56 #include "ui_skinned_window.h" |
2901
5ed0674fabd6
replace PButton in playlistwin with UiSkinnedButton, pbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
57 #include "ui_skinned_button.h" |
2943
a8f2c99727eb
replace Textbox in playlistwin with UiSkinnedTextbox, textbox.c no longer needed, temporary comment out g_usleep in textbox_scroll as it needs to be run as new thread
Tomasz Mon <desowin@gmail.com>
parents:
2904
diff
changeset
|
58 #include "ui_skinned_textbox.h" |
2494
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
2492
diff
changeset
|
59 |
2313 | 60 #include "icons-stock.h" |
61 #include "images/audacious_playlist.xpm" | |
62 | |
63 GtkWidget *playlistwin; | |
64 | |
65 PlayList_List *playlistwin_list = NULL; | |
2901
5ed0674fabd6
replace PButton in playlistwin with UiSkinnedButton, pbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
66 GtkWidget *playlistwin_shade, *playlistwin_close; |
2313 | 67 |
68 static GdkPixmap *playlistwin_bg; | |
69 static GdkBitmap *playlistwin_mask = NULL; | |
70 | |
71 static gboolean playlistwin_hint_flag = FALSE; | |
72 | |
2348
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
2338
diff
changeset
|
73 static GtkWidget *playlistwin_infopopup = NULL; |
2351
911743d27aba
[svn] - simplify and optimize the metadata tooltip trigger function
giacomo
parents:
2348
diff
changeset
|
74 static guint playlistwin_infopopup_sid = 0; |
2348
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
2338
diff
changeset
|
75 |
2313 | 76 static PlaylistSlider *playlistwin_slider = NULL; |
2943
a8f2c99727eb
replace Textbox in playlistwin with UiSkinnedTextbox, textbox.c no longer needed, temporary comment out g_usleep in textbox_scroll as it needs to be run as new thread
Tomasz Mon <desowin@gmail.com>
parents:
2904
diff
changeset
|
77 static GtkWidget *playlistwin_time_min, *playlistwin_time_sec; |
a8f2c99727eb
replace Textbox in playlistwin with UiSkinnedTextbox, textbox.c no longer needed, temporary comment out g_usleep in textbox_scroll as it needs to be run as new thread
Tomasz Mon <desowin@gmail.com>
parents:
2904
diff
changeset
|
78 static GtkWidget *playlistwin_info, *playlistwin_sinfo; |
2902
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
79 static GtkWidget *playlistwin_srew, *playlistwin_splay; |
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
80 static GtkWidget *playlistwin_spause, *playlistwin_sstop; |
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
81 static GtkWidget *playlistwin_sfwd, *playlistwin_seject; |
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
82 static GtkWidget *playlistwin_sscroll_up, *playlistwin_sscroll_down; |
2313 | 83 |
84 static GList *playlistwin_wlist = NULL; | |
85 | |
86 void playlistwin_select_search_cbt_cb( GtkWidget *called_cbt , | |
87 gpointer other_cbt ); | |
88 static gboolean playlistwin_select_search_kp_cb( GtkWidget *entry , GdkEventKey *event , | |
89 gpointer searchdlg_win ); | |
90 | |
91 static void playlistwin_draw_frame(void); | |
92 | |
2348
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
2338
diff
changeset
|
93 static gboolean playlistwin_fileinfopopup_probe(gpointer * filepopup_win); |
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
2338
diff
changeset
|
94 |
2491
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
95 static gboolean playlistwin_resizing = FALSE; |
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
96 static gint playlistwin_resize_x, playlistwin_resize_y; |
2313 | 97 |
98 gboolean | |
99 playlistwin_is_shaded(void) | |
100 { | |
101 return cfg.playlist_shaded; | |
102 } | |
103 | |
104 gint | |
105 playlistwin_get_width(void) | |
106 { | |
107 cfg.playlist_width /= PLAYLISTWIN_WIDTH_SNAP; | |
108 cfg.playlist_width *= PLAYLISTWIN_WIDTH_SNAP; | |
109 return cfg.playlist_width; | |
110 } | |
111 | |
112 gint | |
113 playlistwin_get_height_unshaded(void) | |
114 { | |
115 gint height; | |
116 cfg.playlist_height /= PLAYLISTWIN_HEIGHT_SNAP; | |
117 cfg.playlist_height *= PLAYLISTWIN_HEIGHT_SNAP; | |
118 height = cfg.playlist_height; | |
119 return height; | |
120 } | |
121 | |
122 gint | |
123 playlistwin_get_height_shaded(void) | |
124 { | |
125 return PLAYLISTWIN_SHADED_HEIGHT; | |
126 } | |
127 | |
128 gint | |
129 playlistwin_get_height(void) | |
130 { | |
131 if (playlistwin_is_shaded()) | |
132 return playlistwin_get_height_shaded(); | |
133 else | |
134 return playlistwin_get_height_unshaded(); | |
135 } | |
136 | |
137 void | |
138 playlistwin_get_size(gint * width, gint * height) | |
139 { | |
140 if (width) | |
141 *width = playlistwin_get_width(); | |
142 | |
143 if (height) | |
144 *height = playlistwin_get_height(); | |
145 } | |
146 | |
147 static void | |
148 playlistwin_update_info(Playlist *playlist) | |
149 { | |
150 gchar *text, *sel_text, *tot_text; | |
151 gulong selection, total; | |
152 gboolean selection_more, total_more; | |
153 | |
154 playlist_get_total_time(playlist, &total, &selection, &total_more, &selection_more); | |
155 | |
156 if (selection > 0 || (selection == 0 && !selection_more)) { | |
157 if (selection > 3600) | |
158 sel_text = | |
159 g_strdup_printf("%lu:%-2.2lu:%-2.2lu%s", selection / 3600, | |
160 (selection / 60) % 60, selection % 60, | |
161 (selection_more ? "+" : "")); | |
162 else | |
163 sel_text = | |
164 g_strdup_printf("%lu:%-2.2lu%s", selection / 60, | |
165 selection % 60, (selection_more ? "+" : "")); | |
166 } | |
167 else | |
168 sel_text = g_strdup("?"); | |
169 if (total > 0 || (total == 0 && !total_more)) { | |
170 if (total > 3600) | |
171 tot_text = | |
172 g_strdup_printf("%lu:%-2.2lu:%-2.2lu%s", total / 3600, | |
173 (total / 60) % 60, total % 60, | |
174 total_more ? "+" : ""); | |
175 else | |
176 tot_text = | |
177 g_strdup_printf("%lu:%-2.2lu%s", total / 60, total % 60, | |
178 total_more ? "+" : ""); | |
179 } | |
180 else | |
181 tot_text = g_strdup("?"); | |
182 text = g_strconcat(sel_text, "/", tot_text, NULL); | |
2943
a8f2c99727eb
replace Textbox in playlistwin with UiSkinnedTextbox, textbox.c no longer needed, temporary comment out g_usleep in textbox_scroll as it needs to be run as new thread
Tomasz Mon <desowin@gmail.com>
parents:
2904
diff
changeset
|
183 ui_skinned_textbox_set_text(playlistwin_info, text ? text : ""); |
2313 | 184 g_free(text); |
185 g_free(tot_text); | |
186 g_free(sel_text); | |
187 } | |
188 | |
189 static void | |
190 playlistwin_update_sinfo(Playlist *playlist) | |
191 { | |
192 gchar *posstr, *timestr, *title, *info; | |
193 gint pos, time; | |
194 | |
195 pos = playlist_get_position(playlist); | |
196 title = playlist_get_songtitle(playlist, pos); | |
197 | |
198 if (!title) { | |
2943
a8f2c99727eb
replace Textbox in playlistwin with UiSkinnedTextbox, textbox.c no longer needed, temporary comment out g_usleep in textbox_scroll as it needs to be run as new thread
Tomasz Mon <desowin@gmail.com>
parents:
2904
diff
changeset
|
199 ui_skinned_textbox_set_text(playlistwin_sinfo, ""); |
2313 | 200 return; |
201 } | |
202 | |
203 convert_title_text(title); | |
204 | |
205 time = playlist_get_songtime(playlist, pos); | |
206 | |
207 if (cfg.show_numbers_in_pl) | |
208 posstr = g_strdup_printf("%d. ", pos + 1); | |
209 else | |
210 posstr = g_strdup(""); | |
211 | |
212 if (time != -1) { | |
213 timestr = g_strdup_printf(" (%d:%-2.2d)", time / 60000, | |
214 (time / 1000) % 60); | |
215 } | |
216 else | |
217 timestr = g_strdup(""); | |
218 | |
219 info = g_strdup_printf("%s%s%s", posstr, title, timestr); | |
220 | |
221 g_free(posstr); | |
222 g_free(title); | |
223 g_free(timestr); | |
224 | |
2943
a8f2c99727eb
replace Textbox in playlistwin with UiSkinnedTextbox, textbox.c no longer needed, temporary comment out g_usleep in textbox_scroll as it needs to be run as new thread
Tomasz Mon <desowin@gmail.com>
parents:
2904
diff
changeset
|
225 ui_skinned_textbox_set_text(playlistwin_sinfo, info ? info : ""); |
2313 | 226 g_free(info); |
227 } | |
228 | |
229 gboolean | |
230 playlistwin_item_visible(gint index) | |
231 { | |
232 if (index >= playlistwin_list->pl_first | |
233 && index < | |
234 (playlistwin_list->pl_first + playlistwin_list->pl_num_visible)) | |
235 return TRUE; | |
236 return FALSE; | |
237 } | |
238 | |
239 gint | |
240 playlistwin_get_toprow(void) | |
241 { | |
242 if (playlistwin_list) | |
243 return (playlistwin_list->pl_first); | |
244 return (-1); | |
245 } | |
246 | |
247 void | |
248 playlistwin_set_toprow(gint toprow) | |
249 { | |
250 if (playlistwin_list) | |
251 playlistwin_list->pl_first = toprow; | |
252 playlistwin_update_list(playlist_get_active()); | |
253 } | |
254 | |
255 void | |
256 playlistwin_update_list(Playlist *playlist) | |
257 { | |
258 /* this can happen early on. just bail gracefully. */ | |
2363 | 259 g_return_if_fail(playlistwin_list); |
2313 | 260 |
261 widget_draw(WIDGET(playlistwin_list)); | |
262 widget_draw(WIDGET(playlistwin_slider)); | |
263 playlistwin_update_info(playlist); | |
264 playlistwin_update_sinfo(playlist); | |
265 } | |
266 | |
267 static void | |
268 playlistwin_set_mask(void) | |
269 { | |
270 GdkGC *gc; | |
271 GdkColor pattern; | |
272 | |
273 if (playlistwin_mask) | |
274 g_object_unref(playlistwin_mask); | |
275 | |
276 playlistwin_mask = | |
277 gdk_pixmap_new(playlistwin->window, playlistwin_get_width(), | |
278 playlistwin_get_height(), 1); | |
279 gc = gdk_gc_new(playlistwin_mask); | |
280 pattern.pixel = 1; | |
281 gdk_gc_set_foreground(gc, &pattern); | |
282 gdk_draw_rectangle(playlistwin_mask, gc, TRUE, 0, 0, | |
283 playlistwin_get_width(), playlistwin_get_height()); | |
284 g_object_unref(gc); | |
285 | |
286 gtk_widget_shape_combine_mask(playlistwin, playlistwin_mask, 0, 0); | |
287 } | |
288 | |
289 static void | |
290 playlistwin_set_geometry_hints(gboolean shaded) | |
291 { | |
292 GdkGeometry geometry; | |
293 GdkWindowHints mask; | |
294 | |
295 geometry.min_width = PLAYLISTWIN_MIN_WIDTH; | |
296 geometry.max_width = G_MAXUINT16; | |
297 | |
298 geometry.width_inc = PLAYLISTWIN_WIDTH_SNAP; | |
299 geometry.height_inc = PLAYLISTWIN_HEIGHT_SNAP; | |
300 | |
301 if (shaded) { | |
302 geometry.min_height = PLAYLISTWIN_SHADED_HEIGHT; | |
303 geometry.max_height = PLAYLISTWIN_SHADED_HEIGHT; | |
304 geometry.base_height = PLAYLISTWIN_SHADED_HEIGHT; | |
305 } | |
306 else { | |
307 geometry.min_height = PLAYLISTWIN_MIN_HEIGHT; | |
308 geometry.max_height = G_MAXUINT16; | |
309 } | |
310 | |
311 mask = GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE | GDK_HINT_RESIZE_INC; | |
312 | |
313 gtk_window_set_geometry_hints(GTK_WINDOW(playlistwin), | |
314 playlistwin, &geometry, mask); | |
315 } | |
316 | |
317 void | |
318 playlistwin_set_sinfo_font(gchar *font) | |
319 { | |
320 gchar *tmp = NULL, *tmp2 = NULL; | |
321 | |
2363 | 322 g_return_if_fail(font); |
2313 | 323 |
324 tmp = g_strdup(font); | |
2363 | 325 g_return_if_fail(tmp); |
2313 | 326 |
327 *strrchr(tmp, ' ') = '\0'; | |
328 tmp2 = g_strdup_printf("%s 8", tmp); | |
2363 | 329 g_return_if_fail(tmp2); |
330 | |
2943
a8f2c99727eb
replace Textbox in playlistwin with UiSkinnedTextbox, textbox.c no longer needed, temporary comment out g_usleep in textbox_scroll as it needs to be run as new thread
Tomasz Mon <desowin@gmail.com>
parents:
2904
diff
changeset
|
331 ui_skinned_textbox_set_xfont(playlistwin_sinfo, cfg.mainwin_use_xfont, tmp2); |
2313 | 332 |
2363 | 333 g_free(tmp); |
334 g_free(tmp2); | |
2313 | 335 } |
336 | |
337 void | |
338 playlistwin_set_sinfo_scroll(gboolean scroll) | |
339 { | |
340 if(playlistwin_is_shaded()) | |
2943
a8f2c99727eb
replace Textbox in playlistwin with UiSkinnedTextbox, textbox.c no longer needed, temporary comment out g_usleep in textbox_scroll as it needs to be run as new thread
Tomasz Mon <desowin@gmail.com>
parents:
2904
diff
changeset
|
341 ui_skinned_textbox_set_scroll(playlistwin_sinfo, cfg.autoscroll); |
2313 | 342 else |
2943
a8f2c99727eb
replace Textbox in playlistwin with UiSkinnedTextbox, textbox.c no longer needed, temporary comment out g_usleep in textbox_scroll as it needs to be run as new thread
Tomasz Mon <desowin@gmail.com>
parents:
2904
diff
changeset
|
343 ui_skinned_textbox_set_scroll(playlistwin_sinfo, FALSE); |
2313 | 344 } |
345 | |
346 void | |
347 playlistwin_set_shade(gboolean shaded) | |
348 { | |
349 cfg.playlist_shaded = shaded; | |
350 | |
351 if (shaded) { | |
352 playlistwin_set_sinfo_font(cfg.playlist_font); | |
353 playlistwin_set_sinfo_scroll(cfg.autoscroll); | |
2943
a8f2c99727eb
replace Textbox in playlistwin with UiSkinnedTextbox, textbox.c no longer needed, temporary comment out g_usleep in textbox_scroll as it needs to be run as new thread
Tomasz Mon <desowin@gmail.com>
parents:
2904
diff
changeset
|
354 gtk_widget_show(playlistwin_sinfo); |
3006
3c4ed53a685f
use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
355 ui_skinned_set_push_button_data(playlistwin_shade, 128, 45, 150, 42); |
3c4ed53a685f
use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
356 ui_skinned_set_push_button_data(playlistwin_close, 138, 45, -1, -1); |
2313 | 357 } |
358 else { | |
2943
a8f2c99727eb
replace Textbox in playlistwin with UiSkinnedTextbox, textbox.c no longer needed, temporary comment out g_usleep in textbox_scroll as it needs to be run as new thread
Tomasz Mon <desowin@gmail.com>
parents:
2904
diff
changeset
|
359 gtk_widget_hide(playlistwin_sinfo); |
2313 | 360 playlistwin_set_sinfo_scroll(FALSE); |
3006
3c4ed53a685f
use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
361 ui_skinned_set_push_button_data(playlistwin_shade, 157, 3, 62, 42); |
3c4ed53a685f
use ui_skinned_set_push_button_data instead accessing values directly
Tomasz Mon <desowin@gmail.com>
parents:
3005
diff
changeset
|
362 ui_skinned_set_push_button_data(playlistwin_close, 167, 3, -1, -1); |
2313 | 363 } |
364 | |
365 dock_shade(dock_window_list, GTK_WINDOW(playlistwin), | |
366 playlistwin_get_height()); | |
367 | |
368 playlistwin_set_geometry_hints(cfg.playlist_shaded); | |
369 | |
370 gtk_window_resize(GTK_WINDOW(playlistwin), | |
371 playlistwin_get_width(), | |
372 playlistwin_get_height()); | |
373 | |
374 playlistwin_set_mask(); | |
375 | |
376 widget_draw(WIDGET(playlistwin_list)); | |
377 widget_draw(WIDGET(playlistwin_slider)); | |
378 | |
379 draw_playlist_window(TRUE); | |
380 } | |
381 | |
382 static void | |
383 playlistwin_set_shade_menu(gboolean shaded) | |
384 { | |
385 GtkAction *action = gtk_action_group_get_action( | |
386 toggleaction_group_others , "roll up playlist editor" ); | |
387 gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(action) , shaded ); | |
388 | |
389 playlistwin_set_shade(shaded); | |
390 playlistwin_update_list(playlist_get_active()); | |
391 } | |
392 | |
393 void | |
394 playlistwin_shade_toggle(void) | |
395 { | |
396 playlistwin_set_shade_menu(!cfg.playlist_shaded); | |
397 } | |
398 | |
399 static void | |
400 playlistwin_release(GtkWidget * widget, | |
401 GdkEventButton * event, | |
402 gpointer callback_data) | |
403 { | |
404 if (event->button == 3) | |
405 return; | |
406 | |
407 gdk_pointer_ungrab(GDK_CURRENT_TIME); | |
408 playlistwin_resizing = FALSE; | |
409 gdk_flush(); | |
410 | |
411 if (dock_is_moving(GTK_WINDOW(playlistwin))) | |
412 dock_move_release(GTK_WINDOW(playlistwin)); | |
413 else | |
414 { | |
415 handle_release_cb(playlistwin_wlist, widget, event); | |
416 draw_playlist_window(FALSE); | |
417 } | |
418 } | |
419 | |
420 void | |
421 playlistwin_scroll(gint num) | |
422 { | |
423 playlistwin_list->pl_first += num; | |
424 playlistwin_update_list(playlist_get_active()); | |
425 } | |
426 | |
427 void | |
428 playlistwin_scroll_up_pushed(void) | |
429 { | |
430 playlistwin_scroll(-3); | |
431 } | |
432 | |
433 void | |
434 playlistwin_scroll_down_pushed(void) | |
435 { | |
436 playlistwin_scroll(3); | |
437 } | |
438 | |
439 static void | |
440 playlistwin_select_all(void) | |
441 { | |
442 Playlist *playlist = playlist_get_active(); | |
443 | |
444 playlist_select_all(playlist, TRUE); | |
445 playlistwin_list->pl_prev_selected = 0; | |
446 playlistwin_list->pl_prev_min = 0; | |
447 playlistwin_list->pl_prev_max = playlist_get_length(playlist) - 1; | |
448 playlistwin_update_list(playlist); | |
449 } | |
450 | |
451 static void | |
452 playlistwin_select_none(void) | |
453 { | |
454 playlist_select_all(playlist_get_active(), FALSE); | |
455 playlistwin_list->pl_prev_selected = -1; | |
456 playlistwin_list->pl_prev_min = -1; | |
457 playlistwin_update_list(playlist_get_active()); | |
458 } | |
459 | |
460 static void | |
461 playlistwin_select_search(void) | |
462 { | |
463 Playlist *playlist = playlist_get_active(); | |
464 GtkWidget *searchdlg_win, *searchdlg_table; | |
465 GtkWidget *searchdlg_hbox, *searchdlg_logo, *searchdlg_helptext; | |
2807
26755684c0dc
[svn] - Fixed naming inconsistencies in search dialog
mf0102
parents:
2653
diff
changeset
|
466 GtkWidget *searchdlg_entry_title, *searchdlg_label_title; |
26755684c0dc
[svn] - Fixed naming inconsistencies in search dialog
mf0102
parents:
2653
diff
changeset
|
467 GtkWidget *searchdlg_entry_album, *searchdlg_label_album; |
2313 | 468 GtkWidget *searchdlg_entry_file_name, *searchdlg_label_file_name; |
469 GtkWidget *searchdlg_entry_performer, *searchdlg_label_performer; | |
470 GtkWidget *searchdlg_checkbt_clearprevsel; | |
471 GtkWidget *searchdlg_checkbt_newplaylist; | |
472 GtkWidget *searchdlg_checkbt_autoenqueue; | |
473 gint result; | |
474 | |
475 /* create dialog */ | |
476 searchdlg_win = gtk_dialog_new_with_buttons( | |
477 _("Search entries in active playlist") , GTK_WINDOW(mainwin) , | |
478 GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT , | |
479 GTK_STOCK_CANCEL , GTK_RESPONSE_REJECT , GTK_STOCK_OK , GTK_RESPONSE_ACCEPT , NULL ); | |
2904 | 480 gtk_window_set_position(GTK_WINDOW(searchdlg_win), GTK_WIN_POS_CENTER); |
481 | |
2313 | 482 /* help text and logo */ |
483 searchdlg_hbox = gtk_hbox_new( FALSE , 4 ); | |
484 searchdlg_logo = gtk_image_new_from_stock( GTK_STOCK_FIND , GTK_ICON_SIZE_DIALOG ); | |
485 searchdlg_helptext = gtk_label_new( _("Select entries in playlist by filling one or more " | |
486 "fields. Fields use regular expressions syntax, case-insensitive. If you don't know how " | |
487 "regular expressions work, simply insert a literal portion of what you're searching for.") ); | |
488 gtk_label_set_line_wrap( GTK_LABEL(searchdlg_helptext) , TRUE ); | |
489 gtk_box_pack_start( GTK_BOX(searchdlg_hbox) , searchdlg_logo , FALSE , FALSE , 0 ); | |
490 gtk_box_pack_start( GTK_BOX(searchdlg_hbox) , searchdlg_helptext , FALSE , FALSE , 0 ); | |
2904 | 491 |
2807
26755684c0dc
[svn] - Fixed naming inconsistencies in search dialog
mf0102
parents:
2653
diff
changeset
|
492 /* title */ |
26755684c0dc
[svn] - Fixed naming inconsistencies in search dialog
mf0102
parents:
2653
diff
changeset
|
493 searchdlg_label_title = gtk_label_new( _("Title: ") ); |
26755684c0dc
[svn] - Fixed naming inconsistencies in search dialog
mf0102
parents:
2653
diff
changeset
|
494 searchdlg_entry_title = gtk_entry_new(); |
26755684c0dc
[svn] - Fixed naming inconsistencies in search dialog
mf0102
parents:
2653
diff
changeset
|
495 gtk_misc_set_alignment( GTK_MISC(searchdlg_label_title) , 0 , 0.5 ); |
26755684c0dc
[svn] - Fixed naming inconsistencies in search dialog
mf0102
parents:
2653
diff
changeset
|
496 g_signal_connect( G_OBJECT(searchdlg_entry_title) , "key-press-event" , |
2313 | 497 G_CALLBACK(playlistwin_select_search_kp_cb) , searchdlg_win ); |
2904 | 498 |
2807
26755684c0dc
[svn] - Fixed naming inconsistencies in search dialog
mf0102
parents:
2653
diff
changeset
|
499 /* album */ |
26755684c0dc
[svn] - Fixed naming inconsistencies in search dialog
mf0102
parents:
2653
diff
changeset
|
500 searchdlg_label_album= gtk_label_new( _("Album: ") ); |
26755684c0dc
[svn] - Fixed naming inconsistencies in search dialog
mf0102
parents:
2653
diff
changeset
|
501 searchdlg_entry_album= gtk_entry_new(); |
26755684c0dc
[svn] - Fixed naming inconsistencies in search dialog
mf0102
parents:
2653
diff
changeset
|
502 gtk_misc_set_alignment( GTK_MISC(searchdlg_label_album) , 0 , 0.5 ); |
26755684c0dc
[svn] - Fixed naming inconsistencies in search dialog
mf0102
parents:
2653
diff
changeset
|
503 g_signal_connect( G_OBJECT(searchdlg_entry_album) , "key-press-event" , |
2313 | 504 G_CALLBACK(playlistwin_select_search_kp_cb) , searchdlg_win ); |
2904 | 505 |
2313 | 506 /* artist */ |
507 searchdlg_label_performer = gtk_label_new( _("Artist: ") ); | |
508 searchdlg_entry_performer = gtk_entry_new(); | |
509 gtk_misc_set_alignment( GTK_MISC(searchdlg_label_performer) , 0 , 0.5 ); | |
510 g_signal_connect( G_OBJECT(searchdlg_entry_performer) , "key-press-event" , | |
511 G_CALLBACK(playlistwin_select_search_kp_cb) , searchdlg_win ); | |
2904 | 512 |
2313 | 513 /* file name */ |
514 searchdlg_label_file_name = gtk_label_new( _("Filename: ") ); | |
515 searchdlg_entry_file_name = gtk_entry_new(); | |
516 gtk_misc_set_alignment( GTK_MISC(searchdlg_label_file_name) , 0 , 0.5 ); | |
517 g_signal_connect( G_OBJECT(searchdlg_entry_file_name) , "key-press-event" , | |
518 G_CALLBACK(playlistwin_select_search_kp_cb) , searchdlg_win ); | |
2904 | 519 |
2313 | 520 /* some options that control behaviour */ |
521 searchdlg_checkbt_clearprevsel = gtk_check_button_new_with_label( | |
522 _("Clear previous selection before searching") ); | |
523 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(searchdlg_checkbt_clearprevsel) , TRUE ); | |
524 searchdlg_checkbt_autoenqueue = gtk_check_button_new_with_label( | |
525 _("Automatically toggle queue for matching entries") ); | |
526 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(searchdlg_checkbt_autoenqueue) , FALSE ); | |
527 searchdlg_checkbt_newplaylist = gtk_check_button_new_with_label( | |
528 _("Create a new playlist with matching entries") ); | |
529 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(searchdlg_checkbt_newplaylist) , FALSE ); | |
530 g_signal_connect( G_OBJECT(searchdlg_checkbt_autoenqueue) , "clicked" , | |
531 G_CALLBACK(playlistwin_select_search_cbt_cb) , searchdlg_checkbt_newplaylist ); | |
532 g_signal_connect( G_OBJECT(searchdlg_checkbt_newplaylist) , "clicked" , | |
533 G_CALLBACK(playlistwin_select_search_cbt_cb) , searchdlg_checkbt_autoenqueue ); | |
2904 | 534 |
2313 | 535 /* place fields in searchdlg_table */ |
536 searchdlg_table = gtk_table_new( 8 , 2 , FALSE ); | |
537 gtk_table_set_row_spacing( GTK_TABLE(searchdlg_table) , 0 , 8 ); | |
538 gtk_table_set_row_spacing( GTK_TABLE(searchdlg_table) , 4 , 8 ); | |
539 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_hbox , | |
540 0 , 2 , 0 , 1 , GTK_FILL | GTK_EXPAND , GTK_FILL | GTK_EXPAND , 0 , 2 ); | |
2807
26755684c0dc
[svn] - Fixed naming inconsistencies in search dialog
mf0102
parents:
2653
diff
changeset
|
541 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_label_title , |
2313 | 542 0 , 1 , 1 , 2 , GTK_FILL , GTK_FILL | GTK_EXPAND , 0 , 2 ); |
2807
26755684c0dc
[svn] - Fixed naming inconsistencies in search dialog
mf0102
parents:
2653
diff
changeset
|
543 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_entry_title , |
2313 | 544 1 , 2 , 1 , 2 , GTK_FILL | GTK_EXPAND , GTK_FILL | GTK_EXPAND , 0 , 2 ); |
2807
26755684c0dc
[svn] - Fixed naming inconsistencies in search dialog
mf0102
parents:
2653
diff
changeset
|
545 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_label_album, |
2313 | 546 0 , 1 , 2 , 3 , GTK_FILL , GTK_FILL | GTK_EXPAND , 0 , 2 ); |
2807
26755684c0dc
[svn] - Fixed naming inconsistencies in search dialog
mf0102
parents:
2653
diff
changeset
|
547 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_entry_album, |
2313 | 548 1 , 2 , 2 , 3 , GTK_FILL | GTK_EXPAND , GTK_FILL | GTK_EXPAND , 0 , 2 ); |
549 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_label_performer , | |
550 0 , 1 , 3 , 4 , GTK_FILL , GTK_FILL | GTK_EXPAND , 0 , 2 ); | |
551 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_entry_performer , | |
552 1 , 2 , 3 , 4 , GTK_FILL | GTK_EXPAND , GTK_FILL | GTK_EXPAND , 0 , 2 ); | |
553 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_label_file_name , | |
554 0 , 1 , 4 , 5 , GTK_FILL , GTK_FILL | GTK_EXPAND , 0 , 2 ); | |
555 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_entry_file_name , | |
556 1 , 2 , 4 , 5 , GTK_FILL | GTK_EXPAND , GTK_FILL | GTK_EXPAND , 0 , 2 ); | |
557 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_checkbt_clearprevsel , | |
558 0 , 2 , 5 , 6 , GTK_FILL | GTK_EXPAND , GTK_FILL | GTK_EXPAND , 0 , 1 ); | |
559 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_checkbt_autoenqueue , | |
560 0 , 2 , 6 , 7 , GTK_FILL | GTK_EXPAND , GTK_FILL | GTK_EXPAND , 0 , 1 ); | |
561 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_checkbt_newplaylist , | |
562 0 , 2 , 7 , 8 , GTK_FILL | GTK_EXPAND , GTK_FILL | GTK_EXPAND , 0 , 1 ); | |
563 | |
564 gtk_container_set_border_width( GTK_CONTAINER(searchdlg_table) , 5 ); | |
565 gtk_container_add( GTK_CONTAINER(GTK_DIALOG(searchdlg_win)->vbox) , searchdlg_table ); | |
566 gtk_widget_show_all( searchdlg_win ); | |
567 result = gtk_dialog_run( GTK_DIALOG(searchdlg_win) ); | |
568 switch(result) | |
569 { | |
570 case GTK_RESPONSE_ACCEPT: | |
571 { | |
572 gint matched_entries_num = 0; | |
573 /* create a TitleInput tuple with user search data */ | |
574 TitleInput *tuple = g_malloc(sizeof(TitleInput)); | |
575 gchar *searchdata = NULL; | |
2807
26755684c0dc
[svn] - Fixed naming inconsistencies in search dialog
mf0102
parents:
2653
diff
changeset
|
576 searchdata = (gchar*)gtk_entry_get_text( GTK_ENTRY(searchdlg_entry_title) ); |
2313 | 577 tuple->track_name = ( strcmp(searchdata,"") ) ? g_strdup(searchdata) : NULL; |
2807
26755684c0dc
[svn] - Fixed naming inconsistencies in search dialog
mf0102
parents:
2653
diff
changeset
|
578 searchdata = (gchar*)gtk_entry_get_text( GTK_ENTRY(searchdlg_entry_album) ); |
2313 | 579 tuple->album_name = ( strcmp(searchdata,"") ) ? g_strdup(searchdata) : NULL; |
580 searchdata = (gchar*)gtk_entry_get_text( GTK_ENTRY(searchdlg_entry_performer) ); | |
581 tuple->performer = ( strcmp(searchdata,"") ) ? g_strdup(searchdata) : NULL; | |
582 searchdata = (gchar*)gtk_entry_get_text( GTK_ENTRY(searchdlg_entry_file_name) ); | |
583 tuple->file_name = ( strcmp(searchdata,"") ) ? g_strdup(searchdata) : NULL; | |
584 /* check if previous selection should be cleared before searching */ | |
585 if ( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(searchdlg_checkbt_clearprevsel)) == TRUE ) | |
586 playlistwin_select_none(); | |
587 /* now send this tuple to the real search function */ | |
588 matched_entries_num = playlist_select_search( playlist , tuple , 0 ); | |
589 /* we do not need the tuple and its data anymore */ | |
590 if ( tuple->track_name != NULL ) g_free( tuple->track_name ); | |
591 if ( tuple->album_name != NULL ) g_free( tuple->album_name ); | |
592 if ( tuple->performer != NULL ) g_free( tuple->performer ); | |
593 if ( tuple->file_name != NULL ) g_free( tuple->file_name ); | |
594 g_free( tuple ); | |
595 playlistwin_update_list(playlist_get_active()); | |
596 /* check if a new playlist should be created after searching */ | |
597 if ( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(searchdlg_checkbt_newplaylist)) == TRUE ) | |
598 playlist_new_from_selected(); | |
599 /* check if matched entries should be queued */ | |
600 else if ( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(searchdlg_checkbt_autoenqueue)) == TRUE ) | |
601 playlist_queue(playlist_get_active()); | |
602 break; | |
603 } | |
604 default: | |
605 break; | |
606 } | |
607 /* done here :) */ | |
608 gtk_widget_destroy( searchdlg_win ); | |
609 } | |
610 | |
611 static void | |
612 playlistwin_inverse_selection(void) | |
613 { | |
614 playlist_select_invert_all(playlist_get_active()); | |
615 playlistwin_list->pl_prev_selected = -1; | |
616 playlistwin_list->pl_prev_min = -1; | |
617 playlistwin_update_list(playlist_get_active()); | |
618 } | |
619 | |
620 static void | |
621 playlistwin_resize(gint width, gint height) | |
622 { | |
2491
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
623 gint tx, ty; |
2507
e07c141dd326
[svn] - made new functions: widget_move_relative and widget_resize_relative
mf0102
parents:
2499
diff
changeset
|
624 gint dx, dy; |
2313 | 625 gboolean redraw; |
626 | |
627 g_return_if_fail(width > 0 && height > 0); | |
628 | |
2491
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
629 tx = (width - PLAYLISTWIN_MIN_WIDTH) / PLAYLISTWIN_WIDTH_SNAP; |
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
630 tx = (tx * PLAYLISTWIN_WIDTH_SNAP) + PLAYLISTWIN_MIN_WIDTH; |
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
631 if (tx < PLAYLISTWIN_MIN_WIDTH) |
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
632 tx = PLAYLISTWIN_MIN_WIDTH; |
2313 | 633 |
634 if (!cfg.playlist_shaded) | |
2491
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
635 { |
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
636 ty = (height - PLAYLISTWIN_MIN_HEIGHT) / PLAYLISTWIN_HEIGHT_SNAP; |
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
637 ty = (ty * PLAYLISTWIN_HEIGHT_SNAP) + PLAYLISTWIN_MIN_HEIGHT; |
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
638 if (ty < PLAYLISTWIN_MIN_HEIGHT) |
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
639 ty = PLAYLISTWIN_MIN_HEIGHT; |
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
640 } |
2313 | 641 else |
2491
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
642 ty = cfg.playlist_height; |
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
643 |
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
644 if (tx == cfg.playlist_width && ty == cfg.playlist_height) |
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
645 return; |
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
646 |
2507
e07c141dd326
[svn] - made new functions: widget_move_relative and widget_resize_relative
mf0102
parents:
2499
diff
changeset
|
647 /* difference between previous size and new size */ |
e07c141dd326
[svn] - made new functions: widget_move_relative and widget_resize_relative
mf0102
parents:
2499
diff
changeset
|
648 dx = tx - cfg.playlist_width; |
e07c141dd326
[svn] - made new functions: widget_move_relative and widget_resize_relative
mf0102
parents:
2499
diff
changeset
|
649 dy = ty - cfg.playlist_height; |
e07c141dd326
[svn] - made new functions: widget_move_relative and widget_resize_relative
mf0102
parents:
2499
diff
changeset
|
650 |
2491
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
651 cfg.playlist_width = width = tx; |
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
652 cfg.playlist_height = height = ty; |
2313 | 653 |
654 | |
2507
e07c141dd326
[svn] - made new functions: widget_move_relative and widget_resize_relative
mf0102
parents:
2499
diff
changeset
|
655 widget_resize_relative(WIDGET(playlistwin_list), dx, dy); |
2313 | 656 |
2507
e07c141dd326
[svn] - made new functions: widget_move_relative and widget_resize_relative
mf0102
parents:
2499
diff
changeset
|
657 widget_move_relative(WIDGET(playlistwin_slider), dx, 0); |
e07c141dd326
[svn] - made new functions: widget_move_relative and widget_resize_relative
mf0102
parents:
2499
diff
changeset
|
658 widget_resize_relative(WIDGET(playlistwin_slider), 0, dy); |
2313 | 659 |
2945
09c216d437b2
Backed out changeset 3c66c8d03c534692d1606ed3ed79634e227f7bd2
William Pitcock <nenolod@atheme.org>
parents:
2944
diff
changeset
|
660 ui_skinned_textbox_resize_relative(playlistwin_sinfo, dx, 0); |
2313 | 661 playlistwin_update_sinfo(playlist_get_active()); |
662 | |
2901
5ed0674fabd6
replace PButton in playlistwin with UiSkinnedButton, pbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
663 ui_skinned_button_move_relative(playlistwin_shade, dx, 0); |
5ed0674fabd6
replace PButton in playlistwin with UiSkinnedButton, pbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
664 ui_skinned_button_move_relative(playlistwin_close, dx, 0); |
2943
a8f2c99727eb
replace Textbox in playlistwin with UiSkinnedTextbox, textbox.c no longer needed, temporary comment out g_usleep in textbox_scroll as it needs to be run as new thread
Tomasz Mon <desowin@gmail.com>
parents:
2904
diff
changeset
|
665 ui_skinned_textbox_move_relative(playlistwin_time_min, dx, dy); |
a8f2c99727eb
replace Textbox in playlistwin with UiSkinnedTextbox, textbox.c no longer needed, temporary comment out g_usleep in textbox_scroll as it needs to be run as new thread
Tomasz Mon <desowin@gmail.com>
parents:
2904
diff
changeset
|
666 ui_skinned_textbox_move_relative(playlistwin_time_sec, dx, dy); |
a8f2c99727eb
replace Textbox in playlistwin with UiSkinnedTextbox, textbox.c no longer needed, temporary comment out g_usleep in textbox_scroll as it needs to be run as new thread
Tomasz Mon <desowin@gmail.com>
parents:
2904
diff
changeset
|
667 ui_skinned_textbox_move_relative(playlistwin_info, dx, dy); |
2902
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
668 ui_skinned_button_move_relative(playlistwin_srew, dx, dy); |
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
669 ui_skinned_button_move_relative(playlistwin_splay, dx, dy); |
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
670 ui_skinned_button_move_relative(playlistwin_spause, dx, dy); |
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
671 ui_skinned_button_move_relative(playlistwin_sstop, dx, dy); |
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
672 ui_skinned_button_move_relative(playlistwin_sfwd, dx, dy); |
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
673 ui_skinned_button_move_relative(playlistwin_seject, dx, dy); |
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
674 ui_skinned_button_move_relative(playlistwin_sscroll_up, dx, dy); |
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
675 ui_skinned_button_move_relative(playlistwin_sscroll_down, dx, dy); |
2313 | 676 |
677 g_object_unref(playlistwin_bg); | |
678 playlistwin_bg = gdk_pixmap_new(playlistwin->window, width, height, -1); | |
679 playlistwin_set_mask(); | |
680 | |
681 widget_list_lock(playlistwin_wlist); | |
2965
f84d09bada0f
correct _move_relative() and _resize_relative()
Tomasz Mon <desowin@gmail.com>
parents:
2950
diff
changeset
|
682 GList *iter; |
f84d09bada0f
correct _move_relative() and _resize_relative()
Tomasz Mon <desowin@gmail.com>
parents:
2950
diff
changeset
|
683 for (iter = GTK_FIXED (SKINNED_WINDOW(playlistwin)->fixed)->children; iter; iter = g_list_next (iter)) { |
f84d09bada0f
correct _move_relative() and _resize_relative()
Tomasz Mon <desowin@gmail.com>
parents:
2950
diff
changeset
|
684 GtkFixedChild *child_data = (GtkFixedChild *) iter->data; |
f84d09bada0f
correct _move_relative() and _resize_relative()
Tomasz Mon <desowin@gmail.com>
parents:
2950
diff
changeset
|
685 GtkWidget *child = child_data->widget; |
f84d09bada0f
correct _move_relative() and _resize_relative()
Tomasz Mon <desowin@gmail.com>
parents:
2950
diff
changeset
|
686 g_signal_emit_by_name(child, "redraw"); |
f84d09bada0f
correct _move_relative() and _resize_relative()
Tomasz Mon <desowin@gmail.com>
parents:
2950
diff
changeset
|
687 } |
2313 | 688 widget_list_change_pixmap(playlistwin_wlist, playlistwin_bg); |
689 playlistwin_draw_frame(); | |
690 widget_list_draw(playlistwin_wlist, &redraw, TRUE); | |
691 widget_list_clear_redraw(playlistwin_wlist); | |
692 | |
693 widget_list_unlock(playlistwin_wlist); | |
694 | |
695 gdk_window_set_back_pixmap(playlistwin->window, playlistwin_bg, 0); | |
696 gdk_window_clear(playlistwin->window); | |
697 } | |
698 | |
699 static void | |
700 playlistwin_motion(GtkWidget * widget, | |
701 GdkEventMotion * event, | |
702 gpointer callback_data) | |
703 { | |
704 GdkEvent *gevent; | |
705 | |
2491
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
706 /* |
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
707 * GDK2's resize is broken and doesn't really play nice, so we have |
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
708 * to do all of this stuff by hand. |
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
709 */ |
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
710 if (playlistwin_resizing == TRUE) |
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
711 { |
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
712 if (event->x + playlistwin_resize_x != playlistwin_get_width() || |
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
713 event->y + playlistwin_resize_y != playlistwin_get_height()) |
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
714 { |
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
715 playlistwin_resize(event->x + playlistwin_resize_x, |
2507
e07c141dd326
[svn] - made new functions: widget_move_relative and widget_resize_relative
mf0102
parents:
2499
diff
changeset
|
716 event->y + playlistwin_resize_y); |
2491
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
717 } |
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
718 gdk_window_resize(playlistwin->window, |
2507
e07c141dd326
[svn] - made new functions: widget_move_relative and widget_resize_relative
mf0102
parents:
2499
diff
changeset
|
719 cfg.playlist_width, cfg.playlist_height); |
2491
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
720 } |
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
721 else if (dock_is_moving(GTK_WINDOW(playlistwin))) |
2313 | 722 dock_move_motion(GTK_WINDOW(playlistwin), event); |
2491
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
723 else |
2aeea41ef023
[svn] - using ConfigureNotify for resizing is wrong per ICCCM guideline,
nenolod
parents:
2461
diff
changeset
|
724 { |
2313 | 725 handle_motion_cb(playlistwin_wlist, widget, event); |
726 draw_playlist_window(FALSE); | |
727 } | |
728 gdk_flush(); | |
729 | |
2601 | 730 while ((gevent = gdk_event_get()) != NULL) gdk_event_free(gevent); |
2313 | 731 } |
732 | |
733 static void | |
734 playlistwin_enter(GtkWidget * widget, | |
735 GdkEventMotion * event, | |
736 gpointer callback_data) | |
737 { | |
738 playlistwin_list->pl_tooltips = TRUE; | |
739 } | |
740 | |
741 static void | |
742 playlistwin_leave(GtkWidget * widget, | |
743 GdkEventMotion * event, | |
744 gpointer callback_data) | |
745 { | |
746 playlistwin_list->pl_tooltips = FALSE; | |
747 } | |
748 | |
749 static void | |
750 playlistwin_show_filebrowser(void) | |
751 { | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
752 run_filebrowser(NO_PLAY_BUTTON); |
2313 | 753 } |
754 | |
755 static void | |
756 playlistwin_fileinfo(void) | |
757 { | |
758 Playlist *playlist = playlist_get_active(); | |
759 | |
760 /* Show the first selected file, or the current file if nothing is | |
761 * selected */ | |
762 GList *list = playlist_get_selected(playlist); | |
763 if (list) { | |
764 playlist_fileinfo(playlist, GPOINTER_TO_INT(list->data)); | |
765 g_list_free(list); | |
766 } | |
767 else | |
768 playlist_fileinfo_current(playlist); | |
769 } | |
770 | |
771 static void | |
2363 | 772 show_playlist_save_error(GtkWindow *parent, |
773 const gchar *filename) | |
2313 | 774 { |
775 GtkWidget *dialog; | |
776 | |
777 g_return_if_fail(GTK_IS_WINDOW(parent)); | |
2363 | 778 g_return_if_fail(filename); |
2313 | 779 |
780 dialog = gtk_message_dialog_new(GTK_WINDOW(parent), | |
781 GTK_DIALOG_DESTROY_WITH_PARENT, | |
782 GTK_MESSAGE_ERROR, | |
783 GTK_BUTTONS_OK, | |
784 _("Error writing playlist \"%s\": %s"), | |
785 filename, strerror(errno)); | |
786 | |
2640 | 787 gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER); /* centering */ |
2313 | 788 gtk_dialog_run(GTK_DIALOG(dialog)); |
789 gtk_widget_destroy(dialog); | |
790 } | |
791 | |
792 static gboolean | |
793 show_playlist_overwrite_prompt(GtkWindow * parent, | |
794 const gchar * filename) | |
795 { | |
796 GtkWidget *dialog; | |
797 gint result; | |
798 | |
799 g_return_val_if_fail(GTK_IS_WINDOW(parent), FALSE); | |
800 g_return_val_if_fail(filename != NULL, FALSE); | |
801 | |
802 dialog = gtk_message_dialog_new(GTK_WINDOW(parent), | |
803 GTK_DIALOG_DESTROY_WITH_PARENT, | |
804 GTK_MESSAGE_QUESTION, | |
805 GTK_BUTTONS_YES_NO, | |
806 _("%s already exist. Continue?"), | |
807 filename); | |
808 | |
2635 | 809 gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER); /* centering */ |
2313 | 810 result = gtk_dialog_run(GTK_DIALOG(dialog)); |
811 gtk_widget_destroy(dialog); | |
812 | |
813 return (result == GTK_RESPONSE_YES); | |
814 } | |
815 | |
816 static void | |
817 show_playlist_save_format_error(GtkWindow * parent, | |
818 const gchar * filename) | |
819 { | |
820 const gchar *markup = | |
821 N_("<b><big>Unable to save playlist.</big></b>\n\n" | |
822 "Unknown file type for '%s'.\n"); | |
823 | |
824 GtkWidget *dialog; | |
825 | |
826 g_return_if_fail(GTK_IS_WINDOW(parent)); | |
827 g_return_if_fail(filename != NULL); | |
828 | |
829 dialog = | |
830 gtk_message_dialog_new_with_markup(GTK_WINDOW(parent), | |
831 GTK_DIALOG_DESTROY_WITH_PARENT, | |
832 GTK_MESSAGE_ERROR, | |
833 GTK_BUTTONS_OK, | |
834 _(markup), | |
835 filename); | |
2640 | 836 |
837 gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER); /* centering */ | |
2313 | 838 gtk_dialog_run(GTK_DIALOG(dialog)); |
839 gtk_widget_destroy(dialog); | |
840 } | |
841 | |
842 static void | |
843 playlistwin_save_playlist(const gchar * filename) | |
844 { | |
845 PlaylistContainer *plc; | |
846 gchar *ext = strrchr(filename, '.') + 1; | |
847 | |
848 plc = playlist_container_find(ext); | |
849 if (plc == NULL) { | |
850 show_playlist_save_format_error(GTK_WINDOW(playlistwin), filename); | |
851 return; | |
852 } | |
853 | |
854 str_replace_in(&cfg.playlist_path, g_path_get_dirname(filename)); | |
855 | |
856 if (g_file_test(filename, G_FILE_TEST_IS_REGULAR)) | |
857 if (!show_playlist_overwrite_prompt(GTK_WINDOW(playlistwin), filename)) | |
858 return; | |
859 | |
860 if (!playlist_save(playlist_get_active(), filename)) | |
861 show_playlist_save_error(GTK_WINDOW(playlistwin), filename); | |
862 } | |
863 | |
864 static void | |
865 playlistwin_load_playlist(const gchar * filename) | |
866 { | |
867 Playlist *playlist = playlist_get_active(); | |
868 | |
869 g_return_if_fail(filename != NULL); | |
870 | |
2640 | 871 str_replace_in(&cfg.playlist_path, g_path_get_dirname(filename)); |
2313 | 872 |
873 playlist_clear(playlist); | |
874 mainwin_clear_song_info(); | |
875 mainwin_set_info_text(); | |
876 | |
877 playlist_load(playlist, filename); | |
878 playlist_set_current_name(playlist, filename); | |
879 } | |
880 | |
881 static gchar * | |
882 playlist_file_selection_load(const gchar * title, | |
883 const gchar * default_filename) | |
884 { | |
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2508
diff
changeset
|
885 GtkWidget *dialog; |
2313 | 886 gchar *filename; |
887 | |
888 g_return_val_if_fail(title != NULL, NULL); | |
889 | |
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2508
diff
changeset
|
890 dialog = make_filebrowser(title, FALSE); |
2640 | 891 gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), cfg.playlist_path); |
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2508
diff
changeset
|
892 gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog), default_filename); |
2640 | 893 gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER); /* centering */ |
2313 | 894 |
895 if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) | |
896 filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); | |
897 else | |
898 filename = NULL; | |
899 | |
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2508
diff
changeset
|
900 gtk_widget_destroy(dialog); |
2313 | 901 return filename; |
902 } | |
903 | |
2636 | 904 static void |
905 on_static_toggle(GtkToggleButton *button, gpointer data) | |
906 { | |
907 Playlist *playlist = playlist_get_active(); | |
908 | |
909 playlist->attribute = | |
2640 | 910 gtk_toggle_button_get_active(button) ? |
911 playlist->attribute | PLAYLIST_STATIC : | |
912 playlist->attribute & ~PLAYLIST_STATIC; | |
2636 | 913 } |
914 | |
2641 | 915 static void |
916 on_relative_toggle(GtkToggleButton *button, gpointer data) | |
917 { | |
918 Playlist *playlist = playlist_get_active(); | |
919 | |
920 playlist->attribute = | |
921 gtk_toggle_button_get_active(button) ? | |
922 playlist->attribute | PLAYLIST_USE_RELATIVE : | |
923 playlist->attribute & ~PLAYLIST_USE_RELATIVE; | |
924 } | |
925 | |
2313 | 926 static gchar * |
927 playlist_file_selection_save(const gchar * title, | |
928 const gchar * default_filename) | |
929 { | |
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2508
diff
changeset
|
930 GtkWidget *dialog; |
2313 | 931 gchar *filename; |
2641 | 932 GtkWidget *hbox; |
933 GtkWidget *toggle, *toggle2; | |
2313 | 934 |
935 g_return_val_if_fail(title != NULL, NULL); | |
936 | |
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2508
diff
changeset
|
937 dialog = make_filebrowser(title, TRUE); |
2640 | 938 gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), cfg.playlist_path); |
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2508
diff
changeset
|
939 gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog), default_filename); |
2636 | 940 |
2641 | 941 hbox = gtk_hbox_new(FALSE, 5); |
942 | |
2636 | 943 /* static playlist */ |
2640 | 944 toggle = gtk_check_button_new_with_label("Save as Static Playlist"); |
2636 | 945 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), |
946 (playlist_get_active()->attribute & PLAYLIST_STATIC) ? TRUE : FALSE); | |
947 g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(on_static_toggle), dialog); | |
2641 | 948 gtk_box_pack_start(GTK_BOX(hbox), toggle, FALSE, FALSE, 0); |
949 | |
950 /* use relative path */ | |
951 toggle2 = gtk_check_button_new_with_label("Use Relative Path"); | |
952 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle2), | |
953 (playlist_get_active()->attribute & PLAYLIST_USE_RELATIVE) ? TRUE : FALSE); | |
954 g_signal_connect(G_OBJECT(toggle2), "toggled", G_CALLBACK(on_relative_toggle), dialog); | |
955 gtk_box_pack_start(GTK_BOX(hbox), toggle2, FALSE, FALSE, 0); | |
956 | |
957 gtk_widget_show_all(hbox); | |
958 gtk_file_chooser_set_extra_widget(GTK_FILE_CHOOSER(dialog), hbox); | |
2508
ecdfed7b1861
[svn] - more playlist cleanups (generalized code for playlist loading/saving
mf0102
parents:
2507
diff
changeset
|
959 |
2313 | 960 if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) |
961 filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); | |
962 else | |
963 filename = NULL; | |
964 | |
2514
7934ac463591
[svn] - removed unused function bmp_menu_translate()
mf0102
parents:
2508
diff
changeset
|
965 gtk_widget_destroy(dialog); |
2313 | 966 return filename; |
967 } | |
968 | |
969 void | |
970 playlistwin_select_playlist_to_load(const gchar * default_filename) | |
971 { | |
972 gchar *filename = | |
973 playlist_file_selection_load(_("Load Playlist"), default_filename); | |
974 | |
975 if (filename) { | |
976 playlistwin_load_playlist(filename); | |
977 g_free(filename); | |
978 } | |
979 } | |
980 | |
981 static void | |
982 playlistwin_select_playlist_to_save(const gchar * default_filename) | |
983 { | |
984 gchar *dot = NULL, *basename = NULL; | |
985 gchar *filename = | |
986 playlist_file_selection_save(_("Save Playlist"), default_filename); | |
987 | |
988 if (filename) { | |
989 /* Default to xspf if no filename has extension */ | |
990 basename = g_path_get_basename(filename); | |
991 dot = strrchr(basename, '.'); | |
992 if( dot == NULL || dot == basename) { | |
993 gchar *oldname = filename; | |
994 filename = g_strconcat(oldname, ".xspf", NULL); | |
995 g_free(oldname); | |
996 } | |
997 g_free(basename); | |
998 | |
999 playlistwin_save_playlist(filename); | |
1000 g_free(filename); | |
1001 } | |
1002 } | |
1003 | |
1004 #define REGION_L(x1,x2,y1,y2) \ | |
1005 (event->x >= (x1) && event->x < (x2) && \ | |
1006 event->y >= cfg.playlist_height - (y1) && \ | |
1007 event->y < cfg.playlist_height - (y2)) | |
1008 | |
1009 #define REGION_R(x1,x2,y1,y2) \ | |
1010 (event->x >= playlistwin_get_width() - (x1) && \ | |
1011 event->x < playlistwin_get_width() - (x2) && \ | |
1012 event->y >= cfg.playlist_height - (y1) && \ | |
1013 event->y < cfg.playlist_height - (y2)) | |
1014 | |
1015 static void | |
1016 playlistwin_scrolled(GtkWidget * widget, | |
1017 GdkEventScroll * event, | |
1018 gpointer callback_data) | |
1019 { | |
1020 | |
1021 if (event->direction == GDK_SCROLL_DOWN) | |
1022 playlistwin_scroll(cfg.scroll_pl_by); | |
1023 | |
1024 if (event->direction == GDK_SCROLL_UP) | |
1025 playlistwin_scroll(-cfg.scroll_pl_by); | |
1026 | |
1027 g_cond_signal(cond_scan); | |
1028 | |
1029 } | |
1030 | |
1031 static gboolean | |
1032 playlistwin_press(GtkWidget * widget, | |
1033 GdkEventButton * event, | |
1034 gpointer callback_data) | |
1035 { | |
1036 gboolean grab = TRUE; | |
1037 gint xpos, ypos; | |
1038 GtkRequisition req; | |
2653 | 1039 Playlist *playlist = playlist_get_active(); |
1040 gint idx = 0; | |
2313 | 1041 |
1042 gtk_window_get_position(GTK_WINDOW(playlistwin), &xpos, &ypos); | |
1043 | |
1044 if (event->button == 1 && !cfg.show_wm_decorations && | |
1045 ((!cfg.playlist_shaded && | |
1046 event->x > playlistwin_get_width() - 20 && | |
1047 event->y > cfg.playlist_height - 20) || | |
1048 (cfg.playlist_shaded && | |
1049 event->x >= playlistwin_get_width() - 31 && | |
1050 event->x < playlistwin_get_width() - 22))) { | |
1051 | |
1052 if (event->type != GDK_2BUTTON_PRESS && | |
1053 event->type != GDK_3BUTTON_PRESS) { | |
1054 playlistwin_resizing = TRUE; | |
2492
ea80fe9c3ba4
[svn] - use ConfigureNotify to set playlist location, a proper use of ICCCM.
nenolod
parents:
2491
diff
changeset
|
1055 playlistwin_resize_x = cfg.playlist_width - event->x; |
ea80fe9c3ba4
[svn] - use ConfigureNotify to set playlist location, a proper use of ICCCM.
nenolod
parents:
2491
diff
changeset
|
1056 playlistwin_resize_y = cfg.playlist_height - event->y; |
2313 | 1057 } |
1058 } | |
1059 else if (event->button == 1 && REGION_L(12, 37, 29, 11)) { | |
1060 /* ADD button menu */ | |
1061 gtk_widget_size_request(playlistwin_pladd_menu, &req); | |
1062 ui_manager_popup_menu_show(GTK_MENU(playlistwin_pladd_menu), | |
1063 xpos + 12, | |
1064 (ypos + playlistwin_get_height()) - 8 - req.height, | |
1065 event->button, | |
1066 event->time); | |
1067 grab = FALSE; | |
1068 } | |
1069 else if (event->button == 1 && REGION_L(41, 66, 29, 11)) { | |
1070 /* SUB button menu */ | |
1071 gtk_widget_size_request(playlistwin_pldel_menu, &req); | |
1072 ui_manager_popup_menu_show(GTK_MENU(playlistwin_pldel_menu), | |
1073 xpos + 40, | |
1074 (ypos + playlistwin_get_height()) - 8 - req.height, | |
1075 event->button, | |
1076 event->time); | |
1077 grab = FALSE; | |
1078 } | |
1079 else if (event->button == 1 && REGION_L(70, 95, 29, 11)) { | |
1080 /* SEL button menu */ | |
1081 gtk_widget_size_request(playlistwin_plsel_menu, &req); | |
1082 ui_manager_popup_menu_show(GTK_MENU(playlistwin_plsel_menu), | |
1083 xpos + 68, | |
1084 (ypos + playlistwin_get_height()) - 8 - req.height, | |
1085 event->button, | |
1086 event->time); | |
1087 grab = FALSE; | |
1088 } | |
1089 else if (event->button == 1 && REGION_L(99, 124, 29, 11)) { | |
1090 /* MISC button menu */ | |
1091 gtk_widget_size_request(playlistwin_plsort_menu, &req); | |
1092 ui_manager_popup_menu_show(GTK_MENU(playlistwin_plsort_menu), | |
1093 xpos + 100, | |
1094 (ypos + playlistwin_get_height()) - 8 - req.height, | |
1095 event->button, | |
1096 event->time); | |
1097 grab = FALSE; | |
1098 } | |
1099 else if (event->button == 1 && REGION_R(46, 23, 29, 11)) { | |
1100 /* LIST button menu */ | |
1101 gtk_widget_size_request(playlistwin_pllist_menu, &req); | |
1102 ui_manager_popup_menu_show(GTK_MENU(playlistwin_pllist_menu), | |
1103 xpos + playlistwin_get_width() - req.width - 12, | |
1104 (ypos + playlistwin_get_height()) - 8 - req.height, | |
1105 event->button, | |
1106 event->time); | |
1107 grab = FALSE; | |
1108 } | |
1109 else if (event->button == 1 && REGION_R(82, 54, 15, 9)) { | |
1110 if (cfg.timer_mode == TIMER_ELAPSED) | |
1111 cfg.timer_mode = TIMER_REMAINING; | |
1112 else | |
1113 cfg.timer_mode = TIMER_ELAPSED; | |
1114 } | |
1115 else if (event->button == 2 && (event->type == GDK_BUTTON_PRESS) && | |
1116 widget_contains(WIDGET(playlistwin_list), event->x, event->y)) { | |
1117 gtk_selection_convert(widget, GDK_SELECTION_PRIMARY, | |
1118 GDK_TARGET_STRING, event->time); | |
1119 } | |
1120 else if (event->button == 1 && event->type == GDK_BUTTON_PRESS && | |
2528
60f2787cc7fd
[svn] - playlist editor: use SkinnedWindow widgetlist
nenolod
parents:
2527
diff
changeset
|
1121 !ui_skinned_window_widgetlist_contained(playlistwin, event->x, |
2807
26755684c0dc
[svn] - Fixed naming inconsistencies in search dialog
mf0102
parents:
2653
diff
changeset
|
1122 event->y) && |
26755684c0dc
[svn] - Fixed naming inconsistencies in search dialog
mf0102
parents:
2653
diff
changeset
|
1123 (cfg.easy_move || event->y < 14)) |
2313 | 1124 { |
1125 dock_move_press(dock_window_list, GTK_WINDOW(playlistwin), event, | |
1126 FALSE); | |
1127 gtk_window_present(GTK_WINDOW(playlistwin)); | |
1128 } | |
1129 else if (event->button == 1 && event->type == GDK_2BUTTON_PRESS && | |
2528
60f2787cc7fd
[svn] - playlist editor: use SkinnedWindow widgetlist
nenolod
parents:
2527
diff
changeset
|
1130 !ui_skinned_window_widgetlist_contained(playlistwin, event->x, event->y) |
2313 | 1131 && event->y < 14) { |
1132 /* double click on title bar */ | |
1133 playlistwin_shade_toggle(); | |
1134 if (dock_is_moving(GTK_WINDOW(playlistwin))) | |
1135 dock_move_release(GTK_WINDOW(playlistwin)); | |
1136 return TRUE; | |
1137 } | |
1138 else if (event->button == 3 && | |
1139 !(widget_contains(WIDGET(playlistwin_list), event->x, event->y) || | |
1140 (event->y >= cfg.playlist_height - 29 && | |
1141 event->y < cfg.playlist_height - 11 && | |
1142 ((event->x >= 12 && event->x < 37) || | |
1143 (event->x >= 41 && event->x < 66) || | |
1144 (event->x >= 70 && event->x < 95) || | |
1145 (event->x >= 99 && event->x < 124) || | |
1146 (event->x >= playlistwin_get_width() - 46 && | |
1147 event->x < playlistwin_get_width() - 23))))) { | |
1148 /* | |
1149 * Pop up the main menu a few pixels down to avoid | |
1150 * anything to be selected initially. | |
1151 */ | |
1152 ui_manager_popup_menu_show(GTK_MENU(mainwin_general_menu), event->x_root, | |
1153 event->y_root + 2, 3, event->time); | |
1154 grab = FALSE; | |
1155 } | |
1156 else if (event->button == 3 && | |
1157 widget_contains(WIDGET(playlistwin_list), event->x, event->y)) { | |
2356
4b2c7d9523e7
[svn] right-clicking on playlist entry automatically selects the entry if it was unselected before, closes #728
mf0102
parents:
2351
diff
changeset
|
1158 handle_press_cb(playlistwin_wlist, widget, event); |
2313 | 1159 ui_manager_popup_menu_show(GTK_MENU(playlistwin_popup_menu), |
1160 event->x_root, event->y_root + 5, | |
1161 event->button, event->time); | |
1162 grab = FALSE; | |
1163 } | |
2650
f41ca301852a
[svn] - patch by Vincent Ratier to add Alt+Click enqueue to the playlist editor. Closes #860.
nenolod
parents:
2641
diff
changeset
|
1164 else if (event->button == 1 && (event->state & GDK_MOD1_MASK)) |
f41ca301852a
[svn] - patch by Vincent Ratier to add Alt+Click enqueue to the playlist editor. Closes #860.
nenolod
parents:
2641
diff
changeset
|
1165 { |
2653 | 1166 GList *node; |
2650
f41ca301852a
[svn] - patch by Vincent Ratier to add Alt+Click enqueue to the playlist editor. Closes #860.
nenolod
parents:
2641
diff
changeset
|
1167 |
f41ca301852a
[svn] - patch by Vincent Ratier to add Alt+Click enqueue to the playlist editor. Closes #860.
nenolod
parents:
2641
diff
changeset
|
1168 handle_press_cb(playlistwin_wlist, widget, event); |
f41ca301852a
[svn] - patch by Vincent Ratier to add Alt+Click enqueue to the playlist editor. Closes #860.
nenolod
parents:
2641
diff
changeset
|
1169 draw_playlist_window(FALSE); |
f41ca301852a
[svn] - patch by Vincent Ratier to add Alt+Click enqueue to the playlist editor. Closes #860.
nenolod
parents:
2641
diff
changeset
|
1170 |
2653 | 1171 node = playlist_get_selected(playlist); |
2652
2d0c90f38824
[svn] - fix alt+click enqueue. this is more like vincent ratier's original patch except that it's C90-capable for freebsd 4.
nenolod
parents:
2650
diff
changeset
|
1172 |
2653 | 1173 if (node != NULL) |
1174 { | |
1175 idx = GPOINTER_TO_INT(playlist_get_selected(playlist)->data); | |
1176 playlist_queue_position(playlist, idx); | |
1177 } | |
1178 | |
1179 grab = FALSE; | |
2650
f41ca301852a
[svn] - patch by Vincent Ratier to add Alt+Click enqueue to the playlist editor. Closes #860.
nenolod
parents:
2641
diff
changeset
|
1180 } |
2313 | 1181 else { |
1182 handle_press_cb(playlistwin_wlist, widget, event); | |
1183 draw_playlist_window(FALSE); | |
1184 } | |
1185 | |
1186 if (grab) | |
1187 gdk_pointer_grab(playlistwin->window, FALSE, | |
1188 GDK_BUTTON_MOTION_MASK | GDK_BUTTON_RELEASE_MASK | | |
1189 GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | | |
1190 GDK_BUTTON1_MOTION_MASK, NULL, NULL, | |
1191 GDK_CURRENT_TIME); | |
1192 | |
1193 return FALSE; | |
1194 } | |
1195 | |
1196 static gboolean | |
1197 playlistwin_focus_in(GtkWidget * widget, GdkEvent * event, gpointer data) | |
1198 { | |
1199 draw_playlist_window(TRUE); | |
1200 return FALSE; | |
1201 } | |
1202 | |
1203 static gboolean | |
1204 playlistwin_focus_out(GtkWidget * widget, | |
1205 GdkEventButton * event, gpointer data) | |
1206 { | |
1207 draw_playlist_window(TRUE); | |
1208 return FALSE; | |
1209 } | |
1210 | |
1211 void | |
1212 playlistwin_set_back_pixmap(void) | |
1213 { | |
1214 gdk_window_set_back_pixmap(playlistwin->window, playlistwin_bg, 0); | |
1215 gdk_window_clear(playlistwin->window); | |
1216 } | |
1217 | |
1218 static gboolean | |
1219 playlistwin_delete(GtkWidget * w, gpointer data) | |
1220 { | |
1221 playlistwin_hide(); | |
1222 return TRUE; | |
1223 } | |
1224 | |
1225 static void | |
1226 playlistwin_keypress_up_down_handler(PlayList_List * pl, | |
1227 gboolean up, guint state) | |
1228 { | |
1229 Playlist *playlist = playlist_get_active(); | |
1230 | |
1231 if ((state & GDK_MOD1_MASK) && (state & GDK_SHIFT_MASK)) | |
1232 return; | |
1233 if (!(state & GDK_MOD1_MASK)) | |
1234 playlist_select_all(playlist, FALSE); | |
1235 | |
1236 if (pl->pl_prev_selected == -1 || | |
1237 (!playlistwin_item_visible(pl->pl_prev_selected) && | |
1238 !(state & GDK_SHIFT_MASK && pl->pl_prev_min != -1))) { | |
1239 pl->pl_prev_selected = pl->pl_first; | |
1240 } | |
1241 else if (state & GDK_SHIFT_MASK) { | |
1242 if (pl->pl_prev_min == -1) { | |
1243 pl->pl_prev_max = pl->pl_prev_selected; | |
1244 pl->pl_prev_min = pl->pl_prev_selected; | |
1245 } | |
1246 pl->pl_prev_max += (up ? -1 : 1); | |
1247 pl->pl_prev_max = | |
1248 CLAMP(pl->pl_prev_max, 0, playlist_get_length(playlist) - 1); | |
1249 | |
1250 pl->pl_first = MIN(pl->pl_first, pl->pl_prev_max); | |
1251 pl->pl_first = MAX(pl->pl_first, pl->pl_prev_max - | |
1252 pl->pl_num_visible + 1); | |
1253 playlist_select_range(playlist, pl->pl_prev_min, pl->pl_prev_max, TRUE); | |
1254 return; | |
1255 } | |
1256 else if (state & GDK_MOD1_MASK) { | |
1257 if (up) | |
1258 playlist_list_move_up(pl); | |
1259 else | |
1260 playlist_list_move_down(pl); | |
1261 if (pl->pl_prev_min < pl->pl_first) | |
1262 pl->pl_first = pl->pl_prev_min; | |
1263 else if (pl->pl_prev_max >= (pl->pl_first + pl->pl_num_visible)) | |
1264 pl->pl_first = pl->pl_prev_max - pl->pl_num_visible + 1; | |
1265 return; | |
1266 } | |
1267 else if (up) | |
1268 pl->pl_prev_selected--; | |
1269 else | |
1270 pl->pl_prev_selected++; | |
1271 | |
1272 pl->pl_prev_selected = | |
1273 CLAMP(pl->pl_prev_selected, 0, playlist_get_length(playlist) - 1); | |
1274 | |
1275 if (pl->pl_prev_selected < pl->pl_first) | |
1276 pl->pl_first--; | |
1277 else if (pl->pl_prev_selected >= (pl->pl_first + pl->pl_num_visible)) | |
1278 pl->pl_first++; | |
1279 | |
1280 playlist_select_range(playlist, pl->pl_prev_selected, pl->pl_prev_selected, TRUE); | |
1281 pl->pl_prev_min = -1; | |
1282 } | |
1283 | |
1284 /* FIXME: Handle the keys through menu */ | |
1285 | |
1286 static gboolean | |
1287 playlistwin_keypress(GtkWidget * w, GdkEventKey * event, gpointer data) | |
1288 { | |
1289 Playlist *playlist = playlist_get_active(); | |
1290 | |
1291 guint keyval; | |
1292 gboolean refresh = FALSE; | |
1293 | |
1294 if (cfg.playlist_shaded) | |
1295 return FALSE; | |
1296 | |
1297 switch (keyval = event->keyval) { | |
1298 case GDK_KP_Up: | |
1299 case GDK_KP_Down: | |
1300 case GDK_Up: | |
1301 case GDK_Down: | |
1302 playlistwin_keypress_up_down_handler(playlistwin_list, | |
1303 keyval == GDK_Up | |
1304 || keyval == GDK_KP_Up, | |
1305 event->state); | |
1306 refresh = TRUE; | |
1307 break; | |
1308 case GDK_Page_Up: | |
1309 playlistwin_scroll(-playlistwin_list->pl_num_visible); | |
1310 refresh = TRUE; | |
1311 break; | |
1312 case GDK_Page_Down: | |
1313 playlistwin_scroll(playlistwin_list->pl_num_visible); | |
1314 refresh = TRUE; | |
1315 break; | |
1316 case GDK_Home: | |
1317 playlistwin_list->pl_first = 0; | |
1318 refresh = TRUE; | |
1319 break; | |
1320 case GDK_End: | |
1321 playlistwin_list->pl_first = | |
1322 playlist_get_length(playlist) - playlistwin_list->pl_num_visible; | |
1323 refresh = TRUE; | |
1324 break; | |
1325 case GDK_Return: | |
1326 if (playlistwin_list->pl_prev_selected > -1 | |
1327 && playlistwin_item_visible(playlistwin_list->pl_prev_selected)) { | |
1328 playlist_set_position(playlist, playlistwin_list->pl_prev_selected); | |
1329 if (!playback_get_playing()) | |
1330 playback_initiate(); | |
1331 } | |
1332 break; | |
1333 case GDK_3: | |
1334 if (event->state & GDK_CONTROL_MASK) | |
1335 playlistwin_fileinfo(); | |
1336 break; | |
1337 case GDK_Delete: | |
1338 if (event->state & GDK_CONTROL_MASK) | |
1339 playlist_delete(playlist, TRUE); | |
1340 else | |
1341 playlist_delete(playlist, FALSE); | |
1342 break; | |
1343 case GDK_Insert: | |
1344 if (event->state & GDK_MOD1_MASK) | |
1345 mainwin_show_add_url_window(); | |
1346 else | |
1347 playlistwin_show_filebrowser(); | |
1348 break; | |
1349 case GDK_Left: | |
1350 case GDK_KP_Left: | |
1351 case GDK_KP_7: | |
1352 if (playlist_get_current_length(playlist) != -1) | |
1353 playback_seek(CLAMP | |
1354 (playback_get_time() - 5000, 0, | |
1355 playlist_get_current_length(playlist)) / 1000); | |
1356 break; | |
1357 case GDK_Right: | |
1358 case GDK_KP_Right: | |
1359 case GDK_KP_9: | |
1360 if (playlist_get_current_length(playlist) != -1) | |
1361 playback_seek(CLAMP | |
1362 (playback_get_time() + 5000, 0, | |
1363 playlist_get_current_length(playlist)) / 1000); | |
1364 break; | |
1365 case GDK_KP_4: | |
1366 playlist_prev(playlist); | |
1367 break; | |
1368 case GDK_KP_6: | |
1369 playlist_next(playlist); | |
1370 break; | |
1371 | |
1372 case GDK_Escape: | |
1373 mainwin_minimize_cb(); | |
1374 break; | |
1375 default: | |
1376 return FALSE; | |
1377 } | |
1378 | |
1379 if (refresh) { | |
1380 g_cond_signal(cond_scan); | |
1381 playlistwin_update_list(playlist_get_active()); | |
1382 } | |
1383 | |
1384 return TRUE; | |
1385 } | |
1386 | |
1387 static void | |
1388 playlistwin_draw_frame(void) | |
1389 { | |
1390 gboolean focus = | |
1391 gtk_window_has_toplevel_focus(GTK_WINDOW(playlistwin)) || | |
1392 !cfg.dim_titlebar; | |
1393 | |
1394 if (cfg.playlist_shaded) { | |
1395 skin_draw_playlistwin_shaded(bmp_active_skin, | |
2527
05c841971f9f
[svn] - playlist editor: use SkinnedWindow provided GC.
nenolod
parents:
2515
diff
changeset
|
1396 playlistwin_bg, SKINNED_WINDOW(playlistwin)->gc, |
2313 | 1397 playlistwin_get_width(), focus); |
1398 } | |
1399 else { | |
1400 skin_draw_playlistwin_frame(bmp_active_skin, | |
2527
05c841971f9f
[svn] - playlist editor: use SkinnedWindow provided GC.
nenolod
parents:
2515
diff
changeset
|
1401 playlistwin_bg, SKINNED_WINDOW(playlistwin)->gc, |
2313 | 1402 playlistwin_get_width(), |
1403 cfg.playlist_height, focus); | |
1404 } | |
1405 } | |
1406 | |
1407 void | |
1408 draw_playlist_window(gboolean force) | |
1409 { | |
1410 gboolean redraw; | |
1411 GList *wl; | |
1412 Widget *w; | |
1413 | |
1414 if (force) | |
1415 playlistwin_draw_frame(); | |
1416 | |
1417 widget_list_lock(playlistwin_wlist); | |
1418 widget_list_draw(playlistwin_wlist, &redraw, force); | |
1419 | |
1420 if (redraw || force) { | |
1421 if (force) { | |
1422 gdk_window_clear(playlistwin->window); | |
2903
ef8ad0a5cbdd
redraw custom widgets when needed
Tomasz Mon <desowin@gmail.com>
parents:
2902
diff
changeset
|
1423 GList *iter; |
3000
bbca1e0e054a
don't call gtk_widget_show/hide from func that's called every now and then
Tomasz Mon <desowin@gmail.com>
parents:
2999
diff
changeset
|
1424 for (iter = GTK_FIXED (SKINNED_WINDOW(playlistwin)->fixed)->children; iter; iter = g_list_next (iter)) { |
2903
ef8ad0a5cbdd
redraw custom widgets when needed
Tomasz Mon <desowin@gmail.com>
parents:
2902
diff
changeset
|
1425 GtkFixedChild *child_data = (GtkFixedChild *) iter->data; |
ef8ad0a5cbdd
redraw custom widgets when needed
Tomasz Mon <desowin@gmail.com>
parents:
2902
diff
changeset
|
1426 GtkWidget *child = child_data->widget; |
2999
e6340ab753a1
replace calling redraw signals with gtk_widget_queue_draw()
Tomasz Mon <desowin@gmail.com>
parents:
2980
diff
changeset
|
1427 gtk_widget_queue_draw(child); |
2903
ef8ad0a5cbdd
redraw custom widgets when needed
Tomasz Mon <desowin@gmail.com>
parents:
2902
diff
changeset
|
1428 } |
2313 | 1429 } |
1430 else { | |
1431 for (wl = playlistwin_wlist; wl; wl = g_list_next(wl)) { | |
1432 w = WIDGET(wl->data); | |
1433 if (w->redraw && w->visible) { | |
1434 gdk_window_clear_area(playlistwin->window, w->x, w->y, | |
1435 w->width, w->height); | |
1436 w->redraw = FALSE; | |
1437 } | |
1438 } | |
1439 } | |
1440 | |
1441 gdk_flush(); | |
1442 } | |
1443 | |
1444 widget_list_unlock(playlistwin_wlist); | |
1445 } | |
1446 | |
1447 | |
1448 void | |
1449 playlistwin_hide_timer(void) | |
1450 { | |
2943
a8f2c99727eb
replace Textbox in playlistwin with UiSkinnedTextbox, textbox.c no longer needed, temporary comment out g_usleep in textbox_scroll as it needs to be run as new thread
Tomasz Mon <desowin@gmail.com>
parents:
2904
diff
changeset
|
1451 ui_skinned_textbox_set_text(playlistwin_time_min, " "); |
a8f2c99727eb
replace Textbox in playlistwin with UiSkinnedTextbox, textbox.c no longer needed, temporary comment out g_usleep in textbox_scroll as it needs to be run as new thread
Tomasz Mon <desowin@gmail.com>
parents:
2904
diff
changeset
|
1452 ui_skinned_textbox_set_text(playlistwin_time_sec, " "); |
2313 | 1453 } |
1454 | |
1455 void | |
1456 playlistwin_set_time(gint time, gint length, TimerMode mode) | |
1457 { | |
1458 gchar *text, sign; | |
1459 | |
1460 if (mode == TIMER_REMAINING && length != -1) { | |
1461 time = length - time; | |
1462 sign = '-'; | |
1463 } | |
1464 else | |
1465 sign = ' '; | |
1466 | |
1467 time /= 1000; | |
1468 | |
1469 if (time < 0) | |
1470 time = 0; | |
1471 if (time > 99 * 60) | |
1472 time /= 60; | |
1473 | |
1474 text = g_strdup_printf("%c%-2.2d", sign, time / 60); | |
2943
a8f2c99727eb
replace Textbox in playlistwin with UiSkinnedTextbox, textbox.c no longer needed, temporary comment out g_usleep in textbox_scroll as it needs to be run as new thread
Tomasz Mon <desowin@gmail.com>
parents:
2904
diff
changeset
|
1475 ui_skinned_textbox_set_text(playlistwin_time_min, text); |
2313 | 1476 g_free(text); |
1477 | |
1478 text = g_strdup_printf("%-2.2d", time % 60); | |
2943
a8f2c99727eb
replace Textbox in playlistwin with UiSkinnedTextbox, textbox.c no longer needed, temporary comment out g_usleep in textbox_scroll as it needs to be run as new thread
Tomasz Mon <desowin@gmail.com>
parents:
2904
diff
changeset
|
1479 ui_skinned_textbox_set_text(playlistwin_time_sec, text); |
2313 | 1480 g_free(text); |
1481 } | |
1482 | |
1483 static void | |
1484 playlistwin_drag_motion(GtkWidget * widget, | |
1485 GdkDragContext * context, | |
1486 gint x, gint y, | |
1487 GtkSelectionData * selection_data, | |
1488 guint info, guint time, gpointer user_data) | |
1489 { | |
1490 playlistwin_list->pl_drag_motion = TRUE; | |
1491 playlistwin_list->drag_motion_x = x; | |
1492 playlistwin_list->drag_motion_y = y; | |
1493 playlistwin_update_list(playlist_get_active()); | |
1494 playlistwin_hint_flag = TRUE; | |
1495 } | |
1496 | |
1497 static void | |
1498 playlistwin_drag_end(GtkWidget * widget, | |
1499 GdkDragContext * context, gpointer user_data) | |
1500 { | |
1501 playlistwin_list->pl_drag_motion = FALSE; | |
1502 playlistwin_hint_flag = FALSE; | |
1503 playlistwin_update_list(playlist_get_active()); | |
1504 } | |
1505 | |
1506 static void | |
1507 playlistwin_drag_data_received(GtkWidget * widget, | |
1508 GdkDragContext * context, | |
1509 gint x, gint y, | |
1510 GtkSelectionData * | |
1511 selection_data, guint info, | |
1512 guint time, gpointer user_data) | |
1513 { | |
1514 gint pos; | |
1515 Playlist *playlist = playlist_get_active(); | |
1516 | |
2363 | 1517 g_return_if_fail(selection_data); |
2313 | 1518 |
1519 if (!selection_data->data) { | |
1520 g_message("Received no DND data!"); | |
1521 return; | |
1522 } | |
1523 | |
1524 if (widget_contains(WIDGET(playlistwin_list), x, y)) { | |
1525 pos = (y - WIDGET(playlistwin_list)->y) / | |
1526 playlistwin_list->pl_fheight + playlistwin_list->pl_first; | |
1527 | |
1528 pos = MIN(pos, playlist_get_length(playlist)); | |
1529 playlist_ins_url(playlist, (gchar *) selection_data->data, pos); | |
1530 } | |
1531 else | |
1532 playlist_add_url(playlist, (gchar *) selection_data->data); | |
1533 } | |
1534 | |
1535 static void | |
1536 local_playlist_prev(void) | |
1537 { | |
1538 playlist_prev(playlist_get_active()); | |
1539 } | |
1540 | |
1541 static void | |
1542 local_playlist_next(void) | |
1543 { | |
1544 playlist_next(playlist_get_active()); | |
1545 } | |
1546 | |
1547 static void | |
1548 playlistwin_create_widgets(void) | |
1549 { | |
1550 /* This function creates the custom widgets used by the playlist editor */ | |
1551 | |
1552 /* text box for displaying song title in shaded mode */ | |
3005
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
1553 playlistwin_sinfo = ui_skinned_textbox_new(SKINNED_WINDOW(playlistwin)->fixed, |
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
1554 4, 4, playlistwin_get_width() - 35, TRUE, SKIN_TEXT); |
2313 | 1555 |
1556 playlistwin_set_sinfo_font(cfg.playlist_font); | |
1557 | |
2901
5ed0674fabd6
replace PButton in playlistwin with UiSkinnedButton, pbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
1558 playlistwin_shade = ui_skinned_button_new(); |
2313 | 1559 /* shade/unshade window push button */ |
1560 if (cfg.playlist_shaded) | |
3005
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
1561 ui_skinned_push_button_setup(playlistwin_shade, SKINNED_WINDOW(playlistwin)->fixed, |
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
1562 playlistwin_get_width() - 21, 3, |
2901
5ed0674fabd6
replace PButton in playlistwin with UiSkinnedButton, pbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
1563 9, 9, 128, 45, 150, 42, SKIN_PLEDIT); |
2313 | 1564 else |
3005
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
1565 ui_skinned_push_button_setup(playlistwin_shade, SKINNED_WINDOW(playlistwin)->fixed, |
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
1566 playlistwin_get_width() - 21, 3, |
2901
5ed0674fabd6
replace PButton in playlistwin with UiSkinnedButton, pbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
1567 9, 9, 157, 3, 62, 42, SKIN_PLEDIT); |
2313 | 1568 |
2901
5ed0674fabd6
replace PButton in playlistwin with UiSkinnedButton, pbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
1569 g_signal_connect(playlistwin_shade, "clicked", playlistwin_shade_toggle, NULL ); |
2313 | 1570 |
1571 /* close window push button */ | |
2901
5ed0674fabd6
replace PButton in playlistwin with UiSkinnedButton, pbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
1572 playlistwin_close = ui_skinned_button_new(); |
3005
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
1573 ui_skinned_push_button_setup(playlistwin_close, SKINNED_WINDOW(playlistwin)->fixed, |
2901
5ed0674fabd6
replace PButton in playlistwin with UiSkinnedButton, pbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
1574 playlistwin_get_width() - 11, 3, 9, 9, |
5ed0674fabd6
replace PButton in playlistwin with UiSkinnedButton, pbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
1575 cfg.playlist_shaded ? 138 : 167, |
5ed0674fabd6
replace PButton in playlistwin with UiSkinnedButton, pbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
1576 cfg.playlist_shaded ? 45 : 3, 52, 42, SKIN_PLEDIT); |
5ed0674fabd6
replace PButton in playlistwin with UiSkinnedButton, pbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
1577 |
5ed0674fabd6
replace PButton in playlistwin with UiSkinnedButton, pbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
1578 g_signal_connect(playlistwin_close, "clicked", playlistwin_hide, NULL ); |
5ed0674fabd6
replace PButton in playlistwin with UiSkinnedButton, pbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
1579 |
2313 | 1580 /* playlist list box */ |
1581 playlistwin_list = | |
1582 create_playlist_list(&playlistwin_wlist, playlistwin_bg, | |
2527
05c841971f9f
[svn] - playlist editor: use SkinnedWindow provided GC.
nenolod
parents:
2515
diff
changeset
|
1583 SKINNED_WINDOW(playlistwin)->gc, 12, 20, |
2313 | 1584 playlistwin_get_width() - 31, |
1585 cfg.playlist_height - 58); | |
1586 playlist_list_set_font(cfg.playlist_font); | |
2528
60f2787cc7fd
[svn] - playlist editor: use SkinnedWindow widgetlist
nenolod
parents:
2527
diff
changeset
|
1587 ui_skinned_window_widgetlist_associate(playlistwin, WIDGET(playlistwin_list)); |
2313 | 1588 |
1589 /* playlist list box slider */ | |
1590 playlistwin_slider = | |
1591 create_playlistslider(&playlistwin_wlist, playlistwin_bg, | |
2527
05c841971f9f
[svn] - playlist editor: use SkinnedWindow provided GC.
nenolod
parents:
2515
diff
changeset
|
1592 SKINNED_WINDOW(playlistwin)->gc, playlistwin_get_width() - 15, |
2313 | 1593 20, cfg.playlist_height - 58, playlistwin_list); |
2528
60f2787cc7fd
[svn] - playlist editor: use SkinnedWindow widgetlist
nenolod
parents:
2527
diff
changeset
|
1594 ui_skinned_window_widgetlist_associate(playlistwin, WIDGET(playlistwin_slider)); |
60f2787cc7fd
[svn] - playlist editor: use SkinnedWindow widgetlist
nenolod
parents:
2527
diff
changeset
|
1595 |
2313 | 1596 /* track time (minute) */ |
3005
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
1597 playlistwin_time_min = ui_skinned_textbox_new(SKINNED_WINDOW(playlistwin)->fixed, |
2313 | 1598 playlistwin_get_width() - 82, |
1599 cfg.playlist_height - 15, 15, FALSE, SKIN_TEXT); | |
1600 | |
1601 /* track time (second) */ | |
3005
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
1602 playlistwin_time_sec = ui_skinned_textbox_new(SKINNED_WINDOW(playlistwin)->fixed, |
2313 | 1603 playlistwin_get_width() - 64, |
1604 cfg.playlist_height - 15, 10, FALSE, SKIN_TEXT); | |
1605 | |
1606 /* playlist information (current track length / total track length) */ | |
3005
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
1607 playlistwin_info = ui_skinned_textbox_new(SKINNED_WINDOW(playlistwin)->fixed, |
2313 | 1608 playlistwin_get_width() - 143, |
1609 cfg.playlist_height - 28, 90, FALSE, SKIN_TEXT); | |
1610 | |
1611 /* mini play control buttons at right bottom corner */ | |
1612 | |
1613 /* rewind button */ | |
2902
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
1614 playlistwin_srew = ui_skinned_button_new(); |
3005
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
1615 ui_skinned_small_button_setup(playlistwin_srew, SKINNED_WINDOW(playlistwin)->fixed, |
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
1616 playlistwin_get_width() - 144, |
2902
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
1617 cfg.playlist_height - 16, 8, 7); |
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
1618 g_signal_connect(playlistwin_srew, "clicked", local_playlist_prev, NULL); |
2313 | 1619 |
1620 /* play button */ | |
2902
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
1621 playlistwin_splay = ui_skinned_button_new(); |
3005
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
1622 ui_skinned_small_button_setup(playlistwin_splay, SKINNED_WINDOW(playlistwin)->fixed, |
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
1623 playlistwin_get_width() - 138, |
2902
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
1624 cfg.playlist_height - 16, 10, 7); |
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
1625 g_signal_connect(playlistwin_splay, "clicked", mainwin_play_pushed, NULL); |
2313 | 1626 |
1627 /* pause button */ | |
2902
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
1628 playlistwin_spause = ui_skinned_button_new(); |
3005
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
1629 ui_skinned_small_button_setup(playlistwin_spause, SKINNED_WINDOW(playlistwin)->fixed, |
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
1630 playlistwin_get_width() - 128, |
2902
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
1631 cfg.playlist_height - 16, 10, 7); |
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
1632 g_signal_connect(playlistwin_spause, "clicked", playback_pause, NULL); |
2313 | 1633 |
1634 /* stop button */ | |
2902
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
1635 playlistwin_sstop = ui_skinned_button_new(); |
3005
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
1636 ui_skinned_small_button_setup(playlistwin_sstop, SKINNED_WINDOW(playlistwin)->fixed, |
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
1637 playlistwin_get_width() - 118, |
2902
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
1638 cfg.playlist_height - 16, 9, 7); |
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
1639 g_signal_connect(playlistwin_sstop, "clicked", mainwin_stop_pushed, NULL); |
2313 | 1640 |
1641 /* forward button */ | |
2902
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
1642 playlistwin_sfwd = ui_skinned_button_new(); |
3005
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
1643 ui_skinned_small_button_setup(playlistwin_sfwd, SKINNED_WINDOW(playlistwin)->fixed, |
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
1644 playlistwin_get_width() - 109, |
2902
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
1645 cfg.playlist_height - 16, 8, 7); |
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
1646 g_signal_connect(playlistwin_sfwd, "clicked", local_playlist_next, NULL); |
2313 | 1647 |
1648 /* eject button */ | |
2902
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
1649 playlistwin_seject = ui_skinned_button_new(); |
3005
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
1650 ui_skinned_small_button_setup(playlistwin_seject, SKINNED_WINDOW(playlistwin)->fixed, |
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
1651 playlistwin_get_width() - 100, |
2902
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
1652 cfg.playlist_height - 16, 9, 7); |
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
1653 g_signal_connect(playlistwin_seject, "clicked", mainwin_eject_pushed, NULL); |
2313 | 1654 |
2902
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
1655 playlistwin_sscroll_up = ui_skinned_button_new(); |
3005
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
1656 ui_skinned_small_button_setup(playlistwin_sscroll_up, SKINNED_WINDOW(playlistwin)->fixed, |
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
1657 playlistwin_get_width() - 14, |
2902
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
1658 cfg.playlist_height - 35, 8, 5); |
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
1659 g_signal_connect(playlistwin_sscroll_up, "clicked", playlistwin_scroll_up_pushed, NULL); |
2528
60f2787cc7fd
[svn] - playlist editor: use SkinnedWindow widgetlist
nenolod
parents:
2527
diff
changeset
|
1660 |
2902
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
1661 playlistwin_sscroll_down = ui_skinned_button_new(); |
3005
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
1662 ui_skinned_small_button_setup(playlistwin_sscroll_down, SKINNED_WINDOW(playlistwin)->fixed, |
3db40ad79fd9
request GdkGC when needed rather than carry one around
Tomasz Mon <desowin@gmail.com>
parents:
3000
diff
changeset
|
1663 playlistwin_get_width() - 14, |
2902
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
1664 cfg.playlist_height - 30, 8, 5); |
2b379b796c84
replace SButton in playlistwin with UiSkinnedButton, sbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2901
diff
changeset
|
1665 g_signal_connect(playlistwin_sscroll_down, "clicked", playlistwin_scroll_down_pushed, NULL); |
2313 | 1666 } |
1667 | |
1668 static void | |
1669 selection_received(GtkWidget * widget, | |
1670 GtkSelectionData * selection_data, gpointer data) | |
1671 { | |
1672 if (selection_data->type == GDK_SELECTION_TYPE_STRING && | |
1673 selection_data->length > 0) | |
1674 playlist_add_url(playlist_get_active(), (gchar *) selection_data->data); | |
1675 } | |
1676 | |
1677 static void | |
1678 playlistwin_create_window(void) | |
1679 { | |
1680 GdkPixbuf *icon; | |
1681 | |
2515
319b10203d7c
[svn] gtk_window_set_wmclass() has to be called before gtk_widget_realize(). Patched by Christian "Joker" Birchinger from Gentoo.
chainsaw
parents:
2514
diff
changeset
|
1682 playlistwin = ui_skinned_window_new(GTK_WINDOW_TOPLEVEL, "playlist"); |
2313 | 1683 gtk_window_set_title(GTK_WINDOW(playlistwin), _("Audacious Playlist Editor")); |
1684 gtk_window_set_role(GTK_WINDOW(playlistwin), "playlist"); | |
1685 gtk_window_set_default_size(GTK_WINDOW(playlistwin), | |
1686 playlistwin_get_width(), | |
1687 playlistwin_get_height()); | |
1688 gtk_window_set_resizable(GTK_WINDOW(playlistwin), TRUE); | |
1689 playlistwin_set_geometry_hints(cfg.playlist_shaded); | |
1690 | |
1691 gtk_window_set_transient_for(GTK_WINDOW(playlistwin), | |
1692 GTK_WINDOW(mainwin)); | |
1693 gtk_window_set_skip_taskbar_hint(GTK_WINDOW(playlistwin), TRUE); | |
1694 | |
1695 icon = gdk_pixbuf_new_from_xpm_data((const gchar **) bmp_playlist_icon); | |
1696 gtk_window_set_icon(GTK_WINDOW(playlistwin), icon); | |
1697 g_object_unref(icon); | |
1698 | |
1699 gtk_widget_set_app_paintable(playlistwin, TRUE); | |
1700 | |
1701 if (cfg.playlist_x != -1 && cfg.save_window_position) | |
1702 gtk_window_move(GTK_WINDOW(playlistwin), | |
1703 cfg.playlist_x, cfg.playlist_y); | |
1704 | |
1705 gtk_widget_add_events(playlistwin, GDK_POINTER_MOTION_MASK | | |
1706 GDK_FOCUS_CHANGE_MASK | GDK_BUTTON_MOTION_MASK | | |
1707 GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | | |
1708 GDK_SCROLL_MASK | GDK_VISIBILITY_NOTIFY_MASK); | |
1709 gtk_widget_realize(playlistwin); | |
1710 | |
1711 g_signal_connect(playlistwin, "delete_event", | |
1712 G_CALLBACK(playlistwin_delete), NULL); | |
1713 g_signal_connect(playlistwin, "button_press_event", | |
1714 G_CALLBACK(playlistwin_press), NULL); | |
1715 g_signal_connect(playlistwin, "button_release_event", | |
1716 G_CALLBACK(playlistwin_release), NULL); | |
1717 g_signal_connect(playlistwin, "scroll_event", | |
1718 G_CALLBACK(playlistwin_scrolled), NULL); | |
1719 g_signal_connect(playlistwin, "motion_notify_event", | |
1720 G_CALLBACK(playlistwin_motion), NULL); | |
1721 g_signal_connect(playlistwin, "enter_notify_event", | |
1722 G_CALLBACK(playlistwin_enter), NULL); | |
1723 g_signal_connect(playlistwin, "leave_notify_event", | |
1724 G_CALLBACK(playlistwin_leave), NULL); | |
1725 g_signal_connect_after(playlistwin, "focus_in_event", | |
1726 G_CALLBACK(playlistwin_focus_in), NULL); | |
1727 g_signal_connect_after(playlistwin, "focus_out_event", | |
1728 G_CALLBACK(playlistwin_focus_out), NULL); | |
1729 g_signal_connect(playlistwin, "style_set", | |
1730 G_CALLBACK(playlistwin_set_back_pixmap), NULL); | |
1731 | |
1732 bmp_drag_dest_set(playlistwin); | |
1733 | |
1734 /* DnD stuff */ | |
1735 g_signal_connect(playlistwin, "drag-leave", | |
1736 G_CALLBACK(playlistwin_drag_end), NULL); | |
1737 g_signal_connect(playlistwin, "drag-data-delete", | |
1738 G_CALLBACK(playlistwin_drag_end), NULL); | |
1739 g_signal_connect(playlistwin, "drag-end", | |
1740 G_CALLBACK(playlistwin_drag_end), NULL); | |
1741 g_signal_connect(playlistwin, "drag-drop", | |
1742 G_CALLBACK(playlistwin_drag_end), NULL); | |
1743 g_signal_connect(playlistwin, "drag-data-received", | |
1744 G_CALLBACK(playlistwin_drag_data_received), NULL); | |
1745 g_signal_connect(playlistwin, "drag-motion", | |
1746 G_CALLBACK(playlistwin_drag_motion), NULL); | |
1747 | |
1748 g_signal_connect(playlistwin, "key_press_event", | |
1749 G_CALLBACK(playlistwin_keypress), NULL); | |
1750 g_signal_connect(playlistwin, "selection_received", | |
1751 G_CALLBACK(selection_received), NULL); | |
1752 | |
1753 playlistwin_set_mask(); | |
1754 } | |
1755 | |
1756 void | |
1757 playlistwin_create(void) | |
1758 { | |
1759 playlistwin_create_window(); | |
1760 | |
1761 /* create GC and back pixmap for custom widget to draw on */ | |
1762 playlistwin_bg = gdk_pixmap_new(playlistwin->window, | |
1763 playlistwin_get_width(), | |
1764 playlistwin_get_height_unshaded(), -1); | |
1765 gdk_window_set_back_pixmap(playlistwin->window, playlistwin_bg, 0); | |
1766 | |
1767 playlistwin_create_widgets(); | |
1768 playlistwin_update_info(playlist_get_active()); | |
1769 | |
2348
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
2338
diff
changeset
|
1770 playlistwin_infopopup = audacious_fileinfopopup_create(); |
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
2338
diff
changeset
|
1771 |
2313 | 1772 gtk_window_add_accel_group(GTK_WINDOW(playlistwin), ui_manager_get_accel_group()); |
1773 } | |
1774 | |
1775 | |
1776 void | |
1777 playlistwin_show(void) | |
1778 { | |
1779 GtkAction *action = gtk_action_group_get_action( | |
1780 toggleaction_group_others , "show playlist editor" ); | |
1781 gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(action) , TRUE ); | |
1782 | |
1783 cfg.playlist_visible = TRUE; | |
2901
5ed0674fabd6
replace PButton in playlistwin with UiSkinnedButton, pbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
1784 UI_SKINNED_BUTTON(mainwin_pl)->inside = TRUE; |
2999
e6340ab753a1
replace calling redraw signals with gtk_widget_queue_draw()
Tomasz Mon <desowin@gmail.com>
parents:
2980
diff
changeset
|
1785 gtk_widget_queue_draw(mainwin_pl); |
2313 | 1786 |
1787 playlistwin_set_toprow(0); | |
1788 playlist_check_pos_current(playlist_get_active()); | |
1789 | |
2351
911743d27aba
[svn] - simplify and optimize the metadata tooltip trigger function
giacomo
parents:
2348
diff
changeset
|
1790 if ( playlistwin_infopopup_sid == 0 ) |
911743d27aba
[svn] - simplify and optimize the metadata tooltip trigger function
giacomo
parents:
2348
diff
changeset
|
1791 playlistwin_infopopup_sid = g_timeout_add( |
911743d27aba
[svn] - simplify and optimize the metadata tooltip trigger function
giacomo
parents:
2348
diff
changeset
|
1792 50 , (GSourceFunc)playlistwin_fileinfopopup_probe , playlistwin_infopopup ); |
2348
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
2338
diff
changeset
|
1793 |
2901
5ed0674fabd6
replace PButton in playlistwin with UiSkinnedButton, pbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
1794 gtk_widget_show_all(playlistwin); |
2943
a8f2c99727eb
replace Textbox in playlistwin with UiSkinnedTextbox, textbox.c no longer needed, temporary comment out g_usleep in textbox_scroll as it needs to be run as new thread
Tomasz Mon <desowin@gmail.com>
parents:
2904
diff
changeset
|
1795 if (!cfg.playlist_shaded) |
a8f2c99727eb
replace Textbox in playlistwin with UiSkinnedTextbox, textbox.c no longer needed, temporary comment out g_usleep in textbox_scroll as it needs to be run as new thread
Tomasz Mon <desowin@gmail.com>
parents:
2904
diff
changeset
|
1796 gtk_widget_hide(playlistwin_sinfo); |
a8f2c99727eb
replace Textbox in playlistwin with UiSkinnedTextbox, textbox.c no longer needed, temporary comment out g_usleep in textbox_scroll as it needs to be run as new thread
Tomasz Mon <desowin@gmail.com>
parents:
2904
diff
changeset
|
1797 ui_skinned_textbox_set_text(playlistwin_info, " "); |
2901
5ed0674fabd6
replace PButton in playlistwin with UiSkinnedButton, pbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
1798 gtk_window_present(GTK_WINDOW(playlistwin)); |
2313 | 1799 } |
1800 | |
1801 void | |
1802 playlistwin_hide(void) | |
1803 { | |
1804 GtkAction *action = gtk_action_group_get_action( | |
1805 toggleaction_group_others , "show playlist editor" ); | |
1806 gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(action) , FALSE ); | |
1807 | |
1808 gtk_widget_hide(playlistwin); | |
1809 cfg.playlist_visible = FALSE; | |
2901
5ed0674fabd6
replace PButton in playlistwin with UiSkinnedButton, pbutton.c is no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2843
diff
changeset
|
1810 UI_SKINNED_BUTTON(mainwin_pl)->inside = FALSE; |
2999
e6340ab753a1
replace calling redraw signals with gtk_widget_queue_draw()
Tomasz Mon <desowin@gmail.com>
parents:
2980
diff
changeset
|
1811 gtk_widget_queue_draw(mainwin_pl); |
2313 | 1812 |
2348
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
2338
diff
changeset
|
1813 /* no point in probing for playlistwin_infopopup trigger when the playlistwin is hidden */ |
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
2338
diff
changeset
|
1814 if ( playlistwin_infopopup_sid != 0 ) |
2351
911743d27aba
[svn] - simplify and optimize the metadata tooltip trigger function
giacomo
parents:
2348
diff
changeset
|
1815 { |
2348
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
2338
diff
changeset
|
1816 g_source_remove( playlistwin_infopopup_sid ); |
2351
911743d27aba
[svn] - simplify and optimize the metadata tooltip trigger function
giacomo
parents:
2348
diff
changeset
|
1817 playlistwin_infopopup_sid = 0; |
911743d27aba
[svn] - simplify and optimize the metadata tooltip trigger function
giacomo
parents:
2348
diff
changeset
|
1818 } |
2348
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
2338
diff
changeset
|
1819 |
2338
d0a04f1ee732
[svn] - in playlistwin_hide(), pass focus to the player main window only if it's visible
giacomo
parents:
2328
diff
changeset
|
1820 if ( cfg.player_visible ) |
d0a04f1ee732
[svn] - in playlistwin_hide(), pass focus to the player main window only if it's visible
giacomo
parents:
2328
diff
changeset
|
1821 { |
d0a04f1ee732
[svn] - in playlistwin_hide(), pass focus to the player main window only if it's visible
giacomo
parents:
2328
diff
changeset
|
1822 gtk_window_present(GTK_WINDOW(mainwin)); |
d0a04f1ee732
[svn] - in playlistwin_hide(), pass focus to the player main window only if it's visible
giacomo
parents:
2328
diff
changeset
|
1823 gtk_widget_grab_focus(mainwin); |
d0a04f1ee732
[svn] - in playlistwin_hide(), pass focus to the player main window only if it's visible
giacomo
parents:
2328
diff
changeset
|
1824 } |
2313 | 1825 } |
1826 | |
1827 void action_playlist_track_info(void) | |
1828 { | |
1829 playlistwin_fileinfo(); | |
1830 } | |
1831 | |
1832 void action_queue_toggle(void) | |
1833 { | |
1834 playlist_queue(playlist_get_active()); | |
1835 } | |
1836 | |
1837 void action_playlist_sort_by_playlist_entry(void) | |
1838 { | |
1839 Playlist *playlist = playlist_get_active(); | |
1840 | |
1841 playlist_sort(playlist, PLAYLIST_SORT_PLAYLIST); | |
1842 playlistwin_update_list(playlist); | |
1843 } | |
1844 | |
1845 void action_playlist_sort_by_track_number(void) | |
1846 { | |
1847 Playlist *playlist = playlist_get_active(); | |
1848 | |
1849 playlist_sort(playlist, PLAYLIST_SORT_TRACK); | |
1850 playlistwin_update_list(playlist); | |
1851 } | |
1852 | |
1853 void action_playlist_sort_by_title(void) | |
1854 { | |
1855 Playlist *playlist = playlist_get_active(); | |
1856 | |
1857 playlist_sort(playlist, PLAYLIST_SORT_TITLE); | |
1858 playlistwin_update_list(playlist); | |
1859 } | |
1860 | |
1861 void action_playlist_sort_by_artist(void) | |
1862 { | |
1863 Playlist *playlist = playlist_get_active(); | |
1864 | |
1865 playlist_sort(playlist, PLAYLIST_SORT_ARTIST); | |
1866 playlistwin_update_list(playlist); | |
1867 } | |
1868 | |
1869 void action_playlist_sort_by_full_path(void) | |
1870 { | |
1871 Playlist *playlist = playlist_get_active(); | |
1872 | |
1873 playlist_sort(playlist, PLAYLIST_SORT_PATH); | |
1874 playlistwin_update_list(playlist); | |
1875 } | |
1876 | |
1877 void action_playlist_sort_by_date(void) | |
1878 { | |
1879 Playlist *playlist = playlist_get_active(); | |
1880 | |
1881 playlist_sort(playlist, PLAYLIST_SORT_DATE); | |
1882 playlistwin_update_list(playlist); | |
1883 } | |
1884 | |
1885 void action_playlist_sort_by_filename(void) | |
1886 { | |
1887 Playlist *playlist = playlist_get_active(); | |
1888 | |
1889 playlist_sort(playlist, PLAYLIST_SORT_FILENAME); | |
1890 playlistwin_update_list(playlist); | |
1891 } | |
1892 | |
1893 void action_playlist_sort_selected_by_playlist_entry(void) | |
1894 { | |
1895 Playlist *playlist = playlist_get_active(); | |
1896 | |
1897 playlist_sort_selected(playlist, PLAYLIST_SORT_PLAYLIST); | |
1898 playlistwin_update_list(playlist); | |
1899 } | |
1900 | |
1901 void action_playlist_sort_selected_by_track_number(void) | |
1902 { | |
1903 Playlist *playlist = playlist_get_active(); | |
1904 | |
1905 playlist_sort_selected(playlist, PLAYLIST_SORT_TRACK); | |
1906 playlistwin_update_list(playlist); | |
1907 } | |
1908 | |
1909 void action_playlist_sort_selected_by_title(void) | |
1910 { | |
1911 Playlist *playlist = playlist_get_active(); | |
1912 | |
1913 playlist_sort_selected(playlist, PLAYLIST_SORT_TITLE); | |
1914 playlistwin_update_list(playlist); | |
1915 } | |
1916 | |
1917 void action_playlist_sort_selected_by_artist(void) | |
1918 { | |
1919 Playlist *playlist = playlist_get_active(); | |
1920 | |
1921 playlist_sort_selected(playlist, PLAYLIST_SORT_ARTIST); | |
1922 playlistwin_update_list(playlist); | |
1923 } | |
1924 | |
1925 void action_playlist_sort_selected_by_full_path(void) | |
1926 { | |
1927 Playlist *playlist = playlist_get_active(); | |
1928 | |
1929 playlist_sort_selected(playlist, PLAYLIST_SORT_PATH); | |
1930 playlistwin_update_list(playlist); | |
1931 } | |
1932 | |
1933 void action_playlist_sort_selected_by_date(void) | |
1934 { | |
1935 Playlist *playlist = playlist_get_active(); | |
1936 | |
1937 playlist_sort_selected(playlist, PLAYLIST_SORT_DATE); | |
1938 playlistwin_update_list(playlist); | |
1939 } | |
1940 | |
1941 void action_playlist_sort_selected_by_filename(void) | |
1942 { | |
1943 Playlist *playlist = playlist_get_active(); | |
1944 | |
1945 playlist_sort_selected(playlist, PLAYLIST_SORT_FILENAME); | |
1946 playlistwin_update_list(playlist); | |
1947 } | |
1948 | |
1949 void action_playlist_randomize_list(void) | |
1950 { | |
1951 Playlist *playlist = playlist_get_active(); | |
1952 | |
1953 playlist_random(playlist); | |
1954 playlistwin_update_list(playlist); | |
1955 } | |
1956 | |
1957 void action_playlist_reverse_list(void) | |
1958 { | |
1959 Playlist *playlist = playlist_get_active(); | |
1960 | |
1961 playlist_reverse(playlist); | |
1962 playlistwin_update_list(playlist); | |
1963 } | |
1964 | |
1965 void | |
1966 action_playlist_clear_queue(void) | |
1967 { | |
1968 playlist_clear_queue(playlist_get_active()); | |
1969 } | |
1970 | |
1971 void | |
1972 action_playlist_remove_unavailable(void) | |
1973 { | |
1974 playlist_remove_dead_files(playlist_get_active()); | |
1975 } | |
1976 | |
1977 void | |
1978 action_playlist_remove_dupes_by_title(void) | |
1979 { | |
1980 playlist_remove_duplicates(playlist_get_active(), PLAYLIST_DUPS_TITLE); | |
1981 } | |
1982 | |
1983 void | |
1984 action_playlist_remove_dupes_by_filename(void) | |
1985 { | |
1986 playlist_remove_duplicates(playlist_get_active(), PLAYLIST_DUPS_FILENAME); | |
1987 } | |
1988 | |
1989 void | |
1990 action_playlist_remove_dupes_by_full_path(void) | |
1991 { | |
1992 playlist_remove_duplicates(playlist_get_active(), PLAYLIST_DUPS_PATH); | |
1993 } | |
1994 | |
1995 void | |
1996 action_playlist_remove_all(void) | |
1997 { | |
1998 playlist_clear(playlist_get_active()); | |
1999 | |
2000 /* XXX -- should this really be coupled here? -nenolod */ | |
2001 mainwin_clear_song_info(); | |
2002 mainwin_set_info_text(); | |
2003 } | |
2004 | |
2005 void | |
2006 action_playlist_remove_selected(void) | |
2007 { | |
2008 playlist_delete(playlist_get_active(), FALSE); | |
2009 } | |
2010 | |
2011 void | |
2012 action_playlist_remove_unselected(void) | |
2013 { | |
2014 playlist_delete(playlist_get_active(), TRUE); | |
2015 } | |
2016 | |
2017 void | |
2018 action_playlist_add_files(void) | |
2019 { | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
2020 run_filebrowser(NO_PLAY_BUTTON); |
2313 | 2021 } |
2022 | |
2023 void | |
2024 action_playlist_add_cd(void) | |
2025 { | |
2026 add_medium(); | |
2027 } | |
2028 | |
2029 void | |
2030 action_playlist_add_url(void) | |
2031 { | |
2032 mainwin_show_add_url_window(); | |
2033 } | |
2034 | |
2035 void | |
2036 action_playlist_new( void ) | |
2037 { | |
2038 Playlist *new_pl = playlist_new(); | |
2039 playlist_add_playlist(new_pl); | |
2040 playlist_select_playlist(new_pl); | |
2041 } | |
2042 | |
2043 void | |
2044 action_playlist_prev( void ) | |
2045 { | |
2807
26755684c0dc
[svn] - Fixed naming inconsistencies in search dialog
mf0102
parents:
2653
diff
changeset
|
2046 playlist_select_prev(); |
2313 | 2047 } |
2048 | |
2049 void | |
2050 action_playlist_next( void ) | |
2051 { | |
2807
26755684c0dc
[svn] - Fixed naming inconsistencies in search dialog
mf0102
parents:
2653
diff
changeset
|
2052 playlist_select_next(); |
2313 | 2053 } |
2054 | |
2055 void | |
2056 action_playlist_delete( void ) | |
2057 { | |
2807
26755684c0dc
[svn] - Fixed naming inconsistencies in search dialog
mf0102
parents:
2653
diff
changeset
|
2058 playlist_remove_playlist( playlist_get_active() ); |
2313 | 2059 } |
2060 | |
2061 void | |
2062 action_playlist_save_list(void) | |
2063 { | |
2064 Playlist *playlist = playlist_get_active(); | |
2065 | |
2066 playlistwin_select_playlist_to_save(playlist_get_current_name(playlist)); | |
2067 } | |
2068 | |
2069 void | |
2070 action_playlist_save_default_list(void) | |
2071 { | |
2072 Playlist *playlist = playlist_get_active(); | |
2073 | |
2074 playlist_save(playlist, bmp_paths[BMP_PATH_PLAYLIST_FILE]); | |
2075 } | |
2076 | |
2077 void | |
2078 action_playlist_load_list(void) | |
2079 { | |
2080 Playlist *playlist = playlist_get_active(); | |
2081 | |
2082 playlistwin_select_playlist_to_load(playlist_get_current_name(playlist)); | |
2083 } | |
2084 | |
2085 void | |
2086 action_playlist_refresh_list(void) | |
2087 { | |
2088 Playlist *playlist = playlist_get_active(); | |
2089 | |
2090 playlist_read_info_selection(playlist); | |
2091 playlistwin_update_list(playlist); | |
2092 } | |
2093 | |
2094 void | |
2095 action_open_list_manager(void) | |
2096 { | |
2097 playlist_manager_ui_show(); | |
2098 } | |
2099 | |
2100 void | |
2101 action_playlist_search_and_select(void) | |
2102 { | |
2103 playlistwin_select_search(); | |
2104 } | |
2105 | |
2106 void | |
2107 action_playlist_invert_selection(void) | |
2108 { | |
2109 playlistwin_inverse_selection(); | |
2110 } | |
2111 | |
2112 void | |
2113 action_playlist_select_none(void) | |
2114 { | |
2115 playlistwin_select_none(); | |
2116 } | |
2117 | |
2118 void | |
2119 action_playlist_select_all(void) | |
2120 { | |
2121 playlistwin_select_all(); | |
2122 } | |
2123 | |
2124 | |
2125 | |
2126 /* playlistwin_select_search callback functions | |
2127 placed here to avoid making the code messier :) */ | |
2128 void | |
2363 | 2129 playlistwin_select_search_cbt_cb(GtkWidget *called_cbt, gpointer other_cbt) |
2313 | 2130 { |
2363 | 2131 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(called_cbt)) == TRUE) |
2132 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(other_cbt), FALSE); | |
2313 | 2133 return; |
2134 } | |
2135 | |
2136 static gboolean | |
2363 | 2137 playlistwin_select_search_kp_cb(GtkWidget *entry, GdkEventKey *event, |
2807
26755684c0dc
[svn] - Fixed naming inconsistencies in search dialog
mf0102
parents:
2653
diff
changeset
|
2138 gpointer searchdlg_win) |
2313 | 2139 { |
2140 switch (event->keyval) | |
2141 { | |
2142 case GDK_Return: | |
2363 | 2143 gtk_dialog_response(GTK_DIALOG(searchdlg_win), GTK_RESPONSE_ACCEPT); |
2313 | 2144 return TRUE; |
2145 default: | |
2146 return FALSE; | |
2147 } | |
2148 } | |
2348
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
2338
diff
changeset
|
2149 |
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
2338
diff
changeset
|
2150 |
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
2338
diff
changeset
|
2151 /* fileinfopopup callback for playlistwin */ |
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
2338
diff
changeset
|
2152 static gboolean |
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
2338
diff
changeset
|
2153 playlistwin_fileinfopopup_probe(gpointer * filepopup_win) |
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
2338
diff
changeset
|
2154 { |
2363 | 2155 gint x, y, pos; |
2156 TitleInput *tuple; | |
2157 static gint prev_x = 0, prev_y = 0, ctr = 0, prev_pos = -1; | |
2158 static gint shaded_pos = -1, shaded_prev_pos = -1; | |
2159 gboolean skip = FALSE; | |
2160 GdkWindow *win; | |
2161 Playlist *playlist = playlist_get_active(); | |
2348
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
2338
diff
changeset
|
2162 |
2363 | 2163 win = gdk_window_at_pointer(NULL, NULL); |
2164 gdk_window_get_pointer(GDK_WINDOW(playlistwin->window), &x, &y, NULL); | |
2165 pos = playlist_list_get_playlist_position(playlistwin_list, x, y); | |
2348
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
2338
diff
changeset
|
2166 |
2363 | 2167 if (win == NULL |
2168 || cfg.show_filepopup_for_tuple == FALSE | |
2169 || playlistwin_list->pl_tooltips == FALSE | |
2170 || pos != prev_pos | |
2171 || win != GDK_WINDOW(playlistwin->window)) | |
2172 { | |
2173 prev_pos = pos; | |
2174 ctr = 0; | |
2175 audacious_fileinfopopup_hide(GTK_WIDGET(filepopup_win), NULL); | |
2176 return TRUE; | |
2177 } | |
2348
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
2338
diff
changeset
|
2178 |
2363 | 2179 if (prev_x == x && prev_y == y) |
2180 ctr++; | |
2181 else | |
2182 { | |
2183 ctr = 0; | |
2184 prev_x = x; | |
2185 prev_y = y; | |
2186 audacious_fileinfopopup_hide(GTK_WIDGET(filepopup_win), NULL); | |
2187 return TRUE; | |
2188 } | |
2348
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
2338
diff
changeset
|
2189 |
2363 | 2190 if (playlistwin_is_shaded()) |
2191 { | |
2192 shaded_pos = playlist_get_position(playlist); | |
2193 if (shaded_prev_pos != shaded_pos) | |
2194 skip = TRUE; | |
2195 } | |
2348
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
2338
diff
changeset
|
2196 |
2807
26755684c0dc
[svn] - Fixed naming inconsistencies in search dialog
mf0102
parents:
2653
diff
changeset
|
2197 if (ctr >= cfg.filepopup_delay && (skip == TRUE || GTK_WIDGET_VISIBLE(GTK_WIDGET(filepopup_win)) != TRUE)) { |
2363 | 2198 if (pos == -1 && !playlistwin_is_shaded()) |
2199 { | |
2200 audacious_fileinfopopup_hide(GTK_WIDGET(filepopup_win), NULL); | |
2201 return TRUE; | |
2202 } | |
2203 /* shaded mode */ | |
2204 else | |
2205 { | |
2206 tuple = playlist_get_tuple(playlist, shaded_pos); | |
2207 audacious_fileinfopopup_hide(GTK_WIDGET(filepopup_win), NULL); | |
2208 audacious_fileinfopopup_show_from_tuple(GTK_WIDGET(filepopup_win), tuple); | |
2209 shaded_prev_pos = shaded_pos; | |
2210 } | |
2348
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
2338
diff
changeset
|
2211 |
2363 | 2212 prev_pos = pos; |
2348
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
2338
diff
changeset
|
2213 |
2363 | 2214 tuple = playlist_get_tuple(playlist, pos); |
2215 audacious_fileinfopopup_show_from_tuple(GTK_WIDGET(filepopup_win), tuple); | |
2216 } | |
2348
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
2338
diff
changeset
|
2217 |
2363 | 2218 return TRUE; |
2348
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
2338
diff
changeset
|
2219 } |