1693
|
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
|
1707
|
18 //char * appMPlayerDirInHome=NULL;
|
|
19 //char * appMPlayerDir=NULL;
|
1693
|
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 {
|
1707
|
101 skinDirInHome=get_path("Skin");
|
|
102 skinMPlayerDir=DATADIR "/Skin";
|
|
103 printf("SKIN dir 1: '%s'\n",skinDirInHome);
|
|
104 printf("SKIN dir 2: '%s'\n",skinMPlayerDir);
|
|
105
|
|
106 // if ( ( appMPlayerDirInHome=(char *)calloc( 1,strlen( getenv( "HOME" ) ) + 9 ) ) != NULL )
|
|
107 // { strcpy( appMPlayerDirInHome,getenv( "HOME" ) ); strcat( appMPlayerDirInHome,"/.mplayer" ); }
|
|
108 // if ( ( skinDirInHome=(char *)calloc( 1,strlen( appMPlayerDirInHome ) + 5 ) ) != NULL )
|
|
109 // { strcpy( skinDirInHome,appMPlayerDirInHome ); strcat( skinDirInHome,"/Skin" ); }
|
|
110 // if ( ( appMPlayerDir=(char *)calloc( 1,strlen( PREFIX ) + 14 ) ) != NULL )
|
|
111 // { strcpy( appMPlayerDir,PREFIX ); strcat( appMPlayerDir,"/share/mplayer" ); }
|
|
112 // if ( ( skinMPlayerDir=(char *)calloc( 1,strlen( appMPlayerDir ) + 5 ) ) != NULL )
|
|
113 // { strcpy( skinMPlayerDir,appMPlayerDir ); strcat( skinMPlayerDir,"/Skin" ); }
|
1693
|
114
|
1696
|
115 initDebug(NULL); // write messages to stderr
|
1693
|
116
|
1696
|
117 cfgDefaults(); // set skin to "default"
|
|
118 cfgRead(); // empty function - NOP
|
|
119 // if ( !strcmp( cfgAppName,"movieplayer" ) )
|
|
120 // {
|
1693
|
121 appMPlayer.sub.x=-1; appMPlayer.sub.y=-1; appMPlayer.sub.width=512; appMPlayer.sub.height=256;
|
|
122 switch ( skinRead( cfgSkin ) )
|
|
123 {
|
|
124 case -1: dbprintf( 0,"[app] skin configfile not found.\n" ); exit( 0 );
|
|
125 case -2: dbprintf( 0,"[app] skin configfile read error.\n" ); exit( 0 );
|
|
126 }
|
1696
|
127 mplInit( argc,argv,envp ); // does gtk & ws initialization, create windows
|
|
128 // }
|
1693
|
129 }
|