comparison gui/mplayer/menu.c @ 33084:b8779b19730e

Cosmetic: Rename menuBase menu. The new name corresponds better to the names of the other wItems and statements using it are more intelligible.
author ib
date Thu, 31 Mar 2011 12:25:32 +0000
parents 03b1051bed5c
children 9566100d88a1
comparison
equal deleted inserted replaced
33083:8c96263e0f09 33084:b8779b19730e
39 { 39 {
40 uint32_t * buf = NULL; 40 uint32_t * buf = NULL;
41 uint32_t * drw = NULL; 41 uint32_t * drw = NULL;
42 int x,y,tmp; 42 int x,y,tmp;
43 43
44 if ( !appMPlayer.menuIsPresent || !appMPlayer.menuBase.Bitmap.Image ) return; 44 if ( !appMPlayer.menuIsPresent || !appMPlayer.menu.Bitmap.Image ) return;
45 if ( !mplMenuRender && !appMPlayer.menuWindow.Visible ) return; 45 if ( !mplMenuRender && !appMPlayer.menuWindow.Visible ) return;
46 46
47 if ( mplMenuRender || mplMenuItem != mplOldMenuItem ) 47 if ( mplMenuRender || mplMenuItem != mplOldMenuItem )
48 { 48 {
49 memcpy( mplMenuDrawBuffer,appMPlayer.menuBase.Bitmap.Image,appMPlayer.menuBase.Bitmap.ImageSize ); 49 memcpy( mplMenuDrawBuffer,appMPlayer.menu.Bitmap.Image,appMPlayer.menu.Bitmap.ImageSize );
50 // --- 50 // ---
51 if ( mplMenuItem != -1 ) 51 if ( mplMenuItem != -1 )
52 { 52 {
53 buf=(uint32_t *)mplMenuDrawBuffer; 53 buf=(uint32_t *)mplMenuDrawBuffer;
54 drw=(uint32_t *)appMPlayer.menuSelected.Bitmap.Image; 54 drw=(uint32_t *)appMPlayer.menuSelected.Bitmap.Image;
55 for ( y=appMPlayer.menuItems[ mplMenuItem ].y; y < appMPlayer.menuItems[ mplMenuItem ].y + appMPlayer.menuItems[ mplMenuItem ].height; y++ ) 55 for ( y=appMPlayer.menuItems[ mplMenuItem ].y; y < appMPlayer.menuItems[ mplMenuItem ].y + appMPlayer.menuItems[ mplMenuItem ].height; y++ )
56 for ( x=appMPlayer.menuItems[ mplMenuItem ].x; x < appMPlayer.menuItems[ mplMenuItem ].x + appMPlayer.menuItems[ mplMenuItem ].width; x++ ) 56 for ( x=appMPlayer.menuItems[ mplMenuItem ].x; x < appMPlayer.menuItems[ mplMenuItem ].x + appMPlayer.menuItems[ mplMenuItem ].width; x++ )
57 { 57 {
58 tmp=drw[ y * appMPlayer.menuSelected.width + x ]; 58 tmp=drw[ y * appMPlayer.menuSelected.width + x ];
59 if ( tmp != 0x00ff00ff ) buf[ y * appMPlayer.menuBase.width + x ]=tmp; 59 if ( tmp != 0x00ff00ff ) buf[ y * appMPlayer.menu.width + x ]=tmp;
60 } 60 }
61 } 61 }
62 mplOldMenuItem=mplMenuItem; 62 mplOldMenuItem=mplMenuItem;
63 // --- 63 // ---
64 wsConvert( &appMPlayer.menuWindow,mplMenuDrawBuffer,appMPlayer.menuBase.Bitmap.ImageSize ); 64 wsConvert( &appMPlayer.menuWindow,mplMenuDrawBuffer,appMPlayer.menu.Bitmap.ImageSize );
65 mplMenuRender=0; 65 mplMenuRender=0;
66 } 66 }
67 wsPutImage( &appMPlayer.menuWindow ); 67 wsPutImage( &appMPlayer.menuWindow );
68 } 68 }
69 69
70 void mplMenuMouseHandle( int X,int Y,int RX,int RY ) 70 void mplMenuMouseHandle( int X,int Y,int RX,int RY )
71 { 71 {
72 int x,y,i; 72 int x,y,i;
73 73
74 if ( !appMPlayer.menuBase.Bitmap.Image ) return; 74 if ( !appMPlayer.menu.Bitmap.Image ) return;
75 75
76 mplMenuItem=-1; 76 mplMenuItem=-1;
77 x=RX - appMPlayer.menuWindow.X; 77 x=RX - appMPlayer.menuWindow.X;
78 y=RY - appMPlayer.menuWindow.Y; 78 y=RY - appMPlayer.menuWindow.Y;
79 if ( ( x < 0 ) || ( y < 0 ) || ( x > appMPlayer.menuBase.width ) || ( y > appMPlayer.menuBase.height ) ) 79 if ( ( x < 0 ) || ( y < 0 ) || ( x > appMPlayer.menu.width ) || ( y > appMPlayer.menu.height ) )
80 { 80 {
81 wsPostRedisplay( &appMPlayer.menuWindow ); 81 wsPostRedisplay( &appMPlayer.menuWindow );
82 return; 82 return;
83 } 83 }
84 84
93 93
94 void mplShowMenu( int mx,int my ) 94 void mplShowMenu( int mx,int my )
95 { 95 {
96 int x,y; 96 int x,y;
97 97
98 if ( !appMPlayer.menuIsPresent || !appMPlayer.menuBase.Bitmap.Image ) return; 98 if ( !appMPlayer.menuIsPresent || !appMPlayer.menu.Bitmap.Image ) return;
99 99
100 x=mx; 100 x=mx;
101 if ( x + appMPlayer.menuWindow.Width > wsMaxX ) x=wsMaxX - appMPlayer.menuWindow.Width - 1 + wsOrgX; 101 if ( x + appMPlayer.menuWindow.Width > wsMaxX ) x=wsMaxX - appMPlayer.menuWindow.Width - 1 + wsOrgX;
102 y=my; 102 y=my;
103 if ( y + appMPlayer.menuWindow.Height > wsMaxY ) y=wsMaxY - appMPlayer.menuWindow.Height - 1 + wsOrgY; 103 if ( y + appMPlayer.menuWindow.Height > wsMaxY ) y=wsMaxY - appMPlayer.menuWindow.Height - 1 + wsOrgY;
116 116
117 void mplHideMenu( int mx,int my,int w ) 117 void mplHideMenu( int mx,int my,int w )
118 { 118 {
119 int x,y,i=mplMenuItem; 119 int x,y,i=mplMenuItem;
120 120
121 if ( !appMPlayer.menuIsPresent || !appMPlayer.menuBase.Bitmap.Image ) return; 121 if ( !appMPlayer.menuIsPresent || !appMPlayer.menu.Bitmap.Image ) return;
122 122
123 x=mx-mplMenuX; 123 x=mx-mplMenuX;
124 y=my-mplMenuY; 124 y=my-mplMenuY;
125 // x=RX - appMPlayer.menuWindow.X; 125 // x=RX - appMPlayer.menuWindow.X;
126 // y=RY - appMPlayer.menuWindow.Y; 126 // y=RY - appMPlayer.menuWindow.Y;
141 } 141 }
142 142
143 void mplMenuInit( void ) 143 void mplMenuInit( void )
144 { 144 {
145 145
146 if ( mplMenuIsInitialized || !appMPlayer.menuIsPresent || !appMPlayer.menuBase.Bitmap.Image ) return; 146 if ( mplMenuIsInitialized || !appMPlayer.menuIsPresent || !appMPlayer.menu.Bitmap.Image ) return;
147 147
148 appMPlayer.menuBase.x=0; 148 appMPlayer.menu.x=0;
149 appMPlayer.menuBase.y=0; 149 appMPlayer.menu.y=0;
150 150
151 if ( ( mplMenuDrawBuffer = calloc( 1,appMPlayer.menuBase.Bitmap.ImageSize ) ) == NULL ) 151 if ( ( mplMenuDrawBuffer = calloc( 1,appMPlayer.menu.Bitmap.ImageSize ) ) == NULL )
152 { 152 {
153 #ifdef DEBUG 153 #ifdef DEBUG
154 mp_msg( MSGT_GPLAYER,MSGL_DBG2,MSGTR_NEMFMR ); 154 mp_msg( MSGT_GPLAYER,MSGL_DBG2,MSGTR_NEMFMR );
155 #endif 155 #endif
156 gtkMessageBox( GTK_MB_FATAL,MSGTR_NEMFMR ); 156 gtkMessageBox( GTK_MB_FATAL,MSGTR_NEMFMR );
157 return; 157 return;
158 } 158 }
159 159
160 wsCreateWindow( &appMPlayer.menuWindow, 160 wsCreateWindow( &appMPlayer.menuWindow,
161 appMPlayer.menuBase.x,appMPlayer.menuBase.y,appMPlayer.menuBase.width,appMPlayer.menuBase.height, 161 appMPlayer.menu.x,appMPlayer.menu.y,appMPlayer.menu.width,appMPlayer.menu.height,
162 wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,wsOverredirect|wsHideFrame|wsMaxSize|wsMinSize|wsHideWindow,"MPlayer menu" ); 162 wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,wsOverredirect|wsHideFrame|wsMaxSize|wsMinSize|wsHideWindow,"MPlayer menu" );
163 163
164 wsSetShape( &appMPlayer.menuWindow,appMPlayer.menuBase.Mask.Image ); 164 wsSetShape( &appMPlayer.menuWindow,appMPlayer.menu.Mask.Image );
165 165
166 #ifdef DEBUG 166 #ifdef DEBUG
167 mp_msg( MSGT_GPLAYER,MSGL_DBG2,"menu: 0x%x\n",(int)appMPlayer.menuWindow.WindowID ); 167 mp_msg( MSGT_GPLAYER,MSGL_DBG2,"menu: 0x%x\n",(int)appMPlayer.menuWindow.WindowID );
168 #endif 168 #endif
169 169