diff --git a/src/gui/html_export_window.cpp b/src/gui/html_export_window.cpp
index a1746542..a48795f5 100644
--- a/src/gui/html_export_window.cpp
+++ b/src/gui/html_export_window.cpp
@@ -29,7 +29,7 @@ HtmlExportWindow::HtmlExportWindow(Window* parent, const SetP& set)
// init controls
list = new PackageList(this, ID_EXPORT_LIST);
options = new ExportOptionsEditor(this, wxID_ANY, wxNO_BORDER);
- options->setSet(set);
+ options->setSet(new_intrusive1(set->stylesheet)); // dummy set
// init sizers
wxSizer* s = new wxBoxSizer(wxVERTICAL);
s->Add(new wxStaticText(this, wxID_ANY, _LABEL_("html template")), 0, wxALL, 4);
diff --git a/src/gui/set/style_panel.cpp b/src/gui/set/style_panel.cpp
index 8d58f084..b53082b3 100644
--- a/src/gui/set/style_panel.cpp
+++ b/src/gui/set/style_panel.cpp
@@ -35,7 +35,7 @@ StylePanel::StylePanel(Window* parent, int id)
s2->Add(list, 0, wxEXPAND | wxBOTTOM, 4);
s2->Add(use_for_all, 0, wxRIGHT | wxBOTTOM | wxALIGN_RIGHT, 4);
wxSizer* s3 = new wxStaticBoxSizer(wxVERTICAL, this, _LABEL_("styling options"));
- s3->Add(use_custom_options, 0, wxEXPAND, 0);
+ s3->Add(use_custom_options, 0, wxEXPAND | wxALL, 4);
s3->Add(editor, 2, wxEXPAND, 0);
s2->Add(s3, 1, wxEXPAND | wxALL, 2);
s->Add(s2, 1, wxEXPAND, 8);
diff --git a/src/gui/welcome_window.cpp b/src/gui/welcome_window.cpp
index f198fd49..fecabeb5 100644
--- a/src/gui/welcome_window.cpp
+++ b/src/gui/welcome_window.cpp
@@ -39,7 +39,7 @@ WelcomeWindow::WelcomeWindow()
wxControl* open_last = nullptr;
if (!settings.recent_sets.empty()) {
wxFileName n(settings.recent_sets.front());
- if (n.FileExists())
+ if (n.FileExists() || n.DirExists())
#ifdef USE_HOVERBUTTON
open_last = new HoverButtonExt(this, ID_FILE_RECENT, load_resource_image(_("welcome_last")), _BUTTON_("last opened set"), _("Open '") + n.GetName() + _("'"));
#else
diff --git a/src/render/value/choice.cpp b/src/render/value/choice.cpp
index 35f3a0d7..fae43ab1 100644
--- a/src/render/value/choice.cpp
+++ b/src/render/value/choice.cpp
@@ -53,6 +53,9 @@ void ChoiceValueViewer::draw(RotatedDC& dc) {
style().angle
);
margin = dc.trInvS(image.GetWidth()) + 1;
+ } else if (nativeLook()) {
+ // always have the margin
+ margin = 17;
}
}
if (style().render_style & RENDER_TEXT) {
diff --git a/src/script/context.cpp b/src/script/context.cpp
index 193613ae..9ed4e0de 100644
--- a/src/script/context.cpp
+++ b/src/script/context.cpp
@@ -240,14 +240,13 @@ void instrUnary (UnaryInstructionType i, ScriptValueP& a) {
} \
break
-// operator on strings or doubles or ints
+// operator on strings or doubles or ints, when in doubt, uses strings
#define OPERATOR_SDI(OP) \
- if (at == SCRIPT_STRING || bt == SCRIPT_STRING) { \
- a = to_script(a->toString() OP b->toString()); \
- } else if (at == SCRIPT_DOUBLE || bt == SCRIPT_DOUBLE) { \
- a = to_script((double)*a OP (double)*b); \
- } else if (at == SCRIPT_INT || bt == SCRIPT_INT ) { \
+ if (at == SCRIPT_INT && bt == SCRIPT_INT) { \
a = to_script((int)*a OP (int)*b); \
+ } else if ((at == SCRIPT_INT || at == SCRIPT_DOUBLE) && \
+ (bt == SCRIPT_INT || bt == SCRIPT_DOUBLE)) { \
+ a = to_script((double)*a OP (double)*b); \
} else { \
a = to_script(a->toString() OP b->toString()); \
} \
@@ -288,12 +287,11 @@ void instrBinary (BinaryInstructionType i, ScriptValueP& a, const ScriptValueP&
// a = a;
} else if (at == SCRIPT_FUNCTION && bt == SCRIPT_FUNCTION) {
a = new_intrusive2(a, b);
- } else if (at == SCRIPT_STRING || bt == SCRIPT_STRING) {
- a = to_script(a->toString() + b->toString());
- } else if (at == SCRIPT_DOUBLE || bt == SCRIPT_DOUBLE) {
- a = to_script((double)*a + (double)*b);
- } else if (at == SCRIPT_INT || bt == SCRIPT_INT) {
+ } else if (at == SCRIPT_INT && bt == SCRIPT_INT) {
a = to_script((int)*a + (int)*b);
+ } else if ((at == SCRIPT_INT || at == SCRIPT_DOUBLE) &&
+ (bt == SCRIPT_INT || bt == SCRIPT_DOUBLE)) {
+ a = to_script((double)*a + (double)*b);
} else {
a = to_script(a->toString() + b->toString());
}
diff --git a/src/script/script_manager.cpp b/src/script/script_manager.cpp
index 742df548..9de5e6b5 100644
--- a/src/script/script_manager.cpp
+++ b/src/script/script_manager.cpp
@@ -214,9 +214,13 @@ void SetScriptManager::updateStyles(const CardP& card) {
}
void SetScriptManager::updateStyles(Context& ctx, const IndexMap& styles) {
FOR_EACH_CONST(s, styles) {
- if (s->update(ctx)) {
- // style has changed, tell listeners
- s->tellListeners();
+ try {
+ if (s->update(ctx)) {
+ // style has changed, tell listeners
+ s->tellListeners();
+ }
+ } catch (const ScriptError& e) {
+ throw ScriptError(e.what() + _("\nWhile updating styles for '") + s->fieldP->name + _("'"));
}
}
}
@@ -251,13 +255,21 @@ void SetScriptManager::updateAll() {
// update set data
Context& ctx = getContext(set.stylesheet);
FOR_EACH(v, set.data) {
- v->update(ctx);
+ try {
+ v->update(ctx);
+ } catch (const ScriptError& e) {
+ throw ScriptError(e.what() + _("\nWhile updating set value '") + v->fieldP->name + _("'"));
+ }
}
// update card data of all cards
FOR_EACH(card, set.cards) {
Context& ctx = getContext(card);
FOR_EACH(v, card->data) {
- v->update(ctx);
+ try {
+ v->update(ctx);
+ } catch (const ScriptError& e) {
+ throw ScriptError(e.what() + _("\nWhile updating card value '") + v->fieldP->name + _("'"));
+ }
}
}
// update things that depend on the card list
@@ -286,7 +298,13 @@ void SetScriptManager::updateToUpdate(const ToUpdate& u, deque& to_upd
Age age = u.value->last_script_update;
if (starting_age < age) return; // this value was already updated
Context& ctx = getContext(u.card);
- if (u.value->update(ctx)) {
+ bool changes;
+ try {
+ changes = u.value->update(ctx);
+ } catch (const ScriptError& e) {
+ throw ScriptError(e.what() + _("\nWhile updating value '") + u.value->fieldP->name + _("'"));
+ }
+ if (changes) {
// changed, send event
ScriptValueEvent change(u.card.get(), u.value);
set.actions.tellListeners(change, false);
diff --git a/src/util/version.cpp b/src/util/version.cpp
index 2e24bf0e..cb527994 100644
--- a/src/util/version.cpp
+++ b/src/util/version.cpp
@@ -49,7 +49,7 @@ template <> void GetDefaultMember::handle(const Version& v) {
// ----------------------------------------------------------------------------- : Versions
// NOTE: Don't use leading zeroes, they mean octal
-const Version app_version = 303; // 0.3.3
+const Version app_version = 304; // 0.3.4
#ifdef UNICODE
const Char* version_suffix = _(" (beta)");
#else
@@ -65,5 +65,6 @@ const Char* version_suffix = _(" (beta, ascii build)");
* 0.3.1 : new keyword system, some new style options
* 0.3.2 : package dependencies
* 0.3.3 : keyword separator before/after
+ * 0.3.4 : html export; choice rendering based on scripted 'image'
*/
-const Version file_version = 303; // 0.3.3
+const Version file_version = 304; // 0.3.4