From: Leon W. <moo...@us...> - 2005-11-13 10:56:56
|
Update of /cvsroot/anyedit/AnyEditv2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18604 Modified Files: AnyEditDoc.cpp AnyEditDoc.h Log Message: Separated Read Only and Documents change checking from outside of AnyEdit. They are now checked individually. Index: AnyEditDoc.h =================================================================== RCS file: /cvsroot/anyedit/AnyEditv2/AnyEditDoc.h,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** AnyEditDoc.h 1 Nov 2005 19:30:41 -0000 1.30 --- AnyEditDoc.h 13 Nov 2005 10:56:47 -0000 1.31 *************** *** 56,59 **** --- 56,60 ---- CTime m_tLastChangeTime; // Time of last change of open document (not file!) CTime m_tLastParseTime; // Time of last parsing of open document + bool m_bCheckReadOnly; // Boolean indicating if we should check if the read only flag of the file changed. int m_docPointer; // Doc Pointer of scintilla controls Index: AnyEditDoc.cpp =================================================================== RCS file: /cvsroot/anyedit/AnyEditv2/AnyEditDoc.cpp,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** AnyEditDoc.cpp 1 Nov 2005 19:30:41 -0000 1.56 --- AnyEditDoc.cpp 13 Nov 2005 10:56:47 -0000 1.57 *************** *** 138,141 **** --- 138,142 ---- m_tLastChangeTime = 0; m_tLastParseTime = 0; + m_bCheckReadOnly = true; m_docPointer = NULL; RemoveTempCopy(TRUE); *************** *** 403,407 **** // First check if we need to check the last access time. ! if (!theApp.CheckModification() || (m_tLastAccessTime == 0)) return; --- 404,408 ---- // First check if we need to check the last access time. ! if (!theApp.CheckModification()) return; *************** *** 417,454 **** CAnyEditView* pFirstView = GetFirstEditView(); ! if(status.m_mtime == m_tLastAccessTime) { ! // The file has not changed, check read only flag ! if ((status.m_attribute & CFile::Attribute::readOnly) != pFirstView->GetScintillaControl()->GetReadOnly()) { ! if (status.m_attribute & CFile::Attribute::readOnly) { ! if (! pFirstView->GetScintillaControl()->GetReadOnly()) ! { ! if (AfxMessageBox(StrPrintf("File '%s' is now read only. Do you want to set document read only too?", GetPathName()), MB_ICONQUESTION | MB_YESNO) == IDYES) ! { ! pFirstView->GetScintillaControl()->SetReadOnly(true); ! } ! else ! m_tLastAccessTime = 0; // Don't check anymore... ! } } else ! pFirstView->GetScintillaControl()->SetReadOnly(false); } ! m_bLockCheckLastAccessTime = false; ! return; } ! m_tLastAccessTime = status.m_mtime; ! if (AfxMessageBox(StrPrintf("'%s'\nFile has been modified outside AnyEdit!\nDo you want to reload it ?", GetPathName()), MB_ICONQUESTION | MB_YESNO) == IDYES) { ! ReloadFile(); } - else - { - pFirstView->GetScintillaControl()->SetFocus(); - m_tLastAccessTime = 0; // Don't check anymore... - } } else --- 418,457 ---- CAnyEditView* pFirstView = GetFirstEditView(); ! // Check read only flag ! if (status.m_attribute & CFile::Attribute::readOnly) { ! if (m_bCheckReadOnly && !pFirstView->GetScintillaControl()->GetReadOnly()) { ! if (AfxMessageBox(StrPrintf("File '%s' is now read only. Do you want to set document read only too?", GetPathName()), MB_ICONQUESTION | MB_YESNO) == IDYES) { ! pFirstView->GetScintillaControl()->SetReadOnly(true); } else ! m_bCheckReadOnly = false; // Don't check anymore... } ! } ! else ! { ! if( pFirstView->GetScintillaControl()->GetReadOnly() ) ! { ! pFirstView->GetScintillaControl()->SetReadOnly(false); ! } ! m_bCheckReadOnly = true; // Now we can start checking again. } ! // Check file modifications ! if( m_tLastAccessTime != 0 && status.m_mtime != m_tLastAccessTime ) { ! m_tLastAccessTime = status.m_mtime; ! if (AfxMessageBox(StrPrintf("'%s'\nFile has been modified outside AnyEdit!\nDo you want to reload it ?", GetPathName()), MB_ICONQUESTION | MB_YESNO) == IDYES) ! { ! ReloadFile(); ! } ! else ! { ! pFirstView->GetScintillaControl()->SetFocus(); ! m_tLastAccessTime = 0; // Don't check anymore... ! } } } else |