32 using namespace boost;
39 const PanelManager::PanelDescription
40 PanelManager::panelDescriptionList[] = {
41 PanelManager::Panel<TimelinePanel>(),
42 PanelManager::Panel<InfoBoxPanel>(),
43 PanelManager::Panel<ViewerPanel>(),
44 PanelManager::Panel<AssetsPanel>()
47 unsigned short PanelManager::panelID = 0;
51 PanelManager::PanelManager (WorkspaceWindow& owner)
52 : workspaceWindow_(owner)
58 dockLayout_ = Gdl::DockLayout::create(dock_);
61 Glib::RefPtr<Gdl::DockMaster> dock_master = dock_.property_master();
62 dock_master->property_switcher_style() = Gdl::SWITCHER_STYLE_ICON;
64 memset(&dockPlaceholders_, 0,
sizeof(dockPlaceholders_));
69 PanelManager::~PanelManager()
75 for(int i = 0; i < 4; i++) 77 if(dockPlaceholders_[i])
78 g_object_unref(dockPlaceholders_[i]);
87 PanelManager::setupDock()
91 REQUIRE(dockPlaceholders_[0] == NULL && dockPlaceholders_[1] == NULL &&
92 dockPlaceholders_[2] == NULL && dockPlaceholders_[3] == NULL);
93 dockPlaceholders_[0] = GDL_DOCK_PLACEHOLDER(gdl_dock_placeholder_new(
94 "ph1", GDL_DOCK_OBJECT(dock_.gobj()), GDL_DOCK_TOP, FALSE));
95 dockPlaceholders_[1] = GDL_DOCK_PLACEHOLDER(gdl_dock_placeholder_new(
96 "ph2", GDL_DOCK_OBJECT(dock_.gobj()), GDL_DOCK_BOTTOM, FALSE));
97 dockPlaceholders_[2] = GDL_DOCK_PLACEHOLDER(gdl_dock_placeholder_new(
98 "ph3", GDL_DOCK_OBJECT(dock_.gobj()), GDL_DOCK_LEFT, FALSE));
99 dockPlaceholders_[3] = GDL_DOCK_PLACEHOLDER(gdl_dock_placeholder_new(
100 "ph4", GDL_DOCK_OBJECT(dock_.gobj()), GDL_DOCK_RIGHT, FALSE));
101 ENSURE(dockPlaceholders_[0] && dockPlaceholders_[1] &&
102 dockPlaceholders_[2] && dockPlaceholders_[3]);
109 PanelManager::getDock()
116 PanelManager::getDockBar()
123 PanelManager::getWorkspaceWindow()
125 return workspaceWindow_;
130 PanelManager::hasPanel (
const int description_index)
134 return getPanelType(panel) == description_index;
139 PanelManager::showPanel (
const int description_index)
142 list< panel::Panel* >::iterator i;
143 for(i = panels_.begin(); i != panels_.end(); i++)
146 if (getPanelType(panel) == description_index)
148 if (!panel->is_shown()) panel->
show();
151 dock_item.present(dock_);
158 panel::Panel *new_panel = createPanel_by_index (description_index);
161 dock_.add_item(new_panel->
getDockItem(), Gdl::DOCK_FLOATING);
169 PanelManager::switchPanel (
panel::Panel& old_panel,
const int description_index)
171 REQUIRE (description_index >= 0 &&
172 description_index < getPanelDescriptionCount());
175 Gdl::DockItem &dock_item = old_panel.
getDockItem();
178 removePanel (&old_panel);
181 createPanel_by_index (description_index, dock_item);
186 PanelManager::splitPanel (
panel::Panel& panel, Gtk::Orientation split_direction)
190 const int index = getPanelType(&panel);
194 Gdl::DockPlacement placement = Gdl::DOCK_NONE;
195 switch(split_direction)
197 case ORIENTATION_HORIZONTAL:
198 placement = Gdl::DOCK_RIGHT;
201 case ORIENTATION_VERTICAL:
202 placement = Gdl::DOCK_BOTTOM;
206 ERROR (
stage,
"Unknown split_direction: %d", split_direction);
217 PanelManager::getPanelDescriptionCount()
224 PanelManager::getPanelStockID (
int index)
226 REQUIRE (index >= 0 && index < getPanelDescriptionCount());
227 return panelDescriptionList[index].getStockID();
232 PanelManager::getPanelTitle (
int index)
234 REQUIRE (index >= 0 && index < getPanelDescriptionCount());
235 return panelDescriptionList[index].getTitle();
240 PanelManager::createPanels()
243 panel::Panel* assetsPanel = createPanel_by_name(
"AssetsPanel");
244 panel::Panel* viewerPanel = createPanel_by_name(
"InfoBoxPanel");
245 panel::Panel* timelinePanel = createPanel_by_name(
"TimelinePanel");
247 dock_.add_item(assetsPanel->
getDockItem(),Gdl::DOCK_LEFT);
248 dock_.add_item(timelinePanel->
getDockItem(),Gdl::DOCK_BOTTOM);
249 dock_.add_item(viewerPanel->
getDockItem(),Gdl::DOCK_RIGHT);
254 PanelManager::findPanelDescription (
const char* class_name)
258 const int count = getPanelDescriptionCount();
259 for(
int i = 0; i < count; i++)
261 if (strstr(panelDescriptionList[i].getClassName(), class_name))
265 ERROR (
stage,
"Unable to find a description with class name %s", class_name);
271 PanelManager::createPanel_by_index (
const int index)
273 REQUIRE(index >= 0 && index < getPanelDescriptionCount());
277 snprintf(name,
sizeof(name),
"%X", panelID++);
280 return createPanel_by_index(index,
281 *
new Gdl::DockItem(name,
"",Gdl::DOCK_ITEM_BEH_NORMAL));
286 PanelManager::createPanel_by_index (
const int index, Gdl::DockItem &dock_item)
289 panel::Panel *panel = panelDescriptionList[index].create(*
this, dock_item);
295 sigc::mem_fun(*
this, &PanelManager::on_panel_shown), panel));
298 panels_.push_back(panel);
305 PanelManager::createPanel_by_name (
const char* class_name)
308 const int index = findPanelDescription(class_name);
309 return createPanel_by_index(index);
318 const type_info &info =
typeid(*panel);
319 const int count = getPanelDescriptionCount();
320 for(
int i = 0; i < count; i++)
322 if(info == panelDescriptionList[i].getClassInfo())
326 ERROR (
stage,
"Unable to find a description with with this class type");
336 list< panel::Panel* >::iterator i;
337 for(i = panels_.begin(); i != panels_.end(); i++)
350 PanelManager::clearPanels()
354 list< panel::Panel* >::iterator i;
355 for(i = panels_.begin(); i != panels_.end(); i++)
Management of dockable panels.
This header is for including and configuring NoBug.
bool is_iconified() const
void show(bool show=true)
Shows or hides the panel.
A (dockable) panel to organise the assets of a project.
The base class for all dockable panels.
Lumiera GTK UI implementation root.
A (dockable) panel to display and manage information and parameters.
The main Lumiera workspace window.
Definition of a dockable panel to hold the video viewers.
sigc::signal< void > & signal_hidePanel()
fires when the dock item gets hidden.
Gdl::DockItem & getDockItem()
Perform operations "for each element" of a collection.
A class to describe and instantiate Panel types.
A dockable container to hold a notebook of timeline displays.