本文整理汇总了C++中CDocument::IsModified方法的典型用法代码示例。如果您正苦于以下问题:C++ CDocument::IsModified方法的具体用法?C++ CDocument::IsModified怎么用?C++ CDocument::IsModified使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDocument
的用法示例。
在下文中一共展示了CDocument::IsModified方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnUpdateFrameTitle
void CMDITabChildWnd::OnUpdateFrameTitle(BOOL bAddToTitle)
{
// Don't call super - all it does it take the document title and put it there.
CDocument* pDocument = GetActiveDocument();
if (bAddToTitle && pDocument)
{
bool fModified = (pDocument->IsModified() == TRUE);
if (_fFirstTime || (_fModifiedCache != fModified))
{
_fModifiedCache = (pDocument->IsModified() == TRUE);
_UpdateFrameTitle(pDocument);
_fFirstTime = true;
}
}
}
示例2: OnUpdateFrameTitle
void CChildFrame::OnUpdateFrameTitle(BOOL bAddToTitle)
//----------------------------------------------------
{
// update our parent window first
GetMDIFrame()->OnUpdateFrameTitle(bAddToTitle);
if ((GetStyle() & FWS_ADDTOTITLE) == 0) {
return; // leave child window alone!
}
CDocument* pDocument = GetActiveDocument();
if (bAddToTitle) {
TCHAR szText[256+_MAX_PATH];
if (pDocument == NULL) {
lstrcpy(szText, m_strTitle);
} else {
lstrcpy(szText, pDocument->GetTitle());
if (pDocument->IsModified()) lstrcat(szText, "*");
}
if (m_nWindow > 0) {
wsprintf(szText + lstrlen(szText), _T(":%d"), m_nWindow);
}
// set title if changed, but don't remove completely
AfxSetWindowText(m_hWnd, szText);
}
}
示例3: Py_BuildValue
// @pymethod int|PyCDocument|IsModified|Return a flag indicating if the document has been modified.
PyObject *
ui_doc_is_modified(PyObject *self, PyObject *args)
{
CDocument *pDoc;
if (!(pDoc=PyCDocument::GetDoc(self)))
return NULL;
CHECK_NO_ARGS2(args,IsModified);
GUI_BGN_SAVE;
int rc = pDoc->IsModified();
GUI_END_SAVE;
return Py_BuildValue("i", rc); // @pyseemfc CDocument|IsModified
}
示例4: OpenDocumentFile
CDocument* CDocTemplateEx::OpenDocumentFile(LPCTSTR lpszPathName, BOOL bMakeVisible)
{
CAIPIApp* pApp = (CAIPIApp*)AfxGetApp();
if (m_docList.GetCount() == 1)
{
CDocument* pDocument = (CDocument*)m_docList.GetHead();
BOOL e = pDocument->GetPathName().IsEmpty();
BOOL m = pDocument->IsModified();
if (lpszPathName != NULL && pDocument->GetPathName().IsEmpty() && pDocument->IsModified())
{
pApp->AipiOpenDocumentFile(lpszPathName);
CWaitCursor wait;
if (!pDocument->OnOpenDocument(lpszPathName))
{
// user has be alerted to what failed in OnOpenDocument
TRACE0("CDocument::OnOpenDocument returned FALSE.\n");
return NULL;
}
pDocument->SetPathName(lpszPathName);
POSITION pos = pDocument->GetFirstViewPosition();
CView* pView = pDocument->GetNextView(pos);
CFrameWnd* pFrame = pView->GetParentFrame();
InitialUpdateFrame(pFrame, pDocument);
return pDocument;
}
}
pApp->AipiOpenDocumentFile(lpszPathName);
return CMultiDocTemplate::OpenDocumentFile(lpszPathName, bMakeVisible);
}
示例5: OnUpdateFrameTitle
void CChildFrame::OnUpdateFrameTitle(BOOL bAddToTitle)
{
GetMDIFrame()->OnUpdateFrameTitle(bAddToTitle);
if ( (GetStyle() & FWS_ADDTOTITLE) == 0) return;
if (bAddToTitle)
{
CDocument* pDoc = GetActiveDocument();
CString csText;
if (pDoc == NULL) csText = m_strTitle;
else {
csText = pDoc->GetTitle();
}
if (m_nWindow > 0) csText.Format(_T("%s: %d"), csText, m_nWindow);
if (pDoc->IsModified()) csText += " *";
AfxSetWindowText(m_hWnd, csText);
}
}
示例6: OpenDocumentFile
CDocument* CSingleDocTemplate::OpenDocumentFile(LPCTSTR lpszPathName,
BOOL bMakeVisible)
// if lpszPathName == NULL => create new file of this type
{
CDocument* pDocument = NULL;
CFrameWnd* pFrame = NULL;
BOOL bCreated = FALSE; // => doc and frame created
BOOL bWasModified = FALSE;
if (m_pOnlyDoc != NULL)
{
// already have a document - reinit it
pDocument = m_pOnlyDoc;
if (!pDocument->SaveModified())
return NULL; // leave the original one
pFrame = (CFrameWnd*)AfxGetMainWnd();
ASSERT(pFrame != NULL);
ASSERT(pFrame->IsKindOf(RUNTIME_CLASS(CFrameWnd)));
ASSERT_VALID(pFrame);
}
else
{
// create a new document
pDocument = CreateNewDocument();
ASSERT(pFrame == NULL); // will be created below
bCreated = TRUE;
}
if (pDocument == NULL)
{
AfxMessageBox(AFX_IDP_FAILED_TO_CREATE_DOC);
return NULL;
}
ASSERT(pDocument == m_pOnlyDoc);
if (pFrame == NULL)
{
ASSERT(bCreated);
// create frame - set as main document frame
BOOL bAutoDelete = pDocument->m_bAutoDelete;
pDocument->m_bAutoDelete = FALSE;
// don't destroy if something goes wrong
pFrame = CreateNewFrame(pDocument, NULL);
pDocument->m_bAutoDelete = bAutoDelete;
if (pFrame == NULL)
{
AfxMessageBox(AFX_IDP_FAILED_TO_CREATE_DOC);
delete pDocument; // explicit delete on error
return NULL;
}
}
if (lpszPathName == NULL)
{
// create a new document
SetDefaultTitle(pDocument);
// avoid creating temporary compound file when starting up invisible
if (!bMakeVisible)
pDocument->m_bEmbedded = TRUE;
if (!pDocument->OnNewDocument())
{
// user has been alerted to what failed in OnNewDocument
TRACE0("CDocument::OnNewDocument returned FALSE.\n");
if (bCreated)
pFrame->DestroyWindow(); // will destroy document
return NULL;
}
}
else
{
BeginWaitCursor();
// open an existing document
bWasModified = pDocument->IsModified();
pDocument->SetModifiedFlag(FALSE); // not dirty for open
if (!pDocument->OnOpenDocument(lpszPathName))
{
// user has been alerted to what failed in OnOpenDocument
TRACE0("CDocument::OnOpenDocument returned FALSE.\n");
if (bCreated)
{
pFrame->DestroyWindow(); // will destroy document
}
else if (!pDocument->IsModified())
{
// original document is untouched
pDocument->SetModifiedFlag(bWasModified);
}
else
{
// we corrupted the original document
SetDefaultTitle(pDocument);
if (!pDocument->OnNewDocument())
{
//.........这里部分代码省略.........