|
|
@ -2,7 +2,7 @@ |
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application. |
|
|
|
* |
|
|
|
* Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr |
|
|
|
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors. |
|
|
|
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors. |
|
|
|
* |
|
|
|
* This program is free software: you can redistribute it and/or modify it |
|
|
|
* under the terms of the GNU General Public License as published by the |
|
|
@ -18,10 +18,6 @@ |
|
|
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/ |
|
|
|
|
|
|
|
/**
|
|
|
|
* @file gerbview_frame.cpp |
|
|
|
*/ |
|
|
|
|
|
|
|
#include <fctsys.h>
|
|
|
|
#include <kiface_i.h>
|
|
|
|
#include <pgm_base.h>
|
|
|
@ -120,7 +116,7 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ): |
|
|
|
|
|
|
|
SetLayout( new GBR_LAYOUT() ); |
|
|
|
|
|
|
|
SetVisibleLayers( -1 ); // All draw layers visible.
|
|
|
|
SetVisibleLayers( LSET::AllLayersMask() ); // All draw layers visible.
|
|
|
|
|
|
|
|
SetScreen( new GBR_SCREEN( GetPageSettings().GetSizeIU() ) ); |
|
|
|
|
|
|
@ -661,8 +657,8 @@ void GERBVIEW_FRAME::UpdateDisplayOptions( const GBR_DISPLAY_OPTIONS& aOptions ) |
|
|
|
|
|
|
|
if( update_flashed ) |
|
|
|
{ |
|
|
|
view->UpdateAllItemsConditionally( KIGFX::REPAINT, |
|
|
|
[]( KIGFX::VIEW_ITEM* aItem ) { |
|
|
|
view->UpdateAllItemsConditionally( KIGFX::REPAINT, []( KIGFX::VIEW_ITEM* aItem ) |
|
|
|
{ |
|
|
|
auto item = static_cast<GERBER_DRAW_ITEM*>( aItem ); |
|
|
|
|
|
|
|
switch( item->m_Shape ) |
|
|
@ -681,8 +677,8 @@ void GERBVIEW_FRAME::UpdateDisplayOptions( const GBR_DISPLAY_OPTIONS& aOptions ) |
|
|
|
} |
|
|
|
else if( update_lines ) |
|
|
|
{ |
|
|
|
view->UpdateAllItemsConditionally( KIGFX::REPAINT, |
|
|
|
[]( KIGFX::VIEW_ITEM* aItem ) { |
|
|
|
view->UpdateAllItemsConditionally( KIGFX::REPAINT, []( KIGFX::VIEW_ITEM* aItem ) |
|
|
|
{ |
|
|
|
auto item = static_cast<GERBER_DRAW_ITEM*>( aItem ); |
|
|
|
|
|
|
|
switch( item->m_Shape ) |
|
|
@ -699,8 +695,8 @@ void GERBVIEW_FRAME::UpdateDisplayOptions( const GBR_DISPLAY_OPTIONS& aOptions ) |
|
|
|
} |
|
|
|
else if( update_polygons ) |
|
|
|
{ |
|
|
|
view->UpdateAllItemsConditionally( KIGFX::REPAINT, |
|
|
|
[]( KIGFX::VIEW_ITEM* aItem ) { |
|
|
|
view->UpdateAllItemsConditionally( KIGFX::REPAINT, []( KIGFX::VIEW_ITEM* aItem ) |
|
|
|
{ |
|
|
|
auto item = static_cast<GERBER_DRAW_ITEM*>( aItem ); |
|
|
|
|
|
|
|
return ( item->m_Shape == GBR_POLYGON ); |
|
|
@ -800,36 +796,27 @@ bool GERBVIEW_FRAME::IsElementVisible( int aLayerID ) const |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
long GERBVIEW_FRAME::GetVisibleLayers() const |
|
|
|
LSET GERBVIEW_FRAME::GetVisibleLayers() const |
|
|
|
{ |
|
|
|
long layerMask = 0; |
|
|
|
LSET visible = LSET::AllLayersMask(); |
|
|
|
|
|
|
|
if( auto canvas = GetGalCanvas() ) |
|
|
|
{ |
|
|
|
// NOTE: This assumes max 32 drawlayers!
|
|
|
|
for( int i = 0; i < GERBER_DRAWLAYERS_COUNT; i++ ) |
|
|
|
{ |
|
|
|
if( canvas->GetView()->IsLayerVisible( GERBER_DRAW_LAYER( i ) ) ) |
|
|
|
layerMask |= ( 1 << i ); |
|
|
|
} |
|
|
|
|
|
|
|
return layerMask; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
return -1; |
|
|
|
visible[i] = canvas->GetView()->IsLayerVisible( GERBER_DRAW_LAYER( i ) ); |
|
|
|
} |
|
|
|
|
|
|
|
return visible; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void GERBVIEW_FRAME::SetVisibleLayers( long aLayerMask ) |
|
|
|
void GERBVIEW_FRAME::SetVisibleLayers( LSET aLayerMask ) |
|
|
|
{ |
|
|
|
if( auto canvas = GetGalCanvas() ) |
|
|
|
{ |
|
|
|
// NOTE: This assumes max 32 drawlayers!
|
|
|
|
for( int i = 0; i < GERBER_DRAWLAYERS_COUNT; i++ ) |
|
|
|
{ |
|
|
|
bool v = ( aLayerMask & ( 1 << i ) ); |
|
|
|
bool v = aLayerMask[i]; |
|
|
|
int layer = GERBER_DRAW_LAYER( i ); |
|
|
|
canvas->GetView()->SetLayerVisible( layer, v ); |
|
|
|
canvas->GetView()->SetLayerVisible( GERBER_DCODE_LAYER( layer ), |
|
|
@ -1051,13 +1038,6 @@ void GERBVIEW_FRAME::SetGridColor( COLOR4D aColor ) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
EDA_RECT GERBVIEW_FRAME::GetGerberLayoutBoundingBox() |
|
|
|
{ |
|
|
|
GetGerberLayout()->ComputeBoundingBox(); |
|
|
|
return GetGerberLayout()->GetBoundingBox(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void GERBVIEW_FRAME::UpdateStatusBar() |
|
|
|
{ |
|
|
|
EDA_DRAW_FRAME::UpdateStatusBar(); |
|
|
|