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;
|
2011-08-03 15:09:39 +00:00
|
|
|
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
|
|
|
|
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 );
|
|
|
|
IsNew = true;
|
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
|
|
|
// Raising the window does not show the window on Windows if iconized.
|
|
|
|
// This should work on any platform.
|
|
|
|
if( m_DisplayFootprintFrame->IsIconized() )
|
|
|
|
m_DisplayFootprintFrame->Iconize( false );
|
|
|
|
m_DisplayFootprintFrame->Raise();
|
2011-08-03 15:09:39 +00:00
|
|
|
|
|
|
|
// Raising the window does not set the focus on Linux. This should work on any platform.
|
2011-08-04 11:23:19 +00:00
|
|
|
if( wxWindow::FindFocus() != m_DisplayFootprintFrame )
|
|
|
|
m_DisplayFootprintFrame->SetFocus();
|
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;
|
2011-08-04 11:23:19 +00:00
|
|
|
m_DisplayFootprintFrame->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
|
|
|
|
2011-08-04 11:23:19 +00:00
|
|
|
m_DisplayFootprintFrame->SetStatusText( msg, 0 );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2011-08-04 11:23:19 +00:00
|
|
|
if( m_DisplayFootprintFrame->GetBoard()->m_Modules.GetCount() )
|
2007-10-03 15:21:13 +00:00
|
|
|
{
|
|
|
|
// there is only one module in the list
|
2011-08-04 11:23:19 +00:00
|
|
|
m_DisplayFootprintFrame->GetBoard()->m_Modules.DeleteAll();
|
2007-10-03 15:21:13 +00:00
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2011-08-04 11:23:19 +00:00
|
|
|
MODULE* mod = m_DisplayFootprintFrame->Get_Module( FootprintName );
|
2011-08-03 15:09:39 +00:00
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
if( mod )
|
2011-08-04 11:23:19 +00:00
|
|
|
m_DisplayFootprintFrame->GetBoard()->m_Modules.PushBack( mod );
|
2007-10-03 15:21:13 +00:00
|
|
|
|
2011-08-04 11:23:19 +00:00
|
|
|
m_DisplayFootprintFrame->Zoom_Automatique( false );
|
|
|
|
m_DisplayFootprintFrame->DrawPanel->Refresh();
|
|
|
|
m_DisplayFootprintFrame->UpdateStatusBar(); /* Display new cursor coordinates and zoom value */
|
2011-08-03 15:09:39 +00:00
|
|
|
|
2011-08-04 11:23:19 +00:00
|
|
|
if( m_DisplayFootprintFrame->m_Draw3DFrame )
|
|
|
|
m_DisplayFootprintFrame->m_Draw3DFrame->NewDisplay();
|
2007-10-03 15:21:13 +00:00
|
|
|
}
|
|
|
|
else if( !IsNew )
|
|
|
|
{
|
2011-08-04 11:23:19 +00:00
|
|
|
m_DisplayFootprintFrame->Refresh();
|
2011-08-03 15:09:39 +00:00
|
|
|
|
2011-08-04 11:23:19 +00:00
|
|
|
if( m_DisplayFootprintFrame->m_Draw3DFrame )
|
|
|
|
m_DisplayFootprintFrame->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;
|
|
|
|
|
|
|
|
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,
|
2011-08-20 14:56:55 +00:00
|
|
|
int* aLenDie,
|
2011-03-23 15:18:44 +00:00
|
|
|
bool aReorder )
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|