Commit 4999de8d authored by Olivier Teulière's avatar Olivier Teulière

- skins2/utils/bezier.*: Added support for curves made of one point

 - skins2/theme/skin.dtd: Removed Event and Rectangle tags
 - skins2/src/theme.cpp: Destroy curves explicitely
 - ALL: Anchors can be defined using a Bezier curve, which allows
   rectilinear anchors (but it is still possible to define anchors
   reduced to a single point).
   A "curved anchor" only attracts "single point anchors"
parent 0ba71b8c
......@@ -2,7 +2,7 @@
* ctrl_slider.cpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: ctrl_slider.cpp,v 1.4 2004/02/29 16:49:55 asmax Exp $
* $Id: ctrl_slider.cpp,v 1.5 2004/03/02 21:45:15 ipkiss Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr>
......@@ -55,7 +55,7 @@ CtrlSliderCursor::CtrlSliderCursor( intf_thread_t *pIntf,
m_cmdUpOver( this, &transUpOver ), m_cmdMove( this, &transMove ),
m_cmdScroll( this, &transScroll ),
m_lastPercentage( 0 ), m_xOffset( 0 ), m_yOffset( 0 ),
m_pEvt( NULL ), m_curve( rCurve )
m_pEvt( NULL ), m_rCurve( rCurve )
{
// Build the images of the cursor
OSFactory *pOsFactory = OSFactory::instance( getIntf() );
......@@ -120,7 +120,7 @@ bool CtrlSliderCursor::mouseOver( int x, int y ) const
{
// Compute the position of the cursor
int xPos, yPos;
m_curve.getPoint( m_rVariable.get(), xPos, yPos );
m_rCurve.getPoint( m_rVariable.get(), xPos, yPos );
// Compute the resize factors
float factorX, factorY;
......@@ -144,7 +144,7 @@ void CtrlSliderCursor::draw( OSGraphics &rImage, int xDest, int yDest )
{
// Compute the position of the cursor
int xPos, yPos;
m_curve.getPoint( m_rVariable.get(), xPos, yPos );
m_rCurve.getPoint( m_rVariable.get(), xPos, yPos );
// Compute the resize factors
float factorX, factorY;
......@@ -181,7 +181,7 @@ void CtrlSliderCursor::transOverDown( SkinObject *pCtrl )
// Compute the offset
int tempX, tempY;
pThis->m_curve.getPoint( pThis->m_rVariable.get(), tempX, tempY );
pThis->m_rCurve.getPoint( pThis->m_rVariable.get(), tempX, tempY );
pThis->m_xOffset = pEvtMouse->getXPos() - pPos->getLeft()
- (int)(tempX * factorX);
pThis->m_yOffset = pEvtMouse->getYPos() - pPos->getTop()
......@@ -244,10 +244,10 @@ void CtrlSliderCursor::transMove( SkinObject *pCtrl )
int relYPond = (int)(relY / factorY);
// Update the position
if( pThis->m_curve.getMinDist( relXPond, relYPond ) < RANGE )
if( pThis->m_rCurve.getMinDist( relXPond, relYPond ) < RANGE )
{
float percentage = pThis->m_curve.getNearestPercent( relXPond,
relYPond );
float percentage = pThis->m_rCurve.getNearestPercent( relXPond,
relYPond );
pThis->m_rVariable.set( percentage );
}
else
......@@ -304,7 +304,7 @@ CtrlSliderBg::CtrlSliderBg( intf_thread_t *pIntf, CtrlSliderCursor &rCursor,
int thickness, VarBool *pVisible,
const UString &rHelp ):
CtrlGeneric( pIntf, rHelp, pVisible ), m_rCursor( rCursor ),
m_rVariable( rVariable ), m_thickness( thickness ), m_curve( rCurve ),
m_rVariable( rVariable ), m_thickness( thickness ), m_rCurve( rCurve ),
m_width( rCurve.getWidth() ), m_height( rCurve.getHeight() )
{
}
......@@ -316,8 +316,8 @@ bool CtrlSliderBg::mouseOver( int x, int y ) const
float factorX, factorY;
getResizeFactors( factorX, factorY );
return (m_curve.getMinDist( (int)(x / factorX),
(int)(y / factorY) ) < m_thickness );
return (m_rCurve.getMinDist( (int)(x / factorX),
(int)(y / factorY) ) < m_thickness );
}
......@@ -336,7 +336,7 @@ void CtrlSliderBg::handleEvent( EvtGeneric &rEvent )
EvtMouse &rEvtMouse = (EvtMouse&)rEvent;
int x = rEvtMouse.getXPos();
int y = rEvtMouse.getYPos();
m_rVariable.set( m_curve.getNearestPercent(
m_rVariable.set( m_rCurve.getNearestPercent(
(int)((x - pPos->getLeft()) / factorX),
(int)((y - pPos->getTop()) / factorY) ) );
......
......@@ -2,7 +2,7 @@
* ctrl_slider.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: ctrl_slider.hpp,v 1.3 2004/02/29 16:49:55 asmax Exp $
* $Id: ctrl_slider.hpp,v 1.4 2004/03/02 21:45:15 ipkiss Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr>
......@@ -92,7 +92,7 @@ class CtrlSliderCursor: public CtrlGeneric, public Observer<VarPercent>
/// Current image
OSGraphics *m_pImg;
/// Bezier curve of the slider
const Bezier m_curve;
const Bezier &m_rCurve;
/// Callback functions
static void transOverDown( SkinObject *pCtrl );
......@@ -133,7 +133,7 @@ class CtrlSliderBg: public CtrlGeneric
/// Thickness of the curve
int m_thickness;
/// Bezier curve of the slider
const Bezier m_curve;
const Bezier &m_rCurve;
/// Initial size of the control
int m_width, m_height;
......
......@@ -2,7 +2,7 @@
* builder.cpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: builder.cpp,v 1.8 2004/03/01 18:33:31 asmax Exp $
* $Id: builder.cpp,v 1.9 2004/03/02 21:45:15 ipkiss Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr>
......@@ -182,8 +182,18 @@ void Builder::addAnchor( const BuilderData::Anchor &rData )
return;
}
Bezier *pCurve = getPoints( rData.m_points.c_str() );
if( pCurve == NULL )
{
msg_Err( getIntf(), "Invalid format in tag points=\"%s\"",
rData.m_points.c_str() );
return;
}
m_pTheme->m_curves.push_back( BezierPtr( pCurve ) );
Anchor *pAnc = new Anchor( getIntf(), rData.m_xPos, rData.m_yPos,
rData.m_range, rData.m_priority, *pWin );
rData.m_range, rData.m_priority,
*pCurve, *pWin );
pWin->addAnchor( pAnc );
}
......@@ -615,16 +625,18 @@ Bezier *Builder::getPoints( const char *pTag ) const
int x, y, n;
while( 1 )
{
if( sscanf( pTag, "(%d,%d)%n", &x, &y, &n ) < 2 )
if( sscanf( pTag, "(%d,%d)%n", &x, &y, &n ) < 1 )
{
return NULL;
}
#if 0
if( x < 0 || y < 0 )
{
msg_Err( getIntf(),
"Slider points cannot have negative coordinates!" );
return NULL;
}
#endif
xBez.push_back( x );
yBez.push_back( y );
pTag += n;
......
......@@ -3,7 +3,7 @@ Bitmap id:string fileName:string alphaColor:uint32_t
Font id:string fontName:string size:int
Window id:string xPos:int yPos:int visible:bool dragDrop:bool playOnDrop:bool
Layout id:string width:int height:int minWidth:int maxWidth:int minHeight:int maxHeight:int windowId:string
Anchor xPos:int yPos:int range:int priority:int windowId:string
Anchor xPos:int yPos:int range:int priority:int points:string windowId:string
Button id:string xPos:int yPos:int leftTop:string rightBottom:string upId:string downId:string overId:string actionId:string tooltip:string help:string layer:int windowId:string layoutId:string
Checkbox id:string xPos:int yPos:int leftTop:string rightBottom:string up1Id:string down1Id:string over1Id:string up2Id:string down2Id:string over2Id:string state:string action1:string action2:string tooltip1:string tooltip2:string help:string layer:int windowId:string layoutId:string
Image id:string xPos:int yPos:int leftTop:string rightBottom:string visible:bool bmpId:string onclickId:string help:string layer:int windowId:string layoutId:string
......
......@@ -2,7 +2,7 @@
* builder_data.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: builder_data.hpp,v 1.5 2004/02/29 16:49:55 asmax Exp $
* $Id: builder_data.hpp,v 1.6 2004/03/02 21:45:15 ipkiss Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
......@@ -116,13 +116,14 @@ m_id( id ), m_width( width ), m_height( height ), m_minWidth( minWidth ), m_maxW
/// Type definition
struct Anchor
{
Anchor( int xPos, int yPos, int range, int priority, const string & windowId ):
m_xPos( xPos ), m_yPos( yPos ), m_range( range ), m_priority( priority ), m_windowId( windowId ) {}
Anchor( int xPos, int yPos, int range, int priority, const string & points, const string & windowId ):
m_xPos( xPos ), m_yPos( yPos ), m_range( range ), m_priority( priority ), m_points( points ), m_windowId( windowId ) {}
int m_xPos;
int m_yPos;
int m_range;
int m_priority;
const string m_points;
const string m_windowId;
};
/// List
......
......@@ -15,7 +15,7 @@ hppfile.write(
* builder_data.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: gen_builder.py,v 1.1 2004/01/03 23:31:33 asmax Exp $
* $Id: gen_builder.py,v 1.2 2004/03/02 21:45:15 ipkiss Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr>
......@@ -41,13 +41,13 @@ hppfile.write(
#ifndef BUILDER_DATA_HPP
#define BUILDER_DATA_HPP
using namespace std;
#include <vlc/vlc.h>
#include <list>
#include <map>
#include <string>
using namespace std;
/// Structure for mapping data from XML file
struct BuilderData
{
......
......@@ -2,7 +2,7 @@
* skin_parser.cpp
*****************************************************************************
* Copyright (C) 2004 VideoLAN
* $Id: skin_parser.cpp,v 1.4 2004/03/01 19:36:43 asmax Exp $
* $Id: skin_parser.cpp,v 1.5 2004/03/02 21:45:15 ipkiss Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
*
......@@ -40,7 +40,7 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
{
const BuilderData::Anchor anchor( atoi( attr["x"] ) + m_xOffset,
atoi( attr["y"] ) + m_yOffset, atoi( attr["range"] ),
atoi( attr["priority"] ), m_curWindowId );
atoi( attr["priority"] ), attr["points"], m_curWindowId );
m_data.m_listAnchor.push_back( anchor );
}
......
......@@ -2,7 +2,7 @@
* anchor.cpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: anchor.cpp,v 1.1 2004/01/03 23:31:33 asmax Exp $
* $Id: anchor.cpp,v 1.2 2004/03/02 21:45:15 ipkiss Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
......@@ -27,20 +27,47 @@
bool Anchor::isHanging( const Anchor &rOther ) const
{
return (getXPosAbs() == rOther.getXPosAbs() &&
getYPosAbs() == rOther.getYPosAbs() &&
m_priority > rOther.m_priority );
if( m_priority <= rOther.m_priority )
return false;
// Compute delta coordinates between anchors, since the Bezier class
// uses coordinates relative to (0;0)
int deltaX = getXPosAbs() - rOther.getXPosAbs();
int deltaY = getYPosAbs() - rOther.getYPosAbs();
// One of the anchors (at least) must be a point, else it has no meaning
return (isPoint() && rOther.m_rCurve.getMinDist( deltaX, deltaY ) == 0) ||
(rOther.isPoint() && m_rCurve.getMinDist( -deltaX, -deltaY ) == 0);
}
bool Anchor::canHang( const Anchor &rOther, int &xOffset, int &yOffset ) const
{
int xDist = getXPosAbs() - (rOther.getXPosAbs() + xOffset);
int yDist = getYPosAbs() - (rOther.getYPosAbs() + yOffset);
if( m_range > 0 && xDist*xDist + yDist*yDist <= m_range*m_range )
int deltaX = getXPosAbs() - (rOther.getXPosAbs() + xOffset);
int deltaY = getYPosAbs() - (rOther.getYPosAbs() + yOffset);
// One of the anchors (at least) must be a point, else it has no meaning
if( (isPoint() && rOther.m_rCurve.getMinDist( deltaX, deltaY ) < m_range) )
{
xOffset = getXPosAbs() - rOther.getXPosAbs();
yOffset = getYPosAbs() - rOther.getYPosAbs();
// Compute the coordinates of the nearest point of the curve
int xx, yy;
float p = rOther.m_rCurve.getNearestPercent( deltaX, deltaY );
rOther.m_rCurve.getPoint( p, xx, yy );
xOffset = getXPosAbs() - (rOther.getXPosAbs() + xx);
yOffset = getYPosAbs() - (rOther.getYPosAbs() + yy);
return true;
}
else if( (rOther.isPoint() &&
m_rCurve.getMinDist( -deltaX, -deltaY ) < m_range) )
{
// Compute the coordinates of the nearest point of the curve
int xx, yy;
float p = m_rCurve.getNearestPercent( -deltaX, -deltaY );
m_rCurve.getPoint( p, xx, yy );
xOffset = (getXPosAbs() + xx) - rOther.getXPosAbs();
yOffset = (getYPosAbs() + yy) - rOther.getYPosAbs();
return true;
}
else
......
......@@ -2,7 +2,7 @@
* anchor.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: anchor.hpp,v 1.1 2004/01/03 23:31:33 asmax Exp $
* $Id: anchor.hpp,v 1.2 2004/03/02 21:45:15 ipkiss Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
......@@ -27,6 +27,7 @@
#include "skin_common.hpp"
#include "generic_window.hpp"
#include "../utils/bezier.hpp"
/// Class for the windows anchors
......@@ -34,9 +35,10 @@ class Anchor: public SkinObject
{
public:
Anchor( intf_thread_t *pIntf, int xPos, int yPos, int range,
int priority, GenericWindow &rWindow ):
int priority, const Bezier &rCurve, GenericWindow &rWindow ):
SkinObject( pIntf ), m_xPos( xPos ), m_yPos( yPos ),
m_range( range ), m_priority( priority ), m_rWindow( rWindow ) {}
m_rCurve( rCurve ), m_range( range ), m_priority( priority ),
m_rWindow( rWindow ) {}
virtual ~Anchor() {}
/// Return true if the given anchor is hanged by this one
......@@ -56,6 +58,9 @@ class Anchor: public SkinObject
/// doesn't "jump" in a strange way).
bool canHang( const Anchor &rOther, int &xOffset, int &yOffset ) const;
// Indicate whether this anchor is reduced to a single point
bool isPoint() const { return m_rCurve.getNbCtrlPoints() == 1; }
// Getters
int getXPosAbs() const { return (m_xPos + m_rWindow.getLeft()); }
int getYPosAbs() const { return (m_yPos + m_rWindow.getTop()); }
......@@ -64,6 +69,9 @@ class Anchor: public SkinObject
/// Coordinates relative to the window
int m_xPos, m_yPos;
/// Curve of the anchor
const Bezier &m_rCurve;
/// Range of action
int m_range;
......
......@@ -2,7 +2,7 @@
* theme.cpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: theme.cpp,v 1.3 2004/02/08 11:23:17 gbazin Exp $
* $Id: theme.cpp,v 1.4 2004/03/02 21:45:15 ipkiss Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr>
......@@ -37,6 +37,7 @@ Theme::~Theme()
m_fonts.clear();
m_commands.clear();
m_vars.clear();
m_curves.clear();
}
......
......@@ -2,7 +2,7 @@
-->
<!ELEMENT Theme (ThemeInfo,(Bitmap|Font|Window|Event)*)>
<!ELEMENT Theme (ThemeInfo,(Bitmap|Font|Window)*)>
<!ATTLIST Theme
version CDATA "1.0"
magnet CDATA "15"
......@@ -18,12 +18,6 @@
file CDATA #REQUIRED
alphacolor CDATA #REQUIRED
>
<!ELEMENT Event EMPTY>
<!ATTLIST Event
id CDATA #REQUIRED
event CDATA #REQUIRED
key CDATA "none"
>
<!ELEMENT Font EMPTY>
<!ATTLIST Font
id CDATA #REQUIRED
......@@ -61,7 +55,7 @@
maxheight CDATA "-1"
>
<!ELEMENT Group (Group|Image|Button|Playlist|Slider|RadialSlider|Text|CheckBox|
Rectangle|Anchor)+>
Anchor)+>
<!ATTLIST Group
x CDATA "0"
y CDATA "0"
......@@ -73,6 +67,7 @@
x CDATA "0"
y CDATA "0"
priority CDATA #REQUIRED
points CDATA "(0,0)"
range CDATA "10"
>
......@@ -89,18 +84,6 @@
onclick CDATA "none"
help CDATA "\0"
>
<!ELEMENT Rectangle EMPTY>
<!ATTLIST Rectangle
id CDATA "none"
visible CDATA "true"
x CDATA "0"
y CDATA "0"
w CDATA "50"
h CDATA "50"
color CDATA "#C0C0C0"
onclick CDATA "none"
help CDATA "\0"
>
<!ELEMENT Button EMPTY>
<!ATTLIST Button
id CDATA "none"
......
<!DOCTYPE Theme SYSTEM "skin.dtd">
<Theme version="1.99" magnet="20" alpha="255" movealpha="192" fadetime="500">
<ThemeInfo name="VLC OSX Interface" author="BigBen"
email="bigben@videolan.org" webpage="http://www.videolan.org"/>
<Bitmap id="mainbody" file="body.png" alphacolor="#FF0000"/>
<Bitmap id="add_item" file="add_item.png" alphacolor="#FF0000"/>
<Bitmap id="add_item_onclick" file="add_item_onclick.png" alphacolor="#FF0000"/>
<Bitmap id="close" file="close.png" alphacolor="#00FF00"/>
<Bitmap id="close_onclick" file="close_onclick.png" alphacolor="#00FF00"/>
<Bitmap id="close_mouseover" file="close_mouseover.png" alphacolor="#00FF00"/>
<Bitmap id="delete_item" file="delete_item.png" alphacolor="#FF0000"/>
<Bitmap id="delete_item_onclick" file="delete_item_onclick.png" alphacolor="#FF0000"/>
<Bitmap id="fast" file="fast.png" alphacolor="#FF0000"/>
<Bitmap id="fast_click" file="fast_onclick.png" alphacolor="#FF0000"/>
<Bitmap id="fast_disabled" file="fast_disabled.png" alphacolor="#FF0000"/>
<Bitmap id="rev" file="rev.png" alphacolor="#FF0000"/>
<Bitmap id="rev_click" file="rev_onclick.png" alphacolor="#FF0000"/>
<Bitmap id="next" file="next.png" alphacolor="#FF0000"/>
<Bitmap id="next_disabled" file="next_disabled.png" alphacolor="#FF0000"/>
<Bitmap id="next_onclick" file="next_onclick.png" alphacolor="#FF0000"/>
<Bitmap id="pause" file="pause.png" alphacolor="#FF0000"/>
<Bitmap id="pause_onclick" file="pause_onclick.png" alphacolor="#FF0000"/>
<Bitmap id="play" file="play.png" alphacolor="#FF0000"/>
<Bitmap id="play_onclick" file="play_onclick.png" alphacolor="#FF0000"/>
<Bitmap id="disabled" file="disabled.png" alphacolor="#FF0000"/>
<Bitmap id="playlist1" file="playlist_body1.png" alphacolor="#FF0000"/>
<Bitmap id="playlist2" file="playlist_body2.png" alphacolor="#FF0000"/>
<Bitmap id="playlist3" file="playlist_body3.png" alphacolor="#FF0000"/>
<Bitmap id="playlist4" file="playlist_body4.png" alphacolor="#FF0000"/>
<Bitmap id="playlist6" file="playlist_body6.png" alphacolor="#FF0000"/>
<Bitmap id="playlist7" file="playlist_body7.png" alphacolor="#FF0000"/>
<Bitmap id="playlist8" file="playlist_body8.png" alphacolor="#FF0000"/>
<Bitmap id="playlist9" file="playlist_body9.png" alphacolor="#FF0000"/>
<Bitmap id="resize" file="resize.png" alphacolor="#FF0000"/>
<Bitmap id="playlist_button" file="playlist_button.png" alphacolor="#FF0000"/>
<Bitmap id="playlist_button_onclick" file="playlist_button_onclick.png" alphacolor="#FF0000"/>
<Bitmap id="playlist_button2" file="playlist_button2.png" alphacolor="#FF0000"/>
<Bitmap id="playlist_button_onclick2" file="playlist_button_onclick2.png" alphacolor="#FF0000"/>
<Bitmap id="sort_button" file="sort.png" alphacolor="#FF0000"/>
<Bitmap id="sort_button_onclick" file="sort_onclick.png" alphacolor="#FF0000"/>
<Bitmap id="preferences" file="preferences.png" alphacolor="#FF0000"/>
<Bitmap id="preferences_onclick" file="preferences_onclick.png" alphacolor="#FF0000"/>
<Bitmap id="previous" file="previous.png" alphacolor="#FF0000"/>
<Bitmap id="previous_disabled" file="previous_disabled.png" alphacolor="#FF0000"/>
<Bitmap id="previous_onclick" file="previous_onclick.png" alphacolor="#FF0000"/>
<Bitmap id="reduce" file="reduce.png" alphacolor="#FF0000"/>
<Bitmap id="reduce_onclick" file="reduce_onclick.png" alphacolor="#FF0000"/>
<Bitmap id="reduce_disabled" file="reduce_disabled.png" alphacolor="#FF0000"/>
<Bitmap id="slider" file="slider.png" alphacolor="#FF0000"/>
<Bitmap id="slider_onclick" file="slider_onclick.png" alphacolor="#FF0000"/>
<Bitmap id="slider_playlist" file="slider_playlist.png" alphacolor="#FF0000"/>
<Bitmap id="slider_volume" file="slider_volume.png" alphacolor="#FF0000"/>
<Bitmap id="slider_volume_onclick" file="slider_volume_onclick.png" alphacolor="#FF0000"/>
<Bitmap id="slow" file="slow.png" alphacolor="#FF0000"/>
<Bitmap id="slow_disabled" file="slow_disabled.png" alphacolor="#FF0000"/>
<Bitmap id="slow_onclick" file="slow_onclick.png" alphacolor="#FF0000"/>
<Bitmap id="stop" file="stop.png" alphacolor="#FF0000"/>
<Bitmap id="stop_disabled" file="stop_disabled.png" alphacolor="#FF0000"/>
<Bitmap id="stop_onclick" file="stop_onclick.png" alphacolor="#FF0000"/>
<Bitmap id="volume_radial" file="volume.png" alphacolor="#FF0000"/>
<Font id="default_font" font="FreeSansBold.ttf" size="15"/>
<Font id="playlist_font" font="FreeSansBold.ttf" size="12"/>
<Window x="230" y="250" dragdrop="true">
<Layout id="testlayout" width="424" height="152">
<Group x="0" y="0">
<Image x="0" y="0" image="mainbody" onclick="move"/>
<Button x="8" y="5" up="close" down="close_onclick" over="close_mouseover" action="vlc.quit()" tooltiptext="Quit VLC"/>
</Group>
</Layout>
<Layout id="mainlayout" width="424" height="152">
<Group x="0" y="0">
<Anchor x="7" y="151" priority="100"/>
<Image x="0" y="0" image="mainbody" onclick="move"/>
<Text font="default_font" width="70" x="287" y="79" text="$T" color="#000000"/>
<Button x="42" y="42" up="preferences" down="preferences_onclick" over="preferences" action="dialogs.prefs()" tooltiptext="Preferences"/>
<Button x="17" y="64" up="stop" down="stop_onclick" over="stop" action="vlc.stop()" tooltiptext="Stop"/>
<CheckBox x="42" y="87" up1="playlist_button" down1="playlist_button_onclick" up2="playlist_button2" down2="playlist_button_onclick2" state="playlist_window.isVisible" action1="playlist_window.show()" action2="playlist_window.hide()" tooltiptext1="Show Playlist" tooltiptext2="Hide Playlist"/>
<CheckBox x="83" y="44" up1="play" up2="pause" down1="play_onclick" down2="pause_onclick" state="vlc.isPlaying" action1="vlc.play()" action2="vlc.pause()" tooltiptext1="Play" tooltiptext2="Pause"/>
<Button x="159" y="37" up="rev" down="rev_click" over="rev" action="vlc.slower()" tooltiptext="Slower"/>
<Button x="159" y="89" up="fast" down="fast_click" over="fast" action="vlc.faster()" tooltiptext="Faster"/>
<Button x="196" y="46" up="previous" down="previous_onclick" over="previous" action="playlist.previous()" tooltiptext="Previous Item"/>
<Button x="196" y="79" up="next" down="next_onclick" over="next" action="playlist.next()" tooltiptext="Next Item"/>
<Button x="8" y="5" up="close" down="close_onclick" over="close_mouseover" action="vlc.quit()" tooltiptext="Quit VLC" help="quit"/>
<Image x="29" y="5" image="reduce_disabled"/>
<Slider id="time_slider" x="24" y="130" up="slider" down="slider_onclick" points="(0,0),(366,0)" value="time" visible="vlc.isSeekable and not vlc.isStopped" tooltiptext="Time: $T"/>
<Slider id="volume_slider" x="391" y="53" up="slider_volume" down="slider_volume_onclick" points="(0,47),(0,0)" value="volume" tooltiptext="Volume: $V%"/>
</Group>
</Layout>
</Window>
<Window id="playlist_window" x="237" y="401" visible="false">
<Layout id="playlistLayout" width="410" height="250" minwidth="200" minheight="150" maxwidth="1000" maxheight="800">
<Group x="0" y="0">
<Anchor x="0" y="0" priority="50"/>
<Image image="playlist1" x="0" y="0" lefttop="lefttop" rightbottom="lefttop" onclick="move"/>
<Image image="playlist2" x="17" y="0" lefttop="lefttop" rightbottom="righttop" onclick="move"/>
<Image image="playlist3" x="350" y="0" lefttop="righttop" rightbottom="righttop" onclick="move"/>
<Image image="playlist4" x="0" y="70" lefttop="lefttop" rightbottom="leftbottom" onclick="move"/>
<Image image="playlist6" x="350" y="70" lefttop="righttop" rightbottom="rightbottom" onclick="move"/>
<Image image="playlist7" x="0" y="200" lefttop="leftbottom" rightbottom="leftbottom" onclick="move"/>
<Image image="playlist8" x="17" y="200" lefttop="leftbottom" rightbottom="rightbottom" onclick="move"/>
<Image image="playlist9" x="350" y="200" lefttop="rightbottom" rightbottom="rightbottom" onclick="move"/>
<Image image="resize" x="392" y="232" lefttop="rightbottom" rightbottom="rightbottom" onclick="resize"/>
<Button x="374" y="12" lefttop="righttop" rightbottom="righttop" up="add_item" down="add_item_onclick" over="add_item" action="playlist.add()" tooltiptext="Add item"/>
<Button x="374" y="40" up="delete_item" lefttop="righttop" rightbottom="righttop" down="delete_item_onclick" over="delete_item" action="playlist.del()" tooltiptext="Del item"/>
<Button x="374" y="68" up="sort_button" lefttop="righttop" rightbottom="righttop" down="sort_button_onclick" over="sort_button" action="playlist.sort()" tooltiptext="Sort the playlist"/>
<Playlist id="playlist" x="17" y="15" width="333" height="204" lefttop="lefttop" rightbottom="rightbottom" font="playlist_font" fgcolor="#000000" playcolor="#ff0000" bgcolor1="#ffffff" bgcolor2="#e0e0ff" selcolor="#4e8bc7">
<Slider id="playlist_slider" x="358" y="25" lefttop="righttop" rightbottom="rightbottom" up="slider_volume" down="slider_volume_onclick" points="(0,185),(0,0)"/>
</Playlist>
</Group>
</Layout>
</Window>
</Theme>
<!DOCTYPE Theme SYSTEM "skin.dtd">
<Theme version="1.99" magnet="20" alpha="255" movealpha="192" fadetime="500">
<ThemeInfo name="VLC OSX Interface" author="BigBen"
email="bigben@videolan.org" webpage="http://www.videolan.org"/>
<Bitmap id="mainbody" file="body.png" alphacolor="#FF0000"/>
<Bitmap id="add_item" file="add_item.png" alphacolor="#FF0000"/>
<Bitmap id="add_item_onclick" file="add_item_onclick.png" alphacolor="#FF0000"/>
<Bitmap id="close" file="close.png" alphacolor="#00FF00"/>
<Bitmap id="close_onclick" file="close_onclick.png" alphacolor="#00FF00"/>
<Bitmap id="close_mouseover" file="close_mouseover.png" alphacolor="#00FF00"/>
<Bitmap id="delete_item" file="delete_item.png" alphacolor="#FF0000"/>
<Bitmap id="delete_item_onclick" file="delete_item_onclick.png" alphacolor="#FF0000"/>
<Bitmap id="fast" file="fast.png" alphacolor="#FF0000"/>
<Bitmap id="fast_click" file="fast_onclick.png" alphacolor="#FF0000"/>
<Bitmap id="fast_disabled" file="fast_disabled.png" alphacolor="#FF0000"/>
<Bitmap id="rev" file="rev.png" alphacolor="#FF0000"/>
<Bitmap id="rev_click" file="rev_onclick.png" alphacolor="#FF0000"/>
<Bitmap id="next" file="next.png" alphacolor="#FF0000"/>
<Bitmap id="next_disabled" file="next_disabled.png" alphacolor="#FF0000"/>
<Bitmap id="next_onclick" file="next_onclick.png" alphacolor="#FF0000"/>
<Bitmap id="pause" file="pause.png" alphacolor="#FF0000"/>
<Bitmap id="pause_onclick" file="pause_onclick.png" alphacolor="#FF0000"/>
<Bitmap id="play" file="play.png" alphacolor="#FF0000"/>
<Bitmap id="play_onclick" file="play_onclick.png" alphacolor="#FF0000"/>
<Bitmap id="disabled" file="disabled.png" alphacolor="#FF0000"/>
<Bitmap id="playlist1" file="playlist_body1.png" alphacolor="#FF0000"/>
<Bitmap id="playlist2" file="playlist_body2.png" alphacolor="#FF0000"/>
<Bitmap id="playlist3" file="playlist_body3.png" alphacolor="#FF0000"/>
<Bitmap id="playlist4" file="playlist_body4.png" alphacolor="#FF0000"/>
<Bitmap id="playlist6" file="playlist_body6.png" alphacolor="#FF0000"/>
<Bitmap id="playlist7" file="playlist_body7.png" alphacolor="#FF0000"/>
<Bitmap id="playlist8" file="playlist_body8.png" alphacolor="#FF0000"/>
<Bitmap id="playlist9" file="playlist_body9.png" alphacolor="#FF0000"/>
<Bitmap id="resize" file="resize.png" alphacolor="#FF0000"/>
<Bitmap id="playlist_button" file="playlist_button.png" alphacolor="#FF0000"/>
<Bitmap id="playlist_button_onclick" file="playlist_button_onclick.png" alphacolor="#FF0000"/>
<Bitmap id="playlist_button2" file="playlist_button2.png" alphacolor="#FF0000"/>
<Bitmap id="playlist_button_onclick2" file="playlist_button_onclick2.png" alphacolor="#FF0000"/>
<Bitmap id="sort_button" file="sort.png" alphacolor="#FF0000"/>
<Bitmap id="sort_button_onclick" file="sort_onclick.png" alphacolor="#FF0000"/>
<Bitmap id="preferences" file="preferences.png" alphacolor="#FF0000"/>
<Bitmap id="preferences_onclick" file="preferences_onclick.png" alphacolor="#FF0000"/>
<Bitmap id="previous" file="previous.png" alphacolor="#FF0000"/>
<Bitmap id="previous_disabled" file="previous_disabled.png" alphacolor="#FF0000"/>
<Bitmap id="previous_onclick" file="previous_onclick.png" alphacolor="#FF0000"/>
<Bitmap id="reduce" file="reduce.png" alphacolor="#FF0000"/>
<Bitmap id="reduce_onclick" file="reduce_onclick.png" alphacolor="#FF0000"/>
<Bitmap id="reduce_disabled" file="reduce_disabled.png" alphacolor="#FF0000"/>
<Bitmap id="slider" file="slider.png" alphacolor="#FF0000"/>
<Bitmap id="slider_onclick" file="slider_onclick.png" alphacolor="#FF0000"/>
<Bitmap id="slider_playlist" file="slider_playlist.png" alphacolor="#FF0000"/>
<Bitmap id="slider_volume" file="slider_volume.png" alphacolor="#FF0000"/>
<Bitmap id="slider_volume_onclick" file="slider_volume_onclick.png" alphacolor="#FF0000"/>
<Bitmap id="slow" file="slow.png" alphacolor="#FF0000"/>
<Bitmap id="slow_disabled" file="slow_disabled.png" alphacolor="#FF0000"/>
<Bitmap id="slow_onclick" file="slow_onclick.png" alphacolor="#FF0000"/>
<Bitmap id="stop" file="stop.png" alphacolor="#FF0000"/>
<Bitmap id="stop_disabled" file="stop_disabled.png" alphacolor="#FF0000"/>
<Bitmap id="stop_onclick" file="stop_onclick.png" alphacolor="#FF0000"/>
<Bitmap id="volume_radial" file="volume.png" alphacolor="#FF0000"/>
<Font id="default_font" font="FreeSansBold.ttf" size="15"/>
<Font id="playlist_font" font="FreeSansBold.ttf" size="12"/>
<Window x="230" y="250" dragdrop="true">
<Layout id="testlayout" width="424" height="152">
<Group x="0" y="0">
<Image x="0" y="0" image="mainbody" onclick="move"/>
<Button x="8" y="5" up="close" down="close_onclick" over="close_mouseover" action="vlc.quit()" tooltiptext="Quit VLC"/>
</Group>
</Layout>
<Layout id="mainlayout" width="424" height="152">
<Group x="0" y="0">
<Anchor x="7" y="151" points="(0,0)" priority="100"/>
<Image x="0" y="0" image="mainbody" onclick="move"/>
<Text font="default_font" width="70" x="287" y="79" text="$T" color="#000000"/>
<Button x="42" y="42" up="preferences" down="preferences_onclick" over="preferences" action="dialogs.prefs()" tooltiptext="Preferences"/>
<Button x="17" y="64" up="stop" down="stop_onclick" over="stop" action="vlc.stop()" tooltiptext="Stop"/>
<CheckBox x="42" y="87" up1="playlist_button" down1="playlist_button_onclick" up2="playlist_button2" down2="playlist_button_onclick2" state="playlist_window.isVisible" action1="playlist_window.show()" action2="playlist_window.hide()" tooltiptext1="Show Playlist" tooltiptext2="Hide Playlist"/>
<CheckBox x="83" y="44" up1="play" up2="pause" down1="play_onclick" down2="pause_onclick" state="vlc.isPlaying" action1="vlc.play()" action2="vlc.pause()" tooltiptext1="Play" tooltiptext2="Pause"/>
<Button x="159" y="37" up="rev" down="rev_click" over="rev" action="vlc.slower()" tooltiptext="Slower"/>
<Button x="159" y="89" up="fast" down="fast_click" over="fast" action="vlc.faster()" tooltiptext="Faster"/>
<Button x="196" y="46" up="previous" down="previous_onclick" over="previous" action="playlist.previous()" tooltiptext="Previous Item"/>
<Button x="196" y="79" up="next" down="next_onclick" over="next" action="playlist.next()" tooltiptext="Next Item"/>
<Button x="8" y="5" up="close" down="close_onclick" over="close_mouseover" action="vlc.quit()" tooltiptext="Quit VLC" help="quit"/>
<Image x="29" y="5" image="reduce_disabled"/>
<Slider id="time_slider" x="24" y="130" up="slider" down="slider_onclick" points="(0,0),(366,0)" value="time" visible="vlc.isSeekable and not vlc.isStopped" tooltiptext="Time: $T"/>
<Slider id="volume_slider" x="391" y="53" up="slider_volume" down="slider_volume_onclick" points="(0,47),(0,0)" value="volume" tooltiptext="Volume: $V%"/>
</Group>
</Layout>
</Window>
<Window id="playlist_window" x="237" y="401" visible="false">
<Layout id="playlistLayout" width="410" height="250" minwidth="200" minheight="150" maxwidth="1000" maxheight="800">
<Group x="0" y="0">
<Anchor x="0" y="0" points="(0,0)" priority="50"/>
<Image image="playlist1" x="0" y="0" lefttop="lefttop" rightbottom="lefttop" onclick="move"/>
<Image image="playlist2" x="17" y="0" lefttop="lefttop" rightbottom="righttop" onclick="move"/>
<Image image="playlist3" x="350" y="0" lefttop="righttop" rightbottom="righttop" onclick="move"/>
<Image image="playlist4" x="0" y="70" lefttop="lefttop" rightbottom="leftbottom" onclick="move"/>
<Image image="playlist6" x="350" y="70" lefttop="righttop" rightbottom="rightbottom" onclick="move"/>
<Image image="playlist7" x="0" y="200" lefttop="leftbottom" rightbottom="leftbottom" onclick="move"/>
<Image image="playlist8" x="17" y="200" lefttop="leftbottom" rightbottom="rightbottom" onclick="move"/>
<Image image="playlist9" x="350" y="200" lefttop="rightbottom" rightbottom="rightbottom" onclick="move"/>
<Image image="resize" x="392" y="232" lefttop="rightbottom" rightbottom="rightbottom" onclick="resize"/>
<Button x="374" y="12" lefttop="righttop" rightbottom="righttop" up="add_item" down="add_item_onclick" over="add_item" action="playlist.add()" tooltiptext="Add item"/>
<Button x="374" y="40" up="delete_item" lefttop="righttop" rightbottom="righttop" down="delete_item_onclick" over="delete_item" action="playlist.del()" tooltiptext="Del item"/>
<Button x="374" y="68" up="sort_button" lefttop="righttop" rightbottom="righttop" down="sort_button_onclick" over="sort_button" action="playlist.sort()" tooltiptext="Sort the playlist"/>
<Playlist id="playlist" x="17" y="15" width="333" height="204" lefttop="lefttop" rightbottom="rightbottom" font="playlist_font" fgcolor="#000000" playcolor="#ff0000" bgcolor1="#ffffff" bgcolor2="#e0e0ff" selcolor="#4e8bc7">
<Slider id="playlist_slider" x="358" y="25" lefttop="righttop" rightbottom="rightbottom" up="slider_volume" down="slider_volume_onclick" points="(0,185),(0,0)"/>
</Playlist>
</Group>
</Layout>
</Window>
</Theme>
......@@ -2,7 +2,7 @@
* bezier.cpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: bezier.cpp,v 1.3 2004/02/01 21:13:04 ipkiss Exp $
* $Id: bezier.cpp,v 1.4 2004/03/02 21:45:15 ipkiss Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr>
......@@ -30,13 +30,13 @@ Bezier::Bezier( intf_thread_t *p_intf, const vector<float> &rAbscissas,
const vector<float> &rOrdinates, Flag_t flag )
: SkinObject( p_intf )
{
// We expect rAbscissas and rOrdinates to have the same size, of course
m_nbCtrlPt = rAbscissas.size();
// Copy the control points coordinates
m_ptx.assign( rAbscissas.begin(), rAbscissas.end() );
m_pty.assign( rOrdinates.begin(), rOrdinates.end() );
// We expect m_ptx and m_pty to have the same size, of course
m_nbCtrlPt = m_ptx.size();
// Precalculate the factoriels
m_ft.push_back( 1 );
for( int i = 1; i < m_nbCtrlPt; i++ )
......@@ -44,18 +44,16 @@ Bezier::Bezier( intf_thread_t *p_intf, const vector<float> &rAbscissas,
m_ft.push_back( i * m_ft[i - 1] );
}
// Initialization
int cx, cy, oldx, oldy;
m_leftVect.reserve( MAX_BEZIER_POINT + 1 );
m_topVect.reserve( MAX_BEZIER_POINT + 1 );
// Calculate the first point
int oldx, oldy;
computePoint( 0, oldx, oldy );
m_leftVect[0] = oldx;
m_topVect[0] = oldy;
m_leftVect.push_back( oldx );
m_topVect.push_back( oldy );
m_percVect.push_back( 0 );
// Calculate the other points
float percentage;
int cx, cy;
for( float j = 1; j <= MAX_BEZIER_POINT; j++ )
{
percentage = j / MAX_BEZIER_POINT;
......@@ -71,9 +69,19 @@ Bezier::Bezier( intf_thread_t *p_intf, const vector<float> &rAbscissas,
oldy = cy;
}
}
m_nbPoints = m_percVect.size();
m_nbPoints = m_leftVect.size();
// If we have only one control point, we duplicate it
// This allows to simplify the algorithms used in the class
if( m_nbPoints == 1 )
{
m_leftVect.push_back( m_leftVect[0] );
m_topVect.push_back( m_topVect[0] );
m_percVect.push_back( 1 );
m_nbPoints = 2;
}
// Small hack to ensure that the percentage of the last point is always 1
// Ensure that the percentage of the last point is always 1
m_percVect[m_nbPoints - 1] = 1;
}
......
......@@ -2,7 +2,7 @@
* bezier.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: bezier.hpp,v 1.4 2004/02/01 21:13:04 ipkiss Exp $
* $Id: bezier.hpp,v 1.5 2004/03/02 21:45:15 ipkiss Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
......@@ -51,6 +51,9 @@ class Bezier: public SkinObject
Flag_t flag = kCoordsBoth );
~Bezier() {}
/// Get the number of control points used to define the curve
int getNbCtrlPoints() const { return m_nbCtrlPt; }
/// Return the percentage (between 0 and 1) of the curve point nearest
/// from (x, y)
float getNearestPercent( int x, int y ) const;
......
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