annotate audacious/mainwin.c @ 52:fc4dbbeae814 trunk

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