本文整理汇总了C++中leditor::Vec_t类的典型用法代码示例。如果您正苦于以下问题:C++ Vec_t类的具体用法?C++ Vec_t怎么用?C++ Vec_t使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Vec_t类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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_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;
}
开发者ID:fmestrone,项目名称:codelite,代码行数:33,代码来源:mainbook.cpp
示例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_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;
}
开发者ID:qioixiy,项目名称:codelite,代码行数:31,代码来源:mainbook.cpp
示例3: GetAllEditors
void MainBook::GetAllEditors(LEditor::Vec_t& editors, size_t flags)
{
editors.clear();
if(!(flags & kGetAll_DetachedOnly)) {
// Collect booked editors
if(!(flags & kGetAll_RetainOrder)) {
// Most of the time we don't care about the order the tabs are stored in
for(size_t i = 0; i < m_book->GetPageCount(); i++) {
LEditor* editor = dynamic_cast<LEditor*>(m_book->GetPage(i));
if(editor) {
editors.push_back(editor);
}
}
} else {
std::vector<wxWindow*> windows;
for(size_t i = 0; i < m_book->GetPageCount(); i++) {
LEditor* editor = dynamic_cast<LEditor*>(m_book->GetPage(i));
if(editor) {
editors.push_back(editor);
}
}
}
}
if((flags & kGetAll_IncludeDetached) || (flags & kGetAll_DetachedOnly)) {
// Add the detached editors
EditorFrame::List_t::iterator iter = m_detachedEditors.begin();
for(; iter != m_detachedEditors.end(); ++iter) {
editors.push_back((*iter)->GetEditor());
}
}
}
开发者ID:fmestrone,项目名称:codelite,代码行数:31,代码来源:mainbook.cpp
示例4: 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();
}
}
开发者ID:qioixiy,项目名称:codelite,代码行数:10,代码来源:breakpointsmgr.cpp
示例5: 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);
}
}
开发者ID:qioixiy,项目名称:codelite,代码行数:58,代码来源:mainbook.cpp
示例6: GetAllEditors
size_t PluginManager::GetAllEditors(IEditor::List_t& editors, bool inOrder)
{
LEditor::Vec_t tmpEditors;
size_t flags = MainBook::kGetAll_IncludeDetached;
if(inOrder) {
flags |= MainBook::kGetAll_RetainOrder;
}
clMainFrame::Get()->GetMainBook()->GetAllEditors(tmpEditors, flags);
editors.insert(editors.end(), tmpEditors.begin(), tmpEditors.end());
return editors.size();
}
开发者ID:kaustubhcs,项目名称:codelite,代码行数:12,代码来源:pluginmanager.cpp
示例7: 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();
}
开发者ID:fmestrone,项目名称:codelite,代码行数:20,代码来源:mainbook.cpp
示例8: 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();
}
}
}
开发者ID:kluete,项目名称:codelite,代码行数:41,代码来源:findresultstab.cpp
示例9: 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);
}
}
}
开发者ID:05storm26,项目名称:codelite,代码行数:21,代码来源:code_completion_manager.cpp
示例10: 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;
}
开发者ID:fmestrone,项目名称:codelite,代码行数:69,代码来源:mainbook.cpp
示例11: 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);
//.........这里部分代码省略.........
开发者ID:fmestrone,项目名称:codelite,代码行数:101,代码来源:mainbook.cpp
注:本文中的leditor::Vec_t类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论