#define NDEBUG
#include <debug.h>
-#include "font.h"
+#include "concfg/font.h"
#include "guiterm.h"
#include "resource.h"
WndClass.hIcon = ghDefaultIcon;
WndClass.hIconSm = ghDefaultIconSm;
WndClass.hCursor = ghDefaultCursor;
- WndClass.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); // The color of a terminal when it is switched off.
+ WndClass.hbrBackground = NULL;
WndClass.lpszMenuName = NULL;
WndClass.cbClsExtra = 0;
WndClass.cbWndExtra = GWLP_CONWND_ALLOC;
CreateSysMenu(HWND hWnd)
{
MENUITEMINFOW mii;
+ HMENU hMenu;
+ PWCHAR ptrTab;
WCHAR szMenuStringBack[255];
- WCHAR *ptrTab;
- HMENU hMenu = GetSystemMenu(hWnd, FALSE);
- if (hMenu != NULL)
- {
- mii.cbSize = sizeof(mii);
- mii.fMask = MIIM_STRING;
- mii.dwTypeData = szMenuStringBack;
- mii.cch = sizeof(szMenuStringBack)/sizeof(WCHAR);
- GetMenuItemInfoW(hMenu, SC_CLOSE, FALSE, &mii);
+ hMenu = GetSystemMenu(hWnd, FALSE);
+ if (hMenu == NULL)
+ return;
- ptrTab = wcschr(szMenuStringBack, '\t');
- if (ptrTab)
- {
- *ptrTab = '\0';
- mii.cch = wcslen(szMenuStringBack);
+ mii.cbSize = sizeof(mii);
+ mii.fMask = MIIM_STRING;
+ mii.dwTypeData = szMenuStringBack;
+ mii.cch = ARRAYSIZE(szMenuStringBack);
- SetMenuItemInfoW(hMenu, SC_CLOSE, FALSE, &mii);
- }
+ GetMenuItemInfoW(hMenu, SC_CLOSE, FALSE, &mii);
- AppendMenuItems(hMenu, GuiConsoleMainMenuItems);
- DrawMenuBar(hWnd);
+ ptrTab = wcschr(szMenuStringBack, L'\t');
+ if (ptrTab)
+ {
+ *ptrTab = L'\0';
+ mii.cch = wcslen(szMenuStringBack);
+
+ SetMenuItemInfoW(hMenu, SC_CLOSE, FALSE, &mii);
}
+
+ AppendMenuItems(hMenu, GuiConsoleMainMenuItems);
+ DrawMenuBar(hWnd);
}
static VOID
Console = GuiData->Console;
GuiData->hWindow = hWnd;
+ GuiData->hSysMenu = GetSystemMenu(hWnd, FALSE);
/* Initialize the fonts */
if (!InitFonts(GuiData,
PaintSelectionRect(GuiData, &ps);
}
+ // TODO: Move cursor display here!
+
LeaveCriticalSection(&GuiData->Lock);
}
EndPaint(GuiData->hWindow, &ps);
/* Free the GuiData registration */
SetWindowLongPtrW(hWnd, GWLP_USERDATA, (DWORD_PTR)NULL);
+ /* Reset the system menu back to default and destroy the previous menu */
GetSystemMenu(hWnd, TRUE);
if (GuiData)
PCONSRV_CONSOLE Console = GuiData->Console;
/* Do nothing if the window is hidden */
- if (!GuiData->IsWindowVisible) return;
+ if (!GuiData->IsWindowVisible || IsIconic(GuiData->hWindow)) return;
if (!ConDrvValidateConsoleUnsafe((PCONSOLE)Console, CONSOLE_RUNNING, TRUE)) return;
if ((windy % HeightUnit) >= (HeightUnit / 2)) ++chary;
/* Compensate for added scroll bars in window */
- if (charx < (DWORD)Buff->ScreenBufferSize.X) windy -= GetSystemMetrics(SM_CYHSCROLL); // Window will have a horizontal scroll bar
- if (chary < (DWORD)Buff->ScreenBufferSize.Y) windx -= GetSystemMetrics(SM_CXVSCROLL); // Window will have a vertical scroll bar
+ if (Buff->ViewSize.X < Buff->ScreenBufferSize.X) windy -= GetSystemMetrics(SM_CYHSCROLL); // Window will have a horizontal scroll bar
+ if (Buff->ViewSize.Y < Buff->ScreenBufferSize.Y) windx -= GetSystemMetrics(SM_CXVSCROLL); // Window will have a vertical scroll bar
charx = windx / (int)WidthUnit ;
chary = windy / (int)HeightUnit;
if (OnClose(GuiData)) goto Default;
break;
+ case WM_ERASEBKGND:
+ return TRUE;
+
case WM_PAINT:
OnPaint(GuiData);
break;