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
7f037a96
Commit
7f037a96
authored
Jul 07, 2007
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
'Edit' and 'gallery' button for symbol editor
parent
51ba6e11
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
103 additions
and
11 deletions
+103
-11
src/gui/value/symbol.cpp
src/gui/value/symbol.cpp
+88
-2
src/gui/value/symbol.hpp
src/gui/value/symbol.hpp
+12
-0
src/render/value/information.cpp
src/render/value/information.cpp
+1
-0
src/render/value/symbol.cpp
src/render/value/symbol.cpp
+0
-7
src/render/value/symbol.hpp
src/render/value/symbol.hpp
+1
-1
src/util/rotation.cpp
src/util/rotation.cpp
+1
-1
No files found.
src/gui/value/symbol.cpp
View file @
7f037a96
...
...
@@ -11,10 +11,96 @@
// ----------------------------------------------------------------------------- : SymbolValueEditor
IMPLEMENT_VALUE_EDITOR
(
Symbol
)
{}
IMPLEMENT_VALUE_EDITOR
(
Symbol
)
,
button_down
(
-
2
)
{}
void
SymbolValueEditor
::
draw
(
RotatedDC
&
dc
)
{
SymbolValueViewer
::
draw
(
dc
);
// draw helper text if there are no symbols
if
(
symbols
.
empty
())
{
dc
.
SetFont
(
wxFont
(
10
,
wxSWISS
,
wxNORMAL
,
wxNORMAL
));
dc
.
SetTextForeground
(
*
wxBLACK
);
RealSize
text_size
=
dc
.
GetTextExtent
(
_
(
"double click to edit symbol"
));
dc
.
DrawText
(
_
(
"double click to edit symbol"
),
align_in_rect
(
ALIGN_MIDDLE_CENTER
,
text_size
,
style
().
getRect
()));
}
if
(
nativeLook
())
{
// draw editor buttons
dc
.
SetFont
(
*
wxNORMAL_FONT
);
drawButton
(
dc
,
0
,
_
(
"Edit"
));
drawButton
(
dc
,
1
,
_
(
"Gallery"
));
}
}
void
SymbolValueEditor
::
drawButton
(
RotatedDC
&
dc
,
int
button
,
const
String
&
text
)
{
bool
down
=
button
==
button_down
;
double
size
=
style
().
height
;
double
x
=
style
().
right
-
size
-
(
size
+
1
)
*
button
;
double
y
=
style
().
top
;
// draw button
dc
.
SetPen
(
*
wxTRANSPARENT_PEN
);
dc
.
SetBrush
(
wxSystemSettings
::
GetColour
(
wxSYS_COLOUR_BTNFACE
));
dc
.
DrawRectangle
(
RealRect
(
x
,
y
,
size
,
size
));
dc
.
SetPen
(
wxSystemSettings
::
GetColour
(
down
?
wxSYS_COLOUR_BTNSHADOW
:
wxSYS_COLOUR_BTNHIGHLIGHT
));
dc
.
DrawLine
(
RealPoint
(
x
,
y
),
RealPoint
(
x
+
size
,
y
));
dc
.
DrawLine
(
RealPoint
(
x
,
y
),
RealPoint
(
x
,
y
+
size
));
dc
.
SetPen
(
wxSystemSettings
::
GetColour
(
down
?
wxSYS_COLOUR_BTNHIGHLIGHT
:
wxSYS_COLOUR_BTNSHADOW
));
dc
.
DrawLine
(
RealPoint
(
x
+
size
-
1
,
y
),
RealPoint
(
x
+
size
-
1
,
y
+
size
));
dc
.
DrawLine
(
RealPoint
(
x
,
y
+
size
-
1
),
RealPoint
(
x
+
size
,
y
+
size
-
1
));
// draw text
RealSize
text_size
=
dc
.
GetTextExtent
(
text
);
dc
.
DrawText
(
text
,
align_in_rect
((
Alignment
)(
ALIGN_BOTTOM
|
ALIGN_CENTER
),
text_size
,
RealRect
(
x
,
y
,
size
,
size
*
0.9
)));
}
int
SymbolValueEditor
::
findButton
(
const
RealPoint
&
pos
)
{
if
(
pos
.
y
<
style
().
top
||
pos
.
y
>=
style
().
bottom
)
return
-
1
;
int
button
=
(
int
)
floor
(
(
style
().
right
-
pos
.
x
)
/
(
style
().
height
+
1
)
);
if
(
button
>=
0
&&
button
<=
1
)
return
button
;
return
-
1
;
}
bool
SymbolValueEditor
::
onLeftDown
(
const
RealPoint
&
pos
,
wxMouseEvent
&
)
{
if
(
!
nativeLook
())
return
false
;
int
button
=
findButton
(
pos
);
if
(
button
!=
button_down
)
{
button_down
=
button
;
viewer
.
redraw
(
*
this
);
}
return
true
;
}
bool
SymbolValueEditor
::
onMotion
(
const
RealPoint
&
pos
,
wxMouseEvent
&
ev
)
{
if
(
button_down
!=
-
2
)
{
int
button
=
findButton
(
pos
);
if
(
button
!=
button_down
)
{
button_down
=
button
;
viewer
.
redraw
(
*
this
);
}
}
return
true
;
}
bool
SymbolValueEditor
::
onLeftUp
(
const
RealPoint
&
pos
,
wxMouseEvent
&
)
{
if
(
!
nativeLook
())
return
false
;
if
(
button_down
==
0
)
{
// edit
button_down
=
-
2
;
viewer
.
redraw
(
*
this
);
SymbolWindow
*
wnd
=
new
SymbolWindow
(
nullptr
,
valueP
(),
viewer
.
getSet
());
wnd
->
Show
();
return
true
;
}
else
if
(
button_down
==
1
)
{
// gallery
button_down
=
-
2
;
viewer
.
redraw
(
*
this
);
// TODO
return
true
;
}
else
{
button_down
=
-
2
;
return
false
;
}
}
bool
SymbolValueEditor
::
onLeftDClick
(
const
RealPoint
&
pos
,
wxMouseEvent
&
)
{
//
TODO : u
se SetWindow as parent? Maybe not, the symbol editor will stay open when mainwindow closes
//
U
se SetWindow as parent? Maybe not, the symbol editor will stay open when mainwindow closes
SymbolWindow
*
wnd
=
new
SymbolWindow
(
nullptr
,
valueP
(),
viewer
.
getSet
());
wnd
->
Show
();
return
true
;
...
...
src/gui/value/symbol.hpp
View file @
7f037a96
...
...
@@ -20,8 +20,20 @@ class SymbolValueEditor : public SymbolValueViewer, public ValueEditor {
public:
DECLARE_VALUE_EDITOR
(
Symbol
);
virtual
void
draw
(
RotatedDC
&
dc
);
virtual
bool
onLeftDown
(
const
RealPoint
&
pos
,
wxMouseEvent
&
);
virtual
bool
onLeftUp
(
const
RealPoint
&
pos
,
wxMouseEvent
&
);
virtual
bool
onLeftDClick
(
const
RealPoint
&
pos
,
wxMouseEvent
&
);
virtual
bool
onMotion
(
const
RealPoint
&
pos
,
wxMouseEvent
&
);
virtual
void
determineSize
(
bool
);
private:
/// Draw a button, buttons are numbered from the right
void
drawButton
(
RotatedDC
&
dc
,
int
button
,
const
String
&
text
);
/// Is there a button at the given position? returns the button index, or -1 if there is no button
int
findButton
(
const
RealPoint
&
pos
);
// button, or -1 for mouse down, but not on button, or -2 for mouse not down
int
button_down
;
};
// ----------------------------------------------------------------------------- : EOF
...
...
src/render/value/information.cpp
View file @
7f037a96
...
...
@@ -12,6 +12,7 @@
// ----------------------------------------------------------------------------- : InfoValueViewer
void
InfoValueViewer
::
draw
(
RotatedDC
&
dc
)
{
dc
.
SetPen
(
*
wxTRANSPARENT_PEN
);
if
(
nativeLook
())
{
dc
.
SetTextForeground
(
wxSystemSettings
::
GetColour
(
wxSYS_COLOUR_WINDOWTEXT
));
dc
.
SetBrush
(
wxSystemSettings
::
GetColour
(
wxSYS_COLOUR_APPWORKSPACE
));
...
...
src/render/value/symbol.cpp
View file @
7f037a96
...
...
@@ -43,13 +43,6 @@ void SymbolValueViewer::draw(RotatedDC& dc) {
// todo : labels?
dc
.
DrawBitmap
(
symbols
[
i
],
style
().
getPos
()
+
RealSize
(
i
*
(
wh
+
2
),
0
));
}
// draw helper text if there are no symbols
if
(
symbols
.
empty
())
{
dc
.
SetFont
(
wxFont
(
10
,
wxSWISS
,
wxNORMAL
,
wxNORMAL
));
dc
.
SetTextForeground
(
*
wxBLACK
);
RealSize
text_size
=
dc
.
GetTextExtent
(
_
(
"double click to edit symbol"
));
dc
.
DrawText
(
_
(
"double click to edit symbol"
),
align_in_rect
(
ALIGN_MIDDLE_CENTER
,
text_size
,
style
().
getRect
()));
}
}
void
SymbolValueViewer
::
onValueChange
()
{
...
...
src/render/value/symbol.hpp
View file @
7f037a96
...
...
@@ -23,7 +23,7 @@ class SymbolValueViewer : public ValueViewer {
virtual
void
draw
(
RotatedDC
&
dc
);
void
onValueChange
();
pr
ivate
:
pr
otected
:
vector
<
Bitmap
>
symbols
;
///< Cached images
};
...
...
src/util/rotation.cpp
View file @
7f037a96
...
...
@@ -120,7 +120,7 @@ Rotater::~Rotater() {
// ----------------------------------------------------------------------------- : RotatedDC
RotatedDC
::
RotatedDC
(
DC
&
dc
,
int
angle
,
const
RealRect
&
rect
,
double
zoom
,
RenderQuality
quality
,
bool
is_internal
)
:
Rotation
(
angle
,
rect
,
zoom
,
is_internal
)
:
Rotation
(
angle
,
rect
,
zoom
,
1.0
,
is_internal
)
,
dc
(
dc
),
quality
(
quality
)
{}
...
...
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