2019-04-17 19:09:48 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2019-08-14 08:28:07 +00:00
|
|
|
* Copyright (C) 2019 CERN
|
2021-01-26 15:23:37 +00:00
|
|
|
* Copyright (C) 2019-2021 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
|
|
|
|
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>
|
2019-05-16 21:27:03 +00:00
|
|
|
#include <status_popup.h>
|
2019-04-17 19:09:48 +00:00
|
|
|
|
|
|
|
class SCH_COMPONENT;
|
|
|
|
class SCH_BUS_WIRE_ENTRY;
|
|
|
|
class SCH_LABEL;
|
|
|
|
class SCHLIB_FILTER;
|
|
|
|
class SCH_EDIT_FRAME;
|
2019-05-10 17:19:48 +00:00
|
|
|
class EE_SELECTION_TOOL;
|
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 );
|
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 );
|
|
|
|
|
|
|
|
private:
|
2020-05-23 15:50:08 +00:00
|
|
|
/**
|
2021-01-26 15:23:37 +00:00
|
|
|
* Get the next queued text item.
|
|
|
|
*
|
2020-05-23 15:50:08 +00:00
|
|
|
* @return next SCH_TEXT* or nullptr if empty
|
|
|
|
*/
|
|
|
|
SCH_TEXT* createNewText( const VECTOR2I& aPosition, int aType );
|
2019-04-17 19:09:48 +00:00
|
|
|
|
2020-10-31 00:25:46 +00:00
|
|
|
SCH_HIERLABEL* importHierLabel( SCH_SHEET* aSheet );
|
|
|
|
|
|
|
|
SCH_SHEET_PIN* createSheetPin( SCH_SHEET* aSheet, SCH_HIERLABEL* aLabel );
|
|
|
|
|
2019-04-30 20:01:17 +00:00
|
|
|
void sizeSheet( SCH_SHEET* aSheet, 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
|
|
|
|
2020-11-07 14:31:50 +00:00
|
|
|
std::vector<PICKED_SYMBOL> m_symbolHistoryList;
|
|
|
|
std::vector<PICKED_SYMBOL> m_powerHistoryList;
|
|
|
|
|
|
|
|
PINSHEETLABEL_SHAPE m_lastSheetPinType;
|
|
|
|
PINSHEETLABEL_SHAPE m_lastGlobalLabelShape;
|
|
|
|
LABEL_SPIN_STYLE m_lastTextOrientation;
|
|
|
|
bool m_lastTextBold;
|
|
|
|
bool m_lastTextItalic;
|
2020-05-23 15:50:08 +00:00
|
|
|
|
2021-01-27 19:50:07 +00:00
|
|
|
///< Re-entrancy guards
|
2021-03-28 16:55:07 +00:00
|
|
|
bool m_inPlaceSymbol;
|
2021-01-27 19:50:07 +00:00
|
|
|
bool m_inPlaceImage;
|
|
|
|
bool m_inSingleClickPlace;
|
|
|
|
bool m_inTwoClickPlace;
|
|
|
|
bool m_inDrawSheet;
|
|
|
|
|
2020-10-31 00:25:46 +00:00
|
|
|
std::unique_ptr<STATUS_TEXT_POPUP> m_statusPopup;
|
2019-04-17 19:09:48 +00:00
|
|
|
};
|
|
|
|
|
2019-05-07 18:49:53 +00:00
|
|
|
#endif /* SCH_DRAWING_TOOLS_H */
|