spirit-code / spirit

Atomistic Spin Simulation Framework
http://spirit-code.github.io
MIT License
118 stars 52 forks source link

Imgui Docking #598

Closed MSallermann closed 2 years ago

MSallermann commented 3 years ago

Uses the imgui docking branch to enhance the imgui version of spirit.

codecov[bot] commented 3 years ago

Codecov Report

Merging #598 (7a1d50e) into develop (945e3d5) will decrease coverage by 0.00%. The diff coverage is 0.00%.

@@             Coverage Diff             @@
##           develop     #598      +/-   ##
===========================================
- Coverage    48.00%   47.99%   -0.01%     
===========================================
  Files           72       72              
  Lines        11249    11251       +2     
===========================================
  Hits          5400     5400              
- Misses        5849     5851       +2     
coveralls commented 3 years ago

Coverage Status

Coverage remained the same at 80.986% when pulling 7a1d50eb5cc55dd460dd2259eb36b44be7c37a09 on imgui-test into 2dab6cfc95913929592695684c0261b28b47c9c7 on develop.

GPMueller commented 3 years ago

In order to determine whether any windows are docked into the right-side dock-space, one could use the imgui-internal APIs:

for( const auto * w : spirit_widgets )
{
    if( w->imgui_window_ptr )
    {
        if( w->imgui_window_ptr->DockNode )
        {
            ImGuiDockNode * node   = w->imgui_window_ptr->DockNode;
            ImGuiDockNode * parent = node->ParentNode;
            while( parent )
            {
                node = parent;
                parent = node->ParentNode;
            }
            if( node->ID == id_dockspace_right )
                fmt::print( "{} is docked in the sidebar\n", w->title );
        }
    }
}

for which the WidgetBase needs to store its window-pointer, imgui_window_ptr = ImGui::GetCurrentWindow();. I currently don't see any way to get the same information without using the internal APIs in both classes... 😕

For some reason, it also seems that the evaluation of node->ParentNode->ID only works inside the MainWindow::draw function. If placed into WidgetBase::show, there does not seem to be a parent for windows docked into the sidebar.

GPMueller commented 2 years ago

Implemented a few of the feature-parity points from issue #600.