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
0860db16
Commit
0860db16
authored
Mar 30, 2011
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use ->toImage() instead of image_from_script function.
parent
f3aac625
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
5 additions
and
18 deletions
+5
-18
src/gui/value/choice.cpp
src/gui/value/choice.cpp
+1
-1
src/script/functions/export.cpp
src/script/functions/export.cpp
+1
-1
src/script/functions/image.cpp
src/script/functions/image.cpp
+1
-5
src/script/image.cpp
src/script/image.cpp
+1
-8
src/script/image.hpp
src/script/image.hpp
+0
-3
src/script/to_value.hpp
src/script/to_value.hpp
+1
-0
No files found.
src/gui/value/choice.cpp
View file @
0860db16
...
...
@@ -183,7 +183,7 @@ void DropDownChoiceListBase::generateThumbnailImages() {
try
{
String
name
=
canonical_name_form
(
field
().
choices
->
choiceName
(
i
));
ctx
.
setVariable
(
_
(
"input"
),
to_script
(
name
));
GeneratedImageP
img
=
image_from_script
(
style
().
image
.
getValidScriptP
()
->
eval
(
ctx
)
);
GeneratedImageP
img
=
style
().
image
.
getValidScriptP
()
->
eval
(
ctx
)
->
toImage
(
);
style
().
choice_images
.
insert
(
make_pair
(
name
,
ScriptableImage
(
img
)));
}
catch
(
const
Error
&
e
)
{
handle_error
(
Error
(
e
.
what
()
+
_
(
"
\n
while generating choice images for drop down list"
)));
...
...
src/script/functions/export.cpp
View file @
0860db16
...
...
@@ -421,7 +421,7 @@ SCRIPT_FUNCTION(write_image_file) {
if
(
card
)
{
image
=
conform_image
(
export_bitmap
(
ei
.
set
,
card
->
getValue
()).
ConvertToImage
(),
options
);
}
else
{
image
=
i
mage_from_script
(
input
)
->
generateConform
(
options
);
image
=
i
nput
->
toImage
(
)
->
generateConform
(
options
);
}
if
(
!
image
.
Ok
())
throw
Error
(
_
(
"Unable to generate image for file "
)
+
file
);
// write
...
...
src/script/functions/image.cpp
View file @
0860db16
...
...
@@ -25,10 +25,6 @@ void parse_enum(const String&, ImageCombine& out);
// ----------------------------------------------------------------------------- : Utility
template
<>
inline
GeneratedImageP
from_script
<
GeneratedImageP
>
(
const
ScriptValueP
&
value
)
{
return
image_from_script
(
value
);
}
SCRIPT_FUNCTION
(
to_image
)
{
SCRIPT_PARAM_C
(
GeneratedImageP
,
input
);
return
input
;
...
...
@@ -156,7 +152,7 @@ SCRIPT_FUNCTION(symbol_variation) {
}
else
if
(
valueO
)
{
throw
ScriptErrorConversion
(
valueO
->
typeName
(),
_TYPE_
(
"symbol"
));
}
else
{
filename
=
from_script
<
String
>
(
symbol
);
filename
=
symbol
->
toString
(
);
}
// known variation?
SCRIPT_OPTIONAL_PARAM_
(
String
,
variation
)
...
...
src/script/image.cpp
View file @
0860db16
...
...
@@ -15,13 +15,6 @@
#include <gfx/generated_image.hpp>
#include <data/field/image.hpp>
// ----------------------------------------------------------------------------- : Utility
// convert any script value to a GeneratedImageP
GeneratedImageP
image_from_script
(
const
ScriptValueP
&
value
)
{
return
value
->
toImage
();
}
// ----------------------------------------------------------------------------- : ScriptableImage
Image
ScriptableImage
::
generate
(
const
GeneratedImage
::
Options
&
options
)
const
{
...
...
@@ -50,7 +43,7 @@ ImageCombine ScriptableImage::combine() const {
bool
ScriptableImage
::
update
(
Context
&
ctx
)
{
if
(
!
isScripted
())
return
false
;
GeneratedImageP
new_value
=
image_from_script
(
script
.
invoke
(
ctx
)
);
GeneratedImageP
new_value
=
script
.
invoke
(
ctx
)
->
toImage
(
);
if
(
!
new_value
||
!
value
||
*
new_value
!=
*
value
)
{
value
=
new_value
;
return
true
;
...
...
src/script/image.hpp
View file @
0860db16
...
...
@@ -71,9 +71,6 @@ class ScriptableImage {
/// Missing for now
inline
ScriptValueP
to_script
(
const
ScriptableImage
&
)
{
return
script_nil
;
}
/// Convert a script value to a GeneratedImageP
GeneratedImageP
image_from_script
(
const
ScriptValueP
&
value
);
// ----------------------------------------------------------------------------- : CachedScriptableImage
/// A version of ScriptableImage that does caching
...
...
src/script/to_value.hpp
View file @
0860db16
...
...
@@ -429,6 +429,7 @@ template <> inline bool from_script<bool> (const ScriptValueP& va
template
<>
inline
Color
from_script
<
Color
>
(
const
ScriptValueP
&
value
)
{
return
value
->
toColor
();
}
template
<>
inline
AColor
from_script
<
AColor
>
(
const
ScriptValueP
&
value
)
{
return
value
->
toColor
();
}
template
<>
inline
wxDateTime
from_script
<
wxDateTime
>
(
const
ScriptValueP
&
value
)
{
return
value
->
toDateTime
();
}
template
<>
inline
GeneratedImageP
from_script
<
GeneratedImageP
>
(
const
ScriptValueP
&
value
)
{
return
value
->
toImage
();
}
// ----------------------------------------------------------------------------- : EOF
#endif
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