mirror of
https://github.com/jmarshall23/DoomRTX.git
synced 2026-08-12 08:11:10 +02:00
Added new editor layout similar to idTech 5.
Cleaned up the entity inspector. Fixed numerous radiant bugs.
This commit is contained in:
@@ -101,9 +101,14 @@ If you have questions concerning this license or the applicable additional terms
|
||||
#define RENDERDEMO_VERSION 2
|
||||
|
||||
// editor info
|
||||
|
||||
#ifdef PREY
|
||||
#define EDITOR_DEFAULT_PROJECT "prey.qe4"
|
||||
#else
|
||||
#define EDITOR_DEFAULT_PROJECT "doom.qe4"
|
||||
#endif
|
||||
#define EDITOR_REGISTRY_KEY "DOOMRadiant"
|
||||
#define EDITOR_WINDOWTEXT "IceEdit2(for " GAME_NAME " )"
|
||||
#define EDITOR_WINDOWTEXT "IceEdit2 for " GAME_NAME ""
|
||||
|
||||
// win32 info
|
||||
#define WIN32_CONSOLE_CLASS "DOOM 3 WinConsole"
|
||||
|
||||
+559
-10
@@ -826,6 +826,496 @@ static void CameraNav_DrawOverlay(CCamWnd* cam) {
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
========================
|
||||
Camera window embedded menu bar
|
||||
|
||||
The camera view is an OpenGL window, so the menu is a real child window at the
|
||||
very top of the camera client area. CCamWnd reserves that strip in OnSize() and
|
||||
all GL viewports/scissors use the reduced camera height, which keeps the camera
|
||||
view from drawing underneath the menu.
|
||||
========================
|
||||
*/
|
||||
bool IsBModel(brush_t* b);
|
||||
|
||||
static const char* CAMWND_MENU_BAR_CLASS = "QER_CamWndMenuBar";
|
||||
static const char* CAMWND_PROP_MENU_BAR = "QER_CamWnd_MenuBar";
|
||||
static const char* CAMWND_PROP_RENDER_MODE = "QER_CamWnd_RenderMode";
|
||||
static const char* CAMWND_PROP_REBUILD_MODE = "QER_CamWnd_RebuildMode";
|
||||
static const char* CAMWND_PROP_ENTITY_MODE = "QER_CamWnd_EntityMode";
|
||||
static const char* CAMWND_PROP_FILTER_MASK = "QER_CamWnd_FilterMask";
|
||||
|
||||
#define CAMWND_MENU_HEIGHT 22
|
||||
#define CAMWND_MENU_CHILD_ID 62000
|
||||
#define CAMWND_MENU_CMD_REALTIME_LIGHTING 62100
|
||||
#define CAMWND_MENU_CMD_SHOW_WORLD 62101
|
||||
#define CAMWND_MENU_CMD_SHOW_PATCHES 62102
|
||||
#define CAMWND_MENU_CMD_SHOW_MODELS 62103
|
||||
#define CAMWND_MENU_CMD_SHOW_ENTITIES 62104
|
||||
#define CAMWND_MENU_CMD_SHOW_LIGHTS 62105
|
||||
#define CAMWND_MENU_CMD_RESET_FILTERS 62106
|
||||
|
||||
#define CAMWND_FILTER_HIDE_WORLD 0x00000001
|
||||
#define CAMWND_FILTER_HIDE_PATCHES 0x00000002
|
||||
#define CAMWND_FILTER_HIDE_MODELS 0x00000004
|
||||
#define CAMWND_FILTER_HIDE_ENTITIES 0x00000008
|
||||
#define CAMWND_FILTER_HIDE_LIGHTS 0x00000010
|
||||
|
||||
static LRESULT CALLBACK CamWnd_MenuBarProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
static int CamWnd_GetMenuHeight() {
|
||||
return CAMWND_MENU_HEIGHT;
|
||||
}
|
||||
|
||||
static int CamWnd_GetIntProp(HWND hWnd, const char* name, int defaultValue = 0) {
|
||||
if (!hWnd) {
|
||||
return defaultValue;
|
||||
}
|
||||
HANDLE value = GetProp(hWnd, name);
|
||||
if (!value) {
|
||||
return defaultValue;
|
||||
}
|
||||
return (int)(INT_PTR)value;
|
||||
}
|
||||
|
||||
static void CamWnd_SetIntProp(HWND hWnd, const char* name, int value) {
|
||||
if (!hWnd) {
|
||||
return;
|
||||
}
|
||||
if (value == 0) {
|
||||
RemoveProp(hWnd, name);
|
||||
}
|
||||
else {
|
||||
SetProp(hWnd, name, (HANDLE)(INT_PTR)value);
|
||||
}
|
||||
}
|
||||
|
||||
static int CamWnd_GetFilterMask(CCamWnd* cam) {
|
||||
return cam ? CamWnd_GetIntProp(cam->GetSafeHwnd(), CAMWND_PROP_FILTER_MASK, 0) : 0;
|
||||
}
|
||||
|
||||
static void CamWnd_SetFilterMask(CCamWnd* cam, int mask) {
|
||||
if (!cam) {
|
||||
return;
|
||||
}
|
||||
CamWnd_SetIntProp(cam->GetSafeHwnd(), CAMWND_PROP_FILTER_MASK, mask);
|
||||
}
|
||||
|
||||
static CCamWnd* CamWnd_FromMenuBar(HWND hWnd) {
|
||||
HWND parent = GetParent(hWnd);
|
||||
if (!parent) {
|
||||
return NULL;
|
||||
}
|
||||
CWnd* wnd = CWnd::FromHandlePermanent(parent);
|
||||
return DYNAMIC_DOWNCAST(CCamWnd, wnd);
|
||||
}
|
||||
|
||||
static HWND CamWnd_GetMenuBar(CCamWnd* cam) {
|
||||
if (!cam || !cam->GetSafeHwnd()) {
|
||||
return NULL;
|
||||
}
|
||||
HWND hBar = (HWND)GetProp(cam->GetSafeHwnd(), CAMWND_PROP_MENU_BAR);
|
||||
return IsWindow(hBar) ? hBar : NULL;
|
||||
}
|
||||
|
||||
static void CamWnd_RequestRedraw(CCamWnd* cam) {
|
||||
if (cam && cam->GetSafeHwnd()) {
|
||||
cam->InvalidateRect(NULL, FALSE);
|
||||
}
|
||||
Sys_UpdateWindows(W_CAMERA);
|
||||
if (g_pParentWnd) {
|
||||
g_pParentWnd->PostMessage(WM_TIMER, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
static void CamWnd_GetMenuItemRect(HWND hWnd, int item, RECT& rect) {
|
||||
GetClientRect(hWnd, &rect);
|
||||
rect.top = 1;
|
||||
rect.bottom = CAMWND_MENU_HEIGHT - 1;
|
||||
|
||||
if (item == 0) {
|
||||
rect.left = 4;
|
||||
rect.right = 86;
|
||||
}
|
||||
else {
|
||||
rect.left = 86;
|
||||
rect.right = 156;
|
||||
}
|
||||
}
|
||||
|
||||
static int CamWnd_MenuHitTest(HWND hWnd, int x, int y) {
|
||||
RECT rect;
|
||||
for (int i = 0; i < 2; i++) {
|
||||
CamWnd_GetMenuItemRect(hWnd, i, rect);
|
||||
if (x >= rect.left && x < rect.right && y >= rect.top && y < rect.bottom) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
static bool CamWnd_RealtimeLightingEnabled(CCamWnd* cam) {
|
||||
if (!cam || !cam->GetSafeHwnd()) {
|
||||
return false;
|
||||
}
|
||||
const HWND hWnd = cam->GetSafeHwnd();
|
||||
return CamWnd_GetIntProp(hWnd, CAMWND_PROP_RENDER_MODE, 0) != 0 &&
|
||||
CamWnd_GetIntProp(hWnd, CAMWND_PROP_REBUILD_MODE, 0) != 0;
|
||||
}
|
||||
|
||||
static void CamWnd_SetRealtimeLighting(CCamWnd* cam, bool enabled) {
|
||||
if (!cam || !cam->GetSafeHwnd()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const HWND hWnd = cam->GetSafeHwnd();
|
||||
bool renderMode = CamWnd_GetIntProp(hWnd, CAMWND_PROP_RENDER_MODE, 0) != 0;
|
||||
bool rebuildMode = CamWnd_GetIntProp(hWnd, CAMWND_PROP_REBUILD_MODE, 0) != 0;
|
||||
|
||||
if (enabled) {
|
||||
if (!renderMode) {
|
||||
cam->ToggleRenderMode();
|
||||
}
|
||||
if (!rebuildMode) {
|
||||
cam->ToggleRebuildMode();
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (rebuildMode) {
|
||||
cam->ToggleRebuildMode();
|
||||
}
|
||||
if (renderMode) {
|
||||
cam->ToggleRenderMode();
|
||||
}
|
||||
}
|
||||
|
||||
CamWnd_RequestRedraw(cam);
|
||||
}
|
||||
|
||||
static void CamWnd_ToggleRealtimeLighting(CCamWnd* cam) {
|
||||
CamWnd_SetRealtimeLighting(cam, !CamWnd_RealtimeLightingEnabled(cam));
|
||||
}
|
||||
|
||||
static void CamWnd_ToggleFilterBit(CCamWnd* cam, int bit) {
|
||||
int mask = CamWnd_GetFilterMask(cam);
|
||||
mask ^= bit;
|
||||
CamWnd_SetFilterMask(cam, mask);
|
||||
CamWnd_RequestRedraw(cam);
|
||||
}
|
||||
|
||||
static void CamWnd_ResetFilters(CCamWnd* cam) {
|
||||
CamWnd_SetFilterMask(cam, 0);
|
||||
CamWnd_RequestRedraw(cam);
|
||||
}
|
||||
|
||||
static void CamWnd_HandleMenuCommand(CCamWnd* cam, int command) {
|
||||
switch (command) {
|
||||
case CAMWND_MENU_CMD_REALTIME_LIGHTING:
|
||||
CamWnd_ToggleRealtimeLighting(cam);
|
||||
break;
|
||||
case CAMWND_MENU_CMD_SHOW_WORLD:
|
||||
CamWnd_ToggleFilterBit(cam, CAMWND_FILTER_HIDE_WORLD);
|
||||
break;
|
||||
case CAMWND_MENU_CMD_SHOW_PATCHES:
|
||||
CamWnd_ToggleFilterBit(cam, CAMWND_FILTER_HIDE_PATCHES);
|
||||
break;
|
||||
case CAMWND_MENU_CMD_SHOW_MODELS:
|
||||
CamWnd_ToggleFilterBit(cam, CAMWND_FILTER_HIDE_MODELS);
|
||||
break;
|
||||
case CAMWND_MENU_CMD_SHOW_ENTITIES:
|
||||
CamWnd_ToggleFilterBit(cam, CAMWND_FILTER_HIDE_ENTITIES);
|
||||
break;
|
||||
case CAMWND_MENU_CMD_SHOW_LIGHTS:
|
||||
CamWnd_ToggleFilterBit(cam, CAMWND_FILTER_HIDE_LIGHTS);
|
||||
break;
|
||||
case CAMWND_MENU_CMD_RESET_FILTERS:
|
||||
CamWnd_ResetFilters(cam);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void CamWnd_AppendVisibleFilterItem(HMENU menu, int mask, int bit, UINT command, const char* text) {
|
||||
UINT flags = MF_STRING;
|
||||
if ((mask & bit) == 0) {
|
||||
flags |= MF_CHECKED;
|
||||
}
|
||||
AppendMenu(menu, flags, command, text);
|
||||
}
|
||||
|
||||
static void CamWnd_ShowLightingMenu(HWND hWnd, CCamWnd* cam) {
|
||||
RECT itemRect;
|
||||
POINT pt;
|
||||
HMENU menu;
|
||||
int command;
|
||||
|
||||
CamWnd_GetMenuItemRect(hWnd, 0, itemRect);
|
||||
pt.x = itemRect.left;
|
||||
pt.y = itemRect.bottom;
|
||||
ClientToScreen(hWnd, &pt);
|
||||
|
||||
menu = CreatePopupMenu();
|
||||
AppendMenu(menu, MF_STRING | (CamWnd_RealtimeLightingEnabled(cam) ? MF_CHECKED : 0), CAMWND_MENU_CMD_REALTIME_LIGHTING, "Real-time lighting");
|
||||
|
||||
command = TrackPopupMenu(menu, TPM_RETURNCMD | TPM_LEFTALIGN | TPM_TOPALIGN, pt.x, pt.y, 0, hWnd, NULL);
|
||||
DestroyMenu(menu);
|
||||
|
||||
if (command) {
|
||||
CamWnd_HandleMenuCommand(cam, command);
|
||||
}
|
||||
}
|
||||
|
||||
static void CamWnd_ShowFiltersMenu(HWND hWnd, CCamWnd* cam) {
|
||||
RECT itemRect;
|
||||
POINT pt;
|
||||
HMENU menu;
|
||||
int command;
|
||||
int mask = CamWnd_GetFilterMask(cam);
|
||||
|
||||
CamWnd_GetMenuItemRect(hWnd, 1, itemRect);
|
||||
pt.x = itemRect.left;
|
||||
pt.y = itemRect.bottom;
|
||||
ClientToScreen(hWnd, &pt);
|
||||
|
||||
menu = CreatePopupMenu();
|
||||
CamWnd_AppendVisibleFilterItem(menu, mask, CAMWND_FILTER_HIDE_WORLD, CAMWND_MENU_CMD_SHOW_WORLD, "Show world geometry");
|
||||
CamWnd_AppendVisibleFilterItem(menu, mask, CAMWND_FILTER_HIDE_PATCHES, CAMWND_MENU_CMD_SHOW_PATCHES, "Show patches");
|
||||
CamWnd_AppendVisibleFilterItem(menu, mask, CAMWND_FILTER_HIDE_MODELS, CAMWND_MENU_CMD_SHOW_MODELS, "Show models");
|
||||
CamWnd_AppendVisibleFilterItem(menu, mask, CAMWND_FILTER_HIDE_ENTITIES, CAMWND_MENU_CMD_SHOW_ENTITIES, "Show entities");
|
||||
CamWnd_AppendVisibleFilterItem(menu, mask, CAMWND_FILTER_HIDE_LIGHTS, CAMWND_MENU_CMD_SHOW_LIGHTS, "Show lights");
|
||||
AppendMenu(menu, MF_SEPARATOR, 0, NULL);
|
||||
AppendMenu(menu, MF_STRING, CAMWND_MENU_CMD_RESET_FILTERS, "Reset filters");
|
||||
|
||||
command = TrackPopupMenu(menu, TPM_RETURNCMD | TPM_LEFTALIGN | TPM_TOPALIGN, pt.x, pt.y, 0, hWnd, NULL);
|
||||
DestroyMenu(menu);
|
||||
|
||||
if (command) {
|
||||
CamWnd_HandleMenuCommand(cam, command);
|
||||
}
|
||||
}
|
||||
|
||||
static void CamWnd_ShowTopMenu(HWND hWnd, int item) {
|
||||
CCamWnd* cam = CamWnd_FromMenuBar(hWnd);
|
||||
if (!cam) {
|
||||
return;
|
||||
}
|
||||
if (item == 0) {
|
||||
CamWnd_ShowLightingMenu(hWnd, cam);
|
||||
}
|
||||
else if (item == 1) {
|
||||
CamWnd_ShowFiltersMenu(hWnd, cam);
|
||||
}
|
||||
}
|
||||
|
||||
static void CamWnd_RegisterMenuBarClass() {
|
||||
static bool registered = false;
|
||||
if (registered) {
|
||||
return;
|
||||
}
|
||||
|
||||
WNDCLASS wc;
|
||||
memset(&wc, 0, sizeof(wc));
|
||||
wc.style = CS_HREDRAW | CS_VREDRAW;
|
||||
wc.lpfnWndProc = CamWnd_MenuBarProc;
|
||||
wc.hInstance = AfxGetInstanceHandle();
|
||||
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
|
||||
wc.lpszClassName = CAMWND_MENU_BAR_CLASS;
|
||||
AfxRegisterClass(&wc);
|
||||
registered = true;
|
||||
}
|
||||
|
||||
static HWND CamWnd_EnsureMenuBar(CCamWnd* cam) {
|
||||
if (!cam || !cam->GetSafeHwnd()) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
HWND hBar = CamWnd_GetMenuBar(cam);
|
||||
if (hBar) {
|
||||
return hBar;
|
||||
}
|
||||
|
||||
CamWnd_RegisterMenuBarClass();
|
||||
|
||||
CRect rect;
|
||||
cam->GetClientRect(rect);
|
||||
hBar = CreateWindowEx(
|
||||
0,
|
||||
CAMWND_MENU_BAR_CLASS,
|
||||
"",
|
||||
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
|
||||
0,
|
||||
0,
|
||||
rect.Width(),
|
||||
CAMWND_MENU_HEIGHT,
|
||||
cam->GetSafeHwnd(),
|
||||
(HMENU)CAMWND_MENU_CHILD_ID,
|
||||
AfxGetInstanceHandle(),
|
||||
NULL);
|
||||
|
||||
if (hBar) {
|
||||
SetProp(cam->GetSafeHwnd(), CAMWND_PROP_MENU_BAR, hBar);
|
||||
SendMessage(hBar, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), FALSE);
|
||||
}
|
||||
|
||||
return hBar;
|
||||
}
|
||||
|
||||
static void CamWnd_LayoutMenuBar(CCamWnd* cam) {
|
||||
if (!cam || !cam->GetSafeHwnd()) {
|
||||
return;
|
||||
}
|
||||
|
||||
HWND hBar = CamWnd_EnsureMenuBar(cam);
|
||||
if (!hBar) {
|
||||
return;
|
||||
}
|
||||
|
||||
CRect rect;
|
||||
cam->GetClientRect(rect);
|
||||
MoveWindow(hBar, 0, 0, rect.Width(), CAMWND_MENU_HEIGHT, TRUE);
|
||||
}
|
||||
|
||||
static void CamWnd_DestroyMenuBar(CCamWnd* cam) {
|
||||
if (!cam || !cam->GetSafeHwnd()) {
|
||||
return;
|
||||
}
|
||||
HWND hBar = CamWnd_GetMenuBar(cam);
|
||||
if (hBar) {
|
||||
DestroyWindow(hBar);
|
||||
}
|
||||
RemoveProp(cam->GetSafeHwnd(), CAMWND_PROP_MENU_BAR);
|
||||
RemoveProp(cam->GetSafeHwnd(), CAMWND_PROP_RENDER_MODE);
|
||||
RemoveProp(cam->GetSafeHwnd(), CAMWND_PROP_REBUILD_MODE);
|
||||
RemoveProp(cam->GetSafeHwnd(), CAMWND_PROP_ENTITY_MODE);
|
||||
RemoveProp(cam->GetSafeHwnd(), CAMWND_PROP_FILTER_MASK);
|
||||
}
|
||||
|
||||
static bool CamWnd_PointInMenuBar(CCamWnd* cam, const CPoint& point) {
|
||||
if (!cam || !cam->GetSafeHwnd()) {
|
||||
return false;
|
||||
}
|
||||
return point.y >= 0 && point.y < CAMWND_MENU_HEIGHT;
|
||||
}
|
||||
|
||||
static void CamWnd_UpdateRuntimeState(CCamWnd* cam, bool renderMode, bool rebuildMode, bool entityMode) {
|
||||
if (!cam || !cam->GetSafeHwnd()) {
|
||||
return;
|
||||
}
|
||||
const HWND hWnd = cam->GetSafeHwnd();
|
||||
CamWnd_SetIntProp(hWnd, CAMWND_PROP_RENDER_MODE, renderMode ? 1 : 0);
|
||||
CamWnd_SetIntProp(hWnd, CAMWND_PROP_REBUILD_MODE, rebuildMode ? 1 : 0);
|
||||
CamWnd_SetIntProp(hWnd, CAMWND_PROP_ENTITY_MODE, entityMode ? 1 : 0);
|
||||
|
||||
HWND hBar = CamWnd_GetMenuBar(cam);
|
||||
if (hBar) {
|
||||
InvalidateRect(hBar, NULL, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
static bool CamWnd_MenuFilterBrush(CCamWnd* cam, brush_t* brush) {
|
||||
if (!cam || !brush) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const int mask = CamWnd_GetFilterMask(cam);
|
||||
if (mask == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const bool hasOwner = (brush->owner != NULL && brush->owner->eclass != NULL);
|
||||
const bool isLight = hasOwner && ((brush->owner->eclass->nShowFlags & ECLASS_LIGHT) != 0);
|
||||
const bool isPatch = (brush->pPatch != NULL);
|
||||
const bool isModel = (brush->modelHandle > 0) || (hasOwner && brush->owner->eclass->entityModel) || brush->entityModel;
|
||||
const bool isBrushModel = hasOwner && IsBModel(brush);
|
||||
const bool isFixedEntity = hasOwner && brush->owner->eclass->fixedsize;
|
||||
const bool isEntity = isLight || isModel || isBrushModel || isFixedEntity;
|
||||
|
||||
if ((mask & CAMWND_FILTER_HIDE_LIGHTS) && isLight) {
|
||||
return true;
|
||||
}
|
||||
if ((mask & CAMWND_FILTER_HIDE_MODELS) && isModel) {
|
||||
return true;
|
||||
}
|
||||
if ((mask & CAMWND_FILTER_HIDE_ENTITIES) && isEntity) {
|
||||
return true;
|
||||
}
|
||||
if ((mask & CAMWND_FILTER_HIDE_PATCHES) && isPatch) {
|
||||
return true;
|
||||
}
|
||||
if ((mask & CAMWND_FILTER_HIDE_WORLD) && !isEntity && !isPatch && !isModel) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static LRESULT CALLBACK CamWnd_MenuBarProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
|
||||
switch (uMsg) {
|
||||
case WM_ERASEBKGND:
|
||||
return 1;
|
||||
|
||||
case WM_SETCURSOR:
|
||||
SetCursor(LoadCursor(NULL, IDC_ARROW));
|
||||
return TRUE;
|
||||
|
||||
case WM_LBUTTONDOWN:
|
||||
SetCapture(hWnd);
|
||||
return 0;
|
||||
|
||||
case WM_LBUTTONUP:
|
||||
{
|
||||
if (GetCapture() == hWnd) {
|
||||
ReleaseCapture();
|
||||
}
|
||||
const int x = (short)LOWORD(lParam);
|
||||
const int y = (short)HIWORD(lParam);
|
||||
const int item = CamWnd_MenuHitTest(hWnd, x, y);
|
||||
if (item >= 0) {
|
||||
CamWnd_ShowTopMenu(hWnd, item);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
case WM_PAINT:
|
||||
{
|
||||
PAINTSTRUCT ps;
|
||||
HDC hDC = BeginPaint(hWnd, &ps);
|
||||
RECT rect;
|
||||
GetClientRect(hWnd, &rect);
|
||||
|
||||
FillRect(hDC, &rect, (HBRUSH)(COLOR_BTNFACE + 1));
|
||||
|
||||
RECT lineRect = rect;
|
||||
lineRect.top = CAMWND_MENU_HEIGHT - 1;
|
||||
FillRect(hDC, &lineRect, (HBRUSH)(COLOR_3DSHADOW + 1));
|
||||
|
||||
HFONT font = (HFONT)SendMessage(hWnd, WM_GETFONT, 0, 0);
|
||||
HFONT oldFont = NULL;
|
||||
if (font) {
|
||||
oldFont = (HFONT)SelectObject(hDC, font);
|
||||
}
|
||||
|
||||
SetBkMode(hDC, TRANSPARENT);
|
||||
SetTextColor(hDC, GetSysColor(COLOR_BTNTEXT));
|
||||
|
||||
RECT itemRect;
|
||||
CamWnd_GetMenuItemRect(hWnd, 0, itemRect);
|
||||
DrawText(hDC, "Lighting", -1, &itemRect, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
|
||||
CamWnd_GetMenuItemRect(hWnd, 1, itemRect);
|
||||
DrawText(hDC, "Filters", -1, &itemRect, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
|
||||
|
||||
if (oldFont) {
|
||||
SelectObject(hDC, oldFont);
|
||||
}
|
||||
EndPaint(hWnd, &ps);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return DefWindowProc(hWnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
|
||||
int g_axialAnchor = -1;
|
||||
int g_axialDest = -1;
|
||||
bool g_bAxialMode = false;
|
||||
@@ -969,6 +1459,10 @@ BOOL CCamWnd::PreCreateWindow(CREATESTRUCT& cs) {
|
||||
cs.style = QE3_SPLITTER_STYLE;
|
||||
}
|
||||
|
||||
// Keep the OpenGL camera surface out of child-window areas such as the
|
||||
// embedded menu bar.
|
||||
cs.style |= WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
|
||||
|
||||
BOOL bResult = CWnd::PreCreateWindow(cs);
|
||||
|
||||
//
|
||||
@@ -1000,6 +1494,8 @@ void CCamWnd::OnPaint() {
|
||||
bool bPaint = true;
|
||||
|
||||
UpdateCaption();
|
||||
CamWnd_EnsureMenuBar(this);
|
||||
CamWnd_LayoutMenuBar(this);
|
||||
|
||||
idGraphicsDeviceContextHelper context(dc.m_hDC, hglrc);
|
||||
|
||||
@@ -1026,6 +1522,7 @@ void CCamWnd::SetXYFriend(CXYWnd* pWnd) {
|
||||
=======================================================================================================================
|
||||
*/
|
||||
void CCamWnd::OnDestroy() {
|
||||
CamWnd_DestroyMenuBar(this);
|
||||
CWnd::OnDestroy();
|
||||
}
|
||||
|
||||
@@ -1078,12 +1575,14 @@ void CCamWnd::OnMouseMove(UINT nFlags, CPoint point) {
|
||||
=======================================================================================================================
|
||||
*/
|
||||
void CCamWnd::OnLButtonDown(UINT nFlags, CPoint point) {
|
||||
if (CamWnd_PointInMenuBar(this, point)) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_ptLastCursor = point;
|
||||
if (CameraNav_IsActive(this)) {
|
||||
CRect r;
|
||||
GetClientRect(r);
|
||||
int x = r.Width() / 2;
|
||||
int y = r.Height() / 2;
|
||||
int x = m_Camera.width / 2;
|
||||
int y = m_Camera.height / 2;
|
||||
Cam_MouseDown(x, y, MK_LBUTTON);
|
||||
Cam_MouseUp(x, y, 0);
|
||||
Sys_UpdateWindows(W_ALL);
|
||||
@@ -1105,6 +1604,10 @@ void CCamWnd::OnLButtonUp(UINT nFlags, CPoint point) {
|
||||
=======================================================================================================================
|
||||
*/
|
||||
void CCamWnd::OnMButtonDown(UINT nFlags, CPoint point) {
|
||||
if (CamWnd_PointInMenuBar(this, point)) {
|
||||
return;
|
||||
}
|
||||
|
||||
OriginalMouseDown(nFlags, point);
|
||||
}
|
||||
|
||||
@@ -1121,6 +1624,10 @@ void CCamWnd::OnMButtonUp(UINT nFlags, CPoint point) {
|
||||
=======================================================================================================================
|
||||
*/
|
||||
void CCamWnd::OnRButtonDown(UINT nFlags, CPoint point) {
|
||||
if (CamWnd_PointInMenuBar(this, point)) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_ptLastCursor = point;
|
||||
if (!(nFlags & (MK_SHIFT | MK_CONTROL)) && CameraNav_Begin(this)) {
|
||||
return;
|
||||
@@ -1213,6 +1720,10 @@ int CCamWnd::OnCreate(LPCREATESTRUCT lpCreateStruct) {
|
||||
common->Printf("GL_VERSION: %s\n", glGetString(GL_VERSION));
|
||||
common->Printf("GL_EXTENSIONS: %s\n", glGetString(GL_EXTENSIONS));
|
||||
|
||||
CamWnd_UpdateRuntimeState(this, renderMode, rebuildMode, entityMode);
|
||||
CamWnd_EnsureMenuBar(this);
|
||||
CamWnd_LayoutMenuBar(this);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1791,6 +2302,7 @@ void CCamWnd::Cam_Draw() {
|
||||
|
||||
|
||||
glViewport(0, 0, m_Camera.width, m_Camera.height);
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
glScissor(0, 0, m_Camera.width, m_Camera.height);
|
||||
glClearColor(g_qeglobals.d_savedinfo.colors[COLOR_CAMERABACK][0], g_qeglobals.d_savedinfo.colors[COLOR_CAMERABACK][1], g_qeglobals.d_savedinfo.colors[COLOR_CAMERABACK][2], 0);
|
||||
|
||||
@@ -1821,6 +2333,10 @@ void CCamWnd::Cam_Draw() {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (CamWnd_MenuFilterBrush(this, brush)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (renderMode) {
|
||||
if (!(entityMode && brush->owner->eclass->fixedsize)) {
|
||||
continue;
|
||||
@@ -1842,6 +2358,9 @@ void CCamWnd::Cam_Draw() {
|
||||
if (!renderMode) {
|
||||
// draw normally
|
||||
for (brush = pList->next; brush != pList; brush = brush->next) {
|
||||
if (CamWnd_MenuFilterBrush(this, brush)) {
|
||||
continue;
|
||||
}
|
||||
if (brush->pPatch) {
|
||||
continue;
|
||||
}
|
||||
@@ -1860,6 +2379,9 @@ void CCamWnd::Cam_Draw() {
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
globalImages->BindNull();
|
||||
for (brush = pList->next; brush != pList; brush = brush->next) {
|
||||
if (CamWnd_MenuFilterBrush(this, brush)) {
|
||||
continue;
|
||||
}
|
||||
if (brush->pPatch || brush->modelHandle > 0) {
|
||||
Brush_Draw(brush, true);
|
||||
|
||||
@@ -1905,6 +2427,9 @@ void CCamWnd::Cam_Draw() {
|
||||
|
||||
glColor3f(1, 1, 1);
|
||||
for (brush = pList->next; brush != pList; brush = brush->next) {
|
||||
if (CamWnd_MenuFilterBrush(this, brush)) {
|
||||
continue;
|
||||
}
|
||||
if (brush->pPatch || brush->modelHandle > 0) {
|
||||
continue;
|
||||
}
|
||||
@@ -1964,6 +2489,7 @@ void CCamWnd::Cam_Draw() {
|
||||
|
||||
CameraNav_DrawOverlay(this);
|
||||
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
glFinish();
|
||||
QE_CheckOpenGLForErrors();
|
||||
|
||||
@@ -1982,8 +2508,13 @@ void CCamWnd::OnSize(UINT nType, int cx, int cy) {
|
||||
|
||||
CRect rect;
|
||||
GetClientRect(rect);
|
||||
m_Camera.width = rect.right;
|
||||
m_Camera.height = rect.bottom;
|
||||
CamWnd_EnsureMenuBar(this);
|
||||
CamWnd_LayoutMenuBar(this);
|
||||
m_Camera.width = rect.Width();
|
||||
m_Camera.height = rect.Height() - CamWnd_GetMenuHeight();
|
||||
if (m_Camera.height < 1) {
|
||||
m_Camera.height = 1;
|
||||
}
|
||||
InvalidateRect(NULL, false);
|
||||
}
|
||||
|
||||
@@ -2225,11 +2756,14 @@ static unsigned int EditorHashBrushGeometry(brush_t* brush, const idVec3& origin
|
||||
return hash;
|
||||
}
|
||||
|
||||
static unsigned int EditorHashBModelGeometry(entity_t* ent) {
|
||||
static unsigned int EditorHashBModelGeometry(CCamWnd* cam, entity_t* ent) {
|
||||
unsigned int hash = EDITOR_RENDER_HASH_INIT;
|
||||
hash = EditorHashString(hash, ValueForKey(ent, "name"));
|
||||
|
||||
for (brush_t* brush = ent->brushes.onext; brush != &ent->brushes; brush = brush->onext) {
|
||||
if (FilterBrush(brush) || CamWnd_MenuFilterBrush(cam, brush) || Map_IsBrushFiltered(brush)) {
|
||||
continue;
|
||||
}
|
||||
const unsigned int brushHash = EditorHashBrushGeometry(brush, ent->origin);
|
||||
hash = EditorHashInt(hash, brushHash);
|
||||
}
|
||||
@@ -2281,11 +2815,14 @@ static idRenderModel* EditorBuildSingleBrushModel(brush_t* brush, const idVec3&
|
||||
return model;
|
||||
}
|
||||
|
||||
static idRenderModel* EditorBuildBModel(entity_t* ent, const char* name) {
|
||||
static idRenderModel* EditorBuildBModel(CCamWnd* cam, entity_t* ent, const char* name) {
|
||||
idTriList tris(1024);
|
||||
idMatList mats(1024);
|
||||
|
||||
for (brush_t* brush = ent->brushes.onext; brush != &ent->brushes; brush = brush->onext) {
|
||||
if (FilterBrush(brush) || CamWnd_MenuFilterBrush(cam, brush) || Map_IsBrushFiltered(brush)) {
|
||||
continue;
|
||||
}
|
||||
Brush_ToTris(brush, &tris, &mats, false, true);
|
||||
}
|
||||
|
||||
@@ -2384,6 +2921,9 @@ static bool EditorWorldBrushRenderable(CCamWnd* cam, brush_t* brush) {
|
||||
if (FilterBrush(brush)) {
|
||||
return false;
|
||||
}
|
||||
if (CamWnd_MenuFilterBrush(cam, brush)) {
|
||||
return false;
|
||||
}
|
||||
if (cam->CullBrush(brush, true)) {
|
||||
return false;
|
||||
}
|
||||
@@ -2631,6 +3171,7 @@ void CCamWnd::BuildEntityRenderState(entity_t* ent, bool update) {
|
||||
// If the entity is no longer renderable, remove only this entity's defs.
|
||||
if (ent->brushes.onext == &ent->brushes ||
|
||||
FilterBrush(ent->brushes.onext) ||
|
||||
CamWnd_MenuFilterBrush(this, ent->brushes.onext) ||
|
||||
CullBrush(ent->brushes.onext, true) ||
|
||||
Map_IsBrushFiltered(ent->brushes.onext)) {
|
||||
EditorFreeEntityModelDef(entityState, ent);
|
||||
@@ -2655,7 +3196,7 @@ void CCamWnd::BuildEntityRenderState(entity_t* ent, bool update) {
|
||||
// Brush model entity. Rebuild the renderModel only when the
|
||||
// entity-local brush geometry/materials changed. Plain movement
|
||||
// is handled by UpdateEntityDef below.
|
||||
const unsigned int geometryHash = EditorHashBModelGeometry(ent);
|
||||
const unsigned int geometryHash = EditorHashBModelGeometry(this, ent);
|
||||
editorRenderBModelState_t* bmodelState = EditorTouchBModelState(ent);
|
||||
idRenderModel* oldModel = NULL;
|
||||
|
||||
@@ -2665,7 +3206,7 @@ void CCamWnd::BuildEntityRenderState(entity_t* ent, bool update) {
|
||||
idStr::Icmp(bmodelState->modelName.c_str(), name) != 0);
|
||||
|
||||
if (geometryChanged) {
|
||||
idRenderModel* newModel = EditorBuildBModel(ent, name);
|
||||
idRenderModel* newModel = EditorBuildBModel(this, ent, name);
|
||||
if (newModel) {
|
||||
oldModel = bmodelState->model;
|
||||
bmodelState->model = newModel;
|
||||
@@ -3229,6 +3770,7 @@ void CCamWnd::UpdateCaption() {
|
||||
strCaption += (animationMode) ? " +anim" : "";
|
||||
}
|
||||
strCaption += (soundMode) ? " +snd" : "";
|
||||
CamWnd_UpdateRuntimeState(this, renderMode, rebuildMode, entityMode);
|
||||
SetWindowText(strCaption);
|
||||
}
|
||||
|
||||
@@ -3379,6 +3921,10 @@ void CCamWnd::DrawEntityData() {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (CamWnd_MenuFilterBrush(this, brush)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((pass == 1 && selectMode) || (entityMode && pass == 0 && brush->owner->lightDef >= 0)) {
|
||||
Brush_DrawXY(brush, 0, true, true);
|
||||
}
|
||||
@@ -3413,6 +3959,8 @@ void CCamWnd::Cam_Render() {
|
||||
|
||||
// save the editor state
|
||||
//glPushAttrib( GL_ALL_ATTRIB_BITS );
|
||||
glViewport(0, 0, m_Camera.width, m_Camera.height);
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
glClearColor(0.1f, 0.1f, 0.1f, 0.0f);
|
||||
glScissor(0, 0, m_Camera.width, m_Camera.height);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
@@ -3453,6 +4001,7 @@ void CCamWnd::Cam_Render() {
|
||||
|
||||
//wglSwapBuffers(dc.m_hDC);
|
||||
// get back to the editor state
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
Cam_BuildMatrix();
|
||||
|
||||
+935
-472
File diff suppressed because it is too large
Load Diff
@@ -2,30 +2,14 @@
|
||||
===========================================================================
|
||||
|
||||
Doom 3 GPL Source Code
|
||||
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
|
||||
|
||||
Doom 3 Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Doom 3 Source Code is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
|
||||
|
||||
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
||||
Modernized Entity Inspector UI pass by Justin / IceBridge workflow.
|
||||
|
||||
===========================================================================
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "afxcmn.h"
|
||||
#include "afxwin.h"
|
||||
#include "PropertyList.h"
|
||||
@@ -33,30 +17,32 @@ If you have questions concerning this license or the applicable additional terms
|
||||
|
||||
// CEntityDlg dialog
|
||||
|
||||
|
||||
|
||||
class CEntityDlg : public CDialog
|
||||
{
|
||||
class CEntityDlg : public CDialog {
|
||||
DECLARE_DYNAMIC(CEntityDlg)
|
||||
|
||||
public:
|
||||
CEntityDlg(CWnd* pParent = NULL); // standard constructor
|
||||
CEntityDlg(CWnd* pParent = NULL);
|
||||
virtual ~CEntityDlg();
|
||||
void SetDict(idDict *_dict) {
|
||||
dict = dict;
|
||||
|
||||
void SetDict(idDict* _dict) {
|
||||
dict = _dict;
|
||||
}
|
||||
void SetEditEntity(entity_t *ent) {
|
||||
|
||||
void SetEditEntity(entity_t* ent) {
|
||||
editEntity = ent;
|
||||
}
|
||||
|
||||
void CreateEntity();
|
||||
void AssignModel ();
|
||||
static CPreviewDlg *ShowModelChooser();
|
||||
static CPreviewDlg *ShowGuiChooser();
|
||||
static CPreviewDlg *ShowSoundChooser();
|
||||
static CPreviewDlg *ShowMaterialChooser();
|
||||
static CPreviewDlg *ShowParticleChooser();
|
||||
static CPreviewDlg *ShowSkinChooser( entity_t *ent );
|
||||
|
||||
void SetKeyVal(const char *key, const char *val) {
|
||||
void AssignModel();
|
||||
|
||||
static CPreviewDlg* ShowModelChooser();
|
||||
static CPreviewDlg* ShowGuiChooser();
|
||||
static CPreviewDlg* ShowSoundChooser();
|
||||
static CPreviewDlg* ShowMaterialChooser();
|
||||
static CPreviewDlg* ShowParticleChooser();
|
||||
static CPreviewDlg* ShowSkinChooser(entity_t* ent);
|
||||
|
||||
void SetKeyVal(const char* key, const char* val) {
|
||||
editKey.SetWindowText(key);
|
||||
editVal.SetWindowText(val);
|
||||
}
|
||||
@@ -66,55 +52,103 @@ public:
|
||||
void InsertCurvePoint();
|
||||
void DeleteCurvePoint();
|
||||
|
||||
// Dialog Data
|
||||
enum { IDD = IDD_DIALOG_ENTITY };
|
||||
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
virtual void DoDataExchange(CDataExchange* pDX);
|
||||
|
||||
//DECLARE_MESSAGE_MAP()
|
||||
public:
|
||||
|
||||
virtual BOOL OnInitDialog();
|
||||
virtual INT_PTR OnToolHitTest(CPoint point, TOOLINFO* pTI) const;
|
||||
|
||||
void AddClassNames();
|
||||
void UpdateEntitySel(eclass_t *ent);
|
||||
void SetKeyValPairs( bool updateAnims = true );
|
||||
static const char *TranslateString(const char *p);
|
||||
void UpdateEntitySel(eclass_t* ent);
|
||||
void SetKeyValPairs(bool updateAnims = true);
|
||||
static const char* TranslateString(const char* p);
|
||||
|
||||
void AddProp();
|
||||
void DelProp();
|
||||
void UpdateFromListBox();
|
||||
|
||||
CEdit editKey;
|
||||
CEdit editVal;
|
||||
void UpdateKeyVal(const char *key, const char *val);
|
||||
void SelectCurvePointByRay(const idVec3 &org, const idVec3 &dir, int buttons);
|
||||
void UpdateEntityCurve();
|
||||
|
||||
void UpdateKeyVal(const char* key, const char* val);
|
||||
void SelectCurvePointByRay(const idVec3& org, const idVec3& dir, int buttons);
|
||||
void UpdateEntityCurve();
|
||||
void UpdateFromAnimationFrame(bool updateKeyValueDisplay = true);
|
||||
|
||||
private:
|
||||
entity_t *editEntity;
|
||||
entity_t* editEntity;
|
||||
bool multipleEntities;
|
||||
|
||||
CPropertyList listKeyVal;
|
||||
CPropertyList listVars;
|
||||
CComboBox comboClass;
|
||||
idDict *dict;
|
||||
|
||||
idDict* dict;
|
||||
|
||||
const idMD5Anim* currentAnimation;
|
||||
int currentAnimationFrame;
|
||||
|
||||
const char *AngleKey();
|
||||
const char* AngleKey();
|
||||
|
||||
idPointListInterface curvePoints;
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// Modern inspector theme
|
||||
// --------------------------------------------------------------------
|
||||
CFont fontTitle;
|
||||
CFont fontSection;
|
||||
CFont fontNormal;
|
||||
CFont fontMono;
|
||||
|
||||
CBrush brushBackground;
|
||||
CBrush brushPanel;
|
||||
CBrush brushPanelAlt;
|
||||
CBrush brushEdit;
|
||||
CBrush brushStatic;
|
||||
|
||||
COLORREF colorBackground;
|
||||
COLORREF colorPanel;
|
||||
COLORREF colorPanelAlt;
|
||||
COLORREF colorBorder;
|
||||
COLORREF colorText;
|
||||
COLORREF colorTextMuted;
|
||||
COLORREF colorAccent;
|
||||
COLORREF colorEditBg;
|
||||
|
||||
bool themeInitialized;
|
||||
|
||||
void InitModernTheme();
|
||||
void ApplyModernTheme();
|
||||
void DestroyModernTheme();
|
||||
|
||||
void MoveCtrl(CWnd& wnd, int x, int y, int w, int h, UINT flags = SWP_SHOWWINDOW);
|
||||
void MoveCtrl(int id, int x, int y, int w, int h, UINT flags = SWP_SHOWWINDOW);
|
||||
void SetCtrlFont(CWnd& wnd, CFont* font);
|
||||
void SetCtrlFont(int id, CFont* font);
|
||||
|
||||
void DrawModernBackground(CDC& dc);
|
||||
void DrawPanel(CDC& dc, const CRect& r, const char* title, bool accent = false);
|
||||
|
||||
public:
|
||||
void UpdateFromAnimationFrame ( bool updateKeyValueDisplay = true);
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
afx_msg void OnSize(UINT nType, int cx, int cy);
|
||||
afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
|
||||
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
|
||||
afx_msg void OnPaint();
|
||||
|
||||
CStatic staticTitle;
|
||||
CStatic staticKey;
|
||||
CStatic staticVal;
|
||||
CStatic staticFrame;
|
||||
|
||||
CButton btnPlayAnim;
|
||||
CButton btnStopAnim;
|
||||
CButton btnBrowse;
|
||||
|
||||
CButton btn135;
|
||||
CButton btn90;
|
||||
CButton btn45;
|
||||
@@ -125,17 +159,23 @@ public:
|
||||
CButton btn315;
|
||||
CButton btnUp;
|
||||
CButton btnDown;
|
||||
|
||||
CButton btnModel;
|
||||
CButton btnSound;
|
||||
CButton btnGui;
|
||||
CButton btnParticle;
|
||||
CButton btnSkin;
|
||||
CButton btnCurve;
|
||||
CButton btnCreate;
|
||||
|
||||
CComboBox cbAnimations;
|
||||
CSliderCtrl slFrameSlider;
|
||||
|
||||
afx_msg void OnCbnSelchangeComboClass();
|
||||
afx_msg void OnLbnSelchangeListkeyval();
|
||||
|
||||
virtual BOOL PreTranslateMessage(MSG* pMsg);
|
||||
|
||||
afx_msg void OnBnClickedE135();
|
||||
afx_msg void OnBnClickedE90();
|
||||
afx_msg void OnBnClickedE45();
|
||||
@@ -146,6 +186,7 @@ public:
|
||||
afx_msg void OnBnClickedE315();
|
||||
afx_msg void OnBnClickedEUp();
|
||||
afx_msg void OnBnClickedEDown();
|
||||
|
||||
afx_msg void OnBnClickedButtonModel();
|
||||
afx_msg void OnBnClickedButtonSound();
|
||||
afx_msg void OnBnClickedButtonGui();
|
||||
@@ -154,15 +195,16 @@ public:
|
||||
afx_msg void OnBnClickedButtonCreate();
|
||||
afx_msg void OnBnClickedStartAnimation();
|
||||
afx_msg void OnBnClickedStopAnimation();
|
||||
CButton btnCreate;
|
||||
|
||||
afx_msg void OnLbnDblclkListkeyval();
|
||||
afx_msg void OnLbnSelchangeListVars();
|
||||
afx_msg void OnLbnDblclkListVars();
|
||||
void OnNMReleasedcaptureSlider1(NMHDR *pNMHDR, LRESULT *pResult);
|
||||
afx_msg void OnCbnAnimationChange ();
|
||||
void OnTimer(UINT_PTR nIDEvent);
|
||||
|
||||
afx_msg void OnNMReleasedcaptureSlider1(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
afx_msg void OnCbnAnimationChange();
|
||||
afx_msg void OnTimer(UINT_PTR nIDEvent);
|
||||
|
||||
afx_msg void OnBnClickedButtonParticle();
|
||||
afx_msg void OnBnClickedButtonSkin();
|
||||
afx_msg void OnBnClickedButtonCurve();
|
||||
|
||||
};
|
||||
};
|
||||
@@ -2,26 +2,7 @@
|
||||
===========================================================================
|
||||
|
||||
Doom 3 GPL Source Code
|
||||
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
|
||||
|
||||
Doom 3 Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Doom 3 Source Code is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
|
||||
|
||||
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
||||
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
===========================================================================
|
||||
*/
|
||||
@@ -36,71 +17,156 @@ If you have questions concerning this license or the applicable additional terms
|
||||
#include "InspectorDialog.h"
|
||||
#include "TabsDlg.h"
|
||||
|
||||
CInspectorDialog *g_Inspectors = NULL;
|
||||
// CInspectorDialog dialog
|
||||
CInspectorDialog* g_Inspectors = NULL;
|
||||
|
||||
void InspectorsDockingCallback ( bool docked , int ID , CWnd* wnd )
|
||||
{
|
||||
g_Inspectors->SetDockedTabs( docked , ID );
|
||||
static const COLORREF INSPECTOR_BG = RGB(245, 247, 250);
|
||||
static const COLORREF INSPECTOR_PANEL_BG = RGB(255, 255, 255);
|
||||
static const COLORREF INSPECTOR_TEXT = RGB(32, 36, 42);
|
||||
static const COLORREF INSPECTOR_MUTED_TEXT = RGB(88, 96, 105);
|
||||
static const COLORREF INSPECTOR_BORDER = RGB(218, 223, 230);
|
||||
|
||||
static const int INSPECTOR_MARGIN = 8;
|
||||
static const int INSPECTOR_TAB_HEIGHT = 42;
|
||||
static const int INSPECTOR_DIVIDER_HEIGHT = 1;
|
||||
|
||||
void InspectorsDockingCallback(bool docked, int ID, CWnd* wnd) {
|
||||
if (g_Inspectors) {
|
||||
g_Inspectors->SetDockedTabs(docked, ID);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// CInspectorDialog dialog
|
||||
//IMPLEMENT_DYNAMIC(CInspectorDialog,CTabsDlg)
|
||||
|
||||
CInspectorDialog::CInspectorDialog(CWnd* pParent /*=NULL*/)
|
||||
: CTabsDlg(CInspectorDialog::IDD, pParent)
|
||||
{
|
||||
: CTabsDlg(CInspectorDialog::IDD, pParent) {
|
||||
initialized = false;
|
||||
dockedTabs = W_CONSOLE | W_TEXTURE | W_MEDIA;
|
||||
}
|
||||
|
||||
CInspectorDialog::~CInspectorDialog()
|
||||
{
|
||||
CInspectorDialog::~CInspectorDialog() {
|
||||
if (modernFont.GetSafeHandle()) {
|
||||
modernFont.DeleteObject();
|
||||
}
|
||||
if (bgBrush.GetSafeHandle()) {
|
||||
bgBrush.DeleteObject();
|
||||
}
|
||||
if (editBrush.GetSafeHandle()) {
|
||||
editBrush.DeleteObject();
|
||||
}
|
||||
if (staticBrush.GetSafeHandle()) {
|
||||
staticBrush.DeleteObject();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CInspectorDialog, CTabsDlg)
|
||||
ON_NOTIFY(TCN_SELCHANGE, IDC_TAB_INSPECTOR, OnTcnSelchange )
|
||||
ON_NOTIFY(TCN_SELCHANGE, IDC_TAB_INSPECTOR, OnTcnSelchange)
|
||||
ON_WM_SIZE()
|
||||
ON_WM_DESTROY()
|
||||
ON_WM_CLOSE()
|
||||
ON_WM_CTLCOLOR()
|
||||
ON_WM_ERASEBKGND()
|
||||
ON_WM_PAINT()
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
// CInspectorDialog message handlers
|
||||
|
||||
BOOL CInspectorDialog::OnInitDialog()
|
||||
{
|
||||
BOOL CInspectorDialog::OnInitDialog() {
|
||||
CTabsDlg::OnInitDialog();
|
||||
|
||||
ASSERT ( m_Tabs.GetSafeHwnd() );
|
||||
ASSERT(m_Tabs.GetSafeHwnd());
|
||||
|
||||
LoadWindowPlacement(GetSafeHwnd() , "radiant_InspectorsWindow" );
|
||||
LoadWindowPlacement(GetSafeHwnd(), "radiant_InspectorsWindow");
|
||||
|
||||
consoleWnd.Create(IDD_DIALOG_CONSOLE, this);
|
||||
texWnd.Create(TEXTURE_WINDOW_CLASS, "", QE3_SPLITTER_STYLE, CRect(5, 5, 10, 10), this, 1299);
|
||||
mediaDlg.Create(IDD_DIALOG_TEXTURELIST, this);
|
||||
entityDlg.Create(IDD_DIALOG_ENTITY, this);
|
||||
|
||||
dockedTabs = GetCvarInt ( "radiant_InspectorDockedDialogs" , W_CONSOLE | W_TEXTURE | W_MEDIA );
|
||||
dockedTabs = GetCvarInt("radiant_InspectorDockedDialogs", W_CONSOLE | W_TEXTURE | W_MEDIA);
|
||||
|
||||
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);
|
||||
|
||||
ApplyModernTheme();
|
||||
|
||||
SetMode(W_CONSOLE);
|
||||
|
||||
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 );
|
||||
|
||||
SetMode(W_CONSOLE);
|
||||
initialized = true;
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
CRect rc;
|
||||
GetClientRect(&rc);
|
||||
LayoutModern(rc.Width(), rc.Height());
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CInspectorDialog::ApplyModernTheme() {
|
||||
if (!modernFont.GetSafeHandle()) {
|
||||
LOGFONT lf;
|
||||
memset(&lf, 0, sizeof(lf));
|
||||
|
||||
HDC hDC = ::GetDC(GetSafeHwnd());
|
||||
const int dpiY = GetDeviceCaps(hDC, LOGPIXELSY);
|
||||
::ReleaseDC(GetSafeHwnd(), hDC);
|
||||
|
||||
lf.lfHeight = -MulDiv(9, dpiY, 72);
|
||||
lf.lfWeight = FW_NORMAL;
|
||||
lf.lfQuality = CLEARTYPE_QUALITY;
|
||||
|
||||
strncpy(lf.lfFaceName, "Segoe UI", sizeof(lf.lfFaceName) - 1);
|
||||
lf.lfFaceName[sizeof(lf.lfFaceName) - 1] = '\0';
|
||||
|
||||
modernFont.CreateFontIndirect(&lf);
|
||||
}
|
||||
|
||||
if (!bgBrush.GetSafeHandle()) {
|
||||
bgBrush.CreateSolidBrush(INSPECTOR_BG);
|
||||
}
|
||||
if (!editBrush.GetSafeHandle()) {
|
||||
editBrush.CreateSolidBrush(INSPECTOR_PANEL_BG);
|
||||
}
|
||||
if (!staticBrush.GetSafeHandle()) {
|
||||
staticBrush.CreateSolidBrush(INSPECTOR_BG);
|
||||
}
|
||||
|
||||
SetFont(&modernFont, FALSE);
|
||||
|
||||
if (m_Tabs.GetSafeHwnd()) {
|
||||
m_Tabs.SetFont(&modernFont, FALSE);
|
||||
m_Tabs.ModifyStyleEx(WS_EX_CLIENTEDGE, 0, SWP_FRAMECHANGED);
|
||||
}
|
||||
|
||||
ApplyModernFontRecursive(&consoleWnd);
|
||||
ApplyModernFontRecursive(&mediaDlg);
|
||||
ApplyModernFontRecursive(&entityDlg);
|
||||
|
||||
ModifyStyleEx(WS_EX_CLIENTEDGE, 0, SWP_FRAMECHANGED);
|
||||
|
||||
Invalidate(TRUE);
|
||||
}
|
||||
|
||||
void CInspectorDialog::ApplyModernFontRecursive(CWnd* wnd) {
|
||||
if (!wnd || !wnd->GetSafeHwnd() || !modernFont.GetSafeHandle()) {
|
||||
return;
|
||||
}
|
||||
|
||||
wnd->SetFont(&modernFont, FALSE);
|
||||
|
||||
CWnd* child = wnd->GetWindow(GW_CHILD);
|
||||
while (child) {
|
||||
child->SetFont(&modernFont, FALSE);
|
||||
child = child->GetNextWindow();
|
||||
}
|
||||
}
|
||||
|
||||
void CInspectorDialog::SetMode(int mode, bool updateTabs) {
|
||||
FocusWindow ( mode );
|
||||
FocusWindow(mode);
|
||||
}
|
||||
|
||||
void CInspectorDialog::UpdateEntitySel(eclass_t *ent) {
|
||||
void CInspectorDialog::UpdateEntitySel(eclass_t* ent) {
|
||||
entityDlg.UpdateEntitySel(ent);
|
||||
}
|
||||
|
||||
@@ -112,80 +178,183 @@ void CInspectorDialog::UpdateSelectedEntity() {
|
||||
entityDlg.SetKeyValPairs();
|
||||
}
|
||||
|
||||
bool CInspectorDialog::GetSelectAllCriteria(idStr &key, idStr &val) {
|
||||
CString k, v;
|
||||
bool CInspectorDialog::GetSelectAllCriteria(idStr& key, idStr& val) {
|
||||
CString k;
|
||||
CString v;
|
||||
|
||||
entityDlg.editKey.GetWindowText(k);
|
||||
entityDlg.editVal.GetWindowText(v);
|
||||
|
||||
key = k;
|
||||
val = v;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CInspectorDialog::LayoutModern(int cx, int cy) {
|
||||
if (!initialized || cx <= 0 || cy <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const int margin = INSPECTOR_MARGIN;
|
||||
|
||||
void CInspectorDialog::OnSize(UINT nType, int cx, int cy)
|
||||
{
|
||||
CTabsDlg::OnSize(nType, cx, cy);
|
||||
CRect tabRect;
|
||||
tabRect.left = margin;
|
||||
tabRect.right = cx - margin;
|
||||
tabRect.bottom = cy - margin;
|
||||
tabRect.top = tabRect.bottom - INSPECTOR_TAB_HEIGHT;
|
||||
|
||||
if (tabRect.top < margin) {
|
||||
tabRect.top = margin;
|
||||
}
|
||||
|
||||
if (m_Tabs.GetSafeHwnd()) {
|
||||
m_Tabs.SetWindowPos(
|
||||
NULL,
|
||||
tabRect.left,
|
||||
tabRect.top,
|
||||
tabRect.Width(),
|
||||
tabRect.Height(),
|
||||
SWP_NOZORDER | SWP_NOACTIVATE
|
||||
);
|
||||
}
|
||||
|
||||
CRect childRect;
|
||||
childRect.left = margin;
|
||||
childRect.top = margin;
|
||||
childRect.right = cx - margin;
|
||||
childRect.bottom = tabRect.top - margin;
|
||||
|
||||
if (childRect.right < childRect.left) {
|
||||
childRect.right = childRect.left;
|
||||
}
|
||||
if (childRect.bottom < childRect.top) {
|
||||
childRect.bottom = childRect.top;
|
||||
}
|
||||
|
||||
DockedWindowInfo* info = NULL;
|
||||
POSITION pos;
|
||||
WORD wID;
|
||||
|
||||
for (pos = m_Windows.GetStartPosition(); pos != NULL; ) {
|
||||
m_Windows.GetNextAssoc(pos, wID, (void*&)info);
|
||||
|
||||
if (info && info->m_Window && info->m_Window->GetSafeHwnd() && info->m_State == DockedWindowInfo::DOCKED) {
|
||||
info->m_Window->SetWindowPos(
|
||||
NULL,
|
||||
childRect.left,
|
||||
childRect.top,
|
||||
childRect.Width(),
|
||||
childRect.Height(),
|
||||
SWP_NOZORDER | SWP_NOACTIVATE
|
||||
);
|
||||
|
||||
info->m_Window->ModifyStyleEx(WS_EX_CLIENTEDGE, 0, SWP_FRAMECHANGED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CInspectorDialog::OnSize(UINT nType, int cx, int cy) {
|
||||
CTabsDlg::OnSize(nType, cx, cy);
|
||||
|
||||
if (!initialized) {
|
||||
return;
|
||||
}
|
||||
|
||||
CRect rect;
|
||||
GetClientRect(rect);
|
||||
LayoutModern(cx, cy);
|
||||
Invalidate(FALSE);
|
||||
}
|
||||
|
||||
CRect tabRect;
|
||||
m_Tabs.GetWindowRect(tabRect);
|
||||
// retain vert size but size 4 in from edges and 4 up from bottom
|
||||
tabRect.left = 4;
|
||||
tabRect.right = rect.Width() - 4;
|
||||
tabRect.top = rect.Height() - tabRect.Height() - 4;
|
||||
tabRect.bottom = rect.Height() - 4;
|
||||
// adjust rect for children size
|
||||
rect.bottom -= 5 + tabRect.Height();
|
||||
BOOL CInspectorDialog::OnEraseBkgnd(CDC* pDC) {
|
||||
CRect rc;
|
||||
GetClientRect(&rc);
|
||||
|
||||
m_Tabs.SetWindowPos(NULL, tabRect.left, tabRect.top, tabRect.Width(), tabRect.Height(), 0);
|
||||
pDC->FillSolidRect(&rc, INSPECTOR_BG);
|
||||
|
||||
for( pos = m_Windows.GetStartPosition(); pos != NULL ; )
|
||||
{
|
||||
m_Windows.GetNextAssoc( pos, wID, (void*&)info );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if ( (info->m_State == DockedWindowInfo::DOCKED) ) {
|
||||
info->m_Window->SetWindowPos(NULL, rect.left, rect.top, rect.Width(), rect.Height(), 0);
|
||||
}
|
||||
void CInspectorDialog::OnPaint() {
|
||||
CPaintDC dc(this);
|
||||
|
||||
CRect rc;
|
||||
GetClientRect(&rc);
|
||||
|
||||
dc.FillSolidRect(&rc, INSPECTOR_BG);
|
||||
|
||||
if (m_Tabs.GetSafeHwnd()) {
|
||||
CRect tabRect;
|
||||
m_Tabs.GetWindowRect(&tabRect);
|
||||
ScreenToClient(&tabRect);
|
||||
|
||||
CRect lineRect;
|
||||
lineRect.left = INSPECTOR_MARGIN;
|
||||
lineRect.right = rc.Width() - INSPECTOR_MARGIN;
|
||||
lineRect.top = tabRect.top - (INSPECTOR_MARGIN / 2);
|
||||
lineRect.bottom = lineRect.top + INSPECTOR_DIVIDER_HEIGHT;
|
||||
|
||||
dc.FillSolidRect(&lineRect, INSPECTOR_BORDER);
|
||||
}
|
||||
}
|
||||
|
||||
void CInspectorDialog::OnDestroy()
|
||||
{
|
||||
::SaveWindowPlacement(GetSafeHwnd() , "radiant_InspectorsWindow" );
|
||||
SetCvarInt("radiant_InspectorDockedDialogs" , dockedTabs );
|
||||
HBRUSH CInspectorDialog::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) {
|
||||
HBRUSH hbr = CTabsDlg::OnCtlColor(pDC, pWnd, nCtlColor);
|
||||
|
||||
if (!pDC) {
|
||||
return hbr;
|
||||
}
|
||||
|
||||
pDC->SetTextColor(INSPECTOR_TEXT);
|
||||
|
||||
switch (nCtlColor) {
|
||||
case CTLCOLOR_DLG:
|
||||
pDC->SetBkColor(INSPECTOR_BG);
|
||||
return (HBRUSH)bgBrush.GetSafeHandle();
|
||||
|
||||
case CTLCOLOR_STATIC:
|
||||
pDC->SetBkColor(INSPECTOR_BG);
|
||||
pDC->SetTextColor(INSPECTOR_MUTED_TEXT);
|
||||
return (HBRUSH)staticBrush.GetSafeHandle();
|
||||
|
||||
case CTLCOLOR_EDIT:
|
||||
case CTLCOLOR_LISTBOX:
|
||||
pDC->SetBkColor(INSPECTOR_PANEL_BG);
|
||||
pDC->SetTextColor(INSPECTOR_TEXT);
|
||||
return (HBRUSH)editBrush.GetSafeHandle();
|
||||
|
||||
case CTLCOLOR_BTN:
|
||||
pDC->SetBkColor(INSPECTOR_BG);
|
||||
pDC->SetTextColor(INSPECTOR_TEXT);
|
||||
return (HBRUSH)bgBrush.GetSafeHandle();
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return hbr;
|
||||
}
|
||||
|
||||
void CInspectorDialog::OnDestroy() {
|
||||
::SaveWindowPlacement(GetSafeHwnd(), "radiant_InspectorsWindow");
|
||||
SetCvarInt("radiant_InspectorDockedDialogs", dockedTabs);
|
||||
|
||||
CTabsDlg::OnDestroy();
|
||||
}
|
||||
|
||||
void CInspectorDialog::OnClose()
|
||||
{
|
||||
void CInspectorDialog::OnClose() {
|
||||
CTabsDlg::OnClose();
|
||||
}
|
||||
|
||||
BOOL CInspectorDialog::PreTranslateMessage(MSG* pMsg)
|
||||
{
|
||||
// TODO: Add your specialized code here and/or call the base class
|
||||
if ( pMsg->message == WM_KEYDOWN || pMsg->message == WM_KEYUP) {
|
||||
BOOL CInspectorDialog::PreTranslateMessage(MSG* pMsg) {
|
||||
if (pMsg->message == WM_KEYDOWN || pMsg->message == WM_KEYUP) {
|
||||
g_pParentWnd->PostMessage(pMsg->message, pMsg->wParam, pMsg->lParam);
|
||||
}
|
||||
|
||||
return CTabsDlg::PreTranslateMessage(pMsg);
|
||||
}
|
||||
|
||||
void CInspectorDialog::SetDockedTabs ( bool docked , int ID )
|
||||
{
|
||||
if ( docked ) {
|
||||
void CInspectorDialog::SetDockedTabs(bool docked, int ID) {
|
||||
if (docked) {
|
||||
dockedTabs |= ID;
|
||||
}
|
||||
else {
|
||||
@@ -193,7 +362,6 @@ void CInspectorDialog::SetDockedTabs ( bool docked , int ID )
|
||||
}
|
||||
}
|
||||
|
||||
void CInspectorDialog::AssignModel ()
|
||||
{
|
||||
void CInspectorDialog::AssignModel() {
|
||||
entityDlg.AssignModel();
|
||||
}
|
||||
}
|
||||
@@ -45,7 +45,20 @@ public:
|
||||
|
||||
// Dialog Data
|
||||
enum { IDD = IDD_DIALOG_INSPECTORS };
|
||||
protected:
|
||||
afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
|
||||
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
|
||||
afx_msg void OnPaint();
|
||||
|
||||
private:
|
||||
CFont modernFont;
|
||||
CBrush bgBrush;
|
||||
CBrush editBrush;
|
||||
CBrush staticBrush;
|
||||
|
||||
void ApplyModernTheme();
|
||||
void ApplyModernFontRecursive(CWnd* wnd);
|
||||
void LayoutModern(int cx, int cy);
|
||||
protected:
|
||||
bool initialized;
|
||||
unsigned int dockedTabs;
|
||||
|
||||
+772
-84
File diff suppressed because it is too large
Load Diff
+115
-1
@@ -60,6 +60,111 @@ struct SKeyInfo
|
||||
};
|
||||
|
||||
|
||||
//=============================================================================
|
||||
// CMainFrameLeftPaneWnd
|
||||
//
|
||||
// Left workspace stack:
|
||||
// [ Camera ]
|
||||
// [ splitter ]
|
||||
// [ Inspector]
|
||||
//
|
||||
// The first layout pass uses a percentage instead of loading child window
|
||||
// placement from radiant.ini / the registry. Dragging the splitter updates the
|
||||
// percentage so the split remains proportional when the frame is resized.
|
||||
//=============================================================================
|
||||
class CMainFrameLeftPaneWnd : public CWnd
|
||||
{
|
||||
DECLARE_DYNAMIC(CMainFrameLeftPaneWnd)
|
||||
public:
|
||||
CMainFrameLeftPaneWnd();
|
||||
virtual ~CMainFrameLeftPaneWnd();
|
||||
|
||||
BOOL Create(CWnd *pParent, UINT nID);
|
||||
void SetEmbeddedWindows(CWnd *pCameraWnd, CWnd *pInspectorWnd);
|
||||
void LayoutChildren();
|
||||
void RecalcLayout();
|
||||
|
||||
protected:
|
||||
CWnd *m_pCameraWnd;
|
||||
CWnd *m_pInspectorWnd;
|
||||
int m_nCameraPercent;
|
||||
int m_nCameraHeight;
|
||||
int m_nSplitterHeight;
|
||||
bool m_bInLayout;
|
||||
bool m_bTrackingSplitter;
|
||||
int m_nDragStartY;
|
||||
int m_nDragStartCameraHeight;
|
||||
CRect m_rcSplitter;
|
||||
|
||||
void AttachChild(CWnd *pWnd);
|
||||
bool IsWindowUsable(CWnd *pWnd) const;
|
||||
int ClampCameraHeight(int cameraHeight, const CRect &client) const;
|
||||
bool HitTestSplitter(const CPoint &point) const;
|
||||
void DrawSplitter(CDC *pDC);
|
||||
|
||||
afx_msg void OnSize(UINT nType, int cx, int cy);
|
||||
afx_msg void OnPaint();
|
||||
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
|
||||
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
|
||||
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
|
||||
afx_msg BOOL OnSetCursor(CWnd *pWnd, UINT nHitTest, UINT message);
|
||||
afx_msg BOOL OnEraseBkgnd(CDC *pDC);
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// CMainFrameLayoutWnd
|
||||
//
|
||||
// Main workspace split:
|
||||
// [ Camera/Inspector stack ] [ splitter ] [ XYDock: menu, toolbar, Z | XY ]
|
||||
//
|
||||
// XYDock already owns the Z/XY splitter. This wrapper supplies the missing
|
||||
// MainFrm-level split and gives startup proportions like the reference image.
|
||||
//=============================================================================
|
||||
class CMainFrameLayoutWnd : public CWnd
|
||||
{
|
||||
DECLARE_DYNAMIC(CMainFrameLayoutWnd)
|
||||
public:
|
||||
CMainFrameLayoutWnd();
|
||||
virtual ~CMainFrameLayoutWnd();
|
||||
|
||||
BOOL Create(CWnd *pParent, UINT nID = AFX_IDW_PANE_FIRST);
|
||||
void SetEmbeddedWindows(CWnd *pCameraWnd, CWnd *pInspectorWnd, CWnd *pXYDockWnd);
|
||||
CWnd *GetLeftPaneWnd();
|
||||
void LayoutChildren();
|
||||
void RecalcLayout();
|
||||
|
||||
protected:
|
||||
CMainFrameLeftPaneWnd m_wndLeftPane;
|
||||
CWnd *m_pXYDockWnd;
|
||||
int m_nLeftPercent;
|
||||
int m_nLeftWidth;
|
||||
int m_nSplitterWidth;
|
||||
bool m_bInLayout;
|
||||
bool m_bTrackingSplitter;
|
||||
int m_nDragStartX;
|
||||
int m_nDragStartLeftWidth;
|
||||
CRect m_rcSplitter;
|
||||
|
||||
void AttachChild(CWnd *pWnd);
|
||||
bool IsWindowUsable(CWnd *pWnd) const;
|
||||
int ClampLeftWidth(int leftWidth, const CRect &client) const;
|
||||
bool HitTestSplitter(const CPoint &point) const;
|
||||
void DrawSplitter(CDC *pDC);
|
||||
|
||||
afx_msg void OnSize(UINT nType, int cx, int cy);
|
||||
afx_msg void OnPaint();
|
||||
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
|
||||
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
|
||||
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
|
||||
afx_msg BOOL OnSetCursor(CWnd *pWnd, UINT nHitTest, UINT message);
|
||||
afx_msg BOOL OnEraseBkgnd(CDC *pDC);
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
class CMainFrame : public CFrameWnd
|
||||
@@ -122,6 +227,10 @@ public:
|
||||
CXYWnd* GetYZWnd() {return m_pYZWnd;};
|
||||
CCamWnd* GetCamera() {return m_pCamWnd;};
|
||||
CZWnd* GetZWnd() {return m_pZWnd;};
|
||||
CXYDockWnd* GetXYDockWnd() { return m_pXYDockWnd; };
|
||||
CMenu* GetMenu() const;
|
||||
void RecalcMainLayout();
|
||||
void RecalcXYDockLayout();
|
||||
|
||||
void SetActiveXY(CXYWnd* p)
|
||||
{
|
||||
@@ -142,7 +251,8 @@ public:
|
||||
protected: // control bar embedded members
|
||||
CStatusBar m_wndStatusBar;
|
||||
CToolBar m_wndToolBar;
|
||||
CTextureBar m_wndTextureBar;
|
||||
//CTextureBar m_wndTextureBar;
|
||||
CMainFrameLayoutWnd m_wndMainLayout;
|
||||
CSplitterWnd m_wndSplit;
|
||||
CSplitterWnd m_wndSplit2;
|
||||
CSplitterWnd m_wndSplit3;
|
||||
@@ -151,6 +261,8 @@ protected: // control bar embedded members
|
||||
CXYWnd* m_pXZWnd;
|
||||
CCamWnd* m_pCamWnd;
|
||||
CZWnd* m_pZWnd;
|
||||
CXYDockWnd* m_pXYDockWnd;
|
||||
HMENU m_hMovedMenu;
|
||||
CString m_strStatus[15];
|
||||
CXYWnd* m_pActiveXY;
|
||||
bool m_bCamPreview;
|
||||
@@ -161,6 +273,8 @@ protected: // control bar embedded members
|
||||
protected:
|
||||
bool m_bDoLoop;
|
||||
void CreateQEChildren();
|
||||
BOOL CreateEmbeddedMainToolBar(UINT nID);
|
||||
void MoveFrameMenuIntoXYWnd();
|
||||
void LoadCommandMap();
|
||||
void SaveCommandMap();
|
||||
void ShowMenuItemKeyBindings(CMenu *pMenu);
|
||||
|
||||
@@ -163,22 +163,36 @@ if only patches selected, will read the patch texdef
|
||||
extern void Face_GetScale_BrushPrimit(face_t *face, float *s, float *t, float *rot);
|
||||
void CSurfaceDlg::SetTexMods() {
|
||||
UpdateData(TRUE);
|
||||
|
||||
// Default to the current texture window material.
|
||||
m_strMaterial = g_qeglobals.d_texturewin.texdef.name;
|
||||
patchMesh_t *p = SinglePatchSelected();
|
||||
|
||||
patchMesh_t* p = SinglePatchSelected();
|
||||
if (p) {
|
||||
m_subdivide = p->explicitSubdivisions;
|
||||
m_strMaterial = p->d_texture->GetName();
|
||||
} else {
|
||||
m_subdivide = false;
|
||||
|
||||
if (p->d_texture) {
|
||||
m_strMaterial = p->d_texture->GetName();
|
||||
}
|
||||
|
||||
m_horzScale = 1.0f;
|
||||
m_vertScale = 1.0f;
|
||||
|
||||
UpdateData(FALSE);
|
||||
return;
|
||||
}
|
||||
|
||||
m_subdivide = false;
|
||||
|
||||
int faceCount = g_ptrSelectedFaces.GetSize();
|
||||
face_t *selFace = NULL;
|
||||
face_t* selFace = NULL;
|
||||
|
||||
if (faceCount) {
|
||||
selFace = reinterpret_cast < face_t * > (g_ptrSelectedFaces.GetAt(0));
|
||||
} else {
|
||||
selFace = reinterpret_cast<face_t*>(g_ptrSelectedFaces.GetAt(0));
|
||||
}
|
||||
else {
|
||||
if (selected_brushes.next != &selected_brushes) {
|
||||
brush_t *b = selected_brushes.next;
|
||||
brush_t* b = selected_brushes.next;
|
||||
if (!b->pPatch) {
|
||||
selFace = b->brush_faces;
|
||||
}
|
||||
@@ -186,9 +200,18 @@ void CSurfaceDlg::SetTexMods() {
|
||||
}
|
||||
|
||||
if (selFace) {
|
||||
// Fill the surface material textbox with the selected face material.
|
||||
if (selFace->d_texture) {
|
||||
m_strMaterial = selFace->d_texture->GetName();
|
||||
}
|
||||
else if (selFace->texdef.name[0]) {
|
||||
m_strMaterial = selFace->texdef.name;
|
||||
}
|
||||
|
||||
float rot;
|
||||
Face_GetScale_BrushPrimit(selFace, &m_horzScale, &m_vertScale, &rot);
|
||||
} else {
|
||||
Face_GetScale_BrushPrimit(selFace, &m_horzScale, &m_vertScale, &rot);
|
||||
}
|
||||
else {
|
||||
m_horzScale = 1.0f;
|
||||
m_vertScale = 1.0f;
|
||||
}
|
||||
|
||||
+932
-2
@@ -32,11 +32,16 @@ If you have questions concerning this license or the applicable additional terms
|
||||
#include "qe3.h"
|
||||
#include "Radiant.h"
|
||||
#include "XYWnd.h"
|
||||
#include "ZWnd.h"
|
||||
#include "DialogInfo.h"
|
||||
#include "splines.h"
|
||||
#include "../../renderer/tr_local.h"
|
||||
#include "../../renderer/model_local.h" // for idRenderModelLiquid
|
||||
|
||||
#ifndef WM_IDLEUPDATECMDUI
|
||||
#define WM_IDLEUPDATECMDUI 0x0363
|
||||
#endif
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
@@ -110,6 +115,926 @@ CMemFile g_PatchClipboard(4096);
|
||||
extern int pressx;
|
||||
extern int pressy;
|
||||
|
||||
//=============================================================================
|
||||
// CXYMenuBar
|
||||
//=============================================================================
|
||||
IMPLEMENT_DYNAMIC(CXYMenuBar, CWnd)
|
||||
|
||||
BEGIN_MESSAGE_MAP(CXYMenuBar, CWnd)
|
||||
ON_WM_PAINT()
|
||||
ON_WM_LBUTTONDOWN()
|
||||
ON_WM_MOUSEMOVE()
|
||||
ON_WM_ERASEBKGND()
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
CXYMenuBar::CXYMenuBar() {
|
||||
m_nItemRects = 0;
|
||||
m_nHotItem = -1;
|
||||
}
|
||||
|
||||
CXYMenuBar::~CXYMenuBar() {
|
||||
if (m_menu.GetSafeHmenu()) {
|
||||
m_menu.DestroyMenu();
|
||||
}
|
||||
}
|
||||
|
||||
BOOL CXYMenuBar::Create(CWnd *pParent, UINT nID) {
|
||||
CString className = AfxRegisterWndClass(
|
||||
CS_HREDRAW | CS_VREDRAW,
|
||||
::LoadCursor(NULL, IDC_ARROW),
|
||||
(HBRUSH)(COLOR_MENU + 1),
|
||||
NULL
|
||||
);
|
||||
return CWnd::CreateEx(
|
||||
0,
|
||||
className,
|
||||
"RadiantEmbeddedMenuBar",
|
||||
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS,
|
||||
CRect(0, 0, 0, 0),
|
||||
pParent,
|
||||
nID
|
||||
);
|
||||
}
|
||||
|
||||
BOOL CXYMenuBar::AttachMenu(HMENU hMenu) {
|
||||
if (!hMenu) {
|
||||
return FALSE;
|
||||
}
|
||||
if (m_menu.GetSafeHmenu()) {
|
||||
m_menu.DestroyMenu();
|
||||
}
|
||||
m_menu.Attach(hMenu);
|
||||
Invalidate(FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL CXYMenuBar::LoadMenu(UINT nID) {
|
||||
if (m_menu.GetSafeHmenu()) {
|
||||
m_menu.DestroyMenu();
|
||||
}
|
||||
BOOL result = m_menu.LoadMenu(nID);
|
||||
Invalidate(FALSE);
|
||||
return result;
|
||||
}
|
||||
|
||||
CMenu *CXYMenuBar::GetMenu() {
|
||||
return m_menu.GetSafeHmenu() ? &m_menu : NULL;
|
||||
}
|
||||
|
||||
HMENU CXYMenuBar::GetMenuHandle() const {
|
||||
return m_menu.GetSafeHmenu();
|
||||
}
|
||||
|
||||
int CXYMenuBar::PreferredHeight() const {
|
||||
int h = ::GetSystemMetrics(SM_CYMENU) + 4;
|
||||
return (h < 22) ? 22 : h;
|
||||
}
|
||||
|
||||
void CXYMenuBar::RebuildItemRects(CDC &dc) {
|
||||
m_nItemRects = 0;
|
||||
|
||||
if (!m_menu.GetSafeHmenu()) {
|
||||
return;
|
||||
}
|
||||
|
||||
int x = 4;
|
||||
const int y = 1;
|
||||
const int h = PreferredHeight() - 2;
|
||||
const int count = m_menu.GetMenuItemCount();
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
CString text;
|
||||
m_menu.GetMenuString(i, text, MF_BYPOSITION);
|
||||
if (m_nItemRects >= 64) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (text.IsEmpty()) {
|
||||
m_itemRects[m_nItemRects++] = CRect(x, y, x + 8, y + h);
|
||||
x += 8;
|
||||
continue;
|
||||
}
|
||||
|
||||
CSize size = dc.GetTextExtent(text);
|
||||
CRect rect(x, y, x + size.cx + 20, y + h);
|
||||
m_itemRects[m_nItemRects++] = rect;
|
||||
x = rect.right + 1;
|
||||
}
|
||||
}
|
||||
|
||||
int CXYMenuBar::HitTest(const CPoint &point) const {
|
||||
for (int i = 0; i < m_nItemRects; i++) {
|
||||
if (m_itemRects[i].PtInRect(point)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void CXYMenuBar::TrackTopLevelMenu(int nIndex) {
|
||||
if (!m_menu.GetSafeHmenu() || nIndex < 0 || nIndex >= m_menu.GetMenuItemCount()) {
|
||||
return;
|
||||
}
|
||||
|
||||
CMenu *subMenu = m_menu.GetSubMenu(nIndex);
|
||||
if (!subMenu || !subMenu->GetSafeHmenu()) {
|
||||
return;
|
||||
}
|
||||
|
||||
CRect rect;
|
||||
if (nIndex < m_nItemRects) {
|
||||
rect = m_itemRects[nIndex];
|
||||
} else {
|
||||
GetClientRect(rect);
|
||||
}
|
||||
|
||||
CPoint pt(rect.left, rect.bottom);
|
||||
ClientToScreen(&pt);
|
||||
|
||||
m_nHotItem = nIndex;
|
||||
Invalidate(FALSE);
|
||||
UpdateWindow();
|
||||
|
||||
CWnd *commandTarget = GetCommandTarget();
|
||||
CWnd *popupOwner = (commandTarget && commandTarget->GetSafeHwnd()) ? commandTarget : static_cast<CWnd *>(this);
|
||||
|
||||
if (popupOwner && popupOwner->GetSafeHwnd()) {
|
||||
CWnd *topLevelOwner = popupOwner->GetTopLevelParent();
|
||||
if (topLevelOwner && topLevelOwner->GetSafeHwnd()) {
|
||||
topLevelOwner->SetForegroundWindow();
|
||||
} else {
|
||||
popupOwner->SetForegroundWindow();
|
||||
}
|
||||
}
|
||||
|
||||
// The popup owner must be the frame, not this embedded menu-bar window.
|
||||
// That keeps WM_INITMENUPOPUP, WM_MENUSELECT, command routing, MRU updates,
|
||||
// and ON_UPDATE_COMMAND_UI handling in CMainFrame where the old menu used them.
|
||||
UINT command = subMenu->TrackPopupMenu(
|
||||
TPM_LEFTALIGN | TPM_TOPALIGN | TPM_LEFTBUTTON | TPM_RIGHTBUTTON | TPM_RETURNCMD,
|
||||
pt.x,
|
||||
pt.y,
|
||||
popupOwner
|
||||
);
|
||||
|
||||
if (command != 0 && commandTarget && commandTarget->GetSafeHwnd()) {
|
||||
commandTarget->SendMessage(WM_COMMAND, MAKEWPARAM(command, 0), 0);
|
||||
}
|
||||
|
||||
m_nHotItem = -1;
|
||||
Invalidate(FALSE);
|
||||
if (popupOwner && popupOwner->GetSafeHwnd()) {
|
||||
popupOwner->PostMessage(WM_NULL, 0, 0);
|
||||
} else {
|
||||
PostMessage(WM_NULL, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
CWnd *CXYMenuBar::GetCommandTarget() const {
|
||||
CWnd *commandTarget = AfxGetMainWnd();
|
||||
if (commandTarget && commandTarget->GetSafeHwnd() && commandTarget != this) {
|
||||
return commandTarget;
|
||||
}
|
||||
|
||||
for (CWnd *parent = GetParent(); parent && parent->GetSafeHwnd(); parent = parent->GetParent()) {
|
||||
if (parent != this && parent->IsKindOf(RUNTIME_CLASS(CFrameWnd))) {
|
||||
return parent;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int XYMenuBarUpper(int ch) {
|
||||
if (ch >= 'a' && ch <= 'z') {
|
||||
return ch - 'a' + 'A';
|
||||
}
|
||||
return ch;
|
||||
}
|
||||
|
||||
BOOL CXYMenuBar::TrackMnemonic(UINT nChar) {
|
||||
if (!m_menu.GetSafeHmenu()) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (nChar == VK_F10) {
|
||||
TrackTopLevelMenu(0);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (nChar > 255) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
const int wanted = XYMenuBarUpper(static_cast<int>(nChar));
|
||||
const int count = m_menu.GetMenuItemCount();
|
||||
for (int i = 0; i < count; i++) {
|
||||
CString text;
|
||||
m_menu.GetMenuString(i, text, MF_BYPOSITION);
|
||||
const int len = text.GetLength();
|
||||
for (int j = 0; j < len; j++) {
|
||||
if (text[j] != '&') {
|
||||
continue;
|
||||
}
|
||||
if (j + 1 >= len) {
|
||||
break;
|
||||
}
|
||||
if (text[j + 1] == '&') {
|
||||
j++;
|
||||
continue;
|
||||
}
|
||||
if (XYMenuBarUpper(static_cast<unsigned char>(text[j + 1])) == wanted) {
|
||||
TrackTopLevelMenu(i);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void CXYMenuBar::OnPaint() {
|
||||
CPaintDC dc(this);
|
||||
CRect client;
|
||||
GetClientRect(client);
|
||||
|
||||
CBrush backBrush(::GetSysColor(COLOR_MENU));
|
||||
dc.FillRect(client, &backBrush);
|
||||
|
||||
RebuildItemRects(dc);
|
||||
|
||||
if (m_menu.GetSafeHmenu()) {
|
||||
const int count = m_menu.GetMenuItemCount();
|
||||
for (int i = 0; i < count && i < m_nItemRects; i++) {
|
||||
CString text;
|
||||
m_menu.GetMenuString(i, text, MF_BYPOSITION);
|
||||
CRect itemRect = m_itemRects[i];
|
||||
|
||||
if (i == m_nHotItem) {
|
||||
dc.Draw3dRect(itemRect, ::GetSysColor(COLOR_3DHILIGHT), ::GetSysColor(COLOR_3DSHADOW));
|
||||
itemRect.DeflateRect(1, 1);
|
||||
}
|
||||
|
||||
dc.SetBkMode(TRANSPARENT);
|
||||
dc.SetTextColor(::GetSysColor(COLOR_MENUTEXT));
|
||||
dc.DrawText(text, itemRect, DT_SINGLELINE | DT_VCENTER | DT_CENTER);
|
||||
}
|
||||
}
|
||||
|
||||
CPen shadowPen(PS_SOLID, 1, ::GetSysColor(COLOR_3DSHADOW));
|
||||
CPen *oldPen = dc.SelectObject(&shadowPen);
|
||||
dc.MoveTo(client.left, client.bottom - 1);
|
||||
dc.LineTo(client.right, client.bottom - 1);
|
||||
dc.SelectObject(oldPen);
|
||||
}
|
||||
|
||||
void CXYMenuBar::OnLButtonDown(UINT nFlags, CPoint point) {
|
||||
CClientDC dc(this);
|
||||
RebuildItemRects(dc);
|
||||
TrackTopLevelMenu(HitTest(point));
|
||||
}
|
||||
|
||||
void CXYMenuBar::OnMouseMove(UINT nFlags, CPoint point) {
|
||||
CClientDC dc(this);
|
||||
RebuildItemRects(dc);
|
||||
int hotItem = HitTest(point);
|
||||
if (hotItem != m_nHotItem) {
|
||||
m_nHotItem = hotItem;
|
||||
Invalidate(FALSE);
|
||||
}
|
||||
CWnd::OnMouseMove(nFlags, point);
|
||||
}
|
||||
|
||||
BOOL CXYMenuBar::OnEraseBkgnd(CDC *pDC) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL CXYMenuBar::OnCommand(WPARAM wParam, LPARAM lParam) {
|
||||
CWnd *commandTarget = GetCommandTarget();
|
||||
if (commandTarget && commandTarget->GetSafeHwnd() && commandTarget != this) {
|
||||
return static_cast<BOOL>(commandTarget->SendMessage(WM_COMMAND, wParam, lParam));
|
||||
}
|
||||
return CWnd::OnCommand(wParam, lParam);
|
||||
}
|
||||
|
||||
BOOL CXYMenuBar::OnCmdMsg(UINT nID, int nCode, void *pExtra, AFX_CMDHANDLERINFO *pHandlerInfo) {
|
||||
if (CWnd::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo)) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
CWnd *commandTarget = GetCommandTarget();
|
||||
if (commandTarget && commandTarget->GetSafeHwnd() && commandTarget != this) {
|
||||
return commandTarget->OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// CXYMDIContainerWnd
|
||||
//=============================================================================
|
||||
IMPLEMENT_DYNAMIC(CXYMDIContainerWnd, CWnd)
|
||||
|
||||
BEGIN_MESSAGE_MAP(CXYMDIContainerWnd, CWnd)
|
||||
ON_WM_SIZE()
|
||||
ON_WM_PAINT()
|
||||
ON_WM_LBUTTONDOWN()
|
||||
ON_WM_LBUTTONUP()
|
||||
ON_WM_MOUSEMOVE()
|
||||
ON_WM_SETCURSOR()
|
||||
ON_WM_ERASEBKGND()
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
CXYMDIContainerWnd::CXYMDIContainerWnd() {
|
||||
m_pXYWnd = NULL;
|
||||
m_pZWnd = NULL;
|
||||
m_nZDockPercent = 5;
|
||||
m_nZWidth = 0;
|
||||
m_nSplitterWidth = 5;
|
||||
m_bZStartupSized = false;
|
||||
m_bInLayout = false;
|
||||
m_bTrackingSplitter = false;
|
||||
m_nDragStartX = 0;
|
||||
m_nDragStartZWidth = 0;
|
||||
m_rcSplitter.SetRectEmpty();
|
||||
}
|
||||
|
||||
CXYMDIContainerWnd::~CXYMDIContainerWnd() {
|
||||
}
|
||||
|
||||
BOOL CXYMDIContainerWnd::Create(CWnd *pParent, UINT nID) {
|
||||
CLIENTCREATESTRUCT clientCreate;
|
||||
memset(&clientCreate, 0, sizeof(clientCreate));
|
||||
clientCreate.hWindowMenu = NULL;
|
||||
clientCreate.idFirstChild = 0x7B00;
|
||||
|
||||
return CWnd::CreateEx(
|
||||
0,
|
||||
"MDICLIENT",
|
||||
"RadiantXYMDIContainer",
|
||||
WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
|
||||
CRect(0, 0, 0, 0),
|
||||
pParent,
|
||||
nID,
|
||||
&clientCreate
|
||||
);
|
||||
}
|
||||
|
||||
void CXYMDIContainerWnd::AttachChild(CWnd *pWnd) {
|
||||
if (!pWnd || !pWnd->GetSafeHwnd() || !GetSafeHwnd()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (::GetParent(pWnd->GetSafeHwnd()) != GetSafeHwnd()) {
|
||||
pWnd->SetParent(this);
|
||||
}
|
||||
|
||||
LONG style = ::GetWindowLong(pWnd->GetSafeHwnd(), GWL_STYLE);
|
||||
style &= ~(WS_POPUP | WS_CAPTION | WS_THICKFRAME | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX);
|
||||
style |= WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
|
||||
::SetWindowLong(pWnd->GetSafeHwnd(), GWL_STYLE, style);
|
||||
::SetWindowPos(
|
||||
pWnd->GetSafeHwnd(),
|
||||
NULL,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED
|
||||
);
|
||||
}
|
||||
|
||||
void CXYMDIContainerWnd::SetChildWindows(CXYWnd *pXYWnd, CZWnd *pZWnd) {
|
||||
m_pXYWnd = pXYWnd;
|
||||
m_pZWnd = pZWnd;
|
||||
AttachChild(m_pZWnd);
|
||||
AttachChild(m_pXYWnd);
|
||||
LayoutChildren();
|
||||
}
|
||||
|
||||
void CXYMDIContainerWnd::SetEmbeddedWindows(CWnd *pZWnd, CWnd *pXYWnd) {
|
||||
m_pZWnd = pZWnd;
|
||||
m_pXYWnd = pXYWnd;
|
||||
AttachChild(m_pZWnd);
|
||||
AttachChild(m_pXYWnd);
|
||||
LayoutChildren();
|
||||
}
|
||||
|
||||
bool CXYMDIContainerWnd::IsZVisible() const {
|
||||
return m_pZWnd && m_pZWnd->GetSafeHwnd() && m_pZWnd->IsWindowVisible();
|
||||
}
|
||||
|
||||
int CXYMDIContainerWnd::ClampZWidth(int zWidth, const CRect &client) const {
|
||||
const int width = client.Width();
|
||||
if (width <= m_nSplitterWidth + 1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const int minZ = 1;
|
||||
const int minXY = 64;
|
||||
const int available = width - m_nSplitterWidth;
|
||||
int maxZ = available - minXY;
|
||||
if (maxZ < minZ) {
|
||||
maxZ = available - 1;
|
||||
}
|
||||
if (maxZ < minZ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (zWidth < minZ) {
|
||||
zWidth = minZ;
|
||||
}
|
||||
if (zWidth > maxZ) {
|
||||
zWidth = maxZ;
|
||||
}
|
||||
return zWidth;
|
||||
}
|
||||
|
||||
int CXYMDIContainerWnd::ComputeInitialZWidth(const CRect &client) const {
|
||||
const int width = client.Width();
|
||||
if (width <= 1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int zWidth = (width * m_nZDockPercent) / 100;
|
||||
if (zWidth < 1) {
|
||||
zWidth = 1;
|
||||
}
|
||||
return ClampZWidth(zWidth, client);
|
||||
}
|
||||
|
||||
void CXYMDIContainerWnd::SetZDockPercent(int percent) {
|
||||
// Keep legacy MainFrm calls such as SetZDockPercent(20) from changing the
|
||||
// required startup size. The embedded Z pane starts at 5%, then the user can
|
||||
// drag the splitter to any practical width.
|
||||
m_nZDockPercent = 5;
|
||||
|
||||
if (!m_bZStartupSized) {
|
||||
LayoutChildren();
|
||||
}
|
||||
}
|
||||
|
||||
int CXYMDIContainerWnd::GetZDockPercent() const {
|
||||
return m_nZDockPercent;
|
||||
}
|
||||
|
||||
int CXYMDIContainerWnd::GetZWidth() const {
|
||||
return m_nZWidth;
|
||||
}
|
||||
|
||||
int CXYMDIContainerWnd::GetFixedZWidth() const {
|
||||
return GetZWidth();
|
||||
}
|
||||
|
||||
bool CXYMDIContainerWnd::HitTestSplitter(const CPoint &point) const {
|
||||
return !m_rcSplitter.IsRectEmpty() && m_rcSplitter.PtInRect(point);
|
||||
}
|
||||
|
||||
void CXYMDIContainerWnd::DrawSplitter(CDC *pDC) {
|
||||
if (!pDC || m_rcSplitter.IsRectEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
CRect rc = m_rcSplitter;
|
||||
CBrush brush(::GetSysColor(COLOR_BTNFACE));
|
||||
pDC->FillRect(rc, &brush);
|
||||
pDC->Draw3dRect(rc, ::GetSysColor(COLOR_3DHILIGHT), ::GetSysColor(COLOR_3DSHADOW));
|
||||
|
||||
int x = rc.left + rc.Width() / 2;
|
||||
CPen pen(PS_SOLID, 1, ::GetSysColor(COLOR_3DSHADOW));
|
||||
CPen *oldPen = pDC->SelectObject(&pen);
|
||||
pDC->MoveTo(x, rc.top + 3);
|
||||
pDC->LineTo(x, rc.bottom - 3);
|
||||
pDC->SelectObject(oldPen);
|
||||
}
|
||||
|
||||
void CXYMDIContainerWnd::LayoutChildren() {
|
||||
if (!GetSafeHwnd() || m_bInLayout) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_bInLayout = true;
|
||||
|
||||
CRect client;
|
||||
GetClientRect(client);
|
||||
|
||||
if (client.Width() < 1 || client.Height() < 1) {
|
||||
m_rcSplitter.SetRectEmpty();
|
||||
m_bInLayout = false;
|
||||
return;
|
||||
}
|
||||
|
||||
bool zVisible = IsZVisible();
|
||||
int zWidth = 0;
|
||||
int splitterWidth = 0;
|
||||
|
||||
if (zVisible) {
|
||||
if (!m_bZStartupSized) {
|
||||
m_nZWidth = ComputeInitialZWidth(client);
|
||||
m_bZStartupSized = true;
|
||||
}
|
||||
|
||||
zWidth = ClampZWidth(m_nZWidth, client);
|
||||
m_nZWidth = zWidth;
|
||||
if (zWidth > 0 && client.Width() > zWidth + m_nSplitterWidth) {
|
||||
splitterWidth = m_nSplitterWidth;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_pZWnd && m_pZWnd->GetSafeHwnd()) {
|
||||
if (zVisible && zWidth > 0) {
|
||||
m_pZWnd->MoveWindow(client.left, client.top, zWidth, client.Height(), TRUE);
|
||||
m_pZWnd->Invalidate(FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
if (zVisible && zWidth > 0 && splitterWidth > 0) {
|
||||
m_rcSplitter.SetRect(client.left + zWidth, client.top, client.left + zWidth + splitterWidth, client.bottom);
|
||||
} else {
|
||||
m_rcSplitter.SetRectEmpty();
|
||||
}
|
||||
|
||||
if (m_pXYWnd && m_pXYWnd->GetSafeHwnd()) {
|
||||
int xyLeft = client.left + zWidth + splitterWidth;
|
||||
if (xyLeft > client.right - 1) {
|
||||
xyLeft = client.left;
|
||||
}
|
||||
CRect xyRect(xyLeft, client.top, client.right, client.bottom);
|
||||
m_pXYWnd->MoveWindow(xyRect, TRUE);
|
||||
m_pXYWnd->Invalidate(FALSE);
|
||||
}
|
||||
|
||||
Invalidate(FALSE);
|
||||
m_bInLayout = false;
|
||||
}
|
||||
|
||||
void CXYMDIContainerWnd::OnSize(UINT nType, int cx, int cy) {
|
||||
CWnd::OnSize(nType, cx, cy);
|
||||
LayoutChildren();
|
||||
}
|
||||
|
||||
void CXYMDIContainerWnd::OnPaint() {
|
||||
CPaintDC dc(this);
|
||||
DrawSplitter(&dc);
|
||||
}
|
||||
|
||||
void CXYMDIContainerWnd::OnLButtonDown(UINT nFlags, CPoint point) {
|
||||
if (HitTestSplitter(point)) {
|
||||
m_bTrackingSplitter = true;
|
||||
m_nDragStartX = point.x;
|
||||
m_nDragStartZWidth = m_nZWidth;
|
||||
SetCapture();
|
||||
::SetCursor(::LoadCursor(NULL, IDC_SIZEWE));
|
||||
return;
|
||||
}
|
||||
|
||||
CWnd::OnLButtonDown(nFlags, point);
|
||||
}
|
||||
|
||||
void CXYMDIContainerWnd::OnLButtonUp(UINT nFlags, CPoint point) {
|
||||
if (m_bTrackingSplitter) {
|
||||
m_bTrackingSplitter = false;
|
||||
if (GetCapture() == this) {
|
||||
ReleaseCapture();
|
||||
}
|
||||
LayoutChildren();
|
||||
return;
|
||||
}
|
||||
|
||||
CWnd::OnLButtonUp(nFlags, point);
|
||||
}
|
||||
|
||||
void CXYMDIContainerWnd::OnMouseMove(UINT nFlags, CPoint point) {
|
||||
if (m_bTrackingSplitter) {
|
||||
CRect client;
|
||||
GetClientRect(client);
|
||||
m_nZWidth = ClampZWidth(m_nDragStartZWidth + point.x - m_nDragStartX, client);
|
||||
LayoutChildren();
|
||||
::SetCursor(::LoadCursor(NULL, IDC_SIZEWE));
|
||||
return;
|
||||
}
|
||||
|
||||
if (HitTestSplitter(point)) {
|
||||
::SetCursor(::LoadCursor(NULL, IDC_SIZEWE));
|
||||
}
|
||||
|
||||
CWnd::OnMouseMove(nFlags, point);
|
||||
}
|
||||
|
||||
BOOL CXYMDIContainerWnd::OnSetCursor(CWnd *pWnd, UINT nHitTest, UINT message) {
|
||||
CPoint point;
|
||||
GetCursorPos(&point);
|
||||
ScreenToClient(&point);
|
||||
if (m_bTrackingSplitter || HitTestSplitter(point)) {
|
||||
::SetCursor(::LoadCursor(NULL, IDC_SIZEWE));
|
||||
return TRUE;
|
||||
}
|
||||
return CWnd::OnSetCursor(pWnd, nHitTest, message);
|
||||
}
|
||||
|
||||
BOOL CXYMDIContainerWnd::OnEraseBkgnd(CDC *pDC) {
|
||||
DrawSplitter(pDC);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL CXYMDIContainerWnd::OnCommand(WPARAM wParam, LPARAM lParam) {
|
||||
CWnd *commandTarget = AfxGetMainWnd();
|
||||
if (commandTarget && commandTarget->GetSafeHwnd() && commandTarget != this) {
|
||||
return static_cast<BOOL>(commandTarget->SendMessage(WM_COMMAND, wParam, lParam));
|
||||
}
|
||||
return CWnd::OnCommand(wParam, lParam);
|
||||
}
|
||||
|
||||
BOOL CXYMDIContainerWnd::OnCmdMsg(UINT nID, int nCode, void *pExtra, AFX_CMDHANDLERINFO *pHandlerInfo) {
|
||||
if (CWnd::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo)) {
|
||||
return TRUE;
|
||||
}
|
||||
CWnd *commandTarget = AfxGetMainWnd();
|
||||
if (commandTarget && commandTarget->GetSafeHwnd() && commandTarget != this) {
|
||||
return commandTarget->OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// CXYDockWnd
|
||||
//=============================================================================
|
||||
IMPLEMENT_DYNAMIC(CXYDockWnd, CWnd)
|
||||
|
||||
BEGIN_MESSAGE_MAP(CXYDockWnd, CWnd)
|
||||
ON_WM_CREATE()
|
||||
ON_WM_SIZE()
|
||||
ON_WM_ERASEBKGND()
|
||||
ON_MESSAGE(WM_IDLEUPDATECMDUI, OnIdleUpdateCmdUI)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
CXYDockWnd::CXYDockWnd() {
|
||||
m_pToolBar = NULL;
|
||||
m_bInLayout = false;
|
||||
}
|
||||
|
||||
CXYDockWnd::~CXYDockWnd() {
|
||||
}
|
||||
|
||||
BOOL CXYDockWnd::Create(CWnd *pParent, UINT nID) {
|
||||
CRect rect(0, 0, 0, 0);
|
||||
return Create(rect, pParent, nID);
|
||||
}
|
||||
|
||||
BOOL CXYDockWnd::Create(const RECT &rect, CWnd *pParent, UINT nID) {
|
||||
CString className = AfxRegisterWndClass(
|
||||
CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS,
|
||||
::LoadCursor(NULL, IDC_ARROW),
|
||||
(HBRUSH)(COLOR_BTNFACE + 1),
|
||||
NULL
|
||||
);
|
||||
return CWnd::CreateEx(
|
||||
0,
|
||||
className,
|
||||
"RadiantXYDockWnd",
|
||||
WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
|
||||
rect,
|
||||
pParent,
|
||||
nID
|
||||
);
|
||||
}
|
||||
|
||||
int CXYDockWnd::OnCreate(LPCREATESTRUCT lpCreateStruct) {
|
||||
if (CWnd::OnCreate(lpCreateStruct) == -1) {
|
||||
return -1;
|
||||
}
|
||||
if (!m_wndMenuBar.Create(this, 0x7A01)) {
|
||||
return -1;
|
||||
}
|
||||
if (!m_wndMDIContainer.Create(this, 0x7A02)) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CXYDockWnd::SetChildWindows(CXYWnd *pXYWnd, CZWnd *pZWnd) {
|
||||
m_wndMDIContainer.SetChildWindows(pXYWnd, pZWnd);
|
||||
LayoutChildren();
|
||||
}
|
||||
|
||||
void CXYDockWnd::SetEmbeddedWindows(CWnd *pZWnd, CWnd *pXYWnd) {
|
||||
m_wndMDIContainer.SetEmbeddedWindows(pZWnd, pXYWnd);
|
||||
LayoutChildren();
|
||||
}
|
||||
|
||||
void CXYDockWnd::SetToolBar(CToolBar *pToolBar) {
|
||||
m_pToolBar = pToolBar;
|
||||
if (m_pToolBar && m_pToolBar->GetSafeHwnd()) {
|
||||
CWnd *commandTarget = GetCommandTarget();
|
||||
if (!commandTarget || !commandTarget->GetSafeHwnd()) {
|
||||
commandTarget = this;
|
||||
}
|
||||
|
||||
m_pToolBar->SetParent(this);
|
||||
m_pToolBar->SetOwner(this);
|
||||
m_pToolBar->SetDlgCtrlID(AFX_IDW_TOOLBAR);
|
||||
m_pToolBar->ModifyStyle(WS_POPUP | WS_CAPTION | WS_THICKFRAME | WS_SYSMENU, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN);
|
||||
}
|
||||
LayoutChildren();
|
||||
}
|
||||
|
||||
void CXYDockWnd::SetEmbeddedToolBar(CToolBar *pToolBar) {
|
||||
SetToolBar(pToolBar);
|
||||
}
|
||||
|
||||
CWnd *CXYDockWnd::GetCommandTarget() const {
|
||||
CWnd *commandTarget = AfxGetMainWnd();
|
||||
if (commandTarget && commandTarget->GetSafeHwnd() && commandTarget != this) {
|
||||
return commandTarget;
|
||||
}
|
||||
|
||||
for (CWnd *parent = GetParent(); parent && parent->GetSafeHwnd(); parent = parent->GetParent()) {
|
||||
if (parent != this && parent->IsKindOf(RUNTIME_CLASS(CFrameWnd))) {
|
||||
return parent;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void CXYDockWnd::UpdateToolBarCmdUI(BOOL bDisableIfNoHndler) {
|
||||
if (!m_pToolBar || !m_pToolBar->GetSafeHwnd() || !m_pToolBar->IsWindowVisible()) {
|
||||
return;
|
||||
}
|
||||
|
||||
CWnd *commandTarget = GetCommandTarget();
|
||||
if (!commandTarget || !commandTarget->GetSafeHwnd()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (commandTarget->IsKindOf(RUNTIME_CLASS(CFrameWnd))) {
|
||||
m_pToolBar->OnUpdateCmdUI(static_cast<CFrameWnd *>(commandTarget), bDisableIfNoHndler);
|
||||
}
|
||||
}
|
||||
|
||||
void CXYDockWnd::ShowEmbeddedToolBar(BOOL bShow) {
|
||||
if (m_pToolBar && m_pToolBar->GetSafeHwnd()) {
|
||||
m_pToolBar->ShowWindow(bShow ? SW_SHOW : SW_HIDE);
|
||||
}
|
||||
LayoutChildren();
|
||||
}
|
||||
|
||||
BOOL CXYDockWnd::AttachMenu(HMENU hMenu) {
|
||||
BOOL result = m_wndMenuBar.AttachMenu(hMenu);
|
||||
LayoutChildren();
|
||||
return result;
|
||||
}
|
||||
|
||||
void CXYDockWnd::SetMenuHandle(HMENU hMenu) {
|
||||
AttachMenu(hMenu);
|
||||
}
|
||||
|
||||
BOOL CXYDockWnd::LoadMenu(UINT nID) {
|
||||
BOOL result = m_wndMenuBar.LoadMenu(nID);
|
||||
LayoutChildren();
|
||||
return result;
|
||||
}
|
||||
|
||||
CMenu *CXYDockWnd::GetEmbeddedMenu() {
|
||||
return m_wndMenuBar.GetMenu();
|
||||
}
|
||||
|
||||
HMENU CXYDockWnd::GetEmbeddedMenuHandle() const {
|
||||
return m_wndMenuBar.GetMenuHandle();
|
||||
}
|
||||
|
||||
HMENU CXYDockWnd::GetMenuHandle() const {
|
||||
return GetEmbeddedMenuHandle();
|
||||
}
|
||||
|
||||
void CXYDockWnd::SetZDockPercent(int percent) {
|
||||
m_wndMDIContainer.SetZDockPercent(percent);
|
||||
}
|
||||
|
||||
void CXYDockWnd::SetZPercent(int percent) {
|
||||
SetZDockPercent(percent);
|
||||
}
|
||||
|
||||
int CXYDockWnd::GetZDockPercent() const {
|
||||
return m_wndMDIContainer.GetZDockPercent();
|
||||
}
|
||||
|
||||
int CXYDockWnd::GetZPercent() const {
|
||||
return GetZDockPercent();
|
||||
}
|
||||
|
||||
void CXYDockWnd::LayoutChildren() {
|
||||
if (!GetSafeHwnd() || m_bInLayout) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_bInLayout = true;
|
||||
|
||||
CRect client;
|
||||
GetClientRect(client);
|
||||
|
||||
int y = client.top;
|
||||
const int width = client.Width();
|
||||
|
||||
if (m_wndMenuBar.GetSafeHwnd()) {
|
||||
if (m_wndMenuBar.GetMenuHandle()) {
|
||||
m_wndMenuBar.ShowWindow(SW_SHOW);
|
||||
const int menuHeight = m_wndMenuBar.PreferredHeight();
|
||||
m_wndMenuBar.MoveWindow(client.left, y, width, menuHeight, TRUE);
|
||||
y += menuHeight;
|
||||
} else {
|
||||
m_wndMenuBar.ShowWindow(SW_HIDE);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_pToolBar && m_pToolBar->GetSafeHwnd()) {
|
||||
if (m_pToolBar->IsWindowVisible()) {
|
||||
CSize toolbarSize = m_pToolBar->CalcFixedLayout(FALSE, TRUE);
|
||||
int toolbarHeight = toolbarSize.cy;
|
||||
if (toolbarHeight < 24) {
|
||||
toolbarHeight = 24;
|
||||
}
|
||||
m_pToolBar->MoveWindow(client.left, y, width, toolbarHeight, TRUE);
|
||||
y += toolbarHeight;
|
||||
}
|
||||
}
|
||||
|
||||
CRect content(client.left, y, client.right, client.bottom);
|
||||
if (content.Width() < 1 || content.Height() < 1) {
|
||||
m_bInLayout = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_wndMDIContainer.GetSafeHwnd()) {
|
||||
m_wndMDIContainer.MoveWindow(content, TRUE);
|
||||
m_wndMDIContainer.LayoutChildren();
|
||||
}
|
||||
|
||||
m_bInLayout = false;
|
||||
}
|
||||
|
||||
void CXYDockWnd::RecalcLayout() {
|
||||
LayoutChildren();
|
||||
}
|
||||
|
||||
BOOL CXYDockWnd::TrackMenuMnemonic(UINT nChar) {
|
||||
if (m_wndMenuBar.GetSafeHwnd()) {
|
||||
return m_wndMenuBar.TrackMnemonic(nChar);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void CXYDockWnd::OnSize(UINT nType, int cx, int cy) {
|
||||
CWnd::OnSize(nType, cx, cy);
|
||||
LayoutChildren();
|
||||
}
|
||||
|
||||
BOOL CXYDockWnd::OnEraseBkgnd(CDC *pDC) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
LRESULT CXYDockWnd::OnIdleUpdateCmdUI(WPARAM wParam, LPARAM lParam) {
|
||||
UpdateToolBarCmdUI(static_cast<BOOL>(wParam));
|
||||
return 0L;
|
||||
}
|
||||
|
||||
BOOL CXYDockWnd::OnCommand(WPARAM wParam, LPARAM lParam) {
|
||||
CWnd *commandTarget = GetCommandTarget();
|
||||
if (commandTarget && commandTarget->GetSafeHwnd() && commandTarget != this) {
|
||||
return static_cast<BOOL>(commandTarget->SendMessage(WM_COMMAND, wParam, lParam));
|
||||
}
|
||||
return CWnd::OnCommand(wParam, lParam);
|
||||
}
|
||||
|
||||
BOOL CXYDockWnd::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT *pResult) {
|
||||
CWnd *commandTarget = GetCommandTarget();
|
||||
if (commandTarget && commandTarget->GetSafeHwnd() && commandTarget != this) {
|
||||
LRESULT result = commandTarget->SendMessage(WM_NOTIFY, wParam, lParam);
|
||||
if (pResult) {
|
||||
*pResult = result;
|
||||
}
|
||||
if (result != 0) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return CWnd::OnNotify(wParam, lParam, pResult);
|
||||
}
|
||||
|
||||
BOOL CXYDockWnd::OnCmdMsg(UINT nID, int nCode, void *pExtra, AFX_CMDHANDLERINFO *pHandlerInfo) {
|
||||
if (CWnd::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo)) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
CWnd *commandTarget = GetCommandTarget();
|
||||
if (commandTarget && commandTarget->GetSafeHwnd() && commandTarget != this) {
|
||||
return commandTarget->OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
=======================================================================================================================
|
||||
=======================================================================================================================
|
||||
@@ -594,6 +1519,7 @@ BOOL CXYWnd::PreCreateWindow(CREATESTRUCT &cs) {
|
||||
if (cs.style != QE3_CHILDSTYLE) {
|
||||
cs.style = QE3_SPLITTER_STYLE;
|
||||
}
|
||||
cs.style |= WS_CLIPSIBLINGS | WS_CLIPCHILDREN;
|
||||
|
||||
return CWnd::PreCreateWindow(cs);
|
||||
}
|
||||
@@ -2732,7 +3658,7 @@ bool CXYWnd::XY_MouseMoved(int x, int y, int buttons) {
|
||||
|
||||
/*
|
||||
=======================================================================================================================
|
||||
DRAWING £
|
||||
DRAWING £
|
||||
XY_DrawGrid
|
||||
=======================================================================================================================
|
||||
*/
|
||||
@@ -3304,7 +4230,7 @@ bool FilterBrush(brush_t *pb) {
|
||||
|
||||
/*
|
||||
=======================================================================================================================
|
||||
PATH LINES £
|
||||
PATH LINES £
|
||||
DrawPathLines Draws connections between entities. Needs to consider all entities, not just ones on screen, because
|
||||
the lines can be visible when neither end is. Called for both camera view and xy view.
|
||||
=======================================================================================================================
|
||||
@@ -3535,6 +4461,10 @@ extern void DrawBrushEntityName(brush_t *b);
|
||||
=======================================================================================================================
|
||||
*/
|
||||
void CXYWnd::XY_Draw() {
|
||||
if (m_nWidth <= 0 || m_nHeight <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
brush_t *brush;
|
||||
float w, h;
|
||||
entity_t *e;
|
||||
|
||||
@@ -40,6 +40,171 @@ If you have questions concerning this license or the applicable additional terms
|
||||
#include "qe3.h"
|
||||
#include "CamWnd.h"
|
||||
|
||||
|
||||
class CXYWnd;
|
||||
class CZWnd;
|
||||
|
||||
//=============================================================================
|
||||
// CXYMenuBar
|
||||
//
|
||||
// Lightweight in-client menu bar used by CXYDockWnd. The old Radiant menu is
|
||||
// detached from CMainFrame and attached here, so existing command IDs and menu
|
||||
// check states continue to be used.
|
||||
//=============================================================================
|
||||
class CXYMenuBar : public CWnd
|
||||
{
|
||||
DECLARE_DYNAMIC(CXYMenuBar)
|
||||
public:
|
||||
CXYMenuBar();
|
||||
virtual ~CXYMenuBar();
|
||||
|
||||
BOOL Create(CWnd *pParent, UINT nID);
|
||||
BOOL AttachMenu(HMENU hMenu);
|
||||
BOOL LoadMenu(UINT nID);
|
||||
CMenu *GetMenu();
|
||||
HMENU GetMenuHandle() const;
|
||||
int PreferredHeight() const;
|
||||
BOOL TrackMnemonic(UINT nChar);
|
||||
|
||||
protected:
|
||||
CMenu m_menu;
|
||||
CRect m_itemRects[64];
|
||||
int m_nItemRects;
|
||||
int m_nHotItem;
|
||||
|
||||
void RebuildItemRects(CDC &dc);
|
||||
int HitTest(const CPoint &point) const;
|
||||
void TrackTopLevelMenu(int nIndex);
|
||||
CWnd *GetCommandTarget() const;
|
||||
|
||||
afx_msg void OnPaint();
|
||||
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
|
||||
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
|
||||
afx_msg BOOL OnEraseBkgnd(CDC *pDC);
|
||||
virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
|
||||
virtual BOOL OnCmdMsg(UINT nID, int nCode, void *pExtra, AFX_CMDHANDLERINFO *pHandlerInfo);
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// CXYMDIContainerWnd
|
||||
//
|
||||
// Hosts the docked Z and XY top child windows inside an MDI client container.
|
||||
// The initial Z pane is 5% of this container. After startup, the user can drag
|
||||
// the splitter bar between Z and XY top to resize both panes interactively.
|
||||
//=============================================================================
|
||||
class CXYMDIContainerWnd : public CWnd
|
||||
{
|
||||
DECLARE_DYNAMIC(CXYMDIContainerWnd)
|
||||
public:
|
||||
CXYMDIContainerWnd();
|
||||
virtual ~CXYMDIContainerWnd();
|
||||
|
||||
BOOL Create(CWnd *pParent, UINT nID);
|
||||
void SetChildWindows(CXYWnd *pXYWnd, CZWnd *pZWnd);
|
||||
void SetEmbeddedWindows(CWnd *pZWnd, CWnd *pXYWnd);
|
||||
void LayoutChildren();
|
||||
void SetZDockPercent(int percent);
|
||||
int GetZDockPercent() const;
|
||||
int GetZWidth() const;
|
||||
int GetFixedZWidth() const;
|
||||
|
||||
protected:
|
||||
CWnd *m_pXYWnd;
|
||||
CWnd *m_pZWnd;
|
||||
int m_nZDockPercent;
|
||||
int m_nZWidth;
|
||||
int m_nSplitterWidth;
|
||||
bool m_bZStartupSized;
|
||||
bool m_bInLayout;
|
||||
bool m_bTrackingSplitter;
|
||||
int m_nDragStartX;
|
||||
int m_nDragStartZWidth;
|
||||
CRect m_rcSplitter;
|
||||
|
||||
void AttachChild(CWnd *pWnd);
|
||||
bool IsZVisible() const;
|
||||
int ComputeInitialZWidth(const CRect &client) const;
|
||||
int ClampZWidth(int zWidth, const CRect &client) const;
|
||||
bool HitTestSplitter(const CPoint &point) const;
|
||||
void DrawSplitter(CDC *pDC);
|
||||
|
||||
afx_msg void OnSize(UINT nType, int cx, int cy);
|
||||
afx_msg void OnPaint();
|
||||
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
|
||||
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
|
||||
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
|
||||
afx_msg BOOL OnSetCursor(CWnd *pWnd, UINT nHitTest, UINT message);
|
||||
afx_msg BOOL OnEraseBkgnd(CDC *pDC);
|
||||
virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
|
||||
virtual BOOL OnCmdMsg(UINT nID, int nCode, void *pExtra, AFX_CMDHANDLERINFO *pHandlerInfo);
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// CXYDockWnd
|
||||
//
|
||||
// Owns the embedded XY editor layout:
|
||||
// [ menu bar ]
|
||||
// [ toolbar ]
|
||||
// [ MDI client: Z window | splitter | XY top render window ]
|
||||
//
|
||||
// The docked Z window starts at 5% of the MDI container width. The divider in
|
||||
// the MDI client can be dragged to resize the Z and XY top panes.
|
||||
//=============================================================================
|
||||
class CXYDockWnd : public CWnd
|
||||
{
|
||||
DECLARE_DYNAMIC(CXYDockWnd)
|
||||
public:
|
||||
CXYDockWnd();
|
||||
virtual ~CXYDockWnd();
|
||||
|
||||
BOOL Create(CWnd *pParent, UINT nID = AFX_IDW_PANE_FIRST);
|
||||
BOOL Create(const RECT &rect, CWnd *pParent, UINT nID);
|
||||
|
||||
void SetChildWindows(CXYWnd *pXYWnd, CZWnd *pZWnd);
|
||||
void SetEmbeddedWindows(CWnd *pZWnd, CWnd *pXYWnd);
|
||||
|
||||
void SetToolBar(CToolBar *pToolBar);
|
||||
void SetEmbeddedToolBar(CToolBar *pToolBar);
|
||||
void ShowEmbeddedToolBar(BOOL bShow);
|
||||
void UpdateToolBarCmdUI(BOOL bDisableIfNoHndler);
|
||||
|
||||
BOOL AttachMenu(HMENU hMenu);
|
||||
void SetMenuHandle(HMENU hMenu);
|
||||
BOOL LoadMenu(UINT nID);
|
||||
CMenu *GetEmbeddedMenu();
|
||||
HMENU GetEmbeddedMenuHandle() const;
|
||||
HMENU GetMenuHandle() const;
|
||||
|
||||
void LayoutChildren();
|
||||
void RecalcLayout();
|
||||
BOOL TrackMenuMnemonic(UINT nChar);
|
||||
void SetZDockPercent(int percent);
|
||||
void SetZPercent(int percent);
|
||||
int GetZDockPercent() const;
|
||||
int GetZPercent() const;
|
||||
|
||||
protected:
|
||||
CXYMenuBar m_wndMenuBar;
|
||||
CXYMDIContainerWnd m_wndMDIContainer;
|
||||
CToolBar *m_pToolBar;
|
||||
bool m_bInLayout;
|
||||
|
||||
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
|
||||
afx_msg void OnSize(UINT nType, int cx, int cy);
|
||||
afx_msg BOOL OnEraseBkgnd(CDC *pDC);
|
||||
afx_msg LRESULT OnIdleUpdateCmdUI(WPARAM wParam, LPARAM lParam);
|
||||
virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
|
||||
virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT *pResult);
|
||||
virtual BOOL OnCmdMsg(UINT nID, int nCode, void *pExtra, AFX_CMDHANDLERINFO *pHandlerInfo);
|
||||
CWnd *GetCommandTarget() const;
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
const int SCALE_X = 0x01;
|
||||
const int SCALE_Y = 0x02;
|
||||
const int SCALE_Z = 0x04;
|
||||
|
||||
Reference in New Issue
Block a user