Mercurial > audlegacy
annotate src/audacious/ui_main.c @ 2842:c2622a939e9e trunk
rename audacious_pbutton to ui_skinned_button
author | Tomasz Mon <desowin@gmail.com> |
---|---|
date | Sun, 17 Jun 2007 12:54:59 +0200 |
parents | 53dd8641b4d1 |
children | 91ef09fe7936 |
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 #ifdef HAVE_CONFIG_H | |
25 # include "config.h" | |
26 #endif | |
27 | |
28 | |
29 #include <glib.h> | |
30 #include <glib/gi18n.h> | |
31 #include <glib/gprintf.h> | |
32 #include <gtk/gtk.h> | |
33 #include <gtk/gtkmessagedialog.h> | |
34 | |
35 /* GDK including */ | |
36 #include "platform/smartinclude.h" | |
37 | |
38 #include <math.h> | |
39 #include <stdlib.h> | |
40 #include <string.h> | |
41 | |
42 #include <X11/Xlib.h> | |
43 | |
44 #include <sys/types.h> | |
45 | |
46 #if defined(USE_REGEX_ONIGURUMA) | |
47 #include <onigposix.h> | |
48 #elif defined(USE_REGEX_PCRE) | |
49 #include <pcreposix.h> | |
50 #else | |
51 #include <regex.h> | |
52 #endif | |
53 | |
54 #include "widgets/widgetcore.h" | |
55 #include "ui_main.h" | |
56 #include "icons-stock.h" | |
57 | |
58 #include "actions-mainwin.h" | |
59 | |
60 #include "main.h" | |
2717 | 61 #include "configdb.h" |
2313 | 62 #include "dnd.h" |
63 #include "dock.h" | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
64 #include "genevent.h" |
2313 | 65 #include "hints.h" |
66 #include "input.h" | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
67 #include "urldecode.h" |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
68 #include "playback.h" |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
69 #include "playlist.h" |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
70 #include "pluginenum.h" |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
71 #include "ui_credits.h" |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
72 #include "ui_equalizer.h" |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
73 #include "ui_fileopener.h" |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
74 #include "ui_manager.h" |
2313 | 75 #include "ui_playlist.h" |
76 #include "ui_preferences.h" | |
77 #include "ui_skinselector.h" | |
2422 | 78 #include "ui_urlopener.h" |
2373
ad1d7687814c
[svn] made strings.h for existing strings.c, cleanups
mf0102
parents:
2354
diff
changeset
|
79 #include "strings.h" |
2313 | 80 #include "util.h" |
81 #include "visualization.h" | |
82 | |
2494
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
2485
diff
changeset
|
83 #include "ui_skinned_window.h" |
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2840
diff
changeset
|
84 #include "ui_skinned_button.h" |
2500 | 85 #include "ui_jumptotrack.h" |
2494
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
2485
diff
changeset
|
86 |
2313 | 87 static GTimeVal cb_time; /* click delay for tristate is defined by TRISTATE_THRESHOLD */ |
88 | |
89 #define ITEM_SEPARATOR {"/-", NULL, NULL, 0, "<Separator>"} | |
90 #define TRISTATE_THRESHOLD 200 | |
91 | |
92 #define VOLSET_DISP_TIMES 5 | |
93 | |
94 enum { | |
95 MAINWIN_SEEK_REV = -1, | |
96 MAINWIN_SEEK_NIL, | |
97 MAINWIN_SEEK_FWD | |
98 }; | |
99 | |
100 enum { | |
101 MAINWIN_VIS_ACTIVE_MAINWIN, MAINWIN_VIS_ACTIVE_PLAYLISTWIN | |
102 }; | |
103 | |
104 | |
105 typedef struct _PlaybackInfo PlaybackInfo; | |
106 | |
107 struct _PlaybackInfo { | |
108 gchar *title; | |
109 gint bitrate; | |
110 gint frequency; | |
111 gint n_channels; | |
112 }; | |
113 | |
2496
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
114 static GList *mainwin_wlist = NULL; |
2313 | 115 |
116 GtkWidget *mainwin = NULL; | |
117 GtkWidget *err = NULL; /* an error dialog for miscellaneous error messages */ | |
118 | |
119 static GdkBitmap *nullmask; | |
120 static gint balance; | |
121 | |
122 static GtkWidget *mainwin_jtt = NULL; | |
123 | |
124 gint seek_state = MAINWIN_SEEK_NIL; | |
125 gint seek_initial_pos = 0; | |
126 | |
127 static GdkPixmap *mainwin_bg = NULL, *mainwin_bg_x2 = NULL; | |
128 | |
2821 | 129 static GtkWidget *mainwin_menubtn; |
130 static GtkWidget *mainwin_minimize, *mainwin_shade, *mainwin_close; | |
131 | |
132 static GtkWidget *mainwin_rew, *mainwin_fwd; | |
133 static GtkWidget *mainwin_eject; | |
134 static GtkWidget *mainwin_play, *mainwin_pause, *mainwin_stop; | |
2313 | 135 |
136 TButton *mainwin_shuffle, *mainwin_repeat, *mainwin_eq, *mainwin_pl; | |
137 TextBox *mainwin_info; | |
138 TextBox *mainwin_stime_min, *mainwin_stime_sec; | |
139 | |
140 static TextBox *mainwin_rate_text, *mainwin_freq_text, | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
141 *mainwin_othertext; |
2313 | 142 |
143 PlayStatus *mainwin_playstatus; | |
144 | |
145 Number *mainwin_minus_num, *mainwin_10min_num, *mainwin_min_num; | |
146 Number *mainwin_10sec_num, *mainwin_sec_num; | |
147 | |
148 static gboolean setting_volume = FALSE; | |
149 | |
150 Vis *active_vis; | |
151 Vis *mainwin_vis; | |
152 SVis *mainwin_svis; | |
153 | |
154 HSlider *mainwin_sposition = NULL; | |
155 | |
156 static MenuRow *mainwin_menurow; | |
157 static HSlider *mainwin_volume, *mainwin_balance, *mainwin_position; | |
158 static MonoStereo *mainwin_monostereo; | |
159 static SButton *mainwin_srew, *mainwin_splay, *mainwin_spause; | |
160 static SButton *mainwin_sstop, *mainwin_sfwd, *mainwin_seject, *mainwin_about; | |
161 | |
162 static gint mainwin_timeout_id; | |
163 | |
164 G_LOCK_DEFINE_STATIC(mainwin_title); | |
165 | |
166 static gboolean mainwin_force_redraw = FALSE; | |
167 static gchar *mainwin_title_text = NULL; | |
168 static gboolean mainwin_info_text_locked = FALSE; | |
169 | |
170 static int ab_position_a = -1; | |
171 static int ab_position_b = -1; | |
172 | |
173 static PlaybackInfo playback_info = { NULL, 0, 0, 0 }; | |
174 | |
175 | |
176 static gint mainwin_idle_func(gpointer data); | |
177 | |
178 static void set_timer_mode_menu_cb(TimerMode mode); | |
179 static void set_timer_mode(TimerMode mode); | |
180 | |
181 static void mainwin_refresh_hints(void); | |
182 | |
183 void mainwin_position_motion_cb(gint pos); | |
184 void mainwin_position_release_cb(gint pos); | |
185 | |
186 void set_doublesize(gboolean doublesize); | |
187 | |
188 | |
189 | |
190 /* FIXME: placed here for now */ | |
191 void | |
192 playback_get_sample_params(gint * bitrate, | |
193 gint * frequency, | |
194 gint * n_channels) | |
195 { | |
196 if (bitrate) | |
197 *bitrate = playback_info.bitrate; | |
198 | |
199 if (frequency) | |
200 *frequency = playback_info.frequency; | |
201 | |
202 if (n_channels) | |
203 *n_channels = playback_info.n_channels; | |
204 } | |
205 | |
206 static void | |
207 playback_set_sample_params(gint bitrate, | |
208 gint frequency, | |
209 gint n_channels) | |
210 { | |
211 if (bitrate >= 0) | |
212 playback_info.bitrate = bitrate; | |
213 | |
214 if (frequency >= 0) | |
215 playback_info.frequency = frequency; | |
216 | |
217 if (n_channels >= 0) | |
218 playback_info.n_channels = n_channels; | |
219 } | |
220 | |
221 static void | |
222 mainwin_set_title_scroll(gboolean scroll) | |
223 { | |
224 cfg.autoscroll = scroll; | |
225 textbox_set_scroll(mainwin_info, cfg.autoscroll); | |
226 } | |
227 | |
228 | |
229 void | |
230 mainwin_set_always_on_top(gboolean always) | |
231 { | |
232 GtkAction *action = gtk_action_group_get_action( | |
233 toggleaction_group_others , "view always on top" ); | |
234 gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(action) , always ); | |
235 } | |
236 | |
237 static void | |
238 mainwin_set_shape_mask(void) | |
239 { | |
240 if (!cfg.player_visible) | |
241 return; | |
242 | |
243 if (cfg.doublesize == FALSE) | |
244 gtk_widget_shape_combine_mask(mainwin, | |
245 skin_get_mask(bmp_active_skin, | |
246 SKIN_MASK_MAIN), 0, 0); | |
247 else | |
248 gtk_widget_shape_combine_mask(mainwin, NULL, 0, 0); | |
249 } | |
250 | |
251 static void | |
252 mainwin_set_shade(gboolean shaded) | |
253 { | |
254 GtkAction *action = gtk_action_group_get_action( | |
255 toggleaction_group_others , "roll up player" ); | |
256 gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(action) , shaded ); | |
257 } | |
258 | |
259 static void | |
260 mainwin_set_shade_menu_cb(gboolean shaded) | |
261 { | |
262 cfg.player_shaded = shaded; | |
263 | |
264 mainwin_set_shape_mask(); | |
265 | |
266 if (shaded) { | |
267 dock_shade(dock_window_list, GTK_WINDOW(mainwin), | |
268 MAINWIN_SHADED_HEIGHT * (cfg.doublesize + 1)); | |
269 | |
270 widget_show(WIDGET(mainwin_svis)); | |
271 vis_clear_data(mainwin_vis); | |
272 | |
273 widget_show(WIDGET(mainwin_srew)); | |
274 widget_show(WIDGET(mainwin_splay)); | |
275 widget_show(WIDGET(mainwin_spause)); | |
276 widget_show(WIDGET(mainwin_sstop)); | |
277 widget_show(WIDGET(mainwin_sfwd)); | |
278 widget_show(WIDGET(mainwin_seject)); | |
279 | |
280 textbox_set_scroll(mainwin_info, FALSE); | |
281 if (playback_get_playing()) | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
282 { |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
283 widget_show(WIDGET(mainwin_sposition)); |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
284 widget_show(WIDGET(mainwin_stime_min)); |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
285 widget_show(WIDGET(mainwin_stime_sec)); |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
286 } |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
287 else |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
288 { |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
289 widget_hide(WIDGET(mainwin_sposition)); |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
290 widget_hide(WIDGET(mainwin_stime_min)); |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
291 widget_hide(WIDGET(mainwin_stime_sec)); |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
292 } |
2313 | 293 |
294 } | |
295 else { | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
296 gint height = !bmp_active_skin->properties.mainwin_height ? MAINWIN_HEIGHT : |
2313 | 297 bmp_active_skin->properties.mainwin_height; |
298 | |
299 dock_shade(dock_window_list, GTK_WINDOW(mainwin), height * (cfg.doublesize + 1)); | |
300 | |
301 widget_hide(WIDGET(mainwin_svis)); | |
302 svis_clear_data(mainwin_svis); | |
303 | |
304 widget_hide(WIDGET(mainwin_srew)); | |
305 widget_hide(WIDGET(mainwin_splay)); | |
306 widget_hide(WIDGET(mainwin_spause)); | |
307 widget_hide(WIDGET(mainwin_sstop)); | |
308 widget_hide(WIDGET(mainwin_sfwd)); | |
309 widget_hide(WIDGET(mainwin_seject)); | |
310 | |
311 widget_hide(WIDGET(mainwin_stime_min)); | |
312 widget_hide(WIDGET(mainwin_stime_sec)); | |
313 widget_hide(WIDGET(mainwin_sposition)); | |
314 | |
315 textbox_set_scroll(mainwin_info, cfg.autoscroll); | |
316 } | |
317 | |
318 draw_main_window(TRUE); | |
319 } | |
320 | |
321 static void | |
322 mainwin_vis_set_active_vis(gint new_vis) | |
323 { | |
324 active_vis = mainwin_vis; | |
325 } | |
326 | |
327 static void | |
328 mainwin_vis_set_refresh(RefreshRate rate) | |
329 { | |
330 cfg.vis_refresh = rate; | |
331 } | |
332 | |
333 static void | |
334 mainwin_vis_set_afalloff(FalloffSpeed speed) | |
335 { | |
336 cfg.analyzer_falloff = speed; | |
337 } | |
338 | |
339 static void | |
340 mainwin_vis_set_pfalloff(FalloffSpeed speed) | |
341 { | |
342 cfg.peaks_falloff = speed; | |
343 } | |
344 | |
345 static void | |
346 mainwin_vis_set_analyzer_mode(AnalyzerMode mode) | |
347 { | |
348 cfg.analyzer_mode = mode; | |
349 } | |
350 | |
351 static void | |
352 mainwin_vis_set_analyzer_type(AnalyzerType mode) | |
353 { | |
354 cfg.analyzer_type = mode; | |
355 } | |
356 | |
357 void | |
358 mainwin_vis_set_type(VisType mode) | |
359 { | |
360 GtkAction *action; | |
361 | |
362 switch ( mode ) | |
363 { | |
364 case VIS_ANALYZER: | |
365 action = gtk_action_group_get_action( | |
366 radioaction_group_vismode , "vismode analyzer" ); | |
367 break; | |
368 case VIS_SCOPE: | |
369 action = gtk_action_group_get_action( | |
370 radioaction_group_vismode , "vismode scope" ); | |
371 break; | |
372 case VIS_VOICEPRINT: | |
373 action = gtk_action_group_get_action( | |
374 radioaction_group_vismode , "vismode voiceprint" ); | |
375 break; | |
376 case VIS_OFF: | |
377 default: | |
378 action = gtk_action_group_get_action( | |
379 radioaction_group_vismode , "vismode off" ); | |
380 break; | |
381 } | |
382 | |
383 gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(action) , TRUE ); | |
384 } | |
385 | |
386 static void | |
387 mainwin_vis_set_type_menu_cb(VisType mode) | |
388 { | |
389 cfg.vis_type = mode; | |
390 | |
391 if (mode == VIS_OFF) { | |
392 if (cfg.player_shaded && cfg.player_visible) | |
393 svis_clear(mainwin_svis); | |
394 else | |
395 vis_clear(active_vis); | |
396 } | |
397 if (mode == VIS_ANALYZER || mode == VIS_SCOPE || mode == VIS_VOICEPRINT) { | |
398 vis_clear_data(active_vis); | |
399 svis_clear_data(mainwin_svis); | |
400 } | |
401 } | |
402 | |
403 static void | |
404 mainwin_menubtn_cb(void) | |
405 { | |
406 gint x, y; | |
407 gtk_window_get_position(GTK_WINDOW(mainwin), &x, &y); | |
408 ui_manager_popup_menu_show(GTK_MENU(mainwin_general_menu), | |
409 x + 6 * (1 + cfg.doublesize), | |
410 y + MAINWIN_SHADED_HEIGHT * (1 + cfg.doublesize), | |
411 1, GDK_CURRENT_TIME); | |
412 } | |
413 | |
414 void | |
415 mainwin_minimize_cb(void) | |
416 { | |
417 if (!mainwin) | |
418 return; | |
419 | |
420 gtk_window_iconify(GTK_WINDOW(mainwin)); | |
421 } | |
422 | |
423 static void | |
424 mainwin_shade_toggle(void) | |
425 { | |
426 mainwin_set_shade(!cfg.player_shaded); | |
427 } | |
428 | |
429 void | |
430 mainwin_quit_cb(void) | |
431 { | |
432 GList *playlists = NULL, *playlists_top = NULL; | |
433 | |
434 gtk_widget_hide(equalizerwin); | |
435 gtk_widget_hide(playlistwin); | |
436 gtk_widget_hide(mainwin); | |
437 gdk_flush(); | |
438 | |
439 g_source_remove(mainwin_timeout_id); | |
440 | |
441 bmp_config_save(); | |
442 gtk_accel_map_save(bmp_paths[BMP_PATH_ACCEL_FILE]); | |
443 | |
444 plugin_system_cleanup(); | |
445 | |
446 playlist_stop_get_info_thread(); | |
447 | |
448 /* free and clear each playlist */ | |
449 playlists = playlist_get_playlists(); | |
450 playlists_top = playlists; | |
451 while ( playlists != NULL ) | |
452 { | |
453 playlist_clear((Playlist*)playlists->data); | |
454 playlist_free((Playlist*)playlists->data); | |
455 playlists = g_list_next(playlists); | |
456 } | |
457 g_list_free( playlists_top ); | |
458 | |
459 gtk_main_quit(); | |
460 | |
461 exit(EXIT_SUCCESS); | |
462 } | |
463 | |
464 static void | |
465 mainwin_destroy(GtkWidget * widget, gpointer data) | |
466 { | |
467 mainwin_quit_cb(); | |
468 } | |
469 | |
470 static void | |
471 mainwin_draw_titlebar(gboolean focus) | |
472 { | |
2525 | 473 /* FIXME: uses SkinnedWindow::gc directly. -nenolod */ |
474 skin_draw_mainwin_titlebar(bmp_active_skin, mainwin_bg, | |
2693
b47f5577bea0
[svn] - Made the Space key pause/unpause playback (like e.g. mplayer)
mf0102
parents:
2651
diff
changeset
|
475 SKINNED_WINDOW(mainwin)->gc, |
2313 | 476 cfg.player_shaded, focus || !cfg.dim_titlebar); |
477 } | |
478 | |
479 void | |
480 draw_main_window(gboolean force) | |
481 { | |
482 GdkImage *img, *img2x; | |
483 GList *wl; | |
484 Widget *w; | |
485 gboolean redraw; | |
486 | |
487 if (!cfg.player_visible) | |
488 return; | |
489 | |
490 if (force) | |
491 mainwin_refresh_hints(); | |
492 | |
493 widget_list_lock(mainwin_wlist); | |
494 | |
495 if (force) { | |
496 if (!cfg.player_shaded) | |
2525 | 497 skin_draw_pixmap(bmp_active_skin, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, |
2313 | 498 SKIN_MAIN, 0, 0, 0, 0, bmp_active_skin->properties.mainwin_width, |
499 bmp_active_skin->properties.mainwin_height); | |
500 mainwin_draw_titlebar(gtk_window_has_toplevel_focus | |
501 (GTK_WINDOW(mainwin))); | |
502 } | |
503 | |
504 widget_list_draw(mainwin_wlist, &redraw, force); | |
505 | |
506 if (redraw || force) { | |
507 if (force) { | |
508 if (cfg.doublesize) { | |
509 img = gdk_drawable_get_image(mainwin_bg, 0, 0, bmp_active_skin->properties.mainwin_width, | |
510 cfg.player_shaded ? | |
511 MAINWIN_SHADED_HEIGHT : | |
512 bmp_active_skin->properties.mainwin_height); | |
513 img2x = create_dblsize_image(img); | |
2525 | 514 gdk_draw_image(mainwin_bg_x2, SKINNED_WINDOW(mainwin)->gc, img2x, 0, 0, |
2313 | 515 0, 0, bmp_active_skin->properties.mainwin_width * 2, |
516 cfg.player_shaded ? MAINWIN_SHADED_HEIGHT * | |
517 2 : bmp_active_skin->properties.mainwin_height * 2); | |
518 g_object_unref(img2x); | |
519 g_object_unref(img); | |
520 } | |
521 | |
2829
4eda78b785ed
[svn] - draw_main_window redraws custom gtk widgets
desowin
parents:
2827
diff
changeset
|
522 GList *iter; |
4eda78b785ed
[svn] - draw_main_window redraws custom gtk widgets
desowin
parents:
2827
diff
changeset
|
523 for (iter = GTK_FIXED (SKINNED_WINDOW(mainwin)->fixed)->children; iter; iter = g_list_next (iter)) { |
4eda78b785ed
[svn] - draw_main_window redraws custom gtk widgets
desowin
parents:
2827
diff
changeset
|
524 GtkFixedChild *child_data = (GtkFixedChild *) iter->data; |
4eda78b785ed
[svn] - draw_main_window redraws custom gtk widgets
desowin
parents:
2827
diff
changeset
|
525 GtkWidget *child = child_data->widget; |
4eda78b785ed
[svn] - draw_main_window redraws custom gtk widgets
desowin
parents:
2827
diff
changeset
|
526 g_signal_emit_by_name(child, "redraw"); |
4eda78b785ed
[svn] - draw_main_window redraws custom gtk widgets
desowin
parents:
2827
diff
changeset
|
527 } |
4eda78b785ed
[svn] - draw_main_window redraws custom gtk widgets
desowin
parents:
2827
diff
changeset
|
528 |
2840 | 529 } |
530 else { | |
2313 | 531 for (wl = mainwin_wlist; wl; wl = g_list_next(wl)) { |
532 w = WIDGET(wl->data); | |
533 | |
534 if (!w->redraw || !w->visible) | |
535 continue; | |
536 | |
2496
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
537 if (w->x > bmp_active_skin->properties.mainwin_width || |
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
538 w->y > bmp_active_skin->properties.mainwin_height) |
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
539 continue; |
2313 | 540 |
541 if (cfg.doublesize) { | |
542 gint width, height; | |
543 | |
544 width = w->x + w->width <= bmp_active_skin->properties.mainwin_width ? w->width : (w->width - ((w->x + w->width) - bmp_active_skin->properties.mainwin_width)); | |
545 height = w->y + w->height <= bmp_active_skin->properties.mainwin_width ? w->height : (w->height - ((w->y + w->height) - bmp_active_skin->properties.mainwin_height)); | |
546 | |
547 img = gdk_drawable_get_image(mainwin_bg, w->x, w->y, | |
548 width, height); | |
549 img2x = create_dblsize_image(img); | |
2525 | 550 gdk_draw_image(mainwin_bg_x2, SKINNED_WINDOW(mainwin)->gc, |
2313 | 551 img2x, 0, 0, w->x << 1, w->y << 1, |
552 width << 1, height << 1); | |
553 g_object_unref(img2x); | |
554 g_object_unref(img); | |
555 gdk_window_clear_area(mainwin->window, w->x << 1, | |
556 w->y << 1, width << 1, | |
557 height << 1); | |
558 } | |
559 else | |
560 gdk_window_clear_area(mainwin->window, w->x, w->y, | |
561 w->width, w->height); | |
562 w->redraw = FALSE; | |
563 } | |
564 } | |
565 | |
566 gdk_flush(); | |
567 } | |
568 | |
569 widget_list_unlock(mainwin_wlist); | |
570 } | |
571 | |
572 | |
573 void | |
574 mainwin_set_info_text(void) | |
575 { | |
576 gchar *text; | |
577 | |
578 if (mainwin_info_text_locked) | |
579 return; | |
580 | |
581 if ((text = input_get_info_text()) != NULL) { | |
582 textbox_set_text(mainwin_info, text); | |
583 g_free(text); | |
584 } | |
585 else if ((text = playlist_get_info_text(playlist_get_active())) != NULL) { | |
586 textbox_set_text(mainwin_info, text); | |
587 g_free(text); | |
588 } | |
589 } | |
590 | |
591 static gchar *mainwin_tb_old_text = NULL; | |
592 | |
593 void | |
594 mainwin_lock_info_text(const gchar * text) | |
595 { | |
596 if (mainwin_info_text_locked != TRUE) | |
597 mainwin_tb_old_text = g_strdup(bmp_active_skin->properties.mainwin_othertext_is_status ? | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
598 mainwin_othertext->tb_text : mainwin_info->tb_text); |
2313 | 599 |
600 mainwin_info_text_locked = TRUE; | |
601 textbox_set_text(bmp_active_skin->properties.mainwin_othertext_is_status ? | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
602 mainwin_othertext : mainwin_info, text); |
2313 | 603 } |
604 | |
605 void | |
606 mainwin_release_info_text(void) | |
607 { | |
608 mainwin_info_text_locked = FALSE; | |
609 | |
610 if (mainwin_tb_old_text != NULL) | |
611 { | |
612 textbox_set_text(bmp_active_skin->properties.mainwin_othertext_is_status ? | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
613 mainwin_othertext : mainwin_info, mainwin_tb_old_text); |
2313 | 614 g_free(mainwin_tb_old_text); |
615 mainwin_tb_old_text = NULL; | |
616 } | |
617 else | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
618 mainwin_set_info_text(); /* XXX: best we can do */ |
2313 | 619 } |
620 | |
621 | |
622 static gchar * | |
623 make_mainwin_title(const gchar * title) | |
624 { | |
625 if (title) | |
626 return g_strdup_printf(_("%s - Audacious"), title); | |
627 else | |
628 return g_strdup(_("Audacious")); | |
629 } | |
630 | |
631 void | |
632 mainwin_set_song_title(const gchar * title) | |
633 { | |
634 G_LOCK(mainwin_title); | |
635 g_free(mainwin_title_text); | |
636 mainwin_title_text = make_mainwin_title(title); | |
637 G_UNLOCK(mainwin_title); | |
638 } | |
639 | |
640 static void | |
641 mainwin_refresh_hints(void) | |
642 { | |
643 if (bmp_active_skin && bmp_active_skin->properties.mainwin_othertext | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
644 == TRUE) |
2313 | 645 { |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
646 widget_hide(WIDGET(mainwin_rate_text)); |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
647 widget_hide(WIDGET(mainwin_freq_text)); |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
648 widget_hide(WIDGET(mainwin_monostereo)); |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
649 |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
650 if (bmp_active_skin->properties.mainwin_othertext_visible) |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
651 widget_show(WIDGET(mainwin_othertext)); |
2313 | 652 } |
653 else | |
654 { | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
655 widget_show(WIDGET(mainwin_rate_text)); |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
656 widget_show(WIDGET(mainwin_freq_text)); |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
657 widget_show(WIDGET(mainwin_monostereo)); |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
658 widget_hide(WIDGET(mainwin_othertext)); |
2313 | 659 } |
660 | |
661 /* positioning and size attributes */ | |
662 if (bmp_active_skin->properties.mainwin_vis_x && bmp_active_skin->properties.mainwin_vis_y) | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
663 widget_move(WIDGET(mainwin_vis), bmp_active_skin->properties.mainwin_vis_x, |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
664 bmp_active_skin->properties.mainwin_vis_y); |
2313 | 665 |
666 if (bmp_active_skin->properties.mainwin_vis_width) | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
667 widget_resize(WIDGET(mainwin_vis), bmp_active_skin->properties.mainwin_vis_width, |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
668 mainwin_vis->vs_widget.height); |
2313 | 669 |
670 if (bmp_active_skin->properties.mainwin_text_x && bmp_active_skin->properties.mainwin_text_y) | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
671 widget_move(WIDGET(mainwin_info), bmp_active_skin->properties.mainwin_text_x, |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
672 bmp_active_skin->properties.mainwin_text_y); |
2313 | 673 |
674 if (bmp_active_skin->properties.mainwin_text_width) | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
675 widget_resize(WIDGET(mainwin_info), bmp_active_skin->properties.mainwin_text_width, |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
676 mainwin_info->tb_widget.height); |
2313 | 677 |
678 if (bmp_active_skin->properties.mainwin_infobar_x && bmp_active_skin->properties.mainwin_infobar_y) | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
679 widget_move(WIDGET(mainwin_othertext), bmp_active_skin->properties.mainwin_infobar_x, |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
680 bmp_active_skin->properties.mainwin_infobar_y); |
2313 | 681 |
682 if (bmp_active_skin->properties.mainwin_number_0_x && bmp_active_skin->properties.mainwin_number_0_y) | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
683 widget_move(WIDGET(mainwin_minus_num), bmp_active_skin->properties.mainwin_number_0_x, |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
684 bmp_active_skin->properties.mainwin_number_0_y); |
2313 | 685 |
686 if (bmp_active_skin->properties.mainwin_number_1_x && bmp_active_skin->properties.mainwin_number_1_y) | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
687 widget_move(WIDGET(mainwin_10min_num), bmp_active_skin->properties.mainwin_number_1_x, |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
688 bmp_active_skin->properties.mainwin_number_1_y); |
2313 | 689 |
690 if (bmp_active_skin->properties.mainwin_number_2_x && bmp_active_skin->properties.mainwin_number_2_y) | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
691 widget_move(WIDGET(mainwin_min_num), bmp_active_skin->properties.mainwin_number_2_x, |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
692 bmp_active_skin->properties.mainwin_number_2_y); |
2313 | 693 |
694 if (bmp_active_skin->properties.mainwin_number_3_x && bmp_active_skin->properties.mainwin_number_3_y) | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
695 widget_move(WIDGET(mainwin_10sec_num), bmp_active_skin->properties.mainwin_number_3_x, |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
696 bmp_active_skin->properties.mainwin_number_3_y); |
2313 | 697 |
698 if (bmp_active_skin->properties.mainwin_number_4_x && bmp_active_skin->properties.mainwin_number_4_y) | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
699 widget_move(WIDGET(mainwin_sec_num), bmp_active_skin->properties.mainwin_number_4_x, |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
700 bmp_active_skin->properties.mainwin_number_4_y); |
2313 | 701 |
702 if (bmp_active_skin->properties.mainwin_playstatus_x && bmp_active_skin->properties.mainwin_playstatus_y) | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
703 widget_move(WIDGET(mainwin_playstatus), bmp_active_skin->properties.mainwin_playstatus_x, |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
704 bmp_active_skin->properties.mainwin_playstatus_y); |
2313 | 705 |
706 if (bmp_active_skin->properties.mainwin_volume_x && bmp_active_skin->properties.mainwin_volume_y) | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
707 widget_move(WIDGET(mainwin_volume), bmp_active_skin->properties.mainwin_volume_x, |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
708 bmp_active_skin->properties.mainwin_volume_y); |
2313 | 709 |
710 if (bmp_active_skin->properties.mainwin_balance_x && bmp_active_skin->properties.mainwin_balance_y) | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
711 widget_move(WIDGET(mainwin_balance), bmp_active_skin->properties.mainwin_balance_x, |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
712 bmp_active_skin->properties.mainwin_balance_y); |
2313 | 713 |
714 if (bmp_active_skin->properties.mainwin_position_x && bmp_active_skin->properties.mainwin_position_y) | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
715 widget_move(WIDGET(mainwin_position), bmp_active_skin->properties.mainwin_position_x, |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
716 bmp_active_skin->properties.mainwin_position_y); |
2313 | 717 |
718 if (bmp_active_skin->properties.mainwin_previous_x && bmp_active_skin->properties.mainwin_previous_y) | |
2821 | 719 gtk_fixed_move(GTK_FIXED(SKINNED_WINDOW(mainwin)->fixed), mainwin_rew, bmp_active_skin->properties.mainwin_previous_x, |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
720 bmp_active_skin->properties.mainwin_previous_y); |
2313 | 721 |
722 if (bmp_active_skin->properties.mainwin_play_x && bmp_active_skin->properties.mainwin_play_y) | |
2821 | 723 gtk_fixed_move(GTK_FIXED(SKINNED_WINDOW(mainwin)->fixed), GTK_WIDGET(mainwin_play), bmp_active_skin->properties.mainwin_play_x, |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
724 bmp_active_skin->properties.mainwin_play_y); |
2313 | 725 |
726 if (bmp_active_skin->properties.mainwin_pause_x && bmp_active_skin->properties.mainwin_pause_y) | |
2821 | 727 gtk_fixed_move(GTK_FIXED(SKINNED_WINDOW(mainwin)->fixed), GTK_WIDGET(mainwin_pause), bmp_active_skin->properties.mainwin_pause_x, |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
728 bmp_active_skin->properties.mainwin_pause_y); |
2313 | 729 |
730 if (bmp_active_skin->properties.mainwin_stop_x && bmp_active_skin->properties.mainwin_stop_y) | |
2821 | 731 gtk_fixed_move(GTK_FIXED(SKINNED_WINDOW(mainwin)->fixed), GTK_WIDGET(mainwin_stop), bmp_active_skin->properties.mainwin_stop_x, |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
732 bmp_active_skin->properties.mainwin_stop_y); |
2313 | 733 |
734 if (bmp_active_skin->properties.mainwin_next_x && bmp_active_skin->properties.mainwin_next_y) | |
2821 | 735 gtk_fixed_move(GTK_FIXED(SKINNED_WINDOW(mainwin)->fixed), GTK_WIDGET(mainwin_fwd), bmp_active_skin->properties.mainwin_next_x, |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
736 bmp_active_skin->properties.mainwin_next_y); |
2313 | 737 |
738 if (bmp_active_skin->properties.mainwin_eject_x && bmp_active_skin->properties.mainwin_eject_y) | |
2821 | 739 gtk_fixed_move(GTK_FIXED(SKINNED_WINDOW(mainwin)->fixed), GTK_WIDGET(mainwin_eject), bmp_active_skin->properties.mainwin_eject_x, |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
740 bmp_active_skin->properties.mainwin_eject_y); |
2313 | 741 |
742 if (bmp_active_skin->properties.mainwin_eqbutton_x && bmp_active_skin->properties.mainwin_eqbutton_y) | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
743 widget_move(WIDGET(mainwin_eq), bmp_active_skin->properties.mainwin_eqbutton_x, |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
744 bmp_active_skin->properties.mainwin_eqbutton_y); |
2313 | 745 |
746 if (bmp_active_skin->properties.mainwin_plbutton_x && bmp_active_skin->properties.mainwin_plbutton_y) | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
747 widget_move(WIDGET(mainwin_pl), bmp_active_skin->properties.mainwin_plbutton_x, |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
748 bmp_active_skin->properties.mainwin_plbutton_y); |
2313 | 749 |
750 if (bmp_active_skin->properties.mainwin_shuffle_x && bmp_active_skin->properties.mainwin_shuffle_y) | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
751 widget_move(WIDGET(mainwin_shuffle), bmp_active_skin->properties.mainwin_shuffle_x, |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
752 bmp_active_skin->properties.mainwin_shuffle_y); |
2313 | 753 |
754 if (bmp_active_skin->properties.mainwin_repeat_x && bmp_active_skin->properties.mainwin_repeat_y) | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
755 widget_move(WIDGET(mainwin_repeat), bmp_active_skin->properties.mainwin_repeat_x, |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
756 bmp_active_skin->properties.mainwin_repeat_y); |
2313 | 757 |
758 if (bmp_active_skin->properties.mainwin_about_x && bmp_active_skin->properties.mainwin_about_y) | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
759 widget_move(WIDGET(mainwin_about), bmp_active_skin->properties.mainwin_about_x, |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
760 bmp_active_skin->properties.mainwin_about_y); |
2313 | 761 |
762 if (bmp_active_skin->properties.mainwin_minimize_x && bmp_active_skin->properties.mainwin_minimize_y) | |
2821 | 763 gtk_fixed_move(GTK_FIXED(SKINNED_WINDOW(mainwin)->fixed), GTK_WIDGET(mainwin_minimize), cfg.player_shaded ? 244 : bmp_active_skin->properties.mainwin_minimize_x, |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
764 cfg.player_shaded ? 3 : bmp_active_skin->properties.mainwin_minimize_y); |
2313 | 765 |
766 if (bmp_active_skin->properties.mainwin_shade_x && bmp_active_skin->properties.mainwin_shade_y) | |
2821 | 767 gtk_fixed_move(GTK_FIXED(SKINNED_WINDOW(mainwin)->fixed), GTK_WIDGET(mainwin_shade), cfg.player_shaded ? 254 : bmp_active_skin->properties.mainwin_shade_x, |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
768 cfg.player_shaded ? 3 : bmp_active_skin->properties.mainwin_shade_y); |
2313 | 769 |
770 if (bmp_active_skin->properties.mainwin_close_x && bmp_active_skin->properties.mainwin_close_y) | |
2821 | 771 gtk_fixed_move(GTK_FIXED(SKINNED_WINDOW(mainwin)->fixed), GTK_WIDGET(mainwin_close), cfg.player_shaded ? 264 : bmp_active_skin->properties.mainwin_close_x, |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
772 cfg.player_shaded ? 3 : bmp_active_skin->properties.mainwin_close_y); |
2313 | 773 |
774 /* visibility attributes */ | |
775 if (bmp_active_skin->properties.mainwin_menurow_visible) | |
776 widget_show(WIDGET(mainwin_menurow)); | |
777 else | |
778 widget_hide(WIDGET(mainwin_menurow)); | |
779 | |
780 if (bmp_active_skin->properties.mainwin_text_visible) | |
781 widget_show(WIDGET(mainwin_info)); | |
782 else | |
783 widget_hide(WIDGET(mainwin_info)); | |
784 | |
785 if (bmp_active_skin->properties.mainwin_othertext_visible) | |
786 widget_show(WIDGET(mainwin_othertext)); | |
787 else | |
788 widget_hide(WIDGET(mainwin_othertext)); | |
789 | |
790 if (bmp_active_skin->properties.mainwin_vis_visible) | |
791 widget_show(WIDGET(mainwin_vis)); | |
792 else | |
793 widget_hide(WIDGET(mainwin_vis)); | |
794 | |
795 /* window size, mainwinWidth && mainwinHeight properties */ | |
796 if (bmp_active_skin->properties.mainwin_height && bmp_active_skin->properties.mainwin_width) | |
797 { | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
798 gint width, height; |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
799 |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
800 gdk_window_get_size(mainwin->window, &width, &height); |
2313 | 801 |
802 if (width == bmp_active_skin->properties.mainwin_width * (cfg.doublesize + 1) && | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
803 height == bmp_active_skin->properties.mainwin_height * (cfg.doublesize + 1)) |
2313 | 804 return; |
805 | |
806 dock_window_resize(GTK_WINDOW(mainwin), cfg.player_shaded ? MAINWIN_SHADED_WIDTH * (cfg.doublesize + 1) : bmp_active_skin->properties.mainwin_width * (cfg.doublesize + 1), | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
807 cfg.player_shaded ? MAINWIN_SHADED_HEIGHT * (cfg.doublesize + 1) : bmp_active_skin->properties.mainwin_height * (cfg.doublesize + 1), |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
808 bmp_active_skin->properties.mainwin_width * (cfg.doublesize + 1), |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
809 bmp_active_skin->properties.mainwin_height * (cfg.doublesize + 1)); |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
810 |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
811 g_object_unref(mainwin_bg); |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
812 g_object_unref(mainwin_bg_x2); |
2313 | 813 mainwin_bg = gdk_pixmap_new(mainwin->window, |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
814 bmp_active_skin->properties.mainwin_width, |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
815 bmp_active_skin->properties.mainwin_height, -1); |
2313 | 816 mainwin_bg_x2 = gdk_pixmap_new(mainwin->window, |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
817 bmp_active_skin->properties.mainwin_width * 2, |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
818 bmp_active_skin->properties.mainwin_height * 2, -1); |
2313 | 819 mainwin_set_back_pixmap(); |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
820 widget_list_change_pixmap(mainwin_wlist, mainwin_bg); |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
821 gdk_flush(); |
2313 | 822 } |
823 } | |
824 | |
825 void | |
826 mainwin_set_song_info(gint bitrate, | |
827 gint frequency, | |
828 gint n_channels) | |
829 { | |
830 gchar text[512]; | |
831 gchar *title; | |
832 Playlist *playlist = playlist_get_active(); | |
833 | |
834 playback_set_sample_params(bitrate, frequency, n_channels); | |
835 | |
836 if (bitrate != -1) { | |
837 bitrate /= 1000; | |
838 | |
839 if (bitrate < 1000) { | |
840 /* Show bitrate in 1000s */ | |
841 g_snprintf(text, sizeof(text), "%3d", bitrate); | |
842 textbox_set_text(mainwin_rate_text, text); | |
843 } | |
844 else { | |
845 /* Show bitrate in 100,000s */ | |
846 g_snprintf(text, sizeof(text), "%2dH", bitrate / 100); | |
847 textbox_set_text(mainwin_rate_text, text); | |
848 } | |
849 } | |
850 else | |
851 textbox_set_text(mainwin_rate_text, _("VBR")); | |
852 | |
853 /* Show sampling frequency in kHz */ | |
854 g_snprintf(text, sizeof(text), "%2d", frequency / 1000); | |
855 textbox_set_text(mainwin_freq_text, text); | |
856 | |
857 monostereo_set_num_channels(mainwin_monostereo, n_channels); | |
858 | |
859 if (cfg.player_shaded) | |
860 { | |
861 widget_show(WIDGET(mainwin_stime_min)); | |
862 widget_show(WIDGET(mainwin_stime_sec)); | |
863 } | |
864 | |
865 widget_show(WIDGET(mainwin_minus_num)); | |
866 widget_show(WIDGET(mainwin_10min_num)); | |
867 widget_show(WIDGET(mainwin_min_num)); | |
868 widget_show(WIDGET(mainwin_10sec_num)); | |
869 widget_show(WIDGET(mainwin_sec_num)); | |
870 | |
871 if (!playback_get_paused() && mainwin_playstatus != NULL) | |
872 playstatus_set_status(mainwin_playstatus, STATUS_PLAY); | |
873 | |
874 if (playlist_get_current_length(playlist) != -1) { | |
875 if (cfg.player_shaded) | |
876 widget_show(WIDGET(mainwin_sposition)); | |
877 widget_show(WIDGET(mainwin_position)); | |
878 } | |
879 else { | |
880 widget_hide(WIDGET(mainwin_position)); | |
881 widget_hide(WIDGET(mainwin_sposition)); | |
882 mainwin_force_redraw = TRUE; | |
883 } | |
884 | |
885 if (bmp_active_skin && bmp_active_skin->properties.mainwin_othertext | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
886 == TRUE) |
2313 | 887 { |
888 if (bitrate != -1) | |
889 g_snprintf(text, 512, "%d kbps, %0.1f kHz, %s", | |
890 bitrate, | |
891 (gfloat) frequency / 1000, | |
892 (n_channels > 1) ? _("stereo") : _("mono")); | |
893 else | |
894 g_snprintf(text, 512, "VBR, %0.1f kHz, %s", | |
895 (gfloat) frequency / 1000, | |
896 (n_channels > 1) ? _("stereo") : _("mono")); | |
897 | |
898 textbox_set_text(mainwin_othertext, text); | |
899 | |
900 widget_hide(WIDGET(mainwin_rate_text)); | |
901 widget_hide(WIDGET(mainwin_freq_text)); | |
902 widget_hide(WIDGET(mainwin_monostereo)); | |
903 | |
904 if (bmp_active_skin->properties.mainwin_othertext_visible) | |
905 widget_show(WIDGET(mainwin_othertext)); | |
906 } | |
907 else | |
908 { | |
909 widget_show(WIDGET(mainwin_rate_text)); | |
910 widget_show(WIDGET(mainwin_freq_text)); | |
911 widget_show(WIDGET(mainwin_monostereo)); | |
912 widget_hide(WIDGET(mainwin_othertext)); | |
913 } | |
914 | |
915 title = playlist_get_info_text(playlist); | |
916 mainwin_set_song_title(title); | |
917 g_free(title); | |
918 } | |
919 | |
920 void | |
921 mainwin_clear_song_info(void) | |
922 { | |
923 if (!mainwin) | |
924 return; | |
925 | |
926 /* clear title */ | |
927 G_LOCK(mainwin_title); | |
928 g_free(mainwin_title_text); | |
929 mainwin_title_text = NULL; | |
930 G_UNLOCK(mainwin_title); | |
931 | |
932 /* clear sampling parameters */ | |
933 playback_set_sample_params(0, 0, 0); | |
934 | |
935 mainwin_position->hs_pressed = FALSE; | |
936 mainwin_sposition->hs_pressed = FALSE; | |
937 | |
938 /* clear sampling parameter displays */ | |
939 textbox_set_text(mainwin_rate_text, " "); | |
940 textbox_set_text(mainwin_freq_text, " "); | |
941 monostereo_set_num_channels(mainwin_monostereo, 0); | |
942 | |
943 if (mainwin_playstatus != NULL) | |
944 playstatus_set_status(mainwin_playstatus, STATUS_STOP); | |
945 | |
946 /* hide playback time */ | |
947 widget_hide(WIDGET(mainwin_minus_num)); | |
948 widget_hide(WIDGET(mainwin_10min_num)); | |
949 widget_hide(WIDGET(mainwin_min_num)); | |
950 widget_hide(WIDGET(mainwin_10sec_num)); | |
951 widget_hide(WIDGET(mainwin_sec_num)); | |
952 | |
953 widget_hide(WIDGET(mainwin_stime_min)); | |
954 widget_hide(WIDGET(mainwin_stime_sec)); | |
955 | |
956 widget_hide(WIDGET(mainwin_position)); | |
957 widget_hide(WIDGET(mainwin_sposition)); | |
958 | |
959 widget_hide(WIDGET(mainwin_othertext)); | |
960 | |
961 playlistwin_hide_timer(); | |
962 draw_main_window(TRUE); | |
963 | |
964 vis_clear(active_vis); | |
965 } | |
966 | |
967 void | |
968 mainwin_disable_seekbar(void) | |
969 { | |
970 if (!mainwin) | |
971 return; | |
972 | |
973 /* | |
974 * We dont call draw_main_window() here so this will not | |
975 * remove them visually. It will only prevent us from sending | |
976 * any seek calls to the input plugin before the input plugin | |
977 * calls ->set_info(). | |
978 */ | |
979 widget_hide(WIDGET(mainwin_position)); | |
980 widget_hide(WIDGET(mainwin_sposition)); | |
981 } | |
982 | |
983 static gboolean | |
984 mainwin_mouse_button_release(GtkWidget * widget, | |
985 GdkEventButton * event, | |
986 gpointer callback_data) | |
987 { | |
988 gdk_pointer_ungrab(GDK_CURRENT_TIME); | |
989 | |
990 /* | |
991 * The gdk_flush() is just for making sure that the pointer really | |
992 * gets ungrabbed before calling any button callbacks | |
993 * | |
994 */ | |
995 | |
996 gdk_flush(); | |
997 | |
998 if (dock_is_moving(GTK_WINDOW(mainwin))) { | |
999 dock_move_release(GTK_WINDOW(mainwin)); | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
1000 draw_playlist_window(TRUE); |
2313 | 1001 } |
1002 | |
1003 if (mainwin_menurow->mr_doublesize_selected) { | |
1004 event->x /= 2; | |
1005 event->y /= 2; | |
1006 } | |
1007 | |
1008 handle_release_cb(mainwin_wlist, widget, event); | |
1009 | |
1010 draw_main_window(FALSE); | |
1011 | |
1012 return FALSE; | |
1013 } | |
1014 | |
1015 static gboolean | |
1016 mainwin_motion(GtkWidget * widget, | |
1017 GdkEventMotion * event, | |
1018 gpointer callback_data) | |
1019 { | |
1020 int x, y; | |
1021 GdkModifierType state; | |
1022 | |
2494
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
2485
diff
changeset
|
1023 /* If it's a hint, we had to query X, so override the |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
2485
diff
changeset
|
1024 * information we we're given... it's probably useless... --nenolod |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
2485
diff
changeset
|
1025 */ |
2313 | 1026 if (event->is_hint != FALSE) |
1027 { | |
2494
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
2485
diff
changeset
|
1028 gdk_window_get_pointer(GDK_WINDOW(mainwin->window), &x, &y, &state); |
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
2485
diff
changeset
|
1029 |
2313 | 1030 event->x = x; |
1031 event->y = y; | |
1032 event->state = state; | |
1033 } | |
1034 else | |
1035 { | |
1036 x = event->x; | |
1037 y = event->y; | |
1038 state = event->state; | |
1039 } | |
1040 if (cfg.doublesize) { | |
1041 event->x /= 2; | |
1042 event->y /= 2; | |
1043 } | |
2646
db74f7ecf22d
[svn] - fix doublesize motion events. patch by gagern, closes #856.
nenolod
parents:
2525
diff
changeset
|
1044 |
db74f7ecf22d
[svn] - fix doublesize motion events. patch by gagern, closes #856.
nenolod
parents:
2525
diff
changeset
|
1045 handle_motion_cb(mainwin_wlist, widget, event); |
db74f7ecf22d
[svn] - fix doublesize motion events. patch by gagern, closes #856.
nenolod
parents:
2525
diff
changeset
|
1046 draw_main_window(FALSE); |
2313 | 1047 |
1048 gdk_flush(); | |
1049 | |
1050 return FALSE; | |
1051 } | |
1052 | |
1053 void | |
1054 mainwin_scrolled(GtkWidget *widget, GdkEventScroll *event, | |
1055 gpointer callback_data) | |
1056 { | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
1057 Playlist *playlist = playlist_get_active(); |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
1058 |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
1059 switch (event->direction) { |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
1060 case GDK_SCROLL_UP: |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
1061 mainwin_set_volume_diff(cfg.mouse_change); |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
1062 break; |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
1063 case GDK_SCROLL_DOWN: |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
1064 mainwin_set_volume_diff(-cfg.mouse_change); |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
1065 break; |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
1066 case GDK_SCROLL_LEFT: |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
1067 if (playlist_get_current_length(playlist) != -1) |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
1068 playback_seek(CLAMP(playback_get_time() - 1000, |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
1069 0, playlist_get_current_length(playlist)) / 1000); |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
1070 break; |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
1071 case GDK_SCROLL_RIGHT: |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
1072 if (playlist_get_current_length(playlist) != -1) |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
1073 playback_seek(CLAMP(playback_get_time() + 1000, |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
1074 0, playlist_get_current_length(playlist)) / 1000); |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
1075 break; |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
1076 } |
2313 | 1077 } |
1078 | |
1079 static gboolean | |
1080 mainwin_mouse_button_press(GtkWidget * widget, | |
1081 GdkEventButton * event, | |
1082 gpointer callback_data) | |
1083 { | |
1084 | |
1085 gboolean grab = TRUE; | |
1086 | |
1087 if (cfg.doublesize) { | |
1088 /* | |
1089 * A hack to make doublesize transparent to callbacks. | |
1090 * We should make a copy of this data instead of | |
1091 * tampering with the data we get from gtk+ | |
1092 */ | |
1093 event->x /= 2; | |
1094 event->y /= 2; | |
1095 } | |
1096 | |
1097 if (event->button == 1 && event->type == GDK_BUTTON_PRESS && | |
2496
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
1098 !ui_skinned_window_widgetlist_contained(mainwin, event->x, event->y) && |
2313 | 1099 (cfg.easy_move || event->y < 14)) { |
2497
204d1bab71f9
[svn] - if (0 && hint_move_resize_available()) -- i'm not sure how this linked as we do not have a hint_move_resize_available().
nenolod
parents:
2496
diff
changeset
|
1100 gtk_window_present(GTK_WINDOW(mainwin)); |
204d1bab71f9
[svn] - if (0 && hint_move_resize_available()) -- i'm not sure how this linked as we do not have a hint_move_resize_available().
nenolod
parents:
2496
diff
changeset
|
1101 dock_move_press(dock_window_list, GTK_WINDOW(mainwin), event, |
204d1bab71f9
[svn] - if (0 && hint_move_resize_available()) -- i'm not sure how this linked as we do not have a hint_move_resize_available().
nenolod
parents:
2496
diff
changeset
|
1102 TRUE); |
2313 | 1103 } |
1104 else if (event->button == 1 && event->type == GDK_2BUTTON_PRESS && | |
2496
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
1105 event->y < 14 && !ui_skinned_window_widgetlist_contained(mainwin, event->x, event->y)) { |
2313 | 1106 mainwin_set_shade(!cfg.player_shaded); |
1107 if (dock_is_moving(GTK_WINDOW(mainwin))) | |
1108 dock_move_release(GTK_WINDOW(mainwin)); | |
1109 } | |
1110 else if (event->button == 1 && event->type == GDK_2BUTTON_PRESS && | |
1111 widget_contains(WIDGET(mainwin_info), event->x, event->y)) { | |
1112 playlist_fileinfo_current(playlist_get_active()); | |
1113 } | |
1114 else { | |
1115 handle_press_cb(mainwin_wlist, widget, event); | |
1116 draw_main_window(FALSE); | |
1117 } | |
1118 | |
1119 if ((event->button == 1) && event->type != GDK_2BUTTON_PRESS && | |
1120 (widget_contains(WIDGET(mainwin_vis), event->x, event->y) || | |
1121 widget_contains(WIDGET(mainwin_svis), event->x, event->y))) { | |
1122 | |
1123 cfg.vis_type++; | |
1124 | |
1125 if (cfg.vis_type > VIS_OFF) | |
1126 cfg.vis_type = VIS_ANALYZER; | |
1127 | |
1128 mainwin_vis_set_type(cfg.vis_type); | |
1129 } | |
1130 | |
1131 if (event->button == 3) { | |
1132 if (widget_contains(WIDGET(mainwin_info), event->x, event->y)) { | |
1133 ui_manager_popup_menu_show(GTK_MENU(mainwin_songname_menu), | |
1134 event->x_root, event->y_root, | |
1135 3, event->time); | |
1136 grab = FALSE; | |
1137 } | |
1138 else if (widget_contains(WIDGET(mainwin_vis), event->x, event->y) || | |
1139 widget_contains(WIDGET(mainwin_svis), event->x, event->y)) { | |
1140 ui_manager_popup_menu_show(GTK_MENU(mainwin_visualization_menu), event->x_root, | |
1141 event->y_root, 3, event->time); | |
1142 grab = FALSE; | |
1143 } | |
1144 else if ( (event->y > 70) && (event->x < 128) ) | |
1145 { | |
1146 | |
1147 ui_manager_popup_menu_show(GTK_MENU(mainwin_playback_menu), | |
1148 event->x_root, | |
1149 event->y_root, 3, event->time); | |
1150 grab = FALSE; | |
1151 } else { | |
1152 /* | |
1153 * Pop up the main menu a few pixels down. | |
1154 * This will avoid that anything is selected | |
1155 * if one right-clicks to focus the window | |
1156 * without raising it. | |
1157 * | |
1158 ***MD I think the above is stupid, people don't expect this | |
1159 * | |
1160 */ | |
1161 ui_manager_popup_menu_show(GTK_MENU(mainwin_general_menu), | |
1162 event->x_root, | |
1163 event->y_root, 3, event->time); | |
1164 grab = FALSE; | |
1165 } | |
1166 } | |
1167 | |
1168 if (event->button == 1) | |
1169 { | |
1170 if (widget_contains(WIDGET(mainwin_minus_num), event->x, event->y) || | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
1171 widget_contains(WIDGET(mainwin_10min_num), event->x, event->y) || |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
1172 widget_contains(WIDGET(mainwin_min_num), event->x, event->y) || |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
1173 widget_contains(WIDGET(mainwin_10sec_num), event->x, event->y) || |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
1174 widget_contains(WIDGET(mainwin_sec_num), event->x, event->y) || |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
1175 widget_contains(WIDGET(mainwin_stime_min), event->x, event->y) || |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
1176 widget_contains(WIDGET(mainwin_stime_sec), event->x, event->y)) |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
1177 { |
2313 | 1178 if (cfg.timer_mode == TIMER_ELAPSED) |
1179 set_timer_mode(TIMER_REMAINING); | |
1180 else | |
1181 set_timer_mode(TIMER_ELAPSED); | |
1182 } | |
1183 } | |
1184 | |
1185 if (grab) | |
1186 gdk_pointer_grab(mainwin->window, FALSE, | |
1187 GDK_BUTTON_MOTION_MASK | | |
1188 GDK_BUTTON_RELEASE_MASK, | |
1189 GDK_WINDOW(GDK_NONE), NULL, GDK_CURRENT_TIME); | |
1190 | |
1191 return FALSE; | |
1192 } | |
1193 | |
1194 static gboolean | |
1195 mainwin_focus_in(GtkWidget * window, | |
1196 GdkEventFocus * event, | |
1197 gpointer data) | |
1198 { | |
1199 draw_main_window(TRUE); | |
1200 | |
1201 return TRUE; | |
1202 } | |
1203 | |
1204 | |
1205 static gboolean | |
1206 mainwin_focus_out(GtkWidget * widget, | |
1207 GdkEventFocus * event, | |
1208 gpointer callback_data) | |
1209 { | |
1210 draw_main_window(TRUE); | |
1211 | |
1212 return TRUE; | |
1213 } | |
1214 | |
1215 static gboolean | |
1216 mainwin_keypress(GtkWidget * grab_widget, | |
1217 GdkEventKey * event, | |
1218 gpointer data) | |
1219 { | |
1220 Playlist *playlist = playlist_get_active(); | |
1221 | |
1222 switch (event->keyval) { | |
1223 | |
1224 case GDK_Up: | |
1225 case GDK_KP_Up: | |
1226 case GDK_KP_8: | |
1227 mainwin_set_volume_diff(2); | |
1228 break; | |
1229 case GDK_Down: | |
1230 case GDK_KP_Down: | |
1231 case GDK_KP_2: | |
1232 mainwin_set_volume_diff(-2); | |
1233 break; | |
1234 case GDK_Left: | |
1235 case GDK_KP_Left: | |
1236 case GDK_KP_7: | |
1237 if (playlist_get_current_length(playlist) != -1) | |
1238 playback_seek(CLAMP | |
1239 (playback_get_time() - 5000, 0, | |
1240 playlist_get_current_length(playlist)) / 1000); | |
1241 break; | |
1242 case GDK_Right: | |
1243 case GDK_KP_Right: | |
1244 case GDK_KP_9: | |
1245 if (playlist_get_current_length(playlist) != -1) | |
1246 playback_seek(CLAMP | |
1247 (playback_get_time() + 5000, 0, | |
1248 playlist_get_current_length(playlist)) / 1000); | |
1249 break; | |
1250 case GDK_KP_4: | |
1251 playlist_prev(playlist); | |
1252 break; | |
1253 case GDK_KP_6: | |
1254 playlist_next(playlist); | |
1255 break; | |
1256 case GDK_KP_Insert: | |
2500 | 1257 ui_jump_to_track(); |
2313 | 1258 break; |
1259 case GDK_KP_5: | |
1260 mainwin_play_pushed(); | |
1261 break; | |
2693
b47f5577bea0
[svn] - Made the Space key pause/unpause playback (like e.g. mplayer)
mf0102
parents:
2651
diff
changeset
|
1262 case GDK_space: |
b47f5577bea0
[svn] - Made the Space key pause/unpause playback (like e.g. mplayer)
mf0102
parents:
2651
diff
changeset
|
1263 playback_pause(); |
b47f5577bea0
[svn] - Made the Space key pause/unpause playback (like e.g. mplayer)
mf0102
parents:
2651
diff
changeset
|
1264 break; |
2313 | 1265 case GDK_Escape: |
1266 mainwin_minimize_cb(); | |
1267 break; | |
1268 default: | |
1269 return FALSE; | |
1270 } | |
1271 | |
1272 return TRUE; | |
1273 } | |
1274 | |
1275 static void | |
1276 mainwin_jump_to_time_cb(GtkWidget * widget, | |
1277 GtkWidget * entry) | |
1278 { | |
1279 guint min = 0, sec = 0, params; | |
1280 gint time; | |
1281 Playlist *playlist = playlist_get_active(); | |
1282 | |
1283 params = sscanf(gtk_entry_get_text(GTK_ENTRY(entry)), "%u:%u", | |
1284 &min, &sec); | |
1285 if (params == 2) | |
1286 time = (min * 60) + sec; | |
1287 else if (params == 1) | |
1288 time = min; | |
1289 else | |
1290 return; | |
1291 | |
1292 if (playlist_get_current_length(playlist) > -1 && | |
1293 time <= (playlist_get_current_length(playlist) / 1000)) | |
1294 { | |
1295 playback_seek(time); | |
1296 gtk_widget_destroy(mainwin_jtt); | |
1297 } | |
1298 } | |
1299 | |
1300 | |
1301 void | |
1302 mainwin_jump_to_time(void) | |
1303 { | |
1304 GtkWidget *vbox, *hbox_new, *hbox_total; | |
1305 GtkWidget *time_entry, *label, *bbox, *jump, *cancel; | |
1306 guint tindex; | |
1307 gchar time_str[10]; | |
1308 | |
1309 if (!playback_get_playing()) { | |
1310 report_error("JIT can't be launched when no track is being played.\n"); | |
1311 return; | |
1312 } | |
1313 | |
1314 if (mainwin_jtt) { | |
1315 gtk_window_present(GTK_WINDOW(mainwin_jtt)); | |
1316 return; | |
1317 } | |
1318 | |
1319 mainwin_jtt = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
1320 gtk_window_set_type_hint(GTK_WINDOW(mainwin_jtt), | |
1321 GDK_WINDOW_TYPE_HINT_DIALOG); | |
1322 | |
1323 gtk_window_set_title(GTK_WINDOW(mainwin_jtt), _("Jump to Time")); | |
1324 gtk_window_set_position(GTK_WINDOW(mainwin_jtt), GTK_WIN_POS_CENTER); | |
1325 gtk_window_set_transient_for(GTK_WINDOW(mainwin_jtt), | |
1326 GTK_WINDOW(mainwin)); | |
1327 | |
1328 g_signal_connect(mainwin_jtt, "destroy", | |
1329 G_CALLBACK(gtk_widget_destroyed), &mainwin_jtt); | |
1330 gtk_container_border_width(GTK_CONTAINER(mainwin_jtt), 10); | |
1331 | |
1332 vbox = gtk_vbox_new(FALSE, 5); | |
1333 gtk_container_add(GTK_CONTAINER(mainwin_jtt), vbox); | |
1334 | |
1335 hbox_new = gtk_hbox_new(FALSE, 0); | |
1336 gtk_box_pack_start(GTK_BOX(vbox), hbox_new, TRUE, TRUE, 5); | |
1337 | |
1338 time_entry = gtk_entry_new(); | |
1339 gtk_box_pack_start(GTK_BOX(hbox_new), time_entry, FALSE, FALSE, 5); | |
1340 g_signal_connect(time_entry, "activate", | |
1341 G_CALLBACK(mainwin_jump_to_time_cb), time_entry); | |
1342 | |
1343 gtk_widget_set_size_request(time_entry, 70, -1); | |
1344 label = gtk_label_new(_("minutes:seconds")); | |
1345 gtk_box_pack_start(GTK_BOX(hbox_new), label, FALSE, FALSE, 5); | |
1346 | |
1347 hbox_total = gtk_hbox_new(FALSE, 0); | |
1348 gtk_box_pack_start(GTK_BOX(vbox), hbox_total, TRUE, TRUE, 5); | |
1349 gtk_widget_show(hbox_total); | |
1350 | |
1351 /* FIXME: Disable display of current track length. It's not | |
1352 updated when track changes */ | |
1353 #if 0 | |
1354 label = gtk_label_new(_("Track length:")); | |
1355 gtk_box_pack_start(GTK_BOX(hbox_total), label, FALSE, FALSE, 5); | |
1356 | |
1357 len = playlist_get_current_length() / 1000; | |
1358 g_snprintf(time_str, sizeof(time_str), "%u:%2.2u", len / 60, len % 60); | |
1359 label = gtk_label_new(time_str); | |
1360 | |
1361 gtk_box_pack_start(GTK_BOX(hbox_total), label, FALSE, FALSE, 10); | |
1362 #endif | |
1363 | |
1364 bbox = gtk_hbutton_box_new(); | |
1365 gtk_box_pack_start(GTK_BOX(vbox), bbox, TRUE, TRUE, 0); | |
1366 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); | |
1367 gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5); | |
1368 | |
1369 cancel = gtk_button_new_from_stock(GTK_STOCK_CANCEL); | |
1370 GTK_WIDGET_SET_FLAGS(cancel, GTK_CAN_DEFAULT); | |
1371 gtk_container_add(GTK_CONTAINER(bbox), cancel); | |
1372 g_signal_connect_swapped(cancel, "clicked", | |
1373 G_CALLBACK(gtk_widget_destroy), mainwin_jtt); | |
1374 | |
1375 jump = gtk_button_new_from_stock(GTK_STOCK_JUMP_TO); | |
1376 GTK_WIDGET_SET_FLAGS(jump, GTK_CAN_DEFAULT); | |
1377 gtk_container_add(GTK_CONTAINER(bbox), jump); | |
1378 g_signal_connect(jump, "clicked", | |
1379 G_CALLBACK(mainwin_jump_to_time_cb), time_entry); | |
1380 | |
1381 tindex = playback_get_time() / 1000; | |
1382 g_snprintf(time_str, sizeof(time_str), "%u:%2.2u", tindex / 60, | |
1383 tindex % 60); | |
1384 gtk_entry_set_text(GTK_ENTRY(time_entry), time_str); | |
1385 | |
1386 gtk_entry_select_region(GTK_ENTRY(time_entry), 0, strlen(time_str)); | |
1387 | |
1388 gtk_widget_show_all(mainwin_jtt); | |
1389 | |
1390 gtk_widget_grab_focus(time_entry); | |
1391 gtk_widget_grab_default(jump); | |
1392 } | |
1393 | |
1394 static gboolean | |
1395 mainwin_configure(GtkWidget * window, | |
1396 GdkEventConfigure * event, | |
1397 gpointer data) | |
1398 { | |
1399 if (!GTK_WIDGET_VISIBLE(window)) | |
1400 return FALSE; | |
1401 | |
1402 if (cfg.show_wm_decorations) | |
1403 gdk_window_get_root_origin(window->window, | |
1404 &cfg.player_x, &cfg.player_y); | |
1405 else | |
1406 gdk_window_get_deskrelative_origin(window->window, | |
1407 &cfg.player_x, &cfg.player_y); | |
1408 return FALSE; | |
1409 } | |
1410 | |
1411 void | |
1412 mainwin_set_back_pixmap(void) | |
1413 { | |
1414 if (cfg.doublesize) | |
1415 gdk_window_set_back_pixmap(mainwin->window, mainwin_bg_x2, 0); | |
1416 else | |
1417 gdk_window_set_back_pixmap(mainwin->window, mainwin_bg, 0); | |
1418 gdk_window_clear(mainwin->window); | |
1419 } | |
1420 | |
1421 /* | |
1422 * Rewritten 09/13/06: | |
1423 * | |
1424 * Remove all of this flaky iter/sourcelist/strsplit stuff. | |
1425 * All we care about is the filepath. | |
1426 * | |
1427 * We can figure this out and easily pass it to xmms_urldecode_plain(). | |
1428 * - nenolod | |
1429 */ | |
1430 void | |
1431 mainwin_drag_data_received(GtkWidget * widget, | |
1432 GdkDragContext * context, | |
1433 gint x, | |
1434 gint y, | |
1435 GtkSelectionData * selection_data, | |
1436 guint info, | |
1437 guint time, | |
1438 gpointer user_data) | |
1439 { | |
1440 Playlist *playlist = playlist_get_active(); | |
1441 | |
1442 g_return_if_fail(selection_data != NULL); | |
1443 g_return_if_fail(selection_data->data != NULL); | |
1444 | |
1445 if (str_has_prefix_nocase((gchar *) selection_data->data, "fonts:///")) | |
1446 { | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
1447 gchar *path = (gchar *) selection_data->data + 9; /* skip fonts:/// */ |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
1448 gchar *decoded = xmms_urldecode_plain(path); |
2313 | 1449 |
1450 cfg.playlist_font = g_strconcat(decoded, strrchr(cfg.playlist_font, ' '), NULL); | |
1451 playlist_list_set_font(cfg.playlist_font); | |
1452 playlistwin_update_list(playlist); | |
1453 | |
1454 g_free(decoded); | |
1455 | |
1456 return; | |
1457 } | |
1458 | |
1459 playlist_clear(playlist); | |
1460 playlist_add_url(playlist, (gchar *) selection_data->data); | |
1461 playback_initiate(); | |
1462 } | |
1463 | |
1464 static void | |
1465 on_add_url_add_clicked(GtkWidget * widget, | |
1466 GtkWidget * entry) | |
1467 { | |
1468 const gchar *text = gtk_entry_get_text(GTK_ENTRY(entry)); | |
1469 if (text && *text) | |
1470 playlist_add_url(playlist_get_active(), text); | |
1471 } | |
1472 | |
1473 static void | |
1474 on_add_url_ok_clicked(GtkWidget * widget, | |
1475 GtkWidget * entry) | |
1476 { | |
1477 Playlist *playlist = playlist_get_active(); | |
1478 | |
1479 const gchar *text = gtk_entry_get_text(GTK_ENTRY(entry)); | |
1480 if (text && *text) | |
1481 { | |
1482 playlist_clear(playlist); | |
1483 playlist_add_url(playlist, text); | |
1484 playback_initiate(); | |
1485 } | |
1486 } | |
1487 | |
2651
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2646
diff
changeset
|
1488 static void |
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2646
diff
changeset
|
1489 on_visibility_warning_toggle(GtkToggleButton *tbt, gpointer unused) |
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2646
diff
changeset
|
1490 { |
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2646
diff
changeset
|
1491 cfg.warn_about_win_visibility = !gtk_toggle_button_get_active(tbt); |
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2646
diff
changeset
|
1492 } |
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2646
diff
changeset
|
1493 |
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2646
diff
changeset
|
1494 static void |
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2646
diff
changeset
|
1495 on_visibility_warning_response(GtkDialog *dlg, gint r_id, gpointer unused) |
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2646
diff
changeset
|
1496 { |
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2646
diff
changeset
|
1497 switch (r_id) |
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2646
diff
changeset
|
1498 { |
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2646
diff
changeset
|
1499 case GTK_RESPONSE_OK: |
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2646
diff
changeset
|
1500 mainwin_show(TRUE); |
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2646
diff
changeset
|
1501 break; |
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2646
diff
changeset
|
1502 case GTK_RESPONSE_CANCEL: |
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2646
diff
changeset
|
1503 default: |
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2646
diff
changeset
|
1504 break; |
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2646
diff
changeset
|
1505 } |
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2646
diff
changeset
|
1506 gtk_widget_destroy(GTK_WIDGET(dlg)); |
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2646
diff
changeset
|
1507 } |
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2646
diff
changeset
|
1508 |
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2646
diff
changeset
|
1509 void |
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2646
diff
changeset
|
1510 mainwin_show_visibility_warning(void) |
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2646
diff
changeset
|
1511 { |
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2646
diff
changeset
|
1512 if (cfg.warn_about_win_visibility) |
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2646
diff
changeset
|
1513 { |
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2646
diff
changeset
|
1514 GtkWidget *label, *checkbt, *vbox; |
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2646
diff
changeset
|
1515 GtkWidget *warning_dlg = gtk_dialog_new_with_buttons( _("Audacious - visibility warning") , |
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2646
diff
changeset
|
1516 GTK_WINDOW(mainwin) , GTK_DIALOG_DESTROY_WITH_PARENT , |
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2646
diff
changeset
|
1517 _("Show main player window") , GTK_RESPONSE_OK , |
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2646
diff
changeset
|
1518 _("Ignore") , GTK_RESPONSE_CANCEL , NULL ); |
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2646
diff
changeset
|
1519 vbox = gtk_vbox_new( FALSE , 4 ); |
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2646
diff
changeset
|
1520 gtk_container_set_border_width( GTK_CONTAINER(vbox) , 4 ); |
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2646
diff
changeset
|
1521 gtk_box_pack_start( GTK_BOX(GTK_DIALOG(warning_dlg)->vbox) , vbox , TRUE , TRUE , 0 ); |
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2646
diff
changeset
|
1522 label = gtk_label_new( _("Audacious has been started with all of its windows hidden.\n" |
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2646
diff
changeset
|
1523 "You may want to show the player window again to control Audacious; " |
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2646
diff
changeset
|
1524 "otherwise, you'll have to control it remotely via audtool or " |
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2646
diff
changeset
|
1525 "enabled plugins (such as the statusicon plugin).") ); |
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2646
diff
changeset
|
1526 gtk_label_set_line_wrap( GTK_LABEL(label) , TRUE ); |
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2646
diff
changeset
|
1527 gtk_misc_set_alignment( GTK_MISC(label) , 0.0 , 0.0 ); |
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2646
diff
changeset
|
1528 checkbt = gtk_check_button_new_with_label( _("Always ignore, show/hide is controlled remotely") ); |
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2646
diff
changeset
|
1529 gtk_box_pack_start( GTK_BOX(vbox) , label , TRUE , TRUE , 0 ); |
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2646
diff
changeset
|
1530 gtk_box_pack_start( GTK_BOX(vbox) , checkbt , TRUE , TRUE , 0 ); |
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2646
diff
changeset
|
1531 g_signal_connect( G_OBJECT(checkbt) , "toggled" , |
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2646
diff
changeset
|
1532 G_CALLBACK(on_visibility_warning_toggle) , NULL ); |
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2646
diff
changeset
|
1533 g_signal_connect( G_OBJECT(warning_dlg) , "response" , |
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2646
diff
changeset
|
1534 G_CALLBACK(on_visibility_warning_response) , NULL ); |
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2646
diff
changeset
|
1535 gtk_widget_show_all(warning_dlg); |
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2646
diff
changeset
|
1536 } |
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2646
diff
changeset
|
1537 } |
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2646
diff
changeset
|
1538 |
2313 | 1539 void |
1540 mainwin_show_add_url_window(void) | |
1541 { | |
1542 static GtkWidget *url_window = NULL; | |
1543 | |
1544 if (!url_window) { | |
1545 url_window = | |
1546 util_add_url_dialog_new(_("Enter location to play:"), | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
1547 G_CALLBACK(on_add_url_ok_clicked), |
2313 | 1548 G_CALLBACK(on_add_url_add_clicked)); |
1549 gtk_window_set_transient_for(GTK_WINDOW(url_window), | |
1550 GTK_WINDOW(mainwin)); | |
1551 g_signal_connect(url_window, "destroy", | |
1552 G_CALLBACK(gtk_widget_destroyed), | |
1553 &url_window); | |
1554 } | |
1555 | |
1556 gtk_window_present(GTK_WINDOW(url_window)); | |
1557 } | |
1558 | |
1559 static void | |
1560 check_set( GtkActionGroup * action_group , | |
1561 const gchar * action_name , | |
1562 gboolean is_on ) | |
1563 { | |
1564 /* check_set noew uses gtkaction */ | |
1565 GtkAction *action = gtk_action_group_get_action( action_group , action_name ); | |
1566 if ( action != NULL ) | |
1567 gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(action) , is_on ); | |
1568 return; | |
1569 } | |
1570 | |
1571 void | |
1572 mainwin_eject_pushed(void) | |
1573 { | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
1574 run_filebrowser(PLAY_BUTTON); |
2313 | 1575 } |
1576 | |
1577 void | |
1578 mainwin_rev_pushed(void) | |
1579 { | |
1580 g_get_current_time(&cb_time); | |
1581 | |
1582 seek_initial_pos = hslider_get_position(mainwin_position); | |
1583 seek_state = MAINWIN_SEEK_REV; | |
1584 } | |
1585 | |
1586 void | |
1587 mainwin_rev_release(void) | |
1588 { | |
1589 GTimeVal now_time; | |
1590 GTimeVal delta_time; | |
1591 gulong now_dur; | |
1592 | |
1593 g_get_current_time(&now_time); | |
1594 | |
1595 delta_time.tv_usec = now_time.tv_usec - cb_time.tv_usec; | |
1596 delta_time.tv_sec = now_time.tv_sec - cb_time.tv_sec; | |
1597 | |
1598 now_dur = labs((delta_time.tv_sec * 1000) + (glong) (delta_time.tv_usec / 1000)); | |
1599 | |
1600 if ( now_dur <= TRISTATE_THRESHOLD ) | |
1601 { | |
1602 /* interpret as 'skip to previous song' */ | |
1603 playlist_prev(playlist_get_active()); | |
1604 } | |
1605 else | |
1606 { | |
1607 /* interpret as 'seek' */ | |
1608 mainwin_position_release_cb( hslider_get_position(mainwin_position) ); | |
1609 } | |
1610 | |
1611 seek_state = MAINWIN_SEEK_NIL; | |
1612 } | |
1613 | |
1614 void | |
1615 mainwin_fwd_pushed(void) | |
1616 { | |
1617 g_get_current_time(&cb_time); | |
1618 seek_initial_pos = hslider_get_position(mainwin_position); | |
1619 seek_state = MAINWIN_SEEK_FWD; | |
1620 } | |
1621 | |
1622 void | |
1623 mainwin_fwd_release(void) | |
1624 { | |
1625 GTimeVal now_time; | |
1626 GTimeVal delta_time; | |
1627 gulong now_dur; | |
1628 | |
1629 g_get_current_time(&now_time); | |
1630 | |
1631 delta_time.tv_usec = now_time.tv_usec - cb_time.tv_usec; | |
1632 delta_time.tv_sec = now_time.tv_sec - cb_time.tv_sec; | |
1633 | |
1634 now_dur = labs((delta_time.tv_sec * 1000) + (glong) (delta_time.tv_usec / 1000)); | |
1635 | |
1636 if ( now_dur <= TRISTATE_THRESHOLD ) | |
1637 { | |
2480
bb2f191895ce
[svn] - fixed crash when skipping to next song with an empty playlist
marvin
parents:
2478
diff
changeset
|
1638 /* interpret as 'skip to next song' */ |
2313 | 1639 playlist_next(playlist_get_active()); |
1640 } | |
1641 else | |
1642 { | |
1643 /* interpret as 'seek' */ | |
1644 mainwin_position_release_cb( hslider_get_position(mainwin_position) ); | |
1645 } | |
1646 | |
1647 seek_state = MAINWIN_SEEK_NIL; | |
1648 } | |
1649 | |
1650 void | |
1651 mainwin_play_pushed(void) | |
1652 { | |
1653 if (ab_position_a != -1) | |
1654 playback_seek(ab_position_a / 1000); | |
1655 if (playback_get_paused()) { | |
1656 playback_pause(); | |
1657 return; | |
1658 } | |
1659 | |
1660 if (playlist_get_length(playlist_get_active())) | |
1661 playback_initiate(); | |
1662 else | |
1663 mainwin_eject_pushed(); | |
1664 } | |
1665 | |
1666 void | |
1667 mainwin_stop_pushed(void) | |
1668 { | |
1669 ip_data.stop = TRUE; | |
1670 mainwin_clear_song_info(); | |
1671 playback_stop(); | |
1672 ip_data.stop = FALSE; | |
1673 } | |
1674 | |
1675 void | |
1676 mainwin_shuffle_pushed(gboolean toggled) | |
1677 { | |
1678 check_set( toggleaction_group_others , "playback shuffle" , toggled ); | |
1679 } | |
1680 | |
1681 void | |
1682 mainwin_repeat_pushed(gboolean toggled) | |
1683 { | |
1684 check_set( toggleaction_group_others , "playback repeat" , toggled ); | |
1685 } | |
1686 | |
1687 void | |
1688 mainwin_pl_pushed(gboolean toggled) | |
1689 { | |
1690 if (toggled) | |
1691 playlistwin_show(); | |
1692 else | |
1693 playlistwin_hide(); | |
1694 } | |
1695 | |
1696 gint | |
1697 mainwin_spos_frame_cb(gint pos) | |
1698 { | |
1699 if (mainwin_sposition) { | |
1700 if (pos < 6) | |
1701 mainwin_sposition->hs_knob_nx = mainwin_sposition->hs_knob_px = | |
1702 17; | |
1703 else if (pos < 9) | |
1704 mainwin_sposition->hs_knob_nx = mainwin_sposition->hs_knob_px = | |
1705 20; | |
1706 else | |
1707 mainwin_sposition->hs_knob_nx = mainwin_sposition->hs_knob_px = | |
1708 23; | |
1709 } | |
1710 return 1; | |
1711 } | |
1712 | |
1713 void | |
1714 mainwin_spos_motion_cb(gint pos) | |
1715 { | |
1716 gint time; | |
1717 gchar *time_msg; | |
1718 Playlist *playlist = playlist_get_active(); | |
1719 | |
1720 pos--; | |
1721 | |
1722 time = ((playlist_get_current_length(playlist) / 1000) * pos) / 12; | |
1723 | |
1724 if (cfg.timer_mode == TIMER_REMAINING) { | |
1725 time = (playlist_get_current_length(playlist) / 1000) - time; | |
1726 time_msg = g_strdup_printf("-%2.2d", time / 60); | |
1727 textbox_set_text(mainwin_stime_min, time_msg); | |
1728 g_free(time_msg); | |
1729 } | |
1730 else { | |
1731 time_msg = g_strdup_printf(" %2.2d", time / 60); | |
1732 textbox_set_text(mainwin_stime_min, time_msg); | |
1733 g_free(time_msg); | |
1734 } | |
1735 | |
1736 time_msg = g_strdup_printf("%2.2d", time % 60); | |
1737 textbox_set_text(mainwin_stime_sec, time_msg); | |
1738 g_free(time_msg); | |
1739 } | |
1740 | |
1741 void | |
1742 mainwin_spos_release_cb(gint pos) | |
1743 { | |
1744 playback_seek(((playlist_get_current_length(playlist_get_active()) / 1000) * | |
1745 (pos - 1)) / 12); | |
1746 } | |
1747 | |
1748 void | |
1749 mainwin_position_motion_cb(gint pos) | |
1750 { | |
1751 gint length, time; | |
1752 gchar *seek_msg; | |
1753 | |
1754 length = playlist_get_current_length(playlist_get_active()) / 1000; | |
1755 time = (length * pos) / 219; | |
1756 seek_msg = g_strdup_printf(_("SEEK TO: %d:%-2.2d/%d:%-2.2d (%d%%)"), | |
1757 time / 60, time % 60, | |
1758 length / 60, length % 60, | |
1759 (length != 0) ? (time * 100) / length : 0); | |
1760 mainwin_lock_info_text(seek_msg); | |
1761 g_free(seek_msg); | |
1762 } | |
1763 | |
1764 void | |
1765 mainwin_position_release_cb(gint pos) | |
1766 { | |
1767 gint length, time; | |
1768 | |
1769 length = playlist_get_current_length(playlist_get_active()) / 1000; | |
1770 time = (length * pos) / 219; | |
1771 playback_seek(time); | |
1772 mainwin_release_info_text(); | |
1773 } | |
1774 | |
1775 gint | |
1776 mainwin_volume_frame_cb(gint pos) | |
1777 { | |
1778 return (gint) rint((pos / 52.0) * 28); | |
1779 } | |
1780 | |
1781 void | |
1782 mainwin_adjust_volume_motion(gint v) | |
1783 { | |
1784 gchar *volume_msg; | |
1785 | |
1786 setting_volume = TRUE; | |
1787 | |
1788 volume_msg = g_strdup_printf(_("VOLUME: %d%%"), v); | |
1789 mainwin_lock_info_text(volume_msg); | |
1790 g_free(volume_msg); | |
1791 | |
1792 if (balance < 0) | |
1793 input_set_volume(v, (v * (100 - abs(balance))) / 100); | |
1794 else if (balance > 0) | |
1795 input_set_volume((v * (100 - abs(balance))) / 100, v); | |
1796 else | |
1797 input_set_volume(v, v); | |
1798 } | |
1799 | |
1800 void | |
1801 mainwin_adjust_volume_release(void) | |
1802 { | |
1803 mainwin_release_info_text(); | |
1804 setting_volume = FALSE; | |
1805 read_volume(VOLUME_ADJUSTED); | |
1806 } | |
1807 | |
1808 void | |
1809 mainwin_adjust_balance_motion(gint b) | |
1810 { | |
1811 gchar *balance_msg; | |
1812 gint v, pvl, pvr; | |
1813 | |
1814 setting_volume = TRUE; | |
1815 balance = b; | |
1816 input_get_volume(&pvl, &pvr); | |
1817 v = MAX(pvl, pvr); | |
1818 if (b < 0) { | |
1819 balance_msg = g_strdup_printf(_("BALANCE: %d%% LEFT"), -b); | |
1820 input_set_volume(v, (gint) rint(((100 + b) / 100.0) * v)); | |
1821 } | |
1822 else if (b == 0) { | |
1823 balance_msg = g_strdup_printf(_("BALANCE: CENTER")); | |
1824 input_set_volume(v, v); | |
1825 } | |
1826 else { /* b > 0 */ | |
1827 balance_msg = g_strdup_printf(_("BALANCE: %d%% RIGHT"), b); | |
1828 input_set_volume((gint) rint(((100 - b) / 100.0) * v), v); | |
1829 } | |
1830 mainwin_lock_info_text(balance_msg); | |
1831 g_free(balance_msg); | |
1832 } | |
1833 | |
1834 void | |
1835 mainwin_adjust_balance_release(void) | |
1836 { | |
1837 mainwin_release_info_text(); | |
1838 setting_volume = FALSE; | |
1839 read_volume(VOLUME_ADJUSTED); | |
1840 } | |
1841 | |
1842 void | |
1843 mainwin_set_volume_slider(gint percent) | |
1844 { | |
1845 hslider_set_position(mainwin_volume, (gint) rint((percent * 51) / 100.0)); | |
1846 } | |
1847 | |
1848 void | |
1849 mainwin_set_balance_slider(gint percent) | |
1850 { | |
1851 hslider_set_position(mainwin_balance, | |
1852 (gint) rint(((percent * 12) / 100.0) + 12)); | |
1853 } | |
1854 | |
1855 void | |
1856 mainwin_volume_motion_cb(gint pos) | |
1857 { | |
1858 gint vol = (pos * 100) / 51; | |
1859 mainwin_adjust_volume_motion(vol); | |
1860 equalizerwin_set_volume_slider(vol); | |
1861 } | |
1862 | |
1863 void | |
1864 mainwin_volume_release_cb(gint pos) | |
1865 { | |
1866 mainwin_adjust_volume_release(); | |
1867 } | |
1868 | |
1869 gint | |
1870 mainwin_balance_frame_cb(gint pos) | |
1871 { | |
1872 return ((abs(pos - 12) * 28) / 13); | |
1873 } | |
1874 | |
1875 void | |
1876 mainwin_balance_motion_cb(gint pos) | |
1877 { | |
1878 gint bal = ((pos - 12) * 100) / 12; | |
1879 mainwin_adjust_balance_motion(bal); | |
1880 equalizerwin_set_balance_slider(bal); | |
1881 } | |
1882 | |
1883 void | |
1884 mainwin_balance_release_cb(gint pos) | |
1885 { | |
1886 mainwin_adjust_volume_release(); | |
1887 } | |
1888 | |
1889 void | |
1890 mainwin_set_volume_diff(gint diff) | |
1891 { | |
1892 gint vl, vr, vol; | |
1893 | |
1894 input_get_volume(&vl, &vr); | |
1895 vol = MAX(vl, vr); | |
1896 vol = CLAMP(vol + diff, 0, 100); | |
1897 | |
1898 mainwin_adjust_volume_motion(vol); | |
1899 setting_volume = FALSE; | |
1900 mainwin_set_volume_slider(vol); | |
1901 equalizerwin_set_volume_slider(vol); | |
1902 read_volume(VOLUME_SET); | |
1903 } | |
1904 | |
1905 void | |
1906 mainwin_set_balance_diff(gint diff) | |
1907 { | |
1908 gint b; | |
1909 b = CLAMP(balance + diff, -100, 100); | |
1910 mainwin_adjust_balance_motion(b); | |
1911 setting_volume = FALSE; | |
1912 mainwin_set_balance_slider(b); | |
1913 equalizerwin_set_balance_slider(b); | |
1914 read_volume(VOLUME_SET); | |
1915 } | |
1916 | |
1917 void | |
1918 mainwin_show(gboolean show) | |
1919 { | |
1920 if (show) | |
1921 mainwin_real_show(); | |
1922 else | |
1923 mainwin_real_hide(); | |
1924 } | |
1925 | |
1926 void | |
1927 mainwin_real_show(void) | |
1928 { | |
1929 cfg.player_visible = TRUE; | |
1930 | |
1931 check_set( toggleaction_group_others , "show player" , TRUE ); | |
1932 | |
1933 if (cfg.player_shaded) | |
1934 vis_clear_data(active_vis); | |
1935 | |
1936 mainwin_vis_set_active_vis(MAINWIN_VIS_ACTIVE_MAINWIN); | |
1937 mainwin_set_shape_mask(); | |
1938 | |
1939 if (cfg.show_wm_decorations) { | |
1940 if (!pposition_broken && cfg.player_x != -1 | |
1941 && cfg.save_window_position) | |
1942 gtk_window_move(GTK_WINDOW(mainwin), cfg.player_x, cfg.player_y); | |
1943 | |
1944 gtk_widget_show(mainwin); | |
1945 | |
1946 if (pposition_broken && cfg.player_x != -1 | |
1947 && cfg.save_window_position) | |
1948 gtk_window_move(GTK_WINDOW(mainwin), cfg.player_x, cfg.player_y); | |
1949 | |
1950 return; | |
1951 } | |
1952 | |
1953 gtk_widget_show_all(mainwin); | |
1954 | |
2345
0fb47429ad7e
[svn] - in mainwin_real_show, do not return if a nullmask doesn't exist
giacomo
parents:
2339
diff
changeset
|
1955 if (nullmask) |
0fb47429ad7e
[svn] - in mainwin_real_show, do not return if a nullmask doesn't exist
giacomo
parents:
2339
diff
changeset
|
1956 { |
0fb47429ad7e
[svn] - in mainwin_real_show, do not return if a nullmask doesn't exist
giacomo
parents:
2339
diff
changeset
|
1957 g_object_unref(nullmask); |
0fb47429ad7e
[svn] - in mainwin_real_show, do not return if a nullmask doesn't exist
giacomo
parents:
2339
diff
changeset
|
1958 nullmask = NULL; |
0fb47429ad7e
[svn] - in mainwin_real_show, do not return if a nullmask doesn't exist
giacomo
parents:
2339
diff
changeset
|
1959 } |
2313 | 1960 |
1961 gtk_window_resize(GTK_WINDOW(mainwin), | |
1962 !bmp_active_skin->properties.mainwin_width ? PLAYER_WIDTH : | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
1963 bmp_active_skin->properties.mainwin_width, |
2313 | 1964 !bmp_active_skin->properties.mainwin_height ? PLAYER_HEIGHT : |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
1965 bmp_active_skin->properties.mainwin_height); |
2313 | 1966 |
1967 draw_main_window(TRUE); | |
1968 | |
2651
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2646
diff
changeset
|
1969 if (cfg.player_x != -1 && cfg.save_window_position) |
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2646
diff
changeset
|
1970 gtk_window_move(GTK_WINDOW(mainwin), cfg.player_x, cfg.player_y); |
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2646
diff
changeset
|
1971 |
2313 | 1972 gtk_window_present(GTK_WINDOW(mainwin)); |
1973 } | |
1974 | |
1975 void | |
1976 mainwin_real_hide(void) | |
1977 { | |
1978 GdkGC *gc; | |
1979 GdkColor pattern; | |
1980 | |
1981 check_set( toggleaction_group_others , "show player", FALSE); | |
1982 | |
1983 if (cfg.player_shaded) | |
1984 svis_clear_data(mainwin_svis); | |
1985 | |
1986 if (!cfg.show_wm_decorations) { | |
1987 nullmask = gdk_pixmap_new(mainwin->window, 20, 20, 1); | |
1988 gc = gdk_gc_new(nullmask); | |
1989 pattern.pixel = 0; | |
1990 gdk_gc_set_foreground(gc, &pattern); | |
1991 gdk_draw_rectangle(nullmask, gc, TRUE, 0, 0, 20, 20); | |
1992 g_object_unref(gc); | |
1993 gtk_widget_shape_combine_mask(mainwin, nullmask, 0, 0); | |
1994 } | |
1995 | |
1996 gtk_widget_hide(mainwin); | |
1997 | |
1998 mainwin_vis_set_active_vis(MAINWIN_VIS_ACTIVE_PLAYLISTWIN); | |
1999 cfg.player_visible = FALSE; | |
2000 } | |
2001 | |
2002 | |
2003 void | |
2004 mainwin_set_stopaftersong(gboolean stop) | |
2005 { | |
2006 cfg.stopaftersong = stop; | |
2007 check_set(toggleaction_group_others, "stop after current song", cfg.stopaftersong); | |
2008 } | |
2009 | |
2769
bf2d80abf76e
[svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents:
2717
diff
changeset
|
2010 void |
bf2d80abf76e
[svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents:
2717
diff
changeset
|
2011 mainwin_set_noplaylistadvance(gboolean no_advance) |
bf2d80abf76e
[svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents:
2717
diff
changeset
|
2012 { |
bf2d80abf76e
[svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents:
2717
diff
changeset
|
2013 cfg.no_playlist_advance = no_advance; |
bf2d80abf76e
[svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents:
2717
diff
changeset
|
2014 check_set(toggleaction_group_others, "playback no playlist advance", cfg.no_playlist_advance); |
bf2d80abf76e
[svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents:
2717
diff
changeset
|
2015 } |
2313 | 2016 |
2017 static void | |
2018 mainwin_set_doublesize(gboolean doublesize) | |
2019 { | |
2020 gint height; | |
2021 | |
2022 if (cfg.player_shaded) | |
2023 height = MAINWIN_SHADED_HEIGHT; | |
2024 else | |
2025 height = bmp_active_skin->properties.mainwin_height; | |
2026 | |
2027 mainwin_set_shape_mask(); | |
2028 | |
2029 dock_window_resize(GTK_WINDOW(mainwin), cfg.player_shaded ? MAINWIN_SHADED_WIDTH : bmp_active_skin->properties.mainwin_width, | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
2030 cfg.player_shaded ? MAINWIN_SHADED_HEIGHT : bmp_active_skin->properties.mainwin_height, |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
2031 bmp_active_skin->properties.mainwin_width * 2, bmp_active_skin->properties.mainwin_height * 2); |
2313 | 2032 |
2033 if (cfg.doublesize) { | |
2034 gdk_window_set_back_pixmap(mainwin->window, mainwin_bg_x2, 0); | |
2035 } | |
2036 else { | |
2037 gdk_window_set_back_pixmap(mainwin->window, mainwin_bg, 0); | |
2038 } | |
2039 | |
2821 | 2040 GList *iter; |
2041 for (iter = GTK_FIXED (SKINNED_WINDOW(mainwin)->fixed)->children; iter; iter = g_list_next (iter)) { | |
2042 GtkFixedChild *child_data = (GtkFixedChild *) iter->data; | |
2043 GtkWidget *child = child_data->widget; | |
2827 | 2044 g_signal_emit_by_name(child, "toggle-double-size"); |
2821 | 2045 } |
2046 | |
2313 | 2047 draw_main_window(TRUE); |
2048 vis_set_doublesize(mainwin_vis, doublesize); | |
2049 } | |
2050 | |
2051 void | |
2052 set_doublesize(gboolean doublesize) | |
2053 { | |
2054 cfg.doublesize = doublesize; | |
2055 | |
2056 mainwin_set_doublesize(doublesize); | |
2057 | |
2058 if (cfg.eq_doublesize_linked) | |
2059 equalizerwin_set_doublesize(doublesize); | |
2060 } | |
2061 | |
2062 | |
2063 | |
2064 void | |
2065 mainwin_general_menu_callback(gpointer data, | |
2066 guint action, | |
2067 GtkWidget * item) | |
2068 { | |
2069 Playlist *playlist = playlist_get_active(); | |
2070 | |
2071 switch (action) { | |
2072 case MAINWIN_GENERAL_PREFS: | |
2073 show_prefs_window(); | |
2074 break; | |
2075 case MAINWIN_GENERAL_ABOUT: | |
2076 show_about_window(); | |
2077 break; | |
2078 case MAINWIN_GENERAL_PLAYFILE: | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
2079 run_filebrowser(NO_PLAY_BUTTON); |
2313 | 2080 break; |
2081 case MAINWIN_GENERAL_PLAYCD: | |
2082 play_medium(); | |
2083 break; | |
2084 case MAINWIN_GENERAL_ADDCD: | |
2085 add_medium(); | |
2086 break; | |
2087 case MAINWIN_GENERAL_PLAYLOCATION: | |
2088 mainwin_show_add_url_window(); | |
2089 break; | |
2090 case MAINWIN_GENERAL_FILEINFO: | |
2091 playlist_fileinfo_current(playlist); | |
2092 break; | |
2093 case MAINWIN_GENERAL_FOCUSPLWIN: | |
2094 gtk_window_present(GTK_WINDOW(playlistwin)); | |
2095 break; | |
2096 case MAINWIN_GENERAL_SHOWMWIN: | |
2097 mainwin_show(GTK_CHECK_MENU_ITEM(item)->active); | |
2098 break; | |
2099 case MAINWIN_GENERAL_SHOWPLWIN: | |
2100 if (GTK_CHECK_MENU_ITEM(item)->active) | |
2101 playlistwin_show(); | |
2102 else | |
2103 playlistwin_hide(); | |
2104 break; | |
2105 case MAINWIN_GENERAL_SHOWEQWIN: | |
2106 if (GTK_CHECK_MENU_ITEM(item)->active) | |
2107 equalizerwin_real_show(); | |
2108 else | |
2109 equalizerwin_real_hide(); | |
2110 break; | |
2111 case MAINWIN_GENERAL_PREV: | |
2112 playlist_prev(playlist); | |
2113 break; | |
2114 case MAINWIN_GENERAL_PLAY: | |
2115 mainwin_play_pushed(); | |
2116 break; | |
2117 case MAINWIN_GENERAL_PAUSE: | |
2118 playback_pause(); | |
2119 break; | |
2120 case MAINWIN_GENERAL_STOP: | |
2121 mainwin_stop_pushed(); | |
2122 break; | |
2123 case MAINWIN_GENERAL_NEXT: | |
2124 playlist_next(playlist); | |
2125 break; | |
2126 case MAINWIN_GENERAL_BACK5SEC: | |
2127 if (playback_get_playing() | |
2128 && playlist_get_current_length(playlist) != -1) | |
2129 playback_seek_relative(-5); | |
2130 break; | |
2131 case MAINWIN_GENERAL_FWD5SEC: | |
2132 if (playback_get_playing() | |
2133 && playlist_get_current_length(playlist) != -1) | |
2134 playback_seek_relative(5); | |
2135 break; | |
2136 case MAINWIN_GENERAL_START: | |
2137 playlist_set_position(playlist, 0); | |
2138 break; | |
2139 case MAINWIN_GENERAL_JTT: | |
2140 mainwin_jump_to_time(); | |
2141 break; | |
2142 case MAINWIN_GENERAL_JTF: | |
2500 | 2143 ui_jump_to_track(); |
2313 | 2144 break; |
2145 case MAINWIN_GENERAL_EXIT: | |
2146 mainwin_quit_cb(); | |
2147 break; | |
2148 case MAINWIN_GENERAL_SETAB: | |
2149 if (playlist_get_current_length(playlist) != -1) { | |
2150 if (ab_position_a == -1) { | |
2151 ab_position_a = playback_get_time(); | |
2152 ab_position_b = -1; | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
2153 mainwin_lock_info_text("LOOP-POINT A POSITION SET."); |
2313 | 2154 } else if (ab_position_b == -1) { |
2155 int time = playback_get_time(); | |
2156 if (time > ab_position_a) | |
2157 ab_position_b = time; | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
2158 mainwin_release_info_text(); |
2313 | 2159 } else { |
2160 ab_position_a = playback_get_time(); | |
2161 ab_position_b = -1; | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
2162 mainwin_lock_info_text("LOOP-POINT A POSITION RESET."); |
2313 | 2163 } |
2164 } | |
2165 break; | |
2166 case MAINWIN_GENERAL_CLEARAB: | |
2167 if (playlist_get_current_length(playlist) != -1) { | |
2168 ab_position_a = ab_position_b = -1; | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
2169 mainwin_release_info_text(); |
2313 | 2170 } |
2171 break; | |
2172 case MAINWIN_GENERAL_NEW_PL: | |
2173 { | |
2174 Playlist *new_pl = playlist_new(); | |
2175 playlist_add_playlist(new_pl); | |
2176 playlist_select_playlist(new_pl); | |
2177 } | |
2178 break; | |
2179 case MAINWIN_GENERAL_PREV_PL: | |
2180 playlist_select_prev(); | |
2181 break; | |
2182 case MAINWIN_GENERAL_NEXT_PL: | |
2183 playlist_select_next(); | |
2184 break; | |
2185 } | |
2186 } | |
2187 | |
2188 static void | |
2189 mainwin_mr_change(MenuRowItem i) | |
2190 { | |
2191 switch (i) { | |
2192 case MENUROW_NONE: | |
2193 mainwin_set_info_text(); | |
2194 break; | |
2195 case MENUROW_OPTIONS: | |
2196 mainwin_lock_info_text(_("OPTIONS MENU")); | |
2197 break; | |
2198 case MENUROW_ALWAYS: | |
2199 if (mainwin_menurow->mr_always_selected) | |
2200 mainwin_lock_info_text(_("DISABLE ALWAYS ON TOP")); | |
2201 else | |
2202 mainwin_lock_info_text(_("ENABLE ALWAYS ON TOP")); | |
2203 break; | |
2204 case MENUROW_FILEINFOBOX: | |
2205 mainwin_lock_info_text(_("FILE INFO BOX")); | |
2206 break; | |
2207 case MENUROW_DOUBLESIZE: | |
2208 if (mainwin_menurow->mr_doublesize_selected) | |
2209 mainwin_lock_info_text(_("DISABLE DOUBLESIZE")); | |
2210 else | |
2211 mainwin_lock_info_text(_("ENABLE DOUBLESIZE")); | |
2212 break; | |
2213 case MENUROW_VISUALIZATION: | |
2214 mainwin_lock_info_text(_("VISUALIZATION MENU")); | |
2215 break; | |
2216 } | |
2217 } | |
2218 | |
2219 static void | |
2220 mainwin_mr_release(MenuRowItem i) | |
2221 { | |
2222 GdkModifierType modmask; | |
2223 gint x, y; | |
2224 | |
2225 switch (i) { | |
2226 case MENUROW_OPTIONS: | |
2227 gdk_window_get_pointer(NULL, &x, &y, &modmask); | |
2228 ui_manager_popup_menu_show(GTK_MENU(mainwin_view_menu), x, y, 1, | |
2229 GDK_CURRENT_TIME); | |
2230 break; | |
2231 case MENUROW_ALWAYS: | |
2232 gtk_toggle_action_set_active( | |
2233 GTK_TOGGLE_ACTION(gtk_action_group_get_action( | |
2234 toggleaction_group_others , "view always on top" )) , | |
2235 mainwin_menurow->mr_always_selected ); | |
2236 break; | |
2237 case MENUROW_FILEINFOBOX: | |
2238 playlist_fileinfo_current(playlist_get_active()); | |
2239 break; | |
2240 case MENUROW_DOUBLESIZE: | |
2241 gtk_toggle_action_set_active( | |
2242 GTK_TOGGLE_ACTION(gtk_action_group_get_action( | |
2243 toggleaction_group_others , "view doublesize" )) , | |
2244 mainwin_menurow->mr_doublesize_selected ); | |
2245 break; | |
2246 case MENUROW_VISUALIZATION: | |
2247 gdk_window_get_pointer(NULL, &x, &y, &modmask); | |
2248 ui_manager_popup_menu_show(GTK_MENU(mainwin_visualization_menu), x, y, 1, GDK_CURRENT_TIME); | |
2249 break; | |
2250 case MENUROW_NONE: | |
2251 break; | |
2252 } | |
2253 mainwin_release_info_text(); | |
2254 } | |
2255 | |
2256 static void | |
2257 run_no_audiocd_dialog(void) | |
2258 { | |
2259 const gchar *markup = | |
2260 N_("<b><big>No playable CD found.</big></b>\n\n" | |
2261 "No CD inserted, or inserted CD is not an audio CD.\n"); | |
2262 | |
2263 GtkWidget *dialog = | |
2264 gtk_message_dialog_new_with_markup(GTK_WINDOW(mainwin), | |
2265 GTK_DIALOG_DESTROY_WITH_PARENT, | |
2266 GTK_MESSAGE_ERROR, | |
2267 GTK_BUTTONS_OK, | |
2268 _(markup)); | |
2269 gtk_dialog_run(GTK_DIALOG(dialog)); | |
2270 gtk_widget_destroy(dialog); | |
2271 } | |
2272 | |
2273 static void | |
2274 run_no_output_device_dialog(void) | |
2275 { | |
2276 const gchar *markup = | |
2277 N_("<b><big>Couldn't open audio.</big></b>\n\n" | |
2278 "Please check that:\n" | |
2279 "1. You have the correct output plugin selected.\n" | |
2280 "2. No other programs is blocking the soundcard.\n" | |
2281 "3. Your soundcard is configured properly.\n"); | |
2282 | |
2283 GtkWidget *dialog = | |
2284 gtk_message_dialog_new_with_markup(GTK_WINDOW(mainwin), | |
2285 GTK_DIALOG_DESTROY_WITH_PARENT, | |
2286 GTK_MESSAGE_ERROR, | |
2287 GTK_BUTTONS_OK, | |
2288 _(markup)); | |
2289 gtk_dialog_run(GTK_DIALOG(dialog)); | |
2290 gtk_widget_destroy(dialog); | |
2291 } | |
2292 | |
2293 | |
2294 void | |
2295 add_medium(void) | |
2296 { | |
2297 GList *list, *node; | |
2298 gchar *filename; | |
2299 gchar *path; | |
2300 ConfigDb *db; | |
2301 | |
2302 db = bmp_cfg_db_open(); | |
2303 | |
2478
54bea5c43ed8
[svn] - prevent player from crashing when bmp_cfg_db_get_string(db, CDDA, directory, &path) in add_medium returns FALSE
giacomo
parents:
2422
diff
changeset
|
2304 if ( bmp_cfg_db_get_string(db, "CDDA", "directory", &path) != TRUE ) |
54bea5c43ed8
[svn] - prevent player from crashing when bmp_cfg_db_get_string(db, CDDA, directory, &path) in add_medium returns FALSE
giacomo
parents:
2422
diff
changeset
|
2305 { |
54bea5c43ed8
[svn] - prevent player from crashing when bmp_cfg_db_get_string(db, CDDA, directory, &path) in add_medium returns FALSE
giacomo
parents:
2422
diff
changeset
|
2306 bmp_cfg_db_close(db); |
54bea5c43ed8
[svn] - prevent player from crashing when bmp_cfg_db_get_string(db, CDDA, directory, &path) in add_medium returns FALSE
giacomo
parents:
2422
diff
changeset
|
2307 run_no_audiocd_dialog(); |
54bea5c43ed8
[svn] - prevent player from crashing when bmp_cfg_db_get_string(db, CDDA, directory, &path) in add_medium returns FALSE
giacomo
parents:
2422
diff
changeset
|
2308 return; |
54bea5c43ed8
[svn] - prevent player from crashing when bmp_cfg_db_get_string(db, CDDA, directory, &path) in add_medium returns FALSE
giacomo
parents:
2422
diff
changeset
|
2309 } |
54bea5c43ed8
[svn] - prevent player from crashing when bmp_cfg_db_get_string(db, CDDA, directory, &path) in add_medium returns FALSE
giacomo
parents:
2422
diff
changeset
|
2310 else |
54bea5c43ed8
[svn] - prevent player from crashing when bmp_cfg_db_get_string(db, CDDA, directory, &path) in add_medium returns FALSE
giacomo
parents:
2422
diff
changeset
|
2311 bmp_cfg_db_close(db); |
2313 | 2312 |
2313 if (!(list = input_scan_dir(path))) { | |
2314 run_no_audiocd_dialog(); | |
2315 return; | |
2316 } | |
2317 | |
2318 for (node = list; node; node = g_list_next(node)) { | |
2319 filename = g_build_filename(path, node->data, NULL); | |
2320 playlist_add(playlist_get_active(), filename); | |
2321 g_free(filename); | |
2322 g_free(node->data); | |
2323 } | |
2324 | |
2325 g_free(path); | |
2326 g_list_free(list); | |
2327 | |
2328 } | |
2329 | |
2330 void | |
2331 play_medium(void) | |
2332 { | |
2333 GList *list, *node; | |
2334 gchar *filename; | |
2335 gchar *path; | |
2336 ConfigDb *db; | |
2337 Playlist *playlist = playlist_get_active(); | |
2338 | |
2339 db = bmp_cfg_db_open(); | |
2340 bmp_cfg_db_get_string(db, "CDDA", "directory", &path); | |
2341 bmp_cfg_db_close(db); | |
2342 | |
2343 if (!(list = input_scan_dir(path))) { | |
2344 run_no_audiocd_dialog(); | |
2345 return; | |
2346 } | |
2347 | |
2348 playlist_clear(playlist); | |
2349 | |
2350 for (node = list; node; node = g_list_next(node)) { | |
2351 filename = g_build_filename(path, node->data, NULL); | |
2352 playlist_add(playlist, filename); | |
2353 g_free(filename); | |
2354 g_free(node->data); | |
2355 } | |
2356 | |
2357 g_free(path); | |
2358 g_list_free(list); | |
2359 | |
2360 playlist_set_position(playlist, 0); | |
2361 playback_initiate(); | |
2362 } | |
2363 | |
2364 void | |
2365 read_volume(gint when) | |
2366 { | |
2367 static gint pvl = 0, pvr = 0; | |
2368 static gint times = VOLSET_DISP_TIMES; | |
2369 static gboolean changing = FALSE; | |
2370 | |
2371 gint vl, vr, b, v; | |
2372 | |
2373 input_get_volume(&vl, &vr); | |
2374 | |
2375 switch (when) { | |
2376 case VOLSET_STARTUP: | |
2377 vl = CLAMP(vl, 0, 100); | |
2378 vr = CLAMP(vr, 0, 100); | |
2379 pvl = vl; | |
2380 pvr = vr; | |
2381 v = MAX(vl, vr); | |
2382 if (vl > vr) | |
2383 b = (gint) rint(((gdouble) vr / vl) * 100) - 100; | |
2384 else if (vl < vr) | |
2385 b = 100 - (gint) rint(((gdouble) vl / vr) * 100); | |
2386 else | |
2387 b = 0; | |
2388 | |
2389 balance = b; | |
2390 mainwin_set_volume_slider(v); | |
2391 equalizerwin_set_volume_slider(v); | |
2392 mainwin_set_balance_slider(b); | |
2393 equalizerwin_set_balance_slider(b); | |
2394 return; | |
2395 | |
2396 case VOLSET_UPDATE: | |
2397 if (vl == -1 || vr == -1) | |
2398 return; | |
2399 | |
2400 if (setting_volume) { | |
2401 pvl = vl; | |
2402 pvr = vr; | |
2403 return; | |
2404 } | |
2405 | |
2406 if (pvr == vr && pvl == vl && changing) { | |
2407 if (times < VOLSET_DISP_TIMES) | |
2408 times++; | |
2409 else { | |
2410 mainwin_release_info_text(); | |
2411 changing = FALSE; | |
2412 } | |
2413 } | |
2414 else if (pvr != vr || pvl != vl) { | |
2415 gchar *tmp; | |
2416 | |
2417 v = MAX(vl, vr); | |
2418 if (vl > vr) | |
2419 b = (gint) rint(((gdouble) vr / vl) * 100) - 100; | |
2420 else if (vl < vr) | |
2421 b = 100 - (gint) rint(((gdouble) vl / vr) * 100); | |
2422 else | |
2423 b = 0; | |
2424 | |
2425 if (MAX(vl, vr) != MAX(pvl, pvr)) | |
2426 tmp = g_strdup_printf(_("VOLUME: %d%%"), v); | |
2427 else { | |
2428 if (vl > vr) { | |
2429 tmp = g_strdup_printf(_("BALANCE: %d%% LEFT"), -b); | |
2430 } | |
2431 else if (vr == vl) | |
2432 tmp = g_strdup_printf(_("BALANCE: CENTER")); | |
2433 else { /* (vl < vr) */ | |
2434 tmp = g_strdup_printf(_("BALANCE: %d%% RIGHT"), b); | |
2435 } | |
2436 } | |
2437 mainwin_lock_info_text(tmp); | |
2438 g_free(tmp); | |
2439 | |
2440 pvr = vr; | |
2441 pvl = vl; | |
2442 times = 0; | |
2443 changing = TRUE; | |
2444 mainwin_set_volume_slider(v); | |
2445 equalizerwin_set_volume_slider(v); | |
2446 | |
2447 /* Don't change the balance slider if the volume has been | |
2448 * set to zero. The balance can be anything, and our best | |
2449 * guess is what is was before. */ | |
2450 if (v > 0) { | |
2451 balance = b; | |
2452 mainwin_set_balance_slider(b); | |
2453 equalizerwin_set_balance_slider(b); | |
2454 } | |
2455 } | |
2456 break; | |
2457 | |
2458 case VOLUME_ADJUSTED: | |
2459 pvl = vl; | |
2460 pvr = vr; | |
2461 break; | |
2462 | |
2463 case VOLUME_SET: | |
2464 times = 0; | |
2465 changing = TRUE; | |
2466 pvl = vl; | |
2467 pvr = vr; | |
2468 break; | |
2469 } | |
2470 } | |
2471 | |
2472 | |
2473 /* TODO: HAL! */ | |
2474 gboolean | |
2475 can_play_cd(void) | |
2476 { | |
2477 GList *ilist; | |
2478 | |
2479 for (ilist = get_input_list(); ilist; ilist = g_list_next(ilist)) { | |
2480 InputPlugin *ip = INPUT_PLUGIN(ilist->data); | |
2481 | |
2482 if (!g_ascii_strcasecmp(g_basename(ip->filename), | |
2483 PLUGIN_FILENAME("cdaudio"))) { | |
2484 return TRUE; | |
2485 } | |
2486 } | |
2487 | |
2488 return FALSE; | |
2489 } | |
2490 | |
2491 | |
2492 static void | |
2493 set_timer_mode(TimerMode mode) | |
2494 { | |
2495 if (mode == TIMER_ELAPSED) | |
2496 check_set(radioaction_group_viewtime, "view time elapsed", TRUE); | |
2497 else | |
2498 check_set(radioaction_group_viewtime, "view time remaining", TRUE); | |
2499 } | |
2500 | |
2501 static void | |
2502 set_timer_mode_menu_cb(TimerMode mode) | |
2503 { | |
2504 cfg.timer_mode = mode; | |
2505 } | |
2506 | |
2507 static void | |
2508 mainwin_playlist_prev(void) | |
2509 { | |
2510 playlist_prev(playlist_get_active()); | |
2511 } | |
2512 | |
2513 static void | |
2514 mainwin_playlist_next(void) | |
2515 { | |
2516 playlist_next(playlist_get_active()); | |
2517 } | |
2518 | |
2519 void | |
2520 mainwin_setup_menus(void) | |
2521 { | |
2522 set_timer_mode(cfg.timer_mode); | |
2523 | |
2524 /* View menu */ | |
2525 | |
2526 check_set(toggleaction_group_others, "view always on top", cfg.always_on_top); | |
2527 check_set(toggleaction_group_others, "view put on all workspaces", cfg.sticky); | |
2528 check_set(toggleaction_group_others, "roll up player", cfg.player_shaded); | |
2529 check_set(toggleaction_group_others, "roll up playlist editor", cfg.playlist_shaded); | |
2530 check_set(toggleaction_group_others, "roll up equalizer", cfg.equalizer_shaded); | |
2531 check_set(toggleaction_group_others, "view easy move", cfg.easy_move); | |
2532 check_set(toggleaction_group_others, "view doublesize", cfg.doublesize); | |
2533 | |
2534 /* Songname menu */ | |
2535 | |
2536 check_set(toggleaction_group_others, "autoscroll songname", cfg.autoscroll); | |
2537 check_set(toggleaction_group_others, "stop after current song", cfg.stopaftersong); | |
2538 | |
2539 /* Playback menu */ | |
2540 | |
2541 check_set(toggleaction_group_others, "playback repeat", cfg.repeat); | |
2542 check_set(toggleaction_group_others, "playback shuffle", cfg.shuffle); | |
2543 check_set(toggleaction_group_others, "playback no playlist advance", cfg.no_playlist_advance); | |
2544 | |
2545 /* Visualization menu */ | |
2546 | |
2547 switch ( cfg.vis_type ) | |
2548 { | |
2549 case VIS_ANALYZER: | |
2550 check_set(radioaction_group_vismode, "vismode analyzer", TRUE); | |
2551 break; | |
2552 case VIS_SCOPE: | |
2553 check_set(radioaction_group_vismode, "vismode scope", TRUE); | |
2554 break; | |
2555 case VIS_VOICEPRINT: | |
2556 check_set(radioaction_group_vismode, "vismode voiceprint", TRUE); | |
2557 break; | |
2558 case VIS_OFF: | |
2559 default: | |
2560 check_set(radioaction_group_vismode, "vismode off", TRUE); | |
2561 break; | |
2562 } | |
2563 | |
2564 switch ( cfg.analyzer_mode ) | |
2565 { | |
2566 case ANALYZER_FIRE: | |
2567 check_set(radioaction_group_anamode, "anamode fire", TRUE); | |
2568 break; | |
2569 case ANALYZER_VLINES: | |
2570 check_set(radioaction_group_anamode, "anamode vertical lines", TRUE); | |
2571 break; | |
2572 case ANALYZER_NORMAL: | |
2573 default: | |
2574 check_set(radioaction_group_anamode, "anamode normal", TRUE); | |
2575 break; | |
2576 } | |
2577 | |
2578 switch ( cfg.analyzer_type ) | |
2579 { | |
2580 case ANALYZER_BARS: | |
2581 check_set(radioaction_group_anatype, "anatype bars", TRUE); | |
2582 break; | |
2583 case ANALYZER_LINES: | |
2584 default: | |
2585 check_set(radioaction_group_anatype, "anatype lines", TRUE); | |
2586 break; | |
2587 } | |
2588 | |
2589 check_set(toggleaction_group_others, "anamode peaks", cfg.analyzer_peaks ); | |
2590 | |
2591 switch ( cfg.scope_mode ) | |
2592 { | |
2593 case SCOPE_LINE: | |
2594 check_set(radioaction_group_scomode, "scomode line", TRUE); | |
2595 break; | |
2596 case SCOPE_SOLID: | |
2597 check_set(radioaction_group_scomode, "scomode solid", TRUE); | |
2598 break; | |
2599 case SCOPE_DOT: | |
2600 default: | |
2601 check_set(radioaction_group_scomode, "scomode dot", TRUE); | |
2602 break; | |
2603 } | |
2604 | |
2605 switch ( cfg.voiceprint_mode ) | |
2606 { | |
2607 case VOICEPRINT_FIRE: | |
2608 check_set(radioaction_group_vprmode, "vprmode fire", TRUE); | |
2609 break; | |
2610 case VOICEPRINT_ICE: | |
2611 check_set(radioaction_group_vprmode, "vprmode ice", TRUE); | |
2612 break; | |
2613 case VOICEPRINT_NORMAL: | |
2614 default: | |
2615 check_set(radioaction_group_vprmode, "vprmode normal", TRUE); | |
2616 break; | |
2617 } | |
2618 | |
2619 switch ( cfg.vu_mode ) | |
2620 { | |
2621 case VU_SMOOTH: | |
2622 check_set(radioaction_group_wshmode, "wshmode smooth", TRUE); | |
2623 break; | |
2624 case VU_NORMAL: | |
2625 default: | |
2626 check_set(radioaction_group_wshmode, "wshmode normal", TRUE); | |
2627 break; | |
2628 } | |
2629 | |
2630 switch ( cfg.vis_refresh ) | |
2631 { | |
2632 case REFRESH_HALF: | |
2633 check_set(radioaction_group_refrate, "refrate half", TRUE); | |
2634 break; | |
2635 case REFRESH_QUARTER: | |
2636 check_set(radioaction_group_refrate, "refrate quarter", TRUE); | |
2637 break; | |
2638 case REFRESH_EIGTH: | |
2639 check_set(radioaction_group_refrate, "refrate eighth", TRUE); | |
2640 break; | |
2641 case REFRESH_FULL: | |
2642 default: | |
2643 check_set(radioaction_group_refrate, "refrate full", TRUE); | |
2644 break; | |
2645 } | |
2646 | |
2647 switch ( cfg.analyzer_falloff ) | |
2648 { | |
2649 case FALLOFF_SLOW: | |
2650 check_set(radioaction_group_anafoff, "anafoff slow", TRUE); | |
2651 break; | |
2652 case FALLOFF_MEDIUM: | |
2653 check_set(radioaction_group_anafoff, "anafoff medium", TRUE); | |
2654 break; | |
2655 case FALLOFF_FAST: | |
2656 check_set(radioaction_group_anafoff, "anafoff fast", TRUE); | |
2657 break; | |
2658 case FALLOFF_FASTEST: | |
2659 check_set(radioaction_group_anafoff, "anafoff fastest", TRUE); | |
2660 break; | |
2661 case FALLOFF_SLOWEST: | |
2662 default: | |
2663 check_set(radioaction_group_anafoff, "anafoff slowest", TRUE); | |
2664 break; | |
2665 } | |
2666 | |
2667 switch ( cfg.peaks_falloff ) | |
2668 { | |
2669 case FALLOFF_SLOW: | |
2670 check_set(radioaction_group_peafoff, "peafoff slow", TRUE); | |
2671 break; | |
2672 case FALLOFF_MEDIUM: | |
2673 check_set(radioaction_group_peafoff, "peafoff medium", TRUE); | |
2674 break; | |
2675 case FALLOFF_FAST: | |
2676 check_set(radioaction_group_peafoff, "peafoff fast", TRUE); | |
2677 break; | |
2678 case FALLOFF_FASTEST: | |
2679 check_set(radioaction_group_peafoff, "peafoff fastest", TRUE); | |
2680 break; | |
2681 case FALLOFF_SLOWEST: | |
2682 default: | |
2683 check_set(radioaction_group_peafoff, "peafoff slowest", TRUE); | |
2684 break; | |
2685 } | |
2686 | |
2687 } | |
2688 | |
2689 static void | |
2690 mainwin_create_widgets(void) | |
2691 { | |
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2840
diff
changeset
|
2692 mainwin_menubtn = ui_skinned_button_new(); |
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2840
diff
changeset
|
2693 ui_skinned_push_button_setup(mainwin_menubtn, SKINNED_WINDOW(mainwin)->fixed, mainwin_bg, |
2821 | 2694 SKINNED_WINDOW(mainwin)->gc, 6, 3, 9, 9, 0, 0, 0, 9, SKIN_TITLEBAR); |
2695 g_signal_connect(mainwin_menubtn, "clicked", mainwin_menubtn_cb, NULL ); | |
2696 | |
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2840
diff
changeset
|
2697 mainwin_minimize = ui_skinned_button_new(); |
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2840
diff
changeset
|
2698 ui_skinned_push_button_setup(mainwin_minimize, SKINNED_WINDOW(mainwin)->fixed, mainwin_bg, |
2821 | 2699 SKINNED_WINDOW(mainwin)->gc, 244, 3, 9, 9, 9, 0, 9, 9, SKIN_TITLEBAR); |
2700 g_signal_connect(mainwin_minimize, "clicked", mainwin_minimize_cb, NULL ); | |
2701 | |
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2840
diff
changeset
|
2702 mainwin_shade = ui_skinned_button_new(); |
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2840
diff
changeset
|
2703 ui_skinned_push_button_setup(mainwin_shade, SKINNED_WINDOW(mainwin)->fixed, mainwin_bg, |
2821 | 2704 SKINNED_WINDOW(mainwin)->gc, 254, 3, 9, 9, 0, |
2705 cfg.player_shaded ? 27 : 18, 9, cfg.player_shaded ? 27 : 18, SKIN_TITLEBAR); | |
2706 g_signal_connect(mainwin_shade, "clicked", mainwin_shade_toggle, NULL ); | |
2707 | |
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2840
diff
changeset
|
2708 mainwin_close = ui_skinned_button_new(); |
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2840
diff
changeset
|
2709 ui_skinned_push_button_setup(mainwin_close, SKINNED_WINDOW(mainwin)->fixed, mainwin_bg, |
2821 | 2710 SKINNED_WINDOW(mainwin)->gc, 264, 3, 9, 9, 18, 0, 18, 9, SKIN_TITLEBAR); |
2711 g_signal_connect(mainwin_close, "clicked", mainwin_quit_cb, NULL ); | |
2712 | |
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2840
diff
changeset
|
2713 mainwin_rew = ui_skinned_button_new(); |
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2840
diff
changeset
|
2714 ui_skinned_push_button_setup(mainwin_rew, SKINNED_WINDOW(mainwin)->fixed, mainwin_bg, |
2821 | 2715 SKINNED_WINDOW(mainwin)->gc, 16, 88, 23, 18, 0, 0, 0, 18, SKIN_CBUTTONS); |
2716 g_signal_connect(mainwin_rew, "pressed", mainwin_rev_pushed, NULL); | |
2717 g_signal_connect(mainwin_rew, "released", mainwin_rev_release, NULL); | |
2718 | |
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2840
diff
changeset
|
2719 mainwin_fwd = ui_skinned_button_new(); |
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2840
diff
changeset
|
2720 ui_skinned_push_button_setup(mainwin_fwd, SKINNED_WINDOW(mainwin)->fixed, mainwin_bg, |
2821 | 2721 SKINNED_WINDOW(mainwin)->gc, 108, 88, 22, 18, 92, 0, 92, 18, SKIN_CBUTTONS); |
2722 g_signal_connect(mainwin_fwd, "pressed", mainwin_fwd_pushed, NULL); | |
2723 g_signal_connect(mainwin_fwd, "released", mainwin_fwd_release, NULL); | |
2724 | |
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2840
diff
changeset
|
2725 mainwin_play = ui_skinned_button_new(); |
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2840
diff
changeset
|
2726 ui_skinned_push_button_setup(mainwin_play, SKINNED_WINDOW(mainwin)->fixed, mainwin_bg, |
2821 | 2727 SKINNED_WINDOW(mainwin)->gc, 39, 88, 23, 18, 23, 0, 23, 18, SKIN_CBUTTONS); |
2728 g_signal_connect(mainwin_play, "clicked", mainwin_play_pushed, NULL ); | |
2729 | |
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2840
diff
changeset
|
2730 mainwin_pause = ui_skinned_button_new(); |
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2840
diff
changeset
|
2731 ui_skinned_push_button_setup(mainwin_pause, SKINNED_WINDOW(mainwin)->fixed, mainwin_bg, |
2821 | 2732 SKINNED_WINDOW(mainwin)->gc, 62, 88, 23, 18, 46, 0, 46, 18, SKIN_CBUTTONS); |
2733 g_signal_connect(mainwin_pause, "clicked", playback_pause, NULL ); | |
2734 | |
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2840
diff
changeset
|
2735 mainwin_stop = ui_skinned_button_new(); |
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2840
diff
changeset
|
2736 ui_skinned_push_button_setup(mainwin_stop, SKINNED_WINDOW(mainwin)->fixed, mainwin_bg, |
2821 | 2737 SKINNED_WINDOW(mainwin)->gc, 85, 88, 23, 18, 69, 0, 69, 18, SKIN_CBUTTONS); |
2738 g_signal_connect(mainwin_stop, "clicked", mainwin_stop_pushed, NULL ); | |
2739 | |
2842
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2840
diff
changeset
|
2740 mainwin_eject = ui_skinned_button_new(); |
c2622a939e9e
rename audacious_pbutton to ui_skinned_button
Tomasz Mon <desowin@gmail.com>
parents:
2840
diff
changeset
|
2741 ui_skinned_push_button_setup(mainwin_eject, SKINNED_WINDOW(mainwin)->fixed, mainwin_bg, |
2821 | 2742 SKINNED_WINDOW(mainwin)->gc, 136, 89, 22, 16, 114, 0, 114, 16, SKIN_CBUTTONS); |
2743 g_signal_connect(mainwin_eject, "clicked", mainwin_eject_pushed, NULL); | |
2313 | 2744 |
2745 mainwin_srew = | |
2525 | 2746 create_sbutton(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 169, 4, 8, |
2313 | 2747 7, mainwin_playlist_prev); |
2748 mainwin_splay = | |
2525 | 2749 create_sbutton(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 177, 4, 10, |
2313 | 2750 7, mainwin_play_pushed); |
2751 mainwin_spause = | |
2525 | 2752 create_sbutton(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 187, 4, 10, |
2313 | 2753 7, playback_pause); |
2754 mainwin_sstop = | |
2525 | 2755 create_sbutton(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 197, 4, 9, |
2313 | 2756 7, mainwin_stop_pushed); |
2757 mainwin_sfwd = | |
2525 | 2758 create_sbutton(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 206, 4, 8, |
2313 | 2759 7, mainwin_playlist_next); |
2760 mainwin_seject = | |
2525 | 2761 create_sbutton(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 216, 4, 9, |
2313 | 2762 7, mainwin_eject_pushed); |
2763 | |
2764 mainwin_shuffle = | |
2525 | 2765 create_tbutton(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 164, 89, 46, |
2313 | 2766 15, 28, 0, 28, 15, 28, 30, 28, 45, |
2767 mainwin_shuffle_pushed, SKIN_SHUFREP); | |
2768 | |
2769 mainwin_repeat = | |
2525 | 2770 create_tbutton(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 210, 89, 28, |
2313 | 2771 15, 0, 0, 0, 15, 0, 30, 0, 45, |
2772 mainwin_repeat_pushed, SKIN_SHUFREP); | |
2773 | |
2774 mainwin_eq = | |
2525 | 2775 create_tbutton(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 219, 58, 23, |
2313 | 2776 12, 0, 61, 46, 61, 0, 73, 46, 73, equalizerwin_show, |
2777 SKIN_SHUFREP); | |
2778 tbutton_set_toggled(mainwin_eq, cfg.equalizer_visible); | |
2779 mainwin_pl = | |
2525 | 2780 create_tbutton(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 242, 58, 23, |
2313 | 2781 12, 23, 61, 69, 61, 23, 73, 69, 73, |
2782 mainwin_pl_pushed, SKIN_SHUFREP); | |
2783 tbutton_set_toggled(mainwin_pl, cfg.playlist_visible); | |
2784 | |
2785 mainwin_info = | |
2525 | 2786 create_textbox(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 112, 27, |
2313 | 2787 153, 1, SKIN_TEXT); |
2788 textbox_set_scroll(mainwin_info, cfg.autoscroll); | |
2789 textbox_set_xfont(mainwin_info, cfg.mainwin_use_xfont, cfg.mainwin_font); | |
2790 | |
2791 mainwin_othertext = | |
2525 | 2792 create_textbox(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 112, 43, |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
2793 153, 1, SKIN_TEXT); |
2313 | 2794 |
2795 mainwin_rate_text = | |
2525 | 2796 create_textbox(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 111, 43, 15, |
2313 | 2797 0, SKIN_TEXT); |
2798 mainwin_freq_text = | |
2525 | 2799 create_textbox(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 156, 43, 10, |
2313 | 2800 0, SKIN_TEXT); |
2801 | |
2802 mainwin_menurow = | |
2525 | 2803 create_menurow(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 10, 22, 304, |
2313 | 2804 0, 304, 44, mainwin_mr_change, mainwin_mr_release, |
2805 SKIN_TITLEBAR); | |
2806 mainwin_menurow->mr_doublesize_selected = cfg.doublesize; | |
2807 mainwin_menurow->mr_always_selected = cfg.always_on_top; | |
2808 | |
2809 mainwin_volume = | |
2525 | 2810 create_hslider(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 107, 57, 68, |
2313 | 2811 13, 15, 422, 0, 422, 14, 11, 15, 0, 0, 51, |
2812 mainwin_volume_frame_cb, mainwin_volume_motion_cb, | |
2813 mainwin_volume_release_cb, SKIN_VOLUME); | |
2814 mainwin_balance = | |
2525 | 2815 create_hslider(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 177, 57, 38, |
2313 | 2816 13, 15, 422, 0, 422, 14, 11, 15, 9, 0, 24, |
2817 mainwin_balance_frame_cb, mainwin_balance_motion_cb, | |
2818 mainwin_balance_release_cb, SKIN_BALANCE); | |
2819 | |
2820 mainwin_monostereo = | |
2525 | 2821 create_monostereo(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 212, 41, |
2313 | 2822 SKIN_MONOSTEREO); |
2823 | |
2824 mainwin_playstatus = | |
2525 | 2825 create_playstatus(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 24, 28); |
2313 | 2826 |
2827 mainwin_minus_num = | |
2525 | 2828 create_number(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 36, 26, |
2313 | 2829 SKIN_NUMBERS); |
2830 widget_hide(WIDGET(mainwin_minus_num)); | |
2831 mainwin_10min_num = | |
2525 | 2832 create_number(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 48, 26, |
2313 | 2833 SKIN_NUMBERS); |
2834 widget_hide(WIDGET(mainwin_10min_num)); | |
2835 | |
2836 mainwin_min_num = | |
2525 | 2837 create_number(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 60, 26, |
2313 | 2838 SKIN_NUMBERS); |
2839 widget_hide(WIDGET(mainwin_min_num)); | |
2840 | |
2841 mainwin_10sec_num = | |
2525 | 2842 create_number(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 78, 26, |
2313 | 2843 SKIN_NUMBERS); |
2844 widget_hide(WIDGET(mainwin_10sec_num)); | |
2845 | |
2846 mainwin_sec_num = | |
2525 | 2847 create_number(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 90, 26, |
2313 | 2848 SKIN_NUMBERS); |
2849 widget_hide(WIDGET(mainwin_sec_num)); | |
2850 | |
2851 mainwin_about = | |
2525 | 2852 create_sbutton(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 247, 83, 20, |
2313 | 2853 25, show_about_window); |
2854 | |
2855 mainwin_vis = | |
2525 | 2856 create_vis(&mainwin_wlist, mainwin_bg, mainwin->window, SKINNED_WINDOW(mainwin)->gc, |
2313 | 2857 24, 43, 76, cfg.doublesize); |
2525 | 2858 mainwin_svis = create_svis(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 79, 5); |
2313 | 2859 active_vis = mainwin_vis; |
2860 | |
2861 mainwin_position = | |
2525 | 2862 create_hslider(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 16, 72, 248, |
2313 | 2863 10, 248, 0, 278, 0, 29, 10, 10, 0, 0, 219, NULL, |
2864 mainwin_position_motion_cb, | |
2865 mainwin_position_release_cb, SKIN_POSBAR); | |
2866 widget_hide(WIDGET(mainwin_position)); | |
2867 | |
2868 mainwin_sposition = | |
2525 | 2869 create_hslider(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 226, 4, 17, |
2313 | 2870 7, 17, 36, 17, 36, 3, 7, 36, 0, 1, 13, |
2871 mainwin_spos_frame_cb, mainwin_spos_motion_cb, | |
2872 mainwin_spos_release_cb, SKIN_TITLEBAR); | |
2873 widget_hide(WIDGET(mainwin_sposition)); | |
2874 | |
2875 mainwin_stime_min = | |
2525 | 2876 create_textbox(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 130, 4, 15, |
2313 | 2877 FALSE, SKIN_TEXT); |
2878 mainwin_stime_sec = | |
2525 | 2879 create_textbox(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 147, 4, 10, |
2313 | 2880 FALSE, SKIN_TEXT); |
2881 | |
2882 if (!cfg.player_shaded) { | |
2883 widget_hide(WIDGET(mainwin_svis)); | |
2884 widget_hide(WIDGET(mainwin_srew)); | |
2885 widget_hide(WIDGET(mainwin_splay)); | |
2886 widget_hide(WIDGET(mainwin_spause)); | |
2887 widget_hide(WIDGET(mainwin_sstop)); | |
2888 widget_hide(WIDGET(mainwin_sfwd)); | |
2889 widget_hide(WIDGET(mainwin_seject)); | |
2890 widget_hide(WIDGET(mainwin_stime_min)); | |
2891 widget_hide(WIDGET(mainwin_stime_sec)); | |
2892 } | |
2893 | |
2894 err = gtk_message_dialog_new(GTK_WINDOW(mainwin), GTK_DIALOG_DESTROY_WITH_PARENT|GTK_DIALOG_MODAL, | |
2895 GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, _("Error in Audacious.")); | |
2896 | |
2897 | |
2898 gtk_window_set_position(GTK_WINDOW(err), GTK_WIN_POS_CENTER); | |
2899 /* Dang well better set an error message or you'll see this */ | |
2900 gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(err), | |
2901 "Boo! Bad stuff! Booga Booga!"); | |
2902 | |
2496
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
2903 /* XXX: eventually update widgetcore API to not need this */ |
2821 | 2904 |
2496
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
2905 ui_skinned_window_widgetlist_associate(mainwin, WIDGET(mainwin_eject)); |
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
2906 |
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
2907 ui_skinned_window_widgetlist_associate(mainwin, WIDGET(mainwin_srew)); |
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
2908 ui_skinned_window_widgetlist_associate(mainwin, WIDGET(mainwin_splay)); |
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
2909 ui_skinned_window_widgetlist_associate(mainwin, WIDGET(mainwin_spause)); |
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
2910 ui_skinned_window_widgetlist_associate(mainwin, WIDGET(mainwin_sstop)); |
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
2911 ui_skinned_window_widgetlist_associate(mainwin, WIDGET(mainwin_sfwd)); |
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
2912 ui_skinned_window_widgetlist_associate(mainwin, WIDGET(mainwin_seject)); |
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
2913 |
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
2914 ui_skinned_window_widgetlist_associate(mainwin, WIDGET(mainwin_shuffle)); |
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
2915 ui_skinned_window_widgetlist_associate(mainwin, WIDGET(mainwin_repeat)); |
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
2916 |
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
2917 ui_skinned_window_widgetlist_associate(mainwin, WIDGET(mainwin_eq)); |
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
2918 ui_skinned_window_widgetlist_associate(mainwin, WIDGET(mainwin_pl)); |
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
2919 |
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
2920 ui_skinned_window_widgetlist_associate(mainwin, WIDGET(mainwin_info)); |
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
2921 ui_skinned_window_widgetlist_associate(mainwin, WIDGET(mainwin_othertext)); |
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
2922 |
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
2923 ui_skinned_window_widgetlist_associate(mainwin, WIDGET(mainwin_rate_text)); |
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
2924 ui_skinned_window_widgetlist_associate(mainwin, WIDGET(mainwin_freq_text)); |
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
2925 |
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
2926 ui_skinned_window_widgetlist_associate(mainwin, WIDGET(mainwin_menurow)); |
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
2927 |
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
2928 ui_skinned_window_widgetlist_associate(mainwin, WIDGET(mainwin_volume)); |
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
2929 ui_skinned_window_widgetlist_associate(mainwin, WIDGET(mainwin_balance)); |
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
2930 |
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
2931 ui_skinned_window_widgetlist_associate(mainwin, WIDGET(mainwin_monostereo)); |
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
2932 ui_skinned_window_widgetlist_associate(mainwin, WIDGET(mainwin_playstatus)); |
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
2933 |
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
2934 ui_skinned_window_widgetlist_associate(mainwin, WIDGET(mainwin_minus_num)); |
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
2935 ui_skinned_window_widgetlist_associate(mainwin, WIDGET(mainwin_10min_num)); |
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
2936 ui_skinned_window_widgetlist_associate(mainwin, WIDGET(mainwin_min_num)); |
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
2937 ui_skinned_window_widgetlist_associate(mainwin, WIDGET(mainwin_10sec_num)); |
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
2938 ui_skinned_window_widgetlist_associate(mainwin, WIDGET(mainwin_sec_num)); |
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
2939 |
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
2940 ui_skinned_window_widgetlist_associate(mainwin, WIDGET(mainwin_about)); |
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
2941 |
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
2942 ui_skinned_window_widgetlist_associate(mainwin, WIDGET(mainwin_vis)); |
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
2943 ui_skinned_window_widgetlist_associate(mainwin, WIDGET(mainwin_svis)); |
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
2944 |
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
2945 ui_skinned_window_widgetlist_associate(mainwin, WIDGET(mainwin_position)); |
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
2946 ui_skinned_window_widgetlist_associate(mainwin, WIDGET(mainwin_sposition)); |
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
2947 |
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
2948 ui_skinned_window_widgetlist_associate(mainwin, WIDGET(mainwin_stime_min)); |
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
2949 ui_skinned_window_widgetlist_associate(mainwin, WIDGET(mainwin_stime_sec)); |
2313 | 2950 } |
2951 | |
2952 static void | |
2953 mainwin_create_window(void) | |
2954 { | |
2955 gint width, height; | |
2956 | |
2515
319b10203d7c
[svn] gtk_window_set_wmclass() has to be called before gtk_widget_realize(). Patched by Christian "Joker" Birchinger from Gentoo.
chainsaw
parents:
2500
diff
changeset
|
2957 mainwin = ui_skinned_window_new(GTK_WINDOW_TOPLEVEL, "player"); |
2313 | 2958 gtk_window_set_title(GTK_WINDOW(mainwin), _("Audacious")); |
2959 gtk_window_set_role(GTK_WINDOW(mainwin), "player"); | |
2960 gtk_window_set_resizable(GTK_WINDOW(mainwin), FALSE); | |
2961 | |
2962 width = cfg.player_shaded ? MAINWIN_SHADED_WIDTH : bmp_active_skin->properties.mainwin_width; | |
2963 height = cfg.player_shaded ? MAINWIN_SHADED_HEIGHT : bmp_active_skin->properties.mainwin_height; | |
2964 | |
2965 if (cfg.doublesize) { | |
2966 width *= 2; | |
2967 height *= 2; | |
2968 } | |
2969 | |
2970 gtk_widget_set_size_request(mainwin, width, height); | |
2971 | |
2972 if (cfg.player_x != -1 && cfg.save_window_position) | |
2973 gtk_window_move(GTK_WINDOW(mainwin), cfg.player_x, cfg.player_y); | |
2974 | |
2975 g_signal_connect(mainwin, "destroy", G_CALLBACK(mainwin_destroy), NULL); | |
2976 g_signal_connect(mainwin, "button_press_event", | |
2977 G_CALLBACK(mainwin_mouse_button_press), NULL); | |
2978 g_signal_connect(mainwin, "scroll_event", | |
2979 G_CALLBACK(mainwin_scrolled), NULL); | |
2980 g_signal_connect(mainwin, "button_release_event", | |
2981 G_CALLBACK(mainwin_mouse_button_release), NULL); | |
2982 g_signal_connect(mainwin, "motion_notify_event", | |
2983 G_CALLBACK(mainwin_motion), NULL); | |
2984 g_signal_connect_after(mainwin, "focus_in_event", | |
2985 G_CALLBACK(mainwin_focus_in), NULL); | |
2986 g_signal_connect_after(mainwin, "focus_out_event", | |
2987 G_CALLBACK(mainwin_focus_out), NULL); | |
2988 g_signal_connect(mainwin, "configure_event", | |
2989 G_CALLBACK(mainwin_configure), NULL); | |
2990 g_signal_connect(mainwin, "style_set", | |
2991 G_CALLBACK(mainwin_set_back_pixmap), NULL); | |
2992 | |
2993 bmp_drag_dest_set(mainwin); | |
2994 | |
2995 g_signal_connect(mainwin, "key_press_event", | |
2996 G_CALLBACK(mainwin_keypress), NULL); | |
2997 } | |
2998 | |
2999 void | |
3000 mainwin_create(void) | |
3001 { | |
3002 mainwin_create_window(); | |
3003 | |
3004 gtk_window_add_accel_group( GTK_WINDOW(mainwin) , ui_manager_get_accel_group() ); | |
3005 | |
3006 mainwin_bg = gdk_pixmap_new(mainwin->window, | |
3007 bmp_active_skin->properties.mainwin_width, | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3008 bmp_active_skin->properties.mainwin_height, -1); |
2313 | 3009 mainwin_bg_x2 = gdk_pixmap_new(mainwin->window, |
3010 bmp_active_skin->properties.mainwin_width * 2, | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3011 bmp_active_skin->properties.mainwin_height * 2, -1); |
2313 | 3012 mainwin_set_back_pixmap(); |
3013 mainwin_create_widgets(); | |
3014 | |
3015 vis_set_window(mainwin_vis, mainwin->window); | |
3016 } | |
3017 | |
3018 void | |
3019 mainwin_attach_idle_func(void) | |
3020 { | |
3021 mainwin_timeout_id = g_timeout_add(MAINWIN_UPDATE_INTERVAL, | |
3022 mainwin_idle_func, NULL); | |
3023 } | |
3024 | |
3025 static void | |
3026 idle_func_update_song_info(gint time) | |
3027 { | |
3028 gint length, t; | |
3029 gchar stime_prefix; | |
3030 | |
3031 if (ab_position_a != -1 && ab_position_b != -1 && time > ab_position_b) | |
3032 playback_seek(ab_position_a/1000); | |
3033 | |
3034 length = playlist_get_current_length(playlist_get_active()); | |
3035 if (playback_get_playing()) | |
3036 playlistwin_set_time(time, length, cfg.timer_mode); | |
3037 else | |
3038 playlistwin_hide_timer(); | |
3039 input_update_vis(time); | |
3040 | |
3041 if (cfg.timer_mode == TIMER_REMAINING) { | |
3042 if (length != -1) { | |
3043 number_set_number(mainwin_minus_num, 11); | |
3044 t = length - time; | |
3045 stime_prefix = '-'; | |
3046 } | |
3047 else { | |
3048 number_set_number(mainwin_minus_num, 10); | |
3049 t = time; | |
3050 stime_prefix = ' '; | |
3051 } | |
3052 } | |
3053 else { | |
3054 number_set_number(mainwin_minus_num, 10); | |
3055 t = time; | |
3056 stime_prefix = ' '; | |
3057 } | |
3058 t /= 1000; | |
3059 | |
3060 /* Show the time in the format HH:MM when we have more than 100 | |
3061 * minutes. */ | |
3062 if (t >= 100 * 60) | |
3063 t /= 60; | |
3064 number_set_number(mainwin_10min_num, t / 600); | |
3065 number_set_number(mainwin_min_num, (t / 60) % 10); | |
3066 number_set_number(mainwin_10sec_num, (t / 10) % 6); | |
3067 number_set_number(mainwin_sec_num, t % 10); | |
3068 | |
3069 if (!mainwin_sposition->hs_pressed) { | |
3070 gchar *time_str; | |
3071 | |
3072 time_str = g_strdup_printf("%c%2.2d", stime_prefix, t / 60); | |
3073 textbox_set_text(mainwin_stime_min, time_str); | |
3074 g_free(time_str); | |
3075 | |
3076 time_str = g_strdup_printf("%2.2d", t % 60); | |
3077 textbox_set_text(mainwin_stime_sec, time_str); | |
3078 g_free(time_str); | |
3079 } | |
3080 | |
3081 time /= 1000; | |
3082 length /= 1000; | |
3083 if (length > 0) { | |
3084 if (time > length) { | |
3085 hslider_set_position(mainwin_position, 219); | |
3086 hslider_set_position(mainwin_sposition, 13); | |
3087 } | |
3088 /* update the slider position ONLY if there is not a seek in progress */ | |
3089 else if (seek_state == MAINWIN_SEEK_NIL) { | |
3090 hslider_set_position(mainwin_position, (time * 219) / length); | |
3091 hslider_set_position(mainwin_sposition, | |
3092 ((time * 12) / length) + 1); | |
3093 } | |
3094 } | |
3095 else { | |
3096 hslider_set_position(mainwin_position, 0); | |
3097 hslider_set_position(mainwin_sposition, 1); | |
3098 } | |
3099 } | |
3100 | |
3101 static gboolean | |
3102 mainwin_idle_func(gpointer data) | |
3103 { | |
3104 static gint count = 0; | |
3105 gint time = 0; | |
3106 | |
3107 /* run audcore events, then run our own. --nenolod */ | |
3108 switch((time = audcore_generic_events())) | |
3109 { | |
3110 case -2: | |
3111 /* no usable output device */ | |
3112 GDK_THREADS_ENTER(); | |
3113 run_no_output_device_dialog(); | |
3114 mainwin_stop_pushed(); | |
3115 GDK_THREADS_LEAVE(); | |
3116 ev_waiting = FALSE; | |
3117 break; | |
3118 | |
3119 default: | |
3120 idle_func_update_song_info(time); | |
3121 /* nothing at this time */ | |
3122 } | |
3123 | |
3124 GDK_THREADS_ENTER(); | |
3125 | |
3126 if (playback_get_playing()) | |
3127 vis_playback_start(); | |
3128 else { | |
3129 vis_playback_stop(); | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3130 ab_position_a = ab_position_b = -1; |
2313 | 3131 } |
3132 | |
3133 draw_main_window(mainwin_force_redraw); | |
3134 | |
3135 if (!count) { | |
3136 read_volume(VOLSET_UPDATE); | |
3137 count = 10; | |
3138 } | |
3139 else | |
3140 count--; | |
3141 | |
3142 mainwin_force_redraw = FALSE; | |
3143 draw_equalizer_window(FALSE); | |
3144 draw_playlist_window(FALSE); | |
3145 | |
3146 if (mainwin_title_text) { | |
3147 G_LOCK(mainwin_title); | |
3148 gtk_window_set_title(GTK_WINDOW(mainwin), mainwin_title_text); | |
3149 g_free(mainwin_title_text); | |
3150 mainwin_title_text = NULL; | |
3151 G_UNLOCK(mainwin_title); | |
3152 | |
3153 mainwin_set_info_text(); | |
3154 playlistwin_update_list(playlist_get_active()); | |
3155 } | |
3156 | |
3157 /* tristate buttons seek */ | |
3158 if ( seek_state != MAINWIN_SEEK_NIL ) | |
3159 { | |
3160 GTimeVal now_time; | |
3161 GTimeVal delta_time; | |
3162 gulong now_dur; | |
3163 g_get_current_time(&now_time); | |
3164 | |
3165 delta_time.tv_usec = now_time.tv_usec - cb_time.tv_usec; | |
3166 delta_time.tv_sec = now_time.tv_sec - cb_time.tv_sec; | |
3167 | |
3168 now_dur = labs((delta_time.tv_sec * 1000) + (glong) (delta_time.tv_usec / 1000)); | |
3169 | |
3170 if ( now_dur > TRISTATE_THRESHOLD ) | |
3171 { | |
3172 gint np; | |
3173 if (seek_state == MAINWIN_SEEK_REV) | |
3174 np = seek_initial_pos - labs((gulong)(now_dur/100)); /* seek back */ | |
3175 else | |
3176 np = seek_initial_pos + labs((gulong)(now_dur/100)); /* seek forward */ | |
3177 | |
3178 /* boundaries check */ | |
3179 if (np < 0 ) | |
3180 np = 0; | |
3181 else if ( np > 219 ) | |
3182 np = 219; | |
3183 | |
3184 hslider_set_position( mainwin_position , np ); | |
3185 mainwin_position_motion_cb( np ); | |
3186 } | |
3187 } | |
3188 | |
3189 GDK_THREADS_LEAVE(); | |
3190 | |
3191 /* | |
3192 if (seek_state == MAINWIN_SEEK_REV) | |
3193 playback_seek(CLAMP(playback_get_time() - 1000, 0, | |
3194 playlist_get_current_length()) / 1000); | |
3195 else if (seek_state == MAINWIN_SEEK_FWD) | |
3196 playback_seek(CLAMP(playback_get_time() + 1000, 0, | |
3197 playlist_get_current_length()) / 1000); | |
3198 */ | |
3199 | |
3200 return TRUE; | |
3201 } | |
3202 | |
3203 | |
2353
0fb258122933
[svn] - added audacious_menu_main_show(x,y,button,time) in util.h, convenience function to display the audacious main popup menu
giacomo
parents:
2345
diff
changeset
|
3204 void |
0fb258122933
[svn] - added audacious_menu_main_show(x,y,button,time) in util.h, convenience function to display the audacious main popup menu
giacomo
parents:
2345
diff
changeset
|
3205 audacious_menu_main_show( gint x , gint y , guint button , guint time ) |
0fb258122933
[svn] - added audacious_menu_main_show(x,y,button,time) in util.h, convenience function to display the audacious main popup menu
giacomo
parents:
2345
diff
changeset
|
3206 { |
0fb258122933
[svn] - added audacious_menu_main_show(x,y,button,time) in util.h, convenience function to display the audacious main popup menu
giacomo
parents:
2345
diff
changeset
|
3207 /* convenience function that shows the main popup menu wherever requested */ |
0fb258122933
[svn] - added audacious_menu_main_show(x,y,button,time) in util.h, convenience function to display the audacious main popup menu
giacomo
parents:
2345
diff
changeset
|
3208 ui_manager_popup_menu_show( GTK_MENU(mainwin_general_menu), |
0fb258122933
[svn] - added audacious_menu_main_show(x,y,button,time) in util.h, convenience function to display the audacious main popup menu
giacomo
parents:
2345
diff
changeset
|
3209 x , y , button , time ); |
0fb258122933
[svn] - added audacious_menu_main_show(x,y,button,time) in util.h, convenience function to display the audacious main popup menu
giacomo
parents:
2345
diff
changeset
|
3210 return; |
0fb258122933
[svn] - added audacious_menu_main_show(x,y,button,time) in util.h, convenience function to display the audacious main popup menu
giacomo
parents:
2345
diff
changeset
|
3211 } |
0fb258122933
[svn] - added audacious_menu_main_show(x,y,button,time) in util.h, convenience function to display the audacious main popup menu
giacomo
parents:
2345
diff
changeset
|
3212 |
0fb258122933
[svn] - added audacious_menu_main_show(x,y,button,time) in util.h, convenience function to display the audacious main popup menu
giacomo
parents:
2345
diff
changeset
|
3213 |
2313 | 3214 /* toggleactionentries actions */ |
3215 | |
3216 void | |
3217 action_anamode_peaks( GtkToggleAction * action ) | |
3218 { | |
3219 cfg.analyzer_peaks = gtk_toggle_action_get_active( action ); | |
3220 } | |
3221 | |
3222 void | |
3223 action_autoscroll_songname( GtkToggleAction * action ) | |
3224 { | |
3225 mainwin_set_title_scroll(gtk_toggle_action_get_active(action)); | |
3226 playlistwin_set_sinfo_scroll(cfg.autoscroll); /* propagate scroll setting to playlistwin_sinfo */ | |
3227 } | |
3228 | |
3229 void | |
3230 action_playback_noplaylistadvance( GtkToggleAction * action ) | |
3231 { | |
3232 cfg.no_playlist_advance = gtk_toggle_action_get_active( action ); | |
3233 } | |
3234 | |
3235 void | |
3236 action_playback_repeat( GtkToggleAction * action ) | |
3237 { | |
3238 cfg.repeat = gtk_toggle_action_get_active( action ); | |
3239 tbutton_set_toggled(mainwin_repeat, cfg.repeat); | |
3240 } | |
3241 | |
3242 void | |
3243 action_playback_shuffle( GtkToggleAction * action ) | |
3244 { | |
3245 cfg.shuffle = gtk_toggle_action_get_active( action ); | |
3246 playlist_set_shuffle(cfg.shuffle); | |
3247 tbutton_set_toggled(mainwin_shuffle, cfg.shuffle); | |
3248 } | |
3249 | |
3250 void | |
3251 action_stop_after_current_song( GtkToggleAction * action ) | |
3252 { | |
3253 cfg.stopaftersong = gtk_toggle_action_get_active( action ); | |
3254 } | |
3255 | |
3256 void | |
3257 action_view_always_on_top( GtkToggleAction * action ) | |
3258 { | |
3259 mainwin_menurow->mr_always_selected = gtk_toggle_action_get_active( action ); | |
3260 cfg.always_on_top = mainwin_menurow->mr_always_selected; | |
3261 widget_draw(WIDGET(mainwin_menurow)); | |
3262 | |
3263 if (starting_up == FALSE) | |
3264 hint_set_always(cfg.always_on_top); | |
3265 } | |
3266 | |
3267 void | |
3268 action_view_doublesize( GtkToggleAction * action ) | |
3269 { | |
3270 mainwin_menurow->mr_doublesize_selected = gtk_toggle_action_get_active( action ); | |
3271 widget_draw(WIDGET(mainwin_menurow)); | |
3272 set_doublesize(mainwin_menurow->mr_doublesize_selected); | |
3273 gdk_flush(); | |
3274 } | |
3275 | |
3276 void | |
3277 action_view_easymove( GtkToggleAction * action ) | |
3278 { | |
3279 cfg.easy_move = gtk_toggle_action_get_active( action ); | |
3280 } | |
3281 | |
3282 void | |
3283 action_view_on_all_workspaces( GtkToggleAction * action ) | |
3284 { | |
3285 cfg.sticky = gtk_toggle_action_get_active( action ); | |
3286 hint_set_sticky(cfg.sticky); | |
3287 } | |
3288 | |
3289 void | |
3290 action_roll_up_equalizer( GtkToggleAction * action ) | |
3291 { | |
3292 equalizerwin_set_shade_menu_cb(gtk_toggle_action_get_active(action)); | |
3293 } | |
3294 | |
3295 void | |
3296 action_roll_up_player( GtkToggleAction * action ) | |
3297 { | |
3298 mainwin_set_shade_menu_cb(gtk_toggle_action_get_active(action)); | |
3299 } | |
3300 | |
3301 void | |
3302 action_roll_up_playlist_editor( GtkToggleAction * action ) | |
3303 { | |
3304 playlistwin_set_shade(gtk_toggle_action_get_active(action)); | |
3305 } | |
3306 | |
3307 void | |
3308 action_show_equalizer( GtkToggleAction * action ) | |
3309 { | |
3310 if (gtk_toggle_action_get_active(action)) | |
3311 equalizerwin_real_show(); | |
3312 else | |
3313 equalizerwin_real_hide(); | |
3314 } | |
3315 | |
3316 void | |
3317 action_show_playlist_editor( GtkToggleAction * action ) | |
3318 { | |
3319 if (gtk_toggle_action_get_active(action)) | |
3320 playlistwin_show(); | |
3321 else | |
3322 playlistwin_hide(); | |
3323 } | |
3324 | |
3325 void | |
3326 action_show_player( GtkToggleAction * action ) | |
3327 { | |
3328 mainwin_show(gtk_toggle_action_get_active(action)); | |
3329 } | |
3330 | |
3331 | |
3332 /* radioactionentries actions (one callback for each radio group) */ | |
3333 | |
3334 void | |
3335 action_anafoff( GtkAction *action, GtkRadioAction *current ) | |
3336 { | |
3337 mainwin_vis_set_afalloff(gtk_radio_action_get_current_value(current)); | |
3338 } | |
3339 | |
3340 void | |
3341 action_anamode( GtkAction *action, GtkRadioAction *current ) | |
3342 { | |
3343 mainwin_vis_set_analyzer_mode(gtk_radio_action_get_current_value(current)); | |
3344 } | |
3345 | |
3346 void | |
3347 action_anatype( GtkAction *action, GtkRadioAction *current ) | |
3348 { | |
3349 mainwin_vis_set_analyzer_type(gtk_radio_action_get_current_value(current)); | |
3350 } | |
3351 | |
3352 void | |
3353 action_peafoff( GtkAction *action, GtkRadioAction *current ) | |
3354 { | |
3355 mainwin_vis_set_pfalloff(gtk_radio_action_get_current_value(current)); | |
3356 } | |
3357 | |
3358 void | |
3359 action_refrate( GtkAction *action, GtkRadioAction *current ) | |
3360 { | |
3361 mainwin_vis_set_refresh(gtk_radio_action_get_current_value(current)); | |
3362 } | |
3363 | |
3364 void | |
3365 action_scomode( GtkAction *action, GtkRadioAction *current ) | |
3366 { | |
3367 cfg.scope_mode = gtk_radio_action_get_current_value(current); | |
3368 } | |
3369 | |
3370 void | |
3371 action_vismode( GtkAction *action, GtkRadioAction *current ) | |
3372 { | |
3373 mainwin_vis_set_type_menu_cb(gtk_radio_action_get_current_value(current)); | |
3374 } | |
3375 | |
3376 void | |
3377 action_vprmode( GtkAction *action, GtkRadioAction *current ) | |
3378 { | |
3379 cfg.voiceprint_mode = gtk_radio_action_get_current_value(current); | |
3380 } | |
3381 | |
3382 void | |
3383 action_wshmode( GtkAction *action, GtkRadioAction *current ) | |
3384 { | |
3385 cfg.vu_mode = gtk_radio_action_get_current_value(current); | |
3386 } | |
3387 | |
3388 void | |
3389 action_viewtime( GtkAction *action, GtkRadioAction *current ) | |
3390 { | |
3391 set_timer_mode_menu_cb(gtk_radio_action_get_current_value(current)); | |
3392 } | |
3393 | |
3394 | |
3395 /* actionentries actions */ | |
3396 | |
3397 void | |
3398 action_about_audacious( void ) | |
3399 { | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3400 show_about_window(); |
2313 | 3401 } |
3402 | |
3403 void | |
3404 action_play_file( void ) | |
3405 { | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3406 run_filebrowser(PLAY_BUTTON); |
2313 | 3407 } |
3408 | |
3409 void | |
3410 action_play_location( void ) | |
3411 { | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3412 mainwin_show_add_url_window(); |
2313 | 3413 } |
3414 | |
3415 void | |
3416 action_ab_set( void ) | |
3417 { | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3418 Playlist *playlist = playlist_get_active(); |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3419 if (playlist_get_current_length(playlist) != -1) |
2313 | 3420 { |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3421 if (ab_position_a == -1) |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3422 { |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3423 ab_position_a = playback_get_time(); |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3424 ab_position_b = -1; |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3425 mainwin_lock_info_text("LOOP-POINT A POSITION SET."); |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3426 } |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3427 else if (ab_position_b == -1) |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3428 { |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3429 int time = playback_get_time(); |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3430 if (time > ab_position_a) |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3431 ab_position_b = time; |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3432 mainwin_release_info_text(); |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3433 } |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3434 else |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3435 { |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3436 ab_position_a = playback_get_time(); |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3437 ab_position_b = -1; |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3438 mainwin_lock_info_text("LOOP-POINT A POSITION RESET."); |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3439 } |
2313 | 3440 } |
3441 } | |
3442 | |
3443 void | |
3444 action_ab_clear( void ) | |
3445 { | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3446 Playlist *playlist = playlist_get_active(); |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3447 if (playlist_get_current_length(playlist) != -1) |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3448 { |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3449 ab_position_a = ab_position_b = -1; |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3450 mainwin_release_info_text(); |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3451 } |
2313 | 3452 } |
3453 | |
3454 void | |
3455 action_current_track_info( void ) | |
3456 { | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3457 playlist_fileinfo_current(playlist_get_active()); |
2313 | 3458 } |
3459 | |
3460 void | |
3461 action_jump_to_file( void ) | |
3462 { | |
2500 | 3463 ui_jump_to_track(); |
2313 | 3464 } |
3465 | |
3466 void | |
3467 action_jump_to_playlist_start( void ) | |
3468 { | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3469 Playlist *playlist = playlist_get_active(); |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3470 playlist_set_position(playlist, 0); |
2313 | 3471 } |
3472 | |
3473 void | |
3474 action_jump_to_time( void ) | |
3475 { | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3476 mainwin_jump_to_time(); |
2313 | 3477 } |
3478 | |
3479 void | |
3480 action_playback_next( void ) | |
3481 { | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3482 Playlist *playlist = playlist_get_active(); |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3483 playlist_next(playlist); |
2313 | 3484 } |
3485 | |
3486 void | |
3487 action_playback_previous( void ) | |
3488 { | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3489 Playlist *playlist = playlist_get_active(); |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3490 playlist_prev(playlist); |
2313 | 3491 } |
3492 | |
3493 void | |
3494 action_playback_play( void ) | |
3495 { | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3496 mainwin_play_pushed(); |
2313 | 3497 } |
3498 | |
3499 void | |
3500 action_playback_playcd( void ) | |
3501 { | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3502 play_medium(); |
2313 | 3503 } |
3504 | |
3505 void | |
3506 action_playback_pause( void ) | |
3507 { | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3508 playback_pause(); |
2313 | 3509 } |
3510 | |
3511 void | |
3512 action_playback_stop( void ) | |
3513 { | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3514 mainwin_stop_pushed(); |
2313 | 3515 } |
3516 | |
3517 void | |
3518 action_preferences( void ) | |
3519 { | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3520 show_prefs_window(); |
2313 | 3521 } |
3522 | |
3523 void | |
3524 action_quit( void ) | |
3525 { | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3526 mainwin_quit_cb(); |
2313 | 3527 } |