annotate audacious/mainwin.c @ 706:f520a0abddbc trunk

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