mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-12-14 12:08:14 +00:00
Compare commits
4 Commits
idd-mode-e
...
idd-config
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cab12c6bd2 | ||
|
|
3ed08ba56c | ||
|
|
70da98c1a1 | ||
|
|
ed1602fc74 |
@@ -58,6 +58,7 @@ void CConfigWindow::updateFont()
|
||||
for (HWND child : std::initializer_list<HWND>({
|
||||
*m_version, *m_modeGroup, *m_modeBox, *m_widthLabel, *m_heightLabel, *m_refreshLabel,
|
||||
*m_modeWidth, *m_modeHeight, *m_modeRefresh, *m_modeUpdate, *m_modeDelete,
|
||||
*m_autosizeGroup, *m_defRefreshLabel, *m_defRefresh, *m_defRefreshHz,
|
||||
}))
|
||||
SendMessage(child, WM_SETFONT, (WPARAM)m_font.Get(), 1);
|
||||
}
|
||||
@@ -102,7 +103,7 @@ LRESULT CConfigWindow::onCreate()
|
||||
|
||||
m_modeGroup.reset(new CGroupBox(L"Custom modes", WS_CHILD | WS_VISIBLE, m_hwnd));
|
||||
|
||||
m_modeBox.reset(new CListBox(WS_CHILD | WS_VISIBLE | WS_VSCROLL | LBS_NOTIFY, m_hwnd));
|
||||
m_modeBox.reset(new CListBox(WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | LBS_NOTIFY, m_hwnd));
|
||||
if (m_modes)
|
||||
updateModeList();
|
||||
|
||||
@@ -110,15 +111,24 @@ LRESULT CConfigWindow::onCreate()
|
||||
m_heightLabel.reset(new CStaticWidget(L"Height:", WS_CHILD | WS_VISIBLE | SS_CENTERIMAGE, m_hwnd));
|
||||
m_refreshLabel.reset(new CStaticWidget(L"Refresh:", WS_CHILD | WS_VISIBLE | SS_CENTERIMAGE, m_hwnd));
|
||||
|
||||
m_modeWidth.reset(new CEditWidget(WS_CHILD | WS_VISIBLE | ES_LEFT | ES_NUMBER, m_hwnd));
|
||||
m_modeHeight.reset(new CEditWidget(WS_CHILD | WS_VISIBLE | ES_LEFT | ES_NUMBER, m_hwnd));
|
||||
m_modeRefresh.reset(new CEditWidget(WS_CHILD | WS_VISIBLE | ES_LEFT | ES_NUMBER, m_hwnd));
|
||||
m_modeWidth.reset(new CEditWidget(WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_LEFT | ES_NUMBER, m_hwnd));
|
||||
m_modeHeight.reset(new CEditWidget(WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_LEFT | ES_NUMBER, m_hwnd));
|
||||
m_modeRefresh.reset(new CEditWidget(WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_LEFT | ES_NUMBER, m_hwnd));
|
||||
|
||||
m_modeUpdate.reset(new CButton(L"Save", WS_CHILD | WS_VISIBLE, m_hwnd));
|
||||
m_modeDelete.reset(new CButton(L"Delete", WS_CHILD | WS_VISIBLE, m_hwnd));
|
||||
m_modeUpdate.reset(new CButton(L"Save", WS_CHILD | WS_VISIBLE | WS_TABSTOP, m_hwnd));
|
||||
m_modeDelete.reset(new CButton(L"Delete", WS_CHILD | WS_VISIBLE | WS_TABSTOP, m_hwnd));
|
||||
EnableWindow(*m_modeUpdate, FALSE);
|
||||
EnableWindow(*m_modeDelete, FALSE);
|
||||
|
||||
m_autosizeGroup.reset(new CGroupBox(L"Autosizing", WS_CHILD | WS_VISIBLE, m_hwnd));
|
||||
m_defRefreshLabel.reset(new CStaticWidget(L"Default refresh:", WS_CHILD | WS_VISIBLE | SS_CENTERIMAGE, m_hwnd));
|
||||
m_defRefresh.reset(new CEditWidget(WS_CHILD | WS_VISIBLE | ES_LEFT | ES_NUMBER | WS_TABSTOP, m_hwnd));
|
||||
m_defRefreshHz.reset(new CStaticWidget(L"Hz", WS_CHILD | WS_VISIBLE | SS_CENTERIMAGE, m_hwnd));
|
||||
|
||||
RECT client = { 0, 0, (LONG)(436 * m_scale), (LONG)(300 * m_scale) };
|
||||
AdjustWindowRect(&client, WS_OVERLAPPEDWINDOW, FALSE);
|
||||
SetWindowPos(m_hwnd, NULL, 0, 0, client.right - client.left, client.bottom - client.top, SWP_NOMOVE | SWP_NOZORDER);
|
||||
|
||||
updateFont();
|
||||
|
||||
return 0;
|
||||
@@ -135,6 +145,7 @@ LRESULT CConfigWindow::onResize(DWORD width, DWORD height)
|
||||
{
|
||||
WidgetPositioner pos(m_scale, width, height);
|
||||
pos.pinTopLeftRight(*m_version, 12, 12, 12, 20);
|
||||
|
||||
pos.pinLeftTopBottom(*m_modeGroup, 12, 40, 200, 12);
|
||||
pos.pinLeftTopBottom(*m_modeBox, 24, 64, 176, 120);
|
||||
pos.pinBottomLeft(*m_widthLabel, 24, 96, 50, 20);
|
||||
@@ -145,6 +156,11 @@ LRESULT CConfigWindow::onResize(DWORD width, DWORD height)
|
||||
pos.pinBottomLeft(*m_modeRefresh, 75, 48, 50, 20);
|
||||
pos.pinBottomLeft(*m_modeUpdate, 24, 20, 50, 24);
|
||||
pos.pinBottomLeft(*m_modeDelete, 75, 20, 50, 24);
|
||||
|
||||
pos.pinTopLeft(*m_autosizeGroup, 224, 40, 200, 52);
|
||||
pos.pinTopLeft(*m_defRefreshLabel, 236, 64, 95, 20);
|
||||
pos.pinTopLeft(*m_defRefresh, 331, 64, 63, 20);
|
||||
pos.pinTopLeft(*m_defRefreshHz, 398, 64, 16, 20);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,11 @@ class CConfigWindow : public CWindow
|
||||
std::unique_ptr<CButton> m_modeUpdate;
|
||||
std::unique_ptr<CButton> m_modeDelete;
|
||||
|
||||
std::unique_ptr<CGroupBox> m_autosizeGroup;
|
||||
std::unique_ptr<CStaticWidget> m_defRefreshLabel;
|
||||
std::unique_ptr<CEditWidget> m_defRefresh;
|
||||
std::unique_ptr<CStaticWidget> m_defRefreshHz;
|
||||
|
||||
std::function<void()> m_onDestroy;
|
||||
double m_scale;
|
||||
Microsoft::WRL::Wrappers::HandleT<FontTraits> m_font;
|
||||
|
||||
@@ -51,6 +51,7 @@ LRESULT CNotifyWindow::handleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
case WM_NOTIFY_ICON:
|
||||
return onNotifyIcon(LOWORD(lParam), HIWORD(lParam), GET_X_LPARAM(wParam), GET_Y_LPARAM(wParam));
|
||||
|
||||
case WM_CLEAN_UP_CONFIG:
|
||||
if (m_config && !m_config->hwnd())
|
||||
{
|
||||
@@ -58,6 +59,7 @@ LRESULT CNotifyWindow::handleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
m_config.reset();
|
||||
}
|
||||
return 0;
|
||||
|
||||
default:
|
||||
if (s_taskbarCreated && uMsg == s_taskbarCreated)
|
||||
{
|
||||
@@ -70,6 +72,9 @@ LRESULT CNotifyWindow::handleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
LRESULT CNotifyWindow::onCreate()
|
||||
{
|
||||
// Allow explorer to send us this message to register the notification icon.
|
||||
ChangeWindowMessageFilterEx(m_hwnd, s_taskbarCreated, MSGFLT_ALLOW, NULL);
|
||||
|
||||
registerIcon();
|
||||
return 0;
|
||||
}
|
||||
@@ -129,12 +134,20 @@ void CNotifyWindow::registerIcon()
|
||||
StringCbCopy(m_iconData.szTip, sizeof m_iconData.szTip, L"Looking Glass (IDD)");
|
||||
|
||||
if (!Shell_NotifyIcon(NIM_ADD, &m_iconData))
|
||||
{
|
||||
DEBUG_ERROR_HR(GetLastError(), "Shell_NotifyIcon(NIM_ADD)");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Shell_NotifyIcon(NIM_SETVERSION, &m_iconData))
|
||||
DEBUG_ERROR_HR(GetLastError(), "Shell_NotifyIcon(NIM_SETVERSION)");
|
||||
}
|
||||
|
||||
HWND CNotifyWindow::hwndDialog()
|
||||
{
|
||||
return m_config ? m_config->hwnd() : nullptr;
|
||||
}
|
||||
|
||||
void CNotifyWindow::close()
|
||||
{
|
||||
closeRequested = true;
|
||||
|
||||
@@ -28,5 +28,6 @@ public:
|
||||
~CNotifyWindow() override;
|
||||
static bool registerClass();
|
||||
|
||||
HWND hwndDialog();
|
||||
void close();
|
||||
};
|
||||
|
||||
@@ -105,8 +105,12 @@ int WINAPI WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _
|
||||
MSG msg;
|
||||
while (GetMessage(&msg, NULL, 0, 0) > 0)
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
HWND hDlg = window.hwndDialog();
|
||||
if (!hDlg || !IsDialogMessage(hDlg, &msg))
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
}
|
||||
|
||||
(void) UnregisterWait(hWait);
|
||||
|
||||
Reference in New Issue
Block a user