2007-05-06 16:03:28 +00:00
|
|
|
/*********************************************************************/
|
|
|
|
/** setvisu.cpp: initialisations de l'ecran d'affichage du composant **/
|
|
|
|
/*********************************************************************/
|
|
|
|
|
|
|
|
#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
|
|
|
#include "id.h"
|
|
|
|
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "bitmaps.h"
|
|
|
|
#include "cvpcb.h"
|
2007-05-06 16:03:28 +00:00
|
|
|
#include "protos.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "cvstruct.h"
|
|
|
|
|
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
|
|
|
|
* included to prevent the error from occuring.
|
|
|
|
*/
|
|
|
|
#include "3d_viewer.h"
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2007-10-03 15:21:13 +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
|
|
|
*/
|
2009-05-06 11:55:36 +00:00
|
|
|
void WinEDA_CvpcbFrame::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 )
|
|
|
|
{
|
2008-12-08 15:27:13 +00:00
|
|
|
DrawFrame = new WinEDA_DisplayFrame( this, _( "Module" ),
|
|
|
|
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 );
|
2009-04-23 15:02:18 +00:00
|
|
|
FOOTPRINT* Module = GetModuleDescrByName( FootprintName, m_footprints );
|
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-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.
|
|
|
|
*/
|
2007-10-27 12:24:09 +00:00
|
|
|
void WinEDA_DisplayFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
|
|
|
{
|
2009-01-05 05:21:35 +00:00
|
|
|
if( !GetBoard() )
|
2007-10-27 12:24:09 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
ActiveScreen = (PCB_SCREEN*) GetScreen();
|
|
|
|
|
|
|
|
if( EraseBg )
|
|
|
|
DrawPanel->EraseScreen( DC );
|
|
|
|
|
|
|
|
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;
|
2008-09-27 19:26:29 +00:00
|
|
|
if ( Module )
|
2009-04-17 08:51:02 +00:00
|
|
|
Module->DisplayInfo( this );
|
2007-10-27 12:24:09 +00:00
|
|
|
DrawPanel->Trace_Curseur( DC );
|
|
|
|
}
|
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.
|
|
|
|
*/
|
2008-09-27 19:26:29 +00:00
|
|
|
void BOARD::Draw( WinEDA_DrawPanel* aPanel, wxDC* DC,
|
|
|
|
int aDrawMode, const wxPoint& offset )
|
|
|
|
{
|
|
|
|
if( m_Modules )
|
|
|
|
{
|
|
|
|
m_Modules->Draw( aPanel, DC, GR_COPY );
|
2009-05-06 11:55:36 +00:00
|
|
|
}
|
2008-09-27 19:26:29 +00:00
|
|
|
}
|