annotate Gui/app.c @ 5961:f4f3cfcd0d64

10l - MMX rgb2bgr 32bpp expects num_of_bytes instead of num_of_pixels
author arpi
date Fri, 03 May 2002 23:16:07 +0000
parents 3e7f39c4110c
children 8cfddba867b4
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;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
41 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
42
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
43 void appCopy( listItems * dest,listItems * source )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
44 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
45 dest->NumberOfItems=source->NumberOfItems;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
46 memcpy( &dest->Items,&source->Items,128 * sizeof( wItem ) );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
47
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
48 dest->NumberOfMenuItems=source->NumberOfMenuItems;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
49 memcpy( &dest->MenuItems,&source->MenuItems,32 * sizeof( wItem ) );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
50
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
51 memcpy( &dest->main,&source->main,sizeof( wItem ) );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
52 memcpy( &dest->sub,&source->sub,sizeof( wItem ) );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
53 memcpy( &dest->eq,&source->eq,sizeof( wItem ) );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
54 memcpy( &dest->menuBase,&source->menuBase,sizeof( wItem ) );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
55 memcpy( &dest->menuSelected,&source->menuSelected,sizeof( wItem ) );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
56 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
57
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
58 void appInitStruct( listItems * item )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
59 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
60 int i;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
61 for ( i=0;i<item->NumberOfItems;i++ )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
62 appClearItem( &item->Items[i] );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
63 for ( i=0;i<item->NumberOfMenuItems;i++ )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
64 appClearItem( &item->MenuItems[i] );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
65
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
66 item->NumberOfItems=-1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
67 memset( item->Items,0,128 * sizeof( wItem ) );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
68 item->NumberOfMenuItems=-1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
69 memset( item->MenuItems,0,32 * sizeof( wItem ) );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
70
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
71 appClearItem( &item->main );
1866
32b1bb50a0e8 some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents: 1823
diff changeset
72 item->mainDecoration=0;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
73 appClearItem( &item->sub );
1823
a6c67352ccac fix some bug.
pontscho
parents: 1729
diff changeset
74 item->sub.Bitmap.Width=384; item->sub.Bitmap.Height=384;
a6c67352ccac fix some bug.
pontscho
parents: 1729
diff changeset
75 item->sub.width=384; item->sub.height=384;
a6c67352ccac fix some bug.
pontscho
parents: 1729
diff changeset
76 item->sub.x=-1; item->sub.y=-1;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
77 appClearItem( &item->menuBase );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
78 appClearItem( &item->menuSelected );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
79 item->subR=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
80 item->subG=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
81 item->subB=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
82 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
83
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
84 int appFindKey( unsigned char * name )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
85 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
86 int i;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
87 for ( i=0;i<wsKeyNumber;i++ )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
88 if ( !strcmp( wsKeyNames[i].name,name ) ) return wsKeyNames[i].code;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
89 return -1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
90 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
91
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
92 int appFindMessage( unsigned char * str )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
93 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
94 int i;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
95 for ( i=0;i<evBoxs;i++ )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
96 if ( !strcmp( evNames[i].name,str ) ) return evNames[i].msg;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
97 return -1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
98 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
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
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
101 {
1707
216aae08226c misc fixes/cleanup, Skin path stuff fixed
arpi
parents: 1696
diff changeset
102 skinDirInHome=get_path("Skin");
216aae08226c misc fixes/cleanup, Skin path stuff fixed
arpi
parents: 1696
diff changeset
103 skinMPlayerDir=DATADIR "/Skin";
216aae08226c misc fixes/cleanup, Skin path stuff fixed
arpi
parents: 1696
diff changeset
104 printf("SKIN dir 1: '%s'\n",skinDirInHome);
216aae08226c misc fixes/cleanup, Skin path stuff fixed
arpi
parents: 1696
diff changeset
105 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
106 if ( !skinName )
32b1bb50a0e8 some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents: 1823
diff changeset
107 {
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
108 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
109 strcpy( skinName,"default" );
32b1bb50a0e8 some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents: 1823
diff changeset
110 }
32b1bb50a0e8 some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents: 1823
diff changeset
111 switch ( skinRead( skinName ) )
1823
a6c67352ccac fix some bug.
pontscho
parents: 1729
diff changeset
112 {
3586
a0009a534428 itt a skin nem van hibauzenet igy.
pontscho
parents: 1866
diff changeset
113 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
114 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
115 }
a6c67352ccac fix some bug.
pontscho
parents: 1729
diff changeset
116 mplInit( argc,argv,envp,disp ); // does gtk & ws initialization, create windows
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
117 }