本文整理汇总了C++中CDocument::SetModifiedFlag方法的典型用法代码示例。如果您正苦于以下问题:C++ CDocument::SetModifiedFlag方法的具体用法?C++ CDocument::SetModifiedFlag怎么用?C++ CDocument::SetModifiedFlag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDocument
的用法示例。
在下文中一共展示了CDocument::SetModifiedFlag方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnFileOpen
void CSeriousSkaStudioApp::OnFileOpen()
{
CTFileName fnSim;
// get file name
fnSim = _EngineGUI.FileRequester( "Select existing Smc file",
"ASCII model files (*.smc)\0*.smc\0"
"All files (*.*)\0*.*\0\0",
"Open directory", "Models\\", "");
if (fnSim=="") return;
CTFileName fnFull;
fnFull = _fnmApplicationPath + fnSim;
CModelInstance *pmi = OnOpenExistingInstance(fnSim);
if(pmi == NULL)
{
// if faile to open smc
theApp.ErrorMessage("Failed to open model instance '%s'",(const char*)fnSim);
return;
}
// create new document
CDocument* pDocument = m_pdtDocTemplate->CreateNewDocument();
if (pDocument == NULL)
{
TRACE0("CDocTemplate::CreateNewDocument returned NULL.\n");
AfxMessageBox(AFX_IDP_FAILED_TO_CREATE_DOC);
return;
}
ASSERT_VALID(pDocument);
// View creation
CFrameWnd* pFrame = m_pdtDocTemplate->CreateNewFrame(pDocument, NULL);
if (pFrame == NULL)
{
AfxMessageBox(AFX_IDP_FAILED_TO_CREATE_DOC);
delete pDocument; // explicit delete on error
return;
}
ASSERT_VALID(pFrame);
pDocument->SetModifiedFlag( FALSE);
// add file to mru
CTString strFileName = pmi->mi_fnSourceFile.FileName() + pmi->mi_fnSourceFile.FileExt();
CString strOpenPath;
strOpenPath = theApp.GetProfileString(L"SeriousSkaStudio", L"Open directory", L"");
strOpenPath += pmi->mi_fnSourceFile;
pDocument->SetPathName(CString(strFileName), TRUE);
pDocument->SetTitle(CString(strFileName));
pDocument->SetModifiedFlag( FALSE);
m_pdtDocTemplate->InitialUpdateFrame(pFrame, pDocument, TRUE);
// set root model instance
theApp.GetDocument()->m_ModelInstance = pmi;
// fill tree view with new model insntance
ReloadRootModelInstance();
}
示例2: OnEditChange
BOOL CEditView::OnEditChange()
/****************************/
{
CDocument *pDoc = GetDocument();
ASSERT( pDoc != NULL );
pDoc->SetModifiedFlag();
return( FALSE );
}
示例3: InstrumentChanged
void CInstrument::InstrumentChanged() const
{
// Set modified flag
CFrameWnd *pFrameWnd = dynamic_cast<CFrameWnd*>(AfxGetMainWnd());
if (pFrameWnd != NULL) {
CDocument *pDoc = pFrameWnd->GetActiveDocument();
if (pDoc != NULL)
pDoc->SetModifiedFlag();
}
}
示例4:
// @pymethod |PyCDocument|SetModifiedFlag|Set the "dirty" flag for the document.
static PyObject *
ui_doc_set_modified_flag(PyObject *self, PyObject *args)
{
BOOL bModified = TRUE;
if (!PyArg_ParseTuple(args, "|i:SetModifiedFlag", &bModified)) // @pyparm int|bModified|1|Set dirty flag
return NULL;
CDocument *pDoc;
if (!(pDoc=PyCDocument::GetDoc(self)))
return NULL;
GUI_BGN_SAVE;
pDoc->SetModifiedFlag(bModified); // @pyseemfc CDocument|SetModifiedFlag
GUI_END_SAVE;
RETURN_NONE;
}
示例5: OnFileNew
void CSeriousSkaStudioApp::OnFileNew()
{
// add new model instance
CModelInstance *pmi = OnAddNewModelInstance();
if(pmi == NULL)
{
//delete pDocument;
theApp.ErrorMessage("Failed to create model instance");
return;
}
CDocument* pDocument = m_pdtDocTemplate->CreateNewDocument();
if (pDocument == NULL)
{
TRACE0("CDocTemplate::CreateNewDocument returned NULL.\n");
AfxMessageBox(AFX_IDP_FAILED_TO_CREATE_DOC);
return;
}
ASSERT_VALID(pDocument);
// View creation
CFrameWnd* pFrame = m_pdtDocTemplate->CreateNewFrame(pDocument, NULL);
if (pFrame == NULL)
{
AfxMessageBox(AFX_IDP_FAILED_TO_CREATE_DOC);
delete pDocument; // explicit delete on error
return;
}
ASSERT_VALID(pFrame);
// add file to mru
CTString strFileName = pmi->mi_fnSourceFile.FileName() + pmi->mi_fnSourceFile.FileExt();
CString strOpenPath;
strOpenPath = theApp.GetProfileString(L"SeriousSkaStudio", L"Open directory", L"");
strOpenPath += pmi->mi_fnSourceFile;
pDocument->SetPathName(CString(strFileName), TRUE);
pDocument->SetTitle(CString(strFileName));
pDocument->SetModifiedFlag( FALSE);
m_pdtDocTemplate->InitialUpdateFrame(pFrame, pDocument, TRUE);
// set root model instance
theApp.GetDocument()->m_ModelInstance = pmi;
// theApp.SaveRootModel();
// fill tree view with new model instance
// ReloadRootModelInstance();
UpdateRootModelInstance();
}
示例6: UpdateBrother
void CSettingsPage::UpdateBrother()
{
if(!m_dad->m_Brother){
TRACE0("No brother on update\n");
return;
}
if(::IsWindow(m_hWnd))
UpdateData();
CBrother toCompare;
toCompare = *m_dad->m_Brother;
m_dad->m_Brother->m_IntervalBad=m_IntervalBad;
m_dad->m_Brother->m_IntervalGood=m_IntervalGood;
if(m_OverrideIntervals)
m_dad->m_Brother->flags|=CBrother::flagsOverrideIntervals;
else
m_dad->m_Brother->flags&=~CBrother::flagsOverrideIntervals;
m_dad->m_Brother->m_Retries=m_Retries;
if(m_OverrideRetries)
m_dad->m_Brother->flags|=CBrother::flagsOverrideRetries;
else
m_dad->m_Brother->flags&=~CBrother::flagsOverrideRetries;
m_dad->m_Brother->m_TimeOut=m_TimeOut;
if(m_OverrideTimeout)
m_dad->m_Brother->flags|=CBrother::flagsOverrideTimeout;
else
m_dad->m_Brother->flags&=~CBrother::flagsOverrideTimeout;
m_dad->m_Brother->ParentalAdjust();
if(toCompare!=(*m_dad->m_Brother)){
CDocument *pDoc = m_dad->m_Daddy->GetDocument();
ASSERT(pDoc);
pDoc->SetModifiedFlag();
}
if(::IsWindow(m_hWnd)){
UpdateData(FALSE);
SetupControls();
}
}
示例7: OnCreateObject
CCmdTarget* COleTemplateServer::OnCreateObject()
{
ASSERT_VALID(this);
ASSERT_VALID(m_pDocTemplate);
// save application user control status
BOOL bUserCtrl = AfxOleGetUserCtrl();
// create invisible doc/view/frame set
CDocument* pDoc = m_pDocTemplate->OpenDocumentFile(NULL, FALSE);
// restore application's user control status
AfxOleSetUserCtrl(bUserCtrl);
if (pDoc != NULL)
{
ASSERT_VALID(pDoc);
ASSERT_KINDOF(CDocument, pDoc);
// all new documents created by OLE start out modified
pDoc->SetModifiedFlag();
}
return pDoc;
}
示例8: OnNotify
/////////////////////////////////////
// @mfunc menu handler - find previous bookmark from the caret line
// @rvalue BOOL | TRUE if we handled the message - FALSE if message should be processed further
//
BOOL CScintillamfcView::OnNotify(
WPARAM wParam, //@parm not used
LPARAM lParam, //@parm pointer to notification structure
LRESULT* pResult ) //@parm result
{
NMHDR *phDR;
phDR = (NMHDR*)lParam;
// does notification come from my scintilla window?
if (phDR != NULL && phDR->hwndFrom == m_wndScintilla.m_hWnd)
{
SCNotification *pMsg = (SCNotification*)lParam;
switch (phDR->code)
{
case SCN_STYLENEEDED:
break;
case SCN_CHARADDED:
break;
case SCN_SAVEPOINTREACHED:
break;
// called when the document is changed - mark document modified
case SCN_SAVEPOINTLEFT:
{
CDocument *pDoc = GetDocument();
pDoc->SetModifiedFlag(TRUE);
}
break;
case SCN_MODIFYATTEMPTRO:
break;
case SCN_KEY:
break;
case SCN_DOUBLECLICK:
break;
// called when something changes and we want to show new indicator state or brace matching
case SCN_UPDATEUI:
{
m_wndScintilla.UpdateUI();
}
break;
case SCN_MODIFIED:
break;
case SCN_MACRORECORD:
break;
// user clicked margin - try folding action
case SCN_MARGINCLICK:
{
m_wndScintilla.DoDefaultFolding(pMsg->margin, pMsg->position);
}
break;
case SCN_NEEDSHOWN:
break;
case SCN_PAINTED:
break;
case SCN_USERLISTSELECTION:
break;
case SCN_URIDROPPED:
break;
case SCN_DWELLSTART:
break;
case SCN_DWELLEND:
break;
}
return TRUE; // we processed the message
}
return CWnd::OnNotify(wParam, lParam, pResult);
}
示例9: 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())
{
//.........这里部分代码省略.........
示例10: OnEditPaste
void CIVAnimatorView::OnEditPaste()
{
CDocument *pDoc = CIvfApp::IvfGetAfxDocument(this);
pDoc->SetModifiedFlag();
IvfOnEditPaste();
}
示例11: OnScriptMakeModel
void CScriptView::OnScriptMakeModel()
{
// First we save script file
CModelerDoc *pDoc = (CModelerDoc *) GetDocument();
CTFileName fnScriptName = CTString(pDoc->GetPathName());
CTFileName fnModelName = fnScriptName.FileDir() + fnScriptName.FileName() + ".mdl";
try
{
fnScriptName.RemoveApplicationPath_t();
}
catch( char *err_str)
{
AfxMessageBox( err_str);
return;
}
pDoc->OnSaveDocument( pDoc->GetPathName());
// close mdl document with same name
POSITION pos = theApp.m_pdtModelDocTemplate->GetFirstDocPosition();
while (pos!=NULL)
{
CModelerDoc *pmdCurrent = (CModelerDoc *)theApp.m_pdtModelDocTemplate->GetNextDoc(pos);
if( CTFileName( CTString(pmdCurrent->GetPathName())) == fnModelName)
{
pmdCurrent->OnCloseDocument();
break;
}
}
// Now we will create one instance of new document of type CModelerDoc
CDocument* pDocument = theApp.m_pdtModelDocTemplate->CreateNewDocument();
if (pDocument == NULL)
{
TRACE0("CDocTemplate::CreateNewDocument returned NULL.\n");
AfxMessageBox(AFX_IDP_FAILED_TO_CREATE_DOC);
return;
}
ASSERT_VALID(pDocument);
BOOL bAutoDelete = pDocument->m_bAutoDelete;
pDocument->m_bAutoDelete = FALSE; // don't destroy if something goes wrong
CFrameWnd* pFrame = theApp.m_pdtModelDocTemplate->CreateNewFrame(pDocument, NULL);
pDocument->m_bAutoDelete = bAutoDelete;
if (pFrame == NULL)
{
AfxMessageBox(AFX_IDP_FAILED_TO_CREATE_DOC);
delete pDocument; // explicit delete on error
return;
}
ASSERT_VALID(pFrame);
pDocument->SetPathName( fnModelName, FALSE);
pDocument->SetTitle( fnModelName.FileName() + fnModelName.FileExt());
char strError[ 256];
if( !((CModelerDoc *)pDocument)->CreateModelFromScriptFile( fnScriptName, strError))
{
pDocument->OnCloseDocument();
AfxMessageBox( strError);
return;
}
theApp.m_pdtModelDocTemplate->InitialUpdateFrame(pFrame, pDocument, TRUE);
((CModelerDoc *)pDocument)->m_emEditModel.edm_md.md_bPreparedForRendering = FALSE;
pDocument->SetModifiedFlag();
// add textures from .ini file
CTFileName fnIniFileName = fnScriptName.NoExt() + ".ini";
try
{
((CModelerDoc *)pDocument)->m_emEditModel.CSerial::Load_t(fnIniFileName);
}
catch( char *strError)
{
// ignore errors
(void) strError;
}
}