Mercurial > audlegacy
annotate audacious/mainwin.c @ 967:55757f96ef5d trunk
[svn] Force dependance on taglib now used by mpg123 and musepack.
author | nemo |
---|---|
date | Mon, 24 Apr 2006 14:03:16 -0700 |
parents | 25963e82c40f |
children | c9915a0559f7 |
rev | line source |
---|---|
0 | 1 /* BMP - Cross-platform multimedia player |
2 * Copyright (C) 2003-2004 BMP development team. | |
3 * | |
4 * Based on XMMS: | |
5 * Copyright (C) 1998-2003 XMMS development team. | |
6 * | |
7 * This program is free software; you can redistribute it and/or modify | |
8 * it under the terms of the GNU General Public License as published by | |
9 * the Free Software Foundation; either version 2 of the License, or | |
10 * (at your option) any later version. | |
11 * | |
12 * This program is distributed in the hope that it will be useful, | |
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 * GNU General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU General Public License | |
18 * along with this program; if not, write to the Free Software | |
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
20 */ | |
21 | |
22 #ifdef HAVE_CONFIG_H | |
23 # include "config.h" | |
24 #endif | |
25 | |
26 | |
27 #include <glib.h> | |
28 #include <glib/gi18n.h> | |
29 #include <glib/gprintf.h> | |
30 #include <gtk/gtk.h> | |
781
12c47704b4b5
[svn] Add error reporting for many places, patch by external contributor Derek
nenolod
parents:
654
diff
changeset
|
31 #include <gtk/gtkmessagedialog.h> |
0 | 32 #include <gdk/gdkx.h> |
33 #include <gdk/gdkkeysyms.h> | |
34 | |
35 #include <math.h> | |
36 #include <stdlib.h> | |
37 #include <string.h> | |
38 | |
39 #include <X11/Xlib.h> | |
40 | |
41 #include "textbox.h" | |
42 #include "mainwin.h" | |
43 #include "pixmaps.h" | |
44 | |
45 #include "main.h" | |
46 | |
47 #include "controlsocket.h" | |
48 #include "pluginenum.h" | |
49 | |
471 | 50 #include "credits.h" |
0 | 51 #include "dnd.h" |
52 #include "dock.h" | |
53 #include "equalizer.h" | |
54 #include "hints.h" | |
55 #include "input.h" | |
383 | 56 #include "ui_playlist.h" |
0 | 57 #include "prefswin.h" |
58 #include "skinwin.h" | |
197
ccd034857702
[svn] Split up generic events into audcore_generic_events(), and client-specific stuff remains in mainwin_idle_func().
nenolod
parents:
196
diff
changeset
|
59 #include "genevent.h" |
0 | 60 #include "hslider.h" |
61 #include "menurow.h" | |
62 #include "monostereo.h" | |
63 #include "pbutton.h" | |
538
e4e897d20791
[svn] remove libaudcore, we never did anything with it
nenolod
parents:
536
diff
changeset
|
64 #include "playback.h" |
0 | 65 #include "playlist.h" |
66 #include "playlist_list.h" | |
67 #include "playstatus.h" | |
68 #include "sbutton.h" | |
69 #include "svis.h" | |
70 #include "textbox.h" | |
71 #include "urldecode.h" | |
72 #include "util.h" | |
73 #include "vis.h" | |
74 #include "visualization.h" | |
75 #include "libaudacious/configdb.h" | |
76 | |
434
7ffecac12107
[svn] Logic stuff relating to tristate-seek. Now I just need to work it into the event loop.
nenolod
parents:
433
diff
changeset
|
77 static GTimeVal cb_time; /* 150ms click delay for tristate --nenolod */ |
7ffecac12107
[svn] Logic stuff relating to tristate-seek. Now I just need to work it into the event loop.
nenolod
parents:
433
diff
changeset
|
78 |
0 | 79 #define ITEM_SEPARATOR {"/-", NULL, NULL, 0, "<Separator>"} |
80 | |
81 /* | |
82 * If you change the menu above change these defines also | |
83 */ | |
84 | |
85 #define MAINWIN_VIS_MENU_VIS_MODE 1 | |
86 #define MAINWIN_VIS_MENU_NUM_VIS_MODE 3 | |
87 #define MAINWIN_VIS_MENU_ANALYZER_MODE 5 | |
88 #define MAINWIN_VIS_MENU_NUM_ANALYZER_MODE 3 | |
89 #define MAINWIN_VIS_MENU_ANALYZER_TYPE 9 | |
90 #define MAINWIN_VIS_MENU_NUM_ANALYZER_TYPE 2 | |
91 #define MAINWIN_VIS_MENU_ANALYZER_PEAKS 12 | |
92 #define MAINWIN_VIS_MENU_SCOPE_MODE 14 | |
93 #define MAINWIN_VIS_MENU_NUM_SCOPE_MODE 3 | |
94 #define MAINWIN_VIS_MENU_WSHADEVU_MODE 18 | |
95 #define MAINWIN_VIS_MENU_NUM_WSHADEVU_MODE 2 | |
96 #define MAINWIN_VIS_MENU_REFRESH_RATE 21 | |
97 #define MAINWIN_VIS_MENU_NUM_REFRESH_RATE 4 | |
98 #define MAINWIN_VIS_MENU_AFALLOFF 26 | |
99 #define MAINWIN_VIS_MENU_NUM_AFALLOFF 5 | |
100 #define MAINWIN_VIS_MENU_PFALLOFF 32 | |
101 #define MAINWIN_VIS_MENU_NUM_PFALLOFF 5 | |
102 | |
103 #define VOLSET_DISP_TIMES 5 | |
104 | |
433
041bc95827be
[svn] Convert prev/next buttons to tristate, via create_pbutton_ex().
nenolod
parents:
383
diff
changeset
|
105 enum { |
434
7ffecac12107
[svn] Logic stuff relating to tristate-seek. Now I just need to work it into the event loop.
nenolod
parents:
433
diff
changeset
|
106 MAINWIN_SEEK_REV = -1, |
7ffecac12107
[svn] Logic stuff relating to tristate-seek. Now I just need to work it into the event loop.
nenolod
parents:
433
diff
changeset
|
107 MAINWIN_SEEK_NIL, |
433
041bc95827be
[svn] Convert prev/next buttons to tristate, via create_pbutton_ex().
nenolod
parents:
383
diff
changeset
|
108 MAINWIN_SEEK_FWD |
041bc95827be
[svn] Convert prev/next buttons to tristate, via create_pbutton_ex().
nenolod
parents:
383
diff
changeset
|
109 }; |
0 | 110 |
111 enum { | |
112 MAINWIN_SONGNAME_FILEINFO, | |
113 MAINWIN_SONGNAME_JTF, | |
114 MAINWIN_SONGNAME_JTT, | |
898 | 115 MAINWIN_SONGNAME_SCROLL, |
116 MAINWIN_SONGNAME_STOPAFTERSONG | |
0 | 117 }; |
118 | |
119 enum { | |
120 MAINWIN_OPT_SKIN, MAINWIN_OPT_RELOADSKIN, | |
121 MAINWIN_OPT_REPEAT, MAINWIN_OPT_SHUFFLE, MAINWIN_OPT_NPA, | |
122 MAINWIN_OPT_TELAPSED, MAINWIN_OPT_TREMAINING, | |
123 MAINWIN_OPT_ALWAYS, | |
124 MAINWIN_OPT_STICKY, | |
125 MAINWIN_OPT_WS, | |
126 MAINWIN_OPT_PWS, | |
127 MAINWIN_OPT_EQWS | |
128 }; | |
129 | |
130 enum { | |
131 MAINWIN_VIS_ANALYZER, MAINWIN_VIS_SCOPE, MAINWIN_VIS_OFF, | |
132 MAINWIN_VIS_ANALYZER_NORMAL, MAINWIN_VIS_ANALYZER_FIRE, | |
133 MAINWIN_VIS_ANALYZER_VLINES, | |
134 MAINWIN_VIS_ANALYZER_LINES, MAINWIN_VIS_ANALYZER_BARS, | |
135 MAINWIN_VIS_ANALYZER_PEAKS, | |
136 MAINWIN_VIS_SCOPE_DOT, MAINWIN_VIS_SCOPE_LINE, MAINWIN_VIS_SCOPE_SOLID, | |
137 MAINWIN_VIS_VU_NORMAL, MAINWIN_VIS_VU_SMOOTH, | |
138 MAINWIN_VIS_REFRESH_FULL, MAINWIN_VIS_REFRESH_HALF, | |
139 MAINWIN_VIS_REFRESH_QUARTER, MAINWIN_VIS_REFRESH_EIGHTH, | |
140 MAINWIN_VIS_AFALLOFF_SLOWEST, MAINWIN_VIS_AFALLOFF_SLOW, | |
141 MAINWIN_VIS_AFALLOFF_MEDIUM, MAINWIN_VIS_AFALLOFF_FAST, | |
142 MAINWIN_VIS_AFALLOFF_FASTEST, | |
143 MAINWIN_VIS_PFALLOFF_SLOWEST, MAINWIN_VIS_PFALLOFF_SLOW, | |
144 MAINWIN_VIS_PFALLOFF_MEDIUM, MAINWIN_VIS_PFALLOFF_FAST, | |
145 MAINWIN_VIS_PFALLOFF_FASTEST, | |
146 MAINWIN_VIS_PLUGINS | |
147 }; | |
148 | |
149 enum { | |
150 MAINWIN_VIS_ACTIVE_MAINWIN, MAINWIN_VIS_ACTIVE_PLAYLISTWIN | |
151 }; | |
152 | |
153 | |
154 typedef struct _PlaybackInfo PlaybackInfo; | |
155 | |
156 struct _PlaybackInfo { | |
157 gchar *title; | |
158 gint bitrate; | |
159 gint frequency; | |
160 gint n_channels; | |
161 }; | |
162 | |
163 | |
164 GtkWidget *mainwin = NULL; | |
813
c8cf439179b8
[svn] - Fix a ton and a half of memory leaks, via the wonderful Leonardo Boshell <leonardop -at- gentoo.org>.
nenolod
parents:
799
diff
changeset
|
165 GtkWidget *err = NULL; /* an error dialog for miscellaneous error messages */ |
0 | 166 |
167 static GdkBitmap *nullmask; | |
168 static gint balance; | |
169 | |
170 GtkWidget *mainwin_jtf = NULL; | |
171 static GtkWidget *mainwin_jtt = NULL; | |
172 | |
173 GtkItemFactory *mainwin_songname_menu, *mainwin_vis_menu; | |
174 GtkItemFactory *mainwin_general_menu, *mainwin_play_menu, *mainwin_add_menu; | |
175 GtkItemFactory *mainwin_view_menu; | |
176 | |
434
7ffecac12107
[svn] Logic stuff relating to tristate-seek. Now I just need to work it into the event loop.
nenolod
parents:
433
diff
changeset
|
177 gint seek_state = MAINWIN_SEEK_NIL; |
467
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
178 gint seek_initial_pos = 0; |
0 | 179 |
180 GdkGC *mainwin_gc; | |
181 static GdkPixmap *mainwin_bg = NULL; | |
182 | |
183 GtkAccelGroup *mainwin_accel = NULL; | |
184 | |
185 static PButton *mainwin_menubtn; | |
186 static PButton *mainwin_minimize, *mainwin_shade, *mainwin_close; | |
187 | |
188 static PButton *mainwin_rew, *mainwin_fwd; | |
189 static PButton *mainwin_eject; | |
190 static PButton *mainwin_play, *mainwin_pause, *mainwin_stop; | |
191 | |
192 TButton *mainwin_shuffle, *mainwin_repeat, *mainwin_eq, *mainwin_pl; | |
193 TextBox *mainwin_info; | |
197
ccd034857702
[svn] Split up generic events into audcore_generic_events(), and client-specific stuff remains in mainwin_idle_func().
nenolod
parents:
196
diff
changeset
|
194 TextBox *mainwin_stime_min, *mainwin_stime_sec; |
0 | 195 |
837
7d998597254e
[svn] - initial work on skin.hints support (the first step to modernizing our
nenolod
parents:
836
diff
changeset
|
196 static TextBox *mainwin_rate_text, *mainwin_freq_text, |
7d998597254e
[svn] - initial work on skin.hints support (the first step to modernizing our
nenolod
parents:
836
diff
changeset
|
197 *mainwin_othertext; |
0 | 198 |
199 PlayStatus *mainwin_playstatus; | |
200 | |
197
ccd034857702
[svn] Split up generic events into audcore_generic_events(), and client-specific stuff remains in mainwin_idle_func().
nenolod
parents:
196
diff
changeset
|
201 Number *mainwin_minus_num, *mainwin_10min_num, *mainwin_min_num; |
ccd034857702
[svn] Split up generic events into audcore_generic_events(), and client-specific stuff remains in mainwin_idle_func().
nenolod
parents:
196
diff
changeset
|
202 Number *mainwin_10sec_num, *mainwin_sec_num; |
0 | 203 |
204 static gboolean setting_volume = FALSE; | |
205 | |
206 Vis *active_vis; | |
207 Vis *mainwin_vis; | |
208 SVis *mainwin_svis; | |
209 | |
197
ccd034857702
[svn] Split up generic events into audcore_generic_events(), and client-specific stuff remains in mainwin_idle_func().
nenolod
parents:
196
diff
changeset
|
210 HSlider *mainwin_sposition = NULL; |
ccd034857702
[svn] Split up generic events into audcore_generic_events(), and client-specific stuff remains in mainwin_idle_func().
nenolod
parents:
196
diff
changeset
|
211 |
0 | 212 static MenuRow *mainwin_menurow; |
213 static HSlider *mainwin_volume, *mainwin_balance, *mainwin_position; | |
214 static MonoStereo *mainwin_monostereo; | |
215 static SButton *mainwin_srew, *mainwin_splay, *mainwin_spause; | |
216 static SButton *mainwin_sstop, *mainwin_sfwd, *mainwin_seject, *mainwin_about; | |
217 | |
218 static GList *mainwin_wlist = NULL; | |
219 | |
220 static gint mainwin_timeout_id; | |
221 | |
222 G_LOCK_DEFINE_STATIC(mainwin_title); | |
223 | |
224 static gboolean mainwin_force_redraw = FALSE; | |
225 static gchar *mainwin_title_text = NULL; | |
226 static gboolean mainwin_info_text_locked = FALSE; | |
227 | |
228 | |
229 static void mainwin_songname_menu_callback(gpointer user_data, | |
230 guint action, | |
231 GtkWidget * widget); | |
232 | |
233 static void mainwin_vis_menu_callback(gpointer user_data, | |
234 guint action, | |
235 GtkWidget * widget); | |
236 | |
237 static void mainwin_view_menu_callback(gpointer user_data, | |
238 guint action, | |
239 GtkWidget * widget); | |
240 | |
241 static void mainwin_play_menu_callback(gpointer user_data, | |
242 guint action, | |
243 GtkWidget * widget); | |
244 | |
245 /* Song name area menu */ | |
246 | |
85
8c8a20f72ace
[svn] s/static GTKItemFactoryEntry/GTKItemFactoryEntry/g.
nenolod
parents:
0
diff
changeset
|
247 GtkItemFactoryEntry mainwin_songname_menu_entries[] = { |
0 | 248 {N_("/View Track Details"), "<alt>i", mainwin_general_menu_callback, |
249 MAINWIN_GENERAL_FILEINFO, "<ImageItem>", my_pixbuf}, | |
799
fbbd15125774
[svn] - add corrected version of Aerdan's jump to file patch
nenolod
parents:
781
diff
changeset
|
250 {N_("/Jump to File"), "J", mainwin_songname_menu_callback, |
fbbd15125774
[svn] - add corrected version of Aerdan's jump to file patch
nenolod
parents:
781
diff
changeset
|
251 MAINWIN_SONGNAME_JTF, "<StockItem>", GTK_STOCK_JUMP_TO}, |
625
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
252 {"/-", NULL, NULL, 0, "<Separator>", NULL}, |
0 | 253 {N_("/Autoscroll Songname"), NULL, mainwin_songname_menu_callback, |
625
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
254 MAINWIN_SONGNAME_SCROLL, "<ToggleItem>", NULL}, |
898 | 255 {N_("/Stop After Current Song"), "<control>M", mainwin_songname_menu_callback, |
256 MAINWIN_SONGNAME_STOPAFTERSONG, "<ToggleItem>", NULL}, | |
0 | 257 }; |
258 | |
259 static gint mainwin_songname_menu_entries_num = | |
260 G_N_ELEMENTS(mainwin_songname_menu_entries); | |
261 | |
262 /* Mini-visualizer area menu */ | |
263 | |
85
8c8a20f72ace
[svn] s/static GTKItemFactoryEntry/GTKItemFactoryEntry/g.
nenolod
parents:
0
diff
changeset
|
264 GtkItemFactoryEntry mainwin_vis_menu_entries[] = { |
625
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
265 {N_("/Visualization Mode"), NULL, NULL, 0, "<Branch>", NULL}, |
0 | 266 {N_("/Visualization Mode/Analyzer"), NULL, mainwin_vis_menu_callback, |
625
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
267 MAINWIN_VIS_ANALYZER, "<RadioItem>", NULL}, |
0 | 268 {N_("/Visualization Mode/Scope"), NULL, mainwin_vis_menu_callback, |
625
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
269 MAINWIN_VIS_SCOPE, "/Visualization Mode/Analyzer", NULL}, |
0 | 270 {N_("/Visualization Mode/Off"), NULL, mainwin_vis_menu_callback, |
625
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
271 MAINWIN_VIS_OFF, "/Visualization Mode/Analyzer", NULL}, |
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
272 {N_("/Analyzer Mode"), NULL, NULL, 0, "<Branch>", NULL}, |
0 | 273 {N_("/Analyzer Mode/Normal"), NULL, mainwin_vis_menu_callback, |
625
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
274 MAINWIN_VIS_ANALYZER_NORMAL, "<RadioItem>", NULL}, |
0 | 275 {N_("/Analyzer Mode/Fire"), NULL, mainwin_vis_menu_callback, |
625
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
276 MAINWIN_VIS_ANALYZER_FIRE, "/Analyzer Mode/Normal", NULL}, |
0 | 277 {N_("/Analyzer Mode/Vertical Lines"), NULL, mainwin_vis_menu_callback, |
625
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
278 MAINWIN_VIS_ANALYZER_VLINES, "/Analyzer Mode/Normal", NULL}, |
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
279 {"/Analyzer Mode/-", NULL, NULL, 0, "<Separator>", NULL}, |
0 | 280 {N_("/Analyzer Mode/Lines"), NULL, mainwin_vis_menu_callback, |
625
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
281 MAINWIN_VIS_ANALYZER_LINES, "<RadioItem>", NULL}, |
0 | 282 {N_("/Analyzer Mode/Bars"), NULL, mainwin_vis_menu_callback, |
625
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
283 MAINWIN_VIS_ANALYZER_BARS, "/Analyzer Mode/Lines", NULL}, |
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
284 {"/Analyzer Mode/-", NULL, NULL, 0, "<Separator>", NULL}, |
0 | 285 {N_("/Analyzer Mode/Peaks"), NULL, mainwin_vis_menu_callback, |
625
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
286 MAINWIN_VIS_ANALYZER_PEAKS, "<ToggleItem>", NULL}, |
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
287 {N_("/Scope Mode"), NULL, NULL, 0, "<Branch>", NULL}, |
0 | 288 {N_("/Scope Mode/Dot Scope"), NULL, mainwin_vis_menu_callback, |
625
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
289 MAINWIN_VIS_SCOPE_DOT, "<RadioItem>", NULL}, |
0 | 290 {N_("/Scope Mode/Line Scope"), NULL, mainwin_vis_menu_callback, |
625
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
291 MAINWIN_VIS_SCOPE_LINE, "/Scope Mode/Dot Scope", NULL}, |
0 | 292 {N_("/Scope Mode/Solid Scope"), NULL, mainwin_vis_menu_callback, |
625
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
293 MAINWIN_VIS_SCOPE_SOLID, "/Scope Mode/Dot Scope", NULL}, |
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
294 {N_("/WindowShade VU Mode"), NULL, NULL, 0, "<Branch>", NULL}, |
0 | 295 {N_("/WindowShade VU Mode/Normal"), NULL, mainwin_vis_menu_callback, |
625
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
296 MAINWIN_VIS_VU_NORMAL, "<RadioItem>", NULL}, |
0 | 297 {N_("/WindowShade VU Mode/Smooth"), NULL, mainwin_vis_menu_callback, |
625
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
298 MAINWIN_VIS_VU_SMOOTH, "/WindowShade VU Mode/Normal", NULL}, |
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
299 {N_("/Refresh Rate"), NULL, NULL, 0, "<Branch>", NULL}, |
0 | 300 {N_("/Refresh Rate/Full (~50 fps)"), NULL, mainwin_vis_menu_callback, |
625
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
301 MAINWIN_VIS_REFRESH_FULL, "<RadioItem>", NULL}, |
0 | 302 {N_("/Refresh Rate/Half (~25 fps)"), NULL, mainwin_vis_menu_callback, |
625
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
303 MAINWIN_VIS_REFRESH_HALF, "/Refresh Rate/Full (~50 fps)", NULL}, |
0 | 304 {N_("/Refresh Rate/Quarter (~13 fps)"), NULL, mainwin_vis_menu_callback, |
625
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
305 MAINWIN_VIS_REFRESH_QUARTER, "/Refresh Rate/Full (~50 fps)", NULL}, |
0 | 306 {N_("/Refresh Rate/Eighth (~6 fps)"), NULL, mainwin_vis_menu_callback, |
625
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
307 MAINWIN_VIS_REFRESH_EIGHTH, "/Refresh Rate/Full (~50 fps)", NULL}, |
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
308 {N_("/Analyzer Falloff"), NULL, NULL, 0, "<Branch>", NULL}, |
0 | 309 {N_("/Analyzer Falloff/Slowest"), NULL, mainwin_vis_menu_callback, |
625
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
310 MAINWIN_VIS_AFALLOFF_SLOWEST, "<RadioItem>", NULL}, |
0 | 311 {N_("/Analyzer Falloff/Slow"), NULL, mainwin_vis_menu_callback, |
625
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
312 MAINWIN_VIS_AFALLOFF_SLOW, "/Analyzer Falloff/Slowest", NULL}, |
0 | 313 {N_("/Analyzer Falloff/Medium"), NULL, mainwin_vis_menu_callback, |
625
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
314 MAINWIN_VIS_AFALLOFF_MEDIUM, "/Analyzer Falloff/Slowest", NULL}, |
0 | 315 {N_("/Analyzer Falloff/Fast"), NULL, mainwin_vis_menu_callback, |
625
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
316 MAINWIN_VIS_AFALLOFF_FAST, "/Analyzer Falloff/Slowest", NULL}, |
0 | 317 {N_("/Analyzer Falloff/Fastest"), NULL, mainwin_vis_menu_callback, |
625
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
318 MAINWIN_VIS_AFALLOFF_FASTEST, "/Analyzer Falloff/Slowest", NULL}, |
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
319 {N_("/Peaks Falloff"), NULL, NULL, 0, "<Branch>", NULL}, |
0 | 320 {N_("/Peaks Falloff/Slowest"), NULL, mainwin_vis_menu_callback, |
625
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
321 MAINWIN_VIS_PFALLOFF_SLOWEST, "<RadioItem>", NULL}, |
0 | 322 {N_("/Peaks Falloff/Slow"), NULL, mainwin_vis_menu_callback, |
625
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
323 MAINWIN_VIS_PFALLOFF_SLOW, "/Peaks Falloff/Slowest", NULL}, |
0 | 324 {N_("/Peaks Falloff/Medium"), NULL, mainwin_vis_menu_callback, |
625
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
325 MAINWIN_VIS_PFALLOFF_MEDIUM, "/Peaks Falloff/Slowest", NULL}, |
0 | 326 {N_("/Peaks Falloff/Fast"), NULL, mainwin_vis_menu_callback, |
625
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
327 MAINWIN_VIS_PFALLOFF_FAST, "/Peaks Falloff/Slowest", NULL}, |
0 | 328 {N_("/Peaks Falloff/Fastest"), NULL, mainwin_vis_menu_callback, |
625
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
329 MAINWIN_VIS_PFALLOFF_FASTEST, "/Peaks Falloff/Slowest", NULL} |
0 | 330 }; |
331 | |
332 static const gint mainwin_vis_menu_entries_num = | |
333 G_N_ELEMENTS(mainwin_vis_menu_entries); | |
334 | |
335 /* Playback menu (now used only for accelerators) */ | |
336 | |
85
8c8a20f72ace
[svn] s/static GTKItemFactoryEntry/GTKItemFactoryEntry/g.
nenolod
parents:
0
diff
changeset
|
337 GtkItemFactoryEntry mainwin_playback_menu_entries[] = { |
0 | 338 {N_("/Play CD"), "<alt>C", mainwin_general_menu_callback, |
339 MAINWIN_GENERAL_PLAYCD, "<StockItem>", GTK_STOCK_CDROM}, | |
625
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
340 {"/-", NULL, NULL, 0, "<Separator>", NULL}, |
0 | 341 {N_("/Repeat"), "R", mainwin_play_menu_callback, |
625
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
342 MAINWIN_OPT_REPEAT, "<ToggleItem>", NULL}, |
0 | 343 {N_("/Shuffle"), "S", mainwin_play_menu_callback, |
625
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
344 MAINWIN_OPT_SHUFFLE, "<ToggleItem>", NULL}, |
0 | 345 {N_("/No Playlist Advance"), "<control>N", mainwin_play_menu_callback, |
625
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
346 MAINWIN_OPT_NPA, "<ToggleItem>", NULL}, |
898 | 347 {N_("/Stop After Current Song"), "<control>M", mainwin_songname_menu_callback, |
348 MAINWIN_SONGNAME_STOPAFTERSONG, "<ToggleItem>", NULL}, | |
625
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
349 {"/-", NULL, NULL, 0, "<Separator>", NULL}, |
0 | 350 {N_("/Play"), "x", mainwin_general_menu_callback, |
536 | 351 MAINWIN_GENERAL_PLAY, "<StockItem>", GTK_STOCK_MEDIA_PLAY}, |
0 | 352 {N_("/Pause"), "c", mainwin_general_menu_callback, |
536 | 353 MAINWIN_GENERAL_PAUSE, "<StockItem>", GTK_STOCK_MEDIA_PAUSE}, |
0 | 354 {N_("/Stop"), "v", mainwin_general_menu_callback, |
536 | 355 MAINWIN_GENERAL_STOP, "<StockItem>", GTK_STOCK_MEDIA_STOP}, |
0 | 356 {N_("/Previous"), "z", mainwin_general_menu_callback, |
536 | 357 MAINWIN_GENERAL_PREV, "<StockItem>", GTK_STOCK_MEDIA_PREVIOUS}, |
0 | 358 {N_("/Next"), "b", mainwin_general_menu_callback, |
536 | 359 MAINWIN_GENERAL_NEXT, "<StockItem>", GTK_STOCK_MEDIA_NEXT}, |
625
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
360 {"/-", NULL, NULL, 0, "<Separator>", NULL}, |
0 | 361 {N_("/Jump to Playlist Start"), "<control>Z", mainwin_general_menu_callback, |
362 MAINWIN_GENERAL_START, "<StockItem>", GTK_STOCK_GOTO_TOP}, | |
625
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
363 {"/-", NULL, NULL, 0, "<Separator>", NULL}, |
0 | 364 {N_("/Jump to File"), "J", mainwin_general_menu_callback, |
365 MAINWIN_GENERAL_JTF, "<StockItem>", GTK_STOCK_JUMP_TO}, | |
366 {N_("/Jump to Time"), "<control>J", mainwin_general_menu_callback, | |
367 MAINWIN_GENERAL_JTT, "<StockItem>", GTK_STOCK_JUMP_TO}, | |
625
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
368 {"/-", NULL, NULL, 0, "<Separator>", NULL}, |
87 | 369 {N_("/View Track Details"), "<alt>I", mainwin_general_menu_callback, |
370 MAINWIN_GENERAL_FILEINFO, "<ImageItem>", my_pixbuf} | |
0 | 371 }; |
372 | |
373 static const gint mainwin_playback_menu_entries_num = | |
374 G_N_ELEMENTS(mainwin_playback_menu_entries); | |
375 | |
376 /* Main menu */ | |
377 | |
85
8c8a20f72ace
[svn] s/static GTKItemFactoryEntry/GTKItemFactoryEntry/g.
nenolod
parents:
0
diff
changeset
|
378 GtkItemFactoryEntry mainwin_general_menu_entries[] = { |
86 | 379 {N_("/About Audacious"), NULL, mainwin_general_menu_callback, |
380 MAINWIN_GENERAL_ABOUT, "<StockItem>", GTK_STOCK_DIALOG_INFO}, | |
625
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
381 {"/-", NULL, NULL, 0, "<Separator>", NULL}, |
86 | 382 {N_("/Play File"), "L", mainwin_general_menu_callback, |
383 MAINWIN_GENERAL_PLAYFILE, "<StockItem>", GTK_STOCK_OPEN}, | |
384 {N_("/Play Location"), "<control>L", mainwin_general_menu_callback, | |
385 MAINWIN_GENERAL_PLAYLOCATION, "<StockItem>", GTK_STOCK_NETWORK}, | |
625
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
386 {"/-", NULL, NULL, 0, "<Separator>", NULL}, |
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
387 {N_("/V_isualization"), NULL, NULL, 0, "<Item>", NULL}, |
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
388 {N_("/_Playback"), NULL, NULL, 0, "<Item>", NULL}, |
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
389 {N_("/_View"), NULL, NULL, 0, "<Item>", NULL}, |
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
390 {"/-", NULL, NULL, 0, "<Separator>", NULL}, |
0 | 391 {N_("/Preferences"), "<control>P", mainwin_general_menu_callback, |
392 MAINWIN_GENERAL_PREFS, "<StockItem>", GTK_STOCK_PREFERENCES}, | |
393 {N_("/_Quit"), NULL, mainwin_general_menu_callback, | |
394 MAINWIN_GENERAL_EXIT, "<StockItem>", GTK_STOCK_QUIT} | |
395 }; | |
396 | |
397 static const gint mainwin_general_menu_entries_num = | |
398 G_N_ELEMENTS(mainwin_general_menu_entries); | |
399 | |
400 /* Add submenu */ | |
401 | |
85
8c8a20f72ace
[svn] s/static GTKItemFactoryEntry/GTKItemFactoryEntry/g.
nenolod
parents:
0
diff
changeset
|
402 GtkItemFactoryEntry mainwin_add_menu_entries[] = { |
0 | 403 {N_("/Files..."), "f", mainwin_general_menu_callback, |
404 MAINWIN_GENERAL_PLAYFILE, "<StockItem>", GTK_STOCK_OPEN}, | |
405 {N_("/Internet location..."), "<control>h", mainwin_general_menu_callback, | |
406 MAINWIN_GENERAL_PLAYLOCATION, "<StockItem>", GTK_STOCK_NETWORK}, | |
407 }; | |
408 | |
409 static const gint mainwin_add_menu_entries_num = | |
410 G_N_ELEMENTS(mainwin_add_menu_entries); | |
411 | |
412 /* View submenu */ | |
413 | |
85
8c8a20f72ace
[svn] s/static GTKItemFactoryEntry/GTKItemFactoryEntry/g.
nenolod
parents:
0
diff
changeset
|
414 GtkItemFactoryEntry mainwin_view_menu_entries[] = { |
0 | 415 {N_("/Show Playlist Editor"), "<alt>E", mainwin_general_menu_callback, |
625
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
416 MAINWIN_GENERAL_SHOWPLWIN, "<ToggleItem>", NULL}, |
0 | 417 {N_("/Show Equalizer"), "<alt>G", mainwin_general_menu_callback, |
625
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
418 MAINWIN_GENERAL_SHOWEQWIN, "<ToggleItem>", NULL}, |
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
419 {"/-", NULL, NULL, 0, "<Separator>", NULL}, |
0 | 420 {N_("/Time Elapsed"), "<control>E", mainwin_view_menu_callback, |
625
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
421 MAINWIN_OPT_TELAPSED, "<RadioItem>", NULL}, |
0 | 422 {N_("/Time Remaining"), "<control>R", mainwin_view_menu_callback, |
625
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
423 MAINWIN_OPT_TREMAINING, "/Time Elapsed", NULL}, |
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
424 {"/-", NULL, NULL, 0, "<Separator>", NULL}, |
0 | 425 {N_("/Always On Top"), "<control>o", mainwin_view_menu_callback, |
625
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
426 MAINWIN_OPT_ALWAYS, "<ToggleItem>", NULL}, |
0 | 427 {N_("/Put on All Workspaces"), "<control>S", |
625
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
428 mainwin_view_menu_callback, MAINWIN_OPT_STICKY, "<ToggleItem>", NULL}, |
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
429 {"/-", NULL, NULL, 0, "<Separator>", NULL}, |
0 | 430 {N_("/Roll up Player"), "<control>W", mainwin_view_menu_callback, |
625
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
431 MAINWIN_OPT_WS, "<ToggleItem>", NULL}, |
0 | 432 {N_("/Roll up Playlist Editor"), "<control><shift>W", mainwin_view_menu_callback, |
625
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
433 MAINWIN_OPT_PWS, "<ToggleItem>", NULL}, |
0 | 434 {N_("/Roll up Equalizer"), "<control><alt>W", mainwin_view_menu_callback, |
625
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
435 MAINWIN_OPT_EQWS, "<ToggleItem>", NULL} |
0 | 436 }; |
437 | |
438 static const gint mainwin_view_menu_entries_num = | |
439 G_N_ELEMENTS(mainwin_view_menu_entries); | |
440 | |
441 | |
442 static PlaybackInfo playback_info = { NULL, 0, 0, 0 }; | |
443 | |
444 | |
445 static gint mainwin_idle_func(gpointer data); | |
446 | |
447 static void set_timer_mode_menu_cb(TimerMode mode); | |
448 static void set_timer_mode(TimerMode mode); | |
449 | |
837
7d998597254e
[svn] - initial work on skin.hints support (the first step to modernizing our
nenolod
parents:
836
diff
changeset
|
450 static void mainwin_refresh_hints(void); |
7d998597254e
[svn] - initial work on skin.hints support (the first step to modernizing our
nenolod
parents:
836
diff
changeset
|
451 |
467
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
452 void mainwin_position_motion_cb(gint pos); |
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
453 void mainwin_position_release_cb(gint pos); |
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
454 |
0 | 455 |
456 /* FIXME: placed here for now */ | |
457 void | |
458 playback_get_sample_params(gint * bitrate, | |
459 gint * frequency, | |
460 gint * n_channels) | |
461 { | |
462 if (bitrate) | |
463 *bitrate = playback_info.bitrate; | |
464 | |
465 if (frequency) | |
466 *frequency = playback_info.frequency; | |
467 | |
468 if (n_channels) | |
469 *n_channels = playback_info.n_channels; | |
470 } | |
471 | |
472 static void | |
473 playback_set_sample_params(gint bitrate, | |
474 gint frequency, | |
475 gint n_channels) | |
476 { | |
477 if (bitrate >= 0) | |
478 playback_info.bitrate = bitrate; | |
479 | |
480 if (frequency >= 0) | |
481 playback_info.frequency = frequency; | |
482 | |
483 if (n_channels >= 0) | |
484 playback_info.n_channels = n_channels; | |
485 } | |
486 | |
487 static void | |
488 mainwin_set_title_scroll(gboolean scroll) | |
489 { | |
490 cfg.autoscroll = scroll; | |
491 textbox_set_scroll(mainwin_info, cfg.autoscroll); | |
492 } | |
493 | |
494 | |
495 void | |
496 mainwin_set_always_on_top(gboolean always) | |
497 { | |
498 GtkWidget *widget = gtk_item_factory_get_widget(mainwin_view_menu, | |
499 "/Always On Top"); | |
500 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(widget), | |
501 mainwin_menurow->mr_always_selected); | |
502 } | |
503 | |
504 static void | |
505 mainwin_set_shape_mask(void) | |
506 { | |
507 GdkBitmap *mask; | |
508 | |
509 if (!cfg.player_visible) | |
510 return; | |
511 | |
512 mask = skin_get_mask(bmp_active_skin, SKIN_MASK_MAIN + cfg.player_shaded); | |
513 gtk_widget_shape_combine_mask(mainwin, mask, 0, 0); | |
514 } | |
515 | |
516 static void | |
517 mainwin_set_shade(gboolean shaded) | |
518 { | |
519 GtkWidget *widget; | |
520 widget = gtk_item_factory_get_widget(mainwin_view_menu, | |
521 "/Roll up Player"); | |
522 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(widget), shaded); | |
523 } | |
524 | |
525 static void | |
526 mainwin_set_shade_menu_cb(gboolean shaded) | |
527 { | |
528 cfg.player_shaded = shaded; | |
529 | |
530 mainwin_set_shape_mask(); | |
531 | |
532 if (shaded) { | |
533 dock_shade(dock_window_list, GTK_WINDOW(mainwin), | |
534 MAINWIN_SHADED_HEIGHT); | |
535 | |
536 widget_show(WIDGET(mainwin_svis)); | |
537 vis_clear_data(mainwin_vis); | |
538 | |
539 widget_show(WIDGET(mainwin_srew)); | |
540 widget_show(WIDGET(mainwin_splay)); | |
541 widget_show(WIDGET(mainwin_spause)); | |
542 widget_show(WIDGET(mainwin_sstop)); | |
543 widget_show(WIDGET(mainwin_sfwd)); | |
544 widget_show(WIDGET(mainwin_seject)); | |
545 | |
546 textbox_set_scroll(mainwin_info, FALSE); | |
654
6c14adb859fe
[svn] Fix logic for shaded mode. With TIME_REMAINING and a song of unknown length, we got just the :, and not the time.
chainsaw
parents:
632
diff
changeset
|
547 if (bmp_playback_get_playing()) |
632
6bc44654ebba
[svn] Do not show 00:00 when stopped in shaded mode, closes bug #390.
chainsaw
parents:
625
diff
changeset
|
548 { |
6bc44654ebba
[svn] Do not show 00:00 when stopped in shaded mode, closes bug #390.
chainsaw
parents:
625
diff
changeset
|
549 widget_show(WIDGET(mainwin_sposition)); |
6bc44654ebba
[svn] Do not show 00:00 when stopped in shaded mode, closes bug #390.
chainsaw
parents:
625
diff
changeset
|
550 widget_show(WIDGET(mainwin_stime_min)); |
6bc44654ebba
[svn] Do not show 00:00 when stopped in shaded mode, closes bug #390.
chainsaw
parents:
625
diff
changeset
|
551 widget_show(WIDGET(mainwin_stime_sec)); |
6bc44654ebba
[svn] Do not show 00:00 when stopped in shaded mode, closes bug #390.
chainsaw
parents:
625
diff
changeset
|
552 } |
6bc44654ebba
[svn] Do not show 00:00 when stopped in shaded mode, closes bug #390.
chainsaw
parents:
625
diff
changeset
|
553 else |
6bc44654ebba
[svn] Do not show 00:00 when stopped in shaded mode, closes bug #390.
chainsaw
parents:
625
diff
changeset
|
554 { |
6bc44654ebba
[svn] Do not show 00:00 when stopped in shaded mode, closes bug #390.
chainsaw
parents:
625
diff
changeset
|
555 widget_hide(WIDGET(mainwin_sposition)); |
6bc44654ebba
[svn] Do not show 00:00 when stopped in shaded mode, closes bug #390.
chainsaw
parents:
625
diff
changeset
|
556 widget_hide(WIDGET(mainwin_stime_min)); |
6bc44654ebba
[svn] Do not show 00:00 when stopped in shaded mode, closes bug #390.
chainsaw
parents:
625
diff
changeset
|
557 widget_hide(WIDGET(mainwin_stime_sec)); |
6bc44654ebba
[svn] Do not show 00:00 when stopped in shaded mode, closes bug #390.
chainsaw
parents:
625
diff
changeset
|
558 } |
6bc44654ebba
[svn] Do not show 00:00 when stopped in shaded mode, closes bug #390.
chainsaw
parents:
625
diff
changeset
|
559 |
0 | 560 mainwin_shade->pb_ny = mainwin_shade->pb_py = 27; |
561 } | |
562 else { | |
563 dock_shade(dock_window_list, GTK_WINDOW(mainwin), MAINWIN_HEIGHT); | |
564 | |
565 widget_hide(WIDGET(mainwin_svis)); | |
566 svis_clear_data(mainwin_svis); | |
567 | |
568 widget_hide(WIDGET(mainwin_srew)); | |
569 widget_hide(WIDGET(mainwin_splay)); | |
570 widget_hide(WIDGET(mainwin_spause)); | |
571 widget_hide(WIDGET(mainwin_sstop)); | |
572 widget_hide(WIDGET(mainwin_sfwd)); | |
573 widget_hide(WIDGET(mainwin_seject)); | |
574 | |
575 widget_hide(WIDGET(mainwin_stime_min)); | |
576 widget_hide(WIDGET(mainwin_stime_sec)); | |
577 widget_hide(WIDGET(mainwin_sposition)); | |
578 | |
579 textbox_set_scroll(mainwin_info, TRUE); | |
580 mainwin_shade->pb_ny = mainwin_shade->pb_py = 18; | |
581 } | |
582 | |
583 draw_main_window(TRUE); | |
584 } | |
585 | |
586 static void | |
587 mainwin_vis_set_active_vis(gint new_vis) | |
588 { | |
561
2b9dc862967b
[svn] Remove the elusive playlistwin visualiser that we do not use.
nenolod
parents:
549
diff
changeset
|
589 active_vis = mainwin_vis; |
0 | 590 } |
591 | |
592 static void | |
593 mainwin_vis_set_refresh(RefreshRate rate) | |
594 { | |
595 cfg.vis_refresh = rate; | |
596 } | |
597 | |
598 static void | |
599 mainwin_vis_set_afalloff(FalloffSpeed speed) | |
600 { | |
601 cfg.analyzer_falloff = speed; | |
602 } | |
603 | |
604 static void | |
605 mainwin_vis_set_pfalloff(FalloffSpeed speed) | |
606 { | |
607 cfg.peaks_falloff = speed; | |
608 } | |
609 | |
610 static void | |
611 mainwin_vis_set_analyzer_mode(AnalyzerMode mode) | |
612 { | |
613 cfg.analyzer_mode = mode; | |
614 } | |
615 | |
616 static void | |
617 mainwin_vis_set_analyzer_type(AnalyzerType mode) | |
618 { | |
619 cfg.analyzer_type = mode; | |
620 } | |
621 | |
622 void | |
623 mainwin_vis_set_type(VisType mode) | |
624 { | |
625 gchar *path = | |
626 mainwin_vis_menu_entries[MAINWIN_VIS_MENU_VIS_MODE + mode].path; | |
627 GtkWidget *widget = gtk_item_factory_get_widget(mainwin_vis_menu, path); | |
628 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(widget), TRUE); | |
629 } | |
630 | |
631 static void | |
632 mainwin_vis_set_type_menu_cb(VisType mode) | |
633 { | |
634 cfg.vis_type = mode; | |
635 | |
636 if (mode == VIS_OFF) { | |
637 if (cfg.player_shaded && cfg.player_visible) | |
638 svis_clear(mainwin_svis); | |
639 else | |
640 vis_clear(active_vis); | |
641 } | |
836 | 642 if (mode == VIS_ANALYZER || mode == VIS_SCOPE) { |
0 | 643 vis_clear_data(active_vis); |
644 svis_clear_data(mainwin_svis); | |
645 } | |
646 } | |
647 | |
648 static void | |
649 mainwin_menubtn_cb(void) | |
650 { | |
651 gint x, y; | |
652 gtk_window_get_position(GTK_WINDOW(mainwin), &x, &y); | |
653 util_item_factory_popup(mainwin_general_menu, | |
654 x + 6, | |
655 y + MAINWIN_SHADED_HEIGHT, | |
656 1, GDK_CURRENT_TIME); | |
657 } | |
658 | |
659 void | |
660 mainwin_minimize_cb(void) | |
661 { | |
662 if (!mainwin) | |
663 return; | |
664 | |
665 gtk_window_iconify(GTK_WINDOW(mainwin)); | |
666 } | |
667 | |
668 static void | |
669 mainwin_shade_toggle(void) | |
670 { | |
671 mainwin_set_shade(!cfg.player_shaded); | |
672 } | |
673 | |
674 void | |
675 mainwin_quit_cb(void) | |
676 { | |
677 gtk_widget_hide(equalizerwin); | |
678 gtk_widget_hide(playlistwin); | |
679 gtk_widget_hide(mainwin); | |
680 gdk_flush(); | |
681 | |
682 g_source_remove(mainwin_timeout_id); | |
683 | |
684 util_set_cursor(NULL); | |
685 | |
686 bmp_config_save(); | |
687 gtk_accel_map_save(bmp_paths[BMP_PATH_ACCEL_FILE]); | |
688 | |
689 ctrlsocket_cleanup(); | |
690 | |
691 playlist_stop_get_info_thread(); | |
692 playlist_clear(); | |
693 | |
694 plugin_system_cleanup(); | |
695 | |
696 gtk_main_quit(); | |
196 | 697 |
698 exit(EXIT_SUCCESS); | |
0 | 699 } |
700 | |
701 static void | |
702 mainwin_destroy(GtkWidget * widget, gpointer data) | |
703 { | |
704 mainwin_quit_cb(); | |
705 } | |
706 | |
707 static void | |
708 mainwin_draw_titlebar(gboolean focus) | |
709 { | |
710 skin_draw_mainwin_titlebar(bmp_active_skin, mainwin_bg, mainwin_gc, | |
711 cfg.player_shaded, focus || !cfg.dim_titlebar); | |
712 } | |
713 | |
714 void | |
715 draw_main_window(gboolean force) | |
716 { | |
717 GList *wl; | |
718 Widget *w; | |
719 gboolean redraw; | |
720 | |
721 if (!cfg.player_visible) | |
722 return; | |
723 | |
837
7d998597254e
[svn] - initial work on skin.hints support (the first step to modernizing our
nenolod
parents:
836
diff
changeset
|
724 if (force) |
7d998597254e
[svn] - initial work on skin.hints support (the first step to modernizing our
nenolod
parents:
836
diff
changeset
|
725 mainwin_refresh_hints(); |
7d998597254e
[svn] - initial work on skin.hints support (the first step to modernizing our
nenolod
parents:
836
diff
changeset
|
726 |
0 | 727 widget_list_lock(mainwin_wlist); |
728 | |
729 if (force) { | |
730 if (!cfg.player_shaded) | |
731 skin_draw_pixmap(bmp_active_skin, mainwin_bg, mainwin_gc, | |
732 SKIN_MAIN, 0, 0, 0, 0, MAINWIN_WIDTH, | |
733 MAINWIN_HEIGHT); | |
734 mainwin_draw_titlebar(gtk_window_has_toplevel_focus | |
735 (GTK_WINDOW(mainwin))); | |
736 } | |
737 | |
738 widget_list_draw(mainwin_wlist, &redraw, force); | |
739 | |
740 if (redraw || force) { | |
741 if (force) { | |
742 gdk_window_clear(mainwin->window); | |
743 } | |
744 else { | |
745 for (wl = mainwin_wlist; wl; wl = g_list_next(wl)) { | |
746 w = WIDGET(wl->data); | |
747 | |
748 if (!w->redraw || !w->visible) | |
749 continue; | |
750 | |
751 gdk_window_clear_area(mainwin->window, w->x, w->y, | |
752 w->width, w->height); | |
753 w->redraw = FALSE; | |
754 } | |
755 } | |
756 | |
757 gdk_flush(); | |
758 } | |
759 | |
760 widget_list_unlock(mainwin_wlist); | |
761 } | |
762 | |
763 | |
764 void | |
765 mainwin_set_info_text(void) | |
766 { | |
767 gchar *text; | |
768 | |
769 if (mainwin_info_text_locked) | |
770 return; | |
771 | |
772 if ((text = input_get_info_text()) != NULL) { | |
773 textbox_set_text(mainwin_info, text); | |
774 g_free(text); | |
775 } | |
776 else if ((text = playlist_get_info_text()) != NULL) { | |
777 textbox_set_text(mainwin_info, text); | |
778 g_free(text); | |
779 } | |
780 } | |
781 | |
782 void | |
783 mainwin_lock_info_text(const gchar * text) | |
784 { | |
785 mainwin_info_text_locked = TRUE; | |
786 textbox_set_text(mainwin_info, text); | |
787 } | |
788 | |
789 void | |
790 mainwin_release_info_text(void) | |
791 { | |
792 mainwin_info_text_locked = FALSE; | |
793 mainwin_set_info_text(); | |
794 } | |
795 | |
796 | |
797 static gchar * | |
798 make_mainwin_title(const gchar * title) | |
799 { | |
800 if (title) | |
801 return g_strdup_printf(_("%s - Audacious"), title); | |
802 else | |
803 return g_strdup(_("Audacious")); | |
804 } | |
805 | |
806 void | |
807 mainwin_set_song_title(const gchar * title) | |
808 { | |
809 G_LOCK(mainwin_title); | |
810 g_free(mainwin_title_text); | |
811 mainwin_title_text = make_mainwin_title(title); | |
812 G_UNLOCK(mainwin_title); | |
813 } | |
814 | |
837
7d998597254e
[svn] - initial work on skin.hints support (the first step to modernizing our
nenolod
parents:
836
diff
changeset
|
815 static void |
7d998597254e
[svn] - initial work on skin.hints support (the first step to modernizing our
nenolod
parents:
836
diff
changeset
|
816 mainwin_refresh_hints(void) |
7d998597254e
[svn] - initial work on skin.hints support (the first step to modernizing our
nenolod
parents:
836
diff
changeset
|
817 { |
889
21e0ef28e318
[svn] - Unbreak headless support. This probably needs to be backported to 0.2.4.
nenolod
parents:
837
diff
changeset
|
818 if (bmp_active_skin && bmp_active_skin->properties.mainwin_othertext |
21e0ef28e318
[svn] - Unbreak headless support. This probably needs to be backported to 0.2.4.
nenolod
parents:
837
diff
changeset
|
819 == TRUE) |
837
7d998597254e
[svn] - initial work on skin.hints support (the first step to modernizing our
nenolod
parents:
836
diff
changeset
|
820 { |
7d998597254e
[svn] - initial work on skin.hints support (the first step to modernizing our
nenolod
parents:
836
diff
changeset
|
821 widget_hide(WIDGET(mainwin_rate_text)); |
7d998597254e
[svn] - initial work on skin.hints support (the first step to modernizing our
nenolod
parents:
836
diff
changeset
|
822 widget_hide(WIDGET(mainwin_freq_text)); |
7d998597254e
[svn] - initial work on skin.hints support (the first step to modernizing our
nenolod
parents:
836
diff
changeset
|
823 widget_hide(WIDGET(mainwin_monostereo)); |
7d998597254e
[svn] - initial work on skin.hints support (the first step to modernizing our
nenolod
parents:
836
diff
changeset
|
824 widget_show(WIDGET(mainwin_othertext)); |
7d998597254e
[svn] - initial work on skin.hints support (the first step to modernizing our
nenolod
parents:
836
diff
changeset
|
825 } |
7d998597254e
[svn] - initial work on skin.hints support (the first step to modernizing our
nenolod
parents:
836
diff
changeset
|
826 else |
7d998597254e
[svn] - initial work on skin.hints support (the first step to modernizing our
nenolod
parents:
836
diff
changeset
|
827 { |
7d998597254e
[svn] - initial work on skin.hints support (the first step to modernizing our
nenolod
parents:
836
diff
changeset
|
828 widget_show(WIDGET(mainwin_rate_text)); |
7d998597254e
[svn] - initial work on skin.hints support (the first step to modernizing our
nenolod
parents:
836
diff
changeset
|
829 widget_show(WIDGET(mainwin_freq_text)); |
7d998597254e
[svn] - initial work on skin.hints support (the first step to modernizing our
nenolod
parents:
836
diff
changeset
|
830 widget_show(WIDGET(mainwin_monostereo)); |
7d998597254e
[svn] - initial work on skin.hints support (the first step to modernizing our
nenolod
parents:
836
diff
changeset
|
831 widget_hide(WIDGET(mainwin_othertext)); |
7d998597254e
[svn] - initial work on skin.hints support (the first step to modernizing our
nenolod
parents:
836
diff
changeset
|
832 } |
7d998597254e
[svn] - initial work on skin.hints support (the first step to modernizing our
nenolod
parents:
836
diff
changeset
|
833 } |
7d998597254e
[svn] - initial work on skin.hints support (the first step to modernizing our
nenolod
parents:
836
diff
changeset
|
834 |
0 | 835 void |
836 mainwin_set_song_info(gint bitrate, | |
837 gint frequency, | |
838 gint n_channels) | |
839 { | |
837
7d998597254e
[svn] - initial work on skin.hints support (the first step to modernizing our
nenolod
parents:
836
diff
changeset
|
840 gchar text[512]; |
0 | 841 gchar *title; |
842 | |
843 playback_set_sample_params(bitrate, frequency, n_channels); | |
844 | |
845 if (bitrate != -1) { | |
846 bitrate /= 1000; | |
847 | |
848 if (bitrate < 1000) { | |
849 /* Show bitrate in 1000s */ | |
850 g_snprintf(text, sizeof(text), "%3d", bitrate); | |
851 textbox_set_text(mainwin_rate_text, text); | |
852 } | |
853 else { | |
854 /* Show bitrate in 100,000s */ | |
855 bitrate /= 100; | |
856 g_snprintf(text, sizeof(text), "%2dH", bitrate); | |
857 textbox_set_text(mainwin_rate_text, text); | |
858 } | |
859 } | |
860 else | |
861 textbox_set_text(mainwin_rate_text, _("VBR")); | |
862 | |
863 /* Show sampling frequency in kHz */ | |
864 g_snprintf(text, sizeof(text), "%2d", frequency / 1000); | |
865 textbox_set_text(mainwin_freq_text, text); | |
866 | |
867 monostereo_set_num_channels(mainwin_monostereo, n_channels); | |
868 | |
632
6bc44654ebba
[svn] Do not show 00:00 when stopped in shaded mode, closes bug #390.
chainsaw
parents:
625
diff
changeset
|
869 if (cfg.player_shaded) |
6bc44654ebba
[svn] Do not show 00:00 when stopped in shaded mode, closes bug #390.
chainsaw
parents:
625
diff
changeset
|
870 { |
6bc44654ebba
[svn] Do not show 00:00 when stopped in shaded mode, closes bug #390.
chainsaw
parents:
625
diff
changeset
|
871 widget_show(WIDGET(mainwin_stime_min)); |
6bc44654ebba
[svn] Do not show 00:00 when stopped in shaded mode, closes bug #390.
chainsaw
parents:
625
diff
changeset
|
872 widget_show(WIDGET(mainwin_stime_sec)); |
6bc44654ebba
[svn] Do not show 00:00 when stopped in shaded mode, closes bug #390.
chainsaw
parents:
625
diff
changeset
|
873 } |
6bc44654ebba
[svn] Do not show 00:00 when stopped in shaded mode, closes bug #390.
chainsaw
parents:
625
diff
changeset
|
874 |
0 | 875 widget_show(WIDGET(mainwin_minus_num)); |
876 widget_show(WIDGET(mainwin_10min_num)); | |
877 widget_show(WIDGET(mainwin_min_num)); | |
878 widget_show(WIDGET(mainwin_10sec_num)); | |
879 widget_show(WIDGET(mainwin_sec_num)); | |
880 | |
881 if (!bmp_playback_get_paused()) | |
882 playstatus_set_status(mainwin_playstatus, STATUS_PLAY); | |
883 | |
884 if (playlist_get_current_length() != -1) { | |
885 if (cfg.player_shaded) | |
886 widget_show(WIDGET(mainwin_sposition)); | |
887 widget_show(WIDGET(mainwin_position)); | |
888 } | |
889 else { | |
890 widget_hide(WIDGET(mainwin_position)); | |
891 widget_hide(WIDGET(mainwin_sposition)); | |
892 mainwin_force_redraw = TRUE; | |
893 } | |
894 | |
889
21e0ef28e318
[svn] - Unbreak headless support. This probably needs to be backported to 0.2.4.
nenolod
parents:
837
diff
changeset
|
895 if (bmp_active_skin && bmp_active_skin->properties.mainwin_othertext |
21e0ef28e318
[svn] - Unbreak headless support. This probably needs to be backported to 0.2.4.
nenolod
parents:
837
diff
changeset
|
896 == TRUE) |
837
7d998597254e
[svn] - initial work on skin.hints support (the first step to modernizing our
nenolod
parents:
836
diff
changeset
|
897 { |
7d998597254e
[svn] - initial work on skin.hints support (the first step to modernizing our
nenolod
parents:
836
diff
changeset
|
898 g_snprintf(text, 512, "%d kbps, %0.1f khz, %s", |
7d998597254e
[svn] - initial work on skin.hints support (the first step to modernizing our
nenolod
parents:
836
diff
changeset
|
899 bitrate < 1000 ? bitrate : bitrate / 100, |
7d998597254e
[svn] - initial work on skin.hints support (the first step to modernizing our
nenolod
parents:
836
diff
changeset
|
900 (gfloat) frequency / 1000, |
7d998597254e
[svn] - initial work on skin.hints support (the first step to modernizing our
nenolod
parents:
836
diff
changeset
|
901 (n_channels > 1) ? _("stereo") : _("mono")); |
7d998597254e
[svn] - initial work on skin.hints support (the first step to modernizing our
nenolod
parents:
836
diff
changeset
|
902 textbox_set_text(mainwin_othertext, text); |
7d998597254e
[svn] - initial work on skin.hints support (the first step to modernizing our
nenolod
parents:
836
diff
changeset
|
903 |
7d998597254e
[svn] - initial work on skin.hints support (the first step to modernizing our
nenolod
parents:
836
diff
changeset
|
904 widget_hide(WIDGET(mainwin_rate_text)); |
7d998597254e
[svn] - initial work on skin.hints support (the first step to modernizing our
nenolod
parents:
836
diff
changeset
|
905 widget_hide(WIDGET(mainwin_freq_text)); |
7d998597254e
[svn] - initial work on skin.hints support (the first step to modernizing our
nenolod
parents:
836
diff
changeset
|
906 widget_hide(WIDGET(mainwin_monostereo)); |
7d998597254e
[svn] - initial work on skin.hints support (the first step to modernizing our
nenolod
parents:
836
diff
changeset
|
907 widget_show(WIDGET(mainwin_othertext)); |
7d998597254e
[svn] - initial work on skin.hints support (the first step to modernizing our
nenolod
parents:
836
diff
changeset
|
908 } |
7d998597254e
[svn] - initial work on skin.hints support (the first step to modernizing our
nenolod
parents:
836
diff
changeset
|
909 else |
7d998597254e
[svn] - initial work on skin.hints support (the first step to modernizing our
nenolod
parents:
836
diff
changeset
|
910 { |
7d998597254e
[svn] - initial work on skin.hints support (the first step to modernizing our
nenolod
parents:
836
diff
changeset
|
911 widget_show(WIDGET(mainwin_rate_text)); |
7d998597254e
[svn] - initial work on skin.hints support (the first step to modernizing our
nenolod
parents:
836
diff
changeset
|
912 widget_show(WIDGET(mainwin_freq_text)); |
7d998597254e
[svn] - initial work on skin.hints support (the first step to modernizing our
nenolod
parents:
836
diff
changeset
|
913 widget_show(WIDGET(mainwin_monostereo)); |
7d998597254e
[svn] - initial work on skin.hints support (the first step to modernizing our
nenolod
parents:
836
diff
changeset
|
914 widget_hide(WIDGET(mainwin_othertext)); |
7d998597254e
[svn] - initial work on skin.hints support (the first step to modernizing our
nenolod
parents:
836
diff
changeset
|
915 } |
7d998597254e
[svn] - initial work on skin.hints support (the first step to modernizing our
nenolod
parents:
836
diff
changeset
|
916 |
0 | 917 title = playlist_get_info_text(); |
918 mainwin_set_song_title(title); | |
919 g_free(title); | |
920 } | |
921 | |
922 void | |
923 mainwin_clear_song_info(void) | |
924 { | |
196 | 925 if (!mainwin) |
926 return; | |
927 | |
0 | 928 /* clear title */ |
929 G_LOCK(mainwin_title); | |
930 g_free(mainwin_title_text); | |
931 mainwin_title_text = NULL; | |
932 G_UNLOCK(mainwin_title); | |
933 | |
934 /* clear sampling parameters */ | |
935 playback_set_sample_params(0, 0, 0); | |
936 | |
937 mainwin_position->hs_pressed = FALSE; | |
938 mainwin_sposition->hs_pressed = FALSE; | |
939 | |
940 /* clear sampling parameter displays */ | |
941 textbox_set_text(mainwin_rate_text, " "); | |
942 textbox_set_text(mainwin_freq_text, " "); | |
943 monostereo_set_num_channels(mainwin_monostereo, 0); | |
944 | |
945 playstatus_set_status(mainwin_playstatus, STATUS_STOP); | |
946 | |
947 /* hide playback time */ | |
948 widget_hide(WIDGET(mainwin_minus_num)); | |
949 widget_hide(WIDGET(mainwin_10min_num)); | |
950 widget_hide(WIDGET(mainwin_min_num)); | |
951 widget_hide(WIDGET(mainwin_10sec_num)); | |
952 widget_hide(WIDGET(mainwin_sec_num)); | |
953 | |
632
6bc44654ebba
[svn] Do not show 00:00 when stopped in shaded mode, closes bug #390.
chainsaw
parents:
625
diff
changeset
|
954 widget_hide(WIDGET(mainwin_stime_min)); |
6bc44654ebba
[svn] Do not show 00:00 when stopped in shaded mode, closes bug #390.
chainsaw
parents:
625
diff
changeset
|
955 widget_hide(WIDGET(mainwin_stime_sec)); |
0 | 956 |
957 widget_hide(WIDGET(mainwin_position)); | |
958 widget_hide(WIDGET(mainwin_sposition)); | |
959 | |
837
7d998597254e
[svn] - initial work on skin.hints support (the first step to modernizing our
nenolod
parents:
836
diff
changeset
|
960 widget_hide(WIDGET(mainwin_othertext)); |
7d998597254e
[svn] - initial work on skin.hints support (the first step to modernizing our
nenolod
parents:
836
diff
changeset
|
961 |
0 | 962 playlistwin_hide_timer(); |
963 draw_main_window(TRUE); | |
964 | |
965 vis_clear(active_vis); | |
966 } | |
967 | |
968 void | |
969 mainwin_disable_seekbar(void) | |
970 { | |
192
0ee0b9b6db7e
[svn] headless now working, use --headless if you wish to experiment.
nenolod
parents:
123
diff
changeset
|
971 if (!mainwin) |
0ee0b9b6db7e
[svn] headless now working, use --headless if you wish to experiment.
nenolod
parents:
123
diff
changeset
|
972 return; |
0ee0b9b6db7e
[svn] headless now working, use --headless if you wish to experiment.
nenolod
parents:
123
diff
changeset
|
973 |
0 | 974 /* |
975 * We dont call draw_main_window() here so this will not | |
976 * remove them visually. It will only prevent us from sending | |
977 * any seek calls to the input plugin before the input plugin | |
978 * calls ->set_info(). | |
979 */ | |
980 widget_hide(WIDGET(mainwin_position)); | |
981 widget_hide(WIDGET(mainwin_sposition)); | |
982 } | |
983 | |
984 static gboolean | |
985 mainwin_mouse_button_release(GtkWidget * widget, | |
986 GdkEventButton * event, | |
987 gpointer callback_data) | |
988 { | |
989 gdk_pointer_ungrab(GDK_CURRENT_TIME); | |
990 | |
991 /* | |
992 * The gdk_flush() is just for making sure that the pointer really | |
993 * gets ungrabbed before calling any button callbacks | |
994 * | |
995 */ | |
996 | |
997 gdk_flush(); | |
998 | |
999 if (dock_is_moving(GTK_WINDOW(mainwin))) { | |
1000 dock_move_release(GTK_WINDOW(mainwin)); | |
1001 } | |
1002 | |
1003 if (mainwin_menurow->mr_doublesize_selected) { | |
1004 event->x /= 2; | |
1005 event->y /= 2; | |
1006 } | |
1007 | |
1008 handle_release_cb(mainwin_wlist, widget, event); | |
1009 | |
1010 draw_main_window(FALSE); | |
1011 | |
1012 return FALSE; | |
1013 } | |
1014 | |
1015 static gboolean | |
1016 mainwin_motion(GtkWidget * widget, | |
1017 GdkEventMotion * event, | |
1018 gpointer callback_data) | |
1019 { | |
484
fc968772e096
[svn] Remove ALL Xlib stuff from the skinning engine and use GDK where
nenolod
parents:
471
diff
changeset
|
1020 int x, y; |
fc968772e096
[svn] Remove ALL Xlib stuff from the skinning engine and use GDK where
nenolod
parents:
471
diff
changeset
|
1021 GdkModifierType state; |
fc968772e096
[svn] Remove ALL Xlib stuff from the skinning engine and use GDK where
nenolod
parents:
471
diff
changeset
|
1022 |
fc968772e096
[svn] Remove ALL Xlib stuff from the skinning engine and use GDK where
nenolod
parents:
471
diff
changeset
|
1023 if (event->is_hint != FALSE) |
fc968772e096
[svn] Remove ALL Xlib stuff from the skinning engine and use GDK where
nenolod
parents:
471
diff
changeset
|
1024 { |
fc968772e096
[svn] Remove ALL Xlib stuff from the skinning engine and use GDK where
nenolod
parents:
471
diff
changeset
|
1025 gdk_window_get_pointer(GDK_WINDOW(mainwin->window), |
fc968772e096
[svn] Remove ALL Xlib stuff from the skinning engine and use GDK where
nenolod
parents:
471
diff
changeset
|
1026 &x, &y, &state); |
fc968772e096
[svn] Remove ALL Xlib stuff from the skinning engine and use GDK where
nenolod
parents:
471
diff
changeset
|
1027 |
fc968772e096
[svn] Remove ALL Xlib stuff from the skinning engine and use GDK where
nenolod
parents:
471
diff
changeset
|
1028 /* If it's a hint, we had to query X, so override the |
fc968772e096
[svn] Remove ALL Xlib stuff from the skinning engine and use GDK where
nenolod
parents:
471
diff
changeset
|
1029 * information we we're given... it's probably useless... --nenolod |
fc968772e096
[svn] Remove ALL Xlib stuff from the skinning engine and use GDK where
nenolod
parents:
471
diff
changeset
|
1030 */ |
fc968772e096
[svn] Remove ALL Xlib stuff from the skinning engine and use GDK where
nenolod
parents:
471
diff
changeset
|
1031 event->x = x; |
fc968772e096
[svn] Remove ALL Xlib stuff from the skinning engine and use GDK where
nenolod
parents:
471
diff
changeset
|
1032 event->y = y; |
fc968772e096
[svn] Remove ALL Xlib stuff from the skinning engine and use GDK where
nenolod
parents:
471
diff
changeset
|
1033 event->state = state; |
fc968772e096
[svn] Remove ALL Xlib stuff from the skinning engine and use GDK where
nenolod
parents:
471
diff
changeset
|
1034 } |
fc968772e096
[svn] Remove ALL Xlib stuff from the skinning engine and use GDK where
nenolod
parents:
471
diff
changeset
|
1035 else |
fc968772e096
[svn] Remove ALL Xlib stuff from the skinning engine and use GDK where
nenolod
parents:
471
diff
changeset
|
1036 { |
fc968772e096
[svn] Remove ALL Xlib stuff from the skinning engine and use GDK where
nenolod
parents:
471
diff
changeset
|
1037 x = event->x; |
fc968772e096
[svn] Remove ALL Xlib stuff from the skinning engine and use GDK where
nenolod
parents:
471
diff
changeset
|
1038 y = event->y; |
fc968772e096
[svn] Remove ALL Xlib stuff from the skinning engine and use GDK where
nenolod
parents:
471
diff
changeset
|
1039 state = event->state; |
0 | 1040 } |
1041 | |
1042 if (dock_is_moving(GTK_WINDOW(mainwin))) { | |
1043 dock_move_motion(GTK_WINDOW(mainwin), event); | |
1044 } | |
1045 else { | |
1046 handle_motion_cb(mainwin_wlist, widget, event); | |
1047 draw_main_window(FALSE); | |
1048 } | |
484
fc968772e096
[svn] Remove ALL Xlib stuff from the skinning engine and use GDK where
nenolod
parents:
471
diff
changeset
|
1049 |
0 | 1050 gdk_flush(); |
1051 | |
1052 return FALSE; | |
1053 } | |
1054 | |
1055 static gboolean | |
1056 inside_sensitive_widgets(gint x, gint y) | |
1057 { | |
1058 return (widget_contains(WIDGET(mainwin_menubtn), x, y) | |
1059 || widget_contains(WIDGET(mainwin_minimize), x, y) | |
1060 || widget_contains(WIDGET(mainwin_shade), x, y) | |
1061 || widget_contains(WIDGET(mainwin_close), x, y) | |
1062 || widget_contains(WIDGET(mainwin_rew), x, y) | |
1063 || widget_contains(WIDGET(mainwin_play), x, y) | |
1064 || widget_contains(WIDGET(mainwin_pause), x, y) | |
1065 || widget_contains(WIDGET(mainwin_stop), x, y) | |
1066 || widget_contains(WIDGET(mainwin_fwd), x, y) | |
1067 || widget_contains(WIDGET(mainwin_eject), x, y) | |
1068 || widget_contains(WIDGET(mainwin_shuffle), x, y) | |
1069 || widget_contains(WIDGET(mainwin_repeat), x, y) | |
1070 || widget_contains(WIDGET(mainwin_pl), x, y) | |
1071 || widget_contains(WIDGET(mainwin_eq), x, y) | |
1072 || widget_contains(WIDGET(mainwin_info), x, y) | |
1073 || widget_contains(WIDGET(mainwin_menurow), x, y) | |
1074 || widget_contains(WIDGET(mainwin_volume), x, y) | |
1075 || widget_contains(WIDGET(mainwin_balance), x, y) | |
1076 || (widget_contains(WIDGET(mainwin_position), x, y) && | |
1077 widget_is_visible(WIDGET(mainwin_position))) | |
1078 || widget_contains(WIDGET(mainwin_minus_num), x, y) | |
1079 || widget_contains(WIDGET(mainwin_10min_num), x, y) | |
1080 || widget_contains(WIDGET(mainwin_min_num), x, y) | |
1081 || widget_contains(WIDGET(mainwin_10sec_num), x, y) | |
1082 || widget_contains(WIDGET(mainwin_sec_num), x, y) | |
1083 || widget_contains(WIDGET(mainwin_vis), x, y) | |
1084 || widget_contains(WIDGET(mainwin_minimize), x, y) | |
1085 || widget_contains(WIDGET(mainwin_shade), x, y) | |
1086 || widget_contains(WIDGET(mainwin_close), x, y) | |
1087 || widget_contains(WIDGET(mainwin_menubtn), x, y) | |
1088 || widget_contains(WIDGET(mainwin_sposition), x, y) | |
1089 || widget_contains(WIDGET(mainwin_stime_min), x, y) | |
1090 || widget_contains(WIDGET(mainwin_stime_sec), x, y) | |
1091 || widget_contains(WIDGET(mainwin_srew), x, y) | |
1092 || widget_contains(WIDGET(mainwin_splay), x, y) | |
1093 || widget_contains(WIDGET(mainwin_spause), x, y) | |
1094 || widget_contains(WIDGET(mainwin_sstop), x, y) | |
1095 || widget_contains(WIDGET(mainwin_sfwd), x, y) | |
1096 || widget_contains(WIDGET(mainwin_seject), x, y) | |
1097 || widget_contains(WIDGET(mainwin_svis), x, y) | |
1098 || widget_contains(WIDGET(mainwin_about), x, y)); | |
1099 } | |
1100 | |
1101 void | |
1102 mainwin_scrolled(GtkWidget * widget, | |
1103 GdkEventScroll * event, | |
1104 gpointer callback_data) | |
1105 { | |
1106 gint d = cfg.mouse_change; | |
1107 if (event->direction == GDK_SCROLL_DOWN) | |
1108 d *= -1; | |
1109 mainwin_set_volume_diff(d); | |
1110 } | |
1111 | |
1112 | |
1113 static gboolean | |
1114 mainwin_mouse_button_press(GtkWidget * widget, | |
1115 GdkEventButton * event, | |
1116 gpointer callback_data) | |
1117 { | |
1118 | |
1119 gboolean grab = TRUE; | |
1120 | |
1121 if (event->button == 1 && event->type == GDK_BUTTON_PRESS && | |
1122 !inside_sensitive_widgets(event->x, event->y) && event->y < 14) { | |
1123 if (0 && hint_move_resize_available()) { | |
1124 hint_move_resize(mainwin, event->x_root, event->y_root, TRUE); | |
1125 grab = FALSE; | |
1126 } | |
1127 else { | |
1128 gtk_window_present(GTK_WINDOW(mainwin)); | |
1129 dock_move_press(dock_window_list, GTK_WINDOW(mainwin), event, | |
1130 TRUE); | |
1131 } | |
1132 } | |
1133 else if (event->button == 1 && event->type == GDK_2BUTTON_PRESS && | |
1134 event->y < 14 && !inside_sensitive_widgets(event->x, event->y)) { | |
1135 mainwin_set_shade(!cfg.player_shaded); | |
1136 if (dock_is_moving(GTK_WINDOW(mainwin))) | |
1137 dock_move_release(GTK_WINDOW(mainwin)); | |
1138 } | |
1139 else if (event->button == 1 && event->type == GDK_2BUTTON_PRESS && | |
1140 widget_contains(WIDGET(mainwin_info), event->x, event->y)) { | |
1141 playlist_fileinfo_current(); | |
1142 } | |
1143 else { | |
1144 handle_press_cb(mainwin_wlist, widget, event); | |
1145 draw_main_window(FALSE); | |
1146 } | |
1147 | |
1148 if ((event->button == 1) && event->type != GDK_2BUTTON_PRESS && | |
1149 (widget_contains(WIDGET(mainwin_vis), event->x, event->y) || | |
1150 widget_contains(WIDGET(mainwin_svis), event->x, event->y))) { | |
1151 | |
1152 cfg.vis_type++; | |
1153 | |
1154 if (cfg.vis_type > VIS_OFF) | |
1155 cfg.vis_type = VIS_ANALYZER; | |
1156 | |
1157 mainwin_vis_set_type(cfg.vis_type); | |
1158 } | |
1159 | |
1160 if (event->button == 3) { | |
1161 if (widget_contains(WIDGET(mainwin_info), event->x, event->y)) { | |
1162 util_item_factory_popup(mainwin_songname_menu, | |
1163 event->x_root, event->y_root, | |
1164 3, event->time); | |
1165 grab = FALSE; | |
1166 } | |
1167 else if (widget_contains(WIDGET(mainwin_vis), event->x, event->y) || | |
1168 widget_contains(WIDGET(mainwin_svis), event->x, event->y)) { | |
1169 util_item_factory_popup(mainwin_vis_menu, event->x_root, | |
1170 event->y_root, 3, event->time); | |
1171 grab = FALSE; | |
1172 } | |
1173 else if ( (event->y > 70) && (event->x < 128) ) | |
1174 { | |
1175 | |
1176 util_item_factory_popup(mainwin_play_menu, | |
1177 event->x_root, | |
1178 event->y_root, 3, event->time); | |
1179 grab = FALSE; | |
1180 } else { | |
1181 /* | |
1182 * Pop up the main menu a few pixels down. | |
1183 * This will avoid that anything is selected | |
1184 * if one right-clicks to focus the window | |
1185 * without raising it. | |
1186 * | |
1187 ***MD I think the above is stupid, people don't expect this | |
1188 * | |
1189 */ | |
1190 util_item_factory_popup(mainwin_general_menu, | |
1191 event->x_root, | |
1192 event->y_root, 3, event->time); | |
1193 grab = FALSE; | |
1194 } | |
1195 } | |
1196 if (event->button == 1) { | |
1197 if ((event->x > 35 && event->x < 100 && | |
1198 event->y > 25 && event->y < 40) || | |
1199 widget_contains(WIDGET(mainwin_stime_min), event->x, event->y) || | |
1200 widget_contains(WIDGET(mainwin_stime_sec), event->x, event->y)) { | |
1201 | |
1202 if (cfg.timer_mode == TIMER_ELAPSED) | |
1203 set_timer_mode(TIMER_REMAINING); | |
1204 else | |
1205 set_timer_mode(TIMER_ELAPSED); | |
1206 } | |
1207 | |
1208 } | |
1209 | |
1210 if (grab) | |
1211 gdk_pointer_grab(mainwin->window, FALSE, | |
1212 GDK_BUTTON_MOTION_MASK | | |
1213 GDK_BUTTON_RELEASE_MASK, | |
1214 GDK_WINDOW(GDK_NONE), NULL, GDK_CURRENT_TIME); | |
1215 | |
1216 return FALSE; | |
1217 } | |
1218 | |
1219 static gboolean | |
1220 mainwin_focus_in(GtkWidget * window, | |
1221 GdkEventFocus * event, | |
1222 gpointer data) | |
1223 { | |
1224 mainwin_menubtn->pb_allow_draw = TRUE; | |
1225 mainwin_minimize->pb_allow_draw = TRUE; | |
1226 mainwin_shade->pb_allow_draw = TRUE; | |
1227 mainwin_close->pb_allow_draw = TRUE; | |
1228 draw_main_window(TRUE); | |
1229 | |
1230 return TRUE; | |
1231 } | |
1232 | |
1233 | |
1234 static gboolean | |
1235 mainwin_focus_out(GtkWidget * widget, | |
1236 GdkEventFocus * event, | |
1237 gpointer callback_data) | |
1238 { | |
1239 mainwin_menubtn->pb_allow_draw = FALSE; | |
1240 mainwin_minimize->pb_allow_draw = FALSE; | |
1241 mainwin_shade->pb_allow_draw = FALSE; | |
1242 mainwin_close->pb_allow_draw = FALSE; | |
1243 draw_main_window(TRUE); | |
1244 | |
1245 return TRUE; | |
1246 } | |
1247 | |
1248 static gboolean | |
1249 mainwin_keypress(GtkWidget * grab_widget, | |
1250 GdkEventKey * event, | |
1251 gpointer data) | |
1252 { | |
1253 | |
1254 switch (event->keyval) { | |
1255 | |
1256 case GDK_Up: | |
1257 case GDK_KP_Up: | |
225
bfee3129143e
[svn] Add Winamp-style numeric keypad shortcut key support.
nenolod
parents:
197
diff
changeset
|
1258 case GDK_KP_8: |
0 | 1259 mainwin_set_volume_diff(2); |
1260 break; | |
1261 case GDK_Down: | |
1262 case GDK_KP_Down: | |
225
bfee3129143e
[svn] Add Winamp-style numeric keypad shortcut key support.
nenolod
parents:
197
diff
changeset
|
1263 case GDK_KP_2: |
0 | 1264 mainwin_set_volume_diff(-2); |
1265 break; | |
1266 case GDK_Left: | |
1267 case GDK_KP_Left: | |
225
bfee3129143e
[svn] Add Winamp-style numeric keypad shortcut key support.
nenolod
parents:
197
diff
changeset
|
1268 case GDK_KP_7: |
0 | 1269 if (playlist_get_current_length() != -1) |
1270 bmp_playback_seek(CLAMP | |
435
e3070cc55ab2
[svn] - Scroll by 1000 frames when using the keypad (7 && 9) inside the player window to
nenolod
parents:
434
diff
changeset
|
1271 (bmp_playback_get_time() - 1000, 0, |
0 | 1272 playlist_get_current_length()) / 1000); |
1273 break; | |
1274 case GDK_Right: | |
1275 case GDK_KP_Right: | |
225
bfee3129143e
[svn] Add Winamp-style numeric keypad shortcut key support.
nenolod
parents:
197
diff
changeset
|
1276 case GDK_KP_9: |
0 | 1277 if (playlist_get_current_length() != -1) |
1278 bmp_playback_seek(CLAMP | |
435
e3070cc55ab2
[svn] - Scroll by 1000 frames when using the keypad (7 && 9) inside the player window to
nenolod
parents:
434
diff
changeset
|
1279 (bmp_playback_get_time() + 1000, 0, |
0 | 1280 playlist_get_current_length()) / 1000); |
1281 break; | |
225
bfee3129143e
[svn] Add Winamp-style numeric keypad shortcut key support.
nenolod
parents:
197
diff
changeset
|
1282 case GDK_KP_4: |
bfee3129143e
[svn] Add Winamp-style numeric keypad shortcut key support.
nenolod
parents:
197
diff
changeset
|
1283 playlist_prev(); |
bfee3129143e
[svn] Add Winamp-style numeric keypad shortcut key support.
nenolod
parents:
197
diff
changeset
|
1284 break; |
bfee3129143e
[svn] Add Winamp-style numeric keypad shortcut key support.
nenolod
parents:
197
diff
changeset
|
1285 case GDK_KP_6: |
bfee3129143e
[svn] Add Winamp-style numeric keypad shortcut key support.
nenolod
parents:
197
diff
changeset
|
1286 playlist_next(); |
bfee3129143e
[svn] Add Winamp-style numeric keypad shortcut key support.
nenolod
parents:
197
diff
changeset
|
1287 break; |
bfee3129143e
[svn] Add Winamp-style numeric keypad shortcut key support.
nenolod
parents:
197
diff
changeset
|
1288 case GDK_KP_Insert: |
bfee3129143e
[svn] Add Winamp-style numeric keypad shortcut key support.
nenolod
parents:
197
diff
changeset
|
1289 mainwin_jump_to_file(); |
bfee3129143e
[svn] Add Winamp-style numeric keypad shortcut key support.
nenolod
parents:
197
diff
changeset
|
1290 break; |
bfee3129143e
[svn] Add Winamp-style numeric keypad shortcut key support.
nenolod
parents:
197
diff
changeset
|
1291 case GDK_KP_5: |
bfee3129143e
[svn] Add Winamp-style numeric keypad shortcut key support.
nenolod
parents:
197
diff
changeset
|
1292 mainwin_play_pushed(); |
bfee3129143e
[svn] Add Winamp-style numeric keypad shortcut key support.
nenolod
parents:
197
diff
changeset
|
1293 break; |
0 | 1294 case GDK_Escape: |
1295 mainwin_minimize_cb(); | |
1296 break; | |
1297 default: | |
1298 return FALSE; | |
1299 } | |
1300 | |
1301 return TRUE; | |
1302 } | |
1303 | |
1304 static void | |
1305 mainwin_jump_to_time_cb(GtkWidget * widget, | |
1306 GtkWidget * entry) | |
1307 { | |
625
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
1308 guint min = 0, sec = 0, params; |
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
561
diff
changeset
|
1309 gint time; |
0 | 1310 |
1311 params = sscanf(gtk_entry_get_text(GTK_ENTRY(entry)), "%u:%u", | |
1312 &min, &sec); | |
1313 if (params == 2) | |
1314 time = (min * 60) + sec; | |
1315 else if (params == 1) | |
1316 time = min; | |
1317 else | |
1318 return; | |
1319 | |
1320 if (playlist_get_current_length() > -1 && | |
1321 time <= (playlist_get_current_length() / 1000)) { | |
1322 bmp_playback_seek(time); | |
1323 gtk_widget_destroy(mainwin_jtt); | |
1324 } | |
1325 } | |
1326 | |
1327 | |
1328 void | |
1329 mainwin_jump_to_time(void) | |
1330 { | |
1331 GtkWidget *vbox, *hbox_new, *hbox_total; | |
1332 GtkWidget *time_entry, *label, *bbox, *jump, *cancel; | |
1333 guint tindex; | |
1334 gchar time_str[10]; | |
1335 | |
1336 if (!bmp_playback_get_playing()) { | |
781
12c47704b4b5
[svn] Add error reporting for many places, patch by external contributor Derek
nenolod
parents:
654
diff
changeset
|
1337 report_error("JIT can't be launched when no track is being played.\n"); |
0 | 1338 return; |
1339 } | |
1340 | |
1341 if (mainwin_jtt) { | |
1342 gtk_window_present(GTK_WINDOW(mainwin_jtt)); | |
1343 return; | |
1344 } | |
1345 | |
1346 mainwin_jtt = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
1347 gtk_window_set_type_hint(GTK_WINDOW(mainwin_jtt), | |
1348 GDK_WINDOW_TYPE_HINT_DIALOG); | |
1349 | |
1350 gtk_window_set_title(GTK_WINDOW(mainwin_jtt), _("Jump to Time")); | |
1351 gtk_window_set_position(GTK_WINDOW(mainwin_jtt), GTK_WIN_POS_CENTER); | |
1352 gtk_window_set_transient_for(GTK_WINDOW(mainwin_jtt), | |
1353 GTK_WINDOW(mainwin)); | |
1354 | |
1355 g_signal_connect(mainwin_jtt, "destroy", | |
1356 G_CALLBACK(gtk_widget_destroyed), &mainwin_jtt); | |
1357 gtk_container_border_width(GTK_CONTAINER(mainwin_jtt), 10); | |
1358 | |
1359 vbox = gtk_vbox_new(FALSE, 5); | |
1360 gtk_container_add(GTK_CONTAINER(mainwin_jtt), vbox); | |
1361 | |
1362 hbox_new = gtk_hbox_new(FALSE, 0); | |
1363 gtk_box_pack_start(GTK_BOX(vbox), hbox_new, TRUE, TRUE, 5); | |
1364 | |
1365 time_entry = gtk_entry_new(); | |
1366 gtk_box_pack_start(GTK_BOX(hbox_new), time_entry, FALSE, FALSE, 5); | |
1367 g_signal_connect(time_entry, "activate", | |
1368 G_CALLBACK(mainwin_jump_to_time_cb), time_entry); | |
1369 | |
1370 gtk_widget_set_size_request(time_entry, 70, -1); | |
1371 label = gtk_label_new(_("minutes:seconds")); | |
1372 gtk_box_pack_start(GTK_BOX(hbox_new), label, FALSE, FALSE, 5); | |
1373 | |
1374 hbox_total = gtk_hbox_new(FALSE, 0); | |
1375 gtk_box_pack_start(GTK_BOX(vbox), hbox_total, TRUE, TRUE, 5); | |
1376 gtk_widget_show(hbox_total); | |
1377 | |
1378 /* FIXME: Disable display of current track length. It's not | |
1379 updated when track changes */ | |
1380 #if 0 | |
1381 label = gtk_label_new(_("Track length:")); | |
1382 gtk_box_pack_start(GTK_BOX(hbox_total), label, FALSE, FALSE, 5); | |
1383 | |
1384 len = playlist_get_current_length() / 1000; | |
1385 g_snprintf(time_str, sizeof(time_str), "%u:%2.2u", len / 60, len % 60); | |
1386 label = gtk_label_new(time_str); | |
1387 | |
1388 gtk_box_pack_start(GTK_BOX(hbox_total), label, FALSE, FALSE, 10); | |
1389 #endif | |
1390 | |
1391 bbox = gtk_hbutton_box_new(); | |
1392 gtk_box_pack_start(GTK_BOX(vbox), bbox, TRUE, TRUE, 0); | |
1393 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); | |
1394 gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5); | |
1395 | |
1396 cancel = gtk_button_new_from_stock(GTK_STOCK_CANCEL); | |
1397 GTK_WIDGET_SET_FLAGS(cancel, GTK_CAN_DEFAULT); | |
1398 gtk_container_add(GTK_CONTAINER(bbox), cancel); | |
1399 g_signal_connect_swapped(cancel, "clicked", | |
1400 G_CALLBACK(gtk_widget_destroy), mainwin_jtt); | |
1401 | |
1402 jump = gtk_button_new_from_stock(GTK_STOCK_JUMP_TO); | |
1403 GTK_WIDGET_SET_FLAGS(jump, GTK_CAN_DEFAULT); | |
1404 gtk_container_add(GTK_CONTAINER(bbox), jump); | |
1405 g_signal_connect(jump, "clicked", | |
1406 G_CALLBACK(mainwin_jump_to_time_cb), time_entry); | |
1407 | |
1408 tindex = bmp_playback_get_time() / 1000; | |
1409 g_snprintf(time_str, sizeof(time_str), "%u:%2.2u", tindex / 60, | |
1410 tindex % 60); | |
1411 gtk_entry_set_text(GTK_ENTRY(time_entry), time_str); | |
1412 | |
1413 gtk_entry_select_region(GTK_ENTRY(time_entry), 0, strlen(time_str)); | |
1414 | |
1415 gtk_widget_show_all(mainwin_jtt); | |
1416 | |
1417 gtk_widget_grab_focus(time_entry); | |
1418 gtk_widget_grab_default(jump); | |
1419 } | |
1420 | |
1421 static void | |
1422 change_song(guint pos) | |
1423 { | |
1424 if (bmp_playback_get_playing()) | |
1425 bmp_playback_stop(); | |
1426 | |
1427 playlist_set_position(pos); | |
1428 bmp_playback_initiate(); | |
1429 } | |
1430 | |
1431 static void | |
1432 mainwin_jump_to_file_jump(GtkTreeView * treeview) | |
1433 { | |
1434 GtkTreeModel *model; | |
1435 GtkTreeSelection *selection; | |
1436 GtkTreeIter iter; | |
1437 gchar *pos_str; | |
1438 guint pos; | |
1439 | |
1440 model = gtk_tree_view_get_model(treeview); | |
1441 selection = gtk_tree_view_get_selection(treeview); | |
1442 | |
1443 if (!gtk_tree_selection_get_selected(selection, NULL, &iter)) | |
1444 return; | |
1445 | |
1446 gtk_tree_model_get(model, &iter, 0, &pos_str, -1); | |
1447 pos = g_ascii_strtoull(pos_str, NULL, 10) - 1; | |
813
c8cf439179b8
[svn] - Fix a ton and a half of memory leaks, via the wonderful Leonardo Boshell <leonardop -at- gentoo.org>.
nenolod
parents:
799
diff
changeset
|
1448 g_free(pos_str); |
0 | 1449 |
1450 change_song(pos); | |
1451 | |
1452 /* FIXME: should only hide window */ | |
1453 gtk_widget_destroy(mainwin_jtf); | |
1454 mainwin_jtf = NULL; | |
1455 } | |
1456 | |
1457 static void | |
1458 mainwin_jump_to_file_jump_cb(GtkTreeView * treeview, | |
1459 gpointer data) | |
1460 { | |
1461 mainwin_jump_to_file_jump(treeview); | |
1462 } | |
1463 | |
1464 static void | |
1465 mainwin_jump_to_file_set_queue_button_label(GtkButton * button, | |
1466 guint pos) | |
1467 { | |
1468 if (playlist_is_position_queued(pos)) | |
1469 gtk_button_set_label(button, _("Un_queue")); | |
1470 else | |
1471 gtk_button_set_label(button, _("_Queue")); | |
1472 } | |
1473 | |
1474 static void | |
1475 mainwin_jump_to_file_queue_cb(GtkButton * button, | |
1476 gpointer data) | |
1477 { | |
1478 GtkTreeView *treeview; | |
1479 GtkTreeModel *model; | |
1480 GtkTreeSelection *selection; | |
1481 GtkTreeIter iter; | |
1482 gchar *pos_str; | |
1483 guint pos; | |
1484 | |
1485 treeview = GTK_TREE_VIEW(data); | |
1486 model = gtk_tree_view_get_model(treeview); | |
1487 selection = gtk_tree_view_get_selection(treeview); | |
1488 | |
1489 if (!gtk_tree_selection_get_selected(selection, NULL, &iter)) | |
1490 return; | |
1491 | |
1492 gtk_tree_model_get(model, &iter, 0, &pos_str, -1); | |
1493 pos = g_ascii_strtoull(pos_str, NULL, 10) - 1; | |
1494 | |
1495 playlist_queue_position(pos); | |
1496 | |
1497 mainwin_jump_to_file_set_queue_button_label(button, pos); | |
1498 } | |
1499 | |
1500 static void | |
1501 mainwin_jump_to_file_selection_changed_cb(GtkTreeSelection *treesel, | |
1502 gpointer data) | |
1503 { | |
1504 GtkTreeView *treeview; | |
1505 GtkTreeModel *model; | |
1506 GtkTreeSelection *selection; | |
1507 GtkTreeIter iter; | |
1508 gchar *pos_str; | |
1509 guint pos; | |
1510 | |
1511 treeview = gtk_tree_selection_get_tree_view(treesel); | |
1512 model = gtk_tree_view_get_model(treeview); | |
1513 selection = gtk_tree_view_get_selection(treeview); | |
1514 | |
1515 if (!gtk_tree_selection_get_selected(selection, NULL, &iter)) | |
1516 return; | |
1517 | |
1518 gtk_tree_model_get(model, &iter, 0, &pos_str, -1); | |
1519 pos = g_ascii_strtoull(pos_str, NULL, 10) - 1; | |
813
c8cf439179b8
[svn] - Fix a ton and a half of memory leaks, via the wonderful Leonardo Boshell <leonardop -at- gentoo.org>.
nenolod
parents:
799
diff
changeset
|
1520 g_free(pos_str); |
0 | 1521 |
1522 mainwin_jump_to_file_set_queue_button_label(GTK_BUTTON(data), pos); | |
1523 } | |
1524 | |
1525 static gboolean | |
1526 mainwin_jump_to_file_keypress_cb(GtkWidget * object, | |
1527 GdkEventKey * event, | |
1528 gpointer data) | |
1529 { | |
1530 switch (event->keyval) { | |
1531 case GDK_Escape: | |
1532 /* FIXME: show only hide window */ | |
1533 gtk_widget_destroy(mainwin_jtf); | |
1534 mainwin_jtf = NULL; | |
1535 return TRUE; | |
1536 case GDK_Return: | |
1537 mainwin_jump_to_file_jump(GTK_TREE_VIEW(data)); | |
1538 return TRUE; | |
1539 default: | |
1540 return FALSE; | |
1541 }; | |
1542 } | |
1543 | |
1544 static gboolean | |
1545 mainwin_jump_to_file_match(const gchar * song, gchar ** keys) | |
1546 { | |
1547 gint i = 0; | |
1548 gchar *key; | |
1549 gchar *song_lc; | |
1550 | |
1551 song_lc = g_ascii_strdown(song, -1); | |
1552 | |
1553 while (keys[i]) { | |
1554 key = g_ascii_strdown(keys[i], -1); | |
1555 if (!g_strrstr(song_lc, key)) { | |
1556 g_free(key); | |
1557 g_free(song_lc); | |
1558 return FALSE; | |
1559 } | |
1560 | |
1561 g_free(key); | |
1562 i++; | |
1563 } | |
1564 | |
1565 g_free(song_lc); | |
1566 | |
1567 return TRUE; | |
1568 } | |
1569 | |
1570 /* FIXME: Clear the entry when the list gets updated */ | |
1571 static void | |
1572 mainwin_update_jtf(GtkWidget * widget, gpointer user_data) | |
1573 { | |
1574 /* FIXME: Is not in sync with playlist due to delayed extinfo | |
1575 * reading */ | |
1576 gint row; | |
1577 GList *playlist; | |
1578 gchar *desc_buf; | |
1579 gchar *row_str; | |
1580 GtkTreeIter iter; | |
1581 GtkTreeSelection *selection; | |
1582 | |
1583 GtkTreeModel *store; | |
1584 | |
1585 if (!mainwin_jtf) | |
1586 return; | |
1587 | |
1588 store = gtk_tree_view_get_model(GTK_TREE_VIEW(user_data)); | |
1589 gtk_list_store_clear(GTK_LIST_STORE(store)); | |
1590 | |
1591 row = 1; | |
1592 for (playlist = playlist_get(); playlist; | |
1593 playlist = g_list_next(playlist)) { | |
1594 PlaylistEntry *entry = PLAYLIST_ENTRY(playlist->data); | |
1595 | |
1596 if (entry->title) | |
1597 desc_buf = entry->title; | |
1598 else if (strchr(entry->filename, '/')) | |
1599 desc_buf = strrchr(entry->filename, '/') + 1; | |
1600 else | |
1601 desc_buf = entry->filename; | |
1602 | |
1603 row_str = g_strdup_printf("%d", row++); | |
1604 | |
1605 gtk_list_store_append(GTK_LIST_STORE(store), &iter); | |
1606 gtk_list_store_set(GTK_LIST_STORE(store), &iter, | |
1607 0, row_str, 1, desc_buf, -1); | |
1608 | |
1609 g_free(row_str); | |
1610 } | |
1611 | |
1612 gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store), &iter); | |
1613 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(user_data)); | |
1614 gtk_tree_selection_select_iter(selection, &iter); | |
1615 } | |
1616 | |
1617 static void | |
1618 mainwin_jump_to_file_edit_cb(GtkEntry * entry, gpointer user_data) | |
1619 { | |
1620 GtkTreeView *treeview = GTK_TREE_VIEW(user_data); | |
1621 GtkTreeSelection *selection; | |
1622 GtkTreeIter iter; | |
1623 | |
1624 GtkListStore *store; | |
1625 | |
1626 gint song_index = 0; | |
1627 gchar **words; | |
1628 GList *playlist; | |
1629 | |
1630 gboolean match = FALSE; | |
1631 | |
1632 /* Chop the key string into ' '-separated key words */ | |
1633 words = g_strsplit(gtk_entry_get_text(entry), " ", 0); | |
1634 | |
1635 /* FIXME: Remove the connected signals before clearing | |
1636 * (row-selected will still eventually arrive once) */ | |
1637 store = GTK_LIST_STORE(gtk_tree_view_get_model(treeview)); | |
1638 gtk_list_store_clear(store); | |
1639 | |
1640 PLAYLIST_LOCK(); | |
1641 | |
1642 for (playlist = playlist_get(); playlist; | |
1643 playlist = g_list_next(playlist)) { | |
1644 | |
1645 PlaylistEntry *entry = PLAYLIST_ENTRY(playlist->data); | |
1646 const gchar *title, *filename; | |
1647 | |
1648 title = entry->title; | |
1649 if (!title) { | |
1650 filename = entry->filename; | |
1651 | |
1652 if (strchr(filename, '/')) | |
1653 title = strrchr(filename, '/') + 1; | |
1654 else | |
1655 title = filename; | |
1656 } | |
1657 | |
1658 /* Compare the key words to the string - if all the words | |
1659 match, add to the ListStore */ | |
1660 | |
1661 /* | |
1662 * FIXME: The search string should be adapted to the | |
1663 * current display setting, e.g. if the user has set it to | |
1664 * "%p - %t" then build the match string like that too, or | |
1665 * even better, search for each of the tags seperatly. | |
1666 * | |
1667 * In any case the string to match should _never_ contain | |
1668 * something the user can't actually see in the playlist. | |
1669 */ | |
1670 if (words[0]) | |
1671 match = mainwin_jump_to_file_match(title, words); | |
1672 else | |
1673 match = TRUE; | |
1674 | |
1675 if (match) { | |
1676 gchar *song_index_str = g_strdup_printf("%d", song_index + 1); | |
1677 gtk_list_store_append(store, &iter); | |
1678 gtk_list_store_set(store, &iter, 0, song_index_str, 1, title, -1); | |
1679 g_free(song_index_str); | |
1680 } | |
1681 | |
1682 song_index++; | |
1683 } | |
1684 | |
1685 PLAYLIST_UNLOCK(); | |
1686 | |
1687 g_strfreev(words); | |
1688 | |
1689 if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store), &iter)) { | |
1690 selection = gtk_tree_view_get_selection(treeview); | |
1691 gtk_tree_selection_select_iter(selection, &iter); | |
1692 } | |
1693 } | |
1694 | |
1695 void | |
1696 mainwin_jump_to_file(void) | |
1697 { | |
1698 GtkWidget *scrollwin; | |
1699 GtkWidget *vbox, *bbox, *sep; | |
1700 GtkWidget *jump, *queue, *cancel; | |
1701 GtkWidget *rescan, *edit; | |
1702 GtkWidget *search_label, *hbox; | |
1703 GList *playlist; | |
1704 gchar *desc_buf; | |
1705 gchar *row_str; | |
1706 gint row; | |
1707 | |
1708 GtkWidget *treeview; | |
1709 GtkListStore *jtf_store; | |
1710 | |
1711 GtkTreeIter iter; | |
1712 GtkCellRenderer *renderer; | |
1713 GtkTreeViewColumn *column; | |
1714 | |
1715 if (mainwin_jtf) { | |
1716 gtk_window_present(GTK_WINDOW(mainwin_jtf)); | |
1717 return; | |
1718 } | |
1719 | |
1720 mainwin_jtf = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
1721 gtk_window_set_type_hint(GTK_WINDOW(mainwin_jtf), | |
1722 GDK_WINDOW_TYPE_HINT_DIALOG); | |
1723 | |
1724 gtk_window_set_title(GTK_WINDOW(mainwin_jtf), _("Jump to Track")); | |
1725 | |
1726 gtk_window_set_position(GTK_WINDOW(mainwin_jtf), GTK_WIN_POS_CENTER); | |
1727 g_signal_connect(mainwin_jtf, "destroy", | |
1728 G_CALLBACK(gtk_widget_destroyed), &mainwin_jtf); | |
1729 | |
1730 gtk_container_border_width(GTK_CONTAINER(mainwin_jtf), 10); | |
1731 gtk_window_set_default_size(GTK_WINDOW(mainwin_jtf), 550, 350); | |
1732 | |
1733 vbox = gtk_vbox_new(FALSE, 5); | |
1734 gtk_container_add(GTK_CONTAINER(mainwin_jtf), vbox); | |
1735 | |
1736 jtf_store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_STRING); | |
1737 treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(jtf_store)); | |
1738 g_object_unref(jtf_store); | |
1739 | |
1740 gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(treeview), TRUE); | |
1741 | |
1742 column = gtk_tree_view_column_new(); | |
1743 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(treeview), FALSE); | |
1744 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); | |
1745 | |
1746 renderer = gtk_cell_renderer_text_new(); | |
1747 gtk_tree_view_column_pack_start(column, renderer, FALSE); | |
1748 gtk_tree_view_column_set_attributes(column, renderer, "text", 0, NULL); | |
1749 gtk_tree_view_column_set_spacing(column, 4); | |
1750 | |
1751 renderer = gtk_cell_renderer_text_new(); | |
1752 gtk_tree_view_column_pack_start(column, renderer, FALSE); | |
1753 gtk_tree_view_column_set_attributes(column, renderer, "text", 1, NULL); | |
1754 gtk_tree_view_column_set_spacing(column, 4); | |
1755 gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column); | |
1756 | |
1757 g_signal_connect(treeview, "row-activated", | |
1758 G_CALLBACK(mainwin_jump_to_file_jump), NULL); | |
1759 | |
1760 hbox = gtk_hbox_new(FALSE, 3); | |
1761 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 3); | |
1762 | |
1763 search_label = gtk_label_new(_("Filter: ")); | |
1764 gtk_label_set_markup_with_mnemonic(GTK_LABEL(search_label), "_Filter:"); | |
1765 gtk_box_pack_start(GTK_BOX(hbox), search_label, FALSE, FALSE, 0); | |
1766 | |
1767 edit = gtk_entry_new(); | |
1768 gtk_entry_set_editable(GTK_ENTRY(edit), TRUE); | |
1769 gtk_label_set_mnemonic_widget(GTK_LABEL(search_label), edit); | |
1770 g_signal_connect(edit, "changed", | |
1771 G_CALLBACK(mainwin_jump_to_file_edit_cb), treeview); | |
1772 | |
1773 g_signal_connect(mainwin_jtf, "key_press_event", | |
1774 G_CALLBACK(mainwin_jump_to_file_keypress_cb), treeview); | |
1775 | |
1776 gtk_box_pack_start(GTK_BOX(hbox), edit, TRUE, TRUE, 3); | |
1777 | |
1778 scrollwin = gtk_scrolled_window_new(NULL, NULL); | |
1779 gtk_container_add(GTK_CONTAINER(scrollwin), treeview); | |
1780 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrollwin), | |
1781 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); | |
1782 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrollwin), | |
1783 GTK_SHADOW_IN); | |
1784 gtk_box_pack_start(GTK_BOX(vbox), scrollwin, TRUE, TRUE, 0); | |
1785 | |
1786 sep = gtk_hseparator_new(); | |
1787 gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0); | |
1788 | |
1789 bbox = gtk_hbutton_box_new(); | |
1790 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); | |
1791 gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5); | |
1792 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); | |
1793 | |
1794 queue = gtk_button_new_with_mnemonic(_("_Queue")); | |
1795 gtk_box_pack_start(GTK_BOX(bbox), queue, FALSE, FALSE, 0); | |
1796 GTK_WIDGET_SET_FLAGS(queue, GTK_CAN_DEFAULT); | |
1797 g_signal_connect(queue, "clicked", | |
1798 G_CALLBACK(mainwin_jump_to_file_queue_cb), | |
1799 treeview); | |
1800 g_signal_connect(gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)), "changed", | |
1801 G_CALLBACK(mainwin_jump_to_file_selection_changed_cb), | |
1802 queue); | |
1803 | |
1804 rescan = gtk_button_new_from_stock(GTK_STOCK_REFRESH); | |
1805 gtk_box_pack_start(GTK_BOX(bbox), rescan, FALSE, FALSE, 0); | |
1806 g_signal_connect(rescan, "clicked", | |
1807 G_CALLBACK(mainwin_update_jtf), treeview); | |
1808 GTK_WIDGET_SET_FLAGS(rescan, GTK_CAN_DEFAULT); | |
1809 gtk_widget_grab_default(rescan); | |
1810 | |
1811 jump = gtk_button_new_from_stock(GTK_STOCK_JUMP_TO); | |
1812 gtk_box_pack_start(GTK_BOX(bbox), jump, FALSE, FALSE, 0); | |
1813 | |
1814 g_signal_connect_swapped(jump, "clicked", | |
1815 G_CALLBACK(mainwin_jump_to_file_jump_cb), | |
1816 treeview); | |
1817 | |
1818 GTK_WIDGET_SET_FLAGS(jump, GTK_CAN_DEFAULT); | |
1819 gtk_widget_grab_default(jump); | |
1820 | |
1821 cancel = gtk_button_new_from_stock(GTK_STOCK_CLOSE); | |
1822 gtk_box_pack_start(GTK_BOX(bbox), cancel, FALSE, FALSE, 0); | |
1823 g_signal_connect_swapped(cancel, "clicked", | |
1824 G_CALLBACK(gtk_widget_destroy), | |
1825 mainwin_jtf); | |
1826 GTK_WIDGET_SET_FLAGS(cancel, GTK_CAN_DEFAULT); | |
1827 | |
1828 gtk_list_store_clear(jtf_store); | |
1829 | |
1830 row = 1; | |
1831 | |
1832 PLAYLIST_LOCK(); | |
1833 | |
1834 for (playlist = playlist_get(); playlist; | |
1835 playlist = g_list_next(playlist)) { | |
1836 | |
1837 PlaylistEntry *entry = PLAYLIST_ENTRY(playlist->data); | |
1838 | |
1839 if (entry->title) | |
1840 desc_buf = entry->title; | |
1841 else if (strchr(entry->filename, '/')) | |
1842 desc_buf = strrchr(entry->filename, '/') + 1; | |
1843 else | |
1844 desc_buf = entry->filename; | |
1845 | |
1846 row_str = g_strdup_printf("%d", row++); | |
1847 | |
1848 gtk_list_store_append(GTK_LIST_STORE(jtf_store), &iter); | |
1849 gtk_list_store_set(GTK_LIST_STORE(jtf_store), &iter, | |
1850 0, row_str, 1, desc_buf, -1); | |
1851 | |
1852 g_free(row_str); | |
1853 } | |
1854 | |
1855 PLAYLIST_UNLOCK(); | |
1856 | |
1857 gtk_widget_show_all(mainwin_jtf); | |
1858 } | |
1859 | |
1860 static gboolean | |
1861 mainwin_configure(GtkWidget * window, | |
1862 GdkEventConfigure * event, | |
1863 gpointer data) | |
1864 { | |
1865 if (!GTK_WIDGET_VISIBLE(window)) | |
1866 return FALSE; | |
1867 | |
1868 if (cfg.show_wm_decorations) | |
1869 gdk_window_get_root_origin(window->window, | |
1870 &cfg.player_x, &cfg.player_y); | |
1871 else | |
1872 gdk_window_get_deskrelative_origin(window->window, | |
1873 &cfg.player_x, &cfg.player_y); | |
1874 return FALSE; | |
1875 } | |
1876 | |
1877 void | |
1878 mainwin_set_back_pixmap(void) | |
1879 { | |
1880 gdk_window_set_back_pixmap(mainwin->window, mainwin_bg, 0); | |
1881 gdk_window_clear(mainwin->window); | |
1882 } | |
1883 | |
1884 void | |
1885 mainwin_drag_data_received(GtkWidget * widget, | |
1886 GdkDragContext * context, | |
1887 gint x, | |
1888 gint y, | |
1889 GtkSelectionData * selection_data, | |
1890 guint info, | |
1891 guint time, | |
1892 gpointer user_data) | |
1893 { | |
289
8eab873f20a8
[svn] possible DND fix for konqueror. (cleaned up version of fixed version of my cleanups...
nenolod
parents:
284
diff
changeset
|
1894 gchar **iter, **sourcelist, *path; |
274
f6edd411a320
[svn] Merge a cleaned up version of the patch included with #383. Audacious
nenolod
parents:
234
diff
changeset
|
1895 gchar *decoded; |
f6edd411a320
[svn] Merge a cleaned up version of the patch included with #383. Audacious
nenolod
parents:
234
diff
changeset
|
1896 gboolean not_font = FALSE; |
f6edd411a320
[svn] Merge a cleaned up version of the patch included with #383. Audacious
nenolod
parents:
234
diff
changeset
|
1897 |
f6edd411a320
[svn] Merge a cleaned up version of the patch included with #383. Audacious
nenolod
parents:
234
diff
changeset
|
1898 if (!selection_data->data) |
f6edd411a320
[svn] Merge a cleaned up version of the patch included with #383. Audacious
nenolod
parents:
234
diff
changeset
|
1899 { |
0 | 1900 g_warning("DND data string is NULL"); |
1901 return; | |
1902 } | |
1903 | |
925
25963e82c40f
[svn] - konqueror hack was breaking standards here, fix a crash
nenolod
parents:
898
diff
changeset
|
1904 iter = sourcelist = g_strsplit((gchar *)(selection_data->data),"\n",-1); |
289
8eab873f20a8
[svn] possible DND fix for konqueror. (cleaned up version of fixed version of my cleanups...
nenolod
parents:
284
diff
changeset
|
1905 |
358
70075730e187
[svn] Checking path for NULL wont work in the for() loop, so we have to check elsewhere.
nenolod
parents:
331
diff
changeset
|
1906 for (path = *sourcelist; *path; path = *(++sourcelist)) |
274
f6edd411a320
[svn] Merge a cleaned up version of the patch included with #383. Audacious
nenolod
parents:
234
diff
changeset
|
1907 { |
925
25963e82c40f
[svn] - konqueror hack was breaking standards here, fix a crash
nenolod
parents:
898
diff
changeset
|
1908 if (path == NULL) /* damn konqueror */ |
25963e82c40f
[svn] - konqueror hack was breaking standards here, fix a crash
nenolod
parents:
898
diff
changeset
|
1909 break; |
25963e82c40f
[svn] - konqueror hack was breaking standards here, fix a crash
nenolod
parents:
898
diff
changeset
|
1910 |
274
f6edd411a320
[svn] Merge a cleaned up version of the patch included with #383. Audacious
nenolod
parents:
234
diff
changeset
|
1911 if (str_has_prefix_nocase(path, "fonts:///")) |
f6edd411a320
[svn] Merge a cleaned up version of the patch included with #383. Audacious
nenolod
parents:
234
diff
changeset
|
1912 { |
f6edd411a320
[svn] Merge a cleaned up version of the patch included with #383. Audacious
nenolod
parents:
234
diff
changeset
|
1913 path += 8; |
f6edd411a320
[svn] Merge a cleaned up version of the patch included with #383. Audacious
nenolod
parents:
234
diff
changeset
|
1914 |
f6edd411a320
[svn] Merge a cleaned up version of the patch included with #383. Audacious
nenolod
parents:
234
diff
changeset
|
1915 /* plain, since we already stripped the first URI part */ |
f6edd411a320
[svn] Merge a cleaned up version of the patch included with #383. Audacious
nenolod
parents:
234
diff
changeset
|
1916 decoded = xmms_urldecode_plain(path); |
f6edd411a320
[svn] Merge a cleaned up version of the patch included with #383. Audacious
nenolod
parents:
234
diff
changeset
|
1917 |
f6edd411a320
[svn] Merge a cleaned up version of the patch included with #383. Audacious
nenolod
parents:
234
diff
changeset
|
1918 /* Get the old font's size, and add it to the dropped |
f6edd411a320
[svn] Merge a cleaned up version of the patch included with #383. Audacious
nenolod
parents:
234
diff
changeset
|
1919 * font's name |
f6edd411a320
[svn] Merge a cleaned up version of the patch included with #383. Audacious
nenolod
parents:
234
diff
changeset
|
1920 */ |
f6edd411a320
[svn] Merge a cleaned up version of the patch included with #383. Audacious
nenolod
parents:
234
diff
changeset
|
1921 cfg.playlist_font = g_strconcat(decoded + 1, |
f6edd411a320
[svn] Merge a cleaned up version of the patch included with #383. Audacious
nenolod
parents:
234
diff
changeset
|
1922 strrchr(cfg.playlist_font, ' '), |
f6edd411a320
[svn] Merge a cleaned up version of the patch included with #383. Audacious
nenolod
parents:
234
diff
changeset
|
1923 NULL); |
f6edd411a320
[svn] Merge a cleaned up version of the patch included with #383. Audacious
nenolod
parents:
234
diff
changeset
|
1924 playlist_list_set_font(cfg.playlist_font); |
f6edd411a320
[svn] Merge a cleaned up version of the patch included with #383. Audacious
nenolod
parents:
234
diff
changeset
|
1925 playlistwin_update_list(); |
0 | 1926 |
274
f6edd411a320
[svn] Merge a cleaned up version of the patch included with #383. Audacious
nenolod
parents:
234
diff
changeset
|
1927 g_free(decoded); |
f6edd411a320
[svn] Merge a cleaned up version of the patch included with #383. Audacious
nenolod
parents:
234
diff
changeset
|
1928 return; |
f6edd411a320
[svn] Merge a cleaned up version of the patch included with #383. Audacious
nenolod
parents:
234
diff
changeset
|
1929 } |
f6edd411a320
[svn] Merge a cleaned up version of the patch included with #383. Audacious
nenolod
parents:
234
diff
changeset
|
1930 |
f6edd411a320
[svn] Merge a cleaned up version of the patch included with #383. Audacious
nenolod
parents:
234
diff
changeset
|
1931 if (str_has_prefix_nocase(path,"file:///")) |
f6edd411a320
[svn] Merge a cleaned up version of the patch included with #383. Audacious
nenolod
parents:
234
diff
changeset
|
1932 { |
f6edd411a320
[svn] Merge a cleaned up version of the patch included with #383. Audacious
nenolod
parents:
234
diff
changeset
|
1933 if (not_font == FALSE) |
f6edd411a320
[svn] Merge a cleaned up version of the patch included with #383. Audacious
nenolod
parents:
234
diff
changeset
|
1934 { |
f6edd411a320
[svn] Merge a cleaned up version of the patch included with #383. Audacious
nenolod
parents:
234
diff
changeset
|
1935 playlist_clear(); |
f6edd411a320
[svn] Merge a cleaned up version of the patch included with #383. Audacious
nenolod
parents:
234
diff
changeset
|
1936 not_font = TRUE; |
f6edd411a320
[svn] Merge a cleaned up version of the patch included with #383. Audacious
nenolod
parents:
234
diff
changeset
|
1937 } |
f6edd411a320
[svn] Merge a cleaned up version of the patch included with #383. Audacious
nenolod
parents:
234
diff
changeset
|
1938 playlist_add_url(path); |
f6edd411a320
[svn] Merge a cleaned up version of the patch included with #383. Audacious
nenolod
parents:
234
diff
changeset
|
1939 } |
0 | 1940 } |
274
f6edd411a320
[svn] Merge a cleaned up version of the patch included with #383. Audacious
nenolod
parents:
234
diff
changeset
|
1941 |
289
8eab873f20a8
[svn] possible DND fix for konqueror. (cleaned up version of fixed version of my cleanups...
nenolod
parents:
284
diff
changeset
|
1942 g_strfreev(iter); |
274
f6edd411a320
[svn] Merge a cleaned up version of the patch included with #383. Audacious
nenolod
parents:
234
diff
changeset
|
1943 |
f6edd411a320
[svn] Merge a cleaned up version of the patch included with #383. Audacious
nenolod
parents:
234
diff
changeset
|
1944 if (not_font) |
f6edd411a320
[svn] Merge a cleaned up version of the patch included with #383. Audacious
nenolod
parents:
234
diff
changeset
|
1945 bmp_playback_initiate(); |
0 | 1946 } |
1947 | |
1948 static void | |
1949 on_add_url_add_clicked(GtkWidget * widget, | |
1950 GtkWidget * entry) | |
1951 { | |
1952 const gchar *text = gtk_entry_get_text(GTK_ENTRY(entry)); | |
1953 if (text && *text) | |
1954 playlist_add_url(text); | |
1955 } | |
1956 | |
86 | 1957 static void |
1958 on_add_url_ok_clicked(GtkWidget * widget, | |
1959 GtkWidget * entry) | |
1960 { | |
1961 const gchar *text = gtk_entry_get_text(GTK_ENTRY(entry)); | |
1962 if (text && *text) | |
1963 { | |
1964 playlist_clear(); | |
1965 playlist_add_url(text); | |
1966 bmp_playback_initiate(); | |
1967 } | |
1968 } | |
1969 | |
0 | 1970 void |
1971 mainwin_show_add_url_window(void) | |
1972 { | |
1973 static GtkWidget *url_window = NULL; | |
1974 | |
1975 if (!url_window) { | |
1976 url_window = | |
86 | 1977 util_add_url_dialog_new(_("Enter location to play:"), |
1978 G_CALLBACK(on_add_url_ok_clicked), | |
0 | 1979 G_CALLBACK(on_add_url_add_clicked)); |
1980 gtk_window_set_transient_for(GTK_WINDOW(url_window), | |
1981 GTK_WINDOW(mainwin)); | |
1982 g_signal_connect(url_window, "destroy", | |
1983 G_CALLBACK(gtk_widget_destroyed), | |
1984 &url_window); | |
1985 } | |
1986 | |
1987 gtk_window_present(GTK_WINDOW(url_window)); | |
1988 } | |
1989 | |
1990 static void | |
1991 check_set(GtkItemFactory * factory, | |
1992 const gchar * path, | |
1993 gboolean active) | |
1994 { | |
1995 GtkWidget *item = gtk_item_factory_get_widget(factory, path); | |
1996 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), active); | |
1997 } | |
1998 | |
1999 void | |
2000 mainwin_eject_pushed(void) | |
2001 { | |
2002 util_run_filebrowser(PLAY_BUTTON); | |
2003 } | |
2004 | |
2005 void | |
433
041bc95827be
[svn] Convert prev/next buttons to tristate, via create_pbutton_ex().
nenolod
parents:
383
diff
changeset
|
2006 mainwin_rev_pushed(void) |
041bc95827be
[svn] Convert prev/next buttons to tristate, via create_pbutton_ex().
nenolod
parents:
383
diff
changeset
|
2007 { |
434
7ffecac12107
[svn] Logic stuff relating to tristate-seek. Now I just need to work it into the event loop.
nenolod
parents:
433
diff
changeset
|
2008 g_get_current_time(&cb_time); |
7ffecac12107
[svn] Logic stuff relating to tristate-seek. Now I just need to work it into the event loop.
nenolod
parents:
433
diff
changeset
|
2009 |
467
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
2010 seek_initial_pos = hslider_get_position(mainwin_position); |
434
7ffecac12107
[svn] Logic stuff relating to tristate-seek. Now I just need to work it into the event loop.
nenolod
parents:
433
diff
changeset
|
2011 seek_state = MAINWIN_SEEK_REV; |
433
041bc95827be
[svn] Convert prev/next buttons to tristate, via create_pbutton_ex().
nenolod
parents:
383
diff
changeset
|
2012 } |
041bc95827be
[svn] Convert prev/next buttons to tristate, via create_pbutton_ex().
nenolod
parents:
383
diff
changeset
|
2013 |
041bc95827be
[svn] Convert prev/next buttons to tristate, via create_pbutton_ex().
nenolod
parents:
383
diff
changeset
|
2014 void |
041bc95827be
[svn] Convert prev/next buttons to tristate, via create_pbutton_ex().
nenolod
parents:
383
diff
changeset
|
2015 mainwin_rev_release(void) |
041bc95827be
[svn] Convert prev/next buttons to tristate, via create_pbutton_ex().
nenolod
parents:
383
diff
changeset
|
2016 { |
434
7ffecac12107
[svn] Logic stuff relating to tristate-seek. Now I just need to work it into the event loop.
nenolod
parents:
433
diff
changeset
|
2017 GTimeVal now_time; |
438
d6051a60aae2
[svn] Smarter algorithm for detecting differentials between button presses, now takes seconds into account.
nenolod
parents:
437
diff
changeset
|
2018 GTimeVal delta_time; |
467
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
2019 gulong now_dur; |
434
7ffecac12107
[svn] Logic stuff relating to tristate-seek. Now I just need to work it into the event loop.
nenolod
parents:
433
diff
changeset
|
2020 |
7ffecac12107
[svn] Logic stuff relating to tristate-seek. Now I just need to work it into the event loop.
nenolod
parents:
433
diff
changeset
|
2021 g_get_current_time(&now_time); |
7ffecac12107
[svn] Logic stuff relating to tristate-seek. Now I just need to work it into the event loop.
nenolod
parents:
433
diff
changeset
|
2022 |
438
d6051a60aae2
[svn] Smarter algorithm for detecting differentials between button presses, now takes seconds into account.
nenolod
parents:
437
diff
changeset
|
2023 delta_time.tv_usec = now_time.tv_usec - cb_time.tv_usec; |
d6051a60aae2
[svn] Smarter algorithm for detecting differentials between button presses, now takes seconds into account.
nenolod
parents:
437
diff
changeset
|
2024 delta_time.tv_sec = now_time.tv_sec - cb_time.tv_sec; |
d6051a60aae2
[svn] Smarter algorithm for detecting differentials between button presses, now takes seconds into account.
nenolod
parents:
437
diff
changeset
|
2025 |
468 | 2026 now_dur = labs((delta_time.tv_sec * 1000) + (glong) (delta_time.tv_usec / 1000)); |
467
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
2027 |
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
2028 if ( now_dur <= 150 ) |
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
2029 { |
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
2030 /* interpret as 'skip to previous song' */ |
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
2031 playlist_prev(); |
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
2032 } |
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
2033 else |
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
2034 { |
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
2035 /* interpret as 'seek' */ |
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
2036 mainwin_position_release_cb( hslider_get_position(mainwin_position) ); |
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
2037 } |
434
7ffecac12107
[svn] Logic stuff relating to tristate-seek. Now I just need to work it into the event loop.
nenolod
parents:
433
diff
changeset
|
2038 |
7ffecac12107
[svn] Logic stuff relating to tristate-seek. Now I just need to work it into the event loop.
nenolod
parents:
433
diff
changeset
|
2039 seek_state = MAINWIN_SEEK_NIL; |
433
041bc95827be
[svn] Convert prev/next buttons to tristate, via create_pbutton_ex().
nenolod
parents:
383
diff
changeset
|
2040 } |
041bc95827be
[svn] Convert prev/next buttons to tristate, via create_pbutton_ex().
nenolod
parents:
383
diff
changeset
|
2041 |
041bc95827be
[svn] Convert prev/next buttons to tristate, via create_pbutton_ex().
nenolod
parents:
383
diff
changeset
|
2042 void |
041bc95827be
[svn] Convert prev/next buttons to tristate, via create_pbutton_ex().
nenolod
parents:
383
diff
changeset
|
2043 mainwin_fwd_pushed(void) |
041bc95827be
[svn] Convert prev/next buttons to tristate, via create_pbutton_ex().
nenolod
parents:
383
diff
changeset
|
2044 { |
434
7ffecac12107
[svn] Logic stuff relating to tristate-seek. Now I just need to work it into the event loop.
nenolod
parents:
433
diff
changeset
|
2045 g_get_current_time(&cb_time); |
7ffecac12107
[svn] Logic stuff relating to tristate-seek. Now I just need to work it into the event loop.
nenolod
parents:
433
diff
changeset
|
2046 |
467
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
2047 seek_initial_pos = hslider_get_position(mainwin_position); |
434
7ffecac12107
[svn] Logic stuff relating to tristate-seek. Now I just need to work it into the event loop.
nenolod
parents:
433
diff
changeset
|
2048 seek_state = MAINWIN_SEEK_FWD; |
433
041bc95827be
[svn] Convert prev/next buttons to tristate, via create_pbutton_ex().
nenolod
parents:
383
diff
changeset
|
2049 } |
041bc95827be
[svn] Convert prev/next buttons to tristate, via create_pbutton_ex().
nenolod
parents:
383
diff
changeset
|
2050 |
041bc95827be
[svn] Convert prev/next buttons to tristate, via create_pbutton_ex().
nenolod
parents:
383
diff
changeset
|
2051 void |
041bc95827be
[svn] Convert prev/next buttons to tristate, via create_pbutton_ex().
nenolod
parents:
383
diff
changeset
|
2052 mainwin_fwd_release(void) |
041bc95827be
[svn] Convert prev/next buttons to tristate, via create_pbutton_ex().
nenolod
parents:
383
diff
changeset
|
2053 { |
434
7ffecac12107
[svn] Logic stuff relating to tristate-seek. Now I just need to work it into the event loop.
nenolod
parents:
433
diff
changeset
|
2054 GTimeVal now_time; |
438
d6051a60aae2
[svn] Smarter algorithm for detecting differentials between button presses, now takes seconds into account.
nenolod
parents:
437
diff
changeset
|
2055 GTimeVal delta_time; |
467
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
2056 gulong now_dur; |
434
7ffecac12107
[svn] Logic stuff relating to tristate-seek. Now I just need to work it into the event loop.
nenolod
parents:
433
diff
changeset
|
2057 |
7ffecac12107
[svn] Logic stuff relating to tristate-seek. Now I just need to work it into the event loop.
nenolod
parents:
433
diff
changeset
|
2058 g_get_current_time(&now_time); |
7ffecac12107
[svn] Logic stuff relating to tristate-seek. Now I just need to work it into the event loop.
nenolod
parents:
433
diff
changeset
|
2059 |
438
d6051a60aae2
[svn] Smarter algorithm for detecting differentials between button presses, now takes seconds into account.
nenolod
parents:
437
diff
changeset
|
2060 delta_time.tv_usec = now_time.tv_usec - cb_time.tv_usec; |
d6051a60aae2
[svn] Smarter algorithm for detecting differentials between button presses, now takes seconds into account.
nenolod
parents:
437
diff
changeset
|
2061 delta_time.tv_sec = now_time.tv_sec - cb_time.tv_sec; |
d6051a60aae2
[svn] Smarter algorithm for detecting differentials between button presses, now takes seconds into account.
nenolod
parents:
437
diff
changeset
|
2062 |
468 | 2063 now_dur = labs((delta_time.tv_sec * 1000) + (glong) (delta_time.tv_usec / 1000)); |
467
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
2064 |
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
2065 if ( now_dur <= 150 ) |
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
2066 { |
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
2067 /* interpret as 'skip to previous song' */ |
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
2068 playlist_next(); |
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
2069 } |
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
2070 else |
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
2071 { |
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
2072 /* interpret as 'seek' */ |
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
2073 mainwin_position_release_cb( hslider_get_position(mainwin_position) ); |
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
2074 } |
434
7ffecac12107
[svn] Logic stuff relating to tristate-seek. Now I just need to work it into the event loop.
nenolod
parents:
433
diff
changeset
|
2075 |
7ffecac12107
[svn] Logic stuff relating to tristate-seek. Now I just need to work it into the event loop.
nenolod
parents:
433
diff
changeset
|
2076 seek_state = MAINWIN_SEEK_NIL; |
433
041bc95827be
[svn] Convert prev/next buttons to tristate, via create_pbutton_ex().
nenolod
parents:
383
diff
changeset
|
2077 } |
041bc95827be
[svn] Convert prev/next buttons to tristate, via create_pbutton_ex().
nenolod
parents:
383
diff
changeset
|
2078 |
041bc95827be
[svn] Convert prev/next buttons to tristate, via create_pbutton_ex().
nenolod
parents:
383
diff
changeset
|
2079 void |
0 | 2080 mainwin_play_pushed(void) |
2081 { | |
2082 if (bmp_playback_get_paused()) { | |
2083 bmp_playback_pause(); | |
2084 return; | |
2085 } | |
2086 | |
2087 if (playlist_get_length()) | |
2088 bmp_playback_initiate(); | |
2089 else | |
2090 mainwin_eject_pushed(); | |
2091 } | |
2092 | |
2093 void | |
2094 mainwin_stop_pushed(void) | |
2095 { | |
890
ed26947bbf57
[svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents:
889
diff
changeset
|
2096 ip_data.stop = TRUE; |
0 | 2097 mainwin_clear_song_info(); |
2098 bmp_playback_stop(); | |
890
ed26947bbf57
[svn] Gapless support. This comes with a few caveats, that I will mention here:
nenolod
parents:
889
diff
changeset
|
2099 ip_data.stop = FALSE; |
0 | 2100 } |
2101 | |
2102 void | |
2103 mainwin_shuffle_pushed(gboolean toggled) | |
2104 { | |
2105 check_set(mainwin_play_menu, "/Shuffle", toggled); | |
2106 } | |
2107 | |
2108 void | |
2109 mainwin_repeat_pushed(gboolean toggled) | |
2110 { | |
2111 check_set(mainwin_play_menu, "/Repeat", toggled); | |
2112 } | |
2113 | |
2114 void | |
2115 mainwin_pl_pushed(gboolean toggled) | |
2116 { | |
2117 if (toggled) | |
2118 playlistwin_show(); | |
2119 else | |
2120 playlistwin_hide(); | |
2121 } | |
2122 | |
2123 gint | |
2124 mainwin_spos_frame_cb(gint pos) | |
2125 { | |
2126 if (mainwin_sposition) { | |
2127 if (pos < 6) | |
2128 mainwin_sposition->hs_knob_nx = mainwin_sposition->hs_knob_px = | |
2129 17; | |
2130 else if (pos < 9) | |
2131 mainwin_sposition->hs_knob_nx = mainwin_sposition->hs_knob_px = | |
2132 20; | |
2133 else | |
2134 mainwin_sposition->hs_knob_nx = mainwin_sposition->hs_knob_px = | |
2135 23; | |
2136 } | |
2137 return 1; | |
2138 } | |
2139 | |
2140 void | |
2141 mainwin_spos_motion_cb(gint pos) | |
2142 { | |
2143 gint time; | |
2144 gchar *time_msg; | |
2145 | |
2146 pos--; | |
2147 | |
2148 time = ((playlist_get_current_length() / 1000) * pos) / 12; | |
2149 | |
2150 if (cfg.timer_mode == TIMER_REMAINING) { | |
2151 time = (playlist_get_current_length() / 1000) - time; | |
2152 time_msg = g_strdup_printf("-%2.2d", time / 60); | |
2153 textbox_set_text(mainwin_stime_min, time_msg); | |
2154 g_free(time_msg); | |
2155 } | |
2156 else { | |
2157 time_msg = g_strdup_printf(" %2.2d", time / 60); | |
2158 textbox_set_text(mainwin_stime_min, time_msg); | |
2159 g_free(time_msg); | |
2160 } | |
2161 | |
2162 time_msg = g_strdup_printf("%2.2d", time % 60); | |
2163 textbox_set_text(mainwin_stime_sec, time_msg); | |
2164 g_free(time_msg); | |
2165 } | |
2166 | |
2167 void | |
2168 mainwin_spos_release_cb(gint pos) | |
2169 { | |
2170 bmp_playback_seek(((playlist_get_current_length() / 1000) * | |
2171 (pos - 1)) / 12); | |
2172 } | |
2173 | |
2174 void | |
2175 mainwin_position_motion_cb(gint pos) | |
2176 { | |
2177 gint length, time; | |
2178 gchar *seek_msg; | |
2179 | |
2180 length = playlist_get_current_length() / 1000; | |
2181 time = (length * pos) / 219; | |
2182 seek_msg = g_strdup_printf(_("SEEK TO: %d:%-2.2d/%d:%-2.2d (%d%%)"), | |
2183 time / 60, time % 60, | |
2184 length / 60, length % 60, | |
2185 (length != 0) ? (time * 100) / length : 0); | |
2186 mainwin_lock_info_text(seek_msg); | |
2187 g_free(seek_msg); | |
2188 } | |
2189 | |
2190 void | |
2191 mainwin_position_release_cb(gint pos) | |
2192 { | |
2193 gint length, time; | |
2194 | |
2195 length = playlist_get_current_length() / 1000; | |
2196 time = (length * pos) / 219; | |
2197 bmp_playback_seek(time); | |
2198 mainwin_release_info_text(); | |
2199 } | |
2200 | |
2201 gint | |
2202 mainwin_volume_frame_cb(gint pos) | |
2203 { | |
2204 return (gint) rint((pos / 52.0) * 28); | |
2205 } | |
2206 | |
2207 void | |
2208 mainwin_adjust_volume_motion(gint v) | |
2209 { | |
2210 gchar *volume_msg; | |
2211 | |
2212 setting_volume = TRUE; | |
2213 | |
2214 volume_msg = g_strdup_printf(_("VOLUME: %d%%"), v); | |
2215 mainwin_lock_info_text(volume_msg); | |
2216 g_free(volume_msg); | |
2217 | |
2218 if (balance < 0) | |
2219 input_set_volume(v, (v * (100 - abs(balance))) / 100); | |
2220 else if (balance > 0) | |
2221 input_set_volume((v * (100 - abs(balance))) / 100, v); | |
2222 else | |
2223 input_set_volume(v, v); | |
2224 } | |
2225 | |
2226 void | |
2227 mainwin_adjust_volume_release(void) | |
2228 { | |
2229 mainwin_release_info_text(); | |
2230 setting_volume = FALSE; | |
2231 read_volume(VOLUME_ADJUSTED); | |
2232 } | |
2233 | |
2234 void | |
2235 mainwin_adjust_balance_motion(gint b) | |
2236 { | |
2237 gchar *balance_msg; | |
2238 gint v, pvl, pvr; | |
2239 | |
2240 setting_volume = TRUE; | |
2241 balance = b; | |
2242 input_get_volume(&pvl, &pvr); | |
2243 v = MAX(pvl, pvr); | |
2244 if (b < 0) { | |
2245 balance_msg = g_strdup_printf(_("BALANCE: %d%% LEFT"), -b); | |
2246 input_set_volume(v, (gint) rint(((100 + b) / 100.0) * v)); | |
2247 } | |
2248 else if (b == 0) { | |
2249 balance_msg = g_strdup_printf(_("BALANCE: CENTER")); | |
2250 input_set_volume(v, v); | |
2251 } | |
2252 else { /* b > 0 */ | |
2253 balance_msg = g_strdup_printf(_("BALANCE: %d%% RIGHT"), b); | |
2254 input_set_volume((gint) rint(((100 - b) / 100.0) * v), v); | |
2255 } | |
2256 mainwin_lock_info_text(balance_msg); | |
2257 g_free(balance_msg); | |
2258 } | |
2259 | |
2260 void | |
2261 mainwin_adjust_balance_release(void) | |
2262 { | |
2263 mainwin_release_info_text(); | |
2264 setting_volume = FALSE; | |
2265 read_volume(VOLUME_ADJUSTED); | |
2266 } | |
2267 | |
2268 void | |
2269 mainwin_set_volume_slider(gint percent) | |
2270 { | |
2271 hslider_set_position(mainwin_volume, (gint) rint((percent * 51) / 100.0)); | |
2272 } | |
2273 | |
2274 void | |
2275 mainwin_set_balance_slider(gint percent) | |
2276 { | |
2277 hslider_set_position(mainwin_balance, | |
2278 (gint) rint(((percent * 12) / 100.0) + 12)); | |
2279 } | |
2280 | |
2281 void | |
2282 mainwin_volume_motion_cb(gint pos) | |
2283 { | |
2284 gint vol = (pos * 100) / 51; | |
2285 mainwin_adjust_volume_motion(vol); | |
2286 equalizerwin_set_volume_slider(vol); | |
2287 } | |
2288 | |
2289 void | |
2290 mainwin_volume_release_cb(gint pos) | |
2291 { | |
2292 mainwin_adjust_volume_release(); | |
2293 } | |
2294 | |
2295 gint | |
2296 mainwin_balance_frame_cb(gint pos) | |
2297 { | |
2298 return ((abs(pos - 12) * 28) / 13); | |
2299 } | |
2300 | |
2301 void | |
2302 mainwin_balance_motion_cb(gint pos) | |
2303 { | |
2304 gint bal = ((pos - 12) * 100) / 12; | |
2305 mainwin_adjust_balance_motion(bal); | |
2306 equalizerwin_set_balance_slider(bal); | |
2307 } | |
2308 | |
2309 void | |
2310 mainwin_balance_release_cb(gint pos) | |
2311 { | |
2312 mainwin_adjust_volume_release(); | |
2313 } | |
2314 | |
2315 void | |
2316 mainwin_set_volume_diff(gint diff) | |
2317 { | |
2318 gint vl, vr, vol; | |
2319 | |
2320 input_get_volume(&vl, &vr); | |
2321 vol = MAX(vl, vr); | |
2322 vol = CLAMP(vol + diff, 0, 100); | |
2323 | |
2324 mainwin_adjust_volume_motion(vol); | |
2325 setting_volume = FALSE; | |
2326 mainwin_set_volume_slider(vol); | |
2327 equalizerwin_set_volume_slider(vol); | |
2328 read_volume(VOLUME_SET); | |
2329 } | |
2330 | |
2331 void | |
2332 mainwin_set_balance_diff(gint diff) | |
2333 { | |
2334 gint b; | |
2335 b = CLAMP(balance + diff, -100, 100); | |
2336 mainwin_adjust_balance_motion(b); | |
2337 setting_volume = FALSE; | |
2338 mainwin_set_balance_slider(b); | |
2339 equalizerwin_set_balance_slider(b); | |
2340 read_volume(VOLUME_SET); | |
2341 } | |
2342 | |
2343 void | |
2344 mainwin_show(gboolean show) | |
2345 { | |
2346 if (show) | |
2347 mainwin_real_show(); | |
2348 else | |
2349 mainwin_real_hide(); | |
2350 } | |
2351 | |
2352 void | |
2353 mainwin_real_show(void) | |
2354 { | |
2355 cfg.player_visible = TRUE; | |
2356 | |
2357 if (cfg.player_shaded) | |
2358 vis_clear_data(active_vis); | |
2359 | |
2360 mainwin_vis_set_active_vis(MAINWIN_VIS_ACTIVE_MAINWIN); | |
2361 mainwin_set_shape_mask(); | |
2362 | |
2363 if (cfg.show_wm_decorations) { | |
2364 if (!pposition_broken && cfg.player_x != -1 | |
2365 && cfg.save_window_position) | |
2366 gtk_window_move(GTK_WINDOW(mainwin), cfg.player_x, cfg.player_y); | |
2367 | |
2368 gtk_widget_show(mainwin); | |
2369 | |
2370 if (pposition_broken && cfg.player_x != -1 | |
2371 && cfg.save_window_position) | |
2372 gtk_window_move(GTK_WINDOW(mainwin), cfg.player_x, cfg.player_y); | |
2373 | |
2374 return; | |
2375 } | |
2376 | |
2377 gtk_widget_show_all(mainwin); | |
2378 | |
2379 if (!nullmask) | |
2380 return; | |
2381 | |
2382 g_object_unref(nullmask); | |
2383 nullmask = NULL; | |
2384 | |
2385 gdk_window_set_hints(mainwin->window, 0, 0, | |
2386 PLAYER_WIDTH, PLAYER_HEIGHT, | |
2387 PLAYER_WIDTH, PLAYER_HEIGHT, | |
2388 GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE); | |
2389 gtk_window_resize(GTK_WINDOW(mainwin), PLAYER_WIDTH, PLAYER_HEIGHT); | |
2390 | |
2391 if (cfg.player_x != -1 && cfg.player_y != -1) | |
2392 gtk_window_move(GTK_WINDOW(mainwin), cfg.player_x, cfg.player_y); | |
2393 | |
2394 draw_main_window(TRUE); | |
2395 | |
2396 gtk_window_present(GTK_WINDOW(mainwin)); | |
2397 } | |
2398 | |
2399 void | |
2400 mainwin_real_hide(void) | |
2401 { | |
2402 GdkGC *gc; | |
2403 GdkColor pattern; | |
2404 | |
561
2b9dc862967b
[svn] Remove the elusive playlistwin visualiser that we do not use.
nenolod
parents:
549
diff
changeset
|
2405 if (cfg.player_shaded) |
0 | 2406 svis_clear_data(mainwin_svis); |
2407 | |
2408 if (!cfg.show_wm_decorations) { | |
2409 nullmask = gdk_pixmap_new(mainwin->window, 20, 20, 1); | |
2410 gc = gdk_gc_new(nullmask); | |
2411 pattern.pixel = 0; | |
2412 gdk_gc_set_foreground(gc, &pattern); | |
2413 gdk_draw_rectangle(nullmask, gc, TRUE, 0, 0, 20, 20); | |
2414 gdk_gc_destroy(gc); | |
2415 gtk_widget_shape_combine_mask(mainwin, nullmask, 0, 0); | |
2416 | |
2417 gdk_window_set_hints(mainwin->window, 0, 0, 0, 0, 0, 0, | |
2418 GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE); | |
2419 gdk_window_resize(mainwin->window, 0, 0); | |
2420 } | |
2421 | |
2422 gtk_widget_hide(mainwin); | |
2423 | |
2424 mainwin_vis_set_active_vis(MAINWIN_VIS_ACTIVE_PLAYLISTWIN); | |
2425 cfg.player_visible = FALSE; | |
2426 } | |
2427 | |
2428 static void | |
2429 mainwin_songname_menu_callback(gpointer data, | |
2430 guint action, | |
2431 GtkWidget * item) | |
2432 { | |
2433 GtkCheckMenuItem *check; | |
2434 | |
2435 switch (action) { | |
2436 case MAINWIN_SONGNAME_FILEINFO: | |
2437 playlist_fileinfo_current(); | |
2438 break; | |
2439 case MAINWIN_SONGNAME_JTF: | |
2440 mainwin_jump_to_file(); | |
2441 break; | |
2442 case MAINWIN_SONGNAME_JTT: | |
2443 mainwin_jump_to_time(); | |
2444 break; | |
2445 case MAINWIN_SONGNAME_SCROLL: | |
2446 check = GTK_CHECK_MENU_ITEM(item); | |
2447 mainwin_set_title_scroll(gtk_check_menu_item_get_active(check)); | |
2448 break; | |
898 | 2449 case MAINWIN_SONGNAME_STOPAFTERSONG: |
2450 check = GTK_CHECK_MENU_ITEM(item); | |
2451 cfg.stopaftersong = gtk_check_menu_item_get_active(check); | |
2452 check_set(mainwin_songname_menu, "/Stop After Current Song", cfg.stopaftersong); | |
2453 check_set(mainwin_play_menu, "/Stop After Current Song", cfg.stopaftersong); | |
2454 break; | |
0 | 2455 } |
2456 } | |
2457 | |
898 | 2458 void |
2459 mainwin_set_stopaftersong(gboolean stop) | |
2460 { | |
2461 cfg.stopaftersong = stop; | |
2462 check_set(mainwin_songname_menu, "/Stop After Current Song", cfg.stopaftersong); | |
2463 } | |
2464 | |
0 | 2465 static void |
2466 mainwin_play_menu_callback(gpointer data, | |
2467 guint action, | |
2468 GtkWidget * item) | |
2469 { | |
2470 GtkCheckMenuItem *check; | |
2471 | |
2472 switch (action) { | |
2473 case MAINWIN_OPT_SHUFFLE: | |
2474 check = GTK_CHECK_MENU_ITEM(item); | |
2475 cfg.shuffle = gtk_check_menu_item_get_active(check); | |
2476 playlist_set_shuffle(cfg.shuffle); | |
2477 tbutton_set_toggled(mainwin_shuffle, cfg.shuffle); | |
2478 break; | |
2479 case MAINWIN_OPT_REPEAT: | |
2480 check = GTK_CHECK_MENU_ITEM(item); | |
2481 cfg.repeat = gtk_check_menu_item_get_active(check); | |
2482 tbutton_set_toggled(mainwin_repeat, cfg.repeat); | |
2483 break; | |
2484 case MAINWIN_OPT_NPA: | |
2485 check = GTK_CHECK_MENU_ITEM(item); | |
2486 cfg.no_playlist_advance = gtk_check_menu_item_get_active(check); | |
2487 break; | |
2488 } | |
2489 } | |
2490 | |
2491 | |
2492 static void | |
2493 mainwin_view_menu_callback(gpointer data, | |
2494 guint action, | |
2495 GtkWidget * item) | |
2496 { | |
2497 switch (action) { | |
2498 case MAINWIN_OPT_TELAPSED: | |
2499 set_timer_mode_menu_cb(TIMER_ELAPSED); | |
2500 break; | |
2501 case MAINWIN_OPT_TREMAINING: | |
2502 set_timer_mode_menu_cb(TIMER_REMAINING); | |
2503 break; | |
2504 case MAINWIN_OPT_ALWAYS: | |
2505 mainwin_menurow->mr_always_selected = GTK_CHECK_MENU_ITEM(item)->active; | |
2506 cfg.always_on_top = mainwin_menurow->mr_always_selected; | |
2507 widget_draw(WIDGET(mainwin_menurow)); | |
486 | 2508 |
2509 if (starting_up == FALSE) | |
2510 hint_set_always(cfg.always_on_top); | |
2511 | |
0 | 2512 break; |
2513 case MAINWIN_OPT_STICKY: | |
2514 cfg.sticky = GTK_CHECK_MENU_ITEM(item)->active; | |
2515 hint_set_sticky(cfg.sticky); | |
2516 break; | |
2517 case MAINWIN_OPT_WS: | |
2518 mainwin_set_shade_menu_cb(GTK_CHECK_MENU_ITEM(item)->active); | |
2519 break; | |
2520 case MAINWIN_OPT_PWS: | |
2521 playlistwin_set_shade(GTK_CHECK_MENU_ITEM(item)->active); | |
2522 break; | |
2523 case MAINWIN_OPT_EQWS: | |
2524 equalizerwin_set_shade_menu_cb(GTK_CHECK_MENU_ITEM(item)->active); | |
2525 break; | |
2526 } | |
2527 } | |
2528 | |
2529 void | |
2530 mainwin_vis_menu_callback(gpointer data, | |
2531 guint action, | |
2532 GtkWidget * item) | |
2533 { | |
2534 switch (action) { | |
2535 case MAINWIN_VIS_ANALYZER: | |
2536 case MAINWIN_VIS_SCOPE: | |
2537 case MAINWIN_VIS_OFF: | |
2538 mainwin_vis_set_type_menu_cb(action - MAINWIN_VIS_ANALYZER); | |
2539 break; | |
2540 case MAINWIN_VIS_ANALYZER_NORMAL: | |
2541 case MAINWIN_VIS_ANALYZER_FIRE: | |
2542 case MAINWIN_VIS_ANALYZER_VLINES: | |
2543 mainwin_vis_set_analyzer_mode(action - MAINWIN_VIS_ANALYZER_NORMAL); | |
2544 break; | |
2545 case MAINWIN_VIS_ANALYZER_LINES: | |
2546 case MAINWIN_VIS_ANALYZER_BARS: | |
2547 mainwin_vis_set_analyzer_type(action - MAINWIN_VIS_ANALYZER_LINES); | |
2548 break; | |
2549 case MAINWIN_VIS_ANALYZER_PEAKS: | |
2550 cfg.analyzer_peaks = GTK_CHECK_MENU_ITEM(item)->active; | |
2551 break; | |
2552 case MAINWIN_VIS_SCOPE_DOT: | |
2553 case MAINWIN_VIS_SCOPE_LINE: | |
2554 case MAINWIN_VIS_SCOPE_SOLID: | |
2555 cfg.scope_mode = action - MAINWIN_VIS_SCOPE_DOT; | |
2556 break; | |
2557 case MAINWIN_VIS_VU_NORMAL: | |
2558 case MAINWIN_VIS_VU_SMOOTH: | |
2559 cfg.vu_mode = action - MAINWIN_VIS_VU_NORMAL; | |
2560 break; | |
2561 case MAINWIN_VIS_REFRESH_FULL: | |
2562 case MAINWIN_VIS_REFRESH_HALF: | |
2563 case MAINWIN_VIS_REFRESH_QUARTER: | |
2564 case MAINWIN_VIS_REFRESH_EIGHTH: | |
2565 mainwin_vis_set_refresh(action - MAINWIN_VIS_REFRESH_FULL); | |
2566 break; | |
2567 case MAINWIN_VIS_AFALLOFF_SLOWEST: | |
2568 case MAINWIN_VIS_AFALLOFF_SLOW: | |
2569 case MAINWIN_VIS_AFALLOFF_MEDIUM: | |
2570 case MAINWIN_VIS_AFALLOFF_FAST: | |
2571 case MAINWIN_VIS_AFALLOFF_FASTEST: | |
2572 mainwin_vis_set_afalloff(action - MAINWIN_VIS_AFALLOFF_SLOWEST); | |
2573 break; | |
2574 case MAINWIN_VIS_PFALLOFF_SLOWEST: | |
2575 case MAINWIN_VIS_PFALLOFF_SLOW: | |
2576 case MAINWIN_VIS_PFALLOFF_MEDIUM: | |
2577 case MAINWIN_VIS_PFALLOFF_FAST: | |
2578 case MAINWIN_VIS_PFALLOFF_FASTEST: | |
2579 mainwin_vis_set_pfalloff(action - MAINWIN_VIS_PFALLOFF_SLOWEST); | |
2580 break; | |
2581 } | |
2582 } | |
2583 | |
2584 void | |
2585 mainwin_general_menu_callback(gpointer data, | |
2586 guint action, | |
2587 GtkWidget * item) | |
2588 { | |
2589 switch (action) { | |
2590 case MAINWIN_GENERAL_PREFS: | |
2591 show_prefs_window(); | |
2592 break; | |
2593 case MAINWIN_GENERAL_ABOUT: | |
2594 show_about_window(); | |
2595 break; | |
2596 case MAINWIN_GENERAL_PLAYFILE: | |
2597 util_run_filebrowser(NO_PLAY_BUTTON); | |
2598 break; | |
2599 case MAINWIN_GENERAL_PLAYCD: | |
2600 play_medium(); | |
2601 break; | |
2602 case MAINWIN_GENERAL_ADDCD: | |
2603 add_medium(); | |
2604 break; | |
2605 case MAINWIN_GENERAL_PLAYLOCATION: | |
2606 mainwin_show_add_url_window(); | |
2607 break; | |
2608 case MAINWIN_GENERAL_FILEINFO: | |
2609 playlist_fileinfo_current(); | |
2610 break; | |
2611 case MAINWIN_GENERAL_FOCUSPLWIN: | |
2612 gtk_window_present(GTK_WINDOW(playlistwin)); | |
2613 break; | |
2614 case MAINWIN_GENERAL_SHOWPLWIN: | |
2615 if (GTK_CHECK_MENU_ITEM(item)->active) | |
2616 playlistwin_show(); | |
2617 else | |
2618 playlistwin_hide(); | |
2619 break; | |
2620 case MAINWIN_GENERAL_SHOWEQWIN: | |
2621 if (GTK_CHECK_MENU_ITEM(item)->active) | |
2622 equalizerwin_real_show(); | |
2623 else | |
2624 equalizerwin_real_hide(); | |
2625 break; | |
2626 case MAINWIN_GENERAL_PREV: | |
2627 playlist_prev(); | |
2628 break; | |
2629 case MAINWIN_GENERAL_PLAY: | |
2630 mainwin_play_pushed(); | |
2631 break; | |
2632 case MAINWIN_GENERAL_PAUSE: | |
2633 bmp_playback_pause(); | |
2634 break; | |
2635 case MAINWIN_GENERAL_STOP: | |
2636 mainwin_stop_pushed(); | |
2637 break; | |
2638 case MAINWIN_GENERAL_NEXT: | |
2639 playlist_next(); | |
2640 break; | |
2641 case MAINWIN_GENERAL_BACK5SEC: | |
2642 if (bmp_playback_get_playing() | |
2643 && playlist_get_current_length() != -1) | |
2644 bmp_playback_seek_relative(-5); | |
2645 break; | |
2646 case MAINWIN_GENERAL_FWD5SEC: | |
2647 if (bmp_playback_get_playing() | |
2648 && playlist_get_current_length() != -1) | |
2649 bmp_playback_seek_relative(5); | |
2650 break; | |
2651 case MAINWIN_GENERAL_START: | |
2652 playlist_set_position(0); | |
2653 break; | |
2654 case MAINWIN_GENERAL_JTT: | |
2655 mainwin_jump_to_time(); | |
2656 break; | |
2657 case MAINWIN_GENERAL_JTF: | |
2658 mainwin_jump_to_file(); | |
2659 break; | |
2660 case MAINWIN_GENERAL_EXIT: | |
2661 mainwin_quit_cb(); | |
2662 break; | |
2663 } | |
2664 } | |
2665 | |
2666 static void | |
2667 mainwin_mr_change(MenuRowItem i) | |
2668 { | |
2669 switch (i) { | |
2670 case MENUROW_NONE: | |
2671 mainwin_set_info_text(); | |
2672 break; | |
2673 case MENUROW_OPTIONS: | |
2674 mainwin_lock_info_text(_("OPTIONS MENU")); | |
2675 break; | |
2676 case MENUROW_ALWAYS: | |
485
59739d266dba
[svn] Convert Xlib stuff to GDK/GTK. This isn't entirely set in stone yet --
nenolod
parents:
484
diff
changeset
|
2677 if (mainwin_menurow->mr_doublesize_selected) |
0 | 2678 mainwin_lock_info_text(_("DISABLE ALWAYS ON TOP")); |
2679 else | |
2680 mainwin_lock_info_text(_("ENABLE ALWAYS ON TOP")); | |
2681 break; | |
2682 case MENUROW_FILEINFOBOX: | |
2683 mainwin_lock_info_text(_("FILE INFO BOX")); | |
2684 break; | |
2685 case MENUROW_DOUBLESIZE: | |
2686 mainwin_lock_info_text(_("** DOUBLESIZE HAS BEEN REMOVED **")); | |
2687 break; | |
2688 case MENUROW_VISUALIZATION: | |
2689 mainwin_lock_info_text(_("VISUALIZATION MENU")); | |
2690 break; | |
2691 } | |
2692 } | |
2693 | |
2694 static void | |
2695 mainwin_mr_release(MenuRowItem i) | |
2696 { | |
2697 GdkModifierType modmask; | |
2698 GtkWidget *widget; | |
2699 gint x, y; | |
2700 | |
2701 switch (i) { | |
2702 case MENUROW_OPTIONS: | |
2703 gdk_window_get_pointer(NULL, &x, &y, &modmask); | |
2704 util_item_factory_popup(mainwin_view_menu, x, y, 1, | |
2705 GDK_CURRENT_TIME); | |
2706 break; | |
2707 case MENUROW_ALWAYS: | |
2708 widget = | |
2709 gtk_item_factory_get_widget(mainwin_view_menu, | |
2710 "/Always On Top"); | |
2711 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(widget), | |
2712 mainwin_menurow->mr_always_selected); | |
2713 break; | |
2714 case MENUROW_FILEINFOBOX: | |
2715 playlist_fileinfo_current(); | |
2716 break; | |
2717 case MENUROW_DOUBLESIZE: | |
2718 /* double size removed, do nothing */ | |
2719 break; | |
2720 case MENUROW_VISUALIZATION: | |
2721 gdk_window_get_pointer(NULL, &x, &y, &modmask); | |
2722 util_item_factory_popup(mainwin_vis_menu, x, y, 1, GDK_CURRENT_TIME); | |
2723 break; | |
2724 case MENUROW_NONE: | |
2725 break; | |
2726 } | |
2727 mainwin_release_info_text(); | |
2728 } | |
2729 | |
2730 static void | |
2731 run_no_audiocd_dialog(void) | |
2732 { | |
2733 const gchar *markup = | |
2734 N_("<b><big>No playable CD found.</big></b>\n\n" | |
2735 "No CD inserted, or inserted CD is not an audio CD.\n"); | |
2736 | |
2737 GtkWidget *dialog = | |
2738 gtk_message_dialog_new_with_markup(GTK_WINDOW(mainwin), | |
2739 GTK_DIALOG_DESTROY_WITH_PARENT, | |
2740 GTK_MESSAGE_ERROR, | |
2741 GTK_BUTTONS_OK, | |
2742 _(markup)); | |
2743 gtk_dialog_run(GTK_DIALOG(dialog)); | |
2744 gtk_widget_destroy(dialog); | |
2745 } | |
2746 | |
2747 static void | |
2748 run_no_output_device_dialog(void) | |
2749 { | |
2750 const gchar *markup = | |
2751 N_("<b><big>Couldn't open audio.</big></b>\n\n" | |
2752 "Please check that:\n" | |
2753 "1. You have the correct output plugin selected.\n" | |
2754 "2. No other programs is blocking the soundcard.\n" | |
2755 "3. Your soundcard is configured properly.\n"); | |
2756 | |
2757 GtkWidget *dialog = | |
2758 gtk_message_dialog_new_with_markup(GTK_WINDOW(mainwin), | |
2759 GTK_DIALOG_DESTROY_WITH_PARENT, | |
2760 GTK_MESSAGE_ERROR, | |
2761 GTK_BUTTONS_OK, | |
2762 _(markup)); | |
2763 gtk_dialog_run(GTK_DIALOG(dialog)); | |
2764 gtk_widget_destroy(dialog); | |
2765 } | |
2766 | |
2767 | |
2768 void | |
2769 add_medium(void) | |
2770 { | |
2771 GList *list, *node; | |
2772 gchar *filename; | |
2773 gchar *path; | |
2774 ConfigDb *db; | |
2775 | |
2776 db = bmp_cfg_db_open(); | |
2777 | |
2778 bmp_cfg_db_get_string(db, "CDDA", "directory", &path); | |
2779 bmp_cfg_db_close(db); | |
2780 | |
2781 if (!(list = input_scan_dir(path))) { | |
2782 run_no_audiocd_dialog(); | |
2783 return; | |
2784 } | |
2785 | |
2786 for (node = list; node; node = g_list_next(node)) { | |
2787 filename = g_build_filename(path, node->data, NULL); | |
2788 playlist_add(filename); | |
2789 g_free(filename); | |
2790 g_free(node->data); | |
2791 } | |
2792 | |
2793 g_free(path); | |
2794 g_list_free(list); | |
2795 | |
2796 } | |
2797 | |
2798 void | |
2799 play_medium(void) | |
2800 { | |
2801 GList *list, *node; | |
2802 gchar *filename; | |
2803 gchar *path; | |
2804 ConfigDb *db; | |
2805 | |
2806 db = bmp_cfg_db_open(); | |
2807 bmp_cfg_db_get_string(db, "CDDA", "directory", &path); | |
2808 bmp_cfg_db_close(db); | |
2809 | |
2810 if (!(list = input_scan_dir(path))) { | |
2811 run_no_audiocd_dialog(); | |
2812 return; | |
2813 } | |
2814 | |
2815 playlist_clear(); | |
2816 | |
2817 for (node = list; node; node = g_list_next(node)) { | |
2818 filename = g_build_filename(path, node->data, NULL); | |
2819 playlist_add(filename); | |
2820 g_free(filename); | |
2821 g_free(node->data); | |
2822 } | |
2823 | |
2824 g_free(path); | |
2825 g_list_free(list); | |
2826 | |
2827 playlist_set_position(0); | |
2828 bmp_playback_initiate(); | |
2829 } | |
2830 | |
2831 void | |
2832 read_volume(gint when) | |
2833 { | |
2834 static gint pvl = 0, pvr = 0; | |
2835 static gint times = VOLSET_DISP_TIMES; | |
2836 static gboolean changing = FALSE; | |
2837 | |
2838 gint vl, vr, b, v; | |
2839 | |
2840 input_get_volume(&vl, &vr); | |
2841 | |
2842 switch (when) { | |
2843 case VOLSET_STARTUP: | |
2844 vl = CLAMP(vl, 0, 100); | |
2845 vr = CLAMP(vr, 0, 100); | |
2846 pvl = vl; | |
2847 pvr = vr; | |
2848 v = MAX(vl, vr); | |
2849 if (vl > vr) | |
2850 b = (gint) rint(((gdouble) vr / vl) * 100) - 100; | |
2851 else if (vl < vr) | |
2852 b = 100 - (gint) rint(((gdouble) vl / vr) * 100); | |
2853 else | |
2854 b = 0; | |
2855 | |
2856 balance = b; | |
2857 mainwin_set_volume_slider(v); | |
2858 equalizerwin_set_volume_slider(v); | |
2859 mainwin_set_balance_slider(b); | |
2860 equalizerwin_set_balance_slider(b); | |
2861 return; | |
2862 | |
2863 case VOLSET_UPDATE: | |
2864 if (vl == -1 || vr == -1) | |
2865 return; | |
2866 | |
2867 if (setting_volume) { | |
2868 pvl = vl; | |
2869 pvr = vr; | |
2870 return; | |
2871 } | |
2872 | |
2873 if (pvr == vr && pvl == vl && changing) { | |
2874 if (times < VOLSET_DISP_TIMES) | |
2875 times++; | |
2876 else { | |
2877 mainwin_release_info_text(); | |
2878 changing = FALSE; | |
2879 } | |
2880 } | |
2881 else if (pvr != vr || pvl != vl) { | |
2882 gchar *tmp; | |
2883 | |
2884 v = MAX(vl, vr); | |
2885 if (vl > vr) | |
2886 b = (gint) rint(((gdouble) vr / vl) * 100) - 100; | |
2887 else if (vl < vr) | |
2888 b = 100 - (gint) rint(((gdouble) vl / vr) * 100); | |
2889 else | |
2890 b = 0; | |
2891 | |
2892 if (MAX(vl, vr) != MAX(pvl, pvr)) | |
2893 tmp = g_strdup_printf(_("VOLUME: %d%%"), v); | |
2894 else { | |
2895 if (vl > vr) { | |
2896 tmp = g_strdup_printf(_("BALANCE: %d%% LEFT"), -b); | |
2897 } | |
2898 else if (vr == vl) | |
2899 tmp = g_strdup_printf(_("BALANCE: CENTER")); | |
2900 else { /* (vl < vr) */ | |
2901 tmp = g_strdup_printf(_("BALANCE: %d%% RIGHT"), b); | |
2902 } | |
2903 } | |
2904 mainwin_lock_info_text(tmp); | |
2905 g_free(tmp); | |
2906 | |
2907 pvr = vr; | |
2908 pvl = vl; | |
2909 times = 0; | |
2910 changing = TRUE; | |
2911 mainwin_set_volume_slider(v); | |
2912 equalizerwin_set_volume_slider(v); | |
2913 | |
2914 /* Don't change the balance slider if the volume has been | |
2915 * set to zero. The balance can be anything, and our best | |
2916 * guess is what is was before. */ | |
2917 if (v > 0) { | |
2918 balance = b; | |
2919 mainwin_set_balance_slider(b); | |
2920 equalizerwin_set_balance_slider(b); | |
2921 } | |
2922 } | |
2923 break; | |
2924 | |
2925 case VOLUME_ADJUSTED: | |
2926 pvl = vl; | |
2927 pvr = vr; | |
2928 break; | |
2929 | |
2930 case VOLUME_SET: | |
2931 times = 0; | |
2932 changing = TRUE; | |
2933 pvl = vl; | |
2934 pvr = vr; | |
2935 break; | |
2936 } | |
2937 } | |
2938 | |
2939 | |
2940 /* TODO: HAL! */ | |
2941 gboolean | |
2942 can_play_cd(void) | |
2943 { | |
2944 GList *ilist; | |
2945 | |
2946 for (ilist = get_input_list(); ilist; ilist = g_list_next(ilist)) { | |
2947 InputPlugin *ip = INPUT_PLUGIN(ilist->data); | |
2948 | |
2949 if (!g_ascii_strcasecmp(g_basename(ip->filename), | |
2950 PLUGIN_FILENAME("cdaudio"))) { | |
2951 return TRUE; | |
2952 } | |
2953 } | |
2954 | |
2955 return FALSE; | |
2956 } | |
2957 | |
2958 | |
2959 static void | |
2960 set_timer_mode(TimerMode mode) | |
2961 { | |
2962 if (mode == TIMER_ELAPSED) | |
2963 check_set(mainwin_view_menu, "/Time Elapsed", TRUE); | |
2964 else | |
2965 check_set(mainwin_view_menu, "/Time Remaining", TRUE); | |
2966 } | |
2967 | |
2968 static void | |
2969 set_timer_mode_menu_cb(TimerMode mode) | |
2970 { | |
2971 cfg.timer_mode = mode; | |
2972 } | |
2973 | |
2974 | |
2975 void | |
2976 mainwin_setup_menus(void) | |
2977 { | |
2978 set_timer_mode(cfg.timer_mode); | |
2979 | |
2980 /* View menu */ | |
2981 | |
2982 check_set(mainwin_view_menu, "/Always On Top", cfg.always_on_top); | |
2983 check_set(mainwin_view_menu, "/Put on All Workspaces", cfg.sticky); | |
2984 check_set(mainwin_view_menu, "/Roll up Player", cfg.player_shaded); | |
2985 check_set(mainwin_view_menu, "/Roll up Playlist Editor", cfg.playlist_shaded); | |
2986 check_set(mainwin_view_menu, "/Roll up Equalizer", cfg.equalizer_shaded); | |
2987 | |
2988 /* Songname menu */ | |
2989 | |
2990 check_set(mainwin_songname_menu, "/Autoscroll Songname", cfg.autoscroll); | |
898 | 2991 check_set(mainwin_songname_menu, "/Stop After Current Song", cfg.stopaftersong); |
0 | 2992 |
2993 /* Playback menu */ | |
2994 | |
2995 check_set(mainwin_play_menu, "/Repeat", cfg.repeat); | |
2996 check_set(mainwin_play_menu, "/Shuffle", cfg.shuffle); | |
891
08b940c25a9a
[svn] * No Playlist Advance context menu checkmark fix (bug #456)
nhjm449
parents:
890
diff
changeset
|
2997 check_set(mainwin_play_menu, "/No Playlist Advance", cfg.no_playlist_advance); |
0 | 2998 |
2999 /* Visualization menu */ | |
3000 | |
3001 check_set(mainwin_vis_menu, | |
3002 mainwin_vis_menu_entries[MAINWIN_VIS_MENU_VIS_MODE + | |
3003 cfg.vis_type].path, TRUE); | |
3004 check_set(mainwin_vis_menu, | |
3005 mainwin_vis_menu_entries[MAINWIN_VIS_MENU_ANALYZER_MODE + | |
3006 cfg.analyzer_mode].path, TRUE); | |
3007 check_set(mainwin_vis_menu, | |
3008 mainwin_vis_menu_entries[MAINWIN_VIS_MENU_ANALYZER_TYPE + | |
3009 cfg.analyzer_type].path, TRUE); | |
3010 check_set(mainwin_vis_menu, | |
3011 mainwin_vis_menu_entries[MAINWIN_VIS_MENU_ANALYZER_PEAKS]. | |
3012 path, cfg.analyzer_peaks); | |
3013 check_set(mainwin_vis_menu, | |
3014 mainwin_vis_menu_entries[MAINWIN_VIS_MENU_SCOPE_MODE + | |
3015 cfg.scope_mode].path, TRUE); | |
3016 check_set(mainwin_vis_menu, | |
3017 mainwin_vis_menu_entries[MAINWIN_VIS_MENU_WSHADEVU_MODE + | |
3018 cfg.vu_mode].path, TRUE); | |
3019 check_set(mainwin_vis_menu, | |
3020 mainwin_vis_menu_entries[MAINWIN_VIS_MENU_REFRESH_RATE + | |
3021 cfg.vis_refresh].path, TRUE); | |
3022 check_set(mainwin_vis_menu, | |
3023 mainwin_vis_menu_entries[MAINWIN_VIS_MENU_AFALLOFF + | |
3024 cfg.analyzer_falloff].path, TRUE); | |
3025 check_set(mainwin_vis_menu, | |
3026 mainwin_vis_menu_entries[MAINWIN_VIS_MENU_PFALLOFF + | |
3027 cfg.peaks_falloff].path, TRUE); | |
3028 } | |
3029 | |
3030 static void | |
3031 mainwin_create_widgets(void) | |
3032 { | |
3033 mainwin_menubtn = | |
3034 create_pbutton(&mainwin_wlist, mainwin_bg, mainwin_gc, 6, 3, 9, 9, | |
3035 0, 0, 0, 9, mainwin_menubtn_cb, SKIN_TITLEBAR); | |
3036 mainwin_menubtn->pb_allow_draw = FALSE; | |
3037 mainwin_minimize = | |
3038 create_pbutton(&mainwin_wlist, mainwin_bg, mainwin_gc, 244, 3, 9, | |
3039 9, 9, 0, 9, 9, mainwin_minimize_cb, SKIN_TITLEBAR); | |
3040 mainwin_minimize->pb_allow_draw = FALSE; | |
3041 mainwin_shade = | |
3042 create_pbutton(&mainwin_wlist, mainwin_bg, mainwin_gc, 254, 3, 9, | |
3043 9, 0, cfg.player_shaded ? 27 : 18, 9, | |
3044 cfg.player_shaded ? 27 : 18, mainwin_shade_toggle, | |
3045 SKIN_TITLEBAR); | |
3046 mainwin_shade->pb_allow_draw = FALSE; | |
3047 mainwin_close = | |
3048 create_pbutton(&mainwin_wlist, mainwin_bg, mainwin_gc, 264, 3, 9, | |
3049 9, 18, 0, 18, 9, mainwin_quit_cb, SKIN_TITLEBAR); | |
3050 mainwin_close->pb_allow_draw = FALSE; | |
3051 | |
3052 mainwin_rew = | |
433
041bc95827be
[svn] Convert prev/next buttons to tristate, via create_pbutton_ex().
nenolod
parents:
383
diff
changeset
|
3053 create_pbutton_ex(&mainwin_wlist, mainwin_bg, mainwin_gc, 16, 88, 23, |
041bc95827be
[svn] Convert prev/next buttons to tristate, via create_pbutton_ex().
nenolod
parents:
383
diff
changeset
|
3054 18, 0, 0, 0, 18, mainwin_rev_pushed, mainwin_rev_release, |
041bc95827be
[svn] Convert prev/next buttons to tristate, via create_pbutton_ex().
nenolod
parents:
383
diff
changeset
|
3055 SKIN_CBUTTONS, SKIN_CBUTTONS); |
0 | 3056 mainwin_play = |
3057 create_pbutton(&mainwin_wlist, mainwin_bg, mainwin_gc, 39, 88, 23, | |
3058 18, 23, 0, 23, 18, mainwin_play_pushed, SKIN_CBUTTONS); | |
3059 mainwin_pause = | |
3060 create_pbutton(&mainwin_wlist, mainwin_bg, mainwin_gc, 62, 88, 23, | |
3061 18, 46, 0, 46, 18, bmp_playback_pause, SKIN_CBUTTONS); | |
3062 mainwin_stop = | |
3063 create_pbutton(&mainwin_wlist, mainwin_bg, mainwin_gc, 85, 88, 23, | |
3064 18, 69, 0, 69, 18, mainwin_stop_pushed, SKIN_CBUTTONS); | |
433
041bc95827be
[svn] Convert prev/next buttons to tristate, via create_pbutton_ex().
nenolod
parents:
383
diff
changeset
|
3065 #if 0 |
0 | 3066 mainwin_fwd = |
3067 create_pbutton(&mainwin_wlist, mainwin_bg, mainwin_gc, 108, 88, 22, | |
3068 18, 92, 0, 92, 18, playlist_next, SKIN_CBUTTONS); | |
433
041bc95827be
[svn] Convert prev/next buttons to tristate, via create_pbutton_ex().
nenolod
parents:
383
diff
changeset
|
3069 #endif |
041bc95827be
[svn] Convert prev/next buttons to tristate, via create_pbutton_ex().
nenolod
parents:
383
diff
changeset
|
3070 mainwin_fwd = |
465 | 3071 create_pbutton_ex(&mainwin_wlist, mainwin_bg, mainwin_gc, 108, 88, 22, |
433
041bc95827be
[svn] Convert prev/next buttons to tristate, via create_pbutton_ex().
nenolod
parents:
383
diff
changeset
|
3072 18, 92, 0, 92, 18, mainwin_fwd_pushed, mainwin_fwd_release, |
041bc95827be
[svn] Convert prev/next buttons to tristate, via create_pbutton_ex().
nenolod
parents:
383
diff
changeset
|
3073 SKIN_CBUTTONS, SKIN_CBUTTONS); |
041bc95827be
[svn] Convert prev/next buttons to tristate, via create_pbutton_ex().
nenolod
parents:
383
diff
changeset
|
3074 |
0 | 3075 mainwin_eject = |
3076 create_pbutton(&mainwin_wlist, mainwin_bg, mainwin_gc, 136, 89, 22, | |
3077 16, 114, 0, 114, 16, mainwin_eject_pushed, | |
3078 SKIN_CBUTTONS); | |
3079 | |
3080 mainwin_srew = | |
3081 create_sbutton(&mainwin_wlist, mainwin_bg, mainwin_gc, 169, 4, 8, | |
3082 7, playlist_prev); | |
3083 mainwin_splay = | |
3084 create_sbutton(&mainwin_wlist, mainwin_bg, mainwin_gc, 177, 4, 10, | |
3085 7, mainwin_play_pushed); | |
3086 mainwin_spause = | |
3087 create_sbutton(&mainwin_wlist, mainwin_bg, mainwin_gc, 187, 4, 10, | |
3088 7, bmp_playback_pause); | |
3089 mainwin_sstop = | |
3090 create_sbutton(&mainwin_wlist, mainwin_bg, mainwin_gc, 197, 4, 9, | |
3091 7, mainwin_stop_pushed); | |
3092 mainwin_sfwd = | |
3093 create_sbutton(&mainwin_wlist, mainwin_bg, mainwin_gc, 206, 4, 8, | |
3094 7, playlist_next); | |
3095 mainwin_seject = | |
3096 create_sbutton(&mainwin_wlist, mainwin_bg, mainwin_gc, 216, 4, 9, | |
3097 7, mainwin_eject_pushed); | |
3098 | |
3099 mainwin_shuffle = | |
3100 create_tbutton(&mainwin_wlist, mainwin_bg, mainwin_gc, 164, 89, 46, | |
3101 15, 28, 0, 28, 15, 28, 30, 28, 45, | |
3102 mainwin_shuffle_pushed, SKIN_SHUFREP); | |
3103 | |
3104 mainwin_repeat = | |
3105 create_tbutton(&mainwin_wlist, mainwin_bg, mainwin_gc, 210, 89, 28, | |
3106 15, 0, 0, 0, 15, 0, 30, 0, 45, | |
3107 mainwin_repeat_pushed, SKIN_SHUFREP); | |
3108 | |
3109 mainwin_eq = | |
3110 create_tbutton(&mainwin_wlist, mainwin_bg, mainwin_gc, 219, 58, 23, | |
3111 12, 0, 61, 46, 61, 0, 73, 46, 73, equalizerwin_show, | |
3112 SKIN_SHUFREP); | |
3113 tbutton_set_toggled(mainwin_eq, cfg.equalizer_visible); | |
3114 mainwin_pl = | |
3115 create_tbutton(&mainwin_wlist, mainwin_bg, mainwin_gc, 242, 58, 23, | |
3116 12, 23, 61, 69, 61, 23, 73, 69, 73, | |
3117 mainwin_pl_pushed, SKIN_SHUFREP); | |
3118 tbutton_set_toggled(mainwin_pl, cfg.playlist_visible); | |
3119 | |
3120 mainwin_info = | |
3121 create_textbox(&mainwin_wlist, mainwin_bg, mainwin_gc, 112, 27, | |
3122 153, 1, SKIN_TEXT); | |
3123 textbox_set_scroll(mainwin_info, cfg.autoscroll); | |
123
022d9717476f
[svn] Bring back support for winamp-style bitmap fonts. :)
nenolod
parents:
88
diff
changeset
|
3124 textbox_set_xfont(mainwin_info, cfg.mainwin_use_xfont, cfg.mainwin_font); |
837
7d998597254e
[svn] - initial work on skin.hints support (the first step to modernizing our
nenolod
parents:
836
diff
changeset
|
3125 |
7d998597254e
[svn] - initial work on skin.hints support (the first step to modernizing our
nenolod
parents:
836
diff
changeset
|
3126 mainwin_othertext = |
7d998597254e
[svn] - initial work on skin.hints support (the first step to modernizing our
nenolod
parents:
836
diff
changeset
|
3127 create_textbox(&mainwin_wlist, mainwin_bg, mainwin_gc, 112, 43, |
7d998597254e
[svn] - initial work on skin.hints support (the first step to modernizing our
nenolod
parents:
836
diff
changeset
|
3128 153, 1, SKIN_TEXT); |
7d998597254e
[svn] - initial work on skin.hints support (the first step to modernizing our
nenolod
parents:
836
diff
changeset
|
3129 |
0 | 3130 mainwin_rate_text = |
3131 create_textbox(&mainwin_wlist, mainwin_bg, mainwin_gc, 111, 43, 15, | |
3132 0, SKIN_TEXT); | |
3133 mainwin_freq_text = | |
3134 create_textbox(&mainwin_wlist, mainwin_bg, mainwin_gc, 156, 43, 10, | |
3135 0, SKIN_TEXT); | |
3136 | |
3137 mainwin_menurow = | |
3138 create_menurow(&mainwin_wlist, mainwin_bg, mainwin_gc, 10, 22, 304, | |
3139 0, 304, 44, mainwin_mr_change, mainwin_mr_release, | |
3140 SKIN_TITLEBAR); | |
3141 mainwin_menurow->mr_doublesize_selected = FALSE; | |
3142 mainwin_menurow->mr_always_selected = cfg.always_on_top; | |
3143 | |
3144 mainwin_volume = | |
3145 create_hslider(&mainwin_wlist, mainwin_bg, mainwin_gc, 107, 57, 68, | |
3146 13, 15, 422, 0, 422, 14, 11, 15, 0, 0, 51, | |
3147 mainwin_volume_frame_cb, mainwin_volume_motion_cb, | |
3148 mainwin_volume_release_cb, SKIN_VOLUME); | |
3149 mainwin_balance = | |
3150 create_hslider(&mainwin_wlist, mainwin_bg, mainwin_gc, 177, 57, 38, | |
3151 13, 15, 422, 0, 422, 14, 11, 15, 9, 0, 24, | |
3152 mainwin_balance_frame_cb, mainwin_balance_motion_cb, | |
3153 mainwin_balance_release_cb, SKIN_BALANCE); | |
3154 | |
3155 mainwin_monostereo = | |
3156 create_monostereo(&mainwin_wlist, mainwin_bg, mainwin_gc, 212, 41, | |
3157 SKIN_MONOSTEREO); | |
3158 | |
3159 mainwin_playstatus = | |
3160 create_playstatus(&mainwin_wlist, mainwin_bg, mainwin_gc, 24, 28); | |
3161 | |
3162 mainwin_minus_num = | |
3163 create_number(&mainwin_wlist, mainwin_bg, mainwin_gc, 36, 26, | |
3164 SKIN_NUMBERS); | |
3165 widget_hide(WIDGET(mainwin_minus_num)); | |
3166 mainwin_10min_num = | |
3167 create_number(&mainwin_wlist, mainwin_bg, mainwin_gc, 48, 26, | |
3168 SKIN_NUMBERS); | |
3169 widget_hide(WIDGET(mainwin_10min_num)); | |
3170 | |
3171 mainwin_min_num = | |
3172 create_number(&mainwin_wlist, mainwin_bg, mainwin_gc, 60, 26, | |
3173 SKIN_NUMBERS); | |
3174 widget_hide(WIDGET(mainwin_min_num)); | |
3175 | |
3176 mainwin_10sec_num = | |
3177 create_number(&mainwin_wlist, mainwin_bg, mainwin_gc, 78, 26, | |
3178 SKIN_NUMBERS); | |
3179 widget_hide(WIDGET(mainwin_10sec_num)); | |
3180 | |
3181 mainwin_sec_num = | |
3182 create_number(&mainwin_wlist, mainwin_bg, mainwin_gc, 90, 26, | |
3183 SKIN_NUMBERS); | |
3184 widget_hide(WIDGET(mainwin_sec_num)); | |
3185 | |
3186 mainwin_about = | |
3187 create_sbutton(&mainwin_wlist, mainwin_bg, mainwin_gc, 247, 83, 20, | |
3188 25, show_about_window); | |
3189 | |
3190 mainwin_vis = | |
3191 create_vis(&mainwin_wlist, mainwin_bg, mainwin->window, mainwin_gc, | |
3192 24, 43, 76); | |
3193 mainwin_svis = create_svis(&mainwin_wlist, mainwin_bg, mainwin_gc, 79, 5); | |
3194 active_vis = mainwin_vis; | |
3195 | |
3196 mainwin_position = | |
3197 create_hslider(&mainwin_wlist, mainwin_bg, mainwin_gc, 16, 72, 248, | |
3198 10, 248, 0, 278, 0, 29, 10, 10, 0, 0, 219, NULL, | |
3199 mainwin_position_motion_cb, | |
3200 mainwin_position_release_cb, SKIN_POSBAR); | |
3201 widget_hide(WIDGET(mainwin_position)); | |
3202 | |
3203 mainwin_sposition = | |
3204 create_hslider(&mainwin_wlist, mainwin_bg, mainwin_gc, 226, 4, 17, | |
3205 7, 17, 36, 17, 36, 3, 7, 36, 0, 1, 13, | |
3206 mainwin_spos_frame_cb, mainwin_spos_motion_cb, | |
3207 mainwin_spos_release_cb, SKIN_TITLEBAR); | |
3208 widget_hide(WIDGET(mainwin_sposition)); | |
3209 | |
3210 mainwin_stime_min = | |
3211 create_textbox(&mainwin_wlist, mainwin_bg, mainwin_gc, 130, 4, 15, | |
3212 FALSE, SKIN_TEXT); | |
3213 mainwin_stime_sec = | |
3214 create_textbox(&mainwin_wlist, mainwin_bg, mainwin_gc, 147, 4, 10, | |
3215 FALSE, SKIN_TEXT); | |
3216 | |
3217 if (!cfg.player_shaded) { | |
3218 widget_hide(WIDGET(mainwin_svis)); | |
3219 widget_hide(WIDGET(mainwin_srew)); | |
3220 widget_hide(WIDGET(mainwin_splay)); | |
3221 widget_hide(WIDGET(mainwin_spause)); | |
3222 widget_hide(WIDGET(mainwin_sstop)); | |
3223 widget_hide(WIDGET(mainwin_sfwd)); | |
3224 widget_hide(WIDGET(mainwin_seject)); | |
3225 widget_hide(WIDGET(mainwin_stime_min)); | |
3226 widget_hide(WIDGET(mainwin_stime_sec)); | |
3227 } | |
3228 | |
781
12c47704b4b5
[svn] Add error reporting for many places, patch by external contributor Derek
nenolod
parents:
654
diff
changeset
|
3229 err = gtk_message_dialog_new(GTK_WINDOW(mainwin), GTK_DIALOG_DESTROY_WITH_PARENT|GTK_DIALOG_MODAL, |
12c47704b4b5
[svn] Add error reporting for many places, patch by external contributor Derek
nenolod
parents:
654
diff
changeset
|
3230 GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,"Error in Audacious."); |
12c47704b4b5
[svn] Add error reporting for many places, patch by external contributor Derek
nenolod
parents:
654
diff
changeset
|
3231 |
12c47704b4b5
[svn] Add error reporting for many places, patch by external contributor Derek
nenolod
parents:
654
diff
changeset
|
3232 |
12c47704b4b5
[svn] Add error reporting for many places, patch by external contributor Derek
nenolod
parents:
654
diff
changeset
|
3233 gtk_window_set_position(GTK_WINDOW(err), GTK_WIN_POS_CENTER); |
12c47704b4b5
[svn] Add error reporting for many places, patch by external contributor Derek
nenolod
parents:
654
diff
changeset
|
3234 /* Dang well better set an error message or you'll see this */ |
813
c8cf439179b8
[svn] - Fix a ton and a half of memory leaks, via the wonderful Leonardo Boshell <leonardop -at- gentoo.org>.
nenolod
parents:
799
diff
changeset
|
3235 gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(err), |
c8cf439179b8
[svn] - Fix a ton and a half of memory leaks, via the wonderful Leonardo Boshell <leonardop -at- gentoo.org>.
nenolod
parents:
799
diff
changeset
|
3236 "Boo! Bad stuff! Booga Booga!"); |
781
12c47704b4b5
[svn] Add error reporting for many places, patch by external contributor Derek
nenolod
parents:
654
diff
changeset
|
3237 |
0 | 3238 } |
3239 | |
3240 static void | |
3241 mainwin_create_window(void) | |
3242 { | |
3243 gint width, height; | |
3244 | |
3245 mainwin = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
3246 gtk_window_set_title(GTK_WINDOW(mainwin), _("Audacious")); | |
3247 gtk_window_set_role(GTK_WINDOW(mainwin), "player"); | |
3248 gtk_window_set_resizable(GTK_WINDOW(mainwin), FALSE); | |
3249 | |
3250 width = MAINWIN_WIDTH; | |
3251 height = cfg.player_shaded ? MAINWIN_SHADED_HEIGHT : MAINWIN_HEIGHT; | |
3252 | |
3253 gtk_widget_set_size_request(mainwin, width, height); | |
3254 gtk_widget_set_app_paintable(mainwin, TRUE); | |
3255 | |
3256 dock_window_list = dock_window_set_decorated(dock_window_list, | |
3257 GTK_WINDOW(mainwin), | |
3258 cfg.show_wm_decorations); | |
3259 | |
3260 if (cfg.player_x != -1 && cfg.save_window_position) | |
3261 gtk_window_move(GTK_WINDOW(mainwin), cfg.player_x, cfg.player_y); | |
3262 | |
3263 gtk_widget_add_events(mainwin, | |
3264 GDK_FOCUS_CHANGE_MASK | GDK_BUTTON_MOTION_MASK | | |
3265 GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | | |
3266 GDK_SCROLL_MASK | GDK_KEY_PRESS_MASK | | |
3267 GDK_VISIBILITY_NOTIFY_MASK); | |
3268 gtk_widget_realize(mainwin); | |
3269 | |
3270 util_set_cursor(mainwin); | |
3271 | |
3272 g_signal_connect(mainwin, "destroy", G_CALLBACK(mainwin_destroy), NULL); | |
3273 g_signal_connect(mainwin, "button_press_event", | |
3274 G_CALLBACK(mainwin_mouse_button_press), NULL); | |
3275 g_signal_connect(mainwin, "scroll_event", | |
3276 G_CALLBACK(mainwin_scrolled), NULL); | |
3277 g_signal_connect(mainwin, "button_release_event", | |
3278 G_CALLBACK(mainwin_mouse_button_release), NULL); | |
3279 g_signal_connect(mainwin, "motion_notify_event", | |
3280 G_CALLBACK(mainwin_motion), NULL); | |
3281 g_signal_connect_after(mainwin, "focus_in_event", | |
3282 G_CALLBACK(mainwin_focus_in), NULL); | |
3283 g_signal_connect_after(mainwin, "focus_out_event", | |
3284 G_CALLBACK(mainwin_focus_out), NULL); | |
3285 g_signal_connect(mainwin, "configure_event", | |
3286 G_CALLBACK(mainwin_configure), NULL); | |
3287 g_signal_connect(mainwin, "style_set", | |
3288 G_CALLBACK(mainwin_set_back_pixmap), NULL); | |
3289 | |
3290 bmp_drag_dest_set(mainwin); | |
3291 | |
3292 g_signal_connect(mainwin, "key_press_event", | |
3293 G_CALLBACK(mainwin_keypress), NULL); | |
3294 } | |
3295 | |
3296 static void | |
3297 mainwin_create_menus(void) | |
3298 { | |
3299 mainwin_general_menu = create_menu(mainwin_general_menu_entries, | |
3300 mainwin_general_menu_entries_num, | |
3301 mainwin_accel); | |
3302 | |
3303 mainwin_play_menu = create_menu(mainwin_playback_menu_entries, | |
3304 mainwin_playback_menu_entries_num, | |
3305 mainwin_accel); | |
3306 | |
3307 mainwin_view_menu = create_menu(mainwin_view_menu_entries, | |
3308 mainwin_view_menu_entries_num, | |
3309 mainwin_accel); | |
3310 | |
3311 mainwin_songname_menu = create_menu(mainwin_songname_menu_entries, | |
3312 mainwin_songname_menu_entries_num, | |
3313 mainwin_accel); | |
3314 | |
3315 mainwin_add_menu = create_menu(mainwin_add_menu_entries, | |
3316 mainwin_add_menu_entries_num, | |
3317 mainwin_accel); | |
3318 | |
3319 mainwin_vis_menu = create_menu(mainwin_vis_menu_entries, | |
3320 mainwin_vis_menu_entries_num, | |
3321 mainwin_accel); | |
3322 | |
3323 make_submenu(mainwin_general_menu, "/View", mainwin_view_menu); | |
87 | 3324 make_submenu(mainwin_general_menu, "/Playback", mainwin_play_menu); |
3325 make_submenu(mainwin_general_menu, "/Visualization", mainwin_vis_menu); | |
0 | 3326 |
3327 gtk_window_add_accel_group(GTK_WINDOW(mainwin), mainwin_accel); | |
3328 } | |
3329 | |
3330 void | |
3331 mainwin_create(void) | |
3332 { | |
3333 mainwin_create_window(); | |
3334 | |
3335 mainwin_accel = gtk_accel_group_new(); | |
3336 mainwin_create_menus(); | |
3337 | |
3338 mainwin_gc = gdk_gc_new(mainwin->window); | |
3339 mainwin_bg = gdk_pixmap_new(mainwin->window, | |
3340 MAINWIN_WIDTH, MAINWIN_HEIGHT, -1); | |
3341 mainwin_set_back_pixmap(); | |
3342 mainwin_create_widgets(); | |
3343 | |
3344 vis_set_window(mainwin_vis, mainwin->window); | |
3345 } | |
3346 | |
3347 void | |
3348 mainwin_attach_idle_func(void) | |
3349 { | |
3350 mainwin_timeout_id = g_timeout_add(MAINWIN_UPDATE_INTERVAL, | |
3351 mainwin_idle_func, NULL); | |
3352 } | |
3353 | |
3354 static void | |
3355 idle_func_update_song_info(gint time) | |
3356 { | |
3357 gint length, t; | |
3358 gchar stime_prefix; | |
3359 | |
3360 length = playlist_get_current_length(); | |
3361 playlistwin_set_time(time, length, cfg.timer_mode); | |
3362 input_update_vis(time); | |
3363 | |
3364 if (cfg.timer_mode == TIMER_REMAINING) { | |
3365 if (length != -1) { | |
3366 number_set_number(mainwin_minus_num, 11); | |
3367 t = length - time; | |
3368 stime_prefix = '-'; | |
3369 } | |
3370 else { | |
3371 number_set_number(mainwin_minus_num, 10); | |
3372 t = time; | |
3373 stime_prefix = ' '; | |
3374 } | |
3375 } | |
3376 else { | |
3377 number_set_number(mainwin_minus_num, 10); | |
3378 t = time; | |
3379 stime_prefix = ' '; | |
3380 } | |
3381 t /= 1000; | |
3382 | |
3383 /* Show the time in the format HH:MM when we have more than 100 | |
3384 * minutes. */ | |
3385 if (t >= 100 * 60) | |
3386 t /= 60; | |
3387 number_set_number(mainwin_10min_num, t / 600); | |
3388 number_set_number(mainwin_min_num, (t / 60) % 10); | |
3389 number_set_number(mainwin_10sec_num, (t / 10) % 6); | |
3390 number_set_number(mainwin_sec_num, t % 10); | |
3391 | |
3392 if (!mainwin_sposition->hs_pressed) { | |
3393 gchar *time_str; | |
3394 | |
3395 time_str = g_strdup_printf("%c%2.2d", stime_prefix, t / 60); | |
3396 textbox_set_text(mainwin_stime_min, time_str); | |
3397 g_free(time_str); | |
3398 | |
3399 time_str = g_strdup_printf("%2.2d", t % 60); | |
3400 textbox_set_text(mainwin_stime_sec, time_str); | |
3401 g_free(time_str); | |
3402 } | |
3403 | |
3404 time /= 1000; | |
3405 length /= 1000; | |
3406 if (length > 0) { | |
3407 if (time > length) { | |
3408 hslider_set_position(mainwin_position, 219); | |
3409 hslider_set_position(mainwin_sposition, 13); | |
3410 } | |
467
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
3411 /* update the slider position ONLY if there is not a seek in progress */ |
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
3412 else if (seek_state == MAINWIN_SEEK_NIL) { |
0 | 3413 hslider_set_position(mainwin_position, (time * 219) / length); |
3414 hslider_set_position(mainwin_sposition, | |
3415 ((time * 12) / length) + 1); | |
3416 } | |
3417 } | |
3418 else { | |
3419 hslider_set_position(mainwin_position, 0); | |
3420 hslider_set_position(mainwin_sposition, 1); | |
3421 } | |
3422 } | |
3423 | |
3424 static gboolean | |
3425 mainwin_idle_func(gpointer data) | |
3426 { | |
3427 static gint count = 0; | |
197
ccd034857702
[svn] Split up generic events into audcore_generic_events(), and client-specific stuff remains in mainwin_idle_func().
nenolod
parents:
196
diff
changeset
|
3428 gint time = 0; |
ccd034857702
[svn] Split up generic events into audcore_generic_events(), and client-specific stuff remains in mainwin_idle_func().
nenolod
parents:
196
diff
changeset
|
3429 |
ccd034857702
[svn] Split up generic events into audcore_generic_events(), and client-specific stuff remains in mainwin_idle_func().
nenolod
parents:
196
diff
changeset
|
3430 /* run audcore events, then run our own. --nenolod */ |
ccd034857702
[svn] Split up generic events into audcore_generic_events(), and client-specific stuff remains in mainwin_idle_func().
nenolod
parents:
196
diff
changeset
|
3431 switch((time = audcore_generic_events())) |
ccd034857702
[svn] Split up generic events into audcore_generic_events(), and client-specific stuff remains in mainwin_idle_func().
nenolod
parents:
196
diff
changeset
|
3432 { |
0 | 3433 case -2: |
3434 /* no usable output device */ | |
3435 GDK_THREADS_ENTER(); | |
3436 run_no_output_device_dialog(); | |
3437 mainwin_stop_pushed(); | |
3438 GDK_THREADS_LEAVE(); | |
197
ccd034857702
[svn] Split up generic events into audcore_generic_events(), and client-specific stuff remains in mainwin_idle_func().
nenolod
parents:
196
diff
changeset
|
3439 ev_waiting = FALSE; |
0 | 3440 break; |
3441 | |
3442 default: | |
3443 idle_func_update_song_info(time); | |
197
ccd034857702
[svn] Split up generic events into audcore_generic_events(), and client-specific stuff remains in mainwin_idle_func().
nenolod
parents:
196
diff
changeset
|
3444 /* nothing at this time */ |
0 | 3445 } |
3446 | |
3447 GDK_THREADS_ENTER(); | |
3448 | |
197
ccd034857702
[svn] Split up generic events into audcore_generic_events(), and client-specific stuff remains in mainwin_idle_func().
nenolod
parents:
196
diff
changeset
|
3449 if (bmp_playback_get_playing()) |
ccd034857702
[svn] Split up generic events into audcore_generic_events(), and client-specific stuff remains in mainwin_idle_func().
nenolod
parents:
196
diff
changeset
|
3450 vis_playback_start(); |
ccd034857702
[svn] Split up generic events into audcore_generic_events(), and client-specific stuff remains in mainwin_idle_func().
nenolod
parents:
196
diff
changeset
|
3451 else |
ccd034857702
[svn] Split up generic events into audcore_generic_events(), and client-specific stuff remains in mainwin_idle_func().
nenolod
parents:
196
diff
changeset
|
3452 vis_playback_stop(); |
0 | 3453 |
3454 draw_main_window(mainwin_force_redraw); | |
3455 | |
3456 if (!count) { | |
3457 read_volume(VOLSET_UPDATE); | |
3458 count = 10; | |
3459 } | |
3460 else | |
3461 count--; | |
3462 | |
233 | 3463 mainwin_force_redraw = FALSE; |
455
40bb32c3789a
[svn] Possibly play nicer with X11 in the skinning engine's event loop.
nenolod
parents:
454
diff
changeset
|
3464 draw_playlist_window(FALSE); |
40bb32c3789a
[svn] Possibly play nicer with X11 in the skinning engine's event loop.
nenolod
parents:
454
diff
changeset
|
3465 draw_equalizer_window(FALSE); |
229
108cd7e58d5e
[svn] Always update the playlist information, regardless of whether it is shaded or not. To ensure this happens, I've attached playlistwin_update_list() to the GUI event loop,
nenolod
parents:
225
diff
changeset
|
3466 |
0 | 3467 if (mainwin_title_text) { |
3468 G_LOCK(mainwin_title); | |
3469 gtk_window_set_title(GTK_WINDOW(mainwin), mainwin_title_text); | |
3470 g_free(mainwin_title_text); | |
3471 mainwin_title_text = NULL; | |
3472 G_UNLOCK(mainwin_title); | |
3473 | |
3474 mainwin_set_info_text(); | |
3475 playlistwin_update_list(); | |
3476 } | |
3477 | |
467
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
3478 /* tristate buttons seek */ |
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
3479 if ( seek_state != MAINWIN_SEEK_NIL ) |
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
3480 { |
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
3481 GTimeVal now_time; |
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
3482 GTimeVal delta_time; |
468 | 3483 gulong now_dur; |
467
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
3484 g_get_current_time(&now_time); |
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
3485 |
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
3486 delta_time.tv_usec = now_time.tv_usec - cb_time.tv_usec; |
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
3487 delta_time.tv_sec = now_time.tv_sec - cb_time.tv_sec; |
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
3488 |
468 | 3489 now_dur = labs((delta_time.tv_sec * 1000) + (glong) (delta_time.tv_usec / 1000)); |
467
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
3490 |
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
3491 if ( now_dur > 150 ) |
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
3492 { |
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
3493 gint np; |
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
3494 if (seek_state == MAINWIN_SEEK_REV) |
468 | 3495 np = seek_initial_pos - labs((gulong)(now_dur/100)); /* seek back */ |
467
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
3496 else |
468 | 3497 np = seek_initial_pos + labs((gulong)(now_dur/100)); /* seek forward */ |
467
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
3498 |
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
3499 /* boundaries check */ |
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
3500 if (np < 0 ) |
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
3501 np = 0; |
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
3502 else if ( np > 219 ) |
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
3503 np = 219; |
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
3504 |
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
3505 hslider_set_position( mainwin_position , np ); |
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
3506 mainwin_position_motion_cb( np ); |
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
3507 } |
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
3508 } |
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
3509 |
0 | 3510 GDK_THREADS_LEAVE(); |
3511 | |
467
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
3512 /* |
435
e3070cc55ab2
[svn] - Scroll by 1000 frames when using the keypad (7 && 9) inside the player window to
nenolod
parents:
434
diff
changeset
|
3513 if (seek_state == MAINWIN_SEEK_REV) |
e3070cc55ab2
[svn] - Scroll by 1000 frames when using the keypad (7 && 9) inside the player window to
nenolod
parents:
434
diff
changeset
|
3514 bmp_playback_seek(CLAMP(bmp_playback_get_time() - 1000, 0, |
e3070cc55ab2
[svn] - Scroll by 1000 frames when using the keypad (7 && 9) inside the player window to
nenolod
parents:
434
diff
changeset
|
3515 playlist_get_current_length()) / 1000); |
e3070cc55ab2
[svn] - Scroll by 1000 frames when using the keypad (7 && 9) inside the player window to
nenolod
parents:
434
diff
changeset
|
3516 else if (seek_state == MAINWIN_SEEK_FWD) |
e3070cc55ab2
[svn] - Scroll by 1000 frames when using the keypad (7 && 9) inside the player window to
nenolod
parents:
434
diff
changeset
|
3517 bmp_playback_seek(CLAMP(bmp_playback_get_time() + 1000, 0, |
e3070cc55ab2
[svn] - Scroll by 1000 frames when using the keypad (7 && 9) inside the player window to
nenolod
parents:
434
diff
changeset
|
3518 playlist_get_current_length()) / 1000); |
467
bd423985b2cf
[svn] seek with tristate prev/next buttons now works just like the seek bar (no seek until the button is released, no seek at all if it should move to the prev/next song)
giacomo
parents:
465
diff
changeset
|
3519 */ |
435
e3070cc55ab2
[svn] - Scroll by 1000 frames when using the keypad (7 && 9) inside the player window to
nenolod
parents:
434
diff
changeset
|
3520 |
0 | 3521 return TRUE; |
3522 } |