Mercurial > mplayer.hg
annotate Gui/app.c @ 3800:3080ef830f93
aspect ratio patch by Rik Snel
author | alex |
---|---|
date | Thu, 27 Dec 2001 19:54:36 +0000 |
parents | a0009a534428 |
children | 3473ca9ef158 |
rev | line source |
---|---|
1693 | 1 |
2 #include <stdlib.h> | |
3 #include <stdio.h> | |
4 #include <string.h> | |
5 | |
3586 | 6 #include "../config.h" |
7 #include "../mp_msg.h" | |
8 #include "../help_mp.h" | |
9 | |
1693 | 10 #include "app.h" |
11 #include "error.h" | |
12 #include "wm/wskeys.h" | |
13 #include "skin/skin.h" | |
14 #include "mplayer/mplayer.h" | |
15 | |
16 listItems appMPlayer; | |
17 | |
18 char * skinDirInHome=NULL; | |
19 char * skinMPlayerDir=NULL; | |
1866
32b1bb50a0e8
some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents:
1823
diff
changeset
|
20 char * skinName = NULL; |
1693 | 21 |
22 void appClearItem( wItem * item ) | |
23 { | |
24 item->type=0; | |
25 // --- | |
26 item->x=0; item->y=0; item->width=0; item->height=0; | |
27 // --- | |
28 item->px=0; item->py=0; item->psx=0; item->psy=0; | |
29 // --- | |
30 item->msg=0; item->msg2=0; | |
31 item->pressed=0; | |
32 item->tmp=0; | |
33 item->key=0; item->key2=0; | |
34 item->Bitmap.Width=0; item->Bitmap.Height=0; item->Bitmap.BPP=0; item->Bitmap.ImageSize=0; | |
35 if ( item->Bitmap.Image ) | |
36 { free( item->Bitmap.Image ); item->Bitmap.Image=NULL; } | |
37 // --- | |
38 item->fontid=0; | |
39 if ( item->label ) free( item->label ); item->label=NULL; | |
40 item->event=0; | |
1729 | 41 item->used=0; |
1693 | 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 ); | |
1866
32b1bb50a0e8
some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents:
1823
diff
changeset
|
73 item->mainDecoration=0; |
1693 | 74 appClearItem( &item->sub ); |
1823 | 75 item->sub.Bitmap.Width=384; item->sub.Bitmap.Height=384; |
76 item->sub.width=384; item->sub.height=384; | |
77 item->sub.x=-1; item->sub.y=-1; | |
1693 | 78 appClearItem( &item->menuBase ); |
79 appClearItem( &item->menuSelected ); | |
80 item->subR=0; | |
81 item->subG=0; | |
82 item->subB=0; | |
83 } | |
84 | |
85 int appFindKey( unsigned char * name ) | |
86 { | |
87 int i; | |
88 for ( i=0;i<wsKeyNumber;i++ ) | |
89 if ( !strcmp( wsKeyNames[i].name,name ) ) return wsKeyNames[i].code; | |
90 return -1; | |
91 } | |
92 | |
93 int appFindMessage( unsigned char * str ) | |
94 { | |
95 int i; | |
96 for ( i=0;i<evBoxs;i++ ) | |
97 if ( !strcmp( evNames[i].name,str ) ) return evNames[i].msg; | |
98 return -1; | |
99 } | |
100 | |
1723
5e4214a7540e
GUI stuff. now seeking works, and xmga renders to video window
arpi
parents:
1707
diff
changeset
|
101 void appInit( int argc,char* argv[], char *envp[], void* disp ) |
1693 | 102 { |
1707 | 103 skinDirInHome=get_path("Skin"); |
104 skinMPlayerDir=DATADIR "/Skin"; | |
105 printf("SKIN dir 1: '%s'\n",skinDirInHome); | |
106 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
|
107 if ( !skinName ) |
32b1bb50a0e8
some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents:
1823
diff
changeset
|
108 { |
32b1bb50a0e8
some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents:
1823
diff
changeset
|
109 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
|
110 strcpy( skinName,"default" ); |
32b1bb50a0e8
some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents:
1823
diff
changeset
|
111 } |
1696 | 112 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
|
113 switch ( skinRead( skinName ) ) |
1823 | 114 { |
3586 | 115 case -1: mp_msg( MSGT_GPLAYER,MSGL_ERR,MSGTR_SKIN_SKINCFG_SkinNotFound,skinName ); exit( 0 ); |
116 case -2: mp_msg( MSGT_GPLAYER,MSGL_ERR,MSGTR_SKIN_SKINCFG_SkinCfgReadError,skinName ); exit( 0 ); | |
1823 | 117 } |
118 mplInit( argc,argv,envp,disp ); // does gtk & ws initialization, create windows | |
1693 | 119 } |