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
a604192c
Commit
a604192c
authored
Jan 08, 2009
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use font settings for drawing multiple choice text labels, spacing and direction are scriptable.
parent
fa706786
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
26 additions
and
7 deletions
+26
-7
src/data/field/multiple_choice.cpp
src/data/field/multiple_choice.cpp
+6
-0
src/data/field/multiple_choice.hpp
src/data/field/multiple_choice.hpp
+4
-2
src/mse.vcproj
src/mse.vcproj
+10
-3
src/render/value/multiple_choice.cpp
src/render/value/multiple_choice.cpp
+3
-2
src/script/scriptable.cpp
src/script/scriptable.cpp
+2
-0
src/script/scriptable.hpp
src/script/scriptable.hpp
+1
-0
No files found.
src/data/field/multiple_choice.cpp
View file @
a604192c
...
...
@@ -39,6 +39,12 @@ IMPLEMENT_REFLECTION(MultipleChoiceStyle) {
REFLECT
(
spacing
);
}
int
MultipleChoiceStyle
::
update
(
Context
&
ctx
)
{
return
ChoiceStyle
::
update
(
ctx
)
|
direction
.
update
(
ctx
)
*
CHANGE_OTHER
|
spacing
.
update
(
ctx
)
*
CHANGE_OTHER
;
}
// ----------------------------------------------------------------------------- : MultipleChoiceValue
IMPLEMENT_REFLECTION_NAMELESS
(
MultipleChoiceValue
)
{
...
...
src/data/field/multiple_choice.hpp
View file @
a604192c
...
...
@@ -36,8 +36,10 @@ class MultipleChoiceStyle : public ChoiceStyle {
MultipleChoiceStyle
(
const
MultipleChoiceFieldP
&
field
);
DECLARE_STYLE_TYPE
(
MultipleChoice
);
Direction
direction
;
///< In what direction are choices layed out?
double
spacing
;
///< Spacing between choices (images) in pixels
Scriptable
<
Direction
>
direction
;
///< In what direction are choices layed out?
Scriptable
<
double
>
spacing
;
///< Spacing between choices (images) in pixels
virtual
int
update
(
Context
&
);
};
// ----------------------------------------------------------------------------- : MultipleChoiceValue
...
...
src/mse.vcproj
View file @
a604192c
...
...
@@ -3950,9 +3950,6 @@
<Filter
Name=
"template-stuff"
Filter=
""
>
<File
RelativePath=
"..\data\magic-test.mse-style\script-language-tests"
>
</File>
<Filter
Name=
"magic"
Filter=
""
>
...
...
@@ -3990,6 +3987,16 @@
RelativePath=
"..\data\magic.mse-game\word_lists"
>
</File>
</Filter>
<Filter
Name=
"test"
Filter=
""
>
<File
RelativePath=
"..\data\magic-test.mse-style\script-language-tests"
>
</File>
<File
RelativePath=
"..\data\magic-test.mse-style\style"
>
</File>
</Filter>
</Filter>
<File
RelativePath=
".\code_template.cpp"
>
...
...
src/render/value/multiple_choice.cpp
View file @
a604192c
...
...
@@ -74,9 +74,10 @@ void MultipleChoiceValueViewer::drawChoice(RotatedDC& dc, RealPoint& pos, const
if
(
style
().
render_style
&
RENDER_TEXT
)
{
// draw text
String
text
=
tr
(
getStylePackage
(),
choice
,
capitalize_sentence
);
dc
.
SetFont
(
style
().
font
,
1
);
RealSize
text_size
=
dc
.
GetTextExtent
(
text
);
dc
.
DrawText
(
text
,
align_in_rect
(
ALIGN_MIDDLE_LEFT
,
text_size
,
RealRect
(
pos
+
RealSize
(
size
.
width
+
1
,
0
),
RealSize
(
0
,
size
.
height
)))
);
RealPoint
text_pos
=
align_in_rect
(
ALIGN_MIDDLE_LEFT
,
text_size
,
RealRect
(
pos
.
x
+
size
.
width
+
1
,
pos
.
y
,
0
,
size
.
height
));
dc
.
DrawTextWithShadow
(
text
,
style
().
font
,
pos
);
size
=
add_horizontal
(
size
,
text_size
);
}
// next position
...
...
src/script/scriptable.cpp
View file @
a604192c
...
...
@@ -15,6 +15,7 @@
#include <gfx/color.hpp>
Alignment
from_string
(
const
String
&
);
bool
parse_enum
(
const
String
&
,
Direction
&
);
DECLARE_TYPEOF_COLLECTION
(
ScriptParseError
);
...
...
@@ -30,6 +31,7 @@ void store(const ScriptValueP& val, Defaultable<String>& var) { var.assign(*val)
void
store
(
const
ScriptValueP
&
val
,
Defaultable
<
Color
>&
var
)
{
var
.
assign
((
AColor
)
*
val
);
}
void
store
(
const
ScriptValueP
&
val
,
Defaultable
<
AColor
>&
var
)
{
var
.
assign
(
*
val
);
}
void
store
(
const
ScriptValueP
&
val
,
Alignment
&
var
)
{
var
=
from_string
(
val
->
toString
());
}
void
store
(
const
ScriptValueP
&
val
,
Direction
&
var
)
{
parse_enum
(
val
->
toString
(),
var
);
}
// ----------------------------------------------------------------------------- : OptionalScript
...
...
src/script/scriptable.hpp
View file @
a604192c
...
...
@@ -33,6 +33,7 @@ void store(const ScriptValueP& val, AColor& var);
void
store
(
const
ScriptValueP
&
val
,
Defaultable
<
String
>&
var
);
void
store
(
const
ScriptValueP
&
val
,
Defaultable
<
Color
>&
var
);
void
store
(
const
ScriptValueP
&
val
,
Alignment
&
var
);
void
store
(
const
ScriptValueP
&
val
,
Direction
&
var
);
// ----------------------------------------------------------------------------- : OptionalScript
...
...
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