Skip to content
Permalink
Browse files

Merge pull request #247 from mesajflaviu/new_branch

New branch
  • Loading branch information
sdottaka committed Jan 3, 2020
2 parents a109622 + 36beb95 commit 6e28b6e8df91a28ed0b3453dcfa65be09109f09f
@@ -88,13 +88,11 @@ CDirFrame::~CDirFrame()
{
}


BEGIN_MESSAGE_MAP(CDirFrame, CMergeFrameCommon)
//{{AFX_MSG_MAP(CDirFrame)
ON_WM_CREATE()
ON_WM_CLOSE()
ON_WM_SIZE()
ON_WM_MDIACTIVATE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

@@ -212,4 +210,3 @@ void CDirFrame::OnSize(UINT nType, int cx, int cy)

m_wndFilePathBar.Resize();
}

@@ -683,7 +683,7 @@ static void NTAPI CheckContextMenu(BCMenu *pPopup, UINT uIDItem, BOOL bCheck)
*/
void CDirView::ListContextMenu(CPoint point, int /*i*/)
{
CDirDoc *pDoc = GetDocument();
CDirDoc* pDoc = GetDocument();
BCMenu menu;
VERIFY(menu.LoadMenu(IDR_POPUP_DIRVIEW));
VERIFY(menu.LoadToolbar(IDR_MAINFRAME));
@@ -3694,7 +3694,6 @@ void CDirView::OnUpdateEditUndo(CCmdUI* pCmdUI)
CEdit *pEdit = m_pList->GetEditControl();
pCmdUI->Enable(pEdit && pEdit->CanUndo());
}

/**
* @brief Returns CShellContextMenu object that owns given HMENU.
*
@@ -199,7 +199,7 @@ class CDirView : public CListView
CSortHeaderCtrl m_ctlSortHeader;
CImageList m_imageList;
CImageList m_imageState;
CListCtrl *m_pList;
CListCtrl* m_pList;
std::unique_ptr<IListCtrl> m_pIList;
bool m_bEscCloses; /**< Cached value for option for ESC closing window */
bool m_bExpandSubdirs;
@@ -215,7 +215,7 @@ bool CImgMergeFrame::OpenDocs(int nFiles, const FileLocation fileloc[], const bo
LPCTSTR lpszWndClass = AfxRegisterWndClass(CS_HREDRAW | CS_VREDRAW,
::LoadCursor(nullptr, IDC_ARROW), (HBRUSH)(COLOR_WINDOW+1), nullptr);

if (!CMDIChildWnd::Create(lpszWndClass, GetTitle(), WS_OVERLAPPEDWINDOW | WS_CHILD, rectDefault, pParent))
if (!CMergeFrameCommon::Create(lpszWndClass, GetTitle(), WS_OVERLAPPEDWINDOW | WS_CHILD, rectDefault, pParent))
return false;

int nCmdShow = SW_SHOW;
@@ -475,7 +475,7 @@ BOOL CImgMergeFrame::OnCreateClient( LPCREATESTRUCT /*lpcs*/,
int CImgMergeFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{

if (CMDIChildWnd::OnCreate(lpCreateStruct) == -1)
if (CMergeFrameCommon::OnCreate(lpCreateStruct) == -1)
return -1;

EnableDocking(CBRS_ALIGN_TOP | CBRS_ALIGN_BOTTOM | CBRS_ALIGN_LEFT | CBRS_ALIGN_RIGHT);
@@ -553,7 +553,7 @@ BOOL CImgMergeFrame::DestroyWindow()
SaveActivePane();
SaveOptions();
SaveWindowState();
return CMDIChildWnd::DestroyWindow();
return CMergeFrameCommon::DestroyWindow();
}

void CImgMergeFrame::LoadOptions()
@@ -624,7 +624,9 @@ void CImgMergeFrame::OnMDIActivate(BOOL bActivate, CWnd* pActivateWnd, CWnd* pDe
// for the dimensions of the diff and location pane, use the CSizingControlBar loader
m_wndLocationBar.LoadState(_T("Settings-ImgMergeFrame"));
}
CMDIChildWnd::OnMDIActivate(bActivate, pActivateWnd, pDeactivateWnd);

CMergeFrameCommon::OnMDIActivate(bActivate, pActivateWnd, pDeactivateWnd);

if (bActivate)
{
GetMainFrame()->PostMessage(WM_USER + 1);
@@ -638,7 +640,7 @@ void CImgMergeFrame::OnClose()
return;

// clean up pointers.
CMDIChildWnd::OnClose();
CMergeFrameCommon::OnClose();

GetMainFrame()->ClearStatusbarItemCount();
}
@@ -1013,7 +1015,7 @@ void CImgMergeFrame::SetTitle(LPCTSTR lpszTitle)
else
sTitle = strutils::join(&sFileName[0], &sFileName[0] + nBuffers, _T(" - "));
}
CMDIChildWnd::SetTitle(sTitle.c_str());
CMergeFrameCommon::SetTitle(sTitle.c_str());
if (m_hWnd != nullptr)
SetWindowText(sTitle.c_str());
}
@@ -1255,12 +1257,12 @@ BOOL CImgMergeFrame::PreTranslateMessage(MSG* pMsg)
return true;
}
}
return CMDIChildWnd::PreTranslateMessage(pMsg);
return CMergeFrameCommon::PreTranslateMessage(pMsg);
}

