2011-12-16 13:32:23 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2012-06-08 09:56:42 +00:00
|
|
|
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
|
|
|
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
2018-11-28 14:58:41 +00:00
|
|
|
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@gmail.com>
|
2018-01-08 04:05:03 +00:00
|
|
|
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
|
2011-12-16 13:32:23 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2011-09-16 18:54:04 +00:00
|
|
|
/**
|
2018-01-31 16:09:26 +00:00
|
|
|
* @file tool_pcb_editor.cpp
|
|
|
|
* @brief PCB editor toolbars build/rebuild functions
|
2011-09-16 18:54:04 +00:00
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <fctsys.h>
|
2014-06-11 05:18:41 +00:00
|
|
|
#include <kiface_i.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <help_common_strings.h>
|
|
|
|
#include <dialog_helpers.h>
|
2018-01-29 20:58:58 +00:00
|
|
|
#include <pcb_edit_frame.h>
|
2015-10-14 18:12:17 +00:00
|
|
|
#include <class_drawpanel.h>
|
|
|
|
#include <confirm.h>
|
2017-02-20 12:20:39 +00:00
|
|
|
#include <bitmaps.h>
|
2011-09-23 13:57:12 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <class_board.h>
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <pcbnew.h>
|
|
|
|
#include <pcbnew_id.h>
|
|
|
|
#include <hotkeys.h>
|
2018-01-31 08:23:20 +00:00
|
|
|
#include <pcb_layer_box_selector.h>
|
2018-06-19 09:27:38 +00:00
|
|
|
#include <view/view.h>
|
2011-09-16 18:54:04 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <wx/wupdlock.h>
|
2018-01-08 04:05:03 +00:00
|
|
|
#include <memory>
|
2018-05-14 17:34:18 +00:00
|
|
|
#include <pgm_base.h>
|
2011-09-16 18:54:04 +00:00
|
|
|
|
2015-07-09 16:44:23 +00:00
|
|
|
extern bool IsWxPythonLoaded();
|
|
|
|
|
2007-08-04 01:08:43 +00:00
|
|
|
#define SEL_LAYER_HELP _( \
|
|
|
|
"Show active layer selections\nand select layer pair for route and place via" )
|
2007-06-13 15:35:40 +00:00
|
|
|
|
2011-09-16 18:54:04 +00:00
|
|
|
|
2007-06-13 15:35:40 +00:00
|
|
|
/* Data to build the layer pair indicator button */
|
2018-01-08 04:05:03 +00:00
|
|
|
static std::unique_ptr<wxBitmap> LayerPairBitmap;
|
2007-09-11 04:17:46 +00:00
|
|
|
|
2013-01-18 14:12:57 +00:00
|
|
|
#define BM_LAYERICON_SIZE 24
|
|
|
|
static const char s_BitmapLayerIcon[BM_LAYERICON_SIZE][BM_LAYERICON_SIZE] =
|
|
|
|
{
|
2007-08-04 01:08:43 +00:00
|
|
|
// 0 = draw pixel with active layer color
|
2011-09-16 18:54:04 +00:00
|
|
|
// 1 = draw pixel with top layer color (top/bottom layer used inautoroute and place via)
|
2007-08-04 01:08:43 +00:00
|
|
|
// 2 = draw pixel with bottom layer color
|
|
|
|
// 3 = draw pixel with via color
|
2011-09-16 18:54:04 +00:00
|
|
|
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0 },
|
|
|
|
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0 },
|
|
|
|
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0 },
|
|
|
|
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0 },
|
|
|
|
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 },
|
|
|
|
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0 },
|
|
|
|
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 },
|
|
|
|
{ 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 0, 1, 1, 1, 1, 3, 0, 0, 0, 0, 0, 0, 0 },
|
|
|
|
{ 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 0, 1, 1, 1, 1, 3, 3, 2, 2, 2, 2, 2, 2, 2 },
|
|
|
|
{ 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 1, 1, 1, 1, 0, 3, 3, 2, 2, 2, 2, 2, 2, 2 },
|
|
|
|
{ 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 1, 1, 1, 1, 0, 3, 3, 2, 2, 2, 2, 2, 2, 2 },
|
|
|
|
{ 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 1, 1, 1, 0, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0 },
|
|
|
|
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
|
|
|
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
|
|
|
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
|
|
|
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
|
|
|
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
|
|
|
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
|
|
|
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
|
|
|
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
|
|
|
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
|
|
|
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
|
2007-06-13 15:35:40 +00:00
|
|
|
};
|
2007-08-04 01:08:43 +00:00
|
|
|
|
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_EDIT_FRAME::PrepareLayerIndicator()
|
2007-06-13 15:35:40 +00:00
|
|
|
{
|
2007-08-04 01:08:43 +00:00
|
|
|
int ii, jj;
|
2017-02-20 16:57:41 +00:00
|
|
|
COLOR4D active_layer_color, Route_Layer_TOP_color,
|
2018-01-14 19:41:01 +00:00
|
|
|
Route_Layer_BOTTOM_color, via_color, background_color;
|
2007-08-04 01:08:43 +00:00
|
|
|
bool change = false;
|
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
static int previous_requested_scale;
|
2017-02-20 16:57:41 +00:00
|
|
|
static COLOR4D previous_active_layer_color, previous_Route_Layer_TOP_color,
|
2018-01-14 19:41:01 +00:00
|
|
|
previous_Route_Layer_BOTTOM_color, previous_via_color,
|
|
|
|
previous_background_color;
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2018-05-14 17:34:18 +00:00
|
|
|
int requested_scale;
|
|
|
|
Pgm().CommonSettings()->Read( ICON_SCALE_KEY, &requested_scale, 0 );
|
2018-01-08 04:05:03 +00:00
|
|
|
|
|
|
|
if( requested_scale != previous_requested_scale )
|
|
|
|
{
|
|
|
|
previous_requested_scale = requested_scale;
|
|
|
|
change = true;
|
|
|
|
}
|
|
|
|
|
2017-08-04 12:43:02 +00:00
|
|
|
active_layer_color = Settings().Colors().GetLayerColor(GetActiveLayer());
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2007-08-04 01:08:43 +00:00
|
|
|
if( previous_active_layer_color != active_layer_color )
|
|
|
|
{
|
|
|
|
previous_active_layer_color = active_layer_color;
|
2009-10-01 16:46:13 +00:00
|
|
|
change = true;
|
2007-08-04 01:08:43 +00:00
|
|
|
}
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
Route_Layer_TOP_color =
|
2017-08-04 12:43:02 +00:00
|
|
|
Settings().Colors().GetLayerColor( GetScreen()->m_Route_Layer_TOP );
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2007-08-04 01:08:43 +00:00
|
|
|
if( previous_Route_Layer_TOP_color != Route_Layer_TOP_color )
|
|
|
|
{
|
|
|
|
previous_Route_Layer_TOP_color = Route_Layer_TOP_color;
|
2009-10-01 16:46:13 +00:00
|
|
|
change = true;
|
2007-08-04 01:08:43 +00:00
|
|
|
}
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
Route_Layer_BOTTOM_color =
|
2017-08-04 12:43:02 +00:00
|
|
|
Settings().Colors().GetLayerColor( GetScreen()->m_Route_Layer_BOTTOM );
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2007-08-04 01:08:43 +00:00
|
|
|
if( previous_Route_Layer_BOTTOM_color != Route_Layer_BOTTOM_color )
|
|
|
|
{
|
|
|
|
previous_Route_Layer_BOTTOM_color = Route_Layer_BOTTOM_color;
|
2009-10-01 16:46:13 +00:00
|
|
|
change = true;
|
2007-08-04 01:08:43 +00:00
|
|
|
}
|
2010-01-31 20:01:46 +00:00
|
|
|
|
2012-02-02 17:45:37 +00:00
|
|
|
int via_type = GetDesignSettings().m_CurrentViaType;
|
2017-08-04 12:43:02 +00:00
|
|
|
via_color = Settings().Colors().GetItemColor( LAYER_VIAS + via_type );
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2007-08-04 01:08:43 +00:00
|
|
|
if( previous_via_color != via_color )
|
|
|
|
{
|
|
|
|
previous_via_color = via_color;
|
2009-10-01 16:46:13 +00:00
|
|
|
change = true;
|
2007-08-04 01:08:43 +00:00
|
|
|
}
|
|
|
|
|
2018-01-14 19:41:01 +00:00
|
|
|
background_color = Settings().Colors().GetItemColor( LAYER_PCB_BACKGROUND );
|
|
|
|
|
|
|
|
if( previous_background_color != background_color )
|
|
|
|
{
|
|
|
|
previous_background_color = background_color;
|
|
|
|
change = true;
|
|
|
|
}
|
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
if( !change && LayerPairBitmap )
|
2007-08-04 01:08:43 +00:00
|
|
|
return;
|
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
LayerPairBitmap = std::make_unique<wxBitmap>( 24, 24 );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2009-11-20 14:55:20 +00:00
|
|
|
/* Draw the icon, with colors according to the active layer and layer
|
|
|
|
* pairs for via command (change layer)
|
2007-08-04 01:08:43 +00:00
|
|
|
*/
|
|
|
|
wxMemoryDC iconDC;
|
|
|
|
iconDC.SelectObject( *LayerPairBitmap );
|
2018-01-14 19:41:01 +00:00
|
|
|
wxBrush brush;
|
2007-08-04 01:08:43 +00:00
|
|
|
wxPen pen;
|
2011-09-16 18:54:04 +00:00
|
|
|
int buttonColor = -1;
|
2011-03-01 19:26:17 +00:00
|
|
|
|
2018-01-14 19:41:01 +00:00
|
|
|
brush.SetStyle( wxBRUSHSTYLE_SOLID );
|
|
|
|
brush.SetColour( background_color.WithAlpha(1.0).ToColour() );
|
|
|
|
iconDC.SetBrush( brush );
|
|
|
|
iconDC.DrawRectangle( 0, 0, BM_LAYERICON_SIZE, BM_LAYERICON_SIZE );
|
|
|
|
|
2013-01-18 14:12:57 +00:00
|
|
|
for( ii = 0; ii < BM_LAYERICON_SIZE; ii++ )
|
2007-08-04 01:08:43 +00:00
|
|
|
{
|
2013-01-18 14:12:57 +00:00
|
|
|
for( jj = 0; jj < BM_LAYERICON_SIZE; jj++ )
|
2007-08-04 01:08:43 +00:00
|
|
|
{
|
2011-09-16 18:54:04 +00:00
|
|
|
if( s_BitmapLayerIcon[ii][jj] != buttonColor )
|
2007-08-04 01:08:43 +00:00
|
|
|
{
|
2011-09-16 18:54:04 +00:00
|
|
|
switch( s_BitmapLayerIcon[ii][jj] )
|
2007-08-04 01:08:43 +00:00
|
|
|
{
|
|
|
|
default:
|
|
|
|
case 0:
|
2017-02-20 16:57:41 +00:00
|
|
|
pen.SetColour( active_layer_color.ToColour() );
|
2007-08-04 01:08:43 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
2017-02-20 16:57:41 +00:00
|
|
|
pen.SetColour( Route_Layer_TOP_color.ToColour() );
|
2007-08-04 01:08:43 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
2017-02-20 16:57:41 +00:00
|
|
|
pen.SetColour( Route_Layer_BOTTOM_color.ToColour() );
|
2007-08-04 01:08:43 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
2017-02-20 16:57:41 +00:00
|
|
|
pen.SetColour( via_color.ToColour() );
|
2007-08-04 01:08:43 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2011-09-16 18:54:04 +00:00
|
|
|
buttonColor = s_BitmapLayerIcon[ii][jj];
|
2007-08-04 01:08:43 +00:00
|
|
|
iconDC.SetPen( pen );
|
|
|
|
}
|
2011-03-01 19:26:17 +00:00
|
|
|
|
2007-08-04 01:08:43 +00:00
|
|
|
iconDC.DrawPoint( jj, ii );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Deselect the Tool Bitmap from DC,
|
|
|
|
* in order to delete the MemoryDC safely without deleting the bitmap */
|
|
|
|
iconDC.SelectObject( wxNullBitmap );
|
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
// Scale the bitmap
|
|
|
|
const int scale = ( requested_scale <= 0 ) ? KiIconScale( this ) : requested_scale;
|
|
|
|
wxImage image = LayerPairBitmap->ConvertToImage();
|
|
|
|
|
|
|
|
// "NEAREST" causes less mixing of colors
|
|
|
|
image.Rescale( scale * image.GetWidth() / 4, scale * image.GetHeight() / 4,
|
|
|
|
wxIMAGE_QUALITY_NEAREST );
|
|
|
|
|
|
|
|
LayerPairBitmap = std::make_unique<wxBitmap>( image );
|
|
|
|
|
|
|
|
if( m_mainToolBar )
|
2007-08-04 01:08:43 +00:00
|
|
|
{
|
2011-12-16 13:32:23 +00:00
|
|
|
m_mainToolBar->SetToolBitmap( ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR, *LayerPairBitmap );
|
|
|
|
m_mainToolBar->Refresh();
|
2007-08-04 01:08:43 +00:00
|
|
|
}
|
2007-06-13 15:35:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_EDIT_FRAME::ReCreateHToolbar()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2019-01-18 16:24:40 +00:00
|
|
|
// Note:
|
|
|
|
// To rebuild the aui toolbar, the more easy way is to clear ( calling m_mainToolBar.Clear() )
|
|
|
|
// all wxAuiToolBarItems.
|
|
|
|
// However the wxAuiToolBarItems are not the owners of controls managed by
|
|
|
|
// them and therefore do not delete them
|
|
|
|
// So we do not recreate them after clearing the tools.
|
|
|
|
|
2007-08-30 08:15:05 +00:00
|
|
|
wxString msg;
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2018-10-13 12:49:49 +00:00
|
|
|
wxWindowUpdateLocker dummy( this );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
if( m_mainToolBar )
|
|
|
|
m_mainToolBar->Clear();
|
|
|
|
else
|
|
|
|
m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
|
|
|
|
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
|
2010-02-08 18:15:42 +00:00
|
|
|
|
2018-07-17 23:01:35 +00:00
|
|
|
#define ADD_TOOL( id, xpm, tooltip ) \
|
|
|
|
m_mainToolBar->AddTool( id, wxEmptyString, KiScaledBitmap( xpm, this ), tooltip );
|
|
|
|
|
2007-08-04 01:08:43 +00:00
|
|
|
// Set up toolbar
|
2014-06-11 05:18:41 +00:00
|
|
|
if( Kiface().IsSingle() )
|
|
|
|
{
|
2018-07-17 23:01:35 +00:00
|
|
|
ADD_TOOL( ID_NEW_BOARD, new_board_xpm, _( "New board" ) );
|
|
|
|
ADD_TOOL( ID_LOAD_FILE, open_brd_file_xpm, _( "Open existing board" ) );
|
2014-06-11 05:18:41 +00:00
|
|
|
}
|
|
|
|
|
2018-07-17 23:01:35 +00:00
|
|
|
ADD_TOOL( ID_SAVE_BOARD, save_xpm, _( "Save board" ) );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledSeparator( m_mainToolBar, this );
|
2018-07-24 10:57:07 +00:00
|
|
|
ADD_TOOL( ID_BOARD_SETUP_DIALOG, options_board_xpm, _( "Board setup" ) );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledSeparator( m_mainToolBar, this );
|
2018-07-17 23:01:35 +00:00
|
|
|
ADD_TOOL( ID_SHEET_SET, sheetset_xpm, _( "Page settings for paper size and texts" ) );
|
|
|
|
ADD_TOOL( wxID_PRINT, print_button_xpm, _( "Print board" ) );
|
|
|
|
ADD_TOOL( ID_GEN_PLOT, plot_xpm, _( "Plot (HPGL, PostScript, or GERBER format)" ) );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledSeparator( m_mainToolBar, this );
|
2018-02-14 22:07:59 +00:00
|
|
|
msg = AddHotkeyName( HELP_UNDO, g_Board_Editor_Hotkeys_Descr, HK_UNDO, IS_COMMENT );
|
2018-07-17 23:01:35 +00:00
|
|
|
ADD_TOOL( wxID_UNDO, undo_xpm, msg );
|
2018-02-14 22:07:59 +00:00
|
|
|
msg = AddHotkeyName( HELP_REDO, g_Board_Editor_Hotkeys_Descr, HK_REDO, IS_COMMENT );
|
2018-07-17 23:01:35 +00:00
|
|
|
ADD_TOOL( wxID_REDO, redo_xpm, msg );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledSeparator( m_mainToolBar, this );
|
2018-07-17 23:01:35 +00:00
|
|
|
msg = AddHotkeyName( HELP_FIND, g_Board_Editor_Hotkeys_Descr, HK_FIND_ITEM, IS_COMMENT );
|
|
|
|
ADD_TOOL( ID_FIND_ITEMS, find_xpm, msg );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledSeparator( m_mainToolBar, this );
|
2018-07-17 23:01:35 +00:00
|
|
|
msg = AddHotkeyName( HELP_ZOOM_REDRAW, g_Board_Editor_Hotkeys_Descr, HK_ZOOM_REDRAW, IS_COMMENT );
|
|
|
|
ADD_TOOL( ID_ZOOM_REDRAW, zoom_redraw_xpm, msg );
|
2018-02-14 22:07:59 +00:00
|
|
|
msg = AddHotkeyName( HELP_ZOOM_IN, g_Board_Editor_Hotkeys_Descr, HK_ZOOM_IN, IS_COMMENT );
|
2018-07-17 23:01:35 +00:00
|
|
|
ADD_TOOL( ID_ZOOM_IN, zoom_in_xpm, msg );
|
2018-02-14 22:07:59 +00:00
|
|
|
msg = AddHotkeyName( HELP_ZOOM_OUT, g_Board_Editor_Hotkeys_Descr, HK_ZOOM_OUT, IS_COMMENT );
|
2018-07-17 23:01:35 +00:00
|
|
|
ADD_TOOL( ID_ZOOM_OUT, zoom_out_xpm, msg );
|
2018-02-14 22:07:59 +00:00
|
|
|
msg = AddHotkeyName( HELP_ZOOM_FIT, g_Board_Editor_Hotkeys_Descr, HK_ZOOM_AUTO, IS_COMMENT );
|
2018-07-17 23:01:35 +00:00
|
|
|
ADD_TOOL( ID_ZOOM_PAGE, zoom_fit_in_page_xpm, msg );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
m_mainToolBar->AddTool( ID_ZOOM_SELECTION, wxEmptyString, KiScaledBitmap( zoom_area_xpm, this ),
|
2017-06-06 13:35:20 +00:00
|
|
|
_( "Zoom to selection" ), wxITEM_CHECK );
|
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledSeparator( m_mainToolBar, this );
|
2018-07-17 23:01:35 +00:00
|
|
|
ADD_TOOL( ID_OPEN_MODULE_EDITOR, module_editor_xpm, _( "Open footprint editor" ) );
|
|
|
|
ADD_TOOL( ID_OPEN_MODULE_VIEWER, modview_icon_xpm, _( "Open footprint viewer" ) );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledSeparator( m_mainToolBar, this );
|
2018-07-25 22:44:57 +00:00
|
|
|
ADD_TOOL( ID_UPDATE_PCB_FROM_SCH, update_pcb_from_sch_xpm, _( "Update PCB from schematic" ) );
|
2018-07-17 23:01:35 +00:00
|
|
|
ADD_TOOL( ID_DRC_CONTROL, erc_xpm, _( "Perform design rules check" ) );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledSeparator( m_mainToolBar, this );
|
2010-11-03 18:55:51 +00:00
|
|
|
|
2019-01-18 16:24:40 +00:00
|
|
|
if( m_SelLayerBox == nullptr )
|
2013-09-01 18:38:11 +00:00
|
|
|
{
|
2012-05-04 17:44:42 +00:00
|
|
|
m_SelLayerBox = new PCB_LAYER_BOX_SELECTOR( m_mainToolBar, ID_TOOLBARH_PCB_SELECT_LAYER );
|
2013-09-01 18:38:11 +00:00
|
|
|
m_SelLayerBox->SetBoardFrame( this );
|
|
|
|
}
|
2014-06-29 13:05:51 +00:00
|
|
|
|
2013-09-02 15:26:52 +00:00
|
|
|
ReCreateLayerBox( false );
|
2011-12-16 13:32:23 +00:00
|
|
|
m_mainToolBar->AddControl( m_SelLayerBox );
|
2010-11-03 18:55:51 +00:00
|
|
|
|
2018-07-17 23:01:35 +00:00
|
|
|
PrepareLayerIndicator(); // Initialize the bitmap with the active layer colors
|
|
|
|
m_mainToolBar->AddTool( ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR, wxEmptyString, *LayerPairBitmap,
|
|
|
|
SEL_LAYER_HELP );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2018-07-22 21:33:01 +00:00
|
|
|
KiScaledSeparator( m_mainToolBar, this );
|
|
|
|
ADD_TOOL( ID_RUN_EESCHEMA, eeschema_xpm, _( "Open schematic in Eeschema" ) );
|
|
|
|
|
2012-08-10 21:53:50 +00:00
|
|
|
// Access to the scripting console
|
2014-10-31 14:45:46 +00:00
|
|
|
#if defined(KICAD_SCRIPTING_WXPYTHON)
|
2015-07-09 16:44:23 +00:00
|
|
|
if( IsWxPythonLoaded() )
|
|
|
|
{
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledSeparator( m_mainToolBar, this );
|
2014-06-17 18:31:27 +00:00
|
|
|
|
2015-07-09 16:44:23 +00:00
|
|
|
m_mainToolBar->AddTool( ID_TOOLBARH_PCB_SCRIPTING_CONSOLE, wxEmptyString,
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledBitmap( py_script_xpm, this ),
|
2018-07-17 23:01:35 +00:00
|
|
|
_( "Show/Hide the Python Scripting console" ), wxITEM_CHECK );
|
2018-08-15 09:26:32 +00:00
|
|
|
|
|
|
|
#if defined(KICAD_SCRIPTING) && defined(KICAD_SCRIPTING_ACTION_MENU)
|
|
|
|
AddActionPluginTools();
|
|
|
|
#endif
|
2015-07-09 16:44:23 +00:00
|
|
|
}
|
2012-08-10 21:53:50 +00:00
|
|
|
#endif
|
2014-06-17 18:31:27 +00:00
|
|
|
|
2011-02-21 13:54:29 +00:00
|
|
|
// after adding the buttons to the toolbar, must call Realize() to reflect the changes
|
2011-12-16 13:32:23 +00:00
|
|
|
m_mainToolBar->Realize();
|
2018-07-17 23:01:35 +00:00
|
|
|
|
|
|
|
#undef ADD_TOOL
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_EDIT_FRAME::ReCreateOptToolbar()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2019-01-18 16:24:40 +00:00
|
|
|
// Note:
|
|
|
|
// To rebuild the aui toolbar, the more easy way is to clear ( calling m_mainToolBar.Clear() )
|
|
|
|
// all wxAuiToolBarItems.
|
|
|
|
// However the wxAuiToolBarItems are not the owners of controls managed by
|
|
|
|
// them and therefore do not delete them
|
|
|
|
// So we do not recreate them after clearing the tools.
|
|
|
|
|
2018-10-13 12:49:49 +00:00
|
|
|
wxWindowUpdateLocker dummy( this );
|
2010-07-27 12:47:08 +00:00
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
if( m_optionsToolBar )
|
|
|
|
m_optionsToolBar->Clear();
|
|
|
|
else
|
|
|
|
m_optionsToolBar = new wxAuiToolBar( this, ID_OPT_TOOLBAR, wxDefaultPosition, wxDefaultSize,
|
|
|
|
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
m_optionsToolBar->AddTool( ID_TB_OPTIONS_DRC_OFF, wxEmptyString, KiScaledBitmap( drc_off_xpm, this ),
|
2011-02-21 13:54:29 +00:00
|
|
|
_( "Enable design rule checking" ), wxITEM_CHECK );
|
2018-01-08 04:05:03 +00:00
|
|
|
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString, KiScaledBitmap( grid_xpm, this ),
|
2009-11-20 14:55:20 +00:00
|
|
|
_( "Hide grid" ), wxITEM_CHECK );
|
2011-12-14 20:03:15 +00:00
|
|
|
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, wxEmptyString,
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledBitmap( polar_coord_xpm, this ),
|
2009-11-20 14:55:20 +00:00
|
|
|
_( "Display polar coordinates" ), wxITEM_CHECK );
|
2011-12-14 20:03:15 +00:00
|
|
|
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, wxEmptyString,
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledBitmap( unit_inch_xpm, this ),
|
2016-10-10 22:54:58 +00:00
|
|
|
_( "Set units to inches" ), wxITEM_CHECK );
|
2011-12-14 20:03:15 +00:00
|
|
|
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_MM, wxEmptyString,
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledBitmap( unit_mm_xpm, this ),
|
2016-10-10 22:54:58 +00:00
|
|
|
_( "Set units to millimeters" ), wxITEM_CHECK );
|
2016-05-11 03:33:24 +00:00
|
|
|
|
|
|
|
#ifndef __APPLE__
|
2011-12-14 20:03:15 +00:00
|
|
|
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_CURSOR, wxEmptyString,
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledBitmap( cursor_shape_xpm, this ),
|
2009-11-20 14:55:20 +00:00
|
|
|
_( "Change cursor shape" ), wxITEM_CHECK );
|
2018-01-27 18:11:56 +00:00
|
|
|
#else
|
|
|
|
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_CURSOR, wxEmptyString,
|
|
|
|
KiScaledBitmap( cursor_shape_xpm, this ),
|
2018-02-19 19:26:02 +00:00
|
|
|
_( "Change cursor shape (not supported in Legacy Toolset)" ),
|
2018-01-27 18:11:56 +00:00
|
|
|
wxITEM_CHECK );
|
|
|
|
#endif
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledSeparator( m_optionsToolBar, this );
|
2011-12-14 20:03:15 +00:00
|
|
|
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_RATSNEST, wxEmptyString,
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledBitmap( general_ratsnest_xpm, this ),
|
2009-11-20 14:55:20 +00:00
|
|
|
_( "Show board ratsnest" ), wxITEM_CHECK );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledSeparator( m_optionsToolBar, this );
|
|
|
|
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_ZONES, wxEmptyString, KiScaledBitmap( show_zone_xpm, this ),
|
2011-12-16 13:32:23 +00:00
|
|
|
_( "Show filled areas in zones" ), wxITEM_CHECK );
|
|
|
|
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_ZONES_DISABLE, wxEmptyString,
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledBitmap( show_zone_disable_xpm, this ),
|
2011-12-16 13:32:23 +00:00
|
|
|
_( "Do not show filled areas in zones" ) , wxITEM_CHECK );
|
|
|
|
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY, wxEmptyString,
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledBitmap( show_zone_outline_only_xpm, this ),
|
2011-12-16 13:32:23 +00:00
|
|
|
_( "Show outlines of filled areas only in zones" ), wxITEM_CHECK );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledSeparator( m_optionsToolBar, this );
|
2011-12-14 20:03:15 +00:00
|
|
|
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_PADS_SKETCH, wxEmptyString,
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledBitmap( pad_sketch_xpm, this ),
|
2009-11-20 14:55:20 +00:00
|
|
|
_( "Show pads in outline mode" ), wxITEM_CHECK );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2011-12-14 20:03:15 +00:00
|
|
|
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_VIAS_SKETCH, wxEmptyString,
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledBitmap( via_sketch_xpm, this ),
|
2009-11-20 14:55:20 +00:00
|
|
|
_( "Show vias in outline mode" ), wxITEM_CHECK );
|
2009-09-29 04:44:35 +00:00
|
|
|
|
2011-12-14 20:03:15 +00:00
|
|
|
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_TRACKS_SKETCH, wxEmptyString,
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledBitmap( showtrack_xpm, this ),
|
2009-11-20 14:55:20 +00:00
|
|
|
_( "Show tracks in outline mode" ),
|
|
|
|
wxITEM_CHECK );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2011-12-14 20:03:15 +00:00
|
|
|
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE, wxEmptyString,
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledBitmap( contrast_mode_xpm, this ),
|
2009-11-20 14:55:20 +00:00
|
|
|
_( "Enable high contrast display mode" ),
|
2008-12-05 16:03:05 +00:00
|
|
|
wxITEM_CHECK );
|
2018-04-30 07:52:49 +00:00
|
|
|
m_optionsToolBar->AddTool( ID_TB_OPTIONS_CURVED_RATSNEST_LINES, wxEmptyString,
|
|
|
|
KiScaledBitmap( curved_ratsnest_xpm, this ),
|
|
|
|
_( "Show ratsnest lines with curved lines" ),
|
|
|
|
wxITEM_CHECK );
|
2009-06-19 20:13:22 +00:00
|
|
|
|
2010-01-24 13:46:01 +00:00
|
|
|
// Tools to show/hide toolbars:
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledSeparator( m_optionsToolBar, this );
|
2011-12-14 20:03:15 +00:00
|
|
|
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR,
|
2011-02-21 13:54:29 +00:00
|
|
|
wxEmptyString,
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledBitmap( layers_manager_xpm, this ),
|
2011-02-21 13:54:29 +00:00
|
|
|
HELP_SHOW_HIDE_LAYERMANAGER,
|
|
|
|
wxITEM_CHECK );
|
2011-12-14 20:03:15 +00:00
|
|
|
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR_MICROWAVE,
|
2008-12-05 16:03:05 +00:00
|
|
|
wxEmptyString,
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledBitmap( mw_toolbar_xpm, this ),
|
2014-02-27 18:48:18 +00:00
|
|
|
HELP_SHOW_HIDE_MICROWAVE_TOOLS,
|
2007-08-04 01:08:43 +00:00
|
|
|
wxITEM_CHECK );
|
2010-01-22 12:55:29 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledSeparator( m_optionsToolBar, this );
|
2011-12-14 20:03:15 +00:00
|
|
|
m_optionsToolBar->Realize();
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_EDIT_FRAME::ReCreateVToolbar()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2018-10-13 12:49:49 +00:00
|
|
|
wxWindowUpdateLocker dummy( this );
|
2010-07-27 12:47:08 +00:00
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
if( m_drawToolBar )
|
|
|
|
m_drawToolBar->Clear();
|
|
|
|
else
|
|
|
|
m_drawToolBar = new wxAuiToolBar( this, ID_V_TOOLBAR, wxDefaultPosition, wxDefaultSize,
|
|
|
|
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-04 01:08:43 +00:00
|
|
|
// Set up toolbar
|
2018-01-08 04:05:03 +00:00
|
|
|
m_drawToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString, KiScaledBitmap( cursor_xpm, this ),
|
2018-06-03 21:42:04 +00:00
|
|
|
_( "Select item" ), wxITEM_CHECK );
|
2016-06-08 11:19:53 +00:00
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledSeparator( m_drawToolBar, this );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
m_drawToolBar->AddTool( ID_PCB_HIGHLIGHT_BUTT, wxEmptyString, KiScaledBitmap( net_highlight_xpm, this ),
|
2011-12-14 20:03:15 +00:00
|
|
|
_( "Highlight net" ), wxITEM_CHECK );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2011-12-14 20:03:15 +00:00
|
|
|
m_drawToolBar->AddTool( ID_PCB_SHOW_1_RATSNEST_BUTT, wxEmptyString,
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledBitmap( tool_ratsnest_xpm, this ),
|
2011-12-14 20:03:15 +00:00
|
|
|
_( "Display local ratsnest" ), wxITEM_CHECK );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledSeparator( m_drawToolBar, this );
|
|
|
|
m_drawToolBar->AddTool( ID_PCB_MODULE_BUTT, wxEmptyString, KiScaledBitmap( module_xpm, this ),
|
2014-10-12 15:12:02 +00:00
|
|
|
_( "Add footprints" ), wxITEM_CHECK );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
m_drawToolBar->AddTool( ID_TRACK_BUTT, wxEmptyString, KiScaledBitmap( add_tracks_xpm, this ),
|
2017-04-22 15:46:31 +00:00
|
|
|
_( "Route tracks" ), wxITEM_CHECK );
|
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
m_drawToolBar->AddTool( ID_PCB_DRAW_VIA_BUTT, wxEmptyString, KiScaledBitmap( add_via_xpm, this ),
|
2017-04-22 15:46:31 +00:00
|
|
|
_( "Add vias" ), wxITEM_CHECK );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
m_drawToolBar->AddTool( ID_PCB_ZONES_BUTT, wxEmptyString, KiScaledBitmap( add_zone_xpm, this ),
|
2011-12-14 20:03:15 +00:00
|
|
|
_( "Add filled zones" ), wxITEM_CHECK );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2012-07-13 18:55:29 +00:00
|
|
|
m_drawToolBar->AddTool( ID_PCB_KEEPOUT_AREA_BUTT, wxEmptyString,
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledBitmap( add_keepout_area_xpm, this ),
|
2012-07-13 18:55:29 +00:00
|
|
|
_( "Add keepout areas" ), wxITEM_CHECK );
|
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledSeparator( m_drawToolBar, this );
|
2017-10-19 21:14:01 +00:00
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
m_drawToolBar->AddTool( ID_PCB_ADD_LINE_BUTT, wxEmptyString, KiScaledBitmap( add_graphical_segments_xpm, this ),
|
2017-10-19 21:14:01 +00:00
|
|
|
_( "Add graphic lines" ), wxITEM_CHECK );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
m_drawToolBar->AddTool( ID_PCB_CIRCLE_BUTT, wxEmptyString, KiScaledBitmap( add_circle_xpm, this ),
|
2011-12-14 20:03:15 +00:00
|
|
|
_( "Add graphic circle" ), wxITEM_CHECK );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
m_drawToolBar->AddTool( ID_PCB_ARC_BUTT, wxEmptyString, KiScaledBitmap( add_arc_xpm, this ),
|
2011-12-14 20:03:15 +00:00
|
|
|
_( "Add graphic arc" ), wxITEM_CHECK );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
m_drawToolBar->AddTool( ID_PCB_ADD_POLYGON_BUTT, wxEmptyString, KiScaledBitmap( add_graphical_polygon_xpm, this ),
|
2017-10-19 21:14:01 +00:00
|
|
|
_( "Add graphic polygon" ), wxITEM_CHECK );
|
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
m_drawToolBar->AddTool( ID_PCB_ADD_TEXT_BUTT, wxEmptyString, KiScaledBitmap( text_xpm, this ),
|
2011-12-14 20:03:15 +00:00
|
|
|
_( "Add text on copper layers or graphic text" ), wxITEM_CHECK );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledSeparator( m_drawToolBar, this );
|
|
|
|
m_drawToolBar->AddTool( ID_PCB_DIMENSION_BUTT, wxEmptyString, KiScaledBitmap( add_dimension_xpm, this ),
|
2011-12-14 20:03:15 +00:00
|
|
|
_( "Add dimension" ), wxITEM_CHECK );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
m_drawToolBar->AddTool( ID_PCB_TARGET_BUTT, wxEmptyString, KiScaledBitmap( add_pcb_target_xpm, this ),
|
2011-12-14 20:03:15 +00:00
|
|
|
_( "Add layer alignment target" ), wxITEM_CHECK );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledSeparator( m_drawToolBar, this );
|
|
|
|
m_drawToolBar->AddTool( ID_PCB_DELETE_ITEM_BUTT, wxEmptyString, KiScaledBitmap( delete_xpm, this ),
|
2011-12-14 20:03:15 +00:00
|
|
|
_( "Delete items" ), wxITEM_CHECK );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledSeparator( m_drawToolBar, this );
|
2011-12-14 20:03:15 +00:00
|
|
|
m_drawToolBar->AddTool( ID_PCB_PLACE_OFFSET_COORD_BUTT, wxEmptyString,
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledBitmap( pcb_offset_xpm, this ),
|
2018-04-16 17:41:25 +00:00
|
|
|
_( "Place the auxiliary axis origin for some plot file formats,\n"
|
|
|
|
"and for drill and place files" ),
|
2011-12-14 20:03:15 +00:00
|
|
|
wxITEM_CHECK );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2011-12-14 20:03:15 +00:00
|
|
|
m_drawToolBar->AddTool( ID_PCB_PLACE_GRID_COORD_BUTT, wxEmptyString,
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledBitmap( grid_select_axis_xpm, this ),
|
2011-12-14 20:03:15 +00:00
|
|
|
_( "Set the origin point for the grid" ),
|
|
|
|
wxITEM_CHECK );
|
2010-07-13 10:42:32 +00:00
|
|
|
|
2017-03-09 09:09:13 +00:00
|
|
|
m_drawToolBar->AddTool( ID_PCB_MEASUREMENT_TOOL, wxEmptyString,
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledBitmap( measurement_xpm, this ),
|
2017-06-02 09:51:11 +00:00
|
|
|
_( "Measure distance" ),
|
2017-03-09 09:09:13 +00:00
|
|
|
wxITEM_CHECK );
|
|
|
|
|
2011-12-14 20:03:15 +00:00
|
|
|
m_drawToolBar->Realize();
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-09-16 18:54:04 +00:00
|
|
|
/* Create the auxiliary vertical right toolbar, showing tools for microwave applications
|
2007-08-04 01:08:43 +00:00
|
|
|
*/
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_EDIT_FRAME::ReCreateMicrowaveVToolbar()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2018-10-13 12:49:49 +00:00
|
|
|
wxWindowUpdateLocker dummy(this);
|
2010-07-27 12:47:08 +00:00
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
if( m_microWaveToolBar )
|
|
|
|
m_microWaveToolBar->Clear();
|
|
|
|
else
|
|
|
|
m_microWaveToolBar = new wxAuiToolBar( this, ID_MICROWAVE_V_TOOLBAR, wxDefaultPosition,
|
|
|
|
wxDefaultSize,
|
|
|
|
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
|
|
|
// Set up toolbar
|
2011-12-14 20:03:15 +00:00
|
|
|
m_microWaveToolBar->AddTool( ID_PCB_MUWAVE_TOOL_SELF_CMD, wxEmptyString,
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledBitmap( mw_add_line_xpm, this ),
|
2014-02-27 18:48:18 +00:00
|
|
|
_( "Create line of specified length for microwave applications" ),
|
2014-06-11 05:18:41 +00:00
|
|
|
wxITEM_CHECK );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2011-12-14 20:03:15 +00:00
|
|
|
m_microWaveToolBar->AddTool( ID_PCB_MUWAVE_TOOL_GAP_CMD, wxEmptyString,
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledBitmap( mw_add_gap_xpm, this ),
|
2014-02-27 18:48:18 +00:00
|
|
|
_( "Create gap of specified length for microwave applications" ),
|
2014-06-11 05:18:41 +00:00
|
|
|
wxITEM_CHECK );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledSeparator( m_microWaveToolBar, this );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2011-12-14 20:03:15 +00:00
|
|
|
m_microWaveToolBar->AddTool( ID_PCB_MUWAVE_TOOL_STUB_CMD, wxEmptyString,
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledBitmap( mw_add_stub_xpm, this ),
|
2014-02-27 18:48:18 +00:00
|
|
|
_( "Create stub of specified length for microwave applications" ),
|
2014-06-11 05:18:41 +00:00
|
|
|
wxITEM_CHECK );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2011-12-14 20:03:15 +00:00
|
|
|
m_microWaveToolBar->AddTool( ID_PCB_MUWAVE_TOOL_STUB_ARC_CMD, wxEmptyString,
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledBitmap( mw_add_stub_arc_xpm, this ),
|
2014-02-27 18:48:18 +00:00
|
|
|
_( "Create stub (arc) of specified length for microwave applications" ),
|
2014-06-11 05:18:41 +00:00
|
|
|
wxITEM_CHECK );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2011-12-14 20:03:15 +00:00
|
|
|
m_microWaveToolBar->AddTool( ID_PCB_MUWAVE_TOOL_FUNCTION_SHAPE_CMD, wxEmptyString,
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledBitmap( mw_add_shape_xpm, this ),
|
2014-02-27 18:48:18 +00:00
|
|
|
_( "Create a polynomial shape for microwave applications" ),
|
2014-06-11 05:18:41 +00:00
|
|
|
wxITEM_CHECK );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2011-12-14 20:03:15 +00:00
|
|
|
m_microWaveToolBar->Realize();
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_EDIT_FRAME::ReCreateAuxiliaryToolbar()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2018-10-13 12:49:49 +00:00
|
|
|
wxWindowUpdateLocker dummy( this );
|
2010-07-27 12:47:08 +00:00
|
|
|
|
2011-12-14 20:03:15 +00:00
|
|
|
if( m_auxiliaryToolBar )
|
2015-01-05 13:20:04 +00:00
|
|
|
{
|
2018-04-28 15:22:25 +00:00
|
|
|
UpdateTrackWidthSelectBox( m_SelTrackWidthBox );
|
|
|
|
UpdateViaSizeSelectBox( m_SelViaSizeBox );
|
2015-01-05 13:20:04 +00:00
|
|
|
|
|
|
|
// combobox sizes can have changed: apply new best sizes
|
|
|
|
wxAuiToolBarItem* item = m_auxiliaryToolBar->FindTool( ID_AUX_TOOLBAR_PCB_TRACK_WIDTH );
|
|
|
|
item->SetMinSize( m_SelTrackWidthBox->GetBestSize() );
|
|
|
|
item = m_auxiliaryToolBar->FindTool( ID_AUX_TOOLBAR_PCB_VIA_SIZE );
|
|
|
|
item->SetMinSize( m_SelViaSizeBox->GetBestSize() );
|
|
|
|
|
|
|
|
m_auxiliaryToolBar->Realize();
|
|
|
|
m_auimgr.Update();
|
2011-02-21 13:54:29 +00:00
|
|
|
return;
|
2015-01-05 13:20:04 +00:00
|
|
|
}
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2011-12-16 13:32:23 +00:00
|
|
|
m_auxiliaryToolBar = new wxAuiToolBar( this, ID_AUX_TOOLBAR, wxDefaultPosition, wxDefaultSize,
|
2017-09-27 17:40:18 +00:00
|
|
|
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
|
2011-02-21 13:54:29 +00:00
|
|
|
|
|
|
|
/* Set up toolbar items */
|
|
|
|
|
|
|
|
// Creates box to display and choose tracks widths:
|
2019-01-18 16:24:40 +00:00
|
|
|
if( m_SelTrackWidthBox == nullptr )
|
2019-01-28 14:15:32 +00:00
|
|
|
m_SelTrackWidthBox = new wxChoice( m_auxiliaryToolBar,
|
|
|
|
ID_AUX_TOOLBAR_PCB_TRACK_WIDTH,
|
|
|
|
wxDefaultPosition, wxDefaultSize,
|
|
|
|
0, NULL );
|
2019-01-18 16:24:40 +00:00
|
|
|
|
2018-04-28 15:22:25 +00:00
|
|
|
UpdateTrackWidthSelectBox( m_SelTrackWidthBox );
|
2011-12-14 20:03:15 +00:00
|
|
|
m_auxiliaryToolBar->AddControl( m_SelTrackWidthBox );
|
2011-02-21 13:54:29 +00:00
|
|
|
|
|
|
|
// Creates box to display and choose vias diameters:
|
2019-01-28 14:15:32 +00:00
|
|
|
|
2019-01-18 16:24:40 +00:00
|
|
|
if( m_SelViaSizeBox == nullptr )
|
2019-01-28 14:15:32 +00:00
|
|
|
m_SelViaSizeBox = new wxChoice( m_auxiliaryToolBar,
|
|
|
|
ID_AUX_TOOLBAR_PCB_VIA_SIZE,
|
|
|
|
wxDefaultPosition, wxDefaultSize,
|
|
|
|
0, NULL );
|
2019-01-18 16:24:40 +00:00
|
|
|
|
2018-04-28 15:22:25 +00:00
|
|
|
UpdateViaSizeSelectBox( m_SelViaSizeBox );
|
2011-12-14 20:03:15 +00:00
|
|
|
m_auxiliaryToolBar->AddControl( m_SelViaSizeBox );
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledSeparator( m_auxiliaryToolBar, this );
|
2011-02-21 13:54:29 +00:00
|
|
|
|
|
|
|
// Creates box to display and choose strategy to handle tracks an vias sizes:
|
2011-12-14 20:03:15 +00:00
|
|
|
m_auxiliaryToolBar->AddTool( ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH,
|
2011-02-21 13:54:29 +00:00
|
|
|
wxEmptyString,
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledBitmap( auto_track_width_xpm, this ),
|
2015-10-14 18:12:17 +00:00
|
|
|
_( "Auto track width: when starting on an existing track "
|
|
|
|
"use its width\notherwise, use current width setting" ),
|
2011-02-21 13:54:29 +00:00
|
|
|
wxITEM_CHECK );
|
|
|
|
|
|
|
|
// Add the box to display and select the current grid size:
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledSeparator( m_auxiliaryToolBar, this );
|
2019-01-18 16:24:40 +00:00
|
|
|
|
|
|
|
if( m_gridSelectBox == nullptr )
|
2019-01-28 14:15:32 +00:00
|
|
|
m_gridSelectBox = new wxChoice( m_auxiliaryToolBar,
|
|
|
|
ID_ON_GRID_SELECT,
|
|
|
|
wxDefaultPosition, wxDefaultSize,
|
|
|
|
0, NULL );
|
2019-01-18 16:24:40 +00:00
|
|
|
|
2018-11-23 23:33:02 +00:00
|
|
|
UpdateGridSelectBox();
|
2018-11-28 14:58:41 +00:00
|
|
|
|
2011-12-14 20:03:15 +00:00
|
|
|
m_auxiliaryToolBar->AddControl( m_gridSelectBox );
|
2011-02-21 13:54:29 +00:00
|
|
|
|
|
|
|
// Add the box to display and select the current Zoom
|
2018-01-08 04:05:03 +00:00
|
|
|
KiScaledSeparator( m_auxiliaryToolBar, this );
|
2019-01-18 16:24:40 +00:00
|
|
|
|
|
|
|
if( m_zoomSelectBox == nullptr )
|
2019-01-28 14:15:32 +00:00
|
|
|
m_zoomSelectBox = new wxChoice( m_auxiliaryToolBar,
|
|
|
|
ID_ON_ZOOM_SELECT,
|
|
|
|
wxDefaultPosition, wxDefaultSize,
|
|
|
|
0, NULL );
|
2019-01-18 16:24:40 +00:00
|
|
|
|
2011-02-21 13:54:29 +00:00
|
|
|
updateZoomSelectBox();
|
2015-01-05 13:20:04 +00:00
|
|
|
m_auxiliaryToolBar->AddControl( m_zoomSelectBox );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2011-02-21 13:54:29 +00:00
|
|
|
// after adding the buttons to the toolbar, must call Realize()
|
2011-12-14 20:03:15 +00:00
|
|
|
m_auxiliaryToolBar->Realize();
|
2011-02-21 13:54:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-02-08 13:50:20 +00:00
|
|
|
void PCB_EDIT_FRAME::UpdateTrackWidthSelectBox( wxChoice* aTrackWidthSelectBox, const bool aEdit )
|
2011-02-21 13:54:29 +00:00
|
|
|
{
|
2018-04-28 15:22:25 +00:00
|
|
|
if( aTrackWidthSelectBox == NULL )
|
2011-02-21 13:54:29 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
wxString msg;
|
2018-02-02 15:56:09 +00:00
|
|
|
bool mmFirst = GetUserUnits() != INCHES;
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2018-04-28 15:22:25 +00:00
|
|
|
aTrackWidthSelectBox->Clear();
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2014-05-13 09:22:51 +00:00
|
|
|
for( unsigned ii = 0; ii < GetDesignSettings().m_TrackWidthList.size(); ii++ )
|
2010-07-12 14:07:09 +00:00
|
|
|
{
|
2015-01-05 13:20:04 +00:00
|
|
|
int size = GetDesignSettings().m_TrackWidthList[ii];
|
|
|
|
|
|
|
|
double valueMils = To_User_Unit( INCHES, size ) * 1000;
|
|
|
|
double value_mm = To_User_Unit( MILLIMETRES, size );
|
2010-07-12 14:07:09 +00:00
|
|
|
|
2015-01-05 13:20:04 +00:00
|
|
|
if( mmFirst )
|
|
|
|
msg.Printf( _( "Track: %.3f mm (%.2f mils)" ),
|
|
|
|
value_mm, valueMils );
|
|
|
|
else
|
|
|
|
msg.Printf( _( "Track: %.2f mils (%.3f mm)" ),
|
|
|
|
valueMils, value_mm );
|
|
|
|
|
|
|
|
// Mark the netclass track width value (the first in list)
|
2011-02-21 13:54:29 +00:00
|
|
|
if( ii == 0 )
|
2014-10-31 18:59:37 +00:00
|
|
|
msg << wxT( " *" );
|
2010-07-12 14:07:09 +00:00
|
|
|
|
2018-04-28 15:22:25 +00:00
|
|
|
aTrackWidthSelectBox->Append( msg );
|
2010-07-12 14:07:09 +00:00
|
|
|
}
|
2011-03-01 19:26:17 +00:00
|
|
|
|
2019-02-08 13:50:20 +00:00
|
|
|
if( aEdit )
|
|
|
|
{
|
|
|
|
aTrackWidthSelectBox->Append( wxT( "---" ) );
|
|
|
|
aTrackWidthSelectBox->Append( _( "Edit pre-defined sizes..." ) );
|
|
|
|
}
|
2018-11-17 00:33:20 +00:00
|
|
|
|
2014-05-13 09:22:51 +00:00
|
|
|
if( GetDesignSettings().GetTrackWidthIndex() >= GetDesignSettings().m_TrackWidthList.size() )
|
|
|
|
GetDesignSettings().SetTrackWidthIndex( 0 );
|
2013-01-09 18:52:44 +00:00
|
|
|
|
2018-04-28 15:22:25 +00:00
|
|
|
aTrackWidthSelectBox->SetSelection( GetDesignSettings().GetTrackWidthIndex() );
|
2011-02-21 13:54:29 +00:00
|
|
|
}
|
|
|
|
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2019-02-08 13:50:20 +00:00
|
|
|
void PCB_EDIT_FRAME::UpdateViaSizeSelectBox( wxChoice* aViaSizeSelectBox, const bool aEdit )
|
2011-02-21 13:54:29 +00:00
|
|
|
{
|
2018-04-28 15:22:25 +00:00
|
|
|
if( aViaSizeSelectBox == NULL )
|
2011-02-21 13:54:29 +00:00
|
|
|
return;
|
|
|
|
|
2018-04-28 15:22:25 +00:00
|
|
|
aViaSizeSelectBox->Clear();
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2018-02-02 15:56:09 +00:00
|
|
|
bool mmFirst = GetUserUnits() != INCHES;
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2014-05-13 09:22:51 +00:00
|
|
|
for( unsigned ii = 0; ii < GetDesignSettings().m_ViasDimensionsList.size(); ii++ )
|
2007-08-04 01:08:43 +00:00
|
|
|
{
|
2018-04-28 15:22:25 +00:00
|
|
|
VIA_DIMENSION viaDimension = GetDesignSettings().m_ViasDimensionsList[ii];
|
|
|
|
wxString msg, mmStr, milsStr;
|
2015-01-05 13:20:04 +00:00
|
|
|
|
2018-04-28 15:22:25 +00:00
|
|
|
double diam = To_User_Unit( MILLIMETRES, viaDimension.m_Diameter );
|
|
|
|
double hole = To_User_Unit( MILLIMETRES, viaDimension.m_Drill );
|
2015-01-05 13:20:04 +00:00
|
|
|
|
2018-04-28 15:22:25 +00:00
|
|
|
if( hole > 0 )
|
2018-09-25 11:17:29 +00:00
|
|
|
mmStr.Printf( _( "%.2f / %.2f mm" ), diam, hole );
|
2015-01-05 13:20:04 +00:00
|
|
|
else
|
2018-09-25 11:17:29 +00:00
|
|
|
mmStr.Printf( _( "%.2f mm" ), diam );
|
2010-12-08 20:12:46 +00:00
|
|
|
|
2018-04-28 15:22:25 +00:00
|
|
|
diam = To_User_Unit( INCHES, viaDimension.m_Diameter ) * 1000;
|
|
|
|
hole = To_User_Unit( INCHES, viaDimension.m_Drill ) * 1000;
|
2015-01-05 13:20:04 +00:00
|
|
|
|
2018-04-28 15:22:25 +00:00
|
|
|
if( hole > 0 )
|
2018-09-25 11:17:29 +00:00
|
|
|
milsStr.Printf( _( "%.1f / %.1f mils" ), diam, hole );
|
2018-04-28 15:22:25 +00:00
|
|
|
else
|
2018-09-25 11:17:29 +00:00
|
|
|
milsStr.Printf( _( "%.1f mils" ), diam );
|
2018-04-28 15:22:25 +00:00
|
|
|
|
|
|
|
msg.Printf( _( "Via: %s (%s)" ), mmFirst ? mmStr : milsStr, mmFirst ? milsStr : mmStr );
|
2008-12-05 16:03:05 +00:00
|
|
|
|
2015-01-05 13:20:04 +00:00
|
|
|
// Mark the netclass via size value (the first in list)
|
2011-02-21 13:54:29 +00:00
|
|
|
if( ii == 0 )
|
2014-10-31 18:59:37 +00:00
|
|
|
msg << wxT( " *" );
|
2009-10-14 19:43:31 +00:00
|
|
|
|
2018-04-28 15:22:25 +00:00
|
|
|
aViaSizeSelectBox->Append( msg );
|
2007-08-04 01:08:43 +00:00
|
|
|
}
|
2011-03-01 19:26:17 +00:00
|
|
|
|
2019-02-08 13:50:20 +00:00
|
|
|
if( aEdit )
|
|
|
|
{
|
|
|
|
aViaSizeSelectBox->Append( wxT( "---" ) );
|
|
|
|
aViaSizeSelectBox->Append( _( "Edit pre-defined sizes..." ) );
|
|
|
|
}
|
2018-11-17 00:33:20 +00:00
|
|
|
|
2014-05-13 09:22:51 +00:00
|
|
|
if( GetDesignSettings().GetViaSizeIndex() >= GetDesignSettings().m_ViasDimensionsList.size() )
|
|
|
|
GetDesignSettings().SetViaSizeIndex( 0 );
|
2011-12-16 13:32:23 +00:00
|
|
|
|
2018-04-28 15:22:25 +00:00
|
|
|
aViaSizeSelectBox->SetSelection( GetDesignSettings().GetViaSizeIndex() );
|
2011-02-21 13:54:29 +00:00
|
|
|
}
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2013-09-02 15:26:52 +00:00
|
|
|
void PCB_EDIT_FRAME::ReCreateLayerBox( bool aForceResizeToolbar )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2013-09-02 15:26:52 +00:00
|
|
|
if( m_SelLayerBox == NULL || m_mainToolBar == NULL )
|
|
|
|
return;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2013-09-02 15:26:52 +00:00
|
|
|
m_SelLayerBox->SetToolTip( _( "+/- to switch" ) );
|
2018-02-14 22:07:59 +00:00
|
|
|
m_SelLayerBox->m_hotkeys = g_Board_Editor_Hotkeys_Descr;
|
2010-11-02 23:13:56 +00:00
|
|
|
m_SelLayerBox->Resync();
|
2008-04-29 13:35:26 +00:00
|
|
|
|
2013-09-02 15:26:52 +00:00
|
|
|
if( aForceResizeToolbar )
|
|
|
|
{
|
|
|
|
// the layer box can have its size changed
|
|
|
|
// Update the aui manager, to take in account the new size
|
|
|
|
m_auimgr.Update();
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
2015-10-14 18:12:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
void PCB_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
int id = event.GetId();
|
|
|
|
bool state = event.IsChecked();
|
2017-10-30 17:21:07 +00:00
|
|
|
auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions();
|
2015-10-14 18:12:17 +00:00
|
|
|
|
|
|
|
switch( id )
|
|
|
|
{
|
|
|
|
case ID_TB_OPTIONS_DRC_OFF:
|
2017-08-04 12:43:02 +00:00
|
|
|
Settings().m_legacyDrcOn = !state;
|
2015-10-14 18:12:17 +00:00
|
|
|
|
|
|
|
if( GetToolId() == ID_TRACK_BUTT )
|
|
|
|
{
|
2017-08-04 12:43:02 +00:00
|
|
|
if( Settings().m_legacyDrcOn )
|
2015-10-14 18:12:17 +00:00
|
|
|
m_canvas->SetCursor( wxCURSOR_PENCIL );
|
|
|
|
else
|
|
|
|
m_canvas->SetCursor( wxCURSOR_QUESTION_ARROW );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_TB_OPTIONS_SHOW_RATSNEST:
|
2017-03-13 03:19:33 +00:00
|
|
|
SetElementVisibility( LAYER_RATSNEST, state );
|
2018-11-19 03:54:01 +00:00
|
|
|
PCB_BASE_FRAME::OnModify();
|
2017-03-22 13:51:07 +00:00
|
|
|
Compile_Ratsnest( NULL, true );
|
2015-10-14 18:12:17 +00:00
|
|
|
|
2018-06-19 09:27:38 +00:00
|
|
|
if( IsGalCanvasActive() )
|
|
|
|
{
|
|
|
|
// keep the ratsnest layer enabled in view, so it shows up when an item is dragged
|
|
|
|
auto view = GetGalCanvas()->GetView();
|
|
|
|
view->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
|
|
|
|
view->SetLayerVisible( LAYER_RATSNEST, true );
|
|
|
|
}
|
|
|
|
|
2015-10-14 18:12:17 +00:00
|
|
|
m_canvas->Refresh();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_TB_OPTIONS_SHOW_ZONES:
|
|
|
|
displ_opts->m_DisplayZonesMode = 0;
|
|
|
|
m_canvas->Refresh();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_TB_OPTIONS_SHOW_ZONES_DISABLE:
|
|
|
|
displ_opts->m_DisplayZonesMode = 1;
|
|
|
|
m_canvas->Refresh();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY:
|
|
|
|
displ_opts->m_DisplayZonesMode = 2;
|
|
|
|
m_canvas->Refresh();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_TB_OPTIONS_SHOW_VIAS_SKETCH:
|
|
|
|
displ_opts->m_DisplayViaFill = !state;
|
|
|
|
m_canvas->Refresh();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_TB_OPTIONS_SHOW_TRACKS_SKETCH:
|
|
|
|
displ_opts->m_DisplayPcbTrackFill = !state;
|
|
|
|
m_canvas->Refresh();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE:
|
|
|
|
{
|
|
|
|
displ_opts->m_ContrastModeDisplay = state;
|
|
|
|
m_canvas->Refresh();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2018-04-30 07:52:49 +00:00
|
|
|
case ID_TB_OPTIONS_CURVED_RATSNEST_LINES:
|
|
|
|
{
|
|
|
|
displ_opts->m_DisplayRatsnestLinesCurved = !state;
|
|
|
|
m_canvas->Refresh();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2015-10-14 18:12:17 +00:00
|
|
|
case ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR_MICROWAVE:
|
|
|
|
m_show_microwave_tools = state;
|
2018-08-11 16:04:46 +00:00
|
|
|
m_auimgr.GetPane( "MicrowaveToolbar" ).Show( m_show_microwave_tools );
|
2015-10-14 18:12:17 +00:00
|
|
|
m_auimgr.Update();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR:
|
|
|
|
// show auxiliary Vertical layers and visibility manager toolbar
|
|
|
|
m_show_layer_manager_tools = state;
|
2018-08-11 16:04:46 +00:00
|
|
|
m_auimgr.GetPane( "LayersManager" ).Show( m_show_layer_manager_tools );
|
2015-10-14 18:12:17 +00:00
|
|
|
m_auimgr.Update();
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2017-08-01 11:12:59 +00:00
|
|
|
DisplayErrorMessage( this, "Invalid toolbar option",
|
|
|
|
"PCB_EDIT_FRAME::OnSelectOptionToolbar error \n (event not handled!)" );
|
2015-10-14 18:12:17 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|