demote the WindowManager to be a petty window list (#1964)
the only adequate thing you can do with managers is to demote them.
This commit is contained in:
parent
a6fb10b9e0
commit
86d6e11505
9 changed files with 85 additions and 55 deletions
|
|
@ -106,13 +106,13 @@ namespace gui {
|
|||
uiManager.init (Config::get (KEY_ICON_PATH), Config::get (KEY_UIRES_PATH));
|
||||
uiManager.setTheme (Config::get (KEY_STYLESHEET));
|
||||
|
||||
windowManagerInstance_.reset (new workspace::WindowManager (uiManager));
|
||||
windowManagerInstance_.reset (new workspace::WindowList (uiManager));
|
||||
windowManagerInstance_->newWindow (project, controller);
|
||||
kit.run(); // GTK event loop
|
||||
}
|
||||
|
||||
|
||||
WindowManager&
|
||||
WindowList&
|
||||
GtkLumiera::windowManager()
|
||||
{
|
||||
if (not windowManagerInstance_)
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
** 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 WindowManager instance used for
|
||||
** 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
|
||||
|
|
@ -53,7 +53,7 @@
|
|||
|
||||
#include "gui/gtk-base.hpp"
|
||||
#include "gui/workspace/ui-manager.hpp"
|
||||
#include "gui/workspace/window-manager.hpp"
|
||||
#include "gui/workspace/window-list.hpp"
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <memory>
|
||||
|
|
@ -139,7 +139,7 @@ namespace gui {
|
|||
: boost::noncopyable
|
||||
{
|
||||
/** Central application window manager instance */
|
||||
shared_ptr<workspace::WindowManager> windowManagerInstance_;
|
||||
shared_ptr<workspace::WindowList> windowManagerInstance_;
|
||||
|
||||
|
||||
public:
|
||||
|
|
@ -151,7 +151,7 @@ namespace gui {
|
|||
/** start up the GUI and run the event thread */
|
||||
void main(int argc, char *argv[]);
|
||||
|
||||
workspace::WindowManager& windowManager(); ////////////////////////////TICKET #1048 : this loophole needs to be closed
|
||||
workspace::WindowList& windowManager(); ////////////////////////////TICKET #1048 : this loophole needs to be closed
|
||||
|
||||
|
||||
/** the name of the application */
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@
|
|||
** The _generic interface element_ based on [Tangible](\ref model::Tangible) covers a set of behaviour
|
||||
** common to all elements of the interface. This behaviour is targeted towards the _integration_
|
||||
** with the core application. Beyond that, there are still several concerns regarding presentation,
|
||||
** like a common styling. These are addressed the conventional way, through a common \ref WindowManager.
|
||||
** like a common styling. These are addressed the conventional way, through a common \ref UiManager.
|
||||
** The following discussion focuses on the aspects of integration with the core.
|
||||
**
|
||||
** For one reason or another, any element in the UI can appear and go away.
|
||||
|
|
|
|||
|
|
@ -145,11 +145,11 @@ namespace gui {
|
|||
* Backbone of the Lumiera GTK GUI.
|
||||
* This is the Interface and Lifecycle front-end.
|
||||
* When an instance of this class is created, the backbone becomes operative
|
||||
* and can then be used to attach the active gui::WindowManager. When it goes away,
|
||||
* all backbone services are forced to shut down and disconnect, which means, that
|
||||
* at this point, the entire UI must be decommissioned. Effectively this also means
|
||||
* that the UiBus object must be run within the GTK event thread and must not be
|
||||
* accessed from anywhere else.
|
||||
* and can then be used to attach the active workspace::UiManager and similar entities.
|
||||
* When it goes away, all backbone services are forced to shut down and disconnect,
|
||||
* which means, that at this point, the entire UI must be decommissioned. Effectively
|
||||
* this also means that the UiBus object must be run within the GTK event thread
|
||||
* and must not be accessed from anywhere else.
|
||||
*/
|
||||
class UiBus
|
||||
: boost::noncopyable
|
||||
|
|
|
|||
|
|
@ -95,8 +95,8 @@ namespace workspace {
|
|||
|
||||
Cairo::RefPtr<Cairo::SolidPattern>
|
||||
UiManager::readStyleColourProperty (Gtk::Widget& widget
|
||||
,const gchar * property_name
|
||||
,guint16 red, guint16 green, guint16 blue)
|
||||
,const gchar * property_name
|
||||
,guint16 red, guint16 green, guint16 blue)
|
||||
{
|
||||
REQUIRE (property_name);
|
||||
|
||||
|
|
@ -159,14 +159,13 @@ namespace workspace {
|
|||
|
||||
bool
|
||||
UiManager::addStockIconSet (Glib::RefPtr<IconFactory> const& factory
|
||||
,cuString& icon_name
|
||||
,cuString& id
|
||||
,cuString& label)
|
||||
,cuString& icon_name
|
||||
,cuString& id
|
||||
,cuString& label)
|
||||
{
|
||||
Glib::RefPtr<Gtk::IconSet> icon_set = Gtk::IconSet::create();
|
||||
|
||||
// Load all the sizes, wildcarding the first, largest icon to be
|
||||
// loaded
|
||||
// Load all the sizes, wildcarding the first, largest icon to be loaded
|
||||
bool no_icons = true;
|
||||
no_icons &= !addStockIcon(
|
||||
icon_set, icon_name, GiantIconSize, no_icons);
|
||||
|
|
@ -201,7 +200,7 @@ namespace workspace {
|
|||
,bool wildcard)
|
||||
{
|
||||
// Try the icon theme
|
||||
if(addThemeIconSource(icon_set, icon_name, size, wildcard))
|
||||
if (addThemeIconSource(icon_set, icon_name, size, wildcard))
|
||||
return true;
|
||||
|
||||
// Try to resolve the icon via the configured search path
|
||||
|
|
@ -220,9 +219,9 @@ namespace workspace {
|
|||
|
||||
bool
|
||||
UiManager::addThemeIconSource (Glib::RefPtr<Gtk::IconSet> const& icon_set
|
||||
,cuString& icon_name
|
||||
,Gtk::IconSize size
|
||||
,bool wildcard)
|
||||
,cuString& icon_name
|
||||
,Gtk::IconSize size
|
||||
,bool wildcard)
|
||||
{
|
||||
// Get the size
|
||||
int width = 0, height = 0;
|
||||
|
|
@ -246,10 +245,10 @@ namespace workspace {
|
|||
|
||||
bool
|
||||
UiManager::addNonThemeIconSource (Glib::RefPtr<Gtk::IconSet> const& icon_set
|
||||
,cuString& base_dir
|
||||
,cuString& icon_name
|
||||
,Gtk::IconSize size
|
||||
,bool wildcard)
|
||||
,cuString& base_dir
|
||||
,cuString& icon_name
|
||||
,Gtk::IconSize size
|
||||
,bool wildcard)
|
||||
{
|
||||
// Get the size
|
||||
int width = 0, height = 0;
|
||||
|
|
@ -266,9 +265,9 @@ namespace workspace {
|
|||
|
||||
bool
|
||||
UiManager::addStockIconFromPath (string path
|
||||
,Glib::RefPtr<Gtk::IconSet> const& icon_set
|
||||
,Gtk::IconSize size
|
||||
,bool wildcard)
|
||||
,Glib::RefPtr<Gtk::IconSet> const& icon_set
|
||||
,Gtk::IconSize size
|
||||
,bool wildcard)
|
||||
{
|
||||
if (!fsys::exists (path)) return false;
|
||||
|
||||
|
|
|
|||
|
|
@ -23,14 +23,12 @@
|
|||
|
||||
|
||||
/** @file ui-manager.hpp
|
||||
** Manager for all application windows and resources.
|
||||
** This file defines the global UI Manager class. The central WindowManager
|
||||
** instance is owned by the GtkLumiera object and initialised in GTK-main.
|
||||
** The WindowManager has the ability to create new windows integrated with
|
||||
** the application framework, to provide Icons and other resources and
|
||||
** to set and access a general UI theme.
|
||||
** Manager for application resources and similar global state.
|
||||
** The central UiManager instance is owned by the GtkLumiera object and initialised in GTK-main.
|
||||
** It offers services to provide Icons and other resources and to set and access a general UI theme.
|
||||
**
|
||||
** @see gtk-lumiera.hpp
|
||||
** @see ui-bus.hpp
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -61,8 +59,7 @@ namespace workspace {
|
|||
|
||||
|
||||
/**
|
||||
* The centralised manager of all the windows,
|
||||
* icons and resources within Lumiera's GUI.
|
||||
* The centralised manager of all icons and resources within Lumiera's GUI.
|
||||
*/
|
||||
class UiManager
|
||||
: public Gtk::UIManager
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
WindowManager - Global UI Manager
|
||||
WindowList - manage all top level windows
|
||||
|
||||
Copyright (C) Lumiera.org
|
||||
2008, Joel Holdsworth <joel@airwebreathe.org.uk>
|
||||
|
|
@ -21,8 +21,14 @@
|
|||
* *****************************************************/
|
||||
|
||||
|
||||
/** @file window-list.cpp
|
||||
** Implementation parts of the list to manage all top level windows.
|
||||
** @see ui-manager.hpp
|
||||
*/
|
||||
|
||||
|
||||
#include "gui/workspace/ui-manager.hpp"
|
||||
#include "gui/workspace/window-manager.hpp"
|
||||
#include "gui/workspace/window-list.hpp"
|
||||
#include "gui/workspace/workspace-window.hpp"
|
||||
|
||||
#include <memory>
|
||||
|
|
@ -37,20 +43,20 @@ namespace workspace {
|
|||
|
||||
|
||||
|
||||
WindowManager::WindowManager (UiManager& uiManager)
|
||||
WindowList::WindowList (UiManager& uiManager)
|
||||
: uiManager_{uiManager}
|
||||
, windowList_{}
|
||||
{ }
|
||||
|
||||
|
||||
void
|
||||
WindowManager::newWindow (gui::model::Project& source_project, gui::controller::Controller& source_controller)
|
||||
WindowList::newWindow (gui::model::Project& source_project, gui::controller::Controller& source_controller)
|
||||
{
|
||||
PWindow window (new WorkspaceWindow{uiManager_, source_project, source_controller});
|
||||
REQUIRE(window);
|
||||
|
||||
window->signal_delete_event().connect(sigc::mem_fun(
|
||||
this, &WindowManager::on_window_closed));
|
||||
this, &WindowList::on_window_closed));
|
||||
|
||||
windowList_.push_back(window);
|
||||
|
||||
|
|
@ -61,7 +67,7 @@ namespace workspace {
|
|||
|
||||
|
||||
bool
|
||||
WindowManager::on_window_closed (GdkEventAny* event)
|
||||
WindowList::on_window_closed (GdkEventAny* event)
|
||||
{
|
||||
REQUIRE(event);
|
||||
REQUIRE(event->window);
|
||||
|
|
@ -100,7 +106,7 @@ namespace workspace {
|
|||
|
||||
|
||||
void
|
||||
WindowManager::updateCloseWindowInMenus()
|
||||
WindowList::updateCloseWindowInMenus()
|
||||
{
|
||||
uiManager_.allowCloseWindow ( 1 < windowList_.size());
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
WINDOW-MANAGER.hpp - Global UI Manager
|
||||
WINDOW-LIST.hpp - manage all top level windows
|
||||
|
||||
Copyright (C) Lumiera.org
|
||||
2008, Joel Holdsworth <joel@airwebreathe.org.uk>
|
||||
|
|
@ -21,10 +21,10 @@
|
|||
*/
|
||||
|
||||
|
||||
/** @file window-manager.hpp
|
||||
/** @file window-list.hpp
|
||||
** Manager for all top level application windows.
|
||||
** The central WindowManager instance is owned by the GtkLumiera object and
|
||||
** initialised in GTK-main. The WindowManager allows to create new windows
|
||||
** The central WindowList instance is owned by the GtkLumiera object and
|
||||
** initialised in GTK-main. The WindowList allows to create new windows
|
||||
** integrated with the application framework.
|
||||
**
|
||||
** @see gtk-lumiera.hpp
|
||||
|
|
@ -32,8 +32,8 @@
|
|||
*/
|
||||
|
||||
|
||||
#ifndef GUI_WINDOW_MANAGER_H
|
||||
#define GUI_WINDOW_MANAGER_H
|
||||
#ifndef GUI_WINDOW_LIST_H
|
||||
#define GUI_WINDOW_LIST_H
|
||||
|
||||
#include "gui/gtk-base.hpp"
|
||||
|
||||
|
|
@ -59,7 +59,7 @@ namespace workspace {
|
|||
/**
|
||||
* A centralised manager of all top level application windows.
|
||||
*/
|
||||
class WindowManager
|
||||
class WindowList
|
||||
: boost::noncopyable
|
||||
{
|
||||
using PWindow = shared_ptr<WorkspaceWindow>;
|
||||
|
|
@ -69,7 +69,7 @@ namespace workspace {
|
|||
|
||||
|
||||
public:
|
||||
WindowManager (UiManager&);
|
||||
WindowList (UiManager&);
|
||||
|
||||
/**
|
||||
* Create a new window connected to a specified project and controller
|
||||
|
|
@ -105,4 +105,4 @@ namespace workspace {
|
|||
|
||||
|
||||
}}// namespace gui::workspace
|
||||
#endif /*GUI_WINDOW_MANAGER_H*/
|
||||
#endif /*GUI_WINDOW_LIST_H*/
|
||||
|
|
@ -1695,7 +1695,8 @@
|
|||
<node CREATED="1485454263876" ID="ID_543704434" MODIFIED="1485454270615" TEXT="globale Keybindings"/>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1485126466520" ID="ID_717310004" MODIFIED="1485457324752" TEXT="WindowManager">
|
||||
<node CREATED="1485126466520" ID="ID_717310004" MODIFIED="1485546455540" TEXT="WindowManager">
|
||||
<icon BUILTIN="button_cancel"/>
|
||||
<node CREATED="1485457325724" ID="ID_1954589768" MODIFIED="1485457325724" TEXT="nur für die Hauptfenster zuständig"/>
|
||||
<node CREATED="1485457328043" ID="ID_1787642462" MODIFIED="1485457367904" TEXT="wir haben kein ApplicationWindow">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
|
|
@ -1712,6 +1713,33 @@
|
|||
<icon BUILTIN="idea"/>
|
||||
</node>
|
||||
<node CREATED="1485457370310" ID="ID_1931452525" MODIFIED="1485457379864" TEXT="GtkWindow sind völlig ausreichend"/>
|
||||
<node CREATED="1485546285407" ID="ID_1129769291" MODIFIED="1485546307908">
|
||||
<richcontent TYPE="NODE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
muß kein <b>Manager</b> sein
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
<icon BUILTIN="yes"/>
|
||||
</node>
|
||||
<node CREATED="1485546319434" ID="ID_1592361314" MODIFIED="1485546343174" TEXT="macht nur eine Sache">
|
||||
<icon BUILTIN="idea"/>
|
||||
<node CREATED="1485546325993" ID="ID_1335197005" MODIFIED="1485546333460" TEXT="nämlich eine Liste der Fenster verwalten"/>
|
||||
</node>
|
||||
<node CREATED="1485546344471" ID="ID_582242471" MODIFIED="1485546422834" TEXT="WindowList">
|
||||
<arrowlink DESTINATION="ID_298060478" ENDARROW="Default" ENDINCLINATION="-3;-38;" ID="Arrow_ID_683571287" STARTARROW="None" STARTINCLINATION="-62;0;"/>
|
||||
<icon BUILTIN="forward"/>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1485546396952" ID="ID_298060478" MODIFIED="1485546422834" TEXT="WindowList">
|
||||
<linktarget COLOR="#a9b4c1" DESTINATION="ID_298060478" ENDARROW="Default" ENDINCLINATION="-3;-38;" ID="Arrow_ID_683571287" SOURCE="ID_582242471" STARTARROW="None" STARTINCLINATION="-62;0;"/>
|
||||
<node CREATED="1485546400807" ID="ID_1118405222" MODIFIED="1485546415097" TEXT="macht, was vom großen Manager übrig blieb"/>
|
||||
<node CREATED="1485546425452" ID="ID_1088557274" MODIFIED="1485546450588" TEXT="wird von GtkLumiera gehalten und verdrahtet"/>
|
||||
</node>
|
||||
<node CREATED="1485126481023" ID="ID_943652445" MODIFIED="1485126488201" TEXT="pro Fenster">
|
||||
<node CREATED="1485126488981" ID="ID_1346100835" MODIFIED="1485126494129" TEXT="WorkspaceWindow"/>
|
||||
|
|
|
|||
Loading…
Reference in a new issue