Mercurial > mplayer.hg
annotate Gui/app.c @ 1753:a411db476483
resize
author | pontscho |
---|---|
date | Wed, 29 Aug 2001 17:37:03 +0000 |
parents | d6c99f70449e |
children | a6c67352ccac |
rev | line source |
---|---|
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; | |
1729 | 42 item->used=0; |
1693 | 43 } |
44 | |
45 void appCopy( listItems * dest,listItems * source ) | |
46 { | |
47 dest->NumberOfItems=source->NumberOfItems; | |
48 memcpy( &dest->Items,&source->Items,128 * sizeof( wItem ) ); | |
49 | |
50 dest->NumberOfMenuItems=source->NumberOfMenuItems; | |
51 memcpy( &dest->MenuItems,&source->MenuItems,32 * sizeof( wItem ) ); | |
52 | |
53 memcpy( &dest->main,&source->main,sizeof( wItem ) ); | |
54 memcpy( &dest->sub,&source->sub,sizeof( wItem ) ); | |
55 memcpy( &dest->eq,&source->eq,sizeof( wItem ) ); | |
56 memcpy( &dest->menuBase,&source->menuBase,sizeof( wItem ) ); | |
57 memcpy( &dest->menuSelected,&source->menuSelected,sizeof( wItem ) ); | |
58 } | |
59 | |
60 void appInitStruct( listItems * item ) | |
61 { | |
62 int i; | |
63 for ( i=0;i<item->NumberOfItems;i++ ) | |
64 appClearItem( &item->Items[i] ); | |
65 for ( i=0;i<item->NumberOfMenuItems;i++ ) | |
66 appClearItem( &item->MenuItems[i] ); | |
67 | |
68 item->NumberOfItems=-1; | |
69 memset( item->Items,0,128 * sizeof( wItem ) ); | |
70 item->NumberOfMenuItems=-1; | |
71 memset( item->MenuItems,0,32 * sizeof( wItem ) ); | |
72 | |
73 appClearItem( &item->main ); | |
74 appClearItem( &item->sub ); | |
75 item->sub.Bitmap.Width=256; item->sub.Bitmap.Height=256; | |
76 item->sub.width=256; item->sub.height=256; | |
77 appClearItem( &item->menuBase ); | |
78 appClearItem( &item->menuSelected ); | |
79 item->subR=0; | |
80 item->subG=0; | |
81 item->subB=0; | |
82 } | |
83 | |
84 int appFindKey( unsigned char * name ) | |
85 { | |
86 int i; | |
87 for ( i=0;i<wsKeyNumber;i++ ) | |
88 if ( !strcmp( wsKeyNames[i].name,name ) ) return wsKeyNames[i].code; | |
89 return -1; | |
90 } | |
91 | |
92 int appFindMessage( unsigned char * str ) | |
93 { | |
94 int i; | |
95 for ( i=0;i<evBoxs;i++ ) | |
96 if ( !strcmp( evNames[i].name,str ) ) return evNames[i].msg; | |
97 return -1; | |
98 } | |
99 | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1707
diff
changeset
|
100 void appInit( int argc,char* argv[], char *envp[], void* disp ) |
1693 | 101 { |
1707 | 102 skinDirInHome=get_path("Skin"); |
103 skinMPlayerDir=DATADIR "/Skin"; | |
104 printf("SKIN dir 1: '%s'\n",skinDirInHome); | |
105 printf("SKIN dir 2: '%s'\n",skinMPlayerDir); | |
106 | |
107 // if ( ( appMPlayerDirInHome=(char *)calloc( 1,strlen( getenv( "HOME" ) ) + 9 ) ) != NULL ) | |
108 // { strcpy( appMPlayerDirInHome,getenv( "HOME" ) ); strcat( appMPlayerDirInHome,"/.mplayer" ); } | |
109 // if ( ( skinDirInHome=(char *)calloc( 1,strlen( appMPlayerDirInHome ) + 5 ) ) != NULL ) | |
110 // { strcpy( skinDirInHome,appMPlayerDirInHome ); strcat( skinDirInHome,"/Skin" ); } | |
111 // if ( ( appMPlayerDir=(char *)calloc( 1,strlen( PREFIX ) + 14 ) ) != NULL ) | |
112 // { strcpy( appMPlayerDir,PREFIX ); strcat( appMPlayerDir,"/share/mplayer" ); } | |
113 // if ( ( skinMPlayerDir=(char *)calloc( 1,strlen( appMPlayerDir ) + 5 ) ) != NULL ) | |
114 // { strcpy( skinMPlayerDir,appMPlayerDir ); strcat( skinMPlayerDir,"/Skin" ); } | |
1693 | 115 |
1696 | 116 initDebug(NULL); // write messages to stderr |
1693 | 117 |
1696 | 118 cfgDefaults(); // set skin to "default" |
119 cfgRead(); // empty function - NOP | |
120 // if ( !strcmp( cfgAppName,"movieplayer" ) ) | |
121 // { | |
1693 | 122 appMPlayer.sub.x=-1; appMPlayer.sub.y=-1; appMPlayer.sub.width=512; appMPlayer.sub.height=256; |
123 switch ( skinRead( cfgSkin ) ) | |
124 { | |
125 case -1: dbprintf( 0,"[app] skin configfile not found.\n" ); exit( 0 ); | |
126 case -2: dbprintf( 0,"[app] skin configfile read error.\n" ); exit( 0 ); | |
127 } | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1707
diff
changeset
|
128 mplInit( argc,argv,envp,disp ); // does gtk & ws initialization, create windows |
1696 | 129 // } |
1693 | 130 } |