Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
magicseteditor
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
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
MyCard
magicseteditor
Commits
80f2d9e2
Commit
80f2d9e2
authored
Oct 28, 2006
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implemented ColorValueViewer
parent
b5adae59
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
269 additions
and
7 deletions
+269
-7
src/mse.vcproj
src/mse.vcproj
+180
-0
src/render/value/color.cpp
src/render/value/color.cpp
+57
-1
src/render/value/color.hpp
src/render/value/color.hpp
+12
-1
src/render/value/image.hpp
src/render/value/image.hpp
+4
-4
src/render/value/viewer.cpp
src/render/value/viewer.cpp
+6
-1
src/util/defaultable.hpp
src/util/defaultable.hpp
+1
-0
src/util/real_point.hpp
src/util/real_point.hpp
+7
-0
src/util/rotation.hpp
src/util/rotation.hpp
+2
-0
No files found.
src/mse.vcproj
View file @
80f2d9e2
...
@@ -1144,6 +1144,96 @@
...
@@ -1144,6 +1144,96 @@
<Filter
<Filter
Name=
"value"
Name=
"value"
Filter=
""
>
Filter=
""
>
<File
RelativePath=
".\render\value\boolean.cpp"
>
<FileConfiguration
Name=
"Debug|Win32"
>
<Tool
Name=
"VCCLCompilerTool"
ObjectFile=
"$(IntDir)/$(InputName)1.obj"
/>
</FileConfiguration>
<FileConfiguration
Name=
"Release|Win32"
>
<Tool
Name=
"VCCLCompilerTool"
ObjectFile=
"$(IntDir)/$(InputName)1.obj"
/>
</FileConfiguration>
<FileConfiguration
Name=
"Debug Unicode|Win32"
>
<Tool
Name=
"VCCLCompilerTool"
ObjectFile=
"$(IntDir)/$(InputName)1.obj"
/>
</FileConfiguration>
<FileConfiguration
Name=
"Release Unicode|Win32"
>
<Tool
Name=
"VCCLCompilerTool"
ObjectFile=
"$(IntDir)/$(InputName)1.obj"
/>
</FileConfiguration>
</File>
<File
RelativePath=
".\render\value\boolean.hpp"
>
</File>
<File
RelativePath=
".\render\value\choice.cpp"
>
<FileConfiguration
Name=
"Debug|Win32"
>
<Tool
Name=
"VCCLCompilerTool"
ObjectFile=
"$(IntDir)/$(InputName)1.obj"
/>
</FileConfiguration>
<FileConfiguration
Name=
"Release|Win32"
>
<Tool
Name=
"VCCLCompilerTool"
ObjectFile=
"$(IntDir)/$(InputName)1.obj"
/>
</FileConfiguration>
<FileConfiguration
Name=
"Debug Unicode|Win32"
>
<Tool
Name=
"VCCLCompilerTool"
ObjectFile=
"$(IntDir)/$(InputName)1.obj"
/>
</FileConfiguration>
<FileConfiguration
Name=
"Release Unicode|Win32"
>
<Tool
Name=
"VCCLCompilerTool"
ObjectFile=
"$(IntDir)/$(InputName)1.obj"
/>
</FileConfiguration>
</File>
<File
RelativePath=
".\render\value\choice.hpp"
>
</File>
<File
RelativePath=
".\render\value\color.cpp"
>
<FileConfiguration
Name=
"Debug|Win32"
>
<Tool
Name=
"VCCLCompilerTool"
ObjectFile=
"$(IntDir)/$(InputName)1.obj"
/>
</FileConfiguration>
<FileConfiguration
Name=
"Release|Win32"
>
<Tool
Name=
"VCCLCompilerTool"
ObjectFile=
"$(IntDir)/$(InputName)1.obj"
/>
</FileConfiguration>
<FileConfiguration
Name=
"Debug Unicode|Win32"
>
<Tool
Name=
"VCCLCompilerTool"
ObjectFile=
"$(IntDir)/$(InputName)1.obj"
/>
</FileConfiguration>
<FileConfiguration
Name=
"Release Unicode|Win32"
>
<Tool
Name=
"VCCLCompilerTool"
ObjectFile=
"$(IntDir)/$(InputName)1.obj"
/>
</FileConfiguration>
</File>
<File
RelativePath=
".\render\value\color.hpp"
>
</File>
<File
<File
RelativePath=
".\render\value\image.cpp"
>
RelativePath=
".\render\value\image.cpp"
>
<FileConfiguration
<FileConfiguration
...
@@ -1174,6 +1264,96 @@
...
@@ -1174,6 +1264,96 @@
<File
<File
RelativePath=
".\render\value\image.hpp"
>
RelativePath=
".\render\value\image.hpp"
>
</File>
</File>
<File
RelativePath=
".\render\value\multiple_choice.cpp"
>
<FileConfiguration
Name=
"Debug|Win32"
>
<Tool
Name=
"VCCLCompilerTool"
ObjectFile=
"$(IntDir)/$(InputName)1.obj"
/>
</FileConfiguration>
<FileConfiguration
Name=
"Release|Win32"
>
<Tool
Name=
"VCCLCompilerTool"
ObjectFile=
"$(IntDir)/$(InputName)1.obj"
/>
</FileConfiguration>
<FileConfiguration
Name=
"Debug Unicode|Win32"
>
<Tool
Name=
"VCCLCompilerTool"
ObjectFile=
"$(IntDir)/$(InputName)1.obj"
/>
</FileConfiguration>
<FileConfiguration
Name=
"Release Unicode|Win32"
>
<Tool
Name=
"VCCLCompilerTool"
ObjectFile=
"$(IntDir)/$(InputName)1.obj"
/>
</FileConfiguration>
</File>
<File
RelativePath=
".\render\value\multiple_choice.hpp"
>
</File>
<File
RelativePath=
".\render\value\symbol.cpp"
>
<FileConfiguration
Name=
"Debug|Win32"
>
<Tool
Name=
"VCCLCompilerTool"
ObjectFile=
"$(IntDir)/$(InputName)2.obj"
/>
</FileConfiguration>
<FileConfiguration
Name=
"Release|Win32"
>
<Tool
Name=
"VCCLCompilerTool"
ObjectFile=
"$(IntDir)/$(InputName)2.obj"
/>
</FileConfiguration>
<FileConfiguration
Name=
"Debug Unicode|Win32"
>
<Tool
Name=
"VCCLCompilerTool"
ObjectFile=
"$(IntDir)/$(InputName)2.obj"
/>
</FileConfiguration>
<FileConfiguration
Name=
"Release Unicode|Win32"
>
<Tool
Name=
"VCCLCompilerTool"
ObjectFile=
"$(IntDir)/$(InputName)2.obj"
/>
</FileConfiguration>
</File>
<File
RelativePath=
".\render\value\symbol.hpp"
>
</File>
<File
RelativePath=
".\render\value\text.cpp"
>
<FileConfiguration
Name=
"Debug|Win32"
>
<Tool
Name=
"VCCLCompilerTool"
ObjectFile=
"$(IntDir)/$(InputName)1.obj"
/>
</FileConfiguration>
<FileConfiguration
Name=
"Release|Win32"
>
<Tool
Name=
"VCCLCompilerTool"
ObjectFile=
"$(IntDir)/$(InputName)1.obj"
/>
</FileConfiguration>
<FileConfiguration
Name=
"Debug Unicode|Win32"
>
<Tool
Name=
"VCCLCompilerTool"
ObjectFile=
"$(IntDir)/$(InputName)1.obj"
/>
</FileConfiguration>
<FileConfiguration
Name=
"Release Unicode|Win32"
>
<Tool
Name=
"VCCLCompilerTool"
ObjectFile=
"$(IntDir)/$(InputName)1.obj"
/>
</FileConfiguration>
</File>
<File
RelativePath=
".\render\value\text.hpp"
>
</File>
<File
<File
RelativePath=
".\render\value\viewer.cpp"
>
RelativePath=
".\render\value\viewer.cpp"
>
<FileConfiguration
<FileConfiguration
...
...
src/render/value/color.cpp
View file @
80f2d9e2
...
@@ -8,4 +8,60 @@
...
@@ -8,4 +8,60 @@
#include <render/value/color.hpp>
#include <render/value/color.hpp>
// ----------------------------------------------------------------------------- :
DECLARE_TYPEOF_COLLECTION
(
ColorField
::
ChoiceP
);
// ----------------------------------------------------------------------------- : ColorValueViewer
void
ColorValueViewer
::
draw
(
RotatedDC
&
dc
)
{
// draw in the value color
dc
.
SetPen
(
*
wxTRANSPARENT_PEN
);
dc
.
SetBrush
(
value
().
value
.
get
());
if
(
nativeLook
())
{
// native look
// find name of color
String
color_name
=
_
(
"Custom"
);
if
(
field
().
default_script
&&
value
().
value
.
isDefault
())
{
color_name
=
field
().
default_name
;
}
else
{
FOR_EACH_CONST
(
c
,
field
().
choices
)
{
if
(
value
().
value
.
get
()
==
c
->
color
)
{
color_name
=
capitalize
(
c
->
name
);
break
;
}
}
}
// draw name and color
dc
.
SetPen
(
wxSystemSettings
::
GetColour
(
wxSYS_COLOUR_WINDOWTEXT
));
dc
.
DrawRectangle
(
RealRect
(
style
().
left
,
style
().
top
,
40
,
style
().
height
));
dc
.
SetBrush
(
wxSystemSettings
::
GetColour
(
wxSYS_COLOUR_WINDOW
));
dc
.
SetPen
(
*
wxTRANSPARENT_PEN
);
dc
.
DrawRectangle
(
style
().
getRect
()
+
RealRect
(
40
,
0
,
-
40
,
0
));
dc
.
DrawText
(
color_name
,
style
().
getPos
()
+
RealSize
(
43
,
3
));
}
else
{
// do we need clipping?
bool
clip
=
style
().
left_width
<
style
().
width
&&
style
().
right_width
<
style
().
width
&&
style
().
top_width
<
style
().
height
&&
style
().
bottom_width
<
style
().
height
;
if
(
clip
)
{
// clip away the inside of the rectangle
wxRegion
r
=
dc
.
tr
(
style
().
getRect
());
r
.
Subtract
(
dc
.
tr
(
RealRect
(
style
().
left
+
style
().
left_width
,
style
().
top
+
style
().
top_width
,
style
().
width
-
style
().
left_width
-
style
().
right_width
,
style
().
height
-
style
().
top_width
-
style
().
bottom_width
)));
dc
.
getDC
().
SetClippingRegion
(
r
);
}
dc
.
DrawRoundedRectangle
(
style
().
getRect
(),
style
().
radius
);
if
(
clip
)
dc
.
getDC
().
DestroyClippingRegion
();
}
}
bool
ColorValueViewer
::
containsPoint
(
const
RealPoint
&
p
)
const
{
// distance to each side
double
left
=
p
.
x
-
style
().
left
,
right
=
style
().
left
+
style
().
width
-
p
.
x
-
1
;
double
top
=
p
.
y
-
style
().
top
,
bottom
=
style
().
top
+
style
().
height
-
p
.
y
-
1
;
return
left
>=
0
&&
right
>=
0
&&
top
>=
0
&&
bottom
>=
0
&&
// inside bounding box
(
left
<
style
().
left_width
||
right
<
style
().
right_width
||
// inside horizontal border
top
<
style
().
top_width
||
bottom
<
style
().
bottom_width
);
// inside vertical border
}
src/render/value/color.hpp
View file @
80f2d9e2
...
@@ -10,8 +10,19 @@
...
@@ -10,8 +10,19 @@
// ----------------------------------------------------------------------------- : Includes
// ----------------------------------------------------------------------------- : Includes
#include <util/prec.hpp>
#include <util/prec.hpp>
#include <render/value/viewer.hpp>
#include <data/field/color.hpp>
// ----------------------------------------------------------------------------- :
// ----------------------------------------------------------------------------- : ColorValueViewer
/// Viewer that displays an color value
class
ColorValueViewer
:
public
ValueViewer
{
public:
DECLARE_VALUE_VIEWER
(
Color
)
:
ValueViewer
(
parent
,
style
)
{}
virtual
void
draw
(
RotatedDC
&
dc
);
virtual
bool
containsPoint
(
const
RealPoint
&
p
)
const
;
};
// ----------------------------------------------------------------------------- : EOF
// ----------------------------------------------------------------------------- : EOF
...
...
src/render/value/image.hpp
View file @
80f2d9e2
...
@@ -20,12 +20,12 @@ class ImageValueViewer : public ValueViewer {
...
@@ -20,12 +20,12 @@ class ImageValueViewer : public ValueViewer {
public:
public:
DECLARE_VALUE_VIEWER
(
Image
)
:
ValueViewer
(
parent
,
style
)
{}
DECLARE_VALUE_VIEWER
(
Image
)
:
ValueViewer
(
parent
,
style
)
{}
void
draw
(
RotatedDC
&
dc
);
v
irtual
v
oid
draw
(
RotatedDC
&
dc
);
bool
containsPoint
(
const
RealPoint
&
p
)
const
;
virtual
bool
containsPoint
(
const
RealPoint
&
p
)
const
;
void
onValueChange
();
v
irtual
v
oid
onValueChange
();
void
onStyleChange
();
v
irtual
v
oid
onStyleChange
();
private:
private:
Bitmap
bitmap
;
Bitmap
bitmap
;
...
...
src/render/value/viewer.cpp
View file @
80f2d9e2
...
@@ -48,6 +48,10 @@ void ValueViewer::drawFieldBorder(RotatedDC& dc) {
...
@@ -48,6 +48,10 @@ void ValueViewer::drawFieldBorder(RotatedDC& dc) {
}
}
}
}
bool
ValueViewer
::
nativeLook
()
const
{
return
viewer
.
nativeLook
();
}
// ----------------------------------------------------------------------------- : Development/debug
// ----------------------------------------------------------------------------- : Development/debug
#ifdef _DEBUG
#ifdef _DEBUG
...
@@ -72,8 +76,9 @@ void ValueViewer::drawFieldBorder(RotatedDC& dc) {
...
@@ -72,8 +76,9 @@ void ValueViewer::drawFieldBorder(RotatedDC& dc) {
ValueViewerP
ChoiceStyle
::
makeViewer
(
DataViewer
&
parent
,
const
StyleP
&
thisP
)
{
return
ValueViewerP
();
}
ValueViewerP
ChoiceStyle
::
makeViewer
(
DataViewer
&
parent
,
const
StyleP
&
thisP
)
{
return
ValueViewerP
();
}
ValueViewerP
BooleanStyle
::
makeViewer
(
DataViewer
&
parent
,
const
StyleP
&
thisP
)
{
return
ValueViewerP
();
}
ValueViewerP
BooleanStyle
::
makeViewer
(
DataViewer
&
parent
,
const
StyleP
&
thisP
)
{
return
ValueViewerP
();
}
ValueViewerP
MultipleChoiceStyle
::
makeViewer
(
DataViewer
&
parent
,
const
StyleP
&
thisP
)
{
return
ValueViewerP
();
}
ValueViewerP
MultipleChoiceStyle
::
makeViewer
(
DataViewer
&
parent
,
const
StyleP
&
thisP
)
{
return
ValueViewerP
();
}
ValueViewerP
ColorStyle
::
makeViewer
(
DataViewer
&
parent
,
const
StyleP
&
thisP
)
{
return
ValueViewerP
();
}
//
ValueViewerP ColorStyle ::makeViewer(DataViewer& parent, const StyleP& thisP) { return ValueViewerP(); }
//ValueViewerP ImageStyle ::makeViewer(DataViewer& parent, const StyleP& thisP) { return ValueViewerP(); }
//ValueViewerP ImageStyle ::makeViewer(DataViewer& parent, const StyleP& thisP) { return ValueViewerP(); }
IMPLEMENT_MAKE_VIEWER
(
Color
);
IMPLEMENT_MAKE_VIEWER
(
Image
);
IMPLEMENT_MAKE_VIEWER
(
Image
);
ValueViewerP
SymbolStyle
::
makeViewer
(
DataViewer
&
parent
,
const
StyleP
&
thisP
)
{
return
ValueViewerP
();
}
ValueViewerP
SymbolStyle
::
makeViewer
(
DataViewer
&
parent
,
const
StyleP
&
thisP
)
{
return
ValueViewerP
();
}
ValueViewerP
TextStyle
::
makeViewer
(
DataViewer
&
parent
,
const
StyleP
&
thisP
)
{
return
ValueViewerP
();
}
ValueViewerP
TextStyle
::
makeViewer
(
DataViewer
&
parent
,
const
StyleP
&
thisP
)
{
return
ValueViewerP
();
}
...
...
src/util/defaultable.hpp
View file @
80f2d9e2
...
@@ -31,6 +31,7 @@ class Defaultable {
...
@@ -31,6 +31,7 @@ class Defaultable {
/// Get access to the value
/// Get access to the value
inline
const
T
&
operator
()
()
const
{
return
value
;
}
inline
const
T
&
operator
()
()
const
{
return
value
;
}
inline
const
T
&
get
()
const
{
return
value
;
}
/// Is this value in the default state?
/// Is this value in the default state?
inline
bool
isDefault
()
const
{
return
is_default
;
}
inline
bool
isDefault
()
const
{
return
is_default
;
}
...
...
src/util/real_point.hpp
View file @
80f2d9e2
...
@@ -93,6 +93,9 @@ class RealRect {
...
@@ -93,6 +93,9 @@ class RealRect {
/// Size of the rectangle
/// Size of the rectangle
RealSize
size
;
RealSize
size
;
inline
RealRect
(
const
wxRect
&
rect
)
:
position
(
rect
.
x
,
rect
.
y
),
size
(
rect
.
width
,
rect
.
height
)
{}
inline
RealRect
(
const
RealPoint
&
position
,
const
RealSize
&
size
)
inline
RealRect
(
const
RealPoint
&
position
,
const
RealSize
&
size
)
:
position
(
position
),
size
(
size
)
:
position
(
position
),
size
(
size
)
{}
{}
...
@@ -107,6 +110,10 @@ class RealRect {
...
@@ -107,6 +110,10 @@ class RealRect {
inline
RealRect
grow
(
double
amount
)
{
inline
RealRect
grow
(
double
amount
)
{
return
RealRect
(
position
.
x
-
amount
,
position
.
y
-
amount
,
size
.
width
+
2
*
amount
,
size
.
height
+
2
*
amount
);
return
RealRect
(
position
.
x
-
amount
,
position
.
y
-
amount
,
size
.
width
+
2
*
amount
,
size
.
height
+
2
*
amount
);
}
}
inline
RealRect
operator
+
(
const
RealRect
&
r
)
const
{
return
RealRect
(
position
+
r
.
position
,
size
+
r
.
size
);
}
};
};
// ----------------------------------------------------------------------------- : Operators
// ----------------------------------------------------------------------------- : Operators
...
...
src/util/rotation.hpp
View file @
80f2d9e2
...
@@ -136,6 +136,8 @@ class RotatedDC : public Rotation {
...
@@ -136,6 +136,8 @@ class RotatedDC : public Rotation {
RealSize
GetTextExtent
(
const
String
&
text
);
RealSize
GetTextExtent
(
const
String
&
text
);
inline
wxDC
&
getDC
()
{
return
dc
;
}
private:
private:
wxDC
&
dc
;
///< The actual dc
wxDC
&
dc
;
///< The actual dc
bool
high_quality
;
///< Drawing using our own anti aliassing?
bool
high_quality
;
///< Drawing using our own anti aliassing?
...
...
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