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