void CImgMergeFrame::OnSize(UINT nType, int cx, int cy)
{
CMDIChildWnd::OnSize(nType, cx, cy);
CMergeFrameCommon::OnSize(nType, cx, cy);
UpdateHeaderSizes();
}

@@ -1326,7 +1328,7 @@ void CImgMergeFrame::OnIdleUpdateCmdUI()
m_wndStatusBar[pane].SetPaneText(0, text.c_str());
}
}
CMDIChildWnd::OnIdleUpdateCmdUI();
CMergeFrameCommon::OnIdleUpdateCmdUI();
}

/**
@@ -74,6 +74,8 @@
#include "Bitmap.h"
#include "CCrystalTextMarkers.h"

#include "WindowsManagerDialog.h"

using std::vector;
using boost::begin;
using boost::end;
@@ -232,7 +234,12 @@ BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
ON_COMMAND_RANGE(ID_MRU_FIRST, ID_MRU_LAST, OnMRUs)
ON_UPDATE_COMMAND_UI(ID_MRU_FIRST, OnUpdateNoMRUs)
ON_UPDATE_COMMAND_UI(ID_NO_MRU, OnUpdateNoMRUs)
ON_COMMAND(ID_ACCEL_QUIT, &CMainFrame::OnAccelQuit)
//}}AFX_MSG_MAP
ON_MESSAGE(WMU_CHILDFRAMEADDED, &CMainFrame::OnChildFrameAdded)
ON_MESSAGE(WMU_CHILDFRAMEREMOVED, &CMainFrame::OnChildFrameRemoved)
ON_MESSAGE(WMU_CHILDFRAMEACTIVATE, &CMainFrame::OnChildFrameActivate)
ON_MESSAGE(WMU_CHILDFRAMEACTIVATED, &CMainFrame::OnChildFrameActivated)
END_MESSAGE_MAP()

/**
@@ -282,6 +289,8 @@ CMainFrame::~CMainFrame()
{
GetOptionsMgr()->SaveOption(OPT_TABBAR_AUTO_MAXWIDTH, m_wndTabBar.GetAutoMaxWidth());
strdiff::Close();

m_arrChild.RemoveAll();
}

const TCHAR CMainFrame::szClassName[] = _T("WinMergeWindowClassW");
@@ -1681,12 +1690,21 @@ BOOL CMainFrame::PreTranslateMessage(MSG* pMsg)
AfxGetMainWnd()->SendMessage(WM_COMMAND, ID_APP_EXIT);
return TRUE;
}
else if (GetOptionsMgr()->GetBool(OPT_CLOSE_WITH_ESC) && m_wndTabBar.GetItemCount() == 0)
/* else if (GetOptionsMgr()->GetBool(OPT_CLOSE_WITH_ESC) && m_wndTabBar.GetItemCount() == 0)
{
AfxGetMainWnd()->PostMessage(WM_COMMAND, ID_APP_EXIT);
return FALSE;
}
}*/ // Don't close the app when user press escape and there is no tab opened, use Ctrl + Q instead like all editors do
}

if (WM_KEYDOWN == pMsg->message && VK_TAB == pMsg->wParam && GetAsyncKeyState(VK_CONTROL) < 0 && m_arrChild.GetSize() > 1)
{
CWindowsManagerDialog* pDlg = new CWindowsManagerDialog;
pDlg->Create(CWindowsManagerDialog::IDD, this);
pDlg->ShowWindow(SW_SHOW);
return TRUE;
}

return CMDIFrameWnd::PreTranslateMessage(pMsg);
}

@@ -2521,3 +2539,72 @@ void CMainFrame::UpdateDocTitle()
}
}
}

void CMainFrame::OnAccelQuit()
{
// TODO: Add your command handler code here

SendMessage(WM_CLOSE);
}

