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