2023-01-01 23:37:24 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2023 CERN
|
|
|
|
* Copyright (C) 2023 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 <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2023-03-03 22:36:07 +00:00
|
|
|
#include <sim/simulator_frame.h>
|
2023-01-01 23:37:24 +00:00
|
|
|
#include <tool/action_menu.h>
|
|
|
|
#include <tool/action_toolbar.h>
|
|
|
|
#include <tool/common_control.h>
|
|
|
|
#include <tool/tool_manager.h>
|
|
|
|
#include <tools/ee_actions.h>
|
|
|
|
#include <widgets/wx_menubar.h>
|
|
|
|
|
|
|
|
|
2023-03-03 22:36:07 +00:00
|
|
|
void SIMULATOR_FRAME::ReCreateHToolbar()
|
2023-01-01 23:37:24 +00:00
|
|
|
{
|
|
|
|
if( m_toolBar )
|
|
|
|
{
|
|
|
|
m_toolBar->ClearToolbar();
|
|
|
|
m_toolBar->SetToolManager( GetToolManager() );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2023-03-04 18:02:05 +00:00
|
|
|
EDA_BASE_FRAME* parent = dynamic_cast<EDA_BASE_FRAME*>( this );
|
|
|
|
|
|
|
|
wxCHECK( parent, /* void */ );
|
|
|
|
|
|
|
|
m_toolBar = new ACTION_TOOLBAR( parent, wxID_ANY, wxDefaultPosition, wxDefaultSize,
|
2023-01-01 23:37:24 +00:00
|
|
|
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
|
|
|
|
}
|
|
|
|
|
|
|
|
m_toolBar->Add( EE_ACTIONS::openWorkbook );
|
|
|
|
m_toolBar->Add( EE_ACTIONS::saveWorkbook );
|
|
|
|
|
|
|
|
m_toolBar->AddScaledSeparator( this );
|
2023-07-19 15:25:57 +00:00
|
|
|
m_toolBar->Add( EE_ACTIONS::newAnalysisTab );
|
|
|
|
m_toolBar->Add( EE_ACTIONS::simAnalysisProperties );
|
2023-01-01 23:37:24 +00:00
|
|
|
|
|
|
|
m_toolBar->AddScaledSeparator( this );
|
|
|
|
m_toolBar->Add( EE_ACTIONS::runSimulation );
|
|
|
|
m_toolBar->Add( EE_ACTIONS::stopSimulation );
|
|
|
|
|
|
|
|
m_toolBar->AddScaledSeparator( this );
|
|
|
|
m_toolBar->Add( ACTIONS::zoomInCenter );
|
|
|
|
m_toolBar->Add( ACTIONS::zoomOutCenter );
|
|
|
|
m_toolBar->Add( ACTIONS::zoomFitScreen );
|
|
|
|
|
|
|
|
m_toolBar->AddScaledSeparator( this );
|
|
|
|
m_toolBar->Add( EE_ACTIONS::simProbe );
|
|
|
|
m_toolBar->Add( EE_ACTIONS::simTune );
|
|
|
|
|
|
|
|
m_toolBar->AddScaledSeparator( this );
|
2023-02-21 09:06:02 +00:00
|
|
|
m_toolBar->Add( EE_ACTIONS::editUserDefinedSignals );
|
2023-01-01 23:37:24 +00:00
|
|
|
m_toolBar->Add( EE_ACTIONS::showNetlist );
|
|
|
|
|
|
|
|
// after adding the buttons to the toolbar, must call Realize() to reflect the changes
|
|
|
|
m_toolBar->KiRealize();
|
|
|
|
|
|
|
|
m_toolBar->Refresh();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-03-03 22:36:07 +00:00
|
|
|
void SIMULATOR_FRAME::doReCreateMenuBar()
|
2023-01-01 23:37:24 +00:00
|
|
|
{
|
|
|
|
COMMON_CONTROL* tool = m_toolManager->GetTool<COMMON_CONTROL>();
|
2023-02-18 12:04:30 +00:00
|
|
|
EDA_BASE_FRAME* base_frame = dynamic_cast<EDA_BASE_FRAME*>( this );
|
|
|
|
|
|
|
|
// base_frame == nullptr should not happen, but it makes Coverity happy
|
|
|
|
wxCHECK( base_frame, /* void */ );
|
|
|
|
|
2023-01-01 23:37:24 +00:00
|
|
|
// wxWidgets handles the OSX Application menu behind the scenes, but that means
|
|
|
|
// we always have to start from scratch with a new wxMenuBar.
|
2023-02-18 12:04:30 +00:00
|
|
|
wxMenuBar* oldMenuBar = base_frame->GetMenuBar();
|
2023-01-01 23:37:24 +00:00
|
|
|
WX_MENUBAR* menuBar = new WX_MENUBAR();
|
|
|
|
|
|
|
|
//-- File menu -----------------------------------------------------------
|
|
|
|
//
|
|
|
|
ACTION_MENU* fileMenu = new ACTION_MENU( false, tool );
|
|
|
|
|
2023-07-19 15:25:57 +00:00
|
|
|
fileMenu->Add( EE_ACTIONS::newAnalysisTab );
|
2023-01-01 23:37:24 +00:00
|
|
|
|
|
|
|
fileMenu->AppendSeparator();
|
|
|
|
fileMenu->Add( EE_ACTIONS::openWorkbook );
|
|
|
|
fileMenu->Add( EE_ACTIONS::saveWorkbook );
|
|
|
|
fileMenu->Add( EE_ACTIONS::saveWorkbookAs );
|
|
|
|
|
|
|
|
fileMenu->AppendSeparator();
|
|
|
|
fileMenu->Add( EE_ACTIONS::exportPlotAsPNG );
|
|
|
|
fileMenu->Add( EE_ACTIONS::exportPlotAsCSV );
|
|
|
|
|
|
|
|
fileMenu->AppendSeparator();
|
|
|
|
fileMenu->AddClose( _( "Simulator" ) );
|
|
|
|
|
2023-01-04 18:06:04 +00:00
|
|
|
|
2023-01-01 23:37:24 +00:00
|
|
|
//-- View menu -----------------------------------------------------------
|
|
|
|
//
|
|
|
|
ACTION_MENU* viewMenu = new ACTION_MENU( false, tool );
|
|
|
|
|
2023-09-26 12:18:28 +00:00
|
|
|
viewMenu->Add( ACTIONS::zoomUndo );
|
|
|
|
viewMenu->Add( ACTIONS::zoomRedo );
|
|
|
|
|
|
|
|
viewMenu->AppendSeparator();
|
2023-01-01 23:37:24 +00:00
|
|
|
viewMenu->Add( ACTIONS::zoomInCenter );
|
|
|
|
viewMenu->Add( ACTIONS::zoomOutCenter );
|
|
|
|
viewMenu->Add( ACTIONS::zoomFitScreen );
|
|
|
|
|
|
|
|
viewMenu->AppendSeparator();
|
|
|
|
viewMenu->Add( ACTIONS::toggleGrid, ACTION_MENU::CHECK );
|
|
|
|
viewMenu->Add( EE_ACTIONS::toggleLegend, ACTION_MENU::CHECK );
|
|
|
|
viewMenu->Add( EE_ACTIONS::toggleDottedSecondary, ACTION_MENU::CHECK );
|
|
|
|
viewMenu->Add( EE_ACTIONS::toggleDarkModePlots, ACTION_MENU::CHECK );
|
|
|
|
|
2023-01-04 18:06:04 +00:00
|
|
|
|
2023-01-01 23:37:24 +00:00
|
|
|
//-- Simulation menu -----------------------------------------------------------
|
|
|
|
//
|
|
|
|
ACTION_MENU* simulationMenu = new ACTION_MENU( false, tool );
|
|
|
|
|
2023-07-19 15:25:57 +00:00
|
|
|
simulationMenu->Add( EE_ACTIONS::newAnalysisTab );
|
|
|
|
simulationMenu->Add( EE_ACTIONS::simAnalysisProperties );
|
2023-01-01 23:37:24 +00:00
|
|
|
simulationMenu->Add( EE_ACTIONS::runSimulation );
|
|
|
|
|
|
|
|
simulationMenu->AppendSeparator();
|
|
|
|
simulationMenu->Add( EE_ACTIONS::simProbe );
|
|
|
|
simulationMenu->Add( EE_ACTIONS::simTune );
|
|
|
|
|
|
|
|
simulationMenu->AppendSeparator();
|
2023-07-05 17:25:52 +00:00
|
|
|
simulationMenu->Add( EE_ACTIONS::editUserDefinedSignals );
|
2023-01-01 23:37:24 +00:00
|
|
|
simulationMenu->Add( EE_ACTIONS::showNetlist );
|
|
|
|
|
2023-01-04 18:06:04 +00:00
|
|
|
|
|
|
|
//-- Preferences menu -----------------------------------------------
|
|
|
|
//
|
|
|
|
ACTION_MENU* prefsMenu = new ACTION_MENU( false, tool );
|
|
|
|
|
|
|
|
//prefsMenu->Add( ACTIONS::configurePaths );
|
|
|
|
//prefsMenu->Add( EE_ACTIONS::showSimLibTable );
|
2023-08-07 23:51:22 +00:00
|
|
|
prefsMenu->Add( ACTIONS::openPreferences );
|
2023-01-04 18:06:04 +00:00
|
|
|
|
|
|
|
prefsMenu->AppendSeparator();
|
|
|
|
AddMenuLanguageList( prefsMenu, tool );
|
|
|
|
|
|
|
|
|
2023-01-01 23:37:24 +00:00
|
|
|
//-- Menubar -------------------------------------------------------------
|
|
|
|
//
|
|
|
|
menuBar->Append( fileMenu, _( "&File" ) );
|
|
|
|
menuBar->Append( viewMenu, _( "&View" ) );
|
|
|
|
menuBar->Append( simulationMenu, _( "&Simulation" ) );
|
2023-01-04 18:06:04 +00:00
|
|
|
menuBar->Append( prefsMenu, _( "&Preferences" ) );
|
2023-02-18 12:04:30 +00:00
|
|
|
base_frame->AddStandardHelpMenu( menuBar );
|
2023-01-01 23:37:24 +00:00
|
|
|
|
2023-02-18 12:04:30 +00:00
|
|
|
base_frame->SetMenuBar( menuBar );
|
2023-01-01 23:37:24 +00:00
|
|
|
delete oldMenuBar;
|
|
|
|
}
|