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
d0ebfb28
Commit
d0ebfb28
authored
Mar 19, 2012
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove #if USE_SCRIPT_VALUE_*, they are all taken to be 1.
parent
47896e4b
Changes
22
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
8 additions
and
629 deletions
+8
-629
src/data/action/value.cpp
src/data/action/value.cpp
+0
-46
src/data/action/value.hpp
src/data/action/value.hpp
+2
-60
src/data/field.cpp
src/data/field.cpp
+0
-3
src/data/field.hpp
src/data/field.hpp
+2
-15
src/data/field/boolean.cpp
src/data/field/boolean.cpp
+1
-10
src/data/field/choice.cpp
src/data/field/choice.cpp
+0
-54
src/data/field/choice.hpp
src/data/field/choice.hpp
+0
-32
src/data/field/color.cpp
src/data/field/color.cpp
+0
-55
src/data/field/color.hpp
src/data/field/color.hpp
+0
-28
src/data/field/image.cpp
src/data/field/image.cpp
+0
-25
src/data/field/image.hpp
src/data/field/image.hpp
+0
-18
src/data/field/information.cpp
src/data/field/information.cpp
+1
-33
src/data/field/information.hpp
src/data/field/information.hpp
+0
-28
src/data/field/multiple_choice.cpp
src/data/field/multiple_choice.cpp
+0
-4
src/data/field/multiple_choice.hpp
src/data/field/multiple_choice.hpp
+0
-4
src/data/field/package_choice.cpp
src/data/field/package_choice.cpp
+0
-55
src/data/field/package_choice.hpp
src/data/field/package_choice.hpp
+0
-29
src/data/field/symbol.cpp
src/data/field/symbol.cpp
+1
-18
src/data/field/symbol.hpp
src/data/field/symbol.hpp
+1
-21
src/data/field/text.cpp
src/data/field/text.cpp
+0
-42
src/data/field/text.hpp
src/data/field/text.hpp
+0
-27
src/script/functions/construction.cpp
src/script/functions/construction.cpp
+0
-22
No files found.
src/data/action/value.cpp
View file @
d0ebfb28
...
...
@@ -39,27 +39,7 @@ void ValueAction::isOnCard(Card* card) {
// ----------------------------------------------------------------------------- : Simple
/// Swap the value in a Value object with a new one
#if !USE_SCRIPT_VALUE_CHOICE
inline
void
swap_value
(
ChoiceValue
&
a
,
ChoiceValue
::
ValueType
&
b
)
{
swap
(
a
.
value
,
b
);
}
#endif
#if !USE_SCRIPT_VALUE_COLOR
inline
void
swap_value
(
ColorValue
&
a
,
ColorValue
::
ValueType
&
b
)
{
swap
(
a
.
value
,
b
);
}
#endif
#if USE_SCRIPT_VALUE_VALUE
inline
void
swap_value
(
AnyValue
&
a
,
AnyValue
::
ValueType
&
b
)
{
swap
(
a
.
value
,
b
);
}
#endif
#if !USE_SCRIPT_VALUE_IMAGE
inline
void
swap_value
(
ImageValue
&
a
,
ImageValue
::
ValueType
&
b
)
{
swap
(
a
.
filename
,
b
);
}
#endif
#if !USE_SCRIPT_VALUE_SYMBOL
inline
void
swap_value
(
SymbolValue
&
a
,
SymbolValue
::
ValueType
&
b
)
{
swap
(
a
.
filename
,
b
);
}
#endif
#if !USE_SCRIPT_VALUE_TEXT
inline
void
swap_value
(
TextValue
&
a
,
TextValue
::
ValueType
&
b
)
{
swap
(
a
.
value
,
b
);
}
#endif
#if !USE_SCRIPT_VALUE_PACKAGE
inline
void
swap_value
(
PackageChoiceValue
&
a
,
PackageChoiceValue
::
ValueType
&
b
)
{
swap
(
a
.
package_name
,
b
);
}
#endif
/// A ValueAction that swaps between old and new values
template
<
typename
T
,
bool
ALLOW_MERGE
>
...
...
@@ -91,33 +71,11 @@ class SimpleValueAction : public ValueAction {
typename
T
::
ValueType
new_value
;
};
#if !USE_SCRIPT_VALUE_CHOICE
ValueAction
*
value_action
(
const
ChoiceValueP
&
value
,
const
Defaultable
<
String
>&
new_value
)
{
return
new
SimpleValueAction
<
ChoiceValue
,
true
>
(
value
,
new_value
);
}
#endif
#if !USE_SCRIPT_VALUE_COLOR
ValueAction
*
value_action
(
const
ColorValueP
&
value
,
const
Defaultable
<
Color
>&
new_value
)
{
return
new
SimpleValueAction
<
ColorValue
,
true
>
(
value
,
new_value
);
}
#endif
#if USE_SCRIPT_VALUE_VALUE
ValueAction
*
value_action
(
const
AnyValueP
&
value
,
const
ScriptValueP
&
new_value
)
{
return
new
SimpleValueAction
<
AnyValue
,
false
>
(
value
,
new_value
);
}
#endif
#if !USE_SCRIPT_VALUE_IMAGE
ValueAction
*
value_action
(
const
ImageValueP
&
value
,
const
FileName
&
new_value
)
{
return
new
SimpleValueAction
<
ImageValue
,
false
>
(
value
,
new_value
);
}
#endif
#if !USE_SCRIPT_VALUE_SYMBOL
ValueAction
*
value_action
(
const
SymbolValueP
&
value
,
const
FileName
&
new_value
)
{
return
new
SimpleValueAction
<
SymbolValue
,
false
>
(
value
,
new_value
);
}
#endif
#if !USE_SCRIPT_VALUE_PACKAGE
ValueAction
*
value_action
(
const
PackageChoiceValueP
&
value
,
const
String
&
new_value
)
{
return
new
SimpleValueAction
<
PackageChoiceValue
,
false
>
(
value
,
new_value
);
}
#endif
// ----------------------------------------------------------------------------- : MultipleChoice
#if USE_SCRIPT_VALUE_CHOICE
ValueAction
*
value_action
(
const
MultipleChoiceValueP
&
value
,
const
ScriptValueP
&
new_value
,
const
String
&
last_change
)
{
#else
ValueAction
*
value_action
(
const
MultipleChoiceValueP
&
value
,
const
Defaultable
<
String
>&
new_value
,
const
String
&
last_change
)
{
#endif
return
new
MultipleChoiceValueAction
(
value
,
new_value
,
last_change
);
}
...
...
@@ -133,11 +91,7 @@ void MultipleChoiceValueAction::perform(bool to_undo) {
// ----------------------------------------------------------------------------- : Text
#if USE_SCRIPT_VALUE_TEXT
TextValueAction
::
TextValueAction
(
const
TextValueP
&
value
,
size_t
start
,
size_t
end
,
size_t
new_end
,
const
ScriptValueP
&
new_value
,
const
String
&
name
)
#else
TextValueAction
::
TextValueAction
(
const
TextValueP
&
value
,
size_t
start
,
size_t
end
,
size_t
new_end
,
const
Defaultable
<
String
>&
new_value
,
const
String
&
name
)
#endif
:
ValueAction
(
value
)
,
selection_start
(
start
),
selection_end
(
end
),
new_selection_end
(
new_end
)
,
new_value
(
new_value
)
...
...
src/data/action/value.hpp
View file @
d0ebfb28
...
...
@@ -25,29 +25,10 @@ class LocalFileName;
DECLARE_POINTER_TYPE
(
Set
);
DECLARE_POINTER_TYPE
(
Value
);
DECLARE_POINTER_TYPE
(
Style
);
#if !USE_SCRIPT_VALUE_TEXT
DECLARE_POINTER_TYPE
(
TextValue
);
#else
DECLARE_POINTER_TYPE
(
AnyValue
);
typedef
AnyValue
TextValue
;
typedef
AnyValueP
TextValueP
;
#endif
#if !USE_SCRIPT_VALUE_CHOICE
DECLARE_POINTER_TYPE
(
ChoiceValue
);
#endif
DECLARE_POINTER_TYPE
(
MultipleChoiceValue
);
#if !USE_SCRIPT_VALUE_COLOR
DECLARE_POINTER_TYPE
(
ColorValue
);
#endif
#if !USE_SCRIPT_VALUE_IMAGE
DECLARE_POINTER_TYPE
(
ImageValue
);
#endif
#if !USE_SCRIPT_VALUE_SYMBOL
DECLARE_POINTER_TYPE
(
SymbolValue
);
#endif
#if !USE_SCRIPT_VALUE_PACKAGE
DECLARE_POINTER_TYPE
(
PackageChoiceValue
);
#endif
DECLARE_POINTER_TYPE
(
AnyValue
);
// ----------------------------------------------------------------------------- : ValueAction (based class)
...
...
@@ -73,37 +54,14 @@ class ValueAction : public Action {
// ----------------------------------------------------------------------------- : Simple
/// Action that updates a Value to a new value
#if !USE_SCRIPT_VALUE_CHOICE
ValueAction
*
value_action
(
const
ChoiceValueP
&
value
,
const
Defaultable
<
String
>&
new_value
);
ValueAction
*
value_action
(
const
MultipleChoiceValueP
&
value
,
const
Defaultable
<
String
>&
new_value
,
const
String
&
last_change
);
#else
ValueAction
*
value_action
(
const
MultipleChoiceValueP
&
value
,
const
ScriptValueP
&
new_value
,
const
String
&
last_change
);
#endif
#if !USE_SCRIPT_VALUE_COLOR
ValueAction
*
value_action
(
const
ColorValueP
&
value
,
const
Defaultable
<
Color
>&
new_value
);
#endif
#if !USE_SCRIPT_VALUE_IMAGE
ValueAction
*
value_action
(
const
ImageValueP
&
value
,
const
LocalFileName
&
new_value
);
#endif
#if !USE_SCRIPT_VALUE_SYMBOL
ValueAction
*
value_action
(
const
SymbolValueP
&
value
,
const
LocalFileName
&
new_value
);
#endif
#if !USE_SCRIPT_VALUE_PACKAGE
ValueAction
*
value_action
(
const
PackageChoiceValueP
&
value
,
const
String
&
new_value
);
#endif
#if USE_SCRIPT_VALUE_VALUE
ValueAction
*
value_action
(
const
AnyValueP
&
value
,
const
ScriptValueP
&
new_value
);
#endif
ValueAction
*
value_action
(
const
MultipleChoiceValueP
&
value
,
const
ScriptValueP
&
new_value
,
const
String
&
last_change
);
// ----------------------------------------------------------------------------- : MultipleChoice
class
MultipleChoiceValueAction
:
public
ValueAction
{
public:
#if USE_SCRIPT_VALUE_CHOICE
inline
MultipleChoiceValueAction
(
const
ValueP
&
value
,
const
ScriptValueP
&
new_value
,
const
String
&
changed_choice
)
#else
inline
MultipleChoiceValueAction
(
const
ValueP
&
value
,
const
Defaultable
<
String
>&
new_value
,
const
String
&
changed_choice
)
#endif
:
ValueAction
(
value
),
new_value
(
new_value
),
changed_choice
(
changed_choice
)
{}
...
...
@@ -111,11 +69,7 @@ class MultipleChoiceValueAction : public ValueAction {
const
String
changed_choice
;
///< What choice was toggled by this action (if any)
private:
#if USE_SCRIPT_VALUE_CHOICE
ScriptValueP
new_value
;
#else
Defaultable
<
String
>
new_value
;
#endif
};
// ----------------------------------------------------------------------------- : Text
...
...
@@ -123,21 +77,13 @@ class MultipleChoiceValueAction : public ValueAction {
/// An action that changes a TextValue
class
TextValueAction
:
public
ValueAction
{
public:
#if USE_SCRIPT_VALUE_TEXT
TextValueAction
(
const
TextValueP
&
value
,
size_t
start
,
size_t
end
,
size_t
new_end
,
const
ScriptValueP
&
new_value
,
const
String
&
name
);
#else
TextValueAction
(
const
TextValueP
&
value
,
size_t
start
,
size_t
end
,
size_t
new_end
,
const
Defaultable
<
String
>&
new_value
,
const
String
&
name
);
#endif
virtual
String
getName
(
bool
to_undo
)
const
;
virtual
void
perform
(
bool
to_undo
);
virtual
bool
merge
(
const
Action
&
action
);
#if USE_SCRIPT_VALUE_TEXT
inline
String
newValue
()
const
{
return
new_value
->
toString
();
}
#else
inline
const
String
&
newValue
()
const
{
return
new_value
();
}
#endif
/// The modified selection
size_t
selection_start
,
selection_end
;
...
...
@@ -145,11 +91,7 @@ class TextValueAction : public ValueAction {
inline
TextValue
&
value
()
const
;
size_t
new_selection_end
;
#if USE_SCRIPT_VALUE_TEXT
ScriptValueP
new_value
;
#else
Defaultable
<
String
>
new_value
;
#endif
String
name
;
};
...
...
src/data/field.cpp
View file @
d0ebfb28
...
...
@@ -382,7 +382,6 @@ void Writer::handle(ScriptValueP const& value) {
}
// ----------------------------------------------------------------------------- : AnyField
#if USE_SCRIPT_VALUE_VALUE
AnyField
::
AnyField
()
:
default_name
(
_
(
"Default"
))
...
...
@@ -452,5 +451,3 @@ IMPLEMENT_REFLECTION_NAMELESS(AnyValue) {
WITH_DYNAMIC_ARG
(
field_for_reading
,
fieldP
.
get
());
REFLECT_NAMELESS
(
value
);
}
#endif
src/data/field.hpp
View file @
d0ebfb28
...
...
@@ -34,18 +34,6 @@ DECLARE_POINTER_TYPE(ValueEditor);
// Value for which script updates are being run
DECLARE_DYNAMIC_ARG
(
Value
*
,
value_being_updated
);
// experimental: use ScriptValue to store any kind of value
// TODO: get rid of the conditional stuff
// TODO2: mergre Any{Field,Value} into {Field,Value}
#define USE_SCRIPT_VALUE_VALUE 1
#define USE_SCRIPT_VALUE_COLOR 1
#define USE_SCRIPT_VALUE_CHOICE 1
#define USE_SCRIPT_VALUE_INFO 1
#define USE_SCRIPT_VALUE_TEXT 1
#define USE_SCRIPT_VALUE_SYMBOL 1
#define USE_SCRIPT_VALUE_IMAGE 1
#define USE_SCRIPT_VALUE_PACKAGE 1
// ----------------------------------------------------------------------------- : Field
/// Information on how to store a value
...
...
@@ -327,10 +315,10 @@ inline String type_name(const Value&) {
void
mark_dependency_member
(
const
IndexMap
<
FieldP
,
ValueP
>&
value
,
const
String
&
name
,
const
Dependency
&
dep
);
#if USE_SCRIPT_VALUE_VALUE
// ----------------------------------------------------------------------------- : Value (new style)
/// Base class for fields whos values can be scripted
// TODO: merge into Field
class
AnyField
:
public
Field
{
public:
AnyField
();
...
...
@@ -346,6 +334,7 @@ class AnyField : public Field {
DECLARE_POINTER_TYPE
(
AnyField
)
/// A Value object that can hold something of 'any' type
// TODO: merge into Value
class
AnyValue
:
public
Value
{
public:
AnyValue
(
AnyFieldP
const
&
field
);
...
...
@@ -369,7 +358,5 @@ class AnyValue : public Value {
};
DECLARE_POINTER_TYPE
(
AnyValue
)
#endif
// ----------------------------------------------------------------------------- : EOF
#endif
src/data/field/boolean.cpp
View file @
d0ebfb28
...
...
@@ -15,22 +15,13 @@ BooleanField::BooleanField() {
choices
->
choices
.
push_back
(
intrusive
(
new
Choice
(
_
(
"true"
),
_
(
"yes"
))));
choices
->
choices
.
push_back
(
intrusive
(
new
Choice
(
_
(
"false"
),
_
(
"no"
))));
choices
->
initIds
();
#if USE_SCRIPT_VALUE_CHOICE
initial
=
script_true
;
#endif
}
IMPLEMENT_FIELD_TYPE
(
Boolean
,
"boolean"
);
IMPLEMENT_REFLECTION
(
BooleanField
)
{
#if USE_SCRIPT_VALUE_CHOICE
REFLECT_BASE
(
AnyField
);
// NOTE: don't reflect as a ChoiceField, TODO: why was that?
#else
REFLECT_BASE
(
Field
);
// NOTE: don't reflect as a ChoiceField
REFLECT
(
script
);
REFLECT_N
(
"default"
,
default_script
);
REFLECT
(
initial
);
#endif
REFLECT_BASE
(
AnyField
);
// NOTE: don't reflect as a ChoiceField, because we don't want to add extra choices
}
// ----------------------------------------------------------------------------- : BooleanStyle
...
...
src/data/field/choice.cpp
View file @
d0ebfb28
...
...
@@ -20,31 +20,12 @@ DECLARE_TYPEOF(map<String COMMA ScriptableImage>);
ChoiceField
::
ChoiceField
()
:
choices
((
Choice
*
)
new
Choice
)
#if !USE_SCRIPT_VALUE_CHOICE
,
default_name
(
_
(
"Default"
))
#endif
{}
IMPLEMENT_FIELD_TYPE
(
Choice
,
"choice"
);
#if !USE_SCRIPT_VALUE_CHOICE
void
ChoiceField
::
initDependencies
(
Context
&
ctx
,
const
Dependency
&
dep
)
const
{
Field
::
initDependencies
(
ctx
,
dep
);
script
.
initDependencies
(
ctx
,
dep
);
default_script
.
initDependencies
(
ctx
,
dep
);
}
#endif
IMPLEMENT_REFLECTION
(
ChoiceField
)
{
#if USE_SCRIPT_VALUE_CHOICE
REFLECT_BASE
(
AnyField
);
#else
REFLECT_BASE
(
Field
);
REFLECT
(
script
);
REFLECT_N
(
"default"
,
default_script
);
REFLECT
(
default_name
);
REFLECT
(
initial
);
#endif
REFLECT_N
(
"choices"
,
choices
->
choices
);
REFLECT_IF_READING
{
}
...
...
@@ -52,16 +33,11 @@ IMPLEMENT_REFLECTION(ChoiceField) {
REFLECT
(
choice_colors_cardlist
);
}
void
ChoiceField
::
after_reading
(
Version
ver
)
{
#if USE_SCRIPT_VALUE_CHOICE
AnyField
::
after_reading
(
ver
);
choices
->
initIds
();
if
(
initial
==
script_default_nil
&&
!
dynamic_cast
<
MultipleChoiceField
*>
(
this
))
{
initial
=
make_default
(
to_script
(
choices
->
choiceName
(
0
)));
}
#else
Field
::
after_reading
(
ver
);
choices
->
initIds
();
#endif
}
// ----------------------------------------------------------------------------- : ChoiceField::Choice
...
...
@@ -302,33 +278,3 @@ IMPLEMENT_REFLECTION(ChoiceStyle) {
REFLECT
(
choice_images
);
reflect_content
(
reflector
,
*
this
);
}
#if !USE_SCRIPT_VALUE_CHOICE
// ----------------------------------------------------------------------------- : ChoiceValue
IMPLEMENT_VALUE_CLONE
(
Choice
);
ChoiceValue
::
ChoiceValue
(
const
ChoiceFieldP
&
field
,
bool
initial_first_choice
)
:
Value
(
field
)
,
value
(
!
field
->
initial
.
empty
()
?
field
->
initial
:
initial_first_choice
?
field
->
choices
->
choiceName
(
0
)
:
_
(
""
)
,
true
)
{}
String
ChoiceValue
::
toFriendlyString
()
const
{
return
value
();
}
bool
ChoiceValue
::
update
(
Context
&
ctx
,
const
Action
*
)
{
bool
change
=
field
().
default_script
.
invokeOnDefault
(
ctx
,
value
)
|
field
().
script
.
invokeOn
(
ctx
,
value
);
Value
::
update
(
ctx
);
return
change
;
}
IMPLEMENT_REFLECTION_NAMELESS
(
ChoiceValue
)
{
if
(
fieldP
->
save_value
||
!
reflector
.
isWriting
())
REFLECT_NAMELESS
(
value
);
}
INSTANTIATE_REFLECTION_NAMELESS
(
ChoiceValue
)
#endif USE_SCRIPT_VALUE_CHOICE
src/data/field/choice.hpp
View file @
d0ebfb28
...
...
@@ -22,16 +22,9 @@
DECLARE_POINTER_TYPE
(
ChoiceField
);
DECLARE_POINTER_TYPE
(
ChoiceStyle
);
#if !USE_SCRIPT_VALUE_CHOICE
DECLARE_POINTER_TYPE
(
ChoiceValue
);
#endif
/// A field that contains a list of choices
#if USE_SCRIPT_VALUE_CHOICE
class
ChoiceField
:
public
AnyField
{
#else
class
ChoiceField
:
public
Field
{
#endif
public:
ChoiceField
();
DECLARE_FIELD_TYPE
();
...
...
@@ -43,14 +36,6 @@ class ChoiceField : public Field {
map
<
String
,
Color
>
choice_colors
;
///< Colors for the various choices (when color_cardlist)
map
<
String
,
Color
>
choice_colors_cardlist
;
///< Colors for the various choices, for in the card list
#if !USE_SCRIPT_VALUE_CHOICE
virtual
void
initDependencies
(
Context
&
,
const
Dependency
&
)
const
;
OptionalScript
script
;
///< Script to apply to all values
OptionalScript
default_script
;
///< Script that generates the default value
String
default_name
;
///< Name of "default" value
String
initial
;
///< Initial choice of a new value, or ""
#endif
virtual
void
after_reading
(
Version
ver
);
};
...
...
@@ -175,25 +160,8 @@ class ChoiceStyle : public Style {
// ----------------------------------------------------------------------------- : ChoiceValue
#if USE_SCRIPT_VALUE_CHOICE
typedef
AnyValue
ChoiceValue
;
typedef
AnyValueP
ChoiceValueP
;
#else
/// The Value in a ChoiceField
class
ChoiceValue
:
public
Value
{
public:
/// Create a value for the given field
/** If initial_first_choice then the first choice should be used in the absence of
an explicit initial value
*/
ChoiceValue
(
const
ChoiceFieldP
&
field
,
bool
initial_first_choice
=
true
);
DECLARE_VALUE_TYPE
(
Choice
,
Defaultable
<
String
>
);
ValueType
value
;
/// The name of the selected choice
virtual
bool
update
(
Context
&
,
const
Action
*
=
nullptr
);
};
#endif
// ----------------------------------------------------------------------------- : EOF
#endif
src/data/field/color.cpp
View file @
d0ebfb28
...
...
@@ -16,31 +16,12 @@ DECLARE_TYPEOF_COLLECTION(ColorField::ChoiceP);
ColorField
::
ColorField
()
:
allow_custom
(
true
)
#if !USE_SCRIPT_VALUE_COLOR
,
default_name
(
_
(
"Default"
))
#endif
{}
IMPLEMENT_FIELD_TYPE
(
Color
,
"color"
);
#if !USE_SCRIPT_VALUE_COLOR
void
ColorField
::
initDependencies
(
Context
&
ctx
,
const
Dependency
&
dep
)
const
{
Field
::
initDependencies
(
ctx
,
dep
);
script
.
initDependencies
(
ctx
,
dep
);
default_script
.
initDependencies
(
ctx
,
dep
);
}
#endif
IMPLEMENT_REFLECTION
(
ColorField
)
{
#if USE_SCRIPT_VALUE_COLOR
REFLECT_BASE
(
AnyField
);
#else
REFLECT_BASE
(
Field
);
REFLECT
(
script
);
REFLECT_N
(
"default"
,
default_script
);
REFLECT
(
default_name
);
REFLECT
(
initial
);
#endif
REFLECT
(
allow_custom
);
REFLECT
(
choices
);
}
...
...
@@ -80,39 +61,3 @@ IMPLEMENT_REFLECTION(ColorStyle) {
int
ColorStyle
::
update
(
Context
&
ctx
)
{
return
Style
::
update
(
ctx
);
}
// ----------------------------------------------------------------------------- : ColorValue
#if !USE_SCRIPT_VALUE_COLOR
IMPLEMENT_VALUE_CLONE
(
Color
);
ColorValue
::
ColorValue
(
const
ColorFieldP
&
field
)
:
Value
(
field
)
,
value
(
!
field
->
initial
.
isDefault
()
?
field
->
initial
()
:
!
field
->
choices
.
empty
()
?
field
->
choices
[
0
]
->
color
:
*
wxBLACK
,
true
)
{}
String
ColorValue
::
toFriendlyString
()
const
{
if
(
value
.
isDefault
())
return
field
().
default_name
;
// is this a named color?
FOR_EACH
(
c
,
field
().
choices
)
{
if
(
value
()
==
c
->
color
)
return
c
->
name
;
}
return
_
(
"<color>"
);
}
bool
ColorValue
::
update
(
Context
&
ctx
,
const
Action
*
)
{
bool
change
=
field
().
default_script
.
invokeOnDefault
(
ctx
,
value
)
|
field
().
script
.
invokeOn
(
ctx
,
value
);
Value
::
update
(
ctx
);
return
change
;
}
IMPLEMENT_REFLECTION_NAMELESS
(
ColorValue
)
{
if
(
fieldP
->
save_value
||
!
reflector
.
isWriting
())
REFLECT_NAMELESS
(
value
);
}
#endif
src/data/field/color.hpp
View file @
d0ebfb28
...
...
@@ -19,16 +19,9 @@
DECLARE_POINTER_TYPE
(
ColorField
);
DECLARE_POINTER_TYPE
(
ColorStyle
);
#if !USE_SCRIPT_VALUE_COLOR
DECLARE_POINTER_TYPE
(
ColorValue
);
#endif
/// A field for color values, it contains a list of choices for colors
#if USE_SCRIPT_VALUE_COLOR
class
ColorField
:
public
AnyField
{
#else
class
ColorField
:
public
Field
{
#endif
public:
ColorField
();
DECLARE_FIELD_TYPE
();
...
...
@@ -38,14 +31,6 @@ class ColorField : public Field {
vector
<
ChoiceP
>
choices
;
///< Color choices available
bool
allow_custom
;
///< Are colors not in the list of choices allowed?
#if !USE_SCRIPT_VALUE_COLOR
virtual
void
initDependencies
(
Context
&
,
const
Dependency
&
)
const
;
OptionalScript
script
;
///< Script to apply to all values
OptionalScript
default_script
;
///< Script that generates the default value
String
default_name
;
///< Name of "default" value
Defaultable
<
Color
>
initial
;
///< Initial choice of a new value, or ""
#endif
};
/// A color that can be chosen for this field
...
...
@@ -77,21 +62,8 @@ class ColorStyle : public Style {
// ----------------------------------------------------------------------------- : ColorValue
#if USE_SCRIPT_VALUE_COLOR
typedef
AnyValue
ColorValue
;
typedef
AnyValueP
ColorValueP
;
#else
/// The Value in a ColorField
class
ColorValue
:
public
Value
{
public:
ColorValue
(
const
ColorFieldP
&
field
);
DECLARE_VALUE_TYPE
(
Color
,
Defaultable
<
Color
>
);
ValueType
value
;
///< The value
virtual
bool
update
(
Context
&
,
const
Action
*
=
nullptr
);
};
#endif
// ----------------------------------------------------------------------------- : EOF
#endif
src/data/field/image.cpp
View file @
d0ebfb28
...
...
@@ -30,28 +30,3 @@ int ImageStyle::update(Context& ctx) {
return
Style
::
update
(
ctx
)
|
default_image
.
update
(
ctx
)
*
CHANGE_DEFAULT
;
}
// ----------------------------------------------------------------------------- : ImageValue
#if !USE_SCRIPT_VALUE_IMAGE
IMPLEMENT_VALUE_CLONE
(
Image
);
String
ImageValue
::
toFriendlyString
()
const
{
return
filename
.
empty
()
?
wxEmptyString
:
_
(
"<image>"
);
}
// custom reflection: convert to ScriptImageP for scripting
void
ImageValue
::
reflect
(
Reader
&
reflector
)
{
reflector
.
handle
(
filename
);
}
void
ImageValue
::
reflect
(
Writer
&
reflector
)
{
if
(
fieldP
->
save_value
)
reflector
.
handle
(
filename
);
}
void
ImageValue
::
reflect
(
GetMember
&
reflector
)
{}
void
ImageValue
::
reflect
(
GetDefaultMember
&
reflector
)
{
// convert to ScriptImageP for scripting
reflector
.
handle
(
(
ScriptValueP
)
intrusive
(
new
ImageValueToImage
(
filename
))
);
}
#endif
src/data/field/image.hpp
View file @
d0ebfb28
...
...
@@ -18,16 +18,9 @@
DECLARE_POINTER_TYPE
(
ImageField
);
DECLARE_POINTER_TYPE
(
ImageStyle
);
#if !USE_SCRIPT_VALUE_IMAGE
DECLARE_POINTER_TYPE
(
ImageValue
);
#endif
/// A field for image values
#if USE_SCRIPT_VALUE_IMAGE
class
ImageField
:
public
AnyField
{
#else
class
ImageField
:
public
Field
{
#endif
public:
// no extra data
DECLARE_FIELD_TYPE
();
...
...
@@ -48,19 +41,8 @@ class ImageStyle : public Style {
// ----------------------------------------------------------------------------- : ImageValue
#if USE_SCRIPT_VALUE_IMAGE
typedef
AnyValue
ImageValue
;
typedef
AnyValueP
ImageValueP
;
#else
/// The Value in a ImageField, i.e. an image
class
ImageValue
:
public
Value
{
public:
inline
ImageValue
(
const
ImageFieldP
&
field
)
:
Value
(
field
)
{}
DECLARE_VALUE_TYPE
(
Image
,
FileName
);
ValueType
filename
;
///< Filename of the image (in the current package), or ""
};
#endif
// ----------------------------------------------------------------------------- : EOF
#endif
src/data/field/information.cpp
View file @
d0ebfb28
...
...
@@ -14,27 +14,15 @@
IMPLEMENT_FIELD_TYPE
(
Info
,
"info"
);
#if USE_SCRIPT_VALUE_INFO
IMPLEMENT_REFLECTION
(
InfoField
)
{
REFLECT_BASE
(
AnyField
);
}
void
InfoField
::
after_reading
(
Version
ver
)
{
AnyField
::
after_reading
(
ver
);
if
(
initial
==
script_default_nil
)
initial
=
to_script
(
caption
);
initial
=
make_default
(
initial
);
}
#else
void
InfoField
::
initDependencies
(
Context
&
ctx
,
const
Dependency
&
dep
)
const
{
Field
::
initDependencies
(
ctx
,
dep
);
script
.
initDependencies
(
ctx
,
dep
);
}
IMPLEMENT_REFLECTION
(
InfoField
)
{
REFLECT_BASE
(
Field
);
REFLECT
(
script
);
}
#endif
// ----------------------------------------------------------------------------- : InfoStyle
...
...
@@ -67,23 +55,3 @@ IMPLEMENT_REFLECTION(InfoStyle) {
REFLECT
(
padding_bottom
);
REFLECT
(
background_color
);
}
#if !USE_SCRIPT_VALUE_INFO
// ----------------------------------------------------------------------------- : InfoValue
IMPLEMENT_VALUE_CLONE
(
Info
);
String
InfoValue
::
toFriendlyString
()
const
{
return
value
;
}
bool
InfoValue
::
update
(
Context
&
ctx
,
const
Action
*
)
{
if
(
value
.
empty
())
value
=
field
().
caption
;
bool
change
=
field
().
script
.
invokeOn
(
ctx
,
value
);
Value
::
update
(
ctx
);
return
change
;
}
IMPLEMENT_REFLECTION_NAMELESS
(
InfoValue
)
{
// never save
}
#endif
src/data/field/information.hpp
View file @
d0ebfb28
...
...
@@ -19,31 +19,16 @@
DECLARE_POINTER_TYPE
(
InfoField
);
DECLARE_POINTER_TYPE
(
InfoStyle
);
#if !USE_SCRIPT_VALUE_INFO
DECLARE_POINTER_TYPE
(
InfoValue
);
#endif
/// A field for informational values.
/** These values are not editable, they are just headers, icons, labels, etc.
*/
#if USE_SCRIPT_VALUE_INFO
class
InfoField
:
public
AnyField
{
public:
InfoField
()
{
editable
=
false
;
}
DECLARE_FIELD_TYPE
();
virtual
void
after_reading
(
Version
ver
);
};
#else
class
InfoField
:
public
Field
{
public:
InfoField
()
{
editable
=
false
;
}
DECLARE_FIELD_TYPE
();
OptionalScript
script
;
///< Script to apply to all values
virtual
void
initDependencies
(
Context
&
,
const
Dependency
&
)
const
;
};
#endif
// ----------------------------------------------------------------------------- : InfoStyle
...
...
@@ -65,21 +50,8 @@ class InfoStyle : public Style {
// ----------------------------------------------------------------------------- : InfoValue
#if USE_SCRIPT_VALUE_INFO
typedef
AnyValue
InfoValue
;
typedef
AnyValueP
InfoValueP
;
#else
/// The Value in a InfoField
class
InfoValue
:
public
Value
{
public:
inline
InfoValue
(
const
InfoFieldP
&
field
)
:
Value
(
field
)
{}
DECLARE_VALUE_TYPE
(
Info
,
String
);
ValueType
value
;
virtual
bool
update
(
Context
&
,
const
Action
*
=
nullptr
);
};
#endif
// ----------------------------------------------------------------------------- : EOF
#endif
src/data/field/multiple_choice.cpp
View file @
d0ebfb28
...
...
@@ -118,9 +118,5 @@ void MultipleChoiceValue::normalForm() {
val
=
field
().
empty_choice
;
}
// store
#if USE_SCRIPT_VALUE_CHOICE
value
=
with_defaultness_of
(
value
,
to_script
(
val
));
#else
value
.
assignDontChangeDefault
(
val
);
#endif
}
src/data/field/multiple_choice.hpp
View file @
d0ebfb28
...
...
@@ -50,11 +50,7 @@ class MultipleChoiceStyle : public ChoiceStyle {
*/
class
MultipleChoiceValue
:
public
ChoiceValue
{
public:
#if USE_SCRIPT_VALUE_CHOICE
inline
MultipleChoiceValue
(
const
MultipleChoiceFieldP
&
field
)
:
ChoiceValue
(
field
)
{}
#else
inline
MultipleChoiceValue
(
const
MultipleChoiceFieldP
&
field
)
:
ChoiceValue
(
field
,
false
)
{}
#endif
DECLARE_HAS_FIELD
(
MultipleChoice
);
virtual
ValueP
clone
()
const
;
...
...
src/data/field/package_choice.cpp
View file @
d0ebfb28
...
...
@@ -14,21 +14,8 @@
IMPLEMENT_FIELD_TYPE
(
PackageChoice
,
"package choice"
);
#if !USE_SCRIPT_VALUE_PACKAGE
void
PackageChoiceField
::
initDependencies
(
Context
&
ctx
,
const
Dependency
&
dep
)
const
{
Field
::
initDependencies
(
ctx
,
dep
);
script
.
initDependencies
(
ctx
,
dep
);
}
#endif
IMPLEMENT_REFLECTION
(
PackageChoiceField
)
{
#if USE_SCRIPT_VALUE_CHOICE
REFLECT_BASE
(
AnyField
);
#else
REFLECT_BASE
(
Field
);
REFLECT
(
script
);
REFLECT
(
initial
);
#endif
REFLECT
(
match
);
REFLECT
(
required
);
REFLECT
(
empty_name
);
...
...
@@ -53,45 +40,3 @@ IMPLEMENT_REFLECTION(PackageChoiceStyle) {
REFLECT_BASE
(
Style
);
REFLECT
(
font
);
}
// ----------------------------------------------------------------------------- : PackageChoiceValue
#if !USE_SCRIPT_VALUE_PACKAGE
IMPLEMENT_VALUE_CLONE
(
PackageChoice
);
String
PackageChoiceValue
::
toFriendlyString
()
const
{
PackagedP
pack
=
getPackage
();
if
(
pack
.
get
())
return
pack
->
short_name
;
else
return
_
(
""
);
}
PackagedP
PackageChoiceValue
::
getPackage
()
const
{
if
(
package_name
.
empty
())
return
nullptr
;
else
return
package_manager
.
openAny
(
package_name
,
true
);
}
bool
PackageChoiceValue
::
update
(
Context
&
ctx
,
const
Action
*
act
)
{
bool
change
=
field
().
script
.
invokeOn
(
ctx
,
package_name
);
Value
::
update
(
ctx
,
act
);
return
change
;
}
void
PackageChoiceValue
::
reflect
(
Reader
&
reflector
)
{
REFLECT_NAMELESS
(
package_name
);
}
void
PackageChoiceValue
::
reflect
(
Writer
&
reflector
)
{
REFLECT_NAMELESS
(
package_name
);
}
void
PackageChoiceValue
::
reflect
(
GetDefaultMember
&
reflector
)
{
if
(
package_name
.
empty
())
{
REFLECT_NAMELESS
(
package_name
);
}
else
if
(
package_name
!=
field
().
initial
)
{
// add a space to the name, to indicate the dependency doesn't have to be marked
// see also PackageManager::openFileFromPackage and SymbolFontRef::loadFont
REFLECT_NAMELESS
(
_
(
"/:NO-WARN-DEP:"
)
+
package_name
);
}
else
{
REFLECT_NAMELESS
(
_
(
"/"
)
+
package_name
);
}
}
void
PackageChoiceValue
::
reflect
(
GetMember
&
reflector
)
{}
#endif
src/data/field/package_choice.hpp
View file @
d0ebfb28
...
...
@@ -20,16 +20,9 @@ DECLARE_POINTER_TYPE(Packaged);
DECLARE_POINTER_TYPE
(
PackageChoiceField
);
DECLARE_POINTER_TYPE
(
PackageChoiceStyle
);
#if !USE_SCRIPT_VALUE_PACKAGE
DECLARE_POINTER_TYPE
(
PackageChoiceValue
);
#endif
/// A field for PackageChoice values, it contains a list of choices for PackageChoices
#if USE_SCRIPT_VALUE_PACKAGE
class
PackageChoiceField
:
public
AnyField
{
#else
class
PackageChoiceField
:
public
Field
{
#endif
public:
PackageChoiceField
()
:
required
(
true
),
empty_name
(
_
(
"none"
))
{}
DECLARE_FIELD_TYPE
();
...
...
@@ -37,12 +30,6 @@ class PackageChoiceField : public Field {
String
match
;
///< Glob of package filenames to match
bool
required
;
///< Is selecting a package required?
String
empty_name
;
///< Displayed name for the empty value (if !required)
#if !USE_SCRIPT_VALUE_PACKAGE
OptionalScript
script
;
///< Script to apply to all values
String
initial
;
///< Initial value
virtual
void
initDependencies
(
Context
&
,
const
Dependency
&
)
const
;
#endif
};
// ----------------------------------------------------------------------------- : PackageChoiceStyle
...
...
@@ -60,24 +47,8 @@ class PackageChoiceStyle : public Style {
// ----------------------------------------------------------------------------- : PackageChoiceValue
#if USE_SCRIPT_VALUE_PACKAGE
typedef
AnyValue
PackageChoiceValue
;
typedef
AnyValueP
PackageChoiceValueP
;
#else
/// The Value in a PackageChoiceField
class
PackageChoiceValue
:
public
Value
{
public:
PackageChoiceValue
(
const
PackageChoiceFieldP
&
field
)
:
Value
(
field
),
package_name
(
field
->
initial
)
{}
DECLARE_VALUE_TYPE
(
PackageChoice
,
String
);
ValueType
package_name
;
///< The selected package
/// Get the package (if it is set)
PackagedP
getPackage
()
const
;
virtual
bool
update
(
Context
&
,
const
Action
*
=
nullptr
);
};
#endif
// ----------------------------------------------------------------------------- : EOF
#endif
src/data/field/symbol.cpp
View file @
d0ebfb28
...
...
@@ -45,9 +45,7 @@ IMPLEMENT_REFLECTION_NO_SCRIPT(SymbolVariation) {
REFLECT_NAMELESS
(
filter
);
}
// ----------------------------------------------------------------------------- : SymbolValue
#if USE_SCRIPT_VALUE_SYMBOL
// ----------------------------------------------------------------------------- : LocalSymbolFile
ScriptValueP
script_local_symbol_file
(
LocalFileName
const
&
filename
)
{
return
intrusive
(
new
LocalSymbolFile
(
filename
));
...
...
@@ -68,18 +66,3 @@ GeneratedImageP LocalSymbolFile::toImage() const {
String
LocalSymbolFile
::
toFriendlyString
()
const
{
return
_
(
"<"
)
+
_TYPE_
(
"symbol"
)
+
_
(
">"
);
}
#else
IMPLEMENT_VALUE_CLONE
(
Symbol
);
String
SymbolValue
::
toFriendlyString
()
const
{
return
filename
.
empty
()
?
wxEmptyString
:
_
(
"<symbol>"
);
}
IMPLEMENT_REFLECTION_NO_GET_MEMBER
(
SymbolValue
)
{
if
(
fieldP
->
save_value
||
!
reflector
.
isWriting
())
REFLECT_NAMELESS
(
filename
);
}
void
SymbolValue
::
reflect
(
GetMember
&
)
{}
void
SymbolValue
::
reflect
(
GetDefaultMember
&
)
{}
#endif
src/data/field/symbol.hpp
View file @
d0ebfb28
...
...
@@ -15,23 +15,15 @@
DECLARE_POINTER_TYPE
(
SymbolFilter
);
DECLARE_POINTER_TYPE
(
SymbolVariation
);
DECLARE_POINTER_TYPE
(
LocalSymbolFile
);
// ----------------------------------------------------------------------------- : SymbolField
DECLARE_POINTER_TYPE
(
SymbolField
);
DECLARE_POINTER_TYPE
(
SymbolStyle
);
#if USE_SCRIPT_VALUE_SYMBOL
DECLARE_POINTER_TYPE
(
LocalSymbolFile
);
#else
DECLARE_POINTER_TYPE
(
SymbolValue
);
#endif
/// A field for image values
#if USE_SCRIPT_VALUE_SYMBOL
class
SymbolField
:
public
AnyField
{
#else
class
SymbolField
:
public
Field
{
#endif
public:
DECLARE_FIELD_TYPE
();
...
...
@@ -70,7 +62,6 @@ class SymbolVariation : public IntrusivePtrBase<SymbolVariation> {
// ----------------------------------------------------------------------------- : SymbolValue
#if USE_SCRIPT_VALUE_SYMBOL
typedef
AnyValue
SymbolValue
;
typedef
AnyValueP
SymbolValueP
;
...
...
@@ -88,16 +79,5 @@ class LocalSymbolFile : public ScriptValue {
LocalFileName
filename
;
// not empty
};
#else
/// The Value in a SymbolField, i.e. a symbol
class
SymbolValue
:
public
Value
{
public:
inline
SymbolValue
(
const
SymbolFieldP
&
field
)
:
Value
(
field
)
{}
DECLARE_VALUE_TYPE
(
Symbol
,
FileName
);
ValueType
filename
;
///< Filename of the symbol (in the current package)
};
#endif
// ----------------------------------------------------------------------------- : EOF
#endif
src/data/field/text.cpp
View file @
d0ebfb28
...
...
@@ -15,31 +15,13 @@
TextField
::
TextField
()
:
multi_line
(
false
)
#if !USE_SCRIPT_VALUE_TEXT
,
default_name
(
_
(
"Default"
))
#endif
{}
IMPLEMENT_FIELD_TYPE
(
Text
,
"text"
);
#if !USE_SCRIPT_VALUE_TEXT
void
TextField
::
initDependencies
(
Context
&
ctx
,
const
Dependency
&
dep
)
const
{
Field
::
initDependencies
(
ctx
,
dep
);
script
.
initDependencies
(
ctx
,
dep
);
default_script
.
initDependencies
(
ctx
,
dep
);
}
#endif
IMPLEMENT_REFLECTION
(
TextField
)
{
#if USE_SCRIPT_VALUE_TEXT
REFLECT_BASE
(
AnyField
);
#else
REFLECT_BASE
(
Field
);
REFLECT
(
script
);
REFLECT_N
(
"default"
,
default_script
);
REFLECT
(
default_name
);
#endif
REFLECT
(
multi_line
);
}
...
...
@@ -138,30 +120,6 @@ IMPLEMENT_REFLECTION(TextStyle) {
reflect_content
(
reflector
,
*
this
);
}
// ----------------------------------------------------------------------------- : TextValue
#if !USE_SCRIPT_VALUE_TEXT
IMPLEMENT_VALUE_CLONE
(
Text
);
String
TextValue
::
toFriendlyString
()
const
{
return
untag_hide_sep
(
value
());
}
bool
TextValue
::
update
(
Context
&
ctx
,
const
Action
*
)
{
WITH_DYNAMIC_ARG
(
last_update_age
,
last_modified
.
get
());
WITH_DYNAMIC_ARG
(
value_being_updated
,
this
);
bool
change
=
field
().
default_script
.
invokeOnDefault
(
ctx
,
value
)
|
field
().
script
.
invokeOn
(
ctx
,
value
);
updateSortValue
(
ctx
);
return
change
;
}
IMPLEMENT_REFLECTION_NAMELESS
(
TextValue
)
{
if
(
fieldP
->
save_value
||
!
reflector
.
isWriting
())
REFLECT_NAMELESS
(
value
);
}
#endif
// ----------------------------------------------------------------------------- : FakeTextValue
FakeTextValue
::
FakeTextValue
(
const
TextFieldP
&
field
,
String
*
underlying
,
bool
editable
,
bool
untagged
)
...
...
src/data/field/text.hpp
View file @
d0ebfb28
...
...
@@ -24,28 +24,14 @@
DECLARE_POINTER_TYPE
(
TextField
);
DECLARE_POINTER_TYPE
(
TextStyle
);
#if !USE_SCRIPT_VALUE_TEXT
DECLARE_POINTER_TYPE
(
TextValue
);
#endif
/// A field for values containing tagged text
#if USE_SCRIPT_VALUE_TEXT
class
TextField
:
public
AnyField
{
#else
class
TextField
:
public
Field
{
#endif
public:
TextField
();
DECLARE_FIELD_TYPE
();
bool
multi_line
;
///< Are newlines allowed in the text?
#if !USE_SCRIPT_VALUE_TEXT
OptionalScript
script
;
///< Script to apply to all values
OptionalScript
default_script
;
///< Script that generates the default value
String
default_name
;
///< Name of "default" value
virtual
void
initDependencies
(
Context
&
,
const
Dependency
&
)
const
;
#endif
};
// ----------------------------------------------------------------------------- : TextStyle
...
...
@@ -88,21 +74,8 @@ class TextStyle : public Style {
// ----------------------------------------------------------------------------- : TextValue
#if USE_SCRIPT_VALUE_TEXT
typedef
AnyValue
TextValue
;
typedef
AnyValueP
TextValueP
;
#else
/// The Value in a TextField
class
TextValue
:
public
Value
{
public:
inline
TextValue
(
const
TextFieldP
&
field
)
:
Value
(
field
)
{}
DECLARE_VALUE_TYPE
(
Text
,
Defaultable
<
String
>
);
ValueType
value
;
///< The text of this value
virtual
bool
update
(
Context
&
,
const
Action
*
=
nullptr
);
};
#endif
// ----------------------------------------------------------------------------- : TextValue
...
...
src/script/functions/construction.cpp
View file @
d0ebfb28
...
...
@@ -37,31 +37,9 @@ SCRIPT_FUNCTION(new_card) {
}
Value
*
value
=
value_it
->
get
();
// set the value
#if !USE_SCRIPT_VALUE_TEXT
if
(
TextValue
*
tvalue
=
dynamic_cast
<
TextValue
*>
(
value
))
{
tvalue
->
value
=
v
->
toString
();
}
else
#endif
#if !USE_SCRIPT_VALUE_CHOICE
if
(
ChoiceValue
*
cvalue
=
dynamic_cast
<
ChoiceValue
*>
(
value
))
{
cvalue
->
value
=
v
->
toString
();
}
else
#endif
#if !USE_SCRIPT_VALUE_PACKAGE
if
(
PackageChoiceValue
*
pvalue
=
dynamic_cast
<
PackageChoiceValue
*>
(
value
))
{
pvalue
->
package_name
=
v
->
toString
();
}
else
#endif
#if !USE_SCRIPT_VALUE_COLOR
if
(
ColorValue
*
cvalue
=
dynamic_cast
<
ColorValue
*>
(
value
))
{
cvalue
->
value
=
v
->
toColor
();
}
else
#endif
#if USE_SCRIPT_VALUE_VALUE
if
(
AnyValue
*
avalue
=
dynamic_cast
<
AnyValue
*>
(
value
))
{
avalue
->
value
=
v
;
}
else
#endif
{
throw
ScriptError
(
format_string
(
_
(
"Can not set value '%s', it is not of the right type"
),
name
));
}
...
...
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