LRESULT CMainFrame::OnChildFrameAdded(WPARAM wParam, LPARAM lParam)
{
for (int i = 0; i < m_arrChild.GetSize(); ++i)
{
if (reinterpret_cast<CMDIChildWnd*>(lParam) == m_arrChild.GetAt(i))
{
return 0;
}
}

m_arrChild.InsertAt(0, (CMDIChildWnd*)lParam);

return 1;
}

LRESULT CMainFrame::OnChildFrameRemoved(WPARAM wParam, LPARAM lParam)
{
for (int i = 0; i < m_arrChild.GetSize(); ++i)
{
if (reinterpret_cast<CMDIChildWnd*>(lParam) == m_arrChild.GetAt(i))
{
m_arrChild.RemoveAt(i);
break;
}
}

return 1;
}

LRESULT CMainFrame::OnChildFrameActivate(WPARAM wParam, LPARAM lParam)
{
for (int i = 0; i < m_arrChild.GetSize(); ++i)
{
if (reinterpret_cast<CMDIChildWnd*>(lParam) == m_arrChild.GetAt(i))
{
CMDIChildWnd* pMDIChild = m_arrChild.GetAt(i);
if (pMDIChild->IsIconic())
pMDIChild->ShowWindow(SW_RESTORE);
MDIActivate(pMDIChild);
break;
}
}

return 1;
}
// put lParam as index 0 in m_arrChild
LRESULT CMainFrame::OnChildFrameActivated(WPARAM wParam, LPARAM lParam)
{
for (int i = 0; i < m_arrChild.GetSize(); ++i)
{
if (reinterpret_cast<CMDIChildWnd*>(lParam) == m_arrChild.GetAt(i))
{
m_arrChild.RemoveAt(i);
break;
}
}

m_arrChild.InsertAt(0, (CMDIChildWnd*)lParam);

return 1;
}
@@ -85,6 +85,7 @@ class CMainFrame : public CMDIFrameWnd
LOGFONT m_lfDiff; /**< MergeView user-selected font */
LOGFONT m_lfDir; /**< DirView user-selected font */
static const TCHAR szClassName[];

// Operations
public:
HMENU NewDirViewMenu();
@@ -120,6 +121,7 @@ class CMainFrame : public CMDIFrameWnd
void UpdateDocTitle();
void ReloadMenu();
DropHandler *GetDropHandler() const { return m_pDropHandler; }
const CTypedPtrArray<CPtrArray, CMDIChildWnd*>* GetChildArray() const { return &m_arrChild; }

// Overrides
virtual void GetMessageString(UINT nID, CString& rMessage) const;
@@ -136,20 +138,18 @@ class CMainFrame : public CMDIFrameWnd
protected:
virtual ~CMainFrame();


// Public implementation data
public:
bool m_bFirstTime; /**< If first time frame activated, get pos from reg */

// Implementation data
protected:


// control bar embedded members
CStatusBar m_wndStatusBar;
CReBar m_wndReBar;
CToolBar m_wndToolBar;
CMDITabBar m_wndTabBar;
CTypedPtrArray<CPtrArray, CMDIChildWnd*> m_arrChild;

// Tweak MDI client window behavior
class CMDIClient : public CWnd
@@ -297,7 +297,12 @@ class CMainFrame : public CMDIFrameWnd
afx_msg void OnMRUs(UINT nID);
afx_msg void OnUpdateNoMRUs(CCmdUI* pCmdUI);
afx_msg void OnDestroy();
afx_msg void OnAccelQuit();
//}}AFX_MSG
afx_msg LRESULT OnChildFrameAdded(WPARAM wParam, LPARAM lParam);
afx_msg LRESULT OnChildFrameRemoved(WPARAM wParam, LPARAM lParam);
afx_msg LRESULT OnChildFrameActivate(WPARAM wParam, LPARAM lParam);
afx_msg LRESULT OnChildFrameActivated(WPARAM wParam, LPARAM lParam);
DECLARE_MESSAGE_MAP()

private:
@@ -25,6 +25,11 @@
*/
#pragma once

#define WMU_CHILDFRAMEADDED (WM_APP + 10)
#define WMU_CHILDFRAMEREMOVED (WM_APP + 11)
#define WMU_CHILDFRAMEACTIVATE (WM_APP + 12)
#define WMU_CHILDFRAMEACTIVATED (WM_APP + 13)

#ifndef __AFXWIN_H__
#error include 'stdafx.h' before including this file for PCH
#endif

0 comments on commit 6e28b6e

Please sign in to comment.
You can’t perform that action at this time.