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