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