Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
6314367b
Commit
6314367b
authored
Dec 16, 2004
by
Olivier Teulière
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* skins2: When a control changes, refresh only the needed part of the layout
instead of refreshing everything
parent
df0d5be1
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
126 additions
and
37 deletions
+126
-37
modules/gui/skins2/controls/ctrl_button.cpp
modules/gui/skins2/controls/ctrl_button.cpp
+16
-8
modules/gui/skins2/controls/ctrl_button.hpp
modules/gui/skins2/controls/ctrl_button.hpp
+1
-1
modules/gui/skins2/controls/ctrl_checkbox.cpp
modules/gui/skins2/controls/ctrl_checkbox.cpp
+16
-8
modules/gui/skins2/controls/ctrl_generic.cpp
modules/gui/skins2/controls/ctrl_generic.cpp
+32
-3
modules/gui/skins2/controls/ctrl_generic.hpp
modules/gui/skins2/controls/ctrl_generic.hpp
+9
-2
modules/gui/skins2/controls/ctrl_radialslider.cpp
modules/gui/skins2/controls/ctrl_radialslider.cpp
+2
-2
modules/gui/skins2/controls/ctrl_slider.cpp
modules/gui/skins2/controls/ctrl_slider.cpp
+9
-5
modules/gui/skins2/controls/ctrl_text.cpp
modules/gui/skins2/controls/ctrl_text.cpp
+5
-3
modules/gui/skins2/src/generic_layout.cpp
modules/gui/skins2/src/generic_layout.cpp
+31
-4
modules/gui/skins2/src/generic_layout.hpp
modules/gui/skins2/src/generic_layout.hpp
+5
-1
No files found.
modules/gui/skins2/controls/ctrl_button.cpp
View file @
6314367b
...
...
@@ -133,8 +133,9 @@ void CtrlButton::transUpOverDownOver( SkinObject *pCtrl )
{
CtrlButton
*
pThis
=
(
CtrlButton
*
)
pCtrl
;
pThis
->
captureMouse
();
const
OSGraphics
*
pOldImg
=
pThis
->
m_pImg
;
pThis
->
m_pImg
=
pThis
->
m_pImgDown
;
pThis
->
notifyLayout
(
);
pThis
->
notifyLayout
MaxSize
(
pOldImg
,
pThis
->
m_pImg
);
}
...
...
@@ -142,8 +143,9 @@ void CtrlButton::transDownOverUpOver( SkinObject *pCtrl )
{
CtrlButton
*
pThis
=
(
CtrlButton
*
)
pCtrl
;
pThis
->
releaseMouse
();
const
OSGraphics
*
pOldImg
=
pThis
->
m_pImg
;
pThis
->
m_pImg
=
pThis
->
m_pImgUp
;
pThis
->
notifyLayout
(
);
pThis
->
notifyLayout
MaxSize
(
pOldImg
,
pThis
->
m_pImg
);
// Execute the command associated to this button
pThis
->
m_rCommand
.
execute
();
}
...
...
@@ -152,32 +154,36 @@ void CtrlButton::transDownOverUpOver( SkinObject *pCtrl )
void
CtrlButton
::
transDownOverDown
(
SkinObject
*
pCtrl
)
{
CtrlButton
*
pThis
=
(
CtrlButton
*
)
pCtrl
;
const
OSGraphics
*
pOldImg
=
pThis
->
m_pImg
;
pThis
->
m_pImg
=
pThis
->
m_pImgUp
;
pThis
->
notifyLayout
(
);
pThis
->
notifyLayout
MaxSize
(
pOldImg
,
pThis
->
m_pImg
);
}
void
CtrlButton
::
transDownDownOver
(
SkinObject
*
pCtrl
)
{
CtrlButton
*
pThis
=
(
CtrlButton
*
)
pCtrl
;
const
OSGraphics
*
pOldImg
=
pThis
->
m_pImg
;
pThis
->
m_pImg
=
pThis
->
m_pImgDown
;
pThis
->
notifyLayout
(
);
pThis
->
notifyLayout
MaxSize
(
pOldImg
,
pThis
->
m_pImg
);
}
void
CtrlButton
::
transUpUpOver
(
SkinObject
*
pCtrl
)
{
CtrlButton
*
pThis
=
(
CtrlButton
*
)
pCtrl
;
const
OSGraphics
*
pOldImg
=
pThis
->
m_pImg
;
pThis
->
m_pImg
=
pThis
->
m_pImgOver
;
pThis
->
notifyLayout
(
);
pThis
->
notifyLayout
MaxSize
(
pOldImg
,
pThis
->
m_pImg
);
}
void
CtrlButton
::
transUpOverUp
(
SkinObject
*
pCtrl
)
{
CtrlButton
*
pThis
=
(
CtrlButton
*
)
pCtrl
;
const
OSGraphics
*
pOldImg
=
pThis
->
m_pImg
;
pThis
->
m_pImg
=
pThis
->
m_pImgUp
;
pThis
->
notifyLayout
(
);
pThis
->
notifyLayout
MaxSize
(
pOldImg
,
pThis
->
m_pImg
);
}
...
...
@@ -191,15 +197,17 @@ void CtrlButton::transDownUp( SkinObject *pCtrl )
void
CtrlButton
::
transUpHidden
(
SkinObject
*
pCtrl
)
{
CtrlButton
*
pThis
=
(
CtrlButton
*
)
pCtrl
;
const
OSGraphics
*
pOldImg
=
pThis
->
m_pImg
;
pThis
->
m_pImg
=
NULL
;
pThis
->
notifyLayout
(
);
pThis
->
notifyLayout
MaxSize
(
pOldImg
,
pThis
->
m_pImg
);
}
void
CtrlButton
::
transHiddenUp
(
SkinObject
*
pCtrl
)
{
CtrlButton
*
pThis
=
(
CtrlButton
*
)
pCtrl
;
const
OSGraphics
*
pOldImg
=
pThis
->
m_pImg
;
pThis
->
m_pImg
=
pThis
->
m_pImgUp
;
pThis
->
notifyLayout
(
);
pThis
->
notifyLayout
MaxSize
(
pOldImg
,
pThis
->
m_pImg
);
}
modules/gui/skins2/controls/ctrl_button.hpp
View file @
6314367b
...
...
@@ -2,7 +2,7 @@
* ctrl_button.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id
: ctrl_button.hpp,v 1.2 2004/02/29 16:49:55 asmax Exp
$
* $Id$
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr>
...
...
modules/gui/skins2/controls/ctrl_checkbox.cpp
View file @
6314367b
...
...
@@ -177,8 +177,9 @@ void CtrlCheckbox::transUpOverDownOver( SkinObject *pCtrl )
{
CtrlCheckbox
*
pThis
=
(
CtrlCheckbox
*
)
pCtrl
;
pThis
->
captureMouse
();
const
OSGraphics
*
pOldImg
=
pThis
->
m_pImgCurrent
;
pThis
->
m_pImgCurrent
=
pThis
->
m_pImgDown
;
pThis
->
notifyLayout
(
);
pThis
->
notifyLayout
MaxSize
(
pOldImg
,
pThis
->
m_pImgCurrent
);
}
...
...
@@ -188,8 +189,9 @@ void CtrlCheckbox::transDownOverUpOver( SkinObject *pCtrl )
pThis
->
releaseMouse
();
// Invert the state variable
const
OSGraphics
*
pOldImg
=
pThis
->
m_pImgCurrent
;
pThis
->
m_pImgCurrent
=
pThis
->
m_pImgUp
;
pThis
->
notifyLayout
(
);
pThis
->
notifyLayout
MaxSize
(
pOldImg
,
pThis
->
m_pImgCurrent
);
// Execute the command
pThis
->
m_pCommand
->
execute
();
...
...
@@ -199,32 +201,36 @@ void CtrlCheckbox::transDownOverUpOver( SkinObject *pCtrl )
void
CtrlCheckbox
::
transDownOverDown
(
SkinObject
*
pCtrl
)
{
CtrlCheckbox
*
pThis
=
(
CtrlCheckbox
*
)
pCtrl
;
const
OSGraphics
*
pOldImg
=
pThis
->
m_pImgCurrent
;
pThis
->
m_pImgCurrent
=
pThis
->
m_pImgUp
;
pThis
->
notifyLayout
(
);
pThis
->
notifyLayout
MaxSize
(
pOldImg
,
pThis
->
m_pImgCurrent
);
}
void
CtrlCheckbox
::
transDownDownOver
(
SkinObject
*
pCtrl
)
{
CtrlCheckbox
*
pThis
=
(
CtrlCheckbox
*
)
pCtrl
;
const
OSGraphics
*
pOldImg
=
pThis
->
m_pImgCurrent
;
pThis
->
m_pImgCurrent
=
pThis
->
m_pImgDown
;
pThis
->
notifyLayout
(
);
pThis
->
notifyLayout
MaxSize
(
pOldImg
,
pThis
->
m_pImgCurrent
);
}
void
CtrlCheckbox
::
transUpUpOver
(
SkinObject
*
pCtrl
)
{
CtrlCheckbox
*
pThis
=
(
CtrlCheckbox
*
)
pCtrl
;
const
OSGraphics
*
pOldImg
=
pThis
->
m_pImgCurrent
;
pThis
->
m_pImgCurrent
=
pThis
->
m_pImgOver
;
pThis
->
notifyLayout
(
);
pThis
->
notifyLayout
MaxSize
(
pOldImg
,
pThis
->
m_pImgCurrent
);
}
void
CtrlCheckbox
::
transUpOverUp
(
SkinObject
*
pCtrl
)
{
CtrlCheckbox
*
pThis
=
(
CtrlCheckbox
*
)
pCtrl
;
const
OSGraphics
*
pOldImg
=
pThis
->
m_pImgCurrent
;
pThis
->
m_pImgCurrent
=
pThis
->
m_pImgUp
;
pThis
->
notifyLayout
(
);
pThis
->
notifyLayout
MaxSize
(
pOldImg
,
pThis
->
m_pImgCurrent
);
}
...
...
@@ -238,16 +244,18 @@ void CtrlCheckbox::transDownUp( SkinObject *pCtrl )
void
CtrlCheckbox
::
transUpHidden
(
SkinObject
*
pCtrl
)
{
CtrlCheckbox
*
pThis
=
(
CtrlCheckbox
*
)
pCtrl
;
const
OSGraphics
*
pOldImg
=
pThis
->
m_pImgCurrent
;
pThis
->
m_pImgCurrent
=
NULL
;
pThis
->
notifyLayout
(
);
pThis
->
notifyLayout
MaxSize
(
pOldImg
,
pThis
->
m_pImgCurrent
);
}
void
CtrlCheckbox
::
transHiddenUp
(
SkinObject
*
pCtrl
)
{
CtrlCheckbox
*
pThis
=
(
CtrlCheckbox
*
)
pCtrl
;
const
OSGraphics
*
pOldImg
=
pThis
->
m_pImgCurrent
;
pThis
->
m_pImgCurrent
=
pThis
->
m_pImgUp
;
pThis
->
notifyLayout
(
);
pThis
->
notifyLayout
MaxSize
(
pOldImg
,
pThis
->
m_pImgCurrent
);
}
...
...
modules/gui/skins2/controls/ctrl_generic.cpp
View file @
6314367b
...
...
@@ -69,12 +69,41 @@ void CtrlGeneric::setLayout( GenericLayout *pLayout,
}
void
CtrlGeneric
::
notifyLayout
()
const
void
CtrlGeneric
::
notifyLayout
(
int
width
,
int
height
)
const
{
// Notify the layout
if
(
m_pLayout
)
{
m_pLayout
->
onControlUpdate
(
*
this
);
m_pLayout
->
onControlUpdate
(
*
this
,
width
,
height
);
}
}
void
CtrlGeneric
::
notifyLayoutMaxSize
(
const
OSGraphics
*
pImg1
,
const
OSGraphics
*
pImg2
)
{
if
(
pImg1
==
NULL
)
{
if
(
pImg2
==
NULL
)
{
notifyLayout
();
}
else
{
notifyLayout
(
pImg2
->
getWidth
(),
pImg2
->
getHeight
()
);
}
}
else
{
if
(
pImg2
==
NULL
)
{
notifyLayout
(
pImg1
->
getWidth
(),
pImg1
->
getHeight
()
);
}
else
{
notifyLayout
(
max
(
pImg1
->
getWidth
(),
pImg2
->
getWidth
()
),
max
(
pImg1
->
getHeight
(),
pImg2
->
getHeight
()
)
);
}
}
}
...
...
@@ -128,7 +157,7 @@ bool CtrlGeneric::isVisible() const
void
CtrlGeneric
::
onUpdate
(
Subject
<
VarBool
>
&
rVariable
)
{
// Is it the visibily variable ?
// Is it the visibil
it
y variable ?
if
(
&
rVariable
==
m_pVisible
)
{
// Redraw the layout
...
...
modules/gui/skins2/controls/ctrl_generic.hpp
View file @
6314367b
...
...
@@ -83,8 +83,15 @@ class CtrlGeneric: public SkinObject, public Observer<VarBool>
CtrlGeneric
(
intf_thread_t
*
pIntf
,
const
UString
&
rHelp
,
VarBool
*
pVisible
=
NULL
);
/// Tell the layout when the image has changed
virtual
void
notifyLayout
()
const
;
/// Tell the layout when the image has changed, with the size of the
/// rectangle to repaint (use the default values for repainting the
/// whole window)
virtual
void
notifyLayout
(
int
witdh
=
-
1
,
int
height
=
-
1
)
const
;
/// Same as notifyLayout(), but takes optional images as parameters.
/// The maximum size(s) of the images will be used for repainting.
void
notifyLayoutMaxSize
(
const
OSGraphics
*
pImg1
=
NULL
,
const
OSGraphics
*
pImg2
=
NULL
);
/// Ask the layout to capture the mouse
virtual
void
captureMouse
()
const
;
...
...
modules/gui/skins2/controls/ctrl_radialslider.cpp
View file @
6314367b
...
...
@@ -2,7 +2,7 @@
* ctrl_radialslider.cpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id
: ctrl_radialslider.cpp,v 1.3 2004/02/29 16:49:55 asmax Exp
$
* $Id$
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr>
...
...
@@ -101,7 +101,7 @@ void CtrlRadialSlider::draw( OSGraphics &rImage, int xDest, int yDest )
void
CtrlRadialSlider
::
onUpdate
(
Subject
<
VarPercent
>
&
rVariable
)
{
m_position
=
(
int
)(
m_rVariable
.
get
()
*
m_numImg
);
notifyLayout
();
notifyLayout
(
m_width
,
m_height
);
}
...
...
modules/gui/skins2/controls/ctrl_slider.cpp
View file @
6314367b
...
...
@@ -163,7 +163,7 @@ void CtrlSliderCursor::draw( OSGraphics &rImage, int xDest, int yDest )
void
CtrlSliderCursor
::
onUpdate
(
Subject
<
VarPercent
>
&
rVariable
)
{
// The position has changed
notifyLayout
();
notifyLayout
(
m_rCurve
.
getWidth
(),
m_rCurve
.
getHeight
()
);
}
...
...
@@ -189,7 +189,8 @@ void CtrlSliderCursor::transOverDown( SkinObject *pCtrl )
pThis
->
captureMouse
();
pThis
->
m_pImg
=
pThis
->
m_pImgDown
;
pThis
->
notifyLayout
();
pThis
->
notifyLayout
(
pThis
->
m_rCurve
.
getWidth
(),
pThis
->
m_rCurve
.
getHeight
()
);
}
...
...
@@ -202,7 +203,8 @@ void CtrlSliderCursor::transDownOver( SkinObject *pCtrl )
pThis
->
releaseMouse
();
pThis
->
m_pImg
=
pThis
->
m_pImgUp
;
pThis
->
notifyLayout
();
pThis
->
notifyLayout
(
pThis
->
m_rCurve
.
getWidth
(),
pThis
->
m_rCurve
.
getHeight
()
);
}
...
...
@@ -211,7 +213,8 @@ void CtrlSliderCursor::transUpOver( SkinObject *pCtrl )
CtrlSliderCursor
*
pThis
=
(
CtrlSliderCursor
*
)
pCtrl
;
pThis
->
m_pImg
=
pThis
->
m_pImgOver
;
pThis
->
notifyLayout
();
pThis
->
notifyLayout
(
pThis
->
m_rCurve
.
getWidth
(),
pThis
->
m_rCurve
.
getHeight
()
);
}
...
...
@@ -220,7 +223,8 @@ void CtrlSliderCursor::transOverUp( SkinObject *pCtrl )
CtrlSliderCursor
*
pThis
=
(
CtrlSliderCursor
*
)
pCtrl
;
pThis
->
m_pImg
=
pThis
->
m_pImgUp
;
pThis
->
notifyLayout
();
pThis
->
notifyLayout
(
pThis
->
m_rCurve
.
getWidth
(),
pThis
->
m_rCurve
.
getHeight
()
);
}
...
...
modules/gui/skins2/controls/ctrl_text.cpp
View file @
6314367b
...
...
@@ -227,7 +227,7 @@ void CtrlText::displayText( const UString &rText )
m_pTimer
->
stop
();
}
}
notifyLayout
();
notifyLayout
(
getPosition
()
->
getWidth
(),
getPosition
()
->
getHeight
()
);
}
}
...
...
@@ -311,7 +311,8 @@ void CtrlText::transMove( SkinObject *pCtrl )
pThis
->
m_xPos
=
(
pEvtMouse
->
getXPos
()
-
pThis
->
m_xOffset
);
pThis
->
adjust
(
pThis
->
m_xPos
);
pThis
->
notifyLayout
();
pThis
->
notifyLayout
(
pThis
->
getPosition
()
->
getWidth
(),
pThis
->
getPosition
()
->
getHeight
()
);
}
}
...
...
@@ -323,7 +324,8 @@ void CtrlText::updateText( SkinObject *pCtrl )
pThis
->
m_xPos
-=
MOVING_TEXT_STEP
;
pThis
->
adjust
(
pThis
->
m_xPos
);
pThis
->
notifyLayout
();
pThis
->
notifyLayout
(
pThis
->
getPosition
()
->
getWidth
(),
pThis
->
getPosition
()
->
getHeight
()
);
}
...
...
modules/gui/skins2/src/generic_layout.cpp
View file @
6314367b
...
...
@@ -121,10 +121,21 @@ const list<LayeredControl> &GenericLayout::getControlList() const
}
void
GenericLayout
::
onControlUpdate
(
const
CtrlGeneric
&
rCtrl
)
void
GenericLayout
::
onControlUpdate
(
const
CtrlGeneric
&
rCtrl
,
int
width
,
int
height
)
{
// TODO: refresh only the needed area if possible
// The size was not specified (or invalid)
if
(
width
<=
0
||
height
<=
0
)
{
refreshAll
();
return
;
}
const
Position
*
pPos
=
rCtrl
.
getPosition
();
if
(
pPos
)
{
refreshRect
(
pPos
->
getLeft
(),
pPos
->
getTop
(),
width
,
height
);
}
}
...
...
@@ -177,6 +188,12 @@ void GenericLayout::resize( int width, int height )
void
GenericLayout
::
refreshAll
()
{
refreshRect
(
0
,
0
,
m_width
,
m_height
);
}
void
GenericLayout
::
refreshRect
(
int
x
,
int
y
,
int
width
,
int
height
)
{
// Draw all the controls of the layout
list
<
LayeredControl
>::
const_iterator
iter
;
...
...
@@ -194,7 +211,17 @@ void GenericLayout::refreshAll()
TopWindow
*
pWindow
=
getWindow
();
if
(
pWindow
)
{
pWindow
->
refresh
(
0
,
0
,
m_width
,
m_height
);
// Check boundaries
if
(
x
<
0
)
x
=
0
;
if
(
y
<
0
)
y
=
0
;
if
(
x
+
width
>
m_width
)
width
=
m_width
-
x
;
if
(
y
+
height
>
m_height
)
height
=
m_height
-
y
;
pWindow
->
refresh
(
x
,
y
,
width
,
height
);
}
}
...
...
modules/gui/skins2/src/generic_layout.hpp
View file @
6314367b
...
...
@@ -105,7 +105,8 @@ class GenericLayout: public SkinObject, public Box
virtual
const
list
<
LayeredControl
>
&
getControlList
()
const
;
/// Called by a control when its image has changed
virtual
void
onControlUpdate
(
const
CtrlGeneric
&
rCtrl
);
virtual
void
onControlUpdate
(
const
CtrlGeneric
&
rCtrl
,
int
width
,
int
height
);
/// Get the list of the anchors of this layout
virtual
const
list
<
Anchor
*>&
getAnchorList
()
const
;
...
...
@@ -114,6 +115,9 @@ class GenericLayout: public SkinObject, public Box
virtual
void
addAnchor
(
Anchor
*
pAnchor
);
private:
/// Refresh a rectangular portion of the window
void
GenericLayout
::
refreshRect
(
int
x
,
int
y
,
int
width
,
int
height
);
/// Parent window of the layout
TopWindow
*
m_pWindow
;
/// Layout size
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment