Refactor view id

This commit is contained in:
Gaute Lindkvist
2019-11-14 20:48:11 +01:00
parent d9043db5e0
commit 228810fd05
27 changed files with 237 additions and 59 deletions

View File

@@ -20,6 +20,10 @@
#include "RiaApplication.h"
#include "RiaPreferences.h"
#include "RicfCommandObject.h"
#include "RimProject.h"
#include "cafPdmUiComboBoxEditor.h"
CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimPlotWindow, "RimPlotWindow" ); // Do not use. Abstract class
@@ -31,6 +35,12 @@ RimPlotWindow::RimPlotWindow()
{
CAF_PDM_InitObject( "PlotWindow", "", "", "" );
RICF_InitField( &m_id, "ViewId", -1, "View ID", "", "", "" );
m_id.uiCapability()->setUiReadOnly( true );
m_id.uiCapability()->setUiHidden( true );
m_id.capability<RicfFieldHandle>()->setIOWriteable( false );
m_id.xmlCapability()->setCopyable( false );
CAF_PDM_InitField( &m_showPlotLegends, "ShowTrackLegends", true, "Show Legends", "", "", "" );
CAF_PDM_InitField( &m_plotLegendsHorizontal, "TrackLegendsHorizontal", true, "Legend Orientation", "", "", "" );
m_plotLegendsHorizontal.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() );
@@ -50,6 +60,14 @@ RimPlotWindow::RimPlotWindow()
//--------------------------------------------------------------------------------------------------
RimPlotWindow::~RimPlotWindow() {}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RimPlotWindow::id() const
{
return m_id;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -199,3 +217,24 @@ void RimPlotWindow::uiOrderingForLegendSettings( QString uiConfigName, caf::PdmU
uiOrdering.add( &m_plotLegendsHorizontal );
uiOrdering.add( &m_legendFontSize );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotWindow::setId( int id )
{
m_id = id;
QString viewIdTooltip = QString( "Plot id: %1" ).arg( m_id );
this->setUiToolTip( viewIdTooltip );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotWindow::assignIdIfNecessary()
{
if ( m_id == -1 )
{
RiaApplication::instance()->project()->assignPlotIdToPlotWindow( this );
}
}