2019-04-17 19:09:48 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2023-11-07 15:45:48 +00:00
|
|
|
* Copyright (C) 2019-2023 CERN
|
|
|
|
* Copyright (C) 2019-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
2019-04-17 19:09:48 +00: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
|
|
|
|
*/
|
|
|
|
|
2019-05-07 18:49:53 +00:00
|
|
|
#ifndef SCH_DRAWING_TOOLS_H
|
|
|
|
#define SCH_DRAWING_TOOLS_H
|
2019-04-17 19:09:48 +00:00
|
|
|
|
2024-02-25 14:23:59 +00:00
|
|
|
#include "sch_sheet_path.h"
|
2019-05-12 11:49:58 +00:00
|
|
|
#include <tools/ee_tool_base.h>
|
2019-04-17 19:09:48 +00:00
|
|
|
#include <sch_base_frame.h>
|
2022-01-24 13:40:39 +00:00
|
|
|
#include <sch_label.h>
|
2019-05-16 21:27:03 +00:00
|
|
|
#include <status_popup.h>
|
2024-02-25 14:23:59 +00:00
|
|
|
#include <sync_sheet_pin/dialog_sync_sheet_pins.h>
|
2019-04-17 19:09:48 +00:00
|
|
|
|
2021-06-10 14:10:55 +00:00
|
|
|
class SCH_SYMBOL;
|
2019-04-17 19:09:48 +00:00
|
|
|
class SCH_BUS_WIRE_ENTRY;
|
|
|
|
class SCH_EDIT_FRAME;
|
2019-05-10 17:19:48 +00:00
|
|
|
class EE_SELECTION_TOOL;
|
2024-02-25 14:23:59 +00:00
|
|
|
class DIALOG_SYNC_SHEET_PINS;
|
2019-04-17 19:09:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
2021-01-26 15:23:37 +00:00
|
|
|
* Tool responsible for drawing/placing items (symbols, wires, buses, labels, etc.).
|
2019-04-17 19:09:48 +00:00
|
|
|
*/
|
|
|
|
|
2019-05-12 11:49:58 +00:00
|
|
|
class SCH_DRAWING_TOOLS : public EE_TOOL_BASE<SCH_EDIT_FRAME>
|
2019-04-17 19:09:48 +00:00
|
|
|
{
|
|
|
|
public:
|
2019-05-07 18:49:53 +00:00
|
|
|
SCH_DRAWING_TOOLS();
|
2019-06-15 00:29:42 +00:00
|
|
|
~SCH_DRAWING_TOOLS() override { }
|
2019-04-17 19:09:48 +00:00
|
|
|
|
|
|
|
/// @copydoc TOOL_INTERACTIVE::Init()
|
|
|
|
bool Init() override;
|
|
|
|
|
2021-03-18 11:46:07 +00:00
|
|
|
int PlaceSymbol( const TOOL_EVENT& aEvent );
|
2019-06-15 00:29:42 +00:00
|
|
|
int SingleClickPlace( const TOOL_EVENT& aEvent );
|
|
|
|
int TwoClickPlace( const TOOL_EVENT& aEvent );
|
2021-07-17 19:56:18 +00:00
|
|
|
int DrawShape( const TOOL_EVENT& aEvent );
|
2023-11-25 12:38:24 +00:00
|
|
|
int DrawTable( const TOOL_EVENT& aEvent );
|
2019-04-18 15:45:10 +00:00
|
|
|
int DrawSheet( const TOOL_EVENT& aEvent );
|
2019-04-17 19:09:48 +00:00
|
|
|
int PlaceImage( const TOOL_EVENT& aEvent );
|
2023-12-29 02:57:21 +00:00
|
|
|
int ImportGraphics( const TOOL_EVENT& aEvent );
|
2024-02-25 14:23:59 +00:00
|
|
|
int SyncSheetsPins( const TOOL_EVENT& aEvent );
|
|
|
|
int SyncAllSheetsPins( const TOOL_EVENT& aEvent );
|
2019-04-17 19:09:48 +00:00
|
|
|
|
|
|
|
private:
|
2023-06-24 11:35:14 +00:00
|
|
|
SCH_LINE* findWire( const VECTOR2I& aPosition );
|
|
|
|
|
2024-03-29 20:00:05 +00:00
|
|
|
///< Gets the (global) label name driving this wire, if it is driven by a label
|
|
|
|
wxString findWireLabelDriverName( SCH_LINE* aWire );
|
|
|
|
|
2020-05-23 15:50:08 +00:00
|
|
|
SCH_TEXT* createNewText( const VECTOR2I& aPosition, int aType );
|
2019-04-17 19:09:48 +00:00
|
|
|
|
2024-02-25 14:23:59 +00:00
|
|
|
SCH_SHEET_PIN* createNewSheetPin( SCH_SHEET* aSheet, const VECTOR2I& aPosition );
|
2020-10-31 00:25:46 +00:00
|
|
|
|
2021-07-26 23:47:26 +00:00
|
|
|
void sizeSheet( SCH_SHEET* aSheet, const VECTOR2I& aPos );
|
2019-04-18 15:45:10 +00:00
|
|
|
|
2021-01-26 15:23:37 +00:00
|
|
|
///< Set up handlers for various events.
|
2019-04-17 19:09:48 +00:00
|
|
|
void setTransitions() override;
|
2019-05-16 21:27:03 +00:00
|
|
|
|
2024-02-25 14:23:59 +00:00
|
|
|
int doSyncSheetsPins( std::list<SCH_SHEET_PATH> aSheets );
|
|
|
|
|
2020-11-07 14:31:50 +00:00
|
|
|
std::vector<PICKED_SYMBOL> m_symbolHistoryList;
|
|
|
|
std::vector<PICKED_SYMBOL> m_powerHistoryList;
|
|
|
|
|
2021-10-12 20:05:37 +00:00
|
|
|
LABEL_FLAG_SHAPE m_lastSheetPinType;
|
|
|
|
LABEL_FLAG_SHAPE m_lastGlobalLabelShape;
|
|
|
|
LABEL_FLAG_SHAPE m_lastNetClassFlagShape;
|
2023-09-07 16:09:53 +00:00
|
|
|
SPIN_STYLE m_lastTextOrientation;
|
2020-11-07 14:31:50 +00:00
|
|
|
bool m_lastTextBold;
|
|
|
|
bool m_lastTextItalic;
|
2022-06-03 20:47:13 +00:00
|
|
|
EDA_ANGLE m_lastTextAngle;
|
2023-11-07 15:45:48 +00:00
|
|
|
EDA_ANGLE m_lastTextboxAngle;
|
|
|
|
GR_TEXT_H_ALIGN_T m_lastTextHJustify;
|
|
|
|
GR_TEXT_V_ALIGN_T m_lastTextVJustify;
|
|
|
|
GR_TEXT_H_ALIGN_T m_lastTextboxHJustify;
|
|
|
|
GR_TEXT_V_ALIGN_T m_lastTextboxVJustify;
|
2021-07-17 19:56:18 +00:00
|
|
|
FILL_T m_lastFillStyle;
|
2022-06-08 09:32:45 +00:00
|
|
|
FILL_T m_lastTextboxFillStyle;
|
2022-06-03 20:47:13 +00:00
|
|
|
COLOR4D m_lastFillColor;
|
2022-06-08 09:32:45 +00:00
|
|
|
COLOR4D m_lastTextboxFillColor;
|
2022-06-03 20:47:13 +00:00
|
|
|
STROKE_PARAMS m_lastStroke;
|
2022-06-08 09:32:45 +00:00
|
|
|
STROKE_PARAMS m_lastTextboxStroke;
|
2022-02-25 21:18:43 +00:00
|
|
|
wxString m_mruPath;
|
2022-03-26 16:27:45 +00:00
|
|
|
bool m_lastAutoLabelRotateOnPlacement;
|
2020-05-23 15:50:08 +00:00
|
|
|
|
2024-02-25 14:23:59 +00:00
|
|
|
bool m_inDrawingTool; // Re-entrancy guard
|
|
|
|
std::unique_ptr<STATUS_TEXT_POPUP> m_statusPopup;
|
|
|
|
std::unique_ptr<DIALOG_SYNC_SHEET_PINS> m_dialogSyncSheetPin;
|
2019-04-17 19:09:48 +00:00
|
|
|
};
|
|
|
|
|
2019-05-07 18:49:53 +00:00
|
|
|
#endif /* SCH_DRAWING_TOOLS_H */
|