[commit] r2467 - trunk/GME/Gme
GMESRC Repository Notifications
gme-commit at list.isis.vanderbilt.edu
Wed Apr 16 13:12:58 CDT 2014
Author: ksmyth
Date: Wed Apr 16 13:12:58 2014
New Revision: 2467
Log:
When closing current model editor tab, activate the next tab (instead of the last tab)
Modified:
trunk/GME/Gme/ChildFrm.cpp
trunk/GME/Gme/MainFrm.cpp
trunk/GME/Gme/MainFrm.h
Modified: trunk/GME/Gme/ChildFrm.cpp
==============================================================================
--- trunk/GME/Gme/ChildFrm.cpp Wed Apr 16 13:12:48 2014 (r2466)
+++ trunk/GME/Gme/ChildFrm.cpp Wed Apr 16 13:12:58 2014 (r2467)
@@ -145,12 +145,24 @@
if(doClose)
{
- // Avoid losing TreeBrowser focus when deleting this (inactive) model from the TreeBrowser
- CMainFrame::theInstance->EnableActivateLastActive(FALSE);
+ CGMEMFCTabCtrl& tabs = *(CGMEMFCTabCtrl*)m_pRelatedTabGroup;
+
+ tabs.EnableActivateLastActive(TRUE);
+ tabs.EnableActivateLastVisible(TRUE);
+ tabs._SetLastActiveTab();
+ if (tabs.GetTabsNum() > 2)
+ {
+ int active = tabs.GetActiveTab();
+ int visible;
+ CWnd* activeWnd = tabs.GetFirstVisibleTab(active, visible);
+ bool thisWindowActive = activeWnd != NULL && activeWnd->GetSafeHwnd() == GetSafeHwnd();
+ if (thisWindowActive && active != tabs.GetTabsNum())
+ {
+ tabs.EnableActivateLastActive(FALSE);
+ }
+ }
// CFramewWnd::OnClose calls CMDIChildWnd::DestroyWindow
CMDIChildWndEx::OnClose();
- // End avoid (and prevent flicker on opening new ChildFrms)
- CMainFrame::theInstance->EnableActivateLastActive(TRUE);
}
Modified: trunk/GME/Gme/MainFrm.cpp
==============================================================================
--- trunk/GME/Gme/MainFrm.cpp Wed Apr 16 13:12:48 2014 (r2466)
+++ trunk/GME/Gme/MainFrm.cpp Wed Apr 16 13:12:58 2014 (r2467)
@@ -152,14 +152,21 @@
ID_INDICATOR_SCRL,
};
-/////////////////////////////////////////////////////////////////////////////
-// CMainFrame construction/destruction
+class CGMEMDIClientAreaWnd : public CMDIClientAreaWnd
+{
+ virtual CMFCTabCtrl* CreateTabGroup(CMFCTabCtrl* pWndTab)
+ {
+ pWndTab = new CGMEMFCTabCtrl;
+ return __super::CreateTabGroup(pWndTab);
+ }
+};
CMainFrame::CMainFrame()
{
theInstance = this;
m_autosaveTimerID = NULL;
theApp.m_nAppLook = theApp.GetInt(_T("ApplicationLook"), ID_VIEW_APPLOOK_VS_2005);
+ new ((void*)&m_wndClientArea) CGMEMDIClientAreaWnd();
}
CMainFrame::~CMainFrame()
Modified: trunk/GME/Gme/MainFrm.h
==============================================================================
--- trunk/GME/Gme/MainFrm.h Wed Apr 16 13:12:48 2014 (r2466)
+++ trunk/GME/Gme/MainFrm.h Wed Apr 16 13:12:58 2014 (r2467)
@@ -17,6 +17,31 @@
#include "GMEPanningWindow.h"
#include "GMEOLEApp.h"
+struct CGMEMFCTabCtrl : public CMFCTabCtrl
+{
+ virtual CWnd* GetLastVisibleTab(int& iTabNum)
+ {
+ if (m_bActivateLastActiveTab)
+ {
+ iTabNum = m_iActiveTab;
+ return GetTabWnd(m_iActiveTab);
+ }
+ // this is a hack to fix the tab behavior when you close the current tab
+ EnableActivateLastVisible(TRUE);
+ iTabNum = m_iActiveTab;
+ return GetTabWnd(m_iActiveTab);
+ }
+
+ void _SetLastActiveTab()
+ {
+ m_iLastActiveTab = m_iActiveTab;
+ }
+
+ void EnableActivateLastVisible(BOOL enable)
+ {
+ m_bActivateLastVisibleTab = enable;
+ }
+};
// Tooltip helper for components
class CComponentBar : public CMFCToolBar {
More information about the gme-commit
mailing list