Commit 98fe36c3 authored by ipkiss's avatar ipkiss
Browse files

* modules/gui/skins/*:

        Added an "Always on top" entry in the system menu (it can also
        be triggered by Ctrl+T). Implemented on Windows only, but to do
        that on X11 you just need to write X11Window::ToggleOnTop().
parent 1ecc3208
......@@ -2,7 +2,7 @@
* banks.cpp: Bitmap bank, Event bank, Font bank and OffSet bank
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: banks.cpp,v 1.9 2003/09/05 15:55:30 asmax Exp $
* $Id: banks.cpp,v 1.10 2003/10/17 18:17:28 ipkiss Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -183,6 +183,7 @@ EventBank::EventBank( intf_thread_t *_p_intf )
Add( "net", "VLC_NET", "CTRL+N" );
Add( "add_file", "VLC_PLAYLIST_ADD_FILE", "CTRL+A" );
Add( "load_skin", "VLC_LOAD_SKIN", "CTRL+S" );
Add( "on_top", "VLC_ON_TOP", "CTRL+T" );
}
//---------------------------------------------------------------------------
EventBank::~EventBank()
......
......@@ -2,7 +2,7 @@
* event.cpp: Event class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: event.cpp,v 1.22 2003/10/17 16:40:09 gbazin Exp $
* $Id: event.cpp,v 1.23 2003/10/17 18:17:28 ipkiss Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -116,6 +116,8 @@ unsigned int Event::GetMessageType( string Desc )
return VLC_NET;
else if( Desc == "VLC_LOAD_SKIN" )
return VLC_LOAD_SKIN;
else if( Desc == "VLC_ON_TOP" )
return VLC_ON_TOP;
else if( Desc == "VLC_CHANGE_TRAY" )
return VLC_CHANGE_TRAY;
else if( Desc == "VLC_CHANGE_TASKBAR" )
......
......@@ -2,7 +2,7 @@
* event.h: Event class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: event.h,v 1.14 2003/09/05 15:55:30 asmax Exp $
* $Id: event.h,v 1.15 2003/10/17 18:17:28 ipkiss Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -59,7 +59,8 @@ using namespace std;
#define VLC_OPEN (VLC_MESSAGE + 5)
#define VLC_LOAD_SKIN (VLC_MESSAGE + 6)
#define VLC_DROP (VLC_MESSAGE + 7)
#define VLC_NET (VLC_MESSAGE + 8)
#define VLC_ON_TOP (VLC_MESSAGE + 8)
#define VLC_NET (VLC_MESSAGE + 9)
#define VLC_LOG_SHOW (VLC_MESSAGE + 20)
#define VLC_PREFS_SHOW (VLC_MESSAGE + 23)
......
......@@ -2,7 +2,7 @@
* skin_common.h: Private Skin interface description
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: skin_common.h,v 1.23 2003/07/20 10:38:49 gbazin Exp $
* $Id: skin_common.h,v 1.24 2003/10/17 18:17:28 ipkiss Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -71,6 +71,7 @@ struct intf_sys_t
// Interface status
int i_index; // Set which file is being played
int i_size; // Size of playlist;
bool b_on_top; // Indicates if the windows are on top
// Interface dialogs
Dialogs *p_dialogs;
......
......@@ -2,7 +2,7 @@
* skin-main.cpp: skins plugin for VLC
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: skin_main.cpp,v 1.50 2003/10/17 16:40:09 gbazin Exp $
* $Id: skin_main.cpp,v 1.51 2003/10/17 18:17:28 ipkiss Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -90,6 +90,8 @@ static int Open ( vlc_object_t *p_this )
p_intf->p_sys->i_index = -1;
p_intf->p_sys->i_size = 0;
p_intf->p_sys->b_on_top = false;
p_intf->p_sys->i_close_status = VLC_NOTHING;
p_intf->p_sys->p_input = NULL;
......
......@@ -2,7 +2,7 @@
* theme.cpp: Theme class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: theme.cpp,v 1.17 2003/10/17 16:40:09 gbazin Exp $
* $Id: theme.cpp,v 1.18 2003/10/17 18:17:28 ipkiss Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -116,6 +116,7 @@ void Theme::CreateSystemMenu()
AddSystemMenu( "Open file...", EvtBank->Get( "open" ) );
AddSystemMenu( "Change skin...", EvtBank->Get( "load_skin" ) );
AddSystemMenu( "Preferences...", EvtBank->Get( "show_prefs" ) );
AddSystemMenu( "Always on top", EvtBank->Get( "on_top" ) );
AddSystemMenu( "SEPARATOR", 0 );
AddSystemMenu( "Exit", EvtBank->Get( "quit" ) );
}
......
......@@ -2,7 +2,7 @@
* vlcproc.cpp: VlcProc class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: vlcproc.cpp,v 1.47 2003/10/17 16:40:09 gbazin Exp $
* $Id: vlcproc.cpp,v 1.48 2003/10/17 18:17:28 ipkiss Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -127,6 +127,17 @@ bool VlcProc::EventProc( Event *evt )
LoadSkin();
return true;
case VLC_ON_TOP:
for( list<SkinWindow *>::const_iterator win =
p_intf->p_sys->p_theme->WindowList.begin();
win != p_intf->p_sys->p_theme->WindowList.end(); win++ )
{
(*win)->ToggleOnTop();
}
// Set the indicator to the new state
p_intf->p_sys->b_on_top = !p_intf->p_sys->b_on_top;
return true;
case VLC_DROP:
DropFile( evt->GetParam1() );
return true;
......@@ -574,6 +585,5 @@ void VlcProc::ChangeVolume( unsigned int msg, long param )
break;
}
aout_VolumeGet( p_intf, &volume );
}
//---------------------------------------------------------------------------
......@@ -2,7 +2,7 @@
* window.h: Window class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: window.h,v 1.5 2003/06/22 12:46:49 asmax Exp $
* $Id: window.h,v 1.6 2003/10/17 18:17:28 ipkiss Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -109,6 +109,7 @@ class SkinWindow
void Hide();
void Open();
void Close();
virtual void ToggleOnTop() {}
void RefreshAll();
void Refresh( int x, int y, int w, int h );
......
......@@ -2,7 +2,7 @@
* win32_window.cpp: Win32 implementation of the Window class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: win32_window.cpp,v 1.12 2003/05/02 15:53:32 gbazin Exp $
* $Id: win32_window.cpp,v 1.13 2003/10/17 18:17:28 ipkiss Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -52,6 +52,8 @@
#include "../os_graphics.h"
#include "../src/skin_common.h"
#include "../src/theme.h"
#include "../os_theme.h"
#include "../src/banks.h"
//---------------------------------------------------------------------------
// Fading API
......@@ -130,18 +132,6 @@ Win32Window::~Win32Window()
}
//---------------------------------------------------------------------------
void Win32Window::OSShow( bool show )
{
if( show )
{
ShowWindow( hWnd, SW_SHOW );
}
else
{
ShowWindow( hWnd, SW_HIDE );
}
}
//---------------------------------------------------------------------------
bool Win32Window::ProcessOSEvent( Event *evt )
{
unsigned int msg = evt->GetMessage();
......@@ -160,9 +150,9 @@ bool Win32Window::ProcessOSEvent( Event *evt )
case WM_MOUSEMOVE:
TRACKMOUSEEVENT TrackEvent;
TrackEvent.cbSize = sizeof( TRACKMOUSEEVENT );
TrackEvent.dwFlags = TME_LEAVE;
TrackEvent.hwndTrack = hWnd;
TrackEvent.cbSize = sizeof( TRACKMOUSEEVENT );
TrackEvent.dwFlags = TME_LEAVE;
TrackEvent.hwndTrack = hWnd;
TrackEvent.dwHoverTime = 1;
TrackMouseEvent( &TrackEvent );
if( p1 == MK_LBUTTON )
......@@ -214,6 +204,44 @@ bool Win32Window::ProcessOSEvent( Event *evt )
}
}
//---------------------------------------------------------------------------
void Win32Window::ToggleOnTop()
{
Win32Theme *winTheme = (Win32Theme *)p_intf->p_sys->p_theme;
HMENU hMenu = GetSystemMenu( winTheme->GetParentWindow(), false );
Event *event = p_intf->p_sys->p_theme->EvtBank->Get( "on_top" );
if( !p_intf->p_sys->b_on_top )
{
// Set the window on top
SetWindowPos( hWnd, HWND_TOPMOST, 0, 0, 0, 0,
SWP_NOSIZE | SWP_NOMOVE );
// Check the menu entry (FIXME: we shouldn't do that here...)
CheckMenuItem( hMenu, (unsigned int)event,
MF_BYCOMMAND | MFS_CHECKED );
}
else
{
// Set the window not on top
SetWindowPos( hWnd, HWND_NOTOPMOST, 0, 0, 0, 0,
SWP_NOSIZE | SWP_NOMOVE );
// Uncheck the menu entry (FIXME: we shouldn't do that here...)
CheckMenuItem( hMenu, (unsigned int)event,
MF_BYCOMMAND | MFS_UNCHECKED );
}
}
//---------------------------------------------------------------------------
void Win32Window::OSShow( bool show )
{
if( show )
{
ShowWindow( hWnd, SW_SHOW );
}
else
{
ShowWindow( hWnd, SW_HIDE );
}
}
//---------------------------------------------------------------------------
void Win32Window::SetTransparency( int Value )
{
if( Value > -1 )
......
......@@ -2,7 +2,7 @@
* win32_window.h: Win32 implementation of the Window class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: win32_window.h,v 1.3 2003/04/21 21:51:16 asmax Exp $
* $Id: win32_window.h,v 1.4 2003/10/17 18:17:28 ipkiss Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -64,6 +64,7 @@ class Win32Window : public SkinWindow
virtual bool ProcessOSEvent( Event *evt );
// Window graphic aspect
virtual void ToggleOnTop();
virtual void OSShow( bool show );
virtual void RefreshFromImage( int x, int y, int w, int h );
virtual void SetTransparency( int Value = -1 );
......
Supports Markdown
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