mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
improve to_json(StyleP)
This commit is contained in:
@@ -239,6 +239,34 @@ void ChoiceStyle::invalidate() {
|
||||
tellListeners(CHANGE_OTHER);
|
||||
}
|
||||
|
||||
String popup_style_to_string(const ChoicePopupStyle& choice) {
|
||||
switch (choice) {
|
||||
case POPUP_MENU: return "menu";
|
||||
case POPUP_DROPDOWN: return "drop down";
|
||||
case POPUP_DROPDOWN_IN_PLACE: return "drop down in place";
|
||||
default: return "menu";
|
||||
}
|
||||
}
|
||||
|
||||
String render_style_to_string(const ChoiceRenderStyle& choice) {
|
||||
switch (choice) {
|
||||
case RENDER_TEXT: return "text";
|
||||
case RENDER_IMAGE: return "image";
|
||||
case RENDER_HIDDEN: return "hidden";
|
||||
case RENDER_CHECKLIST: return "checklist";
|
||||
case RENDER_LIST: return "list";
|
||||
case RENDER_BOTH: return "both";
|
||||
case RENDER_HIDDEN_IMAGE: return "image hidden";
|
||||
case RENDER_TEXT_CHECKLIST: return "text checklist";
|
||||
case RENDER_IMAGE_CHECKLIST: return "image checklist";
|
||||
case RENDER_BOTH_CHECKLIST: return "both checklist";
|
||||
case RENDER_TEXT_LIST: return "text list";
|
||||
case RENDER_IMAGE_LIST: return "image list";
|
||||
case RENDER_BOTH_LIST: return "both list";
|
||||
default: return "text";
|
||||
}
|
||||
}
|
||||
|
||||
IMPLEMENT_REFLECTION_ENUM(ChoicePopupStyle) {
|
||||
VALUE_N("dropdown", POPUP_DROPDOWN);
|
||||
VALUE_N("menu", POPUP_MENU);
|
||||
|
||||
@@ -112,6 +112,9 @@ enum ChoicePopupStyle
|
||||
, POPUP_DROPDOWN
|
||||
, POPUP_DROPDOWN_IN_PLACE
|
||||
};
|
||||
|
||||
String popup_style_to_string(const ChoicePopupStyle&);
|
||||
|
||||
// How should a choice value be rendered?
|
||||
enum ChoiceRenderStyle
|
||||
{ RENDER_TEXT = 0x01 // render the name as text
|
||||
@@ -129,6 +132,8 @@ enum ChoiceRenderStyle
|
||||
, RENDER_BOTH_LIST = RENDER_LIST | RENDER_BOTH
|
||||
};
|
||||
|
||||
String render_style_to_string(const ChoiceRenderStyle&);
|
||||
|
||||
enum ThumbnailStatus
|
||||
{ THUMB_NOT_MADE // there is no image
|
||||
, THUMB_OK // image is ok
|
||||
|
||||
@@ -127,7 +127,7 @@ void LineLayout::reflect(GetMember& handler) const {
|
||||
REFLECT(top);
|
||||
REFLECT(height);
|
||||
REFLECT_N("bottom", bottom());
|
||||
REFLECT_N("middle", top + height/2);
|
||||
REFLECT_N("middle", middle());
|
||||
if (type > Type::LINE) REFLECT(lines);
|
||||
if (type > Type::PARAGRAPH) REFLECT(paragraphs);
|
||||
if (type > Type::BLOCK) REFLECT(blocks);
|
||||
|
||||
@@ -55,6 +55,7 @@ public:
|
||||
|
||||
LineLayout() {}
|
||||
LineLayout(double width, double top, double height, Type type) : width(width), top(top), height(height), type(type) {}
|
||||
inline double middle() const { return top+height/2.; }
|
||||
inline double bottom() const { return top+height; }
|
||||
void reflect(GetMember& gm) const;
|
||||
};
|
||||
|
||||
+257
-125
@@ -15,133 +15,265 @@ using namespace std;
|
||||
|
||||
// ----------------------------------------------------------------------------- : Reflection for combining modes
|
||||
|
||||
String combine_to_string(const ImageCombine& combine) {
|
||||
switch (combine) {
|
||||
case COMBINE_NORMAL: return "normal";
|
||||
case COMBINE_ADD: return "add";
|
||||
case COMBINE_SUBTRACT: return "subtract";
|
||||
case COMBINE_STAMP: return "stamp";
|
||||
case COMBINE_DIFFERENCE: return "difference";
|
||||
case COMBINE_NEGATION: return "negation";
|
||||
case COMBINE_MULTIPLY: return "multiply";
|
||||
case COMBINE_DARKEN: return "darken";
|
||||
case COMBINE_LIGHTEN: return "lighten";
|
||||
case COMBINE_COLOR_DODGE: return "color dodge";
|
||||
case COMBINE_COLOR_BURN: return "color burn";
|
||||
case COMBINE_SCREEN: return "screen";
|
||||
case COMBINE_OVERLAY: return "overlay";
|
||||
case COMBINE_HARD_LIGHT: return "hard light";
|
||||
case COMBINE_SOFT_LIGHT: return "soft light";
|
||||
case COMBINE_REFLECT: return "reflect";
|
||||
case COMBINE_GLOW: return "glow";
|
||||
case COMBINE_FREEZE: return "freeze";
|
||||
case COMBINE_HEAT: return "heat";
|
||||
case COMBINE_AND: return "and";
|
||||
case COMBINE_OR: return "or";
|
||||
case COMBINE_XOR: return "xor";
|
||||
case COMBINE_SHADOW: return "shadow";
|
||||
case COMBINE_SYMMETRIC_OVERLAY: return "symmetric overlay";
|
||||
case COMBINE_BRIGHTNESS_TO_ALPHA: return "brightness to alpha";
|
||||
case COMBINE_DARKNESS_TO_ALPHA: return "darkness to alpha";
|
||||
case COMBINE_GREATER_THAN_5: return "greater than 5";
|
||||
case COMBINE_GREATER_THAN_10: return "greater than 10";
|
||||
case COMBINE_GREATER_THAN_15: return "greater than 15";
|
||||
case COMBINE_GREATER_THAN_20: return "greater than 20";
|
||||
case COMBINE_GREATER_THAN_25: return "greater than 25";
|
||||
case COMBINE_GREATER_THAN_30: return "greater than 30";
|
||||
case COMBINE_GREATER_THAN_35: return "greater than 35";
|
||||
case COMBINE_GREATER_THAN_40: return "greater than 40";
|
||||
case COMBINE_GREATER_THAN_45: return "greater than 45";
|
||||
case COMBINE_GREATER_THAN_50: return "greater than 50";
|
||||
case COMBINE_GREATER_THAN_55: return "greater than 55";
|
||||
case COMBINE_GREATER_THAN_60: return "greater than 60";
|
||||
case COMBINE_GREATER_THAN_65: return "greater than 65";
|
||||
case COMBINE_GREATER_THAN_70: return "greater than 70";
|
||||
case COMBINE_GREATER_THAN_75: return "greater than 75";
|
||||
case COMBINE_GREATER_THAN_80: return "greater than 80";
|
||||
case COMBINE_GREATER_THAN_85: return "greater than 85";
|
||||
case COMBINE_GREATER_THAN_90: return "greater than 90";
|
||||
case COMBINE_GREATER_THAN_95: return "greater than 95";
|
||||
case COMBINE_GREATER_THAN_100: return "greater than 100";
|
||||
case COMBINE_GREATER_THAN_105: return "greater than 105";
|
||||
case COMBINE_GREATER_THAN_110: return "greater than 110";
|
||||
case COMBINE_GREATER_THAN_115: return "greater than 115";
|
||||
case COMBINE_GREATER_THAN_120: return "greater than 120";
|
||||
case COMBINE_GREATER_THAN_125: return "greater than 125";
|
||||
case COMBINE_GREATER_THAN_130: return "greater than 130";
|
||||
case COMBINE_GREATER_THAN_135: return "greater than 135";
|
||||
case COMBINE_GREATER_THAN_140: return "greater than 140";
|
||||
case COMBINE_GREATER_THAN_145: return "greater than 145";
|
||||
case COMBINE_GREATER_THAN_150: return "greater than 150";
|
||||
case COMBINE_GREATER_THAN_155: return "greater than 155";
|
||||
case COMBINE_GREATER_THAN_160: return "greater than 160";
|
||||
case COMBINE_GREATER_THAN_165: return "greater than 165";
|
||||
case COMBINE_GREATER_THAN_170: return "greater than 170";
|
||||
case COMBINE_GREATER_THAN_175: return "greater than 175";
|
||||
case COMBINE_GREATER_THAN_180: return "greater than 180";
|
||||
case COMBINE_GREATER_THAN_185: return "greater than 185";
|
||||
case COMBINE_GREATER_THAN_190: return "greater than 190";
|
||||
case COMBINE_GREATER_THAN_195: return "greater than 195";
|
||||
case COMBINE_GREATER_THAN_200: return "greater than 200";
|
||||
case COMBINE_GREATER_THAN_205: return "greater than 205";
|
||||
case COMBINE_GREATER_THAN_210: return "greater than 210";
|
||||
case COMBINE_GREATER_THAN_215: return "greater than 215";
|
||||
case COMBINE_GREATER_THAN_220: return "greater than 220";
|
||||
case COMBINE_GREATER_THAN_225: return "greater than 225";
|
||||
case COMBINE_GREATER_THAN_230: return "greater than 230";
|
||||
case COMBINE_GREATER_THAN_235: return "greater than 235";
|
||||
case COMBINE_GREATER_THAN_240: return "greater than 240";
|
||||
case COMBINE_GREATER_THAN_245: return "greater than 245";
|
||||
case COMBINE_GREATER_THAN_250: return "greater than 250";
|
||||
case COMBINE_SMALLER_THAN_5: return "smaller than 5";
|
||||
case COMBINE_SMALLER_THAN_10: return "smaller than 10";
|
||||
case COMBINE_SMALLER_THAN_15: return "smaller than 15";
|
||||
case COMBINE_SMALLER_THAN_20: return "smaller than 20";
|
||||
case COMBINE_SMALLER_THAN_25: return "smaller than 25";
|
||||
case COMBINE_SMALLER_THAN_30: return "smaller than 30";
|
||||
case COMBINE_SMALLER_THAN_35: return "smaller than 35";
|
||||
case COMBINE_SMALLER_THAN_40: return "smaller than 40";
|
||||
case COMBINE_SMALLER_THAN_45: return "smaller than 45";
|
||||
case COMBINE_SMALLER_THAN_50: return "smaller than 50";
|
||||
case COMBINE_SMALLER_THAN_55: return "smaller than 55";
|
||||
case COMBINE_SMALLER_THAN_60: return "smaller than 60";
|
||||
case COMBINE_SMALLER_THAN_65: return "smaller than 65";
|
||||
case COMBINE_SMALLER_THAN_70: return "smaller than 70";
|
||||
case COMBINE_SMALLER_THAN_75: return "smaller than 75";
|
||||
case COMBINE_SMALLER_THAN_80: return "smaller than 80";
|
||||
case COMBINE_SMALLER_THAN_85: return "smaller than 85";
|
||||
case COMBINE_SMALLER_THAN_90: return "smaller than 90";
|
||||
case COMBINE_SMALLER_THAN_95: return "smaller than 95";
|
||||
case COMBINE_SMALLER_THAN_100: return "smaller than 100";
|
||||
case COMBINE_SMALLER_THAN_105: return "smaller than 105";
|
||||
case COMBINE_SMALLER_THAN_110: return "smaller than 110";
|
||||
case COMBINE_SMALLER_THAN_115: return "smaller than 115";
|
||||
case COMBINE_SMALLER_THAN_120: return "smaller than 120";
|
||||
case COMBINE_SMALLER_THAN_125: return "smaller than 125";
|
||||
case COMBINE_SMALLER_THAN_130: return "smaller than 130";
|
||||
case COMBINE_SMALLER_THAN_135: return "smaller than 135";
|
||||
case COMBINE_SMALLER_THAN_140: return "smaller than 140";
|
||||
case COMBINE_SMALLER_THAN_145: return "smaller than 145";
|
||||
case COMBINE_SMALLER_THAN_150: return "smaller than 150";
|
||||
case COMBINE_SMALLER_THAN_155: return "smaller than 155";
|
||||
case COMBINE_SMALLER_THAN_160: return "smaller than 160";
|
||||
case COMBINE_SMALLER_THAN_165: return "smaller than 165";
|
||||
case COMBINE_SMALLER_THAN_170: return "smaller than 170";
|
||||
case COMBINE_SMALLER_THAN_175: return "smaller than 175";
|
||||
case COMBINE_SMALLER_THAN_180: return "smaller than 180";
|
||||
case COMBINE_SMALLER_THAN_185: return "smaller than 185";
|
||||
case COMBINE_SMALLER_THAN_190: return "smaller than 190";
|
||||
case COMBINE_SMALLER_THAN_195: return "smaller than 195";
|
||||
case COMBINE_SMALLER_THAN_200: return "smaller than 200";
|
||||
case COMBINE_SMALLER_THAN_205: return "smaller than 205";
|
||||
case COMBINE_SMALLER_THAN_210: return "smaller than 210";
|
||||
case COMBINE_SMALLER_THAN_215: return "smaller than 215";
|
||||
case COMBINE_SMALLER_THAN_220: return "smaller than 220";
|
||||
case COMBINE_SMALLER_THAN_225: return "smaller than 225";
|
||||
case COMBINE_SMALLER_THAN_230: return "smaller than 230";
|
||||
case COMBINE_SMALLER_THAN_235: return "smaller than 235";
|
||||
case COMBINE_SMALLER_THAN_240: return "smaller than 240";
|
||||
case COMBINE_SMALLER_THAN_245: return "smaller than 245";
|
||||
case COMBINE_SMALLER_THAN_250: return "smaller than 250";
|
||||
default: return "normal";
|
||||
}
|
||||
}
|
||||
|
||||
IMPLEMENT_REFLECTION_ENUM(ImageCombine) {
|
||||
VALUE_N("normal", COMBINE_NORMAL);
|
||||
VALUE_N("add", COMBINE_ADD);
|
||||
VALUE_N("subtract", COMBINE_SUBTRACT);
|
||||
VALUE_N("stamp", COMBINE_STAMP);
|
||||
VALUE_N("difference", COMBINE_DIFFERENCE);
|
||||
VALUE_N("negation", COMBINE_NEGATION);
|
||||
VALUE_N("multiply", COMBINE_MULTIPLY);
|
||||
VALUE_N("darken", COMBINE_DARKEN);
|
||||
VALUE_N("lighten", COMBINE_LIGHTEN);
|
||||
VALUE_N("color dodge", COMBINE_COLOR_DODGE);
|
||||
VALUE_N("color burn", COMBINE_COLOR_BURN);
|
||||
VALUE_N("screen", COMBINE_SCREEN);
|
||||
VALUE_N("overlay", COMBINE_OVERLAY);
|
||||
VALUE_N("hard light", COMBINE_HARD_LIGHT);
|
||||
VALUE_N("soft light", COMBINE_SOFT_LIGHT);
|
||||
VALUE_N("reflect", COMBINE_REFLECT);
|
||||
VALUE_N("glow", COMBINE_GLOW);
|
||||
VALUE_N("freeze", COMBINE_FREEZE);
|
||||
VALUE_N("heat", COMBINE_HEAT);
|
||||
VALUE_N("and", COMBINE_AND);
|
||||
VALUE_N("or", COMBINE_OR);
|
||||
VALUE_N("xor", COMBINE_XOR);
|
||||
VALUE_N("shadow", COMBINE_SHADOW);
|
||||
VALUE_N("symmetric overlay", COMBINE_SYMMETRIC_OVERLAY);
|
||||
VALUE_N("normal", COMBINE_NORMAL);
|
||||
VALUE_N("add", COMBINE_ADD);
|
||||
VALUE_N("subtract", COMBINE_SUBTRACT);
|
||||
VALUE_N("stamp", COMBINE_STAMP);
|
||||
VALUE_N("difference", COMBINE_DIFFERENCE);
|
||||
VALUE_N("negation", COMBINE_NEGATION);
|
||||
VALUE_N("multiply", COMBINE_MULTIPLY);
|
||||
VALUE_N("darken", COMBINE_DARKEN);
|
||||
VALUE_N("lighten", COMBINE_LIGHTEN);
|
||||
VALUE_N("color dodge", COMBINE_COLOR_DODGE);
|
||||
VALUE_N("color burn", COMBINE_COLOR_BURN);
|
||||
VALUE_N("screen", COMBINE_SCREEN);
|
||||
VALUE_N("overlay", COMBINE_OVERLAY);
|
||||
VALUE_N("hard light", COMBINE_HARD_LIGHT);
|
||||
VALUE_N("soft light", COMBINE_SOFT_LIGHT);
|
||||
VALUE_N("reflect", COMBINE_REFLECT);
|
||||
VALUE_N("glow", COMBINE_GLOW);
|
||||
VALUE_N("freeze", COMBINE_FREEZE);
|
||||
VALUE_N("heat", COMBINE_HEAT);
|
||||
VALUE_N("and", COMBINE_AND);
|
||||
VALUE_N("or", COMBINE_OR);
|
||||
VALUE_N("xor", COMBINE_XOR);
|
||||
VALUE_N("shadow", COMBINE_SHADOW);
|
||||
VALUE_N("symmetric overlay", COMBINE_SYMMETRIC_OVERLAY);
|
||||
VALUE_N("brightness to alpha", COMBINE_BRIGHTNESS_TO_ALPHA);
|
||||
VALUE_N("darkness to alpha", COMBINE_DARKNESS_TO_ALPHA);
|
||||
VALUE_N("greater than 5", COMBINE_GREATER_THAN_5);
|
||||
VALUE_N("greater than 10", COMBINE_GREATER_THAN_10);
|
||||
VALUE_N("greater than 15", COMBINE_GREATER_THAN_15);
|
||||
VALUE_N("greater than 20", COMBINE_GREATER_THAN_20);
|
||||
VALUE_N("greater than 25", COMBINE_GREATER_THAN_25);
|
||||
VALUE_N("greater than 30", COMBINE_GREATER_THAN_30);
|
||||
VALUE_N("greater than 35", COMBINE_GREATER_THAN_35);
|
||||
VALUE_N("greater than 40", COMBINE_GREATER_THAN_40);
|
||||
VALUE_N("greater than 45", COMBINE_GREATER_THAN_45);
|
||||
VALUE_N("greater than 50", COMBINE_GREATER_THAN_50);
|
||||
VALUE_N("greater than 55", COMBINE_GREATER_THAN_55);
|
||||
VALUE_N("greater than 60", COMBINE_GREATER_THAN_60);
|
||||
VALUE_N("greater than 65", COMBINE_GREATER_THAN_65);
|
||||
VALUE_N("greater than 70", COMBINE_GREATER_THAN_70);
|
||||
VALUE_N("greater than 75", COMBINE_GREATER_THAN_75);
|
||||
VALUE_N("greater than 80", COMBINE_GREATER_THAN_80);
|
||||
VALUE_N("greater than 85", COMBINE_GREATER_THAN_85);
|
||||
VALUE_N("greater than 90", COMBINE_GREATER_THAN_90);
|
||||
VALUE_N("greater than 95", COMBINE_GREATER_THAN_95);
|
||||
VALUE_N("greater than 100", COMBINE_GREATER_THAN_100);
|
||||
VALUE_N("greater than 105", COMBINE_GREATER_THAN_105);
|
||||
VALUE_N("greater than 110", COMBINE_GREATER_THAN_110);
|
||||
VALUE_N("greater than 115", COMBINE_GREATER_THAN_115);
|
||||
VALUE_N("greater than 120", COMBINE_GREATER_THAN_120);
|
||||
VALUE_N("greater than 125", COMBINE_GREATER_THAN_125);
|
||||
VALUE_N("greater than 130", COMBINE_GREATER_THAN_130);
|
||||
VALUE_N("greater than 135", COMBINE_GREATER_THAN_135);
|
||||
VALUE_N("greater than 140", COMBINE_GREATER_THAN_140);
|
||||
VALUE_N("greater than 145", COMBINE_GREATER_THAN_145);
|
||||
VALUE_N("greater than 150", COMBINE_GREATER_THAN_150);
|
||||
VALUE_N("greater than 155", COMBINE_GREATER_THAN_155);
|
||||
VALUE_N("greater than 160", COMBINE_GREATER_THAN_160);
|
||||
VALUE_N("greater than 165", COMBINE_GREATER_THAN_165);
|
||||
VALUE_N("greater than 170", COMBINE_GREATER_THAN_170);
|
||||
VALUE_N("greater than 175", COMBINE_GREATER_THAN_175);
|
||||
VALUE_N("greater than 180", COMBINE_GREATER_THAN_180);
|
||||
VALUE_N("greater than 185", COMBINE_GREATER_THAN_185);
|
||||
VALUE_N("greater than 190", COMBINE_GREATER_THAN_190);
|
||||
VALUE_N("greater than 195", COMBINE_GREATER_THAN_195);
|
||||
VALUE_N("greater than 200", COMBINE_GREATER_THAN_200);
|
||||
VALUE_N("greater than 205", COMBINE_GREATER_THAN_205);
|
||||
VALUE_N("greater than 210", COMBINE_GREATER_THAN_210);
|
||||
VALUE_N("greater than 215", COMBINE_GREATER_THAN_215);
|
||||
VALUE_N("greater than 220", COMBINE_GREATER_THAN_220);
|
||||
VALUE_N("greater than 225", COMBINE_GREATER_THAN_225);
|
||||
VALUE_N("greater than 230", COMBINE_GREATER_THAN_230);
|
||||
VALUE_N("greater than 235", COMBINE_GREATER_THAN_235);
|
||||
VALUE_N("greater than 240", COMBINE_GREATER_THAN_240);
|
||||
VALUE_N("greater than 245", COMBINE_GREATER_THAN_245);
|
||||
VALUE_N("greater than 250", COMBINE_GREATER_THAN_250);
|
||||
VALUE_N("smaller than 5", COMBINE_SMALLER_THAN_5);
|
||||
VALUE_N("smaller than 10", COMBINE_SMALLER_THAN_10);
|
||||
VALUE_N("smaller than 15", COMBINE_SMALLER_THAN_15);
|
||||
VALUE_N("smaller than 20", COMBINE_SMALLER_THAN_20);
|
||||
VALUE_N("smaller than 25", COMBINE_SMALLER_THAN_25);
|
||||
VALUE_N("smaller than 30", COMBINE_SMALLER_THAN_30);
|
||||
VALUE_N("smaller than 35", COMBINE_SMALLER_THAN_35);
|
||||
VALUE_N("smaller than 40", COMBINE_SMALLER_THAN_40);
|
||||
VALUE_N("smaller than 45", COMBINE_SMALLER_THAN_45);
|
||||
VALUE_N("smaller than 50", COMBINE_SMALLER_THAN_50);
|
||||
VALUE_N("smaller than 55", COMBINE_SMALLER_THAN_55);
|
||||
VALUE_N("smaller than 60", COMBINE_SMALLER_THAN_60);
|
||||
VALUE_N("smaller than 65", COMBINE_SMALLER_THAN_65);
|
||||
VALUE_N("smaller than 70", COMBINE_SMALLER_THAN_70);
|
||||
VALUE_N("smaller than 75", COMBINE_SMALLER_THAN_75);
|
||||
VALUE_N("smaller than 80", COMBINE_SMALLER_THAN_80);
|
||||
VALUE_N("smaller than 85", COMBINE_SMALLER_THAN_85);
|
||||
VALUE_N("smaller than 90", COMBINE_SMALLER_THAN_90);
|
||||
VALUE_N("smaller than 95", COMBINE_SMALLER_THAN_95);
|
||||
VALUE_N("smaller than 100", COMBINE_SMALLER_THAN_100);
|
||||
VALUE_N("smaller than 105", COMBINE_SMALLER_THAN_105);
|
||||
VALUE_N("smaller than 110", COMBINE_SMALLER_THAN_110);
|
||||
VALUE_N("smaller than 115", COMBINE_SMALLER_THAN_115);
|
||||
VALUE_N("smaller than 120", COMBINE_SMALLER_THAN_120);
|
||||
VALUE_N("smaller than 125", COMBINE_SMALLER_THAN_125);
|
||||
VALUE_N("smaller than 130", COMBINE_SMALLER_THAN_130);
|
||||
VALUE_N("smaller than 135", COMBINE_SMALLER_THAN_135);
|
||||
VALUE_N("smaller than 140", COMBINE_SMALLER_THAN_140);
|
||||
VALUE_N("smaller than 145", COMBINE_SMALLER_THAN_145);
|
||||
VALUE_N("smaller than 150", COMBINE_SMALLER_THAN_150);
|
||||
VALUE_N("smaller than 155", COMBINE_SMALLER_THAN_155);
|
||||
VALUE_N("smaller than 160", COMBINE_SMALLER_THAN_160);
|
||||
VALUE_N("smaller than 165", COMBINE_SMALLER_THAN_165);
|
||||
VALUE_N("smaller than 170", COMBINE_SMALLER_THAN_170);
|
||||
VALUE_N("smaller than 175", COMBINE_SMALLER_THAN_175);
|
||||
VALUE_N("smaller than 180", COMBINE_SMALLER_THAN_180);
|
||||
VALUE_N("smaller than 185", COMBINE_SMALLER_THAN_185);
|
||||
VALUE_N("smaller than 190", COMBINE_SMALLER_THAN_190);
|
||||
VALUE_N("smaller than 195", COMBINE_SMALLER_THAN_195);
|
||||
VALUE_N("smaller than 200", COMBINE_SMALLER_THAN_200);
|
||||
VALUE_N("smaller than 205", COMBINE_SMALLER_THAN_205);
|
||||
VALUE_N("smaller than 210", COMBINE_SMALLER_THAN_210);
|
||||
VALUE_N("smaller than 215", COMBINE_SMALLER_THAN_215);
|
||||
VALUE_N("smaller than 220", COMBINE_SMALLER_THAN_220);
|
||||
VALUE_N("smaller than 225", COMBINE_SMALLER_THAN_225);
|
||||
VALUE_N("smaller than 230", COMBINE_SMALLER_THAN_230);
|
||||
VALUE_N("smaller than 235", COMBINE_SMALLER_THAN_235);
|
||||
VALUE_N("smaller than 240", COMBINE_SMALLER_THAN_240);
|
||||
VALUE_N("smaller than 245", COMBINE_SMALLER_THAN_245);
|
||||
VALUE_N("smaller than 250", COMBINE_SMALLER_THAN_250);
|
||||
VALUE_N("darkness to alpha", COMBINE_DARKNESS_TO_ALPHA);
|
||||
VALUE_N("greater than 5", COMBINE_GREATER_THAN_5);
|
||||
VALUE_N("greater than 10", COMBINE_GREATER_THAN_10);
|
||||
VALUE_N("greater than 15", COMBINE_GREATER_THAN_15);
|
||||
VALUE_N("greater than 20", COMBINE_GREATER_THAN_20);
|
||||
VALUE_N("greater than 25", COMBINE_GREATER_THAN_25);
|
||||
VALUE_N("greater than 30", COMBINE_GREATER_THAN_30);
|
||||
VALUE_N("greater than 35", COMBINE_GREATER_THAN_35);
|
||||
VALUE_N("greater than 40", COMBINE_GREATER_THAN_40);
|
||||
VALUE_N("greater than 45", COMBINE_GREATER_THAN_45);
|
||||
VALUE_N("greater than 50", COMBINE_GREATER_THAN_50);
|
||||
VALUE_N("greater than 55", COMBINE_GREATER_THAN_55);
|
||||
VALUE_N("greater than 60", COMBINE_GREATER_THAN_60);
|
||||
VALUE_N("greater than 65", COMBINE_GREATER_THAN_65);
|
||||
VALUE_N("greater than 70", COMBINE_GREATER_THAN_70);
|
||||
VALUE_N("greater than 75", COMBINE_GREATER_THAN_75);
|
||||
VALUE_N("greater than 80", COMBINE_GREATER_THAN_80);
|
||||
VALUE_N("greater than 85", COMBINE_GREATER_THAN_85);
|
||||
VALUE_N("greater than 90", COMBINE_GREATER_THAN_90);
|
||||
VALUE_N("greater than 95", COMBINE_GREATER_THAN_95);
|
||||
VALUE_N("greater than 100", COMBINE_GREATER_THAN_100);
|
||||
VALUE_N("greater than 105", COMBINE_GREATER_THAN_105);
|
||||
VALUE_N("greater than 110", COMBINE_GREATER_THAN_110);
|
||||
VALUE_N("greater than 115", COMBINE_GREATER_THAN_115);
|
||||
VALUE_N("greater than 120", COMBINE_GREATER_THAN_120);
|
||||
VALUE_N("greater than 125", COMBINE_GREATER_THAN_125);
|
||||
VALUE_N("greater than 130", COMBINE_GREATER_THAN_130);
|
||||
VALUE_N("greater than 135", COMBINE_GREATER_THAN_135);
|
||||
VALUE_N("greater than 140", COMBINE_GREATER_THAN_140);
|
||||
VALUE_N("greater than 145", COMBINE_GREATER_THAN_145);
|
||||
VALUE_N("greater than 150", COMBINE_GREATER_THAN_150);
|
||||
VALUE_N("greater than 155", COMBINE_GREATER_THAN_155);
|
||||
VALUE_N("greater than 160", COMBINE_GREATER_THAN_160);
|
||||
VALUE_N("greater than 165", COMBINE_GREATER_THAN_165);
|
||||
VALUE_N("greater than 170", COMBINE_GREATER_THAN_170);
|
||||
VALUE_N("greater than 175", COMBINE_GREATER_THAN_175);
|
||||
VALUE_N("greater than 180", COMBINE_GREATER_THAN_180);
|
||||
VALUE_N("greater than 185", COMBINE_GREATER_THAN_185);
|
||||
VALUE_N("greater than 190", COMBINE_GREATER_THAN_190);
|
||||
VALUE_N("greater than 195", COMBINE_GREATER_THAN_195);
|
||||
VALUE_N("greater than 200", COMBINE_GREATER_THAN_200);
|
||||
VALUE_N("greater than 205", COMBINE_GREATER_THAN_205);
|
||||
VALUE_N("greater than 210", COMBINE_GREATER_THAN_210);
|
||||
VALUE_N("greater than 215", COMBINE_GREATER_THAN_215);
|
||||
VALUE_N("greater than 220", COMBINE_GREATER_THAN_220);
|
||||
VALUE_N("greater than 225", COMBINE_GREATER_THAN_225);
|
||||
VALUE_N("greater than 230", COMBINE_GREATER_THAN_230);
|
||||
VALUE_N("greater than 235", COMBINE_GREATER_THAN_235);
|
||||
VALUE_N("greater than 240", COMBINE_GREATER_THAN_240);
|
||||
VALUE_N("greater than 245", COMBINE_GREATER_THAN_245);
|
||||
VALUE_N("greater than 250", COMBINE_GREATER_THAN_250);
|
||||
VALUE_N("smaller than 5", COMBINE_SMALLER_THAN_5);
|
||||
VALUE_N("smaller than 10", COMBINE_SMALLER_THAN_10);
|
||||
VALUE_N("smaller than 15", COMBINE_SMALLER_THAN_15);
|
||||
VALUE_N("smaller than 20", COMBINE_SMALLER_THAN_20);
|
||||
VALUE_N("smaller than 25", COMBINE_SMALLER_THAN_25);
|
||||
VALUE_N("smaller than 30", COMBINE_SMALLER_THAN_30);
|
||||
VALUE_N("smaller than 35", COMBINE_SMALLER_THAN_35);
|
||||
VALUE_N("smaller than 40", COMBINE_SMALLER_THAN_40);
|
||||
VALUE_N("smaller than 45", COMBINE_SMALLER_THAN_45);
|
||||
VALUE_N("smaller than 50", COMBINE_SMALLER_THAN_50);
|
||||
VALUE_N("smaller than 55", COMBINE_SMALLER_THAN_55);
|
||||
VALUE_N("smaller than 60", COMBINE_SMALLER_THAN_60);
|
||||
VALUE_N("smaller than 65", COMBINE_SMALLER_THAN_65);
|
||||
VALUE_N("smaller than 70", COMBINE_SMALLER_THAN_70);
|
||||
VALUE_N("smaller than 75", COMBINE_SMALLER_THAN_75);
|
||||
VALUE_N("smaller than 80", COMBINE_SMALLER_THAN_80);
|
||||
VALUE_N("smaller than 85", COMBINE_SMALLER_THAN_85);
|
||||
VALUE_N("smaller than 90", COMBINE_SMALLER_THAN_90);
|
||||
VALUE_N("smaller than 95", COMBINE_SMALLER_THAN_95);
|
||||
VALUE_N("smaller than 100", COMBINE_SMALLER_THAN_100);
|
||||
VALUE_N("smaller than 105", COMBINE_SMALLER_THAN_105);
|
||||
VALUE_N("smaller than 110", COMBINE_SMALLER_THAN_110);
|
||||
VALUE_N("smaller than 115", COMBINE_SMALLER_THAN_115);
|
||||
VALUE_N("smaller than 120", COMBINE_SMALLER_THAN_120);
|
||||
VALUE_N("smaller than 125", COMBINE_SMALLER_THAN_125);
|
||||
VALUE_N("smaller than 130", COMBINE_SMALLER_THAN_130);
|
||||
VALUE_N("smaller than 135", COMBINE_SMALLER_THAN_135);
|
||||
VALUE_N("smaller than 140", COMBINE_SMALLER_THAN_140);
|
||||
VALUE_N("smaller than 145", COMBINE_SMALLER_THAN_145);
|
||||
VALUE_N("smaller than 150", COMBINE_SMALLER_THAN_150);
|
||||
VALUE_N("smaller than 155", COMBINE_SMALLER_THAN_155);
|
||||
VALUE_N("smaller than 160", COMBINE_SMALLER_THAN_160);
|
||||
VALUE_N("smaller than 165", COMBINE_SMALLER_THAN_165);
|
||||
VALUE_N("smaller than 170", COMBINE_SMALLER_THAN_170);
|
||||
VALUE_N("smaller than 175", COMBINE_SMALLER_THAN_175);
|
||||
VALUE_N("smaller than 180", COMBINE_SMALLER_THAN_180);
|
||||
VALUE_N("smaller than 185", COMBINE_SMALLER_THAN_185);
|
||||
VALUE_N("smaller than 190", COMBINE_SMALLER_THAN_190);
|
||||
VALUE_N("smaller than 195", COMBINE_SMALLER_THAN_195);
|
||||
VALUE_N("smaller than 200", COMBINE_SMALLER_THAN_200);
|
||||
VALUE_N("smaller than 205", COMBINE_SMALLER_THAN_205);
|
||||
VALUE_N("smaller than 210", COMBINE_SMALLER_THAN_210);
|
||||
VALUE_N("smaller than 215", COMBINE_SMALLER_THAN_215);
|
||||
VALUE_N("smaller than 220", COMBINE_SMALLER_THAN_220);
|
||||
VALUE_N("smaller than 225", COMBINE_SMALLER_THAN_225);
|
||||
VALUE_N("smaller than 230", COMBINE_SMALLER_THAN_230);
|
||||
VALUE_N("smaller than 235", COMBINE_SMALLER_THAN_235);
|
||||
VALUE_N("smaller than 240", COMBINE_SMALLER_THAN_240);
|
||||
VALUE_N("smaller than 245", COMBINE_SMALLER_THAN_245);
|
||||
VALUE_N("smaller than 250", COMBINE_SMALLER_THAN_250);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------- : Combining functions
|
||||
|
||||
@@ -245,6 +245,8 @@ enum ImageCombine
|
||||
, COMBINE_SMALLER_THAN_250
|
||||
};
|
||||
|
||||
String combine_to_string(const ImageCombine&);
|
||||
|
||||
/// Combine image b onto image a using some combining function.
|
||||
/// The results are stored in the image A.
|
||||
/// This image gets the alpha channel from B, it should then be
|
||||
|
||||
@@ -65,8 +65,8 @@ public:
|
||||
Color color(double x, double y, SymbolSet point) const override;
|
||||
String fillType() const override;
|
||||
bool operator == (const SymbolFilter& that) const override;
|
||||
private:
|
||||
Color fill_color, border_color;
|
||||
private:
|
||||
DECLARE_REFLECTION_OVERRIDE();
|
||||
};
|
||||
|
||||
@@ -78,9 +78,9 @@ public:
|
||||
: fill_color_1(fill_color_1), border_color_1(border_color_1)
|
||||
, fill_color_2(fill_color_2), border_color_2(border_color_2)
|
||||
{}
|
||||
protected:
|
||||
Color fill_color_1, border_color_1;
|
||||
Color fill_color_2, border_color_2;
|
||||
protected:
|
||||
template <typename T>
|
||||
Color color(double x, double y, SymbolSet point, const T* t) const;
|
||||
bool equal(const GradientSymbolFilter& that) const;
|
||||
@@ -102,9 +102,9 @@ public:
|
||||
/// return time on the gradient, used by GradientSymbolFilter::color
|
||||
inline double t(double x, double y) const;
|
||||
|
||||
private:
|
||||
double center_x, center_y;
|
||||
double end_x, end_y;
|
||||
private:
|
||||
mutable double len;
|
||||
DECLARE_REFLECTION_OVERRIDE();
|
||||
};
|
||||
|
||||
@@ -12,7 +12,11 @@
|
||||
#include <util/delayed_index_maps.hpp>
|
||||
#include <util/prec.hpp>
|
||||
#include <data/card.hpp>
|
||||
#include <data/field/information.hpp>
|
||||
#include <data/field/boolean.hpp>
|
||||
#include <data/field/multiple_choice.hpp>
|
||||
#include <data/format/clipboard.hpp>
|
||||
#include <render/symbol/filter.hpp>
|
||||
#include <script/functions/construction_helper.hpp>
|
||||
#include <sstream>
|
||||
#include <wx/sstream.h>
|
||||
@@ -503,7 +507,9 @@ boost::json::object mse_to_json(const CardP& card, const Set* set) {
|
||||
}
|
||||
|
||||
boost::json::object mse_to_json(const StyleP& style) {
|
||||
//style->update(set->getContext());
|
||||
//Context ctx = set->getContext();
|
||||
//style->update(ctx);
|
||||
|
||||
boost::json::object stylev;
|
||||
stylev.emplace("mse_object_type", "style");
|
||||
stylev.emplace("z_index", wxString::Format(wxT("%i"), style->z_index));
|
||||
@@ -515,7 +521,279 @@ boost::json::object mse_to_json(const StyleP& style) {
|
||||
stylev.emplace("width", wxString::Format(wxT("%.2f"), style->width()));
|
||||
stylev.emplace("height", wxString::Format(wxT("%.2f"), style->height()));
|
||||
stylev.emplace("angle", wxString::Format(wxT("%.2f"), style->angle()));
|
||||
stylev.emplace("visible", style->visible());
|
||||
stylev.emplace("visible", style->visible());
|
||||
stylev.emplace("mask", style->mask.toScriptString());
|
||||
|
||||
if (TextStyle* s = dynamic_cast<TextStyle*>(style.get())) {
|
||||
stylev.emplace("field_type", "text");
|
||||
|
||||
boost::json::object fontv;
|
||||
fontv.emplace("name", s->font.name());
|
||||
fontv.emplace("italic_name", s->font.italic_name());
|
||||
fontv.emplace("size", wxString::Format(wxT("%.2f"), s->font.size()));
|
||||
fontv.emplace("weight", s->font.weight());
|
||||
fontv.emplace("style", s->font.style());
|
||||
fontv.emplace("underline", s->font.underline());
|
||||
fontv.emplace("strikethrough", s->font.strikethrough());
|
||||
fontv.emplace("scale_down_to", wxString::Format(wxT("%.2f"), s->font.scale_down_to));
|
||||
fontv.emplace("max_stretch", wxString::Format(wxT("%.2f"), s->font.max_stretch));
|
||||
fontv.emplace("color", format_color( s->font.color()));
|
||||
fontv.emplace("shadow_color", format_color( s->font.shadow_color()));
|
||||
fontv.emplace("shadow_displacement_x", wxString::Format(wxT("%.2f"), s->font.shadow_displacement_x()));
|
||||
fontv.emplace("shadow_displacement_y", wxString::Format(wxT("%.2f"), s->font.shadow_displacement_y()));
|
||||
fontv.emplace("shadow_blur", wxString::Format(wxT("%.2f"), s->font.shadow_blur()));
|
||||
fontv.emplace("stroke_color", format_color( s->font.stroke_color()));
|
||||
fontv.emplace("stroke_radius", wxString::Format(wxT("%.2f"), s->font.stroke_radius()));
|
||||
fontv.emplace("stroke_blur", wxString::Format(wxT("%.2f"), s->font.stroke_blur()));
|
||||
fontv.emplace("separator_color", format_color( s->font.separator_color));
|
||||
fontv.emplace("flags", wxString::Format(wxT("%i"), s->font.flags));
|
||||
stylev.emplace("font", fontv);
|
||||
|
||||
boost::json::object symbolfontv;
|
||||
symbolfontv.emplace("name", s->symbol_font.name());
|
||||
symbolfontv.emplace("size", wxString::Format(wxT("%.2f"), s->symbol_font.size()));
|
||||
symbolfontv.emplace("underline", s->symbol_font.underline());
|
||||
symbolfontv.emplace("strikethrough", s->symbol_font.strikethrough());
|
||||
symbolfontv.emplace("scale_down_to", wxString::Format(wxT("%.2f"), s->symbol_font.scale_down_to));
|
||||
symbolfontv.emplace("shadow_color", format_color( s->symbol_font.shadow_color()));
|
||||
symbolfontv.emplace("shadow_displacement_x", wxString::Format(wxT("%.2f"), s->symbol_font.shadow_displacement_x()));
|
||||
symbolfontv.emplace("shadow_displacement_y", wxString::Format(wxT("%.2f"), s->symbol_font.shadow_displacement_y()));
|
||||
symbolfontv.emplace("shadow_blur", wxString::Format(wxT("%.2f"), s->symbol_font.shadow_blur()));
|
||||
symbolfontv.emplace("stroke_color", format_color( s->symbol_font.stroke_color()));
|
||||
symbolfontv.emplace("stroke_radius", wxString::Format(wxT("%.2f"), s->symbol_font.stroke_radius()));
|
||||
symbolfontv.emplace("stroke_blur", wxString::Format(wxT("%.2f"), s->symbol_font.stroke_blur()));
|
||||
stylev.emplace("symbol_font", symbolfontv);
|
||||
|
||||
stylev.emplace("always_symbol", s->always_symbol);
|
||||
stylev.emplace("allow_formating", s->allow_formating);
|
||||
stylev.emplace("alignment", alignment_to_string( s->alignment()));
|
||||
stylev.emplace("direction", direction_to_string( s->direction));
|
||||
stylev.emplace("padding_left", wxString::Format(wxT("%.2f"), s->padding_left()));
|
||||
stylev.emplace("padding_right", wxString::Format(wxT("%.2f"), s->padding_right()));
|
||||
stylev.emplace("padding_top", wxString::Format(wxT("%.2f"), s->padding_top()));
|
||||
stylev.emplace("padding_bottom", wxString::Format(wxT("%.2f"), s->padding_bottom()));
|
||||
stylev.emplace("padding_left_min", wxString::Format(wxT("%.2f"), s->padding_left_min()));
|
||||
stylev.emplace("padding_right_min", wxString::Format(wxT("%.2f"), s->padding_right_min()));
|
||||
stylev.emplace("padding_top_min", wxString::Format(wxT("%.2f"), s->padding_top_min()));
|
||||
stylev.emplace("padding_bottom_min", wxString::Format(wxT("%.2f"), s->padding_bottom_min()));
|
||||
stylev.emplace("line_height_soft", wxString::Format(wxT("%.2f"), s->line_height_soft()));
|
||||
stylev.emplace("line_height_hard", wxString::Format(wxT("%.2f"), s->line_height_hard()));
|
||||
stylev.emplace("line_height_line", wxString::Format(wxT("%.2f"), s->line_height_line()));
|
||||
stylev.emplace("line_height_soft_max", wxString::Format(wxT("%.2f"), s->line_height_soft_max()));
|
||||
stylev.emplace("line_height_hard_max", wxString::Format(wxT("%.2f"), s->line_height_hard_max()));
|
||||
stylev.emplace("line_height_line_max", wxString::Format(wxT("%.2f"), s->line_height_line_max()));
|
||||
stylev.emplace("paragraph_height", wxString::Format(wxT("%.2f"), s->paragraph_height()));
|
||||
|
||||
boost::json::object layoutv;
|
||||
layoutv.emplace("content_top", wxString::Format(wxT("%.2f"), s->layout->top));
|
||||
layoutv.emplace("content_middle", wxString::Format(wxT("%.2f"), s->layout->middle()));
|
||||
layoutv.emplace("content_bottom", wxString::Format(wxT("%.2f"), s->layout->bottom()));
|
||||
layoutv.emplace("content_width", wxString::Format(wxT("%.2f"), s->layout->width));
|
||||
layoutv.emplace("content_height", wxString::Format(wxT("%.2f"), s->layout->height));
|
||||
layoutv.emplace("content_lines", wxString::Format(wxT("%i"), s->layout->lines.size()));
|
||||
layoutv.emplace("content_paragraphs", wxString::Format(wxT("%i"), s->layout->paragraphs.size()));
|
||||
layoutv.emplace("content_blocks", wxString::Format(wxT("%i"), s->layout->blocks.size()));
|
||||
boost::json::array separatorsv;
|
||||
int size = s->layout->separators.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
separatorsv.emplace_back(wxString::Format(wxT("%.2f"), s->layout->separators[i]));
|
||||
}
|
||||
if (size > 0) layoutv.emplace("content_separators", separatorsv);
|
||||
|
||||
stylev.emplace("layout", layoutv);
|
||||
}
|
||||
|
||||
else if (ImageStyle* s = dynamic_cast<ImageStyle*>(style.get())) {
|
||||
stylev.emplace("field_type", "image");
|
||||
stylev.emplace("default", s->default_image.toScriptString());
|
||||
stylev.emplace("store_in_metadata", s->store_in_metadata());
|
||||
}
|
||||
|
||||
else if (MultipleChoiceStyle* s = dynamic_cast<MultipleChoiceStyle*>(style.get())) {
|
||||
stylev.emplace("field_type", "multiple_choice");
|
||||
stylev.emplace("popup_style", popup_style_to_string( s->popup_style));
|
||||
stylev.emplace("render_style", render_style_to_string( s->render_style));
|
||||
stylev.emplace("image", s->image.toScriptString());
|
||||
stylev.emplace("combine", combine_to_string( s->combine));
|
||||
stylev.emplace("alignment", alignment_to_string( s->alignment));
|
||||
stylev.emplace("direction", direction_to_string( s->direction()));
|
||||
stylev.emplace("spacing", wxString::Format(wxT("%.2f"), s->spacing()));
|
||||
|
||||
boost::json::object fontv;
|
||||
fontv.emplace("name", s->font.name());
|
||||
fontv.emplace("italic_name", s->font.italic_name());
|
||||
fontv.emplace("size", wxString::Format(wxT("%.2f"), s->font.size()));
|
||||
fontv.emplace("weight", s->font.weight());
|
||||
fontv.emplace("style", s->font.style());
|
||||
fontv.emplace("underline", s->font.underline());
|
||||
fontv.emplace("strikethrough", s->font.strikethrough());
|
||||
fontv.emplace("scale_down_to", wxString::Format(wxT("%.2f"), s->font.scale_down_to));
|
||||
fontv.emplace("max_stretch", wxString::Format(wxT("%.2f"), s->font.max_stretch));
|
||||
fontv.emplace("color", format_color( s->font.color()));
|
||||
fontv.emplace("shadow_color", format_color( s->font.shadow_color()));
|
||||
fontv.emplace("shadow_displacement_x", wxString::Format(wxT("%.2f"), s->font.shadow_displacement_x()));
|
||||
fontv.emplace("shadow_displacement_y", wxString::Format(wxT("%.2f"), s->font.shadow_displacement_y()));
|
||||
fontv.emplace("shadow_blur", wxString::Format(wxT("%.2f"), s->font.shadow_blur()));
|
||||
fontv.emplace("stroke_color", format_color( s->font.stroke_color()));
|
||||
fontv.emplace("stroke_radius", wxString::Format(wxT("%.2f"), s->font.stroke_radius()));
|
||||
fontv.emplace("stroke_blur", wxString::Format(wxT("%.2f"), s->font.stroke_blur()));
|
||||
fontv.emplace("separator_color", format_color( s->font.separator_color));
|
||||
fontv.emplace("flags", wxString::Format(wxT("%i"), s->font.flags));
|
||||
stylev.emplace("font", fontv);
|
||||
|
||||
boost::json::object choiceimagesv;
|
||||
for (auto choice_image : s->choice_images) {
|
||||
String image = choice_image.second.toScriptString();
|
||||
if (!image.empty()) choiceimagesv.emplace(choice_image.first.ToStdString(), image);
|
||||
}
|
||||
if (choiceimagesv.size() > 0) stylev.emplace("choice_images", choiceimagesv);
|
||||
}
|
||||
|
||||
else if (ChoiceStyle* s = dynamic_cast<ChoiceStyle*>(style.get())) {
|
||||
stylev.emplace("field_type", dynamic_cast<BooleanStyle*>(style.get()) ? "boolean" : "choice");
|
||||
stylev.emplace("popup_style", popup_style_to_string( s->popup_style));
|
||||
stylev.emplace("render_style", render_style_to_string( s->render_style));
|
||||
stylev.emplace("image", s->image.toScriptString());
|
||||
stylev.emplace("combine", combine_to_string( s->combine));
|
||||
stylev.emplace("alignment", alignment_to_string( s->alignment));
|
||||
|
||||
boost::json::object fontv;
|
||||
fontv.emplace("name", s->font.name());
|
||||
fontv.emplace("italic_name", s->font.italic_name());
|
||||
fontv.emplace("size", wxString::Format(wxT("%.2f"), s->font.size()));
|
||||
fontv.emplace("weight", s->font.weight());
|
||||
fontv.emplace("style", s->font.style());
|
||||
fontv.emplace("underline", s->font.underline());
|
||||
fontv.emplace("strikethrough", s->font.strikethrough());
|
||||
fontv.emplace("scale_down_to", wxString::Format(wxT("%.2f"), s->font.scale_down_to));
|
||||
fontv.emplace("max_stretch", wxString::Format(wxT("%.2f"), s->font.max_stretch));
|
||||
fontv.emplace("color", format_color( s->font.color()));
|
||||
fontv.emplace("shadow_color", format_color( s->font.shadow_color()));
|
||||
fontv.emplace("shadow_displacement_x", wxString::Format(wxT("%.2f"), s->font.shadow_displacement_x()));
|
||||
fontv.emplace("shadow_displacement_y", wxString::Format(wxT("%.2f"), s->font.shadow_displacement_y()));
|
||||
fontv.emplace("shadow_blur", wxString::Format(wxT("%.2f"), s->font.shadow_blur()));
|
||||
fontv.emplace("stroke_color", format_color( s->font.stroke_color()));
|
||||
fontv.emplace("stroke_radius", wxString::Format(wxT("%.2f"), s->font.stroke_radius()));
|
||||
fontv.emplace("stroke_blur", wxString::Format(wxT("%.2f"), s->font.stroke_blur()));
|
||||
fontv.emplace("separator_color", format_color( s->font.separator_color));
|
||||
fontv.emplace("flags", wxString::Format(wxT("%i"), s->font.flags));
|
||||
stylev.emplace("font", fontv);
|
||||
|
||||
boost::json::object choiceimagesv;
|
||||
for (auto choice_image : s->choice_images) {
|
||||
String image = choice_image.second.toScriptString();
|
||||
if (!image.empty()) choiceimagesv.emplace(choice_image.first.ToStdString(), image);
|
||||
}
|
||||
if (choiceimagesv.size() > 0) stylev.emplace("choice_images", choiceimagesv);
|
||||
}
|
||||
|
||||
else if (PackageChoiceStyle* s = dynamic_cast<PackageChoiceStyle*>(style.get())) {
|
||||
stylev.emplace("field_type", "package_choice");
|
||||
|
||||
boost::json::object fontv;
|
||||
fontv.emplace("name", s->font.name());
|
||||
fontv.emplace("italic_name", s->font.italic_name());
|
||||
fontv.emplace("size", wxString::Format(wxT("%.2f"), s->font.size()));
|
||||
fontv.emplace("weight", s->font.weight());
|
||||
fontv.emplace("style", s->font.style());
|
||||
fontv.emplace("underline", s->font.underline());
|
||||
fontv.emplace("strikethrough", s->font.strikethrough());
|
||||
fontv.emplace("scale_down_to", wxString::Format(wxT("%.2f"), s->font.scale_down_to));
|
||||
fontv.emplace("max_stretch", wxString::Format(wxT("%.2f"), s->font.max_stretch));
|
||||
fontv.emplace("color", format_color( s->font.color()));
|
||||
fontv.emplace("shadow_color", format_color( s->font.shadow_color()));
|
||||
fontv.emplace("shadow_displacement_x", wxString::Format(wxT("%.2f"), s->font.shadow_displacement_x()));
|
||||
fontv.emplace("shadow_displacement_y", wxString::Format(wxT("%.2f"), s->font.shadow_displacement_y()));
|
||||
fontv.emplace("shadow_blur", wxString::Format(wxT("%.2f"), s->font.shadow_blur()));
|
||||
fontv.emplace("stroke_color", format_color( s->font.stroke_color()));
|
||||
fontv.emplace("stroke_radius", wxString::Format(wxT("%.2f"), s->font.stroke_radius()));
|
||||
fontv.emplace("stroke_blur", wxString::Format(wxT("%.2f"), s->font.stroke_blur()));
|
||||
fontv.emplace("separator_color", format_color( s->font.separator_color));
|
||||
fontv.emplace("flags", wxString::Format(wxT("%i"), s->font.flags));
|
||||
stylev.emplace("font", fontv);
|
||||
}
|
||||
|
||||
else if (ColorStyle* s = dynamic_cast<ColorStyle*>(style.get())) {
|
||||
stylev.emplace("field_type", "color");
|
||||
stylev.emplace("radius", wxString::Format(wxT("%.2f"), s->radius()));
|
||||
stylev.emplace("left_width", wxString::Format(wxT("%.2f"), s->left_width()));
|
||||
stylev.emplace("right_width", wxString::Format(wxT("%.2f"), s->right_width()));
|
||||
stylev.emplace("top_width", wxString::Format(wxT("%.2f"), s->top_width()));
|
||||
stylev.emplace("bottom_width", wxString::Format(wxT("%.2f"), s->bottom_width()));
|
||||
stylev.emplace("combine", combine_to_string( s->combine));
|
||||
}
|
||||
|
||||
else if (SymbolStyle* s = dynamic_cast<SymbolStyle*>(style.get())) {
|
||||
stylev.emplace("field_type", "symbol");
|
||||
stylev.emplace("min_aspect_ratio", wxString::Format(wxT("%.2f"), s->min_aspect_ratio));
|
||||
stylev.emplace("max_aspect_ratio", wxString::Format(wxT("%.2f"), s->max_aspect_ratio));
|
||||
boost::json::array variationsv;
|
||||
int size = s->variations.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
boost::json::object variationv;
|
||||
variationv.emplace("name", s->variations[i]->name);
|
||||
variationv.emplace("border_radius", wxString::Format(wxT("%.2f"), s->variations[i]->border_radius));
|
||||
SymbolFilterP filter = s->variations[i]->filter;
|
||||
if (SolidFillSymbolFilter* f = dynamic_cast<SolidFillSymbolFilter*>(filter.get())) {
|
||||
variationv.emplace("fill_type", f->fillType());
|
||||
variationv.emplace("fill_color", format_color( f->fill_color));
|
||||
variationv.emplace("border_color", format_color( f->border_color));
|
||||
}
|
||||
else if (RadialGradientSymbolFilter* f = dynamic_cast<RadialGradientSymbolFilter*>(filter.get())) {
|
||||
variationv.emplace("fill_type", f->fillType());
|
||||
variationv.emplace("fill_color_1", format_color( f->fill_color_1));
|
||||
variationv.emplace("fill_color_2", format_color( f->fill_color_2));
|
||||
variationv.emplace("border_color_1", format_color( f->border_color_1));
|
||||
variationv.emplace("border_color_2", format_color( f->border_color_2));
|
||||
}
|
||||
else if (LinearGradientSymbolFilter* f = dynamic_cast<LinearGradientSymbolFilter*>(filter.get())) {
|
||||
variationv.emplace("fill_type", f->fillType());
|
||||
variationv.emplace("fill_color_1", format_color( f->fill_color_1));
|
||||
variationv.emplace("fill_color_2", format_color( f->fill_color_2));
|
||||
variationv.emplace("border_color_1", format_color( f->border_color_1));
|
||||
variationv.emplace("border_color_2", format_color( f->border_color_2));
|
||||
variationv.emplace("center_x", wxString::Format(wxT("%.2f"), f->center_x));
|
||||
variationv.emplace("center_y", wxString::Format(wxT("%.2f"), f->center_y));
|
||||
variationv.emplace("end_x", wxString::Format(wxT("%.2f"), f->end_x));
|
||||
variationv.emplace("end_y", wxString::Format(wxT("%.2f"), f->end_y));
|
||||
}
|
||||
variationsv.emplace_back(variationv);
|
||||
}
|
||||
if (size > 0) stylev.emplace("variations", variationsv);
|
||||
}
|
||||
|
||||
else if (InfoStyle* s = dynamic_cast<InfoStyle*>(style.get())) {
|
||||
stylev.emplace("field_type", "info");
|
||||
stylev.emplace("alignment", alignment_to_string( s->alignment));
|
||||
stylev.emplace("padding_left", wxString::Format(wxT("%.2f"), s->padding_left));
|
||||
stylev.emplace("padding_right", wxString::Format(wxT("%.2f"), s->padding_right));
|
||||
stylev.emplace("padding_top", wxString::Format(wxT("%.2f"), s->padding_top));
|
||||
stylev.emplace("padding_bottom", wxString::Format(wxT("%.2f"), s->padding_bottom));
|
||||
stylev.emplace("background_color", format_color( s->background_color));
|
||||
|
||||
boost::json::object fontv;
|
||||
fontv.emplace("name", s->font.name());
|
||||
fontv.emplace("italic_name", s->font.italic_name());
|
||||
fontv.emplace("size", wxString::Format(wxT("%.2f"), s->font.size()));
|
||||
fontv.emplace("weight", s->font.weight());
|
||||
fontv.emplace("style", s->font.style());
|
||||
fontv.emplace("underline", s->font.underline());
|
||||
fontv.emplace("strikethrough", s->font.strikethrough());
|
||||
fontv.emplace("scale_down_to", wxString::Format(wxT("%.2f"), s->font.scale_down_to));
|
||||
fontv.emplace("max_stretch", wxString::Format(wxT("%.2f"), s->font.max_stretch));
|
||||
fontv.emplace("color", format_color( s->font.color()));
|
||||
fontv.emplace("shadow_color", format_color( s->font.shadow_color()));
|
||||
fontv.emplace("shadow_displacement_x", wxString::Format(wxT("%.2f"), s->font.shadow_displacement_x()));
|
||||
fontv.emplace("shadow_displacement_y", wxString::Format(wxT("%.2f"), s->font.shadow_displacement_y()));
|
||||
fontv.emplace("shadow_blur", wxString::Format(wxT("%.2f"), s->font.shadow_blur()));
|
||||
fontv.emplace("stroke_color", format_color( s->font.stroke_color()));
|
||||
fontv.emplace("stroke_radius", wxString::Format(wxT("%.2f"), s->font.stroke_radius()));
|
||||
fontv.emplace("stroke_blur", wxString::Format(wxT("%.2f"), s->font.stroke_blur()));
|
||||
fontv.emplace("separator_color", format_color( s->font.separator_color));
|
||||
fontv.emplace("flags", wxString::Format(wxT("%i"), s->font.flags));
|
||||
stylev.emplace("font", fontv);
|
||||
}
|
||||
|
||||
return stylev;
|
||||
}
|
||||
|
||||
|
||||
@@ -64,10 +64,10 @@ boost::json::object mse_to_json(const PackTypeP& pack);
|
||||
|
||||
boost::json::object mse_to_json(const KeywordP& keyword);
|
||||
|
||||
boost::json::object mse_to_json(const CardP& card, const Set* set);
|
||||
|
||||
boost::json::object mse_to_json(const StyleP& style);
|
||||
|
||||
boost::json::object mse_to_json(const CardP& card, const Set* set);
|
||||
|
||||
boost::json::object mse_to_json(const Set* set);
|
||||
|
||||
boost::json::object mse_to_json(const IndexMap<FieldP,ValueP>& map);
|
||||
|
||||
@@ -43,9 +43,15 @@ ImageCombine ScriptableImage::combine() const {
|
||||
|
||||
bool ScriptableImage::update(Context& ctx) {
|
||||
if (!isScripted()) return false;
|
||||
GeneratedImageP new_value = script.invoke(ctx)->toImage();
|
||||
ScriptValueP eval = script.invoke(ctx);
|
||||
GeneratedImageP new_value = eval->toImage();
|
||||
if (!new_value || !value || *new_value != *value) {
|
||||
value = new_value;
|
||||
ScriptType type = eval->type();
|
||||
if (type == SCRIPT_NIL) scriptString = _("<nil>");
|
||||
else if (type == SCRIPT_STRING) scriptString = eval->toString();
|
||||
else if (type == SCRIPT_IMAGE) scriptString = _("<image from script>");
|
||||
else scriptString = _("<unknown>");
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
||||
+11
-1
@@ -44,6 +44,9 @@ public:
|
||||
/// Update the script, returns true if the value has changed
|
||||
bool update(Context& ctx);
|
||||
|
||||
/// Get the string (filename) produced by the script, for debugging
|
||||
inline String toScriptString() { return scriptString; }
|
||||
|
||||
inline void initDependencies(Context& ctx, const Dependency& dep) const {
|
||||
script.initDependencies(ctx, dep);
|
||||
}
|
||||
@@ -61,7 +64,8 @@ public:
|
||||
ScriptP getValidScriptP();
|
||||
|
||||
protected:
|
||||
OptionalScript script; ///< The script, not really optional
|
||||
OptionalScript script; ///< The script, not really optional
|
||||
String scriptString; ///< If the script evaluates to a string, store it here
|
||||
GeneratedImageP value; ///< The image generator
|
||||
|
||||
DECLARE_REFLECTION();
|
||||
@@ -115,9 +119,15 @@ private:
|
||||
class CachedScriptableMask {
|
||||
public:
|
||||
|
||||
/// Is there a mask set?
|
||||
inline bool isSet() const { return script.isSet(); }
|
||||
|
||||
/// Update the script, returns true if the value has changed
|
||||
bool update(Context& ctx);
|
||||
|
||||
/// Get the string (filename) produced by the script, for debugging
|
||||
inline String toScriptString() { return script.toScriptString(); }
|
||||
|
||||
inline void initDependencies(Context& ctx, const Dependency& dep) const {
|
||||
script.initDependencies(ctx, dep);
|
||||
}
|
||||
|
||||
+27
-6
@@ -81,6 +81,9 @@ String to_string(Alignment align) {
|
||||
ret.resize(ret.size() - 1); // drop trailing ' '
|
||||
return ret;
|
||||
}
|
||||
String alignment_to_string(const Alignment& align) {
|
||||
return to_string(align);
|
||||
}
|
||||
|
||||
// we need custom io, because there can be both a horizontal and a vertical component
|
||||
|
||||
@@ -97,12 +100,12 @@ template <> void GetDefaultMember::handle(const Alignment& align) {
|
||||
// ----------------------------------------------------------------------------- : Direction
|
||||
|
||||
IMPLEMENT_REFLECTION_ENUM(Direction) {
|
||||
VALUE_N("left to right", LEFT_TO_RIGHT);
|
||||
VALUE_N("right to left", RIGHT_TO_LEFT);
|
||||
VALUE_N("top to bottom", TOP_TO_BOTTOM);
|
||||
VALUE_N("bottom to top", BOTTOM_TO_TOP);
|
||||
VALUE_N("horizontal", LEFT_TO_RIGHT);
|
||||
VALUE_N("vertical", TOP_TO_BOTTOM);
|
||||
VALUE_N("left to right", LEFT_TO_RIGHT);
|
||||
VALUE_N("right to left", RIGHT_TO_LEFT);
|
||||
VALUE_N("top to bottom", TOP_TO_BOTTOM);
|
||||
VALUE_N("bottom to top", BOTTOM_TO_TOP);
|
||||
VALUE_N("horizontal", LEFT_TO_RIGHT);
|
||||
VALUE_N("vertical", TOP_TO_BOTTOM);
|
||||
VALUE_N("top-right to bottom-left", TOP_RIGHT_TO_BOTTOM_LEFT);
|
||||
VALUE_N("bottom-left to top-right", BOTTOM_LEFT_TO_TOP_RIGHT);
|
||||
VALUE_N("top-left to bottom-right", TOP_LEFT_TO_BOTTOM_RIGHT);
|
||||
@@ -122,3 +125,21 @@ RealPoint move_in_direction(Direction dir, const RealPoint& point, const RealSiz
|
||||
default: return point; // should not happen
|
||||
}
|
||||
}
|
||||
|
||||
/// Convert a Direction to a String
|
||||
String to_string(Direction direction) {
|
||||
switch (direction) {
|
||||
case LEFT_TO_RIGHT: return "left to right";
|
||||
case RIGHT_TO_LEFT: return "right to left";
|
||||
case TOP_TO_BOTTOM: return "top to bottom";
|
||||
case BOTTOM_TO_TOP: return "bottom to top";
|
||||
case TOP_RIGHT_TO_BOTTOM_LEFT: return "top-right to bottom-left";
|
||||
case BOTTOM_LEFT_TO_TOP_RIGHT: return "bottom-left to top-right";
|
||||
case TOP_LEFT_TO_BOTTOM_RIGHT: return "top-left to bottom-right";
|
||||
case BOTTOM_RIGHT_TO_TOP_LEFT: return "bottom-right to top-left";
|
||||
default: return "left to right";
|
||||
}
|
||||
}
|
||||
String direction_to_string(const Direction& direction) {
|
||||
return to_string(direction);
|
||||
}
|
||||
|
||||
@@ -57,6 +57,8 @@ RealPoint align_in_rect(Alignment align, const RealSize& to_align, const RealRec
|
||||
|
||||
Alignment alignment_from_string(const String&);
|
||||
|
||||
String alignment_to_string(const Alignment&);
|
||||
|
||||
// ----------------------------------------------------------------------------- : Direction
|
||||
|
||||
/// Direction to place something in
|
||||
@@ -75,3 +77,5 @@ enum Direction {
|
||||
/** If the direction is horizontal the to_move.width is used, otherwise to_move.height */
|
||||
RealPoint move_in_direction(Direction dir, const RealPoint& point, const RealSize to_move, double spacing = 0);
|
||||
|
||||
String direction_to_string(const Direction&);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user