Commit b193e8e2 authored by Cyril Deguet's avatar Cyril Deguet

* enabled scrolling in the playlist with the mouse wheel

parent ad48c59b
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* generic.cpp: Generic control, parent of the others * generic.cpp: Generic control, parent of the others
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: generic.cpp,v 1.2 2003/04/16 21:40:07 ipkiss Exp $ * $Id: generic.cpp,v 1.3 2003/04/20 13:14:14 asmax Exp $
* *
* Authors: Olivier Teulire <ipkiss@via.ecp.fr> * Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr> * Emmanuel Puig <karibu@via.ecp.fr>
...@@ -145,6 +145,11 @@ bool GenericControl::MouseDblClick( int x, int y, int button ) ...@@ -145,6 +145,11 @@ bool GenericControl::MouseDblClick( int x, int y, int button )
return false; return false;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
bool GenericControl::MouseScroll( int x, int y, int direction )
{
return false;
}
//---------------------------------------------------------------------------
bool GenericControl::SendNewHelpText() bool GenericControl::SendNewHelpText()
{ {
if( Help != "" ) if( Help != "" )
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* generic.h: Generic control, parent of the others * generic.h: Generic control, parent of the others
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: generic.h,v 1.1 2003/03/18 02:21:47 ipkiss Exp $ * $Id: generic.h,v 1.2 2003/04/20 13:14:14 asmax Exp $
* *
* Authors: Olivier Teulière <ipkiss@via.ecp.fr> * Authors: Olivier Teulière <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr> * Emmanuel Puig <karibu@via.ecp.fr>
...@@ -73,6 +73,7 @@ class GenericControl // This is the generic control class ...@@ -73,6 +73,7 @@ class GenericControl // This is the generic control class
virtual bool MouseMove( int x, int y, int button ); virtual bool MouseMove( int x, int y, int button );
virtual bool MouseOver( int x, int y ); virtual bool MouseOver( int x, int y );
virtual bool MouseDblClick( int x, int y, int button ); virtual bool MouseDblClick( int x, int y, int button );
virtual bool MouseScroll( int x, int y, int direction );
virtual bool ToolTipTest( int x, int y ); virtual bool ToolTipTest( int x, int y );
virtual bool SendNewHelpText(); virtual bool SendNewHelpText();
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* playlist.cpp: Playlist control * playlist.cpp: Playlist control
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: playlist.cpp,v 1.3 2003/04/17 19:56:31 karibu Exp $ * $Id: playlist.cpp,v 1.4 2003/04/20 13:14:14 asmax Exp $
* *
* Authors: Olivier Teulire <ipkiss@via.ecp.fr> * Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr> * Emmanuel Puig <karibu@via.ecp.fr>
...@@ -451,6 +451,29 @@ bool ControlPlayList::MouseMove( int x, int y, int button ) ...@@ -451,6 +451,29 @@ bool ControlPlayList::MouseMove( int x, int y, int button )
return false; return false;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
bool ControlPlayList::MouseScroll( int x, int y, int direction )
{
if( !Enabled )
return false;
//long pos = Slider->GetCursorPosition();
long pos = StartIndex;
fprintf(stderr," scroll %d %d\n", pos, StartIndex);
switch( direction )
{
case MOUSE_SCROLL_UP:
if( pos > 0 ) pos--;
break;
case MOUSE_SCROLL_DOWN:
if( pos + Line < NumOfItems ) pos++;
break;
}
StartIndex = pos;
Slider->SetCursorPosition( pos );
RefreshAll();
return true;
}
//---------------------------------------------------------------------------
bool ControlPlayList::MouseOver( int x, int y ) bool ControlPlayList::MouseOver( int x, int y )
{ {
if( TextClipRgn->Hit( x - Left, y - Top ) || Slider->MouseOver( x, y ) ) if( TextClipRgn->Hit( x - Left, y - Top ) || Slider->MouseOver( x, y ) )
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* playlist.h: Playlist control * playlist.h: Playlist control
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: playlist.h,v 1.1 2003/03/18 02:21:47 ipkiss Exp $ * $Id: playlist.h,v 1.2 2003/04/20 13:14:14 asmax Exp $
* *
* Authors: Olivier Teulire <ipkiss@via.ecp.fr> * Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr> * Emmanuel Puig <karibu@via.ecp.fr>
...@@ -121,6 +121,7 @@ class ControlPlayList : public GenericControl ...@@ -121,6 +121,7 @@ class ControlPlayList : public GenericControl
virtual bool MouseMove( int x, int y, int button ); virtual bool MouseMove( int x, int y, int button );
virtual bool MouseOver( int x, int y ); virtual bool MouseOver( int x, int y );
virtual bool MouseDblClick( int x, int y, int button ); virtual bool MouseDblClick( int x, int y, int button );
virtual bool MouseScroll( int x, int y, int direction );
virtual bool ToolTipTest( int x, int y ); virtual bool ToolTipTest( int x, int y );
// Translate control // Translate control
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* slider.h: Slider control * slider.h: Slider control
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: slider.h,v 1.1 2003/03/18 02:21:47 ipkiss Exp $ * $Id: slider.h,v 1.2 2003/04/20 13:14:14 asmax Exp $
* *
* Authors: Olivier Teulière <ipkiss@via.ecp.fr> * Authors: Olivier Teulière <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr> * Emmanuel Puig <karibu@via.ecp.fr>
...@@ -69,7 +69,7 @@ class ControlSlider : public GenericControl ...@@ -69,7 +69,7 @@ class ControlSlider : public GenericControl
int FindNearestPoint( int x, int y ); int FindNearestPoint( int x, int y );
// Move cursor (wether SLIDER_MAX in skin_common.h) // Move cursor (whether SLIDER_MAX in skin_common.h)
void MoveCursor( int newValue ); void MoveCursor( int newValue );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* gtk2_window.cpp: GTK2 implementation of the Window class * gtk2_window.cpp: GTK2 implementation of the Window class
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: gtk2_window.cpp,v 1.22 2003/04/19 11:46:11 asmax Exp $ * $Id: gtk2_window.cpp,v 1.23 2003/04/20 13:14:14 asmax Exp $
* *
* Authors: Cyril Deguet <asmax@videolan.org> * Authors: Cyril Deguet <asmax@videolan.org>
* *
...@@ -241,6 +241,22 @@ bool GTK2Window::ProcessOSEvent( Event *evt ) ...@@ -241,6 +241,22 @@ bool GTK2Window::ProcessOSEvent( Event *evt )
DropObject->HandleDropStart( ( (GdkEventDND *)p2 )->context ); DropObject->HandleDropStart( ( (GdkEventDND *)p2 )->context );
return true; return true;
case GDK_SCROLL:
switch( ( (GdkEventScroll *)p2 )->direction )
{
case GDK_SCROLL_UP:
MouseScroll( ( (GdkEventScroll *)p2 )->x,
( (GdkEventScroll *)p2 )->y,
MOUSE_SCROLL_UP);
break;
case GDK_SCROLL_DOWN:
MouseScroll( ( (GdkEventScroll *)p2 )->x,
( (GdkEventScroll *)p2 )->y,
MOUSE_SCROLL_DOWN);
break;
}
return true;
default: default:
return false; return false;
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* window.cpp: Window class * window.cpp: Window class
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: window.cpp,v 1.16 2003/04/16 21:40:07 ipkiss Exp $ * $Id: window.cpp,v 1.17 2003/04/20 13:14:14 asmax Exp $
* *
* Authors: Olivier Teulire <ipkiss@via.ecp.fr> * Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr> * Emmanuel Puig <karibu@via.ecp.fr>
...@@ -404,6 +404,18 @@ void Window::MouseDblClick( int x, int y, int button ) ...@@ -404,6 +404,18 @@ void Window::MouseDblClick( int x, int y, int button )
} }
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void Window::MouseScroll( int x, int y, int direction )
{
// Checking event in controls
for( int i = ControlList.size() - 1; i >= 0 ; i-- )
{
if( ControlList[i]->MouseScroll( x, y, direction ) )
{
return;
}
}
}
//---------------------------------------------------------------------------
void Window::Init() void Window::Init()
{ {
// Get size of window // Get size of window
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* window.h: Window class * window.h: Window class
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: window.h,v 1.1 2003/03/18 02:21:47 ipkiss Exp $ * $Id: window.h,v 1.2 2003/04/20 13:14:14 asmax Exp $
* *
* Authors: Olivier Teulire <ipkiss@via.ecp.fr> * Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr> * Emmanuel Puig <karibu@via.ecp.fr>
...@@ -40,6 +40,11 @@ class GenericControl; ...@@ -40,6 +40,11 @@ class GenericControl;
class Anchor; class Anchor;
class Event; class Event;
//---------------------------------------------------------------------------
// Constants for scrolling
#define MOUSE_SCROLL_UP 0
#define MOUSE_SCROLL_DOWN 1
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
class Window class Window
{ {
...@@ -96,6 +101,7 @@ class Window ...@@ -96,6 +101,7 @@ class Window
void MouseDown( int x, int y, int button ); void MouseDown( int x, int y, int button );
void MouseMove( int x, int y, int button ); void MouseMove( int x, int y, int button );
void MouseDblClick( int x, int y, int button ); void MouseDblClick( int x, int y, int button );
void Window::MouseScroll( int x, int y, int direction );
// Window graphic aspect // Window graphic aspect
bool OnStartThemeVisible; bool OnStartThemeVisible;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment