/* * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck * Copyright (C) 2012 Wayne Stambaugh * Copyright The KiCad Developers, see AUTHORS.txt for contributors. * * 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 3 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, see . */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include std::optional FOOTPRINT_EDIT_TOOLBAR_SETTINGS::DefaultToolbarConfig( TOOLBAR_LOC aToolbar ) { TOOLBAR_CONFIGURATION config; // clang-format off switch( aToolbar ) { // No Aux toolbar case TOOLBAR_LOC::TOP_AUX: return std::nullopt; case TOOLBAR_LOC::LEFT: config.AppendAction( ACTIONS::toggleGrid ) .AppendAction( ACTIONS::toggleGridOverrides ) .AppendAction( PCB_ACTIONS::togglePolarCoords ) .AppendAction( ACTIONS::inchesUnits ) .AppendAction( ACTIONS::milsUnits ) .AppendAction( ACTIONS::millimetersUnits ) .AppendAction( ACTIONS::toggleCursorStyle ); config.AppendSeparator() .AppendAction( PCB_ACTIONS::toggleHV45Mode ); config.AppendSeparator() .AppendAction( PCB_ACTIONS::padDisplayMode ) .AppendAction( PCB_ACTIONS::graphicsOutlines ) .AppendAction( PCB_ACTIONS::textOutlines ) .AppendAction( ACTIONS::highContrastMode ); if( ADVANCED_CFG::GetCfg().m_DrawBoundingBoxes ) config.AppendAction( ACTIONS::toggleBoundingBoxes ); config.AppendSeparator() .AppendAction( ACTIONS::showLibraryTree ) .AppendAction( PCB_ACTIONS::showLayersManager ) .AppendAction( ACTIONS::showProperties ); /* TODO (ISM): Implement context menus PCB_SELECTION_TOOL* selTool = m_toolManager->GetTool(); std::unique_ptr gridMenu = std::make_unique( false, selTool ); gridMenu->Add( ACTIONS::gridProperties ); gridMenu->Add( ACTIONS::gridOrigin ); m_tbLeft->AddToolContextMenu( ACTIONS::toggleGrid, std::move( gridMenu ) ); */ break; case TOOLBAR_LOC::RIGHT: config.AppendAction( ACTIONS::selectionTool ) .AppendGroup( TOOLBAR_GROUP_CONFIG( _( "Lasso selection tools" ) ) .AddAction( ACTIONS::selectAutoLasso ) .AddAction( ACTIONS::selectInsideLasso ) .AddAction( ACTIONS::selectTouchingLasso ) .AddAction( ACTIONS::selectTouchingPath ) ); config.AppendSeparator() .AppendAction( PCB_ACTIONS::placePad ) .AppendAction( PCB_ACTIONS::drawRuleArea ); config.AppendSeparator() .AppendAction( PCB_ACTIONS::drawLine ) .AppendAction( PCB_ACTIONS::drawArc ) .AppendAction( PCB_ACTIONS::drawRectangle ) .AppendAction( PCB_ACTIONS::drawCircle ) .AppendAction( PCB_ACTIONS::drawPolygon ) .AppendAction( PCB_ACTIONS::drawBezier ) .AppendAction( PCB_ACTIONS::placeReferenceImage ) .AppendAction( PCB_ACTIONS::placeText ) .AppendAction( PCB_ACTIONS::drawTextBox ) .AppendAction( PCB_ACTIONS::drawTable ) .AppendGroup( TOOLBAR_GROUP_CONFIG( _( "Dimension objects" ) ) .AddAction( PCB_ACTIONS::drawOrthogonalDimension ) .AddAction( PCB_ACTIONS::drawAlignedDimension ) .AddAction( PCB_ACTIONS::drawCenterDimension ) .AddAction( PCB_ACTIONS::drawRadialDimension ) .AddAction( PCB_ACTIONS::drawLeader ) ) .AppendAction( ACTIONS::deleteTool ); config.AppendSeparator() .AppendAction( PCB_ACTIONS::setAnchor ) .AppendAction( ACTIONS::gridSetOrigin ) .AppendAction( ACTIONS::measureTool ); /* TODO (ISM): Implement context menus PCB_SELECTION_TOOL* selTool = m_toolManager->GetTool(); auto makeArcMenu = [&]() { std::unique_ptr arcMenu = std::make_unique( false, selTool ); arcMenu->Add( ACTIONS::pointEditorArcKeepCenter, ACTION_MENU::CHECK ); arcMenu->Add( ACTIONS::pointEditorArcKeepEndpoint, ACTION_MENU::CHECK ); arcMenu->Add( ACTIONS::pointEditorArcKeepRadius, ACTION_MENU::CHECK ); return arcMenu; }; m_tbRight->AddToolContextMenu( PCB_ACTIONS::drawArc, makeArcMenu() ); */ break; case TOOLBAR_LOC::TOP_MAIN: config.AppendAction( PCB_ACTIONS::newFootprint ) .AppendAction( PCB_ACTIONS::createFootprint ) .AppendAction( ACTIONS::save ); config.AppendSeparator() .AppendAction( ACTIONS::print ); config.AppendSeparator() .AppendAction( ACTIONS::undo ) .AppendAction( ACTIONS::redo ); config.AppendSeparator() .AppendAction( ACTIONS::zoomRedraw ) .AppendAction( ACTIONS::zoomInCenter ) .AppendAction( ACTIONS::zoomOutCenter ) .AppendAction( ACTIONS::zoomFitScreen ) .AppendAction( ACTIONS::zoomTool ); config.AppendSeparator() .AppendAction( PCB_ACTIONS::rotateCcw ) .AppendAction( PCB_ACTIONS::rotateCw ) .AppendAction( PCB_ACTIONS::mirrorH ) .AppendAction( PCB_ACTIONS::mirrorV ) .AppendAction( ACTIONS::group ) .AppendAction( ACTIONS::ungroup ); config.AppendSeparator() .AppendAction( PCB_ACTIONS::footprintProperties ) .AppendAction( PCB_ACTIONS::defaultPadProperties ) .AppendAction( ACTIONS::showDatasheet ) .AppendAction( PCB_ACTIONS::checkFootprint ); config.AppendSeparator() .AppendAction( PCB_ACTIONS::loadFpFromBoard ) .AppendAction( PCB_ACTIONS::saveFpToBoard ); config.AppendSeparator() .AppendControl( ACTION_TOOLBAR_CONTROLS::gridSelect ); config.AppendSeparator() .AppendControl( ACTION_TOOLBAR_CONTROLS::zoomSelect ); config.AppendSeparator() .AppendControl( ACTION_TOOLBAR_CONTROLS::layerSelector ); break; } // clang-format on return config; } void FOOTPRINT_EDIT_FRAME::ReCreateLayerBox( bool aForceResizeToolbar ) { if( !m_SelLayerBox ) return; m_SelLayerBox->SetToolTip( _( "+/- to switch" ) ); m_SelLayerBox->Resync(); if( aForceResizeToolbar ) UpdateToolbarControlSizes(); }