2019-04-29 21:38:05 +01:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2019-08-14 09:28:07 +01:00
|
|
|
* Copyright (C) 2019 CERN
|
2025-01-01 13:30:11 -08:00
|
|
|
* Copyright The KiCad Developers, see AUTHORS.txt for contributors.
|
2019-04-29 21:38:05 +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
|
|
|
|
*/
|
|
|
|
|
2024-10-04 15:20:03 +01:00
|
|
|
#pragma once
|
2019-04-29 21:38:05 +01:00
|
|
|
|
2025-03-12 14:41:25 +00:00
|
|
|
#include <tools/sch_tool_base.h>
|
2019-04-29 21:38:05 +01:00
|
|
|
|
|
|
|
|
2024-10-04 15:20:03 +01:00
|
|
|
class SCH_PIN;
|
|
|
|
class SCH_SHAPE;
|
2020-10-31 01:27:16 +00:00
|
|
|
class SYMBOL_EDIT_FRAME;
|
2019-04-29 21:38:05 +01:00
|
|
|
|
|
|
|
|
2025-03-12 14:41:25 +00:00
|
|
|
class SYMBOL_EDITOR_EDIT_TOOL : public SCH_TOOL_BASE<SYMBOL_EDIT_FRAME>
|
2019-04-29 21:38:05 +01:00
|
|
|
{
|
|
|
|
public:
|
2020-12-12 03:13:52 +00:00
|
|
|
SYMBOL_EDITOR_EDIT_TOOL();
|
|
|
|
~SYMBOL_EDITOR_EDIT_TOOL() override { }
|
2019-04-29 21:38:05 +01:00
|
|
|
|
|
|
|
/// @copydoc TOOL_INTERACTIVE::Init()
|
|
|
|
bool Init() override;
|
|
|
|
|
2019-05-08 19:56:03 +01:00
|
|
|
int Rotate( const TOOL_EVENT& aEvent );
|
|
|
|
int Mirror( const TOOL_EVENT& aEvent );
|
2024-10-08 10:27:08 -04:00
|
|
|
int Swap( const TOOL_EVENT& aEvent );
|
2019-05-08 19:56:03 +01:00
|
|
|
|
|
|
|
int Duplicate( const TOOL_EVENT& aEvent );
|
|
|
|
|
|
|
|
int Properties( const TOOL_EVENT& aEvent );
|
2019-05-11 15:38:05 +01:00
|
|
|
int PinTable( const TOOL_EVENT& aEvent );
|
2022-09-14 22:11:37 +00:00
|
|
|
int SetUnitDisplayName( const TOOL_EVENT& aEvent );
|
2021-02-13 21:28:06 +00:00
|
|
|
int UpdateSymbolFields( const TOOL_EVENT& aEvent );
|
2019-05-08 19:56:03 +01:00
|
|
|
|
2019-05-14 20:21:10 +01:00
|
|
|
int Undo( const TOOL_EVENT& aEvent );
|
|
|
|
int Redo( const TOOL_EVENT& aEvent );
|
2019-05-08 19:56:03 +01:00
|
|
|
int Cut( const TOOL_EVENT& aEvent );
|
|
|
|
int Copy( const TOOL_EVENT& aEvent );
|
2024-10-13 13:26:11 +08:00
|
|
|
int CopyAsText( const TOOL_EVENT& aEvent );
|
2019-05-08 19:56:03 +01:00
|
|
|
int Paste( const TOOL_EVENT& aEvent );
|
|
|
|
|
2024-10-13 13:53:15 +08:00
|
|
|
int Increment( const TOOL_EVENT& aEvent );
|
|
|
|
|
2019-05-08 19:56:03 +01:00
|
|
|
/**
|
2021-01-26 10:23:37 -05:00
|
|
|
* Delete the selected items, or the item under the cursor.
|
2019-05-08 19:56:03 +01:00
|
|
|
*/
|
|
|
|
int DoDelete( const TOOL_EVENT& aEvent );
|
|
|
|
|
2021-01-26 10:23:37 -05:00
|
|
|
///< Run the deletion tool.
|
2023-10-10 15:43:45 +01:00
|
|
|
int InteractiveDelete( const TOOL_EVENT& aEvent );
|
2019-04-30 19:36:11 +01:00
|
|
|
|
2019-04-29 21:38:05 +01:00
|
|
|
private:
|
2024-04-15 21:18:54 +01:00
|
|
|
void editShapeProperties( SCH_SHAPE* aShape );
|
2024-04-06 14:14:44 +01:00
|
|
|
void editTextProperties( SCH_ITEM* aItem );
|
|
|
|
void editTextBoxProperties( SCH_ITEM* aItem );
|
2024-04-12 22:00:41 +01:00
|
|
|
void editFieldProperties( SCH_FIELD* aField );
|
2019-05-11 15:38:05 +01:00
|
|
|
void editSymbolProperties();
|
2024-04-20 10:44:34 +01:00
|
|
|
void handlePinDuplication(SCH_PIN* aOldPin, SCH_PIN* aNewPin, int &aSymbolLastPinNumber );
|
2019-05-08 19:56:03 +01:00
|
|
|
|
2021-01-26 10:23:37 -05:00
|
|
|
///< Set up handlers for various events.
|
2019-04-29 21:38:05 +01:00
|
|
|
void setTransitions() override;
|
2019-06-24 16:27:05 +01:00
|
|
|
|
|
|
|
EDA_ITEM* m_pickerItem;
|
2019-04-29 21:38:05 +01:00
|
|
|
};
|