Mercurial > mplayer.hg
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 |
rev | line source |
---|---|
1693 | 1 |
2 unsigned char * mplMenuDrawBuffer = NULL; | |
3 int mplMenuRender = 1; | |
4 int mplMenuItem = -1; | |
5 int mplOldMenuItem = -1; | |
6 int mplMenuX,mplMenuY; | |
7 | |
5919 | 8 void mplHideMenu( int mx,int my,int w ); |
1693 | 9 |
10 void mplMenuDraw( wsParamDisplay ) | |
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 | 14 int x,y,tmp; |
1693 | 15 |
16 if ( !appMPlayer.menuBase.Bitmap.Image ) return; | |
3476 | 17 if ( !mplMenuRender && !appMPlayer.menuWindow.Visible ) return; |
1693 | 18 |
19 if ( mplMenuRender || mplMenuItem != mplOldMenuItem ) | |
20 { | |
21 memcpy( mplMenuDrawBuffer,appMPlayer.menuBase.Bitmap.Image,appMPlayer.menuBase.Bitmap.ImageSize ); | |
22 // --- | |
23 if ( mplMenuItem != -1 ) | |
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 | 27 for ( y=appMPlayer.MenuItems[ mplMenuItem ].y; y < appMPlayer.MenuItems[ mplMenuItem ].y + appMPlayer.MenuItems[ mplMenuItem ].height; y++ ) |
28 for ( x=appMPlayer.MenuItems[ mplMenuItem ].x; x < appMPlayer.MenuItems[ mplMenuItem ].x + appMPlayer.MenuItems[ mplMenuItem ].width; x++ ) | |
29 { | |
30 tmp=drw[ y * appMPlayer.menuSelected.width + x ]; | |
31 if ( tmp != 0x00ff00ff ) buf[ y * appMPlayer.menuBase.width + x ]=tmp; | |
32 } | |
33 } | |
34 mplOldMenuItem=mplMenuItem; | |
35 // --- | |
36 wsConvert( &appMPlayer.menuWindow,mplMenuDrawBuffer,appMPlayer.menuBase.Bitmap.ImageSize ); | |
37 mplMenuRender=0; | |
38 } | |
39 wsPutImage( &appMPlayer.menuWindow ); | |
40 } | |
41 | |
42 void mplMenuMouseHandle( int X,int Y,int RX,int RY ) | |
43 { | |
44 int x,y,i; | |
45 | |
46 if ( !appMPlayer.menuBase.Bitmap.Image ) return; | |
47 | |
48 mplMenuItem=-1; | |
49 x=RX - appMPlayer.menuWindow.X; | |
50 y=RY - appMPlayer.menuWindow.Y; | |
51 if ( ( x < 0 ) || ( y < 0 ) || ( x > appMPlayer.menuBase.width ) || ( y > appMPlayer.menuBase.height ) ) | |
52 { | |
53 wsPostRedisplay( &appMPlayer.menuWindow ); | |
54 return; | |
55 } | |
56 | |
1823 | 57 for( i=0;i<=appMPlayer.NumberOfMenuItems;i++ ) |
1693 | 58 { |
59 if ( wgIsRect( x,y, | |
60 appMPlayer.MenuItems[i].x,appMPlayer.MenuItems[i].y, | |
1823 | 61 appMPlayer.MenuItems[i].x+appMPlayer.MenuItems[i].width,appMPlayer.MenuItems[i].y+appMPlayer.MenuItems[i].height ) ) { mplMenuItem=i; break; } |
1693 | 62 } |
63 wsPostRedisplay( &appMPlayer.menuWindow ); | |
64 } | |
65 | |
66 void mplShowMenu( int mx,int my ) | |
67 { | |
68 int x,y; | |
69 | |
70 if ( !appMPlayer.menuBase.Bitmap.Image ) return; | |
71 | |
72 x=mx; | |
73 if ( x + appMPlayer.menuWindow.Width > wsMaxX ) x=wsMaxX - appMPlayer.menuWindow.Width - 1; | |
74 y=my; | |
75 if ( y + appMPlayer.menuWindow.Height > wsMaxY ) y=wsMaxY - appMPlayer.menuWindow.Height - 1; | |
76 | |
77 mplMenuX=x; mplMenuY=y; | |
78 | |
79 mplMenuItem = 0; | |
80 | |
2854 | 81 wsMoveWindow( &appMPlayer.menuWindow,False,x,y ); |
6146 | 82 wsMoveTopWindow( wsDisplay,appMPlayer.menuWindow.WindowID ); |
6221 | 83 wsSetLayer( wsDisplay,appMPlayer.menuWindow.WindowID,1 ); |
3476 | 84 mplMenuRender=1; |
1693 | 85 wsVisibleWindow( &appMPlayer.menuWindow,wsShowWindow ); |
3476 | 86 wsPostRedisplay( &appMPlayer.menuWindow ); |
1693 | 87 } |
88 | |
5919 | 89 void mplHideMenu( int mx,int my,int w ) |
1693 | 90 { |
91 int x,y,i=mplMenuItem; | |
92 | |
93 if ( !appMPlayer.menuBase.Bitmap.Image ) return; | |
94 | |
95 x=mx-mplMenuX; | |
96 y=my-mplMenuY; | |
1823 | 97 // x=RX - appMPlayer.menuWindow.X; |
98 // y=RY - appMPlayer.menuWindow.Y; | |
1693 | 99 |
100 wsVisibleWindow( &appMPlayer.menuWindow,wsHideWindow ); | |
101 | |
102 if ( ( x < 0 ) || ( y < 0 ) ) return; | |
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 | 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 | 106 if ( wgIsRect( x,y, |
107 appMPlayer.MenuItems[i].x,appMPlayer.MenuItems[i].y, | |
108 appMPlayer.MenuItems[i].x+appMPlayer.MenuItems[i].width, | |
109 appMPlayer.MenuItems[i].y+appMPlayer.MenuItems[i].height ) ) | |
110 { | |
5919 | 111 mplEventHandling( appMPlayer.MenuItems[i].msg,(float)w ); |
1693 | 112 } |
113 } | |
114 | |
115 void mplMenuInit( void ) | |
116 { | |
117 | |
118 if ( !appMPlayer.menuBase.Bitmap.Image ) return; | |
119 | |
120 appMPlayer.menuBase.x=0; | |
121 appMPlayer.menuBase.y=0; | |
122 | |
123 if ( ( mplMenuDrawBuffer = calloc( 1,appMPlayer.menuBase.Bitmap.ImageSize ) ) == NULL ) | |
124 { | |
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 | 127 #endif |
1907 | 128 gtkMessageBox( GTK_MB_FATAL,MSGTR_NEMFMR ); |
1693 | 129 return; |
130 } | |
131 | |
132 wsCreateWindow( &appMPlayer.menuWindow, | |
133 appMPlayer.menuBase.x,appMPlayer.menuBase.y,appMPlayer.menuBase.width,appMPlayer.menuBase.height, | |
4411 | 134 wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,wsOverredirect|wsHideFrame|wsMaxSize|wsMinSize|wsHideWindow,"MPlayer menu" ); |
1693 | 135 |
6221 | 136 wsSetShape( &appMPlayer.menuWindow,appMPlayer.menuBase.Mask.Image ); |
137 | |
1693 | 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 | 140 #endif |
141 | |
142 appMPlayer.menuWindow.ReDraw=mplMenuDraw; | |
143 // appMPlayer.menuWindow.MouseHandler=mplMenuMouseHandle; | |
144 // appMPlayer.menuWindow.KeyHandler=mplMainKeyHandle; | |
3476 | 145 mplMenuRender=1; wsPostRedisplay( &appMPlayer.menuWindow ); |
1693 | 146 } |