diff options
author | TheMarlboroMan <marlborometal@gmail.com> | 2020-11-15 16:23:26 +0100 |
---|---|---|
committer | TheMarlboroMan <marlborometal@gmail.com> | 2020-11-15 16:23:26 +0100 |
commit | b0fa70c97c9b4886fb6e063664dc4d10daf12c1c (patch) | |
tree | bad875a8fa771783f9086afa4147f46cfe299671 | |
parent | 37e0c7ece76d2fdc23a42f87f9112ec1423dd988 (diff) |
Store size of main window centralized in mainwindow.h to reduce redundancy.
-rw-r--r-- | plugin/drumgizmo_plugin.cc | 4 | ||||
-rw-r--r-- | plugin/drumgizmo_plugin.h | 4 | ||||
-rw-r--r-- | plugingui/mainwindow.h | 4 | ||||
-rw-r--r-- | plugingui/testmain.cc | 6 |
4 files changed, 10 insertions, 8 deletions
diff --git a/plugin/drumgizmo_plugin.cc b/plugin/drumgizmo_plugin.cc index a91606b..98299ee 100644 --- a/plugin/drumgizmo_plugin.cc +++ b/plugin/drumgizmo_plugin.cc @@ -65,7 +65,7 @@ DrumGizmoPlugin::DrumGizmoPlugin() init(); drumgizmo = std::make_shared<DrumGizmo>(settings, output, input); - resizeWindow(width, height); + resizeWindow(GUI::MainWindow::main_width, GUI::MainWindow::main_height); drumgizmo->setFreeWheel(true); drumgizmo->setSamplerate(44100); drumgizmo->setFrameSize(2048); @@ -317,7 +317,7 @@ bool DrumGizmoPlugin::hasGUI() void* DrumGizmoPlugin::createWindow(void* parent) { plugin_gui = std::make_shared<GUI::MainWindow>(settings, parent); - resizeWindow(width, height); + resizeWindow(GUI::MainWindow::main_width, GUI::MainWindow::main_height); onShowWindow(); return plugin_gui->getNativeWindowHandle(); diff --git a/plugin/drumgizmo_plugin.h b/plugin/drumgizmo_plugin.h index 521ec86..78a74dc 100644 --- a/plugin/drumgizmo_plugin.h +++ b/plugin/drumgizmo_plugin.h @@ -114,6 +114,7 @@ public: void closeWindow() override; private: + class Input : public AudioInputEngineMidi { @@ -215,9 +216,6 @@ private: GUI::Image inline_display_image{":resources/logo.png"}; bool inline_image_first_draw{true}; - static constexpr std::size_t width{750}; - static constexpr std::size_t height{713}; - #ifdef WITH_NLS UITranslation translation; #endif // WITH_NLS diff --git a/plugingui/mainwindow.h b/plugingui/mainwindow.h index ffd0566..219f851 100644 --- a/plugingui/mainwindow.h +++ b/plugingui/mainwindow.h @@ -44,6 +44,10 @@ class MainWindow : public Window { public: + + static constexpr std::size_t main_width{750}; + static constexpr std::size_t main_height{800}; + MainWindow(Settings& settings, void* native_window); ~MainWindow(); diff --git a/plugingui/testmain.cc b/plugingui/testmain.cc index 1195ceb..3f73039 100644 --- a/plugingui/testmain.cc +++ b/plugingui/testmain.cc @@ -35,6 +35,7 @@ #include "window.h" #include "resource.h" #include "uitranslation.h" +#include "mainwindow.h" int main() { @@ -62,11 +63,10 @@ int main() #endif main_window.show(); - // TODO: automatically use drumgizmo_plugin.h size here #ifndef UI_PUGL - parent.resize(750, 713); + parent.resize(GUI::MainWindow::main_width, GUI::MainWindow::main_height); #else - main_window.resize(750, 713); + main_window.resize(GUI::MainWindow::main_width, GUI::MainWindow::main_height); #endif while(true) |