reapack

Package manager for REAPER
Log | Files | Refs | Submodules | README | LICENSE

commit ebc156c678ecc531d5129e7c6bb2153c27a2df96
parent 120b7ad31ca8fa975c43986d4eb4c24ecc829ef5
Author: cfillion <cfillion@users.noreply.github.com>
Date:   Tue,  7 Feb 2017 15:48:57 -0500

browser: don't close on Linux when refreshing the pkg list

Diffstat:
Msrc/dialog.cpp | 18+++++++++---------
Msrc/dialog.hpp | 12++++--------
2 files changed, 13 insertions(+), 17 deletions(-)

diff --git a/src/dialog.cpp b/src/dialog.cpp @@ -57,13 +57,6 @@ WDL_DLGRET Dialog::Proc(HWND handle, UINT msg, WPARAM wParam, LPARAM lParam) dlg->onInit(); break; - case WM_SHOWWINDOW: - // this makes possible to call onHide when destroying the window - // but only if was visible before the destruction request - // (destruction might be caused by the application exiting, - // in which case IsWindowVisible would be false but m_isVisible == true) - dlg->m_isVisible = wParam == 1; - break; case WM_TIMER: dlg->onTimer((int)wParam); break; @@ -124,8 +117,7 @@ int Dialog::HandleKey(MSG *msg, accelerator_register_t *accel) } Dialog::Dialog(const int templateId) - : m_template(templateId), m_isVisible(false), m_minimumSize(), - m_instance(nullptr), m_parent(nullptr), m_handle(nullptr) + : m_template(templateId), m_instance(nullptr), m_parent(nullptr), m_handle(nullptr) { m_accel.translateAccel = HandleKey; m_accel.isLocal = true; @@ -188,9 +180,17 @@ void Dialog::DestroyAll() void Dialog::setVisible(const bool visible, HWND handle) { + if(!handle) + handle = m_handle; + ShowWindow(handle, visible ? SW_SHOW : SW_HIDE); } +bool Dialog::isVisible() const +{ + return IsWindowVisible(m_handle); +} + void Dialog::close(const INT_PTR result) { switch(m_mode) { diff --git a/src/dialog.hpp b/src/dialog.hpp @@ -86,13 +86,10 @@ public: void setEnabled(bool enable) { setEnabled(enable, m_handle); } void setEnabled(bool, HWND); - bool isVisible() const { return m_isVisible; } - void show() { show(m_handle); } - void show(HWND handle) { setVisible(true, handle); } - void hide() { hide(m_handle); } - void hide(HWND handle) { setVisible(false, handle); } - void setVisible(bool visible) { setVisible(visible, m_handle); } - void setVisible(bool, HWND); + bool isVisible() const; + void show(HWND handle = nullptr) { setVisible(true, handle); } + void hide(HWND handle = nullptr) { setVisible(false, handle); } + void setVisible(bool, HWND = nullptr); void close(INT_PTR = 0); void center(); @@ -152,7 +149,6 @@ private: static std::map<HWND, Dialog *> s_instances; const int m_template; - bool m_isVisible; POINT m_minimumSize; WDL_WndSizer m_resizer; Modality m_mode;