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