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