Mercurial > audlegacy
annotate src/audacious/ui_main.c @ 2821:ade60a2c52fb trunk
[svn] beginning of widgetcore rewrite
author | desowin |
---|---|
date | Thu, 07 Jun 2007 03:54:12 -0700 |
parents | bf2d80abf76e |
children | 1f17d4cdcc53 |
rev | line source |
---|---|
2313 | 1 /* Audacious - Cross-platform multimedia player |
2 * Copyright (C) 2005-2006 Audacious development team. | |
3 * | |
4 * BMP - Cross-platform multimedia player | |
5 * Copyright (C) 2003-2004 BMP development team. | |
6 * | |
7 * Based on XMMS: | |
8 * Copyright (C) 1998-2003 XMMS development team. | |
9 * | |
10 * This program is free software; you can redistribute it and/or modify | |
11 * it under the terms of the GNU General Public License as published by | |
12 * the Free Software Foundation; under version 2 of the License. | |
13 * | |
14 * This program is distributed in the hope that it will be useful, | |
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 * GNU General Public License for more details. | |
18 * | |
19 * You should have received a copy of the GNU General Public License | |
20 * along with this program; if not, write to the Free Software | |
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
22 */ | |
23 | |
24 #ifdef HAVE_CONFIG_H | |
25 # include "config.h" | |
26 #endif | |
27 | |
28 | |
29 #include <glib.h> | |
30 #include <glib/gi18n.h> | |
31 #include <glib/gprintf.h> | |
32 #include <gtk/gtk.h> | |
33 #include <gtk/gtkmessagedialog.h> | |
34 | |
35 /* GDK including */ | |
36 #include "platform/smartinclude.h" | |
37 | |
38 #include <math.h> | |
39 #include <stdlib.h> | |
40 #include <string.h> | |
41 | |
42 #include <X11/Xlib.h> | |
43 | |
44 #include <sys/types.h> | |
45 | |
46 #if defined(USE_REGEX_ONIGURUMA) | |
47 #include <onigposix.h> | |
48 #elif defined(USE_REGEX_PCRE) | |
49 #include <pcreposix.h> | |
50 #else | |
51 #include <regex.h> | |
52 #endif | |
53 | |
54 #include "widgets/widgetcore.h" | |
55 #include "ui_main.h" | |
56 #include "icons-stock.h" | |
57 | |
58 #include "actions-mainwin.h" | |
59 | |
60 #include "main.h" | |
2717 | 61 #include "configdb.h" |
2313 | 62 #include "dnd.h" |
63 #include "dock.h" | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
64 #include "genevent.h" |
2313 | 65 #include "hints.h" |
66 #include "input.h" | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
67 #include "urldecode.h" |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
68 #include "playback.h" |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
69 #include "playlist.h" |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
70 #include "pluginenum.h" |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
71 #include "ui_credits.h" |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
72 #include "ui_equalizer.h" |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
73 #include "ui_fileopener.h" |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
74 #include "ui_manager.h" |
2313 | 75 #include "ui_playlist.h" |
76 #include "ui_preferences.h" | |
77 #include "ui_skinselector.h" | |
2422 | 78 #include "ui_urlopener.h" |
2373
ad1d7687814c
[svn] made strings.h for existing strings.c, cleanups
mf0102
parents:
2354
diff
changeset
|
79 #include "strings.h" |
2313 | 80 #include "util.h" |
81 #include "visualization.h" | |
82 | |
2494
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
2485
diff
changeset
|
83 #include "ui_skinned_window.h" |
2500 | 84 #include "ui_jumptotrack.h" |
2494
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
2485
diff
changeset
|
85 |
2313 | 86 static GTimeVal cb_time; /* click delay for tristate is defined by TRISTATE_THRESHOLD */ |
87 | |
88 #define ITEM_SEPARATOR {"/-", NULL, NULL, 0, "<Separator>"} | |
89 #define TRISTATE_THRESHOLD 200 | |
90 | |
91 #define VOLSET_DISP_TIMES 5 | |
92 | |
93 enum { | |
94 MAINWIN_SEEK_REV = -1, | |
95 MAINWIN_SEEK_NIL, | |
96 MAINWIN_SEEK_FWD | |
97 }; | |
98 | |
99 enum { | |
100 MAINWIN_VIS_ACTIVE_MAINWIN, MAINWIN_VIS_ACTIVE_PLAYLISTWIN | |
101 }; | |
102 | |
103 | |
104 typedef struct _PlaybackInfo PlaybackInfo; | |
105 | |
106 struct _PlaybackInfo { | |
107 gchar *title; | |
108 gint bitrate; | |
109 gint frequency; | |
110 gint n_channels; | |
111 }; | |
112 | |
2496
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
113 static GList *mainwin_wlist = NULL; |
2313 | 114 |
115 GtkWidget *mainwin = NULL; | |
116 GtkWidget *err = NULL; /* an error dialog for miscellaneous error messages */ | |
117 | |
118 static GdkBitmap *nullmask; | |
119 static gint balance; | |
120 | |
121 static GtkWidget *mainwin_jtt = NULL; | |
122 | |
123 gint seek_state = MAINWIN_SEEK_NIL; | |
124 gint seek_initial_pos = 0; | |
125 | |
126 static GdkPixmap *mainwin_bg = NULL, *mainwin_bg_x2 = NULL; | |
127 | |
2821 | 128 static GtkWidget *mainwin_menubtn; |
129 static GtkWidget *mainwin_minimize, *mainwin_shade, *mainwin_close; | |
130 | |
131 static GtkWidget *mainwin_rew, *mainwin_fwd; | |
132 static GtkWidget *mainwin_eject; | |
133 static GtkWidget *mainwin_play, *mainwin_pause, *mainwin_stop; | |
2313 | 134 |
135 TButton *mainwin_shuffle, *mainwin_repeat, *mainwin_eq, *mainwin_pl; | |
136 TextBox *mainwin_info; | |
137 TextBox *mainwin_stime_min, *mainwin_stime_sec; | |
138 | |
139 static TextBox *mainwin_rate_text, *mainwin_freq_text, | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
140 *mainwin_othertext; |
2313 | 141 |
142 PlayStatus *mainwin_playstatus; | |
143 | |
144 Number *mainwin_minus_num, *mainwin_10min_num, *mainwin_min_num; | |
145 Number *mainwin_10sec_num, *mainwin_sec_num; | |
146 | |
147 static gboolean setting_volume = FALSE; | |
148 | |
149 Vis *active_vis; | |
150 Vis *mainwin_vis; | |
151 SVis *mainwin_svis; | |
152 | |
153 HSlider *mainwin_sposition = NULL; | |
154 | |
155 static MenuRow *mainwin_menurow; | |
156 static HSlider *mainwin_volume, *mainwin_balance, *mainwin_position; | |
157 static MonoStereo *mainwin_monostereo; | |
158 static SButton *mainwin_srew, *mainwin_splay, *mainwin_spause; | |
159 static SButton *mainwin_sstop, *mainwin_sfwd, *mainwin_seject, *mainwin_about; | |
160 | |
161 static gint mainwin_timeout_id; | |
162 | |
163 G_LOCK_DEFINE_STATIC(mainwin_title); | |
164 | |
165 static gboolean mainwin_force_redraw = FALSE; | |
166 static gchar *mainwin_title_text = NULL; | |
167 static gboolean mainwin_info_text_locked = FALSE; | |
168 | |
169 static int ab_position_a = -1; | |
170 static int ab_position_b = -1; | |
171 | |
172 static PlaybackInfo playback_info = { NULL, 0, 0, 0 }; | |
173 | |
174 | |
175 static gint mainwin_idle_func(gpointer data); | |
176 | |
177 static void set_timer_mode_menu_cb(TimerMode mode); | |
178 static void set_timer_mode(TimerMode mode); | |
179 | |
180 static void mainwin_refresh_hints(void); | |
181 | |
182 void mainwin_position_motion_cb(gint pos); | |
183 void mainwin_position_release_cb(gint pos); | |
184 | |
185 void set_doublesize(gboolean doublesize); | |
186 | |
187 | |
188 | |
189 /* FIXME: placed here for now */ | |
190 void | |
191 playback_get_sample_params(gint * bitrate, | |
192 gint * frequency, | |
193 gint * n_channels) | |
194 { | |
195 if (bitrate) | |
196 *bitrate = playback_info.bitrate; | |
197 | |
198 if (frequency) | |
199 *frequency = playback_info.frequency; | |
200 | |
201 if (n_channels) | |
202 *n_channels = playback_info.n_channels; | |
203 } | |
204 | |
205 static void | |
206 playback_set_sample_params(gint bitrate, | |
207 gint frequency, | |
208 gint n_channels) | |
209 { | |
210 if (bitrate >= 0) | |
211 playback_info.bitrate = bitrate; | |
212 | |
213 if (frequency >= 0) | |
214 playback_info.frequency = frequency; | |
215 | |
216 if (n_channels >= 0) | |
217 playback_info.n_channels = n_channels; | |
218 } | |
219 | |
220 static void | |
221 mainwin_set_title_scroll(gboolean scroll) | |
222 { | |
223 cfg.autoscroll = scroll; | |
224 textbox_set_scroll(mainwin_info, cfg.autoscroll); | |
225 } | |
226 | |
227 | |
228 void | |
229 mainwin_set_always_on_top(gboolean always) | |
230 { | |
231 GtkAction *action = gtk_action_group_get_action( | |
232 toggleaction_group_others , "view always on top" ); | |
233 gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(action) , always ); | |
234 } | |
235 | |
236 static void | |
237 mainwin_set_shape_mask(void) | |
238 { | |
239 if (!cfg.player_visible) | |
240 return; | |
241 | |
242 if (cfg.doublesize == FALSE) | |
243 gtk_widget_shape_combine_mask(mainwin, | |
244 skin_get_mask(bmp_active_skin, | |
245 SKIN_MASK_MAIN), 0, 0); | |
246 else | |
247 gtk_widget_shape_combine_mask(mainwin, NULL, 0, 0); | |
248 } | |
249 | |
250 static void | |
251 mainwin_set_shade(gboolean shaded) | |
252 { | |
253 GtkAction *action = gtk_action_group_get_action( | |
254 toggleaction_group_others , "roll up player" ); | |
255 gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(action) , shaded ); | |
256 } | |
257 | |
258 static void | |
259 mainwin_set_shade_menu_cb(gboolean shaded) | |
260 { | |
261 cfg.player_shaded = shaded; | |
262 | |
263 mainwin_set_shape_mask(); | |
264 | |
265 if (shaded) { | |
266 dock_shade(dock_window_list, GTK_WINDOW(mainwin), | |
267 MAINWIN_SHADED_HEIGHT * (cfg.doublesize + 1)); | |
268 | |
269 widget_show(WIDGET(mainwin_svis)); | |
270 vis_clear_data(mainwin_vis); | |
271 | |
272 widget_show(WIDGET(mainwin_srew)); | |
273 widget_show(WIDGET(mainwin_splay)); | |
274 widget_show(WIDGET(mainwin_spause)); | |
275 widget_show(WIDGET(mainwin_sstop)); | |
276 widget_show(WIDGET(mainwin_sfwd)); | |
277 widget_show(WIDGET(mainwin_seject)); | |
278 | |
279 textbox_set_scroll(mainwin_info, FALSE); | |
280 if (playback_get_playing()) | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
281 { |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
282 widget_show(WIDGET(mainwin_sposition)); |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
283 widget_show(WIDGET(mainwin_stime_min)); |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
284 widget_show(WIDGET(mainwin_stime_sec)); |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
285 } |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
286 else |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
287 { |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
288 widget_hide(WIDGET(mainwin_sposition)); |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
289 widget_hide(WIDGET(mainwin_stime_min)); |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
290 widget_hide(WIDGET(mainwin_stime_sec)); |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
291 } |
2313 | 292 |
293 } | |
294 else { | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
295 gint height = !bmp_active_skin->properties.mainwin_height ? MAINWIN_HEIGHT : |
2313 | 296 bmp_active_skin->properties.mainwin_height; |
297 | |
298 dock_shade(dock_window_list, GTK_WINDOW(mainwin), height * (cfg.doublesize + 1)); | |
299 | |
300 widget_hide(WIDGET(mainwin_svis)); | |
301 svis_clear_data(mainwin_svis); | |
302 | |
303 widget_hide(WIDGET(mainwin_srew)); | |
304 widget_hide(WIDGET(mainwin_splay)); | |
305 widget_hide(WIDGET(mainwin_spause)); | |
306 widget_hide(WIDGET(mainwin_sstop)); | |
307 widget_hide(WIDGET(mainwin_sfwd)); | |
308 widget_hide(WIDGET(mainwin_seject)); | |
309 | |
310 widget_hide(WIDGET(mainwin_stime_min)); | |
311 widget_hide(WIDGET(mainwin_stime_sec)); | |
312 widget_hide(WIDGET(mainwin_sposition)); | |
313 | |
314 textbox_set_scroll(mainwin_info, cfg.autoscroll); | |
315 } | |
316 | |
317 draw_main_window(TRUE); | |
318 } | |
319 | |
320 static void | |
321 mainwin_vis_set_active_vis(gint new_vis) | |
322 { | |
323 active_vis = mainwin_vis; | |
324 } | |
325 | |
326 static void | |
327 mainwin_vis_set_refresh(RefreshRate rate) | |
328 { | |
329 cfg.vis_refresh = rate; | |
330 } | |
331 | |
332 static void | |
333 mainwin_vis_set_afalloff(FalloffSpeed speed) | |
334 { | |
335 cfg.analyzer_falloff = speed; | |
336 } | |
337 | |
338 static void | |
339 mainwin_vis_set_pfalloff(FalloffSpeed speed) | |
340 { | |
341 cfg.peaks_falloff = speed; | |
342 } | |
343 | |
344 static void | |
345 mainwin_vis_set_analyzer_mode(AnalyzerMode mode) | |
346 { | |
347 cfg.analyzer_mode = mode; | |
348 } | |
349 | |
350 static void | |
351 mainwin_vis_set_analyzer_type(AnalyzerType mode) | |
352 { | |
353 cfg.analyzer_type = mode; | |
354 } | |
355 | |
356 void | |
357 mainwin_vis_set_type(VisType mode) | |
358 { | |
359 GtkAction *action; | |
360 | |
361 switch ( mode ) | |
362 { | |
363 case VIS_ANALYZER: | |
364 action = gtk_action_group_get_action( | |
365 radioaction_group_vismode , "vismode analyzer" ); | |
366 break; | |
367 case VIS_SCOPE: | |
368 action = gtk_action_group_get_action( | |
369 radioaction_group_vismode , "vismode scope" ); | |
370 break; | |
371 case VIS_VOICEPRINT: | |
372 action = gtk_action_group_get_action( | |
373 radioaction_group_vismode , "vismode voiceprint" ); | |
374 break; | |
375 case VIS_OFF: | |
376 default: | |
377 action = gtk_action_group_get_action( | |
378 radioaction_group_vismode , "vismode off" ); | |
379 break; | |
380 } | |
381 | |
382 gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(action) , TRUE ); | |
383 } | |
384 | |
385 static void | |
386 mainwin_vis_set_type_menu_cb(VisType mode) | |
387 { | |
388 cfg.vis_type = mode; | |
389 | |
390 if (mode == VIS_OFF) { | |
391 if (cfg.player_shaded && cfg.player_visible) | |
392 svis_clear(mainwin_svis); | |
393 else | |
394 vis_clear(active_vis); | |
395 } | |
396 if (mode == VIS_ANALYZER || mode == VIS_SCOPE || mode == VIS_VOICEPRINT) { | |
397 vis_clear_data(active_vis); | |
398 svis_clear_data(mainwin_svis); | |
399 } | |
400 } | |
401 | |
402 static void | |
403 mainwin_menubtn_cb(void) | |
404 { | |
405 gint x, y; | |
406 gtk_window_get_position(GTK_WINDOW(mainwin), &x, &y); | |
407 ui_manager_popup_menu_show(GTK_MENU(mainwin_general_menu), | |
408 x + 6 * (1 + cfg.doublesize), | |
409 y + MAINWIN_SHADED_HEIGHT * (1 + cfg.doublesize), | |
410 1, GDK_CURRENT_TIME); | |
411 } | |
412 | |
413 void | |
414 mainwin_minimize_cb(void) | |
415 { | |
416 if (!mainwin) | |
417 return; | |
418 | |
419 gtk_window_iconify(GTK_WINDOW(mainwin)); | |
420 } | |
421 | |
422 static void | |
423 mainwin_shade_toggle(void) | |
424 { | |
425 mainwin_set_shade(!cfg.player_shaded); | |
426 } | |
427 | |
428 void | |
429 mainwin_quit_cb(void) | |
430 { | |
431 GList *playlists = NULL, *playlists_top = NULL; | |
432 | |
433 gtk_widget_hide(equalizerwin); | |
434 gtk_widget_hide(playlistwin); | |
435 gtk_widget_hide(mainwin); | |
436 gdk_flush(); | |
437 | |
438 g_source_remove(mainwin_timeout_id); | |
439 | |
440 bmp_config_save(); | |
441 gtk_accel_map_save(bmp_paths[BMP_PATH_ACCEL_FILE]); | |
442 | |
443 plugin_system_cleanup(); | |
444 | |
445 playlist_stop_get_info_thread(); | |
446 | |
447 /* free and clear each playlist */ | |
448 playlists = playlist_get_playlists(); | |
449 playlists_top = playlists; | |
450 while ( playlists != NULL ) | |
451 { | |
452 playlist_clear((Playlist*)playlists->data); | |
453 playlist_free((Playlist*)playlists->data); | |
454 playlists = g_list_next(playlists); | |
455 } | |
456 g_list_free( playlists_top ); | |
457 | |
458 gtk_main_quit(); | |
459 | |
460 exit(EXIT_SUCCESS); | |
461 } | |
462 | |
463 static void | |
464 mainwin_destroy(GtkWidget * widget, gpointer data) | |
465 { | |
466 mainwin_quit_cb(); | |
467 } | |
468 | |
469 static void | |
470 mainwin_draw_titlebar(gboolean focus) | |
471 { | |
2525 | 472 /* FIXME: uses SkinnedWindow::gc directly. -nenolod */ |
473 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
|
474 SKINNED_WINDOW(mainwin)->gc, |
2313 | 475 cfg.player_shaded, focus || !cfg.dim_titlebar); |
476 } | |
477 | |
478 void | |
479 draw_main_window(gboolean force) | |
480 { | |
481 GdkImage *img, *img2x; | |
482 GList *wl; | |
483 Widget *w; | |
484 gboolean redraw; | |
485 | |
486 if (!cfg.player_visible) | |
487 return; | |
488 | |
489 if (force) | |
490 mainwin_refresh_hints(); | |
491 | |
492 widget_list_lock(mainwin_wlist); | |
493 | |
494 if (force) { | |
495 if (!cfg.player_shaded) | |
2525 | 496 skin_draw_pixmap(bmp_active_skin, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, |
2313 | 497 SKIN_MAIN, 0, 0, 0, 0, bmp_active_skin->properties.mainwin_width, |
498 bmp_active_skin->properties.mainwin_height); | |
499 mainwin_draw_titlebar(gtk_window_has_toplevel_focus | |
500 (GTK_WINDOW(mainwin))); | |
501 } | |
502 | |
503 widget_list_draw(mainwin_wlist, &redraw, force); | |
504 | |
505 if (redraw || force) { | |
506 if (force) { | |
507 if (cfg.doublesize) { | |
508 img = gdk_drawable_get_image(mainwin_bg, 0, 0, bmp_active_skin->properties.mainwin_width, | |
509 cfg.player_shaded ? | |
510 MAINWIN_SHADED_HEIGHT : | |
511 bmp_active_skin->properties.mainwin_height); | |
512 img2x = create_dblsize_image(img); | |
2525 | 513 gdk_draw_image(mainwin_bg_x2, SKINNED_WINDOW(mainwin)->gc, img2x, 0, 0, |
2313 | 514 0, 0, bmp_active_skin->properties.mainwin_width * 2, |
515 cfg.player_shaded ? MAINWIN_SHADED_HEIGHT * | |
516 2 : bmp_active_skin->properties.mainwin_height * 2); | |
517 g_object_unref(img2x); | |
518 g_object_unref(img); | |
519 } | |
520 | |
521 gdk_window_clear(mainwin->window); | |
522 | |
523 } | |
524 else { | |
525 for (wl = mainwin_wlist; wl; wl = g_list_next(wl)) { | |
2821 | 526 if(AUDACIOUS_IS_PBUTTON(wl->data)) continue; |
2313 | 527 w = WIDGET(wl->data); |
528 | |
529 if (!w->redraw || !w->visible) | |
530 continue; | |
531 | |
2496
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
532 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
|
533 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
|
534 continue; |
2313 | 535 |
536 if (cfg.doublesize) { | |
537 gint width, height; | |
538 | |
539 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)); | |
540 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)); | |
541 | |
542 img = gdk_drawable_get_image(mainwin_bg, w->x, w->y, | |
543 width, height); | |
544 img2x = create_dblsize_image(img); | |
2525 | 545 gdk_draw_image(mainwin_bg_x2, SKINNED_WINDOW(mainwin)->gc, |
2313 | 546 img2x, 0, 0, w->x << 1, w->y << 1, |
547 width << 1, height << 1); | |
548 g_object_unref(img2x); | |
549 g_object_unref(img); | |
550 gdk_window_clear_area(mainwin->window, w->x << 1, | |
551 w->y << 1, width << 1, | |
552 height << 1); | |
553 } | |
554 else | |
555 gdk_window_clear_area(mainwin->window, w->x, w->y, | |
556 w->width, w->height); | |
557 w->redraw = FALSE; | |
558 } | |
559 } | |
560 | |
561 gdk_flush(); | |
562 } | |
563 | |
564 widget_list_unlock(mainwin_wlist); | |
565 } | |
566 | |
567 | |
568 void | |
569 mainwin_set_info_text(void) | |
570 { | |
571 gchar *text; | |
572 | |
573 if (mainwin_info_text_locked) | |
574 return; | |
575 | |
576 if ((text = input_get_info_text()) != NULL) { | |
577 textbox_set_text(mainwin_info, text); | |
578 g_free(text); | |
579 } | |
580 else if ((text = playlist_get_info_text(playlist_get_active())) != NULL) { | |
581 textbox_set_text(mainwin_info, text); | |
582 g_free(text); | |
583 } | |
584 } | |
585 | |
586 static gchar *mainwin_tb_old_text = NULL; | |
587 | |
588 void | |
589 mainwin_lock_info_text(const gchar * text) | |
590 { | |
591 if (mainwin_info_text_locked != TRUE) | |
592 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
|
593 mainwin_othertext->tb_text : mainwin_info->tb_text); |
2313 | 594 |
595 mainwin_info_text_locked = TRUE; | |
596 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
|
597 mainwin_othertext : mainwin_info, text); |
2313 | 598 } |
599 | |
600 void | |
601 mainwin_release_info_text(void) | |
602 { | |
603 mainwin_info_text_locked = FALSE; | |
604 | |
605 if (mainwin_tb_old_text != NULL) | |
606 { | |
607 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
|
608 mainwin_othertext : mainwin_info, mainwin_tb_old_text); |
2313 | 609 g_free(mainwin_tb_old_text); |
610 mainwin_tb_old_text = NULL; | |
611 } | |
612 else | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
613 mainwin_set_info_text(); /* XXX: best we can do */ |
2313 | 614 } |
615 | |
616 | |
617 static gchar * | |
618 make_mainwin_title(const gchar * title) | |
619 { | |
620 if (title) | |
621 return g_strdup_printf(_("%s - Audacious"), title); | |
622 else | |
623 return g_strdup(_("Audacious")); | |
624 } | |
625 | |
626 void | |
627 mainwin_set_song_title(const gchar * title) | |
628 { | |
629 G_LOCK(mainwin_title); | |
630 g_free(mainwin_title_text); | |
631 mainwin_title_text = make_mainwin_title(title); | |
632 G_UNLOCK(mainwin_title); | |
633 } | |
634 | |
635 static void | |
636 mainwin_refresh_hints(void) | |
637 { | |
638 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
|
639 == TRUE) |
2313 | 640 { |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
641 widget_hide(WIDGET(mainwin_rate_text)); |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
642 widget_hide(WIDGET(mainwin_freq_text)); |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
643 widget_hide(WIDGET(mainwin_monostereo)); |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
644 |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
645 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
|
646 widget_show(WIDGET(mainwin_othertext)); |
2313 | 647 } |
648 else | |
649 { | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
650 widget_show(WIDGET(mainwin_rate_text)); |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
651 widget_show(WIDGET(mainwin_freq_text)); |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
652 widget_show(WIDGET(mainwin_monostereo)); |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
653 widget_hide(WIDGET(mainwin_othertext)); |
2313 | 654 } |
655 | |
656 /* positioning and size attributes */ | |
657 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
|
658 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
|
659 bmp_active_skin->properties.mainwin_vis_y); |
2313 | 660 |
661 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
|
662 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
|
663 mainwin_vis->vs_widget.height); |
2313 | 664 |
665 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
|
666 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
|
667 bmp_active_skin->properties.mainwin_text_y); |
2313 | 668 |
669 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
|
670 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
|
671 mainwin_info->tb_widget.height); |
2313 | 672 |
673 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
|
674 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
|
675 bmp_active_skin->properties.mainwin_infobar_y); |
2313 | 676 |
677 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
|
678 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
|
679 bmp_active_skin->properties.mainwin_number_0_y); |
2313 | 680 |
681 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
|
682 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
|
683 bmp_active_skin->properties.mainwin_number_1_y); |
2313 | 684 |
685 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
|
686 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
|
687 bmp_active_skin->properties.mainwin_number_2_y); |
2313 | 688 |
689 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
|
690 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
|
691 bmp_active_skin->properties.mainwin_number_3_y); |
2313 | 692 |
693 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
|
694 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
|
695 bmp_active_skin->properties.mainwin_number_4_y); |
2313 | 696 |
697 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
|
698 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
|
699 bmp_active_skin->properties.mainwin_playstatus_y); |
2313 | 700 |
701 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
|
702 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
|
703 bmp_active_skin->properties.mainwin_volume_y); |
2313 | 704 |
705 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
|
706 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
|
707 bmp_active_skin->properties.mainwin_balance_y); |
2313 | 708 |
709 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
|
710 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
|
711 bmp_active_skin->properties.mainwin_position_y); |
2313 | 712 |
713 if (bmp_active_skin->properties.mainwin_previous_x && bmp_active_skin->properties.mainwin_previous_y) | |
2821 | 714 gtk_fixed_move(GTK_FIXED(SKINNED_WINDOW(mainwin)->fixed), mainwin_rew, bmp_active_skin->properties.mainwin_previous_x, |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
715 bmp_active_skin->properties.mainwin_previous_y); |
2313 | 716 |
717 if (bmp_active_skin->properties.mainwin_play_x && bmp_active_skin->properties.mainwin_play_y) | |
2821 | 718 gtk_fixed_move(GTK_FIXED(SKINNED_WINDOW(mainwin)->fixed), GTK_WIDGET(mainwin_play), bmp_active_skin->properties.mainwin_play_x, |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
719 bmp_active_skin->properties.mainwin_play_y); |
2313 | 720 |
721 if (bmp_active_skin->properties.mainwin_pause_x && bmp_active_skin->properties.mainwin_pause_y) | |
2821 | 722 gtk_fixed_move(GTK_FIXED(SKINNED_WINDOW(mainwin)->fixed), GTK_WIDGET(mainwin_pause), bmp_active_skin->properties.mainwin_pause_x, |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
723 bmp_active_skin->properties.mainwin_pause_y); |
2313 | 724 |
725 if (bmp_active_skin->properties.mainwin_stop_x && bmp_active_skin->properties.mainwin_stop_y) | |
2821 | 726 gtk_fixed_move(GTK_FIXED(SKINNED_WINDOW(mainwin)->fixed), GTK_WIDGET(mainwin_stop), bmp_active_skin->properties.mainwin_stop_x, |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
727 bmp_active_skin->properties.mainwin_stop_y); |
2313 | 728 |
729 if (bmp_active_skin->properties.mainwin_next_x && bmp_active_skin->properties.mainwin_next_y) | |
2821 | 730 gtk_fixed_move(GTK_FIXED(SKINNED_WINDOW(mainwin)->fixed), GTK_WIDGET(mainwin_fwd), bmp_active_skin->properties.mainwin_next_x, |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
731 bmp_active_skin->properties.mainwin_next_y); |
2313 | 732 |
733 if (bmp_active_skin->properties.mainwin_eject_x && bmp_active_skin->properties.mainwin_eject_y) | |
2821 | 734 gtk_fixed_move(GTK_FIXED(SKINNED_WINDOW(mainwin)->fixed), GTK_WIDGET(mainwin_eject), bmp_active_skin->properties.mainwin_eject_x, |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
735 bmp_active_skin->properties.mainwin_eject_y); |
2313 | 736 |
737 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
|
738 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
|
739 bmp_active_skin->properties.mainwin_eqbutton_y); |
2313 | 740 |
741 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
|
742 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
|
743 bmp_active_skin->properties.mainwin_plbutton_y); |
2313 | 744 |
745 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
|
746 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
|
747 bmp_active_skin->properties.mainwin_shuffle_y); |
2313 | 748 |
749 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
|
750 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
|
751 bmp_active_skin->properties.mainwin_repeat_y); |
2313 | 752 |
753 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
|
754 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
|
755 bmp_active_skin->properties.mainwin_about_y); |
2313 | 756 |
757 if (bmp_active_skin->properties.mainwin_minimize_x && bmp_active_skin->properties.mainwin_minimize_y) | |
2821 | 758 gtk_fixed_move(GTK_FIXED(SKINNED_WINDOW(mainwin)->fixed), GTK_WIDGET(mainwin_minimize), cfg.player_shaded ? 244 : bmp_active_skin->properties.mainwin_minimize_x, |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
759 cfg.player_shaded ? 3 : bmp_active_skin->properties.mainwin_minimize_y); |
2313 | 760 |
761 if (bmp_active_skin->properties.mainwin_shade_x && bmp_active_skin->properties.mainwin_shade_y) | |
2821 | 762 gtk_fixed_move(GTK_FIXED(SKINNED_WINDOW(mainwin)->fixed), GTK_WIDGET(mainwin_shade), cfg.player_shaded ? 254 : bmp_active_skin->properties.mainwin_shade_x, |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
763 cfg.player_shaded ? 3 : bmp_active_skin->properties.mainwin_shade_y); |
2313 | 764 |
765 if (bmp_active_skin->properties.mainwin_close_x && bmp_active_skin->properties.mainwin_close_y) | |
2821 | 766 gtk_fixed_move(GTK_FIXED(SKINNED_WINDOW(mainwin)->fixed), GTK_WIDGET(mainwin_close), cfg.player_shaded ? 264 : bmp_active_skin->properties.mainwin_close_x, |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
767 cfg.player_shaded ? 3 : bmp_active_skin->properties.mainwin_close_y); |
2313 | 768 |
769 /* visibility attributes */ | |
770 if (bmp_active_skin->properties.mainwin_menurow_visible) | |
771 widget_show(WIDGET(mainwin_menurow)); | |
772 else | |
773 widget_hide(WIDGET(mainwin_menurow)); | |
774 | |
775 if (bmp_active_skin->properties.mainwin_text_visible) | |
776 widget_show(WIDGET(mainwin_info)); | |
777 else | |
778 widget_hide(WIDGET(mainwin_info)); | |
779 | |
780 if (bmp_active_skin->properties.mainwin_othertext_visible) | |
781 widget_show(WIDGET(mainwin_othertext)); | |
782 else | |
783 widget_hide(WIDGET(mainwin_othertext)); | |
784 | |
785 if (bmp_active_skin->properties.mainwin_vis_visible) | |
786 widget_show(WIDGET(mainwin_vis)); | |
787 else | |
788 widget_hide(WIDGET(mainwin_vis)); | |
789 | |
790 /* window size, mainwinWidth && mainwinHeight properties */ | |
791 if (bmp_active_skin->properties.mainwin_height && bmp_active_skin->properties.mainwin_width) | |
792 { | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
793 gint width, height; |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
794 |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
795 gdk_window_get_size(mainwin->window, &width, &height); |
2313 | 796 |
797 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
|
798 height == bmp_active_skin->properties.mainwin_height * (cfg.doublesize + 1)) |
2313 | 799 return; |
800 | |
801 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
|
802 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
|
803 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
|
804 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
|
805 |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
806 g_object_unref(mainwin_bg); |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
807 g_object_unref(mainwin_bg_x2); |
2313 | 808 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
|
809 bmp_active_skin->properties.mainwin_width, |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
810 bmp_active_skin->properties.mainwin_height, -1); |
2313 | 811 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
|
812 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
|
813 bmp_active_skin->properties.mainwin_height * 2, -1); |
2313 | 814 mainwin_set_back_pixmap(); |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
815 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
|
816 gdk_flush(); |
2313 | 817 } |
818 } | |
819 | |
820 void | |
821 mainwin_set_song_info(gint bitrate, | |
822 gint frequency, | |
823 gint n_channels) | |
824 { | |
825 gchar text[512]; | |
826 gchar *title; | |
827 Playlist *playlist = playlist_get_active(); | |
828 | |
829 playback_set_sample_params(bitrate, frequency, n_channels); | |
830 | |
831 if (bitrate != -1) { | |
832 bitrate /= 1000; | |
833 | |
834 if (bitrate < 1000) { | |
835 /* Show bitrate in 1000s */ | |
836 g_snprintf(text, sizeof(text), "%3d", bitrate); | |
837 textbox_set_text(mainwin_rate_text, text); | |
838 } | |
839 else { | |
840 /* Show bitrate in 100,000s */ | |
841 g_snprintf(text, sizeof(text), "%2dH", bitrate / 100); | |
842 textbox_set_text(mainwin_rate_text, text); | |
843 } | |
844 } | |
845 else | |
846 textbox_set_text(mainwin_rate_text, _("VBR")); | |
847 | |
848 /* Show sampling frequency in kHz */ | |
849 g_snprintf(text, sizeof(text), "%2d", frequency / 1000); | |
850 textbox_set_text(mainwin_freq_text, text); | |
851 | |
852 monostereo_set_num_channels(mainwin_monostereo, n_channels); | |
853 | |
854 if (cfg.player_shaded) | |
855 { | |
856 widget_show(WIDGET(mainwin_stime_min)); | |
857 widget_show(WIDGET(mainwin_stime_sec)); | |
858 } | |
859 | |
860 widget_show(WIDGET(mainwin_minus_num)); | |
861 widget_show(WIDGET(mainwin_10min_num)); | |
862 widget_show(WIDGET(mainwin_min_num)); | |
863 widget_show(WIDGET(mainwin_10sec_num)); | |
864 widget_show(WIDGET(mainwin_sec_num)); | |
865 | |
866 if (!playback_get_paused() && mainwin_playstatus != NULL) | |
867 playstatus_set_status(mainwin_playstatus, STATUS_PLAY); | |
868 | |
869 if (playlist_get_current_length(playlist) != -1) { | |
870 if (cfg.player_shaded) | |
871 widget_show(WIDGET(mainwin_sposition)); | |
872 widget_show(WIDGET(mainwin_position)); | |
873 } | |
874 else { | |
875 widget_hide(WIDGET(mainwin_position)); | |
876 widget_hide(WIDGET(mainwin_sposition)); | |
877 mainwin_force_redraw = TRUE; | |
878 } | |
879 | |
880 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
|
881 == TRUE) |
2313 | 882 { |
883 if (bitrate != -1) | |
884 g_snprintf(text, 512, "%d kbps, %0.1f kHz, %s", | |
885 bitrate, | |
886 (gfloat) frequency / 1000, | |
887 (n_channels > 1) ? _("stereo") : _("mono")); | |
888 else | |
889 g_snprintf(text, 512, "VBR, %0.1f kHz, %s", | |
890 (gfloat) frequency / 1000, | |
891 (n_channels > 1) ? _("stereo") : _("mono")); | |
892 | |
893 textbox_set_text(mainwin_othertext, text); | |
894 | |
895 widget_hide(WIDGET(mainwin_rate_text)); | |
896 widget_hide(WIDGET(mainwin_freq_text)); | |
897 widget_hide(WIDGET(mainwin_monostereo)); | |
898 | |
899 if (bmp_active_skin->properties.mainwin_othertext_visible) | |
900 widget_show(WIDGET(mainwin_othertext)); | |
901 } | |
902 else | |
903 { | |
904 widget_show(WIDGET(mainwin_rate_text)); | |
905 widget_show(WIDGET(mainwin_freq_text)); | |
906 widget_show(WIDGET(mainwin_monostereo)); | |
907 widget_hide(WIDGET(mainwin_othertext)); | |
908 } | |
909 | |
910 title = playlist_get_info_text(playlist); | |
911 mainwin_set_song_title(title); | |
912 g_free(title); | |
913 } | |
914 | |
915 void | |
916 mainwin_clear_song_info(void) | |
917 { | |
918 if (!mainwin) | |
919 return; | |
920 | |
921 /* clear title */ | |
922 G_LOCK(mainwin_title); | |
923 g_free(mainwin_title_text); | |
924 mainwin_title_text = NULL; | |
925 G_UNLOCK(mainwin_title); | |
926 | |
927 /* clear sampling parameters */ | |
928 playback_set_sample_params(0, 0, 0); | |
929 | |
930 mainwin_position->hs_pressed = FALSE; | |
931 mainwin_sposition->hs_pressed = FALSE; | |
932 | |
933 /* clear sampling parameter displays */ | |
934 textbox_set_text(mainwin_rate_text, " "); | |
935 textbox_set_text(mainwin_freq_text, " "); | |
936 monostereo_set_num_channels(mainwin_monostereo, 0); | |
937 | |
938 if (mainwin_playstatus != NULL) | |
939 playstatus_set_status(mainwin_playstatus, STATUS_STOP); | |
940 | |
941 /* hide playback time */ | |
942 widget_hide(WIDGET(mainwin_minus_num)); | |
943 widget_hide(WIDGET(mainwin_10min_num)); | |
944 widget_hide(WIDGET(mainwin_min_num)); | |
945 widget_hide(WIDGET(mainwin_10sec_num)); | |
946 widget_hide(WIDGET(mainwin_sec_num)); | |
947 | |
948 widget_hide(WIDGET(mainwin_stime_min)); | |
949 widget_hide(WIDGET(mainwin_stime_sec)); | |
950 | |
951 widget_hide(WIDGET(mainwin_position)); | |
952 widget_hide(WIDGET(mainwin_sposition)); | |
953 | |
954 widget_hide(WIDGET(mainwin_othertext)); | |
955 | |
956 playlistwin_hide_timer(); | |
957 draw_main_window(TRUE); | |
958 | |
959 vis_clear(active_vis); | |
960 } | |
961 | |
962 void | |
963 mainwin_disable_seekbar(void) | |
964 { | |
965 if (!mainwin) | |
966 return; | |
967 | |
968 /* | |
969 * We dont call draw_main_window() here so this will not | |
970 * remove them visually. It will only prevent us from sending | |
971 * any seek calls to the input plugin before the input plugin | |
972 * calls ->set_info(). | |
973 */ | |
974 widget_hide(WIDGET(mainwin_position)); | |
975 widget_hide(WIDGET(mainwin_sposition)); | |
976 } | |
977 | |
978 static gboolean | |
979 mainwin_mouse_button_release(GtkWidget * widget, | |
980 GdkEventButton * event, | |
981 gpointer callback_data) | |
982 { | |
983 gdk_pointer_ungrab(GDK_CURRENT_TIME); | |
984 | |
985 /* | |
986 * The gdk_flush() is just for making sure that the pointer really | |
987 * gets ungrabbed before calling any button callbacks | |
988 * | |
989 */ | |
990 | |
991 gdk_flush(); | |
992 | |
993 if (dock_is_moving(GTK_WINDOW(mainwin))) { | |
994 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
|
995 draw_playlist_window(TRUE); |
2313 | 996 } |
997 | |
998 if (mainwin_menurow->mr_doublesize_selected) { | |
999 event->x /= 2; | |
1000 event->y /= 2; | |
1001 } | |
1002 | |
1003 handle_release_cb(mainwin_wlist, widget, event); | |
1004 | |
1005 draw_main_window(FALSE); | |
1006 | |
1007 return FALSE; | |
1008 } | |
1009 | |
1010 static gboolean | |
1011 mainwin_motion(GtkWidget * widget, | |
1012 GdkEventMotion * event, | |
1013 gpointer callback_data) | |
1014 { | |
1015 int x, y; | |
1016 GdkModifierType state; | |
1017 | |
2494
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
2485
diff
changeset
|
1018 /* 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
|
1019 * 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
|
1020 */ |
2313 | 1021 if (event->is_hint != FALSE) |
1022 { | |
2494
59661bd074b4
[svn] Try to put some skinned window code in a common place.
nenolod
parents:
2485
diff
changeset
|
1023 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
|
1024 |
2313 | 1025 event->x = x; |
1026 event->y = y; | |
1027 event->state = state; | |
1028 } | |
1029 else | |
1030 { | |
1031 x = event->x; | |
1032 y = event->y; | |
1033 state = event->state; | |
1034 } | |
1035 if (cfg.doublesize) { | |
1036 event->x /= 2; | |
1037 event->y /= 2; | |
1038 } | |
2646
db74f7ecf22d
[svn] - fix doublesize motion events. patch by gagern, closes #856.
nenolod
parents:
2525
diff
changeset
|
1039 |
db74f7ecf22d
[svn] - fix doublesize motion events. patch by gagern, closes #856.
nenolod
parents:
2525
diff
changeset
|
1040 handle_motion_cb(mainwin_wlist, widget, event); |
db74f7ecf22d
[svn] - fix doublesize motion events. patch by gagern, closes #856.
nenolod
parents:
2525
diff
changeset
|
1041 draw_main_window(FALSE); |
2313 | 1042 |
1043 gdk_flush(); | |
1044 | |
1045 return FALSE; | |
1046 } | |
1047 | |
1048 void | |
1049 mainwin_scrolled(GtkWidget *widget, GdkEventScroll *event, | |
1050 gpointer callback_data) | |
1051 { | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
1052 Playlist *playlist = playlist_get_active(); |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
1053 |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
1054 switch (event->direction) { |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
1055 case GDK_SCROLL_UP: |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
1056 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
|
1057 break; |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
1058 case GDK_SCROLL_DOWN: |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
1059 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
|
1060 break; |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
1061 case GDK_SCROLL_LEFT: |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
1062 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
|
1063 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
|
1064 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
|
1065 break; |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
1066 case GDK_SCROLL_RIGHT: |
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 } |
2313 | 1072 } |
1073 | |
1074 static gboolean | |
1075 mainwin_mouse_button_press(GtkWidget * widget, | |
1076 GdkEventButton * event, | |
1077 gpointer callback_data) | |
1078 { | |
1079 | |
1080 gboolean grab = TRUE; | |
1081 | |
1082 if (cfg.doublesize) { | |
1083 /* | |
1084 * A hack to make doublesize transparent to callbacks. | |
1085 * We should make a copy of this data instead of | |
1086 * tampering with the data we get from gtk+ | |
1087 */ | |
1088 event->x /= 2; | |
1089 event->y /= 2; | |
1090 } | |
1091 | |
1092 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
|
1093 !ui_skinned_window_widgetlist_contained(mainwin, event->x, event->y) && |
2313 | 1094 (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
|
1095 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
|
1096 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
|
1097 TRUE); |
2313 | 1098 } |
1099 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
|
1100 event->y < 14 && !ui_skinned_window_widgetlist_contained(mainwin, event->x, event->y)) { |
2313 | 1101 mainwin_set_shade(!cfg.player_shaded); |
1102 if (dock_is_moving(GTK_WINDOW(mainwin))) | |
1103 dock_move_release(GTK_WINDOW(mainwin)); | |
1104 } | |
1105 else if (event->button == 1 && event->type == GDK_2BUTTON_PRESS && | |
1106 widget_contains(WIDGET(mainwin_info), event->x, event->y)) { | |
1107 playlist_fileinfo_current(playlist_get_active()); | |
1108 } | |
1109 else { | |
1110 handle_press_cb(mainwin_wlist, widget, event); | |
1111 draw_main_window(FALSE); | |
1112 } | |
1113 | |
1114 if ((event->button == 1) && event->type != GDK_2BUTTON_PRESS && | |
1115 (widget_contains(WIDGET(mainwin_vis), event->x, event->y) || | |
1116 widget_contains(WIDGET(mainwin_svis), event->x, event->y))) { | |
1117 | |
1118 cfg.vis_type++; | |
1119 | |
1120 if (cfg.vis_type > VIS_OFF) | |
1121 cfg.vis_type = VIS_ANALYZER; | |
1122 | |
1123 mainwin_vis_set_type(cfg.vis_type); | |
1124 } | |
1125 | |
1126 if (event->button == 3) { | |
1127 if (widget_contains(WIDGET(mainwin_info), event->x, event->y)) { | |
1128 ui_manager_popup_menu_show(GTK_MENU(mainwin_songname_menu), | |
1129 event->x_root, event->y_root, | |
1130 3, event->time); | |
1131 grab = FALSE; | |
1132 } | |
1133 else if (widget_contains(WIDGET(mainwin_vis), event->x, event->y) || | |
1134 widget_contains(WIDGET(mainwin_svis), event->x, event->y)) { | |
1135 ui_manager_popup_menu_show(GTK_MENU(mainwin_visualization_menu), event->x_root, | |
1136 event->y_root, 3, event->time); | |
1137 grab = FALSE; | |
1138 } | |
1139 else if ( (event->y > 70) && (event->x < 128) ) | |
1140 { | |
1141 | |
1142 ui_manager_popup_menu_show(GTK_MENU(mainwin_playback_menu), | |
1143 event->x_root, | |
1144 event->y_root, 3, event->time); | |
1145 grab = FALSE; | |
1146 } else { | |
1147 /* | |
1148 * Pop up the main menu a few pixels down. | |
1149 * This will avoid that anything is selected | |
1150 * if one right-clicks to focus the window | |
1151 * without raising it. | |
1152 * | |
1153 ***MD I think the above is stupid, people don't expect this | |
1154 * | |
1155 */ | |
1156 ui_manager_popup_menu_show(GTK_MENU(mainwin_general_menu), | |
1157 event->x_root, | |
1158 event->y_root, 3, event->time); | |
1159 grab = FALSE; | |
1160 } | |
1161 } | |
1162 | |
1163 if (event->button == 1) | |
1164 { | |
1165 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
|
1166 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
|
1167 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
|
1168 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
|
1169 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
|
1170 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
|
1171 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
|
1172 { |
2313 | 1173 if (cfg.timer_mode == TIMER_ELAPSED) |
1174 set_timer_mode(TIMER_REMAINING); | |
1175 else | |
1176 set_timer_mode(TIMER_ELAPSED); | |
1177 } | |
1178 } | |
1179 | |
1180 if (grab) | |
1181 gdk_pointer_grab(mainwin->window, FALSE, | |
1182 GDK_BUTTON_MOTION_MASK | | |
1183 GDK_BUTTON_RELEASE_MASK, | |
1184 GDK_WINDOW(GDK_NONE), NULL, GDK_CURRENT_TIME); | |
1185 | |
1186 return FALSE; | |
1187 } | |
1188 | |
1189 static gboolean | |
1190 mainwin_focus_in(GtkWidget * window, | |
1191 GdkEventFocus * event, | |
1192 gpointer data) | |
1193 { | |
1194 draw_main_window(TRUE); | |
1195 | |
1196 return TRUE; | |
1197 } | |
1198 | |
1199 | |
1200 static gboolean | |
1201 mainwin_focus_out(GtkWidget * widget, | |
1202 GdkEventFocus * event, | |
1203 gpointer callback_data) | |
1204 { | |
1205 draw_main_window(TRUE); | |
1206 | |
1207 return TRUE; | |
1208 } | |
1209 | |
1210 static gboolean | |
1211 mainwin_keypress(GtkWidget * grab_widget, | |
1212 GdkEventKey * event, | |
1213 gpointer data) | |
1214 { | |
1215 Playlist *playlist = playlist_get_active(); | |
1216 | |
1217 switch (event->keyval) { | |
1218 | |
1219 case GDK_Up: | |
1220 case GDK_KP_Up: | |
1221 case GDK_KP_8: | |
1222 mainwin_set_volume_diff(2); | |
1223 break; | |
1224 case GDK_Down: | |
1225 case GDK_KP_Down: | |
1226 case GDK_KP_2: | |
1227 mainwin_set_volume_diff(-2); | |
1228 break; | |
1229 case GDK_Left: | |
1230 case GDK_KP_Left: | |
1231 case GDK_KP_7: | |
1232 if (playlist_get_current_length(playlist) != -1) | |
1233 playback_seek(CLAMP | |
1234 (playback_get_time() - 5000, 0, | |
1235 playlist_get_current_length(playlist)) / 1000); | |
1236 break; | |
1237 case GDK_Right: | |
1238 case GDK_KP_Right: | |
1239 case GDK_KP_9: | |
1240 if (playlist_get_current_length(playlist) != -1) | |
1241 playback_seek(CLAMP | |
1242 (playback_get_time() + 5000, 0, | |
1243 playlist_get_current_length(playlist)) / 1000); | |
1244 break; | |
1245 case GDK_KP_4: | |
1246 playlist_prev(playlist); | |
1247 break; | |
1248 case GDK_KP_6: | |
1249 playlist_next(playlist); | |
1250 break; | |
1251 case GDK_KP_Insert: | |
2500 | 1252 ui_jump_to_track(); |
2313 | 1253 break; |
1254 case GDK_KP_5: | |
1255 mainwin_play_pushed(); | |
1256 break; | |
2693
b47f5577bea0
[svn] - Made the Space key pause/unpause playback (like e.g. mplayer)
mf0102
parents:
2651
diff
changeset
|
1257 case GDK_space: |
b47f5577bea0
[svn] - Made the Space key pause/unpause playback (like e.g. mplayer)
mf0102
parents:
2651
diff
changeset
|
1258 playback_pause(); |
b47f5577bea0
[svn] - Made the Space key pause/unpause playback (like e.g. mplayer)
mf0102
parents:
2651
diff
changeset
|
1259 break; |
2313 | 1260 case GDK_Escape: |
1261 mainwin_minimize_cb(); | |
1262 break; | |
1263 default: | |
1264 return FALSE; | |
1265 } | |
1266 | |
1267 return TRUE; | |
1268 } | |
1269 | |
1270 static void | |
1271 mainwin_jump_to_time_cb(GtkWidget * widget, | |
1272 GtkWidget * entry) | |
1273 { | |
1274 guint min = 0, sec = 0, params; | |
1275 gint time; | |
1276 Playlist *playlist = playlist_get_active(); | |
1277 | |
1278 params = sscanf(gtk_entry_get_text(GTK_ENTRY(entry)), "%u:%u", | |
1279 &min, &sec); | |
1280 if (params == 2) | |
1281 time = (min * 60) + sec; | |
1282 else if (params == 1) | |
1283 time = min; | |
1284 else | |
1285 return; | |
1286 | |
1287 if (playlist_get_current_length(playlist) > -1 && | |
1288 time <= (playlist_get_current_length(playlist) / 1000)) | |
1289 { | |
1290 playback_seek(time); | |
1291 gtk_widget_destroy(mainwin_jtt); | |
1292 } | |
1293 } | |
1294 | |
1295 | |
1296 void | |
1297 mainwin_jump_to_time(void) | |
1298 { | |
1299 GtkWidget *vbox, *hbox_new, *hbox_total; | |
1300 GtkWidget *time_entry, *label, *bbox, *jump, *cancel; | |
1301 guint tindex; | |
1302 gchar time_str[10]; | |
1303 | |
1304 if (!playback_get_playing()) { | |
1305 report_error("JIT can't be launched when no track is being played.\n"); | |
1306 return; | |
1307 } | |
1308 | |
1309 if (mainwin_jtt) { | |
1310 gtk_window_present(GTK_WINDOW(mainwin_jtt)); | |
1311 return; | |
1312 } | |
1313 | |
1314 mainwin_jtt = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
1315 gtk_window_set_type_hint(GTK_WINDOW(mainwin_jtt), | |
1316 GDK_WINDOW_TYPE_HINT_DIALOG); | |
1317 | |
1318 gtk_window_set_title(GTK_WINDOW(mainwin_jtt), _("Jump to Time")); | |
1319 gtk_window_set_position(GTK_WINDOW(mainwin_jtt), GTK_WIN_POS_CENTER); | |
1320 gtk_window_set_transient_for(GTK_WINDOW(mainwin_jtt), | |
1321 GTK_WINDOW(mainwin)); | |
1322 | |
1323 g_signal_connect(mainwin_jtt, "destroy", | |
1324 G_CALLBACK(gtk_widget_destroyed), &mainwin_jtt); | |
1325 gtk_container_border_width(GTK_CONTAINER(mainwin_jtt), 10); | |
1326 | |
1327 vbox = gtk_vbox_new(FALSE, 5); | |
1328 gtk_container_add(GTK_CONTAINER(mainwin_jtt), vbox); | |
1329 | |
1330 hbox_new = gtk_hbox_new(FALSE, 0); | |
1331 gtk_box_pack_start(GTK_BOX(vbox), hbox_new, TRUE, TRUE, 5); | |
1332 | |
1333 time_entry = gtk_entry_new(); | |
1334 gtk_box_pack_start(GTK_BOX(hbox_new), time_entry, FALSE, FALSE, 5); | |
1335 g_signal_connect(time_entry, "activate", | |
1336 G_CALLBACK(mainwin_jump_to_time_cb), time_entry); | |
1337 | |
1338 gtk_widget_set_size_request(time_entry, 70, -1); | |
1339 label = gtk_label_new(_("minutes:seconds")); | |
1340 gtk_box_pack_start(GTK_BOX(hbox_new), label, FALSE, FALSE, 5); | |
1341 | |
1342 hbox_total = gtk_hbox_new(FALSE, 0); | |
1343 gtk_box_pack_start(GTK_BOX(vbox), hbox_total, TRUE, TRUE, 5); | |
1344 gtk_widget_show(hbox_total); | |
1345 | |
1346 /* FIXME: Disable display of current track length. It's not | |
1347 updated when track changes */ | |
1348 #if 0 | |
1349 label = gtk_label_new(_("Track length:")); | |
1350 gtk_box_pack_start(GTK_BOX(hbox_total), label, FALSE, FALSE, 5); | |
1351 | |
1352 len = playlist_get_current_length() / 1000; | |
1353 g_snprintf(time_str, sizeof(time_str), "%u:%2.2u", len / 60, len % 60); | |
1354 label = gtk_label_new(time_str); | |
1355 | |
1356 gtk_box_pack_start(GTK_BOX(hbox_total), label, FALSE, FALSE, 10); | |
1357 #endif | |
1358 | |
1359 bbox = gtk_hbutton_box_new(); | |
1360 gtk_box_pack_start(GTK_BOX(vbox), bbox, TRUE, TRUE, 0); | |
1361 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); | |
1362 gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5); | |
1363 | |
1364 cancel = gtk_button_new_from_stock(GTK_STOCK_CANCEL); | |
1365 GTK_WIDGET_SET_FLAGS(cancel, GTK_CAN_DEFAULT); | |
1366 gtk_container_add(GTK_CONTAINER(bbox), cancel); | |
1367 g_signal_connect_swapped(cancel, "clicked", | |
1368 G_CALLBACK(gtk_widget_destroy), mainwin_jtt); | |
1369 | |
1370 jump = gtk_button_new_from_stock(GTK_STOCK_JUMP_TO); | |
1371 GTK_WIDGET_SET_FLAGS(jump, GTK_CAN_DEFAULT); | |
1372 gtk_container_add(GTK_CONTAINER(bbox), jump); | |
1373 g_signal_connect(jump, "clicked", | |
1374 G_CALLBACK(mainwin_jump_to_time_cb), time_entry); | |
1375 | |
1376 tindex = playback_get_time() / 1000; | |
1377 g_snprintf(time_str, sizeof(time_str), "%u:%2.2u", tindex / 60, | |
1378 tindex % 60); | |
1379 gtk_entry_set_text(GTK_ENTRY(time_entry), time_str); | |
1380 | |
1381 gtk_entry_select_region(GTK_ENTRY(time_entry), 0, strlen(time_str)); | |
1382 | |
1383 gtk_widget_show_all(mainwin_jtt); | |
1384 | |
1385 gtk_widget_grab_focus(time_entry); | |
1386 gtk_widget_grab_default(jump); | |
1387 } | |
1388 | |
1389 static gboolean | |
1390 mainwin_configure(GtkWidget * window, | |
1391 GdkEventConfigure * event, | |
1392 gpointer data) | |
1393 { | |
1394 if (!GTK_WIDGET_VISIBLE(window)) | |
1395 return FALSE; | |
1396 | |
1397 if (cfg.show_wm_decorations) | |
1398 gdk_window_get_root_origin(window->window, | |
1399 &cfg.player_x, &cfg.player_y); | |
1400 else | |
1401 gdk_window_get_deskrelative_origin(window->window, | |
1402 &cfg.player_x, &cfg.player_y); | |
1403 return FALSE; | |
1404 } | |
1405 | |
1406 void | |
1407 mainwin_set_back_pixmap(void) | |
1408 { | |
1409 if (cfg.doublesize) | |
1410 gdk_window_set_back_pixmap(mainwin->window, mainwin_bg_x2, 0); | |
1411 else | |
1412 gdk_window_set_back_pixmap(mainwin->window, mainwin_bg, 0); | |
1413 gdk_window_clear(mainwin->window); | |
1414 } | |
1415 | |
1416 /* | |
1417 * Rewritten 09/13/06: | |
1418 * | |
1419 * Remove all of this flaky iter/sourcelist/strsplit stuff. | |
1420 * All we care about is the filepath. | |
1421 * | |
1422 * We can figure this out and easily pass it to xmms_urldecode_plain(). | |
1423 * - nenolod | |
1424 */ | |
1425 void | |
1426 mainwin_drag_data_received(GtkWidget * widget, | |
1427 GdkDragContext * context, | |
1428 gint x, | |
1429 gint y, | |
1430 GtkSelectionData * selection_data, | |
1431 guint info, | |
1432 guint time, | |
1433 gpointer user_data) | |
1434 { | |
1435 Playlist *playlist = playlist_get_active(); | |
1436 | |
1437 g_return_if_fail(selection_data != NULL); | |
1438 g_return_if_fail(selection_data->data != NULL); | |
1439 | |
1440 if (str_has_prefix_nocase((gchar *) selection_data->data, "fonts:///")) | |
1441 { | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
1442 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
|
1443 gchar *decoded = xmms_urldecode_plain(path); |
2313 | 1444 |
1445 cfg.playlist_font = g_strconcat(decoded, strrchr(cfg.playlist_font, ' '), NULL); | |
1446 playlist_list_set_font(cfg.playlist_font); | |
1447 playlistwin_update_list(playlist); | |
1448 | |
1449 g_free(decoded); | |
1450 | |
1451 return; | |
1452 } | |
1453 | |
1454 playlist_clear(playlist); | |
1455 playlist_add_url(playlist, (gchar *) selection_data->data); | |
1456 playback_initiate(); | |
1457 } | |
1458 | |
1459 static void | |
1460 on_add_url_add_clicked(GtkWidget * widget, | |
1461 GtkWidget * entry) | |
1462 { | |
1463 const gchar *text = gtk_entry_get_text(GTK_ENTRY(entry)); | |
1464 if (text && *text) | |
1465 playlist_add_url(playlist_get_active(), text); | |
1466 } | |
1467 | |
1468 static void | |
1469 on_add_url_ok_clicked(GtkWidget * widget, | |
1470 GtkWidget * entry) | |
1471 { | |
1472 Playlist *playlist = playlist_get_active(); | |
1473 | |
1474 const gchar *text = gtk_entry_get_text(GTK_ENTRY(entry)); | |
1475 if (text && *text) | |
1476 { | |
1477 playlist_clear(playlist); | |
1478 playlist_add_url(playlist, text); | |
1479 playback_initiate(); | |
1480 } | |
1481 } | |
1482 | |
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
|
1483 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
|
1484 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
|
1485 { |
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
|
1486 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
|
1487 } |
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2646
diff
changeset
|
1488 |
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2646
diff
changeset
|
1489 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
|
1490 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
|
1491 { |
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2646
diff
changeset
|
1492 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
|
1493 { |
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2646
diff
changeset
|
1494 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
|
1495 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
|
1496 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
|
1497 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
|
1498 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
|
1499 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
|
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 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
|
1502 } |
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2646
diff
changeset
|
1503 |
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 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
|
1505 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
|
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 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
|
1508 { |
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2646
diff
changeset
|
1509 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
|
1510 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
|
1511 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
|
1512 _("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
|
1513 _("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
|
1514 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
|
1515 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
|
1516 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
|
1517 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
|
1518 "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
|
1519 "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
|
1520 "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
|
1521 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
|
1522 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
|
1523 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
|
1524 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
|
1525 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
|
1526 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
|
1527 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
|
1528 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
|
1529 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
|
1530 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
|
1531 } |
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 } |
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 |
2313 | 1534 void |
1535 mainwin_show_add_url_window(void) | |
1536 { | |
1537 static GtkWidget *url_window = NULL; | |
1538 | |
1539 if (!url_window) { | |
1540 url_window = | |
1541 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
|
1542 G_CALLBACK(on_add_url_ok_clicked), |
2313 | 1543 G_CALLBACK(on_add_url_add_clicked)); |
1544 gtk_window_set_transient_for(GTK_WINDOW(url_window), | |
1545 GTK_WINDOW(mainwin)); | |
1546 g_signal_connect(url_window, "destroy", | |
1547 G_CALLBACK(gtk_widget_destroyed), | |
1548 &url_window); | |
1549 } | |
1550 | |
1551 gtk_window_present(GTK_WINDOW(url_window)); | |
1552 } | |
1553 | |
1554 static void | |
1555 check_set( GtkActionGroup * action_group , | |
1556 const gchar * action_name , | |
1557 gboolean is_on ) | |
1558 { | |
1559 /* check_set noew uses gtkaction */ | |
1560 GtkAction *action = gtk_action_group_get_action( action_group , action_name ); | |
1561 if ( action != NULL ) | |
1562 gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(action) , is_on ); | |
1563 return; | |
1564 } | |
1565 | |
1566 void | |
1567 mainwin_eject_pushed(void) | |
1568 { | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
1569 run_filebrowser(PLAY_BUTTON); |
2313 | 1570 } |
1571 | |
1572 void | |
1573 mainwin_rev_pushed(void) | |
1574 { | |
1575 g_get_current_time(&cb_time); | |
1576 | |
1577 seek_initial_pos = hslider_get_position(mainwin_position); | |
1578 seek_state = MAINWIN_SEEK_REV; | |
1579 } | |
1580 | |
1581 void | |
1582 mainwin_rev_release(void) | |
1583 { | |
1584 GTimeVal now_time; | |
1585 GTimeVal delta_time; | |
1586 gulong now_dur; | |
1587 | |
1588 g_get_current_time(&now_time); | |
1589 | |
1590 delta_time.tv_usec = now_time.tv_usec - cb_time.tv_usec; | |
1591 delta_time.tv_sec = now_time.tv_sec - cb_time.tv_sec; | |
1592 | |
1593 now_dur = labs((delta_time.tv_sec * 1000) + (glong) (delta_time.tv_usec / 1000)); | |
1594 | |
1595 if ( now_dur <= TRISTATE_THRESHOLD ) | |
1596 { | |
1597 /* interpret as 'skip to previous song' */ | |
1598 playlist_prev(playlist_get_active()); | |
1599 } | |
1600 else | |
1601 { | |
1602 /* interpret as 'seek' */ | |
1603 mainwin_position_release_cb( hslider_get_position(mainwin_position) ); | |
1604 } | |
1605 | |
1606 seek_state = MAINWIN_SEEK_NIL; | |
1607 } | |
1608 | |
1609 void | |
1610 mainwin_fwd_pushed(void) | |
1611 { | |
1612 g_get_current_time(&cb_time); | |
1613 seek_initial_pos = hslider_get_position(mainwin_position); | |
1614 seek_state = MAINWIN_SEEK_FWD; | |
1615 } | |
1616 | |
1617 void | |
1618 mainwin_fwd_release(void) | |
1619 { | |
1620 GTimeVal now_time; | |
1621 GTimeVal delta_time; | |
1622 gulong now_dur; | |
1623 | |
1624 g_get_current_time(&now_time); | |
1625 | |
1626 delta_time.tv_usec = now_time.tv_usec - cb_time.tv_usec; | |
1627 delta_time.tv_sec = now_time.tv_sec - cb_time.tv_sec; | |
1628 | |
1629 now_dur = labs((delta_time.tv_sec * 1000) + (glong) (delta_time.tv_usec / 1000)); | |
1630 | |
1631 if ( now_dur <= TRISTATE_THRESHOLD ) | |
1632 { | |
2480
bb2f191895ce
[svn] - fixed crash when skipping to next song with an empty playlist
marvin
parents:
2478
diff
changeset
|
1633 /* interpret as 'skip to next song' */ |
2313 | 1634 playlist_next(playlist_get_active()); |
1635 } | |
1636 else | |
1637 { | |
1638 /* interpret as 'seek' */ | |
1639 mainwin_position_release_cb( hslider_get_position(mainwin_position) ); | |
1640 } | |
1641 | |
1642 seek_state = MAINWIN_SEEK_NIL; | |
1643 } | |
1644 | |
1645 void | |
1646 mainwin_play_pushed(void) | |
1647 { | |
1648 if (ab_position_a != -1) | |
1649 playback_seek(ab_position_a / 1000); | |
1650 if (playback_get_paused()) { | |
1651 playback_pause(); | |
1652 return; | |
1653 } | |
1654 | |
1655 if (playlist_get_length(playlist_get_active())) | |
1656 playback_initiate(); | |
1657 else | |
1658 mainwin_eject_pushed(); | |
1659 } | |
1660 | |
1661 void | |
1662 mainwin_stop_pushed(void) | |
1663 { | |
1664 ip_data.stop = TRUE; | |
1665 mainwin_clear_song_info(); | |
1666 playback_stop(); | |
1667 ip_data.stop = FALSE; | |
1668 } | |
1669 | |
1670 void | |
1671 mainwin_shuffle_pushed(gboolean toggled) | |
1672 { | |
1673 check_set( toggleaction_group_others , "playback shuffle" , toggled ); | |
1674 } | |
1675 | |
1676 void | |
1677 mainwin_repeat_pushed(gboolean toggled) | |
1678 { | |
1679 check_set( toggleaction_group_others , "playback repeat" , toggled ); | |
1680 } | |
1681 | |
1682 void | |
1683 mainwin_pl_pushed(gboolean toggled) | |
1684 { | |
1685 if (toggled) | |
1686 playlistwin_show(); | |
1687 else | |
1688 playlistwin_hide(); | |
1689 } | |
1690 | |
1691 gint | |
1692 mainwin_spos_frame_cb(gint pos) | |
1693 { | |
1694 if (mainwin_sposition) { | |
1695 if (pos < 6) | |
1696 mainwin_sposition->hs_knob_nx = mainwin_sposition->hs_knob_px = | |
1697 17; | |
1698 else if (pos < 9) | |
1699 mainwin_sposition->hs_knob_nx = mainwin_sposition->hs_knob_px = | |
1700 20; | |
1701 else | |
1702 mainwin_sposition->hs_knob_nx = mainwin_sposition->hs_knob_px = | |
1703 23; | |
1704 } | |
1705 return 1; | |
1706 } | |
1707 | |
1708 void | |
1709 mainwin_spos_motion_cb(gint pos) | |
1710 { | |
1711 gint time; | |
1712 gchar *time_msg; | |
1713 Playlist *playlist = playlist_get_active(); | |
1714 | |
1715 pos--; | |
1716 | |
1717 time = ((playlist_get_current_length(playlist) / 1000) * pos) / 12; | |
1718 | |
1719 if (cfg.timer_mode == TIMER_REMAINING) { | |
1720 time = (playlist_get_current_length(playlist) / 1000) - time; | |
1721 time_msg = g_strdup_printf("-%2.2d", time / 60); | |
1722 textbox_set_text(mainwin_stime_min, time_msg); | |
1723 g_free(time_msg); | |
1724 } | |
1725 else { | |
1726 time_msg = g_strdup_printf(" %2.2d", time / 60); | |
1727 textbox_set_text(mainwin_stime_min, time_msg); | |
1728 g_free(time_msg); | |
1729 } | |
1730 | |
1731 time_msg = g_strdup_printf("%2.2d", time % 60); | |
1732 textbox_set_text(mainwin_stime_sec, time_msg); | |
1733 g_free(time_msg); | |
1734 } | |
1735 | |
1736 void | |
1737 mainwin_spos_release_cb(gint pos) | |
1738 { | |
1739 playback_seek(((playlist_get_current_length(playlist_get_active()) / 1000) * | |
1740 (pos - 1)) / 12); | |
1741 } | |
1742 | |
1743 void | |
1744 mainwin_position_motion_cb(gint pos) | |
1745 { | |
1746 gint length, time; | |
1747 gchar *seek_msg; | |
1748 | |
1749 length = playlist_get_current_length(playlist_get_active()) / 1000; | |
1750 time = (length * pos) / 219; | |
1751 seek_msg = g_strdup_printf(_("SEEK TO: %d:%-2.2d/%d:%-2.2d (%d%%)"), | |
1752 time / 60, time % 60, | |
1753 length / 60, length % 60, | |
1754 (length != 0) ? (time * 100) / length : 0); | |
1755 mainwin_lock_info_text(seek_msg); | |
1756 g_free(seek_msg); | |
1757 } | |
1758 | |
1759 void | |
1760 mainwin_position_release_cb(gint pos) | |
1761 { | |
1762 gint length, time; | |
1763 | |
1764 length = playlist_get_current_length(playlist_get_active()) / 1000; | |
1765 time = (length * pos) / 219; | |
1766 playback_seek(time); | |
1767 mainwin_release_info_text(); | |
1768 } | |
1769 | |
1770 gint | |
1771 mainwin_volume_frame_cb(gint pos) | |
1772 { | |
1773 return (gint) rint((pos / 52.0) * 28); | |
1774 } | |
1775 | |
1776 void | |
1777 mainwin_adjust_volume_motion(gint v) | |
1778 { | |
1779 gchar *volume_msg; | |
1780 | |
1781 setting_volume = TRUE; | |
1782 | |
1783 volume_msg = g_strdup_printf(_("VOLUME: %d%%"), v); | |
1784 mainwin_lock_info_text(volume_msg); | |
1785 g_free(volume_msg); | |
1786 | |
1787 if (balance < 0) | |
1788 input_set_volume(v, (v * (100 - abs(balance))) / 100); | |
1789 else if (balance > 0) | |
1790 input_set_volume((v * (100 - abs(balance))) / 100, v); | |
1791 else | |
1792 input_set_volume(v, v); | |
1793 } | |
1794 | |
1795 void | |
1796 mainwin_adjust_volume_release(void) | |
1797 { | |
1798 mainwin_release_info_text(); | |
1799 setting_volume = FALSE; | |
1800 read_volume(VOLUME_ADJUSTED); | |
1801 } | |
1802 | |
1803 void | |
1804 mainwin_adjust_balance_motion(gint b) | |
1805 { | |
1806 gchar *balance_msg; | |
1807 gint v, pvl, pvr; | |
1808 | |
1809 setting_volume = TRUE; | |
1810 balance = b; | |
1811 input_get_volume(&pvl, &pvr); | |
1812 v = MAX(pvl, pvr); | |
1813 if (b < 0) { | |
1814 balance_msg = g_strdup_printf(_("BALANCE: %d%% LEFT"), -b); | |
1815 input_set_volume(v, (gint) rint(((100 + b) / 100.0) * v)); | |
1816 } | |
1817 else if (b == 0) { | |
1818 balance_msg = g_strdup_printf(_("BALANCE: CENTER")); | |
1819 input_set_volume(v, v); | |
1820 } | |
1821 else { /* b > 0 */ | |
1822 balance_msg = g_strdup_printf(_("BALANCE: %d%% RIGHT"), b); | |
1823 input_set_volume((gint) rint(((100 - b) / 100.0) * v), v); | |
1824 } | |
1825 mainwin_lock_info_text(balance_msg); | |
1826 g_free(balance_msg); | |
1827 } | |
1828 | |
1829 void | |
1830 mainwin_adjust_balance_release(void) | |
1831 { | |
1832 mainwin_release_info_text(); | |
1833 setting_volume = FALSE; | |
1834 read_volume(VOLUME_ADJUSTED); | |
1835 } | |
1836 | |
1837 void | |
1838 mainwin_set_volume_slider(gint percent) | |
1839 { | |
1840 hslider_set_position(mainwin_volume, (gint) rint((percent * 51) / 100.0)); | |
1841 } | |
1842 | |
1843 void | |
1844 mainwin_set_balance_slider(gint percent) | |
1845 { | |
1846 hslider_set_position(mainwin_balance, | |
1847 (gint) rint(((percent * 12) / 100.0) + 12)); | |
1848 } | |
1849 | |
1850 void | |
1851 mainwin_volume_motion_cb(gint pos) | |
1852 { | |
1853 gint vol = (pos * 100) / 51; | |
1854 mainwin_adjust_volume_motion(vol); | |
1855 equalizerwin_set_volume_slider(vol); | |
1856 } | |
1857 | |
1858 void | |
1859 mainwin_volume_release_cb(gint pos) | |
1860 { | |
1861 mainwin_adjust_volume_release(); | |
1862 } | |
1863 | |
1864 gint | |
1865 mainwin_balance_frame_cb(gint pos) | |
1866 { | |
1867 return ((abs(pos - 12) * 28) / 13); | |
1868 } | |
1869 | |
1870 void | |
1871 mainwin_balance_motion_cb(gint pos) | |
1872 { | |
1873 gint bal = ((pos - 12) * 100) / 12; | |
1874 mainwin_adjust_balance_motion(bal); | |
1875 equalizerwin_set_balance_slider(bal); | |
1876 } | |
1877 | |
1878 void | |
1879 mainwin_balance_release_cb(gint pos) | |
1880 { | |
1881 mainwin_adjust_volume_release(); | |
1882 } | |
1883 | |
1884 void | |
1885 mainwin_set_volume_diff(gint diff) | |
1886 { | |
1887 gint vl, vr, vol; | |
1888 | |
1889 input_get_volume(&vl, &vr); | |
1890 vol = MAX(vl, vr); | |
1891 vol = CLAMP(vol + diff, 0, 100); | |
1892 | |
1893 mainwin_adjust_volume_motion(vol); | |
1894 setting_volume = FALSE; | |
1895 mainwin_set_volume_slider(vol); | |
1896 equalizerwin_set_volume_slider(vol); | |
1897 read_volume(VOLUME_SET); | |
1898 } | |
1899 | |
1900 void | |
1901 mainwin_set_balance_diff(gint diff) | |
1902 { | |
1903 gint b; | |
1904 b = CLAMP(balance + diff, -100, 100); | |
1905 mainwin_adjust_balance_motion(b); | |
1906 setting_volume = FALSE; | |
1907 mainwin_set_balance_slider(b); | |
1908 equalizerwin_set_balance_slider(b); | |
1909 read_volume(VOLUME_SET); | |
1910 } | |
1911 | |
1912 void | |
1913 mainwin_show(gboolean show) | |
1914 { | |
1915 if (show) | |
1916 mainwin_real_show(); | |
1917 else | |
1918 mainwin_real_hide(); | |
1919 } | |
1920 | |
1921 void | |
1922 mainwin_real_show(void) | |
1923 { | |
1924 cfg.player_visible = TRUE; | |
1925 | |
1926 check_set( toggleaction_group_others , "show player" , TRUE ); | |
1927 | |
1928 if (cfg.player_shaded) | |
1929 vis_clear_data(active_vis); | |
1930 | |
1931 mainwin_vis_set_active_vis(MAINWIN_VIS_ACTIVE_MAINWIN); | |
1932 mainwin_set_shape_mask(); | |
1933 | |
1934 if (cfg.show_wm_decorations) { | |
1935 if (!pposition_broken && cfg.player_x != -1 | |
1936 && cfg.save_window_position) | |
1937 gtk_window_move(GTK_WINDOW(mainwin), cfg.player_x, cfg.player_y); | |
1938 | |
1939 gtk_widget_show(mainwin); | |
1940 | |
1941 if (pposition_broken && cfg.player_x != -1 | |
1942 && cfg.save_window_position) | |
1943 gtk_window_move(GTK_WINDOW(mainwin), cfg.player_x, cfg.player_y); | |
1944 | |
1945 return; | |
1946 } | |
1947 | |
1948 gtk_widget_show_all(mainwin); | |
1949 | |
2345
0fb47429ad7e
[svn] - in mainwin_real_show, do not return if a nullmask doesn't exist
giacomo
parents:
2339
diff
changeset
|
1950 if (nullmask) |
0fb47429ad7e
[svn] - in mainwin_real_show, do not return if a nullmask doesn't exist
giacomo
parents:
2339
diff
changeset
|
1951 { |
0fb47429ad7e
[svn] - in mainwin_real_show, do not return if a nullmask doesn't exist
giacomo
parents:
2339
diff
changeset
|
1952 g_object_unref(nullmask); |
0fb47429ad7e
[svn] - in mainwin_real_show, do not return if a nullmask doesn't exist
giacomo
parents:
2339
diff
changeset
|
1953 nullmask = NULL; |
0fb47429ad7e
[svn] - in mainwin_real_show, do not return if a nullmask doesn't exist
giacomo
parents:
2339
diff
changeset
|
1954 } |
2313 | 1955 |
1956 gtk_window_resize(GTK_WINDOW(mainwin), | |
1957 !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
|
1958 bmp_active_skin->properties.mainwin_width, |
2313 | 1959 !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
|
1960 bmp_active_skin->properties.mainwin_height); |
2313 | 1961 |
1962 draw_main_window(TRUE); | |
1963 | |
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
|
1964 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
|
1965 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
|
1966 |
2313 | 1967 gtk_window_present(GTK_WINDOW(mainwin)); |
1968 } | |
1969 | |
1970 void | |
1971 mainwin_real_hide(void) | |
1972 { | |
1973 GdkGC *gc; | |
1974 GdkColor pattern; | |
1975 | |
1976 check_set( toggleaction_group_others , "show player", FALSE); | |
1977 | |
1978 if (cfg.player_shaded) | |
1979 svis_clear_data(mainwin_svis); | |
1980 | |
1981 if (!cfg.show_wm_decorations) { | |
1982 nullmask = gdk_pixmap_new(mainwin->window, 20, 20, 1); | |
1983 gc = gdk_gc_new(nullmask); | |
1984 pattern.pixel = 0; | |
1985 gdk_gc_set_foreground(gc, &pattern); | |
1986 gdk_draw_rectangle(nullmask, gc, TRUE, 0, 0, 20, 20); | |
1987 g_object_unref(gc); | |
1988 gtk_widget_shape_combine_mask(mainwin, nullmask, 0, 0); | |
1989 } | |
1990 | |
1991 gtk_widget_hide(mainwin); | |
1992 | |
1993 mainwin_vis_set_active_vis(MAINWIN_VIS_ACTIVE_PLAYLISTWIN); | |
1994 cfg.player_visible = FALSE; | |
1995 } | |
1996 | |
1997 | |
1998 void | |
1999 mainwin_set_stopaftersong(gboolean stop) | |
2000 { | |
2001 cfg.stopaftersong = stop; | |
2002 check_set(toggleaction_group_others, "stop after current song", cfg.stopaftersong); | |
2003 } | |
2004 | |
2769
bf2d80abf76e
[svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents:
2717
diff
changeset
|
2005 void |
bf2d80abf76e
[svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents:
2717
diff
changeset
|
2006 mainwin_set_noplaylistadvance(gboolean no_advance) |
bf2d80abf76e
[svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents:
2717
diff
changeset
|
2007 { |
bf2d80abf76e
[svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents:
2717
diff
changeset
|
2008 cfg.no_playlist_advance = no_advance; |
bf2d80abf76e
[svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents:
2717
diff
changeset
|
2009 check_set(toggleaction_group_others, "playback no playlist advance", cfg.no_playlist_advance); |
bf2d80abf76e
[svn] Implemented CMD_IS_ADVANCE and CMD_TOGGLE_ADVANCE. Added partial MPRIS support. Root is complete, Player is partially implemented, and TrackList has not been started.
magma
parents:
2717
diff
changeset
|
2010 } |
2313 | 2011 |
2012 static void | |
2013 mainwin_set_doublesize(gboolean doublesize) | |
2014 { | |
2015 gint height; | |
2016 | |
2017 if (cfg.player_shaded) | |
2018 height = MAINWIN_SHADED_HEIGHT; | |
2019 else | |
2020 height = bmp_active_skin->properties.mainwin_height; | |
2021 | |
2022 mainwin_set_shape_mask(); | |
2023 | |
2024 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
|
2025 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
|
2026 bmp_active_skin->properties.mainwin_width * 2, bmp_active_skin->properties.mainwin_height * 2); |
2313 | 2027 |
2028 if (cfg.doublesize) { | |
2029 gdk_window_set_back_pixmap(mainwin->window, mainwin_bg_x2, 0); | |
2030 } | |
2031 else { | |
2032 gdk_window_set_back_pixmap(mainwin->window, mainwin_bg, 0); | |
2033 } | |
2034 | |
2821 | 2035 GList *iter; |
2036 for (iter = GTK_FIXED (SKINNED_WINDOW(mainwin)->fixed)->children; iter; iter = g_list_next (iter)) { | |
2037 GtkFixedChild *child_data = (GtkFixedChild *) iter->data; | |
2038 GtkWidget *child = child_data->widget; | |
2039 g_signal_emit_by_name(child, "set-double-size"); | |
2040 } | |
2041 | |
2313 | 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 { | |
2821 | 2687 mainwin_menubtn = audacious_pbutton_new(); |
2688 audacious_pbutton_setup(mainwin_menubtn, SKINNED_WINDOW(mainwin)->fixed, mainwin_bg, | |
2689 SKINNED_WINDOW(mainwin)->gc, 6, 3, 9, 9, 0, 0, 0, 9, SKIN_TITLEBAR); | |
2690 g_signal_connect(mainwin_menubtn, "clicked", mainwin_menubtn_cb, NULL ); | |
2691 | |
2692 mainwin_minimize = audacious_pbutton_new(); | |
2693 audacious_pbutton_setup(mainwin_minimize, SKINNED_WINDOW(mainwin)->fixed, mainwin_bg, | |
2694 SKINNED_WINDOW(mainwin)->gc, 244, 3, 9, 9, 9, 0, 9, 9, SKIN_TITLEBAR); | |
2695 g_signal_connect(mainwin_minimize, "clicked", mainwin_minimize_cb, NULL ); | |
2696 | |
2697 mainwin_shade = audacious_pbutton_new(); | |
2698 audacious_pbutton_setup(mainwin_shade, SKINNED_WINDOW(mainwin)->fixed, mainwin_bg, | |
2699 SKINNED_WINDOW(mainwin)->gc, 254, 3, 9, 9, 0, | |
2700 cfg.player_shaded ? 27 : 18, 9, cfg.player_shaded ? 27 : 18, SKIN_TITLEBAR); | |
2701 g_signal_connect(mainwin_shade, "clicked", mainwin_shade_toggle, NULL ); | |
2702 | |
2703 mainwin_close = audacious_pbutton_new(); | |
2704 audacious_pbutton_setup(mainwin_close, SKINNED_WINDOW(mainwin)->fixed, mainwin_bg, | |
2705 SKINNED_WINDOW(mainwin)->gc, 264, 3, 9, 9, 18, 0, 18, 9, SKIN_TITLEBAR); | |
2706 g_signal_connect(mainwin_close, "clicked", mainwin_quit_cb, NULL ); | |
2707 | |
2708 mainwin_rew = audacious_pbutton_new(); | |
2709 audacious_pbutton_setup(mainwin_rew, SKINNED_WINDOW(mainwin)->fixed, mainwin_bg, | |
2710 SKINNED_WINDOW(mainwin)->gc, 16, 88, 23, 18, 0, 0, 0, 18, SKIN_CBUTTONS); | |
2711 g_signal_connect(mainwin_rew, "pressed", mainwin_rev_pushed, NULL); | |
2712 g_signal_connect(mainwin_rew, "released", mainwin_rev_release, NULL); | |
2713 | |
2714 mainwin_fwd = audacious_pbutton_new(); | |
2715 audacious_pbutton_setup(mainwin_fwd, SKINNED_WINDOW(mainwin)->fixed, mainwin_bg, | |
2716 SKINNED_WINDOW(mainwin)->gc, 108, 88, 22, 18, 92, 0, 92, 18, SKIN_CBUTTONS); | |
2717 g_signal_connect(mainwin_fwd, "pressed", mainwin_fwd_pushed, NULL); | |
2718 g_signal_connect(mainwin_fwd, "released", mainwin_fwd_release, NULL); | |
2719 | |
2720 mainwin_play = audacious_pbutton_new(); | |
2721 audacious_pbutton_setup(mainwin_play, SKINNED_WINDOW(mainwin)->fixed, mainwin_bg, | |
2722 SKINNED_WINDOW(mainwin)->gc, 39, 88, 23, 18, 23, 0, 23, 18, SKIN_CBUTTONS); | |
2723 g_signal_connect(mainwin_play, "clicked", mainwin_play_pushed, NULL ); | |
2724 | |
2725 mainwin_pause = audacious_pbutton_new(); | |
2726 audacious_pbutton_setup(mainwin_pause, SKINNED_WINDOW(mainwin)->fixed, mainwin_bg, | |
2727 SKINNED_WINDOW(mainwin)->gc, 62, 88, 23, 18, 46, 0, 46, 18, SKIN_CBUTTONS); | |
2728 g_signal_connect(mainwin_pause, "clicked", playback_pause, NULL ); | |
2729 | |
2730 mainwin_stop = audacious_pbutton_new(); | |
2731 audacious_pbutton_setup(mainwin_stop, SKINNED_WINDOW(mainwin)->fixed, mainwin_bg, | |
2732 SKINNED_WINDOW(mainwin)->gc, 85, 88, 23, 18, 69, 0, 69, 18, SKIN_CBUTTONS); | |
2733 g_signal_connect(mainwin_stop, "clicked", mainwin_stop_pushed, NULL ); | |
2734 | |
2735 mainwin_eject = audacious_pbutton_new(); | |
2736 audacious_pbutton_setup(mainwin_eject, SKINNED_WINDOW(mainwin)->fixed, mainwin_bg, | |
2737 SKINNED_WINDOW(mainwin)->gc, 136, 89, 22, 16, 114, 0, 114, 16, SKIN_CBUTTONS); | |
2738 g_signal_connect(mainwin_eject, "clicked", mainwin_eject_pushed, NULL); | |
2313 | 2739 |
2740 mainwin_srew = | |
2525 | 2741 create_sbutton(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 169, 4, 8, |
2313 | 2742 7, mainwin_playlist_prev); |
2743 mainwin_splay = | |
2525 | 2744 create_sbutton(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 177, 4, 10, |
2313 | 2745 7, mainwin_play_pushed); |
2746 mainwin_spause = | |
2525 | 2747 create_sbutton(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 187, 4, 10, |
2313 | 2748 7, playback_pause); |
2749 mainwin_sstop = | |
2525 | 2750 create_sbutton(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 197, 4, 9, |
2313 | 2751 7, mainwin_stop_pushed); |
2752 mainwin_sfwd = | |
2525 | 2753 create_sbutton(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 206, 4, 8, |
2313 | 2754 7, mainwin_playlist_next); |
2755 mainwin_seject = | |
2525 | 2756 create_sbutton(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 216, 4, 9, |
2313 | 2757 7, mainwin_eject_pushed); |
2758 | |
2759 mainwin_shuffle = | |
2525 | 2760 create_tbutton(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 164, 89, 46, |
2313 | 2761 15, 28, 0, 28, 15, 28, 30, 28, 45, |
2762 mainwin_shuffle_pushed, SKIN_SHUFREP); | |
2763 | |
2764 mainwin_repeat = | |
2525 | 2765 create_tbutton(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 210, 89, 28, |
2313 | 2766 15, 0, 0, 0, 15, 0, 30, 0, 45, |
2767 mainwin_repeat_pushed, SKIN_SHUFREP); | |
2768 | |
2769 mainwin_eq = | |
2525 | 2770 create_tbutton(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 219, 58, 23, |
2313 | 2771 12, 0, 61, 46, 61, 0, 73, 46, 73, equalizerwin_show, |
2772 SKIN_SHUFREP); | |
2773 tbutton_set_toggled(mainwin_eq, cfg.equalizer_visible); | |
2774 mainwin_pl = | |
2525 | 2775 create_tbutton(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 242, 58, 23, |
2313 | 2776 12, 23, 61, 69, 61, 23, 73, 69, 73, |
2777 mainwin_pl_pushed, SKIN_SHUFREP); | |
2778 tbutton_set_toggled(mainwin_pl, cfg.playlist_visible); | |
2779 | |
2780 mainwin_info = | |
2525 | 2781 create_textbox(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 112, 27, |
2313 | 2782 153, 1, SKIN_TEXT); |
2783 textbox_set_scroll(mainwin_info, cfg.autoscroll); | |
2784 textbox_set_xfont(mainwin_info, cfg.mainwin_use_xfont, cfg.mainwin_font); | |
2785 | |
2786 mainwin_othertext = | |
2525 | 2787 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
|
2788 153, 1, SKIN_TEXT); |
2313 | 2789 |
2790 mainwin_rate_text = | |
2525 | 2791 create_textbox(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 111, 43, 15, |
2313 | 2792 0, SKIN_TEXT); |
2793 mainwin_freq_text = | |
2525 | 2794 create_textbox(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 156, 43, 10, |
2313 | 2795 0, SKIN_TEXT); |
2796 | |
2797 mainwin_menurow = | |
2525 | 2798 create_menurow(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 10, 22, 304, |
2313 | 2799 0, 304, 44, mainwin_mr_change, mainwin_mr_release, |
2800 SKIN_TITLEBAR); | |
2801 mainwin_menurow->mr_doublesize_selected = cfg.doublesize; | |
2802 mainwin_menurow->mr_always_selected = cfg.always_on_top; | |
2803 | |
2804 mainwin_volume = | |
2525 | 2805 create_hslider(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 107, 57, 68, |
2313 | 2806 13, 15, 422, 0, 422, 14, 11, 15, 0, 0, 51, |
2807 mainwin_volume_frame_cb, mainwin_volume_motion_cb, | |
2808 mainwin_volume_release_cb, SKIN_VOLUME); | |
2809 mainwin_balance = | |
2525 | 2810 create_hslider(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 177, 57, 38, |
2313 | 2811 13, 15, 422, 0, 422, 14, 11, 15, 9, 0, 24, |
2812 mainwin_balance_frame_cb, mainwin_balance_motion_cb, | |
2813 mainwin_balance_release_cb, SKIN_BALANCE); | |
2814 | |
2815 mainwin_monostereo = | |
2525 | 2816 create_monostereo(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 212, 41, |
2313 | 2817 SKIN_MONOSTEREO); |
2818 | |
2819 mainwin_playstatus = | |
2525 | 2820 create_playstatus(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 24, 28); |
2313 | 2821 |
2822 mainwin_minus_num = | |
2525 | 2823 create_number(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 36, 26, |
2313 | 2824 SKIN_NUMBERS); |
2825 widget_hide(WIDGET(mainwin_minus_num)); | |
2826 mainwin_10min_num = | |
2525 | 2827 create_number(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 48, 26, |
2313 | 2828 SKIN_NUMBERS); |
2829 widget_hide(WIDGET(mainwin_10min_num)); | |
2830 | |
2831 mainwin_min_num = | |
2525 | 2832 create_number(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 60, 26, |
2313 | 2833 SKIN_NUMBERS); |
2834 widget_hide(WIDGET(mainwin_min_num)); | |
2835 | |
2836 mainwin_10sec_num = | |
2525 | 2837 create_number(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 78, 26, |
2313 | 2838 SKIN_NUMBERS); |
2839 widget_hide(WIDGET(mainwin_10sec_num)); | |
2840 | |
2841 mainwin_sec_num = | |
2525 | 2842 create_number(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 90, 26, |
2313 | 2843 SKIN_NUMBERS); |
2844 widget_hide(WIDGET(mainwin_sec_num)); | |
2845 | |
2846 mainwin_about = | |
2525 | 2847 create_sbutton(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 247, 83, 20, |
2313 | 2848 25, show_about_window); |
2849 | |
2850 mainwin_vis = | |
2525 | 2851 create_vis(&mainwin_wlist, mainwin_bg, mainwin->window, SKINNED_WINDOW(mainwin)->gc, |
2313 | 2852 24, 43, 76, cfg.doublesize); |
2525 | 2853 mainwin_svis = create_svis(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 79, 5); |
2313 | 2854 active_vis = mainwin_vis; |
2855 | |
2856 mainwin_position = | |
2525 | 2857 create_hslider(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 16, 72, 248, |
2313 | 2858 10, 248, 0, 278, 0, 29, 10, 10, 0, 0, 219, NULL, |
2859 mainwin_position_motion_cb, | |
2860 mainwin_position_release_cb, SKIN_POSBAR); | |
2861 widget_hide(WIDGET(mainwin_position)); | |
2862 | |
2863 mainwin_sposition = | |
2525 | 2864 create_hslider(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 226, 4, 17, |
2313 | 2865 7, 17, 36, 17, 36, 3, 7, 36, 0, 1, 13, |
2866 mainwin_spos_frame_cb, mainwin_spos_motion_cb, | |
2867 mainwin_spos_release_cb, SKIN_TITLEBAR); | |
2868 widget_hide(WIDGET(mainwin_sposition)); | |
2869 | |
2870 mainwin_stime_min = | |
2525 | 2871 create_textbox(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 130, 4, 15, |
2313 | 2872 FALSE, SKIN_TEXT); |
2873 mainwin_stime_sec = | |
2525 | 2874 create_textbox(&mainwin_wlist, mainwin_bg, SKINNED_WINDOW(mainwin)->gc, 147, 4, 10, |
2313 | 2875 FALSE, SKIN_TEXT); |
2876 | |
2877 if (!cfg.player_shaded) { | |
2878 widget_hide(WIDGET(mainwin_svis)); | |
2879 widget_hide(WIDGET(mainwin_srew)); | |
2880 widget_hide(WIDGET(mainwin_splay)); | |
2881 widget_hide(WIDGET(mainwin_spause)); | |
2882 widget_hide(WIDGET(mainwin_sstop)); | |
2883 widget_hide(WIDGET(mainwin_sfwd)); | |
2884 widget_hide(WIDGET(mainwin_seject)); | |
2885 widget_hide(WIDGET(mainwin_stime_min)); | |
2886 widget_hide(WIDGET(mainwin_stime_sec)); | |
2887 } | |
2888 | |
2889 err = gtk_message_dialog_new(GTK_WINDOW(mainwin), GTK_DIALOG_DESTROY_WITH_PARENT|GTK_DIALOG_MODAL, | |
2890 GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, _("Error in Audacious.")); | |
2891 | |
2892 | |
2893 gtk_window_set_position(GTK_WINDOW(err), GTK_WIN_POS_CENTER); | |
2894 /* Dang well better set an error message or you'll see this */ | |
2895 gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(err), | |
2896 "Boo! Bad stuff! Booga Booga!"); | |
2897 | |
2821 | 2898 gtk_container_add(GTK_CONTAINER(mainwin), GTK_WIDGET(SKINNED_WINDOW(mainwin)->fixed)); |
2496
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
2899 /* XXX: eventually update widgetcore API to not need this */ |
2821 | 2900 |
2496
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_eject)); |
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
2902 |
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
2903 ui_skinned_window_widgetlist_associate(mainwin, WIDGET(mainwin_srew)); |
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_splay)); |
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_spause)); |
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
2906 ui_skinned_window_widgetlist_associate(mainwin, WIDGET(mainwin_sstop)); |
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_sfwd)); |
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_seject)); |
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_shuffle)); |
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_repeat)); |
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_eq)); |
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_pl)); |
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_info)); |
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_othertext)); |
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_rate_text)); |
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
2920 ui_skinned_window_widgetlist_associate(mainwin, WIDGET(mainwin_freq_text)); |
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
2921 |
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_menurow)); |
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_volume)); |
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_balance)); |
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_monostereo)); |
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_playstatus)); |
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
2929 |
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_minus_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_10min_num)); |
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
2932 ui_skinned_window_widgetlist_associate(mainwin, WIDGET(mainwin_min_num)); |
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_10sec_num)); |
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
2934 ui_skinned_window_widgetlist_associate(mainwin, WIDGET(mainwin_sec_num)); |
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
2935 |
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_about)); |
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_vis)); |
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_svis)); |
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_position)); |
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_sposition)); |
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
2943 |
71bee08db1c6
[svn] - widgetlist -> SkinnedWindow class + basic conversion in ui_main, other skinned windows remain
nenolod
parents:
2495
diff
changeset
|
2944 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
|
2945 ui_skinned_window_widgetlist_associate(mainwin, WIDGET(mainwin_stime_sec)); |
2313 | 2946 } |
2947 | |
2948 static void | |
2949 mainwin_create_window(void) | |
2950 { | |
2951 gint width, height; | |
2952 | |
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
|
2953 mainwin = ui_skinned_window_new(GTK_WINDOW_TOPLEVEL, "player"); |
2313 | 2954 gtk_window_set_title(GTK_WINDOW(mainwin), _("Audacious")); |
2955 gtk_window_set_role(GTK_WINDOW(mainwin), "player"); | |
2956 gtk_window_set_resizable(GTK_WINDOW(mainwin), FALSE); | |
2957 | |
2958 width = cfg.player_shaded ? MAINWIN_SHADED_WIDTH : bmp_active_skin->properties.mainwin_width; | |
2959 height = cfg.player_shaded ? MAINWIN_SHADED_HEIGHT : bmp_active_skin->properties.mainwin_height; | |
2960 | |
2961 if (cfg.doublesize) { | |
2962 width *= 2; | |
2963 height *= 2; | |
2964 } | |
2965 | |
2966 gtk_widget_set_size_request(mainwin, width, height); | |
2967 | |
2968 if (cfg.player_x != -1 && cfg.save_window_position) | |
2969 gtk_window_move(GTK_WINDOW(mainwin), cfg.player_x, cfg.player_y); | |
2970 | |
2971 g_signal_connect(mainwin, "destroy", G_CALLBACK(mainwin_destroy), NULL); | |
2972 g_signal_connect(mainwin, "button_press_event", | |
2973 G_CALLBACK(mainwin_mouse_button_press), NULL); | |
2974 g_signal_connect(mainwin, "scroll_event", | |
2975 G_CALLBACK(mainwin_scrolled), NULL); | |
2976 g_signal_connect(mainwin, "button_release_event", | |
2977 G_CALLBACK(mainwin_mouse_button_release), NULL); | |
2978 g_signal_connect(mainwin, "motion_notify_event", | |
2979 G_CALLBACK(mainwin_motion), NULL); | |
2980 g_signal_connect_after(mainwin, "focus_in_event", | |
2981 G_CALLBACK(mainwin_focus_in), NULL); | |
2982 g_signal_connect_after(mainwin, "focus_out_event", | |
2983 G_CALLBACK(mainwin_focus_out), NULL); | |
2984 g_signal_connect(mainwin, "configure_event", | |
2985 G_CALLBACK(mainwin_configure), NULL); | |
2986 g_signal_connect(mainwin, "style_set", | |
2987 G_CALLBACK(mainwin_set_back_pixmap), NULL); | |
2988 | |
2989 bmp_drag_dest_set(mainwin); | |
2990 | |
2991 g_signal_connect(mainwin, "key_press_event", | |
2992 G_CALLBACK(mainwin_keypress), NULL); | |
2993 } | |
2994 | |
2995 void | |
2996 mainwin_create(void) | |
2997 { | |
2998 mainwin_create_window(); | |
2999 | |
3000 gtk_window_add_accel_group( GTK_WINDOW(mainwin) , ui_manager_get_accel_group() ); | |
3001 | |
3002 mainwin_bg = gdk_pixmap_new(mainwin->window, | |
3003 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
|
3004 bmp_active_skin->properties.mainwin_height, -1); |
2313 | 3005 mainwin_bg_x2 = gdk_pixmap_new(mainwin->window, |
3006 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
|
3007 bmp_active_skin->properties.mainwin_height * 2, -1); |
2313 | 3008 mainwin_set_back_pixmap(); |
3009 mainwin_create_widgets(); | |
3010 | |
3011 vis_set_window(mainwin_vis, mainwin->window); | |
3012 } | |
3013 | |
3014 void | |
3015 mainwin_attach_idle_func(void) | |
3016 { | |
3017 mainwin_timeout_id = g_timeout_add(MAINWIN_UPDATE_INTERVAL, | |
3018 mainwin_idle_func, NULL); | |
3019 } | |
3020 | |
3021 static void | |
3022 idle_func_update_song_info(gint time) | |
3023 { | |
3024 gint length, t; | |
3025 gchar stime_prefix; | |
3026 | |
3027 if (ab_position_a != -1 && ab_position_b != -1 && time > ab_position_b) | |
3028 playback_seek(ab_position_a/1000); | |
3029 | |
3030 length = playlist_get_current_length(playlist_get_active()); | |
3031 if (playback_get_playing()) | |
3032 playlistwin_set_time(time, length, cfg.timer_mode); | |
3033 else | |
3034 playlistwin_hide_timer(); | |
3035 input_update_vis(time); | |
3036 | |
3037 if (cfg.timer_mode == TIMER_REMAINING) { | |
3038 if (length != -1) { | |
3039 number_set_number(mainwin_minus_num, 11); | |
3040 t = length - time; | |
3041 stime_prefix = '-'; | |
3042 } | |
3043 else { | |
3044 number_set_number(mainwin_minus_num, 10); | |
3045 t = time; | |
3046 stime_prefix = ' '; | |
3047 } | |
3048 } | |
3049 else { | |
3050 number_set_number(mainwin_minus_num, 10); | |
3051 t = time; | |
3052 stime_prefix = ' '; | |
3053 } | |
3054 t /= 1000; | |
3055 | |
3056 /* Show the time in the format HH:MM when we have more than 100 | |
3057 * minutes. */ | |
3058 if (t >= 100 * 60) | |
3059 t /= 60; | |
3060 number_set_number(mainwin_10min_num, t / 600); | |
3061 number_set_number(mainwin_min_num, (t / 60) % 10); | |
3062 number_set_number(mainwin_10sec_num, (t / 10) % 6); | |
3063 number_set_number(mainwin_sec_num, t % 10); | |
3064 | |
3065 if (!mainwin_sposition->hs_pressed) { | |
3066 gchar *time_str; | |
3067 | |
3068 time_str = g_strdup_printf("%c%2.2d", stime_prefix, t / 60); | |
3069 textbox_set_text(mainwin_stime_min, time_str); | |
3070 g_free(time_str); | |
3071 | |
3072 time_str = g_strdup_printf("%2.2d", t % 60); | |
3073 textbox_set_text(mainwin_stime_sec, time_str); | |
3074 g_free(time_str); | |
3075 } | |
3076 | |
3077 time /= 1000; | |
3078 length /= 1000; | |
3079 if (length > 0) { | |
3080 if (time > length) { | |
3081 hslider_set_position(mainwin_position, 219); | |
3082 hslider_set_position(mainwin_sposition, 13); | |
3083 } | |
3084 /* update the slider position ONLY if there is not a seek in progress */ | |
3085 else if (seek_state == MAINWIN_SEEK_NIL) { | |
3086 hslider_set_position(mainwin_position, (time * 219) / length); | |
3087 hslider_set_position(mainwin_sposition, | |
3088 ((time * 12) / length) + 1); | |
3089 } | |
3090 } | |
3091 else { | |
3092 hslider_set_position(mainwin_position, 0); | |
3093 hslider_set_position(mainwin_sposition, 1); | |
3094 } | |
3095 } | |
3096 | |
3097 static gboolean | |
3098 mainwin_idle_func(gpointer data) | |
3099 { | |
3100 static gint count = 0; | |
3101 gint time = 0; | |
3102 | |
3103 /* run audcore events, then run our own. --nenolod */ | |
3104 switch((time = audcore_generic_events())) | |
3105 { | |
3106 case -2: | |
3107 /* no usable output device */ | |
3108 GDK_THREADS_ENTER(); | |
3109 run_no_output_device_dialog(); | |
3110 mainwin_stop_pushed(); | |
3111 GDK_THREADS_LEAVE(); | |
3112 ev_waiting = FALSE; | |
3113 break; | |
3114 | |
3115 default: | |
3116 idle_func_update_song_info(time); | |
3117 /* nothing at this time */ | |
3118 } | |
3119 | |
3120 GDK_THREADS_ENTER(); | |
3121 | |
3122 if (playback_get_playing()) | |
3123 vis_playback_start(); | |
3124 else { | |
3125 vis_playback_stop(); | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3126 ab_position_a = ab_position_b = -1; |
2313 | 3127 } |
3128 | |
3129 draw_main_window(mainwin_force_redraw); | |
3130 | |
3131 if (!count) { | |
3132 read_volume(VOLSET_UPDATE); | |
3133 count = 10; | |
3134 } | |
3135 else | |
3136 count--; | |
3137 | |
3138 mainwin_force_redraw = FALSE; | |
3139 draw_equalizer_window(FALSE); | |
3140 draw_playlist_window(FALSE); | |
3141 | |
3142 if (mainwin_title_text) { | |
3143 G_LOCK(mainwin_title); | |
3144 gtk_window_set_title(GTK_WINDOW(mainwin), mainwin_title_text); | |
3145 g_free(mainwin_title_text); | |
3146 mainwin_title_text = NULL; | |
3147 G_UNLOCK(mainwin_title); | |
3148 | |
3149 mainwin_set_info_text(); | |
3150 playlistwin_update_list(playlist_get_active()); | |
3151 } | |
3152 | |
3153 /* tristate buttons seek */ | |
3154 if ( seek_state != MAINWIN_SEEK_NIL ) | |
3155 { | |
3156 GTimeVal now_time; | |
3157 GTimeVal delta_time; | |
3158 gulong now_dur; | |
3159 g_get_current_time(&now_time); | |
3160 | |
3161 delta_time.tv_usec = now_time.tv_usec - cb_time.tv_usec; | |
3162 delta_time.tv_sec = now_time.tv_sec - cb_time.tv_sec; | |
3163 | |
3164 now_dur = labs((delta_time.tv_sec * 1000) + (glong) (delta_time.tv_usec / 1000)); | |
3165 | |
3166 if ( now_dur > TRISTATE_THRESHOLD ) | |
3167 { | |
3168 gint np; | |
3169 if (seek_state == MAINWIN_SEEK_REV) | |
3170 np = seek_initial_pos - labs((gulong)(now_dur/100)); /* seek back */ | |
3171 else | |
3172 np = seek_initial_pos + labs((gulong)(now_dur/100)); /* seek forward */ | |
3173 | |
3174 /* boundaries check */ | |
3175 if (np < 0 ) | |
3176 np = 0; | |
3177 else if ( np > 219 ) | |
3178 np = 219; | |
3179 | |
3180 hslider_set_position( mainwin_position , np ); | |
3181 mainwin_position_motion_cb( np ); | |
3182 } | |
3183 } | |
3184 | |
3185 GDK_THREADS_LEAVE(); | |
3186 | |
3187 /* | |
3188 if (seek_state == MAINWIN_SEEK_REV) | |
3189 playback_seek(CLAMP(playback_get_time() - 1000, 0, | |
3190 playlist_get_current_length()) / 1000); | |
3191 else if (seek_state == MAINWIN_SEEK_FWD) | |
3192 playback_seek(CLAMP(playback_get_time() + 1000, 0, | |
3193 playlist_get_current_length()) / 1000); | |
3194 */ | |
3195 | |
3196 return TRUE; | |
3197 } | |
3198 | |
3199 | |
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
|
3200 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
|
3201 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
|
3202 { |
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 /* 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
|
3204 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
|
3205 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
|
3206 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
|
3207 } |
0fb258122933
[svn] - added audacious_menu_main_show(x,y,button,time) in util.h, convenience function to display the audacious main popup menu
giacomo
parents:
2345
diff
changeset
|
3208 |
0fb258122933
[svn] - added audacious_menu_main_show(x,y,button,time) in util.h, convenience function to display the audacious main popup menu
giacomo
parents:
2345
diff
changeset
|
3209 |
2313 | 3210 /* toggleactionentries actions */ |
3211 | |
3212 void | |
3213 action_anamode_peaks( GtkToggleAction * action ) | |
3214 { | |
3215 cfg.analyzer_peaks = gtk_toggle_action_get_active( action ); | |
3216 } | |
3217 | |
3218 void | |
3219 action_autoscroll_songname( GtkToggleAction * action ) | |
3220 { | |
3221 mainwin_set_title_scroll(gtk_toggle_action_get_active(action)); | |
3222 playlistwin_set_sinfo_scroll(cfg.autoscroll); /* propagate scroll setting to playlistwin_sinfo */ | |
3223 } | |
3224 | |
3225 void | |
3226 action_playback_noplaylistadvance( GtkToggleAction * action ) | |
3227 { | |
3228 cfg.no_playlist_advance = gtk_toggle_action_get_active( action ); | |
3229 } | |
3230 | |
3231 void | |
3232 action_playback_repeat( GtkToggleAction * action ) | |
3233 { | |
3234 cfg.repeat = gtk_toggle_action_get_active( action ); | |
3235 tbutton_set_toggled(mainwin_repeat, cfg.repeat); | |
3236 } | |
3237 | |
3238 void | |
3239 action_playback_shuffle( GtkToggleAction * action ) | |
3240 { | |
3241 cfg.shuffle = gtk_toggle_action_get_active( action ); | |
3242 playlist_set_shuffle(cfg.shuffle); | |
3243 tbutton_set_toggled(mainwin_shuffle, cfg.shuffle); | |
3244 } | |
3245 | |
3246 void | |
3247 action_stop_after_current_song( GtkToggleAction * action ) | |
3248 { | |
3249 cfg.stopaftersong = gtk_toggle_action_get_active( action ); | |
3250 } | |
3251 | |
3252 void | |
3253 action_view_always_on_top( GtkToggleAction * action ) | |
3254 { | |
3255 mainwin_menurow->mr_always_selected = gtk_toggle_action_get_active( action ); | |
3256 cfg.always_on_top = mainwin_menurow->mr_always_selected; | |
3257 widget_draw(WIDGET(mainwin_menurow)); | |
3258 | |
3259 if (starting_up == FALSE) | |
3260 hint_set_always(cfg.always_on_top); | |
3261 } | |
3262 | |
3263 void | |
3264 action_view_doublesize( GtkToggleAction * action ) | |
3265 { | |
3266 mainwin_menurow->mr_doublesize_selected = gtk_toggle_action_get_active( action ); | |
3267 widget_draw(WIDGET(mainwin_menurow)); | |
3268 set_doublesize(mainwin_menurow->mr_doublesize_selected); | |
3269 gdk_flush(); | |
3270 } | |
3271 | |
3272 void | |
3273 action_view_easymove( GtkToggleAction * action ) | |
3274 { | |
3275 cfg.easy_move = gtk_toggle_action_get_active( action ); | |
3276 } | |
3277 | |
3278 void | |
3279 action_view_on_all_workspaces( GtkToggleAction * action ) | |
3280 { | |
3281 cfg.sticky = gtk_toggle_action_get_active( action ); | |
3282 hint_set_sticky(cfg.sticky); | |
3283 } | |
3284 | |
3285 void | |
3286 action_roll_up_equalizer( GtkToggleAction * action ) | |
3287 { | |
3288 equalizerwin_set_shade_menu_cb(gtk_toggle_action_get_active(action)); | |
3289 } | |
3290 | |
3291 void | |
3292 action_roll_up_player( GtkToggleAction * action ) | |
3293 { | |
3294 mainwin_set_shade_menu_cb(gtk_toggle_action_get_active(action)); | |
3295 } | |
3296 | |
3297 void | |
3298 action_roll_up_playlist_editor( GtkToggleAction * action ) | |
3299 { | |
3300 playlistwin_set_shade(gtk_toggle_action_get_active(action)); | |
3301 } | |
3302 | |
3303 void | |
3304 action_show_equalizer( GtkToggleAction * action ) | |
3305 { | |
3306 if (gtk_toggle_action_get_active(action)) | |
3307 equalizerwin_real_show(); | |
3308 else | |
3309 equalizerwin_real_hide(); | |
3310 } | |
3311 | |
3312 void | |
3313 action_show_playlist_editor( GtkToggleAction * action ) | |
3314 { | |
3315 if (gtk_toggle_action_get_active(action)) | |
3316 playlistwin_show(); | |
3317 else | |
3318 playlistwin_hide(); | |
3319 } | |
3320 | |
3321 void | |
3322 action_show_player( GtkToggleAction * action ) | |
3323 { | |
3324 mainwin_show(gtk_toggle_action_get_active(action)); | |
3325 } | |
3326 | |
3327 | |
3328 /* radioactionentries actions (one callback for each radio group) */ | |
3329 | |
3330 void | |
3331 action_anafoff( GtkAction *action, GtkRadioAction *current ) | |
3332 { | |
3333 mainwin_vis_set_afalloff(gtk_radio_action_get_current_value(current)); | |
3334 } | |
3335 | |
3336 void | |
3337 action_anamode( GtkAction *action, GtkRadioAction *current ) | |
3338 { | |
3339 mainwin_vis_set_analyzer_mode(gtk_radio_action_get_current_value(current)); | |
3340 } | |
3341 | |
3342 void | |
3343 action_anatype( GtkAction *action, GtkRadioAction *current ) | |
3344 { | |
3345 mainwin_vis_set_analyzer_type(gtk_radio_action_get_current_value(current)); | |
3346 } | |
3347 | |
3348 void | |
3349 action_peafoff( GtkAction *action, GtkRadioAction *current ) | |
3350 { | |
3351 mainwin_vis_set_pfalloff(gtk_radio_action_get_current_value(current)); | |
3352 } | |
3353 | |
3354 void | |
3355 action_refrate( GtkAction *action, GtkRadioAction *current ) | |
3356 { | |
3357 mainwin_vis_set_refresh(gtk_radio_action_get_current_value(current)); | |
3358 } | |
3359 | |
3360 void | |
3361 action_scomode( GtkAction *action, GtkRadioAction *current ) | |
3362 { | |
3363 cfg.scope_mode = gtk_radio_action_get_current_value(current); | |
3364 } | |
3365 | |
3366 void | |
3367 action_vismode( GtkAction *action, GtkRadioAction *current ) | |
3368 { | |
3369 mainwin_vis_set_type_menu_cb(gtk_radio_action_get_current_value(current)); | |
3370 } | |
3371 | |
3372 void | |
3373 action_vprmode( GtkAction *action, GtkRadioAction *current ) | |
3374 { | |
3375 cfg.voiceprint_mode = gtk_radio_action_get_current_value(current); | |
3376 } | |
3377 | |
3378 void | |
3379 action_wshmode( GtkAction *action, GtkRadioAction *current ) | |
3380 { | |
3381 cfg.vu_mode = gtk_radio_action_get_current_value(current); | |
3382 } | |
3383 | |
3384 void | |
3385 action_viewtime( GtkAction *action, GtkRadioAction *current ) | |
3386 { | |
3387 set_timer_mode_menu_cb(gtk_radio_action_get_current_value(current)); | |
3388 } | |
3389 | |
3390 | |
3391 /* actionentries actions */ | |
3392 | |
3393 void | |
3394 action_about_audacious( void ) | |
3395 { | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3396 show_about_window(); |
2313 | 3397 } |
3398 | |
3399 void | |
3400 action_play_file( void ) | |
3401 { | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3402 run_filebrowser(PLAY_BUTTON); |
2313 | 3403 } |
3404 | |
3405 void | |
3406 action_play_location( void ) | |
3407 { | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3408 mainwin_show_add_url_window(); |
2313 | 3409 } |
3410 | |
3411 void | |
3412 action_ab_set( void ) | |
3413 { | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3414 Playlist *playlist = playlist_get_active(); |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3415 if (playlist_get_current_length(playlist) != -1) |
2313 | 3416 { |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3417 if (ab_position_a == -1) |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3418 { |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3419 ab_position_a = playback_get_time(); |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3420 ab_position_b = -1; |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3421 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
|
3422 } |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3423 else if (ab_position_b == -1) |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3424 { |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3425 int time = playback_get_time(); |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3426 if (time > ab_position_a) |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3427 ab_position_b = time; |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3428 mainwin_release_info_text(); |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3429 } |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3430 else |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3431 { |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3432 ab_position_a = playback_get_time(); |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3433 ab_position_b = -1; |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3434 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
|
3435 } |
2313 | 3436 } |
3437 } | |
3438 | |
3439 void | |
3440 action_ab_clear( void ) | |
3441 { | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3442 Playlist *playlist = playlist_get_active(); |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3443 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
|
3444 { |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3445 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
|
3446 mainwin_release_info_text(); |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3447 } |
2313 | 3448 } |
3449 | |
3450 void | |
3451 action_current_track_info( void ) | |
3452 { | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3453 playlist_fileinfo_current(playlist_get_active()); |
2313 | 3454 } |
3455 | |
3456 void | |
3457 action_jump_to_file( void ) | |
3458 { | |
2500 | 3459 ui_jump_to_track(); |
2313 | 3460 } |
3461 | |
3462 void | |
3463 action_jump_to_playlist_start( void ) | |
3464 { | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3465 Playlist *playlist = playlist_get_active(); |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3466 playlist_set_position(playlist, 0); |
2313 | 3467 } |
3468 | |
3469 void | |
3470 action_jump_to_time( void ) | |
3471 { | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3472 mainwin_jump_to_time(); |
2313 | 3473 } |
3474 | |
3475 void | |
3476 action_playback_next( void ) | |
3477 { | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3478 Playlist *playlist = playlist_get_active(); |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3479 playlist_next(playlist); |
2313 | 3480 } |
3481 | |
3482 void | |
3483 action_playback_previous( void ) | |
3484 { | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3485 Playlist *playlist = playlist_get_active(); |
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3486 playlist_prev(playlist); |
2313 | 3487 } |
3488 | |
3489 void | |
3490 action_playback_play( void ) | |
3491 { | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3492 mainwin_play_pushed(); |
2313 | 3493 } |
3494 | |
3495 void | |
3496 action_playback_playcd( void ) | |
3497 { | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3498 play_medium(); |
2313 | 3499 } |
3500 | |
3501 void | |
3502 action_playback_pause( void ) | |
3503 { | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3504 playback_pause(); |
2313 | 3505 } |
3506 | |
3507 void | |
3508 action_playback_stop( void ) | |
3509 { | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3510 mainwin_stop_pushed(); |
2313 | 3511 } |
3512 | |
3513 void | |
3514 action_preferences( void ) | |
3515 { | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3516 show_prefs_window(); |
2313 | 3517 } |
3518 | |
3519 void | |
3520 action_quit( void ) | |
3521 { | |
2416
0fd7f4f969ad
[svn] integrated urldecode.* from libaudacious into audacious directory, made separate ui_fileopener.*
mf0102
parents:
2373
diff
changeset
|
3522 mainwin_quit_cb(); |
2313 | 3523 } |