void OpenWindowsPanel::OnActiveEditorChanged(wxCommandEvent& e) { e.Skip(); CHECK_WORKSPACE_CLOSING(); PopulateView(); if(m_mgr->GetActiveEditor()) { DoSelectItem(m_mgr->GetActiveEditor()); } else { DoSelectItem((wxWindow*)e.GetClientData()); } }
void AbbreviationsSettingsDlg::OnItemSelected( wxCommandEvent& event ) { if(m_dirty) { DoSaveCurrent(); } DoSelectItem(event.GetSelection()); }
RenameFileDlg::RenameFileDlg( wxWindow* parent, const wxString &replaceWith, std::vector<IncludeStatement> &matches ) : RenameFileBaseDlg( parent ) { m_textCtrlReplaceWith->SetValue(replaceWith); for (size_t i=0; i<matches.size(); i++) { wxString displayString; IncludeStatement is = matches.at(i); displayString << wxString(is.includedFrom.c_str(), wxConvUTF8) << wxT(":") << is.line; int idx = m_checkListMatches->Append(displayString); // Keep the information about this entry m_entries[idx] = is; m_checkListMatches->Check(idx); } if ( m_checkListMatches->GetCount() ) { m_checkListMatches->Select(0); DoSelectItem(0); } WindowAttrManager::Load(this, wxT("RenameFileDlg"), NULL); }
void OpenWindowsPanel::OnActivePageChanged(wxCommandEvent& e) { e.Skip(); CHECK_WORKSPACE_CLOSING(); PopulateView(); DoSelectItem((wxWindow*)e.GetClientData()); }
void OpenResourceDialog::OnKeyDown(wxKeyEvent& event) { if (event.GetKeyCode() == WXK_DOWN && m_listOptions->GetItemCount()> 0) { //up key int cursel = m_listOptions->GetFirstSelected(); if (cursel != wxNOT_FOUND) { //there is a selection in the listbox cursel++; if (cursel >= (int)m_listOptions->GetItemCount()) { //already at last item, cant scroll anymore return; } DoSelectItem(cursel); } else { //no selection is made DoSelectItem(0); } return; } else if (event.GetKeyCode() == WXK_UP && m_listOptions->GetItemCount() > 0) { //up key int cursel = m_listOptions->GetFirstSelected(); if (cursel != wxNOT_FOUND) { //there is a selection in the listbox cursel--; if (cursel < 0) { //already at first item, cant scroll anymore return; } DoSelectItem(cursel); } else { //no selection is made DoSelectItem(0); } return; } else event.Skip(); }
void OpenWindowsPanel::OnSortItems(wxCommandEvent& event) { if(event.IsChecked()) { SortAlphabetically(); } else { SortByEditorOrder(); } IEditor* editor = m_mgr->GetActiveEditor(); DoSelectItem(editor); clConfig::Get().Write(kConfigTabsPaneSortAlphabetically, event.IsChecked()); }
void OpenResourceDialog::OnKeyDown(wxKeyEvent& event) { event.Skip(); if(m_dataviewModel->IsEmpty()) return; if(event.GetKeyCode() == WXK_DOWN || event.GetKeyCode() == WXK_UP || event.GetKeyCode() == WXK_NUMPAD_UP || event.GetKeyCode() == WXK_NUMPAD_DOWN) { event.Skip(false); bool down = (event.GetKeyCode() == WXK_DOWN || event.GetKeyCode() == WXK_NUMPAD_DOWN); wxDataViewItemArray children; m_dataviewModel->GetChildren(wxDataViewItem(0), children); wxDataViewItemArray selections; wxDataViewItem selection; m_dataview->GetSelections(selections); if(!selections.IsEmpty()) { selection = selections.Item(0); } if(!selection.IsOk()) { // No selection, select the first DoSelectItem(children.Item(0)); } else { int curIndex = wxNOT_FOUND; for(size_t i = 0; i < children.size(); ++i) { if(children.Item(i) == selection) { curIndex = i; break; } } if(curIndex != wxNOT_FOUND) { down ? ++curIndex : --curIndex; if((curIndex >= 0) && (curIndex < (int)children.size())) { DoSelectItem(children.Item(curIndex)); } } } // Set the focus back to the text control m_textCtrlResourceName->CallAfter(&wxTextCtrl::SetFocus); } }
void OpenResourceDialog::DoPopulateTags() { bool gotExactMatch(false); // Next, add the tags TagEntryPtrVector_t tags; if(m_userFilters.IsEmpty()) return; m_manager->GetTagsManager()->GetTagsByPartialName(m_userFilters.Item(0), tags); for(size_t i = 0; i < tags.size(); i++) { TagEntryPtr tag = tags.at(i); // Filter out non relevanting entries if(!m_filters.IsEmpty() && m_filters.Index(tag->GetKind()) == wxNOT_FOUND) continue; if(!MatchesFilter(tag->GetName())) continue; wxString name(tag->GetName()); // keep the fullpath wxDataViewItem item; wxString fullname; if(tag->GetKind() == wxT("function") || tag->GetKind() == wxT("prototype")) { fullname = wxString::Format( wxT("%s::%s%s"), tag->GetScope().c_str(), tag->GetName().c_str(), tag->GetSignature().c_str()); item = DoAppendLine(tag->GetName(), fullname, (tag->GetKind() == wxT("function")), new OpenResourceDialogItemData( tag->GetFile(), tag->GetLine(), tag->GetPattern(), tag->GetName(), tag->GetScope()), DoGetTagImg(tag)); } else { fullname = wxString::Format(wxT("%s::%s"), tag->GetScope().c_str(), tag->GetName().c_str()); item = DoAppendLine(tag->GetName(), fullname, false, new OpenResourceDialogItemData( tag->GetFile(), tag->GetLine(), tag->GetPattern(), tag->GetName(), tag->GetScope()), DoGetTagImg(tag)); } if((m_userFilters.GetCount() == 1) && (m_userFilters.Item(0).CmpNoCase(name) == 0) && !gotExactMatch) { gotExactMatch = true; DoSelectItem(item); } } }
void OpenResourceDialog::OnTimer(wxTimerEvent& event) { if(m_needRefresh) { DoPopulateList(); } m_needRefresh = false; // If there is only 1 item in the resource window then highlight it. // This allows the user to hit ENTER immediately after to open the item, nice shortcut. { wxDataViewItemArray children; m_dataviewModel->GetChildren(wxDataViewItem(0), children); if(children.size() == 1) { DoSelectItem(children.Item(0)); } } }
void OpenResourceDialog::DoPopulateWorkspaceFile() { wxArrayString tmpArr; wxString curSel = m_textCtrlResourceName->GetValue(); if (!curSel.Trim().Trim(false).IsEmpty()) { curSel = curSel.MakeLower().Trim().Trim(false); for (size_t i=0; i<m_files.GetCount(); i++) { wxString fileName(m_files.Item(i)); wxString fileNameOnly(wxFileName(fileName).GetFullName()); fileNameOnly.MakeLower(); //append wildcard at the end if (!curSel.EndsWith(wxT("*"))) { curSel << wxT("*"); } // FR# [2008133] if (m_checkBoxUsePartialMatching->IsChecked() && !curSel.StartsWith(wxT("*"))) { curSel.Prepend(wxT("*")); } if (wxMatchWild(curSel, fileNameOnly)) { // keep the fullpath tmpArr.Add(m_files.Item(i)); } } } // Change was done, update the file list for (size_t i=0; i<tmpArr.GetCount(); i++) { wxFileName fn(tmpArr.Item(i)); DoAppendLine(fn.GetFullName(), fn.GetFullPath(), wxT(""), false, new OpenResourceDialogItemData(tmpArr.Item(i), -1, wxT(""), OpenResourceDialog::TYPE_WORKSPACE_FILE, wxT(""), wxT(""))); if( i == 150 ) { m_staticTextErrorMessage->SetLabel(wxT("Too many matches, please narrow down your search")); break; } } if (m_listOptions->GetItemCount() > 0) { DoSelectItem(0); } }
void AbbreviationsSettingsDlg::DoPopulateItems() { m_listBoxAbbreviations->Clear(); m_stc->ClearAll(); std::map<wxString, wxString> entries = m_data.GetEntries(); std::map<wxString, wxString>::iterator iter = entries.begin(); for(; iter != entries.end(); ++iter) { m_listBoxAbbreviations->Append(iter->first); } if(m_listBoxAbbreviations->IsEmpty() == false) { m_listBoxAbbreviations->Select(0); DoSelectItem(0); } m_checkBoxImmediateInsert->SetValue(m_data.IsAutoInsert()); m_dirty = false; }
void AbbreviationsSettingsDlg::OnDelete(wxCommandEvent& event) { if(m_activeItemName.IsEmpty() || m_currSelection == wxNOT_FOUND) { return; } if(wxMessageBox(wxString::Format(_("Are you sure you want to delete '%s'"), m_activeItemName.c_str()), _("CodeLite"), wxYES_NO|wxCANCEL|wxCENTER|wxICON_QUESTION, this) != wxYES) { return; } // delete the entry from the configuration file DoDeleteEntry(m_activeItemName); // delete it m_listBoxAbbreviations->Delete((unsigned int) m_currSelection); m_stc->Clear(); m_textCtrlName->Clear(); // select the previous item in the list if(m_listBoxAbbreviations->IsEmpty() == false) { switch(m_currSelection) { case 0: m_currSelection = 0; m_activeItemName = m_listBoxAbbreviations->GetString(0); break; default: m_currSelection--; m_activeItemName = m_listBoxAbbreviations->GetString(m_currSelection); break; } } else { m_activeItemName.Empty(); m_currSelection = wxNOT_FOUND; } if(m_currSelection != wxNOT_FOUND) { m_listBoxAbbreviations->SetSelection(m_currSelection); DoSelectItem(m_currSelection); } m_dirty = true; }
void OpenResourceDialog::DoPopulateTags() { if (m_tags.empty()) return; bool gotExactMatch(false); wxArrayString tmpArr; wxString curSel = m_textCtrlResourceName->GetValue(); wxString curSelNoStar; if (!curSel.Trim().Trim(false).IsEmpty()) { curSel = curSel.MakeLower().Trim().Trim(false); curSelNoStar = curSel.c_str(); for (size_t i=0; i<m_tags.size(); i++) { TagEntryPtr tag = m_tags.at(i); wxString name(tag->GetName()); name.MakeLower(); //append wildcard at the end if (!curSel.EndsWith(wxT("*"))) { curSel << wxT("*"); } // FR# [2008133] if (m_checkBoxUsePartialMatching->IsChecked() && !curSel.StartsWith(wxT("*"))) { curSel.Prepend(wxT("*")); } if (wxMatchWild(curSel, name)) { // keep the fullpath int index(0); if(tag->GetKind() == wxT("function") || tag->GetKind() == wxT("prototype")) index = DoAppendLine(tag->GetName(), tag->GetSignature(), tag->GetScope(), tag->GetKind() == wxT("function"), new OpenResourceDialogItemData(tag->GetFile(), tag->GetLine(), tag->GetPattern(), m_type, tag->GetName(), tag->GetScope())); else index = DoAppendLine(tag->GetName(), tag->GetScope(), wxT(""), false, new OpenResourceDialogItemData(tag->GetFile(), tag->GetLine(), tag->GetPattern(), m_type, tag->GetName(), tag->GetScope())); if (curSelNoStar == name && !gotExactMatch) { gotExactMatch = true; DoSelectItem(index); } } } } if (m_listOptions->GetItemCount() == 150) { m_staticTextErrorMessage->SetLabel(wxT("Too many matches, please narrow down your search")); } if (!gotExactMatch && m_listOptions->GetItemCount()) { DoSelectItem(0); } }
void RenameFileDlg::OnFileSelected( wxCommandEvent& event ) { DoSelectItem(event.GetSelection()); }