本文整理汇总了C++中TextView::getDocument方法的典型用法代码示例。如果您正苦于以下问题:C++ TextView::getDocument方法的具体用法?C++ TextView::getDocument怎么用?C++ TextView::getDocument使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextView
的用法示例。
在下文中一共展示了TextView::getDocument方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnFileOpen
void CMainFrame::OnFileOpen(int id) {
TextView *view = getActiveTextView();
if(view == NULL) {
showWarning(_T("No active view"));
return;
}
CFileDialog dlg(TRUE);
dlg.m_ofn.lpstrFilter = getFileDialogExtension().cstr();
dlg.m_ofn.lpstrTitle = _T("Open files");
dlg.m_ofn.nFilterIndex = getOptions().m_defaultExtensionIndex;
dlg.m_ofn.Flags |= OFN_ALLOWMULTISELECT | OFN_FILEMUSTEXIST;
TCHAR fileNames[1024];
fileNames[0] = 0;
dlg.m_ofn.lpstrFile = fileNames;
dlg.m_ofn.nMaxFile = ARRAYSIZE(fileNames);
if((dlg.DoModal() != IDOK) || (_tcsclen(fileNames) == 0)) {
return;
}
getOptions().m_defaultExtensionIndex = dlg.m_ofn.nFilterIndex;
TCHAR *files[3];
getFileNames(files,fileNames);
CWinDiffDoc *doc = view->getDocument();
if(_tcsclen(files[1]) == 0) { // only one selected
doc->setDoc(id, DIFFDOC_FILE, files[0]);
} else {
const String f1 = FileNameSplitter::getChildName(files[0],files[1]);
const String f2 = FileNameSplitter::getChildName(files[0],files[2]);
doc->setDocs(f1, f2);
}
Invalidate(FALSE);
}
示例2: OnEditPaste
void CMainFrame::OnEditPaste() {
TextView *view = getActiveTextView();
if(view == NULL) {
return;
}
const String t = getClipboardText();
CWinDiffDoc *doc = view->getDocument();
doc->setDoc(view->getId(),DIFFDOC_BUF,t);
view->refreshBoth();
}
示例3: refreshDoc
void CMainFrame::refreshDoc(bool recomp) {
TextView *view = getActiveTextView();
if(view == NULL) {
return;
}
CWinDiffDoc *doc = view->getDocument();
if(recomp) {
doc->recompare();
}
view->savePositionState();
view->refreshBoth();
}
示例4: OnViewTabSize
void CMainFrame::OnViewTabSize() {
TextView *view = getActiveTextView();
if(view == NULL) {
return;
}
CWinDiffDoc *doc = view->getDocument();
const int tabSize = doc->m_diff.getTabSize();
CTabSizeDlg dlg(tabSize);
if(dlg.DoModal() == IDOK) {
if(dlg.m_tabSize != doc->m_diff.getTabSize()) {
view->setTabSize(dlg.m_tabSize, true);
}
}
}
示例5: onFileMruFile
void CMainFrame::onFileMruFile(int index) {
TextView *view = getActiveTextView();
if(view == NULL) return;
try {
const String fname = theApp.getRecentFile(index);
if(ACCESS(fname, 4) < 0) {
const int errorCode = errno;
showWarning(getErrnoText());
if(errorCode == ENOENT) {
theApp.removeFromRecentFiles(index);
}
return;
}
CWinDiffDoc *doc = view->getDocument();
doc->setDoc(view->getId(),DIFFDOC_FILE, fname);
Invalidate(FALSE);
//view->refreshBoth();
} catch(Exception e) {
showException(e);
}
}