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