commit 7bb71a637f10e24b827c28b84e8d2b680cf9c0ca
parent 824c1cf067fbbb76b15992ed62adf158072f114b
Author: cfillion <cfillion@users.noreply.github.com>
Date: Sat, 19 Dec 2015 17:40:42 -0500
mild refactoring of the dialog code
Diffstat:
3 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/src/dialog.cpp b/src/dialog.cpp
@@ -73,6 +73,12 @@ Dialog::Dialog(const int templateId)
// can't call reimplemented virtual methods here during object construction
}
+Dialog::~Dialog()
+{
+ DestroyWindow(m_handle);
+ s_instances.erase(m_handle);
+}
+
INT_PTR Dialog::init(REAPER_PLUGIN_HINSTANCE inst, HWND parent, Modality mode)
{
m_parent = parent;
@@ -98,12 +104,6 @@ void Dialog::Destroy(Dialog *dlg)
delete dlg;
}
-Dialog::~Dialog()
-{
- DestroyWindow(m_handle);
- s_instances.erase(m_handle);
-}
-
void Dialog::show()
{
center();
@@ -116,6 +116,11 @@ void Dialog::hide()
ShowWindow(m_handle, SW_HIDE);
}
+void Dialog::close(const INT_PTR result)
+{
+ EndDialog(m_handle, result);
+}
+
void Dialog::center()
{
RECT dialogRect, parentRect;
diff --git a/src/dialog.hpp b/src/dialog.hpp
@@ -63,6 +63,7 @@ public:
void show();
void hide();
+ void close(const INT_PTR = 0);
void center();
protected:
diff --git a/src/report.cpp b/src/report.cpp
@@ -68,7 +68,7 @@ void Report::onCommand(WPARAM wParam, LPARAM)
switch(commandId) {
case IDOK:
case IDCANCEL:
- EndDialog(handle(), true);
+ close();
break;
}
}