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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
|
// OptionsDialog.cpp
#include "StdAfx.h"
#include "Windows/Control/Dialog.h"
#include "Windows/Control/PropertyPage.h"
#include "DialogSize.h"
#include "EditPage.h"
#include "EditPageRes.h"
#include "FoldersPage.h"
#include "FoldersPageRes.h"
#include "LangPage.h"
#include "LangPageRes.h"
#include "MenuPage.h"
#include "MenuPageRes.h"
// #include "PluginsPage.h"
// #include "PluginsPageRes.h"
#include "SettingsPage.h"
#include "SettingsPageRes.h"
#include "SystemPage.h"
#include "SystemPageRes.h"
#include "App.h"
#include "LangUtils.h"
#include "MyLoadMenu.h"
#include "ProgramLocation.h"
#include "resource.h"
using namespace NWindows;
#ifndef UNDER_CE
typedef UINT32 (WINAPI * DllRegisterServerPtr)();
extern HWND g_MenuPageHWND;
static void ShowMenuErrorMessage(const wchar_t *m)
{
MessageBoxW(g_MenuPageHWND, m, L"7-Zip", MB_ICONERROR);
}
static int DllRegisterServer2(const char *name)
{
NWindows::NDLL::CLibrary lib;
UString prefix;
GetProgramFolderPath(prefix);
if (!lib.Load(prefix + L"7-zip.dll"))
{
ShowMenuErrorMessage(L"7-Zip cannot load 7-zip.dll");
return E_FAIL;
}
DllRegisterServerPtr f = (DllRegisterServerPtr)lib.GetProc(name);
if (f == NULL)
{
ShowMenuErrorMessage(L"Incorrect plugin");
return E_FAIL;
}
HRESULT res = f();
if (res != S_OK)
ShowMenuErrorMessage(HResultToMessage(res));
return (int)res;
}
STDAPI DllRegisterServer(void)
{
#ifdef UNDER_CE
return S_OK;
#else
return DllRegisterServer2("DllRegisterServer");
#endif
}
STDAPI DllUnregisterServer(void)
{
#ifdef UNDER_CE
return S_OK;
#else
return DllRegisterServer2("DllUnregisterServer");
#endif
}
#endif
void OptionsDialog(HWND hwndOwner, HINSTANCE /* hInstance */)
{
CSystemPage systemPage;
// CPluginsPage pluginsPage;
CEditPage editPage;
CSettingsPage settingsPage;
CLangPage langPage;
CMenuPage menuPage;
CFoldersPage foldersPage;
CObjectVector<NControl::CPageInfo> pages;
UINT32 langIDs[] = { 0x03010300,
// 0x03010100,
0xFFFFFFFF,
0x01000200, 0x03010200, 0x03010400, 0x01000400};
BIG_DIALOG_SIZE(200, 200);
UINT pageIDs[] = {
SIZED_DIALOG(IDD_SYSTEM),
// IDD_PLUGINS,
SIZED_DIALOG(IDD_MENU),
SIZED_DIALOG(IDD_FOLDERS),
SIZED_DIALOG(IDD_EDIT),
SIZED_DIALOG(IDD_SETTINGS),
SIZED_DIALOG(IDD_LANG) };
NControl::CPropertyPage *pagePinters[] = { &systemPage, &menuPage, &foldersPage, &editPage, &settingsPage, &langPage };
const int kNumPages = sizeof(langIDs) / sizeof(langIDs[0]);
for (int i = 0; i < kNumPages; i++)
{
NControl::CPageInfo page;
page.Title = LangString(langIDs[i]);
page.ID = pageIDs[i];
page.Page = pagePinters[i];
pages.Add(page);
}
INT_PTR res = NControl::MyPropertySheet(pages, hwndOwner, LangString(IDS_OPTIONS, 0x03010000));
if (res != -1 && res != 0)
{
if (langPage.LangWasChanged)
{
g_App._window.SetText(LangString(IDS_APP_TITLE, 0x03000000));
MyLoadMenu();
g_App.ReloadToolbars();
g_App.MoveSubWindows();
}
/*
if (systemPage.WasChanged)
{
// probably it doesn't work, since image list is locked?
g_App.SysIconsWereChanged();
}
*/
g_App.SetListSettings();
g_App.SetShowSystemMenu();
g_App.RefreshAllPanels();
// ::PostMessage(hwndOwner, kLangWasChangedMessage, 0 , 0);
}
}
|