aboutsummaryrefslogtreecommitdiff
path: root/CPP/7zip/UI/FileManager/SystemPage.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--CPP/7zip/UI/FileManager/SystemPage.cpp36
1 files changed, 22 insertions, 14 deletions
diff --git a/CPP/7zip/UI/FileManager/SystemPage.cpp b/CPP/7zip/UI/FileManager/SystemPage.cpp
index a95999f..09d8a72 100644
--- a/CPP/7zip/UI/FileManager/SystemPage.cpp
+++ b/CPP/7zip/UI/FileManager/SystemPage.cpp
@@ -4,7 +4,11 @@
4 4
5#include "../../../Common/MyWindows.h" 5#include "../../../Common/MyWindows.h"
6 6
7#if defined(__MINGW32__) || defined(__MINGW64__)
8#include <shlobj.h>
9#else
7#include <ShlObj.h> 10#include <ShlObj.h>
11#endif
8 12
9#include "../../../Common/Defs.h" 13#include "../../../Common/Defs.h"
10#include "../../../Common/StringConvert.h" 14#include "../../../Common/StringConvert.h"
@@ -25,10 +29,12 @@ using namespace NWindows;
25extern bool g_IsNT; 29extern bool g_IsNT;
26#endif 30#endif
27 31
32#ifdef Z7_LANG
28static const UInt32 kLangIDs[] = 33static const UInt32 kLangIDs[] =
29{ 34{
30 IDT_SYSTEM_ASSOCIATE 35 IDT_SYSTEM_ASSOCIATE
31}; 36};
37#endif
32 38
33#define kSystemTopic "FM/options.htm#system" 39#define kSystemTopic "FM/options.htm#system"
34 40
@@ -44,7 +50,7 @@ CSysString CModifiedExtInfo::GetString() const
44 else 50 else
45 return ProgramKey; 51 return ProgramKey;
46 return CSysString (s); 52 return CSysString (s);
47}; 53}
48 54
49 55
50int CSystemPage::AddIcon(const UString &iconPath, int iconIndex) 56int CSystemPage::AddIcon(const UString &iconPath, int iconIndex)
@@ -62,19 +68,19 @@ int CSystemPage::AddIcon(const UString &iconPath, int iconIndex)
62 #else 68 #else
63 // we expand path from REG_EXPAND_SZ registry item. 69 // we expand path from REG_EXPAND_SZ registry item.
64 UString path; 70 UString path;
65 DWORD size = MAX_PATH + 10; 71 const DWORD size = MAX_PATH + 10;
66 DWORD needLen = ::ExpandEnvironmentStringsW(iconPath, path.GetBuf(size + 2), size); 72 const DWORD needLen = ::ExpandEnvironmentStringsW(iconPath, path.GetBuf(size + 2), size);
67 path.ReleaseBuf_CalcLen(size); 73 path.ReleaseBuf_CalcLen(size);
68 if (needLen == 0 || needLen >= size) 74 if (needLen == 0 || needLen >= size)
69 path = iconPath; 75 path = iconPath;
70 int num = ExtractIconExW(path, iconIndex, NULL, &hicon, 1); 76 const UINT num = ExtractIconExW(path, iconIndex, NULL, &hicon, 1);
71 if (num != 1 || !hicon) 77 if (num != 1 || !hicon)
72 #endif 78 #endif
73 return -1; 79 return -1;
74 80
75 _imageList.AddIcon(hicon); 81 _imageList.AddIcon(hicon);
76 DestroyIcon(hicon); 82 DestroyIcon(hicon);
77 return _numIcons++; 83 return (int)(_numIcons++);
78} 84}
79 85
80 86
@@ -84,7 +90,7 @@ void CSystemPage::RefreshListItem(unsigned group, unsigned listIndex)
84 _listView.SetSubItem(listIndex, group + 1, assoc.Pair[group].GetString()); 90 _listView.SetSubItem(listIndex, group + 1, assoc.Pair[group].GetString());
85 LVITEMW newItem; 91 LVITEMW newItem;
86 memset(&newItem, 0, sizeof(newItem)); 92 memset(&newItem, 0, sizeof(newItem));
87 newItem.iItem = listIndex; 93 newItem.iItem = (int)listIndex;
88 newItem.mask = LVIF_IMAGE; 94 newItem.mask = LVIF_IMAGE;
89 newItem.iImage = assoc.GetIconIndex(); 95 newItem.iImage = assoc.GetIconIndex();
90 _listView.SetItem(&newItem); 96 _listView.SetItem(&newItem);
@@ -151,7 +157,9 @@ bool CSystemPage::OnInit()
151{ 157{
152 _needSave = false; 158 _needSave = false;
153 159
154 LangSetDlgItems(*this, kLangIDs, ARRAY_SIZE(kLangIDs)); 160#ifdef Z7_LANG
161 LangSetDlgItems(*this, kLangIDs, Z7_ARRAY_SIZE(kLangIDs));
162#endif
155 163
156 _listView.Attach(GetItem(IDL_SYSTEM_ASSOCIATE)); 164 _listView.Attach(GetItem(IDL_SYSTEM_ASSOCIATE));
157 _listView.SetUnicodeFormat(); 165 _listView.SetUnicodeFormat();
@@ -221,9 +229,9 @@ bool CSystemPage::OnInit()
221 const CExtPlugins &extInfo = _extDB.Exts[i]; 229 const CExtPlugins &extInfo = _extDB.Exts[i];
222 230
223 LVITEMW item; 231 LVITEMW item;
224 item.iItem = i; 232 item.iItem = (int)i;
225 item.mask = LVIF_TEXT | LVIF_PARAM | LVIF_IMAGE; 233 item.mask = LVIF_TEXT | LVIF_PARAM | LVIF_IMAGE;
226 item.lParam = i; 234 item.lParam = (LPARAM)i;
227 item.iSubItem = 0; 235 item.iSubItem = 0;
228 // ListView always uses internal iImage that is 0 by default? 236 // ListView always uses internal iImage that is 0 by default?
229 // so we always use LVIF_IMAGE. 237 // so we always use LVIF_IMAGE.
@@ -245,9 +253,9 @@ bool CSystemPage::OnInit()
245 texts[g] = mi.GetString(); 253 texts[g] = mi.GetString();
246 } 254 }
247 item.iImage = assoc.GetIconIndex(); 255 item.iImage = assoc.GetIconIndex();
248 int itemIndex = _listView.InsertItem(&item); 256 const int itemIndex = _listView.InsertItem(&item);
249 for (g = 0; g < NUM_EXT_GROUPS; g++) 257 for (g = 0; g < NUM_EXT_GROUPS; g++)
250 _listView.SetSubItem(itemIndex, 1 + g, texts[g]); 258 _listView.SetSubItem((unsigned)itemIndex, 1 + g, texts[g]);
251 _items.Add(assoc); 259 _items.Add(assoc);
252 } 260 }
253 261
@@ -334,7 +342,7 @@ void CSystemPage::OnNotifyHelp()
334} 342}
335 343
336 344
337bool CSystemPage::OnButtonClicked(int buttonID, HWND buttonHWND) 345bool CSystemPage::OnButtonClicked(unsigned buttonID, HWND buttonHWND)
338{ 346{
339 switch (buttonID) 347 switch (buttonID)
340 { 348 {
@@ -379,7 +387,7 @@ bool CSystemPage::OnNotify(UINT controlID, LPNMHDR lParam)
379 if (item->iSubItem >= 1 && item->iSubItem <= 2) 387 if (item->iSubItem >= 1 && item->iSubItem <= 2)
380 { 388 {
381 CUIntVector indices; 389 CUIntVector indices;
382 indices.Add(item->iItem); 390 indices.Add((unsigned)item->iItem);
383 ChangeState(item->iSubItem < 2 ? 0 : 1, indices); 391 ChangeState(item->iSubItem < 2 ? 0 : 1, indices);
384 } 392 }
385 } 393 }
@@ -414,7 +422,7 @@ void CSystemPage::ChangeState(unsigned group)
414 422
415 int itemIndex = -1; 423 int itemIndex = -1;
416 while ((itemIndex = _listView.GetNextSelectedItem(itemIndex)) != -1) 424 while ((itemIndex = _listView.GetNextSelectedItem(itemIndex)) != -1)
417 indices.Add(itemIndex); 425 indices.Add((unsigned)itemIndex);
418 426
419 if (indices.IsEmpty()) 427 if (indices.IsEmpty())
420 FOR_VECTOR (i, _items) 428 FOR_VECTOR (i, _items)