mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-12 13:37:00 -04:00
Compatibility update (escaped trigraphs) (yay for unused standard features)
Used real casting in ChoiceThumbnailRequest (can now bactrace card list errors properly) git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@509 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -165,7 +165,7 @@ class SetCombineImage : public GeneratedImage {
|
|||||||
class EnlargeImage : public GeneratedImage {
|
class EnlargeImage : public GeneratedImage {
|
||||||
public:
|
public:
|
||||||
inline EnlargeImage(const GeneratedImageP& image, double border_size)
|
inline EnlargeImage(const GeneratedImageP& image, double border_size)
|
||||||
: image(image), border_size(abs(border_size))
|
: image(image), border_size(fabs(border_size))
|
||||||
{}
|
{}
|
||||||
virtual Image generate(const Options& opt) const;
|
virtual Image generate(const Options& opt) const;
|
||||||
virtual ImageCombine combine() const;
|
virtual ImageCombine combine() const;
|
||||||
|
|||||||
+13
-11
@@ -33,7 +33,7 @@ class ChoiceThumbnailRequest : public ThumbnailRequest {
|
|||||||
|
|
||||||
ChoiceThumbnailRequest::ChoiceThumbnailRequest(ValueViewer* cve, int id, bool from_disk)
|
ChoiceThumbnailRequest::ChoiceThumbnailRequest(ValueViewer* cve, int id, bool from_disk)
|
||||||
: ThumbnailRequest(
|
: ThumbnailRequest(
|
||||||
cve,
|
reinterpret_cast<void *> (cve),
|
||||||
cve->viewer.stylesheet->name() + _("/") + cve->getField()->name + _("/") << id,
|
cve->viewer.stylesheet->name() + _("/") + cve->getField()->name + _("/") << id,
|
||||||
from_disk ? cve->viewer.stylesheet->lastModified()
|
from_disk ? cve->viewer.stylesheet->lastModified()
|
||||||
: wxDateTime::Now()
|
: wxDateTime::Now()
|
||||||
@@ -41,24 +41,26 @@ ChoiceThumbnailRequest::ChoiceThumbnailRequest(ValueViewer* cve, int id, bool fr
|
|||||||
, stylesheet(cve->viewer.stylesheet)
|
, stylesheet(cve->viewer.stylesheet)
|
||||||
, id(id)
|
, id(id)
|
||||||
{
|
{
|
||||||
ChoiceValueEditor e = *(ChoiceValueEditor*)cve;
|
ChoiceValueEditor* e = dynamic_cast<ChoiceValueEditor*> (cve);
|
||||||
String name = cannocial_name_form(e.field().choices->choiceName(id));
|
if (!e)
|
||||||
ScriptableImage img = e.style().choice_images[name];
|
throw InternalError(_("Non-editor passed to ChoiceThumbnailRequest"));
|
||||||
|
String name = cannocial_name_form(e->field().choices->choiceName(id));
|
||||||
|
ScriptableImage img = e->style().choice_images[name];
|
||||||
isThreadSafe = img.threadSafe();
|
isThreadSafe = img.threadSafe();
|
||||||
}
|
}
|
||||||
|
|
||||||
Image ChoiceThumbnailRequest::generate() {
|
Image ChoiceThumbnailRequest::generate() {
|
||||||
ChoiceValueEditor& cve = *(ChoiceValueEditor*)owner;
|
ChoiceValueEditor* cve = reinterpret_cast<ChoiceValueEditor*> (owner);
|
||||||
String name = cannocial_name_form(cve.field().choices->choiceName(id));
|
String name = cannocial_name_form(cve->field().choices->choiceName(id));
|
||||||
ScriptableImage& img = cve.style().choice_images[name];
|
ScriptableImage& img = cve->style().choice_images[name];
|
||||||
return img.isReady()
|
return img.isReady()
|
||||||
? img.generate(GeneratedImage::Options(16,16, stylesheet.get(), &cve.getSet(), ASPECT_BORDER, true), false)
|
? img.generate(GeneratedImage::Options(16,16, stylesheet.get(), &cve->getSet(), ASPECT_BORDER, true), false)
|
||||||
: wxImage();
|
: wxImage();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChoiceThumbnailRequest::store(const Image& img) {
|
void ChoiceThumbnailRequest::store(const Image& img) {
|
||||||
ChoiceValueEditor& cve = *(ChoiceValueEditor*)owner;
|
ChoiceValueEditor* cve = reinterpret_cast<ChoiceValueEditor*> (owner);
|
||||||
wxImageList* il = cve.style().thumbnails;
|
wxImageList* il = cve->style().thumbnails;
|
||||||
while (id > il->GetImageCount()) {
|
while (id > il->GetImageCount()) {
|
||||||
il->Add(wxBitmap(16,16),*wxBLACK);
|
il->Add(wxBitmap(16,16),*wxBLACK);
|
||||||
}
|
}
|
||||||
@@ -89,7 +91,7 @@ void ChoiceThumbnailRequest::store(const Image& img) {
|
|||||||
} else {
|
} else {
|
||||||
il->Replace(id, img);
|
il->Replace(id, img);
|
||||||
}
|
}
|
||||||
cve.style().thumbnails_status[id] = THUMB_OK;
|
cve->style().thumbnails_status[id] = THUMB_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -134,15 +134,15 @@ ScriptValueP Context::eval(const Script& script, bool useScope) {
|
|||||||
if (instr_bt->instr == I_GET_VAR) {
|
if (instr_bt->instr == I_GET_VAR) {
|
||||||
throw ScriptError(e.what() + _("\n in function: ") + variable_to_string(instr_bt->data));
|
throw ScriptError(e.what() + _("\n in function: ") + variable_to_string(instr_bt->data));
|
||||||
} else if (instr_bt->instr == I_MEMBER_C) {
|
} else if (instr_bt->instr == I_MEMBER_C) {
|
||||||
throw ScriptError(e.what() + _("\n in function: ???.") + *script.constants[instr_bt->data]);
|
throw ScriptError(e.what() + _("\n in function: ??\?.") + script.constants[instr_bt->data]->operator String());
|
||||||
} else if (instr_bt->instr == I_BINARY && instr_bt->instr2 == I_MEMBER) {
|
} else if (instr_bt->instr == I_BINARY && instr_bt->instr2 == I_MEMBER) {
|
||||||
throw ScriptError(e.what() + _("\n in function: ???[???]"));
|
throw ScriptError(e.what() + _("\n in function: ??\?[??\?]"));
|
||||||
} else if (instr_bt->instr == I_BINARY && instr_bt->instr2 == I_ADD) {
|
} else if (instr_bt->instr == I_BINARY && instr_bt->instr2 == I_ADD) {
|
||||||
throw ScriptError(e.what() + _("\n in function: ??? + ???"));
|
throw ScriptError(e.what() + _("\n in function: ??? + ???"));
|
||||||
} else if (instr_bt->instr == I_NOP || instr_bt->instr == I_CALL) {
|
} else if (instr_bt->instr == I_NOP || instr_bt->instr == I_CALL) {
|
||||||
throw ScriptError(e.what() + _("\n in function: ???(???)"));
|
throw ScriptError(e.what() + _("\n in function: ??\?(??\?)"));
|
||||||
} else {
|
} else {
|
||||||
throw ScriptError(e.what() + _("\n in function: ???"));
|
throw ScriptError(e.what() + _("\n in function: ??\?"));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw e; // rethrow
|
throw e; // rethrow
|
||||||
|
|||||||
Reference in New Issue
Block a user