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 
OptionsDialog(HWND hwndOwner,HINSTANCE)31 void OptionsDialog(HWND hwndOwner, HINSTANCE /* hInstance */)
32 {
33   CSystemPage systemPage;
34   CMenuPage menuPage;
35   CFoldersPage foldersPage;
36   CEditPage editPage;
37   CSettingsPage settingsPage;
38   CLangPage langPage;
39 
40   CObjectVector<NControl::CPageInfo> pages;
41   BIG_DIALOG_SIZE(200, 200);
42 
43   const UINT pageIDs[] = {
44       SIZED_DIALOG(IDD_SYSTEM),
45       SIZED_DIALOG(IDD_MENU),
46       SIZED_DIALOG(IDD_FOLDERS),
47       SIZED_DIALOG(IDD_EDIT),
48       SIZED_DIALOG(IDD_SETTINGS),
49       SIZED_DIALOG(IDD_LANG) };
50 
51   NControl::CPropertyPage *pagePointers[] = { &systemPage,  &menuPage, &foldersPage, &editPage, &settingsPage, &langPage };
52 
53   for (unsigned i = 0; i < ARRAY_SIZE(pageIDs); i++)
54   {
55     NControl::CPageInfo &page = pages.AddNew();
56     page.ID = pageIDs[i];
57     LangString_OnlyFromLangFile(page.ID, page.Title);
58     page.Page = pagePointers[i];
59   }
60 
61   INT_PTR res = NControl::MyPropertySheet(pages, hwndOwner, LangString(IDS_OPTIONS));
62 
63   if (res != -1 && res != 0)
64   {
65     if (langPage.LangWasChanged)
66     {
67       // g_App._window.SetText(LangString(IDS_APP_TITLE, 0x03000000));
68       MyLoadMenu();
69       g_App.ReloadToolbars();
70       g_App.MoveSubWindows(); // we need it to change list window aafter _toolBar.AutoSize();
71       g_App.ReloadLang();
72     }
73 
74     /*
75     if (systemPage.WasChanged)
76     {
77       // probably it doesn't work, since image list is locked?
78       g_App.SysIconsWereChanged();
79     }
80     */
81 
82     g_App.SetListSettings();
83     g_App.RefreshAllPanels();
84     // ::PostMessage(hwndOwner, kLangWasChangedMessage, 0 , 0);
85   }
86 }
87