control
This commit is contained in:
@@ -253,3 +253,4 @@ If neither variable is set, the workflow falls back to the repo-local defaults u
|
||||
- Logs.
|
||||
- Continue source cleanup/refactoring. Pass 1 done
|
||||
- Support a separate sound shader `.slang` file in shader packages.
|
||||
- Add WebView2
|
||||
|
||||
@@ -71,7 +71,8 @@ typedef HGLRC (WINAPI* PFNWGLCREATECONTEXTATTRIBSARBPROC)(HDC hdc, HGLRC hShareC
|
||||
|
||||
namespace
|
||||
{
|
||||
const int kStatusStripHeight = 92;
|
||||
const int kStatusPanelWidth = 680;
|
||||
const int kStatusPanelHeight = 92;
|
||||
const int kStatusPadding = 8;
|
||||
const int kStatusLabelWidth = 58;
|
||||
const int kStatusButtonWidth = 86;
|
||||
@@ -106,13 +107,13 @@ bool StatusStripCreated(const StatusStripControls& controls)
|
||||
return controls.panel != NULL;
|
||||
}
|
||||
|
||||
HWND CreateStatusChild(HWND parent, const char* className, const char* text, DWORD style, int controlId)
|
||||
HWND CreateStatusChild(HWND parent, const char* className, const char* text, DWORD style, DWORD exStyle, int controlId)
|
||||
{
|
||||
return CreateWindowExA(
|
||||
0,
|
||||
exStyle,
|
||||
className,
|
||||
text,
|
||||
WS_CHILD | WS_VISIBLE | style,
|
||||
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | style,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
@@ -125,15 +126,15 @@ HWND CreateStatusChild(HWND parent, const char* className, const char* text, DWO
|
||||
|
||||
void CreateStatusStrip(HWND hWnd, StatusStripControls& controls)
|
||||
{
|
||||
controls.panel = CreateStatusChild(hWnd, "STATIC", "", SS_NOTIFY, 0);
|
||||
controls.controlLabel = CreateStatusChild(hWnd, "STATIC", "Control", SS_LEFT, 0);
|
||||
controls.controlUrl = CreateStatusChild(hWnd, "EDIT", "", ES_AUTOHSCROLL | ES_READONLY, kControlUrlEditId);
|
||||
controls.openControl = CreateStatusChild(hWnd, "BUTTON", "Open", BS_PUSHBUTTON, kOpenControlButtonId);
|
||||
controls.docsLabel = CreateStatusChild(hWnd, "STATIC", "Docs", SS_LEFT, 0);
|
||||
controls.docsUrl = CreateStatusChild(hWnd, "EDIT", "", ES_AUTOHSCROLL | ES_READONLY, kDocsUrlEditId);
|
||||
controls.openDocs = CreateStatusChild(hWnd, "BUTTON", "Open", BS_PUSHBUTTON, kOpenDocsButtonId);
|
||||
controls.oscLabel = CreateStatusChild(hWnd, "STATIC", "OSC", SS_LEFT, 0);
|
||||
controls.oscAddress = CreateStatusChild(hWnd, "EDIT", "", ES_AUTOHSCROLL | ES_READONLY, kOscAddressEditId);
|
||||
controls.panel = CreateStatusChild(hWnd, "STATIC", "", SS_LEFT, WS_EX_CLIENTEDGE, 0);
|
||||
controls.controlLabel = CreateStatusChild(hWnd, "STATIC", "Control", SS_LEFT, 0, 0);
|
||||
controls.controlUrl = CreateStatusChild(hWnd, "EDIT", "", ES_AUTOHSCROLL | ES_READONLY | WS_TABSTOP, WS_EX_CLIENTEDGE, kControlUrlEditId);
|
||||
controls.openControl = CreateStatusChild(hWnd, "BUTTON", "Open", BS_PUSHBUTTON | WS_TABSTOP, 0, kOpenControlButtonId);
|
||||
controls.docsLabel = CreateStatusChild(hWnd, "STATIC", "Docs", SS_LEFT, 0, 0);
|
||||
controls.docsUrl = CreateStatusChild(hWnd, "EDIT", "", ES_AUTOHSCROLL | ES_READONLY | WS_TABSTOP, WS_EX_CLIENTEDGE, kDocsUrlEditId);
|
||||
controls.openDocs = CreateStatusChild(hWnd, "BUTTON", "Open", BS_PUSHBUTTON | WS_TABSTOP, 0, kOpenDocsButtonId);
|
||||
controls.oscLabel = CreateStatusChild(hWnd, "STATIC", "OSC", SS_LEFT, 0, 0);
|
||||
controls.oscAddress = CreateStatusChild(hWnd, "EDIT", "", ES_AUTOHSCROLL | ES_READONLY | WS_TABSTOP, WS_EX_CLIENTEDGE, kOscAddressEditId);
|
||||
|
||||
HFONT guiFont = reinterpret_cast<HFONT>(GetStockObject(DEFAULT_GUI_FONT));
|
||||
HWND children[] = {
|
||||
@@ -157,6 +158,30 @@ void CreateStatusStrip(HWND hWnd, StatusStripControls& controls)
|
||||
SetWindowTextA(controls.oscAddress, "Starting OSC listener...");
|
||||
}
|
||||
|
||||
void RaiseStatusControls(const StatusStripControls& controls)
|
||||
{
|
||||
if (!StatusStripCreated(controls))
|
||||
return;
|
||||
|
||||
SetWindowPos(controls.panel, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
|
||||
|
||||
HWND interactiveControls[] = {
|
||||
controls.controlLabel,
|
||||
controls.controlUrl,
|
||||
controls.openControl,
|
||||
controls.docsLabel,
|
||||
controls.docsUrl,
|
||||
controls.openDocs,
|
||||
controls.oscLabel,
|
||||
controls.oscAddress
|
||||
};
|
||||
for (HWND control : interactiveControls)
|
||||
{
|
||||
if (control)
|
||||
SetWindowPos(control, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
|
||||
}
|
||||
}
|
||||
|
||||
void LayoutStatusStrip(HWND hWnd, const StatusStripControls& controls)
|
||||
{
|
||||
RECT clientRect = {};
|
||||
@@ -165,14 +190,17 @@ void LayoutStatusStrip(HWND hWnd, const StatusStripControls& controls)
|
||||
|
||||
const int clientWidth = static_cast<int>(clientRect.right - clientRect.left);
|
||||
const int clientHeight = static_cast<int>(clientRect.bottom - clientRect.top);
|
||||
const int panelTop = std::max(0, clientHeight - kStatusStripHeight);
|
||||
MoveWindow(controls.panel, 0, panelTop, clientWidth, kStatusStripHeight, TRUE);
|
||||
const int panelWidth = std::max(280, std::min(kStatusPanelWidth, clientWidth - (kStatusPadding * 2)));
|
||||
const int panelHeight = kStatusPanelHeight;
|
||||
const int panelLeft = kStatusPadding;
|
||||
const int panelTop = std::max(kStatusPadding, clientHeight - panelHeight - kStatusPadding);
|
||||
MoveWindow(controls.panel, panelLeft, panelTop, panelWidth, panelHeight, TRUE);
|
||||
|
||||
const int rowX = kStatusPadding;
|
||||
const int rowX = panelLeft + kStatusPadding;
|
||||
const int editX = rowX + kStatusLabelWidth + kStatusGap;
|
||||
const int buttonX = std::max(editX, clientWidth - kStatusPadding - kStatusButtonWidth);
|
||||
const int buttonX = panelLeft + panelWidth - kStatusPadding - kStatusButtonWidth;
|
||||
const int editWidth = std::max(80, buttonX - editX - kStatusGap);
|
||||
const int oscWidth = std::max(80, clientWidth - editX - kStatusPadding);
|
||||
const int oscWidth = std::max(80, panelLeft + panelWidth - editX - kStatusPadding);
|
||||
const int row1 = panelTop + kStatusPadding;
|
||||
const int row2 = row1 + kStatusRowHeight + kStatusGap;
|
||||
const int row3 = row2 + kStatusRowHeight + kStatusGap;
|
||||
@@ -185,6 +213,7 @@ void LayoutStatusStrip(HWND hWnd, const StatusStripControls& controls)
|
||||
MoveWindow(controls.openDocs, buttonX, row2, kStatusButtonWidth, kStatusRowHeight, TRUE);
|
||||
MoveWindow(controls.oscLabel, rowX, row3 + 3, kStatusLabelWidth, kStatusRowHeight, TRUE);
|
||||
MoveWindow(controls.oscAddress, editX, row3, oscWidth, kStatusRowHeight, TRUE);
|
||||
RaiseStatusControls(controls);
|
||||
}
|
||||
|
||||
void UpdateStatusStrip(const StatusStripControls& controls, const OpenGLComposite& composite)
|
||||
@@ -423,6 +452,13 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
UpdateStatusStrip(sStatusStrip, *pOpenGLComposite);
|
||||
LayoutStatusStrip(hWnd, sStatusStrip);
|
||||
RECT clientRect = {};
|
||||
if (GetClientRect(hWnd, &clientRect))
|
||||
{
|
||||
pOpenGLComposite->resizeGL(
|
||||
static_cast<WORD>(clientRect.right - clientRect.left),
|
||||
static_cast<WORD>(clientRect.bottom - clientRect.top));
|
||||
}
|
||||
InvalidateRect(hWnd, NULL, FALSE);
|
||||
}
|
||||
break;
|
||||
@@ -459,7 +495,11 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
RECT clientRect = {};
|
||||
if (GetClientRect(hWnd, &clientRect))
|
||||
pOpenGLComposite->resizeGL(static_cast<WORD>(clientRect.right - clientRect.left), static_cast<WORD>(clientRect.bottom - clientRect.top));
|
||||
{
|
||||
pOpenGLComposite->resizeGL(
|
||||
static_cast<WORD>(clientRect.right - clientRect.left),
|
||||
static_cast<WORD>(clientRect.bottom - clientRect.top));
|
||||
}
|
||||
}
|
||||
InvalidateRect(hWnd, NULL, FALSE);
|
||||
break;
|
||||
@@ -493,6 +533,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
wglMakeCurrent(hDC, hRC);
|
||||
pOpenGLComposite->paintGL();
|
||||
wglMakeCurrent( NULL, NULL );
|
||||
RaiseStatusControls(sStatusStrip);
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
|
||||
Reference in New Issue
Block a user