Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
sdottaka committed Aug 22, 2024
1 parent e85e626 commit 7e2f5ff
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 6 deletions.
12 changes: 12 additions & 0 deletions Src/Common/MDITabBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ BEGIN_MESSAGE_MAP(CMDITabBar, CControlBar)
ON_WM_MOUSELEAVE()
ON_WM_LBUTTONDOWN()
ON_WM_LBUTTONUP()
ON_MESSAGE(WM_SIZEPARENT, OnSizeParent)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

Expand Down Expand Up @@ -488,6 +489,17 @@ void CMDITabBar::OnLButtonUp(UINT nFlags, CPoint point)
CWnd::OnLButtonUp(nFlags, point);
}

LRESULT CMDITabBar::OnSizeParent(WPARAM wParam, LPARAM lParam)
{
AFX_SIZEPARENTPARAMS* lpLayout = (AFX_SIZEPARENTPARAMS*)lParam;
// lpLayout->rect.left += 24;
// lpLayout->rect.right -= 24 * 3;
LRESULT result = __super::OnSizeParent(wParam, reinterpret_cast<LPARAM>(lpLayout));
// lpLayout->rect.left -= 24;
// lpLayout->rect.right += 24 * 3;
return result;
}

CRect CMDITabBar::GetCloseButtonRect(int nItem)
{
CClientDC dc(this);
Expand Down
1 change: 1 addition & 0 deletions Src/Common/MDITabBar.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class CMDITabBar : public CControlBar
afx_msg void OnMouseLeave();
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
afx_msg LRESULT OnSizeParent(WPARAM wParam, LPARAM lParam);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()

Expand Down
48 changes: 42 additions & 6 deletions Src/MainFrm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
#include "ClipboardHistory.h"
#include "locality.h"
#include "DirWatcher.h"
#include <afxwinverapi.h>

using std::vector;
using boost::begin;
Expand Down Expand Up @@ -220,6 +221,9 @@ BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
ON_MESSAGE(WM_COPYDATA, OnCopyData)
ON_MESSAGE(WM_USER+1, OnUser1)
ON_WM_ACTIVATEAPP()
ON_WM_ACTIVATE()
ON_WM_NCCALCSIZE()
ON_WM_NCHITTEST()
ON_UPDATE_COMMAND_UI_RANGE(CMenuBar::FIRST_MENUID, CMenuBar::FIRST_MENUID + 10, OnUpdateMenuBarMenuItem)
// [File] menu
ON_COMMAND(ID_FILE_NEW, (OnFileNew<2, ID_MERGE_COMPARE_TEXT>))
Expand Down Expand Up @@ -404,12 +408,6 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)

m_wndMDIClient.SubclassWindow(m_hWndMDIClient);

if (!CreateToolbar())
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}

if (!m_wndTabBar.Create(this))
{
TRACE0("Failed to create tab bar\n");
Expand All @@ -420,6 +418,12 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
if (!GetOptionsMgr()->GetBool(OPT_SHOW_TABBAR))
__super::ShowControlBar(&m_wndTabBar, false, 0);

if (!CreateToolbar())
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}

if (!m_wndStatusBar.Create(this))
{
TRACE0("Failed to create status bar\n");
Expand Down Expand Up @@ -2481,6 +2485,38 @@ void CMainFrame::OnActivateApp(BOOL bActive, DWORD dwThreadID)
}
}

void CMainFrame::OnActivate(UINT nState, CWnd *pWndOther, BOOL bMinimized)
{
MARGINS margins;

margins.cxLeftWidth = 0;
margins.cxRightWidth = 0;
margins.cyBottomHeight = 0;
margins.cyTopHeight = 0;

//HRESULT hr = _AfxDwmExtendFrameIntoClientArea(m_hWnd, &margins);

__super::OnActivate(nState, pWndOther, bMinimized);
}

void CMainFrame::OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS FAR* lpncsp)
{
RECT rcWindow = lpncsp->rgrc[0];
__super::OnNcCalcSize(bCalcValidRects, lpncsp);
lpncsp->rgrc[0].top = rcWindow.top + 0;
}

LRESULT CMainFrame::OnNcHitTest(CPoint point)
{
LRESULT res = 0;
//_AfxDwmDefWindowProc(GetSafeHwnd(), WM_NCHITTEST, 0, MAKELPARAM(point.x, point.y), &res);
//return (UINT)res;
return HTMAXBUTTON;
return HTMINBUTTON;
return HTCAPTION;
return __super::OnNcHitTest(point);
}

BOOL CMainFrame::CreateToolbar()
{
if (!m_wndMenuBar.Create(this))
Expand Down
3 changes: 3 additions & 0 deletions Src/MainFrm.h
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,9 @@ class CMainFrame : public CMDIFrameWnd
afx_msg void OnUpdateWindowCloseAll(CCmdUI* pCmdUI);
afx_msg void OnSaveProject();
afx_msg void OnActivateApp(BOOL bActive, DWORD dwThreadID);
afx_msg void OnActivate(UINT nState, CWnd *pWndOther, BOOL bMinimized);
afx_msg LRESULT OnNcHitTest(CPoint point);
afx_msg void OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS FAR* lpncsp);
afx_msg void OnToolbarSize(UINT id);
afx_msg void OnUpdateToolbarSize(CCmdUI* pCmdUI);
afx_msg BOOL OnToolTipText(UINT, NMHDR* pNMHDR, LRESULT* pResult);
Expand Down
5 changes: 5 additions & 0 deletions Src/MenuBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ BOOL CMenuBar::Create(CWnd* pParentWnd, DWORD dwStyle, UINT nID)

bool CMenuBar::AttachMenu(CMenu* pMenu)
{
if (!m_hWnd)
return false;

CToolBarCtrl& toolbar = GetToolBarCtrl();

toolbar.SetRedraw(false);
Expand Down Expand Up @@ -334,6 +337,8 @@ LRESULT CMenuBar::OnShowPopupMenu(WPARAM wParam, LPARAM lParam)

BOOL CMenuBar::PreTranslateMessage(MSG* pMsg)
{
if (!m_hWnd)
return FALSE;
if (pMsg->message == WM_SYSKEYDOWN || pMsg->message == WM_SYSKEYUP)
{
if (pMsg->wParam == VK_F10 || pMsg->wParam == VK_MENU)
Expand Down

0 comments on commit 7e2f5ff

Please sign in to comment.