Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
eb176036
Commit
eb176036
authored
Aug 15, 2005
by
Cyril Deguet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* all: replaced remaining C callbacks by commands
parent
a3eb8858
Changes
26
Hide whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
284 additions
and
305 deletions
+284
-305
modules/gui/skins2/commands/async_queue.cpp
modules/gui/skins2/commands/async_queue.cpp
+5
-5
modules/gui/skins2/commands/async_queue.hpp
modules/gui/skins2/commands/async_queue.hpp
+2
-2
modules/gui/skins2/commands/cmd_generic.hpp
modules/gui/skins2/commands/cmd_generic.hpp
+17
-0
modules/gui/skins2/controls/ctrl_button.cpp
modules/gui/skins2/controls/ctrl_button.cpp
+33
-33
modules/gui/skins2/controls/ctrl_checkbox.cpp
modules/gui/skins2/controls/ctrl_checkbox.cpp
+33
-33
modules/gui/skins2/controls/ctrl_generic.hpp
modules/gui/skins2/controls/ctrl_generic.hpp
+0
-17
modules/gui/skins2/controls/ctrl_move.cpp
modules/gui/skins2/controls/ctrl_move.cpp
+16
-16
modules/gui/skins2/controls/ctrl_radialslider.cpp
modules/gui/skins2/controls/ctrl_radialslider.cpp
+8
-8
modules/gui/skins2/controls/ctrl_resize.cpp
modules/gui/skins2/controls/ctrl_resize.cpp
+32
-32
modules/gui/skins2/controls/ctrl_slider.cpp
modules/gui/skins2/controls/ctrl_slider.cpp
+56
-56
modules/gui/skins2/controls/ctrl_text.cpp
modules/gui/skins2/controls/ctrl_text.cpp
+29
-31
modules/gui/skins2/controls/ctrl_text.hpp
modules/gui/skins2/controls/ctrl_text.hpp
+1
-1
modules/gui/skins2/src/os_factory.hpp
modules/gui/skins2/src/os_factory.hpp
+3
-2
modules/gui/skins2/src/skin_common.hpp
modules/gui/skins2/src/skin_common.hpp
+0
-22
modules/gui/skins2/src/tooltip.cpp
modules/gui/skins2/src/tooltip.cpp
+12
-14
modules/gui/skins2/src/tooltip.hpp
modules/gui/skins2/src/tooltip.hpp
+3
-2
modules/gui/skins2/src/vlcproc.cpp
modules/gui/skins2/src/vlcproc.cpp
+6
-5
modules/gui/skins2/src/vlcproc.hpp
modules/gui/skins2/src/vlcproc.hpp
+4
-4
modules/gui/skins2/win32/win32_factory.cpp
modules/gui/skins2/win32/win32_factory.cpp
+2
-2
modules/gui/skins2/win32/win32_factory.hpp
modules/gui/skins2/win32/win32_factory.hpp
+2
-2
modules/gui/skins2/win32/win32_timer.cpp
modules/gui/skins2/win32/win32_timer.cpp
+4
-4
modules/gui/skins2/win32/win32_timer.hpp
modules/gui/skins2/win32/win32_timer.hpp
+4
-4
modules/gui/skins2/x11/x11_factory.cpp
modules/gui/skins2/x11/x11_factory.cpp
+2
-2
modules/gui/skins2/x11/x11_factory.hpp
modules/gui/skins2/x11/x11_factory.hpp
+2
-2
modules/gui/skins2/x11/x11_timer.cpp
modules/gui/skins2/x11/x11_timer.cpp
+4
-3
modules/gui/skins2/x11/x11_timer.hpp
modules/gui/skins2/x11/x11_timer.hpp
+4
-3
No files found.
modules/gui/skins2/commands/async_queue.cpp
View file @
eb176036
...
...
@@ -27,14 +27,15 @@
#include "../src/os_timer.hpp"
AsyncQueue
::
AsyncQueue
(
intf_thread_t
*
pIntf
)
:
SkinObject
(
pIntf
)
AsyncQueue
::
AsyncQueue
(
intf_thread_t
*
pIntf
)
:
SkinObject
(
pIntf
),
m_cmdFlush
(
this
)
{
// Initialize the mutex
vlc_mutex_init
(
pIntf
,
&
m_lock
);
// Create a timer
OSFactory
*
pOsFactory
=
OSFactory
::
instance
(
pIntf
);
m_pTimer
=
pOsFactory
->
createOSTimer
(
Callback
(
this
,
&
doFlush
)
);
m_pTimer
=
pOsFactory
->
createOSTimer
(
m_cmdFlush
);
// Flush the queue every 10 ms
m_pTimer
->
start
(
10
,
false
);
...
...
@@ -129,9 +130,8 @@ void AsyncQueue::flush()
}
void
AsyncQueue
::
doFlush
(
SkinObject
*
pObj
)
void
AsyncQueue
::
CmdFlush
::
execute
(
)
{
AsyncQueue
*
pThis
=
(
AsyncQueue
*
)
pObj
;
// Flush the queue
pThis
->
flush
();
m_pParent
->
flush
();
}
modules/gui/skins2/commands/async_queue.hpp
View file @
eb176036
...
...
@@ -65,8 +65,8 @@ class AsyncQueue: public SkinObject
AsyncQueue
(
intf_thread_t
*
pIntf
);
virtual
~
AsyncQueue
();
//
/ Callback for the timer
static
void
doFlush
(
SkinObject
*
pObj
);
//
Callback to flush the queue
DEFINE_CALLBACK
(
AsyncQueue
,
Flush
);
};
...
...
modules/gui/skins2/commands/cmd_generic.hpp
View file @
eb176036
...
...
@@ -44,6 +44,23 @@ class Cmd##name: public CmdGeneric \
};
/// Macro to define a "callback" command inside a class
#define DEFINE_CALLBACK( parent, action ) \
class Cmd##action: public CmdGeneric \
{ \
public: \
Cmd##action( parent *pParent ): \
CmdGeneric( pParent->getIntf() ), m_pParent( pParent ) {} \
virtual ~Cmd##action() {} \
virtual void execute(); \
virtual string getType() const { return "Cmd" #parent #action; } \
private: \
parent *m_pParent; \
\
} m_cmd##action; \
friend class Cmd##action;
/// Base class for skins commands
class
CmdGeneric
:
public
SkinObject
{
...
...
modules/gui/skins2/controls/ctrl_button.cpp
View file @
eb176036
...
...
@@ -37,11 +37,11 @@ CtrlButton::CtrlButton( intf_thread_t *pIntf, const GenericBitmap &rBmpUp,
VarBool
*
pVisible
)
:
CtrlGeneric
(
pIntf
,
rHelp
,
pVisible
),
m_fsm
(
pIntf
),
m_rCommand
(
rCommand
),
m_tooltip
(
rTooltip
),
m_cmdUpOverDownOver
(
pIntf
,
this
),
m_cmdDownOverUpOver
(
pIntf
,
this
),
m_cmdDownOverDown
(
pIntf
,
this
),
m_cmdDownDownOver
(
pIntf
,
this
),
m_cmdUpOverUp
(
pIntf
,
this
),
m_cmdUpUpOver
(
pIntf
,
this
),
m_cmdDownUp
(
pIntf
,
this
),
m_cmdUpHidden
(
pIntf
,
this
),
m_cmdHiddenUp
(
pIntf
,
this
)
m_cmdUpOverDownOver
(
this
),
m_cmdDownOverUpOver
(
this
),
m_cmdDownOverDown
(
this
),
m_cmdDownDownOver
(
this
),
m_cmdUpOverUp
(
this
),
m_cmdUpUpOver
(
this
),
m_cmdDownUp
(
this
),
m_cmdUpHidden
(
this
),
m_cmdHiddenUp
(
this
)
{
// Build the images of the button
OSFactory
*
pOsFactory
=
OSFactory
::
instance
(
pIntf
);
...
...
@@ -127,74 +127,74 @@ void CtrlButton::draw( OSGraphics &rImage, int xDest, int yDest )
void
CtrlButton
::
CmdUpOverDownOver
::
execute
()
{
m_p
Control
->
captureMouse
();
const
OSGraphics
*
pOldImg
=
m_p
Control
->
m_pImg
;
m_p
Control
->
m_pImg
=
m_pControl
->
m_pImgDown
;
m_p
Control
->
notifyLayoutMaxSize
(
pOldImg
,
m_pControl
->
m_pImg
);
m_p
Parent
->
captureMouse
();
const
OSGraphics
*
pOldImg
=
m_p
Parent
->
m_pImg
;
m_p
Parent
->
m_pImg
=
m_pParent
->
m_pImgDown
;
m_p
Parent
->
notifyLayoutMaxSize
(
pOldImg
,
m_pParent
->
m_pImg
);
}
void
CtrlButton
::
CmdDownOverUpOver
::
execute
()
{
m_p
Control
->
releaseMouse
();
const
OSGraphics
*
pOldImg
=
m_p
Control
->
m_pImg
;
m_p
Control
->
m_pImg
=
m_pControl
->
m_pImgUp
;
m_p
Control
->
notifyLayoutMaxSize
(
pOldImg
,
m_pControl
->
m_pImg
);
m_p
Parent
->
releaseMouse
();
const
OSGraphics
*
pOldImg
=
m_p
Parent
->
m_pImg
;
m_p
Parent
->
m_pImg
=
m_pParent
->
m_pImgUp
;
m_p
Parent
->
notifyLayoutMaxSize
(
pOldImg
,
m_pParent
->
m_pImg
);
// Execute the command associated to this button
m_p
Control
->
m_rCommand
.
execute
();
m_p
Parent
->
m_rCommand
.
execute
();
}
void
CtrlButton
::
CmdDownOverDown
::
execute
()
{
const
OSGraphics
*
pOldImg
=
m_p
Control
->
m_pImg
;
m_p
Control
->
m_pImg
=
m_pControl
->
m_pImgUp
;
m_p
Control
->
notifyLayoutMaxSize
(
pOldImg
,
m_pControl
->
m_pImg
);
const
OSGraphics
*
pOldImg
=
m_p
Parent
->
m_pImg
;
m_p
Parent
->
m_pImg
=
m_pParent
->
m_pImgUp
;
m_p
Parent
->
notifyLayoutMaxSize
(
pOldImg
,
m_pParent
->
m_pImg
);
}
void
CtrlButton
::
CmdDownDownOver
::
execute
()
{
const
OSGraphics
*
pOldImg
=
m_p
Control
->
m_pImg
;
m_p
Control
->
m_pImg
=
m_pControl
->
m_pImgDown
;
m_p
Control
->
notifyLayoutMaxSize
(
pOldImg
,
m_pControl
->
m_pImg
);
const
OSGraphics
*
pOldImg
=
m_p
Parent
->
m_pImg
;
m_p
Parent
->
m_pImg
=
m_pParent
->
m_pImgDown
;
m_p
Parent
->
notifyLayoutMaxSize
(
pOldImg
,
m_pParent
->
m_pImg
);
}
void
CtrlButton
::
CmdUpUpOver
::
execute
()
{
const
OSGraphics
*
pOldImg
=
m_p
Control
->
m_pImg
;
m_p
Control
->
m_pImg
=
m_pControl
->
m_pImgOver
;
m_p
Control
->
notifyLayoutMaxSize
(
pOldImg
,
m_pControl
->
m_pImg
);
const
OSGraphics
*
pOldImg
=
m_p
Parent
->
m_pImg
;
m_p
Parent
->
m_pImg
=
m_pParent
->
m_pImgOver
;
m_p
Parent
->
notifyLayoutMaxSize
(
pOldImg
,
m_pParent
->
m_pImg
);
}
void
CtrlButton
::
CmdUpOverUp
::
execute
()
{
const
OSGraphics
*
pOldImg
=
m_p
Control
->
m_pImg
;
m_p
Control
->
m_pImg
=
m_pControl
->
m_pImgUp
;
m_p
Control
->
notifyLayoutMaxSize
(
pOldImg
,
m_pControl
->
m_pImg
);
const
OSGraphics
*
pOldImg
=
m_p
Parent
->
m_pImg
;
m_p
Parent
->
m_pImg
=
m_pParent
->
m_pImgUp
;
m_p
Parent
->
notifyLayoutMaxSize
(
pOldImg
,
m_pParent
->
m_pImg
);
}
void
CtrlButton
::
CmdDownUp
::
execute
()
{
m_p
Control
->
releaseMouse
();
m_p
Parent
->
releaseMouse
();
}
void
CtrlButton
::
CmdUpHidden
::
execute
()
{
const
OSGraphics
*
pOldImg
=
m_p
Control
->
m_pImg
;
m_p
Control
->
m_pImg
=
NULL
;
m_p
Control
->
notifyLayoutMaxSize
(
pOldImg
,
m_pControl
->
m_pImg
);
const
OSGraphics
*
pOldImg
=
m_p
Parent
->
m_pImg
;
m_p
Parent
->
m_pImg
=
NULL
;
m_p
Parent
->
notifyLayoutMaxSize
(
pOldImg
,
m_pParent
->
m_pImg
);
}
void
CtrlButton
::
CmdHiddenUp
::
execute
()
{
const
OSGraphics
*
pOldImg
=
m_p
Control
->
m_pImg
;
m_p
Control
->
m_pImg
=
m_pControl
->
m_pImgUp
;
m_p
Control
->
notifyLayoutMaxSize
(
pOldImg
,
m_pControl
->
m_pImg
);
const
OSGraphics
*
pOldImg
=
m_p
Parent
->
m_pImg
;
m_p
Parent
->
m_pImg
=
m_pParent
->
m_pImgUp
;
m_p
Parent
->
notifyLayoutMaxSize
(
pOldImg
,
m_pParent
->
m_pImg
);
}
modules/gui/skins2/controls/ctrl_checkbox.cpp
View file @
eb176036
...
...
@@ -47,11 +47,11 @@ CtrlCheckbox::CtrlCheckbox( intf_thread_t *pIntf,
m_rVariable
(
rVariable
),
m_rCommand1
(
rCommand1
),
m_rCommand2
(
rCommand2
),
m_tooltip1
(
rTooltip1
),
m_tooltip2
(
rTooltip2
),
m_cmdUpOverDownOver
(
pIntf
,
this
),
m_cmdDownOverUpOver
(
pIntf
,
this
),
m_cmdDownOverDown
(
pIntf
,
this
),
m_cmdDownDownOver
(
pIntf
,
this
),
m_cmdUpOverUp
(
pIntf
,
this
),
m_cmdUpUpOver
(
pIntf
,
this
),
m_cmdDownUp
(
pIntf
,
this
),
m_cmdUpHidden
(
pIntf
,
this
),
m_cmdHiddenUp
(
pIntf
,
this
)
m_cmdUpOverDownOver
(
this
),
m_cmdDownOverUpOver
(
this
),
m_cmdDownOverDown
(
this
),
m_cmdDownDownOver
(
this
),
m_cmdUpOverUp
(
this
),
m_cmdUpUpOver
(
this
),
m_cmdDownUp
(
this
),
m_cmdUpHidden
(
this
),
m_cmdHiddenUp
(
this
)
{
// Build the images of the checkbox
OSFactory
*
pOsFactory
=
OSFactory
::
instance
(
pIntf
);
...
...
@@ -171,78 +171,78 @@ void CtrlCheckbox::draw( OSGraphics &rImage, int xDest, int yDest )
void
CtrlCheckbox
::
CmdUpOverDownOver
::
execute
()
{
m_p
Control
->
captureMouse
();
const
OSGraphics
*
pOldImg
=
m_p
Control
->
m_pImgCurrent
;
m_p
Control
->
m_pImgCurrent
=
m_pControl
->
m_pImgDown
;
m_p
Control
->
notifyLayoutMaxSize
(
pOldImg
,
m_pControl
->
m_pImgCurrent
);
m_p
Parent
->
captureMouse
();
const
OSGraphics
*
pOldImg
=
m_p
Parent
->
m_pImgCurrent
;
m_p
Parent
->
m_pImgCurrent
=
m_pParent
->
m_pImgDown
;
m_p
Parent
->
notifyLayoutMaxSize
(
pOldImg
,
m_pParent
->
m_pImgCurrent
);
}
void
CtrlCheckbox
::
CmdDownOverUpOver
::
execute
()
{
m_p
Control
->
releaseMouse
();
m_p
Parent
->
releaseMouse
();
// Invert the state variable
const
OSGraphics
*
pOldImg
=
m_p
Control
->
m_pImgCurrent
;
m_p
Control
->
m_pImgCurrent
=
m_pControl
->
m_pImgUp
;
m_p
Control
->
notifyLayoutMaxSize
(
pOldImg
,
m_pControl
->
m_pImgCurrent
);
const
OSGraphics
*
pOldImg
=
m_p
Parent
->
m_pImgCurrent
;
m_p
Parent
->
m_pImgCurrent
=
m_pParent
->
m_pImgUp
;
m_p
Parent
->
notifyLayoutMaxSize
(
pOldImg
,
m_pParent
->
m_pImgCurrent
);
// Execute the command
m_p
Control
->
m_pCommand
->
execute
();
m_p
Parent
->
m_pCommand
->
execute
();
}
void
CtrlCheckbox
::
CmdDownOverDown
::
execute
()
{
const
OSGraphics
*
pOldImg
=
m_p
Control
->
m_pImgCurrent
;
m_p
Control
->
m_pImgCurrent
=
m_pControl
->
m_pImgUp
;
m_p
Control
->
notifyLayoutMaxSize
(
pOldImg
,
m_pControl
->
m_pImgCurrent
);
const
OSGraphics
*
pOldImg
=
m_p
Parent
->
m_pImgCurrent
;
m_p
Parent
->
m_pImgCurrent
=
m_pParent
->
m_pImgUp
;
m_p
Parent
->
notifyLayoutMaxSize
(
pOldImg
,
m_pParent
->
m_pImgCurrent
);
}
void
CtrlCheckbox
::
CmdDownDownOver
::
execute
()
{
const
OSGraphics
*
pOldImg
=
m_p
Control
->
m_pImgCurrent
;
m_p
Control
->
m_pImgCurrent
=
m_pControl
->
m_pImgDown
;
m_p
Control
->
notifyLayoutMaxSize
(
pOldImg
,
m_pControl
->
m_pImgCurrent
);
const
OSGraphics
*
pOldImg
=
m_p
Parent
->
m_pImgCurrent
;
m_p
Parent
->
m_pImgCurrent
=
m_pParent
->
m_pImgDown
;
m_p
Parent
->
notifyLayoutMaxSize
(
pOldImg
,
m_pParent
->
m_pImgCurrent
);
}
void
CtrlCheckbox
::
CmdUpUpOver
::
execute
()
{
const
OSGraphics
*
pOldImg
=
m_p
Control
->
m_pImgCurrent
;
m_p
Control
->
m_pImgCurrent
=
m_pControl
->
m_pImgOver
;
m_p
Control
->
notifyLayoutMaxSize
(
pOldImg
,
m_pControl
->
m_pImgCurrent
);
const
OSGraphics
*
pOldImg
=
m_p
Parent
->
m_pImgCurrent
;
m_p
Parent
->
m_pImgCurrent
=
m_pParent
->
m_pImgOver
;
m_p
Parent
->
notifyLayoutMaxSize
(
pOldImg
,
m_pParent
->
m_pImgCurrent
);
}
void
CtrlCheckbox
::
CmdUpOverUp
::
execute
()
{
const
OSGraphics
*
pOldImg
=
m_p
Control
->
m_pImgCurrent
;
m_p
Control
->
m_pImgCurrent
=
m_pControl
->
m_pImgUp
;
m_p
Control
->
notifyLayoutMaxSize
(
pOldImg
,
m_pControl
->
m_pImgCurrent
);
const
OSGraphics
*
pOldImg
=
m_p
Parent
->
m_pImgCurrent
;
m_p
Parent
->
m_pImgCurrent
=
m_pParent
->
m_pImgUp
;
m_p
Parent
->
notifyLayoutMaxSize
(
pOldImg
,
m_pParent
->
m_pImgCurrent
);
}
void
CtrlCheckbox
::
CmdDownUp
::
execute
()
{
m_p
Control
->
releaseMouse
();
m_p
Parent
->
releaseMouse
();
}
void
CtrlCheckbox
::
CmdUpHidden
::
execute
()
{
const
OSGraphics
*
pOldImg
=
m_p
Control
->
m_pImgCurrent
;
m_p
Control
->
m_pImgCurrent
=
NULL
;
m_p
Control
->
notifyLayoutMaxSize
(
pOldImg
,
m_pControl
->
m_pImgCurrent
);
const
OSGraphics
*
pOldImg
=
m_p
Parent
->
m_pImgCurrent
;
m_p
Parent
->
m_pImgCurrent
=
NULL
;
m_p
Parent
->
notifyLayoutMaxSize
(
pOldImg
,
m_pParent
->
m_pImgCurrent
);
}
void
CtrlCheckbox
::
CmdHiddenUp
::
execute
()
{
const
OSGraphics
*
pOldImg
=
m_p
Control
->
m_pImgCurrent
;
m_p
Control
->
m_pImgCurrent
=
m_pControl
->
m_pImgUp
;
m_p
Control
->
notifyLayoutMaxSize
(
pOldImg
,
m_pControl
->
m_pImgCurrent
);
const
OSGraphics
*
pOldImg
=
m_p
Parent
->
m_pImgCurrent
;
m_p
Parent
->
m_pImgCurrent
=
m_pParent
->
m_pImgUp
;
m_p
Parent
->
notifyLayoutMaxSize
(
pOldImg
,
m_pParent
->
m_pImgCurrent
);
}
...
...
modules/gui/skins2/controls/ctrl_generic.hpp
View file @
eb176036
...
...
@@ -134,21 +134,4 @@ class CtrlGeneric: public SkinObject, public Observer<VarBool>
typedef
CountedPtr
<
CtrlGeneric
>
CtrlGenericPtr
;
// Macro to define a control action command
#define DEFINE_CALLBACK( control, action ) \
class Cmd##action: public CmdGeneric \
{ \
public: \
Cmd##action( intf_thread_t *pIntf, control *pControl ): \
CmdGeneric( pIntf ), m_pControl( pControl) {} \
virtual ~Cmd##action() {} \
virtual void execute(); \
virtual string getType() const { return "Cmd" #control #action; } \
private: \
control *m_pControl; \
\
} m_cmd##action; \
friend class Cmd##action;
#endif
modules/gui/skins2/controls/ctrl_move.cpp
View file @
eb176036
...
...
@@ -37,9 +37,9 @@ CtrlMove::CtrlMove( intf_thread_t *pIntf, WindowManager &rWindowManager,
CtrlFlat
(
pIntf
,
rHelp
,
pVisible
),
m_fsm
(
pIntf
),
m_rWindowManager
(
rWindowManager
),
m_rCtrl
(
rCtrl
),
m_rWindow
(
rWindow
),
m_cmdMovingMoving
(
pIntf
,
this
),
m_cmdStillMoving
(
pIntf
,
this
),
m_cmdMovingStill
(
pIntf
,
this
)
m_cmdMovingMoving
(
this
),
m_cmdStillMoving
(
this
),
m_cmdMovingStill
(
this
)
{
m_pEvt
=
NULL
;
m_xPos
=
0
;
...
...
@@ -98,33 +98,33 @@ void CtrlMove::handleEvent( EvtGeneric &rEvent )
void
CtrlMove
::
CmdStillMoving
::
execute
()
{
EvtMouse
*
pEvtMouse
=
(
EvtMouse
*
)
m_p
Control
->
m_pEvt
;
EvtMouse
*
pEvtMouse
=
(
EvtMouse
*
)
m_p
Parent
->
m_pEvt
;
m_p
Control
->
m_xPos
=
pEvtMouse
->
getXPos
();
m_p
Control
->
m_yPos
=
pEvtMouse
->
getYPos
();
m_p
Parent
->
m_xPos
=
pEvtMouse
->
getXPos
();
m_p
Parent
->
m_yPos
=
pEvtMouse
->
getYPos
();
m_p
Control
->
captureMouse
();
m_p
Parent
->
captureMouse
();
m_p
Control
->
m_rWindowManager
.
startMove
(
m_pControl
->
m_rWindow
);
m_p
Parent
->
m_rWindowManager
.
startMove
(
m_pParent
->
m_rWindow
);
}
void
CtrlMove
::
CmdMovingMoving
::
execute
()
{
EvtMotion
*
pEvtMotion
=
(
EvtMotion
*
)
m_p
Control
->
m_pEvt
;
EvtMotion
*
pEvtMotion
=
(
EvtMotion
*
)
m_p
Parent
->
m_pEvt
;
int
xNewLeft
=
pEvtMotion
->
getXPos
()
-
m_p
Control
->
m_xPos
+
m_p
Control
->
m_rWindow
.
getLeft
();
int
yNewTop
=
pEvtMotion
->
getYPos
()
-
m_p
Control
->
m_yPos
+
m_p
Control
->
m_rWindow
.
getTop
();
int
xNewLeft
=
pEvtMotion
->
getXPos
()
-
m_p
Parent
->
m_xPos
+
m_p
Parent
->
m_rWindow
.
getLeft
();
int
yNewTop
=
pEvtMotion
->
getYPos
()
-
m_p
Parent
->
m_yPos
+
m_p
Parent
->
m_rWindow
.
getTop
();
m_p
Control
->
m_rWindowManager
.
move
(
m_pControl
->
m_rWindow
,
xNewLeft
,
yNewTop
);
m_p
Parent
->
m_rWindowManager
.
move
(
m_pParent
->
m_rWindow
,
xNewLeft
,
yNewTop
);
}
void
CtrlMove
::
CmdMovingStill
::
execute
()
{
m_p
Control
->
releaseMouse
();
m_p
Parent
->
releaseMouse
();
m_p
Control
->
m_rWindowManager
.
stopMove
();
m_p
Parent
->
m_rWindowManager
.
stopMove
();
}
modules/gui/skins2/controls/ctrl_radialslider.cpp
View file @
eb176036
...
...
@@ -40,8 +40,8 @@ CtrlRadialSlider::CtrlRadialSlider( intf_thread_t *pIntf,
VarBool
*
pVisible
)
:
CtrlGeneric
(
pIntf
,
rHelp
,
pVisible
),
m_fsm
(
pIntf
),
m_numImg
(
numImg
),
m_rVariable
(
rVariable
),
m_minAngle
(
minAngle
),
m_maxAngle
(
maxAngle
),
m_cmdUpDown
(
pIntf
,
this
),
m_cmdDownUp
(
pIntf
,
this
),
m_cmdMove
(
pIntf
,
this
)
m_cmdUpDown
(
this
),
m_cmdDownUp
(
this
),
m_cmdMove
(
this
)
{
// Build the images of the sequence
OSFactory
*
pOsFactory
=
OSFactory
::
instance
(
getIntf
()
);
...
...
@@ -107,27 +107,27 @@ void CtrlRadialSlider::onUpdate( Subject<VarPercent> &rVariable )
void
CtrlRadialSlider
::
CmdUpDown
::
execute
()
{
EvtMouse
*
pEvtMouse
=
(
EvtMouse
*
)
m_p
Control
->
m_pEvt
;
EvtMouse
*
pEvtMouse
=
(
EvtMouse
*
)
m_p
Parent
->
m_pEvt
;
// Change the position of the cursor, in non-blocking mode
m_p
Control
->
setCursor
(
pEvtMouse
->
getXPos
(),
pEvtMouse
->
getYPos
(),
false
);
m_p
Parent
->
setCursor
(
pEvtMouse
->
getXPos
(),
pEvtMouse
->
getYPos
(),
false
);
m_p
Control
->
captureMouse
();
m_p
Parent
->
captureMouse
();
}
void
CtrlRadialSlider
::
CmdDownUp
::
execute
()
{
m_p
Control
->
releaseMouse
();
m_p
Parent
->
releaseMouse
();
}
void
CtrlRadialSlider
::
CmdMove
::
execute
()
{
EvtMouse
*
pEvtMouse
=
(
EvtMouse
*
)
m_p
Control
->
m_pEvt
;
EvtMouse
*
pEvtMouse
=
(
EvtMouse
*
)
m_p
Parent
->
m_pEvt
;
// Change the position of the cursor, in blocking mode
m_p
Control
->
setCursor
(
pEvtMouse
->
getXPos
(),
pEvtMouse
->
getYPos
(),
true
);
m_p
Parent
->
setCursor
(
pEvtMouse
->
getXPos
(),
pEvtMouse
->
getYPos
(),
true
);
}
...
...
modules/gui/skins2/controls/ctrl_resize.cpp
View file @
eb176036
...
...
@@ -37,12 +37,12 @@ CtrlResize::CtrlResize( intf_thread_t *pIntf, CtrlFlat &rCtrl,
GenericLayout
&
rLayout
,
const
UString
&
rHelp
,
VarBool
*
pVisible
)
:
CtrlFlat
(
pIntf
,
rHelp
,
pVisible
),
m_fsm
(
pIntf
),
m_rCtrl
(
rCtrl
),
m_rLayout
(
rLayout
),
m_cmdOutStill
(
pIntf
,
this
),
m_cmdStillOut
(
pIntf
,
this
),
m_cmdStillStill
(
pIntf
,
this
),
m_cmdStillResize
(
pIntf
,
this
),
m_cmdResizeStill
(
pIntf
,
this
),
m_cmdResizeResize
(
pIntf
,
this
)
m_rLayout
(
rLayout
),
m_cmdOutStill
(
this
),
m_cmdStillOut
(
this
),
m_cmdStillStill
(
this
),
m_cmdStillResize
(
this
),
m_cmdResizeStill
(
this
),
m_cmdResizeResize
(
this
)
{
m_pEvt
=
NULL
;
m_xPos
=
0
;
...
...
@@ -105,87 +105,87 @@ void CtrlResize::handleEvent( EvtGeneric &rEvent )
void
CtrlResize
::
CmdOutStill
::
execute
()
{
OSFactory
*
pOsFactory
=
OSFactory
::
instance
(
m_p
Control
->
getIntf
()
);
OSFactory
*
pOsFactory
=
OSFactory
::
instance
(
m_p
Parent
->
getIntf
()
);
pOsFactory
->
changeCursor
(
OSFactory
::
kResizeNWSE
);
}
void
CtrlResize
::
CmdStillOut
::
execute
()
{
OSFactory
*
pOsFactory
=
OSFactory
::
instance
(
m_p
Control
->
getIntf
()
);
OSFactory
*
pOsFactory
=
OSFactory
::
instance
(
m_p
Parent
->
getIntf
()
);
pOsFactory
->
changeCursor
(
OSFactory
::
kDefaultArrow
);
}
void
CtrlResize
::
CmdStillStill
::
execute
()
{
OSFactory
*
pOsFactory
=
OSFactory
::
instance
(
m_p
Control
->
getIntf
()
);
OSFactory
*
pOsFactory
=
OSFactory
::
instance
(
m_p
Parent
->
getIntf
()
);
pOsFactory
->
changeCursor
(
OSFactory
::
kResizeNWSE
);
}
void
CtrlResize
::
CmdStillResize
::
execute
()
{
EvtMouse
*
pEvtMouse
=
(
EvtMouse
*
)
m_p
Control
->
m_pEvt
;
EvtMouse
*
pEvtMouse
=
(
EvtMouse
*
)
m_p
Parent
->
m_pEvt
;
// Set the cursor
OSFactory
*
pOsFactory
=
OSFactory
::
instance
(
m_p
Control
->
getIntf
()
);
OSFactory
*
pOsFactory
=
OSFactory
::
instance
(
m_p
Parent
->
getIntf
()
);
pOsFactory
->
changeCursor
(
OSFactory
::
kResizeNWSE
);
m_p
Control
->
m_xPos
=
pEvtMouse
->
getXPos
();
m_p
Control
->
m_yPos
=
pEvtMouse
->
getYPos
();
m_p
Parent
->
m_xPos
=
pEvtMouse
->
getXPos
();
m_p
Parent
->
m_yPos
=
pEvtMouse
->
getYPos
();
m_p
Control
->
captureMouse
();
m_p
Parent
->
captureMouse
();
m_p
Control
->
m_width
=
m_pControl
->
m_rLayout
.
getWidth
();
m_p
Control
->
m_height
=
m_pControl
->
m_rLayout
.
getHeight
();
m_p
Parent
->
m_width
=
m_pParent
->
m_rLayout
.
getWidth
();
m_p
Parent
->
m_height
=
m_pParent
->
m_rLayout
.
getHeight
();
}
void
CtrlResize
::
CmdResizeStill
::
execute
()
{
// Set the cursor
OSFactory
*
pOsFactory
=
OSFactory
::
instance
(
m_p
Control
->
getIntf
()
);
OSFactory
*
pOsFactory
=
OSFactory
::
instance
(
m_p
Parent
->
getIntf
()
);
pOsFactory
->
changeCursor
(
OSFactory
::
kResizeNWSE
);
m_p
Control
->
releaseMouse
();
m_p
Parent
->
releaseMouse
();
}
void
CtrlResize
::
CmdResizeResize
::
execute
()
{
EvtMotion
*
pEvtMotion
=
(
EvtMotion
*
)
m_p
Control
->
m_pEvt
;
EvtMotion
*
pEvtMotion
=
(
EvtMotion
*
)
m_p
Parent
->
m_pEvt
;
// Set the cursor
OSFactory
*
pOsFactory
=
OSFactory
::
instance
(
m_p
Control
->
getIntf
()
);
OSFactory
*
pOsFactory
=
OSFactory
::
instance
(
m_p
Parent
->
getIntf
()
);
pOsFactory
->
changeCursor
(
OSFactory
::
kResizeNWSE
);
int
newWidth
=
pEvtMotion
->
getXPos
()
-
m_p
Control
->
m_xPos
+
m_pControl
->
m_width
;
int
newHeight
=
pEvtMotion
->
getYPos
()
-
m_p
Control
->
m_yPos
+
m_pControl
->
m_height
;
int
newWidth
=
pEvtMotion
->
getXPos
()
-
m_p
Parent
->
m_xPos
+
m_pParent
->
m_width
;
int
newHeight
=
pEvtMotion
->
getYPos
()
-
m_p
Parent
->
m_yPos
+
m_pParent
->
m_height
;
// Check boundaries
if
(
newWidth
<
m_p
Control
->
m_rLayout
.
getMinWidth
()
)
if
(
newWidth
<
m_p
Parent
->
m_rLayout
.
getMinWidth
()
)
{
newWidth
=
m_p
Control
->
m_rLayout
.
getMinWidth
();
newWidth
=
m_p
Parent
->
m_rLayout
.
getMinWidth
();
}
if
(
newWidth
>
m_p
Control
->
m_rLayout
.
getMaxWidth
()
)
if
(
newWidth
>
m_p
Parent
->
m_rLayout
.
getMaxWidth
()
)
{
newWidth
=
m_p
Control
->
m_rLayout
.
getMaxWidth
();
newWidth
=
m_p
Parent
->
m_rLayout
.
getMaxWidth
();
}
if
(
newHeight
<
m_p
Control
->
m_rLayout
.
getMinHeight
()
)
if
(
newHeight
<
m_p
Parent
->
m_rLayout
.
getMinHeight
()
)
{
newHeight
=
m_p
Control
->
m_rLayout
.
getMinHeight
();
newHeight
=
m_p
Parent
->
m_rLayout
.
getMinHeight
();
}
if
(
newHeight
>
m_p
Control
->
m_rLayout
.
getMaxHeight
()
)
if
(
newHeight
>
m_p
Parent
->
m_rLayout
.
getMaxHeight
()
)
{
newHeight
=
m_p
Control
->
m_rLayout
.
getMaxHeight
();
newHeight
=
m_p
Parent
->
m_rLayout
.
getMaxHeight
();
}
// Create a resize command
CmdGeneric
*
pCmd
=
new
CmdResize
(
m_p
Control
->
getIntf
(),
m_pControl
->
m_rLayout
,
CmdGeneric
*
pCmd
=
new
CmdResize
(
m_p
Parent
->
getIntf
(),
m_pParent
->
m_rLayout
,
newWidth
,
newHeight
);
// Push the command in the asynchronous command queue
AsyncQueue
*
pQueue
=
AsyncQueue
::
instance
(
m_p
Control
->
getIntf
()
);
AsyncQueue
*
pQueue
=
AsyncQueue
::
instance
(
m_p
Parent
->
getIntf
()
);
pQueue
->
remove
(
"resize"
);
pQueue
->
push
(
CmdGenericPtr
(
pCmd
)
);
}
modules/gui/skins2/controls/ctrl_slider.cpp
View file @
eb176036
...
...
@@ -50,9 +50,9 @@ CtrlSliderCursor::CtrlSliderCursor( intf_thread_t *pIntf,
CtrlGeneric
(
pIntf
,
rHelp
,
pVisible
),
m_fsm
(
pIntf
),
m_rVariable
(
rVariable
),
m_tooltip
(
rTooltip
),
m_width
(
rCurve
.
getWidth
()
),
m_height
(
rCurve
.
getHeight
()
),
m_cmdOverDown
(
pIntf
,
this
),
m_cmdDownOver
(
pIntf
,
this
),
m_cmdOverUp
(
pIntf
,
this
),
m_cmdUpOver
(
pIntf
,
this
),
m_cmdMove
(
pIntf
,
this
),
m_cmdScroll
(
pIntf
,
this
),
m_cmdOverDown
(
this
),
m_cmdDownOver
(
this
),
m_cmdOverUp
(
this
),
m_cmdUpOver
(
this
),
m_cmdMove
(
this
),
m_cmdScroll
(
this
),
m_lastPercentage
(
0
),
m_xOffset
(
0
),
m_yOffset
(
0
),
m_pEvt
(
NULL
),
m_rCurve
(
rCurve
)
{
...
...
@@ -176,128 +176,128 @@ void CtrlSliderCursor::onUpdate( Subject<VarPercent> &rVariable )
void
CtrlSliderCursor
::
CmdOverDown
::
execute
()
{
EvtMouse
*
pEvtMouse
=
(
EvtMouse
*
)
m_p
Control
->
m_pEvt
;
EvtMouse
*
pEvtMouse
=
(
EvtMouse
*
)
m_p
Parent
->
m_pEvt
;
// Compute the resize factors
float
factorX
,
factorY
;
m_p
Control
->
getResizeFactors
(
factorX
,
factorY
);
m_p
Parent
->
getResizeFactors
(
factorX
,
factorY
);
// Get the position of the control
const
Position
*
pPos
=
m_p
Control
->
getPosition
();
const
Position
*
pPos
=
m_p
Parent
->
getPosition
();
// Compute the offset
int
tempX
,
tempY
;
m_p
Control
->
m_rCurve
.
getPoint
(
m_pControl
->
m_rVariable
.
get
(),
tempX
,
tempY
);
m_p
Control
->
m_xOffset
=
pEvtMouse
->
getXPos
()
-
pPos
->
getLeft
()
m_p
Parent
->
m_rCurve
.
getPoint
(
m_pParent
->
m_rVariable
.
get
(),
tempX
,
tempY
);
m_p
Parent
->
m_xOffset
=
pEvtMouse
->
getXPos
()
-
pPos
->
getLeft
()
-
(
int
)(
tempX
*
factorX
);
m_p
Control
->
m_yOffset
=
pEvtMouse
->
getYPos
()
-
pPos
->
getTop
()
m_p
Parent
->
m_yOffset
=
pEvtMouse
->
getYPos
()
-
pPos
->
getTop
()
-
(
int
)(
tempY
*
factorY
);
m_p
Control
->
captureMouse
();
m_p
Control
->
m_pImg
=
m_pControl
->
m_pImgDown
;
if
(
m_p
Control
->
m_pImg
)
m_p
Parent
->
captureMouse
();
m_p
Parent
->
m_pImg
=
m_pParent
->
m_pImgDown
;
if
(
m_p
Parent
->
m_pImg
)
{
m_p
Control
->
notifyLayout
(
m_p
Control
->
m_rCurve
.
getWidth
()
+
m_pControl
->
m_pImg
->
getWidth
(),
m_p
Control
->
m_rCurve
.
getHeight
()
+
m_pControl
->
m_pImg
->
getHeight
(),
-
m_p
Control
->
m_pImg
->
getWidth
()
/
2
,
-
m_p
Control
->
m_pImg
->
getHeight
()
/
2
);
m_p
Parent
->
notifyLayout
(
m_p
Parent
->
m_rCurve
.
getWidth
()
+
m_pParent
->
m_pImg
->
getWidth
(),
m_p
Parent
->
m_rCurve
.
getHeight
()
+
m_pParent
->
m_pImg
->
getHeight
(),
-
m_p
Parent
->
m_pImg
->
getWidth
()
/
2
,
-
m_p
Parent
->
m_pImg
->
getHeight
()
/
2
);
}
else
m_p
Control
->
notifyLayout
();
m_p
Parent
->
notifyLayout
();
}
void
CtrlSliderCursor
::
CmdDownOver
::
execute
()
{
// Save the position
m_p
Control
->
m_lastPercentage
=
m_pControl
->
m_rVariable
.
get
();
m_p
Parent
->
m_lastPercentage
=
m_pParent
->
m_rVariable
.
get
();
m_p
Control
->
releaseMouse
();
m_p
Control
->
m_pImg
=
m_pControl
->
m_pImgUp
;
if
(
m_p
Control
->
m_pImg
)
m_p
Parent
->
releaseMouse
();
m_p
Parent
->
m_pImg
=
m_pParent
->
m_pImgUp
;
if
(
m_p
Parent
->
m_pImg
)
{
m_p
Control
->
notifyLayout
(
m_p
Control
->
m_rCurve
.
getWidth
()
+
m_pControl
->
m_pImg
->
getWidth
(),
m_p
Control
->
m_rCurve
.
getHeight
()
+
m_pControl
->
m_pImg
->
getHeight
(),
-
m_p
Control
->
m_pImg
->
getWidth
()
/
2
,
-
m_p
Control
->
m_pImg
->
getHeight
()
/
2
);
m_p
Parent
->
notifyLayout
(
m_p
Parent
->
m_rCurve
.
getWidth
()
+
m_pParent
->
m_pImg
->
getWidth
(),
m_p
Parent
->
m_rCurve
.
getHeight
()
+
m_pParent
->
m_pImg
->
getHeight
(),
-
m_p
Parent
->
m_pImg
->
getWidth
()
/
2
,
-
m_p
Parent
->
m_pImg
->
getHeight
()
/
2
);
}
else
m_p
Control
->
notifyLayout
();
m_p
Parent
->
notifyLayout
();
}
void
CtrlSliderCursor
::
CmdUpOver
::
execute
()
{
m_p
Control
->
m_pImg
=
m_pControl
->
m_pImgOver
;
if
(
m_p
Control
->
m_pImg
)
m_p
Parent
->
m_pImg
=
m_pParent
->
m_pImgOver
;
if
(
m_p
Parent
->
m_pImg
)
{
m_p
Control
->
notifyLayout
(
m_p
Control
->
m_rCurve
.
getWidth
()
+
m_pControl
->
m_pImg
->
getWidth
(),
m_p
Control
->
m_rCurve
.
getHeight
()
+
m_pControl
->
m_pImg
->
getHeight
(),
-
m_p
Control
->
m_pImg
->
getWidth
()
/
2
,
-
m_p
Control
->
m_pImg
->
getHeight
()
/
2
);
m_p
Parent
->
notifyLayout
(
m_p
Parent
->
m_rCurve
.
getWidth
()
+
m_pParent
->
m_pImg
->
getWidth
(),
m_p
Parent
->
m_rCurve
.
getHeight
()
+
m_pParent
->
m_pImg
->
getHeight
(),
-
m_p
Parent
->
m_pImg
->
getWidth
()
/
2
,
-
m_p
Parent
->
m_pImg
->
getHeight
()
/
2
);
}
else
m_p
Control
->
notifyLayout
();
m_p
Parent
->
notifyLayout
();
}
void
CtrlSliderCursor
::
CmdOverUp
::
execute
()
{
m_p
Control
->
m_pImg
=
m_pControl
->
m_pImgUp
;
if
(
m_p
Control
->
m_pImg
)
m_p
Parent
->
m_pImg
=
m_pParent
->
m_pImgUp
;
if
(
m_p
Parent
->
m_pImg
)
{
m_p
Control
->
notifyLayout
(
m_p
Control
->
m_rCurve
.
getWidth
()
+
m_pControl
->
m_pImg
->
getWidth
(),
m_p
Control
->
m_rCurve
.
getHeight
()
+
m_pControl
->
m_pImg
->
getHeight
(),
-
m_p
Control
->
m_pImg
->
getWidth
()
/
2
,
-
m_p
Control
->
m_pImg
->
getHeight
()
/
2
);
m_p
Parent
->
notifyLayout
(
m_p
Parent
->
m_rCurve
.
getWidth
()
+
m_pParent
->
m_pImg
->
getWidth
(),
m_p
Parent
->
m_rCurve
.
getHeight
()
+
m_pParent
->
m_pImg
->
getHeight
(),
-
m_p
Parent
->
m_pImg
->
getWidth
()
/
2
,
-
m_p
Parent
->
m_pImg
->
getHeight
()
/
2
);
}
else
m_p
Control
->
notifyLayout
();
m_p
Parent
->
notifyLayout
();
}
void
CtrlSliderCursor
::
CmdMove
::
execute
()
{
EvtMouse
*
pEvtMouse
=
(
EvtMouse
*
)
m_p
Control
->
m_pEvt
;
EvtMouse
*
pEvtMouse
=
(
EvtMouse
*
)
m_p
Parent
->
m_pEvt
;
// Get the position of the control
const
Position
*
pPos
=
m_p
Control
->
getPosition
();
const
Position
*
pPos
=
m_p
Parent
->
getPosition
();
// Compute the resize factors
float
factorX
,
factorY
;
m_p
Control
->
getResizeFactors
(
factorX
,
factorY
);
m_p
Parent
->
getResizeFactors
(
factorX
,
factorY
);
// Compute the relative position of the centre of the cursor
float
relX
=
pEvtMouse
->
getXPos
()
-
pPos
->
getLeft
()
-
m_p
Control
->
m_xOffset
;
float
relY
=
pEvtMouse
->
getYPos
()
-
pPos
->
getTop
()
-
m_p
Control
->
m_yOffset
;
float
relX
=
pEvtMouse
->
getXPos
()
-
pPos
->
getLeft
()
-
m_p
Parent
->
m_xOffset
;
float
relY
=
pEvtMouse
->
getYPos
()
-
pPos
->
getTop
()
-
m_p
Parent
->
m_yOffset
;
// Ponderate with the resize factors
int
relXPond
=
(
int
)(
relX
/
factorX
);
int
relYPond
=
(
int
)(
relY
/
factorY
);
// Update the position
if
(
m_p
Control
->
m_rCurve
.
getMinDist
(
relXPond
,
relYPond
)
<
RANGE
)
if
(
m_p
Parent
->
m_rCurve
.
getMinDist
(
relXPond
,
relYPond
)
<
RANGE
)
{
float
percentage
=
m_p
Control
->
m_rCurve
.
getNearestPercent
(
relXPond
,
float
percentage
=
m_p
Parent
->
m_rCurve
.
getNearestPercent
(
relXPond
,
relYPond
);
m_p
Control
->
m_rVariable
.
set
(
percentage
);
m_p
Parent
->
m_rVariable
.
set
(
percentage
);
}
else
{
m_p
Control
->
m_rVariable
.
set
(
m_pControl
->
m_lastPercentage
);
m_p
Parent
->
m_rVariable
.
set
(
m_pParent
->
m_lastPercentage
);
}
}
void
CtrlSliderCursor
::
CmdScroll
::
execute
()
{
EvtScroll
*
pEvtScroll
=
(
EvtScroll
*
)
m_p
Control
->
m_pEvt
;
EvtScroll
*
pEvtScroll
=
(
EvtScroll
*
)
m_p
Parent
->
m_pEvt
;
int
direction
=
pEvtScroll
->
getDirection
();
float
percentage
=
m_p
Control
->
m_rVariable
.
get
();
float
percentage
=
m_p
Parent
->
m_rVariable
.
get
();
if
(
direction
==
EvtScroll
::
kUp
)
{
percentage
+=
SCROLL_STEP
;
...
...
@@ -307,7 +307,7 @@ void CtrlSliderCursor::CmdScroll::execute()
percentage
-=
SCROLL_STEP
;
}
m_p
Control
->
m_rVariable
.
set
(
percentage
);
m_p
Parent
->
m_rVariable
.
set
(
percentage
);
}
...
...
modules/gui/skins2/controls/ctrl_text.cpp
View file @
eb176036
...
...
@@ -44,14 +44,14 @@ CtrlText::CtrlText( intf_thread_t *pIntf, VarText &rVariable,
const
GenericFont
&
rFont
,
const
UString
&
rHelp
,
uint32_t
color
,
VarBool
*
pVisible
)
:
CtrlGeneric
(
pIntf
,
rHelp
,
pVisible
),
m_fsm
(
pIntf
),
m_rVariable
(
rVariable
),
m_cmdToManual
(
pIntf
,
this
),
m_cmdManualMoving
(
pIntf
,
this
),
m_cmdManualStill
(
pIntf
,
this
),
m_cmdMove
(
pIntf
,
this
),
m_pEvt
(
NULL
),
m_rFont
(
rFont
),
m_rVariable
(
rVariable
),
m_cmdToManual
(
this
),
m_cmdManualMoving
(
this
),
m_cmdManualStill
(
this
),
m_cmdMove
(
this
),
m_pEvt
(
NULL
),
m_rFont
(
rFont
),
m_color
(
color
),
m_pImg
(
NULL
),
m_pImgDouble
(
NULL
),
m_pCurrImg
(
NULL
),
m_xPos
(
0
),
m_xOffset
(
0
)
m_pCurrImg
(
NULL
),
m_xPos
(
0
),
m_xOffset
(
0
),
m_cmdUpdateText
(
this
)
{
m_pTimer
=
OSFactory
::
instance
(
getIntf
()
)
->
createOSTimer
(
Callback
(
this
,
&
updateText
)
);
m_pTimer
=
OSFactory
::
instance
(
pIntf
)
->
createOSTimer
(
m_cmdUpdateText
);
// States
m_fsm
.
addState
(
"still"
);
...
...
@@ -254,72 +254,70 @@ void CtrlText::onChangePosition()
void
CtrlText
::
CmdToManual
::
execute
()
{
EvtMouse
*
pEvtMouse
=
(
EvtMouse
*
)
m_p
Control
->
m_pEvt
;
EvtMouse
*
pEvtMouse
=
(
EvtMouse
*
)
m_p
Parent
->
m_pEvt
;
// Compute the offset
m_p
Control
->
m_xOffset
=
pEvtMouse
->
getXPos
()
-
m_pControl
->
m_xPos
;
m_p
Parent
->
m_xOffset
=
pEvtMouse
->
getXPos
()
-
m_pParent
->
m_xPos
;
m_p
Control
->
m_pTimer
->
stop
();
m_p
Control
->
captureMouse
();
m_p
Parent
->
m_pTimer
->
stop
();
m_p
Parent
->
captureMouse
();
}
void
CtrlText
::
CmdManualMoving
::
execute
()
{
m_p
Control
->
releaseMouse
();
m_p
Parent
->
releaseMouse
();
// Start the automatic movement, but only if the text is wider than the
// control
if
(
m_p
Control
->
m_pImg
&&
m_p
Control
->
m_pImg
->
getWidth
()
>=
m_pControl
->
getPosition
()
->
getWidth
()
)
if
(
m_p
Parent
->
m_pImg
&&
m_p
Parent
->
m_pImg
->
getWidth
()
>=
m_pParent
->
getPosition
()
->
getWidth
()
)
{
// The current image may have been set incorrectly in displayText(), so
// set the correct value
m_p
Control
->
m_pCurrImg
=
m_pControl
->
m_pImgDouble
;
m_p
Parent
->
m_pCurrImg
=
m_pParent
->
m_pImgDouble
;
m_p
Control
->
m_pTimer
->
start
(
MOVING_TEXT_DELAY
,
false
);
m_p
Parent
->
m_pTimer
->
start
(
MOVING_TEXT_DELAY
,
false
);
}
}
void
CtrlText
::
CmdManualStill
::
execute
()
{
m_p
Control
->
releaseMouse
();
m_p
Parent
->
releaseMouse
();
}
void
CtrlText
::
CmdMove
::
execute
()
{
EvtMouse
*
pEvtMouse
=
(
EvtMouse
*
)
m_p
Control
->
m_pEvt
;
EvtMouse
*
pEvtMouse
=
(
EvtMouse
*
)
m_p
Parent
->
m_pEvt
;
// Do nothing if the text fits in the control
if
(
m_p
Control
->
m_pImg
&&
m_p
Control
->
m_pImg
->
getWidth
()
>=
m_pControl
->
getPosition
()
->
getWidth
()
)
if
(
m_p
Parent
->
m_pImg
&&
m_p
Parent
->
m_pImg
->
getWidth
()
>=
m_pParent
->
getPosition
()
->
getWidth
()
)
{
// The current image may have been set incorrectly in displayText(), so
// we set the correct value
m_p
Control
->
m_pCurrImg
=
m_pControl
->
m_pImgDouble
;
m_p
Parent
->
m_pCurrImg
=
m_pParent
->
m_pImgDouble
;
// Compute the new position of the left side, and make sure it is
// in the correct range
m_p
Control
->
m_xPos
=
(
pEvtMouse
->
getXPos
()
-
m_pControl
->
m_xOffset
);
m_p
Control
->
adjust
(
m_pControl
->
m_xPos
);
m_p
Parent
->
m_xPos
=
(
pEvtMouse
->
getXPos
()
-
m_pParent
->
m_xOffset
);
m_p
Parent
->
adjust
(
m_pParent
->
m_xPos
);
m_p
Control
->
notifyLayout
(
m_pControl
->
getPosition
()
->
getWidth
(),
m_p
Control
->
getPosition
()
->
getHeight
()
);
m_p
Parent
->
notifyLayout
(
m_pParent
->
getPosition
()
->
getWidth
(),
m_p
Parent
->
getPosition
()
->
getHeight
()
);
}
}
void
CtrlText
::
updateText
(
SkinObject
*
pCtrl
)
void
CtrlText
::
CmdUpdateText
::
execute
(
)
{
CtrlText
*
m_pControl
=
(
CtrlText
*
)
pCtrl
;
m_pParent
->
m_xPos
-=
MOVING_TEXT_STEP
;
m_pParent
->
adjust
(
m_pParent
->
m_xPos
);
m_pControl
->
m_xPos
-=
MOVING_TEXT_STEP
;
m_pControl
->
adjust
(
m_pControl
->
m_xPos
);
m_pControl
->
notifyLayout
(
m_pControl
->
getPosition
()
->
getWidth
(),
m_pControl
->
getPosition
()
->
getHeight
()
);
m_pParent
->
notifyLayout
(
m_pParent
->
getPosition
()
->
getWidth
(),
m_pParent
->
getPosition
()
->
getHeight
()
);
}
...
...
modules/gui/skins2/controls/ctrl_text.hpp
View file @
eb176036
...
...
@@ -95,7 +95,7 @@ class CtrlText: public CtrlGeneric, public Observer<VarText>
OSTimer
*
m_pTimer
;
/// Callback for the timer
static
void
updateText
(
SkinObject
*
pCtrl
);
DEFINE_CALLBACK
(
CtrlText
,
UpdateText
);
/// Method called when the observed variable is modified
virtual
void
onUpdate
(
Subject
<
VarText
>
&
rVariable
);
...
...
modules/gui/skins2/src/os_factory.hpp
View file @
eb176036
...
...
@@ -31,6 +31,7 @@
#include <list>
class
GenericWindow
;
class
CmdGeneric
;
class
OSBitmap
;
class
OSGraphics
;
class
OSLoop
;
...
...
@@ -75,8 +76,8 @@ class OSFactory: public SkinObject
///
virtual
void
minimize
()
=
0
;
/// Instantiate an OSTimer with the given c
allback
virtual
OSTimer
*
createOSTimer
(
const
Callback
&
rCallback
)
=
0
;
/// Instantiate an OSTimer with the given c
ommand
virtual
OSTimer
*
createOSTimer
(
CmdGeneric
&
rCmd
)
=
0
;
/// Instantiate an object OSWindow.
virtual
OSWindow
*
createOSWindow
(
GenericWindow
&
rWindow
,
...
...
modules/gui/skins2/src/skin_common.hpp
View file @
eb176036
...
...
@@ -114,28 +114,6 @@ class SkinObject
/// interface)
intf_thread_t
*
getIntf
()
const
{
return
m_pIntf
;
}
/// Class for callbacks
class
Callback
{
public:
/// Type for callback methods
typedef
void
(
*
CallbackFunc_t
)(
SkinObject
*
);
/// Create a callback with the given object and function
Callback
(
SkinObject
*
pObj
,
CallbackFunc_t
pFunc
)
:
m_pObj
(
pObj
),
m_pFunc
(
pFunc
)
{}
~
Callback
()
{}
/// Getters
SkinObject
*
getObj
()
const
{
return
m_pObj
;
}
CallbackFunc_t
getFunc
()
const
{
return
m_pFunc
;
}
private:
/// Pointer on the callback object
SkinObject
*
const
m_pObj
;
/// Pointer on the callback method
CallbackFunc_t
m_pFunc
;
};
private:
intf_thread_t
*
m_pIntf
;
};
...
...
modules/gui/skins2/src/tooltip.cpp
View file @
eb176036
...
...
@@ -35,10 +35,10 @@
Tooltip
::
Tooltip
(
intf_thread_t
*
pIntf
,
const
GenericFont
&
rFont
,
int
delay
)
:
SkinObject
(
pIntf
),
m_rFont
(
rFont
),
m_delay
(
delay
),
m_pImage
(
NULL
),
m_xPos
(
-
1
),
m_yPos
(
-
1
)
m_xPos
(
-
1
),
m_yPos
(
-
1
)
,
m_cmdShow
(
this
)
{
OSFactory
*
pOsFactory
=
OSFactory
::
instance
(
pIntf
);
m_pTimer
=
pOsFactory
->
createOSTimer
(
Callback
(
this
,
&
doShow
)
);
m_pTimer
=
pOsFactory
->
createOSTimer
(
m_cmdShow
);
m_pOsTooltip
=
pOsFactory
->
createOSTooltip
();
// Observe the tooltip text variable
...
...
@@ -119,22 +119,20 @@ void Tooltip::makeImage( const UString &rText )
}
void
Tooltip
::
doShow
(
SkinObject
*
pObj
)
void
Tooltip
::
CmdShow
::
execute
(
)
{
Tooltip
*
pThis
=
(
Tooltip
*
)
pObj
;
if
(
pThis
->
m_pImage
)
if
(
m_pParent
->
m_pImage
)
{
if
(
pThis
->
m_xPos
==
-
1
)
if
(
m_pParent
->
m_xPos
==
-
1
)
{
// Get the mouse coordinates and the image size
OSFactory
*
pOsFactory
=
OSFactory
::
instance
(
pThis
->
getIntf
()
);
OSFactory
*
pOsFactory
=
OSFactory
::
instance
(
m_pParent
->
getIntf
()
);
int
x
,
y
;
pOsFactory
->
getMousePos
(
x
,
y
);
int
scrWidth
=
pOsFactory
->
getScreenWidth
();
int
scrHeight
=
pOsFactory
->
getScreenHeight
();
int
w
=
pThis
->
m_pImage
->
getWidth
();
int
h
=
pThis
->
m_pImage
->
getHeight
();
int
w
=
m_pParent
->
m_pImage
->
getWidth
();
int
h
=
m_pParent
->
m_pImage
->
getHeight
();
// Compute the position of the tooltip
x
-=
(
w
/
2
+
4
);
...
...
@@ -146,13 +144,13 @@ void Tooltip::doShow( SkinObject *pObj )
if
(
y
+
h
>
scrHeight
)
y
-=
(
2
*
h
+
20
);
pThis
->
m_xPos
=
x
;
pThis
->
m_yPos
=
y
;
m_pParent
->
m_xPos
=
x
;
m_pParent
->
m_yPos
=
y
;
}
// Show the tooltip window
pThis
->
m_pOsTooltip
->
show
(
pThis
->
m_xPos
,
pThis
->
m_yPos
,
*
(
pThis
->
m_pImage
)
);
m_pParent
->
m_pOsTooltip
->
show
(
m_pParent
->
m_xPos
,
m_pParent
->
m_yPos
,
*
(
m_pParent
->
m_pImage
)
);
}
}
modules/gui/skins2/src/tooltip.hpp
View file @
eb176036
...
...
@@ -26,6 +26,7 @@
#define TOOLTIP_HPP
#include "../utils/var_text.hpp"
#include "../commands/cmd_generic.hpp"
class
GenericFont
;
class
OSTooltip
;
...
...
@@ -72,8 +73,8 @@ class Tooltip: public SkinObject, public Observer<VarText>
/// Build m_pImage with the given text
void
makeImage
(
const
UString
&
rText
);
///
S
how the tooltip window
static
void
doShow
(
SkinObject
*
pObj
);
///
Callback to s
how the tooltip window
DEFINE_CALLBACK
(
Tooltip
,
Show
);
};
...
...
modules/gui/skins2/src/vlcproc.cpp
View file @
eb176036
...
...
@@ -60,11 +60,12 @@ void VlcProc::destroy( intf_thread_t *pIntf )
}
VlcProc
::
VlcProc
(
intf_thread_t
*
pIntf
)
:
SkinObject
(
pIntf
),
m_pVout
(
NULL
)
VlcProc
::
VlcProc
(
intf_thread_t
*
pIntf
)
:
SkinObject
(
pIntf
),
m_pVout
(
NULL
),
m_cmdManage
(
this
)
{
// Create a timer to poll the status of the vlc
OSFactory
*
pOsFactory
=
OSFactory
::
instance
(
pIntf
);
m_pTimer
=
pOsFactory
->
createOSTimer
(
Callback
(
this
,
&
doManage
)
);
m_pTimer
=
pOsFactory
->
createOSTimer
(
m_cmdManage
);
m_pTimer
->
start
(
100
,
false
);
// Create and register VLC variables
...
...
@@ -272,10 +273,10 @@ void VlcProc::manage()
}
void
VlcProc
::
doManage
(
SkinObject
*
pObj
)
void
VlcProc
::
CmdManage
::
execute
(
)
{
VlcProc
*
pThis
=
(
VlcProc
*
)
pObj
;
pThis
->
manage
();
// Just forward to VlcProc
m_pParent
->
manage
();
}
...
...
modules/gui/skins2/src/vlcproc.hpp
View file @
eb176036
...
...
@@ -31,6 +31,7 @@
#include "../vars/time.hpp"
#include "../vars/volume.hpp"
#include "../utils/var_text.hpp"
#include "../commands/cmd_generic.hpp"
class
OSTimer
;
class
VarBool
;
...
...
@@ -123,13 +124,12 @@ class VlcProc: public SkinObject
*/
void
manage
();
/// Define the command that calls manage()
DEFINE_CALLBACK
(
VlcProc
,
Manage
);
/// Update the stream name variable
void
updateStreamName
(
playlist_t
*
p_playlist
);
/// This function directly calls manage(), because it's boring to
/// always write "pThis->"
static
void
doManage
(
SkinObject
*
pObj
);
/// Callback for intf-change variable
static
int
onIntfChange
(
vlc_object_t
*
pObj
,
const
char
*
pVariable
,
vlc_value_t
oldVal
,
vlc_value_t
newVal
,
...
...
modules/gui/skins2/win32/win32_factory.cpp
View file @
eb176036
...
...
@@ -237,9 +237,9 @@ void Win32Factory::minimize()
ShowWindow
(
m_hParentWindow
,
SW_MINIMIZE
);
}
OSTimer
*
Win32Factory
::
createOSTimer
(
const
Callback
&
rCallback
)
OSTimer
*
Win32Factory
::
createOSTimer
(
CmdGeneric
&
rCmd
)
{
return
new
Win32Timer
(
getIntf
(),
rC
allback
,
m_hParentWindow
);
return
new
Win32Timer
(
getIntf
(),
rC
md
,
m_hParentWindow
);
}
...
...
modules/gui/skins2/win32/win32_factory.hpp
View file @
eb176036
...
...
@@ -56,8 +56,8 @@ class Win32Factory: public OSFactory
///
virtual
void
minimize
();
/// Instantiate an OSTimer with the given c
allback
virtual
OSTimer
*
createOSTimer
(
const
Callback
&
rCallback
);
/// Instantiate an OSTimer with the given c
ommand
virtual
OSTimer
*
createOSTimer
(
CmdGeneric
&
rCmd
);
/// Instantiate an OSWindow object
virtual
OSWindow
*
createOSWindow
(
GenericWindow
&
rWindow
,
...
...
modules/gui/skins2/win32/win32_timer.cpp
View file @
eb176036
...
...
@@ -25,6 +25,7 @@
#ifdef WIN32_SKINS
#include "win32_timer.hpp"
#include "../commands/cmd_generic.hpp"
void
CALLBACK
CallbackTimer
(
HWND
hwnd
,
UINT
uMsg
,
...
...
@@ -38,9 +39,8 @@ void CALLBACK CallbackTimer( HWND hwnd, UINT uMsg,
}
Win32Timer
::
Win32Timer
(
intf_thread_t
*
pIntf
,
const
Callback
&
rCallback
,
HWND
hWnd
)
:
OSTimer
(
pIntf
),
m_callback
(
rCallback
),
m_hWnd
(
hWnd
)
Win32Timer
::
Win32Timer
(
intf_thread_t
*
pIntf
,
CmdGeneric
&
rCmd
,
HWND
hWnd
)
:
OSTimer
(
pIntf
),
m_rCommand
(
rCmd
),
m_hWnd
(
hWnd
)
{
}
...
...
@@ -68,7 +68,7 @@ void Win32Timer::stop()
void
Win32Timer
::
execute
()
{
// Execute the callback
(
*
(
m_callback
.
getFunc
()))(
m_callback
.
getObj
()
);
m_rCommand
.
execute
(
);
// Restart the timer if needed
if
(
!
m_oneShot
)
...
...
modules/gui/skins2/win32/win32_timer.hpp
View file @
eb176036
...
...
@@ -27,13 +27,13 @@
#include "../src/os_timer.hpp"
class
CmdGeneric
;
// Win32 specific timer
class
Win32Timer
:
public
OSTimer
{
public:
Win32Timer
(
intf_thread_t
*
pIntf
,
const
Callback
&
rCallback
,
HWND
hWnd
);
Win32Timer
(
intf_thread_t
*
pIntf
,
CmdGeneric
&
rCmd
,
HWND
hWnd
);
virtual
~
Win32Timer
();
/// (Re)start the timer with the given delay (in ms). If oneShot is
...
...
@@ -47,8 +47,8 @@ class Win32Timer: public OSTimer
void
execute
();
private:
/// C
allback
to execute
C
allback
m_callback
;
/// C
ommand
to execute
C
mdGeneric
&
m_rCommand
;
/// Delay between two execute
mtime_t
m_interval
;
...
...
modules/gui/skins2/x11/x11_factory.cpp
View file @
eb176036
...
...
@@ -102,9 +102,9 @@ void X11Factory::minimize()
DefaultScreen
(
m_pDisplay
->
getDisplay
()
)
);
}
OSTimer
*
X11Factory
::
createOSTimer
(
const
Callback
&
rCallback
)
OSTimer
*
X11Factory
::
createOSTimer
(
CmdGeneric
&
rCmd
)
{
return
new
X11Timer
(
getIntf
(),
rC
allback
);
return
new
X11Timer
(
getIntf
(),
rC
md
);
}
...
...
modules/gui/skins2/x11/x11_factory.hpp
View file @
eb176036
...
...
@@ -59,8 +59,8 @@ class X11Factory: public OSFactory
/// Destroy the instance of OSLoop.
virtual
void
destroyOSLoop
();
/// Instantiate an OSTimer with the given c
allback
virtual
OSTimer
*
createOSTimer
(
const
Callback
&
rCallback
);
/// Instantiate an OSTimer with the given c
ommand
virtual
OSTimer
*
createOSTimer
(
CmdGeneric
&
rCmd
);
///
virtual
void
minimize
();
...
...
modules/gui/skins2/x11/x11_timer.cpp
View file @
eb176036
...
...
@@ -29,10 +29,11 @@
#include "x11_timer.hpp"
#include "x11_factory.hpp"
#include "../commands/cmd_generic.hpp"
X11Timer
::
X11Timer
(
intf_thread_t
*
pIntf
,
const
Callback
&
rCallback
)
:
OSTimer
(
pIntf
),
m_
callback
(
rCallback
)
X11Timer
::
X11Timer
(
intf_thread_t
*
pIntf
,
CmdGeneric
&
rCmd
)
:
OSTimer
(
pIntf
),
m_
rCommand
(
rCmd
)
{
// Get the instance of timer loop
X11Factory
*
m_pOsFactory
=
(
X11Factory
*
)(
OSFactory
::
instance
(
pIntf
)
);
...
...
@@ -71,7 +72,7 @@ bool X11Timer::execute()
{
m_nextDate
+=
m_interval
;
// Execute the callback
(
*
(
m_callback
.
getFunc
()))(
m_callback
.
getObj
()
);
m_rCommand
.
execute
(
);
return
!
m_oneShot
;
}
...
...
modules/gui/skins2/x11/x11_timer.hpp
View file @
eb176036
...
...
@@ -31,13 +31,14 @@
// Forward declaration
class
X11TimerLoop
;
class
CmdGeneric
;
// X11 specific timer
class
X11Timer
:
public
OSTimer
{
public:
X11Timer
(
intf_thread_t
*
pIntf
,
const
Callback
&
rCallback
);
X11Timer
(
intf_thread_t
*
pIntf
,
CmdGeneric
&
rCmd
);
virtual
~
X11Timer
();
/// (Re)start the timer with the given delay (in ms). If oneShot is
...
...
@@ -54,8 +55,8 @@ class X11Timer: public OSTimer
bool
execute
();
private:
/// C
allback
to execute
C
allback
m_callback
;
/// C
ommand
to execute
C
mdGeneric
m_rCommand
;
/// Timer loop
X11TimerLoop
*
m_pTimerLoop
;
/// Delay between two execute
...
...
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