41 using namespace boost;
48 const PanelManager::PanelDescription
49 PanelManager::panelDescriptionList[] = {
50 PanelManager::Panel<TimelinePanel>(),
51 PanelManager::Panel<InfoBoxPanel>(),
52 PanelManager::Panel<ViewerPanel>(),
53 PanelManager::Panel<AssetsPanel>()
56 unsigned short PanelManager::panelID = 0;
60 PanelManager::PanelManager (WorkspaceWindow& owner)
61 : workspaceWindow_(owner)
67 dockLayout_ = Gdl::DockLayout::create(dock_);
70 Glib::RefPtr<Gdl::DockMaster> dock_master = dock_.property_master();
71 dock_master->property_switcher_style() = Gdl::SWITCHER_STYLE_ICON;
73 memset(&dockPlaceholders_, 0,
sizeof(dockPlaceholders_));
78 PanelManager::~PanelManager()
84 for(int i = 0; i < 4; i++) 86 if(dockPlaceholders_[i])
87 g_object_unref(dockPlaceholders_[i]);
96 PanelManager::setupDock()
100 REQUIRE(dockPlaceholders_[0] == NULL && dockPlaceholders_[1] == NULL &&
101 dockPlaceholders_[2] == NULL && dockPlaceholders_[3] == NULL);
102 dockPlaceholders_[0] = GDL_DOCK_PLACEHOLDER(gdl_dock_placeholder_new(
103 "ph1", GDL_DOCK_OBJECT(dock_.gobj()), GDL_DOCK_TOP, FALSE));
104 dockPlaceholders_[1] = GDL_DOCK_PLACEHOLDER(gdl_dock_placeholder_new(
105 "ph2", GDL_DOCK_OBJECT(dock_.gobj()), GDL_DOCK_BOTTOM, FALSE));
106 dockPlaceholders_[2] = GDL_DOCK_PLACEHOLDER(gdl_dock_placeholder_new(
107 "ph3", GDL_DOCK_OBJECT(dock_.gobj()), GDL_DOCK_LEFT, FALSE));
108 dockPlaceholders_[3] = GDL_DOCK_PLACEHOLDER(gdl_dock_placeholder_new(
109 "ph4", GDL_DOCK_OBJECT(dock_.gobj()), GDL_DOCK_RIGHT, FALSE));
110 ENSURE(dockPlaceholders_[0] && dockPlaceholders_[1] &&
111 dockPlaceholders_[2] && dockPlaceholders_[3]);
118 PanelManager::getDock()
125 PanelManager::getDockBar()
132 PanelManager::getWorkspaceWindow()
134 return workspaceWindow_;
139 PanelManager::hasPanel (
const int description_index)
143 return getPanelType(panel) == description_index;
148 PanelManager::showPanel (
const int description_index)
151 list< panel::Panel* >::iterator i;
152 for(i = panels_.begin(); i != panels_.end(); i++)
155 if (getPanelType(panel) == description_index)
157 if (!panel->is_shown()) panel->
show();
160 dock_item.present(dock_);
167 panel::Panel *new_panel = createPanel_by_index (description_index);
170 dock_.add_item(new_panel->
getDockItem(), Gdl::DOCK_FLOATING);
178 PanelManager::switchPanel (
panel::Panel& old_panel,
const int description_index)
180 REQUIRE (description_index >= 0 &&
181 description_index < getPanelDescriptionCount());
184 Gdl::DockItem &dock_item = old_panel.
getDockItem();
187 removePanel (&old_panel);
190 createPanel_by_index (description_index, dock_item);
195 PanelManager::splitPanel (
panel::Panel& panel, Gtk::Orientation split_direction)
199 const int index = getPanelType(&panel);
203 Gdl::DockPlacement placement = Gdl::DOCK_NONE;
204 switch(split_direction)
206 case ORIENTATION_HORIZONTAL:
207 placement = Gdl::DOCK_RIGHT;
210 case ORIENTATION_VERTICAL:
211 placement = Gdl::DOCK_BOTTOM;
215 ERROR (
stage,
"Unknown split_direction: %d", split_direction);
226 PanelManager::getPanelDescriptionCount()
233 PanelManager::getPanelStockID (
int index)
235 REQUIRE (index >= 0 && index < getPanelDescriptionCount());
236 return panelDescriptionList[index].getStockID();
241 PanelManager::getPanelTitle (
int index)
243 REQUIRE (index >= 0 && index < getPanelDescriptionCount());
244 return panelDescriptionList[index].getTitle();
249 PanelManager::createPanels()
252 panel::Panel* assetsPanel = createPanel_by_name(
"AssetsPanel");
253 panel::Panel* viewerPanel = createPanel_by_name(
"InfoBoxPanel");
254 panel::Panel* timelinePanel = createPanel_by_name(
"TimelinePanel");
256 dock_.add_item(assetsPanel->
getDockItem(),Gdl::DOCK_LEFT);
257 dock_.add_item(timelinePanel->
getDockItem(),Gdl::DOCK_BOTTOM);
258 dock_.add_item(viewerPanel->
getDockItem(),Gdl::DOCK_RIGHT);
263 PanelManager::findPanelDescription (
const char* class_name)
267 const int count = getPanelDescriptionCount();
268 for(
int i = 0; i < count; i++)
270 if (strstr(panelDescriptionList[i].getClassName(), class_name))
274 ERROR (
stage,
"Unable to find a description with class name %s", class_name);
280 PanelManager::createPanel_by_index (
const int index)
282 REQUIRE(index >= 0 && index < getPanelDescriptionCount());
286 snprintf(name,
sizeof(name),
"%X", panelID++);
289 return createPanel_by_index(index,
290 *
new Gdl::DockItem(name,
"",Gdl::DOCK_ITEM_BEH_NORMAL));
295 PanelManager::createPanel_by_index (
const int index, Gdl::DockItem &dock_item)
298 panel::Panel *panel = panelDescriptionList[index].create(*
this, dock_item);
304 sigc::mem_fun(*
this, &PanelManager::on_panel_shown), panel));
307 panels_.push_back(panel);
314 PanelManager::createPanel_by_name (
const char* class_name)
317 const int index = findPanelDescription(class_name);
318 return createPanel_by_index(index);
327 const type_info &info =
typeid(*panel);
328 const int count = getPanelDescriptionCount();
329 for(
int i = 0; i < count; i++)
331 if(info == panelDescriptionList[i].getClassInfo())
335 ERROR (
stage,
"Unable to find a description with with this class type");
345 list< panel::Panel* >::iterator i;
346 for(i = panels_.begin(); i != panels_.end(); i++)
359 PanelManager::clearPanels()
363 list< panel::Panel* >::iterator i;
364 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.