EWXWEXPORT(void*,ELJApp_FindWindowByLabel)(wxString* _lbl,wxWindow* _prt) { return (void*)wxFindWindowByLabel(*_lbl, _prt); }
// ----------------------------------------------------------------------------------------------------------------- void clKeyboardManager::CheckForDuplicateAccels(MenuItemDataMap_t& accelMap) const //(2019/04/22) // ----------------------------------------------------------------------------------------------------------------- { // Warn about duplicate Menu accelerators //(2019/04/22) wxArrayString dupMsgs; for(MenuItemDataMap_t::iterator accelIter = accelMap.begin(); accelIter != accelMap.end(); ++accelIter) { if (accelIter->second.accel.empty()) continue; if (accelIter->second.parentMenu.empty()) continue; //skip global accelerators MenuItemDataMap_t::iterator foundIter = accelMap.end(); MenuItemDataMap_t::iterator patternIter = accelIter; while (accelMap.end() != (foundIter = ExistsALikeAccel(accelMap, patternIter)) ) { #if defined(LOGGING) wxString patternAccel = patternIter->second.accel; wxString patternAction = patternIter->second.action; wxString dupAccel = foundIter->second.accel; wxString dupAction = foundIter->second.action; #endif //skip found global accelerators if (foundIter->second.parentMenu.empty()) { patternIter = foundIter; continue; } // found a duplicate menu accelerator further down the accelerator map MenuItemDataMap_t::iterator srcIter = patternIter; wxString srcMenuLabel = srcIter->second.parentMenu; srcMenuLabel.Replace(_T("\t"), _T(" ")); srcMenuLabel.Replace(_T("&"), _T("")); srcMenuLabel.Replace(_T("::"), _T("/")); wxString foundMenuLabel = foundIter->second.parentMenu; foundMenuLabel.Replace(_T("\t"), _T(" ")); foundMenuLabel.Replace(_T("&"), _T("")); foundMenuLabel.Replace(_T("::"), _T("/")); long srcMenuID; srcIter->first.ToLong(&srcMenuID); long foundMenuID; foundIter->first.ToLong(&foundMenuID); wxString msg = wxString::Format(_T("Conflicting menu items: \'%s\' && \'%s\'"), srcMenuLabel.wx_str(), foundMenuLabel.wx_str()) + wxString::Format(_T("\n Both using shortcut: \'%s\'"), foundIter->second.accel.wx_str()) + wxString::Format(_T(" (IDs [%ld] [%ld])"),srcMenuID, foundMenuID ); msg += _T("\n\n"); dupMsgs.Add(msg); patternIter = foundIter; }//end while } if (dupMsgs.GetCount()) { bool isParentWindowDialog = false; // Get top window to solve msg window getting hidden behind keybinder dialog wxWindow* pMainWin = nullptr; if ( (pMainWin = wxFindWindowByLabel(_T("Configure editor"))) ) { pMainWin = wxFindWindowByLabel(_T("Configure editor")); isParentWindowDialog = true; } else pMainWin = Manager::Get()->GetAppWindow(); wxString msg = _T("Keyboard shortcut conflicts found.\n"); if (not isParentWindowDialog) msg += _T("Use Settings/Editor/KeyboardShortcuts to resolve conflicts.\n\n"); for (size_t ii=0; ii<dupMsgs.GetCount(); ++ii) msg += dupMsgs[ii]; //-cbMessageBox(msg, _T("Keyboard shortcuts conflicts"), wxOK, pMainWin); AnnoyingDialog dlg(_("Keyboard shortcuts conflicts"), msg, wxART_INFORMATION, AnnoyingDialog::OK); dlg.ShowModal(); }//endif dupMsgs return; }