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