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