improve to_json(StyleP)

This commit is contained in:
GenevensiS
2026-01-17 07:55:34 +01:00
parent a741a4d26d
commit 28d5993fe6
13 changed files with 637 additions and 150 deletions
+28
View File
@@ -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);
+6 -1
View File
@@ -111,7 +111,10 @@ enum ChoicePopupStyle
{ POPUP_MENU
, 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
+1 -1
View File
@@ -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);
+1
View File
@@ -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;
};