mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2020 Move LAS files. Support for submenus and command features with custom name and user data
This commit is contained in:
parent
f032a3eb9f
commit
31a84181e6
@ -53,27 +53,7 @@ bool RicExecuteScriptForCasesFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicExecuteScriptForCasesFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
// Dummy - handled by slotExecuteScriptForSelectedCases()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicExecuteScriptForCasesFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setText("Execute script");
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicExecuteScriptForCasesFeature::slotExecuteScriptForSelectedCases()
|
||||
{
|
||||
QAction* action = qobject_cast<QAction*>(sender());
|
||||
if (!action) return;
|
||||
|
||||
QString scriptAbsolutePath = action->data().toString();
|
||||
QString scriptAbsolutePath = userData().toString();
|
||||
|
||||
RiuMainWindow* mainWindow = RiuMainWindow::instance();
|
||||
mainWindow->showProcessMonitorDockPanel();
|
||||
@ -110,3 +90,11 @@ void RicExecuteScriptForCasesFeature::slotExecuteScriptForSelectedCases()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicExecuteScriptForCasesFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setText("Execute script");
|
||||
}
|
||||
|
@ -35,9 +35,6 @@ protected:
|
||||
virtual bool isCommandEnabled();
|
||||
virtual void onActionTriggered( bool isChecked );
|
||||
virtual void setupActionLook( QAction* actionToSetup );
|
||||
|
||||
private slots:
|
||||
void slotExecuteScriptForSelectedCases();
|
||||
};
|
||||
|
||||
|
||||
|
@ -27,6 +27,7 @@ ${CEE_CURRENT_LIST_DIR}RicChangeDataSourceFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicChangeDataSourceFeatureUi.h
|
||||
${CEE_CURRENT_LIST_DIR}RicAsciiExportWellLogPlotFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicWellLogFileCloseFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicMoveWellLogFilesFeature.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
@ -52,6 +53,7 @@ ${CEE_CURRENT_LIST_DIR}RicChangeDataSourceFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicChangeDataSourceFeatureUi.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicAsciiExportWellLogPlotFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicWellLogFileCloseFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicMoveWellLogFilesFeature.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
@ -0,0 +1,75 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
//
|
||||
// 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 "RicMoveWellLogFilesFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimWellPath.h"
|
||||
#include "RimWellLogFile.h"
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include "cafPdmUiObjectEditorHandle.h"
|
||||
#include "cafSelectionManagerTools.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QFileDialog>
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicMoveWellLogFilesFeature, "RicMoveWellLogFilesFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicMoveWellLogFilesFeature::isCommandEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicMoveWellLogFilesFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
const QVariant userData = this->userData();
|
||||
if (!userData.isNull() && userData.type() == QVariant::String)
|
||||
{
|
||||
RimProject* proj = RiaApplication::instance()->project();
|
||||
|
||||
RimWellPath* destWellPath = proj->wellPathByName(userData.toString());
|
||||
RimWellLogFile* wellLogFile = caf::firstAncestorOfTypeFromSelectedObject<RimWellLogFile*>();
|
||||
RimWellPath* sourceWellPath = caf::firstAncestorOfTypeFromSelectedObject<RimWellPath*>();
|
||||
|
||||
if (!destWellPath || !wellLogFile || !sourceWellPath) return;
|
||||
|
||||
sourceWellPath->detachWellLogFile(wellLogFile);
|
||||
destWellPath->addWellLogFile(wellLogFile);
|
||||
|
||||
sourceWellPath->updateConnectedEditors();
|
||||
destWellPath->updateConnectedEditors();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicMoveWellLogFilesFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setText("Move Well Log File(s)");
|
||||
actionToSetup->setIcon(QIcon(":/Well.png"));
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicMoveWellLogFilesFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
|
||||
// Overrides
|
||||
virtual bool isCommandEnabled() override;
|
||||
virtual void onActionTriggered( bool isChecked ) override;
|
||||
virtual void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
@ -19,6 +19,8 @@
|
||||
|
||||
#include "RimContextCommandBuilder.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimCalcScript.h"
|
||||
#include "RimCaseCollection.h"
|
||||
#include "RimCellRangeFilter.h"
|
||||
@ -47,6 +49,7 @@
|
||||
#include "RimIntersectionBox.h"
|
||||
#include "RimIntersectionCollection.h"
|
||||
#include "RimObservedData.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimScriptCollection.h"
|
||||
#include "RimSimWellInView.h"
|
||||
#include "RimSimWellInViewCollection.h"
|
||||
@ -84,24 +87,30 @@
|
||||
#include "RimWellPathFractureCollection.h"
|
||||
#endif // USE_PROTOTYPE_FEATURE_FRACTURES
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include "ToggleCommands/RicToggleItemsFeatureImpl.h"
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
#include "cafCmdFeatureManager.h"
|
||||
#include "cafCmdFeatureMenuBuilder.h"
|
||||
#include "cafPdmUiItem.h"
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include "cafSelectionManagerTools.h"
|
||||
#include "cvfAssert.h"
|
||||
|
||||
#include <vector>
|
||||
#include <QMenu>
|
||||
#include <QDir>
|
||||
#include "OctaveScriptCommands/RicExecuteScriptForCasesFeature.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QStringList RimContextCommandBuilder::commandsFromSelection()
|
||||
caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
||||
{
|
||||
QStringList commandIds;
|
||||
//QStringList commandIds;
|
||||
caf::CmdFeatureMenuBuilder menuBuilder;
|
||||
|
||||
std::vector<caf::PdmUiItem*> uiItems;
|
||||
caf::SelectionManager::instance()->selectedItems(uiItems);
|
||||
@ -113,366 +122,382 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
|
||||
|
||||
if (dynamic_cast<RimEclipseCaseCollection*>(uiItem))
|
||||
{
|
||||
commandIds << "RicImportEclipseCaseFeature";
|
||||
commandIds << "RicImportInputEclipseCaseFeature";
|
||||
commandIds << "RicCreateGridCaseGroupFeature";
|
||||
commandIds << "RicEclipseCaseNewGroupFeature";
|
||||
commandIds << "RicCalculateNumberOfFloodedPoreVolumes";
|
||||
menuBuilder << "RicImportEclipseCaseFeature";
|
||||
menuBuilder << "RicImportInputEclipseCaseFeature";
|
||||
menuBuilder << "RicCreateGridCaseGroupFeature";
|
||||
menuBuilder << "RicEclipseCaseNewGroupFeature";
|
||||
menuBuilder << "RicCalculateNumberOfFloodedPoreVolumes";
|
||||
}
|
||||
else if (dynamic_cast<RimGeoMechView*>(uiItem))
|
||||
{
|
||||
commandIds << "RicPasteGeoMechViewsFeature";
|
||||
commandIds << "Separator";
|
||||
menuBuilder << "RicPasteGeoMechViewsFeature";
|
||||
menuBuilder << "Separator";
|
||||
|
||||
commandIds << "RicNewViewFeature";
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicCopyReferencesToClipboardFeature";
|
||||
menuBuilder << "RicNewViewFeature";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicCopyReferencesToClipboardFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimEclipseView*>(uiItem))
|
||||
{
|
||||
commandIds << "RicPasteEclipseViewsFeature";
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicNewViewFeature";
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicCopyReferencesToClipboardFeature";
|
||||
commandIds << "RicSaveEclipseInputVisibleCellsFeature";
|
||||
menuBuilder << "RicPasteEclipseViewsFeature";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicNewViewFeature";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicCopyReferencesToClipboardFeature";
|
||||
menuBuilder << "RicSaveEclipseInputVisibleCellsFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimCaseCollection*>(uiItem))
|
||||
{
|
||||
commandIds << "RicPasteEclipseCasesFeature";
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicNewStatisticsCaseFeature";
|
||||
menuBuilder << "RicPasteEclipseCasesFeature";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicNewStatisticsCaseFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimEclipseStatisticsCase*>(uiItem))
|
||||
{
|
||||
commandIds << "RicNewViewFeature";
|
||||
commandIds << "RicComputeStatisticsFeature";
|
||||
commandIds << "Separator";
|
||||
menuBuilder << "RicNewViewFeature";
|
||||
menuBuilder << "RicComputeStatisticsFeature";
|
||||
menuBuilder << "Separator";
|
||||
}
|
||||
else if (dynamic_cast<RimEclipseCase*>(uiItem))
|
||||
{
|
||||
commandIds << "RicPasteEclipseCasesFeature";
|
||||
commandIds << "RicPasteEclipseViewsFeature";
|
||||
commandIds << "Separator";
|
||||
menuBuilder << "RicPasteEclipseCasesFeature";
|
||||
menuBuilder << "RicPasteEclipseViewsFeature";
|
||||
menuBuilder << "Separator";
|
||||
|
||||
commandIds << "RicNewViewFeature";
|
||||
commandIds << "RicShowFlowCharacteristicsPlotFeature";
|
||||
commandIds << "RicEclipseCaseNewGroupFeature";
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicCopyReferencesToClipboardFeature";
|
||||
commandIds << "Separator";
|
||||
menuBuilder << "RicNewViewFeature";
|
||||
menuBuilder << "RicShowFlowCharacteristicsPlotFeature";
|
||||
menuBuilder << "RicEclipseCaseNewGroupFeature";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicCopyReferencesToClipboardFeature";
|
||||
menuBuilder << "Separator";
|
||||
}
|
||||
else if (dynamic_cast<RimGeoMechCase*>(uiItem))
|
||||
{
|
||||
commandIds << "RicPasteGeoMechViewsFeature";
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicNewViewFeature";
|
||||
commandIds << "Separator";
|
||||
menuBuilder << "RicPasteGeoMechViewsFeature";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicNewViewFeature";
|
||||
menuBuilder << "Separator";
|
||||
}
|
||||
else if (dynamic_cast<RimIdenticalGridCaseGroup*>(uiItem))
|
||||
{
|
||||
commandIds << "RicPasteEclipseCasesFeature";
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicEclipseCaseNewGroupFeature";
|
||||
menuBuilder << "RicPasteEclipseCasesFeature";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicEclipseCaseNewGroupFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimEclipseCellColors*>(uiItem))
|
||||
{
|
||||
commandIds << "RicSaveEclipseResultAsInputPropertyFeature";
|
||||
menuBuilder << "RicSaveEclipseResultAsInputPropertyFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimEclipseInputPropertyCollection*>(uiItem))
|
||||
{
|
||||
commandIds << "RicAddEclipseInputPropertyFeature";
|
||||
menuBuilder << "RicAddEclipseInputPropertyFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimEclipseInputProperty*>(uiItem))
|
||||
{
|
||||
commandIds << "RicSaveEclipseInputPropertyFeature";
|
||||
menuBuilder << "RicSaveEclipseInputPropertyFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimCellRangeFilterCollection*>(uiItem))
|
||||
{
|
||||
commandIds << "RicRangeFilterNewFeature";
|
||||
commandIds << "RicRangeFilterNewSliceIFeature";
|
||||
commandIds << "RicRangeFilterNewSliceJFeature";
|
||||
commandIds << "RicRangeFilterNewSliceKFeature";
|
||||
menuBuilder << "RicRangeFilterNewFeature";
|
||||
menuBuilder << "RicRangeFilterNewSliceIFeature";
|
||||
menuBuilder << "RicRangeFilterNewSliceJFeature";
|
||||
menuBuilder << "RicRangeFilterNewSliceKFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimCellRangeFilter*>(uiItem))
|
||||
{
|
||||
commandIds << "RicRangeFilterInsertFeature";
|
||||
commandIds << "RicRangeFilterNewSliceIFeature";
|
||||
commandIds << "RicRangeFilterNewSliceJFeature";
|
||||
commandIds << "RicRangeFilterNewSliceKFeature";
|
||||
menuBuilder << "RicRangeFilterInsertFeature";
|
||||
menuBuilder << "RicRangeFilterNewSliceIFeature";
|
||||
menuBuilder << "RicRangeFilterNewSliceJFeature";
|
||||
menuBuilder << "RicRangeFilterNewSliceKFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimEclipsePropertyFilterCollection*>(uiItem))
|
||||
{
|
||||
commandIds << "RicEclipsePropertyFilterNewFeature";
|
||||
menuBuilder << "RicEclipsePropertyFilterNewFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimEclipsePropertyFilter*>(uiItem))
|
||||
{
|
||||
commandIds << "RicEclipsePropertyFilterInsertFeature";
|
||||
commandIds << "RicApplyPropertyFilterAsCellResultFeature";
|
||||
menuBuilder << "RicEclipsePropertyFilterInsertFeature";
|
||||
menuBuilder << "RicApplyPropertyFilterAsCellResultFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimGeoMechPropertyFilterCollection*>(uiItem))
|
||||
{
|
||||
commandIds << "RicGeoMechPropertyFilterNewFeature";
|
||||
menuBuilder << "RicGeoMechPropertyFilterNewFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimGeoMechPropertyFilter*>(uiItem))
|
||||
{
|
||||
commandIds << "RicGeoMechPropertyFilterInsertFeature";
|
||||
commandIds << "RicApplyPropertyFilterAsCellResultFeature";
|
||||
menuBuilder << "RicGeoMechPropertyFilterInsertFeature";
|
||||
menuBuilder << "RicApplyPropertyFilterAsCellResultFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimWellPathCollection*>(uiItem))
|
||||
{
|
||||
commandIds << "RicWellPathsImportFileFeature";
|
||||
commandIds << "RicWellPathsImportSsihubFeature";
|
||||
commandIds << "RicWellLogsImportFileFeature";
|
||||
commandIds << "Separator";
|
||||
menuBuilder << "RicWellPathsImportFileFeature";
|
||||
menuBuilder << "RicWellPathsImportSsihubFeature";
|
||||
menuBuilder << "RicWellLogsImportFileFeature";
|
||||
menuBuilder << "Separator";
|
||||
}
|
||||
else if (dynamic_cast<RimWellPath*>(uiItem))
|
||||
{
|
||||
commandIds << "RicWellPathsImportFileFeature";
|
||||
commandIds << "RicWellLogsImportFileFeature";
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicNewRftPlotFeature";
|
||||
commandIds << "RicNewPltPlotFeature";
|
||||
commandIds << "RicNewWellLogFileCurveFeature";
|
||||
commandIds << "RicNewWellLogCurveExtractionFeature";
|
||||
commandIds << "RicNewWellPathIntersectionFeature";
|
||||
menuBuilder << "RicWellPathsImportFileFeature";
|
||||
menuBuilder << "RicWellLogsImportFileFeature";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicNewRftPlotFeature";
|
||||
menuBuilder << "RicNewPltPlotFeature";
|
||||
menuBuilder << "RicNewWellLogFileCurveFeature";
|
||||
menuBuilder << "RicNewWellLogCurveExtractionFeature";
|
||||
menuBuilder << "RicNewWellPathIntersectionFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimWellLogFile*>(uiItem))
|
||||
{
|
||||
commandIds << "RicWellPathsImportFileFeature";
|
||||
commandIds << "RicWellLogsImportFileFeature";
|
||||
menuBuilder << "RicWellPathsImportFileFeature";
|
||||
menuBuilder << "RicWellLogsImportFileFeature";
|
||||
|
||||
menuBuilder << "Separator";
|
||||
|
||||
menuBuilder.subMenuStart("Move LAS file to well path");
|
||||
|
||||
RimWellPath* parentWellPath = caf::firstAncestorOfTypeFromSelectedObject<RimWellPath*>();
|
||||
QString parentWellPathName = parentWellPath ? parentWellPath->name() : "";
|
||||
|
||||
for (RimWellPath* wellPath : allWellPaths())
|
||||
{
|
||||
if (wellPath->name() != parentWellPathName)
|
||||
{
|
||||
menuBuilder.addCmdFeatureWithUserData("RicMoveWellLogFilesFeature", wellPath->name(), wellPath->name());
|
||||
}
|
||||
}
|
||||
menuBuilder.subMenuEnd();
|
||||
}
|
||||
else if (dynamic_cast<RimWellRftPlot*>(uiItem))
|
||||
{
|
||||
commandIds << "RicDeleteRftPlotFeature";
|
||||
menuBuilder << "RicDeleteRftPlotFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimWellPltPlot*>(uiItem))
|
||||
{
|
||||
commandIds << "RicDeletePltPlotFeature";
|
||||
menuBuilder << "RicDeletePltPlotFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimCalcScript*>(uiItem))
|
||||
{
|
||||
commandIds << "RicEditScriptFeature";
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicNewScriptFeature";
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicExecuteScriptFeature";
|
||||
menuBuilder << "RicEditScriptFeature";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicNewScriptFeature";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicExecuteScriptFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimScriptCollection*>(uiItem))
|
||||
{
|
||||
commandIds << "RicNewScriptFeature";
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicAddScriptPathFeature";
|
||||
commandIds << "RicRefreshScriptsFeature";
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicDeleteScriptPathFeature";
|
||||
menuBuilder << "RicNewScriptFeature";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicAddScriptPathFeature";
|
||||
menuBuilder << "RicRefreshScriptsFeature";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicDeleteScriptPathFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimViewController*>(uiItem))
|
||||
{
|
||||
commandIds << "RicShowAllLinkedViewsFeature";
|
||||
menuBuilder << "RicShowAllLinkedViewsFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimViewLinker*>(uiItem))
|
||||
{
|
||||
commandIds << "RicShowAllLinkedViewsFeature";
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicDeleteAllLinkedViewsFeature";
|
||||
menuBuilder << "RicShowAllLinkedViewsFeature";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicDeleteAllLinkedViewsFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimWellLogPlotCollection*>(uiItem))
|
||||
{
|
||||
commandIds << "RicPasteWellLogPlotFeature";
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicNewWellLogPlotFeature";
|
||||
menuBuilder << "RicPasteWellLogPlotFeature";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicNewWellLogPlotFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimRftPlotCollection*>(uiItem))
|
||||
{
|
||||
commandIds << "RicNewRftPlotFeature";
|
||||
menuBuilder << "RicNewRftPlotFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimPltPlotCollection*>(uiItem))
|
||||
{
|
||||
commandIds << "RicNewPltPlotFeature";
|
||||
menuBuilder << "RicNewPltPlotFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimSummaryPlotCollection*>(uiItem))
|
||||
{
|
||||
commandIds << "RicPasteSummaryPlotFeature";
|
||||
commandIds << "RicPasteAsciiDataToSummaryPlotFeature";
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicNewSummaryPlotFeature";
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicShowSummaryCurveCalculatorFeature";
|
||||
menuBuilder << "RicPasteSummaryPlotFeature";
|
||||
menuBuilder << "RicPasteAsciiDataToSummaryPlotFeature";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicNewSummaryPlotFeature";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicShowSummaryCurveCalculatorFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimSummaryCrossPlotCollection*>(uiItem))
|
||||
{
|
||||
commandIds << "RicNewSummaryCrossPlotFeature";
|
||||
menuBuilder << "RicNewSummaryCrossPlotFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimWellLogPlot*>(uiItem))
|
||||
{
|
||||
commandIds << "RicPasteWellLogPlotFeature";
|
||||
commandIds << "RicPasteWellLogTrackFeature";
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicNewWellLogPlotTrackFeature";
|
||||
commandIds << "RicAsciiExportWellLogPlotFeature";
|
||||
menuBuilder << "RicPasteWellLogPlotFeature";
|
||||
menuBuilder << "RicPasteWellLogTrackFeature";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicNewWellLogPlotTrackFeature";
|
||||
menuBuilder << "RicAsciiExportWellLogPlotFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimWellLogTrack*>(uiItem))
|
||||
{
|
||||
commandIds << "RicPasteWellLogTrackFeature";
|
||||
commandIds << "RicPasteWellLogCurveFeature";
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicNewWellLogCurveExtractionFeature";
|
||||
commandIds << "RicNewWellLogRftCurveFeature";
|
||||
commandIds << "RicNewWellLogFileCurveFeature";
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicDeleteWellLogPlotTrackFeature";
|
||||
menuBuilder << "RicPasteWellLogTrackFeature";
|
||||
menuBuilder << "RicPasteWellLogCurveFeature";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicNewWellLogCurveExtractionFeature";
|
||||
menuBuilder << "RicNewWellLogRftCurveFeature";
|
||||
menuBuilder << "RicNewWellLogFileCurveFeature";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicDeleteWellLogPlotTrackFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimWellLogCurve*>(uiItem))
|
||||
{
|
||||
commandIds << "RicPasteWellLogCurveFeature";
|
||||
menuBuilder << "RicPasteWellLogCurveFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimSummaryPlot*>(uiItem)) // This is also the definition for RimSummaryCrossPlot
|
||||
{
|
||||
commandIds << "RicPasteSummaryCurveFeature";
|
||||
commandIds << "RicPasteSummaryCurveFilterFeature";
|
||||
commandIds << "RicPasteSummaryPlotFeature";
|
||||
commandIds << "RicPasteAsciiDataToSummaryPlotFeature";
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicEditSummaryPlotFeature";
|
||||
commandIds << "RicNewSummaryPlotFeature";
|
||||
commandIds << "RicNewSummaryCurveFeature";
|
||||
commandIds << "RicNewSummaryCrossPlotCurveFeature";
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicShowSummaryCurveCalculatorFeature";
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicAsciiExportSummaryPlotFeature";
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicCopyReferencesToClipboardFeature";
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicViewZoomAllFeature";
|
||||
menuBuilder << "RicPasteSummaryCurveFeature";
|
||||
menuBuilder << "RicPasteSummaryCurveFilterFeature";
|
||||
menuBuilder << "RicPasteSummaryPlotFeature";
|
||||
menuBuilder << "RicPasteAsciiDataToSummaryPlotFeature";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicEditSummaryPlotFeature";
|
||||
menuBuilder << "RicNewSummaryPlotFeature";
|
||||
menuBuilder << "RicNewSummaryCurveFeature";
|
||||
menuBuilder << "RicNewSummaryCrossPlotCurveFeature";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicShowSummaryCurveCalculatorFeature";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicAsciiExportSummaryPlotFeature";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicCopyReferencesToClipboardFeature";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicViewZoomAllFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimSummaryCurve*>(uiItem))
|
||||
{
|
||||
commandIds << "RicPasteSummaryCurveFeature";
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicNewSummaryCurveFeature";
|
||||
commandIds << "RicNewSummaryCrossPlotCurveFeature";
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicCopyReferencesToClipboardFeature";
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicEditSummaryCurveCalculationFeature";
|
||||
menuBuilder << "RicPasteSummaryCurveFeature";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicNewSummaryCurveFeature";
|
||||
menuBuilder << "RicNewSummaryCrossPlotCurveFeature";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicCopyReferencesToClipboardFeature";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicEditSummaryCurveCalculationFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimSummaryCurveCollection*>(uiItem))
|
||||
{
|
||||
commandIds << "RicEditSummaryPlotFeature";
|
||||
menuBuilder << "RicEditSummaryPlotFeature";
|
||||
}
|
||||
else if(dynamic_cast<RimSummaryCurveFilter*>(uiItem))
|
||||
{
|
||||
commandIds << "RicPasteSummaryCurveFilterFeature";
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicNewSummaryCurveFeature";
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicCopyReferencesToClipboardFeature";
|
||||
menuBuilder << "RicPasteSummaryCurveFilterFeature";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicNewSummaryCurveFeature";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicCopyReferencesToClipboardFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimSummaryCase*>(uiItem))
|
||||
{
|
||||
if (!dynamic_cast<RimObservedData*>(uiItem))
|
||||
{
|
||||
commandIds << "RicShowSummaryCurveCalculatorFeature";
|
||||
commandIds << "RicNewSummaryPlotFeature";
|
||||
menuBuilder << "RicShowSummaryCurveCalculatorFeature";
|
||||
menuBuilder << "RicNewSummaryPlotFeature";
|
||||
}
|
||||
}
|
||||
else if (dynamic_cast<RimWellLogFileChannel*>(uiItem))
|
||||
{
|
||||
commandIds << "RicAddWellLogToPlotFeature";
|
||||
menuBuilder << "RicAddWellLogToPlotFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimIntersectionCollection*>(uiItem))
|
||||
{
|
||||
commandIds << "RicAppendIntersectionFeature";
|
||||
commandIds << "RicAppendIntersectionBoxFeature";
|
||||
menuBuilder << "RicAppendIntersectionFeature";
|
||||
menuBuilder << "RicAppendIntersectionBoxFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimIntersection*>(uiItem))
|
||||
{
|
||||
commandIds << "RicAppendIntersectionFeature";
|
||||
commandIds << "RicAppendIntersectionBoxFeature";
|
||||
menuBuilder << "RicAppendIntersectionFeature";
|
||||
menuBuilder << "RicAppendIntersectionBoxFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimIntersectionBox*>(uiItem))
|
||||
{
|
||||
commandIds << "RicAppendIntersectionFeature";
|
||||
commandIds << "RicAppendIntersectionBoxFeature";
|
||||
menuBuilder << "RicAppendIntersectionFeature";
|
||||
menuBuilder << "RicAppendIntersectionBoxFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimSimWellInView*>(uiItem))
|
||||
{
|
||||
commandIds << "RicNewWellLogCurveExtractionFeature";
|
||||
commandIds << "RicNewWellLogRftCurveFeature";
|
||||
commandIds << "RicNewSimWellIntersectionFeature";
|
||||
commandIds << "RicNewRftPlotFeature";
|
||||
commandIds << "RicNewPltPlotFeature";
|
||||
commandIds << "RicShowWellAllocationPlotFeature";
|
||||
menuBuilder << "RicNewWellLogCurveExtractionFeature";
|
||||
menuBuilder << "RicNewWellLogRftCurveFeature";
|
||||
menuBuilder << "RicNewSimWellIntersectionFeature";
|
||||
menuBuilder << "RicNewRftPlotFeature";
|
||||
menuBuilder << "RicNewPltPlotFeature";
|
||||
menuBuilder << "RicShowWellAllocationPlotFeature";
|
||||
}
|
||||
else if(dynamic_cast<RimFormationNames*>(uiItem))
|
||||
{
|
||||
commandIds << "RicImportFormationNamesFeature";
|
||||
commandIds << "RicReloadFormationNamesFeature";
|
||||
menuBuilder << "RicImportFormationNamesFeature";
|
||||
menuBuilder << "RicReloadFormationNamesFeature";
|
||||
}
|
||||
else if(dynamic_cast<RimFormationNamesCollection*>(uiItem))
|
||||
{
|
||||
commandIds << "RicImportFormationNamesFeature";
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicReloadFormationNamesFeature";
|
||||
menuBuilder << "RicImportFormationNamesFeature";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicReloadFormationNamesFeature";
|
||||
}
|
||||
else if ( dynamic_cast<RimFaultInView*>(uiItem) )
|
||||
{
|
||||
commandIds << "RicExportFaultsFeature";
|
||||
menuBuilder << "RicExportFaultsFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimWellAllocationPlot*>(uiItem))
|
||||
{
|
||||
commandIds << "RicAddStoredWellAllocationPlotFeature";
|
||||
menuBuilder << "RicAddStoredWellAllocationPlotFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimFlowCharacteristicsPlot*>(uiItem))
|
||||
{
|
||||
commandIds << "RicAddStoredFlowCharacteristicsPlotFeature";
|
||||
menuBuilder << "RicAddStoredFlowCharacteristicsPlotFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimFlowDiagSolution*>(uiItem))
|
||||
{
|
||||
commandIds << "RicShowFlowCharacteristicsPlotFeature";
|
||||
menuBuilder << "RicShowFlowCharacteristicsPlotFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimFlowPlotCollection*>(uiItem))
|
||||
{
|
||||
commandIds << "RicShowFlowCharacteristicsPlotFeature";
|
||||
menuBuilder << "RicShowFlowCharacteristicsPlotFeature";
|
||||
}
|
||||
else if (dynamic_cast<Rim3dOverlayInfoConfig*>(uiItem))
|
||||
{
|
||||
commandIds << "RicShowGridStatisticsFeature";
|
||||
menuBuilder << "RicShowGridStatisticsFeature";
|
||||
}
|
||||
#ifdef USE_PROTOTYPE_FEATURE_FRACTURES
|
||||
else if (dynamic_cast<RimSimWellFracture*>(uiItem))
|
||||
{
|
||||
commandIds << "RicNewSimWellFractureFeature";
|
||||
menuBuilder << "RicNewSimWellFractureFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimFractureTemplateCollection*>(uiItem) ||
|
||||
dynamic_cast<RimStimPlanFractureTemplate*>(uiItem))
|
||||
{
|
||||
commandIds << "RicNewEllipseFractureTemplateFeature";
|
||||
commandIds << "RicNewStimPlanFractureTemplateFeature";
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicConvertAllFractureTemplatesToMetricFeature";
|
||||
commandIds << "RicConvertAllFractureTemplatesToFieldFeature";
|
||||
menuBuilder << "RicNewEllipseFractureTemplateFeature";
|
||||
menuBuilder << "RicNewStimPlanFractureTemplateFeature";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicConvertAllFractureTemplatesToMetricFeature";
|
||||
menuBuilder << "RicConvertAllFractureTemplatesToFieldFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimEllipseFractureTemplate*>(uiItem))
|
||||
{
|
||||
commandIds << "RicNewEllipseFractureTemplateFeature";
|
||||
commandIds << "RicNewStimPlanFractureTemplateFeature";
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicConvertFractureTemplateUnitFeature";
|
||||
menuBuilder << "RicNewEllipseFractureTemplateFeature";
|
||||
menuBuilder << "RicNewStimPlanFractureTemplateFeature";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicConvertFractureTemplateUnitFeature";
|
||||
}
|
||||
#endif // USE_PROTOTYPE_FEATURE_FRACTURES
|
||||
|
||||
|
||||
if (dynamic_cast<RimView*>(uiItem))
|
||||
{
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicLinkVisibleViewsFeature";
|
||||
commandIds << "RicLinkViewFeature";
|
||||
commandIds << "RicShowLinkOptionsFeature";
|
||||
commandIds << "RicSetMasterViewFeature";
|
||||
commandIds << "RicUnLinkViewFeature";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicLinkVisibleViewsFeature";
|
||||
menuBuilder << "RicLinkViewFeature";
|
||||
menuBuilder << "RicShowLinkOptionsFeature";
|
||||
menuBuilder << "RicSetMasterViewFeature";
|
||||
menuBuilder << "RicUnLinkViewFeature";
|
||||
}
|
||||
}
|
||||
|
||||
@ -487,41 +512,41 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
|
||||
// without using dyncamic_cast.
|
||||
|
||||
|
||||
commandIds << "RicPasteTimeHistoryCurveFeature";
|
||||
commandIds << "RicPasteAsciiDataCurveFeature";
|
||||
commandIds << "RicCopyReferencesToClipboardFeature";
|
||||
menuBuilder << "RicPasteTimeHistoryCurveFeature";
|
||||
menuBuilder << "RicPasteAsciiDataCurveFeature";
|
||||
menuBuilder << "RicCopyReferencesToClipboardFeature";
|
||||
|
||||
commandIds << "RicShowPlotDataFeature";
|
||||
commandIds << "RicShowTotalAllocationDataFeature";
|
||||
menuBuilder << "RicShowPlotDataFeature";
|
||||
menuBuilder << "RicShowTotalAllocationDataFeature";
|
||||
|
||||
commandIds << "RicSummaryCurveSwitchAxisFeature";
|
||||
menuBuilder << "RicSummaryCurveSwitchAxisFeature";
|
||||
|
||||
commandIds << "RicNewFishbonesSubsFeature";
|
||||
commandIds << "RicNewPerforationIntervalFeature";
|
||||
commandIds << "RicEditPerforationCollectionFeature";
|
||||
commandIds << "RicExportFishbonesLateralsFeature";
|
||||
commandIds << "RicExportFishbonesWellSegmentsFeature";
|
||||
commandIds << "RicWellPathImportPerforationIntervalsFeature";
|
||||
commandIds << "RicWellPathExportCompletionDataFeature";
|
||||
commandIds << "RicWellPathImportCompletionsFileFeature";
|
||||
commandIds << "RicFlyToObjectFeature";
|
||||
commandIds << "RicExportCarfin";
|
||||
menuBuilder << "RicNewFishbonesSubsFeature";
|
||||
menuBuilder << "RicNewPerforationIntervalFeature";
|
||||
menuBuilder << "RicEditPerforationCollectionFeature";
|
||||
menuBuilder << "RicExportFishbonesLateralsFeature";
|
||||
menuBuilder << "RicExportFishbonesWellSegmentsFeature";
|
||||
menuBuilder << "RicWellPathImportPerforationIntervalsFeature";
|
||||
menuBuilder << "RicWellPathExportCompletionDataFeature";
|
||||
menuBuilder << "RicWellPathImportCompletionsFileFeature";
|
||||
menuBuilder << "RicFlyToObjectFeature";
|
||||
menuBuilder << "RicExportCarfin";
|
||||
|
||||
commandIds << "RicImportObservedDataFeature";
|
||||
commandIds << "RicPasteSummaryCaseFeature";
|
||||
commandIds << "RicReloadSummaryCaseFeature";
|
||||
commandIds << "RicCreateSummaryCaseCollectionFeature";
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicCutReferencesToClipboardFeature";
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicCloseSummaryCaseFeature";
|
||||
commandIds << "RicCloseSummaryCaseInCollectionFeature";
|
||||
commandIds << "RicDeleteSummaryCaseCollectionFeature";
|
||||
commandIds << "RicCloseObservedDataFeature";
|
||||
menuBuilder << "RicImportObservedDataFeature";
|
||||
menuBuilder << "RicPasteSummaryCaseFeature";
|
||||
menuBuilder << "RicReloadSummaryCaseFeature";
|
||||
menuBuilder << "RicCreateSummaryCaseCollectionFeature";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicCutReferencesToClipboardFeature";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicCloseSummaryCaseFeature";
|
||||
menuBuilder << "RicCloseSummaryCaseInCollectionFeature";
|
||||
menuBuilder << "RicDeleteSummaryCaseCollectionFeature";
|
||||
menuBuilder << "RicCloseObservedDataFeature";
|
||||
|
||||
// Fracture commands
|
||||
#ifdef USE_PROTOTYPE_FEATURE_FRACTURES
|
||||
commandIds << "RicNewWellPathFractureFeature";
|
||||
menuBuilder << "RicNewWellPathFractureFeature";
|
||||
#endif // USE_PROTOTYPE_FEATURE_FRACTURES
|
||||
|
||||
// Work in progress -- End
|
||||
@ -529,55 +554,55 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
|
||||
caf::PdmUiItem* uiItem = uiItems[0];
|
||||
if (dynamic_cast<RimWellLogFileChannel*>(uiItem))
|
||||
{
|
||||
commandIds << "RicAddWellLogToPlotFeature";
|
||||
menuBuilder << "RicAddWellLogToPlotFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimEclipseStatisticsCase*>(uiItem))
|
||||
{
|
||||
commandIds << "RicExecuteScriptForCasesFeature";
|
||||
createExecuteScriptForCasesFeatureMenu(menuBuilder);
|
||||
}
|
||||
else if (dynamic_cast<RimEclipseCase*>(uiItem))
|
||||
{
|
||||
commandIds << "RicReloadCaseFeature";
|
||||
commandIds << "RicExecuteScriptForCasesFeature";
|
||||
commandIds << "RicCloseSourSimDataFeature";
|
||||
menuBuilder << "RicReloadCaseFeature";
|
||||
createExecuteScriptForCasesFeatureMenu(menuBuilder);
|
||||
menuBuilder << "RicCloseSourSimDataFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimSummaryPlot*>(uiItem))
|
||||
{
|
||||
commandIds << "RicAsciiExportSummaryPlotFeature";
|
||||
menuBuilder << "RicAsciiExportSummaryPlotFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimWellLogPlot*>(uiItem))
|
||||
{
|
||||
commandIds << "RicAsciiExportWellLogPlotFeature";
|
||||
menuBuilder << "RicAsciiExportWellLogPlotFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimWellLogCurve*>(uiItem) ||
|
||||
dynamic_cast<RimWellLogTrack*>(uiItem) ||
|
||||
dynamic_cast<RimWellLogPlot*>(uiItem))
|
||||
{
|
||||
commandIds << "RicExportToLasFileFeature";
|
||||
commandIds << "RicChangeDataSourceFeature";
|
||||
menuBuilder << "RicExportToLasFileFeature";
|
||||
menuBuilder << "RicChangeDataSourceFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimWellLogPlotCollection*>(uiItem))
|
||||
{
|
||||
commandIds << "RicExportToLasFileFeature";
|
||||
menuBuilder << "RicExportToLasFileFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimFaultInView*>(uiItem) )
|
||||
{
|
||||
commandIds << "RicExportFaultsFeature";
|
||||
menuBuilder << "RicExportFaultsFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimSimWellInView*>(uiItem))
|
||||
{
|
||||
commandIds << "RicPlotProductionRateFeature";
|
||||
commandIds << "RicShowContributingWellsFeature";
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicEclipseWellShowLabelFeature";
|
||||
commandIds << "RicEclipseWellShowHeadFeature";
|
||||
commandIds << "RicEclipseWellShowPipeFeature";
|
||||
commandIds << "RicEclipseWellShowSpheresFeature";
|
||||
commandIds << "RicEclipseWellShowWellCellsFeature";
|
||||
commandIds << "RicEclipseWellShowWellCellFenceFeature";
|
||||
menuBuilder << "RicPlotProductionRateFeature";
|
||||
menuBuilder << "RicShowContributingWellsFeature";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicEclipseWellShowLabelFeature";
|
||||
menuBuilder << "RicEclipseWellShowHeadFeature";
|
||||
menuBuilder << "RicEclipseWellShowPipeFeature";
|
||||
menuBuilder << "RicEclipseWellShowSpheresFeature";
|
||||
menuBuilder << "RicEclipseWellShowWellCellsFeature";
|
||||
menuBuilder << "RicEclipseWellShowWellCellFenceFeature";
|
||||
#ifdef USE_PROTOTYPE_FEATURE_FRACTURES
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicNewSimWellFractureFeature";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicNewSimWellFractureFeature";
|
||||
#endif // USE_PROTOTYPE_FEATURE_FRACTURES
|
||||
}
|
||||
}
|
||||
@ -585,83 +610,129 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
|
||||
|
||||
if (RicToggleItemsFeatureImpl::isToggleCommandsAvailable())
|
||||
{
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicToggleItemsOnFeature";
|
||||
commandIds << "RicToggleItemsOffFeature";
|
||||
commandIds << "RicToggleItemsFeature";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicToggleItemsOnFeature";
|
||||
menuBuilder << "RicToggleItemsOffFeature";
|
||||
menuBuilder << "RicToggleItemsFeature";
|
||||
}
|
||||
|
||||
if ( caf::CmdFeatureManager::instance()->getCommandFeature("RicDeleteItemFeature")->canFeatureBeExecuted() )
|
||||
{
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicDeleteItemFeature";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicDeleteItemFeature";
|
||||
}
|
||||
|
||||
if (caf::CmdFeatureManager::instance()->getCommandFeature("RicDeleteSubItemsFeature")->canFeatureBeExecuted())
|
||||
{
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicDeleteSubItemsFeature";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicDeleteSubItemsFeature";
|
||||
}
|
||||
|
||||
if (caf::CmdFeatureManager::instance()->getCommandFeature("RicWellPathDeleteFeature")->canFeatureBeExecuted())
|
||||
{
|
||||
// Special delete command for Well paths
|
||||
// Placed here to fit context menu location of general delete feature
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicWellPathDeleteFeature";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicWellPathDeleteFeature";
|
||||
}
|
||||
|
||||
if (caf::CmdFeatureManager::instance()->getCommandFeature("RicWellLogFileCloseFeature")->canFeatureBeExecuted())
|
||||
{
|
||||
// Special delete command for Well paths
|
||||
// Placed here to fit context menu location of general delete feature
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicWellLogFileCloseFeature";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicWellLogFileCloseFeature";
|
||||
}
|
||||
|
||||
if ( caf::CmdFeatureManager::instance()->getCommandFeature("RicCloseCaseFeature")->canFeatureBeExecuted() )
|
||||
{
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicCloseCaseFeature";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicCloseCaseFeature";
|
||||
}
|
||||
|
||||
return commandIds;
|
||||
return menuBuilder;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimContextCommandBuilder::appendCommandsToMenu(const QStringList& commandIds, QMenu* menu)
|
||||
std::vector<RimWellPath*> RimContextCommandBuilder::allWellPaths()
|
||||
{
|
||||
CVF_ASSERT(menu);
|
||||
RimProject* proj = RiaApplication::instance()->project();
|
||||
return proj->allWellPaths();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimContextCommandBuilder::createExecuteScriptForCasesFeatureMenu(caf::CmdFeatureMenuBuilder& menuBuilder)
|
||||
{
|
||||
//menuBuilder << "RicExecuteScriptForCasesFeature";
|
||||
|
||||
// Execute script on selection of cases
|
||||
RiuMainWindow* ruiMainWindow = RiuMainWindow::instance();
|
||||
if (ruiMainWindow)
|
||||
{
|
||||
std::vector<RimCase*> cases;
|
||||
ruiMainWindow->selectedCases(cases);
|
||||
|
||||
if (cases.size() > 0)
|
||||
{
|
||||
menuBuilder.subMenuStart("Execute script");
|
||||
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
RimProject* proj = app->project();
|
||||
if (proj && proj->scriptCollection())
|
||||
{
|
||||
RimScriptCollection* rootScriptCollection = proj->scriptCollection();
|
||||
|
||||
// Root script collection holds a list of subdirectories of user defined script folders
|
||||
for (size_t i = 0; i < rootScriptCollection->subDirectories.size(); i++)
|
||||
{
|
||||
RimScriptCollection* subDir = rootScriptCollection->subDirectories[i];
|
||||
|
||||
if (subDir)
|
||||
{
|
||||
appendScriptItems(menuBuilder, subDir);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
menuBuilder.addSeparator();
|
||||
menuBuilder.subMenuEnd();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimContextCommandBuilder::appendScriptItems(caf::CmdFeatureMenuBuilder& menuBuilder, RimScriptCollection* scriptCollection)
|
||||
{
|
||||
QDir dir(scriptCollection->directory);
|
||||
menuBuilder.subMenuStart(dir.dirName());
|
||||
|
||||
caf::CmdFeatureManager* commandManager = caf::CmdFeatureManager::instance();
|
||||
for (int i = 0; i < commandIds.size(); i++)
|
||||
{
|
||||
if (commandIds[i] == "Separator")
|
||||
{
|
||||
menu->addSeparator();
|
||||
}
|
||||
else
|
||||
{
|
||||
caf::CmdFeature* feature = commandManager->getCommandFeature(commandIds[i].toStdString());
|
||||
CVF_ASSERT(feature);
|
||||
CVF_ASSERT(commandManager);
|
||||
|
||||
if (feature->canFeatureBeExecuted())
|
||||
{
|
||||
QAction* act = commandManager->action(commandIds[i]);
|
||||
CVF_ASSERT(act);
|
||||
RicExecuteScriptForCasesFeature* executeScriptFeature = dynamic_cast<RicExecuteScriptForCasesFeature*>(commandManager->getCommandFeature("RicExecuteScriptForCasesFeature"));
|
||||
CVF_ASSERT(executeScriptFeature);
|
||||
|
||||
for (QAction* existingAct : menu->actions())
|
||||
for (size_t i = 0; i < scriptCollection->calcScripts.size(); i++)
|
||||
{
|
||||
// If action exist, continue to make sure the action is positioned at the first
|
||||
// location of a command ID
|
||||
if (existingAct == act) continue;
|
||||
RimCalcScript* calcScript = scriptCollection->calcScripts[i];
|
||||
QFileInfo fi(calcScript->absolutePath());
|
||||
|
||||
QString menuText = fi.baseName();
|
||||
menuBuilder.addCmdFeatureWithUserData("RicExecuteScriptForCasesFeature", menuText, QVariant(calcScript->absolutePath()));
|
||||
}
|
||||
|
||||
menu->addAction(act);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (size_t i = 0; i < scriptCollection->subDirectories.size(); i++)
|
||||
{
|
||||
RimScriptCollection* subDir = scriptCollection->subDirectories[i];
|
||||
|
||||
appendScriptItems(menuBuilder, subDir);
|
||||
}
|
||||
|
||||
menuBuilder.subMenuEnd();
|
||||
}
|
||||
|
@ -19,9 +19,14 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QStringList>
|
||||
#include <vector>
|
||||
|
||||
namespace caf {
|
||||
class CmdFeatureMenuBuilder;
|
||||
}
|
||||
class QMenu;
|
||||
class RimWellPath;
|
||||
class RimScriptCollection;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@ -30,6 +35,10 @@ class QMenu;
|
||||
class RimContextCommandBuilder
|
||||
{
|
||||
public:
|
||||
static QStringList commandsFromSelection();
|
||||
static void appendCommandsToMenu(const QStringList& commandIds, QMenu* menu);
|
||||
static caf::CmdFeatureMenuBuilder commandsFromSelection();
|
||||
|
||||
private:
|
||||
static std::vector<RimWellPath*> allWellPaths();
|
||||
static void createExecuteScriptForCasesFeatureMenu(caf::CmdFeatureMenuBuilder& menuBuilder);
|
||||
static void appendScriptItems(caf::CmdFeatureMenuBuilder& menuBuilder, RimScriptCollection* scriptCollection);
|
||||
};
|
||||
|
@ -75,7 +75,7 @@
|
||||
#include "cafCmdFeature.h"
|
||||
#include "cafCmdFeatureManager.h"
|
||||
#include "cafPdmUiTreeOrdering.h"
|
||||
|
||||
#include "cafCmdFeatureMenuBuilder.h"
|
||||
#include "cvfBoundingBox.h"
|
||||
|
||||
#include <QDir>
|
||||
@ -754,63 +754,9 @@ void RimProject::computeUtmAreaOfInterest()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimProject::actionsBasedOnSelection(QMenu& contextMenu)
|
||||
{
|
||||
QStringList commandIds = RimContextCommandBuilder::commandsFromSelection();
|
||||
caf::CmdFeatureMenuBuilder menuBuilder = RimContextCommandBuilder::commandsFromSelection();
|
||||
|
||||
caf::CmdFeatureManager* commandManager = caf::CmdFeatureManager::instance();
|
||||
for (int i = 0; i < commandIds.size(); i++)
|
||||
{
|
||||
if (commandIds[i] == "Separator")
|
||||
{
|
||||
contextMenu.addSeparator();
|
||||
}
|
||||
else if (commandIds[i] == "RicExecuteScriptForCasesFeature")
|
||||
{
|
||||
// Execute script on selection of cases
|
||||
RiuMainWindow* ruiMainWindow = RiuMainWindow::instance();
|
||||
if (ruiMainWindow)
|
||||
{
|
||||
std::vector<RimCase*> cases;
|
||||
ruiMainWindow->selectedCases(cases);
|
||||
|
||||
if (cases.size() > 0)
|
||||
{
|
||||
QMenu* executeMenu = contextMenu.addMenu("Execute script");
|
||||
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
RimProject* proj = app->project();
|
||||
if (proj && proj->scriptCollection())
|
||||
{
|
||||
RimScriptCollection* rootScriptCollection = proj->scriptCollection();
|
||||
|
||||
// Root script collection holds a list of subdirectories of user defined script folders
|
||||
for (size_t i = 0; i < rootScriptCollection->subDirectories.size(); i++)
|
||||
{
|
||||
RimScriptCollection* subDir = rootScriptCollection->subDirectories[i];
|
||||
|
||||
if (subDir)
|
||||
{
|
||||
appendScriptItems(executeMenu, subDir);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
contextMenu.addSeparator();
|
||||
contextMenu.addMenu(executeMenu);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
caf::CmdFeature* feature = commandManager->getCommandFeature(commandIds[i].toStdString());
|
||||
if (feature->canFeatureBeExecuted())
|
||||
{
|
||||
QAction* act = commandManager->action(commandIds[i]);
|
||||
CVF_ASSERT(act);
|
||||
|
||||
contextMenu.addAction(act);
|
||||
}
|
||||
}
|
||||
}
|
||||
menuBuilder.appendToMenu(&contextMenu);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -985,41 +931,6 @@ void RimProject::reloadCompletionTypeResultsForEclipseCase(RimEclipseCase* eclip
|
||||
RiaApplication::instance()->scheduleRecalculateCompletionTypeAndRedrawEclipseCase(eclipseCase);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimProject::appendScriptItems(QMenu* menu, RimScriptCollection* scriptCollection)
|
||||
{
|
||||
CVF_ASSERT(menu);
|
||||
|
||||
QDir dir(scriptCollection->directory);
|
||||
QMenu* subMenu = menu->addMenu(dir.dirName());
|
||||
|
||||
caf::CmdFeatureManager* commandManager = caf::CmdFeatureManager::instance();
|
||||
CVF_ASSERT(commandManager);
|
||||
|
||||
RicExecuteScriptForCasesFeature* executeScriptFeature = dynamic_cast<RicExecuteScriptForCasesFeature*>(commandManager->getCommandFeature("RicExecuteScriptForCasesFeature"));
|
||||
CVF_ASSERT(executeScriptFeature);
|
||||
|
||||
for (size_t i = 0; i < scriptCollection->calcScripts.size(); i++)
|
||||
{
|
||||
RimCalcScript* calcScript = scriptCollection->calcScripts[i];
|
||||
QFileInfo fi(calcScript->absolutePath());
|
||||
|
||||
QString menuText = fi.baseName();
|
||||
QAction* scriptAction = subMenu->addAction(menuText, executeScriptFeature, SLOT(slotExecuteScriptForSelectedCases()));
|
||||
|
||||
scriptAction->setData(QVariant(calcScript->absolutePath()));
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < scriptCollection->subDirectories.size(); i++)
|
||||
{
|
||||
RimScriptCollection* subDir = scriptCollection->subDirectories[i];
|
||||
|
||||
appendScriptItems(subMenu, subDir);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -140,9 +140,6 @@ protected:
|
||||
|
||||
virtual void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "");
|
||||
|
||||
private:
|
||||
void appendScriptItems(QMenu* menu, RimScriptCollection* scriptCollection);
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_projectFileVersionString;
|
||||
|
||||
|
@ -656,6 +656,15 @@ void RimWellPath::addWellLogFile(RimWellLogFile* logFileInfo)
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPath::deleteWellLogFile(RimWellLogFile* logFileInfo)
|
||||
{
|
||||
detachWellLogFile(logFileInfo);
|
||||
delete logFileInfo;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPath::detachWellLogFile(RimWellLogFile* logFileInfo)
|
||||
{
|
||||
auto pdmObject = dynamic_cast<caf::PdmObjectHandle*>(logFileInfo);
|
||||
for (size_t i = 0; i < m_wellLogFiles.size(); i++)
|
||||
@ -663,7 +672,6 @@ void RimWellPath::deleteWellLogFile(RimWellLogFile* logFileInfo)
|
||||
if (m_wellLogFiles[i] == pdmObject)
|
||||
{
|
||||
m_wellLogFiles.removeChildObject(pdmObject);
|
||||
delete pdmObject;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -68,6 +68,7 @@ public:
|
||||
|
||||
void addWellLogFile(RimWellLogFile* logFileInfo);
|
||||
void deleteWellLogFile(RimWellLogFile* logFileInfo);
|
||||
void detachWellLogFile(RimWellLogFile* logFileInfo);
|
||||
|
||||
virtual caf::PdmFieldHandle* userDescriptionField();
|
||||
virtual caf::PdmFieldHandle* objectToggleField();
|
||||
|
@ -31,9 +31,9 @@
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuContextMenuLauncher::RiuContextMenuLauncher(QWidget* widget, const QStringList& commandIds) :
|
||||
RiuContextMenuLauncher::RiuContextMenuLauncher(QWidget* widget, const caf::CmdFeatureMenuBuilder& commandIds) :
|
||||
QObject(widget),
|
||||
m_commandIds(commandIds)
|
||||
m_menuBuilder(commandIds)
|
||||
{
|
||||
widget->installEventFilter(this);
|
||||
}
|
||||
@ -46,7 +46,7 @@ bool RiuContextMenuLauncher::eventFilter(QObject* watchedObject, QEvent* event)
|
||||
if (event->type() == QEvent::ContextMenu)
|
||||
{
|
||||
QMenu menu;
|
||||
RimContextCommandBuilder::appendCommandsToMenu(m_commandIds, &menu);
|
||||
m_menuBuilder.appendToMenu(&menu);
|
||||
|
||||
if (menu.actions().size() > 0)
|
||||
{
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafCmdFeatureMenuBuilder.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QStringList>
|
||||
@ -32,12 +33,12 @@ class QWidget;
|
||||
class RiuContextMenuLauncher : public QObject
|
||||
{
|
||||
public:
|
||||
explicit RiuContextMenuLauncher(QWidget* widget, const QStringList& commandIds);
|
||||
explicit RiuContextMenuLauncher(QWidget* widget, const caf::CmdFeatureMenuBuilder& commandIds);
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject* watched, QEvent* event) override;
|
||||
|
||||
private:
|
||||
QStringList m_commandIds;
|
||||
caf::CmdFeatureMenuBuilder m_menuBuilder;
|
||||
};
|
||||
|
||||
|
@ -25,6 +25,8 @@
|
||||
|
||||
#include "RiuLineSegmentQwtPlotCurve.h"
|
||||
|
||||
#include "cafCmdFeatureMenuBuilder.h"
|
||||
|
||||
#include "cvfBase.h"
|
||||
#include "cvfAssert.h"
|
||||
#include "cvfColor3.h"
|
||||
@ -130,11 +132,11 @@ QSize RiuResultQwtPlot::minimumSizeHint() const
|
||||
void RiuResultQwtPlot::contextMenuEvent(QContextMenuEvent* event)
|
||||
{
|
||||
QMenu menu;
|
||||
QStringList commandIds;
|
||||
caf::CmdFeatureMenuBuilder menuBuilder;
|
||||
|
||||
commandIds << "RicNewGridTimeHistoryCurveFeature";
|
||||
menuBuilder << "RicNewGridTimeHistoryCurveFeature";
|
||||
|
||||
RimContextCommandBuilder::appendCommandsToMenu(commandIds, &menu);
|
||||
menuBuilder.appendToMenu(&menu);
|
||||
|
||||
if (menu.actions().size() > 0)
|
||||
{
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "RiuQwtScalePicker.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
#include "cafCmdFeatureMenuBuilder.h"
|
||||
|
||||
#include "qwt_date_scale_draw.h"
|
||||
#include "qwt_date_scale_engine.h"
|
||||
@ -166,13 +167,13 @@ QSize RiuSummaryQwtPlot::minimumSizeHint() const
|
||||
void RiuSummaryQwtPlot::contextMenuEvent(QContextMenuEvent* event)
|
||||
{
|
||||
QMenu menu;
|
||||
QStringList commandIds;
|
||||
caf::CmdFeatureMenuBuilder menuBuilder;
|
||||
|
||||
caf::SelectionManager::instance()->setSelectedItem(ownerPlotDefinition());
|
||||
|
||||
commandIds << "RicShowPlotDataFeature";
|
||||
menuBuilder << "RicShowPlotDataFeature";
|
||||
|
||||
RimContextCommandBuilder::appendCommandsToMenu(commandIds, &menu);
|
||||
menuBuilder.appendToMenu(&menu);
|
||||
|
||||
if (menu.actions().size() > 0)
|
||||
{
|
||||
|
@ -73,6 +73,7 @@
|
||||
#include "cafCmdFeatureManager.h"
|
||||
#include "cafDisplayCoordTransform.h"
|
||||
#include "cafSelectionManager.h"
|
||||
#include "cafCmdFeatureMenuBuilder.h"
|
||||
|
||||
#include "cvfDrawableGeo.h"
|
||||
#include "cvfHitItemCollection.h"
|
||||
@ -279,7 +280,7 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
|
||||
}
|
||||
}
|
||||
|
||||
QStringList commandIds;
|
||||
caf::CmdFeatureMenuBuilder menuBuilder;
|
||||
|
||||
// Well log curve creation commands
|
||||
if (firstHitPart && firstHitPart->sourceInfo())
|
||||
@ -297,21 +298,21 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
|
||||
RiuSelectionManager::instance()->setSelectedItem(selItem, RiuSelectionManager::RUI_TEMPORARY);
|
||||
|
||||
#ifdef USE_PROTOTYPE_FEATURE_FRACTURES
|
||||
commandIds << "RicNewWellPathFractureAtPosFeature";
|
||||
menuBuilder << "RicNewWellPathFractureAtPosFeature";
|
||||
#endif // USE_PROTOTYPE_FEATURE_FRACTURES
|
||||
|
||||
|
||||
//TODO: Update so these also use RiuWellPathSelectionItem
|
||||
caf::SelectionManager::instance()->setSelectedItem(wellPath);
|
||||
|
||||
commandIds << "RicNewWellLogCurveExtractionFeature";
|
||||
commandIds << "RicNewWellLogFileCurveFeature";
|
||||
commandIds << "RicNewRftPlotFeature";
|
||||
commandIds << "RicNewPltPlotFeature";
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicNewWellPathIntersectionFeature";
|
||||
commandIds << "RicNewFishbonesSubsAtMeasuredDepthFeature";
|
||||
commandIds << "RicNewPerforationIntervalAtMeasuredDepthFeature";
|
||||
menuBuilder << "RicNewWellLogCurveExtractionFeature";
|
||||
menuBuilder << "RicNewWellLogFileCurveFeature";
|
||||
menuBuilder << "RicNewRftPlotFeature";
|
||||
menuBuilder << "RicNewPltPlotFeature";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicNewWellPathIntersectionFeature";
|
||||
menuBuilder << "RicNewFishbonesSubsAtMeasuredDepthFeature";
|
||||
menuBuilder << "RicNewPerforationIntervalAtMeasuredDepthFeature";
|
||||
}
|
||||
}
|
||||
|
||||
@ -326,19 +327,19 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
|
||||
RiuSelectionItem* selItem = new RiuSimWellSelectionItem(eclipseWellSourceInfo->well(), m_currentPickPositionInDomainCoords, eclipseWellSourceInfo->branchIndex());
|
||||
RiuSelectionManager::instance()->setSelectedItem(selItem, RiuSelectionManager::RUI_TEMPORARY);
|
||||
|
||||
commandIds << "RicNewWellLogCurveExtractionFeature";
|
||||
commandIds << "RicNewWellLogRftCurveFeature";
|
||||
commandIds << "RicNewRftPlotFeature";
|
||||
commandIds << "RicNewPltPlotFeature";
|
||||
commandIds << "RicShowWellAllocationPlotFeature";
|
||||
commandIds << "RicPlotProductionRateFeature";
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicShowContributingWellsFeature";
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicNewSimWellIntersectionFeature";
|
||||
commandIds << "RicPlotProductionRateFeature";
|
||||
menuBuilder << "RicNewWellLogCurveExtractionFeature";
|
||||
menuBuilder << "RicNewWellLogRftCurveFeature";
|
||||
menuBuilder << "RicNewRftPlotFeature";
|
||||
menuBuilder << "RicNewPltPlotFeature";
|
||||
menuBuilder << "RicShowWellAllocationPlotFeature";
|
||||
menuBuilder << "RicPlotProductionRateFeature";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicShowContributingWellsFeature";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicNewSimWellIntersectionFeature";
|
||||
menuBuilder << "RicPlotProductionRateFeature";
|
||||
#ifdef USE_PROTOTYPE_FEATURE_FRACTURES
|
||||
commandIds << "RicNewSimWellFractureAtPosFeature";
|
||||
menuBuilder << "RicNewSimWellFractureAtPosFeature";
|
||||
#endif // USE_PROTOTYPE_FEATURE_FRACTURES
|
||||
}
|
||||
}
|
||||
@ -348,19 +349,19 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
|
||||
// View Link commands
|
||||
if (!firstHitPart)
|
||||
{
|
||||
commandIds << "RicLinkViewFeature";
|
||||
commandIds << "RicShowLinkOptionsFeature";
|
||||
commandIds << "RicSetMasterViewFeature";
|
||||
commandIds << "RicUnLinkViewFeature";
|
||||
menuBuilder << "RicLinkViewFeature";
|
||||
menuBuilder << "RicShowLinkOptionsFeature";
|
||||
menuBuilder << "RicSetMasterViewFeature";
|
||||
menuBuilder << "RicUnLinkViewFeature";
|
||||
}
|
||||
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicNewGridTimeHistoryCurveFeature";
|
||||
commandIds << "RicShowFlowCharacteristicsPlotFeature";
|
||||
commandIds << "RicSaveEclipseInputVisibleCellsFeature";
|
||||
commandIds << "RicShowGridStatisticsFeature";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicNewGridTimeHistoryCurveFeature";
|
||||
menuBuilder << "RicShowFlowCharacteristicsPlotFeature";
|
||||
menuBuilder << "RicSaveEclipseInputVisibleCellsFeature";
|
||||
menuBuilder << "RicShowGridStatisticsFeature";
|
||||
|
||||
RimContextCommandBuilder::appendCommandsToMenu(commandIds, &menu);
|
||||
menuBuilder.appendToMenu(&menu);
|
||||
|
||||
if (!menu.isEmpty())
|
||||
{
|
||||
|
@ -79,16 +79,16 @@ RiuWellAllocationPlot::RiuWellAllocationPlot(RimWellAllocationPlot* plotDefiniti
|
||||
m_legendWidget = new RiuNightchartsWidget(this);
|
||||
new RiuPlotObjectPicker(m_legendWidget, m_plotDefinition->plotLegend());
|
||||
|
||||
QStringList commandIds;
|
||||
commandIds << "RicShowTotalAllocationDataFeature";
|
||||
new RiuContextMenuLauncher(m_legendWidget, commandIds);
|
||||
caf::CmdFeatureMenuBuilder menuBuilder;
|
||||
menuBuilder << "RicShowTotalAllocationDataFeature";
|
||||
new RiuContextMenuLauncher(m_legendWidget, menuBuilder);
|
||||
|
||||
rightColumnLayout->addWidget(m_legendWidget);
|
||||
m_legendWidget->showPie(false);
|
||||
|
||||
QWidget* totalFlowAllocationWidget = m_plotDefinition->totalWellFlowPlot()->createViewWidget(this);
|
||||
new RiuPlotObjectPicker(totalFlowAllocationWidget, m_plotDefinition->totalWellFlowPlot());
|
||||
new RiuContextMenuLauncher(totalFlowAllocationWidget, commandIds);
|
||||
new RiuContextMenuLauncher(totalFlowAllocationWidget, menuBuilder);
|
||||
|
||||
rightColumnLayout->addWidget(totalFlowAllocationWidget, Qt::AlignTop);
|
||||
rightColumnLayout->addWidget(m_plotDefinition->tofAccumulatedPhaseFractionsPlot()->createViewWidget(this), Qt::AlignTop);
|
||||
@ -193,11 +193,11 @@ QSize RiuWellAllocationPlot::minimumSizeHint() const
|
||||
void RiuWellAllocationPlot::contextMenuEvent(QContextMenuEvent* event)
|
||||
{
|
||||
QMenu menu;
|
||||
QStringList commandIds;
|
||||
caf::CmdFeatureMenuBuilder menuBuilder;
|
||||
|
||||
commandIds << "RicShowContributingWellsFromPlotFeature";
|
||||
menuBuilder << "RicShowContributingWellsFromPlotFeature";
|
||||
|
||||
RimContextCommandBuilder::appendCommandsToMenu(commandIds, &menu);
|
||||
menuBuilder.appendToMenu(&menu);
|
||||
|
||||
if (menu.actions().size() > 0)
|
||||
{
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "RiuWellLogTrack.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
#include "cafCmdFeatureMenuBuilder.h"
|
||||
|
||||
#include "cvfAssert.h"
|
||||
|
||||
@ -214,14 +215,14 @@ QSize RiuWellLogPlot::sizeHint() const
|
||||
void RiuWellLogPlot::contextMenuEvent(QContextMenuEvent* event)
|
||||
{
|
||||
QMenu menu;
|
||||
QStringList commandIds;
|
||||
caf::CmdFeatureMenuBuilder menuBuilder;
|
||||
|
||||
caf::SelectionManager::instance()->setSelectedItem(ownerPlotDefinition());
|
||||
|
||||
commandIds << "RicShowPlotDataFeature";
|
||||
commandIds << "RicShowContributingWellsFromPlotFeature";
|
||||
menuBuilder << "RicShowPlotDataFeature";
|
||||
menuBuilder << "RicShowContributingWellsFromPlotFeature";
|
||||
|
||||
RimContextCommandBuilder::appendCommandsToMenu(commandIds, &menu);
|
||||
menuBuilder.appendToMenu(&menu);
|
||||
|
||||
if (menu.actions().size() > 0)
|
||||
{
|
||||
|
@ -61,6 +61,8 @@ set( PROJECT_FILES
|
||||
cafCmdFeature.h
|
||||
cafCmdFeatureManager.cpp
|
||||
cafCmdFeatureManager.h
|
||||
cafCmdFeatureMenuBuilder.cpp
|
||||
cafCmdFeatureMenuBuilder.h
|
||||
)
|
||||
|
||||
|
||||
|
@ -68,13 +68,21 @@ CmdFeature::~CmdFeature()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QAction* CmdFeature::action()
|
||||
{
|
||||
return this->action(QString(""));
|
||||
return this->actionWithCustomText(QString(""));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QAction* CmdFeature::action(QString customText)
|
||||
QAction* CmdFeature::actionWithCustomText(const QString& customText)
|
||||
{
|
||||
return actionWithUserData(customText, QVariant());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QAction* CmdFeature::actionWithUserData(const QString& customText, const QVariant& userData)
|
||||
{
|
||||
QAction* action = NULL;
|
||||
|
||||
@ -88,6 +96,11 @@ QAction* CmdFeature::action(QString customText)
|
||||
else
|
||||
{
|
||||
action = new QAction(this);
|
||||
|
||||
if (!userData.isNull())
|
||||
{
|
||||
action->setData(userData);
|
||||
}
|
||||
connect(action, SIGNAL(triggered(bool)), SLOT(actionTriggered(bool)));
|
||||
m_customTextToActionMap[customText]= action;
|
||||
}
|
||||
@ -170,4 +183,15 @@ void CmdFeature::disableModelChangeContribution()
|
||||
m_triggerModelChange = false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const QVariant CmdFeature::userData() const
|
||||
{
|
||||
QAction* action = qobject_cast<QAction*>(sender());
|
||||
if (!action) return QVariant();
|
||||
|
||||
return action->data();
|
||||
}
|
||||
|
||||
} // end namespace caf
|
||||
|
@ -77,7 +77,8 @@ public:
|
||||
virtual ~CmdFeature();
|
||||
|
||||
QAction* action();
|
||||
QAction* action(QString customText);
|
||||
QAction* actionWithCustomText(const QString& customText);
|
||||
QAction* actionWithUserData(const QString& customText, const QVariant& userData);
|
||||
void refreshEnabledState();
|
||||
void refreshCheckedState();
|
||||
|
||||
@ -93,6 +94,7 @@ protected:
|
||||
virtual bool isCommandChecked();
|
||||
|
||||
void disableModelChangeContribution();
|
||||
const QVariant userData() const;
|
||||
|
||||
private:
|
||||
std::map<QString, QAction*> m_customTextToActionMap;
|
||||
|
@ -108,7 +108,21 @@ QAction* CmdFeatureManager::action(const QString& commandId, const QString& cust
|
||||
{
|
||||
std::pair<CmdFeature*, size_t> featurePair = createFeature(commandId.toStdString());
|
||||
|
||||
QAction* act = featurePair.first->action(customActionText);
|
||||
QAction* act = featurePair.first->actionWithCustomText(customActionText);
|
||||
m_actionToFeatureIdxMap[act] = featurePair.second;
|
||||
|
||||
return act;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Get action for the specified command, with custom action text
|
||||
/// The action is owned by the PdmCommandItemManager
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QAction* CmdFeatureManager::actionWithUserData(const QString& commandId, const QString& customActionText, const QVariant& userData)
|
||||
{
|
||||
std::pair<CmdFeature*, size_t> featurePair = createFeature(commandId.toStdString());
|
||||
|
||||
QAction* act = featurePair.first->actionWithUserData(customActionText, userData);
|
||||
m_actionToFeatureIdxMap[act] = featurePair.second;
|
||||
|
||||
return act;
|
||||
|
@ -63,8 +63,8 @@ public:
|
||||
virtual ~CmdFeatureManager();
|
||||
|
||||
QAction* action(const QString& commandId);
|
||||
QAction* action(const QString& commandId, const QString& actionText);
|
||||
|
||||
QAction* action(const QString& commandId, const QString& customActionText);
|
||||
QAction* actionWithUserData(const QString& commandId, const QString& customActionText, const QVariant& userData);
|
||||
void refreshStates(const QStringList& commandIdList = QStringList());
|
||||
void refreshEnabledState(const QStringList& commandIdList = QStringList());
|
||||
void refreshCheckedState(const QStringList& commandIdList = QStringList());
|
||||
|
209
Fwk/AppFwk/cafCommand/cafCmdFeatureMenuBuilder.cpp
Normal file
209
Fwk/AppFwk/cafCommand/cafCmdFeatureMenuBuilder.cpp
Normal file
@ -0,0 +1,209 @@
|
||||
//##################################################################################################
|
||||
//
|
||||
// Custom Visualization Core library
|
||||
// Copyright (C) 2011-2013 Ceetron AS
|
||||
//
|
||||
// This library may be used under the terms of either the GNU General Public License or
|
||||
// the GNU Lesser General Public License as follows:
|
||||
//
|
||||
// GNU General Public License Usage
|
||||
// This library 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.
|
||||
//
|
||||
// This library 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.
|
||||
//
|
||||
// GNU Lesser General Public License Usage
|
||||
// This library is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation; either version 2.1 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This library 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 Lesser General Public License at <<http://www.gnu.org/licenses/lgpl-2.1.html>>
|
||||
// for more details.
|
||||
//
|
||||
//##################################################################################################
|
||||
|
||||
|
||||
#include "cafCmdFeatureMenuBuilder.h"
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
#include "cafCmdFeatureManager.h"
|
||||
#include "cafCmdSelectionHelper.h"
|
||||
#include "cafFactory.h"
|
||||
|
||||
#include "cvfAssert.h"
|
||||
|
||||
#include "defaultfeatures/cafCmdDeleteItemFeature.h"
|
||||
#include "defaultfeatures/cafCmdAddItemFeature.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QMenu>
|
||||
|
||||
namespace caf
|
||||
{
|
||||
|
||||
// typedef Factory<CmdFeature, std::string> CommandFeatureFactory;
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
CmdFeatureMenuBuilder::CmdFeatureMenuBuilder()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
CmdFeatureMenuBuilder::~CmdFeatureMenuBuilder()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
CmdFeatureMenuBuilder& CmdFeatureMenuBuilder::operator<<(const QString& commandId)
|
||||
{
|
||||
if (commandId == "Separator")
|
||||
{
|
||||
addSeparator();
|
||||
}
|
||||
else
|
||||
{
|
||||
addCmdFeature(commandId);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
CmdFeatureMenuBuilder& CmdFeatureMenuBuilder::addCmdFeature(const QString commandId, const QString& uiText)
|
||||
{
|
||||
MenuItem i;
|
||||
i.itemType = MenuItem::COMMAND;
|
||||
i.itemName = commandId;
|
||||
i.uiText = uiText;
|
||||
m_items.push_back(i);
|
||||
return *this;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
CmdFeatureMenuBuilder& CmdFeatureMenuBuilder::addCmdFeatureWithUserData(const QString commandId, const QString& uiText, const QVariant& userData)
|
||||
{
|
||||
MenuItem i;
|
||||
i.itemType = MenuItem::COMMAND;
|
||||
i.itemName = commandId;
|
||||
i.uiText = uiText;
|
||||
i.userData = userData;
|
||||
m_items.push_back(i);
|
||||
return *this;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
CmdFeatureMenuBuilder& CmdFeatureMenuBuilder::addSeparator()
|
||||
{
|
||||
MenuItem i;
|
||||
i.itemType = MenuItem::SEPARATOR;
|
||||
m_items.push_back(i);
|
||||
return *this;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
CmdFeatureMenuBuilder& CmdFeatureMenuBuilder::subMenuStart(const QString& menuName)
|
||||
{
|
||||
MenuItem i;
|
||||
i.itemType = MenuItem::SUBMENU_START;
|
||||
i.itemName = menuName;
|
||||
m_items.push_back(i);
|
||||
return *this;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
CmdFeatureMenuBuilder& CmdFeatureMenuBuilder::subMenuEnd()
|
||||
{
|
||||
MenuItem i;
|
||||
i.itemType = MenuItem::SUBMENU_END;
|
||||
m_items.push_back(i);
|
||||
return *this;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void CmdFeatureMenuBuilder::appendToMenu(QMenu* menu)
|
||||
{
|
||||
CVF_ASSERT(menu);
|
||||
|
||||
std::vector<QMenu*> menus = { menu };
|
||||
for (int i = 0; i < m_items.size(); i++)
|
||||
{
|
||||
if (m_items[i].itemType == MenuItem::SEPARATOR)
|
||||
{
|
||||
menu->addSeparator();
|
||||
}
|
||||
else if (m_items[i].itemType == MenuItem::SUBMENU_START)
|
||||
{
|
||||
QMenu* subMenu = menus.back()->addMenu(m_items[i].itemName);
|
||||
menus.push_back(subMenu);
|
||||
}
|
||||
else if (m_items[i].itemType == MenuItem::SUBMENU_END)
|
||||
{
|
||||
if (menus.size() > 1)
|
||||
{
|
||||
menus.pop_back();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CmdFeatureManager* commandManager = CmdFeatureManager::instance();
|
||||
QMenu* currentMenu = menus.back();
|
||||
caf::CmdFeature* feature = commandManager->getCommandFeature(m_items[i].itemName.toStdString());
|
||||
CVF_ASSERT(feature);
|
||||
|
||||
if (feature->canFeatureBeExecuted())
|
||||
{
|
||||
const QAction* act;
|
||||
if (!m_items[i].userData.isNull())
|
||||
{
|
||||
act = commandManager->actionWithUserData(m_items[i].itemName, m_items[i].uiText, m_items[i].userData);
|
||||
}
|
||||
else
|
||||
{
|
||||
act = commandManager->action(m_items[i].itemName);
|
||||
}
|
||||
|
||||
CVF_ASSERT(act);
|
||||
|
||||
for (QAction* existingAct : currentMenu->actions())
|
||||
{
|
||||
// If action exist, continue to make sure the action is positioned at the first
|
||||
// location of a command ID
|
||||
if (existingAct == act) continue;
|
||||
}
|
||||
|
||||
currentMenu->addAction(const_cast<QAction*>(act));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // end namespace caf
|
110
Fwk/AppFwk/cafCommand/cafCmdFeatureMenuBuilder.h
Normal file
110
Fwk/AppFwk/cafCommand/cafCmdFeatureMenuBuilder.h
Normal file
@ -0,0 +1,110 @@
|
||||
//##################################################################################################
|
||||
//
|
||||
// Custom Visualization Core library
|
||||
// Copyright (C) 2011-2013 Ceetron AS
|
||||
//
|
||||
// This library may be used under the terms of either the GNU General Public License or
|
||||
// the GNU Lesser General Public License as follows:
|
||||
//
|
||||
// GNU General Public License Usage
|
||||
// This library 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.
|
||||
//
|
||||
// This library 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.
|
||||
//
|
||||
// GNU Lesser General Public License Usage
|
||||
// This library is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation; either version 2.1 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This library 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 Lesser General Public License at <<http://www.gnu.org/licenses/lgpl-2.1.html>>
|
||||
// for more details.
|
||||
//
|
||||
//##################################################################################################
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <set>
|
||||
|
||||
#include <QObject>
|
||||
#include <QVariant>
|
||||
|
||||
class QAction;
|
||||
class QMenu;
|
||||
|
||||
namespace caf
|
||||
{
|
||||
|
||||
class CmdFeature;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class CmdFeatureMenuBuilder
|
||||
{
|
||||
public:
|
||||
CmdFeatureMenuBuilder();
|
||||
//CmdFeatureMenuBuilder(const CmdFeatureMenuBuilder& other);
|
||||
virtual ~CmdFeatureMenuBuilder();
|
||||
|
||||
CmdFeatureMenuBuilder& operator<<(const QString& commandIdOrSeparator);
|
||||
CmdFeatureMenuBuilder& addCmdFeature(const QString commandId, const QString& customUiText = "");
|
||||
CmdFeatureMenuBuilder& addCmdFeatureWithUserData(const QString commandId, const QString& customUiText, const QVariant& userData);
|
||||
|
||||
CmdFeatureMenuBuilder& addSeparator();
|
||||
|
||||
CmdFeatureMenuBuilder& subMenuStart(const QString& menuName);
|
||||
CmdFeatureMenuBuilder& subMenuEnd();
|
||||
|
||||
void appendToMenu(QMenu* menu);
|
||||
|
||||
// const std::vector<MenuItem> items() const;
|
||||
|
||||
private:
|
||||
struct MenuItem
|
||||
{
|
||||
public:
|
||||
enum ItemType { COMMAND, SEPARATOR, SUBMENU_START, SUBMENU_END };
|
||||
|
||||
ItemType itemType;
|
||||
QString itemName;
|
||||
QString uiText;
|
||||
QVariant userData;
|
||||
};
|
||||
|
||||
std::vector<MenuItem> m_items;
|
||||
};
|
||||
|
||||
} // end namespace caf
|
||||
|
||||
|
||||
|
||||
//static MenuItem command(QString commandName)
|
||||
//{
|
||||
// MenuItem i;
|
||||
// i.itemType = COMMAND;
|
||||
// i.itemName = commandName;
|
||||
// return i;
|
||||
//}
|
||||
//
|
||||
//static MenuItem separator()
|
||||
//{
|
||||
// MenuItem i;
|
||||
// i.itemType = SEPARATOR;
|
||||
// return i;
|
||||
//}
|
Loading…
Reference in New Issue
Block a user