annotate Gui/app.c @ 2597:dfb13228e18b

alpha. currently no options working :)
author gabucino
date Wed, 31 Oct 2001 20:15:19 +0000
parents 32b1bb50a0e8
children a0009a534428
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
2 #include <stdlib.h>
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
3 #include <stdio.h>
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
4 #include <string.h>
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
5
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
6 #include "app.h"
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
7 #include "../config.h"
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
8 #include "error.h"
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
9 #include "wm/wskeys.h"
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
10 #include "skin/skin.h"
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
11 #include "mplayer/mplayer.h"
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
12
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
13 listItems appMPlayer;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
14
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
15 char * skinDirInHome=NULL;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
16 char * skinMPlayerDir=NULL;
1866
32b1bb50a0e8 some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents: 1823
diff changeset
17 char * skinName = NULL;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
18
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
19 void appClearItem( wItem * item )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
20 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
21 item->type=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
22 // ---
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
23 item->x=0; item->y=0; item->width=0; item->height=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
24 // ---
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
25 item->px=0; item->py=0; item->psx=0; item->psy=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
26 // ---
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
27 item->msg=0; item->msg2=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
28 item->pressed=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
29 item->tmp=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
30 item->key=0; item->key2=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
31 item->Bitmap.Width=0; item->Bitmap.Height=0; item->Bitmap.BPP=0; item->Bitmap.ImageSize=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
32 if ( item->Bitmap.Image )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
33 { free( item->Bitmap.Image ); item->Bitmap.Image=NULL; }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
34 // ---
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
35 item->fontid=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
36 if ( item->label ) free( item->label ); item->label=NULL;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
37 item->event=0;
1729
d6c99f70449e fix hprogressbar
pontscho
parents: 1723
diff changeset
38 item->used=0;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
39 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
40
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
41 void appCopy( listItems * dest,listItems * source )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
42 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
43 dest->NumberOfItems=source->NumberOfItems;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
44 memcpy( &dest->Items,&source->Items,128 * sizeof( wItem ) );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
45
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
46 dest->NumberOfMenuItems=source->NumberOfMenuItems;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
47 memcpy( &dest->MenuItems,&source->MenuItems,32 * sizeof( wItem ) );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
48
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
49 memcpy( &dest->main,&source->main,sizeof( wItem ) );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
50 memcpy( &dest->sub,&source->sub,sizeof( wItem ) );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
51 memcpy( &dest->eq,&source->eq,sizeof( wItem ) );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
52 memcpy( &dest->menuBase,&source->menuBase,sizeof( wItem ) );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
53 memcpy( &dest->menuSelected,&source->menuSelected,sizeof( wItem ) );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
54 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
55
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
56 void appInitStruct( listItems * item )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
57 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
58 int i;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
59 for ( i=0;i<item->NumberOfItems;i++ )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
60 appClearItem( &item->Items[i] );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
61 for ( i=0;i<item->NumberOfMenuItems;i++ )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
62 appClearItem( &item->MenuItems[i] );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
63
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
64 item->NumberOfItems=-1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
65 memset( item->Items,0,128 * sizeof( wItem ) );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
66 item->NumberOfMenuItems=-1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
67 memset( item->MenuItems,0,32 * sizeof( wItem ) );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
68
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
69 appClearItem( &item->main );
1866
32b1bb50a0e8 some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents: 1823
diff changeset
70 item->mainDecoration=0;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
71 appClearItem( &item->sub );
1823
a6c67352ccac fix some bug.
pontscho
parents: 1729
diff changeset
72 item->sub.Bitmap.Width=384; item->sub.Bitmap.Height=384;
a6c67352ccac fix some bug.
pontscho
parents: 1729
diff changeset
73 item->sub.width=384; item->sub.height=384;
a6c67352ccac fix some bug.
pontscho
parents: 1729
diff changeset
74 item->sub.x=-1; item->sub.y=-1;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
75 appClearItem( &item->menuBase );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
76 appClearItem( &item->menuSelected );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
77 item->subR=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
78 item->subG=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
79 item->subB=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
80 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
81
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
82 int appFindKey( unsigned char * name )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
83 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
84 int i;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
85 for ( i=0;i<wsKeyNumber;i++ )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
86 if ( !strcmp( wsKeyNames[i].name,name ) ) return wsKeyNames[i].code;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
87 return -1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
88 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
89
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
90 int appFindMessage( unsigned char * str )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
91 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
92 int i;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
93 for ( i=0;i<evBoxs;i++ )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
94 if ( !strcmp( evNames[i].name,str ) ) return evNames[i].msg;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
95 return -1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
96 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
97
1723
5e4214a7540e GUI stuff. now seeking works, and xmga renders to video window
arpi
parents: 1707
diff changeset
98 void appInit( int argc,char* argv[], char *envp[], void* disp )
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
99 {
1707
216aae08226c misc fixes/cleanup, Skin path stuff fixed
arpi
parents: 1696
diff changeset
100 skinDirInHome=get_path("Skin");
216aae08226c misc fixes/cleanup, Skin path stuff fixed
arpi
parents: 1696
diff changeset
101 skinMPlayerDir=DATADIR "/Skin";
216aae08226c misc fixes/cleanup, Skin path stuff fixed
arpi
parents: 1696
diff changeset
102 printf("SKIN dir 1: '%s'\n",skinDirInHome);
216aae08226c misc fixes/cleanup, Skin path stuff fixed
arpi
parents: 1696
diff changeset
103 printf("SKIN dir 2: '%s'\n",skinMPlayerDir);
1866
32b1bb50a0e8 some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents: 1823
diff changeset
104 if ( !skinName )
32b1bb50a0e8 some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents: 1823
diff changeset
105 {
32b1bb50a0e8 some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents: 1823
diff changeset
106 if ( ( skinName=(char *)calloc( 1,7 ) ) == NULL ) { dbprintf( 0,"[config] Not enough memory.\n" ); exit( 1 ); }
32b1bb50a0e8 some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents: 1823
diff changeset
107 strcpy( skinName,"default" );
32b1bb50a0e8 some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents: 1823
diff changeset
108 }
1696
eca342b2a2f4 commented
arpi
parents: 1695
diff changeset
109 initDebug(NULL); // write messages to stderr
1866
32b1bb50a0e8 some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents: 1823
diff changeset
110 switch ( skinRead( skinName ) )
1823
a6c67352ccac fix some bug.
pontscho
parents: 1729
diff changeset
111 {
a6c67352ccac fix some bug.
pontscho
parents: 1729
diff changeset
112 case -1: dbprintf( 0,"[app] skin configfile not found.\n" ); exit( 0 );
a6c67352ccac fix some bug.
pontscho
parents: 1729
diff changeset
113 case -2: dbprintf( 0,"[app] skin configfile read error.\n" ); exit( 0 );
a6c67352ccac fix some bug.
pontscho
parents: 1729
diff changeset
114 }
a6c67352ccac fix some bug.
pontscho
parents: 1729
diff changeset
115 mplInit( argc,argv,envp,disp ); // does gtk & ws initialization, create windows
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
116 }