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
|
2019-04-17 19:09:48 +00:00
|
|
|
* Copyright (C) 2019 KiCad Developers, see AUTHORS.txt for contributors.
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
|
|
|
|
|
|
|
/**
|
2020-01-10 14:31:00 +00:00
|
|
|
* SCH_DRAWING_TOOLS
|
2019-04-17 19:09:48 +00:00
|
|
|
*
|
2020-04-02 17:03:53 +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;
|
|
|
|
|
2019-06-15 00:29:42 +00:00
|
|
|
int PlaceComponent( const TOOL_EVENT& aEvent );
|
|
|
|
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
|
|
|
/**
|
|
|
|
* Gets the next queued text item
|
|
|
|
* @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
|
|
|
|
2019-04-17 19:09:48 +00:00
|
|
|
///> Sets up handlers for various events.
|
|
|
|
void setTransitions() override;
|
2019-05-16 21:27:03 +00:00
|
|
|
|
|
|
|
private:
|
2020-05-23 15:50:08 +00:00
|
|
|
// History lists for PlaceComponent()
|
2020-10-31 00:25:46 +00:00
|
|
|
std::vector<COMPONENT_SELECTION> m_symbolHistoryList;
|
|
|
|
std::vector<COMPONENT_SELECTION> m_powerHistoryList;
|
2020-05-23 15:50:08 +00:00
|
|
|
|
2020-10-31 00:25:46 +00:00
|
|
|
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
|
|
|
|
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 */
|