Make gerbview compilable and working (does not use now layers and layer masks from Pcbnew).
Export to Pcbnew is broken, but it is a very rarely used feature. It will be fixed later.
This commit is contained in:
parent
8627684122
commit
013296cb1a
|
@ -109,7 +109,8 @@ bool DrawPageOnClipboard( EDA_DRAW_FRAME* aFrame )
|
|||
dc.SetClippingRegion( DrawArea );
|
||||
}
|
||||
|
||||
aFrame->PrintPage( &dc, FULL_LAYERS, false );
|
||||
const LSET allLayersMask = LSET().set();
|
||||
aFrame->PrintPage( &dc, allLayersMask, false );
|
||||
screen->m_IsPrinting = false;
|
||||
aFrame->GetCanvas()->SetClipBox( tmp );
|
||||
wxMetafile* mf = dc.Close();
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include <gr_basic.h>
|
||||
|
||||
#include <gerbview.h>
|
||||
#include <gerbview_frame.h>
|
||||
#include <class_gerber_draw_item.h>
|
||||
|
||||
#include <wx/debug.h>
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include <wxstruct.h>
|
||||
#include <class_drawpanel.h>
|
||||
#include <gerbview.h>
|
||||
#include <dcode.h>
|
||||
|
||||
#include <class_DCodeSelectionbox.h>
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include <macros.h>
|
||||
|
||||
#include <gerbview.h>
|
||||
#include <gerbview_frame.h>
|
||||
#include <class_GERBER.h>
|
||||
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ private:
|
|||
excellon_state m_State; // state of excellon file analysis
|
||||
bool m_SlotOn; // true during an oval driil definition
|
||||
|
||||
public: EXCELLON_IMAGE( GERBVIEW_FRAME* aParent, LAYER_NUM layer ) :
|
||||
public: EXCELLON_IMAGE( GERBVIEW_FRAME* aParent, int layer ) :
|
||||
GERBER_IMAGE( aParent, layer )
|
||||
{
|
||||
m_State = READ_HEADER_STATE;
|
||||
|
|
|
@ -40,7 +40,7 @@ void GBR_LAYER_BOX_SELECTOR::Resync()
|
|||
{
|
||||
Clear();
|
||||
|
||||
for( LAYER_NUM layerid = FIRST_LAYER; layerid < NB_LAYERS; ++layerid )
|
||||
for( int layerid = 0; layerid < GERBER_DRAWLAYERS_COUNT; ++layerid )
|
||||
{
|
||||
wxBitmap layerbmp( 14, 14 );
|
||||
wxString layername;
|
||||
|
@ -49,7 +49,7 @@ void GBR_LAYER_BOX_SELECTOR::Resync()
|
|||
continue;
|
||||
|
||||
// Prepare Bitmap
|
||||
SetBitmapLayer( layerbmp, layerid );
|
||||
SetBitmapLayer( layerbmp, (LAYER_ID)layerid );
|
||||
|
||||
layername = GetLayerName( layerid );
|
||||
|
||||
|
@ -59,7 +59,7 @@ void GBR_LAYER_BOX_SELECTOR::Resync()
|
|||
|
||||
|
||||
// Returns a color index from the layer id
|
||||
EDA_COLOR_T GBR_LAYER_BOX_SELECTOR::GetLayerColor( LAYER_NUM aLayer ) const
|
||||
EDA_COLOR_T GBR_LAYER_BOX_SELECTOR::GetLayerColor( int aLayer ) const
|
||||
{
|
||||
GERBVIEW_FRAME* frame = (GERBVIEW_FRAME*) GetParent()->GetParent();
|
||||
|
||||
|
@ -68,7 +68,7 @@ EDA_COLOR_T GBR_LAYER_BOX_SELECTOR::GetLayerColor( LAYER_NUM aLayer ) const
|
|||
|
||||
|
||||
// Returns the name of the layer id
|
||||
wxString GBR_LAYER_BOX_SELECTOR::GetLayerName( LAYER_NUM aLayer ) const
|
||||
wxString GBR_LAYER_BOX_SELECTOR::GetLayerName( int aLayer ) const
|
||||
{
|
||||
wxString name;
|
||||
name.Printf( _( "Layer %d" ), aLayer + 1 );
|
||||
|
|
|
@ -22,15 +22,14 @@ public:
|
|||
|
||||
// Returns a color index from the layer id
|
||||
// Virtual function
|
||||
EDA_COLOR_T GetLayerColor( LAYER_NUM aLayer ) const;
|
||||
EDA_COLOR_T GetLayerColor( int aLayer ) const;
|
||||
|
||||
// Returns true if the layer id is enabled (i.e. is it should be displayed)
|
||||
// Virtual function
|
||||
bool IsLayerEnabled( LAYER_NUM aLayer ) const { return true; };
|
||||
bool IsLayerEnabled( int aLayer ) const { return true; };
|
||||
|
||||
// Returns the name of the layer id
|
||||
// Virtual function
|
||||
wxString GetLayerName( LAYER_NUM aLayer ) const;
|
||||
wxString GetLayerName( int aLayer ) const;
|
||||
};
|
||||
|
||||
#endif //CLASS_GBR_LAYER_BOX_SELECTOR_H
|
||||
|
|
|
@ -14,7 +14,7 @@ GBR_LAYOUT::GBR_LAYOUT()
|
|||
{
|
||||
PAGE_INFO pageInfo( wxT( "GERBER" ) );
|
||||
SetPageSettings( pageInfo );
|
||||
m_printLayersMask = FULL_LAYERS;
|
||||
m_printLayersMask = -1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -22,16 +22,6 @@ GBR_LAYOUT::~GBR_LAYOUT()
|
|||
{
|
||||
}
|
||||
|
||||
/* Function IsLayerVisible
|
||||
* tests whether a given layer is visible
|
||||
* param aLayer = The layer to be tested
|
||||
* return bool - true if the layer is visible.
|
||||
*/
|
||||
bool GBR_LAYOUT::IsLayerVisible( LAYER_NUM aLayer ) const
|
||||
{
|
||||
return m_printLayersMask & GetLayerMask( aLayer );
|
||||
}
|
||||
|
||||
|
||||
EDA_RECT GBR_LAYOUT::ComputeBoundingBox()
|
||||
{
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include <class_colors_design_settings.h>
|
||||
#include <common.h> // PAGE_INFO
|
||||
#include <gerbview.h> // GERBER_DRAWLAYERS_COUNT
|
||||
#include <class_title_block.h>
|
||||
#include <class_gerber_draw_item.h>
|
||||
|
||||
|
@ -27,7 +28,7 @@ private:
|
|||
PAGE_INFO m_paper;
|
||||
TITLE_BLOCK m_titles;
|
||||
wxPoint m_originAxisPosition;
|
||||
LSET m_printLayersMask; // When printing: the list of layers to print
|
||||
std::bitset <GERBER_DRAWLAYERS_COUNT> m_printLayersMask; // When printing: the list of layers to print
|
||||
public:
|
||||
|
||||
DLIST<GERBER_DRAW_ITEM> m_Drawings; // linked list of Gerber Items
|
||||
|
@ -87,24 +88,35 @@ public:
|
|||
void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
|
||||
GR_DRAWMODE aDrawMode, const wxPoint& aOffset,
|
||||
bool aPrintBlackAndWhite = false );
|
||||
|
||||
/**
|
||||
* Function SetVisibleLayers
|
||||
* changes the bit-mask of visible layers
|
||||
* @param aLayerMask = The new bit-mask of visible layers
|
||||
* Function SetPrintableLayers
|
||||
* changes the list of printable layers
|
||||
* @param aLayerMask = The new bit-mask of printable layers
|
||||
*/
|
||||
void SetVisibleLayers( LSET aLayerMask )
|
||||
void SetPrintableLayers( const std::bitset <GERBER_DRAWLAYERS_COUNT>& aLayerMask )
|
||||
{
|
||||
m_printLayersMask = aLayerMask;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function IsLayerVisible
|
||||
* Function GetPrintableLayers
|
||||
* @return the bit-mask of printable layers
|
||||
*/
|
||||
std::bitset <GERBER_DRAWLAYERS_COUNT> GetPrintableLayers()
|
||||
{
|
||||
return m_printLayersMask;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function IsLayerPrintable
|
||||
* tests whether a given layer is visible
|
||||
* @param aLayer = The layer to be tested
|
||||
* @return bool - true if the layer is visible.
|
||||
*/
|
||||
bool IsLayerVisible( LAYER_NUM aLayer ) const;
|
||||
bool IsLayerPrintable( int aLayer ) const
|
||||
{
|
||||
return m_printLayersMask[ aLayer ];
|
||||
}
|
||||
|
||||
#if defined(DEBUG)
|
||||
void Show( int nestLevel, std::ostream& os ) const; // overload
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include <msgpanel.h>
|
||||
|
||||
#include <gerbview.h>
|
||||
#include <gerbview_frame.h>
|
||||
#include <class_gerber_draw_item.h>
|
||||
#include <class_GERBER.h>
|
||||
|
||||
|
@ -44,7 +45,7 @@ GERBER_DRAW_ITEM::GERBER_DRAW_ITEM( GBR_LAYOUT* aParent, GERBER_IMAGE* aGerberpa
|
|||
EDA_ITEM( (EDA_ITEM*)aParent, TYPE_GERBER_DRAW_ITEM )
|
||||
{
|
||||
m_imageParams = aGerberparams;
|
||||
m_Layer = FIRST_LAYER;
|
||||
m_Layer = 0;
|
||||
m_Shape = GBR_SEGMENT;
|
||||
m_Flashed = false;
|
||||
m_DCode = 0;
|
||||
|
|
|
@ -90,7 +90,7 @@ public:
|
|||
* redundancy for these parameters
|
||||
*/
|
||||
private:
|
||||
LAYER_NUM m_Layer;
|
||||
int m_Layer;
|
||||
|
||||
// These values are used to draw this item, according to gerber layers parameters
|
||||
// Because they can change inside a gerber image, they are stored here
|
||||
|
@ -123,7 +123,7 @@ public:
|
|||
* Function GetLayer
|
||||
* returns the layer this item is on.
|
||||
*/
|
||||
LAYER_NUM GetLayer() const { return m_Layer; }
|
||||
int GetLayer() const { return m_Layer; }
|
||||
|
||||
/**
|
||||
* Function SetLayer
|
||||
|
@ -132,12 +132,7 @@ public:
|
|||
* is virtual because some items (in fact: class DIMENSION)
|
||||
* have a slightly different initialization
|
||||
*/
|
||||
void SetLayer( LAYER_NUM aLayer ) { m_Layer = aLayer; }
|
||||
|
||||
LSET GetLayerMask()
|
||||
{
|
||||
return ::GetLayerMask( m_Layer );
|
||||
}
|
||||
void SetLayer( int aLayer ) { m_Layer = aLayer; }
|
||||
|
||||
bool GetLayerPolarity()
|
||||
{
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include <class_gbr_layer_box_selector.h>
|
||||
|
||||
#include <gerbview.h>
|
||||
#include <gerbview_frame.h>
|
||||
#include <class_GERBER.h>
|
||||
#include <layer_widget.h>
|
||||
#include <class_gerbview_layer_widget.h>
|
||||
|
@ -169,7 +170,7 @@ void GERBER_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
|
|||
int rowCount;
|
||||
int menuId = event.GetId();
|
||||
bool visible = (menuId == ID_SHOW_ALL_LAYERS) ? true : false;;
|
||||
LSET visibleLayers = NO_LAYERS;
|
||||
long visibleLayers = 0;
|
||||
bool force_active_layer_visible;
|
||||
|
||||
m_alwaysShowActiveLayer = ( menuId == ID_ALWAYS_SHOW_NO_LAYERS_BUT_ACTIVE );
|
||||
|
@ -186,7 +187,7 @@ void GERBER_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
|
|||
for( int row=0; row < rowCount; ++row )
|
||||
{
|
||||
wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, 3 );
|
||||
LAYER_NUM layer = getDecodedId( cb->GetId() );
|
||||
int layer = getDecodedId( cb->GetId() );
|
||||
bool loc_visible = visible;
|
||||
|
||||
if( force_active_layer_visible && (layer == myframe->getActiveLayer() ) )
|
||||
|
@ -195,9 +196,9 @@ void GERBER_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
|
|||
cb->SetValue( loc_visible );
|
||||
|
||||
if( loc_visible )
|
||||
visibleLayers |= GetLayerSet( row );
|
||||
visibleLayers |= 1 << row;
|
||||
else
|
||||
visibleLayers &= ~GetLayerSet( row );
|
||||
visibleLayers &= ~( 1 << row );
|
||||
}
|
||||
|
||||
myframe->SetVisibleLayers( visibleLayers );
|
||||
|
@ -224,7 +225,7 @@ void GERBER_LAYER_WIDGET::ReFill()
|
|||
{
|
||||
ClearLayerRows();
|
||||
|
||||
for( LAYER_NUM layer = FIRST_LAYER; layer < NB_GERBER_LAYERS; ++layer )
|
||||
for( int layer = 0; layer < GERBER_DRAWLAYERS_COUNT; ++layer )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _("Layer %d"), layer+1 );
|
||||
|
@ -244,11 +245,11 @@ void GERBER_LAYER_WIDGET::OnLayerColorChange( int aLayer, EDA_COLOR_T aColor )
|
|||
myframe->GetCanvas()->Refresh();
|
||||
}
|
||||
|
||||
bool GERBER_LAYER_WIDGET::OnLayerSelect( LAYER_NUM aLayer )
|
||||
bool GERBER_LAYER_WIDGET::OnLayerSelect( int aLayer )
|
||||
{
|
||||
// the layer change from the GERBER_LAYER_WIDGET can be denied by returning
|
||||
// false from this function.
|
||||
LAYER_NUM layer = myframe->getActiveLayer( );
|
||||
int layer = myframe->getActiveLayer( );
|
||||
myframe->setActiveLayer( aLayer, false );
|
||||
myframe->syncLayerBox();
|
||||
|
||||
|
@ -261,14 +262,14 @@ bool GERBER_LAYER_WIDGET::OnLayerSelect( LAYER_NUM aLayer )
|
|||
return true;
|
||||
}
|
||||
|
||||
void GERBER_LAYER_WIDGET::OnLayerVisible( LAYER_NUM aLayer, bool isVisible, bool isFinal )
|
||||
void GERBER_LAYER_WIDGET::OnLayerVisible( int aLayer, bool isVisible, bool isFinal )
|
||||
{
|
||||
LSET visibleLayers = myframe->GetVisibleLayers();
|
||||
long visibleLayers = myframe->GetVisibleLayers();
|
||||
|
||||
if( isVisible )
|
||||
visibleLayers |= GetLayerSet( aLayer );
|
||||
visibleLayers |= 1 << aLayer;
|
||||
else
|
||||
visibleLayers &= ~GetLayerSet( aLayer );
|
||||
visibleLayers &= ~( 1 << aLayer );
|
||||
|
||||
myframe->SetVisibleLayers( visibleLayers );
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include <common.h>
|
||||
#include <class_drawpanel.h>
|
||||
#include <gerbview.h>
|
||||
#include <gerbview_frame.h>
|
||||
|
||||
|
||||
void GERBVIEW_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey )
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include <base_units.h>
|
||||
|
||||
#include <gerbview.h>
|
||||
#include <gerbview_frame.h>
|
||||
#include <class_gerber_draw_item.h>
|
||||
#include <class_GERBER.h>
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#define wxTEST_POSTSCRIPT_IN_MSW 1
|
||||
|
||||
#include <fctsys.h>
|
||||
//#include <pgm_base.h>
|
||||
|
||||
#include <kiface_i.h>
|
||||
#include <common.h>
|
||||
#include <class_drawpanel.h>
|
||||
|
@ -16,9 +16,9 @@
|
|||
#include <printout_controler.h>
|
||||
|
||||
#include <gerbview.h>
|
||||
#include <gerbview_frame.h>
|
||||
#include <pcbplot.h>
|
||||
|
||||
static long s_SelectedLayers;
|
||||
static double s_ScaleList[] =
|
||||
{ 0, 0.5, 0.7, 0.999, 1.0, 1.4, 2.0, 3.0, 4.0 };
|
||||
|
||||
|
@ -27,8 +27,8 @@ static double s_ScaleList[] =
|
|||
#define MAX_SCALE 100.0
|
||||
|
||||
// static print data and page setup data, to remember settings during the session
|
||||
static wxPrintData* g_PrintData;
|
||||
static wxPageSetupDialogData* g_pageSetupData = (wxPageSetupDialogData*) NULL;
|
||||
static wxPrintData* s_printData;
|
||||
static wxPageSetupDialogData* s_pageSetupData = (wxPageSetupDialogData*) NULL;
|
||||
|
||||
// Variables locales
|
||||
static PRINT_PARAMETERS s_Parameters;
|
||||
|
@ -64,6 +64,9 @@ public:
|
|||
bool IsMirrored() { return m_Print_Mirror->IsChecked(); }
|
||||
bool PrintUsingSinglePage() { return true; }
|
||||
int SetLayerSetFromListSelection();
|
||||
// Prepare print parameters. return true if OK,
|
||||
// false if there is an issue (mainly no printable layers)
|
||||
bool PreparePrintPrms();
|
||||
};
|
||||
|
||||
|
||||
|
@ -75,17 +78,17 @@ void GERBVIEW_FRAME::ToPrinter( wxCommandEvent& event )
|
|||
* Display the print dialog
|
||||
*/
|
||||
{
|
||||
if( g_PrintData == NULL ) // First print
|
||||
g_PrintData = new wxPrintData();
|
||||
if( s_printData == NULL ) // First print
|
||||
s_printData = new wxPrintData();
|
||||
|
||||
if( !g_PrintData->Ok() )
|
||||
if( !s_printData->Ok() )
|
||||
{
|
||||
DisplayError( this, _( "Error Init Printer info" ) );
|
||||
return;
|
||||
}
|
||||
|
||||
g_PrintData->SetQuality( wxPRINT_QUALITY_HIGH );
|
||||
g_PrintData->SetOrientation( GetPageSettings().IsPortrait() ?
|
||||
s_printData->SetQuality( wxPRINT_QUALITY_HIGH );
|
||||
s_printData->SetOrientation( GetPageSettings().IsPortrait() ?
|
||||
wxPORTRAIT : wxLANDSCAPE );
|
||||
|
||||
DIALOG_PRINT_USING_PRINTER* frame = new DIALOG_PRINT_USING_PRINTER( this );
|
||||
|
@ -118,31 +121,29 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
|
|||
/************************************************************************/
|
||||
{
|
||||
SetFocus();
|
||||
LAYER_NUM layer_max = NB_GERBER_LAYERS;
|
||||
wxString msg;
|
||||
|
||||
if( g_pageSetupData == NULL )
|
||||
if( s_pageSetupData == NULL )
|
||||
{
|
||||
g_pageSetupData = new wxPageSetupDialogData;
|
||||
s_pageSetupData = new wxPageSetupDialogData;
|
||||
// Set initial page margins.
|
||||
// Margins are already set in Pcbnew, so we can use 0
|
||||
g_pageSetupData->SetMarginTopLeft(wxPoint(0, 0));
|
||||
g_pageSetupData->SetMarginBottomRight(wxPoint(0, 0));
|
||||
// Margins are already set in Gerbview, so we can use 0
|
||||
s_pageSetupData->SetMarginTopLeft(wxPoint(0, 0));
|
||||
s_pageSetupData->SetMarginBottomRight(wxPoint(0, 0));
|
||||
}
|
||||
|
||||
s_Parameters.m_PageSetupData = g_pageSetupData;
|
||||
s_Parameters.m_PageSetupData = s_pageSetupData;
|
||||
|
||||
layer_max = NB_LAYERS;
|
||||
// Create layer list
|
||||
for( LAYER_NUM ii = FIRST_LAYER; ii < layer_max; ++ii )
|
||||
for( int ii = 0; ii < GERBER_DRAWLAYERS_COUNT; ++ii )
|
||||
{
|
||||
LSET mask = GetLayerSet( ii );
|
||||
msg = _( "Layer" );
|
||||
msg << wxT( " " ) << ii + 1;
|
||||
m_BoxSelectLayer[ii] = new wxCheckBox( this, -1, msg );
|
||||
|
||||
if( mask & s_SelectedLayers )
|
||||
m_BoxSelectLayer[ii]->SetValue( true );
|
||||
if( g_GERBER_List[ii] == NULL ) // Nothing loaded on this draw layer
|
||||
m_BoxSelectLayer[ii]->Enable( false );
|
||||
|
||||
if( ii < 16 )
|
||||
m_leftLayersBoxSizer->Add( m_BoxSelectLayer[ii],
|
||||
wxGROW | wxLEFT | wxRIGHT | wxTOP );
|
||||
|
@ -170,21 +171,14 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
|
|||
s_Parameters.m_YScaleAdjust > MAX_SCALE )
|
||||
s_Parameters.m_XScaleAdjust = s_Parameters.m_YScaleAdjust = 1.0;
|
||||
|
||||
s_SelectedLayers = 0;
|
||||
for( LAYER_NUM layer = FIRST_LAYER; layer < layer_max; ++layer )
|
||||
for( int layer = 0; layer < GERBER_DRAWLAYERS_COUNT; ++layer )
|
||||
{
|
||||
wxString layerKey;
|
||||
bool option;
|
||||
|
||||
layerKey.Printf( OPTKEY_LAYERBASE, layer );
|
||||
|
||||
option = false;
|
||||
if( m_Config->Read( layerKey, &option ) )
|
||||
{
|
||||
m_Config->Read( layerKey, &option, false );
|
||||
m_BoxSelectLayer[layer]->SetValue( option );
|
||||
if( option )
|
||||
s_SelectedLayers |= GetLayerSet( layer );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -214,30 +208,29 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
|
|||
m_FineAdjustYscaleOpt->Enable(enable);
|
||||
}
|
||||
|
||||
/**************************************************************/
|
||||
int DIALOG_PRINT_USING_PRINTER::SetLayerSetFromListSelection()
|
||||
/**************************************************************/
|
||||
{
|
||||
int page_count = 0;
|
||||
s_Parameters.m_PrintMaskLayer = NO_LAYERS;
|
||||
for( LAYER_NUM ii = FIRST_LAYER; ii < NB_GERBER_LAYERS; ++ii )
|
||||
std::bitset <GERBER_DRAWLAYERS_COUNT> layerMask;
|
||||
for( int ii = 0; ii < GERBER_DRAWLAYERS_COUNT; ++ii )
|
||||
{
|
||||
if( m_BoxSelectLayer[ii]->IsChecked() )
|
||||
if( m_BoxSelectLayer[ii]->IsChecked() && m_BoxSelectLayer[ii]->IsEnabled() )
|
||||
{
|
||||
page_count++;
|
||||
s_Parameters.m_PrintMaskLayer |= GetLayerSet( ii );
|
||||
layerMask[ii] = true;
|
||||
}
|
||||
else
|
||||
layerMask[ii] = false;
|
||||
}
|
||||
|
||||
m_Parent->GetGerberLayout()->SetPrintableLayers( layerMask );
|
||||
s_Parameters.m_PageCount = page_count;
|
||||
|
||||
return page_count;
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************/
|
||||
void DIALOG_PRINT_USING_PRINTER::OnCloseWindow( wxCloseEvent& event )
|
||||
/********************************************************************/
|
||||
{
|
||||
SetPrintParameters();
|
||||
|
||||
|
@ -249,19 +242,18 @@ void DIALOG_PRINT_USING_PRINTER::OnCloseWindow( wxCloseEvent& event )
|
|||
m_Config->Write( OPTKEY_PRINT_PAGE_FRAME, s_Parameters.m_Print_Sheet_Ref);
|
||||
m_Config->Write( OPTKEY_PRINT_MONOCHROME_MODE, s_Parameters.m_Print_Black_and_White);
|
||||
wxString layerKey;
|
||||
for( LAYER_NUM layer = FIRST_LAYER; layer < NB_GERBER_LAYERS; ++layer )
|
||||
for( int layer = 0; layer < GERBER_DRAWLAYERS_COUNT; ++layer )
|
||||
{
|
||||
layerKey.Printf( OPTKEY_LAYERBASE, layer );
|
||||
m_Config->Write( layerKey, m_BoxSelectLayer[layer]->IsChecked() );
|
||||
}
|
||||
}
|
||||
|
||||
EndModal( 0 );
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************/
|
||||
void DIALOG_PRINT_USING_PRINTER::SetPrintParameters( )
|
||||
/******************************************************************/
|
||||
{
|
||||
s_Parameters.m_PrintMirror = m_Print_Mirror->GetValue();
|
||||
s_Parameters.m_Print_Black_and_White =
|
||||
|
@ -303,38 +295,45 @@ void DIALOG_PRINT_USING_PRINTER::OnScaleSelectionClick( wxCommandEvent& event )
|
|||
m_FineAdjustYscaleOpt->Enable(enable);
|
||||
}
|
||||
|
||||
/**********************************************************/
|
||||
// Open a dialog box for printer setup (printer options, page size ...)
|
||||
void DIALOG_PRINT_USING_PRINTER::OnPageSetup( wxCommandEvent& event )
|
||||
/**********************************************************/
|
||||
|
||||
/* Open a dialog box for printer setup (printer options, page size ...)
|
||||
*/
|
||||
{
|
||||
*g_pageSetupData = *g_PrintData;
|
||||
*s_pageSetupData = *s_printData;
|
||||
|
||||
wxPageSetupDialog pageSetupDialog(this, g_pageSetupData);
|
||||
wxPageSetupDialog pageSetupDialog(this, s_pageSetupData);
|
||||
pageSetupDialog.ShowModal();
|
||||
|
||||
(*g_PrintData) = pageSetupDialog.GetPageSetupDialogData().GetPrintData();
|
||||
(*g_pageSetupData) = pageSetupDialog.GetPageSetupDialogData();
|
||||
(*s_printData) = pageSetupDialog.GetPageSetupDialogData().GetPrintData();
|
||||
(*s_pageSetupData) = pageSetupDialog.GetPageSetupDialogData();
|
||||
}
|
||||
|
||||
|
||||
/************************************************************/
|
||||
void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event )
|
||||
/************************************************************/
|
||||
|
||||
/* Open and display a previewer frame for printing
|
||||
*/
|
||||
bool DIALOG_PRINT_USING_PRINTER::PreparePrintPrms()
|
||||
{
|
||||
SetPrintParameters( );
|
||||
|
||||
// If no layer selected, we have no plot. prompt user if it happens
|
||||
// because he could think there is a bug in Pcbnew:
|
||||
if( m_Parent->GetGerberLayout()->GetPrintableLayers().none() )
|
||||
{
|
||||
DisplayError( this, _( "No layer selected" ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Open and display a previewer frame for printing
|
||||
void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event )
|
||||
{
|
||||
if( !PreparePrintPrms() )
|
||||
return;
|
||||
|
||||
// Pass two printout objects: for preview, and possible printing.
|
||||
wxString title = _( "Print Preview" );
|
||||
wxPrintPreview* preview =
|
||||
new wxPrintPreview( new BOARD_PRINTOUT_CONTROLLER( s_Parameters, m_Parent, title ),
|
||||
new BOARD_PRINTOUT_CONTROLLER( s_Parameters, m_Parent, title ),
|
||||
g_PrintData );
|
||||
s_printData );
|
||||
|
||||
if( preview == NULL )
|
||||
{
|
||||
|
@ -342,16 +341,6 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event )
|
|||
return;
|
||||
}
|
||||
|
||||
SetLayerSetFromListSelection();
|
||||
|
||||
// If no layer selected, we have no plot. prompt user if it happens
|
||||
// because he could think there is a bug in Pcbnew:
|
||||
if( s_Parameters.m_PrintMaskLayer == 0 )
|
||||
{
|
||||
DisplayError( this, _( "No layer selected" ) );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Uses the parent position and size.
|
||||
// @todo uses last position and size ans store them when exit in m_Config
|
||||
|
@ -365,27 +354,14 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
|
||||
/***************************************************************************/
|
||||
void DIALOG_PRINT_USING_PRINTER::OnPrintButtonClick( wxCommandEvent& event )
|
||||
/***************************************************************************/
|
||||
|
||||
/* Called on activate Print button
|
||||
*/
|
||||
{
|
||||
SetPrintParameters( );
|
||||
|
||||
// If no layer selected, we have no plot. prompt user if it happens
|
||||
// because he could think there is a bug in Pcbnew:
|
||||
if( s_Parameters.m_PrintMaskLayer == 0 )
|
||||
{
|
||||
DisplayError( this, _( "No layer selected" ) );
|
||||
if( !PreparePrintPrms() )
|
||||
return;
|
||||
}
|
||||
|
||||
wxPrintDialogData printDialogData( *g_PrintData );
|
||||
wxPrintDialogData printDialogData( *s_printData );
|
||||
|
||||
wxPrinter printer( &printDialogData );
|
||||
|
||||
wxString title = _( "Print" );
|
||||
BOARD_PRINTOUT_CONTROLLER printout( s_Parameters, m_Parent, title );
|
||||
|
||||
|
@ -402,7 +378,7 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintButtonClick( wxCommandEvent& event )
|
|||
}
|
||||
else
|
||||
{
|
||||
*g_PrintData = printer.GetPrintDialogData().GetPrintData();
|
||||
*s_printData = printer.GetPrintDialogData().GetPrintData();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include <select_layers_to_pcb.h>
|
||||
|
||||
// Exported function
|
||||
const wxString GetPCBDefaultLayerName( LAYER_NUM aLayerNumber );
|
||||
const wxString GetPCBDefaultLayerName( int aLayerNumber );
|
||||
|
||||
|
||||
enum layer_sel_id {
|
||||
|
@ -23,11 +23,11 @@ class SELECT_LAYER_DIALOG : public wxDialog
|
|||
private:
|
||||
GERBVIEW_FRAME* m_Parent;
|
||||
wxRadioBox* m_LayerList;
|
||||
LAYER_NUM m_LayerId[int(NB_LAYERS) + 1]; // One extra element for "(Deselect)" radiobutton
|
||||
int m_LayerId[int(GERBER_DRAWLAYERS_COUNT) + 1]; // One extra element for "(Deselect)" radiobutton
|
||||
|
||||
public:
|
||||
// Constructor and destructor
|
||||
SELECT_LAYER_DIALOG( GERBVIEW_FRAME* parent, LAYER_NUM aDefaultLayer,
|
||||
SELECT_LAYER_DIALOG( GERBVIEW_FRAME* parent, int aDefaultLayer,
|
||||
int aCopperLayerCount, bool aShowDeselectOption );
|
||||
~SELECT_LAYER_DIALOG() { };
|
||||
|
||||
|
@ -47,10 +47,10 @@ END_EVENT_TABLE()
|
|||
|
||||
|
||||
/** Install the dialog box for layer selection
|
||||
* @param aDefaultLayer = Preselection (NB_LAYERS for "(Deselect)" layer)
|
||||
* @param aDefaultLayer = Preselection (GERBER_DRAWLAYERS_COUNT for "(Deselect)" layer)
|
||||
* @param aCopperLayerCount = number of copper layers
|
||||
* @param aShowDeselectOption = display a "(Deselect)" radiobutton (when set to true)
|
||||
* @return new layer value (NB_LAYERS when "(Deselect)" radiobutton selected),
|
||||
* @return new layer value (GERBER_DRAWLAYERS_COUNT when "(Deselect)" radiobutton selected),
|
||||
* or -1 if canceled
|
||||
*
|
||||
* Providing the option to also display a "(Deselect)" radiobutton makes the
|
||||
|
@ -61,10 +61,10 @@ END_EVENT_TABLE()
|
|||
* different radiobutton is clicked on) prior to then clicking on the "Deselect"
|
||||
* button provided within the "Layer selection:" dialog box).
|
||||
*/
|
||||
LAYER_NUM GERBVIEW_FRAME::SelectPCBLayer( LAYER_NUM aDefaultLayer, int aCopperLayerCount,
|
||||
int GERBVIEW_FRAME::SelectPCBLayer( int aDefaultLayer, int aCopperLayerCount,
|
||||
bool aShowDeselectOption )
|
||||
{
|
||||
LAYER_NUM layer;
|
||||
int layer;
|
||||
SELECT_LAYER_DIALOG* frame = new SELECT_LAYER_DIALOG( this, aDefaultLayer,
|
||||
aCopperLayerCount,
|
||||
aShowDeselectOption );
|
||||
|
@ -82,14 +82,17 @@ LAYER_NUM GERBVIEW_FRAME::SelectPCBLayer( LAYER_NUM aDefaultLayer, int aCopperLa
|
|||
* to the right of that radiobox.
|
||||
*/
|
||||
SELECT_LAYER_DIALOG::SELECT_LAYER_DIALOG( GERBVIEW_FRAME* parent,
|
||||
LAYER_NUM aDefaultLayer, int aCopperLayerCount,
|
||||
int aDefaultLayer, int aCopperLayerCount,
|
||||
bool aShowDeselectOption ) :
|
||||
wxDialog( parent, -1, _( "Select Layer:" ), wxPoint( -1, -1 ),
|
||||
wxSize( 470, 250 ),
|
||||
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER )
|
||||
{
|
||||
#define NB_PCB_LAYERS 64
|
||||
#define FIRST_COPPER_LAYER 0
|
||||
#define LAST_COPPER_LAYER 31
|
||||
wxButton* Button;
|
||||
LAYER_NUM ii;
|
||||
int ii;
|
||||
wxString LayerList[NB_PCB_LAYERS + 1]; // One extra element for "(Deselect)"
|
||||
// radiobutton
|
||||
int LayerCount, LayerSelect = -1;
|
||||
|
@ -98,9 +101,10 @@ SELECT_LAYER_DIALOG::SELECT_LAYER_DIALOG( GERBVIEW_FRAME* parent,
|
|||
|
||||
// Build the layer list; first build copper layers list
|
||||
LayerCount = 0;
|
||||
for( ii = FIRST_COPPER_LAYER; ii < NB_COPPER_LAYERS; ++ii )
|
||||
|
||||
for( ii = FIRST_COPPER_LAYER; ii <= LAST_COPPER_LAYER; ++ii )
|
||||
{
|
||||
m_LayerId[ii] = FIRST_LAYER;
|
||||
m_LayerId[ii] = 0;
|
||||
|
||||
if( ii == FIRST_COPPER_LAYER || ii == LAST_COPPER_LAYER || ii < aCopperLayerCount-1 )
|
||||
{
|
||||
|
@ -113,10 +117,11 @@ SELECT_LAYER_DIALOG::SELECT_LAYER_DIALOG( GERBVIEW_FRAME* parent,
|
|||
LayerCount++;
|
||||
}
|
||||
}
|
||||
|
||||
// Build the layer list; build non copper layers list
|
||||
for( ; ii < NB_PCB_LAYERS; ++ii )
|
||||
{
|
||||
m_LayerId[ii] = FIRST_LAYER;
|
||||
m_LayerId[ii] = 0;
|
||||
|
||||
LayerList[LayerCount] = GetPCBDefaultLayerName( ii );
|
||||
|
||||
|
@ -182,7 +187,7 @@ void SELECT_LAYER_DIALOG::OnCancelClick( wxCommandEvent& event )
|
|||
EndModal( -1 );
|
||||
}
|
||||
|
||||
const wxString GetPCBDefaultLayerName( LAYER_NUM aLayerNumber )
|
||||
const wxString GetPCBDefaultLayerName( int aLayerNumber )
|
||||
{
|
||||
const wxChar* txt;
|
||||
|
||||
|
@ -190,20 +195,20 @@ const wxString GetPCBDefaultLayerName( LAYER_NUM aLayerNumber )
|
|||
switch( aLayerNumber )
|
||||
{
|
||||
case F_Cu: txt = wxT( "F.Cu" ); break;
|
||||
case LAYER_N_2: txt = wxT( "Inner1.Cu" ); break;
|
||||
case LAYER_N_3: txt = wxT( "Inner2.Cu" ); break;
|
||||
case LAYER_N_4: txt = wxT( "Inner3.Cu" ); break;
|
||||
case LAYER_N_5: txt = wxT( "Inner4.Cu" ); break;
|
||||
case LAYER_N_6: txt = wxT( "Inner5.Cu" ); break;
|
||||
case LAYER_N_7: txt = wxT( "Inner6.Cu" ); break;
|
||||
case LAYER_N_8: txt = wxT( "Inner7.Cu" ); break;
|
||||
case LAYER_N_9: txt = wxT( "Inner8.Cu" ); break;
|
||||
case LAYER_N_10: txt = wxT( "Inner9.Cu" ); break;
|
||||
case LAYER_N_11: txt = wxT( "Inner10.Cu" ); break;
|
||||
case LAYER_N_12: txt = wxT( "Inner11.Cu" ); break;
|
||||
case LAYER_N_13: txt = wxT( "Inner12.Cu" ); break;
|
||||
case LAYER_N_14: txt = wxT( "Inner13.Cu" ); break;
|
||||
case LAYER_N_15: txt = wxT( "Inner14.Cu" ); break;
|
||||
case In1_Cu: txt = wxT( "In1.Cu" ); break;
|
||||
case In2_Cu: txt = wxT( "In2.Cu" ); break;
|
||||
case In3_Cu: txt = wxT( "In3.Cu" ); break;
|
||||
case In4_Cu: txt = wxT( "In4.Cu" ); break;
|
||||
case In5_Cu: txt = wxT( "In5.Cu" ); break;
|
||||
case In6_Cu: txt = wxT( "In6.Cu" ); break;
|
||||
case In7_Cu: txt = wxT( "In7.Cu" ); break;
|
||||
case In8_Cu: txt = wxT( "In8.Cu" ); break;
|
||||
case In9_Cu: txt = wxT( "In9.Cu" ); break;
|
||||
case In10_Cu: txt = wxT( "In10.Cu" ); break;
|
||||
case In11_Cu: txt = wxT( "In11.Cu" ); break;
|
||||
case In12_Cu: txt = wxT( "In12.Cu" ); break;
|
||||
case In13_Cu: txt = wxT( "In13.Cu" ); break;
|
||||
case In14_Cu: txt = wxT( "In14.Cu" ); break;
|
||||
case B_Cu: txt = wxT( "B.Cu" ); break;
|
||||
case B_Adhes: txt = wxT( "B.Adhes" ); break;
|
||||
case F_Adhes: txt = wxT( "F.Adhes" ); break;
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include <macros.h>
|
||||
|
||||
#include <gerbview.h>
|
||||
#include <gerbview_frame.h>
|
||||
#include <dialog_show_page_borders.h>
|
||||
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include <pcbplot.h>
|
||||
#include <gerbview.h>
|
||||
#include <gerbview_frame.h>
|
||||
#include <gerbview_dialog_display_options_frame_base.h>
|
||||
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include <base_units.h>
|
||||
|
||||
#include <gerbview.h>
|
||||
#include <gerbview_frame.h>
|
||||
#include <colors_selection.h>
|
||||
#include <class_gerber_draw_item.h>
|
||||
#include <class_GERBER.h>
|
||||
|
@ -46,11 +47,10 @@ void GERBVIEW_FRAME::PrintPage( wxDC* aDC, LSET aPrintMasklayer,
|
|||
bool aPrintMirrorMode, void* aData )
|
||||
{
|
||||
// Save current draw options, because print mode has specific options:
|
||||
LSET visiblemask = GetVisibleLayers();
|
||||
GBR_DISPLAY_OPTIONS imgDisplayOptions = m_DisplayOptions;
|
||||
std::bitset <GERBER_DRAWLAYERS_COUNT> printLayersMask = GetGerberLayout()->GetPrintableLayers();
|
||||
|
||||
// Set draw options for printing:
|
||||
SetVisibleLayers( aPrintMasklayer );
|
||||
m_DisplayOptions.m_DisplayFlashedItemsFill = true;
|
||||
m_DisplayOptions.m_DisplayLinesFill = true;
|
||||
m_DisplayOptions.m_DisplayPolygonsFill = true;
|
||||
|
@ -58,7 +58,10 @@ void GERBVIEW_FRAME::PrintPage( wxDC* aDC, LSET aPrintMasklayer,
|
|||
m_DisplayOptions.m_IsPrinting = true;
|
||||
|
||||
PRINT_PARAMETERS* printParameters = (PRINT_PARAMETERS*)aData;
|
||||
|
||||
std::bitset <GERBER_DRAWLAYERS_COUNT> printCurrLayerMask;
|
||||
printCurrLayerMask.reset();
|
||||
printCurrLayerMask.set(printParameters->m_Flags); // m_Flags contains the draw layer number
|
||||
GetGerberLayout()->SetPrintableLayers( printCurrLayerMask );
|
||||
m_canvas->SetPrintMirrored( aPrintMirrorMode );
|
||||
bool printBlackAndWhite = printParameters && printParameters->m_Print_Black_and_White;
|
||||
|
||||
|
@ -68,7 +71,7 @@ void GERBVIEW_FRAME::PrintPage( wxDC* aDC, LSET aPrintMasklayer,
|
|||
m_canvas->SetPrintMirrored( false );
|
||||
|
||||
// Restore draw options:
|
||||
SetVisibleLayers( visiblemask );
|
||||
GetGerberLayout()->SetPrintableLayers( printLayersMask );
|
||||
m_DisplayOptions = imgDisplayOptions;
|
||||
}
|
||||
|
||||
|
@ -202,14 +205,14 @@ void GBR_LAYOUT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMode,
|
|||
|
||||
bool end = false;
|
||||
|
||||
for( LAYER_NUM layer = FIRST_LAYER; !end; ++layer )
|
||||
for( int layer = 0; !end; ++layer )
|
||||
{
|
||||
LAYER_NUM active_layer = gerbFrame->getActiveLayer();
|
||||
int active_layer = gerbFrame->getActiveLayer();
|
||||
|
||||
if( layer == active_layer ) // active layer will be drawn after other layers
|
||||
continue;
|
||||
|
||||
if( layer == NB_GERBER_LAYERS ) // last loop: draw active layer
|
||||
if( layer == GERBER_DRAWLAYERS_COUNT ) // last loop: draw active layer
|
||||
{
|
||||
end = true;
|
||||
layer = active_layer;
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include <gestfich.h>
|
||||
|
||||
#include <gerbview.h>
|
||||
#include <gerbview_frame.h>
|
||||
#include <kicad_device_context.h>
|
||||
#include <gerbview_id.h>
|
||||
#include <class_GERBER.h>
|
||||
|
@ -226,7 +227,7 @@ void GERBVIEW_FRAME::OnSelectActiveDCode( wxCommandEvent& event )
|
|||
|
||||
void GERBVIEW_FRAME::OnSelectActiveLayer( wxCommandEvent& event )
|
||||
{
|
||||
LAYER_NUM layer = getActiveLayer();
|
||||
int layer = getActiveLayer();
|
||||
|
||||
setActiveLayer( event.GetSelection() );
|
||||
|
||||
|
@ -240,7 +241,7 @@ void GERBVIEW_FRAME::OnSelectActiveLayer( wxCommandEvent& event )
|
|||
|
||||
void GERBVIEW_FRAME::OnShowGerberSourceFile( wxCommandEvent& event )
|
||||
{
|
||||
LAYER_NUM layer = getActiveLayer();
|
||||
int layer = getActiveLayer();
|
||||
GERBER_IMAGE* gerber_layer = g_GERBER_List[layer];
|
||||
|
||||
if( gerber_layer )
|
||||
|
|
|
@ -67,6 +67,7 @@
|
|||
#include <confirm.h>
|
||||
|
||||
#include <gerbview.h>
|
||||
#include <gerbview_frame.h>
|
||||
#include <trigo.h>
|
||||
#include <macros.h>
|
||||
#include <base_units.h>
|
||||
|
@ -92,13 +93,13 @@ extern double ReadDouble( char*& text, bool aSkipSeparator = true );
|
|||
extern void fillFlashedGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
|
||||
APERTURE_T aAperture,
|
||||
int Dcode_index,
|
||||
LAYER_NUM aLayer,
|
||||
int aLayer,
|
||||
const wxPoint& aPos,
|
||||
wxSize aSize,
|
||||
bool aLayerNegative );
|
||||
void fillLineGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
|
||||
int Dcode_index,
|
||||
LAYER_NUM aLayer,
|
||||
int aLayer,
|
||||
const wxPoint& aStart,
|
||||
const wxPoint& aEnd,
|
||||
wxSize aPenSize,
|
||||
|
@ -167,7 +168,7 @@ static EXCELLON_CMD excellon_G_CmdList[] =
|
|||
bool GERBVIEW_FRAME::Read_EXCELLON_File( const wxString& aFullFileName )
|
||||
{
|
||||
wxString msg;
|
||||
LAYER_NUM layer = getActiveLayer(); // current layer used in GerbView
|
||||
int layer = getActiveLayer(); // current layer used in GerbView
|
||||
|
||||
if( g_GERBER_List[layer] == NULL )
|
||||
{
|
||||
|
|
|
@ -7,13 +7,13 @@
|
|||
|
||||
#include <fctsys.h>
|
||||
#include <common.h>
|
||||
// #include <class_drawpanel.h>
|
||||
#include <confirm.h>
|
||||
#include <macros.h>
|
||||
#include <kicad_string.h>
|
||||
#include <gestfich.h>
|
||||
#include <trigo.h>
|
||||
#include <gerbview.h>
|
||||
#include <gerbview_frame.h>
|
||||
#include <class_gerber_draw_item.h>
|
||||
#include <select_layers_to_pcb.h>
|
||||
#include <build_version.h>
|
||||
|
@ -123,7 +123,7 @@ void GERBVIEW_FRAME::ExportDataInPcbnewFormat( wxCommandEvent& event )
|
|||
int layercount = 0;
|
||||
|
||||
// Count the Gerber layers which are actually currently used
|
||||
for( LAYER_NUM ii = FIRST_LAYER; ii < NB_GERBER_LAYERS; ++ii )
|
||||
for( LAYER_NUM ii = 0; ii < GERBER_DRAWLAYERS_COUNT; ++ii )
|
||||
{
|
||||
if( g_GERBER_List[ii] != NULL )
|
||||
layercount++;
|
||||
|
@ -190,16 +190,17 @@ bool GBR_TO_PCB_EXPORTER::ExportPcb( LAYER_NUM* LayerLookUpTable, int aCopperLay
|
|||
// create an image of gerber data
|
||||
// First: non copper layers:
|
||||
GERBER_DRAW_ITEM* gerb_item = m_gerbview_frame->GetItemsList();
|
||||
int pcbCopperLayerMax = 31;
|
||||
|
||||
for( ; gerb_item; gerb_item = gerb_item->Next() )
|
||||
{
|
||||
LAYER_NUM layer = gerb_item->GetLayer();
|
||||
int layer = gerb_item->GetLayer();
|
||||
LAYER_NUM pcb_layer_number = LayerLookUpTable[layer];
|
||||
|
||||
if( !IsPcbLayer( pcb_layer_number ) )
|
||||
continue;
|
||||
|
||||
if( pcb_layer_number > LAST_COPPER_LAYER )
|
||||
if( pcb_layer_number > pcbCopperLayerMax )
|
||||
export_non_copper_item( gerb_item, pcb_layer_number );
|
||||
}
|
||||
|
||||
|
@ -209,10 +210,10 @@ bool GBR_TO_PCB_EXPORTER::ExportPcb( LAYER_NUM* LayerLookUpTable, int aCopperLay
|
|||
|
||||
for( ; gerb_item; gerb_item = gerb_item->Next() )
|
||||
{
|
||||
LAYER_NUM layer = gerb_item->GetLayer();
|
||||
int layer = gerb_item->GetLayer();
|
||||
LAYER_NUM pcb_layer_number = LayerLookUpTable[layer];
|
||||
|
||||
if( pcb_layer_number < 0 || pcb_layer_number > LAST_COPPER_LAYER )
|
||||
if( pcb_layer_number < 0 || pcb_layer_number > pcbCopperLayerMax )
|
||||
continue;
|
||||
|
||||
else
|
||||
|
@ -398,13 +399,7 @@ void GBR_TO_PCB_EXPORTER::writePcbHeader()
|
|||
|
||||
// Write copper layer count
|
||||
fprintf( m_fp, "LayerCount %d\n", m_pcbCopperLayersCount );
|
||||
// Write enabled layer mask:
|
||||
int lmask = ALL_NO_CU_LAYERS | EXTERNAL_CU_LAYERS;
|
||||
|
||||
for( int ii = 0; ii < m_pcbCopperLayersCount - 2; ii++ )
|
||||
lmask |= 2 << ii;
|
||||
|
||||
fprintf( m_fp, "EnabledLayers %08X\n", lmask );
|
||||
fprintf( m_fp, "$EndGENERAL\n\n" );
|
||||
|
||||
// Creates void setup
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include <gestfich.h>
|
||||
|
||||
#include <gerbview.h>
|
||||
#include <gerbview_frame.h>
|
||||
#include <gerbview_id.h>
|
||||
#include <class_gerbview_layer_widget.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
|
@ -163,7 +164,7 @@ bool GERBVIEW_FRAME::LoadGerberFiles( const wxString& aFullFileName )
|
|||
}
|
||||
|
||||
// Read gerber files: each file is loaded on a new GerbView layer
|
||||
LAYER_NUM layer = getActiveLayer();
|
||||
int layer = getActiveLayer();
|
||||
|
||||
for( unsigned ii = 0; ii < filenamesList.GetCount(); ii++ )
|
||||
{
|
||||
|
@ -244,7 +245,7 @@ bool GERBVIEW_FRAME::LoadExcellonFiles( const wxString& aFullFileName )
|
|||
}
|
||||
|
||||
// Read gerber files: each file is loaded on a new GerbView layer
|
||||
LAYER_NUM layer = getActiveLayer();
|
||||
int layer = getActiveLayer();
|
||||
|
||||
for( unsigned ii = 0; ii < filenamesList.GetCount(); ii++ )
|
||||
{
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include <gerbview.h>
|
||||
#include <gerbview_id.h>
|
||||
#include <hotkeys.h>
|
||||
#include <gerbview_frame.h>
|
||||
|
||||
#include <build_version.h>
|
||||
|
||||
|
|
|
@ -8,9 +8,6 @@
|
|||
#include <vector>
|
||||
#include <set>
|
||||
|
||||
#include <dcode.h>
|
||||
#include <class_gerber_draw_item.h>
|
||||
#include <class_aperture_macro.h>
|
||||
|
||||
#define CURSEUR_ON_GRILLE 0
|
||||
#define CURSEUR_OFF_GRILLE 1
|
||||
|
@ -32,6 +29,8 @@ extern const wxChar* g_GerberPageSizeList[8];
|
|||
#define GERB_STOP_DRAW 2 // Extinguish light (lift pen)
|
||||
#define GERB_FLASH 3 // Flash
|
||||
|
||||
// number fo draw layers in Gerbview
|
||||
#define GERBER_DRAWLAYERS_COUNT 32
|
||||
|
||||
/**
|
||||
* Enum GERBER_VISIBLE_ID
|
||||
|
@ -47,9 +46,6 @@ enum GERBER_VISIBLE_ID
|
|||
END_GERBER_VISIBLE_LIST // sentinel
|
||||
};
|
||||
|
||||
extern const wxString GerbviewProjectFileExt;
|
||||
extern const wxString GerbviewProjectFileWildcard;
|
||||
|
||||
// Interpolation type
|
||||
enum Gerb_Interpolation
|
||||
{
|
||||
|
@ -93,13 +89,6 @@ enum Gerb_Analyse_Cmd
|
|||
ENTER_RS274X_CMD
|
||||
};
|
||||
|
||||
|
||||
/**************/
|
||||
/* rs274x.cpp */
|
||||
/**************/
|
||||
bool GetEndOfBlock( char buff[GERBER_BUFZ], char*& text, FILE* gerber_file );
|
||||
extern GERBER_IMAGE* g_GERBER_List[32];
|
||||
|
||||
#include <gerbview_frame.h>
|
||||
extern GERBER_IMAGE* g_GERBER_List[GERBER_DRAWLAYERS_COUNT];
|
||||
|
||||
#endif // ifndef GERBVIEW_H
|
||||
|
|
|
@ -38,14 +38,13 @@
|
|||
#include <colors_selection.h>
|
||||
|
||||
#include <gerbview.h>
|
||||
#include <gerbview_frame.h>
|
||||
#include <hotkeys.h>
|
||||
#include <dialog_hotkeys_editor.h>
|
||||
|
||||
|
||||
#define GROUP wxT("/gerbview")
|
||||
|
||||
#define INSETUP true
|
||||
|
||||
|
||||
void GERBVIEW_FRAME::Process_Config( wxCommandEvent& event )
|
||||
{
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
//#include <pgm_base.h>
|
||||
#include <kiface_i.h>
|
||||
#include <wxstruct.h>
|
||||
#include <class_drawpanel.h>
|
||||
|
@ -40,6 +39,7 @@
|
|||
#include <msgpanel.h>
|
||||
|
||||
#include <gerbview.h>
|
||||
#include <gerbview_frame.h>
|
||||
#include <class_gerber_draw_item.h>
|
||||
#include <pcbplot.h>
|
||||
#include <gerbview_id.h>
|
||||
|
@ -92,7 +92,7 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ):
|
|||
|
||||
SetLayout( new GBR_LAYOUT() );
|
||||
|
||||
SetVisibleLayers( FULL_LAYERS ); // All 32 layers visible.
|
||||
SetVisibleLayers( -1 ); // All draw layers visible.
|
||||
|
||||
SetScreen( new GBR_SCREEN( GetGerberLayout()->GetPageSettings().GetSizeIU() ) );
|
||||
|
||||
|
@ -167,6 +167,7 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ):
|
|||
m_LayersManager->ReFillRender(); // Update colors in Render after the config is read
|
||||
m_auimgr.Update();
|
||||
|
||||
setActiveLayer( 0, true );
|
||||
Zoom_Automatique( true ); // Gives a default zoom value
|
||||
}
|
||||
|
||||
|
@ -184,9 +185,9 @@ void GERBVIEW_FRAME::OnCloseWindow( wxCloseEvent& Event )
|
|||
|
||||
bool GERBVIEW_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl )
|
||||
{
|
||||
const unsigned limit = std::min( unsigned( aFileSet.size() ), unsigned( NB_GERBER_LAYERS ) );
|
||||
const unsigned limit = std::min( unsigned( aFileSet.size() ), unsigned( GERBER_DRAWLAYERS_COUNT ) );
|
||||
|
||||
LAYER_NUM layer = FIRST_LAYER;
|
||||
int layer = 0;
|
||||
|
||||
for( unsigned i=0; i<limit; ++i, ++layer )
|
||||
{
|
||||
|
@ -338,11 +339,11 @@ void GERBVIEW_FRAME::SetElementVisibility( GERBER_VISIBLE_ID aItemIdVisible,
|
|||
}
|
||||
|
||||
|
||||
LAYER_NUM GERBVIEW_FRAME::getNextAvailableLayer( LAYER_NUM aLayer ) const
|
||||
int GERBVIEW_FRAME::getNextAvailableLayer( int aLayer ) const
|
||||
{
|
||||
LAYER_NUM layer = aLayer;
|
||||
int layer = aLayer;
|
||||
|
||||
for( LAYER_NUM i = FIRST_LAYER; i < NB_GERBER_LAYERS; ++i )
|
||||
for( int i = 0; i < GERBER_DRAWLAYERS_COUNT; ++i )
|
||||
{
|
||||
GERBER_IMAGE* gerber = g_GERBER_List[ layer ];
|
||||
|
||||
|
@ -351,8 +352,8 @@ LAYER_NUM GERBVIEW_FRAME::getNextAvailableLayer( LAYER_NUM aLayer ) const
|
|||
|
||||
++layer;
|
||||
|
||||
if( layer >= NB_GERBER_LAYERS )
|
||||
layer = FIRST_LAYER;
|
||||
if( layer >= GERBER_DRAWLAYERS_COUNT )
|
||||
layer = 0;
|
||||
}
|
||||
|
||||
return NO_AVAILABLE_LAYERS;
|
||||
|
@ -398,9 +399,9 @@ void GERBVIEW_FRAME::Liste_D_Codes()
|
|||
wxArrayString list;
|
||||
double scale = g_UserUnit == INCHES ? IU_PER_MILS * 1000 :
|
||||
IU_PER_MM;
|
||||
LAYER_NUM curr_layer = getActiveLayer();
|
||||
int curr_layer = getActiveLayer();
|
||||
|
||||
for( LAYER_NUM layer = FIRST_LAYER; layer < NB_LAYERS; ++layer )
|
||||
for( int layer = 0; layer < GERBER_DRAWLAYERS_COUNT; ++layer )
|
||||
{
|
||||
GERBER_IMAGE* gerber = g_GERBER_List[layer];
|
||||
|
||||
|
@ -551,9 +552,9 @@ void GERBVIEW_FRAME::SetVisibleAlls()
|
|||
* Returns a bit-mask of all the layers that are visible
|
||||
* @return int - the visible layers in bit-mapped form.
|
||||
*/
|
||||
LSET GERBVIEW_FRAME::GetVisibleLayers() const
|
||||
long GERBVIEW_FRAME::GetVisibleLayers() const
|
||||
{
|
||||
return FULL_LAYERS; // TODO
|
||||
return -1; // TODO
|
||||
}
|
||||
|
||||
|
||||
|
@ -563,9 +564,9 @@ LSET GERBVIEW_FRAME::GetVisibleLayers() const
|
|||
* changes the bit-mask of visible layers
|
||||
* @param aLayerMask = The new bit-mask of visible layers
|
||||
*/
|
||||
void GERBVIEW_FRAME::SetVisibleLayers( LSET aLayerMask )
|
||||
void GERBVIEW_FRAME::SetVisibleLayers( long aLayerMask )
|
||||
{
|
||||
GetGerberLayout()->SetVisibleLayers( aLayerMask );
|
||||
// GetGerberLayout()->SetVisibleLayers( aLayerMask );
|
||||
}
|
||||
|
||||
|
||||
|
@ -575,12 +576,12 @@ void GERBVIEW_FRAME::SetVisibleLayers( LSET aLayerMask )
|
|||
* @param aLayer = The layer to be tested
|
||||
* @return bool - true if the layer is visible.
|
||||
*/
|
||||
bool GERBVIEW_FRAME::IsLayerVisible( LAYER_NUM aLayer ) const
|
||||
bool GERBVIEW_FRAME::IsLayerVisible( int aLayer ) const
|
||||
{
|
||||
if( ! m_DisplayOptions.m_IsPrinting )
|
||||
return m_LayersManager->IsLayerVisible( aLayer );
|
||||
else
|
||||
return GetGerberLayout()->IsLayerVisible( aLayer );
|
||||
return GetGerberLayout()->IsLayerPrintable( aLayer );
|
||||
}
|
||||
|
||||
|
||||
|
@ -664,7 +665,7 @@ EDA_COLOR_T GERBVIEW_FRAME::GetNegativeItemsColor() const
|
|||
* Function GetLayerColor
|
||||
* gets a layer color for any valid layer.
|
||||
*/
|
||||
EDA_COLOR_T GERBVIEW_FRAME::GetLayerColor( LAYER_NUM aLayer ) const
|
||||
EDA_COLOR_T GERBVIEW_FRAME::GetLayerColor( int aLayer ) const
|
||||
{
|
||||
return m_colorsSettings->GetLayerColor( aLayer );
|
||||
}
|
||||
|
@ -674,7 +675,7 @@ EDA_COLOR_T GERBVIEW_FRAME::GetLayerColor( LAYER_NUM aLayer ) const
|
|||
* Function SetLayerColor
|
||||
* changes a layer color for any valid layer.
|
||||
*/
|
||||
void GERBVIEW_FRAME::SetLayerColor( LAYER_NUM aLayer, EDA_COLOR_T aColor )
|
||||
void GERBVIEW_FRAME::SetLayerColor( int aLayer, EDA_COLOR_T aColor )
|
||||
{
|
||||
m_colorsSettings->SetLayerColor( aLayer, aColor );
|
||||
}
|
||||
|
@ -684,7 +685,7 @@ void GERBVIEW_FRAME::SetLayerColor( LAYER_NUM aLayer, EDA_COLOR_T aColor )
|
|||
* Function getActiveLayer
|
||||
* returns the active layer
|
||||
*/
|
||||
LAYER_NUM GERBVIEW_FRAME::getActiveLayer()
|
||||
int GERBVIEW_FRAME::getActiveLayer()
|
||||
{
|
||||
return ( (GBR_SCREEN*) GetScreen() )->m_Active_Layer;
|
||||
}
|
||||
|
@ -695,7 +696,7 @@ LAYER_NUM GERBVIEW_FRAME::getActiveLayer()
|
|||
* will change the currently active layer to \a aLayer and also
|
||||
* update the PCB_LAYER_WIDGET.
|
||||
*/
|
||||
void GERBVIEW_FRAME::setActiveLayer( LAYER_NUM aLayer, bool doLayerWidgetUpdate )
|
||||
void GERBVIEW_FRAME::setActiveLayer( int aLayer, bool doLayerWidgetUpdate )
|
||||
{
|
||||
( (GBR_SCREEN*) GetScreen() )->m_Active_Layer = aLayer;
|
||||
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
#include <gerbview.h>
|
||||
#include <class_gbr_layout.h>
|
||||
#include <class_gbr_screen.h>
|
||||
#include <layers_id_colors_and_visibility.h>
|
||||
|
||||
#define NO_AVAILABLE_LAYERS UNDEFINED_LAYER
|
||||
|
||||
|
@ -167,7 +166,7 @@ public:
|
|||
* different radiobutton is clicked on) prior to then clicking on the "Deselect"
|
||||
* button provided within the "Layer selection:" dialog box).
|
||||
*/
|
||||
LAYER_NUM SelectPCBLayer( LAYER_NUM aDefaultLayer, int aOpperLayerCount, bool aNullLayer = false );
|
||||
int SelectPCBLayer( int aDefaultLayer, int aOpperLayerCount, bool aNullLayer = false );
|
||||
|
||||
protected:
|
||||
GERBER_LAYER_WIDGET* m_LayersManager;
|
||||
|
@ -306,9 +305,9 @@ public:
|
|||
* Function GetVisibleLayers
|
||||
* is a proxy function that calls the correspondent function in m_BoardSettings
|
||||
* Returns a bit-mask of all the layers that are visible
|
||||
* @return int - the visible layers in bit-mapped form.
|
||||
* @return long - the visible layers in bit-mapped form.
|
||||
*/
|
||||
LSET GetVisibleLayers() const;
|
||||
long GetVisibleLayers() const;
|
||||
|
||||
/**
|
||||
* Function SetVisibleLayers
|
||||
|
@ -316,7 +315,7 @@ public:
|
|||
* changes the bit-mask of visible layers
|
||||
* @param aLayerMask = The new bit-mask of visible layers
|
||||
*/
|
||||
void SetVisibleLayers( LSET aLayerMask );
|
||||
void SetVisibleLayers( long aLayerMask );
|
||||
|
||||
/**
|
||||
* Function IsLayerVisible
|
||||
|
@ -324,7 +323,7 @@ public:
|
|||
* @param aLayer = The layer to be tested
|
||||
* @return bool - true if the layer is visible.
|
||||
*/
|
||||
bool IsLayerVisible( LAYER_NUM aLayer ) const;
|
||||
bool IsLayerVisible( int aLayer ) const;
|
||||
|
||||
/**
|
||||
* Function GetVisibleElementColor
|
||||
|
@ -338,13 +337,13 @@ public:
|
|||
* Function GetLayerColor
|
||||
* gets a layer color for any valid layer.
|
||||
*/
|
||||
EDA_COLOR_T GetLayerColor( LAYER_NUM aLayer ) const;
|
||||
EDA_COLOR_T GetLayerColor( int aLayer ) const;
|
||||
|
||||
/**
|
||||
* Function SetLayerColor
|
||||
* changes a layer color for any valid layer.
|
||||
*/
|
||||
void SetLayerColor( LAYER_NUM aLayer, EDA_COLOR_T aColor );
|
||||
void SetLayerColor( int aLayer, EDA_COLOR_T aColor );
|
||||
|
||||
/**
|
||||
* Function GetNegativeItemsColor
|
||||
|
@ -396,13 +395,13 @@ public:
|
|||
* will change the currently active layer to \a aLayer and also
|
||||
* update the GERBER_LAYER_WIDGET.
|
||||
*/
|
||||
void setActiveLayer( LAYER_NUM aLayer, bool doLayerWidgetUpdate = true );
|
||||
void setActiveLayer( int aLayer, bool doLayerWidgetUpdate = true );
|
||||
|
||||
/**
|
||||
* Function getActiveLayer
|
||||
* returns the active layer
|
||||
*/
|
||||
LAYER_NUM getActiveLayer();
|
||||
int getActiveLayer();
|
||||
|
||||
/**
|
||||
* Function getNextAvailableLayer
|
||||
|
@ -411,7 +410,7 @@ public:
|
|||
* @param aLayer The first layer to search.
|
||||
* @return The first empty layer found or NO_AVAILABLE_LAYERS.
|
||||
*/
|
||||
LAYER_NUM getNextAvailableLayer( LAYER_NUM aLayer = FIRST_LAYER ) const;
|
||||
int getNextAvailableLayer( int aLayer = 0 ) const;
|
||||
|
||||
bool hasAvailableLayers() const
|
||||
{
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <id.h>
|
||||
|
||||
#include <gerbview.h>
|
||||
#include <gerbview_frame.h>
|
||||
#include <class_drawpanel.h>
|
||||
#include <hotkeys.h>
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include <confirm.h>
|
||||
|
||||
#include <gerbview.h>
|
||||
#include <gerbview_frame.h>
|
||||
#include <class_gerber_draw_item.h>
|
||||
#include <class_GERBER.h>
|
||||
#include <class_gerbview_layer_widget.h>
|
||||
|
@ -39,7 +40,7 @@
|
|||
|
||||
bool GERBVIEW_FRAME::Clear_Pcb( bool query )
|
||||
{
|
||||
LAYER_NUM layer;
|
||||
int layer;
|
||||
|
||||
if( GetGerberLayout() == NULL )
|
||||
return false;
|
||||
|
@ -52,7 +53,7 @@ bool GERBVIEW_FRAME::Clear_Pcb( bool query )
|
|||
|
||||
GetGerberLayout()->m_Drawings.DeleteAll();
|
||||
|
||||
for( layer = FIRST_LAYER; layer < NB_GERBER_LAYERS; ++layer )
|
||||
for( layer = 0; layer < GERBER_DRAWLAYERS_COUNT; ++layer )
|
||||
{
|
||||
if( g_GERBER_List[layer] )
|
||||
{
|
||||
|
@ -65,7 +66,7 @@ bool GERBVIEW_FRAME::Clear_Pcb( bool query )
|
|||
|
||||
SetScreen( new GBR_SCREEN( GetPageSettings().GetSizeIU() ) );
|
||||
|
||||
setActiveLayer( FIRST_LAYER );
|
||||
setActiveLayer( 0 );
|
||||
m_LayersManager->UpdateLayerIcons();
|
||||
syncLayerBox();
|
||||
return true;
|
||||
|
@ -74,7 +75,7 @@ bool GERBVIEW_FRAME::Clear_Pcb( bool query )
|
|||
|
||||
void GERBVIEW_FRAME::Erase_Current_Layer( bool query )
|
||||
{
|
||||
LAYER_NUM layer = getActiveLayer();
|
||||
int layer = getActiveLayer();
|
||||
wxString msg;
|
||||
|
||||
msg.Printf( _( "Clear layer %d?" ), layer + 1 );
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include <msgpanel.h>
|
||||
|
||||
#include <gerbview.h>
|
||||
#include <gerbview_frame.h>
|
||||
#include <class_gerber_draw_item.h>
|
||||
|
||||
|
||||
|
@ -46,7 +47,7 @@ GERBER_DRAW_ITEM* GERBVIEW_FRAME::Locate( const wxPoint& aPosition, int aTypeloc
|
|||
if( aTypeloc == CURSEUR_ON_GRILLE )
|
||||
ref = GetNearestGridPosition( ref );
|
||||
|
||||
LAYER_NUM layer = getActiveLayer();
|
||||
int layer = getActiveLayer();
|
||||
|
||||
// Search first on active layer
|
||||
GERBER_DRAW_ITEM* gerb_item = GetItemsList();
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include <pgm_base.h>
|
||||
#include <kiface_i.h>
|
||||
#include <gerbview.h>
|
||||
#include <gerbview_frame.h>
|
||||
#include <gerbview_id.h>
|
||||
#include <hotkeys.h>
|
||||
#include <menus_helpers.h>
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include <common.h>
|
||||
|
||||
#include <gerbview.h>
|
||||
#include <gerbview_frame.h>
|
||||
#include <gerbview_id.h>
|
||||
#include <class_GERBER.h>
|
||||
#include <dialog_helpers.h>
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <id.h>
|
||||
|
||||
#include <gerbview.h>
|
||||
#include <gerbview_frame.h>
|
||||
#include <menus_helpers.h>
|
||||
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include <common.h>
|
||||
|
||||
#include <gerbview.h>
|
||||
#include <gerbview_frame.h>
|
||||
#include <pcbplot.h>
|
||||
|
||||
/** TODO */
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <kicad_string.h>
|
||||
#include <gestfich.h>
|
||||
#include <gerbview.h>
|
||||
#include <gerbview_frame.h>
|
||||
#include <class_GERBER.h>
|
||||
|
||||
#include <html_messagebox.h>
|
||||
|
@ -25,7 +26,7 @@ bool GERBVIEW_FRAME::Read_GERBER_File( const wxString& GERBER_FullFileName,
|
|||
|
||||
wxString msg;
|
||||
char* text;
|
||||
LAYER_NUM layer; // current layer used in GerbView
|
||||
int layer; // current layer used in GerbView
|
||||
|
||||
layer = getActiveLayer();
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include <common.h>
|
||||
|
||||
#include <gerbview.h>
|
||||
#include <gerbview_frame.h>
|
||||
#include <trigo.h>
|
||||
#include <macros.h>
|
||||
#include <class_gerber_draw_item.h>
|
||||
|
@ -107,7 +108,7 @@
|
|||
void fillFlashedGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
|
||||
APERTURE_T aAperture,
|
||||
int Dcode_index,
|
||||
LAYER_NUM aLayer,
|
||||
int aLayer,
|
||||
const wxPoint& aPos,
|
||||
wxSize aSize,
|
||||
bool aLayerNegative )
|
||||
|
@ -159,7 +160,7 @@ void fillFlashedGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
|
|||
*/
|
||||
void fillLineGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
|
||||
int Dcode_index,
|
||||
LAYER_NUM aLayer,
|
||||
int aLayer,
|
||||
const wxPoint& aStart,
|
||||
const wxPoint& aEnd,
|
||||
wxSize aPenSize,
|
||||
|
@ -208,7 +209,7 @@ void fillLineGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
|
|||
* false when arc is inside one quadrant
|
||||
* @param aLayerNegative = true if the current layer is negative
|
||||
*/
|
||||
static void fillArcGBRITEM( GERBER_DRAW_ITEM* aGbrItem, int Dcode_index, LAYER_NUM aLayer,
|
||||
static void fillArcGBRITEM( GERBER_DRAW_ITEM* aGbrItem, int Dcode_index, int aLayer,
|
||||
const wxPoint& aStart, const wxPoint& aEnd,
|
||||
const wxPoint& aRelCenter, wxSize aPenSize,
|
||||
bool aClockwise, bool aMultiquadrant,
|
||||
|
@ -344,10 +345,11 @@ static void fillArcPOLY( GERBER_DRAW_ITEM* aGbrItem,
|
|||
* so we muse create a dummy track and use its geometric parameters
|
||||
*/
|
||||
static GERBER_DRAW_ITEM dummyGbrItem( NULL, NULL );
|
||||
static const int drawlayer = 0;
|
||||
|
||||
aGbrItem->SetLayerPolarity( aLayerNegative );
|
||||
|
||||
fillArcGBRITEM( &dummyGbrItem, 0, FIRST_LAYER,
|
||||
fillArcGBRITEM( &dummyGbrItem, 0, drawlayer,
|
||||
aStart, aEnd, rel_center, wxSize(0, 0),
|
||||
aClockwise, aMultiquadrant, aLayerNegative );
|
||||
|
||||
|
@ -568,7 +570,7 @@ bool GERBER_IMAGE::Execute_DCODE_Command( char*& text, int D_commande )
|
|||
GERBER_DRAW_ITEM* gbritem;
|
||||
GBR_LAYOUT* layout = m_Parent->GetGerberLayout();
|
||||
|
||||
LAYER_NUM activeLayer = m_Parent->getActiveLayer();
|
||||
int activeLayer = m_Parent->getActiveLayer();
|
||||
|
||||
int dcode = 0;
|
||||
D_CODE* tool = NULL;
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
extern int ReadInt( char*& text, bool aSkipSeparator = true );
|
||||
extern double ReadDouble( char*& text, bool aSkipSeparator = true );
|
||||
extern bool GetEndOfBlock( char buff[GERBER_BUFZ], char*& text, FILE* gerber_file );
|
||||
|
||||
|
||||
#define CODE( x, y ) ( ( (x) << 8 ) + (y) )
|
||||
|
|
|
@ -27,9 +27,9 @@
|
|||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
//#include <pgm_base.h>
|
||||
#include <kiface_i.h>
|
||||
#include <gerbview.h>
|
||||
#include <gerbview_frame.h>
|
||||
#include <gerbview_id.h>
|
||||
#include <class_GERBER.h>
|
||||
|
||||
|
@ -41,7 +41,7 @@ extern const wxString GetPCBDefaultLayerName( LAYER_NUM aLayerNumber );
|
|||
enum swap_layer_id {
|
||||
ID_LAYERS_MAP_DIALOG = ID_GERBER_END_LIST,
|
||||
ID_BUTTON_0,
|
||||
ID_TEXT_0 = ID_BUTTON_0 + NB_GERBER_LAYERS
|
||||
ID_TEXT_0 = ID_BUTTON_0 + GERBER_DRAWLAYERS_COUNT
|
||||
};
|
||||
|
||||
|
||||
|
@ -55,7 +55,7 @@ int LAYERS_MAP_DIALOG::m_exportBoardCopperLayersCount = 2;
|
|||
|
||||
|
||||
BEGIN_EVENT_TABLE( LAYERS_MAP_DIALOG, LAYERS_MAP_DIALOG_BASE )
|
||||
EVT_COMMAND_RANGE( ID_BUTTON_0, ID_BUTTON_0 + NB_GERBER_LAYERS-1,
|
||||
EVT_COMMAND_RANGE( ID_BUTTON_0, ID_BUTTON_0 + GERBER_DRAWLAYERS_COUNT-1,
|
||||
wxEVT_COMMAND_BUTTON_CLICKED,
|
||||
LAYERS_MAP_DIALOG::OnSelectLayer )
|
||||
END_EVENT_TABLE()
|
||||
|
@ -102,8 +102,7 @@ void LAYERS_MAP_DIALOG::initDialog()
|
|||
// version are also 26 pixels wide and 26 pixels high. If appropriate,
|
||||
// the above code should be modified as required in the event that those
|
||||
// buttons should be some other size in that version.
|
||||
|
||||
for( LAYER_NUM ii = FIRST_LAYER; ii < NB_GERBER_LAYERS; ++ii )
|
||||
for( int ii = 0; ii < GERBER_DRAWLAYERS_COUNT; ++ii )
|
||||
{
|
||||
// Specify the default value for each member of these arrays.
|
||||
m_buttonTable[ii] = -1;
|
||||
|
@ -111,32 +110,31 @@ void LAYERS_MAP_DIALOG::initDialog()
|
|||
}
|
||||
|
||||
// Ensure we have:
|
||||
// at least 2 copper layers and BOARD_COPPER_LAYERS_MAX_COUNT copper layers max
|
||||
// at least 2 copper layers and less than max pacb copper layers count
|
||||
// and even layers count because a board *must* have even layers count
|
||||
// and maxi BOARD_COPPER_LAYERS_MAX_COUNT copper layers count
|
||||
normalizeBrdLayersCount();
|
||||
|
||||
int idx = ( m_exportBoardCopperLayersCount / 2 ) - 1;
|
||||
m_comboCopperLayersCount->SetSelection( idx );
|
||||
|
||||
LAYER_NUM pcb_layer_num = FIRST_LAYER;
|
||||
m_itemsCount = 0;
|
||||
for( LAYER_NUM ii = FIRST_LAYER; ii < NB_GERBER_LAYERS; ++ii )
|
||||
LAYER_NUM pcb_layer_num = 0;
|
||||
m_gerberActiveLayersCount = 0;
|
||||
for( int ii = 0; ii < GERBER_DRAWLAYERS_COUNT; ++ii )
|
||||
{
|
||||
if( g_GERBER_List[ii] == NULL )
|
||||
continue;
|
||||
break;
|
||||
|
||||
if( (pcb_layer_num == m_exportBoardCopperLayersCount - 1)
|
||||
&& (m_exportBoardCopperLayersCount > 1) )
|
||||
pcb_layer_num = F_Cu;
|
||||
|
||||
m_buttonTable[m_itemsCount] = ii;
|
||||
m_buttonTable[m_gerberActiveLayersCount] = ii;
|
||||
m_layersLookUpTable[ii] = pcb_layer_num;
|
||||
m_itemsCount++;
|
||||
m_gerberActiveLayersCount++;
|
||||
++pcb_layer_num;
|
||||
}
|
||||
|
||||
if( m_itemsCount <= NB_GERBER_LAYERS/2 ) // Only one list is enough
|
||||
if( m_gerberActiveLayersCount <= GERBER_DRAWLAYERS_COUNT/2 ) // Only one list is enough
|
||||
{
|
||||
m_staticlineSep->Hide();
|
||||
}
|
||||
|
@ -151,7 +149,7 @@ void LAYERS_MAP_DIALOG::initDialog()
|
|||
}
|
||||
|
||||
wxFlexGridSizer* flexColumnBoxSizer = m_flexLeftColumnBoxSizer;
|
||||
for( int ii = 0; ii < m_itemsCount; ii++ )
|
||||
for( int ii = 0; ii < m_gerberActiveLayersCount; ii++ )
|
||||
{
|
||||
// Each Gerber layer has an associated static text string (to
|
||||
// identify that layer), a button (for invoking a child dialog
|
||||
|
@ -178,7 +176,7 @@ void LAYERS_MAP_DIALOG::initDialog()
|
|||
// is nb_items; otherwise, the number of rows is 16 (with two
|
||||
// separate columns of controls being used if nb_items > 16).
|
||||
|
||||
if( ii == NB_GERBER_LAYERS/2 )
|
||||
if( ii == GERBER_DRAWLAYERS_COUNT/2 )
|
||||
flexColumnBoxSizer = m_flexRightColumnBoxSizer;
|
||||
|
||||
// Provide a text string to identify the Gerber layer
|
||||
|
@ -226,7 +224,7 @@ void LAYERS_MAP_DIALOG::initDialog()
|
|||
wxDefaultSize, 0 );
|
||||
goodSize = text->GetSize();
|
||||
|
||||
for( LAYER_NUM jj = FIRST_LAYER; jj < NB_LAYERS; ++jj )
|
||||
for( LAYER_NUM jj = 0; jj < GERBER_DRAWLAYERS_COUNT; ++jj )
|
||||
{
|
||||
text->SetLabel( GetPCBDefaultLayerName( jj ) );
|
||||
if( goodSize.x < text->GetSize().x )
|
||||
|
@ -259,8 +257,8 @@ void LAYERS_MAP_DIALOG::normalizeBrdLayersCount()
|
|||
if( ( m_exportBoardCopperLayersCount & 1 ) )
|
||||
m_exportBoardCopperLayersCount++;
|
||||
|
||||
if( m_exportBoardCopperLayersCount > NB_LAYERS )
|
||||
m_exportBoardCopperLayersCount = NB_LAYERS;
|
||||
if( m_exportBoardCopperLayersCount > GERBER_DRAWLAYERS_COUNT )
|
||||
m_exportBoardCopperLayersCount = GERBER_DRAWLAYERS_COUNT;
|
||||
|
||||
if( m_exportBoardCopperLayersCount < 2 )
|
||||
m_exportBoardCopperLayersCount = 2;
|
||||
|
@ -284,7 +282,7 @@ void LAYERS_MAP_DIALOG::OnResetClick( wxCommandEvent& event )
|
|||
wxString msg;
|
||||
int ii;
|
||||
LAYER_NUM layer;
|
||||
for( ii = 0, layer = FIRST_LAYER; ii < m_itemsCount; ii++, ++layer )
|
||||
for( ii = 0, layer = 0; ii < m_gerberActiveLayersCount; ii++, ++layer )
|
||||
{
|
||||
if( (layer == m_exportBoardCopperLayersCount - 1)
|
||||
&& (m_exportBoardCopperLayersCount > 1) )
|
||||
|
@ -306,7 +304,7 @@ void LAYERS_MAP_DIALOG::OnStoreSetup( wxCommandEvent& event )
|
|||
config->Write( wxT("BrdLayersCount"), m_exportBoardCopperLayersCount );
|
||||
|
||||
wxString key;
|
||||
for( LAYER_NUM ii = FIRST_LAYER; ii < NB_GERBER_LAYERS; ++ii )
|
||||
for( int ii = 0; ii < GERBER_DRAWLAYERS_COUNT; ++ii )
|
||||
{
|
||||
key.Printf( wxT("GbrLyr%dToPcb"), ii );
|
||||
config->Write( key, m_layersLookUpTable[ii] );
|
||||
|
@ -324,7 +322,7 @@ void LAYERS_MAP_DIALOG::OnGetSetup( wxCommandEvent& event )
|
|||
m_comboCopperLayersCount->SetSelection( idx );
|
||||
|
||||
wxString key;
|
||||
for( LAYER_NUM ii = FIRST_LAYER; ii < NB_GERBER_LAYERS; ++ii )
|
||||
for( int ii = 0; ii < GERBER_DRAWLAYERS_COUNT; ++ii )
|
||||
{
|
||||
key.Printf( wxT("GbrLyr%dToPcb"), ii );
|
||||
int ilayer;
|
||||
|
@ -332,7 +330,7 @@ void LAYERS_MAP_DIALOG::OnGetSetup( wxCommandEvent& event )
|
|||
m_layersLookUpTable[ii] = ilayer;
|
||||
}
|
||||
|
||||
for( int ii = 0; ii < m_itemsCount; ii++ )
|
||||
for( int ii = 0; ii < m_gerberActiveLayersCount; ii++ )
|
||||
{
|
||||
LAYER_NUM layer = m_layersLookUpTable[ii];
|
||||
if( layer == UNSELECTED_LAYER )
|
||||
|
@ -354,7 +352,7 @@ void LAYERS_MAP_DIALOG::OnSelectLayer( wxCommandEvent& event )
|
|||
|
||||
ii = event.GetId() - ID_BUTTON_0;
|
||||
|
||||
if( (ii < FIRST_LAYER) || (ii >= NB_GERBER_LAYERS) )
|
||||
if( (ii < 0) || (ii >= GERBER_DRAWLAYERS_COUNT) )
|
||||
{
|
||||
wxFAIL_MSG( wxT("Bad layer id") );
|
||||
return;
|
||||
|
@ -406,7 +404,7 @@ void LAYERS_MAP_DIALOG::OnOkClick( wxCommandEvent& event )
|
|||
normalizeBrdLayersCount();
|
||||
|
||||
int inner_layer_max = 0;
|
||||
for( LAYER_NUM ii = FIRST_LAYER; ii < NB_GERBER_LAYERS; ++ii )
|
||||
for( int ii = 0; ii < GERBER_DRAWLAYERS_COUNT; ++ii )
|
||||
{
|
||||
if( m_layersLookUpTable[ii] < F_Cu )
|
||||
{
|
||||
|
|
|
@ -6,24 +6,23 @@
|
|||
#define _SELECT_LAYERS_TO_PCB_H_
|
||||
|
||||
#include <dialogs/dialog_layers_select_to_pcb_base.h>
|
||||
#include <layers_id_colors_and_visibility.h>
|
||||
|
||||
/*
|
||||
* This dialog shows the gerber files loaded, and allows user to choose
|
||||
* equivalence tbetween gerber layers and pcb layers
|
||||
* equivalence between gerber layers and pcb layers
|
||||
*/
|
||||
class LAYERS_MAP_DIALOG : public LAYERS_MAP_DIALOG_BASE
|
||||
{
|
||||
private:
|
||||
GERBVIEW_FRAME* m_Parent;
|
||||
int m_itemsCount;
|
||||
int m_gerberActiveLayersCount; // Number of initialized gerber layers
|
||||
static int m_exportBoardCopperLayersCount;
|
||||
wxFlexGridSizer* m_flexRightColumnBoxSizer; // An extra wxFlexGridSizer used
|
||||
// when we have more than 16 gerber files loaded
|
||||
LAYER_NUM m_layersLookUpTable[NB_GERBER_LAYERS]; // Indexes Gerber layers to PCB file layers
|
||||
LAYER_NUM m_layersLookUpTable[GERBER_DRAWLAYERS_COUNT]; // Indexes Gerber layers to PCB file layers
|
||||
// the last value in table is the number of copper layers
|
||||
int m_buttonTable[int(NB_GERBER_LAYERS)+1]; // Indexes buttons to Gerber layers
|
||||
wxStaticText* m_layersList[int(NB_GERBER_LAYERS)+1]; // Indexes text strings to buttons
|
||||
int m_buttonTable[int(GERBER_DRAWLAYERS_COUNT)+1]; // Indexes buttons to Gerber layers
|
||||
wxStaticText* m_layersList[int(GERBER_DRAWLAYERS_COUNT)+1]; // Indexes text strings to buttons
|
||||
|
||||
public: LAYERS_MAP_DIALOG( GERBVIEW_FRAME* parent );
|
||||
~LAYERS_MAP_DIALOG() {};
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include <common.h>
|
||||
#include <macros.h>
|
||||
#include <gerbview.h>
|
||||
#include <gerbview_frame.h>
|
||||
#include <bitmaps.h>
|
||||
#include <gerbview_id.h>
|
||||
#include <hotkeys.h>
|
||||
|
@ -292,7 +293,7 @@ void GERBVIEW_FRAME::OnUpdateShowLayerManager( wxUpdateUIEvent& aEvent )
|
|||
|
||||
void GERBVIEW_FRAME::OnUpdateSelectDCode( wxUpdateUIEvent& aEvent )
|
||||
{
|
||||
LAYER_NUM layer = getActiveLayer();
|
||||
int layer = getActiveLayer();
|
||||
GERBER_IMAGE* gerber = g_GERBER_List[layer];
|
||||
int selected = ( gerber ) ? gerber->m_Selected_Tool : 0;
|
||||
|
||||
|
|
|
@ -375,6 +375,7 @@ bool BOARD::SetLayerName( LAYER_ID aLayer, const wxString& aLayerName )
|
|||
|
||||
// veto changing the name if it exists elsewhere.
|
||||
if( id != aLayer && nameTemp == m_Layer[id].m_name )
|
||||
// if( id != aLayer && nameTemp == wxString( m_Layer[id].m_name ) )
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -89,6 +89,7 @@ BOARD_PRINTOUT_CONTROLLER::BOARD_PRINTOUT_CONTROLLER( const PRINT_PARAMETERS& aP
|
|||
|
||||
bool BOARD_PRINTOUT_CONTROLLER::OnPrintPage( int aPage )
|
||||
{
|
||||
#ifdef PCBNEW
|
||||
LSET lset = m_PrintParams.m_PrintMaskLayer;
|
||||
|
||||
// compute layer mask from page number if we want one page per layer
|
||||
|
@ -106,15 +107,18 @@ bool BOARD_PRINTOUT_CONTROLLER::OnPrintPage( int aPage )
|
|||
if( !m_PrintParams.m_PrintMaskLayer.any() )
|
||||
return false;
|
||||
|
||||
#ifdef PCBNEW
|
||||
// In Pcbnew we can want the layer EDGE always printed
|
||||
if( m_PrintParams.m_Flags == 1 )
|
||||
m_PrintParams.m_PrintMaskLayer.set( Edge_Cuts );
|
||||
#endif
|
||||
|
||||
DrawPage();
|
||||
|
||||
m_PrintParams.m_PrintMaskLayer = lset;
|
||||
#else // GERBVIEW
|
||||
// in gerbview, draw layers are printed on separate pages
|
||||
m_PrintParams.m_Flags = aPage-1; // = gerber draw layer id
|
||||
DrawPage();
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue