mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-25 06:38:13 -05:00
Axis range and auto-zoom setters now schedule the editor update instead of performing it immediately. Every immediate update rebuilds the tags of the whole project tree, and zoom-all releases the range and re-enables auto zoom for every axis of every subplot. Scheduling also avoids deleting the tag whose clicked signal is still being emitted from onPinnedTagClicked(). Remove the m_isAutoZoom branches in fieldChangedByUi(). The field is not part of any UI ordering, and both orderings end with skipRemainingFields(), so the branches were unreachable. Comments referring to a "Set Range Automatically" checkbox are updated accordingly. The pinned tag no longer reuses pinned.svg, which is also the Quick Access dock icon and must keep following the widget palette. The gray tag variant lives in PinnedAxisRange.svg. Zoom All is an explicit request for automatic ranges, but only summary plots released the user defined range. Histogram, grid cross, VFP and analysis plots share RimPlotAxisProperties and set the range as user defined when a min or max is typed, so Zoom All left them with a stale pinned tag and permanently blocked enableAutoValueMinMax(). Release the range for every axis owned by the window in RimViewWindow instead, which makes the summary specific overrides redundant.
127 lines
5.2 KiB
C++
127 lines
5.2 KiB
C++
/////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
// Copyright (C) 2019- 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 "RimPlotAxisPropertiesInterface.h"
|
|
|
|
#include "cafAppEnum.h"
|
|
|
|
CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimPlotAxisPropertiesInterface, "PlotAxisPropertiesInterface", "RimPlotAxisPropertiesInterface" );
|
|
|
|
namespace caf
|
|
{
|
|
template <>
|
|
void caf::AppEnum<RimPlotAxisPropertiesInterface::AxisTitlePositionType>::setUp()
|
|
{
|
|
addItem( RimPlotAxisPropertiesInterface::AXIS_TITLE_CENTER, "AXIS_TITLE_CENTER", "Center" );
|
|
addItem( RimPlotAxisPropertiesInterface::AXIS_TITLE_END, "AXIS_TITLE_END", "At End" );
|
|
|
|
setDefault( RimPlotAxisPropertiesInterface::AXIS_TITLE_CENTER );
|
|
}
|
|
|
|
template <>
|
|
void RimPlotAxisPropertiesInterface::LegendTickmarkCountEnum::setUp()
|
|
{
|
|
addItem( RimPlotAxisPropertiesInterface::LegendTickmarkCount::TICKMARK_VERY_FEW, "VERY_FEW", "Very Few" );
|
|
addItem( RimPlotAxisPropertiesInterface::LegendTickmarkCount::TICKMARK_FEW, "Few", "Few" );
|
|
addItem( RimPlotAxisPropertiesInterface::LegendTickmarkCount::TICKMARK_DEFAULT, "Default", "Default" );
|
|
addItem( RimPlotAxisPropertiesInterface::LegendTickmarkCount::TICKMARK_MANY, "Many", "Many" );
|
|
setDefault( RimPlotAxisPropertiesInterface::LegendTickmarkCount::TICKMARK_DEFAULT );
|
|
}
|
|
} // namespace caf
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
RimPlotAxisPropertiesInterface::RimPlotAxisPropertiesInterface()
|
|
: settingsChanged( this )
|
|
{
|
|
CAF_PDM_InitObject( "Plot Axis Properties Interface" );
|
|
|
|
CAF_PDM_InitField( &m_isRangeUserDefined, "IsRangeUserDefined", false, "Is Range Defined by User" );
|
|
m_isRangeUserDefined.uiCapability()->setUiHidden( true );
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
/// A user defined axis range is kept when the data source of a plot is changed, and is released when the user asks for
|
|
/// automatic range computation (Zoom All, the Auto Zoom command, or clicking the pinned tag in the project tree).
|
|
//--------------------------------------------------------------------------------------------------
|
|
bool RimPlotAxisPropertiesInterface::isRangeUserDefined() const
|
|
{
|
|
return m_isRangeUserDefined();
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RimPlotAxisPropertiesInterface::setRangeUserDefined( bool isUserDefined )
|
|
{
|
|
if ( m_isRangeUserDefined() == isUserDefined ) return;
|
|
|
|
m_isRangeUserDefined = isUserDefined;
|
|
|
|
// Update the project tree tag reflecting the range state (see defineObjectEditorAttribute() in derived classes).
|
|
// Scheduled rather than immediate: zoom-all and axis linking call this once per axis per subplot, and every
|
|
// immediate update rebuilds the tags of the entire project tree. The tag click handler also ends up here, where an
|
|
// immediate update would delete the tag whose signal is being emitted.
|
|
scheduleUpdateConnectedEditors();
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
bool RimPlotAxisPropertiesInterface::isAxisInverted() const
|
|
{
|
|
return false;
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
bool RimPlotAxisPropertiesInterface::isLogarithmicScaleEnabled() const
|
|
{
|
|
return false;
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
int RimPlotAxisPropertiesInterface::tickmarkCountFromEnum( LegendTickmarkCount count )
|
|
{
|
|
int maxTickmarkCount = 8;
|
|
|
|
switch ( count )
|
|
{
|
|
case LegendTickmarkCount::TICKMARK_VERY_FEW:
|
|
maxTickmarkCount = 2;
|
|
break;
|
|
case LegendTickmarkCount::TICKMARK_FEW:
|
|
maxTickmarkCount = 4;
|
|
break;
|
|
case LegendTickmarkCount::TICKMARK_DEFAULT:
|
|
maxTickmarkCount = 8; // Taken from QwtPlot::initAxesData()
|
|
break;
|
|
case LegendTickmarkCount::TICKMARK_MANY:
|
|
maxTickmarkCount = 10;
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
|
|
return maxTickmarkCount;
|
|
}
|