Move scaled toolbar separator into ACTION_TOOLBAR

* Ensure all separators are scaled separators
* Clean up toolbar creation functions
This commit is contained in:
Ian McInerney 2020-06-17 12:03:25 +01:00 committed by Jon Evans
parent 05a89863c5
commit 52856a8ce4
18 changed files with 233 additions and 243 deletions

View File

@ -52,51 +52,49 @@ void EDA_3D_VIEWER::ReCreateMainToolbar()
m_mainToolBar->AddTool( ID_RELOAD3D_BOARD, wxEmptyString,
KiScaledBitmap( import3d_xpm, this ), _( "Reload board" ) );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->AddTool( ID_TOOL_SCREENCOPY_TOCLIBBOARD, wxEmptyString,
KiScaledBitmap( copy_xpm, this ),
_( "Copy 3D image to clipboard" ) );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->AddTool( ID_TOOL_SET_VISIBLE_ITEMS, wxEmptyString,
KiScaledBitmap( read_setup_xpm, this ),
_( "Set display options, and some layers visibility" ) );
m_mainToolBar->AddSeparator();
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->AddTool( ID_RENDER_CURRENT_VIEW, wxEmptyString,
KiScaledBitmap( render_mode_xpm, this ),
_( "Render current view using Raytracing" ), wxITEM_CHECK );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( ACTIONS::zoomRedraw );
m_mainToolBar->Add( ACTIONS::zoomInCenter );
m_mainToolBar->Add( ACTIONS::zoomOutCenter );
m_mainToolBar->Add( ACTIONS::zoomFitScreen );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( EDA_3D_ACTIONS::rotateXCW );
m_mainToolBar->Add( EDA_3D_ACTIONS::rotateXCCW );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( EDA_3D_ACTIONS::rotateYCW );
m_mainToolBar->Add( EDA_3D_ACTIONS::rotateYCCW );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( EDA_3D_ACTIONS::rotateZCW );
m_mainToolBar->Add( EDA_3D_ACTIONS::rotateZCCW );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( EDA_3D_ACTIONS::flipView );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( EDA_3D_ACTIONS::moveLeft );
m_mainToolBar->Add( EDA_3D_ACTIONS::moveRight );
m_mainToolBar->Add( EDA_3D_ACTIONS::moveUp );
m_mainToolBar->Add( EDA_3D_ACTIONS::moveDown );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( EDA_3D_ACTIONS::toggleOrtho, ACTION_TOOLBAR::TOGGLE );
m_mainToolBar->Realize();

View File

