Add search term highlighting to EditGCodeDialog

Now leaves text stored in ParamsNode un-formatted and uses flags to determine the formatting. The GetFormattedText function now returns the markup text.
This commit is contained in:
Ocraftyone
2024-01-10 07:22:36 -05:00
parent 22302a0f10
commit 8de9d97cd8
2 changed files with 41 additions and 14 deletions

View File

@@ -113,6 +113,10 @@ class ParamsNode
bool m_expanded_before_search{false};
bool m_enabled{true};
bool m_bold{false};
// first is pos, second is length
std::unique_ptr<std::pair<int, int>> m_highlight_index{nullptr};
public:
#ifdef __linux__
@@ -139,6 +143,8 @@ public:
const std::string& param_key,
wxDataViewCtrl* ctrl);
wxString GetFormattedText();
bool IsContainer() const { return m_container; }
bool IsGroupNode() const { return m_parent == nullptr; }
bool IsParamNode() const { return m_param_type != ParamType::Undef; }
@@ -257,11 +263,6 @@ public:
void set_em_unit(int em) { m_em_unit = em; }
};
static std::string unbold(const std::string& text) {
return text.substr(text.find("<b>")+3, text.find("</b>")-3);
}
} // namespace GUI
} // namespace Slic3r