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