2011-12-12 14:02:37 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2018-08-06 18:26:37 +00:00
|
|
|
* Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
2018-03-16 12:38:36 +00:00
|
|
|
* Copyright (C) 2015 Wayne Stambaugh <stambaughw@gmail.com>
|
2023-08-26 12:29:24 +00:00
|
|
|
* Copyright (C) 2007-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
2011-12-12 14:02:37 +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 2
|
|
|
|
* 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, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2019-08-09 21:05:16 +00:00
|
|
|
#include <bitmaps.h>
|
2020-11-12 20:19:22 +00:00
|
|
|
#include <board.h>
|
|
|
|
#include <footprint.h>
|
2022-07-24 22:40:47 +00:00
|
|
|
#include <pad.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <common.h>
|
|
|
|
#include <confirm.h>
|
2022-07-24 22:40:47 +00:00
|
|
|
#include <settings/cvpcb_settings.h>
|
2020-05-08 21:05:29 +00:00
|
|
|
#include <footprint_editor_settings.h>
|
2019-08-09 21:05:16 +00:00
|
|
|
#include <fp_lib_table.h>
|
|
|
|
#include <id.h>
|
2021-09-14 22:45:14 +00:00
|
|
|
#include <kiface_base.h>
|
2019-08-09 21:05:16 +00:00
|
|
|
#include <lib_id.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <macros.h>
|
2020-10-25 04:49:02 +00:00
|
|
|
#include <widgets/msgpanel.h>
|
2019-08-09 21:05:16 +00:00
|
|
|
#include <pcb_draw_panel_gal.h>
|
2018-08-06 18:26:37 +00:00
|
|
|
#include <pcb_painter.h>
|
2020-05-08 21:05:29 +00:00
|
|
|
#include <pgm_base.h>
|
2020-06-03 23:34:42 +00:00
|
|
|
#include <reporter.h>
|
2020-05-08 21:05:29 +00:00
|
|
|
#include <settings/settings_manager.h>
|
2019-06-09 21:57:23 +00:00
|
|
|
#include <tool/action_toolbar.h>
|
2018-08-06 18:26:37 +00:00
|
|
|
#include <tool/common_tools.h>
|
2019-08-09 21:05:16 +00:00
|
|
|
#include <tool/tool_dispatcher.h>
|
|
|
|
#include <tool/tool_manager.h>
|
2019-05-04 11:23:04 +00:00
|
|
|
#include <tool/zoom_tool.h>
|
2019-08-09 21:05:16 +00:00
|
|
|
#include <cvpcb_mainframe.h>
|
|
|
|
#include <display_footprints_frame.h>
|
2019-05-04 11:23:04 +00:00
|
|
|
#include <tools/cvpcb_actions.h>
|
2020-05-22 18:27:05 +00:00
|
|
|
#include <tools/pcb_actions.h>
|
2021-07-16 20:13:26 +00:00
|
|
|
#include <tools/pcb_editor_conditions.h> // Shared conditions with other Pcbnew frames
|
|
|
|
#include <tools/pcb_viewer_tools.h> // shared tools with other Pcbnew frames
|
2019-07-18 20:32:12 +00:00
|
|
|
#include <tools/cvpcb_fpviewer_selection_tool.h>
|
2023-04-09 21:59:01 +00:00
|
|
|
#include <wx/choice.h>
|
|
|
|
#include <wx/debug.h>
|
2022-04-18 08:32:36 +00:00
|
|
|
#include <cvpcb_id.h>
|
2023-09-28 03:15:54 +00:00
|
|
|
#include <project_pcb.h>
|
2009-05-06 11:55:36 +00:00
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
BEGIN_EVENT_TABLE( DISPLAY_FOOTPRINTS_FRAME, PCB_BASE_FRAME )
|
2010-02-01 21:23:27 +00:00
|
|
|
EVT_CLOSE( DISPLAY_FOOTPRINTS_FRAME::OnCloseWindow )
|
2023-04-09 21:59:01 +00:00
|
|
|
EVT_CHOICE( ID_ON_ZOOM_SELECT, DISPLAY_FOOTPRINTS_FRAME::OnSelectZoom )
|
|
|
|
EVT_CHOICE( ID_ON_GRID_SELECT, DISPLAY_FOOTPRINTS_FRAME::OnSelectGrid )
|
2007-10-03 15:21:13 +00:00
|
|
|
END_EVENT_TABLE()
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
|
2018-07-01 14:48:35 +00:00
|
|
|
DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
2022-07-25 12:29:18 +00:00
|
|
|
PCB_BASE_FRAME( aKiway, aParent, FRAME_CVPCB_DISPLAY, _( "Footprint Viewer" ),
|
|
|
|
wxDefaultPosition, wxDefaultSize,
|
|
|
|
KICAD_DEFAULT_DRAWFRAME_STYLE, FOOTPRINTVIEWER_FRAME_NAME ),
|
|
|
|
m_currentComp( nullptr )
|
2007-10-03 15:21:13 +00:00
|
|
|
{
|
2007-10-27 12:24:09 +00:00
|
|
|
// Give an icon
|
2011-09-11 11:38:01 +00:00
|
|
|
wxIcon icon;
|
2021-03-08 02:59:07 +00:00
|
|
|
icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_cvpcb ) );
|
2011-09-11 11:38:01 +00:00
|
|
|
SetIcon( icon );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
++PCBNew
* Removed Pcb_Frame argument from BOARD() constructor, since it precludes
having a BOARD being edited by more than one editor, it was a bad design.
And this meant removing m_PcbFrame from BOARD.
* removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame
* Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp
* added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance
* a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed,
such as dialog_mask_clearance, dialog_drc, etc.
* Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it
with build_version.h's #define BOARD_FILE_VERSION, although there may be a
better place for this constant.
* Made the public functions in PARAM_CFG_ARRAY be type const.
void SaveParam(..) const and void ReadParam(..) const
* PARAM_CFG_BASE now has virtual destructor since we have various way of
destroying the derived class and boost::ptr_vector must be told about this.
* Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use
an automatic PARAM_CFG_ARRAY which is on the stack.\
* PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array,
since it has to access the current BOARD and the BOARD can change.
Remember BOARD_DESIGN_SETTINGS are now in the BOARD.
* Made the m_BoundingBox member private, this was a brutally hard task,
and indicative of the lack of commitment to accessors and object oriented
design on the part of KiCad developers. We must do better.
Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox().
* Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
2011-12-05 06:15:33 +00:00
|
|
|
SetBoard( new BOARD() );
|
2020-02-27 17:46:49 +00:00
|
|
|
|
|
|
|
// This board will only be used to hold a footprint for viewing
|
|
|
|
GetBoard()->SetBoardUse( BOARD_USE::FPHOLDER );
|
|
|
|
|
2012-01-04 06:18:38 +00:00
|
|
|
SetScreen( new PCB_SCREEN( GetPageSizeIU() ) );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2020-04-26 23:14:12 +00:00
|
|
|
// Create GAL canvas before loading settings
|
2020-11-16 11:16:44 +00:00
|
|
|
auto* gal_drawPanel = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_frameSize,
|
2020-08-31 17:47:44 +00:00
|
|
|
GetGalDisplayOptions(),
|
|
|
|
EDA_DRAW_PANEL_GAL::GAL_FALLBACK );
|
2020-04-26 23:14:12 +00:00
|
|
|
SetCanvas( gal_drawPanel );
|
|
|
|
|
2021-08-22 22:05:47 +00:00
|
|
|
// Don't show the default board solder mask expansion. Only the footprint or pad expansion
|
|
|
|
// settings should be shown.
|
|
|
|
GetBoard()->GetDesignSettings().m_SolderMaskExpansion = 0;
|
2018-08-29 00:00:27 +00:00
|
|
|
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
LoadSettings( config() );
|
2009-09-19 16:15:40 +00:00
|
|
|
|
2018-08-06 18:26:37 +00:00
|
|
|
// Create the manager and dispatcher & route draw panel events to the dispatcher
|
|
|
|
m_toolManager = new TOOL_MANAGER;
|
|
|
|
m_toolManager->SetEnvironment( GetBoard(), gal_drawPanel->GetView(),
|
2020-06-12 10:58:56 +00:00
|
|
|
gal_drawPanel->GetViewControls(), config(), this );
|
2018-08-06 18:26:37 +00:00
|
|
|
m_actions = new CVPCB_ACTIONS();
|
2021-03-27 20:02:34 +00:00
|
|
|
m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager );
|
2018-08-06 18:26:37 +00:00
|
|
|
gal_drawPanel->SetEventDispatcher( m_toolDispatcher );
|
|
|
|
|
2019-05-04 11:23:04 +00:00
|
|
|
m_toolManager->RegisterTool( new COMMON_TOOLS );
|
|
|
|
m_toolManager->RegisterTool( new ZOOM_TOOL );
|
2019-07-18 20:32:12 +00:00
|
|
|
m_toolManager->RegisterTool( new CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL );
|
2020-05-22 18:27:05 +00:00
|
|
|
m_toolManager->RegisterTool( new PCB_VIEWER_TOOLS );
|
|
|
|
|
|
|
|
m_toolManager->GetTool<PCB_VIEWER_TOOLS>()->SetFootprintFrame( true );
|
|
|
|
|
2018-08-06 18:26:37 +00:00
|
|
|
m_toolManager->InitTools();
|
|
|
|
|
2020-07-29 23:50:25 +00:00
|
|
|
setupUIConditions();
|
|
|
|
|
2018-08-06 18:26:37 +00:00
|
|
|
// Run the control tool, it is supposed to be always active
|
2020-03-29 11:54:18 +00:00
|
|
|
m_toolManager->InvokeTool( "cvpcb.FootprintViewerInteractiveSelection" );
|
2018-08-06 18:26:37 +00:00
|
|
|
|
2019-05-14 19:21:10 +00:00
|
|
|
ReCreateHToolbar();
|
|
|
|
ReCreateVToolbar();
|
|
|
|
ReCreateOptToolbar();
|
|
|
|
|
|
|
|
m_auimgr.SetManagedWindow( this );
|
|
|
|
|
2020-12-22 21:35:25 +00:00
|
|
|
CreateInfoBar();
|
2023-01-17 04:14:38 +00:00
|
|
|
m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( wxS( "MainToolbar" ) )
|
2020-12-11 12:09:37 +00:00
|
|
|
.Top().Layer( 6 ) );
|
2023-01-17 04:14:38 +00:00
|
|
|
m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( wxS( "OptToolbar" ) )
|
2020-12-11 12:09:37 +00:00
|
|
|
.Left().Layer( 3 ) );
|
2023-01-17 04:14:38 +00:00
|
|
|
m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( wxS( "DrawFrame" ) )
|
2020-12-11 12:09:37 +00:00
|
|
|
.Center() );
|
2023-01-17 04:14:38 +00:00
|
|
|
m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( wxS( "MsgPanel" ) )
|
2020-12-11 12:09:37 +00:00
|
|
|
.Bottom().Layer( 6 ) );
|
2020-05-23 18:12:59 +00:00
|
|
|
|
2020-12-22 21:35:25 +00:00
|
|
|
FinishAUIInitialization();
|
2019-05-14 19:21:10 +00:00
|
|
|
|
2018-08-06 18:26:37 +00:00
|
|
|
auto& galOpts = GetGalDisplayOptions();
|
|
|
|
galOpts.m_axesEnabled = true;
|
2019-05-27 16:55:13 +00:00
|
|
|
|
2019-05-30 12:25:08 +00:00
|
|
|
ActivateGalCanvas();
|
2018-09-11 15:28:57 +00:00
|
|
|
|
2020-10-05 19:26:33 +00:00
|
|
|
setupUnits( config() );
|
|
|
|
|
2018-09-11 15:28:57 +00:00
|
|
|
// Restore last zoom. (If auto-zooming we'll adjust when we load the footprint.)
|
2020-05-23 17:14:49 +00:00
|
|
|
CVPCB_SETTINGS* cfg = dynamic_cast<CVPCB_SETTINGS*>( config() );
|
2020-06-05 11:49:32 +00:00
|
|
|
|
|
|
|
if( cfg )
|
2022-04-18 08:32:36 +00:00
|
|
|
{
|
2020-06-05 11:49:32 +00:00
|
|
|
GetCanvas()->GetView()->SetScale( cfg->m_FootprintViewerZoom );
|
2018-08-06 18:26:37 +00:00
|
|
|
|
2022-04-18 08:32:36 +00:00
|
|
|
wxAuiToolBarItem* toolOpt = m_mainToolBar->FindTool( ID_CVPCB_FPVIEWER_AUTOZOOM_TOOL );
|
|
|
|
|
|
|
|
if( cfg->m_FootprintViewerAutoZoomOnSelect )
|
|
|
|
toolOpt->SetState( wxAUI_BUTTON_STATE_CHECKED );
|
|
|
|
else
|
|
|
|
toolOpt->SetState( 0 );
|
|
|
|
}
|
|
|
|
|
2018-08-06 18:26:37 +00:00
|
|
|
updateView();
|
|
|
|
|
2011-02-21 21:07:00 +00:00
|
|
|
Show( true );
|
2021-03-27 21:49:38 +00:00
|
|
|
|
|
|
|
// Register a call to update the toolbar sizes. It can't be done immediately because
|
|
|
|
// it seems to require some sizes calculated that aren't yet (at least on GTK).
|
|
|
|
CallAfter( [&]()
|
|
|
|
{
|
|
|
|
// Ensure the controls on the toolbars all are correctly sized
|
|
|
|
UpdateToolbarControlSizes();
|
|
|
|
} );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-02-01 21:23:27 +00:00
|
|
|
DISPLAY_FOOTPRINTS_FRAME::~DISPLAY_FOOTPRINTS_FRAME()
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2020-02-03 14:00:48 +00:00
|
|
|
// Shutdown all running tools
|
|
|
|
if( m_toolManager )
|
|
|
|
m_toolManager->ShutdownAllTools();
|
|
|
|
|
2020-11-13 15:15:52 +00:00
|
|
|
GetBoard()->DeleteAllFootprints();
|
2019-06-13 17:28:55 +00:00
|
|
|
GetCanvas()->StopDrawing();
|
|
|
|
GetCanvas()->GetView()->Clear();
|
2018-09-11 15:28:57 +00:00
|
|
|
// Be sure any event cannot be fired after frame deletion:
|
2019-06-13 17:28:55 +00:00
|
|
|
GetCanvas()->SetEvtHandlerEnabled( false );
|
2018-08-08 19:23:31 +00:00
|
|
|
|
2011-02-05 02:21:11 +00:00
|
|
|
delete GetScreen();
|
2021-07-16 20:13:26 +00:00
|
|
|
SetScreen( nullptr ); // Be sure there is no double deletion
|
2023-05-31 20:37:58 +00:00
|
|
|
setFPWatcher( nullptr );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2012-02-07 17:36:24 +00:00
|
|
|
|
2020-07-29 23:50:25 +00:00
|
|
|
void DISPLAY_FOOTPRINTS_FRAME::setupUIConditions()
|
|
|
|
{
|
2020-08-06 23:03:58 +00:00
|
|
|
PCB_BASE_FRAME::setupUIConditions();
|
2020-07-29 23:50:25 +00:00
|
|
|
|
2020-08-13 23:09:17 +00:00
|
|
|
ACTION_MANAGER* mgr = m_toolManager->GetActionManager();
|
|
|
|
PCB_EDITOR_CONDITIONS cond( this );
|
2020-07-29 23:50:25 +00:00
|
|
|
|
|
|
|
wxASSERT( mgr );
|
|
|
|
|
2020-08-05 22:00:26 +00:00
|
|
|
#define CHECK( x ) ACTION_CONDITIONS().Check( x )
|
2020-07-29 23:50:25 +00:00
|
|
|
|
2021-07-16 20:13:26 +00:00
|
|
|
mgr->SetConditions( ACTIONS::zoomTool,
|
|
|
|
CHECK( cond.CurrentTool( ACTIONS::zoomTool ) ) );
|
|
|
|
mgr->SetConditions( ACTIONS::selectionTool,
|
|
|
|
CHECK( cond.CurrentTool( ACTIONS::selectionTool ) ) );
|
|
|
|
mgr->SetConditions( ACTIONS::measureTool,
|
|
|
|
CHECK( cond.CurrentTool( ACTIONS::measureTool ) ) );
|
2020-07-29 23:50:25 +00:00
|
|
|
|
2020-08-05 22:00:26 +00:00
|
|
|
mgr->SetConditions( ACTIONS::toggleGrid, CHECK( cond.GridVisible() ) );
|
|
|
|
mgr->SetConditions( ACTIONS::toggleCursorStyle, CHECK( cond.FullscreenCursor() ) );
|
2020-07-29 23:50:25 +00:00
|
|
|
|
2020-10-03 23:34:23 +00:00
|
|
|
mgr->SetConditions( ACTIONS::millimetersUnits, CHECK( cond.Units( EDA_UNITS::MILLIMETRES ) ) );
|
|
|
|
mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::INCHES ) ) );
|
|
|
|
mgr->SetConditions( ACTIONS::milsUnits, CHECK( cond.Units( EDA_UNITS::MILS ) ) );
|
2020-07-29 23:50:25 +00:00
|
|
|
|
2022-01-17 11:55:55 +00:00
|
|
|
mgr->SetConditions( PCB_ACTIONS::showPadNumbers, CHECK( cond.PadNumbersDisplay() ) );
|
|
|
|
mgr->SetConditions( PCB_ACTIONS::padDisplayMode, CHECK( !cond.PadFillDisplay() ) );
|
|
|
|
mgr->SetConditions( PCB_ACTIONS::textOutlines, CHECK( !cond.TextFillDisplay() ) );
|
|
|
|
mgr->SetConditions( PCB_ACTIONS::graphicsOutlines, CHECK( !cond.GraphicsFillDisplay() ) );
|
2020-07-29 23:50:25 +00:00
|
|
|
|
2020-08-05 22:00:26 +00:00
|
|
|
#undef CHECK
|
2020-07-29 23:50:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-02-01 21:23:27 +00:00
|
|
|
void DISPLAY_FOOTPRINTS_FRAME::ReCreateVToolbar()
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2009-11-07 14:36:54 +00:00
|
|
|
// Currently, no vertical right toolbar.
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-04-16 16:28:35 +00:00
|
|
|
void DISPLAY_FOOTPRINTS_FRAME::ReCreateOptToolbar()
|
|
|
|
{
|
2011-12-14 20:03:15 +00:00
|
|
|
if( m_optionsToolBar )
|
2020-09-26 23:55:59 +00:00
|
|
|
{
|
2020-06-23 10:42:23 +00:00
|
|
|
m_optionsToolBar->ClearToolbar();
|
2020-09-26 23:55:59 +00:00
|
|
|
}
|
2020-06-17 11:03:25 +00:00
|
|
|
else
|
2020-09-26 23:55:59 +00:00
|
|
|
{
|
2020-11-07 14:31:50 +00:00
|
|
|
m_optionsToolBar = new ACTION_TOOLBAR( this, ID_OPT_TOOLBAR, wxDefaultPosition,
|
|
|
|
wxDefaultSize,
|
2020-06-17 11:03:25 +00:00
|
|
|
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
|
2020-09-26 23:55:59 +00:00
|
|
|
m_optionsToolBar->SetAuiManager( &m_auimgr );
|
|
|
|
}
|
2010-04-16 16:28:35 +00:00
|
|
|
|
2020-05-22 18:27:05 +00:00
|
|
|
m_optionsToolBar->Add( ACTIONS::selectionTool, ACTION_TOOLBAR::TOGGLE );
|
|
|
|
m_optionsToolBar->Add( ACTIONS::measureTool, ACTION_TOOLBAR::TOGGLE );
|
2018-08-08 19:23:31 +00:00
|
|
|
|
2020-06-17 11:03:25 +00:00
|
|
|
m_optionsToolBar->AddScaledSeparator( this );
|
2020-05-22 18:27:05 +00:00
|
|
|
m_optionsToolBar->Add( ACTIONS::toggleGrid, ACTION_TOOLBAR::TOGGLE );
|
|
|
|
m_optionsToolBar->Add( ACTIONS::togglePolarCoords, ACTION_TOOLBAR::TOGGLE );
|
2020-10-03 23:34:23 +00:00
|
|
|
m_optionsToolBar->Add( ACTIONS::inchesUnits, ACTION_TOOLBAR::TOGGLE );
|
|
|
|
m_optionsToolBar->Add( ACTIONS::milsUnits, ACTION_TOOLBAR::TOGGLE );
|
|
|
|
m_optionsToolBar->Add( ACTIONS::millimetersUnits, ACTION_TOOLBAR::TOGGLE );
|
2020-05-22 18:27:05 +00:00
|
|
|
m_optionsToolBar->Add( ACTIONS::toggleCursorStyle, ACTION_TOOLBAR::TOGGLE );
|
2010-04-16 16:28:35 +00:00
|
|
|
|
2020-06-17 11:03:25 +00:00
|
|
|
m_optionsToolBar->AddScaledSeparator( this );
|
2020-05-23 17:14:49 +00:00
|
|
|
m_optionsToolBar->Add( PCB_ACTIONS::showPadNumbers, ACTION_TOOLBAR::TOGGLE );
|
2020-05-22 18:27:05 +00:00
|
|
|
m_optionsToolBar->Add( PCB_ACTIONS::padDisplayMode, ACTION_TOOLBAR::TOGGLE );
|
2020-05-26 22:21:38 +00:00
|
|
|
m_optionsToolBar->Add( PCB_ACTIONS::textOutlines, ACTION_TOOLBAR::TOGGLE );
|
|
|
|
m_optionsToolBar->Add( PCB_ACTIONS::graphicsOutlines, ACTION_TOOLBAR::TOGGLE );
|
2010-04-16 16:28:35 +00:00
|
|
|
|
2011-12-14 20:03:15 +00:00
|
|
|
m_optionsToolBar->Realize();
|
2010-04-16 16:28:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-02-01 21:23:27 +00:00
|
|
|
void DISPLAY_FOOTPRINTS_FRAME::ReCreateHToolbar()
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2020-06-17 11:03:25 +00:00
|
|
|
// 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 )
|
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
|
|
|
}
|
2020-06-17 11:03:25 +00:00
|
|
|
else
|
2020-09-26 23:55:59 +00:00
|
|
|
{
|
2020-06-17 11:03:25 +00:00
|
|
|
m_mainToolBar = new ACTION_TOOLBAR( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
|
|
|
|
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
|
2020-09-26 23:55:59 +00:00
|
|
|
m_mainToolBar->SetAuiManager( &m_auimgr );
|
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2019-05-14 19:21:10 +00:00
|
|
|
m_mainToolBar->Add( ACTIONS::zoomRedraw );
|
|
|
|
m_mainToolBar->Add( ACTIONS::zoomInCenter );
|
|
|
|
m_mainToolBar->Add( ACTIONS::zoomOutCenter );
|
|
|
|
m_mainToolBar->Add( ACTIONS::zoomFitScreen );
|
2021-09-19 16:31:10 +00:00
|
|
|
m_mainToolBar->Add( ACTIONS::zoomTool, ACTION_TOOLBAR::TOGGLE, ACTION_TOOLBAR::CANCEL );
|
2018-08-08 19:23:31 +00:00
|
|
|
|
2020-06-17 11:03:25 +00:00
|
|
|
m_mainToolBar->AddScaledSeparator( this );
|
2019-06-02 14:34:19 +00:00
|
|
|
m_mainToolBar->Add( ACTIONS::show3DViewer );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2020-06-17 11:03:25 +00:00
|
|
|
m_mainToolBar->AddScaledSeparator( this );
|
2018-09-11 15:28:57 +00:00
|
|
|
|
2023-04-09 21:59:01 +00:00
|
|
|
// Grid selection choice box.
|
2020-06-17 11:03:25 +00:00
|
|
|
if( !m_gridSelectBox )
|
2023-04-09 21:59:01 +00:00
|
|
|
m_gridSelectBox = new wxChoice( m_mainToolBar, ID_ON_GRID_SELECT );
|
2020-06-17 11:03:25 +00:00
|
|
|
|
2018-11-23 23:33:02 +00:00
|
|
|
UpdateGridSelectBox();
|
2018-09-11 15:28:57 +00:00
|
|
|
m_mainToolBar->AddControl( m_gridSelectBox );
|
|
|
|
|
2020-06-17 11:03:25 +00:00
|
|
|
m_mainToolBar->AddScaledSeparator( this );
|
2018-09-11 15:28:57 +00:00
|
|
|
|
|
|
|
// Zoom selection choice box.
|
2020-06-17 11:03:25 +00:00
|
|
|
if( !m_zoomSelectBox )
|
2023-04-09 21:59:01 +00:00
|
|
|
m_zoomSelectBox = new wxChoice( m_mainToolBar, ID_ON_ZOOM_SELECT );
|
2020-06-17 11:03:25 +00:00
|
|
|
|
2020-06-14 15:08:47 +00:00
|
|
|
UpdateZoomSelectBox();
|
2018-09-11 15:28:57 +00:00
|
|
|
m_mainToolBar->AddControl( m_zoomSelectBox );
|
|
|
|
|
2022-04-18 08:32:36 +00:00
|
|
|
// Option to run Zoom automatique on footprint selection changge
|
|
|
|
m_mainToolBar->AddTool( ID_CVPCB_FPVIEWER_AUTOZOOM_TOOL, wxEmptyString,
|
|
|
|
KiScaledBitmap( BITMAPS::zoom_auto_fit_in_page, this ),
|
|
|
|
_( "Automatic Zoom on footprint change" ),
|
|
|
|
wxITEM_CHECK );
|
|
|
|
|
|
|
|
m_mainToolBar->AddScaledSeparator( this );
|
|
|
|
|
2021-03-27 21:49:38 +00:00
|
|
|
m_mainToolBar->UpdateControlWidth( ID_ON_GRID_SELECT );
|
|
|
|
m_mainToolBar->UpdateControlWidth( ID_ON_ZOOM_SELECT );
|
|
|
|
|
2021-07-16 20:13:26 +00:00
|
|
|
// after adding the buttons to the toolbar, must call Realize() to reflect the changes
|
2011-12-16 13:32:23 +00:00
|
|
|
m_mainToolBar->Realize();
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-03-27 21:49:38 +00:00
|
|
|
void DISPLAY_FOOTPRINTS_FRAME::UpdateToolbarControlSizes()
|
|
|
|
{
|
|
|
|
if( m_mainToolBar )
|
|
|
|
{
|
|
|
|
// Update the item widths
|
|
|
|
m_mainToolBar->UpdateControlWidth( ID_ON_GRID_SELECT );
|
|
|
|
m_mainToolBar->UpdateControlWidth( ID_ON_ZOOM_SELECT );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-01-13 01:44:19 +00:00
|
|
|
void DISPLAY_FOOTPRINTS_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2022-07-23 08:34:31 +00:00
|
|
|
CVPCB_SETTINGS* cfg = dynamic_cast<CVPCB_SETTINGS*>( aCfg );
|
2020-03-23 15:17:22 +00:00
|
|
|
wxCHECK( cfg, /* void */ );
|
2020-01-13 01:44:19 +00:00
|
|
|
|
2020-05-24 20:10:16 +00:00
|
|
|
// We don't allow people to change this right now, so make sure it's on
|
|
|
|
GetWindowSettings( cfg )->cursor.always_show_cursor = true;
|
|
|
|
|
2020-06-12 10:58:56 +00:00
|
|
|
PCB_BASE_FRAME::LoadSettings( cfg );
|
2018-09-11 15:28:57 +00:00
|
|
|
|
2020-01-13 01:44:19 +00:00
|
|
|
SetDisplayOptions( cfg->m_FootprintViewerDisplayOptions );
|
2018-09-11 15:28:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-01-13 01:44:19 +00:00
|
|
|
void DISPLAY_FOOTPRINTS_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
|
2018-09-11 15:28:57 +00:00
|
|
|
{
|
2020-11-07 14:31:50 +00:00
|
|
|
CVPCB_SETTINGS* cfg = dynamic_cast<CVPCB_SETTINGS*>( aCfg );
|
2020-03-23 15:17:22 +00:00
|
|
|
wxCHECK( cfg, /* void */ );
|
2020-01-13 01:44:19 +00:00
|
|
|
|
2020-06-12 10:58:56 +00:00
|
|
|
PCB_BASE_FRAME::SaveSettings( cfg );
|
2020-01-13 01:44:19 +00:00
|
|
|
|
|
|
|
cfg->m_FootprintViewerDisplayOptions = GetDisplayOptions();
|
2018-09-11 15:28:57 +00:00
|
|
|
|
2020-05-23 17:14:49 +00:00
|
|
|
cfg->m_FootprintViewerZoom = GetCanvas()->GetView()->GetScale();
|
2022-04-18 08:32:36 +00:00
|
|
|
|
|
|
|
wxAuiToolBarItem* toolOpt = m_mainToolBar->FindTool( ID_CVPCB_FPVIEWER_AUTOZOOM_TOOL );
|
|
|
|
cfg->m_FootprintViewerAutoZoomOnSelect = ( toolOpt->GetState() & wxAUI_BUTTON_STATE_CHECKED );
|
2020-01-13 01:44:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
WINDOW_SETTINGS* DISPLAY_FOOTPRINTS_FRAME::GetWindowSettings( APP_SETTINGS_BASE* aCfg )
|
|
|
|
{
|
2022-07-24 22:40:47 +00:00
|
|
|
CVPCB_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<CVPCB_SETTINGS>();
|
2020-01-13 01:44:19 +00:00
|
|
|
return &cfg->m_FootprintViewer;
|
2011-02-21 21:07:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-07-24 22:40:47 +00:00
|
|
|
PCB_VIEWERS_SETTINGS_BASE* DISPLAY_FOOTPRINTS_FRAME::GetViewerSettingsBase() const
|
|
|
|
{
|
|
|
|
return Pgm().GetSettingsManager().GetAppSettings<CVPCB_SETTINGS>();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-05-22 18:27:05 +00:00
|
|
|
MAGNETIC_SETTINGS* DISPLAY_FOOTPRINTS_FRAME::GetMagneticItemsSettings()
|
|
|
|
{
|
2022-07-24 22:40:47 +00:00
|
|
|
CVPCB_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<CVPCB_SETTINGS>();
|
2020-05-22 18:27:05 +00:00
|
|
|
return &cfg->m_FootprintViewerMagneticSettings;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-08-04 12:43:02 +00:00
|
|
|
COLOR4D DISPLAY_FOOTPRINTS_FRAME::GetGridColor()
|
2010-02-01 21:23:27 +00:00
|
|
|
{
|
2017-02-20 16:57:41 +00:00
|
|
|
return COLOR4D( DARKGRAY );
|
2010-02-01 21:23:27 +00:00
|
|
|
}
|
2013-04-26 15:11:52 +00:00
|
|
|
|
|
|
|
|
2020-11-13 15:15:52 +00:00
|
|
|
FOOTPRINT* DISPLAY_FOOTPRINTS_FRAME::GetFootprint( const wxString& aFootprintName,
|
|
|
|
REPORTER& aReporter )
|
2013-04-26 15:11:52 +00:00
|
|
|
{
|
2021-07-16 20:13:26 +00:00
|
|
|
FOOTPRINT* footprint = nullptr;
|
2020-11-13 15:15:52 +00:00
|
|
|
LIB_ID fpid;
|
2020-05-23 18:12:59 +00:00
|
|
|
|
2020-12-17 23:32:23 +00:00
|
|
|
if( fpid.Parse( aFootprintName ) >= 0 )
|
2013-04-26 15:11:52 +00:00
|
|
|
{
|
2021-06-28 23:44:07 +00:00
|
|
|
aReporter.Report( wxString::Format( _( "Footprint ID '%s' is not valid." ),
|
2020-06-03 23:34:42 +00:00
|
|
|
aFootprintName ),
|
|
|
|
RPT_SEVERITY_ERROR );
|
2021-07-16 20:13:26 +00:00
|
|
|
return nullptr;
|
2020-05-23 18:12:59 +00:00
|
|
|
}
|
|
|
|
|
2023-09-09 04:10:57 +00:00
|
|
|
wxString libNickname = From_UTF8( fpid.GetLibNickname().c_str() );
|
|
|
|
wxString fpName = From_UTF8( fpid.GetLibItemName().c_str() );
|
2013-09-14 20:33:22 +00:00
|
|
|
|
2023-09-28 03:15:54 +00:00
|
|
|
FP_LIB_TABLE* fpTable = PROJECT_PCB::PcbFootprintLibs( &Prj() );
|
2020-05-23 18:12:59 +00:00
|
|
|
wxASSERT( fpTable );
|
2013-09-14 20:33:22 +00:00
|
|
|
|
2020-05-23 18:12:59 +00:00
|
|
|
// See if the library requested is in the library table
|
|
|
|
if( !fpTable->HasLibrary( libNickname ) )
|
|
|
|
{
|
2021-06-28 23:44:07 +00:00
|
|
|
aReporter.Report( wxString::Format( _( "Library '%s' is not in the footprint library table." ),
|
2020-06-03 23:34:42 +00:00
|
|
|
libNickname ),
|
|
|
|
RPT_SEVERITY_ERROR );
|
2021-07-16 20:13:26 +00:00
|
|
|
return nullptr;
|
2020-05-23 18:12:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// See if the footprint requested is in the library
|
|
|
|
if( !fpTable->FootprintExists( libNickname, fpName ) )
|
|
|
|
{
|
2021-06-28 23:44:07 +00:00
|
|
|
aReporter.Report( wxString::Format( _( "Footprint '%s' not found." ), aFootprintName ),
|
2020-06-03 23:34:42 +00:00
|
|
|
RPT_SEVERITY_ERROR );
|
2021-07-16 20:13:26 +00:00
|
|
|
return nullptr;
|
2020-05-23 18:12:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
2021-02-25 23:42:12 +00:00
|
|
|
const FOOTPRINT* fp = fpTable->GetEnumeratedFootprint( libNickname, fpName );
|
|
|
|
|
|
|
|
if( fp )
|
|
|
|
footprint = static_cast<FOOTPRINT*>( fp->Duplicate() );
|
2013-04-26 15:11:52 +00:00
|
|
|
}
|
2014-04-09 13:33:04 +00:00
|
|
|
catch( const IO_ERROR& ioe )
|
2013-04-26 15:11:52 +00:00
|
|
|
{
|
2016-09-14 22:36:45 +00:00
|
|
|
DisplayError( this, ioe.What() );
|
2021-07-16 20:13:26 +00:00
|
|
|
return nullptr;
|
2013-04-26 15:11:52 +00:00
|
|
|
}
|
|
|
|
|
2013-09-14 20:33:22 +00:00
|
|
|
if( footprint )
|
|
|
|
{
|
2023-05-31 20:37:58 +00:00
|
|
|
footprint->SetFPID( fpid );
|
2013-09-14 20:33:22 +00:00
|
|
|
footprint->SetParent( (EDA_ITEM*) GetBoard() );
|
2023-02-19 03:40:07 +00:00
|
|
|
footprint->SetPosition( VECTOR2I( 0, 0 ) );
|
2013-09-14 20:33:22 +00:00
|
|
|
return footprint;
|
|
|
|
}
|
|
|
|
|
2021-06-28 23:44:07 +00:00
|
|
|
aReporter.Report( wxString::Format( _( "Footprint '%s' not found." ), aFootprintName ),
|
2020-06-03 23:34:42 +00:00
|
|
|
RPT_SEVERITY_ERROR );
|
2021-07-16 20:13:26 +00:00
|
|
|
return nullptr;
|
2013-04-26 15:11:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-05-31 20:37:58 +00:00
|
|
|
void DISPLAY_FOOTPRINTS_FRAME::ReloadFootprint( FOOTPRINT* aFootprint )
|
|
|
|
{
|
|
|
|
if( !aFootprint || !m_currentComp )
|
|
|
|
return;
|
|
|
|
|
|
|
|
GetBoard()->DeleteAllFootprints();
|
|
|
|
GetBoard()->GetNetInfo().RemoveUnusedNets();
|
|
|
|
GetCanvas()->GetView()->Clear();
|
|
|
|
|
|
|
|
|
|
|
|
for( PAD* pad : aFootprint->Pads() )
|
|
|
|
{
|
|
|
|
const COMPONENT_NET& net = m_currentComp->GetNet( pad->GetNumber() );
|
|
|
|
|
|
|
|
if( !net.GetPinFunction().IsEmpty() )
|
|
|
|
{
|
|
|
|
NETINFO_ITEM* netinfo = new NETINFO_ITEM( GetBoard() );
|
|
|
|
netinfo->SetNetname( net.GetPinFunction() );
|
|
|
|
GetBoard()->Add( netinfo );
|
|
|
|
pad->SetNet( netinfo );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
GetBoard()->Add( aFootprint );
|
|
|
|
updateView();
|
|
|
|
GetCanvas()->Refresh();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-04-26 15:11:52 +00:00
|
|
|
void DISPLAY_FOOTPRINTS_FRAME::InitDisplay()
|
|
|
|
{
|
2018-07-01 15:22:33 +00:00
|
|
|
CVPCB_MAINFRAME* parentframe = (CVPCB_MAINFRAME *) GetParent();
|
2022-07-24 22:40:47 +00:00
|
|
|
COMPONENT* comp = parentframe->GetSelectedComponent();
|
2020-11-13 15:15:52 +00:00
|
|
|
FOOTPRINT* footprint = nullptr;
|
2020-11-07 14:31:50 +00:00
|
|
|
const FOOTPRINT_INFO* fpInfo = nullptr;
|
2013-10-31 21:30:57 +00:00
|
|
|
|
2016-02-25 09:52:29 +00:00
|
|
|
wxString footprintName = parentframe->GetSelectedFootprint();
|
2013-04-26 15:11:52 +00:00
|
|
|
|
2022-07-24 22:40:47 +00:00
|
|
|
if( footprintName.IsEmpty() && comp )
|
2023-09-14 15:35:19 +00:00
|
|
|
footprintName = comp->GetFPID().Format().wx_str();
|
2022-07-25 12:29:18 +00:00
|
|
|
|
|
|
|
if( m_currentFootprint == footprintName && m_currentComp == comp )
|
|
|
|
return;
|
|
|
|
|
|
|
|
GetBoard()->DeleteAllFootprints();
|
|
|
|
GetBoard()->GetNetInfo().RemoveUnusedNets();
|
|
|
|
GetCanvas()->GetView()->Clear();
|
2013-04-26 15:11:52 +00:00
|
|
|
|
2020-06-03 23:34:42 +00:00
|
|
|
INFOBAR_REPORTER infoReporter( m_infoBar );
|
|
|
|
m_infoBar->Dismiss();
|
|
|
|
|
2018-07-01 15:22:33 +00:00
|
|
|
if( !footprintName.IsEmpty() )
|
|
|
|
{
|
|
|
|
SetTitle( wxString::Format( _( "Footprint: %s" ), footprintName ) );
|
2013-04-26 15:11:52 +00:00
|
|
|
|
2020-11-07 14:31:50 +00:00
|
|
|
footprint = GetFootprint( footprintName, infoReporter );
|
2013-04-26 15:11:52 +00:00
|
|
|
|
2020-11-07 14:31:50 +00:00
|
|
|
fpInfo = parentframe->m_FootprintsList->GetFootprintInfo( footprintName );
|
2018-07-01 15:22:33 +00:00
|
|
|
}
|
2013-04-26 15:11:52 +00:00
|
|
|
|
2020-11-07 14:31:50 +00:00
|
|
|
if( footprint )
|
2022-07-24 22:40:47 +00:00
|
|
|
{
|
|
|
|
if( comp )
|
|
|
|
{
|
|
|
|
for( PAD* pad : footprint->Pads() )
|
|
|
|
{
|
|
|
|
const COMPONENT_NET& net = comp->GetNet( pad->GetNumber() );
|
|
|
|
|
|
|
|
if( !net.GetPinFunction().IsEmpty() )
|
|
|
|
{
|
|
|
|
NETINFO_ITEM* netinfo = new NETINFO_ITEM( GetBoard() );
|
|
|
|
netinfo->SetNetname( net.GetPinFunction() );
|
|
|
|
GetBoard()->Add( netinfo );
|
|
|
|
pad->SetNet( netinfo );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-07 14:31:50 +00:00
|
|
|
GetBoard()->Add( footprint );
|
2022-07-25 12:29:18 +00:00
|
|
|
m_currentFootprint = footprintName;
|
|
|
|
m_currentComp = comp;
|
2023-05-31 20:37:58 +00:00
|
|
|
setFPWatcher( footprint );
|
2022-07-24 22:40:47 +00:00
|
|
|
}
|
2013-04-26 15:11:52 +00:00
|
|
|
|
2020-11-07 14:31:50 +00:00
|
|
|
if( fpInfo )
|
|
|
|
SetStatusText( wxString::Format( _( "Lib: %s" ), fpInfo->GetLibNickname() ), 0 );
|
2018-07-01 15:22:33 +00:00
|
|
|
else
|
|
|
|
SetStatusText( wxEmptyString, 0 );
|
2013-04-26 15:11:52 +00:00
|
|
|
|
2020-06-03 23:34:42 +00:00
|
|
|
infoReporter.Finalize();
|
|
|
|
|
2018-08-06 18:26:37 +00:00
|
|
|
updateView();
|
|
|
|
|
2013-04-26 15:11:52 +00:00
|
|
|
UpdateStatusBar();
|
2018-09-11 15:28:57 +00:00
|
|
|
|
2019-06-13 17:28:55 +00:00
|
|
|
GetCanvas()->Refresh();
|
2021-04-09 06:34:33 +00:00
|
|
|
Update3DView( true, true );
|
2013-04-26 15:11:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-08-06 18:26:37 +00:00
|
|
|
void DISPLAY_FOOTPRINTS_FRAME::updateView()
|
|
|
|
{
|
2019-06-13 17:28:55 +00:00
|
|
|
PCB_DRAW_PANEL_GAL* dp = static_cast<PCB_DRAW_PANEL_GAL*>( GetCanvas() );
|
2020-01-13 01:44:19 +00:00
|
|
|
dp->UpdateColors();
|
2018-09-11 15:28:57 +00:00
|
|
|
dp->DisplayBoard( GetBoard() );
|
|
|
|
|
|
|
|
m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD );
|
|
|
|
|
2022-04-18 08:32:36 +00:00
|
|
|
wxAuiToolBarItem* toolOpt = m_mainToolBar->FindTool( ID_CVPCB_FPVIEWER_AUTOZOOM_TOOL );
|
|
|
|
|
|
|
|
if( toolOpt->GetState() & wxAUI_BUTTON_STATE_CHECKED )
|
2023-06-26 22:16:51 +00:00
|
|
|
m_toolManager->RunAction( ACTIONS::zoomFitScreen );
|
2018-09-11 15:28:57 +00:00
|
|
|
else
|
2023-06-26 22:16:51 +00:00
|
|
|
m_toolManager->RunAction( ACTIONS::centerContents );
|
2018-09-11 15:28:57 +00:00
|
|
|
|
|
|
|
UpdateMsgPanel();
|
2018-08-06 18:26:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void DISPLAY_FOOTPRINTS_FRAME::UpdateMsgPanel()
|
|
|
|
{
|
2021-09-26 23:22:32 +00:00
|
|
|
FOOTPRINT* footprint = GetBoard()->GetFirstFootprint();
|
|
|
|
std::vector<MSG_PANEL_ITEM> items;
|
2018-08-06 18:26:37 +00:00
|
|
|
|
|
|
|
if( footprint )
|
2020-04-24 13:36:10 +00:00
|
|
|
footprint->GetMsgPanelInfo( this, items );
|
2018-08-06 18:26:37 +00:00
|
|
|
|
|
|
|
SetMsgPanel( items );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-09-07 20:34:10 +00:00
|
|
|
COLOR_SETTINGS* DISPLAY_FOOTPRINTS_FRAME::GetColorSettings( bool aForceRefresh ) const
|
2020-05-08 21:05:29 +00:00
|
|
|
{
|
|
|
|
auto* settings = Pgm().GetSettingsManager().GetAppSettings<FOOTPRINT_EDITOR_SETTINGS>();
|
|
|
|
|
|
|
|
if( settings )
|
|
|
|
return Pgm().GetSettingsManager().GetColorSettings( settings->m_ColorTheme );
|
|
|
|
else
|
|
|
|
return Pgm().GetSettingsManager().GetColorSettings();
|
|
|
|
}
|
2020-05-22 18:27:05 +00:00
|
|
|
|
|
|
|
|
|
|
|
BOARD_ITEM_CONTAINER* DISPLAY_FOOTPRINTS_FRAME::GetModel() const
|
|
|
|
{
|
2020-11-08 21:29:04 +00:00
|
|
|
return GetBoard()->GetFirstFootprint();
|
2020-05-22 18:27:05 +00:00
|
|
|
}
|
2020-05-23 17:14:49 +00:00
|
|
|
|
|
|
|
|
2020-07-29 23:50:25 +00:00
|
|
|
SELECTION& DISPLAY_FOOTPRINTS_FRAME::GetCurrentSelection()
|
|
|
|
{
|
|
|
|
return m_toolManager->GetTool<CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL>()->GetSelection();
|
|
|
|
}
|