mirror of
https://github.com/jmarshall23/DoomRTX.git
synced 2026-08-17 11:00:38 +02:00
Added new decl editor.
This commit is contained in:
@@ -17,6 +17,7 @@ Copyright (C) 2026 Justin Marshall
|
||||
#include "InspectorDialog.h"
|
||||
#include "OutlinerDlg.h"
|
||||
#include "TabsDlg.h"
|
||||
#include "../../sys/win32/rc/DeclEditor_resource.h"
|
||||
#include <commctrl.h>
|
||||
|
||||
CInspectorDialog* g_Inspectors = NULL;
|
||||
@@ -379,7 +380,7 @@ void InspectorsDockingCallback(bool docked, int ID, CWnd* wnd) {
|
||||
CInspectorDialog::CInspectorDialog(CWnd* pParent /*=NULL*/)
|
||||
: CTabsDlg(CInspectorDialog::IDD, pParent) {
|
||||
initialized = false;
|
||||
dockedTabs = W_CONSOLE | W_TEXTURE | W_MEDIA | W_OUTLINER;
|
||||
dockedTabs = W_CONSOLE | W_TEXTURE | W_MEDIA | W_OUTLINER | W_DECLS;
|
||||
}
|
||||
|
||||
CInspectorDialog::~CInspectorDialog() {
|
||||
@@ -421,14 +422,17 @@ BOOL CInspectorDialog::OnInitDialog() {
|
||||
mediaDlg.Create(IDD_DIALOG_TEXTURELIST, this);
|
||||
entityDlg.Create(IDD_DIALOG_ENTITY, this);
|
||||
outlinerDlg.Create(this);
|
||||
declBrowserDlg.Create(this);
|
||||
|
||||
dockedTabs = GetCvarInt("radiant_InspectorDockedDialogs", W_CONSOLE | W_TEXTURE | W_MEDIA | W_OUTLINER);
|
||||
dockedTabs = GetCvarInt("radiant_InspectorDockedDialogs", W_CONSOLE | W_TEXTURE | W_MEDIA | W_OUTLINER | W_DECLS);
|
||||
dockedTabs |= W_DECLS;
|
||||
|
||||
AddDockedWindow(&consoleWnd, W_CONSOLE, 1, "Console", (dockedTabs & W_CONSOLE) != 0, InspectorsDockingCallback);
|
||||
AddDockedWindow(&texWnd, W_TEXTURE, 2, "Textures", (dockedTabs & W_TEXTURE) != 0, InspectorsDockingCallback);
|
||||
AddDockedWindow(&mediaDlg, W_MEDIA, 3, "Media", (dockedTabs & W_MEDIA) != 0, InspectorsDockingCallback);
|
||||
AddDockedWindow(&entityDlg, W_ENTITY, 4, "Entity", (dockedTabs & W_ENTITY) != 0, InspectorsDockingCallback);
|
||||
AddDockedWindow(&outlinerDlg, W_OUTLINER, 5, "Outliner", (dockedTabs & W_OUTLINER) != 0, InspectorsDockingCallback);
|
||||
AddDockedWindow(&declBrowserDlg, W_DECLS, 6, "Decls", (dockedTabs & W_DECLS) != 0, InspectorsDockingCallback);
|
||||
|
||||
ApplyModernTheme();
|
||||
|
||||
@@ -485,11 +489,13 @@ void CInspectorDialog::ApplyModernTheme() {
|
||||
ApplyModernFontRecursive(&mediaDlg);
|
||||
ApplyModernFontRecursive(&entityDlg);
|
||||
ApplyModernFontRecursive(&outlinerDlg);
|
||||
ApplyModernFontRecursive(&declBrowserDlg);
|
||||
|
||||
InspectorDark_ApplyToDialog(&consoleWnd);
|
||||
InspectorDark_ApplyToDialog(&mediaDlg);
|
||||
InspectorDark_ApplyNativeTheme(entityDlg.GetSafeHwnd());
|
||||
InspectorDark_ApplyToDialog(&outlinerDlg);
|
||||
InspectorDark_ApplyToDialog(&declBrowserDlg);
|
||||
|
||||
ModifyStyleEx(WS_EX_CLIENTEDGE, 0, SWP_FRAMECHANGED);
|
||||
|
||||
@@ -694,9 +700,30 @@ void CInspectorDialog::OnClose() {
|
||||
CTabsDlg::OnClose();
|
||||
}
|
||||
|
||||
static bool InspectorIsTextInputClass(HWND hWnd) {
|
||||
if (!hWnd) {
|
||||
return false;
|
||||
}
|
||||
char className[128];
|
||||
className[0] = '\0';
|
||||
::GetClassNameA(hWnd, className, sizeof(className));
|
||||
return ::lstrcmpiA(className, "Edit") == 0 ||
|
||||
::lstrcmpiA(className, "ComboBox") == 0 ||
|
||||
::lstrcmpiA(className, "ComboLBox") == 0 ||
|
||||
::lstrcmpiA(className, "SysTreeView32") == 0 ||
|
||||
::lstrcmpiA(className, "SysListView32") == 0;
|
||||
}
|
||||
|
||||
BOOL CInspectorDialog::PreTranslateMessage(MSG* pMsg) {
|
||||
if (pMsg->message == WM_KEYDOWN || pMsg->message == WM_KEYUP) {
|
||||
g_pParentWnd->PostMessage(pMsg->message, pMsg->wParam, pMsg->lParam);
|
||||
HWND focus = ::GetFocus();
|
||||
const bool inDecls = declBrowserDlg.GetSafeHwnd() &&
|
||||
(focus == declBrowserDlg.GetSafeHwnd() || ::IsChild(declBrowserDlg.GetSafeHwnd(), focus));
|
||||
const bool editingText = InspectorIsTextInputClass(focus);
|
||||
|
||||
if (!inDecls && !editingText && g_pParentWnd) {
|
||||
g_pParentWnd->PostMessage(pMsg->message, pMsg->wParam, pMsg->lParam);
|
||||
}
|
||||
}
|
||||
|
||||
return CTabsDlg::PreTranslateMessage(pMsg);
|
||||
|
||||
@@ -32,6 +32,11 @@ If you have questions concerning this license or the applicable additional terms
|
||||
#include "ConsoleDlg.h"
|
||||
#include "TabsDlg.h"
|
||||
#include "OutlinerDlg.h"
|
||||
#include "../decl/DialogDeclBrowser.h"
|
||||
|
||||
#ifndef W_DECLS
|
||||
#define W_DECLS 0x0020
|
||||
#endif
|
||||
|
||||
|
||||
// CInspectorDialog dialog
|
||||
@@ -75,6 +80,8 @@ public:
|
||||
CDialogTextures mediaDlg;
|
||||
CEntityDlg entityDlg;
|
||||
COutlinerDlg outlinerDlg;
|
||||
DialogDeclBrowser declBrowserDlg;
|
||||
DialogDeclBrowser &GetDeclBrowser() { return declBrowserDlg; }
|
||||
void SetMode(int mode, bool updateTabs = true);
|
||||
void UpdateEntitySel(eclass_t *ent);
|
||||
void UpdateSelectedEntity();
|
||||
|
||||
Reference in New Issue
Block a user