2009-11-05 19:26:52 +00:00
|
|
|
/**********************/
|
|
|
|
/** displayframe.cpp **/
|
|
|
|
/**********************/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
#include "fctsys.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "appl_wxstruct.h"
|
2007-05-06 16:03:28 +00:00
|
|
|
#include "common.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "class_drawpanel.h"
|
2009-02-05 20:53:08 +00:00
|
|
|
#include "confirm.h"
|
2009-04-05 20:49:15 +00:00
|
|
|
#include "macros.h"
|
2011-09-23 13:57:12 +00:00
|
|
|
#include "bitmaps.h"
|
|
|
|
|
|
|
|
#include "class_board.h"
|
2009-02-05 20:53:08 +00:00
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
#include "cvpcb.h"
|
2011-02-05 16:15:48 +00:00
|
|
|
#include "cvpcb_mainframe.h"
|
2010-02-01 21:23:27 +00:00
|
|
|
#include "class_DisplayFootprintsFrame.h"
|
2010-11-07 20:06:07 +00:00
|
|
|
#include "cvpcb_id.h"
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2009-05-06 11:55:36 +00:00
|
|
|
/*
|
|
|
|
* NOTE: There is something in 3d_viewer.h that causes a compiler error in
|
|
|
|
* <boost/foreach.hpp> in Linux so move it after cvpcb.h where it is
|
2009-11-05 19:26:52 +00:00
|
|
|
* included to prevent the error from occurring.
|
2009-05-06 11:55:36 +00:00
|
|
|
*/
|
|
|
|
#include "3d_viewer.h"
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
2007-10-27 12:24:09 +00:00
|
|
|
/***************************************************************************/
|
2010-02-01 21:23:27 +00:00
|
|
|
/* DISPLAY_FOOTPRINTS_FRAME: the frame to display the current focused footprint */
|
2007-10-27 12:24:09 +00:00
|
|
|
/***************************************************************************/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2011-02-05 16:15:48 +00:00
|
|
|
DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( CVPCB_MAINFRAME* father,
|
2011-02-21 21:07:00 +00:00
|
|
|
const wxString& title,
|
|
|
|
const wxPoint& pos,
|
|
|
|
const wxSize& size, long style ) :
|
2011-03-01 19:26:17 +00:00
|
|
|
PCB_BASE_FRAME( father, CVPCB_DISPLAY_FRAME, title, pos, size, style )
|
2007-10-03 15:21:13 +00:00
|
|
|
{
|
2009-04-05 20:49:15 +00:00
|
|
|
m_FrameName = wxT( "CmpFrame" );
|
2011-02-21 21:07:00 +00:00
|
|
|
m_Draw_Axis = 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
|
|
|
|
2011-09-14 15:08:44 +00:00
|
|
|
SetBoard( new BOARD( NULL, this ) );
|
2011-02-05 02:21:11 +00:00
|
|
|
SetScreen( new PCB_SCREEN() );
|
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;
|
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
|
|
|
|
|
|
|
|
|
|
|
m_auimgr.AddPane( m_HToolBar,
|
2011-02-21 21:07:00 +00:00
|
|
|
wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top(). Row( 0 ) );
|
2009-11-07 14:36:54 +00:00
|
|
|
|
|
|
|
if( m_VToolBar ) // Currently, no vertical right toolbar.
|
|
|
|
m_auimgr.AddPane( m_VToolBar,
|
2011-02-21 21:07:00 +00:00
|
|
|
wxAuiPaneInfo( vert ).Name( wxT( "m_VToolBar" ) ).Right() );
|
2009-11-07 14:36:54 +00:00
|
|
|
|
|
|
|
m_auimgr.AddPane( DrawPanel,
|
2011-08-04 11:23:19 +00:00
|
|
|
wxAuiPaneInfo().Name( wxT( "DisplayFrame" ) ).CentrePane() );
|
2009-11-07 14:36:54 +00:00
|
|
|
|
|
|
|
m_auimgr.AddPane( MsgPanel,
|
2011-09-15 18:25:44 +00:00
|
|
|
wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().Layer(10) );
|
2009-11-07 14:36:54 +00:00
|
|
|
|
2010-04-16 16:28:35 +00:00
|
|
|
m_auimgr.AddPane( m_OptionsToolBar,
|
|
|
|
wxAuiPaneInfo( vert ).Name( wxT( "m_OptionsToolBar" ) ).Left() );
|
|
|
|
|
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
|
|
|
{
|
2009-08-19 06:10:47 +00:00
|
|
|
delete GetBoard();
|
2011-02-05 02:21:11 +00:00
|
|
|
delete GetScreen();
|
|
|
|
SetScreen( NULL );
|
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
|
|
|
}
|
|
|
|
|
2007-10-27 12:24:09 +00:00
|
|
|
/* Called when the frame is closed
|
|
|
|
* Save current settings (frame position and size
|
2007-10-03 15:21:13 +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 )
|
|
|
|
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()
|
|
|
|
{
|
|
|
|
if( m_OptionsToolBar )
|
|
|
|
return;
|
|
|
|
|
|
|
|
// Create options tool bar.
|
2011-04-13 19:30:27 +00:00
|
|
|
m_OptionsToolBar = new EDA_TOOLBAR( TOOLBAR_OPTION, this, ID_OPT_TOOLBAR, false );
|
2010-04-16 16:28:35 +00:00
|
|
|
|
2011-08-28 20:02:27 +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 );
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
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 );
|
|
|
|
|
|
|
|
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 );
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
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-02-21 21:07:00 +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-02-21 21:07:00 +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
|
|
|
|
|
|
|
m_OptionsToolBar->Realize();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-02-01 21:23:27 +00:00
|
|
|
void DISPLAY_FOOTPRINTS_FRAME::ReCreateHToolbar()
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2007-10-03 15:21:13 +00:00
|
|
|
if( m_HToolBar != NULL )
|
|
|
|
return;
|
|
|
|
|
2011-04-13 19:30:27 +00:00
|
|
|
m_HToolBar = new EDA_TOOLBAR( TOOLBAR_MAIN, this, ID_H_TOOLBAR, true );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2011-08-28 20:02:27 +00:00
|
|
|
m_HToolBar->AddTool( ID_OPTIONS_SETUP, wxEmptyString, KiBitmap( display_options_xpm ),
|
2011-02-21 21:07:00 +00:00
|
|
|
_( "Display options" ) );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2007-10-03 15:21:13 +00:00
|
|
|
m_HToolBar->AddSeparator();
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2011-08-28 20:02:27 +00:00
|
|
|
m_HToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, KiBitmap( zoom_in_xpm ),
|
2009-09-27 14:09:26 +00:00
|
|
|
_( "Zoom in (F1)" ) );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2011-08-28 20:02:27 +00:00
|
|
|
m_HToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, KiBitmap( zoom_out_xpm ),
|
2009-09-27 14:09:26 +00:00
|
|
|
_( "Zoom out (F2)" ) );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2011-08-28 20:02:27 +00:00
|
|
|
m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, KiBitmap( zoom_redraw_xpm ),
|
2009-09-27 14:09:26 +00:00
|
|
|
_( "Redraw view (F3)" ) );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2011-08-28 20:02:27 +00:00
|
|
|
m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, KiBitmap( zoom_fit_in_page_xpm ),
|
2009-09-27 14:09:26 +00:00
|
|
|
_( "Zoom auto (Home)" ) );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2007-10-03 15:21:13 +00:00
|
|
|
m_HToolBar->AddSeparator();
|
2011-08-28 20:51:45 +00:00
|
|
|
m_HToolBar->AddTool( ID_CVPCB_SHOW3D_FRAME, wxEmptyString, KiBitmap( three_d_xpm ),
|
2009-09-27 14:09:26 +00:00
|
|
|
_( "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
|
|
|
|
m_HToolBar->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 );
|
|
|
|
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, msgTextsFill[i] );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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 );
|
|
|
|
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
|
|
|
|
2010-04-16 16:28:35 +00:00
|
|
|
DrawPanel->Refresh( );
|
|
|
|
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
|
|
|
|
|
|
|
DrawPanel->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
|
|
|
|
2011-02-21 21:07:00 +00:00
|
|
|
pos = screen->GetNearestGridPosition( pos );
|
|
|
|
oldpos = screen->GetCrossHairPosition();
|
|
|
|
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 ' ':
|
2011-02-21 21:07:00 +00:00
|
|
|
screen->m_O_Curseur = screen->GetCrossHairPosition();
|
2009-02-05 20:53:08 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WXK_NUMPAD8: /* cursor moved up */
|
|
|
|
case WXK_UP:
|
2011-02-01 15:46:25 +00:00
|
|
|
pos.y -= wxRound( gridSize.y );
|
|
|
|
DrawPanel->MoveCursor( pos );
|
2009-02-05 20:53:08 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WXK_NUMPAD2: /* cursor moved down */
|
|
|
|
case WXK_DOWN:
|
2011-02-01 15:46:25 +00:00
|
|
|
pos.y += wxRound( gridSize.y );
|
|
|
|
DrawPanel->MoveCursor( pos );
|
2009-02-05 20:53:08 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WXK_NUMPAD4: /* cursor moved left */
|
|
|
|
case WXK_LEFT:
|
2011-02-01 15:46:25 +00:00
|
|
|
pos.x -= wxRound( gridSize.x );
|
|
|
|
DrawPanel->MoveCursor( pos );
|
2009-02-05 20:53:08 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WXK_NUMPAD6: /* cursor moved right */
|
|
|
|
case WXK_RIGHT:
|
2011-02-01 15:46:25 +00:00
|
|
|
pos.x += wxRound( gridSize.x );
|
|
|
|
DrawPanel->MoveCursor( pos );
|
2009-02-05 20:53:08 +00:00
|
|
|
break;
|
2007-10-03 15:21:13 +00:00
|
|
|
}
|
|
|
|
|
2011-02-21 21:07:00 +00:00
|
|
|
screen->SetCrossHairPosition( pos );
|
2007-10-03 15:21:13 +00:00
|
|
|
|
2011-02-21 21:07:00 +00:00
|
|
|
if( oldpos != screen->GetCrossHairPosition() )
|
2007-10-03 15:21:13 +00:00
|
|
|
{
|
2011-02-21 21:07:00 +00:00
|
|
|
pos = screen->GetCrossHairPosition();
|
|
|
|
screen->SetCrossHairPosition( oldpos );
|
|
|
|
DrawPanel->CrossHairOff( aDC );
|
|
|
|
screen->SetCrossHairPosition( pos );
|
|
|
|
DrawPanel->CrossHairOn( aDC );
|
2007-10-03 15:21:13 +00:00
|
|
|
|
2011-02-11 20:48:13 +00:00
|
|
|
if( DrawPanel->IsMouseCaptured() )
|
2007-10-03 15:21:13 +00:00
|
|
|
{
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->m_mouseCaptureCallback( DrawPanel, 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
|
|
|
|
2009-02-05 20:53:08 +00:00
|
|
|
/**
|
|
|
|
* Display 3D frame of current footprint selection.
|
|
|
|
*/
|
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-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
|
|
|
|
2010-11-12 16:36:43 +00:00
|
|
|
/**
|
|
|
|
* Function IsGridVisible() , virtual
|
2010-02-01 21:23:27 +00:00
|
|
|
* @return true if the grid must be shown
|
|
|
|
*/
|
|
|
|
bool DISPLAY_FOOTPRINTS_FRAME::IsGridVisible()
|
|
|
|
{
|
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-11-12 16:36:43 +00:00
|
|
|
/**
|
|
|
|
* Function SetGridVisibility() , virtual
|
2010-02-01 21:23:27 +00:00
|
|
|
* It may be overloaded by derived classes
|
2011-02-21 21:07:00 +00:00
|
|
|
* if you want to store/retrieve the grid visibility in configuration.
|
2010-02-01 21:23:27 +00:00
|
|
|
* @param aVisible = true if the grid must be shown
|
|
|
|
*/
|
|
|
|
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
|
|
|
|
2010-11-12 16:36:43 +00:00
|
|
|
/**
|
|
|
|
* Function GetGridColor() , virtual
|
2010-02-01 21:23:27 +00:00
|
|
|
* @return the color of the grid
|
|
|
|
*/
|
|
|
|
int DISPLAY_FOOTPRINTS_FRAME::GetGridColor()
|
|
|
|
{
|
|
|
|
return DARKGRAY;
|
|
|
|
}
|