OSDN Git Service

Rename CChlidFrame class to CMergeEditFrame class
authorTakashi Sawanaka <sdottaka@users.sourceforge.net>
Sat, 6 Apr 2019 11:09:44 +0000 (20:09 +0900)
committerTakashi Sawanaka <sdottaka@users.sourceforge.net>
Sat, 6 Apr 2019 11:09:44 +0000 (20:09 +0900)
17 files changed:
Src/ChildFrm.cpp [deleted file]
Src/ChildFrm.h [deleted file]
Src/DiffViewBar.cpp
Src/ImgMergeFrm.cpp
Src/LocationBar.cpp
Src/LocationView.cpp
Src/MainFrm.cpp
Src/Merge.cpp
Src/Merge.vs2017.vcxproj
Src/Merge.vs2017.vcxproj.filters
Src/Merge.vs2019.vcxproj
Src/Merge.vs2019.vcxproj.filters
Src/MergeDoc.cpp
Src/MergeDoc.h
Src/MergeEditView.cpp
Src/OpenFrm.cpp
Src/Test.cpp

diff --git a/Src/ChildFrm.cpp b/Src/ChildFrm.cpp
deleted file mode 100644 (file)
index c0ffcbc..0000000
+++ /dev/null
@@ -1,532 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//    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  ChildFrm.cpp
- *
- * @brief Implementation file for CChildFrame
- *
- */
-
-#include "stdafx.h"
-#include "ChildFrm.h"
-#include "Merge.h"
-#include "MainFrm.h"
-#include "MergeDoc.h"
-#include "MergeEditView.h"
-#include "LocationView.h"
-#include "DiffViewBar.h"
-#include "OptionsDef.h"
-#include "OptionsMgr.h"
-
-#ifdef _DEBUG
-#define new DEBUG_NEW
-#endif
-
-#define SWAPPARAMS_IF(c, a, b) (c ? a : b), (c ? b : a)
-
-/////////////////////////////////////////////////////////////////////////////
-// CChildFrame
-
-IMPLEMENT_DYNCREATE(CChildFrame, CMDIChildWnd)
-
-BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWnd)
-       //{{AFX_MSG_MAP(CChildFrame)
-       ON_WM_CREATE()
-       ON_WM_CLOSE()
-       ON_WM_MDIACTIVATE()
-       ON_WM_TIMER()
-       ON_WM_GETMINMAXINFO()
-       ON_UPDATE_COMMAND_UI(ID_VIEW_DETAIL_BAR, OnUpdateControlBarMenu)
-       ON_COMMAND_EX(ID_VIEW_DETAIL_BAR, OnBarCheck)
-       ON_UPDATE_COMMAND_UI(ID_VIEW_LOCATION_BAR, OnUpdateControlBarMenu)
-       ON_COMMAND_EX(ID_VIEW_LOCATION_BAR, OnBarCheck)
-       ON_COMMAND(ID_VIEW_SPLITVERTICALLY, OnViewSplitVertically)
-       ON_UPDATE_COMMAND_UI(ID_VIEW_SPLITVERTICALLY, OnUpdateViewSplitVertically)
-       ON_MESSAGE(MSG_STORE_PANESIZES, OnStorePaneSizes)
-       ON_WM_SIZE()
-       ON_MESSAGE_VOID(WM_IDLEUPDATECMDUI, OnIdleUpdateCmdUI)
-       //}}AFX_MSG_MAP
-END_MESSAGE_MAP()
-
-#define IDT_SAVEPOSITION 2
-
-/////////////////////////////////////////////////////////////////////////////
-// CChildFrame construction/destruction
-
-/**
- * @brief Constructor.
- */
-CChildFrame::CChildFrame()
-: m_hIdentical(nullptr)
-, m_hDifferent(nullptr)
-{
-       m_bActivated = false;
-       std::fill_n(m_nLastSplitPos, 2, 0);
-       m_pMergeDoc = 0;
-}
-
-/**
- * Destructor.
- */
-CChildFrame::~CChildFrame()
-{
-}
-
-BOOL CChildFrame::OnCreateClient( LPCREATESTRUCT /*lpcs*/,
-       CCreateContext* pContext)
-{
-       m_wndSplitter.HideBorders(true);
-       m_wndSplitter.Create(this, 2, 1, CSize(1, 1), pContext, WS_CHILD | WS_VISIBLE | 1/*SPLS_DYNAMIC_SPLIT*/);
-
-       // Merge frame has also a dockable bar at the very left
-       // This is not the client area, but we create it now because we want
-       // to use the CCreateContext
-       String sCaption = _("Location Pane");
-       if (!m_wndLocationBar.Create(this, sCaption.c_str(), WS_CHILD | WS_VISIBLE, ID_VIEW_LOCATION_BAR))
-       {
-               TRACE0("Failed to create LocationBar\n");
-               return FALSE;
-       }
-
-       CLocationView *pLocationView = new CLocationView;
-       DWORD dwStyle = AFX_WS_DEFAULT_VIEW & ~WS_BORDER;
-       pLocationView->Create(nullptr, nullptr, dwStyle, CRect(0,0,40,100), &m_wndLocationBar, 152, pContext);
-
-       // Merge frame has also a dockable bar at the very bottom
-       // This is not the client area, but we create it now because we want
-       // to use the CCreateContext
-       sCaption = _("Diff Pane");
-       if (!m_wndDetailBar.Create(this, sCaption.c_str(), WS_CHILD | WS_VISIBLE, ID_VIEW_DETAIL_BAR))
-       {
-               TRACE0("Failed to create DiffViewBar\n");
-               return FALSE;
-       }
-
-       m_pwndDetailMergeEditSplitterView = new CMergeEditSplitterView();
-       m_pwndDetailMergeEditSplitterView->m_bDetailView = true;
-       m_pwndDetailMergeEditSplitterView->Create(nullptr, nullptr, dwStyle, CRect(0,0,1,1), &m_wndDetailBar, ID_VIEW_DETAIL_BAR+1, pContext);
-
-       // tell merge doc about these views
-       m_pMergeDoc = dynamic_cast<CMergeDoc *>(pContext->m_pCurrentDoc);
-       m_pMergeDoc->ForEachView([&](auto& pView) {
-               pView->SetStatusInterface(m_wndStatusBar.GetIMergeEditStatus(pView->m_nThisPane));
-       });
-       m_pMergeDoc->SetLocationView(pLocationView);
-
-       m_wndFilePathBar.SetPaneCount(m_pMergeDoc->m_nBuffers);
-       m_wndFilePathBar.SetOnSetFocusCallback([&](int pane) {
-               auto& wndSplitter = GetMergeEditSplitterWnd(0);
-               if (wndSplitter.GetColumnCount() > 1)
-                       wndSplitter.SetActivePane(0, pane);
-               else
-                       wndSplitter.SetActivePane(pane, 0);
-       });
-       m_wndStatusBar.SetPaneCount(m_pMergeDoc->m_nBuffers);
-       
-       // Set frame window handles so we can post stage changes back
-       pLocationView->SetFrameHwnd(GetSafeHwnd());
-       m_wndLocationBar.SetFrameHwnd(GetSafeHwnd());
-       m_wndDetailBar.SetFrameHwnd(GetSafeHwnd());
-
-       return TRUE;
-}
-
-/////////////////////////////////////////////////////////////////////////////
-// CChildFrame message handlers
-
-/**
-* @brief Create the child frame, the splitter, the filename bar, the status bar,
-* the diff dockable bar, and the four views
-*
-* @note  the panels layout is 
-* <ul>
-*  <li>   -----------
-*  <li>                !  header !
-*  <li>                !.........!
-*  <li>                !.   .   .!
-*  <li>                !. 1 . 2 .!
-*  <li>                !.   .   .!
-*  <li>                !.........!
-*  <li>                !.........!
-*  <li>                !  status !
-*  <li>                -----------
-*  <li>                !.........!
-*  <li>                !.   3   .!
-*  <li>                !.dockable!
-*  <li>                ! splitbar!
-*  <li>                !.   4   .!
-*  <li>                !.........!
-*  <li>                -----------
-* </ul>
-*/
-int CChildFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) 
-{
-       if (CMDIChildWnd::OnCreate(lpCreateStruct) == -1)
-               return -1;
-
-       EnableDocking(CBRS_ALIGN_TOP|CBRS_ALIGN_BOTTOM|CBRS_ALIGN_LEFT | CBRS_ALIGN_RIGHT);
-
-       // Merge frame has a header bar at top
-       if (!m_wndFilePathBar.Create(this))
-       {
-               TRACE0("Failed to create dialog bar\n");
-               return -1;      // fail to create
-       }
-
-       // Set filename bars inactive so colors get initialized
-       m_wndFilePathBar.SetActive(0, false);
-       m_wndFilePathBar.SetActive(1, false);
-       m_wndFilePathBar.SetActive(2, false);
-
-       // Merge frame also has a dockable bar at the very left
-       // created in OnCreateClient 
-       m_wndLocationBar.SetBarStyle(m_wndLocationBar.GetBarStyle() |
-               CBRS_SIZE_DYNAMIC | CBRS_ALIGN_LEFT);
-       m_wndLocationBar.EnableDocking(CBRS_ALIGN_LEFT | CBRS_ALIGN_RIGHT);
-       DockControlBar(&m_wndLocationBar, AFX_IDW_DOCKBAR_LEFT);
-
-       // Merge frame also has a dockable bar at the very bottom
-       // created in OnCreateClient 
-       m_wndDetailBar.SetBarStyle(m_wndDetailBar.GetBarStyle() |
-               CBRS_SIZE_DYNAMIC | CBRS_ALIGN_TOP);
-       m_wndDetailBar.EnableDocking(CBRS_ALIGN_TOP | CBRS_ALIGN_BOTTOM);
-       DockControlBar(&m_wndDetailBar, AFX_IDW_DOCKBAR_BOTTOM);
-
-       // Merge frame also has a status bar at bottom, 
-       // m_wndDetailBar is below, so we create this bar after m_wndDetailBar
-       if (!m_wndStatusBar.Create(this))
-       {
-               TRACE0("Failed to create status bar\n");
-               return -1;      // fail to create
-       }       
-
-       m_hIdentical = AfxGetApp()->LoadIcon(IDI_EQUALTEXTFILE);
-       m_hDifferent = AfxGetApp()->LoadIcon(IDI_NOTEQUALTEXTFILE);
-
-       return 0;
-}
-
-/**
- * @brief We must use this function before a call to SetDockState
- *
- * @note Without this, SetDockState will assert or crash if a bar from the 
- * CDockState is missing in the current CChildFrame.
- * The bars are identified with their ID. This means the missing bar bug is triggered
- * when we run WinMerge after changing the ID of a bar. 
- */
-bool CChildFrame::EnsureValidDockState(CDockState& state) 
-{
-       for (int i = (int) state.m_arrBarInfo.GetSize()-1 ; i >= 0; i--) 
-       {
-               bool barIsCorrect = true;
-               CControlBarInfo* pInfo = (CControlBarInfo*)state.m_arrBarInfo[i];
-               if (pInfo == nullptr) 
-                       barIsCorrect = false;
-               else
-               {
-                       if (! pInfo->m_bFloating) 
-                       {
-                               pInfo->m_pBar = GetControlBar(pInfo->m_nBarID);
-                               if (pInfo->m_pBar == nullptr) 
-                                       barIsCorrect = false; //toolbar id's probably changed   
-                       }
-               }
-
-               if (! barIsCorrect)
-                       state.m_arrBarInfo.RemoveAt(i);
-       }
-       return true;
-}
-
-void CChildFrame::ActivateFrame(int nCmdShow) 
-{
-       // load docking positions and sizes
-       CDockState pDockState;
-       pDockState.LoadState(_T("Settings"));
-       if (EnsureValidDockState(pDockState)) // checks for valid so won't ASSERT
-               SetDockState(pDockState);
-       // for the dimensions of the diff and location pane, use the CSizingControlBar loader
-       m_wndLocationBar.LoadState(_T("Settings"));
-       m_wndDetailBar.LoadState(_T("Settings"));
-
-       if (!m_bActivated) 
-       {
-               m_bActivated = true;
-
-               // get the active child frame, and a flag whether it is maximized
-               BOOL bMaximized = FALSE;
-               CMDIChildWnd * oldActiveFrame = GetMDIFrame()->MDIGetActive(&bMaximized);
-               if (oldActiveFrame == nullptr)
-                       // for the first frame, get the restored/maximized state from the registry
-                       bMaximized = GetOptionsMgr()->GetBool(OPT_ACTIVE_FRAME_MAX);
-               if (bMaximized)
-                       nCmdShow = SW_SHOWMAXIMIZED;
-               else
-                       nCmdShow = SW_SHOWNORMAL;
-       }
-
-       CMDIChildWnd::ActivateFrame(nCmdShow);
-}
-
-BOOL CChildFrame::DestroyWindow() 
-{
-       SavePosition();
-       // If we are active, save the restored/maximized state
-       // If we are not, do nothing and let the active frame do the job.
-       if (this->GetParentFrame()->GetActiveFrame() == (CFrameWnd*)this)
-       {
-               WINDOWPLACEMENT wp;
-               wp.length = sizeof(WINDOWPLACEMENT);
-               GetWindowPlacement(&wp);
-               GetOptionsMgr()->SaveOption(OPT_ACTIVE_FRAME_MAX, (wp.showCmd == SW_MAXIMIZE));
-       }
-
-       return CMDIChildWnd::DestroyWindow();
-}
-
-/**
- * @brief Save coordinates of the frame, splitters, and bars
- *
- * @note Do not save the maximized/restored state here. We are interested
- * in the state of the active frame, and maybe this frame is not active
- */
-void CChildFrame::SavePosition()
-{
-       // save the bars layout
-       // save docking positions and sizes
-       CDockState m_pDockState;
-       GetDockState(m_pDockState);
-       m_pDockState.SaveState(_T("Settings"));
-       // for the dimensions of the diff pane, use the CSizingControlBar save
-       m_wndLocationBar.SaveState(_T("Settings"));
-       m_wndDetailBar.SaveState(_T("Settings"));
-
-       int iRow, iCol;
-       m_wndSplitter.GetActivePane(&iRow, nullptr);
-       if (iRow >= 0)
-       {
-               auto& splitterWnd = static_cast<CMergeEditSplitterView *>(m_wndSplitter.GetPane(iRow, 0))->m_wndSplitter;
-               splitterWnd.GetActivePane(&iRow, &iCol);
-               if (iRow >= 0 || iCol >= 0)
-                       GetOptionsMgr()->SaveOption(OPT_ACTIVE_PANE, max(iRow, iCol));
-       }
-}
-
-void CChildFrame::OnClose() 
-{
-       // clean up pointers.
-       CMDIChildWnd::OnClose();
-
-       GetMainFrame()->ClearStatusbarItemCount();
-}
-
-/// update splitting position for panels 1/2 and headerbar and statusbar 
-void CChildFrame::UpdateHeaderSizes()
-{
-       if(!::IsWindow(m_wndFilePathBar.m_hWnd) || !::IsWindow(m_wndSplitter.m_hWnd))
-               return;
-       
-       if(IsWindowVisible())
-       {
-               int w[3];
-               int pane;
-               CMergeDoc * pDoc = GetMergeDoc();
-               auto& wndSplitter = GetMergeEditSplitterWnd(0);
-               if (wndSplitter.GetColumnCount() > 1)
-               {
-                       for (pane = 0; pane < wndSplitter.GetColumnCount(); pane++)
-                       {
-                               int wmin;
-                               wndSplitter.GetColumnInfo(pane, w[pane], wmin);
-                               if (w[pane]<1) w[pane]=1; // Perry 2003-01-22 (I don't know why this happens)
-                       }
-               }
-               else
-               {
-                       CRect rect;
-                       wndSplitter.GetWindowRect(&rect);
-                       for (pane = 0; pane < pDoc->m_nBuffers; pane++)
-                       {
-                               w[pane] = rect.Width() /  pDoc->m_nBuffers;
-                       }
-               }
-
-               if (!std::equal(m_nLastSplitPos, m_nLastSplitPos + pDoc->m_nBuffers - 1, w))
-               {
-                       std::copy_n(w, pDoc->m_nBuffers - 1, m_nLastSplitPos);
-
-                       // resize controls in header dialog bar
-                       m_wndFilePathBar.Resize(w);
-
-                       m_wndStatusBar.Resize(w);
-               }
-       }
-}
-
-IHeaderBar * CChildFrame::GetHeaderInterface()
-{
-       return &m_wndFilePathBar;
-}
-
-/**
-* @brief Reflect comparison result in window's icon.
-* @param nResult [in] Last comparison result which the application returns.
-*/
-void CChildFrame::SetLastCompareResult(int nResult)
-{
-       HICON hCurrent = GetIcon(FALSE);
-       HICON hReplace = (nResult == 0) ? m_hIdentical : m_hDifferent;
-
-       if (hCurrent != hReplace)
-       {
-               SetIcon(hReplace, TRUE);
-
-               BOOL bMaximized;
-               GetMDIFrame()->MDIGetActive(&bMaximized);
-
-               // When MDI maximized the window icon is drawn on the menu bar, so we
-               // need to notify it that our icon has changed.
-               if (bMaximized)
-               {
-                       GetMDIFrame()->DrawMenuBar();
-               }
-               GetMDIFrame()->OnUpdateFrameTitle(FALSE);
-       }
-
-       theApp.SetLastCompareResult(nResult);
-}
-
-void CChildFrame::UpdateAutoPaneResize()
-{
-       auto& wndSplitter = GetMergeEditSplitterWnd(0);
-       wndSplitter.AutoResizePanes(GetOptionsMgr()->GetBool(OPT_RESIZE_PANES));
-}
-
-void CChildFrame::UpdateSplitter()
-{
-       for (int iRow = 0; iRow < m_wndSplitter.GetRowCount(); ++iRow)
-               GetMergeEditSplitterWnd(iRow).RecalcLayout();
-       m_wndSplitter.RecalcLayout();
-       m_pwndDetailMergeEditSplitterView->m_wndSplitter.RecalcLayout();
-}
-
-/**
- * @brief Synchronize control with splitter position,
- */
-void CChildFrame::OnIdleUpdateCmdUI()
-{
-       UpdateHeaderSizes();
-       CMDIChildWnd::OnIdleUpdateCmdUI();
-}
-
-void CChildFrame::OnTimer(UINT_PTR nIDEvent) 
-{
-       if (nIDEvent == IDT_SAVEPOSITION)
-       {
-               SavePosition();
-               KillTimer(IDT_SAVEPOSITION);
-       }
-       else
-       {
-               UpdateHeaderSizes();
-       }
-       CMDIChildWnd::OnTimer(nIDEvent);
-}
-
-void CChildFrame::OnGetMinMaxInfo(MINMAXINFO* lpMMI)
-{
-       CMDIChildWnd::OnGetMinMaxInfo(lpMMI);
-       // [Fix for MFC 8.0 MDI Maximizing Child Window bug on Vista]
-       // https://groups.google.com/forum/#!topic/microsoft.public.vc.mfc/iajCdW5DzTM
-#if _MFC_VER >= 0x0800
-       lpMMI->ptMaxTrackSize.x = max(lpMMI->ptMaxTrackSize.x, lpMMI->ptMaxSize.x);
-       lpMMI->ptMaxTrackSize.y = max(lpMMI->ptMaxTrackSize.y, lpMMI->ptMaxSize.y);
-#endif
-}
-
-void CChildFrame::OnMDIActivate(BOOL bActivate, CWnd* pActivateWnd, CWnd* pDeactivateWnd)
-{
-       CMDIChildWnd::OnMDIActivate(bActivate, pActivateWnd, pDeactivateWnd);
-
-       CMergeDoc *pDoc = GetMergeDoc();
-       if (bActivate && pDoc != nullptr)
-               this->GetParentFrame()->PostMessage(WM_USER+1);
-       return;
-}
-
-/**
- * @brief Split panes vertically
- */
-void CChildFrame::OnViewSplitVertically() 
-{
-       auto& wndSplitter = GetMergeEditSplitterWnd(0);
-       bool bSplitVertically = (wndSplitter.GetColumnCount() != 1);
-       bSplitVertically = !bSplitVertically; // toggle
-       GetOptionsMgr()->SaveOption(OPT_SPLIT_HORIZONTALLY, !bSplitVertically);
-       for (int iRow = 0; iRow < m_wndSplitter.GetRowCount(); ++iRow)
-               GetMergeEditSplitterWnd(iRow).FlipSplit();
-       m_pwndDetailMergeEditSplitterView->m_wndSplitter.FlipSplit();
-}
-
-/**
- * @brief Update "Split Vertically" UI items
- */
-void CChildFrame::OnUpdateViewSplitVertically(CCmdUI* pCmdUI) 
-{
-       auto& wndSplitter = GetMergeEditSplitterWnd(0);
-       pCmdUI->Enable(TRUE);
-       pCmdUI->SetCheck((wndSplitter.GetColumnCount() != 1));
-}
-
-/// Document commanding us to close
-void CChildFrame::CloseNow()
-{
-       SavePosition(); // Save settings before closing!
-       MDIActivate();
-       MDIDestroy();
-}
-
-/**
- * @brief Update any resources necessary after a GUI language change
- */
-void CChildFrame::UpdateResources()
-{
-       m_wndStatusBar.UpdateResources();
-       m_wndLocationBar.UpdateResources();
-       m_wndDetailBar.UpdateResources();
-}
-
-/**
- * @brief Save pane sizes and positions when one of panes requests it.
- */
-LRESULT CChildFrame::OnStorePaneSizes(WPARAM wParam, LPARAM lParam)
-{
-       KillTimer(IDT_SAVEPOSITION);
-       SetTimer(IDT_SAVEPOSITION, 300, nullptr);
-       return 0;
-}
-
-void CChildFrame::OnSize(UINT nType, int cx, int cy) 
-{
-       CMDIChildWnd::OnSize(nType, cx, cy);
-       
-       UpdateHeaderSizes();
-}
diff --git a/Src/ChildFrm.h b/Src/ChildFrm.h
deleted file mode 100644 (file)
index 18f7568..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//    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  ChildFrm.h
- *
- * @brief interface of the CChildFrame class
- *
- */
-#pragma once
-
-#include "SplitterWndEx.h"
-#include "MergeEditSplitterView.h"
-#include "MergeStatusBar.h"
-#include "EditorFilepathBar.h"
-#include "DiffViewBar.h"
-#include "LocationBar.h"
-
-class CMergeDoc;
-
-/** 
- * @brief Frame class for file compare, handles panes, statusbar etc.
- */
-class CChildFrame : public CMDIChildWnd
-{
-       DECLARE_DYNCREATE(CChildFrame)
-public:
-       CChildFrame();
-
-// Operations
-public:
-       void UpdateResources();
-       void CloseNow();
-       IHeaderBar * GetHeaderInterface();
-       void SetSharedMenu(HMENU hMenu) { m_hMenuShared = hMenu; };
-       CMergeDoc * GetMergeDoc() { return m_pMergeDoc; }
-       void SetLastCompareResult(int nResult);
-
-       void UpdateAutoPaneResize();
-       void UpdateSplitter();
-       CSplitterWndEx& GetSplitter() { return m_wndSplitter; };
-       bool IsActivated() const { return m_bActivated; }
-
-// Attributes
-protected:
-       CSplitterWndEx m_wndSplitter;
-       CEditorFilePathBar m_wndFilePathBar;
-       CDiffViewBar m_wndDetailBar;
-       CMergeEditSplitterView *m_pwndDetailMergeEditSplitterView;
-       CMergeStatusBar m_wndStatusBar;
-       CLocationBar m_wndLocationBar;
-
-// Overrides
-public:
-       // ClassWizard generated virtual function overrides
-       //{{AFX_VIRTUAL(CChildFrame)
-       public:
-       virtual BOOL OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext);
-       virtual void ActivateFrame(int nCmdShow = -1);
-       virtual BOOL DestroyWindow();
-       protected:
-       //}}AFX_VIRTUAL
-
-// Implementation
-private:
-       bool EnsureValidDockState(CDockState& state);
-       void SavePosition();
-       virtual ~CChildFrame();
-       CSplitterWndEx& GetMergeEditSplitterWnd(int iRow)
-       { return static_cast<CMergeEditSplitterView *>(m_wndSplitter.GetPane(iRow, 0))->m_wndSplitter; }
-
-// Generated message map functions
-private:
-       int m_nLastSplitPos[2];
-       void UpdateHeaderSizes();
-       bool m_bActivated;
-       CMergeDoc * m_pMergeDoc;
-       HICON m_hIdentical;
-       HICON m_hDifferent;
-
-       //{{AFX_MSG(CChildFrame)
-       afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
-       afx_msg void OnClose();
-       afx_msg void OnTimer(UINT_PTR nIDEvent);
-       afx_msg void OnMDIActivate(BOOL bActivate, CWnd* pActivateWnd, CWnd* pDeactivateWnd);
-       afx_msg void OnViewSplitVertically();
-       afx_msg void OnUpdateViewSplitVertically(CCmdUI* pCmdUI);
-       afx_msg LRESULT OnStorePaneSizes(WPARAM wParam, LPARAM lParam);
-       afx_msg void OnSize(UINT nType, int cx, int cy);
-       afx_msg void OnIdleUpdateCmdUI();
-       afx_msg void OnGetMinMaxInfo(MINMAXINFO* lpMMI);
-       //}}AFX_MSG
-       DECLARE_MESSAGE_MAP()
-};
index dd4a7d5..efda1e4 100644 (file)
@@ -44,7 +44,7 @@ END_MESSAGE_MAP()
 /**
 * @brief Just create ourself
 *
-* @note The control are created in the parent frame CChildFrame
+* @note The control are created in the parent frame CMergeEditFrame
 *
 */
 BOOL CDiffViewBar::Create(
@@ -88,7 +88,7 @@ void CDiffViewBar::OnLButtonDown(UINT nFlags, CPoint point)
 }
 
 /** 
- * @brief Informs parent frame (CChildFrame) when bar is closed.
+ * @brief Informs parent frame (CMergeEditFrame) when bar is closed.
  *
  * After bar is closed parent frame saves bar states.
  */
