annotate gui/ui/playbar.c @ 36472:c431f2e17a19

Update year in copyright notes.
author ib
date Thu, 02 Jan 2014 09:16:57 +0000
parents b2edfe1a11a6
children 7d250553d451
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 * This file is part of MPlayer.
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 * MPlayer is free software; you can redistribute it and/or modify
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
5 * 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
6 * the Free Software Foundation; either version 2 of the License, or
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
7 * (at your option) any later version.
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
8 *
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
9 * MPlayer is distributed in the hope that it will be useful,
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
12 * GNU General Public License for more details.
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
13 *
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
14 * 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
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
17 */
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
18
34699
ed0e00db4306 Cosmetic: Move, change and add some comments on GUI windows.
ib
parents: 34697
diff changeset
19 /* playbar window */
ed0e00db4306 Cosmetic: Move, change and add some comments on GUI windows.
ib
parents: 34697
diff changeset
20
23077
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
35525
e27855a45128 Rebuild GUI directory structure.
ib
parents: 35493
diff changeset
27 #include "gui/app/app.h"
e27855a45128 Rebuild GUI directory structure.
ib
parents: 35493
diff changeset
28 #include "gui/app/gui.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"
35783
5fb29877d2a3 Add a playbar window initialization debug message.
ib
parents: 35780
diff changeset
36 #include "mp_msg.h"
33024
21e0de9c355f Show GUI message when GUI must exit.
ib
parents: 32931
diff changeset
37 #include "mp_core.h"
26382
b2f4abcf20ed Make include paths consistent; do not use ../ in them.
diego
parents: 26365
diff changeset
38 #include "libvo/x11_common.h"
b2f4abcf20ed Make include paths consistent; do not use ../ in them.
diego
parents: 26365
diff changeset
39 #include "libvo/fastmemcpy.h"
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
40
26382
b2f4abcf20ed Make include paths consistent; do not use ../ in them.
diego
parents: 26365
diff changeset
41 #include "stream/stream.h"
b2f4abcf20ed Make include paths consistent; do not use ../ in them.
diego
parents: 26365
diff changeset
42 #include "mixer.h"
32467
fbe5c829c69b Move libvo/sub.[ch] from libvo to sub.
cigaes
parents: 30535
diff changeset
43 #include "sub/sub.h"
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
44
26382
b2f4abcf20ed Make include paths consistent; do not use ../ in them.
diego
parents: 26365
diff changeset
45 #include "libmpdemux/demuxer.h"
b2f4abcf20ed Make include paths consistent; do not use ../ in them.
diego
parents: 26365
diff changeset
46 #include "libmpdemux/stheader.h"
b2f4abcf20ed Make include paths consistent; do not use ../ in them.
diego
parents: 26365
diff changeset
47 #include "codec-cfg.h"
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
48
35528
ab07b17fddfb Rebuild GUI directory structure.
ib
parents: 35525
diff changeset
49 #include "ui.h"
33556
520fb0f7544c Rename GUI directory 'mplayer' and some files in it.
ib
parents: 33555
diff changeset
50 #include "actions.h"
35529
8ad4d2fb46e8 Rebuild GUI directory structure.
ib
parents: 35528
diff changeset
51 #include "gui/dialog/dialog.h"
33556
520fb0f7544c Rename GUI directory 'mplayer' and some files in it.
ib
parents: 33555
diff changeset
52 #include "render.h"
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
53
28051
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 26458
diff changeset
54 unsigned int GetTimerMS( void );
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 26458
diff changeset
55 unsigned int GetTimer( void );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
56
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
57 unsigned char * playbarDrawBuffer = NULL;
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35450
diff changeset
58 int playbarVisible = False;
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
59 int playbarLength = 0;
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
60 int uiPlaybarFade = 0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
61
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
62 static void uiPlaybarDraw( void )
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
63 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
64 int x;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28051
diff changeset
65
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
66 if ( !guiApp.videoWindow.isFullScreen ) return;
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
67 if ( !playbarVisible || !guiApp.playbarIsPresent ) return;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
68
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
69 // guiApp.playbar.x=( guiApp.videoWindow.Width - guiApp.playbar.width ) / 2;
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
70 switch( guiApp.playbar.x )
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
71 {
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
72 case -1: x=( guiApp.videoWindow.Width - guiApp.playbar.width ) / 2; break;
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
73 case -2: x=( guiApp.videoWindow.Width - guiApp.playbar.width ); break;
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
74 default: x=guiApp.playbar.x;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
75 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28051
diff changeset
76
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
77 switch ( uiPlaybarFade )
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
78 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
79 case 1: // fade in
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
80 playbarLength--;
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
81 if ( guiApp.videoWindow.Height - guiApp.playbar.height >= playbarLength )
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
82 {
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
83 playbarLength=guiApp.videoWindow.Height - guiApp.playbar.height;
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
84 uiPlaybarFade=0;
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35450
diff changeset
85 vo_mouse_autohide=False;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
86 }
35681
80c5c89f77d6 Cosmetic: Rename ws functions for the sake of consistency.
ib
parents: 35675
diff changeset
87 wsWindowMove( &guiApp.playbarWindow,True,x,playbarLength );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
88 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
89 case 2: // fade out
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
90 playbarLength+=10;
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
91 if ( playbarLength > guiApp.videoWindow.Height )
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
92 {
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
93 playbarLength=guiApp.videoWindow.Height;
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35450
diff changeset
94 uiPlaybarFade=0;
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35450
diff changeset
95 playbarVisible=False;
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35450
diff changeset
96 vo_mouse_autohide=True;
35681
80c5c89f77d6 Cosmetic: Rename ws functions for the sake of consistency.
ib
parents: 35675
diff changeset
97 wsWindowVisibility( &guiApp.playbarWindow,wsHideWindow );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
98 return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
99 }
35681
80c5c89f77d6 Cosmetic: Rename ws functions for the sake of consistency.
ib
parents: 35675
diff changeset
100 wsWindowMove( &guiApp.playbarWindow,True,x,playbarLength );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
101 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
102 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
103
34684
b03481253518 Cosmetic: Prefer C style for single line comments.
ib
parents: 34472
diff changeset
104 /* render */
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
105 if ( guiApp.playbarWindow.State == wsWindowExpose )
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
106 {
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
107 btnModify( evSetMoviePosition,guiInfo.Position );
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
108 btnModify( evSetVolume,guiInfo.Volume );
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28051
diff changeset
109
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35450
diff changeset
110 vo_mouse_autohide=False;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
111
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
112 fast_memcpy( playbarDrawBuffer,guiApp.playbar.Bitmap.Image,guiApp.playbar.Bitmap.ImageSize );
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
113 RenderAll( &guiApp.playbarWindow,guiApp.playbarItems,guiApp.IndexOfPlaybarItems,playbarDrawBuffer );
35744
bfe51acc36fb Cosmetic: Rename wsImageConvert() wsImageRender().
ib
parents: 35688
diff changeset
114 wsImageRender( &guiApp.playbarWindow,playbarDrawBuffer );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
115 }
35681
80c5c89f77d6 Cosmetic: Rename ws functions for the sake of consistency.
ib
parents: 35675
diff changeset
116 wsImageDraw( &guiApp.playbarWindow );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
117 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
118
35762
6742a91ba28a Cosmetic: Remove "Handle(r)" from function names.
ib
parents: 35761
diff changeset
119 static void uiPlaybarMouse( int Button, int X, int Y, int RX, int RY )
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
120 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
121 static int itemtype = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
122 int i;
35688
6fd886ce32b9 Cosmetic: Rename wItem guiItem.
ib
parents: 35683
diff changeset
123 guiItem * item = NULL;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
124 float value = 0.0f;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28051
diff changeset
125
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
126 static int SelectedItem = -1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
127 int currentselected = -1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
128
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
129 for ( i=0;i <= guiApp.IndexOfPlaybarItems;i++ )
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
130 if ( ( guiApp.playbarItems[i].pressed != btnDisabled )&&
35675
9e2183017f1f Move wgIsRect from ws.h to gui.h.
ib
parents: 35658
diff changeset
131 ( isInside( 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
132 { currentselected=i; break; }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28051
diff changeset
133
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
134 switch ( Button )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
135 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
136 case wsPMMouseButton:
34333
e8e4e6f9b7ac Change prefix for internal events from ev to iv.
ib
parents: 33993
diff changeset
137 gtkShow( ivHidePopUpMenu,NULL );
35766
16ed8155439b Rename uiShowMenu() uiMenuShow() and uiHideMenu() uiMenuHide().
ib
parents: 35765
diff changeset
138 uiMenuShow( RX,RY );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
139 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
140 case wsRMMouseButton:
35766
16ed8155439b Rename uiShowMenu() uiMenuShow() and uiHideMenu() uiMenuHide().
ib
parents: 35765
diff changeset
141 uiMenuHide( RX,RY,0 );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
142 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
143 case wsRRMouseButton:
34333
e8e4e6f9b7ac Change prefix for internal events from ev to iv.
ib
parents: 33993
diff changeset
144 gtkShow( ivShowPopUpMenu,NULL );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
145 break;
34684
b03481253518 Cosmetic: Prefer C style for single line comments.
ib
parents: 34472
diff changeset
146 /* --- */
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
147 case wsPLMouseButton:
34333
e8e4e6f9b7ac Change prefix for internal events from ev to iv.
ib
parents: 33993
diff changeset
148 gtkShow( ivHidePopUpMenu,NULL );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
149 SelectedItem=currentselected;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
150 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
151 item=&guiApp.playbarItems[SelectedItem];
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
152 itemtype=item->type;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
153 item->pressed=btnPressed;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
154
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
155 switch( item->type )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
156 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
157 case itButton:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
158 if ( ( SelectedItem > -1 ) &&
32911
e06fbdd8eb46 Clean up the wItem structure.
ib
parents: 32467
diff changeset
159 ( ( ( item->message == evPlaySwitchToPause && item->message == evPauseSwitchToPlay ) ) ||
e06fbdd8eb46 Clean up the wItem structure.
ib
parents: 32467
diff changeset
160 ( ( item->message == evPauseSwitchToPlay && item->message == evPlaySwitchToPause ) ) ) )
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
161 { item->pressed=btnDisabled; }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
162 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
163 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
164
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
165 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
166 case wsRLMouseButton:
33107
eda3df3e4a9d Prevent an out-of-bounds array access.
ib
parents: 33024
diff changeset
167 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
168 {
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
169 item=&guiApp.playbarItems[SelectedItem];
33108
5450a92ac4bd Cosmetic: Adjust indent.
ib
parents: 33107
diff changeset
170 item->pressed=btnReleased;
33107
eda3df3e4a9d Prevent an out-of-bounds array access.
ib
parents: 33024
diff changeset
171 }
35367
f1bd28a00384 Fix segmentation fault with mouse button release.
ib
parents: 35366
diff changeset
172 if ( currentselected == - 1 || SelectedItem == -1 ) { itemtype=0; break; }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
173 SelectedItem=-1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
174 value=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
175
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
176 switch( itemtype )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
177 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
178 case itPotmeter:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
179 case itHPotmeter:
36283
ebbd9730a8c6 Increase precision of calculation by using constants of type double.
ib
parents: 36281
diff changeset
180 btnModify( item->message,(float)( X - item->x ) / item->width * 100.0 );
35773
c688b0dcbe66 Cosmetic: Rename uiMainEvent() uiEvent().
ib
parents: 35768
diff changeset
181 uiEvent( item->message,item->value );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
182 value=item->value;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
183 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
184 case itVPotmeter:
36283
ebbd9730a8c6 Increase precision of calculation by using constants of type double.
ib
parents: 36281
diff changeset
185 btnModify( item->message, ( 1.0 - (float)( Y - item->y ) / item->height) * 100.0 );
35773
c688b0dcbe66 Cosmetic: Rename uiMainEvent() uiEvent().
ib
parents: 35768
diff changeset
186 uiEvent( item->message,item->value );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
187 value=item->value;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
188 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
189 }
35773
c688b0dcbe66 Cosmetic: Rename uiMainEvent() uiEvent().
ib
parents: 35768
diff changeset
190 uiEvent( item->message,value );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
191
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
192 itemtype=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
193 break;
34684
b03481253518 Cosmetic: Prefer C style for single line comments.
ib
parents: 34472
diff changeset
194 /* --- */
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
195 case wsP5MouseButton: value=-2.5f; goto rollerhandled;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
196 case wsP4MouseButton: value= 2.5f;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
197 rollerhandled:
35365
fb054f36c3a9 Prevent negative array index read.
ib
parents: 34699
diff changeset
198 if (currentselected != - 1)
fb054f36c3a9 Prevent negative array index read.
ib
parents: 34699
diff changeset
199 {
35366
92cafcf6f6b2 Cosmetic: Adjust indent.
ib
parents: 35365
diff changeset
200 item=&guiApp.playbarItems[currentselected];
92cafcf6f6b2 Cosmetic: Adjust indent.
ib
parents: 35365
diff changeset
201 if ( ( item->type == itHPotmeter )||( item->type == itVPotmeter )||( item->type == itPotmeter ) )
92cafcf6f6b2 Cosmetic: Adjust indent.
ib
parents: 35365
diff changeset
202 {
92cafcf6f6b2 Cosmetic: Adjust indent.
ib
parents: 35365
diff changeset
203 item->value+=value;
92cafcf6f6b2 Cosmetic: Adjust indent.
ib
parents: 35365
diff changeset
204 btnModify( item->message,item->value );
35773
c688b0dcbe66 Cosmetic: Rename uiMainEvent() uiEvent().
ib
parents: 35768
diff changeset
205 uiEvent( item->message,item->value );
35366
92cafcf6f6b2 Cosmetic: Adjust indent.
ib
parents: 35365
diff changeset
206 }
35365
fb054f36c3a9 Prevent negative array index read.
ib
parents: 34699
diff changeset
207 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
208 break;
34684
b03481253518 Cosmetic: Prefer C style for single line comments.
ib
parents: 34472
diff changeset
209 /* --- */
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
210 case wsMoveMouse:
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
211 item=&guiApp.playbarItems[SelectedItem];
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
212 switch ( itemtype )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
213 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
214 case itPRMButton:
35779
8ad72f9cf697 Fix segmentation fault with menu window.
ib
parents: 35778
diff changeset
215 if (guiApp.menuIsPresent) guiApp.menuWindow.MouseHandler( 0,RX,RY,0,0 );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
216 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
217 case itPotmeter:
36283
ebbd9730a8c6 Increase precision of calculation by using constants of type double.
ib
parents: 36281
diff changeset
218 item->value=(float)( X - item->x ) / item->width * 100.0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
219 goto potihandled;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
220 case itVPotmeter:
36283
ebbd9730a8c6 Increase precision of calculation by using constants of type double.
ib
parents: 36281
diff changeset
221 item->value=(1.0 - (float)( Y - item->y ) / item->height) * 100.0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
222 goto potihandled;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
223 case itHPotmeter:
36283
ebbd9730a8c6 Increase precision of calculation by using constants of type double.
ib
parents: 36281
diff changeset
224 item->value=(float)( X - item->x ) / item->width * 100.0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
225 potihandled:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
226 if ( item->value > 100.0f ) item->value=100.0f;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
227 if ( item->value < 0.0f ) item->value=0.0f;
35773
c688b0dcbe66 Cosmetic: Rename uiMainEvent() uiEvent().
ib
parents: 35768
diff changeset
228 uiEvent( item->message,item->value );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
229 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
230 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
231 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
232 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
233 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
234
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
235 void uiPlaybarInit( void )
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
236 {
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
237 if ( !guiApp.playbarIsPresent ) return;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
238
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
239 if ( ( playbarDrawBuffer = malloc( guiApp.playbar.Bitmap.ImageSize ) ) == NULL )
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
240 {
33024
21e0de9c355f Show GUI message when GUI must exit.
ib
parents: 32931
diff changeset
241 gmp_msg( MSGT_GPLAYER,MSGL_FATAL,MSGTR_NEMDB );
33768
cee9987bc81d Remove guiExit().
ib
parents: 33739
diff changeset
242 mplayer( MPLAYER_EXIT_GUI, EXIT_ERROR, 0 );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
243 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
244
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
245 guiApp.playbarWindow.Parent=guiApp.videoWindow.WindowID;
35681
80c5c89f77d6 Cosmetic: Rename ws functions for the sake of consistency.
ib
parents: 35675
diff changeset
246 wsWindowCreate( &guiApp.playbarWindow,
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
247 guiApp.playbar.x,guiApp.playbar.y,guiApp.playbar.width,guiApp.playbar.height,
35683
75155d8a9c7e Remove parameter for border_width from wsWindowCreate().
ib
parents: 35681
diff changeset
248 wsHideFrame|wsHideWindow,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,"PlayBar" );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
249
35783
5fb29877d2a3 Add a playbar window initialization debug message.
ib
parents: 35780
diff changeset
250 mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[playbar] playbarWindow ID: 0x%x\n",(int)guiApp.playbarWindow.WindowID );
5fb29877d2a3 Add a playbar window initialization debug message.
ib
parents: 35780
diff changeset
251
35681
80c5c89f77d6 Cosmetic: Rename ws functions for the sake of consistency.
ib
parents: 35675
diff changeset
252 wsWindowShape( &guiApp.playbarWindow,guiApp.playbar.Mask.Image );
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28051
diff changeset
253
35761
fa2e5b53b2e3 Remove unnecessary cast.
ib
parents: 35760
diff changeset
254 guiApp.playbarWindow.DrawHandler=uiPlaybarDraw;
35762
6742a91ba28a Cosmetic: Remove "Handle(r)" from function names.
ib
parents: 35761
diff changeset
255 guiApp.playbarWindow.MouseHandler=uiPlaybarMouse;
35780
4073fff5efc7 Add new functions uiMainInit() and uiVideoInit().
ib
parents: 35779
diff changeset
256 guiApp.playbarWindow.KeyHandler=guiApp.mainWindow.KeyHandler;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28051
diff changeset
257
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
258 playbarLength=guiApp.videoWindow.Height;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
259 }
35765
42827680dfb9 Cosmetic: Replace uiPlaybarShow().
ib
parents: 35762
diff changeset
260
35796
497a1c45a597 Add uiMainDone(), uiVideoDone(), uiPlaybarDone() and uiMenuDone().
ib
parents: 35783
diff changeset
261 void uiPlaybarDone( void )
497a1c45a597 Add uiMainDone(), uiVideoDone(), uiPlaybarDone() and uiMenuDone().
ib
parents: 35783
diff changeset
262 {
497a1c45a597 Add uiMainDone(), uiVideoDone(), uiPlaybarDone() and uiMenuDone().
ib
parents: 35783
diff changeset
263 nfree(playbarDrawBuffer);
497a1c45a597 Add uiMainDone(), uiVideoDone(), uiPlaybarDone() and uiMenuDone().
ib
parents: 35783
diff changeset
264 wsWindowDestroy(&guiApp.playbarWindow);
36291
b2edfe1a11a6 Process events after destroying a window.
ib
parents: 36283
diff changeset
265 wsEvents();
35796
497a1c45a597 Add uiMainDone(), uiVideoDone(), uiPlaybarDone() and uiMenuDone().
ib
parents: 35783
diff changeset
266 }
497a1c45a597 Add uiMainDone(), uiVideoDone(), uiPlaybarDone() and uiMenuDone().
ib
parents: 35783
diff changeset
267
35765
42827680dfb9 Cosmetic: Replace uiPlaybarShow().
ib
parents: 35762
diff changeset
268 void uiPlaybarShow( int y )
42827680dfb9 Cosmetic: Replace uiPlaybarShow().
ib
parents: 35762
diff changeset
269 {
42827680dfb9 Cosmetic: Replace uiPlaybarShow().
ib
parents: 35762
diff changeset
270 if ( !guiApp.playbarIsPresent || !gtkEnablePlayBar ) return;
42827680dfb9 Cosmetic: Replace uiPlaybarShow().
ib
parents: 35762
diff changeset
271 if ( !guiApp.videoWindow.isFullScreen ) return;
42827680dfb9 Cosmetic: Replace uiPlaybarShow().
ib
parents: 35762
diff changeset
272
42827680dfb9 Cosmetic: Replace uiPlaybarShow().
ib
parents: 35762
diff changeset
273 if ( y > guiApp.videoWindow.Height - guiApp.playbar.height )
42827680dfb9 Cosmetic: Replace uiPlaybarShow().
ib
parents: 35762
diff changeset
274 {
42827680dfb9 Cosmetic: Replace uiPlaybarShow().
ib
parents: 35762
diff changeset
275 if ( !uiPlaybarFade ) wsWindowVisibility( &guiApp.playbarWindow,wsShowWindow );
42827680dfb9 Cosmetic: Replace uiPlaybarShow().
ib
parents: 35762
diff changeset
276 uiPlaybarFade=1; playbarVisible=True; wsWindowRedraw( &guiApp.playbarWindow );
42827680dfb9 Cosmetic: Replace uiPlaybarShow().
ib
parents: 35762
diff changeset
277 }
42827680dfb9 Cosmetic: Replace uiPlaybarShow().
ib
parents: 35762
diff changeset
278 else if ( !uiPlaybarFade ) uiPlaybarFade=2;
42827680dfb9 Cosmetic: Replace uiPlaybarShow().
ib
parents: 35762
diff changeset
279 }