DockAccess: add lookup-by-Type function to PanelManager

...now the mess multiplies
This commit is contained in:
Fischlurch 2018-08-17 16:27:51 +02:00
parent 987aad44c1
commit c0dca2d978
5 changed files with 80 additions and 9 deletions

View file

@ -143,7 +143,7 @@ namespace workspace {
}
void
panel::Panel&
DockArea::showPanel (const int description_index)
{
// Try and find the panel and present it if possible
@ -158,7 +158,8 @@ namespace workspace {
Gdl::DockItem &dock_item = panel->getDockItem();
// ENSURE(dock_item);
dock_item.present(dock_);
return;
ENSURE (panel);
return *panel;
}
}
@ -167,6 +168,9 @@ namespace workspace {
// Dock the item
dock_.add_item(new_panel->getDockItem(), Gdl::DOCK_FLOATING);
ENSURE (new_panel);
return *new_panel;
}
@ -256,7 +260,7 @@ namespace workspace {
int
DockArea::findPanelDescription (const char* class_name) const
DockArea::findPanelDescription (const char* class_name)
{
REQUIRE(class_name);

View file

@ -28,6 +28,10 @@
** @todo 2017 need to clarify the intended behaviour of panels
** ///////////////////////////////////////////////////////////////////////////TICKET #1097 clarify the role and behaviour of Panels
** @todo will be transformed into a Dock entity as of 6/2018 /////////////////////////////////////////////TICKET #1144 refactor dock handling
** @todo as of 8/2018 this is a copy of the (still actively used) PanelManager;
** the intention was to do a clean rewrite and then throw away
** the old messy PanelManager implementation. Meanwhile I was forced to add
** yet more cruft to PanelManager, just to keep it going. Beware!
**
** @see actions.hpp
*/
@ -117,8 +121,9 @@ namespace workspace {
/**
* Shows a panel given a description index.
* @param description_index The index of the panel type to show.
* @return existing or new Panel, docked within the realm of this PanelManager.
*/
void showPanel (const int description_index);
panel::Panel& showPanel (const int description_index);
/**
* Switches a panel from one type to another,
@ -138,6 +143,14 @@ namespace workspace {
public:
/**
* retrieve the internal type-ID corresponding to the given panel implementation type.
* @return internal index into the #panelDescriptionList, or `-1` if not found.
* @deprecated the whole concept of panel identification needs overhaul 8/2018
*/
template<class P>
static int findPanelID();
/** Gets the number of panel descriptions. */
static int getPanelDescriptionCount();
@ -166,7 +179,7 @@ namespace workspace {
* @return Returns the index of the panel description found, or -1
* if no description was found for this type.
*/
int findPanelDescription (const char* class_name) const;
static int findPanelDescription (const char* class_name);
/**
* Creates a panel by description index.
@ -338,5 +351,16 @@ namespace workspace {
};
template<class P>
inline int
DockArea::findPanelID()
{
return DockArea::findPanelDescription (typeid(P).name());
}
}}// namespace gui::workspace
#endif /*GUI_WORKSPACE_DOCK_AREA_H*/

View file

@ -252,7 +252,7 @@ namespace workspace {
int
PanelManager::findPanelDescription (const char* class_name) const
PanelManager::findPanelDescription (const char* class_name)
{
REQUIRE(class_name);

View file

@ -136,6 +136,14 @@ namespace workspace {
public:
/**
* retrieve the internal type-ID corresponding to the given panel implementation type.
* @return internal index into the #panelDescriptionList, or `-1` if not found.
* @deprecated the whole concept of panel identification needs overhaul 8/2018
*/
template<class P>
static int findPanelID();
/** Gets the number of panel descriptions. */
static int getPanelDescriptionCount();
@ -164,7 +172,7 @@ namespace workspace {
* @return Returns the index of the panel description found, or -1
* if no description was found for this type.
*/
int findPanelDescription (const char* class_name) const;
static int findPanelDescription (const char* class_name);
/**
* Creates a panel by description index.
@ -335,5 +343,16 @@ namespace workspace {
};
template<class P>
inline int
PanelManager::findPanelID()
{
return PanelManager::findPanelDescription (typeid(P).name());
}
}}// namespace gui::workspace
#endif /*GUI_WORKSPACE_PANEL_MANAGER_H*/

View file

@ -1668,9 +1668,15 @@
<node CREATED="1533608822826" ID="ID_1772827095" MODIFIED="1533608834604" TEXT="Schema zur reproduzierbaren ID-Generierung ist notwendig"/>
</node>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1534513723209" ID="ID_592805858" MODIFIED="1534513758605" TEXT="PanelManger liefert Panel">
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1534513723209" ID="ID_592805858" MODIFIED="1534516350994" TEXT="PanelManger liefert Panel">
<arrowlink COLOR="#99a7bd" DESTINATION="ID_1360472787" ENDARROW="Default" ENDINCLINATION="772;-6907;" ID="Arrow_ID_1137118362" STARTARROW="None" STARTINCLINATION="698;1616;"/>
<icon BUILTIN="flag-yellow"/>
<node CREATED="1534513739655" ID="ID_1688346556" MODIFIED="1534513746810" TEXT="Suche per Typ-ID"/>
<node COLOR="#338800" CREATED="1534513739655" ID="ID_1688346556" MODIFIED="1534516101304" TEXT="Suche per Typ-ID">
<icon BUILTIN="button_ok"/>
</node>
<node COLOR="#338800" CREATED="1534516106942" ID="ID_1930444963" MODIFIED="1534516117582" TEXT="Referenz auf Panel zur&#xfc;ckliefern">
<icon BUILTIN="button_ok"/>
</node>
<node CREATED="1534513747542" ID="ID_313486234" MODIFIED="1534513755681" TEXT="im Moment eine int-ID">
<icon BUILTIN="messagebox_warning"/>
</node>
@ -14378,6 +14384,24 @@
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1534510993903" ID="ID_1287156693" MODIFIED="1534511005821" TEXT="M&#xfc;llhaufen">
<icon BUILTIN="clanbomber"/>
</node>
<node CREATED="1534515750767" HGAP="258" ID="ID_1360472787" MODIFIED="1534516350994" TEXT="bestehende Anforderungen" VSHIFT="-4">
<linktarget COLOR="#99a7bd" DESTINATION="ID_1360472787" ENDARROW="Default" ENDINCLINATION="772;-6907;" ID="Arrow_ID_1137118362" SOURCE="ID_592805858" STARTARROW="None" STARTINCLINATION="698;1616;"/>
<icon BUILTIN="info"/>
<node CREATED="1534515787114" ID="ID_1305719148" MODIFIED="1534515800828" TEXT="Standard-Ausstattung mit Panels in jedem Fenster erzeugen"/>
<node CREATED="1534515801632" ID="ID_1919529189" MODIFIED="1534515823721" TEXT="Panel-Description-Index verwenden"/>
<node CREATED="1534515812439" ID="ID_1980530420" MODIFIED="1534515817842" TEXT="Liste aller Panels verwalten"/>
<node CREATED="1534515834947" ID="ID_510158797" MODIFIED="1534515927180" TEXT="gew&#xfc;nschtes Panel anzeigen, ggfs erstellen">
<linktarget COLOR="#a9b4c1" DESTINATION="ID_510158797" ENDARROW="Default" ENDINCLINATION="104;0;" ID="Arrow_ID_161519533" SOURCE="ID_819902852" STARTARROW="None" STARTINCLINATION="83;0;"/>
<linktarget COLOR="#a9b4c1" DESTINATION="ID_510158797" ENDARROW="Default" ENDINCLINATION="68;0;" ID="Arrow_ID_970402595" SOURCE="ID_747338376" STARTARROW="None" STARTINCLINATION="89;0;"/>
</node>
<node CREATED="1534515873606" ID="ID_819902852" MODIFIED="1534515892457" TEXT="Referenz auf ein Panel beziehen">
<arrowlink DESTINATION="ID_510158797" ENDARROW="Default" ENDINCLINATION="104;0;" ID="Arrow_ID_161519533" STARTARROW="None" STARTINCLINATION="83;0;"/>
</node>
<node CREATED="1534515905714" ID="ID_747338376" MODIFIED="1534515927180" TEXT="Men&#xfc;-Aktionen: bestimmtes Panel anzeigen">
<arrowlink DESTINATION="ID_510158797" ENDARROW="Default" ENDINCLINATION="68;0;" ID="Arrow_ID_970402595" STARTARROW="None" STARTINCLINATION="89;0;"/>
</node>
<node CREATED="1534515935653" ID="ID_1660813925" MODIFIED="1534516000145" TEXT="Panel durch ein Panel anderen Typs ersetzen"/>
</node>
<node BACKGROUND_COLOR="#ccb59b" COLOR="#6e2a38" CREATED="1534510983624" ID="ID_1587195721" MODIFIED="1534511031983" TEXT="setzt Konzept voraus">
<arrowlink COLOR="#202e48" DESTINATION="ID_1526164022" ENDARROW="Default" ENDINCLINATION="7;-78;" ID="Arrow_ID_1840345516" STARTARROW="None" STARTINCLINATION="-84;65;"/>
<font ITALIC="true" NAME="SansSerif" SIZE="14"/>