@@ -105,7 +105,7 @@ void CDiffViewBar::OnWindowPosChanged(WINDOWPOS* lpwndpos)
 }
 
 /** 
- * @brief Stores HWND of frame window (CChildFrame).
+ * @brief Stores HWND of frame window (CMergeEditFrame).
  */
 void CDiffViewBar::SetFrameHwnd(HWND hwndFrame)
 {
index 096c9f3..a398486 100644 (file)
@@ -522,7 +522,7 @@ int CImgMergeFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
 * @brief We must use this function before a call to SetDockState
 *
 * @note Without this, SetDockState will assert or crash if a bar from the
-* CDockState is missing in the current CChildFrame.
+* CDockState is missing in the current CMergeEditFrame.
 * The bars are identified with their ID. This means the missing bar bug is triggered
 * when we run WinMerge after changing the ID of a bar.
 */
index cc228e5..5966ac1 100644 (file)
@@ -44,7 +44,7 @@ END_MESSAGE_MAP()
 /**
 * @brief Just create ourself
 *
-* @note The control are created in the parent frame CChildFrame
+* @note The control are created in the parent frame CMergeEditFrame
 *
 */
 BOOL CLocationBar::Create(
@@ -92,7 +92,7 @@ void CLocationBar::OnSize(UINT nType, int cx, int cy)
 }
 
 /** 
- * @brief Informs parent frame (CChildFrame) when bar is closed.
+ * @brief Informs parent frame (CMergeEditFrame) when bar is closed.
  *
  * After bar is closed parent frame saves bar states.
  */
@@ -109,7 +109,7 @@ void CLocationBar::OnWindowPosChanged(WINDOWPOS* lpwndpos)
 }
 
 /** 
- * @brief Stores HWND of frame window (CChildFrame).
+ * @brief Stores HWND of frame window (CMergeEditFrame).
  */
 void CLocationBar::SetFrameHwnd(HWND hwndFrame)
 {
index 7769f44..09b685c 100644 (file)
@@ -1034,7 +1034,7 @@ void CLocationView::DrawConnectLines(CDC *pClientDC)
 }
 
 /** 
- * @brief Stores HWND of frame window (CChildFrame).
+ * @brief Stores HWND of frame window (CMergeEditFrame).
  */
 void CLocationView::SetFrameHwnd(HWND hwndFrame)
 {
index aaae8bc..dad5c63 100644 (file)
@@ -36,7 +36,7 @@
 #include "BCMenu.h"
 #include "OpenFrm.h"
 #include "DirFrame.h"          // Include type information
-#include "ChildFrm.h"
+#include "MergeEditFrm.h"
 #include "HexMergeFrm.h"
 #include "DirView.h"
 #include "DirDoc.h"
@@ -714,7 +714,7 @@ bool CMainFrame::ShowMergeDoc(CDirDoc * pDirDoc,
        bool bResult = pMergeDoc->OpenDocs(nFiles, fileloc, GetROFromFlags(nFiles, dwFlags).data(), strDesc);
        if (bResult)
        {
-               if (CChildFrame *pFrame = pMergeDoc->GetParentFrame())
+               if (CMergeEditFrame *pFrame = pMergeDoc->GetParentFrame())
                        if (!pFrame->IsActivated())
                                pFrame->InitialUpdateFrame(pMergeDoc, true);
        }
@@ -1461,12 +1461,12 @@ CMergeEditView * CMainFrame::GetActiveMergeEditView()
 {
        // NB: GetActiveDocument does not return the Merge Doc 
        //     even when the merge edit view is in front
-       // NB: CChildFrame::GetActiveView returns `nullptr` when location view active
+       // NB: CMergeEditFrame::GetActiveView returns `nullptr` when location view active
        // So we have this rather complicated logic to try to get a merge edit view
        // We look at the front child window, which should be a frame
-       // and we can get a MergeEditView from it, if it is a CChildFrame
+       // and we can get a MergeEditView from it, if it is a CMergeEditFrame
        // (DirViews use a different frame type)
-       CChildFrame * pFrame = dynamic_cast<CChildFrame *>(GetActiveFrame());
+       CMergeEditFrame * pFrame = dynamic_cast<CMergeEditFrame *>(GetActiveFrame());
        if (pFrame == nullptr) return nullptr;
        // Try to get the active MergeEditView (ie, left or right)
        if (pFrame->GetActiveView() != nullptr && pFrame->GetActiveView()->IsKindOf(RUNTIME_CLASS(CMergeEditView)))
@@ -1760,7 +1760,7 @@ void CMainFrame::OnResizePanes()
        GetOptionsMgr()->SaveOption(OPT_RESIZE_PANES, bResize);
        // TODO: Introduce a common merge frame superclass?
        CFrameWnd *pActiveFrame = GetActiveFrame();
-       if (CChildFrame *pFrame = DYNAMIC_DOWNCAST(CChildFrame, pActiveFrame))
+       if (CMergeEditFrame *pFrame = DYNAMIC_DOWNCAST(CMergeEditFrame, pActiveFrame))
        {
                pFrame->UpdateAutoPaneResize();
                if (bResize)
@@ -2297,7 +2297,7 @@ bool CMainFrame::DoOpenConflict(const String& conflictFile, const String strDesc
 */
 CMainFrame::FRAMETYPE CMainFrame::GetFrameType(const CFrameWnd * pFrame) const
 {
-       bool bMergeFrame = !!pFrame->IsKindOf(RUNTIME_CLASS(CChildFrame));
+       bool bMergeFrame = !!pFrame->IsKindOf(RUNTIME_CLASS(CMergeEditFrame));
        bool bHexMergeFrame = !!pFrame->IsKindOf(RUNTIME_CLASS(CHexMergeFrame));
        bool bImgMergeFrame = !!pFrame->IsKindOf(RUNTIME_CLASS(CImgMergeFrame));
        bool bDirFrame = !!pFrame->IsKindOf(RUNTIME_CLASS(CDirFrame));
@@ -2474,8 +2474,8 @@ void CMainFrame::ReloadMenu()
                CWnd *pFrame = CWnd::FromHandle(::GetWindow(pMainFrame->m_hWndMDIClient, GW_CHILD));
                while (pFrame != nullptr)
                {
-                       if (pFrame->IsKindOf(RUNTIME_CLASS(CChildFrame)))
-                               static_cast<CChildFrame *>(pFrame)->SetSharedMenu(hNewMergeMenu);
+                       if (pFrame->IsKindOf(RUNTIME_CLASS(CMergeEditFrame)))
+                               static_cast<CMergeEditFrame *>(pFrame)->SetSharedMenu(hNewMergeMenu);
                        if (pFrame->IsKindOf(RUNTIME_CLASS(CHexMergeFrame)))
                                static_cast<CHexMergeFrame *>(pFrame)->SetSharedMenu(hNewMergeMenu);
                        if (pFrame->IsKindOf(RUNTIME_CLASS(CImgMergeFrame)))
@@ -2490,7 +2490,7 @@ void CMainFrame::ReloadMenu()
                CFrameWnd *pActiveFrame = pMainFrame->GetActiveFrame();
                if (pActiveFrame != nullptr)
                {
-                       if (pActiveFrame->IsKindOf(RUNTIME_CLASS(CChildFrame)))
+                       if (pActiveFrame->IsKindOf(RUNTIME_CLASS(CMergeEditFrame)))
                                pMainFrame->MDISetMenu(pNewMergeMenu, nullptr);
                        else if (pActiveFrame->IsKindOf(RUNTIME_CLASS(CHexMergeFrame)))
                                pMainFrame->MDISetMenu(pNewMergeMenu, nullptr);
index 663bf8c..362f736 100644 (file)
@@ -42,7 +42,7 @@
 #include "HexMergeView.h"
 #include "AboutDlg.h"
 #include "MainFrm.h"
-#include "ChildFrm.h"
+#include "MergeEditFrm.h"
 #include "DirFrame.h"
 #include "MergeDoc.h"
 #include "DirDoc.h"
@@ -363,7 +363,7 @@ BOOL CMergeApp::InitInstance()
        m_pDiffTemplate = new CMultiDocTemplate(
                IDR_MERGEDOCTYPE,
                RUNTIME_CLASS(CMergeDoc),
-               RUNTIME_CLASS(CChildFrame), // custom MDI child frame
+               RUNTIME_CLASS(CMergeEditFrame), // custom MDI child frame
                RUNTIME_CLASS(CMergeEditSplitterView));
        AddDocTemplate(m_pDiffTemplate);
 
index 0ebade6..8018b57 100644 (file)
     <ClCompile Include="charsets.c">\r
       <PrecompiledHeader>NotUsing</PrecompiledHeader>\r
     </ClCompile>\r
-    <ClCompile Include="ChildFrm.cpp" />\r
+    <ClCompile Include="MergeEditFrm.cpp" />\r
     <ClCompile Include="Common\ClipBoard.cpp">\r
       <PrecompiledHeader>Use</PrecompiledHeader>\r
       <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>\r
     <ClInclude Include="Common\BCMenu.h" />\r
     <ClInclude Include="Common\Bitmap.h" />\r
     <ClInclude Include="charsets.h" />\r
-    <ClInclude Include="ChildFrm.h" />\r
+    <ClInclude Include="MergeEditFrm.h" />\r
     <ClInclude Include="Common\ClipBoard.h" />\r
     <ClInclude Include="Common\CMoveConstraint.h" />\r
     <ClInclude Include="codepage_detect.h" />\r
index 7a81b6d..04109cc 100644 (file)
     <ClCompile Include="7zCommon.cpp">\r
       <Filter>MFCGui\Source Files</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="ChildFrm.cpp">\r
-      <Filter>MFCGui\Source Files</Filter>\r
-    </ClCompile>\r
     <ClCompile Include="Common\CMoveConstraint.cpp">\r
       <Filter>MFCGui\Source Files</Filter>\r
     </ClCompile>\r
     <ClCompile Include="..\Externals\crystaledit\editlib\lua.cpp">\r
       <Filter>EditLib\parsers</Filter>\r
     </ClCompile>\r
+    <ClCompile Include="MergeEditFrm.cpp">\r
+      <Filter>MFCGui\Source Files</Filter>\r
+    </ClCompile>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <ClInclude Include="charsets.h">\r
     <ClInclude Include="FileOrFolderSelect.h">\r
       <Filter>MFCGui\Header Files</Filter>\r
     </ClInclude>\r
-    <ClInclude Include="ChildFrm.h">\r
-      <Filter>MFCGui\Header Files</Filter>\r
-    </ClInclude>\r
     <ClInclude Include="DiffViewBar.h">\r
       <Filter>MFCGui\Header Files</Filter>\r
     </ClInclude>\r
     <ClInclude Include="..\Externals\crystaledit\editlib\crystallineparser.h">\r
       <Filter>EditLib\parsers</Filter>\r
     </ClInclude>\r
+    <ClInclude Include="MergeEditFrm.h">\r
+      <Filter>MFCGui\Header Files</Filter>\r
+    </ClInclude>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <None Include="res\binarydiff.ico">\r
index 6a41622..2ff1679 100644 (file)
     <ClCompile Include="charsets.c">\r
       <PrecompiledHeader>NotUsing</PrecompiledHeader>\r
     </ClCompile>\r
-    <ClCompile Include="ChildFrm.cpp" />\r
+    <ClCompile Include="MergeEditFrm.cpp" />\r
     <ClCompile Include="Common\ClipBoard.cpp">\r
       <PrecompiledHeader>Use</PrecompiledHeader>\r
       <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>\r
     <ClInclude Include="Common\BCMenu.h" />\r
     <ClInclude Include="Common\Bitmap.h" />\r
     <ClInclude Include="charsets.h" />\r
-    <ClInclude Include="ChildFrm.h" />\r
+    <ClInclude Include="MergeEditFrm.h" />\r
     <ClInclude Include="Common\ClipBoard.h" />\r
     <ClInclude Include="Common\CMoveConstraint.h" />\r
     <ClInclude Include="codepage_detect.h" />\r
index 7a81b6d..04109cc 100644 (file)
     <ClCompile Include="7zCommon.cpp">\r
       <Filter>MFCGui\Source Files</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="ChildFrm.cpp">\r
-      <Filter>MFCGui\Source Files</Filter>\r
-    </ClCompile>\r
     <ClCompile Include="Common\CMoveConstraint.cpp">\r
       <Filter>MFCGui\Source Files</Filter>\r
     </ClCompile>\r
     <ClCompile Include="..\Externals\crystaledit\editlib\lua.cpp">\r
       <Filter>EditLib\parsers</Filter>\r
     </ClCompile>\r
+    <ClCompile Include="MergeEditFrm.cpp">\r
+      <Filter>MFCGui\Source Files</Filter>\r
+    </ClCompile>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <ClInclude Include="charsets.h">\r
     <ClInclude Include="FileOrFolderSelect.h">\r
       <Filter>MFCGui\Header Files</Filter>\r
     </ClInclude>\r
-    <ClInclude Include="ChildFrm.h">\r
-      <Filter>MFCGui\Header Files</Filter>\r
-    </ClInclude>\r
     <ClInclude Include="DiffViewBar.h">\r
       <Filter>MFCGui\Header Files</Filter>\r
     </ClInclude>\r
     <ClInclude Include="..\Externals\crystaledit\editlib\crystallineparser.h">\r
       <Filter>EditLib\parsers</Filter>\r
     </ClInclude>\r
+    <ClInclude Include="MergeEditFrm.h">\r
+      <Filter>MFCGui\Header Files</Filter>\r
+    </ClInclude>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <None Include="res\binarydiff.ico">\r
index 9259792..5ec5269 100644 (file)
@@ -36,7 +36,7 @@
 #include "Environment.h"
 #include "MovedLines.h"
 #include "MergeEditView.h"
-#include "ChildFrm.h"
+#include "MergeEditFrm.h"
 #include "DirDoc.h"
 #include "files.h"
 #include "FileTransform.h"
@@ -2412,9 +2412,9 @@ void CMergeDoc::SetDirDoc(CDirDoc * pDirDoc)
 /**
  * @brief Return pointer to parent frame
  */
-CChildFrame * CMergeDoc::GetParentFrame() 
+CMergeEditFrame * CMergeDoc::GetParentFrame() 
 {
-       return dynamic_cast<CChildFrame *>(m_pView[0][0]->GetParentFrame()); 
+       return dynamic_cast<CMergeEditFrame *>(m_pView[0][0]->GetParentFrame()); 
 }
 
 /**
@@ -2633,7 +2633,7 @@ bool CMergeDoc::OpenDocs(int nFiles, const FileLocation ifileloc[],
        // Bail out if either side failed
        if (std::find_if(nSuccess, nSuccess + m_nBuffers, [](DWORD d){return !FileLoadResult::IsOk(d);} ) != nSuccess + m_nBuffers)
        {
-               CChildFrame *pFrame = GetParentFrame();
+               CMergeEditFrame *pFrame = GetParentFrame();
                if (pFrame != nullptr)
                {
                        // Use verify macro to trap possible error in debug.
@@ -2898,7 +2898,7 @@ void CMergeDoc::RefreshOptions()
  */
 void CMergeDoc::UpdateHeaderPath(int pane)
 {
-       CChildFrame *pf = GetParentFrame();
+       CMergeEditFrame *pf = GetParentFrame();
        ASSERT(pf != nullptr);
        String sText;
        bool bChanges = false;
@@ -2931,7 +2931,7 @@ void CMergeDoc::UpdateHeaderPath(int pane)
  */
 void CMergeDoc::UpdateHeaderActivity(int pane, bool bActivate)
 {
-       CChildFrame *pf = GetParentFrame();
+       CMergeEditFrame *pf = GetParentFrame();
        ASSERT(pf != nullptr);
        pf->GetHeaderInterface()->SetActive(pane, bActivate);
 }
index 0dc69ed..a5046f4 100644 (file)
@@ -130,7 +130,7 @@ struct DiffFileInfo;
 class CMergeEditView;
 class PackingInfo;
 class PrediffingInfo;
-class CChildFrame;
+class CMergeEditFrame;
 class CDirDoc;
 class CEncodingErrorBar;
 class CLocationView;
@@ -254,7 +254,7 @@ public:
                for (int nBuffer = 0; nBuffer < m_nBuffers; ++nBuffer)
                        func(m_pView[nGroup][nBuffer]);
        }
-       CChildFrame * GetParentFrame();
+       CMergeEditFrame * GetParentFrame();
 
        void AddSyncPoint();
        bool DeleteSyncPoint(int pane, int nLine, bool bRescan = true);
index 0cee83b..cfb73b7 100644 (file)
@@ -39,7 +39,7 @@
 #include "WMGotoDlg.h"
 #include "OptionsDef.h"
 #include "SyntaxColors.h"
-#include "ChildFrm.h"
+#include "MergeEditFrm.h"
 #include "MergeLineFlags.h"
 #include "paths.h"
 #include "DropHandler.h"
@@ -4034,7 +4034,7 @@ void CMergeEditView::OnDropFiles(const std::vector<String>& tFiles)
 void CMergeEditView::OnWindowSplit()
 {
 
-       auto& wndSplitter = dynamic_cast<CChildFrame *>(GetParentFrame())->GetSplitter();
+       auto& wndSplitter = dynamic_cast<CMergeEditFrame *>(GetParentFrame())->GetSplitter();
        CMergeDoc *pDoc = GetDocument();
        CMergeEditView *pView = pDoc->GetView(0, m_nThisPane);
        auto* pwndSplitterChild = pView->GetParentSplitter(pView, false);
index f171e62..5dab894 100644 (file)
@@ -1,4 +1,4 @@
-// ChildFrm.cpp : implementation of the COpenFrame class
+// OpenFrm.cpp : implementation of the COpenFrame class
 //
 #include "stdafx.h"
 #include "OpenFrm.h"
index 75cc07d..42bad73 100644 (file)
@@ -96,7 +96,7 @@ TEST(SyntaxHighlight, Verilog)
        if (pDoc == nullptr)\r
                return;\r
 \r
-       std::vector<CCrystalTextView::TEXTBLOCK> blocks;\r
+       std::vector<CrystalLineParser::TEXTBLOCK> blocks;\r
        blocks = pDoc->GetView(0, 0)->GetTextBlocks(0);\r
        EXPECT_EQ(COLORINDEX_COMMENT, blocks[0].m_nColorIndex);\r
        blocks = pDoc->GetView(0, 0)->GetTextBlocks(2);\r