Commit fdc9f0b0 authored by Stéphane Albert's avatar Stéphane Albert
Browse files

BUG: MANTIS-1144 Unable to keep unconstrained editing mode (color-dynamics).

parent 37068cbd
......@@ -139,7 +139,7 @@ ApplicationsToolBoxController
/*******************************************************************************/
void
ApplicationsToolBoxController
::virtual_ResetWidget()
::virtual_ResetWidget( bool )
{
// Reset widget.
ResetDatasetTree();
......
......@@ -125,7 +125,7 @@ protected:
virtual void ClearWidget();
virtual void virtual_ResetWidget();
virtual void virtual_ResetWidget( bool );
virtual void Disconnect( AbstractModel* );
......
......@@ -104,7 +104,7 @@ AbstractModelController
// Enable GUI widget when there is a model.
if( m_Model!=NULL )
{
ResetWidget();
virtual_ResetWidget( true );
GetWidget()->setEnabled( true );
}
......@@ -165,11 +165,12 @@ AbstractModelController
::ResetWidget()
{
// Reset UI from model.
virtual_ResetWidget();
virtual_ResetWidget( false );
#if 0
// Signal model has been updated.
#if 0 // When resetting widget, data is read from model and set into
// widget so, there's no need to signal back model update.
// When resetting widget, data is read from model and set into
// widget so, there's no need to signal back model update.
emit ModelUpdated();
#endif
}
......
......@@ -198,7 +198,7 @@ private:
/**
*/
virtual void virtual_ResetWidget() =0;
virtual void virtual_ResetWidget( bool ) =0;
//
// Private attributes.
......
......@@ -184,7 +184,7 @@ ColorDynamicsController
/*****************************************************************************/
void
ColorDynamicsController
::virtual_ResetWidget()
::virtual_ResetWidget( bool isSettingModel )
{
//
// Reset color-dynamics widget mode (grayscale/RGB).
......@@ -209,7 +209,7 @@ ColorDynamicsController
// Set constrained editing ON/OFF.
// (must be called before settings intensity/quantiles)
SetBoundsEnabled( channels );
SetBoundsEnabled( channels, isSettingModel );
// Set ranges.
ResetIntensityRanges( channels );
......@@ -228,6 +228,8 @@ void
ColorDynamicsController
::ClearWidget()
{
// qDebug() << this << "::ClearWidget()";
assert( GetWidget()!=NULL &&
GetWidget()==GetWidget< ColorDynamicsWidget >() );
ColorDynamicsWidget* widget = GetWidget< ColorDynamicsWidget >();
......@@ -671,8 +673,12 @@ ColorDynamicsController
/*****************************************************************************/
void
ColorDynamicsController
::SetBoundsEnabled( RgbwChannel channels )
::SetBoundsEnabled( RgbwChannel channels, bool isSettingModel )
{
// qDebug()
// << this
// << "::SetBoundsEnabled(" << channels << "," << isSettingModel << ")";
//
// Calculate loop bounds. Return if nothing to do.
CountType begin = -1;
......@@ -713,7 +719,21 @@ ColorDynamicsController
//...but force call to valueChanged() slot to force refresh.
bool widgetSignalsBlocked = colorBandDynWgt->blockSignals( true );
{
colorBandDynWgt->SetBounded( hasValidHistogram );
// MANTIS-1144:
//
// SetBoundsEnabled() must keep track of previous state because it
// is also called (circular loop) when editing quantile and/or
// intensity is finished.
//
// {
colorBandDynWgt->SetBounded(
( !isSettingModel
? colorBandDynWgt->IsBounded()
: true
) &&
hasValidHistogram
);
// }
colorBandDynWgt->SetLinkButtonEnabled( hasValidHistogram );
colorBandDynWgt->SetDefaultsButtonEnabled( hasValidHistogram );
}
......@@ -836,7 +856,7 @@ ColorDynamicsController
{
assert( imageModel->GetHistogramModel()!=NULL );
SetBoundsEnabled( RGBW_CHANNEL_ALL );
SetBoundsEnabled( RGBW_CHANNEL_ALL, true );
if( imageModel->GetHistogramModel()->IsValid() )
ResetQuantiles( RGBW_CHANNEL_ALL );
......
......@@ -168,7 +168,7 @@ private:
virtual void ClearWidget();
virtual void virtual_ResetWidget();
virtual void virtual_ResetWidget( bool );
virtual void Disconnect( AbstractModel* );
......@@ -253,7 +253,7 @@ private:
/**
*/
void SetBoundsEnabled( RgbwChannel );
void SetBoundsEnabled( RgbwChannel, bool );
//
// Private attributes.
......
......@@ -230,7 +230,7 @@ ColorSetupController
/*******************************************************************************/
void
ColorSetupController
::virtual_ResetWidget()
::virtual_ResetWidget( bool )
{
// Reset color-setup widget.
ResetIndices( RGBW_CHANNEL_RGB );
......
......@@ -168,7 +168,7 @@ private:
virtual void ClearWidget();
virtual void virtual_ResetWidget();
virtual void virtual_ResetWidget( bool );
virtual void Disconnect( AbstractModel* );
......
......@@ -259,7 +259,7 @@ DatabaseBrowserController
/*******************************************************************************/
void
DatabaseBrowserController
::virtual_ResetWidget()
::virtual_ResetWidget( bool )
{
RefreshWidget();
}
......
......@@ -165,7 +165,7 @@ private:
virtual void ClearWidget();
virtual void virtual_ResetWidget();
virtual void virtual_ResetWidget( bool );
virtual void Disconnect( AbstractModel* );
......
......@@ -119,7 +119,7 @@ DatasetPropertiesController
/*******************************************************************************/
void
DatasetPropertiesController
::virtual_ResetWidget()
::virtual_ResetWidget( bool )
{
// qDebug() << this << "::virtual_ResetWidget()";
......
......@@ -133,7 +133,7 @@ private:
virtual void ClearWidget();
virtual void virtual_ResetWidget();
virtual void virtual_ResetWidget( bool );
virtual void Disconnect( AbstractModel* );
......
......@@ -110,7 +110,7 @@ HistogramController
/*******************************************************************************/
void
HistogramController
::virtual_ResetWidget()
::virtual_ResetWidget( bool )
{
ResetWidget( RGBW_CHANNEL_ALL );
}
......
......@@ -133,7 +133,7 @@ private:
virtual void ClearWidget();
virtual void virtual_ResetWidget();
virtual void virtual_ResetWidget( bool = false );
virtual void Disconnect( AbstractModel* );
......
......@@ -356,7 +356,7 @@ LayerStackController
/*******************************************************************************/
void
LayerStackController
::virtual_ResetWidget()
::virtual_ResetWidget( bool )
{
}
......
......@@ -142,7 +142,7 @@ private:
/**
*/
virtual void virtual_ResetWidget();
virtual void virtual_ResetWidget( bool );
//
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment