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