fix symbol-font bug

seen here:
https://github.com/MagicSetEditorPacks/Full-Magic-Pack/issues/149
This commit is contained in:
GenevensiS
2025-07-20 07:50:02 +02:00
parent 7f6170998b
commit 51f882315a
+19 -7
View File
@@ -481,13 +481,25 @@ wxMenu* InsertSymbolMenu::makeMenu(int id, SymbolFont& font) const {
wxMenuItem* InsertSymbolMenu::makeMenuItem(wxMenu* parent, int first_id, SymbolFont& font) const { wxMenuItem* InsertSymbolMenu::makeMenuItem(wxMenu* parent, int first_id, SymbolFont& font) const {
String label = this->label.get(); String label = this->label.get();
// ensure that there is not actually an accelerator string, // ensure that we are not defining an accelerator...
label.Replace(_("\t "), _("\t")); // everything after a tab is considered to be an accelerator by wxMenuItem
#ifdef __WXMSW__ int accel_pos = label.find_last_of('\t');
label.Replace(_("\t"), _("\t ")); // by prepending " " if (accel_pos != label.npos && accel_pos > 0) {
#else String accel = label.substr(accel_pos+1);
label.Replace(_("\t"), _(" ")); // by simply dropping the \t #ifdef __WXMSW__
#endif // if there is a + or - in the accelerator, replace the tab with spaces (simply adding a space does not work)
if (accel.Contains("+") || accel.Contains("-")) {
label = label.substr(0, accel_pos) + _(" ") + accel;
}
// otherwise simply add a space after the tab if there isn't one
else {
label.Replace(_("\t "), _("\t"));
label.Replace(_("\t"), _("\t "));
}
#else
label = label.substr(0, accel_pos) + _(" ") + accel; // replace the tab with spaces
#endif
}
if (type == Type::SUBMENU) { if (type == Type::SUBMENU) {
wxMenuItem* item = new wxMenuItem(parent, wxID_ANY, label, wxMenuItem* item = new wxMenuItem(parent, wxID_ANY, label,
wxEmptyString, wxITEM_NORMAL, wxEmptyString, wxITEM_NORMAL,