annotate Gui/app.c @ 7935:643d7fea35c5

some changes found by lgb...
author jonas
date Sun, 27 Oct 2002 17:33:44 +0000
parents 8e9607c5897e
children e5dda05f9aab
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
7092
8e9607c5897e - warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents: 6218
diff changeset
16 extern char *get_path(char *);
8e9607c5897e - warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents: 6218
diff changeset
17
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
18 listItems appMPlayer;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
19
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
20 char * skinDirInHome=NULL;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
21 char * skinMPlayerDir=NULL;
1866
32b1bb50a0e8 some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents: 1823
diff changeset
22 char * skinName = NULL;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
23
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
24 void appClearItem( wItem * item )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
25 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
26 item->type=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
27 // ---
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
28 item->x=0; item->y=0; item->width=0; item->height=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
29 // ---
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
30 item->px=0; item->py=0; item->psx=0; item->psy=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
31 // ---
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
32 item->msg=0; item->msg2=0;
4979
27980a844961 PlayToPause bug with mouse fixed
pontscho
parents: 4818
diff changeset
33 item->pressed=btnReleased;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
34 item->tmp=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
35 item->key=0; item->key2=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
36 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
37 if ( item->Bitmap.Image ) free( item->Bitmap.Image );
27980a844961 PlayToPause bug with mouse fixed
pontscho
parents: 4818
diff changeset
38 item->Bitmap.Image=NULL;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
39 // ---
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
40 item->fontid=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
41 if ( item->label ) free( item->label ); item->label=NULL;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
42 item->event=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
43 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
44
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
45 void appCopy( listItems * dest,listItems * source )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
46 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
47 dest->NumberOfItems=source->NumberOfItems;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
48 memcpy( &dest->Items,&source->Items,128 * sizeof( wItem ) );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
49
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
50 dest->NumberOfMenuItems=source->NumberOfMenuItems;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
51 memcpy( &dest->MenuItems,&source->MenuItems,32 * sizeof( wItem ) );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
52
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
53 memcpy( &dest->main,&source->main,sizeof( wItem ) );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
54 memcpy( &dest->sub,&source->sub,sizeof( wItem ) );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
55 memcpy( &dest->eq,&source->eq,sizeof( wItem ) );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
56 memcpy( &dest->menuBase,&source->menuBase,sizeof( wItem ) );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
57 memcpy( &dest->menuSelected,&source->menuSelected,sizeof( wItem ) );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
58 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
59
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
60 void appInitStruct( listItems * item )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
61 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
62 int i;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
63 for ( i=0;i<item->NumberOfItems;i++ )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
64 appClearItem( &item->Items[i] );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
65 for ( i=0;i<item->NumberOfMenuItems;i++ )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
66 appClearItem( &item->MenuItems[i] );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
67
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
68 item->NumberOfItems=-1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
69 memset( item->Items,0,128 * sizeof( wItem ) );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
70 item->NumberOfMenuItems=-1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
71 memset( item->MenuItems,0,32 * sizeof( wItem ) );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
72
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
73 appClearItem( &item->main );
1866
32b1bb50a0e8 some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents: 1823
diff changeset
74 item->mainDecoration=0;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
75 appClearItem( &item->sub );
1823
a6c67352ccac fix some bug.
pontscho
parents: 1729
diff changeset
76 item->sub.Bitmap.Width=384; item->sub.Bitmap.Height=384;
a6c67352ccac fix some bug.
pontscho
parents: 1729
diff changeset
77 item->sub.width=384; item->sub.height=384;
a6c67352ccac fix some bug.
pontscho
parents: 1729
diff changeset
78 item->sub.x=-1; item->sub.y=-1;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
79 appClearItem( &item->menuBase );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
80 appClearItem( &item->menuSelected );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
81 item->subR=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
82 item->subG=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
83 item->subB=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
84 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
85
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
86 int appFindKey( unsigned char * name )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
87 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
88 int i;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
89 for ( i=0;i<wsKeyNumber;i++ )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
90 if ( !strcmp( wsKeyNames[i].name,name ) ) return wsKeyNames[i].code;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
91 return -1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
92 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
93
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
94 int appFindMessage( unsigned char * str )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
95 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
96 int i;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
97 for ( i=0;i<evBoxs;i++ )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
98 if ( !strcmp( evNames[i].name,str ) ) return evNames[i].msg;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
99 return -1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
100 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
101
6218
8cfddba867b4 fix text render chrash ...
pontscho
parents: 5665
diff changeset
102 void appInit( void * disp )
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
103 {
1707
216aae08226c misc fixes/cleanup, Skin path stuff fixed
arpi
parents: 1696
diff changeset
104 skinDirInHome=get_path("Skin");
216aae08226c misc fixes/cleanup, Skin path stuff fixed
arpi
parents: 1696
diff changeset
105 skinMPlayerDir=DATADIR "/Skin";
216aae08226c misc fixes/cleanup, Skin path stuff fixed
arpi
parents: 1696
diff changeset
106 printf("SKIN dir 1: '%s'\n",skinDirInHome);
216aae08226c misc fixes/cleanup, Skin path stuff fixed
arpi
parents: 1696
diff changeset
107 printf("SKIN dir 2: '%s'\n",skinMPlayerDir);
6218
8cfddba867b4 fix text render chrash ...
pontscho
parents: 5665
diff changeset
108 if ( !skinName ) skinName=strdup( "default" );
1866
32b1bb50a0e8 some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents: 1823
diff changeset
109 switch ( skinRead( skinName ) )
1823
a6c67352ccac fix some bug.
pontscho
parents: 1729
diff changeset
110 {
3586
a0009a534428 itt a skin nem van hibauzenet igy.
pontscho
parents: 1866
diff changeset
111 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
112 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
113 }
6218
8cfddba867b4 fix text render chrash ...
pontscho
parents: 5665
diff changeset
114 mplInit( disp ); // does gtk & ws initialization, create windows
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
115 }