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