mirror of
https://github.com/jmarshall23/DoomRTX.git
synced 2026-08-17 11:00:38 +02:00
Added material editor to main tabs.
This commit is contained in:
@@ -48,6 +48,18 @@ If you have questions concerning this license or the applicable additional terms
|
||||
#define ID_XYDOCK_GAMEPAGE 0x7A04
|
||||
#define ID_XYDOCK_MODELVIEWPAGE 0x7A05
|
||||
#define ID_XYDOCK_SCRIPTEDITORPAGE 0x7A06
|
||||
#define ID_XYDOCK_MATERIALEDITORPAGE 0x7A07
|
||||
|
||||
static const int XYDOCK_TAB_MATERIALEDITOR = 4;
|
||||
|
||||
HWND MaterialEditorCreateEmbeddedWindow(CWnd *parent, const RECT& rect);
|
||||
void MaterialEditorMoveEmbeddedWindow(const RECT& rect);
|
||||
void MaterialEditorShowEmbeddedWindow(BOOL show);
|
||||
void MaterialEditorFocusEmbeddedWindow(void);
|
||||
BOOL MaterialEditorPreTranslateEmbeddedMessage(MSG *pMsg);
|
||||
BOOL MaterialEditorEmbeddedOnCommand(WPARAM wParam, LPARAM lParam);
|
||||
BOOL MaterialEditorEmbeddedOnNotify(WPARAM wParam, LPARAM lParam, LRESULT *pResult);
|
||||
BOOL MaterialEditorEmbeddedOnCmdMsg(UINT nID, int nCode, void *pExtra, AFX_CMDHANDLERINFO *pHandlerInfo);
|
||||
|
||||
#define ID_GAME_HOST 0x7A30
|
||||
#define ID_GAME_FILL_FIT 0x7A40
|
||||
@@ -1538,6 +1550,8 @@ void CGameDockWnd::OnFill50() {
|
||||
FocusGameWindow();
|
||||
}
|
||||
|
||||
static CXYDockWnd *g_materialEditorDockWnd = NULL;
|
||||
|
||||
//=============================================================================
|
||||
// CXYDockWnd
|
||||
//=============================================================================
|
||||
@@ -1555,9 +1569,14 @@ CXYDockWnd::CXYDockWnd() {
|
||||
m_pToolBar = NULL;
|
||||
m_bInLayout = false;
|
||||
m_nActiveTab = XYDOCK_TAB_XY;
|
||||
g_materialEditorDockWnd = this;
|
||||
}
|
||||
|
||||
CXYDockWnd::~CXYDockWnd() {
|
||||
if (g_materialEditorDockWnd == this) {
|
||||
MaterialEditorShowEmbeddedWindow(FALSE);
|
||||
g_materialEditorDockWnd = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
BOOL CXYDockWnd::Create(CWnd *pParent, UINT nID) {
|
||||
@@ -1613,6 +1632,9 @@ int CXYDockWnd::OnCreate(LPCREATESTRUCT lpCreateStruct) {
|
||||
item.pszText = "Script Editor";
|
||||
m_wndTabs.InsertItem(XYDOCK_TAB_SCRIPTEDITOR, &item);
|
||||
|
||||
item.pszText = "Material Editor";
|
||||
m_wndTabs.InsertItem(XYDOCK_TAB_MATERIALEDITOR, &item);
|
||||
|
||||
CString pageClass = AfxRegisterWndClass(
|
||||
CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS,
|
||||
::LoadCursor(NULL, IDC_ARROW),
|
||||
@@ -1647,6 +1669,10 @@ int CXYDockWnd::OnCreate(LPCREATESTRUCT lpCreateStruct) {
|
||||
}
|
||||
m_wndScriptPage.ShowWindow(SW_HIDE);
|
||||
|
||||
CRect materialEditorInitialRect(0, 0, 0, 0);
|
||||
MaterialEditorCreateEmbeddedWindow(&m_wndTabs, materialEditorInitialRect);
|
||||
MaterialEditorShowEmbeddedWindow(FALSE);
|
||||
|
||||
if (!m_wndMenuBar.Create(&m_wndXYPage, 0x7A01)) {
|
||||
return -1;
|
||||
}
|
||||
@@ -1787,6 +1813,7 @@ void CXYDockWnd::ShowActiveTab() {
|
||||
const BOOL gameActive = (m_nActiveTab == XYDOCK_TAB_GAME);
|
||||
const BOOL modelActive = (m_nActiveTab == XYDOCK_TAB_MODELVIEW);
|
||||
const BOOL scriptActive = (m_nActiveTab == XYDOCK_TAB_SCRIPTEDITOR);
|
||||
const BOOL materialActive = (m_nActiveTab == XYDOCK_TAB_MATERIALEDITOR);
|
||||
|
||||
if (m_wndXYPage.GetSafeHwnd()) {
|
||||
m_wndXYPage.ShowWindow(xyActive ? SW_SHOW : SW_HIDE);
|
||||
@@ -1822,10 +1849,12 @@ void CXYDockWnd::ShowActiveTab() {
|
||||
}
|
||||
m_wndScriptPage.SetActive(scriptActive);
|
||||
}
|
||||
|
||||
MaterialEditorShowEmbeddedWindow(materialActive);
|
||||
}
|
||||
|
||||
void CXYDockWnd::SetActiveTab(int nTab) {
|
||||
if (nTab != XYDOCK_TAB_XY && nTab != XYDOCK_TAB_GAME && nTab != XYDOCK_TAB_MODELVIEW && nTab != XYDOCK_TAB_SCRIPTEDITOR) {
|
||||
if (nTab != XYDOCK_TAB_XY && nTab != XYDOCK_TAB_GAME && nTab != XYDOCK_TAB_MODELVIEW && nTab != XYDOCK_TAB_SCRIPTEDITOR && nTab != XYDOCK_TAB_MATERIALEDITOR) {
|
||||
nTab = XYDOCK_TAB_XY;
|
||||
}
|
||||
|
||||
@@ -1900,6 +1929,27 @@ void CXYDockWnd::SetActiveTab(int nTab) {
|
||||
common->ActivateTool(true);
|
||||
FocusScriptEditor();
|
||||
}
|
||||
else if (m_nActiveTab == XYDOCK_TAB_MATERIALEDITOR) {
|
||||
//
|
||||
// Material Editor tab selected:
|
||||
// - game HWND is deactivated
|
||||
// - editor/tool input stays active
|
||||
// - focus moves to the embedded material editor frame
|
||||
//
|
||||
if (m_wndGamePage.GetSafeHwnd()) {
|
||||
m_wndGamePage.SetActive(FALSE);
|
||||
}
|
||||
if (m_wndModelPage.GetSafeHwnd()) {
|
||||
m_wndModelPage.SetActive(FALSE);
|
||||
}
|
||||
if (m_wndScriptPage.GetSafeHwnd()) {
|
||||
m_wndScriptPage.SetActive(FALSE);
|
||||
}
|
||||
|
||||
common->ActivateTool(true);
|
||||
MaterialEditorShowEmbeddedWindow(TRUE);
|
||||
MaterialEditorFocusEmbeddedWindow();
|
||||
}
|
||||
else {
|
||||
//
|
||||
// XY tab selected:
|
||||
@@ -1916,6 +1966,7 @@ void CXYDockWnd::SetActiveTab(int nTab) {
|
||||
if (m_wndScriptPage.GetSafeHwnd()) {
|
||||
m_wndScriptPage.SetActive(FALSE);
|
||||
}
|
||||
MaterialEditorShowEmbeddedWindow(FALSE);
|
||||
|
||||
common->ActivateTool(true);
|
||||
FocusXYWindow();
|
||||
@@ -2002,6 +2053,14 @@ void CXYDockWnd::FocusXYWindow() {
|
||||
m_wndMDIContainer.FocusXYWindow();
|
||||
}
|
||||
|
||||
bool MaterialEditorOpenDockTab() {
|
||||
if (g_materialEditorDockWnd && g_materialEditorDockWnd->GetSafeHwnd()) {
|
||||
g_materialEditorDockWnd->SetActiveTab(XYDOCK_TAB_MATERIALEDITOR);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void CXYDockWnd::LayoutChildren() {
|
||||
if (!GetSafeHwnd() || m_bInLayout) {
|
||||
return;
|
||||
@@ -2050,6 +2109,8 @@ void CXYDockWnd::LayoutChildren() {
|
||||
m_wndScriptPage.LayoutChildren();
|
||||
}
|
||||
|
||||
MaterialEditorMoveEmbeddedWindow(pageRect);
|
||||
|
||||
ShowActiveTab();
|
||||
|
||||
if (m_pToolBar && m_pToolBar->GetSafeHwnd() && m_wndXYPage.GetSafeHwnd()) {
|
||||
@@ -2119,6 +2180,11 @@ BOOL CXYDockWnd::PreTranslateMessage(MSG *pMsg) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
if (m_nActiveTab == XYDOCK_TAB_MATERIALEDITOR) {
|
||||
if (MaterialEditorPreTranslateEmbeddedMessage(pMsg)) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return CWnd::PreTranslateMessage(pMsg);
|
||||
}
|
||||
|
||||
@@ -2144,6 +2210,9 @@ BOOL CXYDockWnd::OnCommand(WPARAM wParam, LPARAM lParam) {
|
||||
m_wndScriptPage.SendMessage(WM_COMMAND, wParam, lParam);
|
||||
return TRUE;
|
||||
}
|
||||
if (m_nActiveTab == XYDOCK_TAB_MATERIALEDITOR) {
|
||||
return MaterialEditorEmbeddedOnCommand(wParam, lParam);
|
||||
}
|
||||
|
||||
if (m_nActiveTab != XYDOCK_TAB_XY) {
|
||||
return CWnd::OnCommand(wParam, lParam);
|
||||
@@ -2160,6 +2229,11 @@ BOOL CXYDockWnd::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT *pResult) {
|
||||
if (wParam == ID_XYDOCK_TABS) {
|
||||
return CWnd::OnNotify(wParam, lParam, pResult);
|
||||
}
|
||||
if (m_nActiveTab == XYDOCK_TAB_MATERIALEDITOR) {
|
||||
if (MaterialEditorEmbeddedOnNotify(wParam, lParam, pResult)) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
CWnd *commandTarget = GetCommandTarget();
|
||||
if (commandTarget && commandTarget->GetSafeHwnd() && commandTarget != this) {
|
||||
@@ -2183,6 +2257,9 @@ BOOL CXYDockWnd::OnCmdMsg(UINT nID, int nCode, void *pExtra, AFX_CMDHANDLERINFO
|
||||
if (m_nActiveTab == XYDOCK_TAB_SCRIPTEDITOR && m_wndScriptPage.GetSafeHwnd()) {
|
||||
return m_wndScriptPage.OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
|
||||
}
|
||||
if (m_nActiveTab == XYDOCK_TAB_MATERIALEDITOR) {
|
||||
return MaterialEditorEmbeddedOnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
|
||||
}
|
||||
|
||||
if (m_nActiveTab != XYDOCK_TAB_XY) {
|
||||
return FALSE;
|
||||
|
||||
@@ -300,11 +300,11 @@ protected:
|
||||
CToolBar *m_pToolBar;
|
||||
bool m_bInLayout;
|
||||
int m_nActiveTab;
|
||||
|
||||
public:
|
||||
void SetActiveTab(int nTab);
|
||||
void ShowActiveTab();
|
||||
CWnd *GetXYPageParent() const;
|
||||
|
||||
protected:
|
||||
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
|
||||
afx_msg void OnSize(UINT nType, int cx, int cy);
|
||||
afx_msg BOOL OnEraseBkgnd(CDC *pDC);
|
||||
|
||||
Reference in New Issue
Block a user