Welcome to mirror list, hosted at ThFree Co, Russian Federation.

OptionsDialog.cpp « FileManager « 7zip - github.com/kornelski/7z.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 350d5263a3eb3ecc8e923292fbd1af6ed5e3af5d (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
// OptionsDialog.cpp

#include "StdAfx.h"

#include "resource.h"

#include "Common/StringConvert.h"

#include "Windows/Control/PropertyPage.h"
#include "Windows/Error.h"

#include "Resource/LangPage/LangPage.h"
#include "Resource/LangPage/resource.h"
#include "Resource/PluginsPage/PluginsPage.h"
#include "Resource/PluginsPage/resource.h"
#include "Resource/SystemPage/SystemPage.h"
#include "Resource/SystemPage/resource.h"
#include "Resource/EditPage/EditPage.h"
#include "Resource/EditPage/resource.h"
#include "Resource/SettingsPage/SettingsPage.h"
#include "Resource/SettingsPage/resource.h"

#include "LangUtils.h"
#include "MyLoadMenu.h"
#include "App.h"

void FillInPropertyPage(PROPSHEETPAGE* page, HINSTANCE instance, int dialogID, 
    NWindows::NControl::CPropertyPage *propertyPage, const CSysString &title)
{
  page->dwSize = sizeof(PROPSHEETPAGE);
  // page->dwSize = sizeof(PROPSHEETPAGEW_V1_SIZE);

  page->dwFlags = PSP_HASHELP;
  page->hInstance = instance;
  page->pszTemplate = MAKEINTRESOURCE(dialogID);
  page->pszIcon = NULL;
  page->pfnDlgProc = NWindows::NControl::ProperyPageProcedure;

  if (title.IsEmpty())
    page->pszTitle = NULL;
  else
  {
    page->dwFlags |= PSP_USETITLE;
    page->pszTitle = title;
  }
 
  page->lParam = LPARAM(propertyPage);
  page->pfnCallback = NULL;

  // page->dwFlags = 0;
  // page->pszTitle = NULL;
  // page->lParam = 0;
}

void OptionsDialog(HWND hwndOwner, HINSTANCE hInstance)
{
  CSystemPage systemPage;
  CPluginsPage pluginsPage;
  CEditPage editPage;
  CSettingsPage settingsPage;
  CLangPage langPage;

  CSysStringVector titles;
  UINT32 langIDs[] = { 0x03010300, 0x03010100, 0x03010200, 0x03010400, 0x01000400};
  const int kNumPages = sizeof(langIDs) / sizeof(langIDs[0]);
  for (int i = 0; i < kNumPages; i++)
    titles.Add(GetSystemString(LangLoadString(langIDs[i])));
  
  PROPSHEETPAGE pages[kNumPages];

  FillInPropertyPage(&pages[0], hInstance, IDD_SYSTEM, &systemPage, titles[0]);
  FillInPropertyPage(&pages[1], hInstance, IDD_PLUGINS, &pluginsPage, titles[1]);
  FillInPropertyPage(&pages[2], hInstance, IDD_EDIT, &editPage, titles[2]);
  FillInPropertyPage(&pages[3], hInstance, IDD_SETTINGS, &settingsPage, titles[3]);
  FillInPropertyPage(&pages[4], hInstance, IDD_LANG, &langPage, titles[4]);

  PROPSHEETHEADER sheet;

  // sheet.dwSize = sizeof(PROPSHEETHEADER_V1_SIZE);

  sheet.dwSize = sizeof(PROPSHEETHEADER);
  sheet.dwFlags = PSH_PROPSHEETPAGE;
  sheet.hwndParent = hwndOwner;
  sheet.hInstance = hInstance;

  CSysString title = LangLoadString(IDS_OPTIONS, 0x03010000);

  sheet.pszCaption = title;
  sheet.nPages = sizeof(pages) / sizeof(PROPSHEETPAGE);
  sheet.nStartPage = 0;
  sheet.ppsp = pages;
  sheet.pfnCallback = NULL;

  if (::PropertySheet(&sheet) != -1)
  {
    if (langPage._langWasChanged)
    {
      g_App._window.SetText(LangLoadStringW(IDS_APP_TITLE, 0x03000000));
      MyLoadMenu();
    }
    g_App.SetListSettings();
    g_App.SetShowSystemMenu();
    g_App.RefreshAllPanels();
    g_App.ReloadToolbars();
      // ::PostMessage(hwndOwner, kLangWasChangedMessage, 0 , 0);
  }
  /*
  else
    MessageBox(0, NWindows::NError::MyFormatMessage(GetLastError()), TEXT("PropertySheet"), 0);
  */

}