annotate audacious/mainwin.c @ 2057:a55ad33d882e trunk

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