2011-12-12 14:02:37 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2007 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
|
|
|
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
|
|
|
* Copyright (C) 2007-2011 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 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
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file class_DisplayFootprintsFrame.cpp
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <fctsys.h>
|
|
|
|
#include <appl_wxstruct.h>
|
|
|
|
#include <common.h>
|
|
|
|
#include <class_drawpanel.h>
|
|
|
|
#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>
|
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>
|
2009-02-05 20:53:08 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <cvpcb_mainframe.h>
|
|
|
|
#include <class_DisplayFootprintsFrame.h>
|
|
|
|
#include <cvpcb_id.h>
|
2013-04-26 15:11:52 +00:00
|
|
|
#include <cvstruct.h>
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <3d_viewer.h>
|
2009-05-06 11:55:36 +00:00
|
|
|
|
|
|
|
|
2007-05-06 16:03:28 +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_SIZE( DISPLAY_FOOTPRINTS_FRAME::OnSize )
|
|
|
|
EVT_TOOL( ID_OPTIONS_SETUP, DISPLAY_FOOTPRINTS_FRAME::InstallOptionsDisplay )
|
|
|
|
EVT_TOOL( ID_CVPCB_SHOW3D_FRAME, DISPLAY_FOOTPRINTS_FRAME::Show3D_Frame )
|
2011-02-21 21:07:00 +00:00
|
|
|
EVT_TOOL( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH,
|
|
|
|
DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar)
|
|
|
|
EVT_TOOL( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH,
|
|
|
|
DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar)
|
|
|
|
|
|
|
|
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH,
|
|
|
|
DISPLAY_FOOTPRINTS_FRAME::OnUpdateTextDrawMode )
|
|
|
|
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH,
|
|
|
|
DISPLAY_FOOTPRINTS_FRAME::OnUpdateLineDrawMode )
|
2007-10-03 15:21:13 +00:00
|
|
|
END_EVENT_TABLE()
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2012-09-12 09:53:11 +00:00
|
|
|
#define DISPLAY_FOOTPRINTS_FRAME_NAME wxT( "CmpFrame" )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
|
2012-02-09 20:33:38 +00:00
|
|
|
DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( CVPCB_MAINFRAME* parent,
|
2011-02-21 21:07:00 +00:00
|
|
|
const wxString& title,
|
|
|
|
const wxPoint& pos,
|
|
|
|
const wxSize& size, long style ) :
|
2012-09-12 09:53:11 +00:00
|
|
|
PCB_BASE_FRAME( parent, CVPCB_DISPLAY_FRAME_TYPE, title, pos, size,
|
|
|
|
style, DISPLAY_FOOTPRINTS_FRAME_NAME )
|
2007-10-03 15:21:13 +00:00
|
|
|
{
|
2012-09-12 09:53:11 +00:00
|
|
|
m_FrameName = DISPLAY_FOOTPRINTS_FRAME_NAME;
|
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
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
LoadSettings();
|
2011-02-21 21:07:00 +00:00
|
|
|
|
2010-04-16 16:28:35 +00:00
|
|
|
// Initialize grid id to a default value if not found in config or bad:
|
2009-10-15 11:35:53 +00:00
|
|
|
if( (m_LastGridSizeId <= 0) ||
|
2009-11-07 14:36:54 +00:00
|
|
|
(m_LastGridSizeId > (ID_POPUP_GRID_USER - 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
|
|
|
|
2009-11-07 14:36:54 +00:00
|
|
|
GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
|
2009-09-19 16:15:40 +00:00
|
|
|
|
|
|
|
// Initialize some display options
|
|
|
|
DisplayOpt.DisplayPadIsol = false; // Pad clearance has no meaning here
|
2011-09-24 18:33:28 +00:00
|
|
|
|
|
|
|
// Track and via clearance has no meaning here.
|
|
|
|
DisplayOpt.ShowTrackClearanceMode = 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
|
|
|
|
|
|
|
m_auimgr.SetManagedWindow( this );
|
|
|
|
|
2011-09-15 18:25:44 +00:00
|
|
|
EDA_PANEINFO horiz;
|
|
|
|
horiz.HorizontalToolbarPane();
|
|
|
|
|
|
|
|
EDA_PANEINFO vert;
|
|
|
|
vert.VerticalToolbarPane();
|
|
|
|
|
|
|
|
EDA_PANEINFO mesg;
|
|
|
|
mesg.MessageToolbarPane();
|
|
|
|
|
2009-11-07 14:36:54 +00:00
|
|
|
|
|
|
|
|
2011-12-16 13:32:23 +00:00
|
|
|
m_auimgr.AddPane( m_mainToolBar,
|
|
|
|
wxAuiPaneInfo( horiz ).Name( wxT( "m_mainToolBar" ) ).Top(). Row( 0 ) );
|
2009-11-07 14:36:54 +00:00
|
|
|
|
2011-12-14 20:03:15 +00:00
|
|
|
if( m_drawToolBar ) // Currently, no vertical right toolbar.
|
|
|
|
m_auimgr.AddPane( m_drawToolBar,
|
|
|
|
wxAuiPaneInfo( vert ).Name( wxT( "m_drawToolBar" ) ).Right() );
|
2009-11-07 14:36:54 +00:00
|
|
|
|
2011-12-22 13:28:11 +00:00
|
|
|
m_auimgr.AddPane( m_canvas,
|
2011-08-04 11:23:19 +00:00
|
|
|
wxAuiPaneInfo().Name( wxT( "DisplayFrame" ) ).CentrePane() );
|
2009-11-07 14:36:54 +00:00
|
|
|
|
2011-12-12 14:02:37 +00:00
|
|
|
m_auimgr.AddPane( m_messagePanel,
|
2011-09-15 18:25:44 +00:00
|
|
|
wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().Layer(10) );
|
2009-11-07 14:36:54 +00:00
|
|
|
|
2011-12-14 20:03:15 +00:00
|
|
|
m_auimgr.AddPane( m_optionsToolBar,
|
|
|
|
wxAuiPaneInfo( vert ).Name( wxT( "m_optionsToolBar" ) ).Left() );
|
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
|
|
|
|
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
|
|
|
{
|
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-10-27 12:24:09 +00:00
|
|
|
|
2011-08-04 11:23:19 +00:00
|
|
|
( (CVPCB_MAINFRAME*) wxGetApp().GetTopWindow() )->m_DisplayFootprintFrame = NULL;
|
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
|
|
|
{
|
2011-08-04 11:23:19 +00:00
|
|
|
if( m_Draw3DFrame )
|
2011-12-12 14:02:37 +00:00
|
|
|
m_Draw3DFrame->Close( true );
|
|
|
|
|
2007-10-03 15:21:13 +00:00
|
|
|
SaveSettings();
|
|
|
|
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,
|
|
|
|
wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_VERTICAL );
|
2010-04-16 16:28:35 +00:00
|
|
|
|
2011-12-14 20:03:15 +00:00
|
|
|
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString, KiBitmap( grid_xpm ),
|
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,
|
2011-08-28 20:02:27 +00:00
|
|
|
KiBitmap( polar_coord_xpm ),
|
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,
|
2011-08-28 20:02:27 +00:00
|
|
|
KiBitmap( unit_inch_xpm ),
|
2010-04-16 16:28:35 +00:00
|
|
|
_( "Units in inches" ), wxITEM_CHECK );
|
|
|
|
|
2011-12-14 20:03:15 +00:00
|
|
|
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_MM, wxEmptyString,
|
2011-08-28 20:02:27 +00:00
|
|
|
KiBitmap( unit_mm_xpm ),
|
2010-04-16 16:28:35 +00:00
|
|
|
_( "Units in millimeters" ), wxITEM_CHECK );
|
|
|
|
|
2011-12-14 20:03:15 +00:00
|
|
|
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_CURSOR, wxEmptyString,
|
2011-08-28 20:02:27 +00:00
|
|
|
KiBitmap( cursor_shape_xpm ),
|
2011-02-21 21:07:00 +00:00
|
|
|
_( "Change cursor shape" ), wxITEM_CHECK );
|
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,
|
2011-08-28 20:02:27 +00:00
|
|
|
KiBitmap( pad_sketch_xpm ),
|
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,
|
2011-08-28 20:02:27 +00:00
|
|
|
KiBitmap( text_sketch_xpm ),
|
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,
|
2011-08-28 20:02:27 +00:00
|
|
|
KiBitmap( show_mod_edge_xpm ),
|
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,
|
|
|
|
wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_HORZ_LAYOUT );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2011-12-16 13:32:23 +00:00
|
|
|
m_mainToolBar->AddTool( ID_OPTIONS_SETUP, wxEmptyString, KiBitmap( display_options_xpm ),
|
|
|
|
_( "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
|
|
|
|
2011-12-16 13:32:23 +00:00
|
|
|
m_mainToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, KiBitmap( zoom_in_xpm ),
|
|
|
|
_( "Zoom in (F1)" ) );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2011-12-16 13:32:23 +00:00
|
|
|
m_mainToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, KiBitmap( zoom_out_xpm ),
|
|
|
|
_( "Zoom out (F2)" ) );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2011-12-16 13:32:23 +00:00
|
|
|
m_mainToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, KiBitmap( zoom_redraw_xpm ),
|
|
|
|
_( "Redraw view (F3)" ) );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2011-12-16 13:32:23 +00:00
|
|
|
m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, KiBitmap( zoom_fit_in_page_xpm ),
|
|
|
|
_( "Zoom auto (Home)" ) );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2011-12-16 13:32:23 +00:00
|
|
|
m_mainToolBar->AddSeparator();
|
|
|
|
m_mainToolBar->AddTool( ID_CVPCB_SHOW3D_FRAME, wxEmptyString, KiBitmap( three_d_xpm ),
|
|
|
|
_( "3D Display" ) );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-02-21 21:07:00 +00:00
|
|
|
void DISPLAY_FOOTPRINTS_FRAME::OnUpdateTextDrawMode( wxUpdateUIEvent& aEvent )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2011-02-21 21:07:00 +00:00
|
|
|
wxString msgTextsFill[3] = { _( "Show texts in line mode" ),
|
|
|
|
_( "Show texts in filled mode" ),
|
|
|
|
_( "Show texts in sketch mode" ) };
|
|
|
|
|
|
|
|
unsigned i = m_DisplayModText + 1;
|
|
|
|
|
|
|
|
if ( i > 2 )
|
|
|
|
i = 0;
|
|
|
|
|
|
|
|
aEvent.Check( m_DisplayModText == 0 );
|
2011-12-14 20:03:15 +00:00
|
|
|
m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, msgTextsFill[i] );
|
2011-02-21 21:07:00 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void DISPLAY_FOOTPRINTS_FRAME::OnUpdateLineDrawMode( wxUpdateUIEvent& aEvent )
|
|
|
|
{
|
|
|
|
wxString msgEdgesFill[3] = { _( "Show outlines in line mode" ),
|
|
|
|
_( "Show outlines in filled mode" ),
|
|
|
|
_( "Show outlines in sketch mode" ) };
|
|
|
|
|
|
|
|
int i = m_DisplayModEdge + 1;
|
|
|
|
|
|
|
|
if ( i > 2 )
|
|
|
|
i = 0;
|
|
|
|
|
|
|
|
aEvent.Check( m_DisplayModEdge == 0 );
|
2011-12-14 20:03:15 +00:00
|
|
|
m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, msgEdgesFill[i] );
|
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
|
|
|
|
2010-04-16 16:28:35 +00:00
|
|
|
void DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
int id = event.GetId();
|
|
|
|
|
|
|
|
switch( id )
|
|
|
|
{
|
|
|
|
case ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH:
|
|
|
|
m_DisplayModText++;
|
2011-02-21 21:07:00 +00:00
|
|
|
|
2010-04-16 16:28:35 +00:00
|
|
|
if( m_DisplayModText > 2 )
|
|
|
|
m_DisplayModText = 0;
|
2011-02-21 21:07:00 +00:00
|
|
|
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->Refresh( );
|
2010-04-16 16:28:35 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH:
|
|
|
|
m_DisplayModEdge++;
|
2011-02-21 21:07:00 +00:00
|
|
|
|
2010-04-16 16:28:35 +00:00
|
|
|
if( m_DisplayModEdge > 2 )
|
|
|
|
m_DisplayModEdge = 0;
|
2011-02-21 21:07:00 +00:00
|
|
|
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->Refresh();
|
2010-04-16 16:28:35 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
DisplayError( this,
|
|
|
|
wxT( "DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar error" ) );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2011-02-21 21:07:00 +00:00
|
|
|
|
2011-02-22 16:43:03 +00:00
|
|
|
void DISPLAY_FOOTPRINTS_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2011-02-01 15:46:25 +00:00
|
|
|
wxRealPoint gridSize;
|
|
|
|
wxPoint oldpos;
|
2011-02-21 21:07:00 +00:00
|
|
|
PCB_SCREEN* screen = GetScreen();
|
2011-02-01 15:46:25 +00:00
|
|
|
wxPoint pos = aPosition;
|
|
|
|
|
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
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
pos = GetNearestGridPosition( pos );
|
|
|
|
oldpos = GetCrossHairPosition();
|
2011-02-21 21:07:00 +00:00
|
|
|
gridSize = screen->GetGridSize();
|
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:
|
|
|
|
cmd.SetId( ID_POPUP_ZOOM_IN );
|
|
|
|
GetEventHandler()->ProcessEvent( cmd );
|
|
|
|
break;
|
2007-10-03 15:21:13 +00:00
|
|
|
|
2009-02-05 20:53:08 +00:00
|
|
|
case WXK_F2:
|
|
|
|
cmd.SetId( ID_POPUP_ZOOM_OUT );
|
|
|
|
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 ' ':
|
2013-08-03 05:15:23 +00:00
|
|
|
screen->m_O_Curseur = GetCrossHairPosition();
|
2009-02-05 20:53:08 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WXK_NUMPAD8: /* cursor moved up */
|
|
|
|
case WXK_UP:
|
// Dick Hollenbeck's KiROUND R&D
// This provides better project control over rounding to int from double
// than wxRound() did. This scheme provides better logging in Debug builds
// and it provides for compile time calculation of constants.
#include <stdio.h>
#include <assert.h>
#include <limits.h>
//-----<KiROUND KIT>------------------------------------------------------------
/**
* KiROUND
* rounds a floating point number to an int using
* "round halfway cases away from zero".
* In Debug build an assert fires if will not fit into an int.
*/
#if defined( DEBUG )
// DEBUG: a macro to capture line and file, then calls this inline
static inline int KiRound( double v, int line, const char* filename )
{
v = v < 0 ? v - 0.5 : v + 0.5;
if( v > INT_MAX + 0.5 )
{
printf( "%s: in file %s on line %d, val: %.16g too ' > 0 ' for int\n", __FUNCTION__, filename, line, v );
}
else if( v < INT_MIN - 0.5 )
{
printf( "%s: in file %s on line %d, val: %.16g too ' < 0 ' for int\n", __FUNCTION__, filename, line, v );
}
return int( v );
}
#define KiROUND( v ) KiRound( v, __LINE__, __FILE__ )
#else
// RELEASE: a macro so compile can pre-compute constants.
#define KiROUND( v ) int( (v) < 0 ? (v) - 0.5 : (v) + 0.5 )
#endif
//-----</KiROUND KIT>-----------------------------------------------------------
// Only a macro is compile time calculated, an inline function causes a static constructor
// in a situation like this.
// Therefore the Release build is best done with a MACRO not an inline function.
int Computed = KiROUND( 14.3 * 8 );
int main( int argc, char** argv )
{
for( double d = double(INT_MAX)-1; d < double(INT_MAX)+8; d += 2.0 )
{
int i = KiROUND( d );
printf( "t: %d %.16g\n", i, d );
}
return 0;
}
2012-04-19 06:55:45 +00:00
|
|
|
pos.y -= KiROUND( gridSize.y );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursor( pos );
|
2009-02-05 20:53:08 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WXK_NUMPAD2: /* cursor moved down */
|
|
|
|
case WXK_DOWN:
|
// Dick Hollenbeck's KiROUND R&D
// This provides better project control over rounding to int from double
// than wxRound() did. This scheme provides better logging in Debug builds
// and it provides for compile time calculation of constants.
#include <stdio.h>
#include <assert.h>
#include <limits.h>
//-----<KiROUND KIT>------------------------------------------------------------
/**
* KiROUND
* rounds a floating point number to an int using
* "round halfway cases away from zero".
* In Debug build an assert fires if will not fit into an int.
*/
#if defined( DEBUG )
// DEBUG: a macro to capture line and file, then calls this inline
static inline int KiRound( double v, int line, const char* filename )
{
v = v < 0 ? v - 0.5 : v + 0.5;
if( v > INT_MAX + 0.5 )
{
printf( "%s: in file %s on line %d, val: %.16g too ' > 0 ' for int\n", __FUNCTION__, filename, line, v );
}
else if( v < INT_MIN - 0.5 )
{
printf( "%s: in file %s on line %d, val: %.16g too ' < 0 ' for int\n", __FUNCTION__, filename, line, v );
}
return int( v );
}
#define KiROUND( v ) KiRound( v, __LINE__, __FILE__ )
#else
// RELEASE: a macro so compile can pre-compute constants.
#define KiROUND( v ) int( (v) < 0 ? (v) - 0.5 : (v) + 0.5 )
#endif
//-----</KiROUND KIT>-----------------------------------------------------------
// Only a macro is compile time calculated, an inline function causes a static constructor
// in a situation like this.
// Therefore the Release build is best done with a MACRO not an inline function.
int Computed = KiROUND( 14.3 * 8 );
int main( int argc, char** argv )
{
for( double d = double(INT_MAX)-1; d < double(INT_MAX)+8; d += 2.0 )
{
int i = KiROUND( d );
printf( "t: %d %.16g\n", i, d );
}
return 0;
}
2012-04-19 06:55:45 +00:00
|
|
|
pos.y += KiROUND( gridSize.y );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursor( pos );
|
2009-02-05 20:53:08 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WXK_NUMPAD4: /* cursor moved left */
|
|
|
|
case WXK_LEFT:
|
// Dick Hollenbeck's KiROUND R&D
// This provides better project control over rounding to int from double
// than wxRound() did. This scheme provides better logging in Debug builds
// and it provides for compile time calculation of constants.
#include <stdio.h>
#include <assert.h>
#include <limits.h>
//-----<KiROUND KIT>------------------------------------------------------------
/**
* KiROUND
* rounds a floating point number to an int using
* "round halfway cases away from zero".
* In Debug build an assert fires if will not fit into an int.
*/
#if defined( DEBUG )
// DEBUG: a macro to capture line and file, then calls this inline
static inline int KiRound( double v, int line, const char* filename )
{
v = v < 0 ? v - 0.5 : v + 0.5;
if( v > INT_MAX + 0.5 )
{
printf( "%s: in file %s on line %d, val: %.16g too ' > 0 ' for int\n", __FUNCTION__, filename, line, v );
}
else if( v < INT_MIN - 0.5 )
{
printf( "%s: in file %s on line %d, val: %.16g too ' < 0 ' for int\n", __FUNCTION__, filename, line, v );
}
return int( v );
}
#define KiROUND( v ) KiRound( v, __LINE__, __FILE__ )
#else
// RELEASE: a macro so compile can pre-compute constants.
#define KiROUND( v ) int( (v) < 0 ? (v) - 0.5 : (v) + 0.5 )
#endif
//-----</KiROUND KIT>-----------------------------------------------------------
// Only a macro is compile time calculated, an inline function causes a static constructor
// in a situation like this.
// Therefore the Release build is best done with a MACRO not an inline function.
int Computed = KiROUND( 14.3 * 8 );
int main( int argc, char** argv )
{
for( double d = double(INT_MAX)-1; d < double(INT_MAX)+8; d += 2.0 )
{
int i = KiROUND( d );
printf( "t: %d %.16g\n", i, d );
}
return 0;
}
2012-04-19 06:55:45 +00:00
|
|
|
pos.x -= KiROUND( gridSize.x );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursor( pos );
|
2009-02-05 20:53:08 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WXK_NUMPAD6: /* cursor moved right */
|
|
|
|
case WXK_RIGHT:
|
// Dick Hollenbeck's KiROUND R&D
// This provides better project control over rounding to int from double
// than wxRound() did. This scheme provides better logging in Debug builds
// and it provides for compile time calculation of constants.
#include <stdio.h>
#include <assert.h>
#include <limits.h>
//-----<KiROUND KIT>------------------------------------------------------------
/**
* KiROUND
* rounds a floating point number to an int using
* "round halfway cases away from zero".
* In Debug build an assert fires if will not fit into an int.
*/
#if defined( DEBUG )
// DEBUG: a macro to capture line and file, then calls this inline
static inline int KiRound( double v, int line, const char* filename )
{
v = v < 0 ? v - 0.5 : v + 0.5;
if( v > INT_MAX + 0.5 )
{
printf( "%s: in file %s on line %d, val: %.16g too ' > 0 ' for int\n", __FUNCTION__, filename, line, v );
}
else if( v < INT_MIN - 0.5 )
{
printf( "%s: in file %s on line %d, val: %.16g too ' < 0 ' for int\n", __FUNCTION__, filename, line, v );
}
return int( v );
}
#define KiROUND( v ) KiRound( v, __LINE__, __FILE__ )
#else
// RELEASE: a macro so compile can pre-compute constants.
#define KiROUND( v ) int( (v) < 0 ? (v) - 0.5 : (v) + 0.5 )
#endif
//-----</KiROUND KIT>-----------------------------------------------------------
// Only a macro is compile time calculated, an inline function causes a static constructor
// in a situation like this.
// Therefore the Release build is best done with a MACRO not an inline function.
int Computed = KiROUND( 14.3 * 8 );
int main( int argc, char** argv )
{
for( double d = double(INT_MAX)-1; d < double(INT_MAX)+8; d += 2.0 )
{
int i = KiROUND( d );
printf( "t: %d %.16g\n", i, d );
}
return 0;
}
2012-04-19 06:55:45 +00:00
|
|
|
pos.x += KiROUND( gridSize.x );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursor( pos );
|
2009-02-05 20:53:08 +00:00
|
|
|
break;
|
2007-10-03 15:21:13 +00:00
|
|
|
}
|
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
SetCrossHairPosition( pos );
|
2007-10-03 15:21:13 +00:00
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
if( oldpos != GetCrossHairPosition() )
|
2007-10-03 15:21:13 +00:00
|
|
|
{
|
2013-08-03 05:15:23 +00:00
|
|
|
pos = GetCrossHairPosition();
|
|
|
|
SetCrossHairPosition( oldpos );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->CrossHairOff( aDC );
|
2013-08-03 05:15:23 +00:00
|
|
|
SetCrossHairPosition( pos );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->CrossHairOn( aDC );
|
2007-10-03 15:21:13 +00:00
|
|
|
|
2011-12-22 13:28:11 +00:00
|
|
|
if( m_canvas->IsMouseCaptured() )
|
2007-10-03 15:21:13 +00:00
|
|
|
{
|
2011-12-29 20:11:42 +00:00
|
|
|
m_canvas->CallMouseCapture( aDC, aPosition, 0 );
|
2007-10-03 15:21:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
UpdateStatusBar(); /* Display new cursor coordinates */
|
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
|
|
|
{
|
|
|
|
if( m_Draw3DFrame )
|
|
|
|
{
|
2011-08-04 11:23:19 +00:00
|
|
|
// Raising the window does not show the window on Windows if iconized.
|
|
|
|
// This should work on any platform.
|
|
|
|
if( m_Draw3DFrame->IsIconized() )
|
|
|
|
m_Draw3DFrame->Iconize( false );
|
2011-12-12 14:02:37 +00:00
|
|
|
|
2011-08-03 15:09:39 +00:00
|
|
|
m_Draw3DFrame->Raise();
|
|
|
|
|
|
|
|
// Raising the window does not set the focus on Linux. This should work on any platform.
|
|
|
|
if( wxWindow::FindFocus() != m_Draw3DFrame )
|
|
|
|
m_Draw3DFrame->SetFocus();
|
|
|
|
|
2009-02-05 20:53:08 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-08-03 15:09:39 +00:00
|
|
|
m_Draw3DFrame = new EDA_3D_FRAME( this, _( "3D Viewer" ), KICAD_DEFAULT_3D_DRAWFRAME_STYLE );
|
2011-02-21 21:07:00 +00:00
|
|
|
m_Draw3DFrame->Show( true );
|
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
|
|
|
{
|
2010-04-16 16:28:35 +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)
|
|
|
|
{
|
2010-04-16 16:28:35 +00:00
|
|
|
m_DrawGrid = aVisible;
|
2010-02-01 21:23:27 +00:00
|
|
|
}
|
|
|
|
|
2011-02-21 21:07:00 +00:00
|
|
|
|
2012-09-02 12:06:47 +00:00
|
|
|
EDA_COLOR_T DISPLAY_FOOTPRINTS_FRAME::GetGridColor() const
|
2010-02-01 21:23:27 +00:00
|
|
|
{
|
|
|
|
return DARKGRAY;
|
|
|
|
}
|
2013-04-26 15:11:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
MODULE* DISPLAY_FOOTPRINTS_FRAME::Get_Module( const wxString& aFootprintName )
|
|
|
|
{
|
|
|
|
CVPCB_MAINFRAME* parent = ( CVPCB_MAINFRAME* ) GetParent();
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
PLUGIN::RELEASER pi( IO_MGR::PluginFind( IO_MGR::LEGACY ) );
|
|
|
|
|
|
|
|
for( unsigned i = 0; i < parent->m_ModuleLibNames.GetCount(); ++i )
|
|
|
|
{
|
2013-05-06 17:57:18 +00:00
|
|
|
wxFileName fn( wxEmptyString, parent->m_ModuleLibNames[i],
|
|
|
|
LegacyFootprintLibPathExtension );
|
2013-04-26 15:11:52 +00:00
|
|
|
|
|
|
|
wxString libPath = wxGetApp().FindLibraryPath( fn );
|
|
|
|
|
|
|
|
if( !libPath )
|
|
|
|
{
|
|
|
|
wxString msg = wxString::Format( _( "PCB footprint library file <%s> could not "
|
|
|
|
"be found in the default search paths." ),
|
|
|
|
fn.GetFullName().GetData() );
|
|
|
|
|
|
|
|
// @todo we should not be using wxMessageBox directly.
|
|
|
|
wxMessageBox( msg, titleLibLoadError, wxOK | wxICON_ERROR, this );
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
MODULE* footprint = pi->FootprintLoad( libPath, aFootprintName );
|
|
|
|
|
|
|
|
if( footprint )
|
|
|
|
{
|
|
|
|
footprint->SetParent( (EDA_ITEM*) GetBoard() );
|
|
|
|
footprint->SetPosition( wxPoint( 0, 0 ) );
|
|
|
|
return footprint;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch( IO_ERROR ioe )
|
|
|
|
{
|
|
|
|
DisplayError( this, ioe.errorText );
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
wxString msg = wxString::Format( _( "Footprint '%s' not found" ), aFootprintName.GetData() );
|
|
|
|
DisplayError( this, msg );
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void DISPLAY_FOOTPRINTS_FRAME::InitDisplay()
|
|
|
|
{
|
|
|
|
wxString msg;
|
|
|
|
CVPCB_MAINFRAME * parentframe = (CVPCB_MAINFRAME *) GetParent();
|
|
|
|
wxString footprintName = parentframe->m_FootprintList->GetSelectedFootprint();
|
|
|
|
|
|
|
|
if( !footprintName.IsEmpty() )
|
|
|
|
{
|
|
|
|
msg.Printf( _( "Footprint: %s" ), GetChars( footprintName ) );
|
|
|
|
SetTitle( msg );
|
|
|
|
FOOTPRINT_INFO* module_info = parentframe->m_footprints.GetModuleInfo( footprintName );
|
|
|
|
|
|
|
|
const wxChar *libname;
|
|
|
|
if( module_info )
|
2013-05-08 20:47:23 +00:00
|
|
|
libname = GetChars( module_info->GetLibraryPath() );
|
2013-04-26 15:11:52 +00:00
|
|
|
else
|
|
|
|
libname = GetChars( wxT( "???" ) );
|
2013-05-08 20:47:23 +00:00
|
|
|
|
2013-04-26 15:11:52 +00:00
|
|
|
msg.Printf( _( "Lib: %s" ), libname );
|
|
|
|
|
|
|
|
SetStatusText( msg, 0 );
|
|
|
|
|
|
|
|
if( GetBoard()->m_Modules.GetCount() )
|
|
|
|
{
|
|
|
|
// there is only one module in the list
|
|
|
|
GetBoard()->m_Modules.DeleteAll();
|
|
|
|
}
|
|
|
|
|
|
|
|
MODULE* module = Get_Module( footprintName );
|
|
|
|
|
|
|
|
if( module )
|
|
|
|
GetBoard()->m_Modules.PushBack( module );
|
|
|
|
|
|
|
|
Zoom_Automatique( false );
|
|
|
|
|
|
|
|
}
|
|
|
|
else // No footprint to display. Erase old footprint, if any
|
|
|
|
{
|
|
|
|
if( GetBoard()->m_Modules.GetCount() )
|
|
|
|
{
|
|
|
|
GetBoard()->m_Modules.DeleteAll();
|
|
|
|
Zoom_Automatique( false );
|
|
|
|
SetStatusText( wxEmptyString, 0 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Display new cursor coordinates and zoom value:
|
|
|
|
UpdateStatusBar();
|
|
|
|
|
|
|
|
GetCanvas()->Refresh();
|
|
|
|
|
|
|
|
if( m_Draw3DFrame )
|
|
|
|
m_Draw3DFrame->NewDisplay();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void DISPLAY_FOOTPRINTS_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
|
|
|
{
|
|
|
|
if( !GetBoard() )
|
|
|
|
return;
|
|
|
|
|
|
|
|
m_canvas->DrawBackGround( DC );
|
|
|
|
GetBoard()->Draw( m_canvas, DC, GR_COPY );
|
|
|
|
|
|
|
|
MODULE* Module = GetBoard()->m_Modules;
|
|
|
|
|
|
|
|
if ( Module )
|
|
|
|
{
|
|
|
|
MSG_PANEL_ITEMS items;
|
|
|
|
Module->GetMsgPanelInfo( items );
|
|
|
|
SetMsgPanel( items );
|
|
|
|
}
|
|
|
|
|
|
|
|
m_canvas->DrawCrossHair( DC );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 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 );
|
|
|
|
}
|
|
|
|
}
|