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"
|
|
|
|
#include "picker_tool.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>
|
2014-03-24 07:45:05 +00:00
|
|
|
#include <class_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>
|
2014-03-24 07:45:05 +00:00
|
|
|
|
2015-08-07 16:24:42 +00:00
|
|
|
#include <pcbnew_id.h>
|
|
|
|
#include <wxPcbStruct.h>
|
|
|
|
#include <pcb_draw_panel_gal.h>
|
2017-03-22 13:43:10 +00:00
|
|
|
#include <connectivity.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>
|
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,
|
|
|
|
"", "" );
|
|
|
|
|
|
|
|
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",
|
|
|
|
AS_GLOBAL, '>',
|
|
|
|
"", "" );
|
|
|
|
|
|
|
|
TOOL_ACTION PCB_ACTIONS::highContrastDec( "pcbnew.Control.highContrastDec",
|
|
|
|
AS_GLOBAL, '<',
|
|
|
|
"", "" );
|
|
|
|
|
|
|
|
|
|
|
|
// 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",
|
2017-06-17 16:11:40 +00:00
|
|
|
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_INC_LAYER_ALHPA ),
|
2017-02-20 18:10:20 +00:00
|
|
|
"", "" );
|
|
|
|
|
|
|
|
TOOL_ACTION PCB_ACTIONS::layerAlphaDec( "pcbnew.Control.layerAlphaDec",
|
2017-06-17 16:11:40 +00:00
|
|
|
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_DEC_LAYER_ALHPA ),
|
2017-02-20 18:10:20 +00:00
|
|
|
"", "" );
|
|
|
|
|
|
|
|
TOOL_ACTION PCB_ACTIONS::layerChanged( "pcbnew.Control.layerChanged",
|
|
|
|
AS_GLOBAL, 0,
|
|
|
|
"", "", NULL, AF_NOTIFY );
|
|
|
|
|
|
|
|
// Cursor control
|
|
|
|
TOOL_ACTION PCB_ACTIONS::cursorUp( "pcbnew.Control.cursorUp",
|
|
|
|
AS_GLOBAL, WXK_UP, "", "", NULL, AF_NONE, (void*) CURSOR_UP );
|
|
|
|
TOOL_ACTION PCB_ACTIONS::cursorDown( "pcbnew.Control.cursorDown",
|
|
|
|
AS_GLOBAL, WXK_DOWN, "", "" , NULL, AF_NONE, (void*) CURSOR_DOWN );
|
|
|
|
TOOL_ACTION PCB_ACTIONS::cursorLeft( "pcbnew.Control.cursorLeft",
|
|
|
|
AS_GLOBAL, WXK_LEFT, "", "" , NULL, AF_NONE, (void*) CURSOR_LEFT );
|
|
|
|
TOOL_ACTION PCB_ACTIONS::cursorRight( "pcbnew.Control.cursorRight",
|
|
|
|
AS_GLOBAL, WXK_RIGHT, "", "" , NULL, AF_NONE, (void*) CURSOR_RIGHT );
|
|
|
|
|
|
|
|
TOOL_ACTION PCB_ACTIONS::cursorUpFast( "pcbnew.Control.cursorUpFast",
|
|
|
|
AS_GLOBAL, MD_CTRL + WXK_UP, "", "", NULL, AF_NONE, (void*) ( CURSOR_UP | CURSOR_FAST_MOVE ) );
|
|
|
|
TOOL_ACTION PCB_ACTIONS::cursorDownFast( "pcbnew.Control.cursorDownFast",
|
|
|
|
AS_GLOBAL, MD_CTRL + WXK_DOWN, "", "" , NULL, AF_NONE, (void*) ( CURSOR_DOWN | CURSOR_FAST_MOVE ) );
|
|
|
|
TOOL_ACTION PCB_ACTIONS::cursorLeftFast( "pcbnew.Control.cursorLeftFast",
|
|
|
|
AS_GLOBAL, MD_CTRL + WXK_LEFT, "", "" , NULL, AF_NONE, (void*) ( CURSOR_LEFT | CURSOR_FAST_MOVE ) );
|
|
|
|
TOOL_ACTION PCB_ACTIONS::cursorRightFast( "pcbnew.Control.cursorRightFast",
|
|
|
|
AS_GLOBAL, MD_CTRL + WXK_RIGHT, "", "" , NULL, AF_NONE, (void*) ( CURSOR_RIGHT | CURSOR_FAST_MOVE ) );
|
|
|
|
|
|
|
|
TOOL_ACTION PCB_ACTIONS::cursorClick( "pcbnew.Control.cursorClick",
|
|
|
|
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_LEFT_CLICK ),
|
|
|
|
"", "", NULL, AF_NONE, (void*) CURSOR_CLICK );
|
|
|
|
TOOL_ACTION PCB_ACTIONS::cursorDblClick( "pcbnew.Control.cursorDblClick",
|
|
|
|
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_LEFT_DCLICK ),
|
|
|
|
"", "", NULL, AF_NONE, (void*) CURSOR_DBL_CLICK );
|
|
|
|
|
|
|
|
TOOL_ACTION PCB_ACTIONS::panUp( "pcbnew.Control.panUp",
|
|
|
|
AS_GLOBAL, MD_SHIFT + WXK_UP, "", "", NULL, AF_NONE, (void*) CURSOR_UP );
|
|
|
|
TOOL_ACTION PCB_ACTIONS::panDown( "pcbnew.Control.panDown",
|
|
|
|
AS_GLOBAL, MD_SHIFT + WXK_DOWN, "", "" , NULL, AF_NONE, (void*) CURSOR_DOWN );
|
|
|
|
TOOL_ACTION PCB_ACTIONS::panLeft( "pcbnew.Control.panLeft",
|
|
|
|
AS_GLOBAL, MD_SHIFT + WXK_LEFT, "", "" , NULL, AF_NONE, (void*) CURSOR_LEFT );
|
|
|
|
TOOL_ACTION PCB_ACTIONS::panRight( "pcbnew.Control.panRight",
|
|
|
|
AS_GLOBAL, MD_SHIFT + WXK_RIGHT, "", "" , NULL, AF_NONE, (void*) CURSOR_RIGHT );
|
|
|
|
|
|
|
|
// Miscellaneous
|
|
|
|
TOOL_ACTION PCB_ACTIONS::selectionTool( "pcbnew.Control.selectionTool",
|
|
|
|
AS_GLOBAL, 0,
|
|
|
|
"", "", NULL, AF_ACTIVATE );
|
|
|
|
|
|
|
|
TOOL_ACTION PCB_ACTIONS::zoomTool( "pcbnew.Control.zoomTool",
|
|
|
|
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ZOOM_SELECTION ),
|
|
|
|
_( "Zoom to Selection" ), "", 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,
|
|
|
|
"", "" );
|
|
|
|
|
|
|
|
TOOL_ACTION PCB_ACTIONS::showHelp( "pcbnew.Control.showHelp",
|
|
|
|
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_HELP ),
|
|
|
|
"", "" );
|
|
|
|
|
|
|
|
TOOL_ACTION PCB_ACTIONS::toBeDone( "pcbnew.Control.toBeDone",
|
|
|
|
AS_GLOBAL, 0, // dialog saying it is not implemented yet
|
|
|
|
"", "" ); // so users are aware of that
|
|
|
|
|
|
|
|
|
2014-03-24 07:45:05 +00:00
|
|
|
PCBNEW_CONTROL::PCBNEW_CONTROL() :
|
2015-02-15 22:21:52 +00:00
|
|
|
TOOL_INTERACTIVE( "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 )
|
|
|
|
{
|
|
|
|
m_gridOrigin->SetPosition( getModel<BOARD>()->GetGridOrigin() );
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-02-14 20:28:47 +00:00
|
|
|
int PCBNEW_CONTROL::TrackDisplayMode( const TOOL_EVENT& aEvent )
|
2014-03-24 07:45:05 +00:00
|
|
|
{
|
2016-12-02 17:58:12 +00:00
|
|
|
auto painter = static_cast<KIGFX::PCB_PAINTER*>( getView()->GetPainter() );
|
|
|
|
auto settings = painter->GetSettings();
|
2014-03-24 16:20:23 +00:00
|
|
|
|
|
|
|
// Apply new display options to the GAL canvas
|
2015-01-10 10:27:49 +00:00
|
|
|
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)m_frame->GetDisplayOptions();
|
|
|
|
displ_opts->m_DisplayPcbTrackFill = !displ_opts->m_DisplayPcbTrackFill;
|
|
|
|
settings->LoadDisplayOptions( displ_opts );
|
2014-03-24 16:20:23 +00:00
|
|
|
|
2014-07-09 13:02:56 +00:00
|
|
|
for( TRACK* track = getModel<BOARD>()->m_Track; track; track = track->Next() )
|
|
|
|
{
|
|
|
|
if( track->Type() == PCB_TRACE_T )
|
2016-12-02 17:58:12 +00:00
|
|
|
getView()->Update( track, KIGFX::GEOMETRY );
|
2014-07-09 13:02:56 +00:00
|
|
|
}
|
2014-03-24 16:20:23 +00:00
|
|
|
|
2014-07-09 13:02:56 +00:00
|
|
|
m_frame->GetGalCanvas()->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
|
|
|
{
|
2016-12-02 17:58:12 +00:00
|
|
|
auto painter = static_cast<KIGFX::PCB_PAINTER*>( getView()->GetPainter() );
|
|
|
|
auto settings = painter->GetSettings();
|
|
|
|
|
2015-01-10 10:27:49 +00:00
|
|
|
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)m_frame->GetDisplayOptions();
|
2014-07-09 13:02:56 +00:00
|
|
|
|
|
|
|
// Apply new display options to the GAL canvas
|
2015-01-10 10:27:49 +00:00
|
|
|
displ_opts->m_DisplayPadFill = !displ_opts->m_DisplayPadFill;
|
|
|
|
settings->LoadDisplayOptions( displ_opts );
|
2014-07-09 13:02:56 +00:00
|
|
|
|
|
|
|
for( MODULE* module = getModel<BOARD>()->m_Modules; module; module = module->Next() )
|
|
|
|
{
|
2017-04-25 09:06:24 +00:00
|
|
|
for( auto pad : module->Pads() )
|
2016-12-02 17:58:12 +00:00
|
|
|
getView()->Update( pad, KIGFX::GEOMETRY );
|
2014-07-09 13:02:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
m_frame->GetGalCanvas()->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
|
|
|
{
|
2016-12-02 17:58:12 +00:00
|
|
|
auto painter = static_cast<KIGFX::PCB_PAINTER*>( getView()->GetPainter() );
|
|
|
|
auto settings = painter->GetSettings();
|
2015-01-10 10:27:49 +00:00
|
|
|
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)m_frame->GetDisplayOptions();
|
2014-03-24 16:20:23 +00:00
|
|
|
|
|
|
|
// Apply new display options to the GAL canvas
|
2015-01-10 10:27:49 +00:00
|
|
|
displ_opts->m_DisplayViaFill = !displ_opts->m_DisplayViaFill;
|
|
|
|
settings->LoadDisplayOptions( displ_opts );
|
2014-03-24 16:20:23 +00:00
|
|
|
|
2014-07-09 13:02:56 +00:00
|
|
|
for( TRACK* track = getModel<BOARD>()->m_Track; track; track = track->Next() )
|
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 )
|
2016-12-02 17:58:12 +00:00
|
|
|
getView()->Update( track, KIGFX::GEOMETRY );
|
2014-03-24 16:20:23 +00:00
|
|
|
}
|
|
|
|
|
2014-07-09 13:02:56 +00:00
|
|
|
m_frame->GetGalCanvas()->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
|
|
|
{
|
2016-12-02 17:58:12 +00:00
|
|
|
auto painter = static_cast<KIGFX::PCB_PAINTER*>( getView()->GetPainter() );
|
|
|
|
auto settings = painter->GetSettings();
|
2015-01-10 10:27:49 +00:00
|
|
|
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)m_frame->GetDisplayOptions();
|
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 ) )
|
2015-01-10 10:27:49 +00:00
|
|
|
displ_opts->m_DisplayZonesMode = 0;
|
2017-02-21 12:42:08 +00:00
|
|
|
else if( aEvent.IsAction( &PCB_ACTIONS::zoneDisplayDisable ) )
|
2015-01-10 10:27:49 +00:00
|
|
|
displ_opts->m_DisplayZonesMode = 1;
|
2017-02-21 12:42:08 +00:00
|
|
|
else if( aEvent.IsAction( &PCB_ACTIONS::zoneDisplayOutlines ) )
|
2015-01-10 10:27:49 +00:00
|
|
|
displ_opts->m_DisplayZonesMode = 2;
|
2014-07-09 13:02:56 +00:00
|
|
|
else
|
|
|
|
assert( false );
|
|
|
|
|
2015-01-10 10:27:49 +00:00
|
|
|
settings->LoadDisplayOptions( displ_opts );
|
2014-07-09 13:02:56 +00:00
|
|
|
|
|
|
|
BOARD* board = getModel<BOARD>();
|
|
|
|
for( int i = 0; i < board->GetAreaCount(); ++i )
|
2016-12-02 17:58:12 +00:00
|
|
|
getView()->Update( board->GetArea( i ), KIGFX::GEOMETRY );
|
2014-07-09 13:02:56 +00:00
|
|
|
|
|
|
|
m_frame->GetGalCanvas()->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
|
|
|
{
|
2016-12-02 17:58:12 +00:00
|
|
|
auto painter = static_cast<KIGFX::PCB_PAINTER*>( getView()->GetPainter() );
|
|
|
|
auto settings = painter->GetSettings();
|
2015-01-10 10:27:49 +00:00
|
|
|
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)m_frame->GetDisplayOptions();
|
2014-03-24 16:20:23 +00:00
|
|
|
|
2015-01-10 10:27:49 +00:00
|
|
|
displ_opts->m_ContrastModeDisplay = !displ_opts->m_ContrastModeDisplay;
|
|
|
|
settings->LoadDisplayOptions( displ_opts );
|
2014-07-09 08:57:32 +00:00
|
|
|
m_frame->GetGalCanvas()->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;
|
|
|
|
|
2014-07-09 14:25:50 +00:00
|
|
|
int layerCount = getModel<BOARD>()->GetCopperLayerCount();
|
|
|
|
|
|
|
|
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
|
|
|
|
2014-07-09 14:44:22 +00:00
|
|
|
assert( IsCopperLayer( layer ) );
|
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;
|
|
|
|
|
2014-07-09 14:25:50 +00:00
|
|
|
int layerCount = getModel<BOARD>()->GetCopperLayerCount();
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
assert( IsCopperLayer( layer ) );
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-02-14 20:28:47 +00:00
|
|
|
int PCBNEW_CONTROL::LayerAlphaInc( const TOOL_EVENT& aEvent )
|
2014-03-24 07:45:05 +00:00
|
|
|
{
|
2016-12-02 17:58:12 +00:00
|
|
|
auto painter = static_cast<KIGFX::PCB_PAINTER*>( getView()->GetPainter() );
|
|
|
|
auto settings = painter->GetSettings();
|
2014-03-24 17:28:21 +00:00
|
|
|
|
|
|
|
LAYER_NUM currentLayer = m_frame->GetActiveLayer();
|
|
|
|
KIGFX::COLOR4D currentColor = settings->GetLayerColor( currentLayer );
|
|
|
|
|
|
|
|
if( currentColor.a <= 0.95 )
|
|
|
|
{
|
|
|
|
currentColor.a += 0.05;
|
|
|
|
settings->SetLayerColor( currentLayer, currentColor );
|
|
|
|
m_frame->GetGalCanvas()->GetView()->UpdateLayerColor( currentLayer );
|
|
|
|
}
|
|
|
|
|
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
|
|
|
{
|
2016-12-02 17:58:12 +00:00
|
|
|
auto painter = static_cast<KIGFX::PCB_PAINTER*>( getView()->GetPainter() );
|
|
|
|
auto settings = painter->GetSettings();
|
2014-03-24 17:28:21 +00:00
|
|
|
|
|
|
|
LAYER_NUM currentLayer = m_frame->GetActiveLayer();
|
|
|
|
KIGFX::COLOR4D currentColor = settings->GetLayerColor( currentLayer );
|
|
|
|
|
|
|
|
if( currentColor.a >= 0.05 )
|
|
|
|
{
|
|
|
|
currentColor.a -= 0.05;
|
|
|
|
settings->SetLayerColor( currentLayer, currentColor );
|
|
|
|
m_frame->GetGalCanvas()->GetView()->UpdateLayerColor( currentLayer );
|
|
|
|
}
|
|
|
|
|
2014-03-24 07:45:05 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-06-30 12:08:24 +00:00
|
|
|
// Cursor control
|
|
|
|
int PCBNEW_CONTROL::CursorControl( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
2016-09-21 19:22:19 +00:00
|
|
|
long type = aEvent.Parameter<intptr_t>();
|
2017-02-21 12:42:08 +00:00
|
|
|
bool fastMove = type & PCB_ACTIONS::CURSOR_FAST_MOVE;
|
|
|
|
type &= ~PCB_ACTIONS::CURSOR_FAST_MOVE;
|
2016-12-12 15:43:43 +00:00
|
|
|
bool mirroredX = getView()->IsMirroredX();
|
2015-06-30 12:08:24 +00:00
|
|
|
|
|
|
|
GRID_HELPER gridHelper( m_frame );
|
|
|
|
VECTOR2D cursor = getViewControls()->GetCursorPosition();
|
|
|
|
VECTOR2I gridSize = gridHelper.GetGrid();
|
|
|
|
VECTOR2D newCursor = gridHelper.Align( cursor );
|
|
|
|
|
|
|
|
if( fastMove )
|
|
|
|
gridSize = gridSize * 10;
|
|
|
|
|
|
|
|
switch( type )
|
|
|
|
{
|
2017-02-21 12:42:08 +00:00
|
|
|
case PCB_ACTIONS::CURSOR_UP:
|
2015-06-30 12:08:24 +00:00
|
|
|
newCursor -= VECTOR2D( 0, gridSize.y );
|
|
|
|
break;
|
|
|
|
|
2017-02-21 12:42:08 +00:00
|
|
|
case PCB_ACTIONS::CURSOR_DOWN:
|
2015-06-30 12:08:24 +00:00
|
|
|
newCursor += VECTOR2D( 0, gridSize.y );
|
|
|
|
break;
|
|
|
|
|
2017-02-21 12:42:08 +00:00
|
|
|
case PCB_ACTIONS::CURSOR_LEFT:
|
2016-12-12 15:43:43 +00:00
|
|
|
newCursor -= VECTOR2D( mirroredX ? -gridSize.x : gridSize.x, 0 );
|
2015-06-30 12:08:24 +00:00
|
|
|
break;
|
|
|
|
|
2017-02-21 12:42:08 +00:00
|
|
|
case PCB_ACTIONS::CURSOR_RIGHT:
|
2016-12-12 15:43:43 +00:00
|
|
|
newCursor += VECTOR2D( mirroredX ? -gridSize.x : gridSize.x, 0 );
|
2015-06-30 12:08:24 +00:00
|
|
|
break;
|
|
|
|
|
2017-02-21 12:42:08 +00:00
|
|
|
case PCB_ACTIONS::CURSOR_CLICK: // fall through
|
|
|
|
case PCB_ACTIONS::CURSOR_DBL_CLICK:
|
2015-07-07 16:36:52 +00:00
|
|
|
{
|
2016-01-11 22:12:49 +00:00
|
|
|
TOOL_ACTIONS action = TA_NONE;
|
2015-07-07 16:36:52 +00:00
|
|
|
int modifiers = 0;
|
|
|
|
|
|
|
|
modifiers |= wxGetKeyState( WXK_SHIFT ) ? MD_SHIFT : 0;
|
|
|
|
modifiers |= wxGetKeyState( WXK_CONTROL ) ? MD_CTRL : 0;
|
|
|
|
modifiers |= wxGetKeyState( WXK_ALT ) ? MD_ALT : 0;
|
|
|
|
|
2017-02-21 12:42:08 +00:00
|
|
|
if( type == PCB_ACTIONS::CURSOR_CLICK )
|
2015-07-07 16:36:52 +00:00
|
|
|
action = TA_MOUSE_CLICK;
|
2017-02-21 12:42:08 +00:00
|
|
|
else if( type == PCB_ACTIONS::CURSOR_DBL_CLICK )
|
2015-07-07 16:36:52 +00:00
|
|
|
action = TA_MOUSE_DBLCLICK;
|
|
|
|
else
|
|
|
|
assert( false );
|
|
|
|
|
|
|
|
TOOL_EVENT evt( TC_MOUSE, action, BUT_LEFT | modifiers );
|
|
|
|
evt.SetMousePosition( getViewControls()->GetCursorPosition() );
|
|
|
|
m_toolMgr->ProcessEvent( evt );
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
break;
|
2015-06-30 12:08:24 +00:00
|
|
|
}
|
|
|
|
|
2015-07-07 16:36:52 +00:00
|
|
|
// Handler cursor movement
|
|
|
|
KIGFX::VIEW* view = getView();
|
|
|
|
newCursor = view->ToScreen( newCursor );
|
2015-07-17 08:26:48 +00:00
|
|
|
newCursor.x = KiROUND( newCursor.x );
|
|
|
|
newCursor.y = KiROUND( newCursor.y );
|
2015-07-07 16:36:52 +00:00
|
|
|
|
|
|
|
// Pan the screen if required
|
|
|
|
const VECTOR2I& screenSize = view->GetGAL()->GetScreenPixelSize();
|
|
|
|
BOX2I screenBox( VECTOR2I( 0, 0 ), screenSize );
|
2015-06-30 12:08:24 +00:00
|
|
|
|
2015-07-07 16:36:52 +00:00
|
|
|
if( !screenBox.Contains( newCursor ) )
|
|
|
|
{
|
|
|
|
VECTOR2D delta( 0, 0 );
|
2015-06-30 12:08:24 +00:00
|
|
|
|
2015-07-07 16:36:52 +00:00
|
|
|
if( newCursor.x < screenBox.GetLeft() )
|
|
|
|
{
|
|
|
|
delta.x = newCursor.x - screenBox.GetLeft();
|
|
|
|
newCursor.x = screenBox.GetLeft();
|
|
|
|
}
|
|
|
|
else if( newCursor.x > screenBox.GetRight() )
|
2015-06-30 12:08:24 +00:00
|
|
|
{
|
2015-07-07 16:36:52 +00:00
|
|
|
delta.x = newCursor.x - screenBox.GetRight();
|
|
|
|
// -1 is to keep the cursor within the drawing area,
|
|
|
|
// so the cursor coordinates are still updated
|
|
|
|
newCursor.x = screenBox.GetRight() - 1;
|
2015-06-30 12:08:24 +00:00
|
|
|
}
|
|
|
|
|
2015-07-07 16:36:52 +00:00
|
|
|
if( newCursor.y < screenBox.GetTop() )
|
|
|
|
{
|
|
|
|
delta.y = newCursor.y - screenBox.GetTop();
|
|
|
|
newCursor.y = screenBox.GetTop();
|
|
|
|
}
|
|
|
|
else if( newCursor.y > screenBox.GetBottom() )
|
|
|
|
{
|
|
|
|
delta.y = newCursor.y - screenBox.GetBottom();
|
|
|
|
// -1 is to keep the cursor within the drawing area,
|
|
|
|
// so the cursor coordinates are still updated
|
|
|
|
newCursor.y = screenBox.GetBottom() - 1;
|
|
|
|
}
|
2015-07-03 18:58:12 +00:00
|
|
|
|
2015-07-07 16:36:52 +00:00
|
|
|
view->SetCenter( view->GetCenter() + view->ToWorld( delta, false ) );
|
2015-06-30 12:08:24 +00:00
|
|
|
}
|
|
|
|
|
2015-07-07 16:36:52 +00:00
|
|
|
m_frame->GetGalCanvas()->WarpPointer( newCursor.x, newCursor.y );
|
|
|
|
|
2015-06-30 12:08:24 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-06-30 12:08:29 +00:00
|
|
|
int PCBNEW_CONTROL::PanControl( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
2016-09-21 19:22:19 +00:00
|
|
|
long type = aEvent.Parameter<intptr_t>();
|
2015-06-30 12:08:29 +00:00
|
|
|
KIGFX::VIEW* view = getView();
|
|
|
|
GRID_HELPER gridHelper( m_frame );
|
|
|
|
VECTOR2D center = view->GetCenter();
|
|
|
|
VECTOR2I gridSize = gridHelper.GetGrid() * 10;
|
2016-12-12 15:43:43 +00:00
|
|
|
bool mirroredX = view->IsMirroredX();
|
2015-06-30 12:08:29 +00:00
|
|
|
|
|
|
|
switch( type )
|
|
|
|
{
|
2017-02-21 12:42:08 +00:00
|
|
|
case PCB_ACTIONS::CURSOR_UP:
|
2015-06-30 12:08:29 +00:00
|
|
|
center -= VECTOR2D( 0, gridSize.y );
|
|
|
|
break;
|
|
|
|
|
2017-02-21 12:42:08 +00:00
|
|
|
case PCB_ACTIONS::CURSOR_DOWN:
|
2015-06-30 12:08:29 +00:00
|
|
|
center += VECTOR2D( 0, gridSize.y );
|
|
|
|
break;
|
|
|
|
|
2017-02-21 12:42:08 +00:00
|
|
|
case PCB_ACTIONS::CURSOR_LEFT:
|
2016-12-12 15:43:43 +00:00
|
|
|
center -= VECTOR2D( mirroredX ? -gridSize.x : gridSize.x, 0 );
|
2015-06-30 12:08:29 +00:00
|
|
|
break;
|
|
|
|
|
2017-02-21 12:42:08 +00:00
|
|
|
case PCB_ACTIONS::CURSOR_RIGHT:
|
2016-12-12 15:43:43 +00:00
|
|
|
center += VECTOR2D( mirroredX ? -gridSize.x : gridSize.x, 0 );
|
2015-06-30 12:08:29 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
assert( false );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
view->SetCenter( center );
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-03-24 07:45:05 +00:00
|
|
|
// 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;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-06-18 15:51:53 +00:00
|
|
|
static bool setOrigin( KIGFX::VIEW* aView, PCB_BASE_FRAME* aFrame,
|
|
|
|
KIGFX::ORIGIN_VIEWITEM* aItem, 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 );
|
2015-06-18 15:51:53 +00:00
|
|
|
aItem->SetPosition( aPoint );
|
2015-06-18 15:51:51 +00:00
|
|
|
aView->MarkDirty();
|
2014-06-04 15:46:43 +00:00
|
|
|
|
2015-06-18 15:51:51 +00:00
|
|
|
return true;
|
|
|
|
}
|
2014-06-04 15:46:43 +00:00
|
|
|
|
|
|
|
|
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 )
|
|
|
|
{
|
2017-03-02 22:57:13 +00:00
|
|
|
setOrigin( getView(), m_frame, m_gridOrigin.get(), *origin );
|
2015-06-30 12:08:03 +00:00
|
|
|
delete origin;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
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>();
|
|
|
|
assert( picker );
|
|
|
|
|
|
|
|
// 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" ) );
|
2017-03-02 22:57:13 +00:00
|
|
|
picker->SetClickHandler( std::bind( setOrigin, 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 )
|
|
|
|
{
|
|
|
|
getModel<BOARD>()->SetGridOrigin( wxPoint( 0, 0 ) );
|
|
|
|
m_gridOrigin->SetPosition( VECTOR2D( 0, 0 ) );
|
|
|
|
|
|
|
|
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
|
|
|
{
|
2014-03-24 17:28:21 +00:00
|
|
|
VECTOR2I cursorPos = getViewControls()->GetCursorPosition();
|
|
|
|
|
|
|
|
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 );
|
|
|
|
|
|
|
|
if( g_UserUnit == INCHES )
|
|
|
|
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>();
|
|
|
|
assert( selectionTool );
|
|
|
|
|
2017-02-21 12:42:08 +00:00
|
|
|
aToolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
|
|
|
|
aToolMgr->RunAction( PCB_ACTIONS::selectionCursor, true );
|
2015-06-18 15:51:51 +00:00
|
|
|
selectionTool->SanitizeSelection();
|
|
|
|
|
2015-09-08 09:17:30 +00:00
|
|
|
const SELECTION& selection = selectionTool->GetSelection();
|
|
|
|
|
|
|
|
if( selection.Empty() )
|
2015-06-18 15:51:51 +00:00
|
|
|
return true;
|
|
|
|
|
2016-11-04 21:29:47 +00:00
|
|
|
bool canBeRemoved = ( selection.Front()->Type() != PCB_MODULE_T );
|
2015-09-08 09:17:30 +00:00
|
|
|
|
|
|
|
if( canBeRemoved || IsOK( aToolMgr->GetEditFrame(), _( "Are you sure you want to delete item?" ) ) )
|
2017-02-21 12:42:08 +00:00
|
|
|
aToolMgr->RunAction( PCB_ACTIONS::remove, true );
|
2015-07-24 08:58:47 +00:00
|
|
|
else
|
2017-02-21 12:42:08 +00:00
|
|
|
aToolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
|
2015-06-18 15:51:51 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int PCBNEW_CONTROL::DeleteItemCursor( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
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>();
|
|
|
|
assert( picker );
|
|
|
|
|
|
|
|
// TODO it will not check the toolbar button in the module editor, as it uses a different ID..
|
2017-06-12 13:10:43 +00:00
|
|
|
m_frame->SetToolID( 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;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-08-07 16:24:42 +00:00
|
|
|
int PCBNEW_CONTROL::AppendBoard( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
|
|
|
int open_ctl;
|
|
|
|
wxString fileName;
|
|
|
|
|
|
|
|
PCB_EDIT_FRAME* editFrame = dynamic_cast<PCB_EDIT_FRAME*>( m_frame );
|
|
|
|
|
|
|
|
if( !editFrame )
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
// Pick a file to append
|
|
|
|
if( !AskLoadBoardFileName( editFrame, &open_ctl, &fileName, true ) )
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
IO_MGR::PCB_FILE_T pluginType = plugin_type( fileName, open_ctl );
|
|
|
|
PLUGIN::RELEASER pi( IO_MGR::PluginFind( pluginType ) );
|
|
|
|
|
2017-04-18 18:10:06 +00:00
|
|
|
// Mark existing tracks, in order to know what are the new tracks
|
|
|
|
// Tracks are inserted, not appended, so mark existing tracks to be
|
|
|
|
// able to select the new tracks only later
|
|
|
|
BOARD* board = getModel<BOARD>();
|
2015-08-07 16:24:42 +00:00
|
|
|
|
|
|
|
for( TRACK* track = board->m_Track; track; track = track->Next() )
|
|
|
|
track->SetFlags( FLAG0 );
|
|
|
|
|
|
|
|
// Other items are appended to the item list, so keep trace to the last existing item is enough
|
|
|
|
MODULE* module = board->m_Modules.GetLast();
|
2016-09-27 18:04:30 +00:00
|
|
|
BOARD_ITEM* drawing = board->DrawingsList().GetLast();
|
2015-08-07 16:24:42 +00:00
|
|
|
int zonescount = board->GetAreaCount();
|
|
|
|
|
|
|
|
// Keep also the count of copper layers, to adjust if necessary
|
|
|
|
int initialCopperLayerCount = board->GetCopperLayerCount();
|
|
|
|
LSET initialEnabledLayers = board->GetEnabledLayers();
|
|
|
|
|
|
|
|
// 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();
|
|
|
|
pi->Load( fileName, board, &props );
|
|
|
|
}
|
|
|
|
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
|
|
|
|
board->BuildListOfNets();
|
|
|
|
board->SynchronizeNetsAndNetClasses();
|
2017-04-24 20:26:11 +00:00
|
|
|
board->GetConnectivity()->Build( board );
|
2017-04-22 07:23:02 +00:00
|
|
|
|
2017-02-21 12:42:08 +00:00
|
|
|
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
|
2015-08-07 16:24:42 +00:00
|
|
|
|
2017-04-18 18:10:06 +00:00
|
|
|
SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<SELECTION_TOOL>();
|
|
|
|
SELECTION& selection = selectionTool->GetSelection();
|
|
|
|
BOARD_COMMIT commit( editFrame );
|
|
|
|
|
2015-08-07 16:24:42 +00:00
|
|
|
// Process the new items
|
|
|
|
for( TRACK* track = board->m_Track; track; track = track->Next() )
|
|
|
|
{
|
|
|
|
if( track->GetFlags() & FLAG0 )
|
|
|
|
{
|
|
|
|
track->ClearFlags( FLAG0 );
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2016-08-19 12:03:49 +00:00
|
|
|
commit.Added( track );
|
2017-04-18 18:10:06 +00:00
|
|
|
selection.Add( track );
|
2015-08-07 16:24:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
module = module ? module->Next() : board->m_Modules;
|
|
|
|
|
|
|
|
for( ; module; module = module->Next() )
|
|
|
|
{
|
2016-08-19 12:03:49 +00:00
|
|
|
commit.Added( module );
|
2017-04-18 18:10:06 +00:00
|
|
|
selection.Add( module );
|
2015-08-07 16:24:42 +00:00
|
|
|
}
|
|
|
|
|
2016-09-27 18:04:30 +00:00
|
|
|
drawing = drawing ? drawing->Next() : board->DrawingsList();
|
2015-08-07 16:24:42 +00:00
|
|
|
|
|
|
|
for( ; drawing; drawing = drawing->Next() )
|
|
|
|
{
|
2016-08-19 12:03:49 +00:00
|
|
|
commit.Added( drawing );
|
2017-04-18 18:10:06 +00:00
|
|
|
selection.Add( drawing );
|
2015-08-07 16:24:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for( ZONE_CONTAINER* zone = board->GetArea( zonescount ); zone;
|
|
|
|
zone = board->GetArea( zonescount ) )
|
|
|
|
{
|
2016-06-21 15:06:28 +00:00
|
|
|
++zonescount;
|
2016-08-19 12:03:49 +00:00
|
|
|
commit.Added( zone );
|
2017-04-18 18:10:06 +00:00
|
|
|
selection.Add( zone );
|
2015-08-07 16:24:42 +00:00
|
|
|
}
|
|
|
|
|
2016-06-21 15:06:28 +00:00
|
|
|
if( commit.Empty() )
|
2015-08-07 16:24:42 +00:00
|
|
|
return 0;
|
|
|
|
|
2016-06-21 15:06:28 +00:00
|
|
|
commit.Push( _( "Append a board" ) );
|
2015-08-07 16:24:42 +00:00
|
|
|
|
|
|
|
// Synchronize layers
|
|
|
|
// we should not ask PLUGINs to do these items:
|
|
|
|
int copperLayerCount = board->GetCopperLayerCount();
|
|
|
|
|
|
|
|
if( copperLayerCount > initialCopperLayerCount )
|
|
|
|
board->SetCopperLayerCount( copperLayerCount );
|
|
|
|
|
|
|
|
// Enable all used layers, and make them visible:
|
|
|
|
LSET enabledLayers = board->GetEnabledLayers();
|
|
|
|
enabledLayers |= initialEnabledLayers;
|
|
|
|
board->SetEnabledLayers( enabledLayers );
|
|
|
|
board->SetVisibleLayers( enabledLayers );
|
|
|
|
editFrame->ReCreateLayerBox();
|
|
|
|
editFrame->ReFillLayerWidget();
|
|
|
|
static_cast<PCB_DRAW_PANEL_GAL*>( editFrame->GetGalCanvas() )->SyncLayersVisibility( board );
|
|
|
|
|
|
|
|
// Start dragging the appended board
|
2017-04-19 12:15:11 +00:00
|
|
|
if( selection.Size() ) // be sure at least one item is loaded
|
2017-04-18 18:10:06 +00:00
|
|
|
{
|
|
|
|
// Inform other potentially interested tools
|
|
|
|
m_toolMgr->ProcessEvent( SELECTION_TOOL::SelectedEvent );
|
|
|
|
|
|
|
|
VECTOR2D v( static_cast<BOARD_ITEM*>( selection.Front() )->GetPosition() );
|
|
|
|
getViewControls()->WarpCursor( v, true, true );
|
|
|
|
m_toolMgr->InvokeTool( "pcbnew.InteractiveEdit" );
|
|
|
|
}
|
2015-08-07 16:24:42 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-02-14 20:28:47 +00:00
|
|
|
int PCBNEW_CONTROL::ShowHelp( 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;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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() );
|
|
|
|
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
|
|
|
|
2015-06-30 12:08:24 +00:00
|
|
|
// Cursor control
|
2017-02-21 12:42:08 +00:00
|
|
|
Go( &PCBNEW_CONTROL::CursorControl, PCB_ACTIONS::cursorUp.MakeEvent() );
|
|
|
|
Go( &PCBNEW_CONTROL::CursorControl, PCB_ACTIONS::cursorDown.MakeEvent() );
|
|
|
|
Go( &PCBNEW_CONTROL::CursorControl, PCB_ACTIONS::cursorLeft.MakeEvent() );
|
|
|
|
Go( &PCBNEW_CONTROL::CursorControl, PCB_ACTIONS::cursorRight.MakeEvent() );
|
|
|
|
Go( &PCBNEW_CONTROL::CursorControl, PCB_ACTIONS::cursorUpFast.MakeEvent() );
|
|
|
|
Go( &PCBNEW_CONTROL::CursorControl, PCB_ACTIONS::cursorDownFast.MakeEvent() );
|
|
|
|
Go( &PCBNEW_CONTROL::CursorControl, PCB_ACTIONS::cursorLeftFast.MakeEvent() );
|
|
|
|
Go( &PCBNEW_CONTROL::CursorControl, PCB_ACTIONS::cursorRightFast.MakeEvent() );
|
|
|
|
Go( &PCBNEW_CONTROL::CursorControl, PCB_ACTIONS::cursorClick.MakeEvent() );
|
|
|
|
Go( &PCBNEW_CONTROL::CursorControl, PCB_ACTIONS::cursorDblClick.MakeEvent() );
|
2015-06-30 12:08:24 +00:00
|
|
|
|
2015-06-30 12:08:29 +00:00
|
|
|
// Pan control
|
2017-02-21 12:42:08 +00:00
|
|
|
Go( &PCBNEW_CONTROL::PanControl, PCB_ACTIONS::panUp.MakeEvent() );
|
|
|
|
Go( &PCBNEW_CONTROL::PanControl, PCB_ACTIONS::panDown.MakeEvent() );
|
|
|
|
Go( &PCBNEW_CONTROL::PanControl, PCB_ACTIONS::panLeft.MakeEvent() );
|
|
|
|
Go( &PCBNEW_CONTROL::PanControl, PCB_ACTIONS::panRight.MakeEvent() );
|
2015-06-30 12:08:29 +00:00
|
|
|
|
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() );
|
|
|
|
Go( &PCBNEW_CONTROL::AppendBoard, PCB_ACTIONS::appendBoard.MakeEvent() );
|
|
|
|
Go( &PCBNEW_CONTROL::ShowHelp, PCB_ACTIONS::showHelp.MakeEvent() );
|
|
|
|
Go( &PCBNEW_CONTROL::ToBeDone, PCB_ACTIONS::toBeDone.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 );
|
|
|
|
}
|