2014-07-09 11:50:27 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2020-02-04 08:40:25 +00:00
|
|
|
* Copyright (C) 2014-2020 CERN
|
2022-04-17 17:14:50 +00:00
|
|
|
* Copyright (C) 2021-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
2021-01-27 22:15:38 +00:00
|
|
|
*
|
2014-07-09 11:50:27 +00:00
|
|
|
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
2020-12-16 13:31:32 +00:00
|
|
|
#ifndef BOARD_EDITOR_CONTROL_H
|
|
|
|
#define BOARD_EDITOR_CONTROL_H
|
2014-07-09 11:50:27 +00:00
|
|
|
|
2019-05-12 11:49:58 +00:00
|
|
|
#include <tools/pcb_tool_base.h>
|
2018-02-11 01:15:16 +00:00
|
|
|
#include <tool/tool_menu.h>
|
2014-07-09 11:50:27 +00:00
|
|
|
|
2015-06-18 15:51:54 +00:00
|
|
|
namespace KIGFX {
|
|
|
|
class ORIGIN_VIEWITEM;
|
|
|
|
}
|
2015-07-24 07:42:46 +00:00
|
|
|
|
2014-07-09 11:50:27 +00:00
|
|
|
class PCB_EDIT_FRAME;
|
|
|
|
|
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Handle actions specific to the board editor in PcbNew.
|
2014-07-09 11:50:27 +00:00
|
|
|
*/
|
2020-12-16 13:31:32 +00:00
|
|
|
class BOARD_EDITOR_CONTROL : public PCB_TOOL_BASE
|
2014-07-09 11:50:27 +00:00
|
|
|
{
|
|
|
|
public:
|
2020-12-16 13:31:32 +00:00
|
|
|
BOARD_EDITOR_CONTROL();
|
|
|
|
~BOARD_EDITOR_CONTROL();
|
2014-07-09 11:50:27 +00:00
|
|
|
|
|
|
|
/// @copydoc TOOL_INTERACTIVE::Reset()
|
2016-09-24 18:53:15 +00:00
|
|
|
void Reset( RESET_REASON aReason ) override;
|
2014-07-09 11:50:27 +00:00
|
|
|
|
|
|
|
/// @copydoc TOOL_INTERACTIVE::Init()
|
2016-09-24 18:53:15 +00:00
|
|
|
bool Init() override;
|
2014-07-09 11:50:27 +00:00
|
|
|
|
2019-05-26 15:36:40 +00:00
|
|
|
int New( const TOOL_EVENT& aEvent );
|
|
|
|
int Open( const TOOL_EVENT& aEvent );
|
|
|
|
int Save( const TOOL_EVENT& aEvent );
|
|
|
|
int SaveAs( const TOOL_EVENT& aEvent );
|
2022-04-24 16:38:34 +00:00
|
|
|
int SaveCopy( const TOOL_EVENT& aEvent );
|
2022-04-17 17:14:50 +00:00
|
|
|
int Revert( const TOOL_EVENT& aEvent );
|
2019-05-26 15:36:40 +00:00
|
|
|
int PageSettings( const TOOL_EVENT& aEvent );
|
|
|
|
int Plot( const TOOL_EVENT& aEvent );
|
2020-09-02 01:09:34 +00:00
|
|
|
|
2022-09-14 02:59:57 +00:00
|
|
|
int Search( const TOOL_EVENT& aEvent );
|
2021-08-27 17:15:51 +00:00
|
|
|
int Find( const TOOL_EVENT& aEvent );
|
|
|
|
int FindNext( const TOOL_EVENT& aEvent );
|
|
|
|
|
2019-06-04 20:59:59 +00:00
|
|
|
int BoardSetup( const TOOL_EVENT& aEvent );
|
|
|
|
int ImportNetlist( const TOOL_EVENT& aEvent );
|
|
|
|
int ImportSpecctraSession( const TOOL_EVENT& aEvent );
|
|
|
|
int ExportSpecctraDSN( const TOOL_EVENT& aEvent );
|
2021-03-28 12:37:54 +00:00
|
|
|
int ExportNetlist( const TOOL_EVENT& aEvent );
|
2019-06-04 20:59:59 +00:00
|
|
|
int GenerateDrillFiles( const TOOL_EVENT& aEvent );
|
|
|
|
int GeneratePosFile( const TOOL_EVENT& aEvent );
|
|
|
|
int GenerateFabFiles( const TOOL_EVENT& aEvent );
|
2020-08-11 14:01:26 +00:00
|
|
|
int RepairBoard( const TOOL_EVENT& aEvent );
|
2019-05-26 15:36:40 +00:00
|
|
|
|
2019-06-03 13:49:17 +00:00
|
|
|
int UpdatePCBFromSchematic( const TOOL_EVENT& aEvent );
|
2020-01-29 16:33:57 +00:00
|
|
|
int UpdateSchematicFromPCB( const TOOL_EVENT& aEvent );
|
2019-07-08 23:43:08 +00:00
|
|
|
int ShowEeschema( const TOOL_EVENT& aEvent );
|
2019-06-04 21:29:51 +00:00
|
|
|
int ToggleLayersManager( const TOOL_EVENT& aEvent );
|
2020-02-04 08:40:25 +00:00
|
|
|
int ToggleProperties( const TOOL_EVENT& aEvent );
|
2024-03-04 23:00:26 +00:00
|
|
|
int ToggleNetInspector( const TOOL_EVENT& aEvent );
|
2022-09-14 02:59:57 +00:00
|
|
|
int ToggleSearch( const TOOL_EVENT& aEvent );
|
2019-06-03 13:49:17 +00:00
|
|
|
int TogglePythonConsole( const TOOL_EVENT& aEvent );
|
|
|
|
|
2014-07-09 11:50:27 +00:00
|
|
|
// Track & via size control
|
2015-02-14 20:28:47 +00:00
|
|
|
int TrackWidthInc( const TOOL_EVENT& aEvent );
|
|
|
|
int TrackWidthDec( const TOOL_EVENT& aEvent );
|
|
|
|
int ViaSizeInc( const TOOL_EVENT& aEvent );
|
|
|
|
int ViaSizeDec( const TOOL_EVENT& aEvent );
|
2014-07-09 11:50:27 +00:00
|
|
|
|
2014-07-09 14:57:01 +00:00
|
|
|
// Zone actions
|
2015-06-19 15:32:33 +00:00
|
|
|
int ZoneMerge( const TOOL_EVENT& aEvent );
|
2014-07-09 14:57:01 +00:00
|
|
|
|
2021-01-27 22:15:38 +00:00
|
|
|
///< Duplicate a zone onto a layer (prompts for new layer)
|
2017-02-06 03:45:56 +00:00
|
|
|
int ZoneDuplicate( const TOOL_EVENT& aEvent );
|
|
|
|
|
2020-06-27 11:57:40 +00:00
|
|
|
int EditFpInFpEditor( const TOOL_EVENT& aEvent );
|
|
|
|
|
2022-07-19 15:00:35 +00:00
|
|
|
///< Notify Eeschema about selected items.
|
|
|
|
int CrossProbeToSch( const TOOL_EVENT& aEvent );
|
|
|
|
|
|
|
|
///< Equivalent to the above, but initiated by the user.
|
|
|
|
int ExplicitCrossProbeToSch( const TOOL_EVENT& aEvent );
|
|
|
|
|
2022-09-03 18:29:02 +00:00
|
|
|
///< Assign a netclass to a labelled net.
|
|
|
|
int AssignNetclass( const TOOL_EVENT& aEvent );
|
|
|
|
|
2015-03-10 15:58:26 +00:00
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Display a dialog to select a footprint to be added and allows the user to set its position.
|
2015-03-10 15:58:26 +00:00
|
|
|
*/
|
2021-01-25 13:58:30 +00:00
|
|
|
int PlaceFootprint( const TOOL_EVENT& aEvent );
|
2015-03-10 15:58:26 +00:00
|
|
|
|
2021-09-29 15:39:43 +00:00
|
|
|
/**
|
|
|
|
* Re-entrancy checker for above.
|
|
|
|
*/
|
|
|
|
bool PlacingFootprint() const { return m_placingFootprint; }
|
|
|
|
|
2021-01-27 22:15:38 +00:00
|
|
|
///< Toggle 'lock' property for selected items.
|
2016-05-09 08:29:06 +00:00
|
|
|
int ToggleLockSelected( const TOOL_EVENT& aEvent );
|
|
|
|
|
2021-01-27 22:15:38 +00:00
|
|
|
///< Lock selected items.
|
2016-05-09 08:29:06 +00:00
|
|
|
int LockSelected( const TOOL_EVENT& aEvent );
|
|
|
|
|
2021-01-27 22:15:38 +00:00
|
|
|
///< Unlock selected items.
|
2016-05-09 08:29:06 +00:00
|
|
|
int UnlockSelected( const TOOL_EVENT& aEvent );
|
2015-09-03 15:35:41 +00:00
|
|
|
|
2021-01-27 22:15:38 +00:00
|
|
|
///< Run the drill origin tool for setting the origin for drill and pick-and-place files.
|
2015-06-18 15:51:51 +00:00
|
|
|
int DrillOrigin( const TOOL_EVENT& aEvent );
|
|
|
|
|
2021-01-27 22:15:38 +00:00
|
|
|
///< Low-level access (below undo) to setting the drill origin.
|
2019-06-12 22:04:00 +00:00
|
|
|
static void DoSetDrillOrigin( KIGFX::VIEW* aView, PCB_BASE_FRAME* aFrame,
|
2020-09-09 02:54:17 +00:00
|
|
|
EDA_ITEM* aItem, const VECTOR2D& aPoint );
|
2018-01-24 10:19:33 +00:00
|
|
|
|
2017-08-01 13:20:40 +00:00
|
|
|
private:
|
2021-01-27 22:15:38 +00:00
|
|
|
///< How to modify a property for selected items.
|
2019-08-12 14:41:45 +00:00
|
|
|
enum MODIFY_MODE { ON, OFF, TOGGLE };
|
2017-08-01 13:20:40 +00:00
|
|
|
|
2019-08-12 14:41:45 +00:00
|
|
|
int modifyLockSelected( MODIFY_MODE aMode );
|
2017-08-01 13:20:40 +00:00
|
|
|
|
2021-01-27 22:15:38 +00:00
|
|
|
///< Set up handlers for various events.
|
2017-07-31 12:30:51 +00:00
|
|
|
void setTransitions() override;
|
2014-07-09 11:50:27 +00:00
|
|
|
|
2022-07-19 15:00:35 +00:00
|
|
|
void doCrossProbePcbToSch( const TOOL_EVENT& aEvent, bool aForce );
|
|
|
|
|
2021-06-20 10:02:44 +00:00
|
|
|
private:
|
|
|
|
PCB_EDIT_FRAME* m_frame;
|
2021-09-29 15:39:43 +00:00
|
|
|
bool m_inPlaceFootprint; // Re-entrancy guard for tool.
|
|
|
|
bool m_placingFootprint; // Re-entrancy guard for placement loop.
|
|
|
|
bool m_inPlaceTarget; // Re-entrancy guard.
|
2015-03-10 15:58:26 +00:00
|
|
|
|
2021-06-20 10:02:44 +00:00
|
|
|
std::unique_ptr<KIGFX::ORIGIN_VIEWITEM> m_placeOrigin;
|
2015-06-18 15:51:54 +00:00
|
|
|
|
2021-01-27 22:15:38 +00:00
|
|
|
static const int WIDTH_STEP; ///< How does line width change after one -/+ key press.
|
2014-07-09 11:50:27 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|