Skip to content

Commit e669d50

Browse files
committed
Different dialog title for node and group settings.
1 parent 11f73f0 commit e669d50

6 files changed

Lines changed: 34 additions & 12 deletions

File tree

Sources/Localization/English.po

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,12 +175,15 @@ msgstr "%d / %d (%d)"
175175
msgid "Texts per page"
176176
msgstr "Texts per page"
177177

178+
msgid "Node Parameters"
179+
msgstr "Node Parameters"
180+
181+
msgid "Group Parameters"
182+
msgstr "Group Parameters"
183+
178184
msgid "Cancel"
179185
msgstr "Cancel"
180186

181187
msgid "OK"
182188
msgstr "OK"
183189

184-
msgid "Parameters"
185-
msgstr "Parameters"
186-

Sources/WindowsAppSupport/WAS_HwndEventHandler.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,18 @@ NUIE::MenuCommandPtr HwndEventHandler::OnContextMenu (NUIE::EventHandler::Contex
2727
return SelectCommandFromContextMenu (hwnd, position, commands);
2828
}
2929

30-
bool HwndEventHandler::OnParameterSettings (NUIE::EventHandler::ParameterSettingsType, NUIE::ParameterInterfacePtr paramAccessor)
30+
bool HwndEventHandler::OnParameterSettings (NUIE::EventHandler::ParameterSettingsType type, NUIE::ParameterInterfacePtr paramAccessor)
3131
{
3232
ParameterDialog paramDialog (paramAccessor);
33-
return paramDialog.Show (hwnd, 0, 0);
33+
std::wstring title;
34+
if (type == NUIE::EventHandler::ParameterSettingsType::Node) {
35+
title = NE::LocalizeString (L"Node Parameters");
36+
} else if (type == NUIE::EventHandler::ParameterSettingsType::Group) {
37+
title = NE::LocalizeString (L"Group Parameters");
38+
} else {
39+
DBGBREAK ();
40+
}
41+
return paramDialog.Show (title, hwnd, 0, 0);
3442
}
3543

3644
void HwndEventHandler::OnDoubleClick (const NUIE::Point&, NUIE::MouseButton)

Sources/WindowsAppSupport/WAS_InMemoryDialog.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,11 +210,20 @@ class SeparatorControl : public InMemoryControl
210210
};
211211

212212
InMemoryDialog::InMemoryDialog () :
213+
parameters (),
213214
controls (),
214215
status (Status::Draft)
215216
{
216217
}
217218

