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