2011-09-23 13:57:12 +00:00
|
|
|
/**
|
|
|
|
* @file setvisu.cpp
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <fctsys.h>
|
|
|
|
#include <common.h>
|
|
|
|
#include <gr_basic.h>
|
|
|
|
#include <class_drawpanel.h>
|
|
|
|
#include <bitmaps.h>
|
2011-09-23 13:57:12 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <class_board.h>
|
|
|
|
#include <class_module.h>
|
2011-09-23 13:57:12 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <cvpcb.h>
|
|
|
|
#include <cvpcb_mainframe.h>
|
|
|
|
#include <cvstruct.h>
|
|
|
|
#include <class_DisplayFootprintsFrame.h>
|
2009-02-04 15:25:03 +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
|
|
|
*/
|
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
|
|
|
|
2009-05-06 11:55:36 +00:00
|
|
|
/*
|
|
|
|
* Create or Update the frame showing the current highlighted footprint
|
|
|
|
* and (if showed) the 3D display frame
|
2007-10-03 15:21:13 +00:00
|
|
|
*/
|
2011-02-05 16:15:48 +00:00
|
|
|
void CVPCB_MAINFRAME::CreateScreenCmp()
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2011-08-04 11:23:19 +00:00
|
|
|
if( m_DisplayFootprintFrame == NULL )
|
2007-10-03 15:21:13 +00:00
|
|
|
{
|
2011-08-04 11:23:19 +00:00
|
|
|
m_DisplayFootprintFrame = new DISPLAY_FOOTPRINTS_FRAME( this, _( "Module" ),
|
2011-08-03 15:09:39 +00:00
|
|
|
wxPoint( 0, 0 ),
|
|
|
|
wxSize( 600, 400 ),
|
|
|
|
KICAD_DEFAULT_DRAWFRAME_STYLE );
|
2011-08-04 11:23:19 +00:00
|
|
|
m_DisplayFootprintFrame->Show( true );
|
2011-08-03 15:09:39 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-08-04 11:23:19 +00:00
|
|
|
if( m_DisplayFootprintFrame->IsIconized() )
|
|
|
|
m_DisplayFootprintFrame->Iconize( false );
|
2007-10-03 15:21:13 +00:00
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2012-05-31 17:41:37 +00:00
|
|
|
m_DisplayFootprintFrame->InitDisplay();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Refresh the full display for this frame:
|
|
|
|
* Set the title, the status line and redraw the canvas
|
|
|
|
* Must be called after the footprint to display is modifed
|
|
|
|
*/
|
|
|
|
void DISPLAY_FOOTPRINTS_FRAME::InitDisplay()
|
|
|
|
{
|
|
|
|
wxString msg;
|
|
|
|
CVPCB_MAINFRAME * parentframe = (CVPCB_MAINFRAME *) GetParent();
|
|
|
|
wxString footprintName = parentframe->m_FootprintList->GetSelectedFootprint();
|
|
|
|
|
|
|
|
if( !footprintName.IsEmpty() )
|
2007-10-03 15:21:13 +00:00
|
|
|
{
|
2012-05-31 17:41:37 +00:00
|
|
|
msg = _( "Footprint: " ) + footprintName;
|
|
|
|
SetTitle( msg );
|
|
|
|
FOOTPRINT_INFO* module_info = parentframe->m_footprints.GetModuleInfo( footprintName );
|
2007-10-03 15:21:13 +00:00
|
|
|
msg = _( "Lib: " );
|
2007-10-27 12:24:09 +00:00
|
|
|
|
2012-05-31 17:41:37 +00:00
|
|
|
if( module_info )
|
|
|
|
msg += module_info->m_LibName;
|
2007-10-03 15:21:13 +00:00
|
|
|
else
|
|
|
|
msg += wxT( "???" );
|
2007-10-27 12:24:09 +00:00
|
|
|
|
2012-05-31 17:41:37 +00:00
|
|
|
SetStatusText( msg, 0 );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2012-05-31 17:41:37 +00:00
|
|
|
if( GetBoard()->m_Modules.GetCount() )
|
2007-10-03 15:21:13 +00:00
|
|
|
{
|
|
|
|
// there is only one module in the list
|
2012-05-31 17:41:37 +00:00
|
|
|
GetBoard()->m_Modules.DeleteAll();
|
2007-10-03 15:21:13 +00:00
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2012-05-31 17:41:37 +00:00
|
|
|
MODULE* module = Get_Module( footprintName );
|
2007-10-03 15:21:13 +00:00
|
|
|
|
2012-05-31 17:41:37 +00:00
|
|
|
if( module )
|
|
|
|
GetBoard()->m_Modules.PushBack( module );
|
2011-12-22 13:28:11 +00:00
|
|
|
|
2012-05-31 17:41:37 +00:00
|
|
|
Zoom_Automatique( false );
|
2011-08-03 15:09:39 +00:00
|
|
|
|
2007-10-03 15:21:13 +00:00
|
|
|
}
|
2012-05-31 17:41:37 +00:00
|
|
|
else // No footprint to display. Erase old footprint, if any
|
2007-10-03 15:21:13 +00:00
|
|
|
{
|
2012-05-31 17:41:37 +00:00
|
|
|
if( GetBoard()->m_Modules.GetCount() )
|
2011-12-18 20:22:16 +00:00
|
|
|
{
|
2012-05-31 17:41:37 +00:00
|
|
|
GetBoard()->m_Modules.DeleteAll();
|
|
|
|
Zoom_Automatique( false );
|
|
|
|
SetStatusText( wxEmptyString, 0 );
|
2011-12-18 20:22:16 +00:00
|
|
|
}
|
2012-05-31 17:41:37 +00:00
|
|
|
}
|
2011-12-18 20:22:16 +00:00
|
|
|
|
2012-05-31 17:41:37 +00:00
|
|
|
// Display new cursor coordinates and zoom value:
|
|
|
|
UpdateStatusBar();
|
2011-08-03 15:09:39 +00:00
|
|
|
|
2012-05-31 17:41:37 +00:00
|
|
|
GetCanvas()->Refresh();
|
|
|
|
|
|
|
|
if( m_Draw3DFrame )
|
|
|
|
m_Draw3DFrame->NewDisplay();
|
2007-10-03 15:21:13 +00:00
|
|
|
}
|
2007-10-27 12:24:09 +00:00
|
|
|
|
2009-05-06 11:55:36 +00:00
|
|
|
/*
|
|
|
|
* Draws the current highlighted footprint.
|
|
|
|
*/
|
2010-02-01 21:23:27 +00:00
|
|
|
void DISPLAY_FOOTPRINTS_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
2007-10-27 12:24:09 +00:00
|
|
|
{
|
2009-01-05 05:21:35 +00:00
|
|
|
if( !GetBoard() )
|
2007-10-27 12:24:09 +00:00
|
|
|
return;
|
|
|
|
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->DrawBackGround( DC );
|
|
|
|
GetBoard()->Draw( m_canvas, DC, GR_COPY );
|
2007-10-27 12:24:09 +00:00
|
|
|
|
2009-01-05 05:21:35 +00:00
|
|
|
MODULE* Module = GetBoard()->m_Modules;
|
2011-02-01 15:46:25 +00:00
|
|
|
|
2008-09-27 19:26:29 +00:00
|
|
|
if ( Module )
|
2009-04-17 08:51:02 +00:00
|
|
|
Module->DisplayInfo( this );
|
2010-01-22 18:13:43 +00:00
|
|
|
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->DrawCrossHair( DC );
|
2007-10-27 12:24:09 +00:00
|
|
|
}
|
2008-09-27 19:26:29 +00:00
|
|
|
|
|
|
|
|
2009-05-06 11:55:36 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Redraw the BOARD items but not cursors, axis or grid.
|
|
|
|
*/
|
2011-01-21 19:30:59 +00:00
|
|
|
void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoint& aOffset )
|
2008-09-27 19:26:29 +00:00
|
|
|
{
|
|
|
|
if( m_Modules )
|
|
|
|
{
|
2010-12-21 12:41:17 +00:00
|
|
|
m_Modules->Draw( aPanel, aDC, GR_COPY );
|
2009-05-06 11:55:36 +00:00
|
|
|
}
|
2008-09-27 19:26:29 +00:00
|
|
|
}
|