(#361) Toggle commands now implemented in new tree

This commit is contained in:
Jacob Støren 2015-08-18 12:08:46 +02:00
parent 302f46b61b
commit c3db342474
6 changed files with 212 additions and 6 deletions

View File

@ -7,17 +7,15 @@ endif()
set (SOURCE_GROUP_HEADER_FILES
${CEE_CURRENT_LIST_DIR}RicToggleItemsFeatureImpl.h
${CEE_CURRENT_LIST_DIR}RicToggleItemsOnFeature.h
#${CEE_CURRENT_LIST_DIR}RicToggleItemsOffFeature.h
#${CEE_CURRENT_LIST_DIR}RicToggleItemsFeature.h
${CEE_CURRENT_LIST_DIR}RicToggleItemsOffFeature.h
${CEE_CURRENT_LIST_DIR}RicToggleItemsFeature.h
)
set (SOURCE_GROUP_SOURCE_FILES
${CEE_CURRENT_LIST_DIR}RicToggleItemsFeatureImpl.cpp
${CEE_CURRENT_LIST_DIR}RicToggleItemsOnFeature.cpp
#${CEE_CURRENT_LIST_DIR}RicToggleItemsOffFeature.cpp
#${CEE_CURRENT_LIST_DIR}RicToggleItemsFeature.cpp
${CEE_CURRENT_LIST_DIR}RicToggleItemsOffFeature.cpp
${CEE_CURRENT_LIST_DIR}RicToggleItemsFeature.cpp
)
list(APPEND CODE_HEADER_FILES

View File

@ -0,0 +1,60 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RicToggleItemsFeature.h"
#include "cafSelectionManager.h"
#include "RicToggleItemsFeatureImpl.h"
#include <QAction>
namespace caf
{
CAF_CMD_SOURCE_INIT(RicToggleItemsFeature, "RicToggleItemsFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicToggleItemsFeature::isCommandEnabled()
{
return RicToggleItemsFeatureImpl::isToggleCommandsAvailable();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicToggleItemsFeature::onActionTriggered(bool isChecked)
{
RicToggleItemsFeatureImpl::setObjectToggleStateForSelection(RicToggleItemsFeatureImpl::TOGGLE);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicToggleItemsFeature::setupActionLook(QAction* actionToSetup)
{
if (RicToggleItemsFeatureImpl::isToggleCommandsForSubItems())
actionToSetup->setText("Toggle Sub Items");
else
actionToSetup->setText("Toggle");
}
} // end namespace caf

View File

@ -0,0 +1,43 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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"
namespace caf
{
//==================================================================================================
///
//==================================================================================================
class RicToggleItemsFeature : public CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
virtual bool isCommandEnabled();
virtual void onActionTriggered( bool isChecked );
virtual void setupActionLook( QAction* actionToSetup );
};
} // end namespace caf

View File

@ -0,0 +1,60 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RicToggleItemsOffFeature.h"
#include "cafSelectionManager.h"
#include "RicToggleItemsFeatureImpl.h"
#include <QAction>
namespace caf
{
CAF_CMD_SOURCE_INIT(RicToggleItemsOffFeature, "RicToggleItemsOffFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicToggleItemsOffFeature::isCommandEnabled()
{
return RicToggleItemsFeatureImpl::isToggleCommandsAvailable();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicToggleItemsOffFeature::onActionTriggered(bool isChecked)
{
RicToggleItemsFeatureImpl::setObjectToggleStateForSelection(RicToggleItemsFeatureImpl::TOGGLE_OFF);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicToggleItemsOffFeature::setupActionLook(QAction* actionToSetup)
{
if (RicToggleItemsFeatureImpl::isToggleCommandsForSubItems())
actionToSetup->setText("Sub Items Off");
else
actionToSetup->setText("Off");
}
} // end namespace caf

View File

@ -0,0 +1,43 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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"
namespace caf
{
//==================================================================================================
///
//==================================================================================================
class RicToggleItemsOffFeature : public CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
virtual bool isCommandEnabled();
virtual void onActionTriggered( bool isChecked );
virtual void setupActionLook( QAction* actionToSetup );
};
} // end namespace caf

View File

@ -654,6 +654,8 @@ void RimProject::actionsBasedOnSelection(QMenu& contextMenu)
{
commandIds << "Separator";
commandIds << "RicToggleItemsOnFeature";
commandIds << "RicToggleItemsOffFeature";
commandIds << "RicToggleItemsFeature";
}