diff --git a/Language/Resource.rc b/Language/Resource.rc index 6c8a651a..128742eb 100644 --- a/Language/Resource.rc +++ b/Language/Resource.rc @@ -169,4 +169,5 @@ STRINGTABLE ID_STR_SHOWNOTIFICATIONAREAICON, "Show notification area icon" ID_STR_SOURCE, "Source" ID_STR_USED2D, "Use D2D rendering" + ID_STR_CLEAR, "Clear" } diff --git a/Library/DialogAbout.cpp b/Library/DialogAbout.cpp index 53fa7255..7f810092 100644 --- a/Library/DialogAbout.cpp +++ b/Library/DialogAbout.cpp @@ -340,6 +340,9 @@ void DialogAbout::TabLog::Create(HWND owner) { Tab::CreateTabWindow(15, 30, 370, 148, owner); + // FIXME: Temporary hack. + short buttonWidth = (short)_wtoi(GetString(ID_STR_NUM_BUTTONWIDTH)); + static const ControlTemplate::Control s_Controls[] = { CT_LISTVIEW(Id_ItemsListView, 0, @@ -356,6 +359,9 @@ void DialogAbout::TabLog::Create(HWND owner) WS_VISIBLE | WS_TABSTOP, 0), CT_CHECKBOX(Id_DebugCheckBox, ID_STR_DEBUG, 210, 139, 70, 9, + WS_VISIBLE | WS_TABSTOP, 0), + CT_BUTTON(Id_ClearButton, ID_STR_CLEAR, + (368 - buttonWidth), 139, buttonWidth, 14, WS_VISIBLE | WS_TABSTOP, 0) }; @@ -442,23 +448,32 @@ void DialogAbout::TabLog::Resize(int w, int h) { SetWindowPos(m_Window, nullptr, 0, 0, w, h, SWP_NOMOVE | SWP_NOZORDER); - RECT r; - HWND item = GetControl(Id_ErrorCheckBox); - GetClientRect(item, &r); + // FIXME: Temporary hack. + short buttonWidth = (short)_wtoi(GetString(ID_STR_NUM_BUTTONWIDTH)); - SetWindowPos(item, nullptr, 0, h - r.bottom, 0, 0, SWP_NOSIZE | SWP_NOZORDER); + RECT r; + LONG bottom; + HWND item = GetControl(Id_ClearButton); + GetClientRect(item, &r); + bottom = r.bottom; + + SetWindowPos(item, nullptr, w - r.right, h - bottom, 0, 0, SWP_NOSIZE | SWP_NOZORDER); + + item = GetControl(Id_ErrorCheckBox); + GetClientRect(item, &r); + SetWindowPos(item, nullptr, 0, h - bottom, 0, 0, SWP_NOSIZE | SWP_NOZORDER); item = GetControl(Id_WarningCheckBox); - SetWindowPos(item, nullptr, r.right, h - r.bottom, 0, 0, SWP_NOSIZE | SWP_NOZORDER); + SetWindowPos(item, nullptr, r.right, h - bottom, 0, 0, SWP_NOSIZE | SWP_NOZORDER); item = GetControl(Id_NoticeCheckBox); - SetWindowPos(item, nullptr, r.right * 2, h - r.bottom, 0, 0, SWP_NOSIZE | SWP_NOZORDER); + SetWindowPos(item, nullptr, r.right * 2, h - bottom, 0, 0, SWP_NOSIZE | SWP_NOZORDER); item = GetControl(Id_DebugCheckBox); - SetWindowPos(item, nullptr, r.right * 3, h - r.bottom, 0, 0, SWP_NOSIZE | SWP_NOZORDER); + SetWindowPos(item, nullptr, r.right * 3, h - bottom, 0, 0, SWP_NOSIZE | SWP_NOZORDER); item = GetControl(Id_ItemsListView); - SetWindowPos(item, nullptr, 0, 0, w, h - r.bottom - 7, SWP_NOMOVE | SWP_NOZORDER); + SetWindowPos(item, nullptr, 0, 0, w, h - bottom - 10, SWP_NOMOVE | SWP_NOZORDER); // Adjust 4th colum LVCOLUMN lvc; @@ -569,6 +584,14 @@ INT_PTR DialogAbout::TabLog::OnCommand(WPARAM wParam, LPARAM lParam) } break; + case Id_ClearButton: + if (HIWORD(wParam) == BN_CLICKED) + { + HWND item = GetControl(Id_ItemsListView); + ListView_DeleteAllItems(item); + } + break; + default: return 1; } diff --git a/Library/DialogAbout.h b/Library/DialogAbout.h index 7ca476ab..6dd16192 100644 --- a/Library/DialogAbout.h +++ b/Library/DialogAbout.h @@ -56,7 +56,8 @@ private: Id_ErrorCheckBox, Id_WarningCheckBox, Id_NoticeCheckBox, - Id_DebugCheckBox + Id_DebugCheckBox, + Id_ClearButton }; TabLog(); diff --git a/Library/resource.h b/Library/resource.h index 10eb989d..0d4d0484 100644 --- a/Library/resource.h +++ b/Library/resource.h @@ -149,6 +149,7 @@ #define ID_STR_SHOWNOTIFICATIONAREAICON 2138 #define ID_STR_SOURCE 2139 #define ID_STR_USED2D 2140 +#define ID_STR_CLEAR 2141 #define IDM_REFRESH 4001 #define IDM_QUIT 4002