@ -164,24 +164,6 @@ wxBitmap KiScaledBitmap( const wxBitmap& aBitmap, wxWindow* aWindow )
}
void KiScaledSeparator( wxAuiToolBar* aToolbar, wxWindow* aWindow )
{
const int scale = get_scale_factor( aWindow );
if( scale > 4 )
{
aToolbar->AddSpacer( 16 * ( scale - 4 ) / 4 );
}
aToolbar->AddSeparator();
if( scale > 4 )
{
aToolbar->AddSpacer( 16 * ( scale - 4 ) / 4 );
}
}
wxBitmap* KiBitmapNew( BITMAP_DEF aBitmap )
{
wxMemoryInputStream is( aBitmap->png, aBitmap->byteCount );

View File

@ -22,13 +22,14 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <functional>
#include <bitmaps.h>
#include <eda_draw_frame.h>
#include <functional>
#include <tool/action_toolbar.h>
#include <tool/actions.h>
#include <tool/tool_event.h>
#include <tool/tool_manager.h>
#include <tool/tool_interactive.h>
#include <tool/action_toolbar.h>
#include <tool/tool_manager.h>
ACTION_TOOLBAR::ACTION_TOOLBAR( EDA_BASE_FRAME* parent, wxWindowID id, const wxPoint& pos,
@ -66,6 +67,23 @@ void ACTION_TOOLBAR::AddButton( const TOOL_ACTION& aAction )
}
void ACTION_TOOLBAR::AddScaledSeparator( wxWindow* aWindow )
{
int scale = Pgm().GetCommonSettings()->m_Appearance.icon_scale;
if( scale == 0 )
scale = KiIconScale( aWindow );
if( scale > 4 )
AddSpacer( 16 * ( scale - 4 ) / 4 );
AddSeparator();
if( scale > 4 )
AddSpacer( 16 * ( scale - 4 ) / 4 );
}
void ACTION_TOOLBAR::SetToolBitmap( const TOOL_ACTION& aAction, const wxBitmap& aBitmap )
{
int toolId = aAction.GetId() + ACTION_ID;

View File

@ -192,23 +192,22 @@ void DISPLAY_FOOTPRINTS_FRAME::ReCreateVToolbar()
void DISPLAY_FOOTPRINTS_FRAME::ReCreateOptToolbar()
{
if( m_optionsToolBar )
return;
// Create options tool bar.
m_optionsToolBar->Clear();
else
m_optionsToolBar = new ACTION_TOOLBAR( this, ID_OPT_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
m_optionsToolBar->Add( ACTIONS::selectionTool, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::measureTool, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->AddSeparator();
m_optionsToolBar->AddScaledSeparator( this );
m_optionsToolBar->Add( ACTIONS::toggleGrid, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::togglePolarCoords, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::imperialUnits, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::metricUnits, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::toggleCursorStyle, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->AddSeparator();
m_optionsToolBar->AddScaledSeparator( this );
m_optionsToolBar->Add( PCB_ACTIONS::showPadNumbers, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( PCB_ACTIONS::padDisplayMode, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( PCB_ACTIONS::textOutlines, ACTION_TOOLBAR::TOGGLE );
@ -220,9 +219,16 @@ void DISPLAY_FOOTPRINTS_FRAME::ReCreateOptToolbar()
void DISPLAY_FOOTPRINTS_FRAME::ReCreateHToolbar()
{
if( m_mainToolBar != NULL )
return;
// 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 ( m_zoomSelectBox and m_gridSelectBox ), and therefore do not delete them
// So we do not recreate them after clearing the tools.
if( m_mainToolBar )
m_mainToolBar->Clear();
else
m_mainToolBar = new ACTION_TOOLBAR( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
@ -233,22 +239,26 @@ void DISPLAY_FOOTPRINTS_FRAME::ReCreateHToolbar()
m_mainToolBar->Add( ACTIONS::zoomTool, ACTION_TOOLBAR::TOGGLE );
m_mainToolBar->Add( PCB_ACTIONS::zoomFootprintAutomatically, ACTION_TOOLBAR::TOGGLE );
m_mainToolBar->AddSeparator();
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( ACTIONS::show3DViewer );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
// Grid selection choice box.
if( !m_gridSelectBox )
m_gridSelectBox = new wxChoice( m_mainToolBar, ID_ON_GRID_SELECT,
wxDefaultPosition, wxDefaultSize, 0, NULL );
UpdateGridSelectBox();
m_mainToolBar->AddControl( m_gridSelectBox );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
// Zoom selection choice box.
if( !m_zoomSelectBox )
m_zoomSelectBox = new wxChoice( m_mainToolBar, ID_ON_ZOOM_SELECT,
wxDefaultPosition, wxDefaultSize, 0, NULL );
UpdateZoomSelectBox();
m_mainToolBar->AddControl( m_zoomSelectBox );

View File

@ -42,25 +42,25 @@ void CVPCB_MAINFRAME::ReCreateHToolbar()
m_mainToolBar->Add( CVPCB_ACTIONS::saveAssociations );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( ACTIONS::showFootprintLibTable );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( CVPCB_ACTIONS::showFootprintViewer );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( CVPCB_ACTIONS::gotoPreviousNA );
m_mainToolBar->Add( CVPCB_ACTIONS::gotoNextNA );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( ACTIONS::undo );
m_mainToolBar->Add( ACTIONS::redo );
m_mainToolBar->Add( CVPCB_ACTIONS::autoAssociate );
m_mainToolBar->Add( CVPCB_ACTIONS::deleteAll );
// Add tools for footprint names filtering:
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
// wxGTK with GTK3 has a serious issue with bold texts: strings are incorrectly sized
// and truncated after the first space.
@ -78,7 +78,7 @@ void CVPCB_MAINFRAME::ReCreateHToolbar()
m_mainToolBar->Add( CVPCB_ACTIONS::filterFPbyPin, true );
m_mainToolBar->Add( CVPCB_ACTIONS::FilterFPbyLibrary, true );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( CVPCB_ACTIONS::FilterFPbyTextPattern, true );
m_tcFilterString = new wxTextCtrl( m_mainToolBar, ID_CVPCB_FILTER_TEXT_EDIT );

View File

@ -53,7 +53,7 @@ void LIB_EDIT_FRAME::ReCreateVToolbar()
// Set up toolbar
m_drawToolBar->Add( ACTIONS::selectionTool, ACTION_TOOLBAR::TOGGLE );
KiScaledSeparator( m_drawToolBar, this );
m_drawToolBar->AddScaledSeparator( this );
m_drawToolBar->Add( EE_ACTIONS::placeSymbolPin, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( EE_ACTIONS::placeSymbolText, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( EE_ACTIONS::drawSymbolRectangle, ACTION_TOOLBAR::TOGGLE );
@ -88,30 +88,30 @@ void LIB_EDIT_FRAME::ReCreateHToolbar()
m_mainToolBar->Add( EE_ACTIONS::newSymbol );
m_mainToolBar->Add( ACTIONS::saveAll );
m_mainToolBar->AddSeparator();
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( ACTIONS::undo );
m_mainToolBar->Add( ACTIONS::redo );
m_mainToolBar->AddSeparator();
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( ACTIONS::zoomRedraw );
m_mainToolBar->Add( ACTIONS::zoomInCenter );
m_mainToolBar->Add( ACTIONS::zoomOutCenter );
m_mainToolBar->Add( ACTIONS::zoomFitScreen );
m_mainToolBar->Add( ACTIONS::zoomTool, ACTION_TOOLBAR::TOGGLE );
m_mainToolBar->AddSeparator();
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( EE_ACTIONS::symbolProperties );
m_mainToolBar->Add( EE_ACTIONS::pinTable );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( EE_ACTIONS::showDatasheet );
m_mainToolBar->Add( EE_ACTIONS::runERC );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( EE_ACTIONS::showDeMorganStandard, ACTION_TOOLBAR::TOGGLE );
m_mainToolBar->Add( EE_ACTIONS::showDeMorganAlternate, ACTION_TOOLBAR::TOGGLE );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
if( m_unitSelectBox == nullptr )
m_unitSelectBox = new wxComboBox( m_mainToolBar, ID_LIBEDIT_SELECT_PART_NUMBER,
@ -119,10 +119,10 @@ void LIB_EDIT_FRAME::ReCreateHToolbar()
nullptr, wxCB_READONLY );
m_mainToolBar->AddControl( m_unitSelectBox );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( EE_ACTIONS::toggleSyncedPinsMode, ACTION_TOOLBAR::TOGGLE );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( EE_ACTIONS::addSymbolToSchematic );
// after adding the buttons to the toolbar, must call Realize() to reflect the changes
@ -139,14 +139,12 @@ void LIB_EDIT_FRAME::ReCreateOptToolbar()
wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
ACTION_TOOLBAR* optToolbar = static_cast<ACTION_TOOLBAR*>( m_optionsToolBar );
optToolbar->Add( ACTIONS::toggleGrid, ACTION_TOOLBAR::TOGGLE );
optToolbar->Add( ACTIONS::imperialUnits, ACTION_TOOLBAR::TOGGLE );
optToolbar->Add( ACTIONS::metricUnits, ACTION_TOOLBAR::TOGGLE );
optToolbar->Add( ACTIONS::toggleCursorStyle, ACTION_TOOLBAR::TOGGLE );
optToolbar->Add( EE_ACTIONS::showElectricalTypes, ACTION_TOOLBAR::TOGGLE );
optToolbar->Add( EE_ACTIONS::showComponentTree, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::toggleGrid, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::imperialUnits, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::metricUnits, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::toggleCursorStyle, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( EE_ACTIONS::showElectricalTypes, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( EE_ACTIONS::showComponentTree, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Realize();
}

View File

@ -43,14 +43,11 @@ void LIB_VIEW_FRAME::ReCreateHToolbar()
wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
ACTION_TOOLBAR* toolbar = static_cast<ACTION_TOOLBAR*>( m_mainToolBar );
wxString msg;
m_mainToolBar->AddTool( ID_LIBVIEW_SELECT_PART, wxEmptyString,
KiScaledBitmap( add_component_xpm, this ),
_( "Select symbol to browse" ) );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->AddTool( ID_LIBVIEW_PREVIOUS, wxEmptyString,
KiScaledBitmap( lib_previous_xpm, this ),
_( "Display previous symbol" ) );
@ -59,27 +56,27 @@ void LIB_VIEW_FRAME::ReCreateHToolbar()
KiScaledBitmap( lib_next_xpm, this ),
_( "Display next symbol" ) );
toolbar->AddSeparator();
toolbar->Add( ACTIONS::zoomRedraw );
toolbar->Add( ACTIONS::zoomInCenter );
toolbar->Add( ACTIONS::zoomOutCenter );
toolbar->Add( ACTIONS::zoomFitScreen );
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( ACTIONS::zoomRedraw );
m_mainToolBar->Add( ACTIONS::zoomInCenter );
m_mainToolBar->Add( ACTIONS::zoomOutCenter );
m_mainToolBar->Add( ACTIONS::zoomFitScreen );
KiScaledSeparator( m_mainToolBar, this );
toolbar->Add( EE_ACTIONS::showDeMorganStandard, ACTION_TOOLBAR::TOGGLE );
toolbar->Add( EE_ACTIONS::showDeMorganAlternate, ACTION_TOOLBAR::TOGGLE );
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( EE_ACTIONS::showDeMorganStandard, ACTION_TOOLBAR::TOGGLE );
m_mainToolBar->Add( EE_ACTIONS::showDeMorganAlternate, ACTION_TOOLBAR::TOGGLE );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
if( m_unitChoice == nullptr )
m_unitChoice = new wxChoice( m_mainToolBar, ID_LIBVIEW_SELECT_PART_NUMBER,
wxDefaultPosition, wxSize( 150, -1 ) );
m_mainToolBar->AddControl( m_unitChoice );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( EE_ACTIONS::showDatasheet );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( EE_ACTIONS::addSymbolToSchematic );
// after adding the buttons to the toolbar, must call Realize() to reflect the changes

View File

@ -44,7 +44,6 @@ void SCH_EDIT_FRAME::ReCreateHToolbar()
m_mainToolBar = new ACTION_TOOLBAR( this, ID_H_TOOLBAR,
wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
wxString msg;
// Set up toolbar
if( Kiface().IsSingle() ) // not when under a project mgr
@ -55,49 +54,49 @@ void SCH_EDIT_FRAME::ReCreateHToolbar()
m_mainToolBar->Add( ACTIONS::save );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( EE_ACTIONS::schematicSetup );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( ACTIONS::pageSettings );
m_mainToolBar->Add( ACTIONS::print );
m_mainToolBar->Add( ACTIONS::plot );
m_mainToolBar->AddSeparator();
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( ACTIONS::paste );
m_mainToolBar->AddSeparator();
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( ACTIONS::undo );
m_mainToolBar->Add( ACTIONS::redo );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( ACTIONS::find );
m_mainToolBar->Add( ACTIONS::findAndReplace );
m_mainToolBar->AddSeparator();
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( ACTIONS::zoomRedraw );
m_mainToolBar->Add( ACTIONS::zoomInCenter );
m_mainToolBar->Add( ACTIONS::zoomOutCenter );
m_mainToolBar->Add( ACTIONS::zoomFitScreen );
m_mainToolBar->Add( ACTIONS::zoomTool, ACTION_TOOLBAR::TOGGLE );
m_mainToolBar->AddSeparator();
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( EE_ACTIONS::navigateHierarchy );
m_mainToolBar->Add( EE_ACTIONS::leaveSheet );
m_mainToolBar->AddSeparator();
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( ACTIONS::showSymbolEditor );
m_mainToolBar->Add( ACTIONS::showSymbolBrowser );
m_mainToolBar->Add( ACTIONS::showFootprintEditor );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( EE_ACTIONS::annotate );
m_mainToolBar->Add( EE_ACTIONS::runERC );
m_mainToolBar->Add( EE_ACTIONS::assignFootprints );
m_mainToolBar->Add( EE_ACTIONS::editSymbolFields );
m_mainToolBar->Add( EE_ACTIONS::generateBOM );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( EE_ACTIONS::showPcbNew );
// after adding the tools to the toolbar, must call Realize() to reflect the changes
@ -119,7 +118,7 @@ void SCH_EDIT_FRAME::ReCreateVToolbar()
m_drawToolBar->Add( ACTIONS::selectionTool, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( EE_ACTIONS::highlightNetTool, ACTION_TOOLBAR::TOGGLE );
KiScaledSeparator( m_drawToolBar, this );
m_drawToolBar->AddScaledSeparator( this );
m_drawToolBar->Add( EE_ACTIONS::placeSymbol, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( EE_ACTIONS::placePower, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( EE_ACTIONS::drawWire, ACTION_TOOLBAR::TOGGLE );
@ -133,7 +132,7 @@ void SCH_EDIT_FRAME::ReCreateVToolbar()
m_drawToolBar->Add( EE_ACTIONS::drawSheet, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( EE_ACTIONS::importSheetPin, ACTION_TOOLBAR::TOGGLE );
KiScaledSeparator( m_drawToolBar, this );
m_drawToolBar->AddScaledSeparator( this );
m_drawToolBar->Add( EE_ACTIONS::drawLines, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( EE_ACTIONS::placeSchematicText, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( EE_ACTIONS::placeImage, ACTION_TOOLBAR::TOGGLE );

View File

@ -39,7 +39,12 @@
void GERBVIEW_FRAME::ReCreateHToolbar()
{
wxString msg;
// 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 ( m_TextInfo and m_SelLayerBox ), and therefore do not delete them
// So we do not recreate them after clearing the tools.
if( m_mainToolBar )
m_mainToolBar->Clear();
@ -59,11 +64,11 @@ void GERBVIEW_FRAME::ReCreateHToolbar()
m_mainToolBar->Add( GERBVIEW_ACTIONS::openGerber );
m_mainToolBar->Add( GERBVIEW_ACTIONS::openDrillFile );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->AddTool( wxID_PRINT, wxEmptyString, KiScaledBitmap( print_button_xpm, this ),
_( "Print layers" ) );
m_mainToolBar->AddSeparator();
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( ACTIONS::zoomRedraw );
m_mainToolBar->Add( ACTIONS::zoomInCenter );
m_mainToolBar->Add( ACTIONS::zoomOutCenter );
@ -71,17 +76,20 @@ void GERBVIEW_FRAME::ReCreateHToolbar()
m_mainToolBar->Add( ACTIONS::zoomTool, ACTION_TOOLBAR::TOGGLE );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
if( !m_SelLayerBox )
m_SelLayerBox = new GBR_LAYER_BOX_SELECTOR( m_mainToolBar,
ID_TOOLBARH_GERBVIEW_SELECT_ACTIVE_LAYER,
wxDefaultPosition, wxDefaultSize, 0, NULL );
m_SelLayerBox->Resync();
m_SelLayerBox->Resync();
m_mainToolBar->AddControl( m_SelLayerBox );
if( !m_TextInfo )
m_TextInfo = new wxTextCtrl( m_mainToolBar, wxID_ANY, wxEmptyString, wxDefaultPosition,
wxDefaultSize, wxTE_READONLY );
m_mainToolBar->AddControl( m_TextInfo );
// after adding the buttons to the toolbar, must call Realize() to reflect the changes
@ -94,7 +102,9 @@ void GERBVIEW_FRAME::ReCreateAuxiliaryToolbar()
wxWindowUpdateLocker dummy( this );
wxStaticText* text;
if( !m_auxiliaryToolBar )
if( m_auxiliaryToolBar )
m_auxiliaryToolBar->Clear();
else
m_auxiliaryToolBar = new ACTION_TOOLBAR( this, ID_AUX_TOOLBAR,
wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
@ -147,7 +157,7 @@ void GERBVIEW_FRAME::ReCreateAuxiliaryToolbar()
if( !m_gridSelectBox )
{
KiScaledSeparator( m_auxiliaryToolBar, this );
m_auxiliaryToolBar->AddScaledSeparator( this );
m_gridSelectBox = new wxChoice( m_auxiliaryToolBar, ID_ON_GRID_SELECT,
wxDefaultPosition, wxDefaultSize, 0, nullptr );
m_auxiliaryToolBar->AddControl( m_gridSelectBox );
@ -155,7 +165,7 @@ void GERBVIEW_FRAME::ReCreateAuxiliaryToolbar()
if( !m_zoomSelectBox )
{
KiScaledSeparator( m_auxiliaryToolBar, this );
m_auxiliaryToolBar->AddScaledSeparator( this );
m_zoomSelectBox = new wxChoice( m_auxiliaryToolBar, ID_ON_ZOOM_SELECT,
wxDefaultPosition, wxDefaultSize, 0, nullptr );
m_auxiliaryToolBar->AddControl( m_zoomSelectBox );
@ -191,16 +201,7 @@ void GERBVIEW_FRAME::ReCreateAuxiliaryToolbar()
void GERBVIEW_FRAME::ReCreateVToolbar()
{
if( m_drawToolBar )
return;
m_drawToolBar = new ACTION_TOOLBAR( this, ID_V_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
m_optionsToolBar->Add( ACTIONS::selectionTool, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->AddSeparator();
m_drawToolBar->Realize();
// This toolbar isn't used currently
}
@ -218,14 +219,14 @@ void GERBVIEW_FRAME::ReCreateOptToolbar()
m_optionsToolBar->Add( ACTIONS::selectionTool, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::measureTool, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->AddSeparator();
m_optionsToolBar->AddScaledSeparator( this );
m_optionsToolBar->Add( ACTIONS::toggleGrid, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::togglePolarCoords, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::imperialUnits, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::metricUnits, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::toggleCursorStyle, ACTION_TOOLBAR::TOGGLE );
KiScaledSeparator( m_mainToolBar, this );
m_optionsToolBar->AddScaledSeparator( this );
m_optionsToolBar->Add( GERBVIEW_ACTIONS::flashedDisplayOutlines, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( GERBVIEW_ACTIONS::linesDisplayOutlines, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( GERBVIEW_ACTIONS::polygonsDisplayOutlines, ACTION_TOOLBAR::TOGGLE );
@ -235,7 +236,7 @@ void GERBVIEW_FRAME::ReCreateOptToolbar()
m_optionsToolBar->Add( ACTIONS::highContrastMode, ACTION_TOOLBAR::TOGGLE );
// Tools to show/hide toolbars:
KiScaledSeparator( m_mainToolBar, this );
m_optionsToolBar->AddScaledSeparator( this );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR,
wxEmptyString,
KiScaledBitmap( layers_manager_xpm, this ),

View File

@ -32,7 +32,6 @@
class wxBitmap; // only to define wxBitmap
class EDA_DRAW_FRAME;
class wxWindow;
class wxAuiToolBar;
#include <config.h>
#include <wx/gdicmn.h> // wxBitmapType
@ -64,11 +63,6 @@ wxBitmap KiScaledBitmap( BITMAP_DEF aBitmap, wxWindow* aWindow );
*/
wxBitmap KiScaledBitmap( const wxBitmap& aBitmap, wxWindow* aWindow );
/**
* Add a separator to the given toolbar scaled the same way as KiScaledBitmap.
*/
void KiScaledSeparator( wxAuiToolBar* aToolbar, wxWindow* aWindow );
/**
* Return the automatic scale factor that would be used for a given window by
* KiScaledBitmap and KiScaledSeparator.

View File

@ -61,6 +61,14 @@ public:
*/
void AddButton( const TOOL_ACTION& aAction );
/**
* Add a separator that introduces space on either side to not squash the tools
* when scaled.
*
* @param aWindow is the window to get the scaling factor of
*/
void AddScaledSeparator( wxWindow* aWindow );
/**
* Function SetToolBitmap()
* Updates the bitmap of a particular tool. Not icon-based because we use it

View File

@ -184,7 +184,7 @@ void KICAD_MANAGER_FRAME::RecreateBaseHToolbar()
m_mainToolBar->Add( KICAD_MANAGER_ACTIONS::newFromTemplate );
m_mainToolBar->Add( KICAD_MANAGER_ACTIONS::openProject );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->AddTool( ID_SAVE_AND_ZIP_FILES, wxEmptyString,
KiScaledBitmap( zip_xpm, this ),
_( "Archive all project files" ) );
@ -193,10 +193,10 @@ void KICAD_MANAGER_FRAME::RecreateBaseHToolbar()
KiScaledBitmap( unzip_xpm, this ),
_( "Unarchive project files from zip archive" ) );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( ACTIONS::zoomRedraw );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->AddTool( ID_BROWSE_IN_FILE_EXPLORER, wxEmptyString,
KiScaledBitmap( directory_browser_xpm, this ),
#ifdef __APPLE__
@ -223,11 +223,11 @@ void KICAD_MANAGER_FRAME::RecreateLauncher()
m_launcher->Add( KICAD_MANAGER_ACTIONS::editSchematic );
m_launcher->Add( KICAD_MANAGER_ACTIONS::editSymbols );
KiScaledSeparator( m_launcher, this );
m_launcher->AddScaledSeparator( this );
m_launcher->Add( KICAD_MANAGER_ACTIONS::editPCB );
m_launcher->Add( KICAD_MANAGER_ACTIONS::editFootprints );
KiScaledSeparator( m_launcher, this );
m_launcher->AddScaledSeparator( this );
m_launcher->Add( KICAD_MANAGER_ACTIONS::viewGerbers );
m_launcher->Add( KICAD_MANAGER_ACTIONS::convertImage );
m_launcher->Add( KICAD_MANAGER_ACTIONS::showCalculator );

View File

@ -42,26 +42,26 @@ void PL_EDITOR_FRAME::ReCreateHToolbar()
m_mainToolBar->Add( ACTIONS::open );
m_mainToolBar->Add( ACTIONS::save );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( ACTIONS::print );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( ACTIONS::undo );
m_mainToolBar->Add( ACTIONS::redo );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( ACTIONS::zoomRedraw );
m_mainToolBar->Add( ACTIONS::zoomInCenter );
m_mainToolBar->Add( ACTIONS::zoomOutCenter );
m_mainToolBar->Add( ACTIONS::zoomFitScreen );
m_mainToolBar->Add( ACTIONS::zoomTool, ACTION_TOOLBAR::TOGGLE );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( PL_ACTIONS::showInspector );
m_mainToolBar->Add( PL_ACTIONS::previewSettings );
// Display mode switch
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->AddTool( ID_SHOW_REAL_MODE, wxEmptyString,
KiScaledBitmap( pagelayout_normal_view_mode_xpm, this ),
_( "Show title block in preview mode:\n"
@ -73,7 +73,7 @@ void PL_EDITOR_FRAME::ReCreateHToolbar()
"text placeholders are shown as ${keyword} tokens."),
wxITEM_CHECK );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
wxString choiceList[5] =
{
@ -127,14 +127,14 @@ void PL_EDITOR_FRAME::ReCreateVToolbar()
m_drawToolBar->Add( ACTIONS::selectionTool, ACTION_TOOLBAR::TOGGLE );
KiScaledSeparator( m_drawToolBar, this );
m_drawToolBar->AddScaledSeparator( this );
m_drawToolBar->Add( PL_ACTIONS::drawLine, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( PL_ACTIONS::drawRectangle, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( PL_ACTIONS::placeText, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( PL_ACTIONS::placeImage, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( PL_ACTIONS::appendImportedWorksheet, ACTION_TOOLBAR::TOGGLE );
KiScaledSeparator( m_drawToolBar, this );
m_drawToolBar->AddScaledSeparator( this );
m_drawToolBar->Add( ACTIONS::deleteTool, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Realize();

View File

@ -588,10 +588,9 @@ void FOOTPRINT_WIZARD_FRAME::Update3DView( bool aForceReload, const wxString* aT
void FOOTPRINT_WIZARD_FRAME::ReCreateHToolbar()
{
wxString msg;
if( !m_mainToolBar )
{
if( m_mainToolBar )
m_mainToolBar->Clear();
else
m_mainToolBar = new ACTION_TOOLBAR( this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
@ -600,12 +599,12 @@ void FOOTPRINT_WIZARD_FRAME::ReCreateHToolbar()
KiBitmap( module_wizard_xpm ),
_( "Select wizard script to run" ) );
m_mainToolBar->AddSeparator();
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->AddTool( ID_FOOTPRINT_WIZARD_RESET_TO_DEFAULT, wxEmptyString,
KiBitmap( reload_xpm ),
_( "Reset wizard parameters to default") );
m_mainToolBar->AddSeparator();
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->AddTool( ID_FOOTPRINT_WIZARD_PREVIOUS, wxEmptyString,
KiBitmap( lib_previous_xpm ),
_( "Select previous parameters page" ) );
@ -613,17 +612,17 @@ void FOOTPRINT_WIZARD_FRAME::ReCreateHToolbar()
KiBitmap( lib_next_xpm ),
_( "Select next parameters page" ) );
m_mainToolBar->AddSeparator();
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( ACTIONS::show3DViewer );
m_mainToolBar->AddSeparator();
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( ACTIONS::zoomRedraw );
m_mainToolBar->Add( ACTIONS::zoomInCenter );
m_mainToolBar->Add( ACTIONS::zoomOutCenter );
m_mainToolBar->Add( ACTIONS::zoomFitScreen );
// The footprint wizard always can export the current footprint
m_mainToolBar->AddSeparator();
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->AddTool( ID_FOOTPRINT_WIZARD_DONE,
wxEmptyString, KiBitmap( export_footprint_names_xpm ),
_( "Export footprint to editor" ) );
@ -631,9 +630,6 @@ void FOOTPRINT_WIZARD_FRAME::ReCreateHToolbar()
// after adding the buttons to the toolbar, must call Realize() to
// reflect the changes
m_mainToolBar->Realize();
}
m_mainToolBar->Refresh();
}

View File

@ -396,9 +396,9 @@ void PCB_EDIT_FRAME::AddActionPluginTools()
if( GetActionPluginButtonVisible( ap->GetPluginPath(), ap->GetShowToolbarButton() ) )
{
if ( need_separator )
if( need_separator )
{
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
need_separator = false;
}

View File

@ -60,25 +60,25 @@ void FOOTPRINT_EDIT_FRAME::ReCreateHToolbar()
else
m_mainToolBar->Add( PCB_ACTIONS::saveToLibrary );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( ACTIONS::print );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( ACTIONS::undo );
m_mainToolBar->Add( ACTIONS::redo );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( ACTIONS::zoomRedraw );
m_mainToolBar->Add( ACTIONS::zoomInCenter );
m_mainToolBar->Add( ACTIONS::zoomOutCenter );
m_mainToolBar->Add( ACTIONS::zoomFitScreen );
m_mainToolBar->Add( ACTIONS::zoomTool, ACTION_TOOLBAR::TOGGLE );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( PCB_ACTIONS::footprintProperties );
m_mainToolBar->Add( PCB_ACTIONS::defaultPadProperties );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->AddTool( ID_MODEDIT_LOAD_MODULE_FROM_BOARD, wxEmptyString,
KiScaledBitmap( load_module_board_xpm, this ),
_( "Load footprint from current board" ) );
@ -88,13 +88,13 @@ void FOOTPRINT_EDIT_FRAME::ReCreateHToolbar()
_( "Insert footprint into current board" ) );
#if 0 // Currently there is no check footprint function defined, so do not show this tool
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->AddTool( ID_MODEDIT_CHECK, wxEmptyString,
KiScaledBitmap( module_check_xpm, this ),
_( "Check footprint" ) );
#endif
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
// Grid selection choice box.
if( m_gridSelectBox == nullptr )
@ -104,7 +104,7 @@ void FOOTPRINT_EDIT_FRAME::ReCreateHToolbar()
UpdateGridSelectBox();
m_mainToolBar->AddControl( m_gridSelectBox );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
// Zoom selection choice box.
if( m_zoomSelectBox == nullptr )
@ -114,7 +114,7 @@ void FOOTPRINT_EDIT_FRAME::ReCreateHToolbar()
UpdateZoomSelectBox();
m_mainToolBar->AddControl( m_zoomSelectBox );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
// Layer selection choice box.
if( m_selLayerBox == nullptr )
@ -147,7 +147,7 @@ void FOOTPRINT_EDIT_FRAME::ReCreateVToolbar()
m_drawToolBar->Add( ACTIONS::selectionTool, ACTION_TOOLBAR::TOGGLE );
KiScaledSeparator( m_drawToolBar, this );
m_drawToolBar->AddScaledSeparator( this );
m_drawToolBar->Add( PCB_ACTIONS::placePad, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( PCB_ACTIONS::drawLine, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( PCB_ACTIONS::drawRectangle, ACTION_TOOLBAR::TOGGLE );
@ -158,7 +158,7 @@ void FOOTPRINT_EDIT_FRAME::ReCreateVToolbar()
m_drawToolBar->Add( PCB_ACTIONS::placeText, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( ACTIONS::deleteTool, ACTION_TOOLBAR::TOGGLE );
KiScaledSeparator( m_drawToolBar, this );
m_drawToolBar->AddScaledSeparator( this );
m_drawToolBar->Add( PCB_ACTIONS::setAnchor, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( PCB_ACTIONS::gridSetOrigin, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( ACTIONS::measureTool, ACTION_TOOLBAR::TOGGLE );
@ -181,13 +181,13 @@ void FOOTPRINT_EDIT_FRAME::ReCreateOptToolbar()
m_optionsToolBar->Add( ACTIONS::metricUnits, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::toggleCursorStyle, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->AddSeparator();
m_optionsToolBar->AddScaledSeparator( this );
m_optionsToolBar->Add( PCB_ACTIONS::padDisplayMode, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( PCB_ACTIONS::graphicsOutlines, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( PCB_ACTIONS::textOutlines, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::highContrastMode, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->AddSeparator();
m_optionsToolBar->AddScaledSeparator( this );
m_optionsToolBar->Add( PCB_ACTIONS::toggleFootprintTree, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Realize();

View File

@ -42,8 +42,6 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateHToolbar()
// them ( m_zoomSelectBox and m_gridSelectBox ), and therefore do not delete them
// So we do not recreate them after clearing the tools.
wxString msg;
if( m_mainToolBar )
m_mainToolBar->Clear();
else
@ -58,7 +56,7 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateHToolbar()
KiScaledBitmap( lib_next_xpm, this ),
_( "Display next footprint" ) );
m_mainToolBar->AddSeparator();
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( ACTIONS::zoomRedraw );
m_mainToolBar->Add( ACTIONS::zoomInCenter );
m_mainToolBar->Add( ACTIONS::zoomOutCenter );
@ -66,13 +64,13 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateHToolbar()
m_mainToolBar->Add( ACTIONS::zoomTool, ACTION_TOOLBAR::TOGGLE );
m_mainToolBar->Add( PCB_ACTIONS::zoomFootprintAutomatically, ACTION_TOOLBAR::TOGGLE );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( ACTIONS::show3DViewer );
m_mainToolBar->AddTool( ID_ADD_FOOTPRINT_TO_BOARD, wxEmptyString,
KiScaledBitmap( export_xpm, this ),
_( "Insert footprint in board" ) );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
// Grid selection choice box.
if( m_gridSelectBox == nullptr )
@ -82,7 +80,7 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateHToolbar()
UpdateGridSelectBox();
m_mainToolBar->AddControl( m_gridSelectBox );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
// Zoom selection choice box.
if( m_zoomSelectBox == nullptr )
@ -95,30 +93,28 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateHToolbar()
// after adding the buttons to the toolbar, must call Realize() to
// reflect the changes
m_mainToolBar->Realize();
m_mainToolBar->Refresh();
}
void FOOTPRINT_VIEWER_FRAME::ReCreateOptToolbar()
{
if( m_optionsToolBar )
return;
// Create options tool bar.
m_optionsToolBar->Clear();
else
m_optionsToolBar = new ACTION_TOOLBAR( this, ID_OPT_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
m_optionsToolBar->Add( ACTIONS::selectionTool, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::measureTool, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->AddSeparator();
m_optionsToolBar->AddScaledSeparator( this );
m_optionsToolBar->Add( ACTIONS::toggleGrid, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::togglePolarCoords, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::imperialUnits, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::metricUnits, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::toggleCursorStyle, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->AddSeparator();
m_optionsToolBar->AddScaledSeparator( this );
m_optionsToolBar->Add( PCB_ACTIONS::showPadNumbers, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( PCB_ACTIONS::padDisplayMode, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( PCB_ACTIONS::textOutlines, ACTION_TOOLBAR::TOGGLE );
@ -130,6 +126,7 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateOptToolbar()
void FOOTPRINT_VIEWER_FRAME::ReCreateVToolbar()
{
// This toolbar is not currently used
}

View File

@ -213,8 +213,6 @@ void PCB_EDIT_FRAME::ReCreateHToolbar()
// them and therefore do not delete them
// So we do not recreate them after clearing the tools.
wxString msg;
wxWindowUpdateLocker dummy( this );
if( m_mainToolBar )
@ -223,9 +221,6 @@ void PCB_EDIT_FRAME::ReCreateHToolbar()
m_mainToolBar = new ACTION_TOOLBAR( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
#define ADD_TOOL( id, xpm, tooltip ) \
m_mainToolBar->AddTool( id, wxEmptyString, KiScaledBitmap( xpm, this ), tooltip );
// Set up toolbar
if( Kiface().IsSingle() )
{
@ -235,37 +230,37 @@ void PCB_EDIT_FRAME::ReCreateHToolbar()
m_mainToolBar->Add( ACTIONS::save );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( PCB_ACTIONS::boardSetup );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( ACTIONS::pageSettings );
m_mainToolBar->Add( ACTIONS::print );
m_mainToolBar->Add( ACTIONS::plot );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( ACTIONS::undo );
m_mainToolBar->Add( ACTIONS::redo );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( ACTIONS::find );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( ACTIONS::zoomRedraw );
m_mainToolBar->Add( ACTIONS::zoomInCenter );
m_mainToolBar->Add( ACTIONS::zoomOutCenter );
m_mainToolBar->Add( ACTIONS::zoomFitScreen );
m_mainToolBar->Add( ACTIONS::zoomTool, ACTION_TOOLBAR::TOGGLE );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( ACTIONS::showFootprintEditor );
m_mainToolBar->Add( ACTIONS::showFootprintBrowser );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( ACTIONS::updatePcbFromSchematic );
m_mainToolBar->Add( PCB_ACTIONS::runDRC );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
if( m_SelLayerBox == nullptr )
{
@ -279,14 +274,14 @@ void PCB_EDIT_FRAME::ReCreateHToolbar()
m_mainToolBar->Add( PCB_ACTIONS::selectLayerPair );
PrepareLayerIndicator( true ); // Force rebuild of the bitmap with the active layer colors
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( PCB_ACTIONS::showEeschema );
// Access to the scripting console
#if defined(KICAD_SCRIPTING_WXPYTHON)
if( IsWxPythonLoaded() )
{
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( PCB_ACTIONS::showPythonConsole, ACTION_TOOLBAR::TOGGLE );
#if defined(KICAD_SCRIPTING) && defined(KICAD_SCRIPTING_ACTION_MENU)
@ -297,8 +292,6 @@ void PCB_EDIT_FRAME::ReCreateHToolbar()
// after adding the buttons to the toolbar, must call Realize() to reflect the changes
m_mainToolBar->Realize();
#undef ADD_TOOL
}
@ -327,27 +320,26 @@ void PCB_EDIT_FRAME::ReCreateOptToolbar()
m_optionsToolBar->Add( ACTIONS::metricUnits, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::toggleCursorStyle, ACTION_TOOLBAR::TOGGLE );
KiScaledSeparator( m_optionsToolBar, this );
m_optionsToolBar->AddScaledSeparator( this );
m_optionsToolBar->Add( PCB_ACTIONS::showRatsnest, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( PCB_ACTIONS::ratsnestLineMode, ACTION_TOOLBAR::TOGGLE );
KiScaledSeparator( m_optionsToolBar, this );
m_optionsToolBar->AddScaledSeparator( this );
m_optionsToolBar->Add( PCB_ACTIONS::zoneDisplayEnable, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( PCB_ACTIONS::zoneDisplayDisable, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( PCB_ACTIONS::zoneDisplayOutlines, ACTION_TOOLBAR::TOGGLE );
KiScaledSeparator( m_optionsToolBar, this );
m_optionsToolBar->AddScaledSeparator( this );
m_optionsToolBar->Add( PCB_ACTIONS::padDisplayMode, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( PCB_ACTIONS::viaDisplayMode, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( PCB_ACTIONS::trackDisplayMode, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::highContrastMode, ACTION_TOOLBAR::TOGGLE );
// Tools to show/hide toolbars:
KiScaledSeparator( m_optionsToolBar, this );
m_optionsToolBar->AddScaledSeparator( this );
m_optionsToolBar->Add( PCB_ACTIONS::showLayersManager, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( PCB_ACTIONS::showMicrowaveToolbar, ACTION_TOOLBAR::TOGGLE );
KiScaledSeparator( m_optionsToolBar, this );
m_optionsToolBar->Realize();
}
@ -366,14 +358,14 @@ void PCB_EDIT_FRAME::ReCreateVToolbar()
m_drawToolBar->Add( PCB_ACTIONS::highlightNetTool, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( PCB_ACTIONS::localRatsnestTool, ACTION_TOOLBAR::TOGGLE );
KiScaledSeparator( m_drawToolBar, this );
m_drawToolBar->AddScaledSeparator( this );
m_drawToolBar->Add( PCB_ACTIONS::placeModule, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( PCB_ACTIONS::routeSingleTrack, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( PCB_ACTIONS::drawVia, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( PCB_ACTIONS::drawZone, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( PCB_ACTIONS::drawZoneKeepout, ACTION_TOOLBAR::TOGGLE );
KiScaledSeparator( m_drawToolBar, this );
m_drawToolBar->AddScaledSeparator( this );
m_drawToolBar->Add( PCB_ACTIONS::drawLine, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( PCB_ACTIONS::drawCircle, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( PCB_ACTIONS::drawArc, ACTION_TOOLBAR::TOGGLE );
@ -383,7 +375,7 @@ void PCB_EDIT_FRAME::ReCreateVToolbar()
m_drawToolBar->Add( PCB_ACTIONS::placeTarget, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( ACTIONS::deleteTool, ACTION_TOOLBAR::TOGGLE );
KiScaledSeparator( m_drawToolBar, this );
m_drawToolBar->AddScaledSeparator( this );
m_drawToolBar->Add( PCB_ACTIONS::drillOrigin, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( PCB_ACTIONS::gridSetOrigin, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( ACTIONS::measureTool, ACTION_TOOLBAR::TOGGLE );
@ -409,7 +401,7 @@ void PCB_EDIT_FRAME::ReCreateMicrowaveVToolbar()
m_microWaveToolBar->Add( PCB_ACTIONS::microwaveCreateLine, ACTION_TOOLBAR::TOGGLE );
m_microWaveToolBar->Add( PCB_ACTIONS::microwaveCreateGap, ACTION_TOOLBAR::TOGGLE );
KiScaledSeparator( m_microWaveToolBar, this );
m_microWaveToolBar->AddScaledSeparator( this );
m_microWaveToolBar->Add( PCB_ACTIONS::microwaveCreateStub, ACTION_TOOLBAR::TOGGLE );
m_microWaveToolBar->Add( PCB_ACTIONS::microwaveCreateStubArc, ACTION_TOOLBAR::TOGGLE );
m_microWaveToolBar->Add( PCB_ACTIONS::microwaveCreateFunctionShape, ACTION_TOOLBAR::TOGGLE );
@ -461,7 +453,7 @@ void PCB_EDIT_FRAME::ReCreateAuxiliaryToolbar()
UpdateViaSizeSelectBox( m_SelViaSizeBox );
m_auxiliaryToolBar->AddControl( m_SelViaSizeBox );
KiScaledSeparator( m_auxiliaryToolBar, this );
m_auxiliaryToolBar->AddScaledSeparator( this );
// Creates box to display and choose strategy to handle tracks an vias sizes:
m_auxiliaryToolBar->AddTool( ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH, wxEmptyString,
@ -471,7 +463,7 @@ void PCB_EDIT_FRAME::ReCreateAuxiliaryToolbar()
wxITEM_CHECK );
// Add the box to display and select the current grid size:
KiScaledSeparator( m_auxiliaryToolBar, this );
m_auxiliaryToolBar->AddScaledSeparator( this );
if( m_gridSelectBox == nullptr )
m_gridSelectBox = new wxChoice( m_auxiliaryToolBar, ID_ON_GRID_SELECT,
@ -482,7 +474,7 @@ void PCB_EDIT_FRAME::ReCreateAuxiliaryToolbar()
m_auxiliaryToolBar->AddControl( m_gridSelectBox );
// Add the box to display and select the current Zoom
KiScaledSeparator( m_auxiliaryToolBar, this );
m_auxiliaryToolBar->AddScaledSeparator( this );
if( m_zoomSelectBox == nullptr )
m_zoomSelectBox = new wxChoice( m_auxiliaryToolBar, ID_ON_ZOOM_SELECT,