mirror of
https://github.com/OPM/ResInsight.git
synced 2026-11-13 09:37:29 -06:00
Flow plots derive from RimViewWindow, not RimPlotWindow, and were missing from RiuPlotMainWindow::viewWindows(). Applying the default dock layout on project open therefore did not re-add their dock widgets. 3D views docked in the plot window are now listed by the plot main window only, and are still activated as the active 3D view so the 3D main window toolbars (e.g. time step animation) are refreshed.
187 lines
6.4 KiB
C++
187 lines
6.4 KiB
C++
/////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
// Copyright (C) 2018- Equinor ASA
|
|
//
|
|
// ResInsight is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
//
|
|
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
// FITNESS FOR A PARTICULAR PURPOSE.
|
|
//
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
|
// for more details.
|
|
//
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
#include "RiuPlotMainWindowTools.h"
|
|
|
|
#include "RiaGuiApplication.h"
|
|
|
|
#include "Rim3dView.h"
|
|
#include "RimViewWindow.h"
|
|
|
|
#include "RiuMainWindow.h"
|
|
#include "RiuPlotMainWindow.h"
|
|
|
|
#include "cafPdmObject.h"
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RiuPlotMainWindowTools::showPlotMainWindow()
|
|
{
|
|
if ( RiaGuiApplication::isRunning() )
|
|
{
|
|
RiaGuiApplication::instance()->getOrCreateAndShowMainPlotWindow();
|
|
}
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RiuPlotMainWindowTools::setActiveViewer( QString viewerName )
|
|
{
|
|
if ( RiaGuiApplication::isRunning() )
|
|
{
|
|
if ( auto mpw = RiaGuiApplication::instance()->mainPlotWindow() )
|
|
{
|
|
mpw->setActiveViewer( viewerName );
|
|
}
|
|
}
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RiuPlotMainWindowTools::setExpanded( const caf::PdmUiItem* uiItem )
|
|
{
|
|
if ( RiaGuiApplication::isRunning() )
|
|
{
|
|
if ( auto mpw = RiaGuiApplication::instance()->mainPlotWindow() )
|
|
{
|
|
mpw->setExpanded( uiItem, true );
|
|
}
|
|
}
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RiuPlotMainWindowTools::selectAsCurrentItem( const caf::PdmObject* object )
|
|
{
|
|
if ( RiaGuiApplication::isRunning() )
|
|
{
|
|
if ( auto mpw = RiaGuiApplication::instance()->mainPlotWindow() )
|
|
{
|
|
mpw->selectAsCurrentItem( object, true /* allowActiveViewChange */ );
|
|
}
|
|
}
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
const caf::PdmObject* RiuPlotMainWindowTools::firstVisibleAncestorOrThis( const caf::PdmObject* object )
|
|
{
|
|
if ( RiaGuiApplication::isRunning() )
|
|
{
|
|
if ( auto mpw = RiaGuiApplication::instance()->mainPlotWindow() )
|
|
{
|
|
auto current = const_cast<caf::PdmObject*>( object );
|
|
while ( current )
|
|
{
|
|
if ( mpw->getTreeViewWithItem( current ) )
|
|
{
|
|
return current;
|
|
}
|
|
|
|
current = current->firstAncestorOfType<caf::PdmObject>();
|
|
}
|
|
}
|
|
}
|
|
|
|
return nullptr;
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RiuPlotMainWindowTools::toggleItemInSelection( const caf::PdmObject* object )
|
|
{
|
|
if ( RiaGuiApplication::isRunning() )
|
|
{
|
|
if ( auto mpw = RiaGuiApplication::instance()->mainPlotWindow() )
|
|
{
|
|
mpw->toggleItemInSelection( object, true /* allowActiveViewChange */ );
|
|
}
|
|
}
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RiuPlotMainWindowTools::selectOrToggleObject( const caf::PdmObject* object, bool toggle )
|
|
{
|
|
if ( toggle )
|
|
{
|
|
RiuPlotMainWindowTools::toggleItemInSelection( object );
|
|
}
|
|
else
|
|
{
|
|
RiuPlotMainWindowTools::selectAsCurrentItem( object );
|
|
}
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RiuPlotMainWindowTools::refreshToolbars()
|
|
{
|
|
if ( RiaGuiApplication::isRunning() )
|
|
{
|
|
if ( auto mpw = RiaGuiApplication::instance()->mainPlotWindow() )
|
|
{
|
|
mpw->updateWellLogPlotToolBar();
|
|
mpw->updateMultiPlotToolBar();
|
|
}
|
|
}
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RiuPlotMainWindowTools::onObjectAppended( const caf::PdmObject* objectToSelect, const caf::PdmObject* objectToExpand )
|
|
{
|
|
if ( objectToExpand == nullptr ) objectToExpand = objectToSelect;
|
|
|
|
if ( objectToExpand ) RiuPlotMainWindowTools::setExpanded( objectToExpand );
|
|
if ( objectToSelect ) RiuPlotMainWindowTools::selectAsCurrentItem( objectToSelect );
|
|
|
|
RiuPlotMainWindowTools::refreshToolbars();
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RiuPlotMainWindowTools::remove3dViewsFromDocking()
|
|
{
|
|
if ( !RiaGuiApplication::isRunning() ) return;
|
|
|
|
if ( auto plotWnd = RiaGuiApplication::instance()->mainPlotWindow() )
|
|
{
|
|
for ( auto view : plotWnd->viewWindows() )
|
|
{
|
|
if ( dynamic_cast<Rim3dView*>( view ) && view->isDockedInPlotView() )
|
|
{
|
|
view->setShowWindow( false );
|
|
view->removeWindowFromDock();
|
|
view->dockAs3DViewWindow();
|
|
view->updateConnectedEditors();
|
|
}
|
|
}
|
|
}
|
|
}
|