219+
void InMemoryDialog::SetParameters (const std::wstring& dialogTitle, short x, short y, short width, short height)
220+
{
221+
if (DBGERROR (status != Status::Draft)) {
222+
return;
223+
}
224+
parameters = DialogParameters (dialogTitle, x, y, width, height);
225+
}
226+
218227
void InMemoryDialog::AddStatic (const std::wstring& controlText, short x, short y, short width, short height, DWORD controlId)
219228
{
220229
if (DBGERROR (status != Status::Draft)) {
@@ -264,7 +273,7 @@ void InMemoryDialog::AddSeparator (short x, short y, short width, DWORD controlI
264273
controls.push_back (std::unique_ptr<InMemoryControl> (new SeparatorControl (x, y, width, controlId)));
265274
}
266275

267-
INT_PTR InMemoryDialog::Show (const DialogParameters& parameters, HWND parentHwnd, DLGPROC dialogProc, LPARAM initParam)
276+
INT_PTR InMemoryDialog::Show (HWND parentHwnd, DLGPROC dialogProc, LPARAM initParam)
268277
{
269278
if (DBGERROR (status != Status::Draft)) {
270279
return -1;
@@ -328,7 +337,7 @@ INT_PTR InMemoryDialog::Show (const DialogParameters& parameters, HWND parentHwn
328337
return result;
329338
}
330339

331-
void InMemoryDialog::InitControls(HWND dialogHwnd)
340+
void InMemoryDialog::InitControls (HWND dialogHwnd)
332341
{
333342
if (DBGERROR (status != Status::Opened)) {
334343
return;

Sources/WindowsAppSupport/WAS_InMemoryDialog.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,18 +65,20 @@ class InMemoryDialog
6565

6666
InMemoryDialog ();
6767

68+
void SetParameters (const std::wstring& dialogTitle, short x, short y, short width, short height);
6869
void AddStatic (const std::wstring& controlText, short x, short y, short width, short height, DWORD controlId);
6970
void AddEdit (const std::wstring& controlText, short x, short y, short width, short height, DWORD controlId);
7071
void AddButton (const std::wstring& controlText, short x, short y, short width, short height, DWORD controlId);
7172
void AddDefButton (const std::wstring& controlText, short x, short y, short width, short height, DWORD controlId);
7273
void AddComboBox (int selectedItem, const std::vector<std::wstring>& choices, short x, short y, short width, short height, DWORD controlId);
7374
void AddSeparator (short x, short y, short width, DWORD controlId);
7475

75-
INT_PTR Show (const DialogParameters& parameters, HWND parentHwnd, DLGPROC dialogProc, LPARAM initParam);
76+
INT_PTR Show (HWND parentHwnd, DLGPROC dialogProc, LPARAM initParam);
7677
void InitControls (HWND dialogHwnd);
7778
Status GetStatus () const;
7879

7980
private:
81+
DialogParameters parameters;
8082
std::vector<std::unique_ptr<InMemoryControl>> controls;
8183
Status status;
8284
};

Sources/WindowsAppSupport/WAS_ParameterDialog.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,13 @@ ParameterDialog::ParameterDialog (NUIE::ParameterInterfacePtr& paramInterface) :
109109

110110
}
111111

112-
bool ParameterDialog::Show (HWND parentHwnd, short x, short y)
112+
bool ParameterDialog::Show (const std::wstring& dialogTitle, HWND parentHwnd, short x, short y)
113113
{
114114
WORD paramCount = (WORD) paramInterface->GetParameterCount ();
115115
short dialogInnerWidth = StaticWidth + ControlWidth + DialogPadding;
116116
short dialogWidth = dialogInnerWidth + 2 * DialogPadding;
117117
short dialogHeight = paramCount * ControlHeight + (paramCount + 3) * DialogPadding + ButtonHeight;
118+
paramDialog.SetParameters (dialogTitle, x, y, dialogWidth, dialogHeight);
118119

119120
short currentY = DialogPadding;
120121
for (WORD paramIndex = 0; paramIndex < paramCount; ++paramIndex) {
@@ -167,9 +168,8 @@ bool ParameterDialog::Show (HWND parentHwnd, short x, short y)
167168
paramDialog.AddButton (NE::LocalizeString (L"Cancel"), dialogInnerWidth - 2 * ButtonWidth, currentY + DialogPadding, ButtonWidth, ButtonHeight, CancelButtonId);
168169
paramDialog.AddDefButton (NE::LocalizeString (L"OK"), dialogInnerWidth - ButtonWidth + DialogPadding, currentY + DialogPadding, ButtonWidth, ButtonHeight, OkButtonId);
169170

170-
DialogParameters parameters (NE::LocalizeString (L"Parameters"), x, y, dialogWidth, dialogHeight);
171171
parentWindowHandle = parentHwnd;
172-
INT_PTR dialogResult = paramDialog.Show (parameters, parentHwnd, DlgProc, (LPARAM) this);
172+
INT_PTR dialogResult = paramDialog.Show (parentHwnd, DlgProc, (LPARAM) this);
173173
if (dialogResult == IDOK) {
174174
ApplyParameterChanges ();
175175
return true;

Sources/WindowsAppSupport/WAS_ParameterDialog.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class ParameterDialog
1515
public:
1616
ParameterDialog (NUIE::ParameterInterfacePtr& paramInterface);
1717

18-
bool Show (HWND parentHwnd, short x, short y);
18+
bool Show (const std::wstring& dialogTitle, HWND parentHwnd, short x, short y);
1919
void CenterToParent (HWND dialogHwnd);
2020
void SetupControls (HWND dialogHwnd);
2121
void SetParameterChanged (DWORD controlId);

0 commit comments

Comments
 (0)