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"
|
2009-02-05 20:53:08 +00:00
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
#include "cvpcb.h"
|
|
|
|
#include "bitmaps.h"
|
|
|
|
#include "protos.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "cvstruct.h"
|
2010-02-01 21:23:27 +00:00
|
|
|
#include "class_DisplayFootprintsFrame.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
|
|
|
|
2010-02-01 21:23:27 +00:00
|
|
|
BEGIN_EVENT_TABLE( DISPLAY_FOOTPRINTS_FRAME, WinEDA_BasePcbFrame )
|
|
|
|
EVT_CLOSE( DISPLAY_FOOTPRINTS_FRAME::OnCloseWindow )
|
|
|
|
EVT_SIZE( DISPLAY_FOOTPRINTS_FRAME::OnSize )
|
|
|
|
EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, DISPLAY_FOOTPRINTS_FRAME::OnZoom )
|
|
|
|
EVT_TOOL( ID_OPTIONS_SETUP, DISPLAY_FOOTPRINTS_FRAME::InstallOptionsDisplay )
|
|
|
|
EVT_TOOL( ID_CVPCB_SHOW3D_FRAME, DISPLAY_FOOTPRINTS_FRAME::Show3D_Frame )
|
2010-04-16 16:28:35 +00:00
|
|
|
EVT_TOOL( ID_TB_OPTIONS_SHOW_GRID, DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar)
|
|
|
|
EVT_TOOL( ID_TB_OPTIONS_SHOW_POLAR_COORD, DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar)
|
|
|
|
EVT_TOOL( ID_TB_OPTIONS_SELECT_UNIT_INCH, DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar)
|
|
|
|
EVT_TOOL( ID_TB_OPTIONS_SELECT_UNIT_MM, DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar)
|
|
|
|
EVT_TOOL( ID_TB_OPTIONS_SELECT_CURSOR, DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar)
|
|
|
|
EVT_TOOL( ID_TB_OPTIONS_SHOW_PADS_SKETCH, DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar)
|
|
|
|
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)
|
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
|
|
|
|
2010-02-01 21:23:27 +00:00
|
|
|
DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( WinEDA_CvpcbFrame* father,
|
2007-10-03 15:21:13 +00:00
|
|
|
const wxString& title,
|
2008-12-05 16:03:05 +00:00
|
|
|
const wxPoint& pos,
|
|
|
|
const wxSize& size, long style ) :
|
2008-12-08 15:27:13 +00:00
|
|
|
WinEDA_BasePcbFrame( father, CVPCB_DISPLAY_FRAME, title, pos,
|
2008-12-05 16:03:05 +00:00
|
|
|
size, style )
|
2007-10-03 15:21:13 +00:00
|
|
|
{
|
2009-04-05 20:49:15 +00:00
|
|
|
m_FrameName = wxT( "CmpFrame" );
|
2010-04-16 16:28:35 +00:00
|
|
|
m_Draw_Axis = true; // TRUE to draw axis.
|
2007-10-27 12:24:09 +00:00
|
|
|
|
|
|
|
// Give an icon
|
2009-05-21 17:42:42 +00:00
|
|
|
#ifdef __WINDOWS__
|
2007-10-27 12:24:09 +00:00
|
|
|
SetIcon( wxICON( a_icon_cvpcb ) );
|
2009-05-21 17:42:42 +00:00
|
|
|
#else
|
2007-10-27 12:24:09 +00:00
|
|
|
SetIcon( wxICON( icon_cvpcb ) );
|
2009-05-21 17:42:42 +00:00
|
|
|
#endif
|
2007-10-03 15:21:13 +00:00
|
|
|
SetTitle( title );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2009-01-05 05:21:35 +00:00
|
|
|
SetBoard( new BOARD( NULL, this ) );
|
2008-12-05 16:03:05 +00:00
|
|
|
SetBaseScreen( new PCB_SCREEN() );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
LoadSettings();
|
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
|
2009-11-05 19:26:52 +00:00
|
|
|
DisplayOpt.ShowTrackClearanceMode = 0; /* tracks and vias clearance has
|
|
|
|
* no meaning here. */
|
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 );
|
|
|
|
|
|
|
|
wxAuiPaneInfo horiz;
|
|
|
|
horiz.Gripper( false );
|
|
|
|
horiz.DockFixed( true );
|
|
|
|
horiz.Movable( false );
|
|
|
|
horiz.Floatable( false );
|
|
|
|
horiz.CloseButton( false );
|
|
|
|
horiz.CaptionVisible( false );
|
|
|
|
|
|
|
|
wxAuiPaneInfo vert( horiz );
|
|
|
|
|
|
|
|
vert.TopDockable( false ).BottomDockable( false );
|
|
|
|
horiz.LeftDockable( false ).RightDockable( false );
|
|
|
|
|
|
|
|
m_auimgr.AddPane( m_HToolBar,
|
|
|
|
wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top().
|
|
|
|
Row( 0 ) );
|
|
|
|
|
|
|
|
if( m_VToolBar ) // Currently, no vertical right toolbar.
|
|
|
|
m_auimgr.AddPane( m_VToolBar,
|
|
|
|
wxAuiPaneInfo( vert ).Name( wxT( "m_VToolBar" ) ).Right() );
|
|
|
|
|
|
|
|
m_auimgr.AddPane( DrawPanel,
|
|
|
|
wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
|
|
|
|
|
|
|
|
m_auimgr.AddPane( MsgPanel,
|
|
|
|
wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() );
|
|
|
|
|
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
|
|
|
|
2007-10-03 15:21:13 +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();
|
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
delete GetBaseScreen();
|
|
|
|
SetBaseScreen( 0 );
|
2007-10-27 12:24:09 +00:00
|
|
|
|
2008-12-08 15:27:13 +00:00
|
|
|
( (WinEDA_CvpcbFrame*) wxGetApp().GetTopWindow() )->DrawFrame = 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
|
|
|
{
|
2007-10-03 15:21:13 +00:00
|
|
|
wxPoint pos;
|
|
|
|
wxSize size;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2007-10-03 15:21:13 +00:00
|
|
|
size = GetSize();
|
|
|
|
pos = GetPosition();
|
2007-05-06 16:03:28 +00:00
|
|
|
|
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.
|
|
|
|
m_OptionsToolBar = new WinEDA_Toolbar( TOOLBAR_OPTION, this,
|
|
|
|
ID_OPT_TOOLBAR, FALSE );
|
|
|
|
|
|
|
|
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString,
|
|
|
|
wxBitmap( grid_xpm ),
|
|
|
|
_( "Hide grid" ), wxITEM_CHECK );
|
|
|
|
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_GRID,IsGridVisible() );
|
|
|
|
|
|
|
|
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, wxEmptyString,
|
|
|
|
wxBitmap( polar_coord_xpm ),
|
|
|
|
_( "Display Polar Coord ON" ), wxITEM_CHECK );
|
|
|
|
|
|
|
|
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, wxEmptyString,
|
|
|
|
wxBitmap( unit_inch_xpm ),
|
|
|
|
_( "Units in inches" ), wxITEM_CHECK );
|
|
|
|
|
|
|
|
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_MM, wxEmptyString,
|
|
|
|
wxBitmap( unit_mm_xpm ),
|
|
|
|
_( "Units in millimeters" ), wxITEM_CHECK );
|
|
|
|
|
|
|
|
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_CURSOR, wxEmptyString,
|
|
|
|
wxBitmap( cursor_shape_xpm ),
|
|
|
|
_( "Change Cursor Shape" ), wxITEM_CHECK );
|
|
|
|
|
|
|
|
m_OptionsToolBar->AddSeparator();
|
|
|
|
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_PADS_SKETCH, wxEmptyString,
|
|
|
|
wxBitmap( pad_sketch_xpm ),
|
|
|
|
_( "Show Pads Sketch" ), wxITEM_CHECK );
|
|
|
|
|
|
|
|
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH,
|
|
|
|
wxEmptyString,
|
|
|
|
wxBitmap( text_sketch_xpm ),
|
|
|
|
_( "Show Texts Sketch" ), wxITEM_CHECK );
|
|
|
|
|
|
|
|
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH,
|
|
|
|
wxEmptyString,
|
|
|
|
wxBitmap( show_mod_edge_xpm ),
|
|
|
|
_( "Show Edges Sketch" ), wxITEM_CHECK );
|
|
|
|
|
|
|
|
m_OptionsToolBar->Realize();
|
|
|
|
|
|
|
|
SetToolbars();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN, this, ID_H_TOOLBAR, TRUE );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2007-10-03 15:21:13 +00:00
|
|
|
m_HToolBar->AddTool( ID_OPTIONS_SETUP, wxEmptyString,
|
2008-12-05 16:03:05 +00:00
|
|
|
wxBitmap( display_options_xpm ),
|
|
|
|
_( "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
|
|
|
|
2009-01-07 15:59:49 +00:00
|
|
|
m_HToolBar->AddTool( ID_ZOOM_IN, wxEmptyString,
|
2008-12-05 16:03:05 +00:00
|
|
|
wxBitmap( zoom_in_xpm ),
|
2009-09-27 14:09:26 +00:00
|
|
|
_( "Zoom in (F1)" ) );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2009-01-07 15:59:49 +00:00
|
|
|
m_HToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString,
|
2008-12-05 16:03:05 +00:00
|
|
|
wxBitmap( zoom_out_xpm ),
|
2009-09-27 14:09:26 +00:00
|
|
|
_( "Zoom out (F2)" ) );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2009-01-07 15:59:49 +00:00
|
|
|
m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString,
|
2008-12-05 16:03:05 +00:00
|
|
|
wxBitmap( zoom_redraw_xpm ),
|
2009-09-27 14:09:26 +00:00
|
|
|
_( "Redraw view (F3)" ) );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2009-01-07 15:59:49 +00:00
|
|
|
m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString,
|
2008-12-05 16:03:05 +00:00
|
|
|
wxBitmap( zoom_auto_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();
|
2008-12-05 16:03:05 +00:00
|
|
|
m_HToolBar->AddTool( ID_CVPCB_SHOW3D_FRAME, wxEmptyString,
|
|
|
|
wxBitmap( show_3d_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
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-02-01 21:23:27 +00:00
|
|
|
void DISPLAY_FOOTPRINTS_FRAME::SetToolbars()
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2010-04-16 16:28:35 +00:00
|
|
|
if( m_OptionsToolBar )
|
|
|
|
{
|
|
|
|
m_OptionsToolBar->ToggleTool(
|
|
|
|
ID_TB_OPTIONS_SELECT_UNIT_MM,
|
2010-07-12 14:07:09 +00:00
|
|
|
g_UserUnit == MILLIMETRES );
|
2010-04-16 16:28:35 +00:00
|
|
|
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_INCH,
|
2010-07-12 14:07:09 +00:00
|
|
|
g_UserUnit == INCHES );
|
2010-04-16 16:28:35 +00:00
|
|
|
|
|
|
|
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_POLAR_COORD,
|
|
|
|
DisplayOpt.DisplayPolarCood );
|
|
|
|
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_POLAR_COORD,
|
|
|
|
DisplayOpt.DisplayPolarCood ?
|
|
|
|
_( "Display rectangular coordinates" ) :
|
|
|
|
_( "Display polar coordinates" ) );
|
|
|
|
|
|
|
|
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_GRID,
|
|
|
|
IsGridVisible( ) );
|
|
|
|
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_GRID,
|
|
|
|
IsGridVisible( ) ?
|
|
|
|
_( "Hide grid" ) :
|
|
|
|
_( "Show grid" ) );
|
|
|
|
|
|
|
|
|
|
|
|
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_CURSOR,
|
|
|
|
m_CursorShape );
|
|
|
|
|
|
|
|
|
|
|
|
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_PADS_SKETCH,
|
|
|
|
!m_DisplayPadFill );
|
|
|
|
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_PADS_SKETCH,
|
|
|
|
m_DisplayPadFill ?
|
|
|
|
_( "Show pads in sketch mode" ) :
|
|
|
|
_( "Show pads in filled mode" ) );
|
|
|
|
|
|
|
|
wxString msgTextsFill[3] =
|
|
|
|
{_( "Show texts in line mode" ),
|
|
|
|
_( "Show texts in filled mode" ),
|
|
|
|
_( "Show texts in sketch mode" )
|
|
|
|
};
|
|
|
|
unsigned idx = m_DisplayModText+1;
|
|
|
|
if ( idx > 2 )
|
|
|
|
idx = 0;
|
|
|
|
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH,
|
|
|
|
m_DisplayModText == 0 );
|
|
|
|
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH,
|
|
|
|
msgTextsFill[idx] );
|
|
|
|
|
|
|
|
wxString msgEdgesFill[3] =
|
|
|
|
{_( "Show outlines in line mode" ),
|
|
|
|
_( "Show outlines in filled mode" ),
|
|
|
|
_( "Show outlines in sketch mode" )
|
|
|
|
};
|
|
|
|
idx = m_DisplayModEdge+1;
|
|
|
|
if ( idx > 2 )
|
|
|
|
idx = 0;
|
|
|
|
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH,
|
|
|
|
m_DisplayModEdge == 0 );
|
|
|
|
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH,
|
|
|
|
msgEdgesFill[idx] );
|
|
|
|
|
|
|
|
m_OptionsToolBar->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
|
|
|
|
2010-02-01 21:23:27 +00:00
|
|
|
bool DISPLAY_FOOTPRINTS_FRAME::OnRightClick( const wxPoint& MousePos,
|
2009-11-05 19:26:52 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
|
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_GRID:
|
|
|
|
SetGridVisibility( m_OptionsToolBar->GetToolState( id ) );
|
|
|
|
DrawPanel->Refresh( );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_TB_OPTIONS_SELECT_UNIT_MM:
|
2010-07-12 14:07:09 +00:00
|
|
|
g_UserUnit = MILLIMETRES;
|
2010-04-16 16:28:35 +00:00
|
|
|
UpdateStatusBar();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_TB_OPTIONS_SELECT_UNIT_INCH:
|
2010-07-12 14:07:09 +00:00
|
|
|
g_UserUnit = INCHES;
|
2010-04-16 16:28:35 +00:00
|
|
|
UpdateStatusBar();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_TB_OPTIONS_SHOW_POLAR_COORD:
|
|
|
|
Affiche_Message( wxEmptyString );
|
|
|
|
DisplayOpt.DisplayPolarCood = m_OptionsToolBar->GetToolState( id );
|
|
|
|
UpdateStatusBar();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_TB_OPTIONS_SELECT_CURSOR:
|
|
|
|
m_CursorShape = m_OptionsToolBar->GetToolState( id );
|
|
|
|
DrawPanel->Refresh( );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_TB_OPTIONS_SHOW_PADS_SKETCH:
|
|
|
|
m_DisplayPadFill = !m_OptionsToolBar->GetToolState( id );
|
|
|
|
DrawPanel->Refresh( );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH:
|
|
|
|
m_DisplayModText++;
|
|
|
|
if( m_DisplayModText > 2 )
|
|
|
|
m_DisplayModText = 0;
|
|
|
|
DrawPanel->Refresh( );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH:
|
|
|
|
m_DisplayModEdge++;
|
|
|
|
if( m_DisplayModEdge > 2 )
|
|
|
|
m_DisplayModEdge = 0;
|
|
|
|
DrawPanel->Refresh( );
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
DisplayError( this,
|
|
|
|
wxT( "DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar error" ) );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
SetToolbars();
|
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2010-02-01 21:23:27 +00:00
|
|
|
void DISPLAY_FOOTPRINTS_FRAME::GeneralControle( wxDC* DC, wxPoint Mouse )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2009-02-07 08:33:25 +00:00
|
|
|
wxRealPoint delta;
|
2007-10-03 15:21:13 +00:00
|
|
|
int flagcurseur = 0;
|
|
|
|
wxPoint curpos, oldpos;
|
2010-02-22 16:45:35 +00:00
|
|
|
double scalar = GetScreen()->GetScalingFactor();
|
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
|
|
|
|
|
|
|
curpos = DrawPanel->CursorRealPosition( Mouse );
|
2008-04-17 16:25:29 +00:00
|
|
|
oldpos = GetScreen()->m_Curseur;
|
2007-10-03 15:21:13 +00:00
|
|
|
|
2009-10-14 19:43:31 +00:00
|
|
|
delta = GetScreen()->GetGridSize();
|
2010-02-08 18:15:42 +00:00
|
|
|
|
2010-02-22 16:45:35 +00:00
|
|
|
delta.x *= scalar;
|
|
|
|
delta.y *= scalar;
|
2009-01-17 20:31:19 +00:00
|
|
|
|
2007-10-03 15:21:13 +00:00
|
|
|
if( delta.x <= 0 )
|
|
|
|
delta.x = 1;
|
|
|
|
if( delta.y <= 0 )
|
|
|
|
delta.y = 1;
|
|
|
|
|
2009-02-05 20:53:08 +00:00
|
|
|
switch( g_KeyPressed )
|
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 );
|
|
|
|
flagcurseur = 2;
|
|
|
|
curpos = GetScreen()->m_Curseur;
|
|
|
|
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 );
|
|
|
|
flagcurseur = 2;
|
|
|
|
curpos = GetScreen()->m_Curseur;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WXK_F3:
|
|
|
|
cmd.SetId( ID_ZOOM_REDRAW );
|
|
|
|
GetEventHandler()->ProcessEvent( cmd );
|
|
|
|
flagcurseur = 2;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WXK_F4:
|
|
|
|
cmd.SetId( ID_POPUP_ZOOM_CENTER );
|
|
|
|
GetEventHandler()->ProcessEvent( cmd );
|
|
|
|
flagcurseur = 2;
|
|
|
|
curpos = GetScreen()->m_Curseur;
|
|
|
|
break;
|
|
|
|
|
2009-09-27 14:09:26 +00:00
|
|
|
case WXK_HOME:
|
|
|
|
cmd.SetId( ID_ZOOM_PAGE );
|
|
|
|
GetEventHandler()->ProcessEvent( cmd );
|
|
|
|
flagcurseur = 2;
|
|
|
|
curpos = GetScreen()->m_Curseur;
|
|
|
|
break;
|
|
|
|
|
2009-02-05 20:53:08 +00:00
|
|
|
case ' ':
|
|
|
|
GetScreen()->m_O_Curseur = GetScreen()->m_Curseur;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WXK_NUMPAD8: /* cursor moved up */
|
|
|
|
case WXK_UP:
|
2009-04-05 20:49:15 +00:00
|
|
|
Mouse.y -= wxRound(delta.y);
|
2009-02-05 20:53:08 +00:00
|
|
|
DrawPanel->MouseTo( Mouse );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WXK_NUMPAD2: /* cursor moved down */
|
|
|
|
case WXK_DOWN:
|
2009-04-05 20:49:15 +00:00
|
|
|
Mouse.y += wxRound(delta.y);
|
2009-02-05 20:53:08 +00:00
|
|
|
DrawPanel->MouseTo( Mouse );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WXK_NUMPAD4: /* cursor moved left */
|
|
|
|
case WXK_LEFT:
|
2009-04-05 20:49:15 +00:00
|
|
|
Mouse.x -= wxRound(delta.x);
|
2009-02-05 20:53:08 +00:00
|
|
|
DrawPanel->MouseTo( Mouse );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WXK_NUMPAD6: /* cursor moved right */
|
|
|
|
case WXK_RIGHT:
|
2009-04-05 20:49:15 +00:00
|
|
|
Mouse.x += wxRound(delta.x);
|
2009-02-05 20:53:08 +00:00
|
|
|
DrawPanel->MouseTo( Mouse );
|
|
|
|
break;
|
2007-10-03 15:21:13 +00:00
|
|
|
}
|
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
GetScreen()->m_Curseur = curpos;
|
2007-10-27 12:24:09 +00:00
|
|
|
/* Put cursor on grid */
|
2008-04-17 16:25:29 +00:00
|
|
|
PutOnGrid( &GetScreen()->m_Curseur );
|
2007-10-03 15:21:13 +00:00
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
if( GetScreen()->IsRefreshReq() )
|
2007-10-03 15:21:13 +00:00
|
|
|
{
|
|
|
|
flagcurseur = 2;
|
2010-01-22 18:13:43 +00:00
|
|
|
Refresh();
|
2007-10-03 15:21:13 +00:00
|
|
|
}
|
|
|
|
|
2009-01-17 20:31:19 +00:00
|
|
|
if( oldpos != GetScreen()->m_Curseur )
|
2007-10-03 15:21:13 +00:00
|
|
|
{
|
|
|
|
if( flagcurseur != 2 )
|
|
|
|
{
|
2008-04-17 16:25:29 +00:00
|
|
|
curpos = GetScreen()->m_Curseur;
|
|
|
|
GetScreen()->m_Curseur = oldpos;
|
2007-10-03 15:21:13 +00:00
|
|
|
DrawPanel->CursorOff( DC );
|
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
GetScreen()->m_Curseur = curpos;
|
2007-10-03 15:21:13 +00:00
|
|
|
DrawPanel->CursorOn( DC );
|
|
|
|
}
|
|
|
|
|
|
|
|
if( DrawPanel->ManageCurseur )
|
|
|
|
{
|
|
|
|
DrawPanel->ManageCurseur( DrawPanel, DC, 0 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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 )
|
|
|
|
{
|
2009-04-17 08:51:02 +00:00
|
|
|
DisplayInfoMessage( this, _( "3D Frame already opened" ) );
|
2009-02-05 20:53:08 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
m_Draw3DFrame = new WinEDA3D_DrawFrame( this, _( "3D Viewer" ),
|
|
|
|
KICAD_DEFAULT_3D_DRAWFRAME_STYLE |
|
|
|
|
wxFRAME_FLOAT_ON_PARENT );
|
|
|
|
m_Draw3DFrame->Show( TRUE );
|
|
|
|
}
|
2009-07-29 13:10:36 +00:00
|
|
|
|
2009-11-05 19:26:52 +00:00
|
|
|
/* Virtual function needed by the PCB_SCREEN class derived from BASE_SCREEN
|
2009-08-19 06:10:47 +00:00
|
|
|
* this is a virtual pure function in BASE_SCREEN
|
2009-07-29 13:10:36 +00:00
|
|
|
* do nothing in cvpcb
|
|
|
|
* could be removed later
|
|
|
|
*/
|
|
|
|
void PCB_SCREEN::ClearUndoORRedoList(UNDO_REDO_CONTAINER&, int )
|
|
|
|
{
|
|
|
|
}
|
2010-02-01 21:23:27 +00:00
|
|
|
|
|
|
|
/** Function IsGridVisible() , virtual
|
|
|
|
* @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
|
|
|
}
|
|
|
|
|
|
|
|
/** Function SetGridVisibility() , virtual
|
|
|
|
* It may be overloaded by derived classes
|
|
|
|
* if you want to store/retrieve the grid visiblity in configuration.
|
|
|
|
* @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
|
|
|
}
|
|
|
|
|
|
|
|
/** Function GetGridColor() , virtual
|
|
|
|
* @return the color of the grid
|
|
|
|
*/
|
|
|
|
int DISPLAY_FOOTPRINTS_FRAME::GetGridColor()
|
|
|
|
{
|
|
|
|
return DARKGRAY;
|
|
|
|
}
|
|
|
|
|