annotate gui/ui/playbar.c @ 34565:25acb5f98cb4

Support v408 and AYUV decoding via FFmpeg.
author cehoyos
date Sun, 05 Feb 2012 21:20:51 +0000
parents f866092d51cd
children b03481253518
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
26458
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
1 /*
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
2 * main window
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
3 *
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
4 * This file is part of MPlayer.
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
5 *
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
6 * MPlayer is free software; you can redistribute it and/or modify
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
7 * it under the terms of the GNU General Public License as published by
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
9 * (at your option) any later version.
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
10 *
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
11 * MPlayer is distributed in the hope that it will be useful,
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
14 * GNU General Public License for more details.
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
15 *
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
16 * You should have received a copy of the GNU General Public License along
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
17 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
19 */
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
20
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
21 #include <stdlib.h>
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
22 #include <stdio.h>
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
23 #include <sys/stat.h>
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
24 #include <unistd.h>
23305
22d3d12c6dfb Include string.h for memcpy, fastmemcpy.h alone is not enough.
reimar
parents: 23077
diff changeset
25 #include <string.h>
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
26
26382
b2f4abcf20ed Make include paths consistent; do not use ../ in them.
diego
parents: 26365
diff changeset
27 #include "config.h"
26365
10dfbc523184 Add gui/ prefix to some #include paths so that compilation from the
diego
parents: 26203
diff changeset
28 #include "gui/app.h"
33738
998f94e62a61 Remove unnecessary #include "gui/interface.h".
ib
parents: 33654
diff changeset
29 #include "gui/interface.h"
26365
10dfbc523184 Add gui/ prefix to some #include paths so that compilation from the
diego
parents: 26203
diff changeset
30 #include "gui/skin/font.h"
10dfbc523184 Add gui/ prefix to some #include paths so that compilation from the
diego
parents: 26203
diff changeset
31 #include "gui/skin/skin.h"
33739
9f6d46d325de Remove gfree() from interface.c.
ib
parents: 33738
diff changeset
32 #include "gui/util/mem.h"
26365
10dfbc523184 Add gui/ prefix to some #include paths so that compilation from the
diego
parents: 26203
diff changeset
33 #include "gui/wm/ws.h"
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
34
26382
b2f4abcf20ed Make include paths consistent; do not use ../ in them.
diego
parents: 26365
diff changeset
35 #include "help_mp.h"
33024
21e0de9c355f Show GUI message when GUI must exit.
ib
parents: 32931
diff changeset
36 #include "mp_core.h"
26382
b2f4abcf20ed Make include paths consistent; do not use ../ in them.
diego
parents: 26365
diff changeset
37 #include "libvo/x11_common.h"
b2f4abcf20ed Make include paths consistent; do not use ../ in them.
diego
parents: 26365
diff changeset
38 #include "libvo/fastmemcpy.h"
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
39
26382
b2f4abcf20ed Make include paths consistent; do not use ../ in them.
diego
parents: 26365
diff changeset
40 #include "stream/stream.h"
b2f4abcf20ed Make include paths consistent; do not use ../ in them.
diego
parents: 26365
diff changeset
41 #include "mixer.h"
32467
fbe5c829c69b Move libvo/sub.[ch] from libvo to sub.
cigaes
parents: 30535
diff changeset
42 #include "sub/sub.h"
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
43
26382
b2f4abcf20ed Make include paths consistent; do not use ../ in them.
diego
parents: 26365
diff changeset
44 #include "libmpdemux/demuxer.h"
b2f4abcf20ed Make include paths consistent; do not use ../ in them.
diego
parents: 26365
diff changeset
45 #include "libmpdemux/stheader.h"
b2f4abcf20ed Make include paths consistent; do not use ../ in them.
diego
parents: 26365
diff changeset
46 #include "codec-cfg.h"
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
47
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
48 #include "gmplayer.h"
33556
520fb0f7544c Rename GUI directory 'mplayer' and some files in it.
ib
parents: 33555
diff changeset
49 #include "actions.h"
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
50 #include "widgets.h"
33556
520fb0f7544c Rename GUI directory 'mplayer' and some files in it.
ib
parents: 33555
diff changeset
51 #include "render.h"
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
52
28051
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 26458
diff changeset
53 unsigned int GetTimerMS( void );
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 26458
diff changeset
54 unsigned int GetTimer( void );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
55
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
56 unsigned char * playbarDrawBuffer = NULL;
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
57 int playbarVisible = 0;
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
58 int playbarLength = 0;
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
59 int uiPlaybarFade = 0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
60
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
61 static void uiPlaybarDraw( void )
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
62 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
63 int x;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28051
diff changeset
64
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
65 if ( !guiApp.subWindow.isFullScreen ) return;
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
66 if ( !playbarVisible || !guiApp.playbarIsPresent ) return;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
67
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
68 // guiApp.playbar.x=( guiApp.subWindow.Width - guiApp.playbar.width ) / 2;
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
69 switch( guiApp.playbar.x )
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
70 {
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
71 case -1: x=( guiApp.subWindow.Width - guiApp.playbar.width ) / 2; break;
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
72 case -2: x=( guiApp.subWindow.Width - guiApp.playbar.width ); break;
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
73 default: x=guiApp.playbar.x;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
74 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28051
diff changeset
75
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
76 switch ( uiPlaybarFade )
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
77 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
78 case 1: // fade in
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
79 playbarLength--;
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
80 if ( guiApp.subWindow.Height - guiApp.playbar.height >= playbarLength )
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
81 {
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
82 playbarLength=guiApp.subWindow.Height - guiApp.playbar.height;
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
83 uiPlaybarFade=0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
84 vo_mouse_autohide=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
85 }
33993
57d711d3dcca Change parameter b of wsMoveWindow().
ib
parents: 33768
diff changeset
86 wsMoveWindow( &guiApp.playbarWindow,True,x,playbarLength );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
87 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
88 case 2: // fade out
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
89 playbarLength+=10;
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
90 if ( playbarLength > guiApp.subWindow.Height )
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
91 {
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
92 playbarLength=guiApp.subWindow.Height;
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
93 uiPlaybarFade=playbarVisible=0;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28051
diff changeset
94 vo_mouse_autohide=1;
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
95 wsVisibleWindow( &guiApp.playbarWindow,wsHideWindow );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
96 return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
97 }
33993
57d711d3dcca Change parameter b of wsMoveWindow().
ib
parents: 33768
diff changeset
98 wsMoveWindow( &guiApp.playbarWindow,True,x,playbarLength );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
99 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
100 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
101
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
102 // --- render
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
103 if ( guiApp.playbarWindow.State == wsWindowExpose )
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
104 {
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
105 btnModify( evSetMoviePosition,guiInfo.Position );
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
106 btnModify( evSetVolume,guiInfo.Volume );
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28051
diff changeset
107
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
108 vo_mouse_autohide=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
109
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
110 fast_memcpy( playbarDrawBuffer,guiApp.playbar.Bitmap.Image,guiApp.playbar.Bitmap.ImageSize );
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
111 RenderAll( &guiApp.playbarWindow,guiApp.playbarItems,guiApp.IndexOfPlaybarItems,playbarDrawBuffer );
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
112 wsConvert( &guiApp.playbarWindow,playbarDrawBuffer );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
113 }
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
114 wsPutImage( &guiApp.playbarWindow );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
115 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
116
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
117 static void uiPlaybarMouseHandle( int Button, int X, int Y, int RX, int RY )
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
118 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
119 static int itemtype = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
120 int i;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
121 wItem * item = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
122 float value = 0.0f;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28051
diff changeset
123
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
124 static int SelectedItem = -1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
125 int currentselected = -1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
126
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
127 for ( i=0;i <= guiApp.IndexOfPlaybarItems;i++ )
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
128 if ( ( guiApp.playbarItems[i].pressed != btnDisabled )&&
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
129 ( wgIsRect( X,Y,guiApp.playbarItems[i].x,guiApp.playbarItems[i].y,guiApp.playbarItems[i].x+guiApp.playbarItems[i].width,guiApp.playbarItems[i].y+guiApp.playbarItems[i].height ) ) )
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
130 { currentselected=i; break; }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28051
diff changeset
131
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
132 switch ( Button )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
133 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
134 case wsPMMouseButton:
34333
e8e4e6f9b7ac Change prefix for internal events from ev to iv.
ib
parents: 33993
diff changeset
135 gtkShow( ivHidePopUpMenu,NULL );
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
136 uiShowMenu( RX,RY );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
137 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
138 case wsRMMouseButton:
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
139 uiHideMenu( RX,RY,0 );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
140 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
141 case wsRRMouseButton:
34333
e8e4e6f9b7ac Change prefix for internal events from ev to iv.
ib
parents: 33993
diff changeset
142 gtkShow( ivShowPopUpMenu,NULL );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
143 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
144 // ---
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
145 case wsPLMouseButton:
34333
e8e4e6f9b7ac Change prefix for internal events from ev to iv.
ib
parents: 33993
diff changeset
146 gtkShow( ivHidePopUpMenu,NULL );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
147 SelectedItem=currentselected;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
148 if ( SelectedItem == -1 ) break; // yeees, i'm move the fucking window
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
149 item=&guiApp.playbarItems[SelectedItem];
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
150 itemtype=item->type;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
151 item->pressed=btnPressed;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
152
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
153 switch( item->type )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
154 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
155 case itButton:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
156 if ( ( SelectedItem > -1 ) &&
32911
e06fbdd8eb46 Clean up the wItem structure.
ib
parents: 32467
diff changeset
157 ( ( ( item->message == evPlaySwitchToPause && item->message == evPauseSwitchToPlay ) ) ||
e06fbdd8eb46 Clean up the wItem structure.
ib
parents: 32467
diff changeset
158 ( ( item->message == evPauseSwitchToPlay && item->message == evPlaySwitchToPause ) ) ) )
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
159 { item->pressed=btnDisabled; }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
160 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
161 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
162
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
163 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
164 case wsRLMouseButton:
33107
eda3df3e4a9d Prevent an out-of-bounds array access.
ib
parents: 33024
diff changeset
165 if ( SelectedItem != -1 ) // NOTE TO MYSELF: only if itButton, itHPotmeter or itVPotmeter
eda3df3e4a9d Prevent an out-of-bounds array access.
ib
parents: 33024
diff changeset
166 {
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
167 item=&guiApp.playbarItems[SelectedItem];
33108
5450a92ac4bd Cosmetic: Adjust indent.
ib
parents: 33107
diff changeset
168 item->pressed=btnReleased;
33107
eda3df3e4a9d Prevent an out-of-bounds array access.
ib
parents: 33024
diff changeset
169 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
170 SelectedItem=-1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
171 if ( currentselected == - 1 ) { itemtype=0; break; }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
172 value=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
173
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
174 switch( itemtype )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
175 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
176 case itPotmeter:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
177 case itHPotmeter:
32911
e06fbdd8eb46 Clean up the wItem structure.
ib
parents: 32467
diff changeset
178 btnModify( item->message,(float)( X - item->x ) / item->width * 100.0f );
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
179 uiEventHandling( item->message,item->value );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
180 value=item->value;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
181 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
182 case itVPotmeter:
32911
e06fbdd8eb46 Clean up the wItem structure.
ib
parents: 32467
diff changeset
183 btnModify( item->message, ( 1. - (float)( Y - item->y ) / item->height) * 100.0f );
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
184 uiEventHandling( item->message,item->value );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
185 value=item->value;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
186 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
187 }
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
188 uiEventHandling( item->message,value );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
189
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
190 itemtype=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
191 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
192 // ---
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
193 case wsP5MouseButton: value=-2.5f; goto rollerhandled;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
194 case wsP4MouseButton: value= 2.5f;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
195 rollerhandled:
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
196 item=&guiApp.playbarItems[currentselected];
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
197 if ( ( item->type == itHPotmeter )||( item->type == itVPotmeter )||( item->type == itPotmeter ) )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
198 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
199 item->value+=value;
32911
e06fbdd8eb46 Clean up the wItem structure.
ib
parents: 32467
diff changeset
200 btnModify( item->message,item->value );
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
201 uiEventHandling( item->message,item->value );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
202 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
203 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
204 // ---
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
205 case wsMoveMouse:
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
206 item=&guiApp.playbarItems[SelectedItem];
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
207 switch ( itemtype )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
208 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
209 case itPRMButton:
34472
f866092d51cd Remove unused parameter from uiMenuMouseHandle().
ib
parents: 34471
diff changeset
210 uiMenuMouseHandle( RX,RY );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
211 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
212 case itPotmeter:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
213 item->value=(float)( X - item->x ) / item->width * 100.0f;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
214 goto potihandled;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
215 case itVPotmeter:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
216 item->value=(1. - (float)( Y - item->y ) / item->height) * 100.0f;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
217 goto potihandled;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
218 case itHPotmeter:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
219 item->value=(float)( X - item->x ) / item->width * 100.0f;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
220 potihandled:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
221 if ( item->value > 100.0f ) item->value=100.0f;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
222 if ( item->value < 0.0f ) item->value=0.0f;
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
223 uiEventHandling( item->message,item->value );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
224 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
225 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
226 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
227 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
228 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
229
34471
65ea3b7a704b Remove unused parameter from uiPlaybarShow().
ib
parents: 34333
diff changeset
230 void uiPlaybarShow( int y )
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
231 {
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
232 if ( !guiApp.playbarIsPresent || !gtkEnablePlayBar ) return;
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
233 if ( !guiApp.subWindow.isFullScreen ) return;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
234
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
235 if ( y > guiApp.subWindow.Height - guiApp.playbar.height )
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28051
diff changeset
236 {
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
237 if ( !uiPlaybarFade ) wsVisibleWindow( &guiApp.playbarWindow,wsShowWindow );
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
238 uiPlaybarFade=1; playbarVisible=1; wsPostRedisplay( &guiApp.playbarWindow );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
239 }
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
240 else if ( !uiPlaybarFade ) uiPlaybarFade=2;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
241 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
242
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
243 void uiPlaybarInit( void )
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
244 {
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
245 if ( !guiApp.playbarIsPresent ) return;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
246
33739
9f6d46d325de Remove gfree() from interface.c.
ib
parents: 33738
diff changeset
247 nfree( playbarDrawBuffer );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
248
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
249 if ( ( playbarDrawBuffer = malloc( guiApp.playbar.Bitmap.ImageSize ) ) == NULL )
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
250 {
33024
21e0de9c355f Show GUI message when GUI must exit.
ib
parents: 32931
diff changeset
251 gmp_msg( MSGT_GPLAYER,MSGL_FATAL,MSGTR_NEMDB );
33768
cee9987bc81d Remove guiExit().
ib
parents: 33739
diff changeset
252 mplayer( MPLAYER_EXIT_GUI, EXIT_ERROR, 0 );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
253 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
254
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
255 guiApp.playbarWindow.Parent=guiApp.subWindow.WindowID;
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
256 wsCreateWindow( &guiApp.playbarWindow,
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
257 guiApp.playbar.x,guiApp.playbar.y,guiApp.playbar.width,guiApp.playbar.height,
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
258 wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,wsHideFrame|wsHideWindow,"PlayBar" );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
259
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
260 wsSetShape( &guiApp.playbarWindow,guiApp.playbar.Mask.Image );
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28051
diff changeset
261
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
262 guiApp.playbarWindow.ReDraw=(void *)uiPlaybarDraw;
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
263 guiApp.playbarWindow.MouseHandler=uiPlaybarMouseHandle;
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
264 guiApp.playbarWindow.KeyHandler=uiMainKeyHandle;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28051
diff changeset
265
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
266 playbarLength=guiApp.subWindow.Height;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
267 }