From c407ffd248d8e2e849387063b8b18966d1187037 Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Wed, 7 May 2025 12:39:47 -0500 Subject: [PATCH] allow ELLIPSIS mode through dialogxml --- rsrc/schemas/dialog.xsd | 1 + src/dialogxml/widgets/message.cpp | 7 ++++++- src/doxy/mainpage.md | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/rsrc/schemas/dialog.xsd b/rsrc/schemas/dialog.xsd index aed40ce4..10a30d3a 100644 --- a/rsrc/schemas/dialog.xsd +++ b/rsrc/schemas/dialog.xsd @@ -188,6 +188,7 @@ + diff --git a/src/dialogxml/widgets/message.cpp b/src/dialogxml/widgets/message.cpp index 9ba0a09c..314763ff 100644 --- a/src/dialogxml/widgets/message.cpp +++ b/src/dialogxml/widgets/message.cpp @@ -63,6 +63,10 @@ bool cTextMsg::parseAttribute(ticpp::Attribute& attr, std::string tagName, std:: else if(val == "left") right_align = false; else throw xBadVal(tagName, attr.Name(), val, attr.Row(), attr.Column(), fname); return true; + }else if(attr.Name() == "ellipsis"){ + std::string val = attr.Value(); + if(val == "true") text_mode = eTextMode::ELLIPSIS; + return true; } return cControl::parseAttribute(attr, tagName, fname); } @@ -118,7 +122,8 @@ void cTextMsg::calculate_layout() { cControl& ctrl = key ? getDialog()->getControl(*key) : *this; msg.replace(pos, 1, ctrl.getAttachedKeyDescription()); } - if(to_rect.bottom - to_rect.top < 20 && msg.find("|") == std::string::npos){ + if(text_mode == eTextMode::ELLIPSIS){} + else if(to_rect.bottom - to_rect.top < 20 && msg.find("|") == std::string::npos){ style.lineHeight = 12; to_rect.left += 3; text_mode = eTextMode::LEFT_BOTTOM; diff --git a/src/doxy/mainpage.md b/src/doxy/mainpage.md index 32c97b7f..e373c9e1 100644 --- a/src/doxy/mainpage.md +++ b/src/doxy/mainpage.md @@ -94,6 +94,7 @@ The `` tag accepts the following attributes: * `outline` - See **Common Attributes** above. * `underline` - If true, the text will be underlined. * `align` - `right` or `left`. Defaults to `left`. +* `ellipsis` - If true, instead of wrapping overflow, truncate to one line with '...' * `fromlist`, `font`, `size`, `color`, `colour`, `def-key` - See **Common Attributes** above.