📄 mw.c
字号:
case evNormalSize: btnSet( evFullScreen,btnReleased ); if ( guiIntfStruct.Playing ) { if ( appMPlayer.subWindow.isFullScreen ) { mplFullScreen(); } wsResizeWindow( &appMPlayer.subWindow, guiIntfStruct.MovieWidth, guiIntfStruct.MovieHeight ); wsMoveWindow( &appMPlayer.subWindow, 0, ( wsMaxX - guiIntfStruct.MovieWidth )/2 + wsOrgX, ( wsMaxY - guiIntfStruct.MovieHeight )/2 + wsOrgY ); break; } else if ( !appMPlayer.subWindow.isFullScreen ) break; case evFullScreen: if ( !guiIntfStruct.Playing && !gtkShowVideoWindow ) break; mplFullScreen(); if ( appMPlayer.subWindow.isFullScreen ) btnSet( evFullScreen,btnPressed ); else btnSet( evFullScreen,btnReleased ); break; case evSetAspect: switch ( iparam ) { case 2: movie_aspect=16.0f / 9.0f; break; case 3: movie_aspect=4.0f / 3.0f; break; case 4: movie_aspect=2.35; break; case 1: default: movie_aspect=-1; } wsClearWindow( appMPlayer.subWindow );#ifdef USE_DVDREAD if ( guiIntfStruct.StreamType == STREAMTYPE_DVD || guiIntfStruct.StreamType == STREAMTYPE_VCD ) goto play_dvd_2; else #endif guiIntfStruct.NewPlay=1; break;// --- timer events case evRedraw: { unsigned now = GetTimerMS(); extern int mplPBFade; if ((now > last_redraw_time) && (now < last_redraw_time + GUI_REDRAW_WAIT) && !mplPBFade) break; last_redraw_time = now; } mplMainRender=1; wsPostRedisplay( &appMPlayer.mainWindow ); wsPostRedisplay( &appMPlayer.barWindow ); break;// --- system events#ifdef MP_DEBUG case evNone: mp_msg( MSGT_GPLAYER,MSGL_STATUS,"[mw] event none received.\n" ); break; default: mp_msg( MSGT_GPLAYER,MSGL_STATUS,"[mw] unknown event received ( %d,%.2f ).\n",msg,param ); break;#endif }}#define itPLMButton (itNULL - 1)#define itPRMButton (itNULL - 2)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; }}int keyPressed = 0;void mplMainKeyHandle( int KeyCode,int Type,int Key ){ int msg = evNone; if ( Type != wsKeyPressed ) return; if ( !Key ) { switch ( KeyCode ) { case wsXFMMPrev: msg=evPrev; break; case wsXFMMStop: msg=evStop; break; case wsXFMMPlay: msg=evPlaySwitchToPause; break; case wsXFMMNext: msg=evNext; break; case wsXFMMVolUp: msg=evIncVolume; break; case wsXFMMVolDown: msg=evDecVolume; break; case wsXFMMMute: msg=evMute; break; } } else { switch ( Key ) { case wsEnter: msg=evPlay; break; case wsXF86LowerVolume: msg=evDecVolume; break; case wsXF86RaiseVolume: msg=evIncVolume; break; case wsXF86Mute: msg=evMute; break; case wsXF86Play: msg=evPlaySwitchToPause; break; case wsXF86Stop: msg=evStop; break; case wsXF86Prev: msg=evPrev; break; case wsXF86Next: msg=evNext; break; case wsXF86Media: msg=evLoad; break; case wsEscape: if ( appMPlayer.subWindow.isFullScreen ) { if ( guiIntfStruct.event_struct ) ((XEvent *)guiIntfStruct.event_struct)->type=None; mplEventHandling( evNormalSize,0 ); return; } default: vo_x11_putkey( Key ); return; } } if ( msg != evNone ) mplEventHandling( msg,0 );}/* this will be used to handle Drag&Drop files */void mplDandDHandler(int num,char** files){ struct stat buf; int f = 0; char* subtitles = NULL; char* filename = NULL; if (num <= 0) return; /* now fill it with new items */ for(f=0; f < num; f++){ char* str = strdup( files[f] ); plItem* item; url_unescape_string(str, files[f]); if(stat(str,&buf) == 0 && S_ISDIR(buf.st_mode) == 0) { /* this is not a directory so try to play it */ mp_msg( MSGT_GPLAYER,MSGL_V,"Received D&D %s\n",str ); /* check if it is a subtitle file */ { char* ext = strrchr(str,'.'); if (ext) { static char supported[] = "utf/sub/srt/smi/rt//txt/ssa/aqt/"; char* type; int len; if((len=strlen(++ext)) && (type=strstr(supported,ext)) &&\ (type-supported)%4 == 0 && *(type+len) == '/'){ /* handle subtitle file */ gfree((void**)&subtitles); subtitles = str; continue; } } } /* clear playlist */ if (filename == NULL) { filename = files[f]; gtkSet(gtkDelPl,0,NULL); } item = calloc(1,sizeof(plItem)); /* FIXME: decompose file name ? */ /* yes -- Pontscho */ if ( strrchr( str,'/' ) ) { char * s = strrchr( str,'/' ); *s=0; s++; item->name = gstrdup( s ); item->path = gstrdup( str ); } else { item->name = strdup(str); item->path = strdup(""); } gtkSet(gtkAddPlItem,0,(void*)item); } else { mp_msg( MSGT_GPLAYER,MSGL_WARN,MSGTR_NotAFile,str ); } free( str ); } if (filename) { mplSetFileName( NULL,filename,STREAMTYPE_FILE ); if ( guiIntfStruct.Playing == 1 ) mplEventHandling( evStop,0 ); mplEventHandling( evPlay,0 ); } if (subtitles) { gfree((void**)&guiIntfStruct.Subtitlename); guiIntfStruct.Subtitlename = subtitles; guiLoadSubtitle(guiIntfStruct.Subtitlename); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -