annotate Gui/mplayer/menu.h @ 6298:d42cb911d7f7

add network streaming support for gui
author pontscho
date Tue, 04 Jun 2002 16:38:18 +0000
parents 4b2459557340
children
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 unsigned char * mplMenuDrawBuffer = NULL;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
3 int mplMenuRender = 1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
4 int mplMenuItem = -1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
5 int mplOldMenuItem = -1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
6 int mplMenuX,mplMenuY;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
7
5919
60cf2bca993f some bug fix
pontscho
parents: 4818
diff changeset
8 void mplHideMenu( int mx,int my,int w );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
9
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
10 void mplMenuDraw( wsParamDisplay )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
11 {
6159
dcf195b784bf applied 64bit patch from Ulrich Hecht <uli@suse.de>
pontscho
parents: 6146
diff changeset
12 uint32_t * buf = NULL;
dcf195b784bf applied 64bit patch from Ulrich Hecht <uli@suse.de>
pontscho
parents: 6146
diff changeset
13 uint32_t * drw = NULL;
4465
b013d01d9968 small bugfixes, and kill other warning
pontscho
parents: 4411
diff changeset
14 int x,y,tmp;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
15
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
16 if ( !appMPlayer.menuBase.Bitmap.Image ) return;
3476
d8e46c2576c5 fix black ize
pontscho
parents: 2854
diff changeset
17 if ( !mplMenuRender && !appMPlayer.menuWindow.Visible ) return;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
18
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
19 if ( mplMenuRender || mplMenuItem != mplOldMenuItem )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
20 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
21 memcpy( mplMenuDrawBuffer,appMPlayer.menuBase.Bitmap.Image,appMPlayer.menuBase.Bitmap.ImageSize );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
22 // ---
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
23 if ( mplMenuItem != -1 )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
24 {
6159
dcf195b784bf applied 64bit patch from Ulrich Hecht <uli@suse.de>
pontscho
parents: 6146
diff changeset
25 buf=(uint32_t *)mplMenuDrawBuffer;
dcf195b784bf applied 64bit patch from Ulrich Hecht <uli@suse.de>
pontscho
parents: 6146
diff changeset
26 drw=(uint32_t *)appMPlayer.menuSelected.Bitmap.Image;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
27 for ( y=appMPlayer.MenuItems[ mplMenuItem ].y; y < appMPlayer.MenuItems[ mplMenuItem ].y + appMPlayer.MenuItems[ mplMenuItem ].height; y++ )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
28 for ( x=appMPlayer.MenuItems[ mplMenuItem ].x; x < appMPlayer.MenuItems[ mplMenuItem ].x + appMPlayer.MenuItems[ mplMenuItem ].width; x++ )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
29 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
30 tmp=drw[ y * appMPlayer.menuSelected.width + x ];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
31 if ( tmp != 0x00ff00ff ) buf[ y * appMPlayer.menuBase.width + x ]=tmp;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
32 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
33 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
34 mplOldMenuItem=mplMenuItem;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
35 // ---
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
36 wsConvert( &appMPlayer.menuWindow,mplMenuDrawBuffer,appMPlayer.menuBase.Bitmap.ImageSize );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
37 mplMenuRender=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
38 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
39 wsPutImage( &appMPlayer.menuWindow );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
40 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
41
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
42 void mplMenuMouseHandle( int X,int Y,int RX,int RY )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
43 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
44 int x,y,i;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
45
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
46 if ( !appMPlayer.menuBase.Bitmap.Image ) return;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
47
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
48 mplMenuItem=-1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
49 x=RX - appMPlayer.menuWindow.X;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
50 y=RY - appMPlayer.menuWindow.Y;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
51 if ( ( x < 0 ) || ( y < 0 ) || ( x > appMPlayer.menuBase.width ) || ( y > appMPlayer.menuBase.height ) )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
52 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
53 wsPostRedisplay( &appMPlayer.menuWindow );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
54 return;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
55 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
56
1823
a6c67352ccac fix some bug.
pontscho
parents: 1693
diff changeset
57 for( i=0;i<=appMPlayer.NumberOfMenuItems;i++ )
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
58 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
59 if ( wgIsRect( x,y,
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
60 appMPlayer.MenuItems[i].x,appMPlayer.MenuItems[i].y,
1823
a6c67352ccac fix some bug.
pontscho
parents: 1693
diff changeset
61 appMPlayer.MenuItems[i].x+appMPlayer.MenuItems[i].width,appMPlayer.MenuItems[i].y+appMPlayer.MenuItems[i].height ) ) { mplMenuItem=i; break; }
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
62 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
63 wsPostRedisplay( &appMPlayer.menuWindow );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
64 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
65
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
66 void mplShowMenu( int mx,int my )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
67 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
68 int x,y;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
69
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
70 if ( !appMPlayer.menuBase.Bitmap.Image ) return;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
71
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
72 x=mx;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
73 if ( x + appMPlayer.menuWindow.Width > wsMaxX ) x=wsMaxX - appMPlayer.menuWindow.Width - 1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
74 y=my;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
75 if ( y + appMPlayer.menuWindow.Height > wsMaxY ) y=wsMaxY - appMPlayer.menuWindow.Height - 1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
76
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
77 mplMenuX=x; mplMenuY=y;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
78
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
79 mplMenuItem = 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
80
2854
fd44ecf77f8d move bug meg fileload bug fixed asszem.
pontscho
parents: 1907
diff changeset
81 wsMoveWindow( &appMPlayer.menuWindow,False,x,y );
6146
b9651eb9749e fix some gtk bug...
pontscho
parents: 6145
diff changeset
82 wsMoveTopWindow( wsDisplay,appMPlayer.menuWindow.WindowID );
6221
4b2459557340 add XShape support for gui's submenu
pontscho
parents: 6159
diff changeset
83 wsSetLayer( wsDisplay,appMPlayer.menuWindow.WindowID,1 );
3476
d8e46c2576c5 fix black ize
pontscho
parents: 2854
diff changeset
84 mplMenuRender=1;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
85 wsVisibleWindow( &appMPlayer.menuWindow,wsShowWindow );
3476
d8e46c2576c5 fix black ize
pontscho
parents: 2854
diff changeset
86 wsPostRedisplay( &appMPlayer.menuWindow );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
87 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
88
5919
60cf2bca993f some bug fix
pontscho
parents: 4818
diff changeset
89 void mplHideMenu( int mx,int my,int w )
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
90 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
91 int x,y,i=mplMenuItem;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
92
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
93 if ( !appMPlayer.menuBase.Bitmap.Image ) return;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
94
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
95 x=mx-mplMenuX;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
96 y=my-mplMenuY;
1823
a6c67352ccac fix some bug.
pontscho
parents: 1693
diff changeset
97 // x=RX - appMPlayer.menuWindow.X;
a6c67352ccac fix some bug.
pontscho
parents: 1693
diff changeset
98 // y=RY - appMPlayer.menuWindow.Y;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
99
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
100 wsVisibleWindow( &appMPlayer.menuWindow,wsHideWindow );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
101
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
102 if ( ( x < 0 ) || ( y < 0 ) ) return;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
103
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4465
diff changeset
104 // printf( "---------> %d %d,%d\n",i,x,y );
3476
d8e46c2576c5 fix black ize
pontscho
parents: 2854
diff changeset
105 // printf( "--------> mi: %d,%d %dx%d\n",appMPlayer.MenuItems[i].x,appMPlayer.MenuItems[i].y,appMPlayer.MenuItems[i].width,appMPlayer.MenuItems[i].height );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
106 if ( wgIsRect( x,y,
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
107 appMPlayer.MenuItems[i].x,appMPlayer.MenuItems[i].y,
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
108 appMPlayer.MenuItems[i].x+appMPlayer.MenuItems[i].width,
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
109 appMPlayer.MenuItems[i].y+appMPlayer.MenuItems[i].height ) )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
110 {
5919
60cf2bca993f some bug fix
pontscho
parents: 4818
diff changeset
111 mplEventHandling( appMPlayer.MenuItems[i].msg,(float)w );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
112 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
113 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
114
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
115 void mplMenuInit( void )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
116 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
117
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
118 if ( !appMPlayer.menuBase.Bitmap.Image ) return;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
119
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
120 appMPlayer.menuBase.x=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
121 appMPlayer.menuBase.y=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
122
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
123 if ( ( mplMenuDrawBuffer = calloc( 1,appMPlayer.menuBase.Bitmap.ImageSize ) ) == NULL )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
124 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
125 #ifdef DEBUG
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4465
diff changeset
126 mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[menu.h] %s",MSGTR_NEMFMR );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
127 #endif
1907
83291fafe66c add new features. and fix skin error loop.
pontscho
parents: 1884
diff changeset
128 gtkMessageBox( GTK_MB_FATAL,MSGTR_NEMFMR );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
129 return;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
130 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
131
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
132 wsCreateWindow( &appMPlayer.menuWindow,
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
133 appMPlayer.menuBase.x,appMPlayer.menuBase.y,appMPlayer.menuBase.width,appMPlayer.menuBase.height,
4411
a97f908988ed small changes
pontscho
parents: 3476
diff changeset
134 wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,wsOverredirect|wsHideFrame|wsMaxSize|wsMinSize|wsHideWindow,"MPlayer menu" );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
135
6221
4b2459557340 add XShape support for gui's submenu
pontscho
parents: 6159
diff changeset
136 wsSetShape( &appMPlayer.menuWindow,appMPlayer.menuBase.Mask.Image );
4b2459557340 add XShape support for gui's submenu
pontscho
parents: 6159
diff changeset
137
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
138 #ifdef DEBUG
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 4465
diff changeset
139 mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[menu.h] menu: 0x%x\n",(int)appMPlayer.menuWindow.WindowID );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
140 #endif
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
141
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
142 appMPlayer.menuWindow.ReDraw=mplMenuDraw;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
143 // appMPlayer.menuWindow.MouseHandler=mplMenuMouseHandle;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
144 // appMPlayer.menuWindow.KeyHandler=mplMainKeyHandle;
3476
d8e46c2576c5 fix black ize
pontscho
parents: 2854
diff changeset
145 mplMenuRender=1; wsPostRedisplay( &appMPlayer.menuWindow );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
146 }