annotate Gui/mplayer/mw.h @ 1784:e9ea2e9cf854

key handling fix
author pontscho
date Thu, 30 Aug 2001 20:51:35 +0000
parents fcba80a2e79f
children ac269ebda44c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
2 // main window
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
3
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
4 #include "mixer.h"
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
5
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
6 unsigned char * mplDrawBuffer = NULL;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
7 int mplMainRender = 1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
8 int mplMainAutoPlay = 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
9
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
10 int mainVisible = 1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
11
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
12 int boxMoved = 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
13 int msButton = 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
14 int sx = 0,sy = 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
15 int i,pot = 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
16
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
17 char * Translate( char * str )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
18 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
19 static char trbuf[512];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
20 char tmp[128];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
21 int i,c;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
22 int t,h,m,s;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
23 memset( trbuf,0,512 );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
24 memset( tmp,0,128 );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
25 for ( c=0,i=0;i < strlen( str );i++ )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
26 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
27 if ( str[i] != '$' ) { trbuf[c++]=str[i]; trbuf[c]=0; }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
28 else
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
29 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
30 switch ( str[++i] )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
31 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
32 case 't':
1707
216aae08226c misc fixes/cleanup, Skin path stuff fixed
arpi
parents: 1693
diff changeset
33 sprintf( tmp,"%02d",mplShMem->Track ); strcat( trbuf,tmp );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
34 break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
35 case 'f':
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
36 if ( strlen( gtkShMem->fs.filename ) )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
37 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
38 int i;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
39 strcpy( tmp,gtkShMem->fs.filename );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
40 for ( i=0;i < strlen( tmp );i++ )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
41 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
42 t=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
43 if ( ( tmp[i] >= 'A' )&&( tmp[i] <= 'Z' ) ) t=32;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
44 tmp[i]=(char)( tmp[i] + t );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
45 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
46 if ( tmp[strlen( tmp ) - 4] == '.' ) tmp[strlen( tmp ) - 4]=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
47 if ( tmp[strlen( tmp ) - 5] == '.' ) tmp[strlen( tmp ) - 5]=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
48 } else strcpy( tmp,"no file loaded" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
49 strcat( trbuf,tmp );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
50 break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
51 case 'F':
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
52 if ( strlen( gtkShMem->fs.filename ) )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
53 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
54 int i;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
55 strcpy( tmp,gtkShMem->fs.filename );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
56 for ( i=0;i < strlen( tmp );i++ )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
57 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
58 char t = 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
59 if ( ( tmp[i] >= 'a' )&&( tmp[i] <= 'z' ) ) t=32;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
60 tmp[i]=tmp[i] - t;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
61 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
62 if ( tmp[strlen( tmp ) - 4] == '.' ) tmp[strlen( tmp ) - 4]=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
63 if ( tmp[strlen( tmp ) - 5] == '.' ) tmp[strlen( tmp ) - 5]=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
64 } else strcpy( tmp,"NO FILE LOADED" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
65 strcat( trbuf,tmp );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
66 break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
67 case 'o':
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
68 if ( strlen( gtkShMem->fs.filename ) )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
69 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
70 strcat( trbuf,gtkShMem->fs.filename );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
71 if ( trbuf[strlen( trbuf ) - 4] == '.' ) trbuf[strlen( trbuf ) - 4]=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
72 if ( trbuf[strlen( trbuf ) - 5] == '.' ) trbuf[strlen( trbuf ) - 5]=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
73 } else strcat( trbuf,"no file loaded" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
74 break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
75 case '6': t=mplShMem->LengthInSec; goto calclengthhhmmss;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
76 case '1': t=mplShMem->TimeSec;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
77 calclengthhhmmss:
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
78 s=t%60; t=( t - s ) / 60; m=t%60; h=t/60;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
79 sprintf( tmp,"%02d:%02d:%02d",h,m,s ); strcat( trbuf,tmp );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
80 break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
81 case '7': t=mplShMem->LengthInSec; goto calclengthmmmmss;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
82 case '2': t=mplShMem->TimeSec;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
83 calclengthmmmmss:
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
84 s=t%60; m=( ( t - s ) / 60 ) % 60;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
85 sprintf( tmp,"%04d:%02d",m,s ); strcat( trbuf,tmp );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
86 break;
1707
216aae08226c misc fixes/cleanup, Skin path stuff fixed
arpi
parents: 1693
diff changeset
87 case '3': sprintf( tmp,"%02d",( mplShMem->TimeSec - ( mplShMem->TimeSec % 60 ) ) / 3600 ); strcat( trbuf,tmp ); break;
216aae08226c misc fixes/cleanup, Skin path stuff fixed
arpi
parents: 1693
diff changeset
88 case '4': sprintf( tmp,"%02d",( ( mplShMem->TimeSec - ( mplShMem->TimeSec % 60 ) ) / 60 ) % 60 ); strcat( trbuf,tmp ); break;
216aae08226c misc fixes/cleanup, Skin path stuff fixed
arpi
parents: 1693
diff changeset
89 case '5': sprintf( tmp,"%02d",mplShMem->TimeSec % 60 ); strcat( trbuf,tmp ); break;
216aae08226c misc fixes/cleanup, Skin path stuff fixed
arpi
parents: 1693
diff changeset
90 case 'v': sprintf( tmp,"%3.2f%%",mplShMem->Volume ); strcat( trbuf,tmp ); break;
216aae08226c misc fixes/cleanup, Skin path stuff fixed
arpi
parents: 1693
diff changeset
91 case 'V': sprintf( tmp,"%3.1f",mplShMem->Volume ); strcat( trbuf,tmp ); break;
216aae08226c misc fixes/cleanup, Skin path stuff fixed
arpi
parents: 1693
diff changeset
92 case 'b': sprintf( tmp,"%3.2f%%",mplShMem->Balance ); strcat( trbuf,tmp ); break;
216aae08226c misc fixes/cleanup, Skin path stuff fixed
arpi
parents: 1693
diff changeset
93 case 'B': sprintf( tmp,"%3.1f",mplShMem->Balance ); strcat( trbuf,tmp ); break;
216aae08226c misc fixes/cleanup, Skin path stuff fixed
arpi
parents: 1693
diff changeset
94 case 's': if ( mplShMem->Playing == 0 ) strcat( trbuf,"s" ); break;
216aae08226c misc fixes/cleanup, Skin path stuff fixed
arpi
parents: 1693
diff changeset
95 case 'l': if ( mplShMem->Playing == 1 ) strcat( trbuf,"p" ); break;
216aae08226c misc fixes/cleanup, Skin path stuff fixed
arpi
parents: 1693
diff changeset
96 case 'e': if ( mplShMem->Playing == 2 ) strcat( trbuf,"e" ); break;
216aae08226c misc fixes/cleanup, Skin path stuff fixed
arpi
parents: 1693
diff changeset
97 case '$': strcat( trbuf,"$" ); break;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
98 default: continue;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
99 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
100 c=strlen( trbuf );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
101 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
102 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
103 return trbuf;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
104 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
105
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
106 void PutImage( txSample * bf,int x,int y,int max,int ofs )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
107 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
108 int i=0,ix,iy;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
109 unsigned long * buf = NULL;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
110 unsigned long * drw = NULL;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
111 unsigned long tmp;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
112
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
113 if ( ( !bf )||( bf->Image == NULL ) ) return;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
114
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
115 i=( bf->Width * ( bf->Height / max ) ) * ofs;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
116 buf=(unsigned long *)mplDrawBuffer;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
117 drw=(unsigned long *)bf->Image;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
118
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
119 for ( iy=y;iy < y+bf->Height / max;iy++ )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
120 for ( ix=x;ix < x+bf->Width;ix++ )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
121 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
122 tmp=drw[i++];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
123 if ( tmp != 0x00ff00ff )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
124 buf[ iy*appMPlayer.main.Bitmap.Width+ix ]=tmp;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
125 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
126 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
127
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
128 void mplMainDraw( wsParamDisplay )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
129 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
130 wItem * item;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
131 txSample * image = NULL;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
132 int i;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
133 char * tmp;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
134
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
135 if ( appMPlayer.mainWindow.Visible == wsWindowNotVisible ||
1729
d6c99f70449e fix hprogressbar
pontscho
parents: 1723
diff changeset
136 !mainVisible ) return;
d6c99f70449e fix hprogressbar
pontscho
parents: 1723
diff changeset
137 // !appMPlayer.mainWindow.Mapped ) return;
d6c99f70449e fix hprogressbar
pontscho
parents: 1723
diff changeset
138
d6c99f70449e fix hprogressbar
pontscho
parents: 1723
diff changeset
139 btnModify( evSetMoviePosition,mplShMem->Position );
d6c99f70449e fix hprogressbar
pontscho
parents: 1723
diff changeset
140 btnModify( evSetVolume,mplShMem->Volume );
1751
d0dbc020f50f fix play -> pause button
pontscho
parents: 1750
diff changeset
141
d0dbc020f50f fix play -> pause button
pontscho
parents: 1750
diff changeset
142 switch ( mplShMem->Playing )
d0dbc020f50f fix play -> pause button
pontscho
parents: 1750
diff changeset
143 {
d0dbc020f50f fix play -> pause button
pontscho
parents: 1750
diff changeset
144 case 2:
d0dbc020f50f fix play -> pause button
pontscho
parents: 1750
diff changeset
145 case 0:
d0dbc020f50f fix play -> pause button
pontscho
parents: 1750
diff changeset
146 btnModify( evPlaySwitchToPause,btnReleased );
d0dbc020f50f fix play -> pause button
pontscho
parents: 1750
diff changeset
147 btnModify( evPauseSwitchToPlay,btnDisabled );
d0dbc020f50f fix play -> pause button
pontscho
parents: 1750
diff changeset
148 break;
d0dbc020f50f fix play -> pause button
pontscho
parents: 1750
diff changeset
149 case 1:
1777
fcba80a2e79f hm. optim
pontscho
parents: 1773
diff changeset
150 if ( mplShMem->Filename[0] != 0 )
1751
d0dbc020f50f fix play -> pause button
pontscho
parents: 1750
diff changeset
151 {
d0dbc020f50f fix play -> pause button
pontscho
parents: 1750
diff changeset
152 btnModify( evPlaySwitchToPause,btnDisabled );
d0dbc020f50f fix play -> pause button
pontscho
parents: 1750
diff changeset
153 btnModify( evPauseSwitchToPlay,btnReleased );
d0dbc020f50f fix play -> pause button
pontscho
parents: 1750
diff changeset
154 }
d0dbc020f50f fix play -> pause button
pontscho
parents: 1750
diff changeset
155 }
d0dbc020f50f fix play -> pause button
pontscho
parents: 1750
diff changeset
156
1744
688748ea8e68 enable filename drawing
pontscho
parents: 1729
diff changeset
157 // --- erosen ideiglenes.
688748ea8e68 enable filename drawing
pontscho
parents: 1729
diff changeset
158 strcpy( gtkShMem->fs.filename,mplShMem->Filename );
688748ea8e68 enable filename drawing
pontscho
parents: 1729
diff changeset
159 // ---
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
160
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
161 if ( mplMainRender )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
162 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
163 memcpy( mplDrawBuffer,appMPlayer.main.Bitmap.Image,appMPlayer.main.Bitmap.ImageSize );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
164 for( i=0;i < appMPlayer.NumberOfItems + 1;i++ )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
165 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
166 item=&appMPlayer.Items[i];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
167 switch( item->type )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
168 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
169 case itButton:
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
170 PutImage( &item->Bitmap,item->x,item->y,3,item->pressed );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
171 break;
1729
d6c99f70449e fix hprogressbar
pontscho
parents: 1723
diff changeset
172 case itPotmeter:
d6c99f70449e fix hprogressbar
pontscho
parents: 1723
diff changeset
173 PutImage( &item->Bitmap,item->x,item->y,item->phases,item->phases * ( item->value / 100.0f ) );
d6c99f70449e fix hprogressbar
pontscho
parents: 1723
diff changeset
174 break;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
175 case itHPotmeter:
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
176 PutImage( &item->Bitmap,item->x,item->y,item->phases,item->phases * ( item->value / 100.0f ) );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
177 PutImage( &item->Mask,item->x + (int)( ( item->width - item->psx ) * item->value / 100.0f ),item->y,3,item->pressed );
1729
d6c99f70449e fix hprogressbar
pontscho
parents: 1723
diff changeset
178 break;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
179 case itSLabel:
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
180 image=fntRender( item->fontid,0,item->width,"%s",item->label );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
181 goto drawrenderedtext;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
182 case itDLabel:
1729
d6c99f70449e fix hprogressbar
pontscho
parents: 1723
diff changeset
183 image=fntRender( item->fontid,mplTimer%item->width,item->width,"%s",Translate( item->label ) );
d6c99f70449e fix hprogressbar
pontscho
parents: 1723
diff changeset
184 // image=fntRender( item->fontid,( mplRedrawTimer / 10 )%item->width,item->width,"%s",Translate( item->label ) );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
185 drawrenderedtext:
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
186 PutImage( image,item->x,item->y,1,0 );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
187 if ( image )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
188 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
189 if ( image->Image ) free( image->Image );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
190 free( image );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
191 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
192 break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
193 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
194 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
195 wsConvert( &appMPlayer.mainWindow,mplDrawBuffer,appMPlayer.main.Bitmap.ImageSize );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
196 mplMainRender=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
197 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
198 wsPutImage( &appMPlayer.mainWindow );
1707
216aae08226c misc fixes/cleanup, Skin path stuff fixed
arpi
parents: 1693
diff changeset
199 XFlush( wsDisplay );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
200 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
201
1723
5e4214a7540e GUI stuff. now seeking works, and xmga renders to video window
arpi
parents: 1707
diff changeset
202 #define IZE(x) printf("@@@ " x " @@@\n");
5e4214a7540e GUI stuff. now seeking works, and xmga renders to video window
arpi
parents: 1707
diff changeset
203
1729
d6c99f70449e fix hprogressbar
pontscho
parents: 1723
diff changeset
204 extern void exit_player(char* how);
d6c99f70449e fix hprogressbar
pontscho
parents: 1723
diff changeset
205
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
206 void mplMsgHandle( int msg,float param )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
207 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
208 int j;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
209
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
210 switch( msg )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
211 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
212 // --- user events
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
213 case evExit:
1729
d6c99f70449e fix hprogressbar
pontscho
parents: 1723
diff changeset
214 // IZE("evExit");
1723
5e4214a7540e GUI stuff. now seeking works, and xmga renders to video window
arpi
parents: 1707
diff changeset
215 wsDoExit(); // sets wsTrue=False;
1729
d6c99f70449e fix hprogressbar
pontscho
parents: 1723
diff changeset
216 exit_player( "Exit" );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
217 break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
218 case evIconify:
1723
5e4214a7540e GUI stuff. now seeking works, and xmga renders to video window
arpi
parents: 1707
diff changeset
219 IZE("evIcon");
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
220 wsIconify( appMPlayer.mainWindow );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
221 break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
222 case evFullScreen:
1723
5e4214a7540e GUI stuff. now seeking works, and xmga renders to video window
arpi
parents: 1707
diff changeset
223 IZE("evFullS");
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
224 for ( j=0;j<appMPlayer.NumberOfItems + 1;j++ )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
225 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
226 if ( appMPlayer.Items[j].msg == evFullScreen )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
227 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
228 appMPlayer.Items[j].tmp=!appMPlayer.Items[j].tmp;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
229 appMPlayer.Items[j].pressed=appMPlayer.Items[j].tmp;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
230 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
231 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
232 mplMainRender=1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
233 mplFullScreen();
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
234 break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
235
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
236 case evPlaySwitchToPause:
1723
5e4214a7540e GUI stuff. now seeking works, and xmga renders to video window
arpi
parents: 1707
diff changeset
237 IZE("evPlay->Pause");
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
238 if ( Filename )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
239 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
240 btnModify( evPlaySwitchToPause,btnDisabled );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
241 btnModify( evPauseSwitchToPlay,btnReleased );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
242 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
243 if ( mplShMem->Playing == 1 ) goto NoPause;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
244 case evPlay:
1723
5e4214a7540e GUI stuff. now seeking works, and xmga renders to video window
arpi
parents: 1707
diff changeset
245 IZE("evPlay");
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
246 mplMainRender=1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
247 mplPlay();
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
248 break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
249
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
250 case evPauseSwitchToPlay:
1723
5e4214a7540e GUI stuff. now seeking works, and xmga renders to video window
arpi
parents: 1707
diff changeset
251 IZE("evPause->Play");
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
252 btnModify( evPlaySwitchToPause,btnReleased );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
253 btnModify( evPauseSwitchToPlay,btnDisabled );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
254 case evPause:
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
255 NoPause:
1723
5e4214a7540e GUI stuff. now seeking works, and xmga renders to video window
arpi
parents: 1707
diff changeset
256 IZE("evPause");
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
257 mplMainRender=1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
258 mplPause();
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
259 break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
260
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
261 case evStop:
1723
5e4214a7540e GUI stuff. now seeking works, and xmga renders to video window
arpi
parents: 1707
diff changeset
262 IZE("evStop");
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
263 btnModify( evPlaySwitchToPause,btnReleased );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
264 btnModify( evPauseSwitchToPlay,btnDisabled );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
265 mplMainRender=1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
266 mplStop();
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
267 break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
268
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
269 case evLoadPlay:
1723
5e4214a7540e GUI stuff. now seeking works, and xmga renders to video window
arpi
parents: 1707
diff changeset
270 IZE("evLoadPlay");
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
271 mplMainAutoPlay=1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
272 case evLoad:
1723
5e4214a7540e GUI stuff. now seeking works, and xmga renders to video window
arpi
parents: 1707
diff changeset
273 IZE("evLoad");
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
274 mplMainRender=1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
275 gtkSendMessage( evLoad );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
276 break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
277 case evPrev:
1723
5e4214a7540e GUI stuff. now seeking works, and xmga renders to video window
arpi
parents: 1707
diff changeset
278 IZE("evPrev");
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
279 mplMainRender=1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
280 #ifdef DEBUG
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
281 dbprintf( 1,"[mw.h] previous stream ...\n" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
282 #endif
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
283 break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
284 case evNext:
1723
5e4214a7540e GUI stuff. now seeking works, and xmga renders to video window
arpi
parents: 1707
diff changeset
285 IZE("evNext");
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
286 mplMainRender=1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
287 #ifdef DEBUG
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
288 dbprintf( 1,"[mw.h] next stream ...\n" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
289 #endif
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
290 break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
291
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
292 case evPlayList:
1723
5e4214a7540e GUI stuff. now seeking works, and xmga renders to video window
arpi
parents: 1707
diff changeset
293 IZE("evPlayList");
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
294 mplMainRender=1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
295 if ( gtkVisiblePlayList )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
296 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
297 btnModify( evPlayList,btnReleased );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
298 gtkShMem->vs.window=evPlayList;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
299 gtkSendMessage( evHideWindow );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
300 gtkVisiblePlayList=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
301 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
302 else
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
303 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
304 gtkSendMessage( evPlayList );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
305 btnModify( evPlayList,btnPressed );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
306 gtkVisiblePlayList=1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
307 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
308 break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
309
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
310 case evSkinBrowser: gtkSendMessage( evSkinBrowser ); break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
311 case evAbout: gtkSendMessage( evAbout ); break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
312 case evPreferences: gtkSendMessage( evPreferences ); break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
313
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
314 case evForward1min: mplRelSeek( 60 ); break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
315 case evBackward1min: mplRelSeek( -60 ); break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
316 case evForward10sec: mplRelSeek( 10 ); break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
317 case evBackward10sec: mplRelSeek( -10 ); break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
318 case evSetMoviePosition: mplAbsSeek( param ); break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
319
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
320 case evIncVolume: mixerIncVolume(); break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
321 case evDecVolume: mixerDecVolume(); break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
322 case evSetVolume: mixerSetVolume( param ); break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
323 case evSetBalance: mixerSetBalance( param ); break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
324 case evMute: mixerMute(); break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
325
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
326 case evIncAudioBufDelay: mplIncAudioBufDelay(); break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
327 case evDecAudioBufDelay: mplDecAudioBufDelay(); break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
328
1765
29913c011d50 normal size
pontscho
parents: 1751
diff changeset
329 case evNormalSize:
29913c011d50 normal size
pontscho
parents: 1751
diff changeset
330 if ( mplShMem->Playing )
29913c011d50 normal size
pontscho
parents: 1751
diff changeset
331 {
29913c011d50 normal size
pontscho
parents: 1751
diff changeset
332 appMPlayer.subWindow.isFullScreen=True;
1769
bd8c6c1b91ce eh. double screen size fix.
pontscho
parents: 1765
diff changeset
333 appMPlayer.subWindow.OldX=( wsMaxX - moviewidth ) / 2;
bd8c6c1b91ce eh. double screen size fix.
pontscho
parents: 1765
diff changeset
334 appMPlayer.subWindow.OldY=( wsMaxY - movieheight ) / 2;
1765
29913c011d50 normal size
pontscho
parents: 1751
diff changeset
335 appMPlayer.subWindow.OldWidth=moviewidth; appMPlayer.subWindow.OldHeight=movieheight;
29913c011d50 normal size
pontscho
parents: 1751
diff changeset
336 wsFullScreen( &appMPlayer.subWindow );
29913c011d50 normal size
pontscho
parents: 1751
diff changeset
337 mplResize( appMPlayer.subWindow.X,appMPlayer.subWindow.Y,moviewidth,movieheight );
29913c011d50 normal size
pontscho
parents: 1751
diff changeset
338 }
29913c011d50 normal size
pontscho
parents: 1751
diff changeset
339 break;
1769
bd8c6c1b91ce eh. double screen size fix.
pontscho
parents: 1765
diff changeset
340 case evDoubleSize:
bd8c6c1b91ce eh. double screen size fix.
pontscho
parents: 1765
diff changeset
341 if ( mplShMem->Playing )
bd8c6c1b91ce eh. double screen size fix.
pontscho
parents: 1765
diff changeset
342 {
bd8c6c1b91ce eh. double screen size fix.
pontscho
parents: 1765
diff changeset
343 appMPlayer.subWindow.isFullScreen=True;
bd8c6c1b91ce eh. double screen size fix.
pontscho
parents: 1765
diff changeset
344 appMPlayer.subWindow.OldX=( wsMaxX - moviewidth * 2 ) / 2;
bd8c6c1b91ce eh. double screen size fix.
pontscho
parents: 1765
diff changeset
345 appMPlayer.subWindow.OldY=( wsMaxY - movieheight * 2 ) / 2;
bd8c6c1b91ce eh. double screen size fix.
pontscho
parents: 1765
diff changeset
346 appMPlayer.subWindow.OldWidth=moviewidth * 2; appMPlayer.subWindow.OldHeight=movieheight * 2;
bd8c6c1b91ce eh. double screen size fix.
pontscho
parents: 1765
diff changeset
347 wsFullScreen( &appMPlayer.subWindow );
bd8c6c1b91ce eh. double screen size fix.
pontscho
parents: 1765
diff changeset
348 mplResize( appMPlayer.subWindow.X,appMPlayer.subWindow.Y,moviewidth,movieheight );
bd8c6c1b91ce eh. double screen size fix.
pontscho
parents: 1765
diff changeset
349 }
bd8c6c1b91ce eh. double screen size fix.
pontscho
parents: 1765
diff changeset
350 break;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
351
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
352 // --- timer events
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
353 case evHideMouseCursor:
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
354 wsVisibleMouse( &appMPlayer.subWindow,wsHideMouseCursor );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
355 break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
356 case evRedraw:
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
357 mplMainRender=1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
358 wsPostRedisplay( &appMPlayer.mainWindow );
1729
d6c99f70449e fix hprogressbar
pontscho
parents: 1723
diff changeset
359 // if ( !mplShMem->Playing )
d6c99f70449e fix hprogressbar
pontscho
parents: 1723
diff changeset
360 wsPostRedisplay( &appMPlayer.subWindow );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
361 XFlush( wsDisplay );
1729
d6c99f70449e fix hprogressbar
pontscho
parents: 1723
diff changeset
362 mplRedrawTimer=mplRedrawTimerConst;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
363 break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
364 case evGeneralTimer:
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
365 if ( mplMainAutoPlay )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
366 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
367 mplMainRender=1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
368 mplMainAutoPlay=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
369 mplPlay();
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
370 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
371 break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
372 // --- system events
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
373 case evNone:
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
374 dbprintf( 1,"[mw] event none received.\n" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
375 break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
376 default:
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
377 dbprintf( 1,"[mw] unknown event received ( %d,%.2f ).\n",msg,param );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
378 break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
379 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
380 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
381
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
382 void mplMainMouseHandle( int Button,int X,int Y,int RX,int RY )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
383 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
384 static int itemtype = 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
385 static int SelectedButton = -1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
386 wItem * item = NULL;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
387 float value = 0.0f;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
388 wsVisibleMouse( &appMPlayer.subWindow,wsShowMouseCursor );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
389 switch ( Button )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
390 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
391 case wsPRMouseButton:
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
392 mplShowMenu( RX,RY );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
393 msButton=wsPRMouseButton;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
394 break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
395 case wsRRMouseButton:
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
396 mplHideMenu( RX,RY );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
397 msButton=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
398 break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
399 case wsPLMouseButton:
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
400 sx=X; sy=Y;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
401 boxMoved=1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
402 msButton=wsPLMouseButton;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
403 for ( i=0;i < appMPlayer.NumberOfItems + 1;i++ )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
404 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
405 item=&appMPlayer.Items[i];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
406 if ( item->pressed != btnDisabled )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
407 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
408 switch( item->type )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
409 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
410 case itButton:
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
411 if ( wgIsRect( X,Y,
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
412 item->x,item->y,
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
413 item->x+item->width,item->y+item->height ) )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
414 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
415 item->pressed=btnPressed;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
416 mplMainRender=1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
417 SelectedButton=i;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
418 msButton=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
419 boxMoved=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
420 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
421 if ( ( SelectedButton > -1 ) &&
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
422 ( ( ( appMPlayer.Items[SelectedButton].msg == evPlaySwitchToPause && item->msg == evPauseSwitchToPlay ) ) ||
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
423 ( ( appMPlayer.Items[SelectedButton].msg == evPauseSwitchToPlay && item->msg == evPlaySwitchToPause ) ) ) )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
424 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
425 appMPlayer.Items[SelectedButton].pressed=btnDisabled;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
426 SelectedButton=i;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
427 appMPlayer.Items[SelectedButton].pressed=btnPressed;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
428 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
429 itemtype=itButton;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
430 break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
431 case itPotmeter:
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
432 if ( wgIsRect( X,Y,
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
433 item->x,item->y,
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
434 item->x+item->width,item->y+item->height ) )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
435 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
436 item->pressed=btnPressed;
1729
d6c99f70449e fix hprogressbar
pontscho
parents: 1723
diff changeset
437 item->used=1;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
438 mplMainRender=1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
439 SelectedButton=i;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
440 boxMoved=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
441 msButton=itPotmeter;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
442 itemtype=itPotmeter;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
443 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
444 break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
445 case itHPotmeter:
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
446 if ( wgIsRect( X,Y,
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
447 item->x,item->y,
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
448 item->x+item->width,item->y+item->height ) )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
449 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
450 item->pressed=btnPressed;
1729
d6c99f70449e fix hprogressbar
pontscho
parents: 1723
diff changeset
451 item->used=1;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
452 mplMainRender=1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
453 SelectedButton=i;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
454 boxMoved=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
455 msButton=itHPotmeter;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
456 itemtype=itHPotmeter;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
457 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
458 break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
459 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
460 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
461 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
462 break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
463 case wsMoveMouse:
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
464 item=&appMPlayer.Items[SelectedButton];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
465 switch ( msButton )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
466 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
467 case wsPLMouseButton:
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
468 wsMoveWindow( &appMPlayer.mainWindow,RX - abs( sx ),RY - abs( sy ) );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
469 mplMainRender=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
470 break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
471 case wsPRMouseButton:
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
472 mplMenuMouseHandle( X,Y,RX,RY );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
473 break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
474 case itPotmeter:
1729
d6c99f70449e fix hprogressbar
pontscho
parents: 1723
diff changeset
475 item->value=(float)( X - item->x ) / item->width * 100.0f;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
476 goto potihandled;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
477 case itHPotmeter:
1729
d6c99f70449e fix hprogressbar
pontscho
parents: 1723
diff changeset
478 item->value=(float)( X - item->x ) / item->width * 100.0f;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
479 potihandled:
1750
5041d1bf251e fix poti
pontscho
parents: 1744
diff changeset
480 if ( item->value > 100.0f ) item->value=100.0f;
5041d1bf251e fix poti
pontscho
parents: 1744
diff changeset
481 if ( item->value < 0.0f ) item->value=0.0f;
1773
pontscho
parents: 1769
diff changeset
482 // if ( ( item->msg == evSetVolume )||( item->msg == evSetBalance ) )
pontscho
parents: 1769
diff changeset
483 mplMsgHandle( item->msg,item->value );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
484 mplMainRender=1; wsPostRedisplay( &appMPlayer.mainWindow );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
485 break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
486 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
487 break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
488 case wsRLMouseButton:
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
489 msButton=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
490 boxMoved=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
491 item=&appMPlayer.Items[SelectedButton];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
492 item->pressed=btnReleased;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
493 switch( itemtype )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
494 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
495 case itButton:
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
496 if ( wgIsRect( X,Y,
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
497 item->x,item->y,
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
498 item->x+item->width,item->y+item->height ) ) value=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
499 break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
500 case itPotmeter:
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
501 case itHPotmeter:
1729
d6c99f70449e fix hprogressbar
pontscho
parents: 1723
diff changeset
502 item->used=0;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
503 btnModify( item->msg,(float)( X - item->x ) / item->width * 100.0f );
1729
d6c99f70449e fix hprogressbar
pontscho
parents: 1723
diff changeset
504 value=item->value;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
505 break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
506 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
507 if ( SelectedButton != -1 ) mplMsgHandle( item->msg,value );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
508 SelectedButton=-1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
509 mplMainRender=1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
510 itemtype=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
511 break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
512 case wsPMMouseButton: break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
513 case wsRMMouseButton: break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
514 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
515 if ( Button != wsMoveMouse ) wsPostRedisplay( &appMPlayer.mainWindow );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
516 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
517
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
518 int keyPressed = 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
519
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
520 void mplMainKeyHandle( int State,int Type,int Key )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
521 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
522 int msg = evNone;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
523 switch ( Key )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
524 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
525 case '.':
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
526 case '>': msg=evNext; break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
527 case ',':
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
528 case '<': msg=evPrev; break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
529
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
530 case wsx:
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
531 case wsX:
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
532 case wsEscape: msg=evExit; break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
533
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
534 case wsUp: msg=evForward1min; break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
535 case wsDown: msg=evBackward1min; break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
536 case wsRight: msg=evForward10sec; break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
537 case wsLeft: msg=evBackward10sec; break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
538
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
539 case wsGrayMul: msg=evIncVolume; break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
540 case wsGrayDiv: msg=evDecVolume; break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
541
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
542 case wsEnter: msg=evPlay; break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
543 case wsSpace: msg=evPause; break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
544 case wsa:
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
545 case wsA: msg=evAbout; break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
546 case wsb:
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
547 case wsB: msg=evSkinBrowser; break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
548 case wse:
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
549 case wsE: msg=evEqualeaser; break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
550 case wsf:
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
551 case wsF: msg=evFullScreen; break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
552 case wsl:
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
553 case wsL: msg=evLoad; break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
554 case wsm:
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
555 case wsM: msg=evMute; break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
556 case wss:
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
557 case wsS: msg=evStop; break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
558 case wsp:
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
559 case wsP: msg=evPlayList; break;
1784
e9ea2e9cf854 key handling fix
pontscho
parents: 1777
diff changeset
560 default: mplayer_put_key( Key ); return;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
561 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
562 if ( ( msg != evNone )&&( Type == wsKeyPressed ) )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
563 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
564 mplMsgHandle( msg,0 );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
565 mplMainRender=1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
566 wsPostRedisplay( &appMPlayer.mainWindow );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
567 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
568 }