Commit 66181839 authored by Cyril Deguet's avatar Cyril Deguet
Browse files

* repaired basic_skins

* removed all the compilation warnings
* fixed LOTS of memory leaks in skins (gibalou, you should try valgrind
  on wxwindows plugin ;)
parent 1e69605c
......@@ -2,7 +2,7 @@
* button.cpp: Button control
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: button.cpp,v 1.14 2003/05/31 23:23:59 ipkiss Exp $
* $Id: button.cpp,v 1.15 2003/06/09 12:33:16 asmax Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -71,6 +71,18 @@ ControlButton::ControlButton(
//---------------------------------------------------------------------------
ControlButton::~ControlButton()
{
if( ClickAction )
{
delete ClickAction;
}
if( MouseOverAction )
{
delete MouseOverAction;
}
if( MouseOutAction )
{
delete MouseOutAction;
}
}
//---------------------------------------------------------------------------
void ControlButton::Init()
......
......@@ -2,7 +2,7 @@
* checkbox.cpp: Checkbox control
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: checkbox.cpp,v 1.6 2003/05/02 15:53:32 gbazin Exp $
* $Id: checkbox.cpp,v 1.7 2003/06/09 12:33:16 asmax Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -95,6 +95,30 @@ ControlCheckBox::ControlCheckBox(
//---------------------------------------------------------------------------
ControlCheckBox::~ControlCheckBox()
{
if( ClickAction1 )
{
delete ClickAction1;
}
if( ClickAction2 )
{
delete ClickAction2;
}
if( MouseOverAction1 )
{
delete MouseOverAction1;
}
if( MouseOverAction2 )
{
delete MouseOverAction2;
}
if( MouseOutAction1 )
{
delete MouseOutAction1;
}
if( MouseOutAction2 )
{
delete MouseOutAction2;
}
}
//---------------------------------------------------------------------------
void ControlCheckBox::Init()
......
......@@ -2,7 +2,7 @@
* image.cpp: Image control
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: image.cpp,v 1.7 2003/05/02 15:53:32 gbazin Exp $
* $Id: image.cpp,v 1.8 2003/06/09 12:33:16 asmax Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -56,6 +56,10 @@ ControlImage::ControlImage( string id, bool visible, int x, int y, string img,
//---------------------------------------------------------------------------
ControlImage::~ControlImage()
{
if( MouseDownAction )
{
delete MouseDownAction;
}
}
//---------------------------------------------------------------------------
void ControlImage::Init()
......
......@@ -2,7 +2,7 @@
* playlist.cpp: Playlist control
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: playlist.cpp,v 1.12 2003/06/08 15:22:03 asmax Exp $
* $Id: playlist.cpp,v 1.13 2003/06/09 12:33:16 asmax Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -83,6 +83,26 @@ ControlPlayList::ControlPlayList( string id, bool visible, int width,
//---------------------------------------------------------------------------
ControlPlayList::~ControlPlayList()
{
if( CaseLeft )
{
delete[] CaseLeft;
}
if( CaseRight )
{
delete[] CaseRight;
}
if( CaseTextLeft )
{
delete[] CaseTextLeft;
}
if( Slider )
{
delete Slider;
}
if( TextClipRgn )
{
delete TextClipRgn;
}
if( PlayList != NULL )
{
vlc_object_release( PlayList );
......
......@@ -2,7 +2,7 @@
* dialogs.cpp: Handles all the different dialog boxes we provide.
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: dialogs.cpp,v 1.4 2003/06/08 16:56:48 gbazin Exp $
* $Id: dialogs.cpp,v 1.5 2003/06/09 12:33:16 asmax Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -422,9 +422,9 @@ void Dialogs::OnExitThread( wxCommandEvent& event )
int PopupMenuCB( vlc_object_t *p_this, const char *psz_variable,
vlc_value_t old_val, vlc_value_t new_val, void *param )
{
#ifndef BASIC_SKINS
Dialogs *p_dialogs = (Dialogs *)param;
#ifndef BASIC_SKINS
p_dialogs->ShowPopup();
#endif // BASIC_SKINS
......
......@@ -2,7 +2,7 @@
* skin_common.h: Private Skin interface description
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: skin_common.h,v 1.15 2003/06/05 21:22:27 gbazin Exp $
* $Id: skin_common.h,v 1.16 2003/06/09 12:33:16 asmax Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -65,12 +65,12 @@ struct intf_sys_t
int i_index; // Set which file is being played
int i_size; // Size of playlist;
#ifndef BASIC_SKINS
// Interface dialogs
Dialogs *p_dialogs;
// Popup menu
vlc_bool_t b_popup_change;
#ifndef BASIC_SKINS
wxMenu *p_popup_menu;
#endif
......
......@@ -2,7 +2,7 @@
* skin-main.cpp: skins plugin for VLC
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: skin_main.cpp,v 1.34 2003/06/08 16:56:48 gbazin Exp $
* $Id: skin_main.cpp,v 1.35 2003/06/09 12:33:16 asmax Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -188,6 +188,10 @@ static void Close ( vlc_object_t *p_this )
// Delete theme, it's important to do it correctly
delete (OSTheme *)p_intf->p_sys->p_theme;
#if defined X11_SKINS
XCloseDisplay( p_intf->p_sys->display );
#endif
// Unsuscribe to messages bank
msg_Unsubscribe( p_intf, p_intf->p_sys->p_sub );
......
......@@ -2,7 +2,7 @@
* theme.cpp: Theme class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: theme.cpp,v 1.13 2003/04/29 20:36:56 ipkiss Exp $
* $Id: theme.cpp,v 1.14 2003/06/09 12:33:16 asmax Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -232,7 +232,7 @@ SkinWindow * Theme::GetWindow( string name )
//---------------------------------------------------------------------------
void Theme::MoveSkin( SkinWindow *wnd, int left, int top )
{
int x, y, oldx, oldy;
int oldx, oldy;
SkinWindow *win;
list<Anchor *>::const_iterator anc;
list<Anchor *>::const_iterator hang;
......
......@@ -2,7 +2,7 @@
* themeloader.cpp: ThemeLoader class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: themeloader.cpp,v 1.13 2003/06/08 16:56:48 gbazin Exp $
* $Id: themeloader.cpp,v 1.14 2003/06/09 12:33:16 asmax Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -133,7 +133,7 @@ bool ThemeLoader::ExtractTarGz( const string tarfile, const string rootdir )
}
if( tar_extract_all( t, (char *)rootdir.c_str() ) != 0 )
{
{ tar_close( t );
return false;
}
......
......@@ -2,7 +2,7 @@
* vlcproc.cpp: VlcProc class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: vlcproc.cpp,v 1.32 2003/06/09 06:52:07 gbazin Exp $
* $Id: vlcproc.cpp,v 1.33 2003/06/09 12:33:16 asmax Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -59,6 +59,10 @@ VlcProc::VlcProc( intf_thread_t *_p_intf )
p_intf = _p_intf;
}
//---------------------------------------------------------------------------
VlcProc::~VlcProc()
{
}
//---------------------------------------------------------------------------
bool VlcProc::EventProc( Event *evt )
{
switch( evt->GetMessage() )
......@@ -98,8 +102,10 @@ bool VlcProc::EventProc( Event *evt )
return true;
case VLC_OPEN:
#ifndef BASIC_SKINS
p_intf->p_sys->p_dialogs->ShowOpen( true );
InterfaceRefresh();
#endif
return true;
case VLC_LOAD_SKIN:
......@@ -131,23 +137,31 @@ bool VlcProc::EventProc( Event *evt )
return true;
case VLC_PLAYLIST_ADD_FILE:
#ifndef BASIC_SKINS
p_intf->p_sys->p_dialogs->ShowOpen( false );
InterfaceRefresh();
#endif
return true;
case VLC_LOG_SHOW:
#ifndef BASIC_SKINS
p_intf->p_sys->p_dialogs->ShowMessages();
#endif
return true;
case VLC_LOG_CLEAR:
return true;
case VLC_PREFS_SHOW:
#ifndef BASIC_SKINS
p_intf->p_sys->p_dialogs->ShowPrefs();
#endif
return true;
case VLC_INFO_SHOW:
#ifndef BASIC_SKINS
p_intf->p_sys->p_dialogs->ShowFileInfo();
#endif
return true;
case VLC_INTF_REFRESH:
......@@ -326,7 +340,9 @@ void VlcProc::LoadSkin()
{
if( p_intf->p_sys->p_new_theme_file == NULL )
{
#ifndef BASIC_SKINS
p_intf->p_sys->p_dialogs->ShowOpenSkin();
#endif
}
else
{
......@@ -421,8 +437,10 @@ void VlcProc::PlayStream()
if( !p_intf->p_sys->p_playlist->i_size )
{
#ifndef BASIC_SKINS
p_intf->p_sys->p_dialogs->ShowOpen( true );
InterfaceRefresh();
#endif
return;
}
......
......@@ -2,7 +2,7 @@
* vlcproc.h: VlcProc class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: vlcproc.h,v 1.6 2003/06/03 22:18:58 gbazin Exp $
* $Id: vlcproc.h,v 1.7 2003/06/09 12:33:16 asmax Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -27,13 +27,12 @@
#ifndef VLC_SKIN_PROC
#define VLC_SKIN_PROC
#include "skin_common.h"
//--- GENERAL ---------------------------------------------------------------
#include <string>
using namespace std;
//---------------------------------------------------------------------------
struct intf_thread_t;
//---------------------------------------------------------------------------
class VlcProc
{
......
......@@ -2,7 +2,7 @@
* window.cpp: Window class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: window.cpp,v 1.26 2003/06/08 16:56:48 gbazin Exp $
* $Id: window.cpp,v 1.27 2003/06/09 12:33:16 asmax Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -87,6 +87,10 @@ SkinWindow::SkinWindow( intf_thread_t *_p_intf, int x, int y, bool visible,
//---------------------------------------------------------------------------
SkinWindow::~SkinWindow()
{
if( Image )
{
delete Image;
}
// Destroy the controls
for( unsigned int i = 0; i < ControlList.size(); i++ )
delete ControlList[i];
......@@ -420,10 +424,12 @@ void SkinWindow::MouseUp( int x, int y, int button )
}
}
#ifndef BASIC_SKINS
if( i < 0 && button == 2 )
{
p_intf->p_sys->p_dialogs->ShowPopup();
}
#endif
}
//---------------------------------------------------------------------------
void SkinWindow::MouseDblClick( int x, int y, int button )
......@@ -512,7 +518,6 @@ void SkinWindow::ReSize()
if( Image != NULL )
delete (OSGraphics *)Image;
Image = (Graphics *)new OSGraphics( p_intf, w, h, this );
// Image = (Graphics *)new OSGraphics( w, h, this );
Size( w, h );
}
......
......@@ -2,7 +2,7 @@
* x11_bitmap.cpp: X11 implementation of the Bitmap class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: x11_bitmap.cpp,v 1.10 2003/06/08 12:45:13 gbazin Exp $
* $Id: x11_bitmap.cpp,v 1.11 2003/06/09 12:33:16 asmax Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
......@@ -59,7 +59,6 @@ X11Bitmap::X11Bitmap( intf_thread_t *_p_intf, string FileName, int AColor )
// Find the display
display = p_intf->p_sys->display;
int screen = DefaultScreen( display );
int depth = DefaultDepth( display, screen );
Screen *screenptr = DefaultScreenOfDisplay( display );
Visual *visual = DefaultVisualOfScreen( screenptr );
Img = NULL;
......@@ -176,9 +175,9 @@ void X11Bitmap::DrawBitmap( int x, int y, int w, int h, int xRef, int yRef,
//---------------------------------------------------------------------------
bool X11Bitmap::Hit( int x, int y)
{
unsigned int c = (unsigned int)GetBmpPixel( x, y );
int c = GetBmpPixel( x, y );
if( c == -1 || c == AlphaColor )
if( c == -1 || (unsigned int)c == AlphaColor )
return false;
else
return true;
......
......@@ -2,7 +2,7 @@
* x11_dragdrop.h: X11 implementation of the drag & drop
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: x11_dragdrop.h,v 1.3 2003/06/09 00:07:09 asmax Exp $
* $Id: x11_dragdrop.h,v 1.4 2003/06/09 12:33:16 asmax Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
......@@ -29,6 +29,8 @@
//--- X11 -----------------------------------------------------------------
#include <X11/Xlib.h>
#include "../src/skin_common.h"
//---------------------------------------------------------------------------
typedef long ldata_t[5];
......
......@@ -2,7 +2,7 @@
* x11_event.cpp: x11 implementation of the Event class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: x11_event.cpp,v 1.2 2003/05/19 21:39:34 asmax Exp $
* $Id: x11_event.cpp,v 1.3 2003/06/09 12:33:16 asmax Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -49,7 +49,7 @@
X11Event::X11Event( intf_thread_t *p_intf, string Desc, string shortcut )
: Event( p_intf, Desc, shortcut )
{
Wnd = NULL;
Wnd = None;
}
//---------------------------------------------------------------------------
X11Event::X11Event( intf_thread_t *p_intf, Window wnd, unsigned int msg,
......@@ -126,7 +126,7 @@ Window X11Event::GetWindowFromName( string name )
if( win == NULL )
{
return NULL;
return None;
}
else
{
......
......@@ -2,7 +2,7 @@
* x11_font.cpp: X11 implementation of the Font class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: x11_font.cpp,v 1.8 2003/06/08 00:32:07 asmax Exp $
* $Id: x11_font.cpp,v 1.9 2003/06/09 12:33:16 asmax Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
......@@ -55,16 +55,19 @@ X11Font::X11Font( intf_thread_t *_p_intf, string fontname, int size,
size = ( size < 10 ? 8 : 12 );
snprintf( name, 256, "-*-helvetica-bold-%c-*-*-*-%i-*-*-*-*-*-*",
slant, 10 * size );
msg_Dbg( _p_intf, "loading font %s", name );
XLOCK;
font = XLoadFont( display, name );
FontInfo = XQueryFont( display, font );
FontInfo = XLoadQueryFont( display, name );
font = FontInfo->fid;
Ascent = FontInfo->max_bounds.ascent;
Descent = FontInfo->max_bounds.descent;
XUNLOCK;
}
//---------------------------------------------------------------------------
X11Font::~X11Font()
{
XLOCK;
XFreeFont( display, FontInfo );
XUNLOCK;
}
//---------------------------------------------------------------------------
void X11Font::AssignFont( Graphics *dest )
......@@ -82,7 +85,7 @@ void X11Font::GetSize( string text, int &w, int &h )
XUNLOCK;
w = overall.rbearing - overall.lbearing;
h = FontInfo->max_bounds.ascent + FontInfo->max_bounds.descent;
h = Ascent + Descent;
}
//---------------------------------------------------------------------------
void X11Font::GenericPrint( Graphics *dest, string text, int x, int y,
......@@ -108,12 +111,10 @@ void X11Font::GenericPrint( Graphics *dest, string text, int x, int y,
XSetClipRectangles( display, gc, 0, 0, &rect, 1, Unsorted );
// Render text no the drawable
XDrawString( display, drawable, gc, x, y+FontInfo->max_bounds.ascent,
text.c_str(), text.size());
XDrawString( display, drawable, gc, x, y+Ascent, text.c_str(), text.size());
if( Underline )
{
XDrawLine( display, drawable, gc, x, y+FontInfo->max_bounds.ascent+1,
x+w, y+FontInfo->max_bounds.ascent+1 );
XDrawLine( display, drawable, gc, x, y+Ascent+1, x+w, y+Ascent+1 );
}
// Reset the clip mask
......
......@@ -2,7 +2,7 @@
* x11_font.h: X11 implementation of the Font class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: x11_font.h,v 1.4 2003/06/08 00:32:07 asmax Exp $
* $Id: x11_font.h,v 1.5 2003/06/09 12:33:16 asmax Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
......@@ -44,6 +44,8 @@ class X11Font : SkinFont
Display *display;
Font font;
XFontStruct *FontInfo;
int Ascent;
int Descent;
bool Underline;
// Assign font to Device Context
......
......@@ -2,7 +2,7 @@
* x11_graphics.cpp: X11 implementation of the Graphics and Region classes
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: x11_graphics.cpp,v 1.7 2003/06/08 15:22:03 asmax Exp $
* $Id: x11_graphics.cpp,v 1.8 2003/06/09 12:33:16 asmax Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -170,7 +170,7 @@ void X11Region::Move( int x, int y )
//---------------------------------------------------------------------------
bool X11Region::Hit( int x, int y )
{
int i;
unsigned int i;
x -= RefPoint.x;
y -= RefPoint.y;
......
......@@ -2,7 +2,7 @@
* x11_run.cpp:
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: x11_run.cpp,v 1.20 2003/06/08 18:17:50 asmax Exp $
* $Id: x11_run.cpp,v 1.21 2003/06/09 12:33:16 asmax Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
......@@ -106,6 +106,7 @@ int ProcessEvent( intf_thread_t *p_intf, VlcProc *proc, XEvent *event )
{
if( !proc->EventProc( evt ) )
{
delete (OSEvent *)evt;
return 1; // Exit VLC !
}
}
......@@ -198,7 +199,7 @@ void OSRun( intf_thread_t *p_intf )
timerManager->Destroy();
delete refreshTimer;
delete proc;
}
//---------------------------------------------------------------------------
bool IsVLCEvent( unsigned int msg )
......
......@@ -2,7 +2,7 @@
* x11_theme.cpp: X11 implementation of the Theme class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: x11_theme.cpp,v 1.10 2003/06/07 10:18:15 gbazin Exp $
* $Id: x11_theme.cpp,v 1.11 2003/06/09 12:33:17 asmax Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
......@@ -59,29 +59,10 @@ X11Theme::X11Theme( intf_thread_t *_p_intf ) : Theme( _p_intf )
//---------------------------------------------------------------------------
X11Theme::~X11Theme()
{/*
// Unregister the window class if needed
WNDCLASS wndclass;
if( GetClassInfo( hinst, "SkinWindow", &wndclass ) )
{
UnregisterClass( "SkinWindow", hinst );
}
if( GetClassInfo( hinst, "ParentWindow", &wndclass ) )
{
UnregisterClass( "ParentWindow", hinst );
}
// Delete tray icon if exists
if( ShowInTray )
{
Shell_NotifyIcon( NIM_DELETE, &TrayIcon );
}
*/
// Destroy parent window
/* if( ParentWindow )
{
gdk_window_destroy( ParentWindow );
}*/
{
XLOCK;
XDestroyWindow( display, p_intf->p_sys->mainWin );
XUNLOCK;
}
//---------------------------------------------------------------------------
void X11Theme::OnLoadTheme()
......
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