Skip to content

Commit e157952

Browse files
committed
improve
1 parent 5a80fe2 commit e157952

File tree

4 files changed

+20
-10
lines changed

4 files changed

+20
-10
lines changed

XgDictList.cpp

+17-7
Original file line numberDiff line numberDiff line change
@@ -67,37 +67,43 @@ void XgDictList_ReloadList(HWND hwnd)
6767
INT iItem = 0;
6868
for (auto& entry : xg_dicts) {
6969
LV_ITEMW item = { LVIF_TEXT };
70+
71+
// リストビューに一行追加する。列「ファイル名」のテキストを設定。
7072
item.pszText = const_cast<LPWSTR>(PathFindFileNameW(entry.m_filename.c_str()));
7173
item.iItem = iItem;
7274
item.iSubItem = 0;
7375
ListView_InsertItem(hwndLst1, &item);
7476

77+
// 列「表示名」のテキストを設定。
7578
item.iItem = iItem;
7679
item.iSubItem = 1;
7780
item.pszText = const_cast<LPWSTR>(entry.m_friendly_name.c_str());
7881
ListView_SetItem(hwndLst1, &item);
7982

83+
// ファイルの更新日時を取得するために、FindFirstFile関数を使う。
8084
WIN32_FIND_DATAW find;
8185
HANDLE hFind = ::FindFirstFileW(entry.m_filename.c_str(), &find);
8286
::FindClose(hFind);
8387

88+
// 更新日時に従って文字列を構築する。
8489
WCHAR szText[32];
85-
item.iItem = iItem;
86-
item.iSubItem = 2;
90+
FILETIME ftLocal;
91+
SYSTEMTIME st;
8792
if (hFind == INVALID_HANDLE_VALUE)
8893
{
8994
StringCchCopyW(szText, _countof(szText), L"N/A");
9095
}
9196
else
9297
{
93-
FILETIME ftLocal;
9498
::FileTimeToLocalFileTime(&find.ftLastWriteTime, &ftLocal);
95-
SYSTEMTIME st;
9699
::FileTimeToSystemTime(&ftLocal, &st);
97100
StringCchPrintfW(szText, _countof(szText), L"%04d-%02d-%02d %02d:%02d",
98101
st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute);
99-
item.pszText = szText;
100102
}
103+
104+
// 列「更新日時」のテキストを設定。
105+
item.iItem = iItem;
106+
item.iSubItem = 2;
101107
item.pszText = szText;
102108
ListView_SetItem(hwndLst1, &item);
103109

@@ -171,17 +177,21 @@ XgDictListDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
171177
ListView_SetExtendedListViewStyle(hwndLst1,
172178
LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_CHECKBOXES);
173179

174-
// 辞書リストのヘッダーを初期化
180+
// 辞書リストのヘッダーの初期化を開始
175181
LV_COLUMNW column = { LVCF_TEXT | LVCF_WIDTH };
182+
183+
// ファイル名。
176184
column.pszText = XgLoadStringDx1(IDS_FILENAME);
177185
column.cx = 200;
178186
ListView_InsertColumn(hwndLst1, 0, &column);
179187

188+
// 表示名。
180189
column.pszText = XgLoadStringDx1(IDS_DISPLAYNAME);
181190
column.cx = 250;
182191
ListView_InsertColumn(hwndLst1, 1, &column);
183192

184-
column.pszText = XgLoadStringDx1(IDS_UPDATEDDATE);
193+
// 更新日時。
194+
column.pszText = XgLoadStringDx1(IDS_UPDATEDTIME);
185195
column.cx = 125;
186196
ListView_InsertColumn(hwndLst1, 2, &column);
187197

lang/en_US.rc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1824,7 +1824,7 @@ STRINGTABLE
18241824
IDS_FITWHOLE, "Fit whole"
18251825
IDS_FILENAME, "Filename"
18261826
IDS_DISPLAYNAME, "Display Name"
1827-
IDS_UPDATEDDATE, "Updated Date"
1827+
IDS_UPDATEDTIME, "Updated Time"
18281828
IDS_TT_NEW, "New crossword"
18291829
IDS_TT_GENERATE, "Generate crossword"
18301830
IDS_TT_OPEN, "Open crossword"

lang/ja_JP.rc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1828,7 +1828,7 @@ STRINGTABLE
18281828
IDS_FITWHOLE, "全体に合わせる"
18291829
IDS_FILENAME, "ファイル名"
18301830
IDS_DISPLAYNAME, "表示名"
1831-
IDS_UPDATEDDATE, "更新日"
1831+
IDS_UPDATEDTIME, "更新日時"
18321832
IDS_TT_NEW, "新規作成"
18331833
IDS_TT_GENERATE, "問題を自動生成する"
18341834
IDS_TT_OPEN, "問題を開く"

resource.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@
254254
#define IDS_FITWHOLE 331
255255
#define IDS_FILENAME 332
256256
#define IDS_DISPLAYNAME 333
257-
#define IDS_UPDATEDDATE 334
257+
#define IDS_UPDATEDTIME 334
258258
#define IDS_TT_NEW 10100
259259
#define IDS_TT_GENERATE 10101
260260
#define IDS_TT_OPEN 10102

0 commit comments

Comments
 (0)