void CDirDoc::Redisplay()
{
-m_pDirView->ToDoDeleteThisValidateColumnOrdering();
+ m_pDirView->ToDoDeleteThisValidateColumnOrdering();
if (m_pCtxt == NULL)
return;
cnt++;
}
}
-m_pDirView->ToDoDeleteThisValidateColumnOrdering();
+ m_pDirView->ToDoDeleteThisValidateColumnOrdering();
}
CDirView * CDirDoc::GetMainView()
// Update view
UpdateScreenItemStatus(ind, current);
}
+
+/**
+ * @brief Set left/right side readonly-status
+ * @param bLeft Select side to set (TRUE = left)
+ * @param bReadOnly New status of selected side
+ */
+void CDirDoc::SetReadOnly(BOOL bLeft, BOOL bReadOnly)
+{
+ if (bLeft)
+ m_bROLeft = bReadOnly;
+ else
+ m_bRORight = bReadOnly;
+}
+
+/**
+ * @brief Return left/right side readonly-status
+ * @param bLeft Select side to ask (TRUE = left)
+ */
+BOOL CDirDoc::GetReadOnly(BOOL bLeft) const
+{
+ if (bLeft)
+ return m_bROLeft;
+ else
+ return m_bRORight;
+}
typedef CTypedPtrList<CPtrList, CMergeDoc *> MergeDocPtrList;
class DirDocFilter;
+/**
+ * @brief User-defined Windows-messages
+ */
const UINT MSG_UI_UPDATE = WM_USER;
const UINT MSG_STAT_UPDATE = WM_USER + 1;
/////////////////////////////////////////////////////////////////////////////
// CDirDoc document
+/**
+ * @brief Documentclass for directory compare
+ */
class CDirDoc : public CDocument
{
protected:
// Implementation
public:
+ BOOL GetReadOnly(BOOL bLeft) const;
+ void SetReadOnly(BOOL bLeft, BOOL bReadOnly);
void UpdateChangedItem(LPCTSTR pathLeft, LPCTSTR pathRight, bool unified);
POSITION FindItemFromPaths(LPCTSTR pathLeft, LPCTSTR pathRight);
void SetDiffContext(CDiffContext *pCtxt);
CDirView *m_pDirView;
MergeDocPtrList m_MergeDocs;
BOOL m_bReuseMergeDocs; // policy to reuse existing merge docs
+ BOOL m_bROLeft;
+ BOOL m_bRORight;
};
-// callback for file/directory filtering during diff
+/// callback for file/directory filtering during diff
// actually we just forward these calls to the app, to CMergeApp::includeFile & includeDir
class DirDocFilter : public IDiffFilter
{
void CDirView::ReloadColumns()
{
LoadColumnHeaderItems();
-ToDoDeleteThisValidateColumnOrdering();
+ ToDoDeleteThisValidateColumnOrdering();
-ToDoDeleteThisValidateColumnOrdering();
+ ToDoDeleteThisValidateColumnOrdering();
UpdateColumnNames();
-ToDoDeleteThisValidateColumnOrdering();
+ ToDoDeleteThisValidateColumnOrdering();
SetColumnWidths();
-ToDoDeleteThisValidateColumnOrdering();
+ ToDoDeleteThisValidateColumnOrdering();
}
/**
}
-// Make a string out of a number
+/// Make a string out of a number
// TODO: Ought to introduce commas every three digits, except this is locale-specific
// How to do this with locale sensitivity ?
CString NumToStr(int n)
return s;
}
-// Change menu item by using string resource
+/// Change menu item by using string resource
// (Question: Why don't we just remove it from the menu resource entirely & do an Add here ?)
void CDirView::ModifyPopup(CMenu * pPopup, int nStringResource, int nMenuId, LPCTSTR szPath)
{
DoCopyFileToRight();
}
-// User chose (context men) Copy from right to left
+/// User chose (context men) Copy from right to left
void CDirView::OnCtxtDirCopyFileToLeft()
{
DoCopyFileToLeft();
}
-// User chose (context menu) Copy from left to right
+/// User chose (context menu) Copy from left to right
void CDirView::OnCtxtDirCopyFileToRight()
{
DoCopyFileToRight();
}
-// Update context menu Copy Right to Left item
+/// Update context menu Copy Right to Left item
void CDirView::OnUpdateCtxtDirCopyFileToLeft(CCmdUI* pCmdUI)
{
DoUpdateDirCopyFileToLeft(pCmdUI, eContext);
}
-// Update context menu Copy Left to Right item
+/// Update context menu Copy Left to Right item
void CDirView::OnUpdateCtxtDirCopyFileToRight(CCmdUI* pCmdUI)
{
DoUpdateDirCopyFileToRight(pCmdUI, eContext);
}
-// Update main menu Copy Right to Left item
+/// Update main menu Copy Right to Left item
void CDirView::OnUpdateDirCopyFileToLeft(CCmdUI* pCmdUI)
{
DoUpdateDirCopyFileToLeft(pCmdUI, eMain);
}
-// Update main menu Copy Left to Right item
+/// Update main menu Copy Left to Right item
void CDirView::OnUpdateDirCopyFileToRight(CCmdUI* pCmdUI)
{
DoUpdateDirCopyFileToRight(pCmdUI, eMain);
}
-// Should Copy to Left be enabled or disabled ? (both main menu & context menu use this)
+/// Should Copy to Left be enabled or disabled ? (both main menu & context menu use this)
void CDirView::DoUpdateDirCopyFileToLeft(CCmdUI* pCmdUI, eMenuType menuType)
{
- int sel=-1;
- int legalcount=0, selcount=0;
- while ((sel = m_pList->GetNextItem(sel, LVNI_SELECTED)) != -1)
- {
- const DIFFITEM& di = GetDiffItem(sel);
- if (IsItemCopyableToLeft(di.code))
- ++legalcount;
- ++selcount;
- }
- pCmdUI->Enable(legalcount>0);
- if (menuType==eContext)
+ if (GetDocument()->GetReadOnly(TRUE))
+ pCmdUI->Enable(FALSE);
+ else
{
- CString s;
- AfxFormatString2(s, IDS_COPY_TO_LEFT, NumToStr(legalcount), NumToStr(selcount));
- pCmdUI->SetText(s);
+ int sel=-1;
+ int legalcount=0, selcount=0;
+ while ((sel = m_pList->GetNextItem(sel, LVNI_SELECTED)) != -1)
+ {
+ const DIFFITEM& di = GetDiffItem(sel);
+ if (IsItemCopyableToLeft(di.code))
+ ++legalcount;
+ ++selcount;
+ }
+ pCmdUI->Enable(legalcount>0);
+ if (menuType==eContext)
+ {
+ CString s;
+ AfxFormatString2(s, IDS_COPY_TO_LEFT, NumToStr(legalcount), NumToStr(selcount));
+ pCmdUI->SetText(s);
+ }
}
}
-// Should Copy to Right be enabled or disabled ? (both main menu & context menu use this)
+
+/// Should Copy to Right be enabled or disabled ? (both main menu & context menu use this)
void CDirView::DoUpdateDirCopyFileToRight(CCmdUI* pCmdUI, eMenuType menuType)
{
- int sel=-1;
- int legalcount=0, selcount=0;
- while ((sel = m_pList->GetNextItem(sel, LVNI_SELECTED)) != -1)
- {
- const DIFFITEM& di = GetDiffItem(sel);
- if (IsItemCopyableToRight(di.code))
- ++legalcount;
- ++selcount;
- }
- pCmdUI->Enable(legalcount>0);
- if (menuType==eContext)
+ if (GetDocument()->GetReadOnly(FALSE))
+ pCmdUI->Enable(FALSE);
+ else
{
- CString s;
- AfxFormatString2(s, IDS_COPY_TO_RIGHT, NumToStr(legalcount), NumToStr(selcount));
- pCmdUI->SetText(s);
+ int sel=-1;
+ int legalcount=0, selcount=0;
+ while ((sel = m_pList->GetNextItem(sel, LVNI_SELECTED)) != -1)
+ {
+ const DIFFITEM& di = GetDiffItem(sel);
+ if (IsItemCopyableToRight(di.code))
+ ++legalcount;
+ ++selcount;
+ }
+ pCmdUI->Enable(legalcount>0);
+ if (menuType==eContext)
+ {
+ CString s;
+ AfxFormatString2(s, IDS_COPY_TO_RIGHT, NumToStr(legalcount), NumToStr(selcount));
+ pCmdUI->SetText(s);
+ }
}
}
{
CString left, right;
GetItemFileNames(sel, left, right);
- mf->ShowMergeDoc(GetDocument(), left, right);
+ mf->ShowMergeDoc(GetDocument(), left, right,
+ GetDocument()->GetReadOnly(TRUE),
+ GetDocument()->GetReadOnly(FALSE));
}
break;
case FILE_LDIRUNIQUE:
}
}
-// User chose (context menu) delete left
+/// User chose (context menu) delete left
void CDirView::OnCtxtDirDelLeft()
{
DoDelLeft();
}
-// User chose (context menu) delete right
+
+/// User chose (context menu) delete right
void CDirView::OnCtxtDirDelRight()
{
DoDelRight();
}
-// User chose (context menu) delete both
+
+/// User chose (context menu) delete both
void CDirView::OnCtxtDirDelBoth()
{
DoDelBoth();
}
-
-// Enable/disable Delete Left menu choice on context menu
+/// Enable/disable Delete Left menu choice on context menu
void CDirView::OnUpdateCtxtDirDelLeft(CCmdUI* pCmdUI)
{
DoUpdateCtxtDirDelLeft(pCmdUI);
}
-// Enable/disable Delete Right menu choice on context menu
+/// Enable/disable Delete Right menu choice on context menu
void CDirView::OnUpdateCtxtDirDelRight(CCmdUI* pCmdUI)
{
DoUpdateCtxtDirDelRight(pCmdUI);
}
-// Enable/disable Delete Both menu choice on context menu
+/// Enable/disable Delete Both menu choice on context menu
void CDirView::OnUpdateCtxtDirDelBoth(CCmdUI* pCmdUI)
{
DoUpdateCtxtDirDelBoth(pCmdUI);
}
-// Should Delete left be enabled or disabled ?
+/// Should Delete left be enabled or disabled ?
void CDirView::DoUpdateCtxtDirDelLeft(CCmdUI* pCmdUI)
{
- int sel=-1;
- int count=0, total=0;
- while ((sel = m_pList->GetNextItem(sel, LVNI_SELECTED)) != -1)
+ if (GetDocument()->GetReadOnly(TRUE))
+ pCmdUI->Enable(FALSE);
+ else
{
- const DIFFITEM& di = GetDiffItem(sel);
- if (IsItemDeletableOnLeft(di.code))
- ++count;
- ++total;
+ int sel=-1;
+ int count=0, total=0;
+ while ((sel = m_pList->GetNextItem(sel, LVNI_SELECTED)) != -1)
+ {
+ const DIFFITEM& di = GetDiffItem(sel);
+ if (IsItemDeletableOnLeft(di.code))
+ ++count;
+ ++total;
+ }
+ pCmdUI->Enable(count>0);
+ CString s;
+ AfxFormatString2(s, IDS_DEL_LEFT_FMT, NumToStr(count), NumToStr(total));
+ pCmdUI->SetText(s);
}
- pCmdUI->Enable(count>0);
- CString s;
- AfxFormatString2(s, IDS_DEL_LEFT_FMT, NumToStr(count), NumToStr(total));
- pCmdUI->SetText(s);
}
-// Should Delete right be enabled or disabled ?
+
+/// Should Delete right be enabled or disabled ?
void CDirView::DoUpdateCtxtDirDelRight(CCmdUI* pCmdUI)
{
- int sel=-1;
- int count=0, total=0;
- while ((sel = m_pList->GetNextItem(sel, LVNI_SELECTED)) != -1)
+ if (GetDocument()->GetReadOnly(FALSE))
+ pCmdUI->Enable(FALSE);
+ else
{
- const DIFFITEM& di = GetDiffItem(sel);
- if (IsItemDeletableOnRight(di.code))
- ++count;
- ++total;
+ int sel=-1;
+ int count=0, total=0;
+ while ((sel = m_pList->GetNextItem(sel, LVNI_SELECTED)) != -1)
+ {
+ const DIFFITEM& di = GetDiffItem(sel);
+ if (IsItemDeletableOnRight(di.code))
+ ++count;
+ ++total;
+ }
+ pCmdUI->Enable(count>0);
+ CString s;
+ AfxFormatString2(s, IDS_DEL_RIGHT_FMT, NumToStr(count), NumToStr(total));
+ pCmdUI->SetText(s);
}
- pCmdUI->Enable(count>0);
- CString s;
- AfxFormatString2(s, IDS_DEL_RIGHT_FMT, NumToStr(count), NumToStr(total));
- pCmdUI->SetText(s);
}
-// Should Delete both be enabled or disabled ?
+/// Should Delete both be enabled or disabled ?
void CDirView::DoUpdateCtxtDirDelBoth(CCmdUI* pCmdUI)
{
- int sel=-1;
- int count=0, total=0;
- while ((sel = m_pList->GetNextItem(sel, LVNI_SELECTED)) != -1)
+ if (GetDocument()->GetReadOnly(TRUE) || GetDocument()->GetReadOnly(FALSE))
+ pCmdUI->Enable(FALSE);
+ else
{
- const DIFFITEM& di = GetDiffItem(sel);
- if (IsItemDeletableOnBoth(di.code))
- ++count;
- ++total;
+ int sel=-1;
+ int count=0, total=0;
+ while ((sel = m_pList->GetNextItem(sel, LVNI_SELECTED)) != -1)
+ {
+ const DIFFITEM& di = GetDiffItem(sel);
+ if (IsItemDeletableOnBoth(di.code))
+ ++count;
+ ++total;
+ }
+ pCmdUI->Enable(count>0);
+ CString s;
+ AfxFormatString2(s, IDS_DEL_BOTH_FMT, NumToStr(count), NumToStr(total));
+ pCmdUI->SetText(s);
}
- pCmdUI->Enable(count>0);
- CString s;
- AfxFormatString2(s, IDS_DEL_BOTH_FMT, NumToStr(count), NumToStr(total));
- pCmdUI->SetText(s);
}
POSITION CDirView::GetItemKey(int idx) const
}
/// Creates new MergeDoc instance and shows documents
-void CMainFrame::ShowMergeDoc(CDirDoc * pDirDoc, LPCTSTR szLeft, LPCTSTR szRight)
+void CMainFrame::ShowMergeDoc(CDirDoc * pDirDoc, LPCTSTR szLeft, LPCTSTR szRight, BOOL bROLeft, BOOL bRORight)
{
BOOL docNull;
BOOL bOpenSuccess = FALSE;
ASSERT(pMergeDoc); // must ASSERT to get an answer to the question below ;-)
if (!pMergeDoc) return; // when does this happen ?
- bOpenSuccess = pMergeDoc->OpenDocs(szLeft, szRight);
+ bOpenSuccess = pMergeDoc->OpenDocs(szLeft, szRight,
+ bROLeft, bRORight);
if (bOpenSuccess)
{
CDiffContext *pCtxt = new CDiffContext(strLeft, strRight);
if (pCtxt != NULL)
{
+ pDirDoc->SetReadOnly(TRUE, FALSE);
+ pDirDoc->SetReadOnly(FALSE, FALSE);
pDirDoc->SetDiffContext(pCtxt);
pCtxt->SetRegExp(strExt);
pDirDoc->Rescan();
CDirView * pDirView = pDirDoc->GetMainView();
pDirView->GotoFirstDiff();
}
-
}
}
}
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
/////////////////////////////////////////////////////////////////////////////
-// MainFrm.h : interface of the CMainFrame class
-//
-/////////////////////////////////////////////////////////////////////////////
-//
+/**
+ * @file MainFrm.h
+ *
+ * @brief Declaration file for CMainFrame
+ *
+ */
+// RCS ID line follows -- this is updated by CVS
// $Id$
#if !defined(AFX_MAINFRM_H__BBCD4F8C_34E4_11D1_BAA6_00A024706EDC__INCLUDED_)
enum
{
FFILEOPEN_NONE = 0x0000,
- FFILEOPEN_NOMRU = 0x0001
+ FFILEOPEN_NOMRU = 0x0001,
+ FFILEOPEN_READONLY = 0x0002,
};
class CDiffView;
typedef CTypedPtrList<CPtrList, CMergeDoc *> MergeDocList;
typedef CTypedPtrList<CPtrList, CDirDoc *> DirDocList;
+/**
+ * @brief Frame class containing save-routines etc
+ */
class CMainFrame : public CMDIFrameWnd
{
DECLARE_DYNAMIC(CMainFrame)
void UpdateCurrentFileStatus(CDirDoc * pDirDoc, UINT nStatus, int idx);
BOOL DoFileOpen(LPCTSTR pszLeft = NULL, LPCTSTR pszRight = NULL,
DWORD dwLeftFlags = 0, DWORD dwRightFlags = 0, BOOL bRecurse = FALSE);
- void ShowMergeDoc(CDirDoc * pDirDoc, LPCTSTR szLeft, LPCTSTR szRight);
+ void ShowMergeDoc(CDirDoc * pDirDoc, LPCTSTR szLeft, LPCTSTR szRight, BOOL bROLeft = FALSE, BOOL bRORight = FALSE);
void UpdateResources();
HMENU NewDefaultMenu();
BOOL CreateBackup(LPCTSTR pszPath);
BOOL bLModified = FALSE;
BOOL bRModified = FALSE;
- if (m_ltBuf.IsModified())
+ if (m_ltBuf.IsModified() && !m_ltBuf.GetReadOnly())
{
bLModified = TRUE;
DoSave(m_strLeftFile, bLSaveSuccess, TRUE );
}
- if (m_rtBuf.IsModified())
+ if (m_rtBuf.IsModified() && !m_rtBuf.GetReadOnly())
{
bRModified = TRUE;
DoSave(m_strRightFile, bRSaveSuccess, FALSE);
}
}
- m_ltBuf.SetReadOnly(FALSE);
m_ltBuf.FinishLoading();
- m_rtBuf.SetReadOnly(FALSE);
m_rtBuf.FinishLoading();
-
}
BOOL CMergeDoc::SaveHelper()
*
* @param sLeftFile File to open to left side
* @param sRightFile File to open to right side
+* @param bROLeft Is left file read-only
+* @param bRORight Is right file read-only
*
* @return Tells if files were loaded and scanned succesfully
*
* @sa CMainFrame::ShowMergeDoc()
*
*/
-BOOL CMergeDoc::OpenDocs(CString sLeftFile, CString sRightFile)
+BOOL CMergeDoc::OpenDocs(CString sLeftFile, CString sRightFile,
+ BOOL bROLeft, BOOL bRORight)
{
int nRescanResult = RESCAN_OK;
CChildFrame *pf = GetParentFrame();
return FALSE;
}
+ // Set read-only statuses
+ m_ltBuf.SetReadOnly(bROLeft);
+ m_rtBuf.SetReadOnly(bRORight);
+
nRescanResult = Rescan();
// Open different and identical files
class CChildFrame;
class CDirDoc;
+/**
+ * @brief Document class for merging two files
+ */
class CMergeDoc : public CDocument
{
// Attributes
UINT m_nDiffs;
CString m_strLeftFile, m_strRightFile;
- BOOL OpenDocs(CString sLeftFile, CString sRightFile);
+ BOOL OpenDocs(CString sLeftFile, CString sRightFile,
+ BOOL bROLeft = FALSE, BOOL bRORight = FALSE);
int LoadFile(CString sFileName, BOOL bLeft);
void RescanIfNeeded(float timeOutInSecond);
int Rescan(BOOL bForced = FALSE);
-// MergeEditView.cpp : implementation file
+/////////////////////////////////////////////////////////////////////////////
+// WinMerge: an interactive diff/merge utility
+// Copyright (C) 1997-2000 Thingamahoochie Software
+// Author: Dean Grimm
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+//
+/////////////////////////////////////////////////////////////////////////////
+/**
+ * @file MergeEditView.cpp
+ *
+ * @brief Implementation of the CMergeEditView class
+ */
+// RCS ID line follows -- this is updated by CVS
+// $Id$
#include "stdafx.h"
#include "merge.h"
void CMergeEditView::OnEditCut()
{
+ if (IsReadOnly(m_bIsLeft))
+ return;
+
CPoint ptSelStart, ptSelEnd;
CMergeDoc * pDoc = GetDocument();
GetSelection(ptSelStart, ptSelEnd);
- if ( ptSelStart == ptSelEnd )
+ // Nothing selected
+ if (ptSelStart == ptSelEnd)
return;
CString text;
void CMergeEditView::OnUpdateEditCut(CCmdUI* pCmdUI)
{
- CCrystalEditViewEx::OnUpdateEditCut(pCmdUI);
+ if (!IsReadOnly(m_bIsLeft))
+ CCrystalEditViewEx::OnUpdateEditCut(pCmdUI);
+ else
+ pCmdUI->Enable(FALSE);
}
void CMergeEditView::OnEditPaste()
{
+ if (IsReadOnly(m_bIsLeft))
+ return;
+
CCrystalEditViewEx::Paste();
m_pTextBuffer->SetModified(TRUE);
}
void CMergeEditView::OnUpdateEditPaste(CCmdUI* pCmdUI)
{
- CCrystalEditViewEx::OnUpdateEditPaste(pCmdUI);
+ if (!IsReadOnly(m_bIsLeft))
+ CCrystalEditViewEx::OnUpdateEditPaste(pCmdUI);
+ else
+ pCmdUI->Enable(FALSE);
}
void CMergeEditView::OnEditUndo()
{
+ if (IsReadOnly(m_bIsLeft))
+ return;
+
CMergeDoc* pDoc = GetDocument();
CMergeEditView *tgt = *(pDoc->curUndo-1);
if(tgt==this)
UpdateCaret();
}
+/// Check if line is inside currently selected diff
BOOL CMergeEditView::IsLineInCurrentDiff(int nLine)
{
CMergeDoc *pd = GetDocument();
void CMergeEditView::OnL2r()
{
+ if (IsReadOnly(FALSE))
+ return;
WaitStatusCursor waitstatus(LoadResString(IDS_STATUS_COPYL2R));
GetDocument()->ListCopy(true);
}
void CMergeEditView::OnUpdateL2r(CCmdUI* pCmdUI)
{
- pCmdUI->Enable(GetDocument()->GetCurrentDiff()!=-1);
+ if (!IsReadOnly(FALSE))
+ pCmdUI->Enable(GetDocument()->GetCurrentDiff()!=-1);
+ else
+ pCmdUI->Enable(FALSE);
}
void CMergeEditView::OnR2l()
{
+ if (IsReadOnly(TRUE))
+ return;
WaitStatusCursor waitstatus(LoadResString(IDS_STATUS_COPYR2L));
GetDocument()->ListCopy(false);
}
void CMergeEditView::OnUpdateR2l(CCmdUI* pCmdUI)
{
- pCmdUI->Enable(GetDocument()->GetCurrentDiff()!=-1);
+ if (!IsReadOnly(TRUE))
+ pCmdUI->Enable(GetDocument()->GetCurrentDiff()!=-1);
+ else
+ pCmdUI->Enable(FALSE);
}
void CMergeEditView::OnAllLeft()
{
+ if (IsReadOnly(TRUE))
+ return;
WaitStatusCursor waitstatus(LoadResString(IDS_STATUS_COPYALL2L));
GetDocument()->CopyAllList(false);
void CMergeEditView::OnUpdateAllLeft(CCmdUI* pCmdUI)
{
- pCmdUI->Enable(GetDocument()->m_nDiffs!=0);
+ if (!IsReadOnly(TRUE))
+ pCmdUI->Enable(GetDocument()->m_nDiffs!=0);
+ else
+ pCmdUI->Enable(FALSE);
}
void CMergeEditView::OnAllRight()
{
+ if (IsReadOnly(FALSE))
+ return;
+
WaitStatusCursor waitstatus(LoadResString(IDS_STATUS_COPYALL2R));
GetDocument()->CopyAllList(true);
void CMergeEditView::OnUpdateAllRight(CCmdUI* pCmdUI)
{
- pCmdUI->Enable(GetDocument()->m_nDiffs!=0);
+ if (!IsReadOnly(FALSE))
+ pCmdUI->Enable(GetDocument()->m_nDiffs!=0);
+ else
+ pCmdUI->Enable(FALSE);
}
void CMergeEditView::OnEditOperation(int nAction, LPCTSTR pszText)
{
+ if (IsReadOnly(m_bIsLeft))
+ return;
+
CMergeDoc* pDoc = GetDocument();
// simple hook for multiplex undo operations
void CMergeEditView::OnEditRedo()
{
+ if (IsReadOnly(m_bIsLeft))
+ return;
+
CMergeDoc* pDoc = GetDocument();
CMergeEditView *tgt = *(pDoc->curUndo);
if(tgt==this)
void CMergeEditView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
{
CCrystalEditViewEx::OnUpdate(pSender, lHint, pHint);
- // ShowDiff(FALSE, FALSE);
}
void CMergeEditView::ShowDiff(BOOL bScroll, BOOL bSelectText)
CCrystalEditViewEx::OnTimer(nIDEvent);
}
+BOOL CMergeEditView::IsReadOnly(BOOL bLeft)
+{
+ CCrystalTextBuffer *pBuf = NULL;
+
+ if (bLeft)
+ pBuf = &GetDocument()->m_ltBuf;
+ else
+ pBuf = &GetDocument()->m_rtBuf;
+
+ return pBuf->GetReadOnly();
+}
+
void CMergeEditView::OnRefresh()
{
CMergeDoc *pd = GetDocument();
+/////////////////////////////////////////////////////////////////////////////
+// WinMerge: an interactive diff/merge utility
+// Copyright (C) 1997 Dean P. Grimm
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+//
+/////////////////////////////////////////////////////////////////////////////
+/**
+ * @file MergeEditView.h
+ *
+ * @brief Declaration file for CMergeEditView
+ *
+ */
+// RCS ID line follows -- this is updated by CVS
+// $Id$
+
#if !defined(AFX_MERGEEDITVIEW_H__0CE31CFD_4BEE_4378_ADB4_B7C9F50A9F53__INCLUDED_)
#define AFX_MERGEEDITVIEW_H__0CE31CFD_4BEE_4378_ADB4_B7C9F50A9F53__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
-// MergeEditView.h : header file
-//
-#define CONTEXT_LINES 5
+/**
+ * @brief Non-diff lines shown above diff when scrolling to it
+ */
+static const UINT CONTEXT_LINES = 5;
#define FLAG_RESCAN_WAITS_FOR_IDLE 1
// Operations
public:
BOOL EnableRescan(BOOL bEnable);
+ BOOL IsReadOnly(BOOL bLeft);
void ShowDiff(BOOL bScroll, BOOL bSelectText);
virtual void OnEditOperation(int nAction, LPCTSTR pszText);
void UpdateLineLengths();
+2003-08-27 Kimmo
+ PATCH: [ 784302 ] Implement Read-only for files and dirs
+ Only background changes, no UI changes
+ WinMerge: DirDoc.h DirDoc.cpp DirView.cpp MainFrm.h MainFrm.cpp
+ MergeDoc.h MergeDoc.cpp MergeEditView.h MergeEditView.cpp
+
2003-08-27 Perry
Add new colhdrs from patch#781529 to Brazilian.
Reorder ChineseSimplified string tables to match English, and add missing entries.