mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
Use std::enable_shared_from_this instead of thisP parameters.
This commit is contained in:
@@ -34,7 +34,7 @@ DataEditor::DataEditor(Window* parent, int id, long style)
|
||||
}
|
||||
|
||||
ValueViewerP DataEditor::makeViewer(const StyleP& style) {
|
||||
return style->makeEditor(*this, style);
|
||||
return style->makeEditor(*this);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------- : Utility for ValueViewers
|
||||
|
||||
@@ -504,7 +504,7 @@ void ConsolePanel::exec(String const& command) {
|
||||
ScriptType type = result->type();
|
||||
if (type == SCRIPT_IMAGE) {
|
||||
GeneratedImage::Options options(0,0, set->stylesheet.get(), set.get());
|
||||
wxImage image = result->toImage(result)->generate(options);
|
||||
wxImage image = result->toImage()->generate(options);
|
||||
message->bitmap = wxBitmap(image);
|
||||
} else if (type == SCRIPT_COLOR) {
|
||||
message->text = result->toCode();
|
||||
|
||||
@@ -152,7 +152,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")));
|
||||
|
||||
@@ -144,9 +144,8 @@ class ValueEditor {
|
||||
public:
|
||||
|
||||
#define IMPLEMENT_VALUE_EDITOR(Type) \
|
||||
ValueViewerP Type##Style::makeEditor(DataEditor& parent, const StyleP& thisP) { \
|
||||
assert(thisP.get() == this); \
|
||||
return ValueViewerP(new Type##ValueEditor(parent, static_pointer_cast<Type##Style>(thisP))); \
|
||||
ValueViewerP Type##Style::makeEditor(DataEditor& parent) { \
|
||||
return ValueViewerP(new Type##ValueEditor(parent, static_pointer_cast<Type##Style>(intrusive_from_this()))); \
|
||||
} \
|
||||
Type##ValueEditor::Type##ValueEditor(DataEditor& parent, const Type##StyleP& style) \
|
||||
: Type##ValueViewer(parent, style)
|
||||
|
||||
Reference in New Issue
Block a user