annotate Gui/mplayer/common.c @ 22962:f9a5e58f9f40

Revert previous broken removal of partial dependency list.
author diego
date Thu, 12 Apr 2007 14:42:48 +0000
parents 8c2056711a2a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8973
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
1
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
2 // main window
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
3
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
4 #include <stdlib.h>
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
5 #include <stdio.h>
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
6 #include <inttypes.h>
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
7 #include <sys/stat.h>
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
8 #include <unistd.h>
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
9
17144
0e1471d9da74 Unify include paths, -I.. is in CFLAGS.
diego
parents: 13181
diff changeset
10 #include "app.h"
0e1471d9da74 Unify include paths, -I.. is in CFLAGS.
diego
parents: 13181
diff changeset
11 #include "skin/font.h"
0e1471d9da74 Unify include paths, -I.. is in CFLAGS.
diego
parents: 13181
diff changeset
12 #include "skin/skin.h"
0e1471d9da74 Unify include paths, -I.. is in CFLAGS.
diego
parents: 13181
diff changeset
13 #include "wm/ws.h"
8973
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
14
17144
0e1471d9da74 Unify include paths, -I.. is in CFLAGS.
diego
parents: 13181
diff changeset
15 #include "../config.h"
0e1471d9da74 Unify include paths, -I.. is in CFLAGS.
diego
parents: 13181
diff changeset
16 #include "../help_mp.h"
0e1471d9da74 Unify include paths, -I.. is in CFLAGS.
diego
parents: 13181
diff changeset
17 #include "../libvo/x11_common.h"
0e1471d9da74 Unify include paths, -I.. is in CFLAGS.
diego
parents: 13181
diff changeset
18 #include "../libvo/fastmemcpy.h"
8973
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
19
19271
64d82a45a05d introduce new 'stream' directory for all stream layer related components and split them from libmpdemux
ben
parents: 18976
diff changeset
20 #include "../stream/stream.h"
17144
0e1471d9da74 Unify include paths, -I.. is in CFLAGS.
diego
parents: 13181
diff changeset
21 #include "../mixer.h"
0e1471d9da74 Unify include paths, -I.. is in CFLAGS.
diego
parents: 13181
diff changeset
22 #include "../libvo/sub.h"
8973
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
23
17144
0e1471d9da74 Unify include paths, -I.. is in CFLAGS.
diego
parents: 13181
diff changeset
24 #include "../libmpdemux/demuxer.h"
0e1471d9da74 Unify include paths, -I.. is in CFLAGS.
diego
parents: 13181
diff changeset
25 #include "../libmpdemux/stheader.h"
0e1471d9da74 Unify include paths, -I.. is in CFLAGS.
diego
parents: 13181
diff changeset
26 #include "../codec-cfg.h"
8973
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
27
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
28
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
29 #include "play.h"
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
30 #include "widgets.h"
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
31
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
32 extern unsigned int GetTimerMS( void );
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
33
12646
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
34 inline void TranslateFilename( int c,char * tmp,size_t tmplen )
8973
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
35 {
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
36 int i;
12646
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
37 char * p;
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
38
8973
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
39 switch ( guiIntfStruct.StreamType )
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
40 {
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
41 case STREAMTYPE_STREAM:
12646
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
42 strlcpy(tmp, guiIntfStruct.Filename, tmplen);
8973
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
43 break;
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
44 case STREAMTYPE_FILE:
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
45 if ( ( guiIntfStruct.Filename )&&( guiIntfStruct.Filename[0] ) )
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
46 {
13181
12176045ccf9 small gcc warning fix
rathann
parents: 12693
diff changeset
47 if ( (p = strrchr(guiIntfStruct.Filename, '/')) )
12646
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
48 strlcpy(tmp, p + 1, tmplen);
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
49 else
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
50 strlcpy(tmp, guiIntfStruct.Filename, tmplen);
8973
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
51 if ( tmp[strlen( tmp ) - 4] == '.' ) tmp[strlen( tmp ) - 4]=0;
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
52 if ( tmp[strlen( tmp ) - 5] == '.' ) tmp[strlen( tmp ) - 5]=0;
12646
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
53 } else strlcpy( tmp,MSGTR_NoFileLoaded,tmplen );
8973
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
54 break;
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
55 #ifdef USE_DVDREAD
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
56 case STREAMTYPE_DVD:
12646
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
57 if ( guiIntfStruct.DVD.current_chapter ) snprintf(tmp,tmplen,MSGTR_Chapter,guiIntfStruct.DVD.current_chapter );
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
58 else strlcat( tmp,MSGTR_NoChapter,tmplen );
8973
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
59 break;
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
60 #endif
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
61 #ifdef HAVE_VCD
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
62 case STREAMTYPE_VCD:
12646
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
63 snprintf( tmp,tmplen,MSGTR_VCDTrack,guiIntfStruct.Track );
8973
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
64 break;
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
65 #endif
12646
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
66 default: strlcpy( tmp,MSGTR_NoMediaOpened,tmplen );
8973
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
67 }
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
68 if ( c )
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
69 {
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
70 for ( i=0;i < (int)strlen( tmp );i++ )
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
71 {
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
72 int t=0;
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
73 if ( c == 1 ) { if ( ( tmp[i] >= 'A' )&&( tmp[i] <= 'Z' ) ) t=32; }
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
74 if ( c == 2 ) { if ( ( tmp[i] >= 'a' )&&( tmp[i] <= 'z' ) ) t=-32; }
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
75 tmp[i]=(char)( tmp[i] + t );
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
76 }
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
77 }
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
78 }
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
79
12646
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
80 /* Unsafe! Pass only null-terminated strings as (char *)str. */
8973
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
81 char * Translate( char * str )
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
82 {
22286
a7e5b99ac083 Fix GUI compilation
uau
parents: 19271
diff changeset
83 mixer_t *mixer = mpctx_get_mixer(guiIntfStruct.mpcontext);
8973
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
84 static char trbuf[512];
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
85 char tmp[512];
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
86 int i,c;
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
87 int t;
12646
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
88 int strsize = 0;
8973
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
89 memset( trbuf,0,512 );
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
90 memset( tmp,0,128 );
12646
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
91 strsize = strlen(str);
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
92 for ( c=0,i=0;i < strsize;i++ )
8973
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
93 {
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
94 if ( str[i] != '$' ) { trbuf[c++]=str[i]; trbuf[c]=0; }
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
95 else
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
96 {
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
97 switch ( str[++i] )
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
98 {
12646
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
99 case 't': snprintf( tmp,sizeof( tmp ),"%02d",guiIntfStruct.Track );
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
100 strlcat( trbuf,tmp,sizeof( trbuf ) ); break;
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
101 case 'o': TranslateFilename( 0,tmp,sizeof( tmp ) );
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
102 strlcat( trbuf,tmp,sizeof( trbuf ) ); break;
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
103 case 'f': TranslateFilename( 1,tmp,sizeof( tmp ) );
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
104 strlcat( trbuf,tmp,sizeof( trbuf ) ); break;
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
105 case 'F': TranslateFilename( 2,tmp,sizeof( tmp ) );
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
106 strlcat( trbuf,tmp,sizeof( trbuf ) ); break;
8973
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
107 case '6': t=guiIntfStruct.LengthInSec; goto calclengthhhmmss;
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
108 case '1': t=guiIntfStruct.TimeSec;
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
109 calclengthhhmmss:
12646
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
110 snprintf( tmp,sizeof( tmp ),"%02d:%02d:%02d",t/3600,t/60%60,t%60 );
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
111 strlcat( trbuf,tmp,sizeof( trbuf ) );
8973
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
112 break;
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
113 case '7': t=guiIntfStruct.LengthInSec; goto calclengthmmmmss;
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
114 case '2': t=guiIntfStruct.TimeSec;
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
115 calclengthmmmmss:
12646
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
116 snprintf( tmp,sizeof( tmp ),"%04d:%02d",t/60,t%60 );
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
117 strlcat( trbuf,tmp,sizeof( trbuf ) );
8973
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
118 break;
12646
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
119 case '3': snprintf( tmp,sizeof( tmp ),"%02d",guiIntfStruct.TimeSec / 3600 );
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
120 strlcat( trbuf,tmp,sizeof( trbuf ) ); break;
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
121 case '4': snprintf( tmp,sizeof( tmp ),"%02d",( ( guiIntfStruct.TimeSec / 60 ) % 60 ) );
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
122 strlcat( trbuf,tmp,sizeof( trbuf ) ); break;
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
123 case '5': snprintf( tmp,sizeof( tmp ),"%02d",guiIntfStruct.TimeSec % 60 );
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
124 strlcat( trbuf,tmp,sizeof( trbuf ) ); break;
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
125 case '8': snprintf( tmp,sizeof( tmp ),"%01d:%02d:%02d",guiIntfStruct.TimeSec / 3600,( guiIntfStruct.TimeSec / 60 ) % 60,guiIntfStruct.TimeSec % 60 ); strlcat( trbuf,tmp,sizeof( trbuf ) ); break;
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
126 case 'v': snprintf( tmp,sizeof( tmp ),"%3.2f%%",guiIntfStruct.Volume );
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
127 strlcat( trbuf,tmp,sizeof( trbuf ) ); break;
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
128 case 'V': snprintf( tmp,sizeof( tmp ),"%3.1f",guiIntfStruct.Volume );
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
129 strlcat( trbuf,tmp,sizeof( trbuf ) ); break;
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
130 case 'b': snprintf( tmp,sizeof( tmp ),"%3.2f%%",guiIntfStruct.Balance );
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
131 strlcat( trbuf,tmp,sizeof( trbuf ) ); break;
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
132 case 'B': snprintf( tmp,sizeof( tmp ),"%3.1f",guiIntfStruct.Balance );
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
133 strlcat( trbuf,tmp,sizeof( trbuf ) ); break;
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
134 case 'd': snprintf( tmp,sizeof( tmp ),"%d",guiIntfStruct.FrameDrop );
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
135 strlcat( trbuf,tmp,sizeof( trbuf ) ); break;
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
136 case 'x': snprintf( tmp,sizeof( tmp ),"%d",guiIntfStruct.MovieWidth );
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
137 strlcat( trbuf,tmp,sizeof( trbuf ) ); break;
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
138 case 'y': snprintf( tmp,sizeof( tmp ),"%d",guiIntfStruct.MovieHeight );
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
139 strlcat( trbuf,tmp,sizeof( trbuf ) ); break;
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
140 case 'C': snprintf( tmp,sizeof( tmp ),"%s", guiIntfStruct.sh_video? ((sh_video_t *)guiIntfStruct.sh_video)->codec->name : "");
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
141 strlcat( trbuf,tmp,sizeof( trbuf ) ); break;
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
142 case 's': if ( guiIntfStruct.Playing == 0 ) strlcat( trbuf,"s",sizeof( trbuf ) ); break;
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
143 case 'l': if ( guiIntfStruct.Playing == 1 ) strlcat( trbuf,"p",sizeof( trbuf ) ); break;
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
144 case 'e': if ( guiIntfStruct.Playing == 2 ) strlcat( trbuf,"e",sizeof( trbuf ) ); break;
8973
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
145 case 'a':
22286
a7e5b99ac083 Fix GUI compilation
uau
parents: 19271
diff changeset
146 if ( mixer->muted ) { strlcat( trbuf,"n",sizeof( trbuf ) ); break; }
8973
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
147 switch ( guiIntfStruct.AudioType )
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
148 {
12646
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
149 case 0: strlcat( trbuf,"n",sizeof( trbuf ) ); break;
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
150 case 1: strlcat( trbuf,"m",sizeof( trbuf ) ); break;
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
151 case 2: strlcat( trbuf,"t",sizeof( trbuf ) ); break;
8973
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
152 }
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
153 break;
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
154 case 'T':
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
155 switch ( guiIntfStruct.StreamType )
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
156 {
12646
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
157 case STREAMTYPE_FILE: strlcat( trbuf,"f",sizeof( trbuf ) ); break;
8973
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
158 #ifdef HAVE_VCD
12646
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
159 case STREAMTYPE_VCD: strlcat( trbuf,"v",sizeof( trbuf ) ); break;
8973
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
160 #endif
12646
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
161 case STREAMTYPE_STREAM: strlcat( trbuf,"u",sizeof( trbuf ) ); break;
8973
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
162 #ifdef USE_DVDREAD
12646
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
163 case STREAMTYPE_DVD: strlcat( trbuf,"d",sizeof( trbuf ) ); break;
8973
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
164 #endif
12646
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
165 default: strlcat( trbuf," ",sizeof( trbuf ) ); break;
8973
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
166 }
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
167 break;
12646
9a495bdc3a1e string handling security fixes
diego
parents: 12522
diff changeset
168 case '$': strlcat( trbuf,"$",sizeof( trbuf ) ); break;
8973
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
169 default: continue;
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
170 }
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
171 c=strlen( trbuf );
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
172 }
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
173 }
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
174 return trbuf;
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
175 }
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
176
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
177 static char * image_buffer = NULL;
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
178 static int image_width = 0;
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
179
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
180 void PutImage( txSample * bf,int x,int y,int max,int ofs )
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
181 {
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
182 int i=0,ix,iy;
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
183 uint32_t * buf = NULL;
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
184 uint32_t * drw = NULL;
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
185 register uint32_t tmp;
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
186 register uint32_t yc;
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
187
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
188 if ( ( !bf )||( bf->Image == NULL ) ) return;
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
189
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
190 i=( bf->Width * ( bf->Height / max ) ) * ofs;
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
191 buf=(uint32_t *)image_buffer;
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
192 drw=(uint32_t *)bf->Image;
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
193
9191
21920dfcc37c workaround one possible sig11
pontscho
parents: 8973
diff changeset
194 #if 1
8973
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
195 for ( iy=y;iy < (int)(y+bf->Height / max);iy++ )
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
196 for ( ix=x;ix < (int)(x+bf->Width);ix++ )
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
197 {
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
198 tmp=drw[i++];
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
199 if ( tmp != 0x00ff00ff ) buf[iy * image_width + ix]=tmp;
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
200 }
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
201 #else
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
202 yc=y * image_width;
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
203 for ( iy=y;iy < (int)(y+bf->Height / max);iy++ )
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
204 {
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
205 for ( ix=x;ix < (int)(x+bf->Width);ix++ )
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
206 {
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
207 tmp=drw[i++];
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
208 if ( tmp != 0x00ff00ff ) buf[yc + ix]=tmp;
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
209 }
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
210 yc+=image_width;
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
211 }
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
212 #endif
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
213 }
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
214
12693
eb996ecdfcd5 simple, smooth, ram-saving dynamic potmeter, which feature is required by the tvisor skin, patch by Andre Kuhne
alex
parents: 12691
diff changeset
215 void SimplePotmeterPutImage( txSample * bf,int x,int y,float frac )
eb996ecdfcd5 simple, smooth, ram-saving dynamic potmeter, which feature is required by the tvisor skin, patch by Andre Kuhne
alex
parents: 12691
diff changeset
216 {
eb996ecdfcd5 simple, smooth, ram-saving dynamic potmeter, which feature is required by the tvisor skin, patch by Andre Kuhne
alex
parents: 12691
diff changeset
217 int i=0,w,r,ix,iy;
eb996ecdfcd5 simple, smooth, ram-saving dynamic potmeter, which feature is required by the tvisor skin, patch by Andre Kuhne
alex
parents: 12691
diff changeset
218 uint32_t * buf = NULL;
eb996ecdfcd5 simple, smooth, ram-saving dynamic potmeter, which feature is required by the tvisor skin, patch by Andre Kuhne
alex
parents: 12691
diff changeset
219 uint32_t * drw = NULL;
eb996ecdfcd5 simple, smooth, ram-saving dynamic potmeter, which feature is required by the tvisor skin, patch by Andre Kuhne
alex
parents: 12691
diff changeset
220 register uint32_t tmp;
eb996ecdfcd5 simple, smooth, ram-saving dynamic potmeter, which feature is required by the tvisor skin, patch by Andre Kuhne
alex
parents: 12691
diff changeset
221
eb996ecdfcd5 simple, smooth, ram-saving dynamic potmeter, which feature is required by the tvisor skin, patch by Andre Kuhne
alex
parents: 12691
diff changeset
222 if ( ( !bf )||( bf->Image == NULL ) ) return;
eb996ecdfcd5 simple, smooth, ram-saving dynamic potmeter, which feature is required by the tvisor skin, patch by Andre Kuhne
alex
parents: 12691
diff changeset
223
eb996ecdfcd5 simple, smooth, ram-saving dynamic potmeter, which feature is required by the tvisor skin, patch by Andre Kuhne
alex
parents: 12691
diff changeset
224 buf=(uint32_t *)image_buffer;
eb996ecdfcd5 simple, smooth, ram-saving dynamic potmeter, which feature is required by the tvisor skin, patch by Andre Kuhne
alex
parents: 12691
diff changeset
225 drw=(uint32_t *)bf->Image;
eb996ecdfcd5 simple, smooth, ram-saving dynamic potmeter, which feature is required by the tvisor skin, patch by Andre Kuhne
alex
parents: 12691
diff changeset
226 w=bf->Width*frac;
eb996ecdfcd5 simple, smooth, ram-saving dynamic potmeter, which feature is required by the tvisor skin, patch by Andre Kuhne
alex
parents: 12691
diff changeset
227 r=bf->Width-w;
eb996ecdfcd5 simple, smooth, ram-saving dynamic potmeter, which feature is required by the tvisor skin, patch by Andre Kuhne
alex
parents: 12691
diff changeset
228 for ( iy=y;iy < (int)(y+bf->Height);iy++ )
eb996ecdfcd5 simple, smooth, ram-saving dynamic potmeter, which feature is required by the tvisor skin, patch by Andre Kuhne
alex
parents: 12691
diff changeset
229 {
eb996ecdfcd5 simple, smooth, ram-saving dynamic potmeter, which feature is required by the tvisor skin, patch by Andre Kuhne
alex
parents: 12691
diff changeset
230 for ( ix=x;ix < (int)(x+w);ix++ )
eb996ecdfcd5 simple, smooth, ram-saving dynamic potmeter, which feature is required by the tvisor skin, patch by Andre Kuhne
alex
parents: 12691
diff changeset
231 {
eb996ecdfcd5 simple, smooth, ram-saving dynamic potmeter, which feature is required by the tvisor skin, patch by Andre Kuhne
alex
parents: 12691
diff changeset
232 tmp=drw[i++];
eb996ecdfcd5 simple, smooth, ram-saving dynamic potmeter, which feature is required by the tvisor skin, patch by Andre Kuhne
alex
parents: 12691
diff changeset
233 if ( tmp != 0x00ff00ff ) buf[iy * image_width + ix]=tmp;
eb996ecdfcd5 simple, smooth, ram-saving dynamic potmeter, which feature is required by the tvisor skin, patch by Andre Kuhne
alex
parents: 12691
diff changeset
234 }
eb996ecdfcd5 simple, smooth, ram-saving dynamic potmeter, which feature is required by the tvisor skin, patch by Andre Kuhne
alex
parents: 12691
diff changeset
235 i+=r;
eb996ecdfcd5 simple, smooth, ram-saving dynamic potmeter, which feature is required by the tvisor skin, patch by Andre Kuhne
alex
parents: 12691
diff changeset
236 }
eb996ecdfcd5 simple, smooth, ram-saving dynamic potmeter, which feature is required by the tvisor skin, patch by Andre Kuhne
alex
parents: 12691
diff changeset
237 }
eb996ecdfcd5 simple, smooth, ram-saving dynamic potmeter, which feature is required by the tvisor skin, patch by Andre Kuhne
alex
parents: 12691
diff changeset
238
8973
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
239 void Render( wsTWindow * window,wItem * Items,int nrItems,char * db,int size )
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
240 {
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
241 wItem * item;
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
242 txSample * image = NULL;
18976
6a08d0dabca8 Remove unused variables, patch by Stefan Huehner, stefan ##at## huehner org.
diego
parents: 17254
diff changeset
243 int i;
8973
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
244
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
245 image_buffer=db;
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
246 image_width=window->Width;
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
247
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
248 for( i=0;i < nrItems + 1;i++ )
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
249 {
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
250 item=&Items[i];
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
251 switch( item->type )
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
252 {
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
253 case itButton:
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
254 PutImage( &item->Bitmap,item->x,item->y,3,item->pressed );
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
255 break;
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
256 case itPotmeter:
12693
eb996ecdfcd5 simple, smooth, ram-saving dynamic potmeter, which feature is required by the tvisor skin, patch by Andre Kuhne
alex
parents: 12691
diff changeset
257 if (item->phases == 1)SimplePotmeterPutImage( &item->Bitmap,item->x,item->y, item->value / 100.0f );
eb996ecdfcd5 simple, smooth, ram-saving dynamic potmeter, which feature is required by the tvisor skin, patch by Andre Kuhne
alex
parents: 12691
diff changeset
258 else PutImage( &item->Bitmap,item->x,item->y,item->phases,( item->phases - 1 ) * ( item->value / 100.0f ) );
8973
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
259 break;
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
260 case itHPotmeter:
12693
eb996ecdfcd5 simple, smooth, ram-saving dynamic potmeter, which feature is required by the tvisor skin, patch by Andre Kuhne
alex
parents: 12691
diff changeset
261 if (item->phases == 1)SimplePotmeterPutImage( &item->Bitmap,item->x,item->y, item->value / 100.0f );
eb996ecdfcd5 simple, smooth, ram-saving dynamic potmeter, which feature is required by the tvisor skin, patch by Andre Kuhne
alex
parents: 12691
diff changeset
262 else PutImage( &item->Bitmap,item->x,item->y,item->phases,( item->phases - 1 ) * ( item->value / 100.0f ) );
8973
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
263 PutImage( &item->Mask,item->x + (int)( ( item->width - item->psx ) * item->value / 100.0f ),item->y,3,item->pressed );
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
264 break;
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
265 case itVPotmeter:
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
266 PutImage( &item->Bitmap,
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
267 item->x,item->y,
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
268 item->phases,
17254
0e152834911a vpotmeter fix, scroll in the correct direction
ods15
parents: 17144
diff changeset
269 item->phases * ( 1. - item->value / 100.0f ) );
8973
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
270 PutImage( &item->Mask,
17254
0e152834911a vpotmeter fix, scroll in the correct direction
ods15
parents: 17144
diff changeset
271 item->x,item->y + (int)( ( item->height - item->psy ) * ( 1. - item->value / 100.0f ) ),
8973
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
272 3,item->pressed );
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
273 break;
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
274 case itSLabel:
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
275 image=fntRender( item,0,"%s",item->label );
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
276 if ( image ) PutImage( image,item->x,item->y,1,0 );
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
277 case itDLabel:
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
278 {
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
279 char * t = Translate( item->label );
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
280 int l = fntTextWidth( item->fontid,t );
12685
b4587790a399 scroll strings from the left to right, patch by Andre Kuhne
alex
parents: 12646
diff changeset
281 l=(l?l:item->width);
b4587790a399 scroll strings from the left to right, patch by Andre Kuhne
alex
parents: 12646
diff changeset
282 image=fntRender( item,l-(GetTimerMS() / 20)%l,"%s",t );
8973
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
283 }
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
284 if ( image ) PutImage( image,item->x,item->y,1,0 );
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
285 break;
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
286 }
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
287 }
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
288 wsConvert( window,db,size );
0a665389cf2b - add playbar
pontscho
parents:
diff changeset
289 }