Initial version of GAL-based module viewer in pcbnew.
This commit is contained in:
parent
a68165d2a0
commit
cc733a4966
|
@ -448,8 +448,12 @@ const EDA_RECT MODULE::GetBoundingBox() const
|
|||
// Add the Clearance shape size: (shape around the pads when the
|
||||
// clearance is shown. Not optimized, but the draw cost is small
|
||||
// (perhaps smaller than optimization).
|
||||
int biggest_clearance = GetBoard()->GetDesignSettings().GetBiggestClearanceValue();
|
||||
BOARD* board = GetBoard();
|
||||
if( board )
|
||||
{
|
||||
int biggest_clearance = board->GetDesignSettings().GetBiggestClearanceValue();
|
||||
area.Inflate( biggest_clearance );
|
||||
}
|
||||
|
||||
return area;
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include <kiway.h>
|
||||
#include <gr_basic.h>
|
||||
#include <class_drawpanel.h>
|
||||
#include <pcb_draw_panel_gal.h>
|
||||
#include <wxPcbStruct.h>
|
||||
#include <3d_viewer.h>
|
||||
#include <pcbcommon.h>
|
||||
|
@ -54,6 +55,8 @@
|
|||
#include <wildcards_and_files_ext.h>
|
||||
#include <pcbnew_config.h>
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
|
||||
#define NEXT_PART 1
|
||||
#define NEW_PART 0
|
||||
|
@ -141,7 +144,14 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent
|
|||
m_footprintList = new wxListBox( this, ID_MODVIEW_FOOTPRINT_LIST,
|
||||
wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_HSCROLL );
|
||||
|
||||
// Create GAL canvas
|
||||
EDA_DRAW_FRAME* drawFrame = static_cast<EDA_DRAW_FRAME*>( aParent );
|
||||
PCB_DRAW_PANEL_GAL* drawPanel = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_FrameSize,
|
||||
drawFrame->GetGalCanvas()->GetBackend() );
|
||||
SetGalCanvas( drawPanel );
|
||||
|
||||
SetBoard( new BOARD() );
|
||||
drawPanel->DisplayBoard( m_Pcb );
|
||||
|
||||
// Ensure all layers and items are visible:
|
||||
GetBoard()->SetVisibleAlls();
|
||||
|
@ -207,6 +217,8 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent
|
|||
// Manage the draw panel, right pane.
|
||||
m_auimgr.AddPane( m_canvas,
|
||||
wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
|
||||
m_auimgr.AddPane( (wxWindow*) GetGalCanvas(),
|
||||
wxAuiPaneInfo().Name( wxT( "DrawFrameGal" ) ).CentrePane().Hide() );
|
||||
|
||||
// Manage the message panel, bottom pane.
|
||||
m_auimgr.AddPane( m_messagePanel,
|
||||
|
@ -244,6 +256,8 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent
|
|||
#endif
|
||||
|
||||
Show( true );
|
||||
|
||||
UseGalCanvas( drawFrame->IsGalCanvasActive() );
|
||||
}
|
||||
|
||||
|
||||
|
@ -421,6 +435,22 @@ void FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
UpdateTitle();
|
||||
|
||||
if( IsGalCanvasActive() )
|
||||
{
|
||||
KIGFX::VIEW* view = GetGalCanvas()->GetView();
|
||||
view->Clear();
|
||||
|
||||
// Load modules and its additional elements
|
||||
for( MODULE* module = GetBoard()->m_Modules; module; module = module->Next() )
|
||||
{
|
||||
module->RunOnChildren( boost::bind( &KIGFX::VIEW::Add, view, _1 ) );
|
||||
view->Add( module );
|
||||
}
|
||||
|
||||
// view->Add( loadFootprint( id ) );
|
||||
}
|
||||
|
||||
Zoom_Automatique( false );
|
||||
m_canvas->Refresh();
|
||||
Update3D_Frame();
|
||||
|
@ -827,3 +857,16 @@ void FOOTPRINT_VIEWER_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
|||
if( module )
|
||||
SetMsgPanel( module );
|
||||
}
|
||||
|
||||
|
||||
void FOOTPRINT_VIEWER_FRAME::UseGalCanvas( bool aEnable )
|
||||
{
|
||||
EDA_DRAW_FRAME::UseGalCanvas( aEnable );
|
||||
|
||||
if( aEnable )
|
||||
{
|
||||
SetBoard( m_Pcb );
|
||||
|
||||
GetGalCanvas()->StartDrawing();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -170,6 +170,9 @@ private:
|
|||
void SaveCopyInUndoList( BOARD_ITEM*, UNDO_REDO_T, const wxPoint& ) {}
|
||||
void SaveCopyInUndoList( const PICKED_ITEMS_LIST&, UNDO_REDO_T, const wxPoint &) {}
|
||||
|
||||
///> @copydoc EDA_DRAW_FRAME::UseGalCanvas()
|
||||
virtual void UseGalCanvas( bool aEnable );
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <worksheet_viewitem.h>
|
||||
#include <ratsnest_viewitem.h>
|
||||
|
||||
#include <class_colors_design_settings.h>
|
||||
#include <class_board.h>
|
||||
#include <class_module.h>
|
||||
#include <class_track.h>
|
||||
|
@ -210,8 +211,7 @@ void PCB_DRAW_PANEL_GAL::DisplayBoard( const BOARD* aBoard )
|
|||
m_ratsnest = new KIGFX::RATSNEST_VIEWITEM( aBoard->GetRatsnest() );
|
||||
m_view->Add( m_ratsnest );
|
||||
|
||||
// Load layer color setup from PCB data
|
||||
static_cast<KIGFX::PCB_RENDER_SETTINGS*>( m_view->GetPainter()->GetSettings() )->ImportLegacyColors( aBoard->GetColorsSettings() );
|
||||
UseColorScheme( aBoard->GetColorsSettings() );
|
||||
|
||||
m_view->RecacheAllItems( true );
|
||||
}
|
||||
|
@ -233,6 +233,14 @@ void PCB_DRAW_PANEL_GAL::SetWorksheet( KIGFX::WORKSHEET_VIEWITEM* aWorksheet )
|
|||
}
|
||||
|
||||
|
||||
void PCB_DRAW_PANEL_GAL::UseColorScheme( const COLORS_DESIGN_SETTINGS* aSettings )
|
||||
{
|
||||
KIGFX::PCB_RENDER_SETTINGS* rs;
|
||||
rs = static_cast<KIGFX::PCB_RENDER_SETTINGS*>( m_view->GetPainter()->GetSettings() );
|
||||
rs->ImportLegacyColors( aSettings );
|
||||
}
|
||||
|
||||
|
||||
void PCB_DRAW_PANEL_GAL::SetHighContrastLayer( LAYER_ID aLayer )
|
||||
{
|
||||
// Set display settings for high contrast mode
|
||||
|
|
|
@ -32,6 +32,7 @@ namespace KIGFX
|
|||
class WORKSHEET_VIEWITEM;
|
||||
class RATSNEST_VIEWITEM;
|
||||
}
|
||||
class COLORS_DESIGN_SETTINGS;
|
||||
|
||||
class PCB_DRAW_PANEL_GAL : public EDA_DRAW_PANEL_GAL
|
||||
{
|
||||
|
@ -56,6 +57,13 @@ public:
|
|||
*/
|
||||
void SetWorksheet( KIGFX::WORKSHEET_VIEWITEM* aWorksheet );
|
||||
|
||||
/**
|
||||
* Function UseColorScheme
|
||||
* Applies layer color settings.
|
||||
* @param aSettings are the new settings.
|
||||
*/
|
||||
void UseColorScheme( const COLORS_DESIGN_SETTINGS* aSettings );
|
||||
|
||||
///> @copydoc EDA_DRAW_PANEL_GAL::SetHighContrastLayer()
|
||||
virtual void SetHighContrastLayer( LAYER_ID aLayer );
|
||||
|
||||
|
|
Loading…
Reference in New Issue