#2017 Make all new objects selected after new / edit commands

This commit is contained in:
Unknown
2017-10-17 13:22:28 +02:00
committed by Rebecca Cox
parent 6c29a553ec
commit b937bc53d8
3 changed files with 19 additions and 19 deletions

View File

@@ -29,6 +29,7 @@
#include "RimSummaryCaseMainCollection.h"
#include "RimSummaryPlotCollection.h"
#include "RiuMainPlotWindow.h"
#include "RiuMainWindow.h"
#include "SummaryPlotCommands/RicNewSummaryPlotFeature.h"
@@ -70,7 +71,11 @@ void RicImportSummaryCaseFeature::onActionTriggered(bool isChecked)
RicImportSummaryCaseFeature::createAndAddSummaryCaseFromFile(f);
}
app->getOrCreateAndShowMainPlotWindow();
RiuMainPlotWindow* mainPlotWindow = app->getOrCreateAndShowMainPlotWindow();
if (mainPlotWindow && sumCaseColl->summaryCaseCount() > 0)
{
mainPlotWindow->selectAsCurrentItem(sumCaseColl->summaryCase(sumCaseColl->summaryCaseCount()-1));
}
std::vector<RimCase*> cases;
app->project()->allCases(cases);

View File

@@ -292,9 +292,6 @@ void RicSummaryCurveCreator::fieldChangedByUi(const caf::PdmFieldHandle* changed
{
if (changedField == &m_applyButtonField || changedField == &m_okButtonField)
{
m_applyButtonField = false;
m_okButtonField = false;
if (m_targetPlot == nullptr)
{
createNewPlot();
@@ -305,9 +302,14 @@ void RicSummaryCurveCreator::fieldChangedByUi(const caf::PdmFieldHandle* changed
if (changedField == &m_okButtonField)
{
m_closeButtonField = true;
RiuMainPlotWindow* mainPlotWindow = RiaApplication::instance()->getOrCreateAndShowMainPlotWindow();
mainPlotWindow->selectAsCurrentItem(m_targetPlot);
mainPlotWindow->setExpanded(m_targetPlot, true);
}
RiaApplication::instance()->getOrCreateAndShowMainPlotWindow()->selectAsCurrentItem(m_targetPlot);
m_applyButtonField = false;
m_okButtonField = false;
caf::PdmField<bool>* field = dynamic_cast<caf::PdmField<bool>*>(m_targetPlot->uiCapability()->objectToggleField());
field->setValueWithFieldChanged(true);
}
@@ -1317,13 +1319,6 @@ void RicSummaryCurveCreator::createNewPlot()
summaryPlotColl->updateConnectedEditors();
RiuMainPlotWindow* mainPlotWindow = RiaApplication::instance()->mainPlotWindow();
if (mainPlotWindow)
{
mainPlotWindow->selectAsCurrentItem(plot);
mainPlotWindow->setExpanded(plot, true);
}
m_targetPlot = plot;
updateTargetPlot();
}

View File

@@ -110,7 +110,7 @@ void RicNewRftPlotFeature::onActionTriggered(bool isChecked)
RimProject* proj = RiaApplication::instance()->project();
auto rftPlotColl = proj->mainPlotCollection()->rftPlotCollection();
RimRftPlotCollection* rftPlotColl = proj->mainPlotCollection()->rftPlotCollection();
if (rftPlotColl)
{
QString wellName;
@@ -127,10 +127,10 @@ void RicNewRftPlotFeature::onActionTriggered(bool isChecked)
QString plotName = QString(RimWellRftPlot::plotNameFormatString()).arg(wellName);
auto rftPlot = new RimWellRftPlot();
RimWellRftPlot* rftPlot = new RimWellRftPlot();
rftPlot->setCurrentWellName(wellName);
auto plotTrack = new RimWellLogTrack();
RimWellLogTrack* plotTrack = new RimWellLogTrack();
rftPlot->wellLogPlot()->addTrack(plotTrack);
plotTrack->setDescription(QString("Track %1").arg(rftPlot->wellLogPlot()->trackCount()));
@@ -144,8 +144,8 @@ void RicNewRftPlotFeature::onActionTriggered(bool isChecked)
RiuMainPlotWindow* mainPlotWindow = RiaApplication::instance()->getOrCreateAndShowMainPlotWindow();
if (mainPlotWindow)
{
mainPlotWindow->setExpanded(plotTrack, true);
mainPlotWindow->selectAsCurrentItem(rftPlot);
mainPlotWindow->setExpanded(rftPlot, true);
}
}
}
@@ -166,7 +166,7 @@ RimWellLogTrack* RicNewRftPlotFeature::selectedWellLogPlotTrack() const
{
std::vector<RimWellLogTrack*> selection;
caf::SelectionManager::instance()->objectsByType(&selection);
return selection.size() > 0 ? selection[0] : NULL;
return selection.size() > 0 ? selection[0] : nullptr;
}
//--------------------------------------------------------------------------------------------------
@@ -176,7 +176,7 @@ RimWellPath* RicNewRftPlotFeature::selectedWellPath() const
{
std::vector<RimWellPath*> selection;
caf::SelectionManager::instance()->objectsByType(&selection);
return selection.size() > 0 ? selection[0] : NULL;
return selection.size() > 0 ? selection[0] : nullptr;
}
//--------------------------------------------------------------------------------------------------
@@ -196,7 +196,7 @@ RimSimWellInView* RicNewRftPlotFeature::selectedSimulationWell(int * branchIndex
std::vector<RimSimWellInView*> selection;
caf::SelectionManager::instance()->objectsByType(&selection);
(*branchIndex) = 0;
return selection.size() > 0 ? selection[0] : NULL;
return selection.size() > 0 ? selection[0] : nullptr;
}
}