annotate audacious/mainwin.c @ 853:74576869a506 trunk

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