/* * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2008 Wayne Stambaugh * Copyright The KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2019 CERN * * 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 std::optional SYMBOL_VIEWER_TOOLBAR_SETTINGS::DefaultToolbarConfig( TOOLBAR_LOC aToolbar ) { TOOLBAR_CONFIGURATION config; // clang-format off switch( aToolbar ) { case TOOLBAR_LOC::LEFT: case TOOLBAR_LOC::RIGHT: case TOOLBAR_LOC::TOP_AUX: return std::nullopt; case TOOLBAR_LOC::TOP_MAIN: /* TODO (ISM): Move these to actions m_tbTopMain->AddTool( ID_LIBVIEW_PREVIOUS, wxEmptyString, KiScaledBitmap( BITMAPS::lib_previous, this ), _( "Display previous symbol" ) ); m_tbTopMain->AddTool( ID_LIBVIEW_NEXT, wxEmptyString, KiScaledBitmap( BITMAPS::lib_next, this ), _( "Display next symbol" ) ); */ config.AppendSeparator() .AppendAction( ACTIONS::zoomRedraw ) .AppendAction( ACTIONS::zoomInCenter ) .AppendAction( ACTIONS::zoomOutCenter ) .AppendAction( ACTIONS::zoomFitScreen ); config.AppendSeparator() .AppendAction( EE_ACTIONS::showElectricalTypes ) .AppendAction( EE_ACTIONS::showPinNumbers ); config.AppendSeparator() .AppendAction( EE_ACTIONS::showDeMorganStandard ) .AppendAction( EE_ACTIONS::showDeMorganAlternate ); config.AppendSeparator() .AppendControl( ACTION_TOOLBAR_CONTROLS::unitSelector ); config.AppendSeparator() .AppendAction( ACTIONS::showDatasheet ); config.AppendSeparator() .AppendAction( EE_ACTIONS::addSymbolToSchematic ); break; } // clang-format on return config; } void SYMBOL_VIEWER_FRAME::configureToolbars() { SCH_BASE_FRAME::configureToolbars(); // Toolbar widget for selecting the unit to show in the symbol viewer auto unitChoiceFactory = [this]( ACTION_TOOLBAR* aToolbar ) { if( !m_unitChoice ) { m_unitChoice = new wxChoice( m_tbTopMain, ID_LIBVIEW_SELECT_UNIT_NUMBER, wxDefaultPosition, wxSize( 150, -1 ) ); } aToolbar->Add( m_unitChoice ); }; RegisterCustomToolbarControlFactory( ACTION_TOOLBAR_CONTROLS::unitSelector, unitChoiceFactory ); } void SYMBOL_VIEWER_FRAME::doReCreateMenuBar() { SYMBOL_EDITOR_CONTROL* libControl = m_toolManager->GetTool(); // wxWidgets handles the OSX Application menu behind the scenes, but that means // we always have to start from scratch with a new wxMenuBar. wxMenuBar* oldMenuBar = GetMenuBar(); WX_MENUBAR* menuBar = new WX_MENUBAR(); //-- File menu ----------------------------------------------------------- // ACTION_MENU* fileMenu = new ACTION_MENU( false, libControl ); fileMenu->AddClose( _( "Symbol Viewer" ) ); //-- View menu ----------------------------------------------------------- // ACTION_MENU* viewMenu = new ACTION_MENU( false, libControl ); viewMenu->Add( ACTIONS::zoomInCenter ); viewMenu->Add( ACTIONS::zoomOutCenter ); viewMenu->Add( ACTIONS::zoomFitScreen ); viewMenu->Add( ACTIONS::zoomRedraw ); viewMenu->AppendSeparator(); viewMenu->AppendSeparator(); viewMenu->Add( EE_ACTIONS::showElectricalTypes, ACTION_MENU::CHECK ); viewMenu->Add( EE_ACTIONS::showPinNumbers, ACTION_MENU::CHECK ); //-- Menubar ------------------------------------------------------------- // menuBar->Append( fileMenu, _( "&File" ) ); menuBar->Append( viewMenu, _( "&View" ) ); AddStandardHelpMenu( menuBar ); SetMenuBar( menuBar ); delete oldMenuBar; }