2014-03-24 07:45:05 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2016-05-04 12:59:14 +00:00
|
|
|
* Copyright (C) 2014-2016 CERN
|
2014-03-24 07:45:05 +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
|
|
|
|
*/
|
|
|
|
|
2016-09-21 19:22:19 +00:00
|
|
|
#include <cstdint>
|
|
|
|
|
2014-03-24 07:45:05 +00:00
|
|
|
#include "pcbnew_control.h"
|
2017-02-21 12:42:08 +00:00
|
|
|
#include "pcb_actions.h"
|
2015-06-18 15:51:51 +00:00
|
|
|
#include "selection_tool.h"
|
2017-09-22 15:17:38 +00:00
|
|
|
#include "edit_tool.h"
|
2015-06-18 15:51:51 +00:00
|
|
|
#include "picker_tool.h"
|
2017-05-18 17:21:30 +00:00
|
|
|
#include "pcb_editor_control.h"
|
2015-06-30 12:08:24 +00:00
|
|
|
#include "grid_helper.h"
|
2014-03-24 07:45:05 +00:00
|
|
|
|
|
|
|
#include <class_board.h>
|
2014-07-09 13:02:56 +00:00
|
|
|
#include <class_module.h>
|
2014-03-24 16:20:23 +00:00
|
|
|
#include <class_track.h>
|
2014-07-09 13:02:56 +00:00
|
|
|
#include <class_zone.h>
|
2018-01-29 10:37:29 +00:00
|
|
|
#include <pcb_screen.h>
|
2015-08-07 16:24:42 +00:00
|
|
|
|
2014-03-24 17:28:21 +00:00
|
|
|
#include <confirm.h>
|
2017-02-20 18:10:20 +00:00
|
|
|
#include <hotkeys.h>
|
2016-07-06 09:22:56 +00:00
|
|
|
#include <properties.h>
|
2015-08-07 16:24:42 +00:00
|
|
|
#include <io_mgr.h>
|
2017-04-15 16:08:23 +00:00
|
|
|
#include <kicad_plugin.h>
|
|
|
|
#include <kicad_clipboard.h>
|
2014-03-24 07:45:05 +00:00
|
|
|
|
2015-08-07 16:24:42 +00:00
|
|
|
#include <pcbnew_id.h>
|
2018-01-29 20:58:58 +00:00
|
|
|
#include <pcb_edit_frame.h>
|
2015-08-07 16:24:42 +00:00
|
|
|
#include <pcb_draw_panel_gal.h>
|
2018-10-12 06:17:15 +00:00
|
|
|
#include <connectivity/connectivity_data.h>
|
2015-06-18 15:51:52 +00:00
|
|
|
#include <tool/tool_manager.h>
|
2014-03-24 16:20:23 +00:00
|
|
|
#include <gal/graphics_abstraction_layer.h>
|
|
|
|
#include <view/view_controls.h>
|
|
|
|
#include <pcb_painter.h>
|
2015-06-18 15:51:53 +00:00
|
|
|
#include <origin_viewitem.h>
|
2016-06-21 15:06:28 +00:00
|
|
|
#include <board_commit.h>
|
2017-09-17 17:49:06 +00:00
|
|
|
#include <bitmaps.h>
|
2014-03-24 07:45:05 +00:00
|
|
|
|
2016-06-29 10:23:11 +00:00
|
|
|
#include <functional>
|
|
|
|
using namespace std::placeholders;
|
2015-06-18 15:51:51 +00:00
|
|
|
|
2014-07-09 14:57:01 +00:00
|
|
|
|
2015-08-07 16:24:42 +00:00
|
|
|
// files.cpp
|
|
|
|
extern bool AskLoadBoardFileName( wxWindow* aParent, int* aCtl, wxString* aFileName,
|
|
|
|
bool aKicadFilesOnly = false );
|
|
|
|
extern IO_MGR::PCB_FILE_T plugin_type( const wxString& aFileName, int aCtl );
|
|
|
|
|
|
|
|
|
2017-02-20 18:10:20 +00:00
|
|
|
// Display modes
|
|
|
|
TOOL_ACTION PCB_ACTIONS::trackDisplayMode( "pcbnew.Control.trackDisplayMode",
|
|
|
|
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_TRACK_DISPLAY_MODE ),
|
|
|
|
"", "" );
|
|
|
|
|
|
|
|
TOOL_ACTION PCB_ACTIONS::padDisplayMode( "pcbnew.Control.padDisplayMode",
|
|
|
|
AS_GLOBAL, 0,
|
|
|
|
"", "" );
|
|
|
|
|
|
|
|
TOOL_ACTION PCB_ACTIONS::viaDisplayMode( "pcbnew.Control.viaDisplayMode",
|
|
|
|
AS_GLOBAL, 0,
|
|
|
|
"", "" );
|
|
|
|
|
2018-02-18 14:21:23 +00:00
|
|
|
TOOL_ACTION PCB_ACTIONS::graphicDisplayMode( "pcbnew.Control.graphicDisplayMode",
|
|
|
|
AS_GLOBAL, 0,
|
|
|
|
"", "" );
|
|
|
|
|
|
|
|
TOOL_ACTION PCB_ACTIONS::moduleEdgeOutlines( "pcbnew.Control.graphicOutlines",
|
|
|
|
AS_GLOBAL, 0,
|
|
|
|
"", "" );
|
|
|
|
|
|
|
|
TOOL_ACTION PCB_ACTIONS::moduleTextOutlines( "pcbnew.Control.textOutlines",
|
|
|
|
AS_GLOBAL, 0,
|
|
|
|
"", "" );
|
|
|
|
|
2017-02-20 18:10:20 +00:00
|
|
|
TOOL_ACTION PCB_ACTIONS::zoneDisplayEnable( "pcbnew.Control.zoneDisplayEnable",
|
|
|
|
AS_GLOBAL, 0,
|
|
|
|
"", "" );
|
|
|
|
|
|
|
|
TOOL_ACTION PCB_ACTIONS::zoneDisplayDisable( "pcbnew.Control.zoneDisplayDisable",
|
|
|
|
AS_GLOBAL, 0,
|
|
|
|
"", "" );
|
|
|
|
|
|
|
|
TOOL_ACTION PCB_ACTIONS::zoneDisplayOutlines( "pcbnew.Control.zoneDisplayOutlines",
|
|
|
|
AS_GLOBAL, 0,
|
|
|
|
"", "" );
|
|
|
|
|
|
|
|
TOOL_ACTION PCB_ACTIONS::highContrastMode( "pcbnew.Control.highContrastMode",
|
|
|
|
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_HIGHCONTRAST_MODE ),
|
|
|
|
"", "" );
|
|
|
|
|
|
|
|
TOOL_ACTION PCB_ACTIONS::highContrastInc( "pcbnew.Control.highContrastInc",
|
2018-02-25 18:30:59 +00:00
|
|
|
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_HIGHCONTRAST_INC ),
|
2017-02-20 18:10:20 +00:00
|
|
|
"", "" );
|
|
|
|
|
|
|
|
TOOL_ACTION PCB_ACTIONS::highContrastDec( "pcbnew.Control.highContrastDec",
|
2018-02-25 18:30:59 +00:00
|
|
|
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_HIGHCONTRAST_DEC ),
|
2017-02-20 18:10:20 +00:00
|
|
|
"", "" );
|
|
|
|
|
|
|
|
|
|
|
|
// Layer control
|
|
|
|
TOOL_ACTION PCB_ACTIONS::layerTop( "pcbnew.Control.layerTop",
|
|
|
|
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_LAYER_TO_COMPONENT ),
|
|
|
|
"", "", NULL, AF_NONE, (void*) F_Cu );
|
|
|
|
|
|
|
|
TOOL_ACTION PCB_ACTIONS::layerInner1( "pcbnew.Control.layerInner1",
|
|
|
|
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_LAYER_TO_INNER1 ),
|
|
|
|
"", "", NULL, AF_NONE, (void*) In1_Cu );
|
|
|
|
|
|
|
|
TOOL_ACTION PCB_ACTIONS::layerInner2( "pcbnew.Control.layerInner2",
|
|
|
|
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_LAYER_TO_INNER2 ),
|
|
|
|
"", "", NULL, AF_NONE, (void*) In2_Cu );
|
|
|
|
|
|
|
|
TOOL_ACTION PCB_ACTIONS::layerInner3( "pcbnew.Control.layerInner3",
|
|
|
|
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_LAYER_TO_INNER3 ),
|
|
|
|
"", "", NULL, AF_NONE, (void*) In3_Cu );
|
|
|
|
|
|
|
|
TOOL_ACTION PCB_ACTIONS::layerInner4( "pcbnew.Control.layerInner4",
|
|
|
|
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_LAYER_TO_INNER4 ),
|
|
|
|
"", "", NULL, AF_NONE, (void*) In4_Cu );
|
|
|
|
|
|
|
|
TOOL_ACTION PCB_ACTIONS::layerInner5( "pcbnew.Control.layerInner5",
|
|
|
|
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_LAYER_TO_INNER5 ),
|
|
|
|
"", "", NULL, AF_NONE, (void*) In5_Cu );
|
|
|
|
|
|
|
|
TOOL_ACTION PCB_ACTIONS::layerInner6( "pcbnew.Control.layerInner6",
|
|
|
|
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_LAYER_TO_INNER6 ),
|
|
|
|
"", "", NULL, AF_NONE, (void*) In6_Cu );
|
|
|
|
|
|
|
|
TOOL_ACTION PCB_ACTIONS::layerBottom( "pcbnew.Control.layerBottom",
|
|
|
|
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_LAYER_TO_COPPER ),
|
|
|
|
"", "", NULL, AF_NONE, (void*) B_Cu );
|
|
|
|
|
|
|
|
TOOL_ACTION PCB_ACTIONS::layerNext( "pcbnew.Control.layerNext",
|
|
|
|
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_LAYER_TO_NEXT ),
|
|
|
|
"", "" );
|
|
|
|
|
|
|
|
TOOL_ACTION PCB_ACTIONS::layerPrev( "pcbnew.Control.layerPrev",
|
|
|
|
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_LAYER_TO_PREVIOUS ),
|
|
|
|
"", "" );
|
|
|
|
|
|
|
|
TOOL_ACTION PCB_ACTIONS::layerToggle( "pcbnew.Control.layerToggle",
|
|
|
|
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ADD_THROUGH_VIA ),
|
|
|
|
"", "" );
|
|
|
|
|
|
|
|
TOOL_ACTION PCB_ACTIONS::layerAlphaInc( "pcbnew.Control.layerAlphaInc",
|
2018-02-25 18:30:59 +00:00
|
|
|
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_INC_LAYER_ALPHA ),
|
2017-02-20 18:10:20 +00:00
|
|
|
"", "" );
|
|
|
|
|
|
|
|
TOOL_ACTION PCB_ACTIONS::layerAlphaDec( "pcbnew.Control.layerAlphaDec",
|
2018-02-25 18:30:59 +00:00
|
|
|
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_DEC_LAYER_ALPHA ),
|
2017-02-20 18:10:20 +00:00
|
|
|
"", "" );
|
|
|
|
|
|
|
|
TOOL_ACTION PCB_ACTIONS::layerChanged( "pcbnew.Control.layerChanged",
|
|
|
|
AS_GLOBAL, 0,
|
|
|
|
"", "", NULL, AF_NOTIFY );
|
|
|
|
|
|
|
|
// Miscellaneous
|
|
|
|
TOOL_ACTION PCB_ACTIONS::selectionTool( "pcbnew.Control.selectionTool",
|
|
|
|
AS_GLOBAL, 0,
|
|
|
|
"", "", NULL, AF_ACTIVATE );
|
|
|
|
|
|
|
|
TOOL_ACTION PCB_ACTIONS::resetCoords( "pcbnew.Control.resetCoords",
|
2017-06-13 09:25:05 +00:00
|
|
|
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_RESET_LOCAL_COORD ),
|
2017-02-20 18:10:20 +00:00
|
|
|
"", "" );
|
|
|
|
|
|
|
|
TOOL_ACTION PCB_ACTIONS::switchCursor( "pcbnew.Control.switchCursor",
|
|
|
|
AS_GLOBAL, 0,
|
|
|
|
"", "" );
|
|
|
|
|
|
|
|
TOOL_ACTION PCB_ACTIONS::switchUnits( "pcbnew.Control.switchUnits",
|
|
|
|
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_UNITS ),
|
|
|
|
"", "" );
|
|
|
|
|
|
|
|
TOOL_ACTION PCB_ACTIONS::deleteItemCursor( "pcbnew.Control.deleteItemCursor",
|
|
|
|
AS_GLOBAL, 0,
|
|
|
|
"", "" );
|
|
|
|
|
2019-06-12 00:59:30 +00:00
|
|
|
TOOL_ACTION PCB_ACTIONS::showHotkeyList( "pcbnew.Control.showHotkeyList",
|
2017-02-20 18:10:20 +00:00
|
|
|
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_HELP ),
|
|
|
|
"", "" );
|
|
|
|
|
2019-06-12 00:59:30 +00:00
|
|
|
TOOL_ACTION PCB_ACTIONS::showHelp( "pcbnew.Control.showHelp",
|
|
|
|
AS_GLOBAL, 0,
|
|
|
|
"", "" );
|
|
|
|
|
2017-02-20 18:10:20 +00:00
|
|
|
TOOL_ACTION PCB_ACTIONS::toBeDone( "pcbnew.Control.toBeDone",
|
|
|
|
AS_GLOBAL, 0, // dialog saying it is not implemented yet
|
|
|
|
"", "" ); // so users are aware of that
|
|
|
|
|
2017-09-17 17:49:06 +00:00
|
|
|
TOOL_ACTION PCB_ACTIONS::pasteFromClipboard( "pcbnew.InteractiveEdit.pasteFromClipboard",
|
2018-03-12 15:46:38 +00:00
|
|
|
AS_GLOBAL, 0, // do not define a hotkey and let TranslateLegacyId() handle the event
|
2017-09-18 11:09:18 +00:00
|
|
|
_( "Paste" ), _( "Paste content from clipboard" ),
|
2017-09-17 17:49:06 +00:00
|
|
|
paste_xpm );
|
|
|
|
|
2017-02-20 18:10:20 +00:00
|
|
|
|
2014-03-24 07:45:05 +00:00
|
|
|
PCBNEW_CONTROL::PCBNEW_CONTROL() :
|
2017-09-22 15:17:38 +00:00
|
|
|
PCB_TOOL( "pcbnew.Control" ), m_frame( NULL )
|
2014-03-24 07:45:05 +00:00
|
|
|
{
|
2017-03-02 22:57:13 +00:00
|
|
|
m_gridOrigin.reset( new KIGFX::ORIGIN_VIEWITEM() );
|
2015-06-18 15:51:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
PCBNEW_CONTROL::~PCBNEW_CONTROL()
|
|
|
|
{
|
2014-03-24 07:45:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-03-24 16:20:23 +00:00
|
|
|
void PCBNEW_CONTROL::Reset( RESET_REASON aReason )
|
|
|
|
{
|
2014-07-09 11:50:27 +00:00
|
|
|
m_frame = getEditFrame<PCB_BASE_FRAME>();
|
2015-06-18 15:51:53 +00:00
|
|
|
|
|
|
|
if( aReason == MODEL_RELOAD || aReason == GAL_SWITCH )
|
|
|
|
{
|
2017-09-22 15:17:38 +00:00
|
|
|
m_gridOrigin->SetPosition( board()->GetGridOrigin() );
|
2018-02-15 19:24:24 +00:00
|
|
|
m_gridOrigin->SetColor( m_frame->GetGridColor() );
|
2017-03-02 22:57:13 +00:00
|
|
|
getView()->Remove( m_gridOrigin.get() );
|
|
|
|
getView()->Add( m_gridOrigin.get() );
|
2015-06-18 15:51:53 +00:00
|
|
|
}
|
2014-03-24 16:20:23 +00:00
|
|
|
}
|
|
|
|
|
2017-10-30 19:17:23 +00:00
|
|
|
template<class T> void Flip( T& aValue )
|
|
|
|
{
|
|
|
|
aValue = !aValue;
|
|
|
|
}
|
2014-03-24 16:20:23 +00:00
|
|
|
|
2015-02-14 20:28:47 +00:00
|
|
|
int PCBNEW_CONTROL::TrackDisplayMode( const TOOL_EVENT& aEvent )
|
2014-03-24 07:45:05 +00:00
|
|
|
{
|
2017-10-30 19:17:23 +00:00
|
|
|
auto opts = displayOptions();
|
2014-03-24 16:20:23 +00:00
|
|
|
|
2017-10-30 19:17:23 +00:00
|
|
|
Flip( opts->m_DisplayPcbTrackFill );
|
|
|
|
view()->UpdateDisplayOptions( opts );
|
2014-03-24 16:20:23 +00:00
|
|
|
|
2017-09-22 15:17:38 +00:00
|
|
|
for( auto track : board()->Tracks() )
|
2014-07-09 13:02:56 +00:00
|
|
|
{
|
|
|
|
if( track->Type() == PCB_TRACE_T )
|
2017-09-22 15:17:38 +00:00
|
|
|
view()->Update( track, KIGFX::GEOMETRY );
|
2014-07-09 13:02:56 +00:00
|
|
|
}
|
2014-03-24 16:20:23 +00:00
|
|
|
|
2017-10-30 19:17:23 +00:00
|
|
|
canvas()->Refresh();
|
2014-03-24 07:45:05 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-02-14 20:28:47 +00:00
|
|
|
int PCBNEW_CONTROL::PadDisplayMode( const TOOL_EVENT& aEvent )
|
2014-03-24 07:45:05 +00:00
|
|
|
{
|
2017-10-30 19:17:23 +00:00
|
|
|
auto opts = displayOptions();
|
2016-12-02 17:58:12 +00:00
|
|
|
|
2017-10-30 19:17:23 +00:00
|
|
|
Flip( opts->m_DisplayPadFill );
|
|
|
|
view()->UpdateDisplayOptions( opts );
|
2014-07-09 13:02:56 +00:00
|
|
|
|
2017-10-30 19:17:23 +00:00
|
|
|
for( auto module : board()->Modules() ) // fixme: move to PCB_VIEW
|
2014-07-09 13:02:56 +00:00
|
|
|
{
|
2017-04-25 09:06:24 +00:00
|
|
|
for( auto pad : module->Pads() )
|
2017-10-30 19:17:23 +00:00
|
|
|
view()->Update( pad, KIGFX::GEOMETRY );
|
2014-07-09 13:02:56 +00:00
|
|
|
}
|
|
|
|
|
2017-10-30 19:17:23 +00:00
|
|
|
canvas()->Refresh();
|
2014-03-24 07:45:05 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-02-14 20:28:47 +00:00
|
|
|
int PCBNEW_CONTROL::ViaDisplayMode( const TOOL_EVENT& aEvent )
|
2014-03-24 07:45:05 +00:00
|
|
|
{
|
2017-10-30 19:17:23 +00:00
|
|
|
auto opts = displayOptions();
|
2014-03-24 16:20:23 +00:00
|
|
|
|
2017-10-30 19:17:23 +00:00
|
|
|
Flip( opts->m_DisplayViaFill );
|
|
|
|
view()->UpdateDisplayOptions( opts );
|
2014-03-24 16:20:23 +00:00
|
|
|
|
2017-09-22 15:17:38 +00:00
|
|
|
for( auto track : board()->Tracks() )
|
2014-03-24 16:20:23 +00:00
|
|
|
{
|
2017-03-20 11:06:48 +00:00
|
|
|
if( track->Type() == PCB_TRACE_T || track->Type() == PCB_VIA_T )
|
2017-10-30 19:17:23 +00:00
|
|
|
view()->Update( track, KIGFX::GEOMETRY );
|
2014-03-24 16:20:23 +00:00
|
|
|
}
|
|
|
|
|
2017-10-30 19:17:23 +00:00
|
|
|
canvas()->Refresh();
|
2014-07-09 13:02:56 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-02-18 14:21:23 +00:00
|
|
|
int PCBNEW_CONTROL::GraphicDisplayMode( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
|
|
|
auto opts = displayOptions();
|
|
|
|
|
|
|
|
Flip( opts->m_DisplayDrawItemsFill );
|
|
|
|
view()->UpdateDisplayOptions( opts );
|
|
|
|
|
|
|
|
for( auto item : board()->Drawings() )
|
|
|
|
{
|
|
|
|
view()->Update( item, KIGFX::GEOMETRY );
|
|
|
|
}
|
|
|
|
|
|
|
|
canvas()->Refresh();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int PCBNEW_CONTROL::ModuleEdgeOutlines( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
|
|
|
auto opts = displayOptions();
|
|
|
|
|
|
|
|
Flip( opts->m_DisplayModEdgeFill );
|
|
|
|
view()->UpdateDisplayOptions( opts );
|
|
|
|
|
|
|
|
for( auto module : board()->Modules() )
|
|
|
|
{
|
|
|
|
for( auto item : module->GraphicalItems() )
|
|
|
|
{
|
|
|
|
if( item->Type() == PCB_MODULE_EDGE_T )
|
|
|
|
view()->Update( item, KIGFX::GEOMETRY );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
canvas()->Refresh();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int PCBNEW_CONTROL::ModuleTextOutlines( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
|
|
|
auto opts = displayOptions();
|
|
|
|
|
|
|
|
Flip( opts->m_DisplayModTextFill );
|
|
|
|
view()->UpdateDisplayOptions( opts );
|
|
|
|
|
|
|
|
for( auto module : board()->Modules() )
|
|
|
|
{
|
|
|
|
for( auto item : module->GraphicalItems() )
|
|
|
|
{
|
|
|
|
if( item->Type() == PCB_MODULE_TEXT_T )
|
|
|
|
view()->Update( item, KIGFX::GEOMETRY );
|
|
|
|
}
|
|
|
|
|
|
|
|
view()->Update( &module->Reference(), KIGFX::GEOMETRY );
|
|
|
|
view()->Update( &module->Value(), KIGFX::GEOMETRY );
|
|
|
|
}
|
|
|
|
|
|
|
|
canvas()->Refresh();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-02-14 20:28:47 +00:00
|
|
|
int PCBNEW_CONTROL::ZoneDisplayMode( const TOOL_EVENT& aEvent )
|
2014-07-09 13:02:56 +00:00
|
|
|
{
|
2017-10-30 19:17:23 +00:00
|
|
|
auto opts = displayOptions();
|
2014-07-09 13:02:56 +00:00
|
|
|
|
|
|
|
// Apply new display options to the GAL canvas
|
2017-02-21 12:42:08 +00:00
|
|
|
if( aEvent.IsAction( &PCB_ACTIONS::zoneDisplayEnable ) )
|
2017-10-30 19:17:23 +00:00
|
|
|
opts->m_DisplayZonesMode = 0;
|
2017-02-21 12:42:08 +00:00
|
|
|
else if( aEvent.IsAction( &PCB_ACTIONS::zoneDisplayDisable ) )
|
2017-10-30 19:17:23 +00:00
|
|
|
opts->m_DisplayZonesMode = 1;
|
2017-02-21 12:42:08 +00:00
|
|
|
else if( aEvent.IsAction( &PCB_ACTIONS::zoneDisplayOutlines ) )
|
2017-10-30 19:17:23 +00:00
|
|
|
opts->m_DisplayZonesMode = 2;
|
2014-07-09 13:02:56 +00:00
|
|
|
else
|
2018-06-15 15:11:32 +00:00
|
|
|
wxFAIL;
|
2014-07-09 13:02:56 +00:00
|
|
|
|
2017-10-30 19:17:23 +00:00
|
|
|
view()->UpdateDisplayOptions( opts );
|
2014-07-09 13:02:56 +00:00
|
|
|
|
2017-09-22 15:17:38 +00:00
|
|
|
for( int i = 0; i < board()->GetAreaCount(); ++i )
|
|
|
|
view()->Update( board()->GetArea( i ), KIGFX::GEOMETRY );
|
2014-07-09 13:02:56 +00:00
|
|
|
|
2017-10-30 19:17:23 +00:00
|
|
|
canvas()->Refresh();
|
2014-03-24 07:45:05 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-02-14 20:28:47 +00:00
|
|
|
int PCBNEW_CONTROL::HighContrastMode( const TOOL_EVENT& aEvent )
|
2014-03-24 07:45:05 +00:00
|
|
|
{
|
2017-10-30 19:17:23 +00:00
|
|
|
auto opts = displayOptions();
|
2014-03-24 16:20:23 +00:00
|
|
|
|
2017-10-30 19:17:23 +00:00
|
|
|
Flip( opts->m_ContrastModeDisplay );
|
|
|
|
view()->UpdateDisplayOptions( opts );
|
|
|
|
canvas()->SetHighContrastLayer( m_frame->GetActiveLayer() );
|
2014-03-24 16:20:23 +00:00
|
|
|
|
2014-03-24 07:45:05 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-02-14 20:28:47 +00:00
|
|
|
int PCBNEW_CONTROL::HighContrastInc( const TOOL_EVENT& aEvent )
|
2014-03-24 07:45:05 +00:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-02-14 20:28:47 +00:00
|
|
|
int PCBNEW_CONTROL::HighContrastDec( const TOOL_EVENT& aEvent )
|
2014-03-24 07:45:05 +00:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Layer control
|
2015-02-14 20:28:47 +00:00
|
|
|
int PCBNEW_CONTROL::LayerSwitch( const TOOL_EVENT& aEvent )
|
2014-07-09 14:25:50 +00:00
|
|
|
{
|
2017-03-13 03:19:33 +00:00
|
|
|
m_frame->SwitchLayer( NULL, (PCB_LAYER_ID) aEvent.Parameter<intptr_t>() );
|
2014-03-24 07:45:05 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-02-14 20:28:47 +00:00
|
|
|
int PCBNEW_CONTROL::LayerNext( const TOOL_EVENT& aEvent )
|
2014-03-24 07:45:05 +00:00
|
|
|
{
|
2014-07-09 11:50:27 +00:00
|
|
|
PCB_BASE_FRAME* editFrame = m_frame;
|
|
|
|
LAYER_NUM layer = editFrame->GetActiveLayer();
|
2014-06-06 12:59:55 +00:00
|
|
|
|
2014-07-09 14:25:50 +00:00
|
|
|
if( layer < F_Cu || layer > B_Cu )
|
2014-06-06 12:59:55 +00:00
|
|
|
return 0;
|
|
|
|
|
2017-09-22 15:17:38 +00:00
|
|
|
int layerCount = board()->GetCopperLayerCount();
|
2014-07-09 14:25:50 +00:00
|
|
|
|
|
|
|
if( layer == layerCount - 2 || layerCount < 2 )
|
2014-06-24 16:17:18 +00:00
|
|
|
layer = B_Cu;
|
2014-07-09 14:25:50 +00:00
|
|
|
else if( layer == B_Cu )
|
2014-07-09 09:50:27 +00:00
|
|
|
layer = F_Cu;
|
2014-06-06 12:59:55 +00:00
|
|
|
else
|
|
|
|
++layer;
|
2014-03-24 07:45:05 +00:00
|
|
|
|
2018-06-15 15:11:32 +00:00
|
|
|
wxCHECK( IsCopperLayer( layer ), 0 );
|
2014-06-29 13:05:51 +00:00
|
|
|
editFrame->SwitchLayer( NULL, ToLAYER_ID( layer ) );
|
2014-03-24 07:45:05 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-02-14 20:28:47 +00:00
|
|
|
int PCBNEW_CONTROL::LayerPrev( const TOOL_EVENT& aEvent )
|
2014-03-24 07:45:05 +00:00
|
|
|
{
|
2014-07-09 11:50:27 +00:00
|
|
|
PCB_BASE_FRAME* editFrame = m_frame;
|
|
|
|
LAYER_NUM layer = editFrame->GetActiveLayer();
|
2014-03-24 07:45:05 +00:00
|
|
|
|
2014-07-09 14:25:50 +00:00
|
|
|
if( layer < F_Cu || layer > B_Cu )
|
2014-06-06 12:59:55 +00:00
|
|
|
return 0;
|
|
|
|
|
2017-09-22 15:17:38 +00:00
|
|
|
int layerCount = board()->GetCopperLayerCount();
|
2014-07-09 14:25:50 +00:00
|
|
|
|
|
|
|
if( layer == F_Cu || layerCount < 2 )
|
2014-06-24 16:17:18 +00:00
|
|
|
layer = B_Cu;
|
|
|
|
else if( layer == B_Cu )
|
2014-07-09 14:25:50 +00:00
|
|
|
layer = layerCount - 2;
|
2014-06-06 12:59:55 +00:00
|
|
|
else
|
|
|
|
--layer;
|
2014-03-24 07:45:05 +00:00
|
|
|
|
2018-06-15 15:11:32 +00:00
|
|
|
wxCHECK( IsCopperLayer( layer ), 0 );
|
2014-06-29 13:05:51 +00:00
|
|
|
editFrame->SwitchLayer( NULL, ToLAYER_ID( layer ) );
|
2014-03-24 07:45:05 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-05-18 11:48:11 +00:00
|
|
|
int PCBNEW_CONTROL::LayerToggle( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
|
|
|
LAYER_NUM currentLayer = m_frame->GetActiveLayer();
|
|
|
|
PCB_SCREEN* screen = m_frame->GetScreen();
|
|
|
|
|
|
|
|
if( currentLayer == screen->m_Route_Layer_TOP )
|
|
|
|
m_frame->SwitchLayer( NULL, screen->m_Route_Layer_BOTTOM );
|
|
|
|
else
|
|
|
|
m_frame->SwitchLayer( NULL, screen->m_Route_Layer_TOP );
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-09-22 11:54:01 +00:00
|
|
|
// It'd be nice to share the min/max with the DIALOG_COLOR_PICKER, but those are
|
2018-02-23 13:04:07 +00:00
|
|
|
// set in wxFormBuilder.
|
|
|
|
#define ALPHA_MIN 0.20
|
|
|
|
#define ALPHA_MAX 1.00
|
|
|
|
#define ALPHA_STEP 0.05
|
|
|
|
|
2015-02-14 20:28:47 +00:00
|
|
|
int PCBNEW_CONTROL::LayerAlphaInc( const TOOL_EVENT& aEvent )
|
2014-03-24 07:45:05 +00:00
|
|
|
{
|
2019-05-27 00:20:18 +00:00
|
|
|
auto& settings = m_frame->Settings().Colors();
|
2014-03-24 17:28:21 +00:00
|
|
|
|
|
|
|
LAYER_NUM currentLayer = m_frame->GetActiveLayer();
|
2019-05-27 00:20:18 +00:00
|
|
|
KIGFX::COLOR4D currentColor = settings.GetLayerColor( currentLayer );
|
2014-03-24 17:28:21 +00:00
|
|
|
|
2018-02-23 13:04:07 +00:00
|
|
|
if( currentColor.a <= ALPHA_MAX - ALPHA_STEP )
|
2014-03-24 17:28:21 +00:00
|
|
|
{
|
2018-02-23 13:04:07 +00:00
|
|
|
currentColor.a += ALPHA_STEP;
|
2019-05-27 00:20:18 +00:00
|
|
|
settings.SetLayerColor( currentLayer, currentColor );
|
|
|
|
|
|
|
|
KIGFX::VIEW* view = m_frame->GetGalCanvas()->GetView();
|
|
|
|
view->GetPainter()->GetSettings()->ImportLegacyColors( &settings );
|
|
|
|
view->UpdateLayerColor( currentLayer );
|
2018-02-21 16:29:24 +00:00
|
|
|
|
|
|
|
wxUpdateUIEvent dummy;
|
|
|
|
static_cast<PCB_EDIT_FRAME*>( m_frame )->OnUpdateLayerAlpha( dummy );
|
2014-03-24 17:28:21 +00:00
|
|
|
}
|
2018-02-23 13:04:07 +00:00
|
|
|
else
|
|
|
|
wxBell();
|
2014-03-24 17:28:21 +00:00
|
|
|
|
2014-03-24 07:45:05 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-02-14 20:28:47 +00:00
|
|
|
int PCBNEW_CONTROL::LayerAlphaDec( const TOOL_EVENT& aEvent )
|
2014-03-24 07:45:05 +00:00
|
|
|
{
|
2019-05-27 00:20:18 +00:00
|
|
|
auto& settings = m_frame->Settings().Colors();
|
2014-03-24 17:28:21 +00:00
|
|
|
|
|
|
|
LAYER_NUM currentLayer = m_frame->GetActiveLayer();
|
2019-05-27 00:20:18 +00:00
|
|
|
KIGFX::COLOR4D currentColor = settings.GetLayerColor( currentLayer );
|
2014-03-24 17:28:21 +00:00
|
|
|
|
2018-02-23 13:04:07 +00:00
|
|
|
if( currentColor.a >= ALPHA_MIN + ALPHA_STEP )
|
2014-03-24 17:28:21 +00:00
|
|
|
{
|
2018-02-23 13:04:07 +00:00
|
|
|
currentColor.a -= ALPHA_STEP;
|
2019-05-27 00:20:18 +00:00
|
|
|
settings.SetLayerColor( currentLayer, currentColor );
|
|
|
|
|
|
|
|
KIGFX::VIEW* view = m_frame->GetGalCanvas()->GetView();
|
|
|
|
view->GetPainter()->GetSettings()->ImportLegacyColors( &settings );
|
|
|
|
view->UpdateLayerColor( currentLayer );
|
2018-02-21 16:29:24 +00:00
|
|
|
|
|
|
|
wxUpdateUIEvent dummy;
|
|
|
|
static_cast<PCB_BASE_FRAME*>( m_frame )->OnUpdateLayerAlpha( dummy );
|
2014-03-24 17:28:21 +00:00
|
|
|
}
|
2018-02-23 13:04:07 +00:00
|
|
|
else
|
|
|
|
wxBell();
|
2014-03-24 17:28:21 +00:00
|
|
|
|
2014-03-24 07:45:05 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Grid control
|
2015-02-14 20:28:47 +00:00
|
|
|
int PCBNEW_CONTROL::GridFast1( const TOOL_EVENT& aEvent )
|
2014-03-24 07:45:05 +00:00
|
|
|
{
|
2014-07-09 11:50:27 +00:00
|
|
|
m_frame->SetFastGrid1();
|
2015-05-12 10:03:39 +00:00
|
|
|
updateGrid();
|
2014-03-24 07:45:05 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-02-14 20:28:47 +00:00
|
|
|
int PCBNEW_CONTROL::GridFast2( const TOOL_EVENT& aEvent )
|
2014-03-24 07:45:05 +00:00
|
|
|
{
|
2014-07-09 11:50:27 +00:00
|
|
|
m_frame->SetFastGrid2();
|
2015-05-12 10:03:39 +00:00
|
|
|
updateGrid();
|
2014-03-24 07:45:05 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-01-24 10:19:33 +00:00
|
|
|
bool PCBNEW_CONTROL::DoSetGridOrigin( KIGFX::VIEW* aView, PCB_BASE_FRAME* aFrame,
|
|
|
|
BOARD_ITEM* originViewItem, const VECTOR2D& aPoint )
|
2014-06-04 15:46:43 +00:00
|
|
|
{
|
2015-06-18 15:51:51 +00:00
|
|
|
aFrame->SetGridOrigin( wxPoint( aPoint.x, aPoint.y ) );
|
|
|
|
aView->GetGAL()->SetGridOrigin( aPoint );
|
2018-01-24 10:19:33 +00:00
|
|
|
originViewItem->SetPosition( wxPoint( aPoint.x, aPoint.y ) );
|
2015-06-18 15:51:51 +00:00
|
|
|
aView->MarkDirty();
|
2018-01-24 21:27:56 +00:00
|
|
|
aFrame->OnModify();
|
2015-06-18 15:51:51 +00:00
|
|
|
return true;
|
|
|
|
}
|
2014-06-04 15:46:43 +00:00
|
|
|
|
|
|
|
|
2018-01-24 10:19:33 +00:00
|
|
|
bool PCBNEW_CONTROL::SetGridOrigin( KIGFX::VIEW* aView, PCB_BASE_FRAME* aFrame,
|
|
|
|
BOARD_ITEM* originViewItem, const VECTOR2D& aPoint )
|
|
|
|
{
|
|
|
|
aFrame->SaveCopyInUndoList( originViewItem, UR_GRIDORIGIN );
|
|
|
|
return DoSetGridOrigin( aView, aFrame, originViewItem, aPoint );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-06-18 15:51:51 +00:00
|
|
|
int PCBNEW_CONTROL::GridSetOrigin( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
2015-06-30 12:08:03 +00:00
|
|
|
VECTOR2D* origin = aEvent.Parameter<VECTOR2D*>();
|
2015-06-18 15:51:51 +00:00
|
|
|
|
2015-06-30 12:08:03 +00:00
|
|
|
if( origin )
|
|
|
|
{
|
2018-01-24 10:19:33 +00:00
|
|
|
// We can't undo the other grid dialog settings, so no sense undoing just the origin
|
|
|
|
|
|
|
|
DoSetGridOrigin( getView(), m_frame, m_gridOrigin.get(), *origin );
|
2015-06-30 12:08:03 +00:00
|
|
|
delete origin;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-07-19 21:13:52 +00:00
|
|
|
if( m_editModules && !getEditFrame<PCB_BASE_EDIT_FRAME>()->GetModel() )
|
|
|
|
return 0;
|
|
|
|
|
2015-07-24 08:58:47 +00:00
|
|
|
Activate();
|
|
|
|
|
2015-06-30 12:08:03 +00:00
|
|
|
PICKER_TOOL* picker = m_toolMgr->GetTool<PICKER_TOOL>();
|
2018-06-15 15:11:32 +00:00
|
|
|
wxCHECK( picker, 0 );
|
2015-06-30 12:08:03 +00:00
|
|
|
|
|
|
|
// TODO it will not check the toolbar button in module editor, as it uses a different ID..
|
|
|
|
m_frame->SetToolID( ID_PCB_PLACE_GRID_COORD_BUTT, wxCURSOR_PENCIL, _( "Adjust grid origin" ) );
|
2018-01-24 10:19:33 +00:00
|
|
|
picker->SetClickHandler( std::bind( SetGridOrigin, getView(), m_frame, m_gridOrigin.get(), _1 ) );
|
2015-06-30 12:08:03 +00:00
|
|
|
picker->Activate();
|
2015-07-24 08:58:47 +00:00
|
|
|
Wait();
|
2015-06-30 12:08:03 +00:00
|
|
|
}
|
2014-06-04 15:46:43 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-05-04 12:59:14 +00:00
|
|
|
int PCBNEW_CONTROL::GridResetOrigin( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
2018-01-24 10:19:33 +00:00
|
|
|
SetGridOrigin( getView(), m_frame, m_gridOrigin.get(), VECTOR2D( 0, 0 ) );
|
2016-05-04 12:59:14 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-03-24 07:45:05 +00:00
|
|
|
// Miscellaneous
|
2015-02-14 20:28:47 +00:00
|
|
|
int PCBNEW_CONTROL::ResetCoords( const TOOL_EVENT& aEvent )
|
2014-03-24 07:45:05 +00:00
|
|
|
{
|
2018-04-24 10:55:33 +00:00
|
|
|
auto vcSettings = m_toolMgr->GetCurrentToolVC();
|
|
|
|
|
|
|
|
// Use either the active tool forced cursor position or the general settings
|
|
|
|
VECTOR2I cursorPos = vcSettings.m_forceCursorPosition ? vcSettings.m_forcedPosition :
|
|
|
|
getViewControls()->GetCursorPosition();
|
2014-03-24 17:28:21 +00:00
|
|
|
|
|
|
|
m_frame->GetScreen()->m_O_Curseur = wxPoint( cursorPos.x, cursorPos.y );
|
|
|
|
m_frame->UpdateStatusBar();
|
2014-03-24 07:45:05 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-02-14 20:28:47 +00:00
|
|
|
int PCBNEW_CONTROL::SwitchCursor( const TOOL_EVENT& aEvent )
|
2014-07-09 13:10:32 +00:00
|
|
|
{
|
2017-03-19 20:51:59 +00:00
|
|
|
auto& galOpts = m_frame->GetGalDisplayOptions();
|
2014-07-09 13:10:32 +00:00
|
|
|
|
2017-03-19 20:51:59 +00:00
|
|
|
galOpts.m_fullscreenCursor = !galOpts.m_fullscreenCursor;
|
|
|
|
galOpts.NotifyChanged();
|
2014-07-09 13:10:32 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-02-14 20:28:47 +00:00
|
|
|
int PCBNEW_CONTROL::SwitchUnits( const TOOL_EVENT& aEvent )
|
2014-03-24 07:45:05 +00:00
|
|
|
{
|
2014-03-24 17:28:21 +00:00
|
|
|
// TODO should not it be refactored to pcb_frame member function?
|
|
|
|
wxCommandEvent evt( wxEVT_COMMAND_MENU_SELECTED );
|
|
|
|
|
2018-06-13 16:05:43 +00:00
|
|
|
if( m_frame->GetUserUnits() == INCHES )
|
2014-03-24 17:28:21 +00:00
|
|
|
evt.SetId( ID_TB_OPTIONS_SELECT_UNIT_MM );
|
|
|
|
else
|
|
|
|
evt.SetId( ID_TB_OPTIONS_SELECT_UNIT_INCH );
|
|
|
|
|
|
|
|
m_frame->ProcessEvent( evt );
|
2014-03-24 07:45:05 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-06-18 15:51:51 +00:00
|
|
|
static bool deleteItem( TOOL_MANAGER* aToolMgr, const VECTOR2D& aPosition )
|
|
|
|
{
|
|
|
|
SELECTION_TOOL* selectionTool = aToolMgr->GetTool<SELECTION_TOOL>();
|
2018-06-15 15:11:32 +00:00
|
|
|
wxCHECK( selectionTool, false );
|
2015-06-18 15:51:51 +00:00
|
|
|
|
2017-02-21 12:42:08 +00:00
|
|
|
aToolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
|
2015-06-18 15:51:51 +00:00
|
|
|
|
2018-09-25 14:23:38 +00:00
|
|
|
const SELECTION& selection = selectionTool->RequestSelection(
|
|
|
|
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector )
|
|
|
|
{ EditToolSelectionFilter( aCollector, EXCLUDE_LOCKED ); } );
|
2015-09-08 09:17:30 +00:00
|
|
|
|
|
|
|
if( selection.Empty() )
|
2015-06-18 15:51:51 +00:00
|
|
|
return true;
|
|
|
|
|
2018-04-19 07:05:07 +00:00
|
|
|
aToolMgr->RunAction( PCB_ACTIONS::remove, true );
|
2015-06-18 15:51:51 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int PCBNEW_CONTROL::DeleteItemCursor( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
2019-07-19 21:13:52 +00:00
|
|
|
if( m_editModules && !m_frame->GetBoard()->m_Modules )
|
|
|
|
return 0;
|
|
|
|
|
2015-07-24 08:58:47 +00:00
|
|
|
Activate();
|
|
|
|
|
2015-06-18 15:51:51 +00:00
|
|
|
PICKER_TOOL* picker = m_toolMgr->GetTool<PICKER_TOOL>();
|
2018-06-15 15:11:32 +00:00
|
|
|
wxCHECK( picker, 0 );
|
2015-06-18 15:51:51 +00:00
|
|
|
|
2018-06-15 15:10:12 +00:00
|
|
|
m_frame->SetToolID( m_editModules ? ID_MODEDIT_DELETE_TOOL : ID_PCB_DELETE_ITEM_BUTT,
|
|
|
|
wxCURSOR_BULLSEYE, _( "Delete item" ) );
|
2015-06-18 15:51:51 +00:00
|
|
|
picker->SetSnapping( false );
|
2016-06-29 10:23:11 +00:00
|
|
|
picker->SetClickHandler( std::bind( deleteItem, m_toolMgr, _1 ) );
|
2015-06-18 15:51:51 +00:00
|
|
|
picker->Activate();
|
2015-07-24 08:58:47 +00:00
|
|
|
Wait();
|
2015-06-18 15:51:51 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2017-05-18 17:21:30 +00:00
|
|
|
|
2018-05-08 08:36:50 +00:00
|
|
|
|
2017-09-22 15:17:38 +00:00
|
|
|
int PCBNEW_CONTROL::PasteItemsFromClipboard( const TOOL_EVENT& aEvent )
|
2017-04-15 16:08:23 +00:00
|
|
|
{
|
|
|
|
CLIPBOARD_IO pi;
|
2017-05-18 17:21:30 +00:00
|
|
|
BOARD_ITEM* clipItem = pi.Parse();
|
2017-09-22 15:17:38 +00:00
|
|
|
|
2017-09-29 09:40:10 +00:00
|
|
|
if( !clipItem )
|
2017-09-22 15:17:38 +00:00
|
|
|
return 0;
|
|
|
|
|
2017-09-29 09:40:10 +00:00
|
|
|
if( clipItem->Type() == PCB_T )
|
2018-05-08 08:36:50 +00:00
|
|
|
static_cast<BOARD*>( clipItem )->ClearAllNetCodes();
|
2017-09-28 16:38:54 +00:00
|
|
|
|
2017-09-22 15:17:38 +00:00
|
|
|
bool editModules = m_editModules || frame()->IsType( FRAME_PCB_MODULE_EDITOR );
|
2017-05-18 17:21:30 +00:00
|
|
|
|
|
|
|
// The clipboard can contain two different things, an entire kicad_pcb
|
|
|
|
// or a single module
|
|
|
|
|
2017-09-29 09:40:10 +00:00
|
|
|
if( editModules && ( !board() || !module() ) )
|
2017-05-18 17:21:30 +00:00
|
|
|
{
|
2017-09-22 15:17:38 +00:00
|
|
|
wxLogDebug( wxT( "Attempting to paste to empty module editor window\n") );
|
|
|
|
return 0;
|
2017-05-18 17:21:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
switch( clipItem->Type() )
|
|
|
|
{
|
|
|
|
case PCB_T:
|
2017-09-22 15:17:38 +00:00
|
|
|
{
|
|
|
|
if( editModules )
|
2017-05-18 17:21:30 +00:00
|
|
|
{
|
2017-09-22 15:17:38 +00:00
|
|
|
wxLogDebug( wxT( "attempting to paste a pcb in the footprint editor\n") );
|
|
|
|
return 0;
|
2017-05-18 17:21:30 +00:00
|
|
|
}
|
2017-09-22 15:17:38 +00:00
|
|
|
|
2018-05-08 08:36:50 +00:00
|
|
|
placeBoardItems( static_cast<BOARD*>( clipItem ) );
|
2017-05-18 17:21:30 +00:00
|
|
|
break;
|
2017-09-22 15:17:38 +00:00
|
|
|
}
|
|
|
|
|
2017-05-18 17:21:30 +00:00
|
|
|
case PCB_MODULE_T:
|
2017-09-22 15:17:38 +00:00
|
|
|
{
|
2018-05-08 08:36:50 +00:00
|
|
|
std::vector<BOARD_ITEM*> items;
|
2017-09-22 15:17:38 +00:00
|
|
|
|
|
|
|
clipItem->SetParent( board() );
|
|
|
|
|
|
|
|
if( editModules )
|
2017-05-18 17:21:30 +00:00
|
|
|
{
|
2018-06-15 11:44:09 +00:00
|
|
|
auto oldModule = static_cast<MODULE*>( clipItem );
|
|
|
|
auto newModule = board()->m_Modules.GetFirst();
|
2017-09-22 15:17:38 +00:00
|
|
|
|
2018-06-15 11:44:09 +00:00
|
|
|
for( D_PAD* pad = oldModule->PadsList(), *next = nullptr; pad; pad = next )
|
2017-09-22 15:17:38 +00:00
|
|
|
{
|
2018-06-15 11:44:09 +00:00
|
|
|
next = pad->Next();
|
|
|
|
oldModule->Remove( pad );
|
|
|
|
pad->SetParent( newModule );
|
2017-09-22 15:17:38 +00:00
|
|
|
items.push_back( pad );
|
|
|
|
}
|
2018-05-08 08:36:50 +00:00
|
|
|
|
2018-06-15 11:44:09 +00:00
|
|
|
for( BOARD_ITEM* item = oldModule->GraphicalItemsList(), *next = nullptr;
|
|
|
|
item; item = next )
|
2017-09-22 15:17:38 +00:00
|
|
|
{
|
2018-06-15 11:44:09 +00:00
|
|
|
next = item->Next();
|
|
|
|
oldModule->Remove( item );
|
|
|
|
item->SetParent( newModule );
|
2017-09-22 15:17:38 +00:00
|
|
|
items.push_back( item );
|
|
|
|
}
|
2017-05-18 17:21:30 +00:00
|
|
|
}
|
2017-09-22 15:17:38 +00:00
|
|
|
else
|
2017-05-18 17:21:30 +00:00
|
|
|
{
|
2017-09-22 15:17:38 +00:00
|
|
|
items.push_back( clipItem );
|
2017-05-18 17:21:30 +00:00
|
|
|
}
|
2017-09-22 15:17:38 +00:00
|
|
|
|
2017-11-11 08:09:24 +00:00
|
|
|
placeBoardItems( items, true );
|
2017-05-18 17:21:30 +00:00
|
|
|
break;
|
2017-09-22 15:17:38 +00:00
|
|
|
}
|
2018-05-08 08:36:50 +00:00
|
|
|
|
2017-05-18 17:21:30 +00:00
|
|
|
default:
|
2017-09-22 15:17:38 +00:00
|
|
|
m_frame->DisplayToolMsg( _( "Invalid clipboard contents" ) );
|
2017-05-18 17:21:30 +00:00
|
|
|
break;
|
|
|
|
}
|
2018-05-08 08:36:50 +00:00
|
|
|
|
2017-05-18 17:21:30 +00:00
|
|
|
return 1;
|
2017-04-15 16:08:23 +00:00
|
|
|
}
|
2015-06-18 15:51:51 +00:00
|
|
|
|
2018-05-08 08:36:50 +00:00
|
|
|
|
2017-04-15 16:08:23 +00:00
|
|
|
int PCBNEW_CONTROL::AppendBoardFromFile( const TOOL_EVENT& aEvent )
|
2015-08-07 16:24:42 +00:00
|
|
|
{
|
|
|
|
int open_ctl;
|
|
|
|
wxString fileName;
|
|
|
|
|
|
|
|
PCB_EDIT_FRAME* editFrame = dynamic_cast<PCB_EDIT_FRAME*>( m_frame );
|
|
|
|
|
|
|
|
if( !editFrame )
|
2017-05-18 17:21:30 +00:00
|
|
|
return 1;
|
2015-08-07 16:24:42 +00:00
|
|
|
|
|
|
|
// Pick a file to append
|
|
|
|
if( !AskLoadBoardFileName( editFrame, &open_ctl, &fileName, true ) )
|
2017-05-18 17:21:30 +00:00
|
|
|
return 1;
|
2015-08-07 16:24:42 +00:00
|
|
|
|
|
|
|
IO_MGR::PCB_FILE_T pluginType = plugin_type( fileName, open_ctl );
|
|
|
|
PLUGIN::RELEASER pi( IO_MGR::PluginFind( pluginType ) );
|
|
|
|
|
2017-04-15 16:08:23 +00:00
|
|
|
return AppendBoard( *pi, fileName );
|
|
|
|
}
|
2017-05-18 17:21:30 +00:00
|
|
|
|
2018-05-08 08:36:50 +00:00
|
|
|
|
2018-05-08 09:21:55 +00:00
|
|
|
// Helper function for PCBNEW_CONTROL::placeBoardItems()
|
|
|
|
template<typename T>
|
|
|
|
static void moveNoFlagToVector( DLIST<T>& aList, std::vector<BOARD_ITEM*>& aTarget, bool aIsNew )
|
2017-09-22 15:17:38 +00:00
|
|
|
{
|
2018-05-08 09:21:55 +00:00
|
|
|
for( auto obj = aIsNew ? aList.PopFront() : aList.GetFirst(); obj;
|
|
|
|
obj = aIsNew ? aList.PopFront() : obj->Next() )
|
2017-09-22 15:17:38 +00:00
|
|
|
{
|
2018-05-08 09:21:55 +00:00
|
|
|
if( obj->GetFlags() & FLAG0 )
|
|
|
|
obj->ClearFlags( FLAG0 );
|
2017-11-11 08:09:24 +00:00
|
|
|
else
|
2018-05-08 09:21:55 +00:00
|
|
|
aTarget.push_back( obj );
|
2017-09-22 15:17:38 +00:00
|
|
|
}
|
2018-05-08 09:21:55 +00:00
|
|
|
}
|
2017-09-22 15:17:38 +00:00
|
|
|
|
2018-05-12 18:48:50 +00:00
|
|
|
static void moveNoFlagToVector( ZONE_CONTAINERS& aList, std::vector<BOARD_ITEM*>& aTarget, bool aIsNew )
|
|
|
|
{
|
2018-05-13 19:50:59 +00:00
|
|
|
if( aList.size() == 0 )
|
|
|
|
return;
|
|
|
|
|
2018-05-12 18:48:50 +00:00
|
|
|
auto obj = aList.front();
|
|
|
|
int idx = 0;
|
|
|
|
|
|
|
|
if( aIsNew )
|
|
|
|
{
|
|
|
|
obj = aList.back();
|
|
|
|
aList.pop_back();
|
|
|
|
}
|
|
|
|
|
|
|
|
for( ; obj ; )
|
|
|
|
{
|
|
|
|
if( obj->GetFlags() & FLAG0 )
|
|
|
|
obj->ClearFlags( FLAG0 );
|
|
|
|
else
|
|
|
|
aTarget.push_back( obj );
|
|
|
|
|
|
|
|
if( aIsNew )
|
|
|
|
{
|
|
|
|
if( aList.size() )
|
|
|
|
{
|
|
|
|
obj = aList.back();
|
|
|
|
aList.pop_back();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
obj = nullptr;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
obj = idx < int(aList.size()-1) ? aList[++idx] : nullptr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-09-22 15:17:38 +00:00
|
|
|
|
2018-05-08 09:21:55 +00:00
|
|
|
int PCBNEW_CONTROL::placeBoardItems( BOARD* aBoard )
|
|
|
|
{
|
2017-11-11 08:09:24 +00:00
|
|
|
// items are new if the current board is not the board source
|
|
|
|
bool isNew = board() != aBoard;
|
2018-05-08 09:21:55 +00:00
|
|
|
std::vector<BOARD_ITEM*> items;
|
|
|
|
|
|
|
|
moveNoFlagToVector( aBoard->m_Track, items, isNew );
|
|
|
|
moveNoFlagToVector( aBoard->m_Modules, items, isNew );
|
|
|
|
moveNoFlagToVector( aBoard->DrawingsList(), items, isNew );
|
2018-05-12 18:48:50 +00:00
|
|
|
moveNoFlagToVector( aBoard->Zones(), items, isNew );
|
2018-05-08 09:21:55 +00:00
|
|
|
|
2017-11-11 08:09:24 +00:00
|
|
|
return placeBoardItems( items, isNew );
|
2017-09-22 15:17:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-11-11 08:09:24 +00:00
|
|
|
int PCBNEW_CONTROL::placeBoardItems( std::vector<BOARD_ITEM*>& aItems, bool aIsNew )
|
2017-09-22 15:17:38 +00:00
|
|
|
{
|
|
|
|
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
|
|
|
|
|
|
|
|
auto selectionTool = m_toolMgr->GetTool<SELECTION_TOOL>();
|
|
|
|
auto editTool = m_toolMgr->GetTool<EDIT_TOOL>();
|
|
|
|
|
|
|
|
SELECTION& selection = selectionTool->GetSelection();
|
|
|
|
|
2017-09-29 09:40:10 +00:00
|
|
|
for( auto item : aItems )
|
2017-09-22 15:17:38 +00:00
|
|
|
{
|
2017-09-24 22:18:51 +00:00
|
|
|
item->SetSelected();
|
2017-09-22 15:17:38 +00:00
|
|
|
selection.Add( item );
|
2017-11-11 08:09:24 +00:00
|
|
|
|
|
|
|
// Add or just select items for the move/place command
|
|
|
|
if( aIsNew )
|
|
|
|
editTool->GetCurrentCommit()->Add( item );
|
|
|
|
else
|
|
|
|
editTool->GetCurrentCommit()->Added( item );
|
2017-09-22 15:17:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
selection.SetReferencePoint( VECTOR2I( 0, 0 ) );
|
|
|
|
|
|
|
|
m_toolMgr->ProcessEvent( SELECTION_TOOL::SelectedEvent );
|
|
|
|
m_toolMgr->RunAction( PCB_ACTIONS::move, true );
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2017-11-11 08:09:24 +00:00
|
|
|
|
2017-04-15 16:08:23 +00:00
|
|
|
int PCBNEW_CONTROL::AppendBoard( PLUGIN& pi, wxString& fileName )
|
|
|
|
{
|
|
|
|
PCB_EDIT_FRAME* editFrame = dynamic_cast<PCB_EDIT_FRAME*>( m_frame );
|
2017-11-11 08:09:24 +00:00
|
|
|
|
2017-05-21 20:18:22 +00:00
|
|
|
if( !editFrame )
|
2017-05-18 17:21:30 +00:00
|
|
|
return 1;
|
|
|
|
|
2017-09-22 15:17:38 +00:00
|
|
|
BOARD* brd = board();
|
2017-11-11 08:09:24 +00:00
|
|
|
|
2017-09-22 15:17:38 +00:00
|
|
|
if( !brd )
|
2017-05-18 17:21:30 +00:00
|
|
|
return 1;
|
2015-08-07 16:24:42 +00:00
|
|
|
|
2017-11-11 08:09:24 +00:00
|
|
|
// Mark existing items, in order to know what are the new items
|
|
|
|
// to be ble to select only the new items after loadind
|
2017-09-22 15:17:38 +00:00
|
|
|
for( auto track : brd->Tracks() )
|
2017-11-11 08:09:24 +00:00
|
|
|
{
|
2015-08-07 16:24:42 +00:00
|
|
|
track->SetFlags( FLAG0 );
|
2017-11-11 08:09:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for( auto module : brd->Modules() )
|
|
|
|
{
|
|
|
|
module->SetFlags( FLAG0 );
|
|
|
|
}
|
|
|
|
|
|
|
|
for( auto drawing : brd->Drawings() )
|
|
|
|
{
|
|
|
|
drawing->SetFlags( FLAG0 );
|
|
|
|
}
|
|
|
|
|
|
|
|
for( auto zone : brd->Zones() )
|
|
|
|
{
|
|
|
|
zone->SetFlags( FLAG0 );
|
|
|
|
}
|
2015-08-07 16:24:42 +00:00
|
|
|
|
|
|
|
// Keep also the count of copper layers, to adjust if necessary
|
2017-09-22 15:17:38 +00:00
|
|
|
int initialCopperLayerCount = brd->GetCopperLayerCount();
|
|
|
|
LSET initialEnabledLayers = brd->GetEnabledLayers();
|
2015-08-07 16:24:42 +00:00
|
|
|
|
|
|
|
// Load the data
|
|
|
|
try
|
|
|
|
{
|
|
|
|
PROPERTIES props;
|
|
|
|
char xbuf[30];
|
|
|
|
char ybuf[30];
|
|
|
|
|
|
|
|
// EAGLE_PLUGIN can use this info to center the BOARD, but it does not yet.
|
|
|
|
sprintf( xbuf, "%d", editFrame->GetPageSizeIU().x );
|
|
|
|
sprintf( ybuf, "%d", editFrame->GetPageSizeIU().y );
|
|
|
|
|
|
|
|
props["page_width"] = xbuf;
|
|
|
|
props["page_height"] = ybuf;
|
|
|
|
|
|
|
|
editFrame->GetDesignSettings().m_NetClasses.Clear();
|
2017-09-22 15:17:38 +00:00
|
|
|
pi.Load( fileName, brd, &props );
|
2015-08-07 16:24:42 +00:00
|
|
|
}
|
|
|
|
catch( const IO_ERROR& ioe )
|
|
|
|
{
|
2016-09-14 22:36:45 +00:00
|
|
|
wxString msg = wxString::Format( _( "Error loading board.\n%s" ), GetChars( ioe.What() ));
|
2015-08-07 16:24:42 +00:00
|
|
|
DisplayError( editFrame, msg );
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2017-04-22 07:23:02 +00:00
|
|
|
// rebuild nets and ratsnest before any use of nets
|
2017-09-22 15:17:38 +00:00
|
|
|
brd->BuildListOfNets();
|
|
|
|
brd->SynchronizeNetsAndNetClasses();
|
2017-11-11 08:09:24 +00:00
|
|
|
brd->BuildConnectivity();
|
2015-08-07 16:24:42 +00:00
|
|
|
|
|
|
|
// Synchronize layers
|
|
|
|
// we should not ask PLUGINs to do these items:
|
2017-09-22 15:17:38 +00:00
|
|
|
int copperLayerCount = brd->GetCopperLayerCount();
|
2015-08-07 16:24:42 +00:00
|
|
|
|
|
|
|
if( copperLayerCount > initialCopperLayerCount )
|
2017-09-22 15:17:38 +00:00
|
|
|
brd->SetCopperLayerCount( copperLayerCount );
|
2015-08-07 16:24:42 +00:00
|
|
|
|
|
|
|
// Enable all used layers, and make them visible:
|
2017-09-22 15:17:38 +00:00
|
|
|
LSET enabledLayers = brd->GetEnabledLayers();
|
2015-08-07 16:24:42 +00:00
|
|
|
enabledLayers |= initialEnabledLayers;
|
2017-09-22 15:17:38 +00:00
|
|
|
brd->SetEnabledLayers( enabledLayers );
|
|
|
|
brd->SetVisibleLayers( enabledLayers );
|
2017-04-18 18:10:06 +00:00
|
|
|
|
2017-09-22 15:17:38 +00:00
|
|
|
return placeBoardItems( brd );
|
2015-08-07 16:24:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-06-12 00:59:30 +00:00
|
|
|
int PCBNEW_CONTROL::ShowHotkeyList( const TOOL_EVENT& aEvent )
|
2014-03-24 07:45:05 +00:00
|
|
|
{
|
2015-06-18 15:51:52 +00:00
|
|
|
DisplayHotkeyList( m_frame, m_frame->GetHotkeyConfig() );
|
2014-03-24 07:45:05 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-06-12 00:59:30 +00:00
|
|
|
int PCBNEW_CONTROL::ShowHelp( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
|
|
|
wxCommandEvent dummyEvent;
|
|
|
|
dummyEvent.SetId( wxID_HELP );
|
|
|
|
m_frame->GetKicadHelp( dummyEvent );
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-02-14 20:28:47 +00:00
|
|
|
int PCBNEW_CONTROL::ToBeDone( const TOOL_EVENT& aEvent )
|
2014-07-09 11:50:27 +00:00
|
|
|
{
|
2015-06-18 15:51:51 +00:00
|
|
|
DisplayInfoMessage( m_frame, _( "Not available in OpenGL/Cairo canvases." ) );
|
2014-07-09 11:50:27 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-07-31 12:30:51 +00:00
|
|
|
void PCBNEW_CONTROL::setTransitions()
|
2014-03-24 07:45:05 +00:00
|
|
|
{
|
|
|
|
// Display modes
|
2017-02-21 12:42:08 +00:00
|
|
|
Go( &PCBNEW_CONTROL::TrackDisplayMode, PCB_ACTIONS::trackDisplayMode.MakeEvent() );
|
|
|
|
Go( &PCBNEW_CONTROL::PadDisplayMode, PCB_ACTIONS::padDisplayMode.MakeEvent() );
|
|
|
|
Go( &PCBNEW_CONTROL::ViaDisplayMode, PCB_ACTIONS::viaDisplayMode.MakeEvent() );
|
2018-02-18 14:21:23 +00:00
|
|
|
Go( &PCBNEW_CONTROL::GraphicDisplayMode, PCB_ACTIONS::graphicDisplayMode.MakeEvent() );
|
|
|
|
Go( &PCBNEW_CONTROL::ModuleEdgeOutlines, PCB_ACTIONS::moduleEdgeOutlines.MakeEvent() );
|
|
|
|
Go( &PCBNEW_CONTROL::ModuleTextOutlines, PCB_ACTIONS::moduleTextOutlines.MakeEvent() );
|
2017-02-21 12:42:08 +00:00
|
|
|
Go( &PCBNEW_CONTROL::ZoneDisplayMode, PCB_ACTIONS::zoneDisplayEnable.MakeEvent() );
|
|
|
|
Go( &PCBNEW_CONTROL::ZoneDisplayMode, PCB_ACTIONS::zoneDisplayDisable.MakeEvent() );
|
|
|
|
Go( &PCBNEW_CONTROL::ZoneDisplayMode, PCB_ACTIONS::zoneDisplayOutlines.MakeEvent() );
|
|
|
|
Go( &PCBNEW_CONTROL::HighContrastMode, PCB_ACTIONS::highContrastMode.MakeEvent() );
|
|
|
|
Go( &PCBNEW_CONTROL::HighContrastInc, PCB_ACTIONS::highContrastInc.MakeEvent() );
|
|
|
|
Go( &PCBNEW_CONTROL::HighContrastDec, PCB_ACTIONS::highContrastDec.MakeEvent() );
|
2014-03-24 07:45:05 +00:00
|
|
|
|
|
|
|
// Layer control
|
2017-02-21 12:42:08 +00:00
|
|
|
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerTop.MakeEvent() );
|
|
|
|
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner1.MakeEvent() );
|
|
|
|
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner2.MakeEvent() );
|
|
|
|
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner3.MakeEvent() );
|
|
|
|
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner4.MakeEvent() );
|
|
|
|
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner5.MakeEvent() );
|
|
|
|
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerInner6.MakeEvent() );
|
|
|
|
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerBottom.MakeEvent() );
|
|
|
|
Go( &PCBNEW_CONTROL::LayerNext, PCB_ACTIONS::layerNext.MakeEvent() );
|
|
|
|
Go( &PCBNEW_CONTROL::LayerPrev, PCB_ACTIONS::layerPrev.MakeEvent() );
|
|
|
|
Go( &PCBNEW_CONTROL::LayerToggle, PCB_ACTIONS::layerToggle.MakeEvent() );
|
|
|
|
Go( &PCBNEW_CONTROL::LayerAlphaInc, PCB_ACTIONS::layerAlphaInc.MakeEvent() );
|
|
|
|
Go( &PCBNEW_CONTROL::LayerAlphaDec, PCB_ACTIONS::layerAlphaDec.MakeEvent() );
|
2014-03-24 07:45:05 +00:00
|
|
|
|
|
|
|
// Grid control
|
2017-02-20 18:10:20 +00:00
|
|
|
Go( &PCBNEW_CONTROL::GridFast1, ACTIONS::gridFast1.MakeEvent() );
|
|
|
|
Go( &PCBNEW_CONTROL::GridFast2, ACTIONS::gridFast2.MakeEvent() );
|
|
|
|
Go( &PCBNEW_CONTROL::GridSetOrigin, ACTIONS::gridSetOrigin.MakeEvent() );
|
|
|
|
Go( &PCBNEW_CONTROL::GridResetOrigin, ACTIONS::gridResetOrigin.MakeEvent() );
|
2014-03-24 07:45:05 +00:00
|
|
|
|
|
|
|
// Miscellaneous
|
2017-02-21 12:42:08 +00:00
|
|
|
Go( &PCBNEW_CONTROL::ResetCoords, PCB_ACTIONS::resetCoords.MakeEvent() );
|
|
|
|
Go( &PCBNEW_CONTROL::SwitchCursor, PCB_ACTIONS::switchCursor.MakeEvent() );
|
|
|
|
Go( &PCBNEW_CONTROL::SwitchUnits, PCB_ACTIONS::switchUnits.MakeEvent() );
|
|
|
|
Go( &PCBNEW_CONTROL::DeleteItemCursor, PCB_ACTIONS::deleteItemCursor.MakeEvent() );
|
2019-06-12 00:59:30 +00:00
|
|
|
Go( &PCBNEW_CONTROL::ShowHotkeyList, PCB_ACTIONS::showHotkeyList.MakeEvent() );
|
2017-02-21 12:42:08 +00:00
|
|
|
Go( &PCBNEW_CONTROL::ShowHelp, PCB_ACTIONS::showHelp.MakeEvent() );
|
|
|
|
Go( &PCBNEW_CONTROL::ToBeDone, PCB_ACTIONS::toBeDone.MakeEvent() );
|
2017-04-15 16:08:23 +00:00
|
|
|
|
|
|
|
// Append control
|
2018-08-22 14:09:16 +00:00
|
|
|
Go( &PCBNEW_CONTROL::AppendBoardFromFile, PCB_ACTIONS::appendBoard.MakeEvent() );
|
2017-09-17 17:49:06 +00:00
|
|
|
|
2018-08-22 14:09:16 +00:00
|
|
|
Go( &PCBNEW_CONTROL::PasteItemsFromClipboard, PCB_ACTIONS::pasteFromClipboard.MakeEvent() );
|
2014-03-24 07:45:05 +00:00
|
|
|
}
|
2015-05-12 10:03:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
void PCBNEW_CONTROL::updateGrid()
|
|
|
|
{
|
|
|
|
BASE_SCREEN* screen = m_frame->GetScreen();
|
|
|
|
//GRID_TYPE grid = screen->GetGrid( idx );
|
|
|
|
getView()->GetGAL()->SetGridSize( VECTOR2D( screen->GetGridSize() ) );
|
|
|
|
getView()->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
|
|
|
|
}
|