annotate audacious/mainwin.c @ 1191:4abdab413cf6 trunk

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