Lumiera  0.pre.03
»edit your freedom«
ui-manager.cpp
Go to the documentation of this file.
1 /*
2  UiManager - Global UI Manager
3 
4  Copyright (C)
5  2008, Joel Holdsworth <joel@airwebreathe.org.uk>
6  2017, Hermann Vosseler <Ichthyostega@web.de>
7 
8   **Lumiera** is free software; you can redistribute it and/or modify it
9   under the terms of the GNU General Public License as published by the
10   Free Software Foundation; either version 2 of the License, or (at your
11   option) any later version. See the file COPYING for further details.
12 
13 * *****************************************************************/
14 
15 
27 #include "stage/gtk-base.hpp"
28 #include "stage/config-keys.hpp"
31 #include "stage/ctrl/actions.hpp"
32 #include "stage/ctrl/facade.hpp"
34 #include "lib/searchpath.hpp"
35 #include "lib/util.hpp"
36 
37 #include <gdlmm.h>
38 
39 using util::isnil;
40 
41 
42 namespace stage {
43 namespace ctrl {
44 
45  using Gtk::IconSize;
46  using Gtk::IconFactory;
47 
48  using workspace::UiStyle;
49 
50 
51 
52 
53  // dtors via smart-ptr invoked from here...
54  UiManager::~UiManager() { }
55 
56 
67  {
68  Glib::thread_init();
69  //---------------------------------------------copied from Gtk::Main
70  gtk_init (nullptr, nullptr);
71  Gtk::Main::init_gtkmm_internals();
72  //---------------------------------------------copied from Gtk::Main
73  Gdl::init();
74  }
75 
76  ApplicationBase::~ApplicationBase()
77  {
78  //---------------------------------------------copied from Gtk::Main
79  // Release the gtkmm type registration tables,
80  // allowing Main to be instantiated again:
81  Glib::wrap_register_cleanup();
82  Glib::Error::register_cleanup();
83  //---------------------------------------------copied from Gtk::Main
84 
85  // NOTE: GtkMainConnectionNode only serves the deprecated key_snooper API as of 2018
86  }
87 
88 
96  : ApplicationBase()
97  , Gtk::UIManager()
98  , globals_{new GlobalCtx{bus, *this}}
99  , uiStyle_{new UiStyle{}}
100  , actions_{new Actions{*globals_}}
101  , facade_{} // note: not activated yet
102  {
103  actions_->populateMainActions (*this);
104  }
105 
106 
111  void
113  {
114  if (globals_->windowLoc_.empty())
115  globals_->windowLoc_.newWindow();
116  }
117 
118 
128  void
130  {
131  facade_.reset (new Facade{globals_->uiBus_, *this});
132 
133  gtk_main(); // GTK event loop
134 
135  facade_.reset (nullptr);
136  }
137 
138 
146  void
148  {
149  gtk_main_quit();
150  }
151 
152 
160  void
161  UiManager::schedule (Operation&& task)
162  {
163  UNIMPLEMENTED ("TICKET #1151 build a suitable dispatcher into the GTK loop");
164  }
165 
166 
167  void
169  {
171  actions_->updateActionState (globals_->windowLoc_.findActiveWindow());
172  }
173 
174 
175  void
176  UiManager::allowCloseWindow (bool yes)
177  {
178  this->get_action("/MenuBar/WindowMenu/WindowCloseWindow")
179  ->set_sensitive (yes);
180  }
181 
182 
183  void
184  UiManager::configureStyle (timeline::TimelineWidget const& timeline)
185  {
186  uiStyle_->prepareStyleContext (timeline);
187  }
188 
189 
190 
191 }}// namespace stage::ctrl
void performMainLoop()
start the GTK Main loop and thus activate the UI.
Definition: ui-manager.cpp:129
Definition of access keys for global UI configuration.
Service for global theming and style related concerns.
Helpers to handle directory search paths.
Setup of global actions for the main menu.
void createApplicationWindow()
Set up the first top-level application window.
Definition: ui-manager.cpp:112
Dependency context to hold all the global UI top-level entities.
void updateWindowFocusRelatedActions()
Definition: ui-manager.cpp:168
void terminateUI()
Cause the main event loop to terminate, so the application as a whole unwinds.
Definition: ui-manager.cpp:147
A context to hold and manage the implementation of all UI facade interfaces.
Backbone of the Lumiera GTK GUI.
Definition: ui-bus.hpp:150
UiManager(UiBus &bus)
Initialise the GTK framework and the Lumiera UI backbone.
Definition: ui-manager.cpp:95
Manager for global user interface concerns, framework integration and global state.
Core timeline display (custom widget).
Lumiera GTK UI implementation root.
Definition: guifacade.cpp:37
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
A helper class which registers global user actions and populates the main menu and toolbar...
Definition: actions.hpp:67
ApplicationBase()
Initialise the GTK framework libraries.
Definition: ui-manager.cpp:66
A global circle of top-level UI management facilities.
Definition: global-ctx.hpp:70
void schedule(Operation &&task)
perform an action within the UI event loop (GTK loop).
Definition: ui-manager.cpp:161
A set of basic GTK includes for the UI.
Framework initialisation base.
Definition: ui-manager.hpp:68
Manage global concerns regarding a coherent user interface.
Definition: ui-style.hpp:63