Mercurial > mplayer.hg
annotate Gui/app.c @ 8744:f3c6f022d6b0
10l ;)
author | colin |
---|---|
date | Fri, 03 Jan 2003 18:33:26 +0000 |
parents | ef8c992672f4 |
children | d07ab8e088a9 |
rev | line source |
---|---|
8043 | 1 |
1693 | 2 |
3 #include <stdlib.h> | |
4 #include <stdio.h> | |
5 #include <string.h> | |
6 | |
3586 | 7 #include "../config.h" |
8 #include "../mp_msg.h" | |
9 #include "../help_mp.h" | |
10 | |
1693 | 11 #include "app.h" |
12 #include "wm/wskeys.h" | |
13 #include "skin/skin.h" | |
14 #include "mplayer/mplayer.h" | |
4979 | 15 #include "interface.h" |
1693 | 16 |
8043 | 17 evName evNames[] = |
18 { | |
19 { evNone, "evNone" }, | |
20 { evPlay, "evPlay" }, | |
21 { evStop, "evStop" }, | |
22 { evPause, "evPause" }, | |
23 { evPrev, "evPrev" }, | |
24 { evNext, "evNext" }, | |
25 { evLoad, "evLoad" }, | |
26 { evEqualizer, "evEqualizer" }, | |
27 { evEqualizer, "evEqualeaser" }, | |
28 { evPlayList, "evPlaylist" }, | |
29 { evExit, "evExit" }, | |
30 { evIconify, "evIconify" }, | |
31 { evIncBalance, "evIncBalance" }, | |
32 { evDecBalance, "evDecBalance" }, | |
33 { evFullScreen, "evFullScreen" }, | |
34 { evFName, "evFName" }, | |
35 { evMovieTime, "evMovieTime" }, | |
36 { evAbout, "evAbout" }, | |
37 { evLoadPlay, "evLoadPlay" }, | |
38 { evPreferences, "evPreferences" }, | |
39 { evSkinBrowser, "evSkinBrowser" }, | |
40 { evBackward10sec, "evBackward10sec" }, | |
41 { evForward10sec, "evForward10sec" }, | |
42 { evBackward1min, "evBackward1min" }, | |
43 { evForward1min, "evForward1min" }, | |
44 { evBackward10min, "evBackward10min" }, | |
45 { evForward10min, "evForward10min" }, | |
46 { evIncVolume, "evIncVolume" }, | |
47 { evDecVolume, "evDecVolume" }, | |
48 { evMute, "evMute" }, | |
49 { evIncAudioBufDelay, "evIncAudioBufDelay" }, | |
50 { evDecAudioBufDelay, "evDecAudioBufDelay" }, | |
51 { evPlaySwitchToPause, "evPlaySwitchToPause" }, | |
52 { evPauseSwitchToPlay, "evPauseSwitchToPlay" }, | |
53 { evNormalSize, "evNormalSize" }, | |
54 { evDoubleSize, "evDoubleSize" }, | |
55 { evSetMoviePosition, "evSetMoviePosition" }, | |
56 { evSetVolume, "evSetVolume" }, | |
57 { evSetBalance, "evSetBalance" }, | |
58 { evHelp, "evHelp" }, | |
59 { evLoadSubtitle, "evLoadSubtitle" }, | |
60 { evPlayDVD, "evPlayDVD" }, | |
61 { evPlayVCD, "evPlayVCD" }, | |
62 { evSetURL, "evSetURL" }, | |
63 { evLoadAudioFile, "evLoadAudioFile" }, | |
64 { evDropSubtitle, "evDropSubtitle" }, | |
8312
ef8c992672f4
- audio track handling in menu (idea from R¸«ädiger Kuhlmann)
pontscho
parents:
8300
diff
changeset
|
65 { evSetAspect, "evSetAspect" }, |
ef8c992672f4
- audio track handling in menu (idea from R¸«ädiger Kuhlmann)
pontscho
parents:
8300
diff
changeset
|
66 { evSetAudio, "evSetAudio" } |
8043 | 67 }; |
68 | |
69 int evBoxs = sizeof( evNames ) / sizeof( evName ); | |
70 | |
71 // --- | |
72 | |
7092
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
6218
diff
changeset
|
73 extern char *get_path(char *); |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
6218
diff
changeset
|
74 |
1693 | 75 listItems appMPlayer; |
76 | |
77 char * skinDirInHome=NULL; | |
78 char * skinMPlayerDir=NULL; | |
1866
32b1bb50a0e8
some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents:
1823
diff
changeset
|
79 char * skinName = NULL; |
1693 | 80 |
81 void appClearItem( wItem * item ) | |
82 { | |
83 item->type=0; | |
84 // --- | |
85 item->x=0; item->y=0; item->width=0; item->height=0; | |
86 // --- | |
87 item->px=0; item->py=0; item->psx=0; item->psy=0; | |
88 // --- | |
89 item->msg=0; item->msg2=0; | |
4979 | 90 item->pressed=btnReleased; |
1693 | 91 item->tmp=0; |
92 item->key=0; item->key2=0; | |
93 item->Bitmap.Width=0; item->Bitmap.Height=0; item->Bitmap.BPP=0; item->Bitmap.ImageSize=0; | |
4979 | 94 if ( item->Bitmap.Image ) free( item->Bitmap.Image ); |
95 item->Bitmap.Image=NULL; | |
1693 | 96 // --- |
97 item->fontid=0; | |
98 if ( item->label ) free( item->label ); item->label=NULL; | |
99 item->event=0; | |
100 } | |
101 | |
102 void appCopy( listItems * dest,listItems * source ) | |
103 { | |
104 dest->NumberOfItems=source->NumberOfItems; | |
105 memcpy( &dest->Items,&source->Items,128 * sizeof( wItem ) ); | |
106 | |
107 dest->NumberOfMenuItems=source->NumberOfMenuItems; | |
108 memcpy( &dest->MenuItems,&source->MenuItems,32 * sizeof( wItem ) ); | |
109 | |
110 memcpy( &dest->main,&source->main,sizeof( wItem ) ); | |
111 memcpy( &dest->sub,&source->sub,sizeof( wItem ) ); | |
112 memcpy( &dest->eq,&source->eq,sizeof( wItem ) ); | |
113 memcpy( &dest->menuBase,&source->menuBase,sizeof( wItem ) ); | |
114 memcpy( &dest->menuSelected,&source->menuSelected,sizeof( wItem ) ); | |
115 } | |
116 | |
117 void appInitStruct( listItems * item ) | |
118 { | |
119 int i; | |
120 for ( i=0;i<item->NumberOfItems;i++ ) | |
121 appClearItem( &item->Items[i] ); | |
122 for ( i=0;i<item->NumberOfMenuItems;i++ ) | |
123 appClearItem( &item->MenuItems[i] ); | |
124 | |
125 item->NumberOfItems=-1; | |
126 memset( item->Items,0,128 * sizeof( wItem ) ); | |
127 item->NumberOfMenuItems=-1; | |
128 memset( item->MenuItems,0,32 * sizeof( wItem ) ); | |
129 | |
130 appClearItem( &item->main ); | |
1866
32b1bb50a0e8
some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents:
1823
diff
changeset
|
131 item->mainDecoration=0; |
1693 | 132 appClearItem( &item->sub ); |
1823 | 133 item->sub.Bitmap.Width=384; item->sub.Bitmap.Height=384; |
134 item->sub.width=384; item->sub.height=384; | |
135 item->sub.x=-1; item->sub.y=-1; | |
1693 | 136 appClearItem( &item->menuBase ); |
137 appClearItem( &item->menuSelected ); | |
138 item->subR=0; | |
139 item->subG=0; | |
140 item->subB=0; | |
141 } | |
142 | |
143 int appFindKey( unsigned char * name ) | |
144 { | |
145 int i; | |
146 for ( i=0;i<wsKeyNumber;i++ ) | |
147 if ( !strcmp( wsKeyNames[i].name,name ) ) return wsKeyNames[i].code; | |
148 return -1; | |
149 } | |
150 | |
151 int appFindMessage( unsigned char * str ) | |
152 { | |
153 int i; | |
154 for ( i=0;i<evBoxs;i++ ) | |
155 if ( !strcmp( evNames[i].name,str ) ) return evNames[i].msg; | |
156 return -1; | |
157 } | |
8280
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
158 |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
159 void btnModify( int event,float state ) |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
160 { |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
161 int j; |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
162 for ( j=0;j<appMPlayer.NumberOfItems + 1;j++ ) |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
163 if ( appMPlayer.Items[j].msg == event ) |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
164 { |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
165 switch ( appMPlayer.Items[j].type ) |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
166 { |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
167 case itButton: |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
168 appMPlayer.Items[j].pressed=(int)state; |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
169 appMPlayer.Items[j].tmp=(int)state; |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
170 break; |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
171 case itPotmeter: |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
172 case itHPotmeter: |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
173 if ( state < 0.0f ) state=0.0f; |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
174 if ( state > 100.f ) state=100.0f; |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
175 appMPlayer.Items[j].value=state; |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
176 break; |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
177 } |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
178 } |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
179 } |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
180 |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
181 float btnGetValue( int event ) |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
182 { |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
183 int j; |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
184 for ( j=0;j<appMPlayer.NumberOfItems + 1;j++ ) |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
185 if ( appMPlayer.Items[j].msg == event ) return appMPlayer.Items[j].value; |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
186 return 0; |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
187 } |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
188 |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
189 void btnSet( int event,int set ) |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
190 { |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
191 int j; |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
192 for ( j=0;j<appMPlayer.NumberOfItems + 1;j++ ) |
8300 | 193 if ( appMPlayer.Items[j].msg == event ) appMPlayer.Items[j].pressed=set; |
8280
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
194 } |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
195 |