blob: 0bf6aae74af3485e61bbe74dfad27dabb9cb83cb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
// SystemPage.h
#ifndef __SYSTEM_PAGE_H
#define __SYSTEM_PAGE_H
#include "../../../Windows/Control/ImageList.h"
#include "../../../Windows/Control/ListView.h"
#include "../../../Windows/Control/PropertyPage.h"
#include "FilePlugins.h"
#include "RegistryAssociations.h"
enum EExtState
{
kExtState_Clear = 0,
kExtState_Other,
kExtState_7Zip
};
struct CModifiedExtInfo: public NRegistryAssoc::CShellExtInfo
{
int OldState;
int State;
int ImageIndex;
bool Other;
bool Other7Zip;
CModifiedExtInfo(): ImageIndex(-1) {}
CSysString GetString() const;
void SetState(const UString &iconPath)
{
State = kExtState_Clear;
Other = false;
Other7Zip = false;
if (!ProgramKey.IsEmpty())
{
State = kExtState_Other;
Other = true;
if (IsIt7Zip())
{
Other7Zip = !iconPath.IsEqualToNoCase(IconPath);
if (!Other7Zip)
{
State = kExtState_7Zip;
Other = false;
}
}
}
OldState = State;
};
};
struct CAssoc
{
CModifiedExtInfo Pair[2];
int SevenZipImageIndex;
int GetIconIndex() const
{
for (int i = 0; i < 2; i++)
{
const CModifiedExtInfo &pair = Pair[i];
if (pair.State == kExtState_Clear)
continue;
if (pair.State == kExtState_7Zip)
return SevenZipImageIndex;
if (pair.ImageIndex != -1)
return pair.ImageIndex;
}
return -1;
}
};
#ifdef UNDER_CE
#define NUM_EXT_GROUPS 1
#else
#define NUM_EXT_GROUPS 2
#endif
class CSystemPage: public NWindows::NControl::CPropertyPage
{
CExtDatabase _extDB;
CObjectVector<CAssoc> _items;
int _numIcons;
NWindows::NControl::CImageList _imageList;
NWindows::NControl::CListView _listView;
const HKEY GetHKey(int
#if NUM_EXT_GROUPS != 1
group
#endif
) const
{
#if NUM_EXT_GROUPS == 1
return HKEY_CLASSES_ROOT;
#else
return group == 0 ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE;
#endif
}
int AddIcon(const UString &path, int iconIndex);
int GetRealIndex(int listIndex) const { return listIndex; }
void RefreshListItem(int group, int listIndex);
void ChangeState(int group, const CIntVector &indices);
void ChangeState(int group);
bool OnListKeyDown(LPNMLVKEYDOWN keyDownInfo);
public:
bool WasChanged;
CSystemPage(): WasChanged(false) {}
virtual bool OnInit();
virtual void OnNotifyHelp();
virtual bool OnNotify(UINT controlID, LPNMHDR lParam);
virtual LONG OnApply();
virtual bool OnButtonClicked(int buttonID, HWND buttonHWND);
};
#endif
|