2020-09-24 02:05:46 +01:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2025-01-01 13:30:11 -08:00
|
|
|
* Copyright The KiCad Developers, see AUTHORS.txt for contributors.
|
2020-09-24 02:05:46 +01:00
|
|
|
*
|
|
|
|
* This program 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 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program 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 for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef GROUP_TOOL_H
|
|
|
|
#define GROUP_TOOL_H
|
|
|
|
|
2025-04-03 09:20:43 -04:00
|
|
|
#include <tool/selection_tool.h>
|
|
|
|
|
|
|
|
class COMMIT;
|
2020-09-24 02:05:46 +01:00
|
|
|
class DIALOG_GROUP_PROPERTIES;
|
|
|
|
|
2025-04-03 09:20:43 -04:00
|
|
|
class GROUP_TOOL : public TOOL_INTERACTIVE
|
2020-09-24 02:05:46 +01:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
GROUP_TOOL();
|
|
|
|
|
|
|
|
void Reset( RESET_REASON aReason ) override;
|
|
|
|
|
|
|
|
/// @copydoc TOOL_BASE::Init()
|
|
|
|
bool Init() override;
|
|
|
|
|
2025-04-03 09:20:43 -04:00
|
|
|
virtual int GroupProperties( const TOOL_EVENT& aEvent );
|
2020-09-24 02:05:46 +01:00
|
|
|
|
|
|
|
/**
|
2021-01-27 17:15:38 -05:00
|
|
|
* Invoke the picker tool to select a new member of the group.
|
2020-09-24 02:05:46 +01:00
|
|
|
*/
|
2025-04-03 09:20:43 -04:00
|
|
|
virtual int PickNewMember( const TOOL_EVENT& aEvent ) = 0;
|
2020-09-24 02:05:46 +01:00
|
|
|
|
2021-01-27 17:15:38 -05:00
|
|
|
///< Group selected items.
|
2025-04-03 09:20:43 -04:00
|
|
|
virtual int Group( const TOOL_EVENT& aEvent ) = 0;
|
2020-10-03 12:16:29 +01:00
|
|
|
|
2021-01-27 17:15:38 -05:00
|
|
|
///< Ungroup selected items.
|
2025-04-03 09:20:43 -04:00
|
|
|
virtual int Ungroup( const TOOL_EVENT& aEvent );
|
2020-10-03 12:16:29 +01:00
|
|
|
|
2021-01-27 17:15:38 -05:00
|
|
|
///< Remove selection from group.
|
2025-04-03 09:20:43 -04:00
|
|
|
virtual int RemoveFromGroup( const TOOL_EVENT& aEvent );
|
2020-10-03 12:16:29 +01:00
|
|
|
|
2021-01-27 17:15:38 -05:00
|
|
|
///< Restrict selection to only member of the group.
|
2025-04-03 09:20:43 -04:00
|
|
|
virtual int EnterGroup( const TOOL_EVENT& aEvent );
|
2020-10-03 12:16:29 +01:00
|
|
|
|
2021-01-27 17:15:38 -05:00
|
|
|
///< Leave the current group (deselect its members and select the group as a whole).
|
2025-04-03 09:20:43 -04:00
|
|
|
virtual int LeaveGroup( const TOOL_EVENT& aEvent );
|
2020-10-03 12:16:29 +01:00
|
|
|
|
2025-04-03 09:20:43 -04:00
|
|
|
protected:
|
2021-01-27 17:15:38 -05:00
|
|
|
///< Set up handlers for various events.
|
2020-09-24 02:05:46 +01:00
|
|
|
void setTransitions() override;
|
|
|
|
|
2025-04-03 09:20:43 -04:00
|
|
|
///< Subclasses implement to provide correct *_COMMIT object type
|
2025-05-06 10:59:13 -04:00
|
|
|
virtual std::shared_ptr<COMMIT> createCommit() = 0;
|
2025-04-03 09:20:43 -04:00
|
|
|
|
|
|
|
EDA_DRAW_FRAME* m_frame = nullptr;
|
|
|
|
DIALOG_GROUP_PROPERTIES* m_propertiesDialog = nullptr;
|
|
|
|
SELECTION_TOOL* m_selectionTool = nullptr;
|
2025-05-06 10:59:13 -04:00
|
|
|
std::shared_ptr<COMMIT> m_commit;
|
2025-04-03 09:20:43 -04:00
|
|
|
bool m_isFootprintEditor = false;
|
2020-09-24 02:05:46 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|