From 895c942289c81ca24346d3bb18d2b922ae469554 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Wed, 8 May 2013 14:56:19 +0200 Subject: Remove GlobalContext class. Move all native code from EventHandler class to NativeWindowX11 and NativeWindowWin32 classes. --- plugingui/plugingui.cc | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'plugingui/plugingui.cc') diff --git a/plugingui/plugingui.cc b/plugingui/plugingui.cc index 3c2cb4c..5b2f2e3 100644 --- a/plugingui/plugingui.cc +++ b/plugingui/plugingui.cc @@ -29,7 +29,6 @@ #include #include -#include "globalcontext.h" #include "knob.h" #include "verticalline.h" @@ -184,9 +183,7 @@ PluginGUI::PluginGUI(DrumGizmo *drumgizmo) this->drumgizmo = drumgizmo; - gctx = NULL; window = NULL; - eventhandler = NULL; running = true; closing = false; @@ -231,7 +228,7 @@ void PluginGUI::thread_main() if(!running) break; - eventhandler->processEvents(window); + window->eventHandler()->processEvents(); Message *msg; if((msg = drumgizmo->receiveGUIMessage()) != NULL) { @@ -301,8 +298,6 @@ void PluginGUI::thread_main() void PluginGUI::deinit() { if(window) delete window; - if(eventhandler) delete eventhandler; - if(gctx) delete gctx; } void closeEventHandler(void *ptr) @@ -314,11 +309,10 @@ void closeEventHandler(void *ptr) void PluginGUI::init() { DEBUG(gui, "init"); - gctx = new GUI::GlobalContext(); - eventhandler = new GUI::EventHandler(gctx); - eventhandler->registerCloseHandler(closeEventHandler, (void*)&closing); + window = new GUI::Window(); + window->eventHandler()->registerCloseHandler(closeEventHandler, + (void*)&closing); - window = new GUI::Window(gctx); window->resize(370, 330); window->setCaption("DrumGizmo v"VERSION); @@ -470,7 +464,7 @@ void PluginGUI::init() void PluginGUI::show() { - if(!gctx) init(); + if(!window) init(); window->show(); } @@ -488,7 +482,7 @@ void PluginGUI::processEvents() } #ifndef USE_THREAD - eventhandler->processEvents(window); + window->eventHandler()->processEvents(window); #endif/*USE_THREAD*/ } -- cgit v1.2.3