Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
29db598a
Commit
29db598a
authored
Apr 05, 2013
by
Erwan Tulou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
skins2: cosmetics (no functional change)
parent
7382d170
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
48 deletions
+36
-48
modules/gui/skins2/controls/ctrl_slider.cpp
modules/gui/skins2/controls/ctrl_slider.cpp
+31
-47
modules/gui/skins2/controls/ctrl_slider.hpp
modules/gui/skins2/controls/ctrl_slider.hpp
+5
-1
No files found.
modules/gui/skins2/controls/ctrl_slider.cpp
View file @
29db598a
...
...
@@ -38,7 +38,7 @@
static
inline
float
scroll
(
bool
up
,
float
pct
,
float
step
)
{
return
pct
+
(
up
?
step
:
-
step
);
return
pct
+
(
up
?
step
:
-
step
);
}
...
...
@@ -57,7 +57,8 @@ CtrlSliderCursor::CtrlSliderCursor( intf_thread_t *pIntf,
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_lastPercentage
(
0
),
m_lastCursorRect
(),
m_xOffset
(
0
),
m_yOffset
(
0
),
m_pEvt
(
NULL
),
m_rCurve
(
rCurve
)
{
// Build the images of the cursor
...
...
@@ -134,10 +135,8 @@ bool CtrlSliderCursor::mouseOver( int x, int y ) const
return
m_pImg
->
hit
(
x
-
xPos
+
m_pImg
->
getWidth
()
/
2
,
y
-
yPos
+
m_pImg
->
getHeight
()
/
2
);
}
else
{
return
false
;
}
return
false
;
}
...
...
@@ -149,10 +148,10 @@ void CtrlSliderCursor::draw( OSGraphics &rImage, int xDest, int yDest, int w, in
rect
inter
;
rect
clip
(
xDest
,
yDest
,
w
,
h
);
if
(
rect
::
intersect
(
m_
curren
tCursorRect
,
clip
,
&
inter
)
)
if
(
rect
::
intersect
(
m_
las
tCursorRect
,
clip
,
&
inter
)
)
rImage
.
drawGraphics
(
*
m_pImg
,
inter
.
x
-
m_
curren
tCursorRect
.
x
,
inter
.
y
-
m_
curren
tCursorRect
.
y
,
inter
.
x
-
m_
las
tCursorRect
.
x
,
inter
.
y
-
m_
las
tCursorRect
.
y
,
inter
.
x
,
inter
.
y
,
inter
.
width
,
inter
.
height
);
}
}
...
...
@@ -160,22 +159,7 @@ void CtrlSliderCursor::draw( OSGraphics &rImage, int xDest, int yDest, int w, in
void
CtrlSliderCursor
::
onPositionChange
()
{
// Compute the position of the cursor
int
xPos
,
yPos
;
m_rCurve
.
getPoint
(
m_rVariable
.
get
(),
xPos
,
yPos
);
// Compute the resize factors
float
factorX
,
factorY
;
getResizeFactors
(
factorX
,
factorY
);
xPos
=
(
int
)(
xPos
*
factorX
);
yPos
=
(
int
)(
yPos
*
factorY
);
const
Position
*
pPos
=
getPosition
();
int
x
=
pPos
->
getLeft
()
+
xPos
-
m_pImg
->
getWidth
()
/
2
;
int
y
=
pPos
->
getTop
()
+
yPos
-
m_pImg
->
getHeight
()
/
2
;
m_currentCursorRect
=
rect
(
x
,
y
,
m_pImg
->
getWidth
(),
m_pImg
->
getHeight
()
);
m_lastCursorRect
=
getCurrentCursorRect
();
}
...
...
@@ -302,6 +286,27 @@ void CtrlSliderCursor::getResizeFactors( float &rFactorX,
void
CtrlSliderCursor
::
refreshLayout
(
bool
force
)
{
rect
currRect
=
getCurrentCursorRect
();
if
(
!
force
&&
currRect
==
m_lastCursorRect
)
return
;
rect
join
;
if
(
rect
::
join
(
m_lastCursorRect
,
currRect
,
&
join
)
)
{
m_lastCursorRect
=
currRect
;
const
Position
*
pPos
=
getPosition
();
notifyLayout
(
join
.
width
,
join
.
height
,
join
.
x
-
pPos
->
getLeft
(),
join
.
y
-
pPos
->
getTop
()
);
}
}
rect
CtrlSliderCursor
::
getCurrentCursorRect
()
{
const
Position
*
pPos
=
getPosition
();
// Compute the position of the cursor
int
xPos
,
yPos
;
m_rCurve
.
getPoint
(
m_rVariable
.
get
(),
xPos
,
yPos
);
...
...
@@ -312,31 +317,10 @@ void CtrlSliderCursor::refreshLayout( bool force )
xPos
=
(
int
)(
xPos
*
factorX
);
yPos
=
(
int
)(
yPos
*
factorY
);
const
Position
*
pPos
=
getPosition
();
int
x
=
pPos
->
getLeft
()
+
xPos
-
m_pImg
->
getWidth
()
/
2
;
int
y
=
pPos
->
getTop
()
+
yPos
-
m_pImg
->
getHeight
()
/
2
;
rect
region
(
x
,
y
,
m_pImg
->
getWidth
(),
m_pImg
->
getHeight
()
);
if
(
!
force
&&
region
.
x
==
m_currentCursorRect
.
x
&&
region
.
y
==
m_currentCursorRect
.
y
&&
region
.
width
==
m_currentCursorRect
.
width
&&
region
.
height
==
m_currentCursorRect
.
height
)
{
return
;
}
rect
join
;
if
(
rect
::
join
(
m_currentCursorRect
,
region
,
&
join
)
)
{
m_currentCursorRect
=
region
;
notifyLayout
(
join
.
width
,
join
.
height
,
join
.
x
-
pPos
->
getLeft
(),
join
.
y
-
pPos
->
getTop
()
);
}
return
rect
(
x
,
y
,
m_pImg
->
getWidth
(),
m_pImg
->
getHeight
()
);
}
...
...
modules/gui/skins2/controls/ctrl_slider.hpp
View file @
29db598a
...
...
@@ -88,7 +88,6 @@ private:
int
m_width
,
m_height
;
/// Position of the cursor
int
m_xPosition
,
m_yPosition
;
rect
m_currentCursorRect
;
/// Callback objects
DEFINE_CALLBACK
(
CtrlSliderCursor
,
OverDown
)
DEFINE_CALLBACK
(
CtrlSliderCursor
,
DownOver
)
...
...
@@ -98,6 +97,8 @@ private:
DEFINE_CALLBACK
(
CtrlSliderCursor
,
Scroll
)
/// Last saved position of the cursor (stored as a percentage)
float
m_lastPercentage
;
/// Last saved cursor placement
rect
m_lastCursorRect
;
/// Offset between the mouse pointer and the center of the cursor
int
m_xOffset
,
m_yOffset
;
/// The last received event
...
...
@@ -117,6 +118,9 @@ private:
/// Call notifyLayout
void
refreshLayout
(
bool
force
=
true
);
/// getter for the current slider rectangle
rect
getCurrentCursorRect
();
};
...
...
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