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>
|
|
|
|
* Copyright (C) 2007-2018 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
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2018-01-28 08:51:28 +00:00
|
|
|
* @file display_footprints_frame.cpp
|
2011-12-12 14:02:37 +00:00
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <fctsys.h>
|
|
|
|
#include <common.h>
|
2018-08-06 18:26:37 +00:00
|
|
|
#include <gal/graphics_abstraction_layer.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <class_drawpanel.h>
|
2014-04-04 09:56:04 +00:00
|
|
|
#include <class_draw_panel_gal.h>
|
2018-08-06 18:26:37 +00:00
|
|
|
#include <pcb_draw_panel_gal.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <confirm.h>
|
|
|
|
#include <macros.h>
|
|
|
|
#include <bitmaps.h>
|
2013-01-12 17:32:24 +00:00
|
|
|
#include <msgpanel.h>
|
2013-04-26 15:11:52 +00:00
|
|
|
#include <wildcards_and_files_ext.h>
|
2016-11-20 23:35:08 +00:00
|
|
|
#include <lib_id.h>
|
2013-09-14 20:33:22 +00:00
|
|
|
#include <fp_lib_table.h>
|
2018-08-11 16:04:46 +00:00
|
|
|
#include <eda_dockart.h>
|
2011-09-23 13:57:12 +00:00
|
|
|
|
2013-04-26 15:11:52 +00:00
|
|
|
#include <io_mgr.h>
|
|
|
|
#include <class_module.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <class_board.h>
|
2018-08-06 18:26:37 +00:00
|
|
|
#include <pcb_painter.h>
|
2009-02-05 20:53:08 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <cvpcb_mainframe.h>
|
2018-01-28 08:51:28 +00:00
|
|
|
#include <display_footprints_frame.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <cvpcb_id.h>
|
2018-01-28 08:51:28 +00:00
|
|
|
#include <listboxes.h>
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2016-07-19 17:35:25 +00:00
|
|
|
#include <3d_viewer/eda_3d_viewer.h>
|
2018-08-06 18:26:37 +00:00
|
|
|
#include <view/view.h>
|
|
|
|
|
|
|
|
#include <tool/tool_manager.h>
|
|
|
|
#include <tool/tool_dispatcher.h>
|
|
|
|
#include <tool/common_tools.h>
|
|
|
|
#include "tools/cvpcb_actions.h"
|
2009-05-06 11:55:36 +00:00
|
|
|
|
2017-09-10 14:21:56 +00:00
|
|
|
// Colors for layers and items
|
|
|
|
COLORS_DESIGN_SETTINGS g_ColorsSettings( FRAME_CVPCB_DISPLAY );
|
|
|
|
|
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 )
|
|
|
|
EVT_TOOL( ID_OPTIONS_SETUP, DISPLAY_FOOTPRINTS_FRAME::InstallOptionsDisplay )
|
|
|
|
EVT_TOOL( ID_CVPCB_SHOW3D_FRAME, DISPLAY_FOOTPRINTS_FRAME::Show3D_Frame )
|
2018-09-11 15:28:57 +00:00
|
|
|
EVT_CHOICE( ID_ON_ZOOM_SELECT, DISPLAY_FOOTPRINTS_FRAME::OnSelectZoom )
|
|
|
|
EVT_CHOICE( ID_ON_GRID_SELECT, DISPLAY_FOOTPRINTS_FRAME::OnSelectGrid )
|
2015-02-01 07:19:31 +00:00
|
|
|
|
2018-08-08 19:23:31 +00:00
|
|
|
EVT_UPDATE_UI( ID_NO_TOOL_SELECTED, DISPLAY_FOOTPRINTS_FRAME::OnUIToolSelection )
|
|
|
|
EVT_UPDATE_UI( ID_TB_MEASUREMENT_TOOL, DISPLAY_FOOTPRINTS_FRAME::OnUIToolSelection )
|
|
|
|
EVT_UPDATE_UI( ID_ZOOM_SELECTION, DISPLAY_FOOTPRINTS_FRAME::OnUIToolSelection )
|
|
|
|
|
2018-08-06 18:26:37 +00:00
|
|
|
/*
|
|
|
|
EVT_TOOL and EVT_UPDATE_UI for:
|
|
|
|
ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH,
|
|
|
|
ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH,
|
|
|
|
ID_TB_OPTIONS_SHOW_PADS_SKETCH
|
|
|
|
are managed in PCB_BASE_FRAME
|
|
|
|
*/
|
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 ) :
|
2014-04-19 18:47:20 +00:00
|
|
|
PCB_BASE_FRAME( aKiway, aParent, FRAME_CVPCB_DISPLAY, _( "Footprint Viewer" ),
|
2018-07-01 14:48:35 +00:00
|
|
|
wxDefaultPosition, wxDefaultSize,
|
|
|
|
KICAD_DEFAULT_DRAWFRAME_STYLE, FOOTPRINTVIEWER_FRAME_NAME )
|
2007-10-03 15:21:13 +00:00
|
|
|
{
|
2011-12-14 20:03:15 +00:00
|
|
|
m_showAxis = true; // true to draw axis.
|
2007-10-27 12:24:09 +00:00
|
|
|
|
|
|
|
// Give an icon
|
2011-09-11 11:38:01 +00:00
|
|
|
wxIcon icon;
|
|
|
|
icon.CopyFromBitmap( KiBitmap( icon_cvpcb_xpm ) );
|
|
|
|
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() );
|
2012-01-04 06:18:38 +00:00
|
|
|
SetScreen( new PCB_SCREEN( GetPageSizeIU() ) );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2018-08-29 00:00:27 +00:00
|
|
|
// Don't show the default board solder mask clearance. Only the
|
|
|
|
// footprint or pad clearance setting should be shown if it is not 0.
|
|
|
|
GetBoard()->GetDesignSettings().m_SolderMaskMargin = 0;
|
|
|
|
|
* 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() );
|
2011-02-21 21:07:00 +00:00
|
|
|
|
2015-05-12 09:05:36 +00:00
|
|
|
// Initialize grid id to a default value if not found in config or incorrect:
|
|
|
|
if( !( GetScreen()->GridExists( m_LastGridSizeId + ID_POPUP_GRID_LEVEL_1000 ) ) )
|
2009-10-15 11:35:53 +00:00
|
|
|
m_LastGridSizeId = ID_POPUP_GRID_LEVEL_500 - ID_POPUP_GRID_LEVEL_1000;
|
2013-04-26 15:11:52 +00:00
|
|
|
|
2015-05-12 09:05:36 +00:00
|
|
|
GetScreen()->SetGrid( m_LastGridSizeId + ID_POPUP_GRID_LEVEL_1000 );
|
2009-09-19 16:15:40 +00:00
|
|
|
|
|
|
|
// Initialize some display options
|
2017-10-30 17:21:07 +00:00
|
|
|
auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions();
|
2015-01-10 10:27:49 +00:00
|
|
|
displ_opts->m_DisplayPadIsol = false; // Pad clearance has no meaning here
|
2011-09-24 18:33:28 +00:00
|
|
|
|
|
|
|
// Track and via clearance has no meaning here.
|
2017-10-30 17:21:07 +00:00
|
|
|
displ_opts->m_ShowTrackClearanceMode = PCB_DISPLAY_OPTIONS::DO_NOT_SHOW_CLEARANCE;
|
2009-09-19 16:15:40 +00:00
|
|
|
|
2007-10-03 15:21:13 +00:00
|
|
|
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
|
|
|
|
ReCreateHToolbar();
|
|
|
|
ReCreateVToolbar();
|
2010-04-16 16:28:35 +00:00
|
|
|
ReCreateOptToolbar();
|
2009-11-07 14:36:54 +00:00
|
|
|
|
2018-08-06 18:26:37 +00:00
|
|
|
// Create GAL canvas
|
2018-09-11 15:28:57 +00:00
|
|
|
#ifdef __WXMAC__
|
|
|
|
// Cairo renderer doesn't handle Retina displays
|
|
|
|
EDA_DRAW_PANEL_GAL::GAL_TYPE backend = EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL;
|
|
|
|
#else
|
2018-08-06 18:26:37 +00:00
|
|
|
EDA_DRAW_PANEL_GAL::GAL_TYPE backend = EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO;
|
2018-09-11 15:28:57 +00:00
|
|
|
#endif
|
2018-08-11 16:04:46 +00:00
|
|
|
auto* gal_drawPanel = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_FrameSize,
|
|
|
|
GetGalDisplayOptions(), backend );
|
2018-08-06 18:26:37 +00:00
|
|
|
SetGalCanvas( gal_drawPanel );
|
|
|
|
|
2009-11-07 14:36:54 +00:00
|
|
|
m_auimgr.SetManagedWindow( this );
|
2018-08-11 16:04:46 +00:00
|
|
|
m_auimgr.SetArtProvider( new EDA_DOCKART( this ) );
|
2009-11-07 14:36:54 +00:00
|
|
|
|
2018-08-11 16:04:46 +00:00
|
|
|
m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) );
|
|
|
|
m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" ).Bottom().Layer(6) );
|
2011-09-15 18:25:44 +00:00
|
|
|
|
2018-08-11 16:04:46 +00:00
|
|
|
m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" ).Left().Layer(3) );
|
2011-09-15 18:25:44 +00:00
|
|
|
|
2018-08-11 20:47:18 +00:00
|
|
|
m_auimgr.AddPane( m_canvas, EDA_PANE().Canvas().Name( "DrawFrame" ).Center() );
|
|
|
|
m_auimgr.AddPane( GetGalCanvas(), EDA_PANE().Canvas().Name( "DrawFrameGal" ).Center().Hide() );
|
2010-04-16 16:28:35 +00:00
|
|
|
|
2009-11-07 14:36:54 +00:00
|
|
|
m_auimgr.Update();
|
2010-02-08 18:15:42 +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(),
|
|
|
|
gal_drawPanel->GetViewControls(), this );
|
|
|
|
m_actions = new CVPCB_ACTIONS();
|
|
|
|
m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager, m_actions );
|
|
|
|
gal_drawPanel->SetEventDispatcher( m_toolDispatcher );
|
|
|
|
|
|
|
|
m_actions->RegisterAllTools( m_toolManager );
|
|
|
|
m_toolManager->InitTools();
|
|
|
|
|
|
|
|
// Run the control tool, it is supposed to be always active
|
|
|
|
m_toolManager->InvokeTool( "cvpcb.InteractiveSelection" );
|
|
|
|
|
|
|
|
auto& galOpts = GetGalDisplayOptions();
|
|
|
|
galOpts.m_axesEnabled = true;
|
2018-09-11 15:28:57 +00:00
|
|
|
UseGalCanvas( true );
|
|
|
|
|
|
|
|
// Restore last zoom. (If auto-zooming we'll adjust when we load the footprint.)
|
|
|
|
GetGalCanvas()->GetView()->SetScale( m_lastZoom );
|
2018-08-06 18:26:37 +00:00
|
|
|
|
|
|
|
updateView();
|
|
|
|
|
2011-02-21 21:07:00 +00:00
|
|
|
Show( true );
|
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
|
|
|
{
|
2018-09-11 15:28:57 +00:00
|
|
|
GetGalCanvas()->StopDrawing();
|
|
|
|
GetGalCanvas()->GetView()->Clear();
|
|
|
|
// Be sure any event cannot be fired after frame deletion:
|
|
|
|
GetGalCanvas()->SetEvtHandlerEnabled( false );
|
2018-08-08 19:23:31 +00:00
|
|
|
|
|
|
|
// Be sure a active tool (if exists) is desactivated:
|
|
|
|
if( m_toolManager )
|
|
|
|
m_toolManager->DeactivateTool();
|
2018-08-06 18:26:37 +00:00
|
|
|
|
2011-02-05 02:21:11 +00:00
|
|
|
delete GetScreen();
|
2012-02-09 20:33:38 +00:00
|
|
|
SetScreen( NULL ); // Be sure there is no double deletion
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2012-02-07 17:36:24 +00:00
|
|
|
|
2010-02-01 21:23:27 +00:00
|
|
|
void DISPLAY_FOOTPRINTS_FRAME::OnCloseWindow( wxCloseEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2018-08-08 19:23:31 +00:00
|
|
|
Destroy();
|
2007-05-06 16:03:28 +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.
|
|
|
|
// So do nothing
|
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 )
|
2010-04-16 16:28:35 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
// Create options tool bar.
|
2011-12-16 13:32:23 +00:00
|
|
|
m_optionsToolBar = new wxAuiToolBar( this, ID_OPT_TOOLBAR, wxDefaultPosition, wxDefaultSize,
|
2017-09-27 17:40:18 +00:00
|
|
|
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
|
2010-04-16 16:28:35 +00:00
|
|
|
|
2018-08-08 19:23:31 +00:00
|
|
|
// TODO: these can be moved to the 'proper' right vertical toolbar if and when there are
|
|
|
|
// actual tools to put there. That, or I'll get around to implementing configurable
|
|
|
|
// toolbars.
|
|
|
|
m_optionsToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString,
|
|
|
|
KiScaledBitmap( cursor_xpm, this ),
|
|
|
|
wxEmptyString, wxITEM_CHECK );
|
|
|
|
|
|
|
|
m_optionsToolBar->AddTool( ID_TB_MEASUREMENT_TOOL, wxEmptyString,
|
|
|
|
KiScaledBitmap( measurement_xpm, this ),
|
|
|
|
_( "Measure distance between two points" ),
|
|
|
|
wxITEM_CHECK );
|
|
|
|
|
|
|
|
KiScaledSeparator( m_optionsToolBar, this );
|
|
|
|
|
|
|
|
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString, KiScaledBitmap( grid_xpm, this ),
|
2010-04-16 16:28:35 +00:00
|
|
|
_( "Hide grid" ), wxITEM_CHECK );
|
|
|
|
|
2011-12-14 20:03:15 +00:00
|
|
|
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, wxEmptyString,
|
2018-08-08 19:23:31 +00:00
|
|
|
KiScaledBitmap( polar_coord_xpm, this ),
|
2011-02-21 21:07:00 +00:00
|
|
|
_( "Display polar coordinates" ), wxITEM_CHECK );
|
2010-04-16 16:28:35 +00:00
|
|
|
|
2011-12-14 20:03:15 +00:00
|
|
|
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, wxEmptyString,
|
2018-08-08 19:23:31 +00:00
|
|
|
KiScaledBitmap( unit_inch_xpm, this ),
|
2016-10-10 22:54:58 +00:00
|
|
|
_( "Set units to inches" ), wxITEM_CHECK );
|
2010-04-16 16:28:35 +00:00
|
|
|
|
2011-12-14 20:03:15 +00:00
|
|
|
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_MM, wxEmptyString,
|
2018-08-08 19:23:31 +00:00
|
|
|
KiScaledBitmap( unit_mm_xpm, this ),
|
2016-10-10 22:54:58 +00:00
|
|
|
_( "Set units to millimeters" ), wxITEM_CHECK );
|
2010-04-16 16:28:35 +00:00
|
|
|
|
2016-05-11 03:33:24 +00:00
|
|
|
#ifndef __APPLE__
|
2011-12-14 20:03:15 +00:00
|
|
|
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_CURSOR, wxEmptyString,
|
2018-08-08 19:23:31 +00:00
|
|
|
KiScaledBitmap( cursor_shape_xpm, this ),
|
2011-02-21 21:07:00 +00:00
|
|
|
_( "Change cursor shape" ), wxITEM_CHECK );
|
2018-01-27 18:11:56 +00:00
|
|
|
#else
|
|
|
|
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_CURSOR, wxEmptyString,
|
2018-08-08 19:23:31 +00:00
|
|
|
KiScaledBitmap( cursor_shape_xpm, this ),
|
2018-02-19 19:26:02 +00:00
|
|
|
_( "Change cursor shape (not supported in Legacy Toolset)" ),
|
2018-01-27 18:11:56 +00:00
|
|
|
wxITEM_CHECK );
|
|
|
|
#endif
|
2010-04-16 16:28:35 +00:00
|
|
|
|
2011-12-14 20:03:15 +00:00
|
|
|
m_optionsToolBar->AddSeparator();
|
|
|
|
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_PADS_SKETCH, wxEmptyString,
|
2018-08-08 19:23:31 +00:00
|
|
|
KiScaledBitmap( pad_sketch_xpm, this ),
|
2011-02-21 21:07:00 +00:00
|
|
|
_( "Show pads in outline mode" ), wxITEM_CHECK );
|
2010-04-16 16:28:35 +00:00
|
|
|
|
2011-12-14 20:03:15 +00:00
|
|
|
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, wxEmptyString,
|
2018-08-08 19:23:31 +00:00
|
|
|
KiScaledBitmap( text_sketch_xpm, this ),
|
2011-02-21 21:07:00 +00:00
|
|
|
_( "Show texts in line mode" ), wxITEM_CHECK );
|
2010-04-16 16:28:35 +00:00
|
|
|
|
2011-12-14 20:03:15 +00:00
|
|
|
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, wxEmptyString,
|
2018-08-08 19:23:31 +00:00
|
|
|
KiScaledBitmap( show_mod_edge_xpm, this ),
|
2011-02-21 21:07:00 +00:00
|
|
|
_( "Show outlines in line mode" ), wxITEM_CHECK );
|
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
|
|
|
{
|
2011-12-16 13:32:23 +00:00
|
|
|
if( m_mainToolBar != NULL )
|
2007-10-03 15:21:13 +00:00
|
|
|
return;
|
|
|
|
|
2011-12-16 13:32:23 +00:00
|
|
|
m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
|
2017-09-27 17:40:18 +00:00
|
|
|
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2018-09-11 15:28:57 +00:00
|
|
|
m_mainToolBar->AddTool( ID_OPTIONS_SETUP, wxEmptyString, KiScaledBitmap( config_xpm, this ),
|
2011-12-16 13:32:23 +00:00
|
|
|
_( "Display options" ) );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2011-12-16 13:32:23 +00:00
|
|
|
m_mainToolBar->AddSeparator();
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2018-08-08 19:23:31 +00:00
|
|
|
m_mainToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, KiScaledBitmap( zoom_in_xpm, this ),
|
2011-12-16 13:32:23 +00:00
|
|
|
_( "Zoom in (F1)" ) );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2018-08-08 19:23:31 +00:00
|
|
|
m_mainToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, KiScaledBitmap( zoom_out_xpm, this ),
|
2011-12-16 13:32:23 +00:00
|
|
|
_( "Zoom out (F2)" ) );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2018-08-08 19:23:31 +00:00
|
|
|
m_mainToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, KiScaledBitmap( zoom_redraw_xpm, this ),
|
2011-12-16 13:32:23 +00:00
|
|
|
_( "Redraw view (F3)" ) );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2018-08-08 19:23:31 +00:00
|
|
|
m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, KiScaledBitmap( zoom_fit_in_page_xpm, this ),
|
2018-03-16 12:38:36 +00:00
|
|
|
_( "Zoom to fit footprint (Home)" ) );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2018-08-08 19:23:31 +00:00
|
|
|
m_mainToolBar->AddTool( ID_ZOOM_SELECTION, wxEmptyString, KiScaledBitmap( zoom_area_xpm, this ),
|
|
|
|
_( "Zoom to selection" ), wxITEM_CHECK );
|
|
|
|
|
2011-12-16 13:32:23 +00:00
|
|
|
m_mainToolBar->AddSeparator();
|
2018-08-08 19:23:31 +00:00
|
|
|
m_mainToolBar->AddTool( ID_CVPCB_SHOW3D_FRAME, wxEmptyString, KiScaledBitmap( three_d_xpm, this ),
|
2015-03-26 19:04:52 +00:00
|
|
|
_( "3D Display (Alt+3)" ) );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2018-09-11 15:28:57 +00:00
|
|
|
KiScaledSeparator( m_mainToolBar, this );
|
|
|
|
|
|
|
|
// Grid selection choice box.
|
|
|
|
m_gridSelectBox = new wxChoice( m_mainToolBar, ID_ON_GRID_SELECT,
|
|
|
|
wxDefaultPosition, wxDefaultSize, 0, NULL );
|
2018-11-23 23:33:02 +00:00
|
|
|
UpdateGridSelectBox();
|
2018-09-11 15:28:57 +00:00
|
|
|
m_mainToolBar->AddControl( m_gridSelectBox );
|
|
|
|
|
|
|
|
KiScaledSeparator( m_mainToolBar, this );
|
|
|
|
|
|
|
|
// Zoom selection choice box.
|
|
|
|
m_zoomSelectBox = new wxChoice( m_mainToolBar, ID_ON_ZOOM_SELECT,
|
|
|
|
wxDefaultPosition, wxDefaultSize, 0, NULL );
|
|
|
|
updateZoomSelectBox();
|
|
|
|
m_mainToolBar->AddControl( m_zoomSelectBox );
|
|
|
|
|
2007-10-03 15:21:13 +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
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-09-11 15:28:57 +00:00
|
|
|
void DISPLAY_FOOTPRINTS_FRAME::LoadSettings( wxConfigBase* aCfg )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2018-09-11 15:28:57 +00:00
|
|
|
PCB_BASE_FRAME::LoadSettings( aCfg );
|
|
|
|
|
|
|
|
m_configSettings.Load( aCfg ); // mainly, load the color config
|
|
|
|
|
|
|
|
aCfg->Read( ConfigBaseName() + AUTO_ZOOM_KEY, &m_autoZoom, true );
|
|
|
|
aCfg->Read( ConfigBaseName() + ZOOM_KEY, &m_lastZoom, 10.0 );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void DISPLAY_FOOTPRINTS_FRAME::SaveSettings( wxConfigBase* aCfg )
|
|
|
|
{
|
|
|
|
PCB_BASE_FRAME::SaveSettings( aCfg );
|
|
|
|
|
|
|
|
aCfg->Write( ConfigBaseName() + AUTO_ZOOM_KEY, m_autoZoom );
|
|
|
|
aCfg->Write( ConfigBaseName() + ZOOM_KEY, GetGalCanvas()->GetView()->GetScale() );
|
2011-02-21 21:07:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-09-11 15:28:57 +00:00
|
|
|
void DISPLAY_FOOTPRINTS_FRAME::ApplyDisplaySettingsToGAL()
|
2011-02-21 21:07:00 +00:00
|
|
|
{
|
2018-09-11 15:28:57 +00:00
|
|
|
auto painter = static_cast<KIGFX::PCB_PAINTER*>( GetGalCanvas()->GetView()->GetPainter() );
|
|
|
|
KIGFX::PCB_RENDER_SETTINGS* settings = painter->GetSettings();
|
|
|
|
settings->LoadDisplayOptions( &m_DisplayOptions, false );
|
2011-02-21 21:07:00 +00:00
|
|
|
|
2018-09-11 15:28:57 +00:00
|
|
|
GetGalCanvas()->GetView()->UpdateAllItems( KIGFX::ALL );
|
|
|
|
GetGalCanvas()->Refresh();
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-02-01 21:23:27 +00:00
|
|
|
void DISPLAY_FOOTPRINTS_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2007-10-03 15:21:13 +00:00
|
|
|
|
2010-02-01 21:23:27 +00:00
|
|
|
void DISPLAY_FOOTPRINTS_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2007-10-03 15:21:13 +00:00
|
|
|
|
2011-02-21 21:07:00 +00:00
|
|
|
bool DISPLAY_FOOTPRINTS_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2007-10-27 12:24:09 +00:00
|
|
|
return true;
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2011-02-21 21:07:00 +00:00
|
|
|
|
2016-01-20 12:11:17 +00:00
|
|
|
bool DISPLAY_FOOTPRINTS_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition,
|
|
|
|
EDA_KEY aHotKey )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2014-08-29 20:23:40 +00:00
|
|
|
bool eventHandled = true;
|
|
|
|
|
2014-06-12 16:12:14 +00:00
|
|
|
// Filter out the 'fake' mouse motion after a keyboard movement
|
|
|
|
if( !aHotKey && m_movingCursorWithKeyboard )
|
|
|
|
{
|
|
|
|
m_movingCursorWithKeyboard = false;
|
2014-08-29 20:23:40 +00:00
|
|
|
return false;
|
2014-06-12 16:12:14 +00:00
|
|
|
}
|
2011-02-01 15:46:25 +00:00
|
|
|
|
2009-01-07 15:59:49 +00:00
|
|
|
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
|
|
|
|
cmd.SetEventObject( this );
|
2007-10-03 15:21:13 +00:00
|
|
|
|
2014-06-12 16:12:14 +00:00
|
|
|
wxPoint pos = aPosition;
|
|
|
|
wxPoint oldpos = GetCrossHairPosition();
|
|
|
|
GeneralControlKeyMovement( aHotKey, &pos, true );
|
2007-10-03 15:21:13 +00:00
|
|
|
|
2011-02-22 16:43:03 +00:00
|
|
|
switch( aHotKey )
|
2007-10-03 15:21:13 +00:00
|
|
|
{
|
2009-02-05 20:53:08 +00:00
|
|
|
case WXK_F1:
|
2018-01-12 10:40:55 +00:00
|
|
|
cmd.SetId( ID_KEY_ZOOM_IN );
|
2009-02-05 20:53:08 +00:00
|
|
|
GetEventHandler()->ProcessEvent( cmd );
|
|
|
|
break;
|
2007-10-03 15:21:13 +00:00
|
|
|
|
2009-02-05 20:53:08 +00:00
|
|
|
case WXK_F2:
|
2018-01-12 10:40:55 +00:00
|
|
|
cmd.SetId( ID_KEY_ZOOM_OUT );
|
2009-02-05 20:53:08 +00:00
|
|
|
GetEventHandler()->ProcessEvent( cmd );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WXK_F3:
|
|
|
|
cmd.SetId( ID_ZOOM_REDRAW );
|
|
|
|
GetEventHandler()->ProcessEvent( cmd );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WXK_F4:
|
|
|
|
cmd.SetId( ID_POPUP_ZOOM_CENTER );
|
|
|
|
GetEventHandler()->ProcessEvent( cmd );
|
|
|
|
break;
|
|
|
|
|
2009-09-27 14:09:26 +00:00
|
|
|
case WXK_HOME:
|
|
|
|
cmd.SetId( ID_ZOOM_PAGE );
|
|
|
|
GetEventHandler()->ProcessEvent( cmd );
|
|
|
|
break;
|
|
|
|
|
2009-02-05 20:53:08 +00:00
|
|
|
case ' ':
|
2014-06-12 16:12:14 +00:00
|
|
|
GetScreen()->m_O_Curseur = GetCrossHairPosition();
|
2009-02-05 20:53:08 +00:00
|
|
|
break;
|
2014-08-29 20:23:40 +00:00
|
|
|
|
2015-03-26 19:04:52 +00:00
|
|
|
case GR_KB_ALT + '3':
|
|
|
|
cmd.SetId( ID_CVPCB_SHOW3D_FRAME );
|
|
|
|
GetEventHandler()->ProcessEvent( cmd );
|
|
|
|
break;
|
|
|
|
|
2014-08-29 20:23:40 +00:00
|
|
|
default:
|
|
|
|
eventHandled = false;
|
2007-10-03 15:21:13 +00:00
|
|
|
}
|
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
SetCrossHairPosition( pos );
|
2014-06-12 16:12:14 +00:00
|
|
|
RefreshCrossHair( oldpos, aPosition, aDC );
|
2007-10-03 15:21:13 +00:00
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
UpdateStatusBar(); /* Display new cursor coordinates */
|
2014-08-29 20:23:40 +00:00
|
|
|
|
|
|
|
return eventHandled;
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-10-03 15:21:13 +00:00
|
|
|
|
2010-02-01 21:23:27 +00:00
|
|
|
void DISPLAY_FOOTPRINTS_FRAME::Show3D_Frame( wxCommandEvent& event )
|
2009-02-05 20:53:08 +00:00
|
|
|
{
|
2018-05-10 10:49:20 +00:00
|
|
|
bool forceRecreateIfNotOwner = true;
|
|
|
|
CreateAndShow3D_Frame( forceRecreateIfNotOwner );
|
2009-02-05 20:53:08 +00:00
|
|
|
}
|
2009-07-29 13:10:36 +00:00
|
|
|
|
2011-02-21 21:07:00 +00:00
|
|
|
|
2011-09-30 18:15:37 +00:00
|
|
|
/**
|
|
|
|
* Virtual function needed by the PCB_SCREEN class derived from BASE_SCREEN
|
|
|
|
* this is a virtual pure function in BASE_SCREEN
|
|
|
|
* do nothing in Cvpcb
|
|
|
|
* could be removed later
|
|
|
|
*/
|
2011-02-21 21:07:00 +00:00
|
|
|
void PCB_SCREEN::ClearUndoORRedoList( UNDO_REDO_CONTAINER&, int )
|
2009-07-29 13:10:36 +00:00
|
|
|
{
|
|
|
|
}
|
2010-02-01 21:23:27 +00:00
|
|
|
|
2011-02-21 21:07:00 +00:00
|
|
|
|
2012-09-02 12:06:47 +00:00
|
|
|
bool DISPLAY_FOOTPRINTS_FRAME::IsGridVisible() const
|
2010-02-01 21:23:27 +00:00
|
|
|
{
|
2014-09-26 10:35:11 +00:00
|
|
|
return m_drawGrid;
|
2010-02-01 21:23:27 +00:00
|
|
|
}
|
|
|
|
|
2011-02-21 21:07:00 +00:00
|
|
|
|
2010-02-01 21:23:27 +00:00
|
|
|
void DISPLAY_FOOTPRINTS_FRAME::SetGridVisibility(bool aVisible)
|
|
|
|
{
|
2014-09-26 10:35:11 +00:00
|
|
|
m_drawGrid = aVisible;
|
2010-02-01 21:23:27 +00:00
|
|
|
}
|
|
|
|
|
2011-02-21 21:07:00 +00:00
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
MODULE* DISPLAY_FOOTPRINTS_FRAME::Get_Module( const wxString& aFootprintName )
|
|
|
|
{
|
2013-09-16 23:56:45 +00:00
|
|
|
MODULE* footprint = NULL;
|
2013-04-26 15:11:52 +00:00
|
|
|
|
|
|
|
try
|
|
|
|
{
|
2016-11-20 23:35:08 +00:00
|
|
|
LIB_ID fpid;
|
2013-09-14 20:33:22 +00:00
|
|
|
|
2018-07-26 14:38:30 +00:00
|
|
|
if( fpid.Parse( aFootprintName, LIB_ID::ID_PCB ) >= 0 )
|
2013-09-14 20:33:22 +00:00
|
|
|
{
|
2018-06-13 00:05:25 +00:00
|
|
|
DisplayInfoMessage( this, wxString::Format( _( "Footprint ID \"%s\" is not valid." ),
|
2013-09-14 20:33:22 +00:00
|
|
|
GetChars( aFootprintName ) ) );
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2013-10-13 21:33:58 +00:00
|
|
|
std::string nickname = fpid.GetLibNickname();
|
2016-11-20 23:35:08 +00:00
|
|
|
std::string fpname = fpid.GetLibItemName();
|
2013-09-14 20:33:22 +00:00
|
|
|
|
2017-12-15 11:37:46 +00:00
|
|
|
wxLogDebug( wxT( "Load footprint \"%s\" from library \"%s\"." ),
|
2013-10-13 21:33:58 +00:00
|
|
|
fpname.c_str(), nickname.c_str() );
|
2013-09-14 20:33:22 +00:00
|
|
|
|
2017-03-23 00:59:25 +00:00
|
|
|
footprint = Prj().PcbFootprintLibs( Kiway() )->FootprintLoad(
|
2014-05-09 18:35:48 +00:00
|
|
|
FROM_UTF8( nickname.c_str() ), FROM_UTF8( fpname.c_str() ) );
|
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() );
|
2013-04-26 15:11:52 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2013-09-14 20:33:22 +00:00
|
|
|
if( footprint )
|
|
|
|
{
|
|
|
|
footprint->SetParent( (EDA_ITEM*) GetBoard() );
|
|
|
|
footprint->SetPosition( wxPoint( 0, 0 ) );
|
|
|
|
return footprint;
|
|
|
|
}
|
|
|
|
|
2017-12-15 11:37:46 +00:00
|
|
|
wxString msg = wxString::Format( _( "Footprint \"%s\" not found" ), aFootprintName.GetData() );
|
2013-04-26 15:11:52 +00:00
|
|
|
DisplayError( this, msg );
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void DISPLAY_FOOTPRINTS_FRAME::InitDisplay()
|
|
|
|
{
|
2018-07-01 15:22:33 +00:00
|
|
|
CVPCB_MAINFRAME* parentframe = (CVPCB_MAINFRAME *) GetParent();
|
|
|
|
MODULE* module = nullptr;
|
|
|
|
const FOOTPRINT_INFO* module_info = nullptr;
|
2013-10-31 21:30:57 +00:00
|
|
|
|
2018-07-01 15:22:33 +00:00
|
|
|
if( GetBoard()->m_Modules.GetCount() )
|
|
|
|
GetBoard()->m_Modules.DeleteAll();
|
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
|
|
|
|
2018-07-01 15:22:33 +00:00
|
|
|
if( footprintName.IsEmpty() )
|
2013-04-26 15:11:52 +00:00
|
|
|
{
|
2018-07-01 15:22:33 +00:00
|
|
|
COMPONENT* comp = parentframe->GetSelectedComponent();
|
2013-09-14 20:33:22 +00:00
|
|
|
|
2018-07-01 15:22:33 +00:00
|
|
|
if( comp )
|
|
|
|
footprintName = comp->GetFPID().GetUniStringLibId();
|
|
|
|
}
|
2013-04-26 15:11:52 +00:00
|
|
|
|
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
|
|
|
|
2018-07-01 15:22:33 +00:00
|
|
|
module = Get_Module( footprintName );
|
2013-04-26 15:11:52 +00:00
|
|
|
|
2018-07-01 15:22:33 +00:00
|
|
|
module_info = parentframe->m_FootprintsList->GetModuleInfo( footprintName );
|
|
|
|
}
|
2013-04-26 15:11:52 +00:00
|
|
|
|
2018-07-01 15:22:33 +00:00
|
|
|
if( module )
|
|
|
|
GetBoard()->m_Modules.PushBack( module );
|
2013-04-26 15:11:52 +00:00
|
|
|
|
2018-07-01 15:22:33 +00:00
|
|
|
if( module_info )
|
2018-07-30 13:18:37 +00:00
|
|
|
SetStatusText( wxString::Format( _( "Lib: %s" ), module_info->GetLibNickname() ), 0 );
|
2018-07-01 15:22:33 +00:00
|
|
|
else
|
|
|
|
SetStatusText( wxEmptyString, 0 );
|
2013-04-26 15:11:52 +00:00
|
|
|
|
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
|
|
|
|
2013-04-26 15:11:52 +00:00
|
|
|
GetCanvas()->Refresh();
|
2018-05-10 10:49:20 +00:00
|
|
|
Update3DView();
|
2013-04-26 15:11:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-08-06 18:26:37 +00:00
|
|
|
void DISPLAY_FOOTPRINTS_FRAME::updateView()
|
|
|
|
{
|
2018-09-11 15:28:57 +00:00
|
|
|
PCB_DRAW_PANEL_GAL* dp = static_cast<PCB_DRAW_PANEL_GAL*>( GetGalCanvas() );
|
|
|
|
dp->UseColorScheme( &Settings().Colors() );
|
|
|
|
dp->DisplayBoard( GetBoard() );
|
|
|
|
|
|
|
|
m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD );
|
|
|
|
|
|
|
|
if( m_autoZoom )
|
2018-08-06 18:26:37 +00:00
|
|
|
m_toolManager->RunAction( ACTIONS::zoomFitScreen, true );
|
2018-09-11 15:28:57 +00:00
|
|
|
else
|
|
|
|
m_toolManager->RunAction( ACTIONS::centerContents, true );
|
|
|
|
|
|
|
|
UpdateMsgPanel();
|
2018-08-06 18:26:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void DISPLAY_FOOTPRINTS_FRAME::UpdateMsgPanel()
|
|
|
|
{
|
|
|
|
MODULE* footprint = GetBoard()->m_Modules;
|
|
|
|
MSG_PANEL_ITEMS items;
|
|
|
|
|
|
|
|
if( footprint )
|
|
|
|
footprint->GetMsgPanelInfo( m_UserUnits, items );
|
|
|
|
|
|
|
|
SetMsgPanel( items );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-04-26 15:11:52 +00:00
|
|
|
void DISPLAY_FOOTPRINTS_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
|
|
|
{
|
2018-09-11 15:28:57 +00:00
|
|
|
if( GetBoard() )
|
|
|
|
UpdateMsgPanel();
|
2013-04-26 15:11:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-08-08 19:23:31 +00:00
|
|
|
void DISPLAY_FOOTPRINTS_FRAME::OnUIToolSelection( wxUpdateUIEvent& aEvent )
|
|
|
|
{
|
|
|
|
switch( aEvent.GetId() )
|
|
|
|
{
|
|
|
|
case ID_TB_MEASUREMENT_TOOL:
|
|
|
|
aEvent.Check( GetToolId() == ID_TB_MEASUREMENT_TOOL );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_NO_TOOL_SELECTED:
|
|
|
|
aEvent.Check( GetToolId() == ID_NO_TOOL_SELECTED );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_ZOOM_SELECTION:
|
|
|
|
aEvent.Check( GetToolId() == ID_ZOOM_SELECTION );
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-04-26 15:11:52 +00:00
|
|
|
/*
|
|
|
|
* Redraw the BOARD items but not cursors, axis or grid.
|
|
|
|
*/
|
|
|
|
void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
|
|
|
|
GR_DRAWMODE aDrawMode, const wxPoint& aOffset )
|
|
|
|
{
|
|
|
|
if( m_Modules )
|
|
|
|
{
|
|
|
|
m_Modules->Draw( aPanel, aDC, GR_COPY );
|
|
|
|
}
|
|
|
|
}
|