2009-11-05 19:26:52 +00:00
|
|
|
/*****************/
|
|
|
|
/** setvisu.cpp **/
|
|
|
|
/*****************/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
#include "fctsys.h"
|
|
|
|
#include "common.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "class_drawpanel.h"
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "bitmaps.h"
|
|
|
|
#include "cvpcb.h"
|
2011-02-05 16:15:48 +00:00
|
|
|
#include "cvpcb_mainframe.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "cvstruct.h"
|
2010-02-01 21:23:27 +00:00
|
|
|
#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
|
|
|
*/
|
|
|
|
#include "3d_viewer.h"
|
|
|
|
|
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
|
|
|
{
|
2007-10-03 15:21:13 +00:00
|
|
|
wxString msg, FootprintName;
|
|
|
|
bool IsNew = FALSE;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2007-10-03 15:21:13 +00:00
|
|
|
FootprintName = m_FootprintList->GetSelectedFootprint();
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2007-10-03 15:21:13 +00:00
|
|
|
if( DrawFrame == NULL )
|
|
|
|
{
|
2010-02-01 21:23:27 +00:00
|
|
|
DrawFrame = new DISPLAY_FOOTPRINTS_FRAME( this, _( "Module" ),
|
2008-12-08 15:27:13 +00:00
|
|
|
wxPoint( 0, 0 ),
|
|
|
|
wxSize( 600, 400 ),
|
2007-10-27 12:24:09 +00:00
|
|
|
KICAD_DEFAULT_DRAWFRAME_STYLE |
|
|
|
|
wxFRAME_FLOAT_ON_PARENT );
|
2007-10-03 15:21:13 +00:00
|
|
|
IsNew = TRUE;
|
2007-10-27 12:24:09 +00:00
|
|
|
DrawFrame->Show( TRUE );
|
2007-10-03 15:21:13 +00:00
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2007-10-03 15:21:13 +00:00
|
|
|
if( !FootprintName.IsEmpty() )
|
|
|
|
{
|
|
|
|
msg = _( "Footprint: " ) + FootprintName;
|
|
|
|
DrawFrame->SetTitle( msg );
|
2011-02-22 17:59:46 +00:00
|
|
|
FOOTPRINT_INFO* Module = m_footprints.GetModuleInfo( FootprintName );
|
2007-10-03 15:21:13 +00:00
|
|
|
msg = _( "Lib: " );
|
2007-10-27 12:24:09 +00:00
|
|
|
|
2007-10-03 15:21:13 +00:00
|
|
|
if( Module )
|
|
|
|
msg += Module->m_LibName;
|
|
|
|
else
|
|
|
|
msg += wxT( "???" );
|
2007-10-27 12:24:09 +00:00
|
|
|
|
2007-10-03 15:21:13 +00:00
|
|
|
DrawFrame->SetStatusText( msg, 0 );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2009-01-05 05:21:35 +00:00
|
|
|
if( DrawFrame->GetBoard()->m_Modules.GetCount() )
|
2007-10-03 15:21:13 +00:00
|
|
|
{
|
|
|
|
// there is only one module in the list
|
2009-01-05 05:21:35 +00:00
|
|
|
DrawFrame->GetBoard()->m_Modules.DeleteAll();
|
2007-10-03 15:21:13 +00:00
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
MODULE* mod = DrawFrame->Get_Module( FootprintName );
|
|
|
|
if( mod )
|
|
|
|
DrawFrame->GetBoard()->m_Modules.PushBack( mod );
|
2007-10-03 15:21:13 +00:00
|
|
|
|
|
|
|
DrawFrame->Zoom_Automatique( FALSE );
|
2009-08-23 12:05:22 +00:00
|
|
|
DrawFrame->DrawPanel->Refresh();
|
2009-06-18 13:30:52 +00:00
|
|
|
DrawFrame->UpdateStatusBar(); /* Display new cursor coordinates and zoom value */
|
2007-10-03 15:21:13 +00:00
|
|
|
if( DrawFrame->m_Draw3DFrame )
|
|
|
|
DrawFrame->m_Draw3DFrame->NewDisplay();
|
|
|
|
}
|
|
|
|
else if( !IsNew )
|
|
|
|
{
|
2008-07-15 10:11:44 +00:00
|
|
|
DrawFrame->Refresh();
|
2007-10-03 15:21:13 +00:00
|
|
|
if( DrawFrame->m_Draw3DFrame )
|
|
|
|
DrawFrame->m_Draw3DFrame->NewDisplay();
|
|
|
|
}
|
|
|
|
}
|
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;
|
|
|
|
|
|
|
|
DrawPanel->DrawBackGround( DC );
|
2009-01-05 05:21:35 +00:00
|
|
|
GetBoard()->Draw( DrawPanel, 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-02-11 20:48:13 +00:00
|
|
|
DrawPanel->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
|
|
|
}
|
2011-03-23 15:18:44 +00:00
|
|
|
|
|
|
|
/* dummy_functions:
|
|
|
|
*
|
|
|
|
* These functions are used in some classes.
|
|
|
|
* they are useful in pcbnew, but have no meaning or are never used
|
|
|
|
* in cvpcb or gerbview.
|
|
|
|
* but they must exist because they appear in some classes.
|
|
|
|
* Do nothing in CvPcb.
|
|
|
|
*/
|
|
|
|
TRACK* Marque_Une_Piste( BOARD* aPcb,
|
|
|
|
TRACK* aStartSegm,
|
|
|
|
int* aSegmCount,
|
|
|
|
int* aTrackLen,
|
|
|
|
bool aReorder )
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|