mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2017 Make all new objects selected after new / edit commands
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user