https://git.reactos.org/?p=reactos.git;a=commitdiff;h=115cf65ebff4c3064967f…
commit 115cf65ebff4c3064967f18c138340bf0b770197
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Fri Mar 7 07:06:38 2025 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Fri Mar 7 07:06:38 2025 +0900
[EVENTVWR] Reduce lines (#7758)
JIRA issue: N/A
- Reduce lines in InitInstance function.
---
base/applications/mscutils/eventvwr/eventvwr.c | 84 +++++++-------------------
1 file changed, 22 insertions(+), 62 deletions(-)
diff --git a/base/applications/mscutils/eventvwr/eventvwr.c
b/base/applications/mscutils/eventvwr/eventvwr.c
index 4c674f7a7fa..3a7a5107eab 100644
--- a/base/applications/mscutils/eventvwr/eventvwr.c
+++ b/base/applications/mscutils/eventvwr/eventvwr.c
@@ -3037,6 +3037,22 @@ InitInstance(HINSTANCE hInstance)
HIMAGELIST hSmall;
LVCOLUMNW lvc = {0};
WCHAR szTemp[256];
+ INT iColumn;
+ static const struct
+ {
+ WORD width;
+ WORD uID;
+ } columnItems[] =
+ {
+ { 90, IDS_COLUMNTYPE },
+ { 70, IDS_COLUMNDATE },
+ { 70, IDS_COLUMNTIME },
+ { 150, IDS_COLUMNSOURCE },
+ { 100, IDS_COLUMNCATEGORY },
+ { 60, IDS_COLUMNEVENT },
+ { 120, IDS_COLUMNUSER },
+ { 100, IDS_COLUMNCOMPUTER },
+ };
/* Create the main window */
rs = Settings.wpPos.rcNormalPosition;
@@ -3180,69 +3196,13 @@ InitInstance(HINSTANCE hInstance)
/* Now set up the listview with its columns */
lvc.mask = LVCF_TEXT | LVCF_WIDTH;
- lvc.cx = 90;
- LoadStringW(hInstance,
- IDS_COLUMNTYPE,
- szTemp,
- ARRAYSIZE(szTemp));
- lvc.pszText = szTemp;
- ListView_InsertColumn(hwndListView, 0, &lvc);
-
- lvc.cx = 70;
- LoadStringW(hInstance,
- IDS_COLUMNDATE,
- szTemp,
- ARRAYSIZE(szTemp));
- lvc.pszText = szTemp;
- ListView_InsertColumn(hwndListView, 1, &lvc);
-
- lvc.cx = 70;
- LoadStringW(hInstance,
- IDS_COLUMNTIME,
- szTemp,
- ARRAYSIZE(szTemp));
- lvc.pszText = szTemp;
- ListView_InsertColumn(hwndListView, 2, &lvc);
-
- lvc.cx = 150;
- LoadStringW(hInstance,
- IDS_COLUMNSOURCE,
- szTemp,
- ARRAYSIZE(szTemp));
- lvc.pszText = szTemp;
- ListView_InsertColumn(hwndListView, 3, &lvc);
-
- lvc.cx = 100;
- LoadStringW(hInstance,
- IDS_COLUMNCATEGORY,
- szTemp,
- ARRAYSIZE(szTemp));
- lvc.pszText = szTemp;
- ListView_InsertColumn(hwndListView, 4, &lvc);
-
- lvc.cx = 60;
- LoadStringW(hInstance,
- IDS_COLUMNEVENT,
- szTemp,
- ARRAYSIZE(szTemp));
- lvc.pszText = szTemp;
- ListView_InsertColumn(hwndListView, 5, &lvc);
-
- lvc.cx = 120;
- LoadStringW(hInstance,
- IDS_COLUMNUSER,
- szTemp,
- ARRAYSIZE(szTemp));
lvc.pszText = szTemp;
- ListView_InsertColumn(hwndListView, 6, &lvc);
-
- lvc.cx = 100;
- LoadStringW(hInstance,
- IDS_COLUMNCOMPUTER,
- szTemp,
- ARRAYSIZE(szTemp));
- lvc.pszText = szTemp;
- ListView_InsertColumn(hwndListView, 7, &lvc);
+ for (iColumn = 0; iColumn < ARRAYSIZE(columnItems); ++iColumn)
+ {
+ lvc.cx = columnItems[iColumn].width;
+ LoadStringW(hInstance, columnItems[iColumn].uID, szTemp, ARRAYSIZE(szTemp));
+ ListView_InsertColumn(hwndListView, iColumn, &lvc);
+ }
/* Initialize the save Dialog */
ZeroMemory(&sfn, sizeof(sfn));