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
ec4d5637
Commit
ec4d5637
authored
May 19, 2004
by
Derk-Jan Hartman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* iTunes style slider
parent
3134c111
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
172 deletions
+49
-172
modules/gui/macosx/misc.h
modules/gui/macosx/misc.h
+0
-19
modules/gui/macosx/misc.m
modules/gui/macosx/misc.m
+49
-153
No files found.
modules/gui/macosx/misc.h
View file @
ec4d5637
...
...
@@ -63,22 +63,3 @@
}
@end
/*****************************************************************************
* MPSliderCell
*****************************************************************************/
@interface
MPSliderCell
:
NSSliderCell
{
NSColor
*
_bgColor
;
NSColor
*
_knobColor
;
float
_knobThickness
;
}
-
(
void
)
setBackgroundColor
:(
NSColor
*
)
newColor
;
-
(
NSColor
*
)
backgroundColor
;
-
(
void
)
setKnobColor
:(
NSColor
*
)
newColor
;
-
(
NSColor
*
)
knobColor
;
@end
\ No newline at end of file
modules/gui/macosx/misc.m
View file @
ec4d5637
...
...
@@ -207,167 +207,63 @@
/*****************************************************************************
* MPSlider
*****************************************************************************/
@implementation
MPSlider
+
(
Class
)
cellClass
{
return
(
[
MPSliderCell
class
]
);
}
@end
/*****************************************************************************
* MPSliderCell
*****************************************************************************/
@implementation
MPSliderCell
-
(
id
)
init
{
self
=
[
super
init
];
if
(
self
!=
nil
)
{
_bgColor
=
[[
NSColor
colorWithDeviceRed
:
0
.
8627451
green:
0
.
8784314
blue:
0
.
7725490
alpha:
1
.
0
]
retain
];
_knobColor
=
[[
NSColor
blackColor
]
retain
];
}
NSLog
(
@"boe"
);
return
(
self
);
}
-
(
void
)
dealloc
{
[
_bgColor
release
];
[
_knobColor
release
];
[
super
dealloc
];
}
-
(
void
)
setBackgroundColor
:(
NSColor
*
)
newColor
{
[
_bgColor
release
];
_bgColor
=
[
newColor
retain
];
}
-
(
NSColor
*
)
backgroundColor
{
return
(
_bgColor
);
}
-
(
void
)
setKnobColor
:(
NSColor
*
)
newColor
{
[
_knobColor
release
];
_knobColor
=
[
newColor
retain
];
}
-
(
NSColor
*
)
knobColor
{
return
(
_knobColor
);
}
-
(
void
)
setKnobThickness
:(
float
)
f_value
{
_knobThickness
=
f_value
;
}
-
(
float
)
knobThickness
{
return
(
_knobThickness
);
}
-
(
NSSize
)
cellSizeForBounds
:(
NSRect
)
s_rc
{
return
(
s_rc
.
size
);
}
-
(
void
)
drawWithFrame
:(
NSRect
)
s_rc
inView
:(
NSView
*
)
o_view
{
if
(
_scFlags
.
weAreVertical
)
{
s_rc
.
origin
.
x
=
1
;
s_rc
.
size
.
width
-=
3
;
s_rc
.
origin
.
y
=
2
;
s_rc
.
size
.
height
-=
5
;
}
else
{
s_rc
.
origin
.
x
=
2
;
s_rc
.
size
.
width
-=
5
;
s_rc
.
origin
.
y
=
1
;
s_rc
.
size
.
height
-=
3
;
}
[
super
drawWithFrame
:
s_rc
inView
:
o_view
];
}
-
(
void
)
drawBarInside
:(
NSRect
)
s_rc
flipped
:(
BOOL
)
b_flipped
void
_drawKnobInRect
(
NSRect
knobRect
)
{
NSRect
s_arc
;
s_rc
.
size
.
width
+=
(
s_rc
.
origin
.
x
*
2
)
+
1
;
s_rc
.
size
.
height
+=
(
s_rc
.
origin
.
y
*
2
)
+
1
;
s_rc
.
origin
.
x
=
s_rc
.
origin
.
y
=
0
;
[[
NSGraphicsContext
currentContext
]
setShouldAntialias
:
NO
];
[
_bgColor
set
];
NSRectFill
(
s_rc
);
s_arc
=
s_rc
;
s_arc
.
origin
.
x
+=
1
.
5
;
s_arc
.
origin
.
y
+=
1
.
5
;
s_arc
.
size
.
width
-=
s_arc
.
origin
.
x
;
s_arc
.
size
.
height
-=
s_arc
.
origin
.
y
;
[[
_bgColor
shadowWithLevel
:
0
.
1
]
set
];
[
NSBezierPath
strokeRect
:
s_arc
];
s_arc
.
origin
=
s_rc
.
origin
;
[[
NSColor
blackColor
]
set
];
[
NSBezierPath
strokeRect
:
s_arc
];
[[
NSGraphicsContext
currentContext
]
setShouldAntialias
:
YES
];
// Center knob in given rect
knobRect
.
origin
.
x
+=
(
int
)((
float
)(
knobRect
.
size
.
width
-
7
)
/
2
.
0
);
knobRect
.
origin
.
y
+=
(
int
)((
float
)(
knobRect
.
size
.
height
-
7
)
/
2
.
0
);
// Draw diamond
NSRectFillUsingOperation
(
NSMakeRect
(
knobRect
.
origin
.
x
+
3
,
knobRect
.
origin
.
y
+
6
,
1
,
1
),
NSCompositeSourceOver
);
NSRectFillUsingOperation
(
NSMakeRect
(
knobRect
.
origin
.
x
+
2
,
knobRect
.
origin
.
y
+
5
,
3
,
1
),
NSCompositeSourceOver
);
NSRectFillUsingOperation
(
NSMakeRect
(
knobRect
.
origin
.
x
+
1
,
knobRect
.
origin
.
y
+
4
,
5
,
1
),
NSCompositeSourceOver
);
NSRectFillUsingOperation
(
NSMakeRect
(
knobRect
.
origin
.
x
+
0
,
knobRect
.
origin
.
y
+
3
,
7
,
1
),
NSCompositeSourceOver
);
NSRectFillUsingOperation
(
NSMakeRect
(
knobRect
.
origin
.
x
+
1
,
knobRect
.
origin
.
y
+
2
,
5
,
1
),
NSCompositeSourceOver
);
NSRectFillUsingOperation
(
NSMakeRect
(
knobRect
.
origin
.
x
+
2
,
knobRect
.
origin
.
y
+
1
,
3
,
1
),
NSCompositeSourceOver
);
NSRectFillUsingOperation
(
NSMakeRect
(
knobRect
.
origin
.
x
+
3
,
knobRect
.
origin
.
y
+
0
,
1
,
1
),
NSCompositeSourceOver
);
}
-
(
NSRect
)
knobRectFlipped
:(
BOOL
)
b_flipped
void
_drawFrameInRect
(
NSRect
frameRect
)
{
NSSize
s_size
;
NSPoint
s_pto
;
float
floatValue
;
floatValue
=
[
self
floatValue
];
if
(
_scFlags
.
weAreVertical
&&
b_flipped
)
{
floatValue
=
_maxValue
+
_minValue
-
floatValue
;
}
floatValue
=
(
floatValue
-
_minValue
)
/
(
_maxValue
-
_minValue
);
if
(
_scFlags
.
weAreVertical
)
{
s_size
=
NSMakeSize
(
_trackRect
.
size
.
width
,
_knobThickness
?
_knobThickness
:
_trackRect
.
size
.
width
);
s_pto
=
_trackRect
.
origin
;
s_pto
.
y
+=
(
_trackRect
.
size
.
height
-
s_size
.
height
)
*
floatValue
;
}
else
{
s_size
=
NSMakeSize
(
_knobThickness
?
_knobThickness
:
_trackRect
.
size
.
height
,
_trackRect
.
size
.
height
);
s_pto
=
_trackRect
.
origin
;
s_pto
.
x
+=
(
_trackRect
.
size
.
width
-
s_size
.
width
)
*
floatValue
;
}
return
NSMakeRect
(
s_pto
.
x
,
s_pto
.
y
,
s_size
.
width
,
s_size
.
height
);
// Draw frame
NSRectFillUsingOperation
(
NSMakeRect
(
frameRect
.
origin
.
x
,
frameRect
.
origin
.
y
,
frameRect
.
size
.
width
,
1
),
NSCompositeSourceOver
);
NSRectFillUsingOperation
(
NSMakeRect
(
frameRect
.
origin
.
x
,
frameRect
.
origin
.
y
+
frameRect
.
size
.
height
-
1
,
frameRect
.
size
.
width
,
1
),
NSCompositeSourceOver
);
NSRectFillUsingOperation
(
NSMakeRect
(
frameRect
.
origin
.
x
,
frameRect
.
origin
.
y
,
1
,
frameRect
.
size
.
height
),
NSCompositeSourceOver
);
NSRectFillUsingOperation
(
NSMakeRect
(
frameRect
.
origin
.
x
+
frameRect
.
size
.
width
-
1
,
frameRect
.
origin
.
y
,
1
,
frameRect
.
size
.
height
),
NSCompositeSourceOver
);
}
-
(
void
)
draw
Knob
:(
NSRect
)
s_rc
-
(
void
)
draw
Rect
:(
NSRect
)
rect
{
[[
NSGraphicsContext
currentContext
]
setShouldAntialias
:
NO
];
[
_knobColor
set
];
NSRectFill
(
s_rc
);
[[
NSGraphicsContext
currentContext
]
setShouldAntialias
:
YES
];
// Draw default to make sure the slider behaves correctly
[[
NSGraphicsContext
currentContext
]
saveGraphicsState
];
NSRectClip
(
NSZeroRect
);
[
super
drawRect
:
rect
];
[[
NSGraphicsContext
currentContext
]
restoreGraphicsState
];
// Full size
rect
=
[
self
bounds
];
int
diff
=
(
int
)(([[
self
cell
]
knobThickness
]
-
7
.
0
)
/
2
.
0
)
-
1
;
rect
.
origin
.
x
+=
diff
-
1
;
rect
.
origin
.
y
+=
diff
;
rect
.
size
.
width
-=
2
*
diff
-
2
;
rect
.
size
.
height
-=
2
*
diff
;
// Draw dark
NSRect
knobRect
=
[[
self
cell
]
knobRectFlipped
:
NO
];
[[[
NSColor
blackColor
]
colorWithAlphaComponent
:
0
.
6
]
set
];
_drawFrameInRect
(
rect
);
_drawKnobInRect
(
knobRect
);
// Draw shadow
[[[
NSColor
blackColor
]
colorWithAlphaComponent
:
0
.
1
]
set
];
rect
.
origin
.
x
++
;
rect
.
origin
.
y
++
;
knobRect
.
origin
.
x
++
;
knobRect
.
origin
.
y
++
;
_drawFrameInRect
(
rect
);
_drawKnobInRect
(
knobRect
);
}
@end
\ No newline at end of file
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