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 < ARRAY_SIZE(pageIDs); i++)
55   {
56     NControl::CPageInfo &page = pages.AddNew();
57     page.ID = pageIDs[i];
58     LangString_OnlyFromLangFile(page.ID, page.Title);
59     page.Page = pagePointers[i];
60   }
61 
62   INT_PTR res = NControl::MyPropertySheet(pages, hwndOwner, LangString(IDS_OPTIONS));
63 
64   if (res != -1 && res != 0)
65   {
66     if (langPage.LangWasChanged)
67     {
68       // g_App._window.SetText(LangString(IDS_APP_TITLE, 0x03000000));
69       MyLoadMenu();
70       g_App.ReloadToolbars();
71       g_App.MoveSubWindows(); // we need it to change list window aafter _toolBar.AutoSize();
72       g_App.ReloadLang();
73     }
74 
75     /*
76     if (systemPage.WasChanged)
77     {
78       // probably it doesn't work, since image list is locked?
79       g_App.SysIconsWereChanged();
80     }
81     */
82 
83     g_App.SetListSettings();
84     g_App.RefreshAllPanels();
85     // ::PostMessage(hwndOwner, kLangWasChangedMessage, 0 , 0);
86   }
87 }
88