summaryrefslogtreecommitdiffstats
path: root/gui/mplayer/pb.c
diff options
context:
space:
mode:
authorAnton Khirnov <wyskas@gmail.com>2009-07-07 19:35:54 +0200
committerUoti Urpala <uau@glyph.nonexistent.invalid>2009-07-07 21:49:42 +0300
commit87366694d82c8d4c7f0bc210e6baa0ccd651d0c2 (patch)
tree57c6a283eed4934c6041658effab17435ef2ff1c /gui/mplayer/pb.c
parenta2037a2effbd4622d0e8336245a9b14c3f886bde (diff)
downloadmpv-87366694d82c8d4c7f0bc210e6baa0ccd651d0c2.tar.bz2
mpv-87366694d82c8d4c7f0bc210e6baa0ccd651d0c2.tar.xz
Remove the internal GUI
The GUI is badly designed and too closely coupled to the internal details of other code. The GUI code is in bad shape and unmaintained for years. There is no indication that anyone would maintain it in the future either. Even if someone did volunteer to implement a better integrated GUI having the current code in the tree probably wouldn't help much. So get rid of it.
Diffstat (limited to 'gui/mplayer/pb.c')
-rw-r--r--gui/mplayer/pb.c265
1 files changed, 0 insertions, 265 deletions
diff --git a/gui/mplayer/pb.c b/gui/mplayer/pb.c
deleted file mode 100644
index 9238755d91..0000000000
--- a/gui/mplayer/pb.c
+++ /dev/null
@@ -1,265 +0,0 @@
-/*
- * main window
- *
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <inttypes.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <string.h>
-
-#include "config.h"
-#include "gui/app.h"
-#include "gui/skin/font.h"
-#include "gui/skin/skin.h"
-#include "gui/wm/ws.h"
-
-#include "help_mp.h"
-#include "libvo/x11_common.h"
-#include "libvo/fastmemcpy.h"
-
-#include "stream/stream.h"
-#include "mixer.h"
-#include "libvo/sub.h"
-
-#include "libmpdemux/demuxer.h"
-#include "libmpdemux/stheader.h"
-#include "codec-cfg.h"
-
-#include "gmplayer.h"
-#include "play.h"
-#include "widgets.h"
-#include "gui_common.h"
-
-unsigned int GetTimerMS( void );
-unsigned int GetTimer( void );
-
-unsigned char * mplPBDrawBuffer = NULL;
-int mplPBVisible = 0;
-int mplPBLength = 0;
-int mplPBFade = 0;
-
-void mplPBDraw( void )
-{
- int x;
-
- if ( !appMPlayer.subWindow.isFullScreen ) return;
- if ( !mplPBVisible || !appMPlayer.barIsPresent ) return;
-
-// appMPlayer.bar.x=( appMPlayer.subWindow.Width - appMPlayer.bar.width ) / 2;
- switch( appMPlayer.bar.x )
- {
- case -1: x=( appMPlayer.subWindow.Width - appMPlayer.bar.width ) / 2; break;
- case -2: x=( appMPlayer.subWindow.Width - appMPlayer.bar.width ); break;
- default: x=appMPlayer.bar.x;
- }
-
- switch ( mplPBFade )
- {
- case 1: // fade in
- mplPBLength--;
- if ( appMPlayer.subWindow.Height - appMPlayer.bar.height >= mplPBLength )
- {
- mplPBLength=appMPlayer.subWindow.Height - appMPlayer.bar.height;
- mplPBFade=0;
- vo_mouse_autohide=0;
- }
- wsMoveWindow( &appMPlayer.barWindow,0,x,mplPBLength );
- break;
- case 2: // fade out
- mplPBLength+=10;
- if ( mplPBLength > appMPlayer.subWindow.Height )
- {
- mplPBLength=appMPlayer.subWindow.Height;
- mplPBFade=mplPBVisible=0;
- vo_mouse_autohide=1;
- wsVisibleWindow( &appMPlayer.barWindow,wsHideWindow );
- return;
- }
- wsMoveWindow( &appMPlayer.barWindow,0,x,mplPBLength );
- break;
- }
-
-// --- render
- if ( appMPlayer.barWindow.State == wsWindowExpose )
- {
- btnModify( evSetMoviePosition,guiIntfStruct.Position );
- btnModify( evSetVolume,guiIntfStruct.Volume );
-
- vo_mouse_autohide=0;
-
- fast_memcpy( mplPBDrawBuffer,appMPlayer.bar.Bitmap.Image,appMPlayer.bar.Bitmap.ImageSize );
- Render( &appMPlayer.barWindow,appMPlayer.barItems,appMPlayer.NumberOfBarItems,mplPBDrawBuffer,appMPlayer.bar.Bitmap.ImageSize );
- wsConvert( &appMPlayer.barWindow,mplPBDrawBuffer,appMPlayer.bar.Bitmap.ImageSize );
- }
- wsPutImage( &appMPlayer.barWindow );
-}
-
-#define itPLMButton (itNULL - 1)
-#define itPRMButton (itNULL - 2)
-
-void mplPBMouseHandle( 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.NumberOfBarItems + 1;i++ )
- if ( ( appMPlayer.barItems[i].pressed != btnDisabled )&&
- ( wgIsRect( X,Y,appMPlayer.barItems[i].x,appMPlayer.barItems[i].y,appMPlayer.barItems[i].x+appMPlayer.barItems[i].width,appMPlayer.barItems[i].y+appMPlayer.barItems[i].height ) ) )
- { currentselected=i; break; }
-
- switch ( Button )
- {
- case wsPMMouseButton:
- gtkShow( evHidePopUpMenu,NULL );
- mplShowMenu( RX,RY );
- break;
- case wsRMMouseButton:
- mplHideMenu( 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 fucking window
- item=&appMPlayer.barItems[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:
- item=&appMPlayer.barItems[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 wsP5MouseButton: value=-2.5f; goto rollerhandled;
- case wsP4MouseButton: value= 2.5f;
-rollerhandled:
- item=&appMPlayer.barItems[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;
-// ---
- case wsMoveMouse:
- item=&appMPlayer.barItems[SelectedItem];
- switch ( itemtype )
- {
- 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;
- }
-}
-
-void mplPBShow( int x, int y )
-{
- if ( !appMPlayer.barIsPresent || !gtkEnablePlayBar ) return;
- if ( !appMPlayer.subWindow.isFullScreen ) return;
-
- if ( y > appMPlayer.subWindow.Height - appMPlayer.bar.height )
- {
- if ( !mplPBFade ) wsVisibleWindow( &appMPlayer.barWindow,wsShowWindow );
- mplPBFade=1; mplPBVisible=1; wsPostRedisplay( &appMPlayer.barWindow );
- }
- else if ( !mplPBFade ) mplPBFade=2;
-}
-
-void mplPBInit( void )
-{
- if ( !appMPlayer.barIsPresent ) return;
-
- gfree( (void**)&mplPBDrawBuffer );
-
- if ( ( mplPBDrawBuffer = malloc( appMPlayer.bar.Bitmap.ImageSize ) ) == NULL )
- {
- mp_msg( MSGT_GPLAYER,MSGL_FATAL,MSGTR_NEMDB );
- exit( 0 );
- }
-
- appMPlayer.barWindow.Parent=appMPlayer.subWindow.WindowID;
- wsCreateWindow( &appMPlayer.barWindow,
- appMPlayer.bar.x,appMPlayer.bar.y,appMPlayer.bar.width,appMPlayer.bar.height,
- wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,wsHideFrame|wsHideWindow,"PlayBar" );
-
- wsSetShape( &appMPlayer.barWindow,appMPlayer.bar.Mask.Image );
-
- appMPlayer.barWindow.ReDraw=(void *)mplPBDraw;
- appMPlayer.barWindow.MouseHandler=mplPBMouseHandle;
- appMPlayer.barWindow.KeyHandler=mplMainKeyHandle;
-
- mplPBLength=appMPlayer.subWindow.Height;
-}