annotate gui/mplayer/gui_common.c @ 25744:7b9e015bca91

typo fix
author diego
date Wed, 16 Jan 2008 09:30:28 +0000
parents 01754b23193e
children 10dfbc523184
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
25603
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
1
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
2 // main window
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
3
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
4 #include <stdlib.h>
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
5 #include <stdio.h>
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
6 #include <inttypes.h>
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
7 #include <sys/stat.h>
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
8 #include <unistd.h>
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
9 #include <string.h>
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
10
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
11 #include "app.h"
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
12 #include "skin/font.h"
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
13 #include "skin/skin.h"
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
14 #include "wm/ws.h"
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
15
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
16 #include "../config.h"
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
17 #include "../help_mp.h"
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
18 #include "../libvo/x11_common.h"
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
19
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
20 #include "../stream/stream.h"
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
21 #include "../mixer.h"
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
22 #include "../libvo/sub.h"
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
23
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
24 #include "../libmpdemux/demuxer.h"
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
25 #include "../libmpdemux/stheader.h"
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
26 #include "../codec-cfg.h"
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
27 #include "../access_mpcontext.h"
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
28 #include "../libavutil/avstring.h"
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
29
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
30
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
31 #include "play.h"
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
32 #include "widgets.h"
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
33
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
34 extern unsigned int GetTimerMS( void );
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
35
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
36 inline void TranslateFilename( int c,char * tmp,size_t tmplen )
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
37 {
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
38 int i;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
39 char * p;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
40
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
41 switch ( guiIntfStruct.StreamType )
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
42 {
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
43 case STREAMTYPE_STREAM:
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
44 av_strlcpy(tmp, guiIntfStruct.Filename, tmplen);
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
45 break;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
46 case STREAMTYPE_FILE:
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
47 if ( ( guiIntfStruct.Filename )&&( guiIntfStruct.Filename[0] ) )
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
48 {
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
49 if ( (p = strrchr(guiIntfStruct.Filename, '/')) )
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
50 av_strlcpy(tmp, p + 1, tmplen);
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
51 else
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
52 av_strlcpy(tmp, guiIntfStruct.Filename, tmplen);
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
53 if ( tmp[strlen( tmp ) - 4] == '.' ) tmp[strlen( tmp ) - 4]=0;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
54 if ( tmp[strlen( tmp ) - 5] == '.' ) tmp[strlen( tmp ) - 5]=0;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
55 } else av_strlcpy( tmp,MSGTR_NoFileLoaded,tmplen );
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
56 break;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
57 #ifdef USE_DVDREAD
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
58 case STREAMTYPE_DVD:
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
59 if ( guiIntfStruct.DVD.current_chapter ) snprintf(tmp,tmplen,MSGTR_Chapter,guiIntfStruct.DVD.current_chapter );
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
60 else av_strlcat( tmp,MSGTR_NoChapter,tmplen );
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
61 break;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
62 #endif
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
63 #ifdef HAVE_VCD
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
64 case STREAMTYPE_VCD:
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
65 snprintf( tmp,tmplen,MSGTR_VCDTrack,guiIntfStruct.Track );
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
66 break;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
67 #endif
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
68 default: av_strlcpy( tmp,MSGTR_NoMediaOpened,tmplen );
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
69 }
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
70 if ( c )
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
71 {
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
72 for ( i=0;i < (int)strlen( tmp );i++ )
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
73 {
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
74 int t=0;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
75 if ( c == 1 ) { if ( ( tmp[i] >= 'A' )&&( tmp[i] <= 'Z' ) ) t=32; }
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
76 if ( c == 2 ) { if ( ( tmp[i] >= 'a' )&&( tmp[i] <= 'z' ) ) t=-32; }
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
77 tmp[i]=(char)( tmp[i] + t );
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
78 }
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
79 }
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
80 }
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
81
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
82 /* Unsafe! Pass only null-terminated strings as (char *)str. */
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
83 char * Translate( char * str )
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
84 {
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
85 mixer_t *mixer = mpctx_get_mixer(guiIntfStruct.mpcontext);
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
86 static char trbuf[512];
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
87 char tmp[512];
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
88 int i,c;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
89 int t;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
90 int strsize = 0;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
91 memset( trbuf,0,512 );
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
92 memset( tmp,0,128 );
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
93 strsize = strlen(str);
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
94 for ( c=0,i=0;i < strsize;i++ )
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
95 {
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
96 if ( str[i] != '$' ) { trbuf[c++]=str[i]; trbuf[c]=0; }
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
97 else
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
98 {
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
99 switch ( str[++i] )
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
100 {
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
101 case 't': snprintf( tmp,sizeof( tmp ),"%02d",guiIntfStruct.Track );
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
102 av_strlcat( trbuf,tmp,sizeof( trbuf ) ); break;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
103 case 'o': TranslateFilename( 0,tmp,sizeof( tmp ) );
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
104 av_strlcat( trbuf,tmp,sizeof( trbuf ) ); break;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
105 case 'f': TranslateFilename( 1,tmp,sizeof( tmp ) );
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
106 av_strlcat( trbuf,tmp,sizeof( trbuf ) ); break;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
107 case 'F': TranslateFilename( 2,tmp,sizeof( tmp ) );
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
108 av_strlcat( trbuf,tmp,sizeof( trbuf ) ); break;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
109 case '6': t=guiIntfStruct.LengthInSec; goto calclengthhhmmss;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
110 case '1': t=guiIntfStruct.TimeSec;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
111 calclengthhhmmss:
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
112 snprintf( tmp,sizeof( tmp ),"%02d:%02d:%02d",t/3600,t/60%60,t%60 );
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
113 av_strlcat( trbuf,tmp,sizeof( trbuf ) );
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
114 break;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
115 case '7': t=guiIntfStruct.LengthInSec; goto calclengthmmmmss;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
116 case '2': t=guiIntfStruct.TimeSec;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
117 calclengthmmmmss:
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
118 snprintf( tmp,sizeof( tmp ),"%04d:%02d",t/60,t%60 );
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
119 av_strlcat( trbuf,tmp,sizeof( trbuf ) );
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
120 break;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
121 case '3': snprintf( tmp,sizeof( tmp ),"%02d",guiIntfStruct.TimeSec / 3600 );
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
122 av_strlcat( trbuf,tmp,sizeof( trbuf ) ); break;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
123 case '4': snprintf( tmp,sizeof( tmp ),"%02d",( ( guiIntfStruct.TimeSec / 60 ) % 60 ) );
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
124 av_strlcat( trbuf,tmp,sizeof( trbuf ) ); break;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
125 case '5': snprintf( tmp,sizeof( tmp ),"%02d",guiIntfStruct.TimeSec % 60 );
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
126 av_strlcat( trbuf,tmp,sizeof( trbuf ) ); break;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
127 case '8': snprintf( tmp,sizeof( tmp ),"%01d:%02d:%02d",guiIntfStruct.TimeSec / 3600,( guiIntfStruct.TimeSec / 60 ) % 60,guiIntfStruct.TimeSec % 60 ); av_strlcat( trbuf,tmp,sizeof( trbuf ) ); break;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
128 case 'v': snprintf( tmp,sizeof( tmp ),"%3.2f%%",guiIntfStruct.Volume );
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
129 av_strlcat( trbuf,tmp,sizeof( trbuf ) ); break;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
130 case 'V': snprintf( tmp,sizeof( tmp ),"%3.1f",guiIntfStruct.Volume );
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
131 av_strlcat( trbuf,tmp,sizeof( trbuf ) ); break;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
132 case 'b': snprintf( tmp,sizeof( tmp ),"%3.2f%%",guiIntfStruct.Balance );
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
133 av_strlcat( trbuf,tmp,sizeof( trbuf ) ); break;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
134 case 'B': snprintf( tmp,sizeof( tmp ),"%3.1f",guiIntfStruct.Balance );
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
135 av_strlcat( trbuf,tmp,sizeof( trbuf ) ); break;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
136 case 'd': snprintf( tmp,sizeof( tmp ),"%d",guiIntfStruct.FrameDrop );
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
137 av_strlcat( trbuf,tmp,sizeof( trbuf ) ); break;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
138 case 'x': snprintf( tmp,sizeof( tmp ),"%d",guiIntfStruct.MovieWidth );
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
139 av_strlcat( trbuf,tmp,sizeof( trbuf ) ); break;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
140 case 'y': snprintf( tmp,sizeof( tmp ),"%d",guiIntfStruct.MovieHeight );
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
141 av_strlcat( trbuf,tmp,sizeof( trbuf ) ); break;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
142 case 'C': snprintf( tmp,sizeof( tmp ),"%s", guiIntfStruct.sh_video? ((sh_video_t *)guiIntfStruct.sh_video)->codec->name : "");
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
143 av_strlcat( trbuf,tmp,sizeof( trbuf ) ); break;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
144 case 's': if ( guiIntfStruct.Playing == 0 ) av_strlcat( trbuf,"s",sizeof( trbuf ) ); break;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
145 case 'l': if ( guiIntfStruct.Playing == 1 ) av_strlcat( trbuf,"p",sizeof( trbuf ) ); break;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
146 case 'e': if ( guiIntfStruct.Playing == 2 ) av_strlcat( trbuf,"e",sizeof( trbuf ) ); break;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
147 case 'a':
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
148 if ( mixer->muted ) { av_strlcat( trbuf,"n",sizeof( trbuf ) ); break; }
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
149 switch ( guiIntfStruct.AudioType )
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
150 {
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
151 case 0: av_strlcat( trbuf,"n",sizeof( trbuf ) ); break;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
152 case 1: av_strlcat( trbuf,"m",sizeof( trbuf ) ); break;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
153 case 2: av_strlcat( trbuf,"t",sizeof( trbuf ) ); break;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
154 }
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
155 break;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
156 case 'T':
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
157 switch ( guiIntfStruct.StreamType )
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
158 {
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
159 case STREAMTYPE_FILE: av_strlcat( trbuf,"f",sizeof( trbuf ) ); break;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
160 #ifdef HAVE_VCD
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
161 case STREAMTYPE_VCD: av_strlcat( trbuf,"v",sizeof( trbuf ) ); break;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
162 #endif
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
163 case STREAMTYPE_STREAM: av_strlcat( trbuf,"u",sizeof( trbuf ) ); break;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
164 #ifdef USE_DVDREAD
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
165 case STREAMTYPE_DVD: av_strlcat( trbuf,"d",sizeof( trbuf ) ); break;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
166 #endif
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
167 default: av_strlcat( trbuf," ",sizeof( trbuf ) ); break;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
168 }
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
169 break;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
170 case '$': av_strlcat( trbuf,"$",sizeof( trbuf ) ); break;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
171 default: continue;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
172 }
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
173 c=strlen( trbuf );
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
174 }
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
175 }
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
176 return trbuf;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
177 }
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
178
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
179 static char * image_buffer = NULL;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
180 static int image_width = 0;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
181
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
182 void PutImage( txSample * bf,int x,int y,int max,int ofs )
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
183 {
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
184 int i=0,ix,iy;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
185 uint32_t * buf = NULL;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
186 uint32_t * drw = NULL;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
187 register uint32_t tmp;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
188 /* register uint32_t yc; */
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
189
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
190 if ( ( !bf )||( bf->Image == NULL ) ) return;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
191
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
192 i=( bf->Width * ( bf->Height / max ) ) * ofs;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
193 buf=(uint32_t *)image_buffer;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
194 drw=(uint32_t *)bf->Image;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
195
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
196 #if 1
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
197 for ( iy=y;iy < (int)(y+bf->Height / max);iy++ )
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
198 for ( ix=x;ix < (int)(x+bf->Width);ix++ )
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
199 {
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
200 tmp=drw[i++];
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
201 if ( tmp != 0x00ff00ff ) buf[iy * image_width + ix]=tmp;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
202 }
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
203 #else
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
204 yc=y * image_width;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
205 for ( iy=y;iy < (int)(y+bf->Height / max);iy++ )
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
206 {
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
207 for ( ix=x;ix < (int)(x+bf->Width);ix++ )
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
208 {
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
209 tmp=drw[i++];
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
210 if ( tmp != 0x00ff00ff ) buf[yc + ix]=tmp;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
211 }
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
212 yc+=image_width;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
213 }
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
214 #endif
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
215 }
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
216
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
217 void SimplePotmeterPutImage( txSample * bf,int x,int y,float frac )
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
218 {
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
219 int i=0,w,r,ix,iy;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
220 uint32_t * buf = NULL;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
221 uint32_t * drw = NULL;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
222 register uint32_t tmp;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
223
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
224 if ( ( !bf )||( bf->Image == NULL ) ) return;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
225
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
226 buf=(uint32_t *)image_buffer;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
227 drw=(uint32_t *)bf->Image;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
228 w=bf->Width*frac;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
229 r=bf->Width-w;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
230 for ( iy=y;iy < (int)(y+bf->Height);iy++ )
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
231 {
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
232 for ( ix=x;ix < (int)(x+w);ix++ )
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
233 {
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
234 tmp=drw[i++];
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
235 if ( tmp != 0x00ff00ff ) buf[iy * image_width + ix]=tmp;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
236 }
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
237 i+=r;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
238 }
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
239 }
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
240
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
241 void Render( wsTWindow * window,wItem * Items,int nrItems,char * db,int size )
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
242 {
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
243 wItem * item;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
244 txSample * image = NULL;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
245 int i;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
246
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
247 image_buffer=db;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
248 image_width=window->Width;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
249
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
250 for( i=0;i < nrItems + 1;i++ )
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
251 {
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
252 item=&Items[i];
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
253 switch( item->type )
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
254 {
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
255 case itButton:
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
256 PutImage( &item->Bitmap,item->x,item->y,3,item->pressed );
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
257 break;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
258 case itPotmeter:
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
259 if (item->phases == 1)SimplePotmeterPutImage( &item->Bitmap,item->x,item->y, item->value / 100.0f );
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
260 else PutImage( &item->Bitmap,item->x,item->y,item->phases,( item->phases - 1 ) * ( item->value / 100.0f ) );
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
261 break;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
262 case itHPotmeter:
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
263 if (item->phases == 1)SimplePotmeterPutImage( &item->Bitmap,item->x,item->y, item->value / 100.0f );
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
264 else PutImage( &item->Bitmap,item->x,item->y,item->phases,( item->phases - 1 ) * ( item->value / 100.0f ) );
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
265 PutImage( &item->Mask,item->x + (int)( ( item->width - item->psx ) * item->value / 100.0f ),item->y,3,item->pressed );
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
266 break;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
267 case itVPotmeter:
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
268 PutImage( &item->Bitmap,
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
269 item->x,item->y,
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
270 item->phases,
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
271 item->phases * ( 1. - item->value / 100.0f ) );
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
272 PutImage( &item->Mask,
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
273 item->x,item->y + (int)( ( item->height - item->psy ) * ( 1. - item->value / 100.0f ) ),
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
274 3,item->pressed );
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
275 break;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
276 case itSLabel:
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
277 image=fntRender( item,0,"%s",item->label );
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
278 if ( image ) PutImage( image,item->x,item->y,1,0 );
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
279 case itDLabel:
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
280 {
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
281 char * t = Translate( item->label );
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
282 int l = fntTextWidth( item->fontid,t );
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
283 l=(l?l:item->width);
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
284 image=fntRender( item,l-(GetTimerMS() / 20)%l,"%s",t );
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
285 }
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
286 if ( image ) PutImage( image,item->x,item->y,1,0 );
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
287 break;
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
288 }
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
289 }
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
290 wsConvert( window,db,size );
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
291 }