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