UI-top-level: drop the UI Application singleton
integrate the remaining functionality of GtkLumiera into the GUI starter plug-in
This commit is contained in:
parent
1ed4bd2c4c
commit
09dec65950
6 changed files with 33 additions and 114 deletions
|
|
@ -34,7 +34,7 @@
|
||||||
** to refer to the installation directory of the currently executing program.
|
** to refer to the installation directory of the currently executing program.
|
||||||
** This allows for a relocatable Lumiera installation bundle.
|
** This allows for a relocatable Lumiera installation bundle.
|
||||||
**
|
**
|
||||||
** @see guistart.cpp the plugin to pull up this GUI
|
** @see gtk-lumiera.cpp the plugin to pull up this GUI
|
||||||
** @see lumiera::BasicSetup definition of the acceptable configuration values
|
** @see lumiera::BasicSetup definition of the acceptable configuration values
|
||||||
** @see lumiera::AppState general Lumiera application main
|
** @see lumiera::AppState general Lumiera application main
|
||||||
** @see lumiera::Config
|
** @see lumiera::Config
|
||||||
|
|
|
||||||
|
|
@ -40,8 +40,7 @@
|
||||||
#include "lib/searchpath.hpp"
|
#include "lib/searchpath.hpp"
|
||||||
#include "lib/util.hpp"
|
#include "lib/util.hpp"
|
||||||
|
|
||||||
using Gtk::IconSize;
|
#include <gdlmm.h>
|
||||||
using Gtk::IconFactory;
|
|
||||||
|
|
||||||
using util::cStr;
|
using util::cStr;
|
||||||
using util::isnil;
|
using util::isnil;
|
||||||
|
|
@ -50,8 +49,12 @@ using util::isnil;
|
||||||
namespace gui {
|
namespace gui {
|
||||||
namespace ctrl {
|
namespace ctrl {
|
||||||
|
|
||||||
|
using Gtk::IconSize;
|
||||||
|
using Gtk::IconFactory;
|
||||||
|
|
||||||
using workspace::StyleManager;
|
using workspace::StyleManager;
|
||||||
|
|
||||||
|
|
||||||
namespace { // dummy command line for GTK
|
namespace { // dummy command line for GTK
|
||||||
int argc =0;
|
int argc =0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@
|
||||||
** @warning include here only what is absolutely necessary,
|
** @warning include here only what is absolutely necessary,
|
||||||
** for sake of compilation times and (debug) executable size.
|
** for sake of compilation times and (debug) executable size.
|
||||||
**
|
**
|
||||||
** @see guistart.cpp the plugin to pull up this GUI
|
** @see gtk-lumiera.cpp the plugin to pull up this GUI
|
||||||
** @see gui::GuiFacade access point for starting the GUI
|
** @see gui::GuiFacade access point for starting the GUI
|
||||||
** @see gui::GuiNotification interface for communication with the gui from the lower layers
|
** @see gui::GuiNotification interface for communication with the gui from the lower layers
|
||||||
** @see lumiera::Config
|
** @see lumiera::Config
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
GuiStart - entry point for the lumiera GUI loaded as shared module
|
GtkLumiera - entry point for the lumiera GUI loaded as shared module
|
||||||
|
|
||||||
Copyright (C) Lumiera.org
|
Copyright (C) Lumiera.org
|
||||||
2007-2008, Joel Holdsworth <joel@airwebreathe.org.uk>
|
2007-2008, Joel Holdsworth <joel@airwebreathe.org.uk>
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
* *****************************************************/
|
* *****************************************************/
|
||||||
|
|
||||||
|
|
||||||
/** @file guistart.cpp
|
/** @file gtk-lumiera.cpp
|
||||||
** Start up the Lumiera GTK GUI when loading it as dynamic module.
|
** Start up the Lumiera GTK GUI when loading it as dynamic module.
|
||||||
** This plugin is linked together with the Lumiera GUI code; when loaded as
|
** This plugin is linked together with the Lumiera GUI code; when loaded as
|
||||||
** Lumiera plugin, it allows to kick off the GTK main event loop and thus to bring
|
** Lumiera plugin, it allows to kick off the GTK main event loop and thus to bring
|
||||||
|
|
@ -36,45 +36,43 @@
|
||||||
** body, while the interface is opened via an InstanceHandle member. The `launchUI()` call
|
** body, while the interface is opened via an InstanceHandle member. The `launchUI()` call
|
||||||
** starts a new thread, which then becomes the UI event thread and remains blocked within
|
** starts a new thread, which then becomes the UI event thread and remains blocked within
|
||||||
** the main GTK event loop. Before entering this loop, the CoreService of the GUI and
|
** the main GTK event loop. Before entering this loop, the CoreService of the GUI and
|
||||||
** especially the [UI-Bus](\ref ui-bus.hpp) is started see \ref GtkLumiera::main().
|
** especially the [UI-Bus](\ref ui-bus.hpp) is started see \ref GtkLumiera::run().
|
||||||
** This entails also to open the primary "business" interface(s) of the GUI
|
** This entails also to open the primary "business" interface(s) of the GUI
|
||||||
** (currently as of 1/16 this is the interface gui::GuiNotification.)
|
** (currently as of 1/16 this is the interface gui::GuiNotification.)
|
||||||
**
|
**
|
||||||
** @see lumiera::AppState
|
** @see lumiera::AppState
|
||||||
** @see gui::GuiFacade
|
** @see gui::GuiFacade
|
||||||
** @see guifacade.cpp
|
** @see guifacade.cpp
|
||||||
** @see gui::GtkLumiera#main the GTK GUI main
|
** @see ui-manager.hpp
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//--------------------tricky special Include sequence
|
#include "gui/gtk-base.hpp"
|
||||||
#include "lib/hash-standard.hpp"// need to be before any inclusion of <string>
|
|
||||||
#include <locale> // need to include this to prevent errors when libintl.h defines textdomain (because gtk-lumiera removes the def when ENABLE_NLS isn't defined)
|
|
||||||
|
|
||||||
#include "gui/gtk-lumiera.hpp" // need to include this before nobugcfg.h, because types.h from GTK tries to shaddow the ERROR macro from windows, which kills nobug's ERROR macro
|
|
||||||
//--------------------tricky special Include sequence
|
|
||||||
|
|
||||||
#include "lib/error.hpp"
|
#include "lib/error.hpp"
|
||||||
|
#include "gui/ui-bus.hpp"
|
||||||
#include "gui/guifacade.hpp"
|
#include "gui/guifacade.hpp"
|
||||||
|
#include "gui/ctrl/ui-manager.hpp"
|
||||||
#include "gui/display-service.hpp"
|
#include "gui/display-service.hpp"
|
||||||
#include "common/subsys.hpp"
|
|
||||||
#include "backend/thread-wrapper.hpp"
|
#include "backend/thread-wrapper.hpp"
|
||||||
#include "lib/depend.hpp"
|
#include "common/subsys.hpp"
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include "common/interface.h"
|
#include "common/interface.h"
|
||||||
#include "common/interface-descriptor.h"
|
#include "common/interface-descriptor.h"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#include <boost/noncopyable.hpp>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
using std::string;
|
|
||||||
using backend::Thread;
|
using backend::Thread;
|
||||||
using lumiera::Subsys;
|
using lumiera::Subsys;
|
||||||
using lumiera::error::LUMIERA_ERROR_STATE;
|
using lumiera::error::LUMIERA_ERROR_STATE;
|
||||||
using gui::LUMIERA_INTERFACE_INAME(lumieraorg_Gui, 1);
|
using gui::LUMIERA_INTERFACE_INAME(lumieraorg_Gui, 1);
|
||||||
|
|
||||||
|
using std::string;
|
||||||
|
|
||||||
|
|
||||||
namespace gui {
|
namespace gui {
|
||||||
|
|
||||||
|
|
@ -82,17 +80,19 @@ namespace gui {
|
||||||
|
|
||||||
/**************************************************************************//**
|
/**************************************************************************//**
|
||||||
* Implement the necessary steps for actually making the Lumiera Gui available.
|
* Implement the necessary steps for actually making the Lumiera Gui available.
|
||||||
* Open the business interface(s) and start up the GTK GUI main event loop.
|
* Establish the UI backbone services and start up the GTK GUI main event loop.
|
||||||
* @todo to ensure invocation of the termination signal, any members
|
* @todo to ensure invocation of the termination signal, any members
|
||||||
* should be failsafe on initialisation (that means, we must not
|
* should be failsafe on initialisation (that means, we must not
|
||||||
* open other interfaces here...) ///////////////////////////TICKET #82
|
* open other interfaces here...) ///////////////////////////TICKET #82
|
||||||
*/
|
*/
|
||||||
struct GuiLifecycle
|
class GtkLumiera
|
||||||
|
: boost::noncopyable
|
||||||
{
|
{
|
||||||
DisplayService activateDisplayService_; ///////////////////////////TICKET #82 will go away once we have a real OutputSlot offered by the UI
|
DisplayService activateDisplayService_; ///////////////////////////TICKET #82 will go away once we have a real OutputSlot offered by the UI
|
||||||
|
|
||||||
GuiLifecycle ()
|
public:
|
||||||
: activateDisplayService_() // opens the gui::Display facade interface
|
GtkLumiera ()
|
||||||
|
: activateDisplayService_() ///////////////////////////TICKET #82 obsolete (and incurs a race)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -102,8 +102,12 @@ namespace gui {
|
||||||
string errorMsgBuff;
|
string errorMsgBuff;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
UiBus uiBus;
|
||||||
|
ctrl::UiManager uiManager(uiBus);
|
||||||
|
|
||||||
// execute the GTK Event Loop____________
|
// execute the GTK Event Loop____________
|
||||||
GtkLumiera::application().run(); /////////////TICKET #1048 : do not access GtkLumiera as singleton, rather just place it as local variable on the stack here
|
uiManager.createApplicationWindow();
|
||||||
|
uiManager.performMainLoop();
|
||||||
} // all went well, regular shutdown
|
} // all went well, regular shutdown
|
||||||
|
|
||||||
catch (lumiera::Error& problem)
|
catch (lumiera::Error& problem)
|
||||||
|
|
@ -126,7 +130,7 @@ namespace gui {
|
||||||
void
|
void
|
||||||
runGUI (Subsys::SigTerm& reportOnTermination)
|
runGUI (Subsys::SigTerm& reportOnTermination)
|
||||||
{
|
{
|
||||||
GuiLifecycle{}.run (reportOnTermination);
|
GtkLumiera{}.run (reportOnTermination);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // (End) impl details
|
} // (End) impl details
|
||||||
|
|
@ -1,88 +0,0 @@
|
||||||
/*
|
|
||||||
GTK-LUMIERA.hpp - The Lumiera GUI Application Object
|
|
||||||
|
|
||||||
Copyright (C) Lumiera.org
|
|
||||||
2008, Joel Holdsworth <joel@airwebreathe.org.uk>
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU General Public License as
|
|
||||||
published by the Free Software Foundation; either version 2 of
|
|
||||||
the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/** @file gtk-lumiera.hpp
|
|
||||||
** The main application object.
|
|
||||||
** Invoking the GtkLumiera::main() function brings up the GUI; this
|
|
||||||
** function will block in the GTK event thread until the Application gets
|
|
||||||
** closed by user interaction or by triggering a shutdown via the GuiNotificationFacade.
|
|
||||||
** GtkLumiera is a singleton and owns the central WindowList instance used for
|
|
||||||
** opening all windows and registering and loading icons and resources.
|
|
||||||
**
|
|
||||||
** \par configuration and resource search
|
|
||||||
** The GUI object retrieves the necessary configuration values from lumiera::Config,
|
|
||||||
** the config facade in the application core. Currently as of 2/2011 these values are
|
|
||||||
** loaded from setup.ini, because the full-blown config system is not yet implemented.
|
|
||||||
** Amongst others, this configuration defines a <i>search path</i> for icons and a
|
|
||||||
** separate search path for resources. These path specs may use the token \c $ORIGIN
|
|
||||||
** to refer to the installation directory of the currently executing program.
|
|
||||||
** This allows for a relocatable Lumiera installation bundle.
|
|
||||||
**
|
|
||||||
** @see guistart.cpp the plugin to pull up this GUI
|
|
||||||
** @see gui::GuiFacade access point for starting the GUI
|
|
||||||
** @see gui::GuiNotification interface for communication with the gui from the lower layers
|
|
||||||
** @see lumiera::Config
|
|
||||||
** @see lumiera::BasicSetup definition of the acceptable configuration values
|
|
||||||
** @see lumiera::AppState general Lumiera application main
|
|
||||||
**
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef GUI_GTK_LUMIERA_H
|
|
||||||
#define GUI_GTK_LUMIERA_H
|
|
||||||
|
|
||||||
|
|
||||||
#include "gui/gtk-base.hpp"
|
|
||||||
|
|
||||||
#include <boost/noncopyable.hpp>
|
|
||||||
|
|
||||||
|
|
||||||
namespace gui {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* ====== The Application Class ====== */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Top level entry point: The Lumiera GTK UI.
|
|
||||||
* @todo as of 12/2016 this is a singleton, which is sketchy.
|
|
||||||
* It should be instantiated in local scope of GuiLifecycle
|
|
||||||
* within guistart.cpp and discarded right after shutdown ///////////////TICKET #1048 : rectify lifecycle
|
|
||||||
*/
|
|
||||||
class GtkLumiera
|
|
||||||
: boost::noncopyable
|
|
||||||
{
|
|
||||||
|
|
||||||
public:
|
|
||||||
/** access the the global application object */
|
|
||||||
static GtkLumiera& application(); ////////////////////////////TICKET #1048 : this loophole needs to be closed
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** start up the GUI and run the event thread */
|
|
||||||
void run();
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
}// namespace gui
|
|
||||||
#endif
|
|
||||||
|
|
@ -69,7 +69,7 @@ namespace gui {
|
||||||
* somewhat special, as its sole purpose is to expose the subsystem
|
* somewhat special, as its sole purpose is to expose the subsystem
|
||||||
* descriptor, which, when started, loads the GUI as a plugin and
|
* descriptor, which, when started, loads the GUI as a plugin and
|
||||||
* invokes `launchUI(term)` there. For the implementation see
|
* invokes `launchUI(term)` there. For the implementation see
|
||||||
* gui::GuiRunner (guifacade.cpp) and guistart.cpp (the plugin).
|
* gui::GuiRunner (guifacade.cpp) and gtk-lumiera.cpp (the plugin).
|
||||||
*
|
*
|
||||||
* @note this facade is intended to be used by Lumiera main solely.
|
* @note this facade is intended to be used by Lumiera main solely.
|
||||||
* client code should always use the "business" interface(s).
|
* client code should always use the "business" interface(s).
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue