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