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