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