本文整理汇总了C++中leditor::Vec_t::size方法的典型用法代码示例。如果您正苦于以下问题:C++ Vec_t::size方法的具体用法?C++ Vec_t::size怎么用?C++ Vec_t::size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类leditor::Vec_t
的用法示例。
在下文中一共展示了Vec_t::size方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SaveAll
bool MainBook::SaveAll(bool askUser, bool includeUntitled)
{
// turn the 'saving all' flag on so we could 'Veto' all focus events
LEditor::Vec_t editors;
GetAllEditors(editors, MainBook::kGetAll_Default);
std::vector<std::pair<wxFileName, bool> > files;
size_t n = 0;
for (size_t i = 0; i < editors.size(); i++) {
if (!editors[i]->GetModify())
continue;
if (!includeUntitled && !editors[i]->GetFileName().FileExists())
continue; //don't save new documents that have not been saved to disk yet
files.push_back(std::make_pair(editors[i]->GetFileName(), true));
editors[n++] = editors[i];
}
editors.resize(n);
bool res = !askUser || UserSelectFiles(files, _("Save Modified Files"),
_("Some files are modified.\nChoose the files you would like to save."));
if (res) {
for (size_t i = 0; i < files.size(); i++) {
if (files[i].second) {
editors[i]->SaveFile();
}
}
}
return res;
}
示例2: SaveAll
bool MainBook::SaveAll(bool askUser, bool includeUntitled)
{
// turn the 'saving all' flag on so we could 'Veto' all focus events
LEditor::Vec_t editors;
GetAllEditors(editors, MainBook::kGetAll_IncludeDetached);
std::vector<std::pair<wxFileName, bool> > files;
size_t n = 0;
for(size_t i = 0; i < editors.size(); i++) {
if(!editors[i]->GetModify()) continue;
if(!includeUntitled && !editors[i]->GetFileName().FileExists())
continue; // don't save new documents that have not been saved to disk yet
files.push_back(std::make_pair(editors[i]->GetFileName(), true));
editors[n++] = editors[i];
}
editors.resize(n);
bool res = !askUser || UserSelectFiles(files, _("Save Modified Files"),
_("Some files are modified.\nChoose the files you would like to save."));
if(res) {
for(size_t i = 0; i < files.size(); i++) {
if(files[i].second) {
editors[i]->SaveFile();
}
}
}
// And notify the plugins to save their tabs (this function only cover editors)
clCommandEvent saveAllEvent(wxEVT_SAVE_ALL_EDITORS);
EventNotifier::Get()->AddPendingEvent(saveAllEvent);
return res;
}
示例3: DeleteAllBreakpointMarkers
// Delete all line-type breakpoint markers in all editors
// Done before refreshing after a delete or edit, lest it was the last bp in a file
void BreakptMgr::DeleteAllBreakpointMarkers()
{
LEditor::Vec_t editors;
clMainFrame::Get()->GetMainBook()->GetAllEditors(editors, MainBook::kGetAll_IncludeDetached);
for(size_t i=0; i<editors.size(); ++i) {
editors.at(i)->DelAllBreakpointMarkers();
}
}
示例4: ReloadExternallyModified
void MainBook::ReloadExternallyModified(bool prompt)
{
if ( m_isWorkspaceReloading )
return;
LEditor::Vec_t editors;
GetAllEditors(editors, MainBook::kGetAll_IncludeDetached);
time_t workspaceModifiedTimeBefore = WorkspaceST::Get()->GetFileLastModifiedTime();
// filter list of editors for any whose files have been modified
std::vector<std::pair<wxFileName, bool> > files;
size_t n = 0;
for (size_t i = 0; i < editors.size(); i++) {
time_t diskTime = editors[i]->GetFileLastModifiedTime();
time_t editTime = editors[i]->GetEditorLastModifiedTime();
if (diskTime != editTime) {
// update editor last mod time so that we don't keep bugging the user over the same file,
// unless it gets changed again
editors[i]->SetEditorLastModifiedTime(diskTime);
// A last check: see if the content of the file has actually changed. This avoids unnecessary reload offers after e.g. git stash
if (!CompareFileWithString(editors[i]->GetFileName().GetFullPath(), editors[i]->GetText())) {
files.push_back(std::make_pair(editors[i]->GetFileName(), !editors[i]->GetModify()));
editors[n++] = editors[i];
}
}
}
editors.resize(n);
if(prompt) {
UserSelectFiles(files, _("Reload Modified Files"), _("Files have been modified outside the editor.\nChoose which files you would like to reload."), false);
}
time_t workspaceModifiedTimeAfter = WorkspaceST::Get()->GetFileLastModifiedTime();
if ( workspaceModifiedTimeBefore != workspaceModifiedTimeAfter ) {
// a workspace reload occured between the "Reload Modified Files" and
// the "Reload WOrkspace" dialog, cancel this it's not needed anymore
return;
}
std::vector<wxFileName> filesToRetag;
for (size_t i = 0; i < files.size(); i++) {
if (files[i].second) {
editors[i]->ReloadFile();
filesToRetag.push_back(files[i].first);
}
}
if (filesToRetag.size() > 1) {
TagsManagerST::Get()->RetagFiles(filesToRetag, TagsManager::Retag_Quick);
SendCmdEvent(wxEVT_FILE_RETAGGED, (void*)&filesToRetag);
} else if (filesToRetag.size() == 1) {
ManagerST::Get()->RetagFile(filesToRetag.at(0).GetFullPath());
SendCmdEvent(wxEVT_FILE_RETAGGED, (void*)&filesToRetag);
}
}
示例5: RefreshPreProcessorColouring
void CodeCompletionManager::RefreshPreProcessorColouring()
{
bool enableBlockColouring = TagsManagerST::Get()->GetCtagsOptions().GetCcColourFlags() & CC_COLOUR_MACRO_BLOCKS;
LEditor::Vec_t editors;
clMainFrame::Get()->GetMainBook()->GetAllEditors(editors, MainBook::kGetAll_IncludeDetached);
if(!enableBlockColouring) {
for(size_t i = 0; i < editors.size(); ++i) {
LEditor* editor = editors.at(i);
editor->SetPreProcessorsWords("");
editor->SetProperty("lexer.cpp.track.preprocessor", "0");
editor->SetProperty("lexer.cpp.update.preprocessor", "0");
}
} else {
for(size_t i = 0; i < editors.size(); ++i) {
LEditor* editor = editors.at(i);
editor->SetProperty("lexer.cpp.track.preprocessor", "0");
editor->SetProperty("lexer.cpp.update.preprocessor", "0");
ProcessMacros(editor);
}
}
}
示例6: OnPageChanged
void MainBook::OnPageChanged(wxBookCtrlEvent& e)
{
e.Skip();
int newSel = e.GetSelection();
if(newSel != wxNOT_FOUND && m_reloadingDoRaise) {
wxWindow* win = m_book->GetPage((size_t)newSel);
if(win) {
SelectPage(win);
}
}
// Cancel any tooltip
LEditor::Vec_t editors;
GetAllEditors(editors, MainBook::kGetAll_IncludeDetached);
for(size_t i = 0; i < editors.size(); ++i) {
// Cancel any calltip when switching from the editor
editors.at(i)->DoCancelCalltip();
}
DoUpdateNotebookTheme();
}
示例7: OnSearchEnded
void FindResultsTab::OnSearchEnded(wxCommandEvent& e)
{
m_searchInProgress = false;
SearchSummary* summary = (SearchSummary*)e.GetClientData();
if(!summary) return;
// did the page closed before the search ended?
AppendText(summary->GetMessage() + wxT("\n"));
if(m_tb->GetToolToggled(XRCID("scroll_on_output"))) {
m_sci->GotoLine(0);
}
if(!EditorConfigST::Get()->GetOptions()->GetDontAutoFoldResults()) {
OutputTabWindow::OnCollapseAll(e);
// Uncollapse the first file's matches
int maxLine = m_sci->GetLineCount();
for(int line = 0; line < maxLine; line++) {
int foldLevel = (m_sci->GetFoldLevel(line) & wxSTC_FOLDLEVELNUMBERMASK) - wxSTC_FOLDLEVELBASE;
if(foldLevel == 2 && !m_sci->GetFoldExpanded(line)) {
m_sci->ToggleFold(line);
break;
}
}
}
delete summary;
SaveSearchData();
// We need to tell all editors that there's been a (new) search
// This lets them clear any already-saved line-changes,
// which a new save will have taken into account
LEditor::Vec_t editors;
clMainFrame::Get()->GetMainBook()->GetAllEditors(editors, MainBook::kGetAll_IncludeDetached);
for(size_t n = 0; n < editors.size(); ++n) {
LEditor* editor = dynamic_cast<LEditor*>(*(editors.begin() + n));
if(editor) {
editor->OnFindInFiles();
}
}
}
示例8: CloseAll
bool MainBook::CloseAll(bool cancellable)
{
LEditor::Vec_t editors;
GetAllEditors(editors, kGetAll_IncludeDetached);
// filter list of editors for any that need to be saved
std::vector<std::pair<wxFileName, bool> > files;
size_t n = 0;
for(size_t i = 0; i < editors.size(); i++) {
if(editors[i]->GetModify()) {
files.push_back(std::make_pair(editors[i]->GetFileName(), true));
editors[n++] = editors[i];
}
}
editors.resize(n);
if(!UserSelectFiles(files, _("Save Modified Files"),
_("Some files are modified.\nChoose the files you would like to save."), cancellable))
return false;
for(size_t i = 0; i < files.size(); i++) {
if(files[i].second) {
editors[i]->SaveFile();
} else {
editors[i]->SetSavePoint();
}
}
// Delete the files without notifications (it will be faster)
clWindowUpdateLocker locker(this);
#if HAS_LIBCLANG
ClangCodeCompletion::Instance()->CancelCodeComplete();
#endif
SendCmdEvent(wxEVT_ALL_EDITORS_CLOSING);
m_reloadingDoRaise = false;
m_book->DeleteAllPages();
m_reloadingDoRaise = true;
// Delete all detached editors
EditorFrame::List_t::iterator iter = m_detachedEditors.begin();
for(; iter != m_detachedEditors.end(); ++iter) {
(*iter)->Destroy(); // Destroying the frame will release the editor
}
// Since we got no more editors opened,
// send a wxEVT_ALL_EDITORS_CLOSED event
SendCmdEvent(wxEVT_ALL_EDITORS_CLOSED);
// Update the quick-find-bar
m_quickFindBar->SetEditor(NULL);
ShowQuickBar(false);
// Clear the Navigation Bar if it is not empty
TagEntryPtr tag = NULL;
m_navBar->UpdateScope(tag);
// Update the frame's title
clMainFrame::Get()->SetFrameTitle(NULL);
DoHandleFrameMenu(NULL);
// OutputTabWindow::OnEditUI will crash on >=wxGTK-2.9.3 if we don't set the focus somewhere that still exists
// This workaround doesn't seem to work if applied earlier in the function :/
m_book->SetFocus();
return true;
}
示例9: ReloadExternallyModified
void MainBook::ReloadExternallyModified(bool prompt)
{
if(m_isWorkspaceReloading) return;
static int depth = wxNOT_FOUND;
++depth;
// Protect against recursion
if(depth == 2) {
depth = wxNOT_FOUND;
return;
}
LEditor::Vec_t editors;
GetAllEditors(editors, MainBook::kGetAll_IncludeDetached);
time_t workspaceModifiedTimeBefore = clCxxWorkspaceST::Get()->GetFileLastModifiedTime();
// filter list of editors for any whose files have been modified
std::vector<std::pair<wxFileName, bool> > files;
size_t n = 0;
for(size_t i = 0; i < editors.size(); i++) {
time_t diskTime = editors[i]->GetFileLastModifiedTime();
time_t editTime = editors[i]->GetEditorLastModifiedTime();
if(diskTime != editTime) {
// update editor last mod time so that we don't keep bugging the user over the same file,
// unless it gets changed again
editors[i]->SetEditorLastModifiedTime(diskTime);
// A last check: see if the content of the file has actually changed. This avoids unnecessary reload offers
// after e.g. git stash
if(!CompareFileWithString(editors[i]->GetFileName().GetFullPath(), editors[i]->GetText())) {
files.push_back(std::make_pair(editors[i]->GetFileName(), !editors[i]->GetModify()));
editors[n++] = editors[i];
}
}
}
editors.resize(n);
if(n == 0) return;
if(prompt) {
int res = clConfig::Get().GetAnnoyingDlgAnswer("FilesModifiedDlg", wxNOT_FOUND);
if(res == wxID_CANCEL) {
return; // User had previous ticked the 'Remember my answer' checkbox after he'd just chosen Ignore
}
if(res == wxNOT_FOUND) {
// User hasn't previously ticked the 'Remember my answer' checkbox
// Show the dialog
res = GetFilesModifiedDlg()->ShowModal();
if(GetFilesModifiedDlg()->GetRememberMyAnswer()) {
clConfig::Get().SetAnnoyingDlgAnswer("FilesModifiedDlg", res);
}
if(res == FilesModifiedDlg::kID_BUTTON_IGNORE) {
return;
}
}
if(res == FilesModifiedDlg::kID_BUTTON_CHOOSE) {
UserSelectFiles(files, _("Reload Modified Files"),
_("Files have been modified outside the editor.\nChoose which files you would like to reload."), false);
}
}
time_t workspaceModifiedTimeAfter = clCxxWorkspaceST::Get()->GetFileLastModifiedTime();
if(workspaceModifiedTimeBefore != workspaceModifiedTimeAfter) {
// a workspace reload occured between the "Reload Modified Files" and
// the "Reload WOrkspace" dialog, cancel this it's not needed anymore
return;
}
// See issue: https://github.com/eranif/codelite/issues/663
LEditor::Vec_t editorsAgain;
GetAllEditors(editorsAgain, MainBook::kGetAll_IncludeDetached);
// Make sure that the tabs that we have opened
// are still available in the main book
LEditor::Vec_t realEditorsList;
std::sort(editors.begin(), editors.end());
std::sort(editorsAgain.begin(), editorsAgain.end());
std::set_intersection(
editorsAgain.begin(), editorsAgain.end(), editors.begin(), editors.end(), std::back_inserter(realEditorsList));
// Update the "files" list
if(editors.size() != realEditorsList.size()) {
// something went wrong here...
CallAfter(&MainBook::ReloadExternallyModified, prompt);
return;
}
// reset the recursive protector
depth = wxNOT_FOUND;
std::vector<wxFileName> filesToRetag;
for(size_t i = 0; i < files.size(); i++) {
if(files[i].second) {
editors[i]->ReloadFile();
filesToRetag.push_back(files[i].first);
//.........这里部分代码省略.........