void mplHideMenu( int mx,int my,int w ) { int x,y,i=mplMenuItem; if ( !appMPlayer.menuIsPresent || !appMPlayer.menuBase.Bitmap.Image ) return; x=mx-mplMenuX; y=my-mplMenuY; // x=RX - appMPlayer.menuWindow.X; // y=RY - appMPlayer.menuWindow.Y; wsVisibleWindow( &appMPlayer.menuWindow,wsHideWindow ); if ( ( x < 0 ) || ( y < 0 ) ) return; // printf( "---------> %d %d,%d\n",i,x,y ); // printf( "--------> mi: %d,%d %dx%d\n",appMPlayer.MenuItems[i].x,appMPlayer.MenuItems[i].y,appMPlayer.MenuItems[i].width,appMPlayer.MenuItems[i].height ); if ( wgIsRect( x,y, appMPlayer.MenuItems[i].x,appMPlayer.MenuItems[i].y, appMPlayer.MenuItems[i].x+appMPlayer.MenuItems[i].width, appMPlayer.MenuItems[i].y+appMPlayer.MenuItems[i].height ) ) { mplEventHandling( appMPlayer.MenuItems[i].msg,(float)w ); } }
void mplMenuMouseHandle( int X,int Y,int RX,int RY ) { int x,y,i; if ( !appMPlayer.menuBase.Bitmap.Image ) return; mplMenuItem=-1; x=RX - appMPlayer.menuWindow.X; y=RY - appMPlayer.menuWindow.Y; if ( ( x < 0 ) || ( y < 0 ) || ( x > appMPlayer.menuBase.width ) || ( y > appMPlayer.menuBase.height ) ) { wsPostRedisplay( &appMPlayer.menuWindow ); return; } for( i=0;i<=appMPlayer.NumberOfMenuItems;i++ ) { if ( wgIsRect( x,y, appMPlayer.MenuItems[i].x,appMPlayer.MenuItems[i].y, appMPlayer.MenuItems[i].x+appMPlayer.MenuItems[i].width,appMPlayer.MenuItems[i].y+appMPlayer.MenuItems[i].height ) ) { mplMenuItem=i; break; } } wsPostRedisplay( &appMPlayer.menuWindow ); }
void mplMainMouseHandle( int Button,int X,int Y,int RX,int RY ) { static int itemtype = 0; int i; wItem * item = NULL; float value = 0.0f; static int SelectedItem = -1; int currentselected = -1; for ( i=0;i < appMPlayer.NumberOfItems + 1;i++ ) if ( ( appMPlayer.Items[i].pressed != btnDisabled )&& ( wgIsRect( X,Y,appMPlayer.Items[i].x,appMPlayer.Items[i].y,appMPlayer.Items[i].x+appMPlayer.Items[i].width,appMPlayer.Items[i].y+appMPlayer.Items[i].height ) ) ) { currentselected=i; break; } switch ( Button ) { case wsPMMouseButton: gtkShow( evHidePopUpMenu,NULL ); mplShowMenu( RX,RY ); itemtype=itPRMButton; break; case wsRMMouseButton: mplHideMenu( RX,RY,0 ); break; case wsPLMouseButton: gtkShow( evHidePopUpMenu,NULL ); sx=X; sy=Y; boxMoved=1; itemtype=itPLMButton; SelectedItem=currentselected; if ( SelectedItem == -1 ) break; boxMoved=0; item=&appMPlayer.Items[SelectedItem]; itemtype=item->type; item->pressed=btnPressed; switch( item->type ) { case itButton: if ( ( SelectedItem > -1 ) && ( ( ( item->msg == evPlaySwitchToPause && item->msg == evPauseSwitchToPlay ) ) || ( ( item->msg == evPauseSwitchToPlay && item->msg == evPlaySwitchToPause ) ) ) ) { item->pressed=btnDisabled; } break; } break; case wsRLMouseButton: boxMoved=0; item=&appMPlayer.Items[SelectedItem]; item->pressed=btnReleased; SelectedItem=-1; if ( currentselected == - 1 ) { itemtype=0; break; } value=0; switch( itemtype ) { case itPotmeter: case itHPotmeter: btnModify( item->msg,(float)( X - item->x ) / item->width * 100.0f ); mplEventHandling( item->msg,item->value ); value=item->value; break; case itVPotmeter: btnModify( item->msg, ( 1. - (float)( Y - item->y ) / item->height) * 100.0f ); mplEventHandling( item->msg,item->value ); value=item->value; break; } mplEventHandling( item->msg,value ); itemtype=0; break; case wsRRMouseButton: gtkShow( evShowPopUpMenu,NULL ); break; // --- rolled mouse ... de szar :))) case wsP5MouseButton: value=-2.5f; goto rollerhandled; case wsP4MouseButton: value= 2.5f; rollerhandled: item=&appMPlayer.Items[currentselected]; if ( ( item->type == itHPotmeter )||( item->type == itVPotmeter )||( item->type == itPotmeter ) ) { item->value+=value; btnModify( item->msg,item->value ); mplEventHandling( item->msg,item->value ); } break; // --- moving case wsMoveMouse: item=&appMPlayer.Items[SelectedItem]; switch ( itemtype ) { case itPLMButton: wsMoveWindow( &appMPlayer.mainWindow,False,RX - abs( sx ),RY - abs( sy ) ); mplMainRender=0; break; case itPRMButton: mplMenuMouseHandle( X,Y,RX,RY ); break; case itPotmeter: item->value=(float)( X - item->x ) / item->width * 100.0f; goto potihandled; case itVPotmeter: item->value=(1. - (float)( Y - item->y ) / item->height) * 100.0f; goto potihandled; case itHPotmeter: item->value=(float)( X - item->x ) / item->width * 100.0f; potihandled: if ( item->value > 100.0f ) item->value=100.0f; if ( item->value < 0.0f ) item->value=0.0f; mplEventHandling( item->msg,item->value ); break; } break; } }
static void uiPlaybarMouseHandle( int Button, int X, int Y, int RX, int RY ) { static int itemtype = 0; int i; wItem * item = NULL; float value = 0.0f; static int SelectedItem = -1; int currentselected = -1; for ( i=0;i <= guiApp.IndexOfPlaybarItems;i++ ) if ( ( guiApp.playbarItems[i].pressed != btnDisabled )&& ( wgIsRect( X,Y,guiApp.playbarItems[i].x,guiApp.playbarItems[i].y,guiApp.playbarItems[i].x+guiApp.playbarItems[i].width,guiApp.playbarItems[i].y+guiApp.playbarItems[i].height ) ) ) { currentselected=i; break; } switch ( Button ) { case wsPMMouseButton: gtkShow( evHidePopUpMenu,NULL ); uiShowMenu( RX,RY ); break; case wsRMMouseButton: uiHideMenu( RX,RY,0 ); break; case wsRRMouseButton: gtkShow( evShowPopUpMenu,NULL ); break; // --- case wsPLMouseButton: gtkShow( evHidePopUpMenu,NULL ); SelectedItem=currentselected; if ( SelectedItem == -1 ) break; // yeees, i'm move the f*****g window item=&guiApp.playbarItems[SelectedItem]; itemtype=item->type; item->pressed=btnPressed; switch( item->type ) { case itButton: if ( ( SelectedItem > -1 ) && ( ( ( item->message == evPlaySwitchToPause && item->message == evPauseSwitchToPlay ) ) || ( ( item->message == evPauseSwitchToPlay && item->message == evPlaySwitchToPause ) ) ) ) { item->pressed=btnDisabled; } break; } break; case wsRLMouseButton: if ( SelectedItem != -1 ) // NOTE TO MYSELF: only if itButton, itHPotmeter or itVPotmeter { item=&guiApp.playbarItems[SelectedItem]; item->pressed=btnReleased; } SelectedItem=-1; if ( currentselected == - 1 ) { itemtype=0; break; } value=0; switch( itemtype ) { case itPotmeter: case itHPotmeter: btnModify( item->message,(float)( X - item->x ) / item->width * 100.0f ); uiEventHandling( item->message,item->value ); value=item->value; break; case itVPotmeter: btnModify( item->message, ( 1. - (float)( Y - item->y ) / item->height) * 100.0f ); uiEventHandling( item->message,item->value ); value=item->value; break; } uiEventHandling( item->message,value ); itemtype=0; break; // --- case wsP5MouseButton: value=-2.5f; goto rollerhandled; case wsP4MouseButton: value= 2.5f; rollerhandled: item=&guiApp.playbarItems[currentselected]; if ( ( item->type == itHPotmeter )||( item->type == itVPotmeter )||( item->type == itPotmeter ) ) { item->value+=value; btnModify( item->message,item->value ); uiEventHandling( item->message,item->value ); } break; // --- case wsMoveMouse: item=&guiApp.playbarItems[SelectedItem]; switch ( itemtype ) { case itPRMButton: uiMenuMouseHandle( X,Y,RX,RY ); break; case itPotmeter: item->value=(float)( X - item->x ) / item->width * 100.0f; goto potihandled; case itVPotmeter: item->value=(1. - (float)( Y - item->y ) / item->height) * 100.0f; goto potihandled; case itHPotmeter: item->value=(float)( X - item->x ) / item->width * 100.0f; potihandled: if ( item->value > 100.0f ) item->value=100.0f; if ( item->value < 0.0f ) item->value=0.0f; uiEventHandling( item->message,item->value ); break; } break; } }