void SubsTextEditCtrl::AddSpellCheckerEntries(wxMenu &menu) { if (currentWord.empty()) return; sugs = spellchecker->GetSuggestions(currentWord); if (spellchecker->CheckWord(currentWord)) { if (sugs.empty()) menu.Append(EDIT_MENU_SUGGESTION,_("No spell checker suggestions"))->Enable(false); else { wxMenu *subMenu = new wxMenu; for (size_t i = 0; i < sugs.size(); ++i) subMenu->Append(EDIT_MENU_SUGGESTIONS+i, to_wx(sugs[i])); menu.Append(-1, wxString::Format(_("Spell checker suggestions for \"%s\""), to_wx(currentWord)), subMenu); } } else { if (sugs.empty()) menu.Append(EDIT_MENU_SUGGESTION,_("No correction suggestions"))->Enable(false); for (size_t i = 0; i < sugs.size(); ++i) menu.Append(EDIT_MENU_SUGGESTIONS+i, to_wx(sugs[i])); // Append "add word" menu.Append(EDIT_MENU_ADD_TO_DICT, wxString::Format(_("Add \"%s\" to dictionary"), to_wx(currentWord)))->Enable(spellchecker->CanAddWord(currentWord)); } }
void RightPopupMenu::CreateDebugMenu(wxMenu& menu) { if (m_edited_sprs.empty()) { return; } #ifdef _DEBUG m_parent->Bind(wxEVT_COMMAND_MENU_SELECTED, &EditPanelImpl::OnRightPopupMenu, m_stage, MENU_INSERT_TO_DTEX); menu.Append(MENU_INSERT_TO_DTEX, "Insert To DTex"); m_parent->Bind(wxEVT_COMMAND_MENU_SELECTED, &EditPanelImpl::OnRightPopupMenu, m_stage, MENU_REMOVE_FROM_DTEX); menu.Append(MENU_REMOVE_FROM_DTEX, "Remove From DTex"); menu.AppendSeparator(); #endif }
void CompilerMessages::AppendAdditionalMenuItems(wxMenu &menu) { menu.Append(idMenuFit, _("Fit text"), _("Makes the whole text visible")); menu.AppendCheckItem(idMenuAutoFit, _("Fit automatically"), _("Automatically makes the whole text visible during compilation")); menu.Check(idMenuAutoFit, m_autoFit); }
void SubsTextEditCtrl::AddThesaurusEntries(wxMenu &menu) { if (currentWord.empty()) return; if (!thesaurus) thesaurus.reset(new Thesaurus); std::vector<Thesaurus::Entry> results; thesaurus->Lookup(currentWord, &results); thesSugs.clear(); if (results.size()) { wxMenu *thesMenu = new wxMenu; int curThesEntry = 0; for (auto const& result : results) { // Single word, insert directly if (result.second.size() == 1) { thesMenu->Append(EDIT_MENU_THESAURUS_SUGS+curThesEntry, to_wx(result.first)); thesSugs.push_back(result.first); ++curThesEntry; } // Multiple, create submenu else { wxMenu *subMenu = new wxMenu; for (auto const& sug : result.second) { subMenu->Append(EDIT_MENU_THESAURUS_SUGS+curThesEntry, to_wx(sug)); thesSugs.push_back(sug); ++curThesEntry; } thesMenu->Append(-1, to_wx(result.first), subMenu); } } menu.Append(-1, wxString::Format(_("Thesaurus suggestions for \"%s\""), to_wx(currentWord)), thesMenu); } else menu.Append(EDIT_MENU_THESAURUS,_("No thesaurus suggestions"))->Enable(false); // Append language list menu.Append(-1,_("Thesaurus language"), GetLanguagesMenu( EDIT_MENU_THES_LANGS, to_wx(OPT_GET("Tool/Thesaurus/Language")->GetString()), to_wx(thesaurus->GetLanguageList()))); menu.AppendSeparator(); }
void CommandProcessorBase::DoPopulateUnRedoMenu(wxMenu& menu, bool undoing) { wxString prefix(undoing ? _("Undo ") : _("Redo ")); int id = FIRST_MENU_ID; int count = 0; if (undoing) { if (GetCommands().size() > 0) { for (CLCommand::Vec_t::const_reverse_iterator iter = GetCommands().rbegin() + GetNextUndoCommand(); iter != GetCommands().rend(); ++iter) { CLCommand::Ptr_t command = *iter; if (command) { wxString label; if (!command->GetUserLabel().empty()) { if (command->GetName().Contains(":")) { label = command->GetName().BeforeFirst(':') + ": "; } label << command->GetUserLabel(); } else { if (command == GetOpenCommand()) { label = GetBestLabel(command); // If the command's still open, there won't otherwise be a name string } else { label = command->GetName(); } } menu.Append(id++, wxString::Format("%i ", ++count) + prefix + label); } } } } else { for (CLCommand::Vec_t::const_iterator iter = GetCommands().begin() + GetCurrentCommand() + 1; iter != GetCommands().end(); ++iter) { CLCommand::Ptr_t command = *iter; if (command) { wxString label; if (!command->GetUserLabel().empty()) { if (command->GetName().Contains(":")) { label = command->GetName().BeforeFirst(':') + ": "; } label << command->GetUserLabel(); } else { label = command->GetName(); } menu.Append(id++, wxString::Format("%i ", ++count) + prefix + label); } } } }
void RightPopupMenu::CreateCommonMenu(wxMenu& menu) { if (m_edited_sprs.empty()) { return; } m_parent->Bind(wxEVT_COMMAND_MENU_SELECTED, &EditPanelImpl::OnRightPopupMenu, m_stage, MENU_UP_LAYER); menu.Append(MENU_UP_LAYER, "ÉÏÒÆÒ»²ã"); m_parent->Bind(wxEVT_COMMAND_MENU_SELECTED, &EditPanelImpl::OnRightPopupMenu, m_stage, MENU_DOWN_LAYER); menu.Append(MENU_DOWN_LAYER, "ÏÂÒÆÒ»²ã"); m_parent->Bind(wxEVT_COMMAND_MENU_SELECTED, &EditPanelImpl::OnRightPopupMenu, m_stage, MENU_UP_MOST); menu.Append(MENU_UP_MOST, "ÒƵ½¶¥"); m_parent->Bind(wxEVT_COMMAND_MENU_SELECTED, &EditPanelImpl::OnRightPopupMenu, m_stage, MENU_DOWN_MOST); menu.Append(MENU_DOWN_MOST, "ÒƵ½µ×"); menu.AppendSeparator(); m_parent->Bind(wxEVT_COMMAND_MENU_SELECTED, &EditPanelImpl::OnRightPopupMenu, m_stage, MENU_HORI_MIRROR); menu.Append(MENU_HORI_MIRROR, "ˮƽ¾µÏñ"); m_parent->Bind(wxEVT_COMMAND_MENU_SELECTED, &EditPanelImpl::OnRightPopupMenu, m_stage, MENU_VERT_MIRROR); menu.Append(MENU_VERT_MIRROR, "ÊúÖ±¾µÏñ"); menu.AppendSeparator(); if (m_edited_sprs.size() == 1) { m_parent->Bind(wxEVT_COMMAND_MENU_SELECTED, &EditPanelImpl::OnRightPopupMenu, m_stage, MENU_SELECT_SAME); menu.Append(MENU_SELECT_SAME, "Ñ¡ÔñÏàͬ"); menu.AppendSeparator(); } }
void showPopupMenu( wxMenu& menu ) override { if( m_grid->GetGridCursorCol() == COL_OPTIONS ) { menu.Append( MYID_OPTIONS_EDITOR, _( "Options Editor..." ), _( "Edit options" ) ); menu.AppendSeparator(); } GRID_TRICKS::showPopupMenu( menu ); }
void wxcEditManager::DoPopulateUnRedoMenu(wxMenu& menu, bool undoing) { wxString prefix(undoing ? _("Undo ") : _("Redo ")); int id = FIRST_MENU_ID; int count = 0; if(undoing) { if(m_undoList.size() > 0) { for(State::List_t::const_reverse_iterator iter = m_undoList.rbegin(); iter != m_undoList.rend(); ++iter) { State::Ptr_t command = *iter; if(command) { menu.Append(id++, wxString::Format("%i ", ++count) + prefix + command->label); } } } } else { for(State::List_t::const_reverse_iterator iter = m_redoList.rbegin(); iter != m_redoList.rend(); ++iter) { State::Ptr_t command = *iter; if(command) { menu.Append(id++, wxString::Format("%i ", ++count) + prefix + command->label); } } } }
void SubsTextEditCtrl::AddSpellCheckerEntries(wxMenu &menu) { if (currentWord.empty()) return; if (spellchecker->CanRemoveWord(currentWord)) menu.Append(EDIT_MENU_REMOVE_FROM_DICT, fmt_tl("Remove \"%s\" from dictionary", currentWord)); sugs = spellchecker->GetSuggestions(currentWord); if (spellchecker->CheckWord(currentWord)) { if (sugs.empty()) menu.Append(EDIT_MENU_SUGGESTION,_("No spell checker suggestions"))->Enable(false); else { auto subMenu = new wxMenu; for (size_t i = 0; i < sugs.size(); ++i) subMenu->Append(EDIT_MENU_SUGGESTIONS+i, to_wx(sugs[i])); menu.Append(-1, fmt_tl("Spell checker suggestions for \"%s\"", currentWord), subMenu); } } else { if (sugs.empty()) menu.Append(EDIT_MENU_SUGGESTION,_("No correction suggestions"))->Enable(false); for (size_t i = 0; i < sugs.size(); ++i) menu.Append(EDIT_MENU_SUGGESTIONS+i, to_wx(sugs[i])); // Append "add word" menu.Append(EDIT_MENU_ADD_TO_DICT, fmt_tl("Add \"%s\" to dictionary", currentWord))->Enable(spellchecker->CanAddWord(currentWord)); } }
bool LocationView::MouseRightDown(const Point2D& mousePt, wxMenu& popupMenu) { if(IsClicked(mousePt)) { if(popupMenu.GetMenuItems().size() == 0) { popupMenu.Append(ID_POPUP_MNU_PROPERTIES, wxT("Properties")); } return true; } return false; }
void RightPopupMenu::CreateSelectMenu(wxMenu& menu) { if (m_selected_sprs.size() <= 1) { return; } int sz = std::min(MENU_MULTI_SELECTED_END - MENU_MULTI_SELECTED + 1, (int)m_selected_sprs.size()); for (int i = 0; i < sz; ++i) { auto spr = m_selected_sprs[i]; m_parent->Bind(wxEVT_COMMAND_MENU_SELECTED, &EditPanelImpl::OnRightPopupMenu, m_stage, MENU_MULTI_SELECTED + i); auto name = FileHelper::GetFilename(std::dynamic_pointer_cast<ee::Symbol>(spr->GetSymbol())->GetFilepath()); menu.Append(MENU_MULTI_SELECTED + i, name.c_str()); } menu.AppendSeparator(); }
void ddTextTableItemFigure::createMenu(wxMenu &mnu) { wxMenu *submenu; wxMenuItem *item; mnu.Append(MNU_DDADDCOLUMN, _("Add a column...")); item = mnu.Append(MNU_DELCOLUMN, _("Delete the selected column...")); if(getOwnerColumn()->isGeneratedForeignKey()) item->Enable(false); mnu.Append(MNU_RENAMECOLUMN, _("Rename the selected column...")); if(getOwnerColumn()->isGeneratedForeignKey() && !getOwnerColumn()->isFkNameGenerated()) mnu.Append(MNU_AUTONAMCOLUMN, _("Activate fk auto-naming...")); mnu.AppendSeparator(); item = mnu.AppendCheckItem(MNU_NOTNULL, _("Not NULL constraint")); if(getOwnerColumn()->isNotNull()) item->Check(true); if(getOwnerColumn()->isGeneratedForeignKey()) item->Enable(false); mnu.AppendSeparator(); item = mnu.AppendCheckItem(MNU_PKEY, _("Primary Key")); if(getOwnerColumn()->isPrimaryKey()) item->Check(true); if(getOwnerColumn()->isGeneratedForeignKey()) item->Enable(false); item = mnu.AppendCheckItem(MNU_UKEY, _("Unique Key")); if(getOwnerColumn()->isUniqueKey()) item->Check(true); mnu.AppendSeparator(); submenu = new wxMenu(); item = mnu.AppendSubMenu(submenu, _("Column datatype")); if(getOwnerColumn()->isGeneratedForeignKey()) item->Enable(false); item = submenu->AppendCheckItem(MNU_TYPESERIAL, _("serial")); item->Check(columnType == dt_bigint); item = submenu->AppendCheckItem(MNU_TYPEBOOLEAN, _("boolean")); item->Check(columnType == dt_boolean); item = submenu->AppendCheckItem(MNU_TYPEINTEGER, _("integer")); item->Check(columnType == dt_integer); item = submenu->AppendCheckItem(MNU_TYPEMONEY, _("money")); item->Check(columnType == dt_money); item = submenu->AppendCheckItem(MNU_TYPEVARCHAR, _("varchar(n)")); item->Check(columnType == dt_varchar); item = submenu->Append(MNU_TYPEOTHER, _("Choose another datatype...")); mnu.AppendSeparator(); mnu.Append(MNU_TYPEPKEY_CONSTRAINTNAME, _("Primary Key Constraint name...")); mnu.Append(MNU_TYPEUKEY_CONSTRAINTNAME, _("Unique Key Constraint name...")); mnu.AppendSeparator(); mnu.Append(MNU_DELTABLE, _("Delete table...")); };
void Scrubber::PopulateMenu(wxMenu &menu) { int id = CMD_ID; auto cm = mProject->GetCommandManager(); const MenuItem *checkedItem = HasStartedScrubbing() ? &FindMenuItem(mSmoothScrollingScrub, mAlwaysSeeking) : nullptr; for (const auto &item : menuItems) { if (cm->GetEnabled(item.name)) { #ifdef CHECKABLE_SCRUB_MENU_ITEMS menu.AppendCheckItem(id, item.label); if(&item == checkedItem) menu.FindItem(id)->Check(); #else menu.Append(id, item.label); #endif } ++id; } }
//Hack to allow use (events) of wxmenu inside a tool like simpletexttool void ddDrawingView::setTextPopUpList(wxArrayString &strings, wxMenu &mnu) { //DD-TODO: choose a better id for event mnu.Disconnect(wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)(wxEventFunction) (wxCommandEventFunction) &ddDrawingView::OnTextPopupClick,NULL,this); int sz = strings.size(); //to avoid warning wxMenuItem *item = NULL; wxMenu *submenu = NULL; bool isSubItem; bool subItemsDisable=false; for(int i=0 ; i < sz ; i++){ //DD-TODO: only create options for what I need, this can be improved later //String "--submenu##menu item**sub menu title" and "--subitem--" create and add items to last created submenu isSubItem=false; item=NULL; if(strings[i].Contains(wxT("--submenu"))) { if(strings[i].Contains(wxT("--disable"))) subItemsDisable=true; else subItemsDisable=false; submenu = new wxMenu(strings[i].SubString(strings[i].find(wxT("**"))+2,strings[i].length())); mnu.AppendSubMenu(submenu,strings[i].SubString(strings[i].find(wxT("##"))+2,strings[i].find(wxT("**"))-1)); } else if(strings[i].Contains(wxT("--subitem"))) { isSubItem=true; if(submenu) { if(strings[i].Contains(wxT("--checked"))) { item=submenu->AppendCheckItem(i,strings[i].SubString(strings[i].find(wxT("**"))+2,strings[i].length())); } else { item=submenu->Append(i,strings[i].SubString(strings[i].find(wxT("**"))+2,strings[i].length())); } } else { wxMessageDialog *error = new wxMessageDialog(NULL, wxT("Error setting text popup strings list"), wxT("Error!"), wxOK | wxICON_ERROR); error->ShowModal(); delete error; } } else if(strings[i].Contains(wxT("--separator--"))) { mnu.AppendSeparator(); } else if(strings[i].Contains(wxT("--checked"))) { item = mnu.AppendCheckItem(i, strings[i].SubString(strings[i].find(wxT("**"))+2,strings[i].length())); } else if(strings[i].Contains(wxT("**"))) { item = mnu.Append(i, strings[i].SubString(strings[i].find(wxT("**"))+2,strings[i].length())); } else { item = mnu.Append(i, strings[i]); } if(item && strings[i].Contains(wxT("--checked"))) { item->Check(true); } if( item && ( strings[i].Contains(wxT("--disable")) || (submenu && isSubItem && subItemsDisable) ) ) { item->Enable(false); } } //DD-TODO: create a better version of this hack mnu.Connect(wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)(wxEventFunction) (wxCommandEventFunction) &ddDrawingView::OnTextPopupClick,NULL,this); }