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