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