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
6d5694d9
Commit
6d5694d9
authored
May 17, 2007
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Automatic conversion of keyword parameter to number;
Made alignment scriptable
parent
71bbef82
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
21 additions
and
3 deletions
+21
-3
src/data/field/text.cpp
src/data/field/text.cpp
+3
-1
src/data/field/text.hpp
src/data/field/text.hpp
+2
-2
src/data/keyword.cpp
src/data/keyword.cpp
+7
-0
src/data/keyword.hpp
src/data/keyword.hpp
+4
-0
src/script/scriptable.cpp
src/script/scriptable.cpp
+3
-0
src/script/scriptable.hpp
src/script/scriptable.hpp
+2
-0
No files found.
src/data/field/text.cpp
View file @
6d5694d9
...
...
@@ -59,7 +59,9 @@ TextStyle::TextStyle(const TextFieldP& field)
bool
TextStyle
::
update
(
Context
&
ctx
)
{
return
Style
::
update
(
ctx
)
|
font
.
update
(
ctx
)
|
symbol_font
.
update
(
ctx
);
|
symbol_font
.
update
(
ctx
)
|
alignment
.
update
(
ctx
)
|
angle
.
update
(
ctx
);
}
void
TextStyle
::
initDependencies
(
Context
&
ctx
,
const
Dependency
&
dep
)
const
{
Style
::
initDependencies
(
ctx
,
dep
);
...
...
src/data/field/text.hpp
View file @
6d5694d9
...
...
@@ -66,8 +66,8 @@ class TextStyle : public Style {
SymbolFontRef
symbol_font
;
///< Symbol font for symbols in the text
bool
always_symbol
;
///< Should everything be drawn as symbols?
bool
allow_formating
;
///< Is formating (bold/italic/..) allowed?
Alignment
alignment
;
///< Alignment inside the box
int
angle
;
///< Angle of the text inside the box
Scriptable
<
Alignment
>
alignment
;
///< Alignment inside the box
Scriptable
<
int
>
angle
;
///< Angle of the text inside the box
double
padding_left
,
padding_left_min
;
///< Padding
double
padding_right
,
padding_right_min
;
///< Padding
double
padding_top
,
padding_top_min
;
///< Padding
...
...
src/data/keyword.cpp
View file @
6d5694d9
...
...
@@ -637,6 +637,7 @@ String KeywordDatabase::expand(const String& text,
ScriptType
KeywordParamValue
::
type
()
const
{
return
SCRIPT_STRING
;
}
String
KeywordParamValue
::
typeName
()
const
{
return
_
(
"keyword parameter"
);
}
KeywordParamValue
::
operator
String
()
const
{
String
safe_type
=
replace_all
(
replace_all
(
replace_all
(
type_name
,
_
(
"("
),
_
(
"-"
)),
...
...
@@ -644,6 +645,12 @@ KeywordParamValue::operator String() const {
_
(
" "
),
_
(
"-"
));
return
_
(
"<param-"
)
+
safe_type
+
_
(
">"
)
+
value
+
_
(
"</param-"
)
+
safe_type
+
_
(
">"
);
}
KeywordParamValue
::
operator
int
()
const
{
return
*
to_script
(
value
);
}
// a bit of a hack
KeywordParamValue
::
operator
double
()
const
{
return
*
to_script
(
value
);
}
KeywordParamValue
::
operator
Color
()
const
{
return
*
to_script
(
value
);
}
int
KeywordParamValue
::
itemCount
()
const
{
return
to_script
(
value
)
->
itemCount
();
}
ScriptValueP
KeywordParamValue
::
getMember
(
const
String
&
name
)
const
{
if
(
name
==
_
(
"type"
))
return
to_script
(
type_name
);
if
(
name
==
_
(
"separator before"
))
return
to_script
(
separator_before
);
...
...
src/data/keyword.hpp
View file @
6d5694d9
...
...
@@ -163,6 +163,10 @@ class KeywordParamValue : public ScriptValue {
virtual
ScriptType
type
()
const
;
virtual
String
typeName
()
const
;
virtual
operator
String
()
const
;
virtual
operator
int
()
const
;
virtual
operator
double
()
const
;
virtual
operator
Color
()
const
;
virtual
int
itemCount
()
const
;
virtual
ScriptValueP
getMember
(
const
String
&
name
)
const
;
};
...
...
src/script/scriptable.cpp
View file @
6d5694d9
...
...
@@ -12,6 +12,8 @@
#include <script/script.hpp>
#include <script/value.hpp>
Alignment
from_string
(
const
String
&
);
// ----------------------------------------------------------------------------- : Store
void
store
(
const
ScriptValueP
&
val
,
String
&
var
)
{
var
=
val
->
toString
();
}
...
...
@@ -21,6 +23,7 @@ void store(const ScriptValueP& val, bool& var) { var = static_cas
void
store
(
const
ScriptValueP
&
val
,
Color
&
var
)
{
var
=
*
val
;
}
void
store
(
const
ScriptValueP
&
val
,
Defaultable
<
String
>&
var
)
{
var
.
assign
(
*
val
);
}
void
store
(
const
ScriptValueP
&
val
,
Defaultable
<
Color
>&
var
)
{
var
.
assign
(
*
val
);
}
void
store
(
const
ScriptValueP
&
val
,
Alignment
&
var
)
{
var
=
from_string
(
val
->
toString
());
}
// ----------------------------------------------------------------------------- : OptionalScript
...
...
src/script/scriptable.hpp
View file @
6d5694d9
...
...
@@ -12,6 +12,7 @@
#include <util/prec.hpp>
#include <util/reflect.hpp>
#include <util/defaultable.hpp>
#include <util/alignment.hpp>
#include <script/script.hpp>
#include <script/context.hpp>
#include <script/parser.hpp>
...
...
@@ -29,6 +30,7 @@ void store(const ScriptValueP& val, bool& var);
void
store
(
const
ScriptValueP
&
val
,
Color
&
var
);
void
store
(
const
ScriptValueP
&
val
,
Defaultable
<
String
>&
var
);
void
store
(
const
ScriptValueP
&
val
,
Defaultable
<
Color
>&
var
);
void
store
(
const
ScriptValueP
&
val
,
Alignment
&
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