1 // OptionsDialog.cpp
2
3 #include "StdAfx.h"
4
5 #include "../../../Windows/Control/Dialog.h"
6 #include "../../../Windows/Control/PropertyPage.h"
7
8 #include "DialogSize.h"
9
10 #include "EditPage.h"
11 #include "EditPageRes.h"
12 #include "FoldersPage.h"
13 #include "FoldersPageRes.h"
14 #include "LangPage.h"
15 #include "LangPageRes.h"
16 #include "MenuPage.h"
17 #include "MenuPageRes.h"
18 #include "SettingsPage.h"
19 #include "SettingsPageRes.h"
20 #include "SystemPage.h"
21 #include "SystemPageRes.h"
22
23 #include "App.h"
24 #include "LangUtils.h"
25 #include "MyLoadMenu.h"
26
27 #include "resource.h"
28
29 using namespace NWindows;
30
31 void OptionsDialog(HWND hwndOwner, HINSTANCE hInstance);
OptionsDialog(HWND hwndOwner,HINSTANCE)32 void OptionsDialog(HWND hwndOwner, HINSTANCE /* hInstance */)
33 {
34 CSystemPage systemPage;
35 CMenuPage menuPage;
36 CFoldersPage foldersPage;
37 CEditPage editPage;
38 CSettingsPage settingsPage;
39 CLangPage langPage;
40
41 CObjectVector<NControl::CPageInfo> pages;
42 BIG_DIALOG_SIZE(200, 200);
43
44 const UINT pageIDs[] = {
45 SIZED_DIALOG(IDD_SYSTEM),
46 SIZED_DIALOG(IDD_MENU),
47 SIZED_DIALOG(IDD_FOLDERS),
48 SIZED_DIALOG(IDD_EDIT),
49 SIZED_DIALOG(IDD_SETTINGS),
50 SIZED_DIALOG(IDD_LANG) };
51
52 NControl::CPropertyPage *pagePointers[] = { &systemPage, &menuPage, &foldersPage, &editPage, &settingsPage, &langPage };
53
54 for (unsigned i = 0; i < Z7_ARRAY_SIZE(pageIDs); i++)
55 {
56 NControl::CPageInfo &page = pages.AddNew();
57 page.ID = pageIDs[i];
58 #ifdef Z7_LANG
59 LangString_OnlyFromLangFile(page.ID, page.Title);
60 #endif
61 page.Page = pagePointers[i];
62 }
63
64 const INT_PTR res = NControl::MyPropertySheet(pages, hwndOwner, LangString(IDS_OPTIONS));
65
66 if (res != -1 && res != 0)
67 {
68 if (langPage.LangWasChanged)
69 {
70 // g_App._window.SetText(LangString(IDS_APP_TITLE, 0x03000000));
71 MyLoadMenu(true); // needResetMenu
72 g_App.ReloadToolbars();
73 g_App.MoveSubWindows(); // we need it to change list window aafter _toolBar.AutoSize();
74 g_App.ReloadLangItems();
75 }
76
77 /*
78 if (systemPage.WasChanged)
79 {
80 // probably it doesn't work, since image list is locked?
81 g_App.SysIconsWereChanged();
82 }
83 */
84
85 g_App.SetListSettings();
86 g_App.RefreshAllPanels();
87 // ::PostMessage(hwndOwner, kLangWasChangedMessage, 0 , 0);
88 }
89 }
90