Mercurial > mplayer.hg
comparison Gui/app.c @ 1693:d237c5d4b216
GUI version n-1
author | arpi |
---|---|
date | Sat, 25 Aug 2001 21:04:29 +0000 |
parents | |
children | bdd63cf7f00f |
comparison
equal
deleted
inserted
replaced
1692:6c98e425c091 | 1693:d237c5d4b216 |
---|---|
1 | |
2 #include <stdlib.h> | |
3 #include <stdio.h> | |
4 #include <string.h> | |
5 | |
6 #include "app.h" | |
7 #include "../config.h" | |
8 #include "config.h" | |
9 #include "error.h" | |
10 #include "wm/wskeys.h" | |
11 #include "skin/skin.h" | |
12 #include "mplayer/mplayer.h" | |
13 | |
14 listItems appMPlayer; | |
15 listItems appTV; | |
16 listItems appRadio; | |
17 | |
18 char * appMPlayerDirInHome=NULL; | |
19 char * appMPlayerDir=NULL; | |
20 char * skinDirInHome=NULL; | |
21 char * skinMPlayerDir=NULL; | |
22 | |
23 void appClearItem( wItem * item ) | |
24 { | |
25 item->type=0; | |
26 // --- | |
27 item->x=0; item->y=0; item->width=0; item->height=0; | |
28 // --- | |
29 item->px=0; item->py=0; item->psx=0; item->psy=0; | |
30 // --- | |
31 item->msg=0; item->msg2=0; | |
32 item->pressed=0; | |
33 item->tmp=0; | |
34 item->key=0; item->key2=0; | |
35 item->Bitmap.Width=0; item->Bitmap.Height=0; item->Bitmap.BPP=0; item->Bitmap.ImageSize=0; | |
36 if ( item->Bitmap.Image ) | |
37 { free( item->Bitmap.Image ); item->Bitmap.Image=NULL; } | |
38 // --- | |
39 item->fontid=0; | |
40 if ( item->label ) free( item->label ); item->label=NULL; | |
41 item->event=0; | |
42 } | |
43 | |
44 void appCopy( listItems * dest,listItems * source ) | |
45 { | |
46 dest->NumberOfItems=source->NumberOfItems; | |
47 memcpy( &dest->Items,&source->Items,128 * sizeof( wItem ) ); | |
48 | |
49 dest->NumberOfMenuItems=source->NumberOfMenuItems; | |
50 memcpy( &dest->MenuItems,&source->MenuItems,32 * sizeof( wItem ) ); | |
51 | |
52 memcpy( &dest->main,&source->main,sizeof( wItem ) ); | |
53 memcpy( &dest->sub,&source->sub,sizeof( wItem ) ); | |
54 memcpy( &dest->eq,&source->eq,sizeof( wItem ) ); | |
55 memcpy( &dest->menuBase,&source->menuBase,sizeof( wItem ) ); | |
56 memcpy( &dest->menuSelected,&source->menuSelected,sizeof( wItem ) ); | |
57 } | |
58 | |
59 void appInitStruct( listItems * item ) | |
60 { | |
61 int i; | |
62 for ( i=0;i<item->NumberOfItems;i++ ) | |
63 appClearItem( &item->Items[i] ); | |
64 for ( i=0;i<item->NumberOfMenuItems;i++ ) | |
65 appClearItem( &item->MenuItems[i] ); | |
66 | |
67 item->NumberOfItems=-1; | |
68 memset( item->Items,0,128 * sizeof( wItem ) ); | |
69 item->NumberOfMenuItems=-1; | |
70 memset( item->MenuItems,0,32 * sizeof( wItem ) ); | |
71 | |
72 appClearItem( &item->main ); | |
73 appClearItem( &item->sub ); | |
74 item->sub.Bitmap.Width=256; item->sub.Bitmap.Height=256; | |
75 item->sub.width=256; item->sub.height=256; | |
76 appClearItem( &item->menuBase ); | |
77 appClearItem( &item->menuSelected ); | |
78 item->subR=0; | |
79 item->subG=0; | |
80 item->subB=0; | |
81 } | |
82 | |
83 int appFindKey( unsigned char * name ) | |
84 { | |
85 int i; | |
86 for ( i=0;i<wsKeyNumber;i++ ) | |
87 if ( !strcmp( wsKeyNames[i].name,name ) ) return wsKeyNames[i].code; | |
88 return -1; | |
89 } | |
90 | |
91 int appFindMessage( unsigned char * str ) | |
92 { | |
93 int i; | |
94 for ( i=0;i<evBoxs;i++ ) | |
95 if ( !strcmp( evNames[i].name,str ) ) return evNames[i].msg; | |
96 return -1; | |
97 } | |
98 | |
99 void appInit( int argc,char* argv[], char *envp[] ) | |
100 { | |
101 if ( ( appMPlayerDirInHome=(char *)calloc( 1,strlen( getenv( "HOME" ) ) + 9 ) ) != NULL ) | |
102 { strcpy( appMPlayerDirInHome,getenv( "HOME" ) ); strcat( appMPlayerDirInHome,"/.mplayer" ); } | |
103 if ( ( skinDirInHome=(char *)calloc( 1,strlen( appMPlayerDirInHome ) + 5 ) ) != NULL ) | |
104 { strcpy( skinDirInHome,appMPlayerDirInHome ); strcat( skinDirInHome,"/Skin" ); } | |
105 if ( ( appMPlayerDir=(char *)calloc( 1,strlen( PREFIX ) + 14 ) ) != NULL ) | |
106 { strcpy( appMPlayerDir,PREFIX ); strcat( appMPlayerDir,"/share/mplayer" ); } | |
107 if ( ( skinMPlayerDir=(char *)calloc( 1,strlen( appMPlayerDir ) + 5 ) ) != NULL ) | |
108 { strcpy( skinMPlayerDir,appMPlayerDir ); strcat( skinMPlayerDir,"/Skin" ); } | |
109 | |
110 initDebug(); | |
111 | |
112 cfgDefaults(); | |
113 cfgRead(); | |
114 if ( !strcmp( cfgAppName,"movieplayer" ) ) | |
115 { | |
116 appMPlayer.sub.x=-1; appMPlayer.sub.y=-1; appMPlayer.sub.width=512; appMPlayer.sub.height=256; | |
117 switch ( skinRead( cfgSkin ) ) | |
118 { | |
119 case -1: dbprintf( 0,"[app] skin configfile not found.\n" ); exit( 0 ); | |
120 case -2: dbprintf( 0,"[app] skin configfile read error.\n" ); exit( 0 ); | |
121 } | |
122 mplInit( argc,argv,envp ); | |
123 } | |
124 } |