annotate audacious/mainwin.c @ 1729:3ee4c6d45c27 trunk

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