m_piFilterUI = 0;
m_piFilterGlobal = 0;
m_msgUpdateStatus = 0;
- m_hMainFrame = NULL;
+ m_hDirFrame = NULL;
}
CDiffContext::CDiffContext(LPCTSTR pszLeft, LPCTSTR pszRight, CDiffContext& src)
m_piFilterUI = src.m_piFilterUI;
m_piFilterGlobal = src.m_piFilterGlobal;
m_msgUpdateStatus = src.m_msgUpdateStatus;
- m_hMainFrame = src.m_hMainFrame;
+ m_hDirFrame = src.m_hDirFrame;
pNamesLeft = NULL;
pNamesRight = NULL;
m_pList->AddTail(di);
// ignore return value
- PostMessage(m_hMainFrame, m_msgUpdateStatus, di.diffcode, NULL);
+ PostMessage(m_hDirFrame, m_msgUpdateStatus, di.diffcode, NULL);
}
void CDiffContext::RemoveDiff(POSITION diffpos)
IDiffFilter * m_piFilterUI;
IDiffFilter * m_piFilterGlobal;
UINT m_msgUpdateStatus;
- HWND m_hMainFrame;
+ HWND m_hDirFrame;
struct dirdata ddLeft, ddRight;
char *pNamesLeft;
m_pDiffParm->msgUIUpdate = m_msgUpdateUI;
m_pDiffParm->hWindow = m_hWnd;
m_pDiffParm->m_pAbortgate = m_pAbortgate;
+ m_bAborting = FALSE;
m_pDiffParm->nThreadState = THREAD_COMPARING;
m_thread = AfxBeginThread(DiffThread, m_pDiffParm);
--- /dev/null
+// DirCompStateBar.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "merge.h"
+#include "DirCompStateBar.h"
+#include "DiffContext.h"
+#include "DirDoc.h"
+#include "DirFrame.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CDirCompStateBar construction destruction
+
+void CDirCompStateBar::ClearStat()
+{
+ //{{AFX_DATA_INIT(CDirCompStateBar)
+ m_nBinaryDiff = 0;
+ m_nBinarySame = 0;
+ m_nEqual = 0;
+ m_nFileSkip = 0;
+ m_nFolderSkip = 0;
+ m_nLFile = 0;
+ m_nLFolder = 0;
+ m_nNotEqual = 0;
+ m_nRFile = 0;
+ m_nRFolder = 0;
+ m_nUnknown = 0;
+ //}}AFX_DATA_INIT
+}
+
+CDirCompStateBar::CDirCompStateBar(CWnd* pParent /*=NULL*/)
+{
+ ClearStat();
+
+ VERIFY(strAbort.LoadString(IDC_COMPARISON_STOP));
+ VERIFY(strClose.LoadString(IDC_COMPARISON_CLOSE));
+}
+
+BOOL CDirCompStateBar::Create(CWnd* pParentWnd)
+{
+ if (! CDialogBar::Create(pParentWnd, CDirCompStateBar::IDD,
+ WS_VISIBLE|CBRS_SIZE_FIXED|CBRS_FLYBY,
+ CDirCompStateBar::IDD))
+ return FALSE;
+
+ return TRUE;
+};
+
+void CDirCompStateBar::DoDataExchange(CDataExchange* pDX)
+{
+ CDialogBar::DoDataExchange(pDX);
+ //{{AFX_DATA_MAP(CDirCompStateBar)
+ DDX_Text(pDX, IDC_COUNT_BINARYDIFF, m_nBinaryDiff);
+ DDX_Text(pDX, IDC_COUNT_BINARYSAME, m_nBinarySame);
+ DDX_Text(pDX, IDC_COUNT_EQUAL, m_nEqual);
+ DDX_Text(pDX, IDC_COUNT_FILESKIP, m_nFileSkip);
+ DDX_Text(pDX, IDC_COUNT_FOLDERSKIP, m_nFolderSkip);
+ DDX_Text(pDX, IDC_COUNT_LFILE, m_nLFile);
+ DDX_Text(pDX, IDC_COUNT_LFOLDER, m_nLFolder);
+ DDX_Text(pDX, IDC_COUNT_NOTEQUAL, m_nNotEqual);
+ DDX_Text(pDX, IDC_COUNT_RFILE, m_nRFile);
+ DDX_Text(pDX, IDC_COUNT_RFOLDER, m_nRFolder);
+ DDX_Text(pDX, IDC_COUNT_UNKNOWN, m_nUnknown);
+ DDX_Control(pDX, IDC_COMPARISON_STOP, m_ctlStop);
+ //}}AFX_DATA_MAP
+}
+
+
+BEGIN_MESSAGE_MAP(CDirCompStateBar, CDialogBar)
+ //{{AFX_MSG_MAP(CDirCompStateBar)
+ ON_COMMAND(IDC_COMPARISON_STOP, OnStop)
+ ON_UPDATE_COMMAND_UI(IDC_COMPARISON_STOP, OnUpdateStop)
+ ON_WM_WINDOWPOSCHANGING()
+ //}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CDirCompStateBar size
+// m_sizeDefault is the size of the dialog
+
+CSize CDirCompStateBar::CalcFixedLayout(BOOL bStretch, BOOL bHorz)
+{
+ if (IsFloating())
+ return m_sizeDefault;
+ else
+ return CDialogBar::CalcFixedLayout(bStretch, bHorz);
+}
+
+BOOL CDirCompStateBar::GetDefaultRect( LPRECT lpRect ) const
+{
+ lpRect->top = 0;
+ lpRect->bottom = m_sizeDefault.cy;
+ lpRect->left = 0;
+ lpRect->right = m_sizeDefault.cx;
+ return TRUE;
+}
+
+
+
+/////////////////////////////////////////////////////////////////////////////
+// CDirCompStateBar message handlers
+
+void CDirCompStateBar::OnStop()
+{
+ // use GetOwner and not GetParentFrame
+ // because FloatControlBar assigns the bar to a new parent frame
+ CFrameWnd * pFrameWnd = static_cast<CFrameWnd*> (GetOwner());
+ CDirDoc * pDirDoc = dynamic_cast<CDirDoc*>(pFrameWnd->GetActiveDocument());
+ ASSERT(pDirDoc != NULL);
+
+ if (pDirDoc->IsCurrentScanAbortable())
+ pDirDoc->AbortCurrentScan();
+
+ CDirFrame * pDirFrame = static_cast<CDirFrame*>(pFrameWnd);
+ ASSERT(pDirFrame != NULL);
+ pDirFrame->ShowProcessingBar(FALSE);
+}
+
+void CDirCompStateBar::OnUpdateStop(CCmdUI* pCmdUI)
+{
+ // use GetOwner and not GetParentFrame
+ // because FloatControlBar assigns the bar to a new parent frame
+ CFrameWnd * pFrameWnd = static_cast<CFrameWnd*> (GetOwner());
+ CDirDoc * pDirDoc = dynamic_cast<CDirDoc*>(pFrameWnd->GetActiveDocument());
+ ASSERT(pDirDoc != NULL);
+
+ // adapt the text of button
+ if (m_ctlStop.GetSafeHwnd())
+ {
+ if (pDirDoc->IsCurrentScanAbortable())
+ m_ctlStop.SetWindowText(strAbort);
+ else
+ {
+ CString text;
+ m_ctlStop.GetWindowText(text);
+ if (text != strClose)
+ m_ctlStop.SetWindowText(strClose);
+ // also give the focus to the button (PreTranslateMessage needs it)
+ m_ctlStop.SetFocus();
+ }
+ }
+
+ pCmdUI->Enable(TRUE);
+}
+
+
+
+// diff completed another file
+void CDirCompStateBar::AddElement(UINT diffcode)
+{
+ DIFFITEM di;
+ di.diffcode = diffcode;
+ if (di.isSideLeft())
+ {
+ // left-only
+ if (di.isDirectory())
+ {
+ ++m_nLFolder;
+ }
+ else
+ {
+ ++m_nLFile;
+ }
+ }
+ else if (di.isSideRight())
+ {
+ // right-only
+ if (di.isDirectory())
+ {
+ ++m_nRFolder;
+ }
+ else
+ {
+ ++m_nRFile;
+ }
+ }
+ else if (di.isResultSkipped())
+ {
+ // skipped
+ if (di.isDirectory())
+ {
+ ++m_nFolderSkip;
+ }
+ else
+ {
+ ++m_nFileSkip;
+ }
+ }
+ else if (di.isResultError())
+ {
+ // could be directory error ?
+ ++m_nUnknown;
+ }
+ // Now we know it was on both sides & compared!
+ else if (di.isResultSame())
+ {
+ // same
+ if (di.isBin())
+ {
+ ++m_nBinarySame;
+ }
+ else
+ {
+ ++m_nEqual;
+ }
+ }
+ else
+ {
+ // presumably it is diff
+ if (di.isDirectory())
+ {
+ // this doesn't happen right now, but it will
+ // TODO
+ }
+ else
+ {
+ if (di.isBin())
+ {
+ ++m_nBinaryDiff;
+ }
+ else
+ {
+ ++m_nNotEqual;
+ }
+ }
+ }
+
+
+ UpdateData(FALSE);
+}
+
+BOOL CDirCompStateBar::PreTranslateMessage(MSG* pMsg)
+{
+ // When the scan is finished, any key will hide the bar
+ CFrameWnd * pFrameWnd = static_cast<CFrameWnd*> (GetOwner());
+ CDirDoc * pDirDoc = dynamic_cast<CDirDoc*>(pFrameWnd->GetActiveDocument());
+ if (pMsg->message == WM_KEYDOWN && !pDirDoc->IsCurrentScanAbortable())
+ {
+ OnStop();
+ return TRUE;
+ }
+
+ return CDialogBar::PreTranslateMessage(pMsg);
+}
+
+/**
+ * @brief Hook : this message is received when the window gets hidden.
+ * It is the only message we get when the user clicks on the upper right x.
+ * (the message WM_CLOSE is processed in the parent CMiniFrameWnd)
+ */
+void CDirCompStateBar::OnWindowPosChanging( WINDOWPOS* lpwndpos )
+{
+ CDialogBar::OnWindowPosChanging(lpwndpos);
+ if (lpwndpos->flags & SWP_HIDEWINDOW)
+ {
+ // need to notify CDirFrame
+ CDirFrame * pDirFrame = static_cast<CDirFrame*>(GetOwner());
+ ASSERT(pDirFrame != NULL);
+ pDirFrame->NotifyHideStateBar();
+ }
+}
--- /dev/null
+#if !defined(AFX_DIRCOMPSTATEDLG_H__8F66C090_C232_429F_A4A2_18D43CCC6C38__INCLUDED_)
+#define AFX_DIRCOMPSTATEDLG_H__8F66C090_C232_429F_A4A2_18D43CCC6C38__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// DirCompStateBar.h : header file
+//
+
+class CDirFrame;
+
+/////////////////////////////////////////////////////////////////////////////
+// CDirCompStateBar dialog
+
+class CDirCompStateBar : public CDialogBar
+{
+// Construction
+public:
+ CDirCompStateBar(CWnd* pParent = NULL); // standard constructor
+ BOOL Create(CWnd* pParentWnd);
+ void ClearStat();
+ void AddElement(UINT diffcode);
+ BOOL GetDefaultRect( LPRECT lpRect ) const;
+
+// Dialog Data
+ //{{AFX_DATA(CDirCompStateBar)
+ enum { IDD = IDD_DIRCOMPSTATE };
+ int m_nBinaryDiff;
+ int m_nBinarySame;
+ int m_nEqual;
+ int m_nFileSkip;
+ int m_nFolderSkip;
+ int m_nLFile;
+ int m_nLFolder;
+ int m_nNotEqual;
+ int m_nRFile;
+ int m_nRFolder;
+ int m_nUnknown;
+ CButton m_ctlStop;
+ //}}AFX_DATA
+
+ CString strAbort;
+ CString strClose;
+
+// Overrides
+ virtual CSize CalcFixedLayout(BOOL bStretch, BOOL bHorz);
+
+ // ClassWizard generated virtual function overrides
+ //{{AFX_VIRTUAL(CDirCompStateBar)
+ protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ //}}AFX_VIRTUAL
+
+// Implementation
+protected:
+ virtual BOOL PreTranslateMessage(MSG* pMsg);
+
+ // Generated message map functions
+ //{{AFX_MSG(CDirCompStateBar)
+ afx_msg void OnStop();
+ afx_msg void OnUpdateStop(CCmdUI* pCmdUI);
+ afx_msg void OnWindowPosChanging( WINDOWPOS* lpwndpos );
+ //}}AFX_MSG
+ DECLARE_MESSAGE_MAP()
+};
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_DIRCOMPSTATEDLG_H__8F66C090_C232_429F_A4A2_18D43CCC6C38__INCLUDED_)
{
if (!m_pCtxt) return;
+ CDirFrame *pf = m_pDirView->GetParentFrame();
+
// If we're already doing a rescan, bail out
UINT threadState = m_diffThread.GetThreadState();
if (threadState == THREAD_COMPARING)
gLog.Write(_T("Starting directory scan:\r\n\tLeft: %s\r\n\tRight: %s\r\n"),
m_pCtxt->m_strLeft, m_pCtxt->m_strRight);
+ pf->clearStatus();
+ pf->ShowProcessingBar(TRUE);
m_pCtxt->RemoveAll();
- mf->clearStatus();
// fix up for diff code (remove trailing slashes etc)
m_pCtxt->m_strNormalizedLeft = m_pCtxt->m_strLeft;
m_pCtxt->m_strNormalizedRight = m_pCtxt->m_strRight;
- m_pCtxt->m_hMainFrame = mf->GetSafeHwnd();
+ m_pCtxt->m_hDirFrame = pf->GetSafeHwnd();
m_pCtxt->m_msgUpdateStatus = MSG_STAT_UPDATE;
paths_normalize(m_pCtxt->m_strNormalizedLeft);
paths_normalize(m_pCtxt->m_strNormalizedRight);
UpdateHeaderPath(TRUE);
UpdateHeaderPath(FALSE);
// draw the headers as active ones
- CDirFrame *pf = m_pDirView->GetParentFrame();
pf->GetHeaderInterface()->SetActive(0, TRUE);
pf->GetHeaderInterface()->SetActive(1, TRUE);
ASSERT(m_pDirView);
m_pDirView->DeleteAllDisplayItems();
+ // hide the floating state bar
+ CDirFrame *pf = m_pDirView->GetParentFrame();
+ pf->ShowProcessingBar(FALSE);
+
// delete comparison parameters and results
if (m_pCtxt != NULL)
delete m_pCtxt;
delete m_statusCursor;
m_statusCursor = 0;
+ // hide the floating state bar
+ // CDirFrame *pf = m_pDirView->GetParentFrame();
+ // pf->ShowProcessingBar(FALSE);
+
m_diffWrapper.EndDirectoryDiff();
}
#include "Merge.h"
#include "DirFrame.h"
#include "FilepathEdit.h"
+#include "DirDoc.h"
#ifdef _DEBUG
#define new DEBUG_NEW
ON_UPDATE_COMMAND_UI(ID_DIFFNUM, OnUpdateStatusNum)
ON_WM_CLOSE()
ON_WM_SIZE()
+ ON_MESSAGE(MSG_STAT_UPDATE, OnUpdateStatusMessage)
+ ON_WM_MDIACTIVATE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
if (CMDIChildWnd::OnCreate(lpCreateStruct) == -1)
return -1;
- // Merge frame has a header bar at top
+ EnableDocking(CBRS_ALIGN_TOP);
+
+ // Dir frame has a header bar at top
if (!m_wndFilePathBar.Create(this))
{
- TRACE0("Failed to create dialog bar\n");
+ TRACE0("Failed to create header bar\n");
+ return -1; // fail to create
+ }
+
+ // Dir frame has a floating bar displayed during comparison
+ if (!m_wndCompStateBar.Create(this))
+ {
+ TRACE0("Failed to create floating dialog bar\n");
return -1; // fail to create
}
+ m_wndCompStateBar.EnableDocking(0);
// Directory frame has a status bar
if (!m_wndStatusBar.Create(this) ||
nCmdShow = SW_MAXIMIZE;
CMDIChildWnd::ActivateFrame(nCmdShow);
+ bFrameIsActive = TRUE;
+
+ // hide the floating bar
+ ShowProcessingBar(FALSE);
+ // and set its initial position (centered at 1/3 of screen)
+ CRect rc;
+ GetWindowRect(&rc);
+ CPoint origin;
+ origin.x = (rc.left+rc.right)/2;
+ origin.y = (rc.top+rc.bottom)/3;
+ CRect rcBar;
+ m_wndCompStateBar.GetDefaultRect(&rcBar);
+ origin -= rcBar.CenterPoint();
+ // always call once FloatControlBar for a floating bar
+ FloatControlBar(&m_wndCompStateBar, origin);
// prepare file path bar to look as a status bar
if (m_wndFilePathBar.LookLikeThisWnd(&m_wndStatusBar) == TRUE)
m_wndFilePathBar.Resize();
}
+
+/// clear counters used to track diff progress
+void CDirFrame::clearStatus()
+{
+ m_wndCompStateBar.ClearStat();
+}
+
+/// diff completed another file
+void CDirFrame::rptStatus(UINT diffcode)
+{
+ m_wndCompStateBar.AddElement(diffcode);
+}
+
+LRESULT CDirFrame::OnUpdateStatusMessage(WPARAM wParam, LPARAM lParam)
+{
+ if (wParam == 0xFF)
+ clearStatus();
+ else
+ rptStatus(wParam);
+ return 0; // return value not meaningful
+}
+
+/**
+ * @brief Interface to show/hide the floating state bar
+ */
+void CDirFrame::ShowProcessingBar(BOOL bShow)
+{
+ if (bShow)
+ {
+ ShowControlBar(&m_wndCompStateBar, TRUE, FALSE);
+ // disable the list view as long as the state bar is shown
+ GetActiveView()->EnableWindow(FALSE);
+ }
+ else if (!bShow)
+ ShowControlBar(&m_wndCompStateBar, FALSE, FALSE);
+
+ bStateBarIsActive = bShow;
+}
+
+
+/**
+ * @brief Enable the list view when the state bar becomes inactive
+ */
+void CDirFrame::NotifyHideStateBar()
+{
+ if (GetParentFrame()->GetActiveDocument() != NULL)
+ return;
+ if (!bFrameIsActive)
+ // bar hidden because the frame get unactived
+ return;
+
+ bStateBarIsActive = FALSE;
+
+ if (!GetActiveView()->IsWindowEnabled())
+ {
+ // enable the list view and set the focus
+ GetActiveView()->EnableWindow();
+ GetActiveView()->SetFocus();
+ }
+}
+
+/**
+ * @brief Override of the MFC functions (see windows help)
+ *
+ * @note Hides the state bar when the document is inactive
+ * (it is a topmost bar, and we don't want to display it above the new active document)
+ */
+void CDirFrame::OnMDIActivate(BOOL bActivate, CWnd* pActivateWnd, CWnd* pDeactivateWnd)
+{
+
+ if (bActivate == TRUE)
+ if (bStateBarIsActive)
+ ShowControlBar(&m_wndCompStateBar, TRUE, FALSE);
+
+ CMDIChildWnd::OnMDIActivate(bActivate, pActivateWnd, pDeactivateWnd);
+ bFrameIsActive = bActivate;
+
+ if (bActivate == FALSE)
+ if (bStateBarIsActive)
+ ShowControlBar(&m_wndCompStateBar, FALSE, FALSE);
+}
+
+/**
+ * @brief Override of the MFC functions (see windows help)
+ *
+ * @note: this line 'pParentFrame->ShowWindow' is bad with MDI
+ * It disturbs the coloring of the document caption if there are two docs
+ * (light blue for inactive / blue for active)
+ */
+void CDirFrame::ShowControlBar( CControlBar* pBar, BOOL bShow, BOOL bDelay )
+{
+ ASSERT(pBar != NULL);
+ CFrameWnd* pParentFrame = pBar->GetDockingFrame();
+ ASSERT(pParentFrame->GetTopLevelParent() == GetTopLevelParent());
+ // parent frame of bar must be related
+
+ if (bDelay)
+ {
+ pBar->DelayShow(bShow);
+ pParentFrame->DelayRecalcLayout();
+ }
+ else
+ {
+ pBar->SetWindowPos(NULL, 0, 0, 0, 0,
+ SWP_NOZORDER|SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE|
+ (bShow ? SWP_SHOWWINDOW : SWP_HIDEWINDOW));
+ // call DelayShow to clear any contradictory DelayShow
+ pBar->DelayShow(bShow);
+ if (bShow || !pBar->IsFloating())
+ pParentFrame->RecalcLayout(FALSE);
+ }
+
+ // show or hide the floating frame as appropriate
+ if (pBar->IsFloating())
+ {
+ int nVisCount = pBar->m_pDockBar != NULL ?
+ pBar->m_pDockBar->GetDockedVisibleCount() : bShow ? 1 : 0;
+ if (nVisCount == 1 && bShow)
+ {
+ pParentFrame->m_nShowDelay = -1;
+ if (bDelay)
+ {
+ pParentFrame->m_nShowDelay = SW_SHOWNA;
+ pParentFrame->RecalcLayout(FALSE);
+ }
+ else
+ pParentFrame->ShowWindow(SW_SHOWNA);
+ }
+ else if (nVisCount == 0)
+ {
+ ASSERT(!bShow);
+ pParentFrame->m_nShowDelay = -1;
+ if (bDelay)
+ pParentFrame->m_nShowDelay = SW_HIDE;
+ else
+ pParentFrame->SetWindowPos(NULL, 0, 0, 0, 0, SWP_HIDEWINDOW | SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
+ // bug : this hides the window and give focus to the parent
+ // (also parent may be disabled too)
+ // pParentFrame->ShowWindow(SW_HIDE);
+ }
+ else if (!bDelay)
+ {
+ pParentFrame->RecalcLayout(FALSE);
+ }
+ }
+}
+
#endif // _MSC_VER >= 1000
#include "EditorFilepathBar.h"
+#include "DirCompStateBar.h"
/////////////////////////////////////////////////////////////////////////////
// CDirFrame frame
CStatusBar m_wndStatusBar;
void SetClosableCallback(bool (*canclose)(void *), void * param);
IHeaderBar * GetHeaderInterface();
+ void rptStatus(UINT diffcode);
+ void clearStatus();
+ void ShowProcessingBar(BOOL bShow);
+ void NotifyHideStateBar();
// Overrides
// ClassWizard generated virtual function overrides
protected:
CEditorFilePathBar m_wndFilePathBar;
+ CDirCompStateBar m_wndCompStateBar;
+ /* @brief The state bar is active when
+ * <ul>
+ * <li> visible
+ * <li> the frame is unactive, and the state bar was visible when the frame was active
+ * </ul>
+ */
+ BOOL bStateBarIsActive;
+ /* @brief Track the activity of this frame, without delay.
+ * This flag must be updated when CMDIChildWnd::OnMDIActivate is called.
+ * GetParentFrame()->GetActiveFrame() introduces some delay.
+ */
+ BOOL bFrameIsActive;
+
virtual ~CDirFrame();
+ void ShowControlBar( CControlBar* pBar, BOOL bShow, BOOL bDelay );
// Generated message map functions
//{{AFX_MSG(CDirFrame)
afx_msg void OnUpdateStatusNum(CCmdUI* pCmdUI);
afx_msg void OnClose();
afx_msg void OnSize(UINT nType, int cx, int cy);
+ afx_msg LRESULT OnUpdateStatusMessage(WPARAM wParam, LPARAM lParam);
+ afx_msg void OnMDIActivate(BOOL bActivate, CWnd* pActivateWnd, CWnd* pDeactivateWnd);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
ON_UPDATE_COMMAND_UI(ID_VIEW_WHITESPACE, OnUpdateViewWhitespace)
ON_COMMAND(ID_TOOLS_GENERATEPATCH, OnToolsGeneratePatch)
ON_WM_DROPFILES()
- ON_MESSAGE(MSG_STAT_UPDATE, OnUpdateStatusMessage)
ON_WM_SETCURSOR()
ON_COMMAND_RANGE(ID_UNPACK_MANUAL, ID_UNPACK_AUTO, OnPluginUnpackMode)
ON_UPDATE_COMMAND_UI_RANGE(ID_UNPACK_MANUAL, ID_UNPACK_AUTO, OnUpdatePluginUnpackMode)
{
ID_SEPARATOR, // status line indicator
ID_SEPARATOR,
- ID_SEPARATOR,
ID_INDICATOR_CAPS,
ID_INDICATOR_NUM,
ID_INDICATOR_SCRL,
return -1; // fail to create
}
m_wndStatusBar.SetPaneInfo(1, ID_DIFFNUM, 0, 150);
- m_wndStatusBar.SetPaneInfo(2, ID_DIFFSTATUS, 0, 250);
// TODO: Remove this if you don't want tool tips or a resizeable toolbar
m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
}
}
-// clear counters used to track diff progress
-void CMainFrame::clearStatus()
-{
- m_nStatusFileSame = m_nStatusFileBinSame = m_nStatusFileDiff = m_nStatusFileBinDiff = m_nStatusFileError
- = m_nStatusLeftFileOnly = m_nStatusLeftDirOnly = m_nStatusRightFileOnly = m_nStatusRightDirOnly
- = 0;
-}
-
-// diff completed another file
-void CMainFrame::rptStatus(UINT diffcode)
-{
- // TODO: This is a mess
- // How do we fix this ?
- DIFFITEM di;
- di.diffcode = diffcode;
- if (di.isSideLeft())
- {
- if (di.isDirectory())
- {
- ++m_nStatusLeftDirOnly;
- }
- else
- {
- ++m_nStatusLeftFileOnly;
- }
- }
- else if (di.isSideRight())
- {
- if (di.isDirectory())
- {
- ++m_nStatusRightDirOnly;
- }
- else
- {
- ++m_nStatusRightFileOnly;
- }
- }
- else
- {
- if (di.isResultSkipped())
- {
- // what about skipped items ?
- }
- else if (di.isResultError())
- {
- // could be directory error ?
- ++m_nStatusFileError;
- }
- // Now we know it was on both sides & compared!
- else if (di.isResultSame())
- {
- if (di.isBin())
- {
- ++m_nStatusFileBinSame;
- }
- else
- {
- ++m_nStatusFileSame;
- }
- }
- else
- {
- // presumably it is diff
- if (di.isDirectory())
- {
- // this doesn't happen right now, but it will
- // TODO
- }
- else
- {
- if (di.isBin())
- {
- ++m_nStatusFileBinDiff;
- }
- else
- {
- ++m_nStatusFileDiff;
- }
- }
- }
- }
-
- CString s;
- // TODO: Load the format string from resource
- s.Format(_T("s:%d bs:%d d:%d bd:%d lf:%d ld:%d rf:%d rd:%d e:%d")
- , m_nStatusFileSame, m_nStatusFileBinSame, m_nStatusFileDiff, m_nStatusFileBinDiff
- , m_nStatusLeftFileOnly, m_nStatusLeftDirOnly, m_nStatusRightFileOnly, m_nStatusRightDirOnly
- , m_nStatusFileError);
- m_wndStatusBar.SetPaneText(2, s);
-}
-
/**
* @brief Begin a diff: open dirdoc if it is directories, else open a mergedoc for editing
*/
DoFileOpen(files[0], files[1], FFILEOPEN_NONE, FFILEOPEN_NONE, ctrlKey);
}
-LRESULT CMainFrame::OnUpdateStatusMessage(WPARAM wParam, LPARAM lParam)
-{
- if (wParam == 0xFF)
- clearStatus();
- else
- rptStatus(wParam);
- return 0; // return value not meaningful
-}
-
BOOL CMainFrame::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
if (CustomStatusCursor::HasWaitCursor())
// Operations
public:
BOOL DeleteFileOrError(LPCTSTR szFile);
- void rptStatus(UINT diffcode);
- void clearStatus();
BOOL SyncFiles(LPCTSTR pszSrc, LPCTSTR pszDest, CString * psError);
BOOL DoSyncFiles(LPCTSTR pszSrc, LPCTSTR pszDest, CString * psError);
BOOL DoFileOpen(LPCTSTR pszLeft = NULL, LPCTSTR pszRight = NULL,
afx_msg void OnUpdateViewWhitespace(CCmdUI* pCmdUI);
afx_msg void OnToolsGeneratePatch();
afx_msg void OnDropFiles(HDROP dropInfo);
- afx_msg LRESULT OnUpdateStatusMessage(WPARAM wParam, LPARAM lParam);
afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
afx_msg void OnPluginUnpackMode(UINT nID);
afx_msg void OnUpdatePluginUnpackMode(CCmdUI* pCmdUI);
# End Source File
# Begin Source File
+SOURCE=.\DirCompStateBar.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\DirDoc.cpp
!IF "$(CFG)" == "Merge - Win32 Release"
# End Source File
# Begin Source File
+SOURCE=.\DirCompStateBar.h
+# End Source File
+# Begin Source File
+
SOURCE=.\DirDoc.h
# End Source File
# Begin Source File
MENUITEM SEPARATOR
MENUITEM "Copy all diffs to other side...",
ID_POPUP_COPYALLDIFFSTOOTHERSIDE
+
MENUITEM "Copy all diffs from other side...",
ID_POPUP_COPYALLDIFFSFROMOTHERSIDE
+
MENUITEM SEPARATOR
MENUITEM "Undo", ID_UNDO
MENUITEM SEPARATOR
BEGIN
MENUITEM "with registered application", ID_DIR_OPEN_LEFT
MENUITEM "with external editor", ID_DIR_OPEN_LEFT_WITHEDITOR
+
MENUITEM "with...", ID_DIR_OPEN_LEFT_WITH
END
POPUP "Open right"
BEGIN
MENUITEM "with registered application", ID_DIR_OPEN_RIGHT
MENUITEM "with external editor", ID_DIR_OPEN_RIGHT_WITHEDITOR
+
MENUITEM "with...", ID_DIR_OPEN_RIGHT_WITH
END
END
ES_READONLY
END
+IDD_DIRCOMPSTATE DIALOGEX 0, 0, 382, 41
+STYLE WS_CHILD
+FONT 8, "MS Sans Serif", 0, 0, 0x1
+BEGIN
+ CONTROL 223,IDC_STATIC,"Static",SS_BITMAP,7,7,12,11,
+ WS_EX_STATICEDGE
+ CONTROL 213,IDC_STATIC,"Static",SS_BITMAP,62,7,12,11,
+ WS_EX_STATICEDGE
+ CONTROL 214,IDC_STATIC,"Static",SS_BITMAP,62,22,12,11,
+ WS_EX_STATICEDGE
+ CONTROL 215,IDC_STATIC,"Static",SS_BITMAP,7,23,12,11,
+ WS_EX_STATICEDGE
+ CONTROL 216,IDC_STATIC,"Static",SS_BITMAP,268,7,12,11,
+ WS_EX_STATICEDGE
+ CONTROL 217,IDC_STATIC,"Static",SS_BITMAP,112,7,12,11,
+ WS_EX_STATICEDGE
+ CONTROL 218,IDC_STATIC,"Static",SS_BITMAP,163,7,12,11,
+ WS_EX_STATICEDGE
+ CONTROL 219,IDC_STATIC,"Static",SS_BITMAP,164,22,12,11,
+ WS_EX_STATICEDGE
+ CONTROL 224,IDC_STATIC,"Static",SS_BITMAP,112,22,12,11,
+ WS_EX_STATICEDGE
+ CONTROL 226,IDC_STATIC,"Static",SS_BITMAP,213,7,12,11,
+ WS_EX_STATICEDGE
+ CONTROL 227,IDC_STATIC,"Static",SS_BITMAP,214,23,12,11,
+ WS_EX_STATICEDGE
+ RTEXT "",IDC_COUNT_LFOLDER,24,9,19,8,SS_REALSIZEIMAGE | 0x2000
+ RTEXT "",IDC_COUNT_RFOLDER,24,25,19,8,SS_REALSIZEIMAGE |
+ 0x2000
+ RTEXT "",IDC_COUNT_EQUAL,77,10,19,8,SS_REALSIZEIMAGE | 0x2000
+ RTEXT "",IDC_COUNT_NOTEQUAL,78,25,19,8,SS_REALSIZEIMAGE |
+ 0x2000
+ RTEXT "",IDC_COUNT_BINARYSAME,128,9,19,8,SS_REALSIZEIMAGE |
+ 0x2000
+ RTEXT "",IDC_COUNT_BINARYDIFF,127,25,19,8,SS_REALSIZEIMAGE |
+ 0x2000
+ RTEXT "",IDC_COUNT_LFILE,180,10,19,8,SS_REALSIZEIMAGE | 0x2000
+ RTEXT "",IDC_COUNT_RFILE,180,25,19,8,SS_REALSIZEIMAGE | 0x2000
+ RTEXT "",IDC_COUNT_FOLDERSKIP,230,10,19,8,SS_REALSIZEIMAGE |
+ 0x2000
+ RTEXT "",IDC_COUNT_FILESKIP,230,24,19,8,SS_REALSIZEIMAGE |
+ 0x2000
+ RTEXT "",IDC_COUNT_UNKNOWN,284,10,19,8,SS_REALSIZEIMAGE |
+ 0x2000
+ PUSHBUTTON "Stop",IDC_COMPARISON_STOP,317,14,60,14
+END
+
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
LEFTMARGIN, 7
RIGHTMARGIN, 266
TOPMARGIN, 7
- BOTTOMMARGIN, 155
END
END
#endif // APSTUDIO_INVOKED
STRINGTABLE DISCARDABLE
BEGIN
+ IDC_COMPARISON_STOP "Stop"
+ IDC_COMPARISON_CLOSE "Press any key"
+END
+
+STRINGTABLE DISCARDABLE
+BEGIN
IDS_NUM_REPLACED "Replaced %1 string(s)."
IDS_EDIT_TEXT_NOT_FOUND "Cannot find string""%s"""
IDS_LINE_STATUS_INFO_EOL "Line: %s Column: %d Characters: %d EOL: %s"
+2003-11-05 Laoran
+ PATCH: [ 831384 ] dir comparison : state bar & stop button
+ WinMerge: DiffContext.cpp DiffContext.h DiffThread.cpp DirDoc.cpp DirFrame.cpp DirFrame.h
+ MainFrm.cpp MainFrm.h Merge.dsp Merge.rc resource.h
+
2003-11-04 Laoran
adapt plugins filters to the syntax of regular expressions
Plugins\dlls: RCLocalizationHelper.dll
#define IDD_DIRCOLS 117
#define ID_FILE_VSSDATABASE 118
#define IDD_SELECTUNPACKER 119
+#define IDD_DIRCOMPSTATE 120
#define IDS_VERSION_FMT 130
#define IDS_ALLFILES 131
#define IDS_CONFIRM_ALL_LEFT 132
#define IDC_EXT_EDITOR_PATH 1092
#define IDC_DIFF_SWAPFILES 1093
#define IDC_DIFF_OPENTOEDITOR 1094
+#define IDC_COUNT_LFOLDER 1095
+#define IDC_COUNT_RFOLDER 1096
+#define IDC_COUNT_FILESKIP 1097
+#define IDC_COUNT_FOLDERSKIP 1098
+#define IDC_COUNT_UNKNOWN 1099
+#define IDC_COUNT_EQUAL 1100
+#define IDC_COUNT_NOTEQUAL 1101
+#define IDC_COUNT_BINARYSAME 1102
+#define IDC_COUNT_BINARYDIFF 1103
+#define IDC_COUNT_LFILE 1104
+#define IDC_COUNT_RFILE 1105
+#define IDC_COMPARISON_STOP 1106
+#define IDC_COMPARISON_CLOSE 1107
#define IDS_NUM_REPLACED 8501
#define IDS_EDIT_TEXT_NOT_FOUND 8502
#define IDS_LINE_STATUS_INFO_EOL 8503
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_3D_CONTROLS 1
-#define _APS_NEXT_RESOURCE_VALUE 120
+#define _APS_NEXT_RESOURCE_VALUE 121
#define _APS_NEXT_COMMAND_VALUE 32856
-#define _APS_NEXT_CONTROL_VALUE 1095
+#define _APS_NEXT_CONTROL_VALUE 1108
#define _APS_NEXT_SYMED_VALUE 108
#endif
#endif