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