annotate Gui/app.c @ 5264:d3846ebe974d

added zlib
author alex
date Fri, 22 Mar 2002 22:14:01 +0000
parents 27980a844961
children 3e7f39c4110c
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
3586
a0009a534428 itt a skin nem van hibauzenet igy.
pontscho
parents: 1866
diff changeset
6 #include "../config.h"
a0009a534428 itt a skin nem van hibauzenet igy.
pontscho
parents: 1866
diff changeset
7 #include "../mp_msg.h"
a0009a534428 itt a skin nem van hibauzenet igy.
pontscho
parents: 1866
diff changeset
8 #include "../help_mp.h"
a0009a534428 itt a skin nem van hibauzenet igy.
pontscho
parents: 1866
diff changeset
9
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
10 #include "app.h"
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
11 #include "wm/wskeys.h"
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
12 #include "skin/skin.h"
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
13 #include "mplayer/mplayer.h"
4979
27980a844961 PlayToPause bug with mouse fixed
pontscho
parents: 4818
diff changeset
14 #include "interface.h"
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
15
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
16 listItems appMPlayer;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
17
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
18 char * skinDirInHome=NULL;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
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
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
21
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
22 void appClearItem( wItem * item )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
23 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
24 item->type=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
25 // ---
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
26 item->x=0; item->y=0; item->width=0; item->height=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
27 // ---
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
28 item->px=0; item->py=0; item->psx=0; item->psy=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
29 // ---
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
30 item->msg=0; item->msg2=0;
4979
27980a844961 PlayToPause bug with mouse fixed
pontscho
parents: 4818
diff changeset
31 item->pressed=btnReleased;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
32 item->tmp=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
33 item->key=0; item->key2=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
34 item->Bitmap.Width=0; item->Bitmap.Height=0; item->Bitmap.BPP=0; item->Bitmap.ImageSize=0;
4979
27980a844961 PlayToPause bug with mouse fixed
pontscho
parents: 4818
diff changeset
35 if ( item->Bitmap.Image ) free( item->Bitmap.Image );
27980a844961 PlayToPause bug with mouse fixed
pontscho
parents: 4818
diff changeset
36 item->Bitmap.Image=NULL;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
37 // ---
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
38 item->fontid=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
39 if ( item->label ) free( item->label ); item->label=NULL;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
40 item->event=0;
1729
d6c99f70449e fix hprogressbar
pontscho
parents: 1723
diff changeset
41 item->used=0;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
42 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
43
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
44 void appCopy( listItems * dest,listItems * source )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
45 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
46 dest->NumberOfItems=source->NumberOfItems;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
47 memcpy( &dest->Items,&source->Items,128 * sizeof( wItem ) );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
48
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
49 dest->NumberOfMenuItems=source->NumberOfMenuItems;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
50 memcpy( &dest->MenuItems,&source->MenuItems,32 * sizeof( wItem ) );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
51
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
52 memcpy( &dest->main,&source->main,sizeof( wItem ) );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
53 memcpy( &dest->sub,&source->sub,sizeof( wItem ) );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
54 memcpy( &dest->eq,&source->eq,sizeof( wItem ) );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
55 memcpy( &dest->menuBase,&source->menuBase,sizeof( wItem ) );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
56 memcpy( &dest->menuSelected,&source->menuSelected,sizeof( wItem ) );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
57 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
58
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
59 void appInitStruct( listItems * item )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
60 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
61 int i;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
62 for ( i=0;i<item->NumberOfItems;i++ )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
63 appClearItem( &item->Items[i] );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
64 for ( i=0;i<item->NumberOfMenuItems;i++ )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
65 appClearItem( &item->MenuItems[i] );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
66
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
67 item->NumberOfItems=-1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
68 memset( item->Items,0,128 * sizeof( wItem ) );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
69 item->NumberOfMenuItems=-1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
70 memset( item->MenuItems,0,32 * sizeof( wItem ) );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
71
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
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
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
74 appClearItem( &item->sub );
1823
a6c67352ccac fix some bug.
pontscho
parents: 1729
diff changeset
75 item->sub.Bitmap.Width=384; item->sub.Bitmap.Height=384;
a6c67352ccac fix some bug.
pontscho
parents: 1729
diff changeset
76 item->sub.width=384; item->sub.height=384;
a6c67352ccac fix some bug.
pontscho
parents: 1729
diff changeset
77 item->sub.x=-1; item->sub.y=-1;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
78 appClearItem( &item->menuBase );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
79 appClearItem( &item->menuSelected );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
80 item->subR=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
81 item->subG=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
82 item->subB=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
83 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
84
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
85 int appFindKey( unsigned char * name )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
86 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
87 int i;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
88 for ( i=0;i<wsKeyNumber;i++ )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
89 if ( !strcmp( wsKeyNames[i].name,name ) ) return wsKeyNames[i].code;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
90 return -1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
91 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
92
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
93 int appFindMessage( unsigned char * str )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
94 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
95 int i;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
96 for ( i=0;i<evBoxs;i++ )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
97 if ( !strcmp( evNames[i].name,str ) ) return evNames[i].msg;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
98 return -1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
99 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
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
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
102 {
1707
216aae08226c misc fixes/cleanup, Skin path stuff fixed
arpi
parents: 1696
diff changeset
103 skinDirInHome=get_path("Skin");
216aae08226c misc fixes/cleanup, Skin path stuff fixed
arpi
parents: 1696
diff changeset
104 skinMPlayerDir=DATADIR "/Skin";
216aae08226c misc fixes/cleanup, Skin path stuff fixed
arpi
parents: 1696
diff changeset
105 printf("SKIN dir 1: '%s'\n",skinDirInHome);
216aae08226c misc fixes/cleanup, Skin path stuff fixed
arpi
parents: 1696
diff changeset
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 {
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
109 if ( ( skinName=(char *)calloc( 1,7 ) ) == NULL ) { mp_msg( MSGT_GPLAYER,MSGL_STATUS,"[config] Not enough memory.\n" ); exit( 1 ); }
1866
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 }
32b1bb50a0e8 some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents: 1823
diff changeset
112 switch ( skinRead( skinName ) )
1823
a6c67352ccac fix some bug.
pontscho
parents: 1729
diff changeset
113 {
3586
a0009a534428 itt a skin nem van hibauzenet igy.
pontscho
parents: 1866
diff changeset
114 case -1: mp_msg( MSGT_GPLAYER,MSGL_ERR,MSGTR_SKIN_SKINCFG_SkinNotFound,skinName ); exit( 0 );
a0009a534428 itt a skin nem van hibauzenet igy.
pontscho
parents: 1866
diff changeset
115 case -2: mp_msg( MSGT_GPLAYER,MSGL_ERR,MSGTR_SKIN_SKINCFG_SkinCfgReadError,skinName ); exit( 0 );
1823
a6c67352ccac fix some bug.
pontscho
parents: 1729
diff changeset
116 }
a6c67352ccac fix some bug.
pontscho
parents: 1729
diff changeset
117 mplInit( argc,argv,envp,disp ); // does gtk & ws initialization, create windows
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
118 }