Dim loader buttons while installing
This commit is contained in:
1 parent
d8f4cb691b
commit
c9f01a52c1
4 files changed
+43
-10
No files matched your search
@@ -38,6 +38,8 @@ build\Release\Change_BootLoader.exe
|
||||
- Интерфейс совпадает с AutoIt-версией (376×208, те же шрифты, позиции,
|
||||
цвета наведения и нажатия).
|
||||
- Диалоги — нативный `MessageBoxW` с теми же заголовками и текстами.
|
||||
- Пока идёт установка загрузчика, все кнопки затенены; кнопка
|
||||
устанавливаемого загрузчика остаётся чуть ярче.
|
||||
- Отладочный лог по умолчанию выключен. `PARAVIS_DEBUG_LOG=1` включает
|
||||
запись в `%TEMP%\cbl_cpp_debug.log`.
|
||||
- Действие «GRUB2 Legacy» использует те же команды bootice `/sectors`, что и
|
||||
|
||||
@@ -26,6 +26,7 @@ public:
|
||||
|
||||
bool busy = false;
|
||||
bool modal = false;
|
||||
int activeButton = -1;
|
||||
|
||||
bool minDown = false;
|
||||
bool closeDown = false;
|
||||
|
||||
@@ -28,6 +28,9 @@ void App::RunAction(int index)
|
||||
}
|
||||
|
||||
busy = true;
|
||||
activeButton = index;
|
||||
InvalidateRect(hwnd, nullptr, FALSE);
|
||||
UpdateWindow(hwnd);
|
||||
switch (index) {
|
||||
case 0:
|
||||
LegacyXor();
|
||||
@@ -54,6 +57,7 @@ void App::RunAction(int index)
|
||||
break;
|
||||
}
|
||||
busy = false;
|
||||
activeButton = -1;
|
||||
InvalidateRect(hwnd, nullptr, FALSE);
|
||||
}
|
||||
|
||||
|
||||
+36
-10
@@ -18,6 +18,12 @@ const DWORD CLR_BORDER = 0xBFC9D6;
|
||||
const DWORD CLR_HOVER = 0xE4EEFF;
|
||||
const DWORD CLR_PRESS = 0xCFE0FF;
|
||||
const DWORD CLR_TEXT = 0x14202E;
|
||||
const DWORD CLR_BUSY_BG = 0xE9ECF1;
|
||||
const DWORD CLR_BUSY_BORDER = 0xD5DAE2;
|
||||
const DWORD CLR_BUSY_TEXT = 0xA7AEBA;
|
||||
const DWORD CLR_ACTIVE_BG = 0xD8E4F8;
|
||||
const DWORD CLR_ACTIVE_BORDER = 0x9BB8E8;
|
||||
const DWORD CLR_ACTIVE_TEXT = 0x2E4A78;
|
||||
|
||||
const wchar_t* kButtonNames[7] = {
|
||||
L"XorBoot", L"Bootmgr", L"Grub4Dos", L"Grub2",
|
||||
@@ -239,11 +245,25 @@ void App::Paint(HDC dc)
|
||||
int bw = kButtonPos[i][2];
|
||||
int bh = kButtonPos[i][3];
|
||||
|
||||
FillRectColor(memory, x - 1, y - 1, bw + 2, bh + 2,
|
||||
ColorFromHex(CLR_BORDER));
|
||||
FillRectColor(memory, x, y, bw, bh, buttonBg[i]);
|
||||
COLORREF background = buttonBg[i];
|
||||
COLORREF border = ColorFromHex(CLR_BORDER);
|
||||
COLORREF text = ColorFromHex(CLR_TEXT);
|
||||
if (busy) {
|
||||
if (i == activeButton) {
|
||||
background = ColorFromHex(CLR_ACTIVE_BG);
|
||||
border = ColorFromHex(CLR_ACTIVE_BORDER);
|
||||
text = ColorFromHex(CLR_ACTIVE_TEXT);
|
||||
} else {
|
||||
background = ColorFromHex(CLR_BUSY_BG);
|
||||
border = ColorFromHex(CLR_BUSY_BORDER);
|
||||
text = ColorFromHex(CLR_BUSY_TEXT);
|
||||
}
|
||||
}
|
||||
|
||||
FillRectColor(memory, x - 1, y - 1, bw + 2, bh + 2, border);
|
||||
FillRectColor(memory, x, y, bw, bh, background);
|
||||
DrawTextRect(memory, kButtonNames[i], fontButton, x, y, bw, bh,
|
||||
ColorFromHex(CLR_TEXT), DT_CENTER | DT_VCENTER);
|
||||
text, DT_CENTER | DT_VCENTER);
|
||||
}
|
||||
|
||||
BitBlt(dc, 0, 0, w, h, memory, 0, 0, SRCCOPY);
|
||||
@@ -265,6 +285,18 @@ void App::OnPoll()
|
||||
ScreenToClient(hwnd, &client);
|
||||
HitResult hit = HitTest(client);
|
||||
|
||||
if (busy) {
|
||||
downButton = -1;
|
||||
for (int i = 0; i < 7; ++i) {
|
||||
buttonBg[i] = (i == activeButton) ? ColorFromHex(CLR_ACTIVE_BG)
|
||||
: ColorFromHex(CLR_BUSY_BG);
|
||||
}
|
||||
minBg = ColorFromHex(CLR_HEAD);
|
||||
closeBg = ColorFromHex(CLR_HEAD);
|
||||
InvalidateRect(hwnd, nullptr, FALSE);
|
||||
return;
|
||||
}
|
||||
|
||||
COLORREF minColor = ColorFromHex(CLR_HEAD);
|
||||
COLORREF closeColor = ColorFromHex(CLR_HEAD);
|
||||
if (hit.kind == HitKind::Min) {
|
||||
@@ -324,12 +356,6 @@ void App::OnPoll()
|
||||
buttonBg[i] = background;
|
||||
}
|
||||
|
||||
if (busy) {
|
||||
downButton = -1;
|
||||
InvalidateRect(hwnd, nullptr, FALSE);
|
||||
return;
|
||||
}
|
||||
|
||||
if (leftDown) {
|
||||
if (hit.kind == HitKind::Button) {
|
||||
downButton = hit.index;
|
||||
|
||||
Reference in new issue
Block a user