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
54c92cc5
Commit
54c92cc5
authored
May 22, 2007
by
coppro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented difference (XOR) option for symbols.
parent
e4d0b5ac
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
23 deletions
+34
-23
data/en.mse-locale/locale
data/en.mse-locale/locale
+4
-1
src/gui/symbol/select_editor.cpp
src/gui/symbol/select_editor.cpp
+7
-6
src/render/symbol/viewer.cpp
src/render/symbol/viewer.cpp
+22
-15
src/render/symbol/viewer.hpp
src/render/symbol/viewer.hpp
+1
-1
No files found.
data/en.mse-locale/locale
View file @
54c92cc5
mse
version
:
0.3.2
mse
version
:
0.3.2
full
name
:
English
##############################################################
Menu
items
...
...
@@ -194,6 +194,7 @@ help:
merge
:
Merges
this
shape
with
those
below
it
subtract
:
Subtracts
this
shape
from
shapes
below
it
,
leaves
only
the
area
in
that
shape
that
is
not
in
this
shape
intersect
:
Intersects
this
shape
with
shapes
below
it
,
leaves
only
the
area
in
both
shapes
difference
:
Differs
this
shape
from
the
shapes
below
it
,
leaves
only
the
area
not
in
any
other
shape
overlap
:
Place
this
shape
,
and
its
border
above
shapes
below
it
border
:
Draws
this
shape
as
a
border
...
...
@@ -251,6 +252,7 @@ tool:
merge
:
Merge
subtract
:
Subtract
intersect
:
Intersect
difference
:
Difference
overlap
:
Overlap
border
:
Border
...
...
@@ -317,6 +319,7 @@ tooltip:
merge
:
Merge
with
shapes
below
subtract
:
Subtract
from
shapes
below
intersect
:
Intersect
with
shapes
below
difference
:
Differ
from
shapes
below
overlap
:
Place
above
other
shapes
border
:
Draw
as
a
border
...
...
src/gui/symbol/select_editor.cpp
View file @
54c92cc5
...
...
@@ -108,18 +108,19 @@ void SymbolSelectEditor::drawRotationCenter(DC& dc, const Vector2D& pos) {
void
SymbolSelectEditor
::
initUI
(
wxToolBar
*
tb
,
wxMenuBar
*
mb
)
{
tb
->
AddSeparator
();
tb
->
AddTool
(
ID_PART_MERGE
,
_TOOL_
(
"merge"
),
load_resource_image
(
_
(
"combine_or"
)),
wxNullBitmap
,
wxITEM_CHECK
,
_TOOLTIP_
(
"merge"
),
_HELP_
(
"merge"
));
tb
->
AddTool
(
ID_PART_SUBTRACT
,
_TOOL_
(
"subtract"
),
load_resource_image
(
_
(
"combine_sub_dark"
)),
wxNullBitmap
,
wxITEM_CHECK
,
_TOOLTIP_
(
"subtract"
),
_HELP_
(
"subtract"
));
tb
->
AddTool
(
ID_PART_INTERSECTION
,
_TOOL_
(
"intersect"
),
load_resource_image
(
_
(
"combine_and_dark"
)),
wxNullBitmap
,
wxITEM_CHECK
,
_TOOLTIP_
(
"intersect"
),
_HELP_
(
"intersect"
));
// note: difference doesn't work (yet)
tb
->
AddTool
(
ID_PART_OVERLAP
,
_TOOL_
(
"overlap"
),
load_resource_image
(
_
(
"combine_over"
)),
wxNullBitmap
,
wxITEM_CHECK
,
_TOOLTIP_
(
"overlap"
),
_HELP_
(
"overlap"
));
tb
->
AddTool
(
ID_PART_BORDER
,
_TOOL_
(
"border"
),
load_resource_image
(
_
(
"combine_border"
)),
wxNullBitmap
,
wxITEM_CHECK
,
_TOOLTIP_
(
"border"
),
_HELP_
(
"border"
));
tb
->
AddTool
(
ID_PART_MERGE
,
_TOOL_
(
"merge"
),
load_resource_image
(
_
(
"combine_or"
)),
wxNullBitmap
,
wxITEM_CHECK
,
_TOOLTIP_
(
"merge"
),
_HELP_
(
"merge"
));
tb
->
AddTool
(
ID_PART_SUBTRACT
,
_TOOL_
(
"subtract"
),
load_resource_image
(
_
(
"combine_sub_dark"
)),
wxNullBitmap
,
wxITEM_CHECK
,
_TOOLTIP_
(
"subtract"
),
_HELP_
(
"subtract"
));
tb
->
AddTool
(
ID_PART_INTERSECTION
,
_TOOL_
(
"intersect"
),
load_resource_image
(
_
(
"combine_and_dark"
)),
wxNullBitmap
,
wxITEM_CHECK
,
_TOOLTIP_
(
"intersect"
),
_HELP_
(
"intersect"
));
tb
->
AddTool
(
ID_PART_DIFFERENCE
,
_TOOL_
(
"difference"
),
load_resource_image
(
_
(
"combine_xor"
)),
wxNullBitmap
,
wxITEM_CHECK
,
_TOOLTIP_
(
"difference"
),
_HELP_
(
"difference"
));
tb
->
AddTool
(
ID_PART_OVERLAP
,
_TOOL_
(
"overlap"
),
load_resource_image
(
_
(
"combine_over"
)),
wxNullBitmap
,
wxITEM_CHECK
,
_TOOLTIP_
(
"overlap"
),
_HELP_
(
"overlap"
));
tb
->
AddTool
(
ID_PART_BORDER
,
_TOOL_
(
"border"
),
load_resource_image
(
_
(
"combine_border"
)),
wxNullBitmap
,
wxITEM_CHECK
,
_TOOLTIP_
(
"border"
),
_HELP_
(
"border"
));
tb
->
Realize
();
}
void
SymbolSelectEditor
::
destroyUI
(
wxToolBar
*
tb
,
wxMenuBar
*
mb
)
{
tb
->
DeleteTool
(
ID_PART_MERGE
);
tb
->
DeleteTool
(
ID_PART_SUBTRACT
);
tb
->
DeleteTool
(
ID_PART_INTERSECTION
);
tb
->
DeleteTool
(
ID_PART_DIFFERENCE
);
tb
->
DeleteTool
(
ID_PART_OVERLAP
);
tb
->
DeleteTool
(
ID_PART_BORDER
);
// HACK: hardcoded size of rest of toolbar
...
...
src/render/symbol/viewer.cpp
View file @
54c92cc5
...
...
@@ -138,39 +138,41 @@ void SymbolViewer::highlightPart(DC& dc, const SymbolPart& part, HighlightStyle
void
SymbolViewer
::
combineSymbolPart
(
const
SymbolPart
&
part
,
DC
&
border
,
DC
&
interior
,
bool
directB
,
bool
directI
)
{
// what color should the interior be?
// use black when drawing to the screen
int
interiorCol
=
directI
?
0
:
255
;
unsigned
char
interiorCol
=
directI
?
0
:
255
;
// how to draw depends on combining mode
switch
(
part
.
combine
)
{
case
PART_OVERLAP
:
case
PART_MERGE
:
{
drawSymbolPart
(
part
,
&
border
,
&
interior
,
255
,
interiorCol
,
directB
);
drawSymbolPart
(
part
,
&
border
,
&
interior
,
255
,
interiorCol
,
directB
,
false
);
break
;
}
case
PART_SUBTRACT
:
{
border
.
SetLogicalFunction
(
wxAND
);
drawSymbolPart
(
part
,
&
border
,
&
interior
,
0
,
interiorCol
^
255
,
directB
);
drawSymbolPart
(
part
,
&
border
,
&
interior
,
0
,
~
interiorCol
,
true
,
true
);
border
.
SetLogicalFunction
(
wxCOPY
);
break
;
}
case
PART_INTERSECTION
:
{
MemoryDCP
keepBorder
=
getTempDC
(
border
);
MemoryDCP
keepInterior
=
getTempDC
(
interior
);
drawSymbolPart
(
part
,
keepBorder
.
get
(),
keepInterior
.
get
(),
255
,
255
,
false
);
drawSymbolPart
(
part
,
keepBorder
.
get
(),
keepInterior
.
get
(),
255
,
255
,
false
,
false
);
// combine the temporary dcs with the result using the AND operator
wxSize
s
=
border
.
GetSize
();
border
.
Blit
(
0
,
0
,
s
.
GetWidth
(),
s
.
GetHeight
(),
&*
keepBorder
,
0
,
0
,
wxAND
);
border
.
Blit
(
0
,
0
,
s
.
GetWidth
(),
s
.
GetHeight
(),
&*
keepBorder
,
0
,
0
,
wxAND
);
interior
.
Blit
(
0
,
0
,
s
.
GetWidth
(),
s
.
GetHeight
(),
&*
keepInterior
,
0
,
0
,
wxAND
);
break
;
}
case
PART_DIFFERENCE
:
{
// TODO
interior
.
SetLogicalFunction
(
wxXOR
);
drawSymbolPart
(
part
,
&
border
,
&
interior
,
0
,
~
interiorCol
,
directB
,
true
);
interior
.
SetLogicalFunction
(
wxCOPY
);
break
;
}
case
PART_BORDER
:
{
// draw border as interior
drawSymbolPart
(
part
,
nullptr
,
&
border
,
0
,
255
,
false
);
drawSymbolPart
(
part
,
nullptr
,
&
border
,
0
,
255
,
false
,
false
);
break
;
}
}
}
void
SymbolViewer
::
drawSymbolPart
(
const
SymbolPart
&
part
,
DC
*
border
,
DC
*
interior
,
int
borderCol
,
int
interiorCol
,
bool
directB
)
{
void
SymbolViewer
::
drawSymbolPart
(
const
SymbolPart
&
part
,
DC
*
border
,
DC
*
interior
,
unsigned
char
borderCol
,
unsigned
char
interiorCol
,
bool
directB
,
bool
clear
)
{
// create point list
vector
<
wxPoint
>
points
;
size_t
size
=
part
.
points
.
size
();
...
...
@@ -179,15 +181,20 @@ void SymbolViewer::drawSymbolPart(const SymbolPart& part, DC* border, DC* interi
}
// draw border
if
(
border
)
{
if
(
directB
)
{
// white/green
border
->
SetBrush
(
Color
(
borderCol
,
min
(
255
,
borderCol
+
128
),
borderCol
));
}
else
{
// white/black
border
->
SetBrush
(
Color
(
borderCol
,
borderCol
,
borderCol
));
}
// white/black
border
->
SetBrush
(
Color
(
borderCol
,
borderCol
^
(
directB
?
128
:
0
),
borderCol
));
border
->
SetPen
(
wxPen
(
*
wxWHITE
,
(
int
)
rotation
.
trS
(
border_radius
)));
border
->
DrawPolygon
((
int
)
points
.
size
(),
&
points
[
0
]);
if
(
clear
)
{
border
->
SetPen
(
*
wxTRANSPARENT_PEN
);
border
->
SetBrush
(
Color
(
0
,
(
directB
?
128
:
0
),
0
));
int
func
=
border
->
GetLogicalFunction
();
border
->
SetLogicalFunction
(
wxCOPY
);
border
->
DrawPolygon
((
int
)
points
.
size
(),
&
points
[
0
]);
border
->
SetLogicalFunction
(
func
);
}
}
// draw interior
if
(
interior
)
{
...
...
src/render/symbol/viewer.hpp
View file @
54c92cc5
...
...
@@ -60,7 +60,7 @@ class SymbolViewer : public SymbolView {
* The **Col parameters give the color to use for the (interior of) the border and the interior
* default should be white (255) border and black (0) interior.
*/
void
drawSymbolPart
(
const
SymbolPart
&
part
,
DC
*
border
,
DC
*
interior
,
int
borderCol
,
int
interiorCol
,
bool
direct
B
);
void
drawSymbolPart
(
const
SymbolPart
&
part
,
DC
*
border
,
DC
*
interior
,
unsigned
char
borderCol
,
unsigned
char
interiorCol
,
bool
directB
,
bool
opp
B
);
/*
// ------------------- Bezier curve calculation
...
...
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