2011-12-16 13:32:23 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2016-11-04 11:13:22 +00:00
|
|
|
* Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
2017-10-06 18:07:43 +00:00
|
|
|
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
|
2020-06-01 13:13:32 +00:00
|
|
|
* Copyright (C) 2004-2020 KiCad Developers, see AUTHORS.txt for contributors.
|
2019-08-14 08:28:07 +00:00
|
|
|
* Copyright (C) 2019 CERN
|
2011-12-16 13:32:23 +00:00
|
|
|
*
|
2018-01-08 04:05:03 +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 3 of the License, or (at your
|
|
|
|
* option) any later version.
|
2011-12-16 13:32:23 +00:00
|
|
|
*
|
2018-01-08 04:05:03 +00:00
|
|
|
* 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.
|
2011-12-16 13:32:23 +00:00
|
|
|
*
|
2018-01-08 04:05:03 +00:00
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
2011-12-16 13:32:23 +00:00
|
|
|
*/
|
|
|
|
|
2021-03-07 20:31:19 +00:00
|
|
|
#include <bitmaps.h>
|
2016-03-11 16:40:24 +00:00
|
|
|
#include <macros.h>
|
2021-03-07 20:31:19 +00:00
|
|
|
#include <class_library.h>
|
|
|
|
#include <eeschema_id.h>
|
|
|
|
#include <symbol_viewer_frame.h>
|
|
|
|
#include <sch_painter.h>
|
2020-08-06 23:03:58 +00:00
|
|
|
#include <tool/action_menu.h>
|
2019-06-09 21:57:23 +00:00
|
|
|
#include <tool/action_toolbar.h>
|
2019-05-14 19:21:10 +00:00
|
|
|
#include <tools/ee_actions.h>
|
2020-12-12 03:13:52 +00:00
|
|
|
#include <tools/symbol_editor_control.h>
|
2020-06-06 17:42:04 +00:00
|
|
|
#include <widgets/wx_menubar.h>
|
2009-09-14 13:24:17 +00:00
|
|
|
|
2021-03-07 20:31:19 +00:00
|
|
|
|
2020-12-25 23:37:01 +00:00
|
|
|
void SYMBOL_VIEWER_FRAME::ReCreateHToolbar()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2018-01-08 04:05:03 +00:00
|
|
|
if( m_mainToolBar )
|
2020-09-26 23:55:59 +00:00
|
|
|
{
|
2020-06-23 10:42:23 +00:00
|
|
|
m_mainToolBar->ClearToolbar();
|
2020-09-26 23:55:59 +00:00
|
|
|
}
|
2018-01-08 04:05:03 +00:00
|
|
|
else
|
2020-09-26 23:55:59 +00:00
|
|
|
{
|
2020-12-25 23:37:01 +00:00
|
|
|
m_mainToolBar = new ACTION_TOOLBAR( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
|
2020-11-06 01:56:02 +00:00
|
|
|
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT | wxAUI_TB_HORIZONTAL );
|
2020-09-26 23:55:59 +00:00
|
|
|
m_mainToolBar->SetAuiManager( &m_auimgr );
|
|
|
|
}
|
2019-05-14 19:21:10 +00:00
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
m_mainToolBar->AddTool( ID_LIBVIEW_SELECT_PART, wxEmptyString,
|
2021-03-08 02:59:07 +00:00
|
|
|
KiScaledBitmap( BITMAPS::library_browser, this ),
|
2020-12-13 13:27:09 +00:00
|
|
|
_( "Choose symbol" ) );
|
2018-01-08 04:05:03 +00:00
|
|
|
|
|
|
|
m_mainToolBar->AddTool( ID_LIBVIEW_PREVIOUS, wxEmptyString,
|
2021-03-08 02:59:07 +00:00
|
|
|
KiScaledBitmap( BITMAPS::lib_previous, this ),
|
2019-06-01 18:36:49 +00:00
|
|
|
_( "Display previous symbol" ) );
|
2018-01-08 04:05:03 +00:00
|
|
|
|
|
|
|
m_mainToolBar->AddTool( ID_LIBVIEW_NEXT, wxEmptyString,
|
2021-03-08 02:59:07 +00:00
|
|
|
KiScaledBitmap( BITMAPS::lib_next, this ),
|
2019-06-01 18:36:49 +00:00
|
|
|
_( "Display next symbol" ) );
|
2018-01-08 04:05:03 +00:00
|
|
|
|
2020-06-17 11:03:25 +00:00
|
|
|
m_mainToolBar->AddScaledSeparator( this );
|
|
|
|
m_mainToolBar->Add( ACTIONS::zoomRedraw );
|
|
|
|
m_mainToolBar->Add( ACTIONS::zoomInCenter );
|
|
|
|
m_mainToolBar->Add( ACTIONS::zoomOutCenter );
|
|
|
|
m_mainToolBar->Add( ACTIONS::zoomFitScreen );
|
2018-01-08 04:05:03 +00:00
|
|
|
|
2020-06-17 11:03:25 +00:00
|
|
|
m_mainToolBar->AddScaledSeparator( this );
|
2020-08-06 23:03:58 +00:00
|
|
|
m_mainToolBar->Add( EE_ACTIONS::showDeMorganStandard, ACTION_TOOLBAR::TOGGLE );
|
2020-06-17 11:03:25 +00:00
|
|
|
m_mainToolBar->Add( EE_ACTIONS::showDeMorganAlternate, ACTION_TOOLBAR::TOGGLE );
|
2018-01-08 04:05:03 +00:00
|
|
|
|
2020-06-17 11:03:25 +00:00
|
|
|
m_mainToolBar->AddScaledSeparator( this );
|
2020-05-30 12:08:00 +00:00
|
|
|
|
|
|
|
if( m_unitChoice == nullptr )
|
|
|
|
m_unitChoice = new wxChoice( m_mainToolBar, ID_LIBVIEW_SELECT_PART_NUMBER,
|
|
|
|
wxDefaultPosition, wxSize( 150, -1 ) );
|
2018-08-29 18:31:43 +00:00
|
|
|
m_mainToolBar->AddControl( m_unitChoice );
|
2018-01-08 04:05:03 +00:00
|
|
|
|
2020-06-17 11:03:25 +00:00
|
|
|
m_mainToolBar->AddScaledSeparator( this );
|
2019-06-01 18:36:49 +00:00
|
|
|
m_mainToolBar->Add( EE_ACTIONS::showDatasheet );
|
2018-01-08 04:05:03 +00:00
|
|
|
|
2020-06-17 11:03:25 +00:00
|
|
|
m_mainToolBar->AddScaledSeparator( this );
|
2019-06-16 18:51:47 +00:00
|
|
|
m_mainToolBar->Add( EE_ACTIONS::addSymbolToSchematic );
|
2009-01-07 15:59:49 +00:00
|
|
|
|
2019-06-01 18:36:49 +00:00
|
|
|
// after adding the buttons to the toolbar, must call Realize() to reflect the changes
|
2020-11-06 01:56:02 +00:00
|
|
|
m_mainToolBar->KiRealize();
|
2018-01-08 04:05:03 +00:00
|
|
|
|
2011-12-16 13:32:23 +00:00
|
|
|
m_mainToolBar->Refresh();
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-25 23:37:01 +00:00
|
|
|
void SYMBOL_VIEWER_FRAME::ReCreateVToolbar()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
|
|
|
}
|
2014-10-15 11:40:38 +00:00
|
|
|
|
|
|
|
|
2020-12-25 23:37:01 +00:00
|
|
|
void SYMBOL_VIEWER_FRAME::ReCreateMenuBar()
|
2014-10-15 11:40:38 +00:00
|
|
|
{
|
2020-12-12 03:13:52 +00:00
|
|
|
SYMBOL_EDITOR_CONTROL* libControl = m_toolManager->GetTool<SYMBOL_EDITOR_CONTROL>();
|
2019-06-02 11:57:29 +00:00
|
|
|
// wxWidgets handles the OSX Application menu behind the scenes, but that means
|
2018-04-07 13:13:38 +00:00
|
|
|
// we always have to start from scratch with a new wxMenuBar.
|
2020-06-06 17:42:04 +00:00
|
|
|
wxMenuBar* oldMenuBar = GetMenuBar();
|
|
|
|
WX_MENUBAR* menuBar = new WX_MENUBAR();
|
2014-10-15 11:40:38 +00:00
|
|
|
|
2019-06-02 11:57:29 +00:00
|
|
|
//-- File menu -----------------------------------------------------------
|
|
|
|
//
|
2020-08-06 23:03:58 +00:00
|
|
|
ACTION_MENU* fileMenu = new ACTION_MENU( false, libControl );
|
2019-06-09 21:57:23 +00:00
|
|
|
|
2020-11-29 08:01:21 +00:00
|
|
|
fileMenu->AddClose( _( "Symbol Viewer" ) );
|
2019-06-09 21:57:23 +00:00
|
|
|
|
2014-10-15 11:40:38 +00:00
|
|
|
|
2019-06-02 11:57:29 +00:00
|
|
|
//-- View menu -----------------------------------------------------------
|
|
|
|
//
|
2020-08-06 23:03:58 +00:00
|
|
|
ACTION_MENU* viewMenu = new ACTION_MENU( false, libControl );
|
2019-05-24 10:54:11 +00:00
|
|
|
|
2020-08-06 23:03:58 +00:00
|
|
|
viewMenu->Add( ACTIONS::zoomInCenter );
|
|
|
|
viewMenu->Add( ACTIONS::zoomOutCenter );
|
|
|
|
viewMenu->Add( ACTIONS::zoomFitScreen );
|
|
|
|
viewMenu->Add( ACTIONS::zoomRedraw );
|
2014-10-15 11:40:38 +00:00
|
|
|
|
2020-08-06 23:03:58 +00:00
|
|
|
viewMenu->AppendSeparator();
|
|
|
|
viewMenu->Add( ACTIONS::toggleGrid, ACTION_MENU::CHECK );
|
|
|
|
viewMenu->Add( ACTIONS::gridProperties );
|
2014-10-15 11:40:38 +00:00
|
|
|
|
2020-08-06 23:03:58 +00:00
|
|
|
viewMenu->AppendSeparator();
|
|
|
|
viewMenu->Add( EE_ACTIONS::showElectricalTypes, ACTION_MENU::CHECK );
|
2016-11-04 11:13:22 +00:00
|
|
|
|
2014-10-15 11:40:38 +00:00
|
|
|
|
2019-06-02 11:57:29 +00:00
|
|
|
//-- Menubar -------------------------------------------------------------
|
|
|
|
//
|
|
|
|
menuBar->Append( fileMenu, _( "&File" ) );
|
2014-10-15 11:40:38 +00:00
|
|
|
menuBar->Append( viewMenu, _( "&View" ) );
|
2019-05-18 10:27:36 +00:00
|
|
|
AddStandardHelpMenu( menuBar );
|
2014-10-15 11:40:38 +00:00
|
|
|
|
2018-04-07 13:13:38 +00:00
|
|
|
SetMenuBar( menuBar );
|
|
|
|
delete oldMenuBar;
|
2014-10-15 11:40:38 +00:00
|
|
|
}
|