Gerbview: code refactoring:
* move gerber_file_image_list class to a separate file * better BestZoom calculation, and fix incorrect size of wxTextCtrl showing info about gerber file format. * remove useless file and dead code. Remove not used parameters in some classes (mainly in class_gerber_draw_item)
This commit is contained in:
commit
5065961cf5
|
@ -28,14 +28,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <fctsys.h>
|
#include <fctsys.h>
|
||||||
#include <gr_basic.h>
|
|
||||||
#include <trigo.h>
|
|
||||||
#include <wxstruct.h>
|
#include <wxstruct.h>
|
||||||
#include <base_struct.h>
|
#include <base_struct.h>
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <macros.h>
|
#include <macros.h>
|
||||||
#include <build_version.h>
|
|
||||||
#include <confirm.h>
|
|
||||||
#include <base_units.h>
|
#include <base_units.h>
|
||||||
#include <reporter.h>
|
#include <reporter.h>
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@ set( GERBVIEW_SRCS
|
||||||
class_gbr_screen.cpp
|
class_gbr_screen.cpp
|
||||||
class_gbr_layout.cpp
|
class_gbr_layout.cpp
|
||||||
class_gerber_file_image.cpp
|
class_gerber_file_image.cpp
|
||||||
|
class_gerber_file_image_list.cpp
|
||||||
class_gerber_draw_item.cpp
|
class_gerber_draw_item.cpp
|
||||||
class_gerbview_layer_widget.cpp
|
class_gerbview_layer_widget.cpp
|
||||||
class_gbr_layer_box_selector.cpp
|
class_gbr_layer_box_selector.cpp
|
||||||
|
@ -48,7 +49,6 @@ set( GERBVIEW_SRCS
|
||||||
menubar.cpp
|
menubar.cpp
|
||||||
onleftclick.cpp
|
onleftclick.cpp
|
||||||
onrightclick.cpp
|
onrightclick.cpp
|
||||||
pcbplot.cpp
|
|
||||||
printout_control.cpp
|
printout_control.cpp
|
||||||
readgerb.cpp
|
readgerb.cpp
|
||||||
rs274_read_XY_and_IJ_coordinates.cpp
|
rs274_read_XY_and_IJ_coordinates.cpp
|
||||||
|
|
|
@ -33,6 +33,8 @@
|
||||||
#include <class_drawpanel.h>
|
#include <class_drawpanel.h>
|
||||||
#include <gerbview_frame.h>
|
#include <gerbview_frame.h>
|
||||||
#include <class_gerber_draw_item.h>
|
#include <class_gerber_draw_item.h>
|
||||||
|
#include <class_gerber_file_image.h>
|
||||||
|
#include <class_gerber_file_image_list.h>
|
||||||
|
|
||||||
|
|
||||||
static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
|
static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
|
||||||
|
@ -200,13 +202,21 @@ void GERBVIEW_FRAME::Block_Move( wxDC* DC )
|
||||||
/* Calculate displacement vectors. */
|
/* Calculate displacement vectors. */
|
||||||
delta = GetScreen()->m_BlockLocate.GetMoveVector();
|
delta = GetScreen()->m_BlockLocate.GetMoveVector();
|
||||||
|
|
||||||
/* Move items in block */
|
for( int layer = 0; layer < GERBER_DRAWLAYERS_COUNT; ++layer )
|
||||||
for( GERBER_DRAW_ITEM* item = GetItemsList(); item; item = item->Next() )
|
|
||||||
{
|
{
|
||||||
GERBER_DRAW_ITEM* gerb_item = item;
|
GERBER_FILE_IMAGE* gerber = g_GERBER_List.GetGbrImage( layer );
|
||||||
|
|
||||||
if( gerb_item->HitTest( GetScreen()->m_BlockLocate ) )
|
if( gerber == NULL ) // Graphic layer not yet used
|
||||||
gerb_item->MoveAB( delta );
|
continue;
|
||||||
|
|
||||||
|
/* Move items in block */
|
||||||
|
for( GERBER_DRAW_ITEM* item = gerber->GetItemsList(); item; item = item->Next() )
|
||||||
|
{
|
||||||
|
GERBER_DRAW_ITEM* gerb_item = item;
|
||||||
|
|
||||||
|
if( gerb_item->HitTest( GetScreen()->m_BlockLocate ) )
|
||||||
|
gerb_item->MoveAB( delta );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_canvas->Refresh( true );
|
m_canvas->Refresh( true );
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 1992-2010 Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
|
* Copyright (C) 1992-2016 Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
|
||||||
* Copyright (C) 2010 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
* Copyright (C) 2010 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||||
* Copyright (C) 1992-2010 KiCad Developers, see change_log.txt for contributors.
|
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -108,7 +108,7 @@ bool AM_PRIMITIVE::mapExposure( GERBER_DRAW_ITEM* aParent )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return exposure ^ aParent->m_imageParams->m_ImageNegative;
|
return exposure ^ aParent->m_GerberImageFile->m_ImageNegative;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
*
|
*
|
||||||
* Copyright (C) 1992-2010 Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
|
* Copyright (C) 1992-2010 Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
|
||||||
* Copyright (C) 2010 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
* Copyright (C) 2010 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||||
* Copyright (C) 1992-2010 KiCad Developers, see change_log.txt for contributors.
|
* Copyright (C) 1992-2010 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
|
|
@ -93,6 +93,7 @@ private:
|
||||||
READ_HEADER_STATE, // When we are in this state, we are reading header
|
READ_HEADER_STATE, // When we are in this state, we are reading header
|
||||||
READ_PROGRAM_STATE // When we are in this state, we are reading drill data
|
READ_PROGRAM_STATE // When we are in this state, we are reading drill data
|
||||||
};
|
};
|
||||||
|
|
||||||
excellon_state m_State; // state of excellon file analysis
|
excellon_state m_State; // state of excellon file analysis
|
||||||
bool m_SlotOn; // true during an oblong drill definition
|
bool m_SlotOn; // true during an oblong drill definition
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <colors_selection.h>
|
#include <colors_selection.h>
|
||||||
#include <gerbview_frame.h>
|
#include <gerbview_frame.h>
|
||||||
#include <class_gerber_file_image.h>
|
#include <class_gerber_file_image_list.h>
|
||||||
|
|
||||||
#include <class_gbr_layer_box_selector.h>
|
#include <class_gbr_layer_box_selector.h>
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#include <class_drawpanel.h>
|
#include <class_drawpanel.h>
|
||||||
#include <class_gbr_layout.h>
|
#include <class_gbr_layout.h>
|
||||||
#include <class_gerber_file_image.h>
|
#include <class_gerber_file_image.h>
|
||||||
|
#include <class_gerber_file_image_list.h>
|
||||||
|
|
||||||
GBR_LAYOUT::GBR_LAYOUT()
|
GBR_LAYOUT::GBR_LAYOUT()
|
||||||
{
|
{
|
||||||
|
@ -50,8 +51,16 @@ EDA_RECT GBR_LAYOUT::ComputeBoundingBox()
|
||||||
{
|
{
|
||||||
EDA_RECT bbox;
|
EDA_RECT bbox;
|
||||||
|
|
||||||
for( GERBER_DRAW_ITEM* gerb_item = m_Drawings; gerb_item; gerb_item = gerb_item->Next() )
|
for( int layer = 0; layer < GERBER_DRAWLAYERS_COUNT; ++layer )
|
||||||
bbox.Merge( gerb_item->GetBoundingBox() );
|
{
|
||||||
|
GERBER_FILE_IMAGE* gerber = g_GERBER_List.GetGbrImage( layer );
|
||||||
|
|
||||||
|
if( gerber == NULL ) // Graphic layer not yet used
|
||||||
|
continue;
|
||||||
|
|
||||||
|
for( GERBER_DRAW_ITEM* item = gerber->GetItemsList(); item; item = item->Next() )
|
||||||
|
bbox.Merge( item->GetBoundingBox() );
|
||||||
|
}
|
||||||
|
|
||||||
SetBoundingBox( bbox );
|
SetBoundingBox( bbox );
|
||||||
return bbox;
|
return bbox;
|
||||||
|
@ -134,6 +143,8 @@ void GBR_LAYOUT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMode,
|
||||||
// in non transparent modes, the last layer drawn mask mask previously drawn layer
|
// in non transparent modes, the last layer drawn mask mask previously drawn layer
|
||||||
for( int layer = GERBER_DRAWLAYERS_COUNT-1; !end; --layer )
|
for( int layer = GERBER_DRAWLAYERS_COUNT-1; !end; --layer )
|
||||||
{
|
{
|
||||||
|
EDA_COLOR_T layer_color = gerbFrame->GetLayerColor( layer );
|
||||||
|
|
||||||
int active_layer = gerbFrame->getActiveLayer();
|
int active_layer = gerbFrame->getActiveLayer();
|
||||||
|
|
||||||
if( layer == active_layer ) // active layer will be drawn after other layers
|
if( layer == active_layer ) // active layer will be drawn after other layers
|
||||||
|
@ -227,11 +238,9 @@ void GBR_LAYOUT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMode,
|
||||||
if( aDrawMode == GR_OR && !gerber->HasNegativeItems() )
|
if( aDrawMode == GR_OR && !gerber->HasNegativeItems() )
|
||||||
layerdrawMode = GR_OR;
|
layerdrawMode = GR_OR;
|
||||||
|
|
||||||
EDA_COLOR_T item_color = gerbFrame->GetLayerColor( layer );
|
|
||||||
|
|
||||||
// Now we can draw the current layer to the bitmap buffer
|
// Now we can draw the current layer to the bitmap buffer
|
||||||
// When needed, the previous bitmap is already copied to the screen buffer.
|
// When needed, the previous bitmap is already copied to the screen buffer.
|
||||||
for( GERBER_DRAW_ITEM* item = gerbFrame->GetItemsList(); item; item = item->Next() )
|
for( GERBER_DRAW_ITEM* item = gerber->GetItemsList(); item; item = item->Next() )
|
||||||
{
|
{
|
||||||
if( item->GetLayer() != layer )
|
if( item->GetLayer() != layer )
|
||||||
continue;
|
continue;
|
||||||
|
@ -246,7 +255,7 @@ void GBR_LAYOUT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMode,
|
||||||
}
|
}
|
||||||
|
|
||||||
if( aPrintBlackAndWhite )
|
if( aPrintBlackAndWhite )
|
||||||
gerbFrame->SetLayerColor( layer, item_color );
|
gerbFrame->SetLayerColor( layer, layer_color );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( doBlit && useBufferBitmap ) // Blit is used only if aDrawMode >= 0
|
if( doBlit && useBufferBitmap ) // Blit is used only if aDrawMode >= 0
|
||||||
|
|
|
@ -55,8 +55,6 @@ private:
|
||||||
std::bitset <GERBER_DRAWLAYERS_COUNT> 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:
|
public:
|
||||||
|
|
||||||
DLIST<GERBER_DRAW_ITEM> m_Drawings; // linked list of Gerber Items to draw
|
|
||||||
|
|
||||||
GBR_LAYOUT();
|
GBR_LAYOUT();
|
||||||
~GBR_LAYOUT();
|
~GBR_LAYOUT();
|
||||||
|
|
||||||
|
|
|
@ -111,10 +111,9 @@ GBR_SCREEN::GBR_SCREEN( const wxSize& aPageSizeIU ) :
|
||||||
|
|
||||||
// Set the working grid size to a reasonable value (in 1/10000 inch)
|
// Set the working grid size to a reasonable value (in 1/10000 inch)
|
||||||
SetGrid( DMIL_GRID( 500 ) );
|
SetGrid( DMIL_GRID( 500 ) );
|
||||||
|
SetZoom( ZOOM_FACTOR( 350 ) ); // a default value for zoom
|
||||||
|
|
||||||
m_Active_Layer = B_Cu; // default active layer = bottom layer
|
m_Active_Layer = 0; // default active layer = first graphic layer
|
||||||
|
|
||||||
SetZoom( ZOOM_FACTOR( 350 ) ); // a default value for zoom
|
|
||||||
|
|
||||||
InitDataPoints( aPageSizeIU );
|
InitDataPoints( aPageSizeIU );
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
class GBR_SCREEN : public BASE_SCREEN
|
class GBR_SCREEN : public BASE_SCREEN
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LAYER_NUM m_Active_Layer;
|
int m_Active_Layer;
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
* @param aPageSizeIU is the size of the initial paper page in internal units.
|
* @param aPageSizeIU is the size of the initial paper page in internal units.
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 1992-2010 <Jean-Pierre Charras>
|
* Copyright (C) 1992-2016 <Jean-Pierre Charras>
|
||||||
* Copyright (C) 1992-2010 KiCad Developers, see change_log.txt for contributors.
|
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -38,11 +38,10 @@
|
||||||
#include <class_gerber_file_image.h>
|
#include <class_gerber_file_image.h>
|
||||||
|
|
||||||
|
|
||||||
GERBER_DRAW_ITEM::GERBER_DRAW_ITEM( GBR_LAYOUT* aParent, GERBER_FILE_IMAGE* aGerberparams ) :
|
GERBER_DRAW_ITEM::GERBER_DRAW_ITEM( GERBER_FILE_IMAGE* aGerberImageFile ) :
|
||||||
EDA_ITEM( (EDA_ITEM*)aParent, TYPE_GERBER_DRAW_ITEM )
|
EDA_ITEM( (EDA_ITEM*)NULL, TYPE_GERBER_DRAW_ITEM )
|
||||||
{
|
{
|
||||||
m_imageParams = aGerberparams;
|
m_GerberImageFile = aGerberImageFile;
|
||||||
m_Layer = 0;
|
|
||||||
m_Shape = GBR_SEGMENT;
|
m_Shape = GBR_SEGMENT;
|
||||||
m_Flashed = false;
|
m_Flashed = false;
|
||||||
m_DCode = 0;
|
m_DCode = 0;
|
||||||
|
@ -53,7 +52,7 @@ GERBER_DRAW_ITEM::GERBER_DRAW_ITEM( GBR_LAYOUT* aParent, GERBER_FILE_IMAGE* aGer
|
||||||
m_mirrorB = false;
|
m_mirrorB = false;
|
||||||
m_drawScale.x = m_drawScale.y = 1.0;
|
m_drawScale.x = m_drawScale.y = 1.0;
|
||||||
m_lyrRotation = 0;
|
m_lyrRotation = 0;
|
||||||
if( m_imageParams )
|
if( m_GerberImageFile )
|
||||||
SetLayerParameters();
|
SetLayerParameters();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +61,7 @@ GERBER_DRAW_ITEM::GERBER_DRAW_ITEM( GBR_LAYOUT* aParent, GERBER_FILE_IMAGE* aGer
|
||||||
GERBER_DRAW_ITEM::GERBER_DRAW_ITEM( const GERBER_DRAW_ITEM& aSource ) :
|
GERBER_DRAW_ITEM::GERBER_DRAW_ITEM( const GERBER_DRAW_ITEM& aSource ) :
|
||||||
EDA_ITEM( aSource )
|
EDA_ITEM( aSource )
|
||||||
{
|
{
|
||||||
m_imageParams = aSource.m_imageParams;
|
m_GerberImageFile = aSource.m_GerberImageFile;
|
||||||
m_Shape = aSource.m_Shape;
|
m_Shape = aSource.m_Shape;
|
||||||
|
|
||||||
m_Flags = aSource.m_Flags;
|
m_Flags = aSource.m_Flags;
|
||||||
|
@ -72,7 +71,6 @@ GERBER_DRAW_ITEM::GERBER_DRAW_ITEM( const GERBER_DRAW_ITEM& aSource ) :
|
||||||
m_Start = aSource.m_Start;
|
m_Start = aSource.m_Start;
|
||||||
m_End = aSource.m_End;
|
m_End = aSource.m_End;
|
||||||
m_Size = aSource.m_Size;
|
m_Size = aSource.m_Size;
|
||||||
m_Layer = aSource.m_Layer;
|
|
||||||
m_Shape = aSource.m_Shape;
|
m_Shape = aSource.m_Shape;
|
||||||
m_Flashed = aSource.m_Flashed;
|
m_Flashed = aSource.m_Flashed;
|
||||||
m_DCode = aSource.m_DCode;
|
m_DCode = aSource.m_DCode;
|
||||||
|
@ -99,21 +97,28 @@ GERBER_DRAW_ITEM* GERBER_DRAW_ITEM::Copy() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int GERBER_DRAW_ITEM::GetLayer() const
|
||||||
|
{
|
||||||
|
// returns the layer this item is on, or 0 if the m_GerberImageFile is NULL.
|
||||||
|
return m_GerberImageFile ? m_GerberImageFile->m_GraphicLayer : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
wxPoint GERBER_DRAW_ITEM::GetABPosition( const wxPoint& aXYPosition ) const
|
wxPoint GERBER_DRAW_ITEM::GetABPosition( const wxPoint& aXYPosition ) const
|
||||||
{
|
{
|
||||||
/* Note: RS274Xrevd_e is obscure about the order of transforms:
|
/* Note: RS274Xrevd_e is obscure about the order of transforms:
|
||||||
* For instance: Rotation must be made after or before mirroring ?
|
* For instance: Rotation must be made after or before mirroring ?
|
||||||
* Note: if something is changed here, GetYXPosition must reflect changes
|
* Note: if something is changed here, GetYXPosition must reflect changes
|
||||||
*/
|
*/
|
||||||
wxPoint abPos = aXYPosition + m_imageParams->m_ImageJustifyOffset;
|
wxPoint abPos = aXYPosition + m_GerberImageFile->m_ImageJustifyOffset;
|
||||||
|
|
||||||
if( m_swapAxis )
|
if( m_swapAxis )
|
||||||
std::swap( abPos.x, abPos.y );
|
std::swap( abPos.x, abPos.y );
|
||||||
|
|
||||||
abPos += m_layerOffset + m_imageParams->m_ImageOffset;
|
abPos += m_layerOffset + m_GerberImageFile->m_ImageOffset;
|
||||||
abPos.x = KiROUND( abPos.x * m_drawScale.x );
|
abPos.x = KiROUND( abPos.x * m_drawScale.x );
|
||||||
abPos.y = KiROUND( abPos.y * m_drawScale.y );
|
abPos.y = KiROUND( abPos.y * m_drawScale.y );
|
||||||
double rotation = m_lyrRotation * 10 + m_imageParams->m_ImageRotation * 10;
|
double rotation = m_lyrRotation * 10 + m_GerberImageFile->m_ImageRotation * 10;
|
||||||
|
|
||||||
if( rotation )
|
if( rotation )
|
||||||
RotatePoint( &abPos, -rotation );
|
RotatePoint( &abPos, -rotation );
|
||||||
|
@ -140,36 +145,36 @@ wxPoint GERBER_DRAW_ITEM::GetXYPosition( const wxPoint& aABPosition ) const
|
||||||
if( !m_mirrorB )
|
if( !m_mirrorB )
|
||||||
xyPos.y = -xyPos.y;
|
xyPos.y = -xyPos.y;
|
||||||
|
|
||||||
double rotation = m_lyrRotation * 10 + m_imageParams->m_ImageRotation * 10;
|
double rotation = m_lyrRotation * 10 + m_GerberImageFile->m_ImageRotation * 10;
|
||||||
|
|
||||||
if( rotation )
|
if( rotation )
|
||||||
RotatePoint( &xyPos, rotation );
|
RotatePoint( &xyPos, rotation );
|
||||||
|
|
||||||
xyPos.x = KiROUND( xyPos.x / m_drawScale.x );
|
xyPos.x = KiROUND( xyPos.x / m_drawScale.x );
|
||||||
xyPos.y = KiROUND( xyPos.y / m_drawScale.y );
|
xyPos.y = KiROUND( xyPos.y / m_drawScale.y );
|
||||||
xyPos -= m_layerOffset + m_imageParams->m_ImageOffset;
|
xyPos -= m_layerOffset + m_GerberImageFile->m_ImageOffset;
|
||||||
|
|
||||||
if( m_swapAxis )
|
if( m_swapAxis )
|
||||||
std::swap( xyPos.x, xyPos.y );
|
std::swap( xyPos.x, xyPos.y );
|
||||||
|
|
||||||
return xyPos - m_imageParams->m_ImageJustifyOffset;
|
return xyPos - m_GerberImageFile->m_ImageJustifyOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GERBER_DRAW_ITEM::SetLayerParameters()
|
void GERBER_DRAW_ITEM::SetLayerParameters()
|
||||||
{
|
{
|
||||||
m_UnitsMetric = m_imageParams->m_GerbMetric;
|
m_UnitsMetric = m_GerberImageFile->m_GerbMetric;
|
||||||
m_swapAxis = m_imageParams->m_SwapAxis; // false if A = X, B = Y;
|
m_swapAxis = m_GerberImageFile->m_SwapAxis; // false if A = X, B = Y;
|
||||||
|
|
||||||
// true if A =Y, B = Y
|
// true if A =Y, B = Y
|
||||||
m_mirrorA = m_imageParams->m_MirrorA; // true: mirror / axe A
|
m_mirrorA = m_GerberImageFile->m_MirrorA; // true: mirror / axe A
|
||||||
m_mirrorB = m_imageParams->m_MirrorB; // true: mirror / axe B
|
m_mirrorB = m_GerberImageFile->m_MirrorB; // true: mirror / axe B
|
||||||
m_drawScale = m_imageParams->m_Scale; // A and B scaling factor
|
m_drawScale = m_GerberImageFile->m_Scale; // A and B scaling factor
|
||||||
m_layerOffset = m_imageParams->m_Offset; // Offset from OF command
|
m_layerOffset = m_GerberImageFile->m_Offset; // Offset from OF command
|
||||||
|
|
||||||
// Rotation from RO command:
|
// Rotation from RO command:
|
||||||
m_lyrRotation = m_imageParams->m_LocalRotation;
|
m_lyrRotation = m_GerberImageFile->m_LocalRotation;
|
||||||
m_LayerNegative = m_imageParams->GetLayerParams().m_LayerNegative;
|
m_LayerNegative = m_GerberImageFile->GetLayerParams().m_LayerNegative;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -223,14 +228,10 @@ D_CODE* GERBER_DRAW_ITEM::GetDcodeDescr()
|
||||||
if( (m_DCode < FIRST_DCODE) || (m_DCode > LAST_DCODE) )
|
if( (m_DCode < FIRST_DCODE) || (m_DCode > LAST_DCODE) )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
GERBER_FILE_IMAGE* gerber = g_GERBER_List.GetGbrImage( m_Layer );
|
if( m_GerberImageFile == NULL )
|
||||||
|
|
||||||
if( gerber == NULL )
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
D_CODE* d_code = gerber->GetDCODE( m_DCode, false );
|
return m_GerberImageFile->GetDCODE( m_DCode, false );
|
||||||
|
|
||||||
return d_code;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -278,7 +279,7 @@ bool GERBER_DRAW_ITEM::Save( FILE* aFile ) const
|
||||||
|
|
||||||
bool GERBER_DRAW_ITEM::HasNegativeItems()
|
bool GERBER_DRAW_ITEM::HasNegativeItems()
|
||||||
{
|
{
|
||||||
bool isClear = m_LayerNegative ^ m_imageParams->m_ImageNegative;
|
bool isClear = m_LayerNegative ^ m_GerberImageFile->m_ImageNegative;
|
||||||
|
|
||||||
// if isClear is true, this item has negative shape
|
// if isClear is true, this item has negative shape
|
||||||
// but if isClear is true, and if this item use an aperture macro definition,
|
// but if isClear is true, and if this item use an aperture macro definition,
|
||||||
|
@ -336,7 +337,7 @@ void GERBER_DRAW_ITEM::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDra
|
||||||
* color other than the background color, else use the background color
|
* color other than the background color, else use the background color
|
||||||
* when drawing so that an erasure happens.
|
* when drawing so that an erasure happens.
|
||||||
*/
|
*/
|
||||||
bool isDark = !(m_LayerNegative ^ m_imageParams->m_ImageNegative);
|
bool isDark = !(m_LayerNegative ^ m_GerberImageFile->m_ImageNegative);
|
||||||
|
|
||||||
if( !isDark )
|
if( !isDark )
|
||||||
{
|
{
|
||||||
|
@ -616,7 +617,7 @@ void GERBER_DRAW_ITEM::Show( int nestLevel, std::ostream& os ) const
|
||||||
|
|
||||||
" shape=\"" << m_Shape << '"' <<
|
" shape=\"" << m_Shape << '"' <<
|
||||||
" addr=\"" << std::hex << this << std::dec << '"' <<
|
" addr=\"" << std::hex << this << std::dec << '"' <<
|
||||||
" layer=\"" << m_Layer << '"' <<
|
" layer=\"" << GetLayer() << '"' <<
|
||||||
" size=\"" << m_Size << '"' <<
|
" size=\"" << m_Size << '"' <<
|
||||||
" flags=\"" << m_Flags << '"' <<
|
" flags=\"" << m_Flags << '"' <<
|
||||||
" status=\"" << GetStatus() << '"' <<
|
" status=\"" << GetStatus() << '"' <<
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 1992-2010 <Jean-Pierre Charras>
|
* Copyright (C) 1992-2016 <Jean-Pierre Charras>
|
||||||
* Copyright (C) 1992-2010 KiCad Developers, see change_log.txt for contributors.
|
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -82,16 +82,14 @@ public:
|
||||||
// 0 for items that do not use DCodes (polygons)
|
// 0 for items that do not use DCodes (polygons)
|
||||||
// or when unknown and normal values are 10 to 999
|
// or when unknown and normal values are 10 to 999
|
||||||
// values 0 to 9 can be used for special purposes
|
// values 0 to 9 can be used for special purposes
|
||||||
GERBER_FILE_IMAGE* m_imageParams; /* main GERBER info for this item
|
GERBER_FILE_IMAGE* m_GerberImageFile; /* Gerber file image source of this item
|
||||||
* Note: some params stored in this class are common
|
* Note: some params stored in this class are common
|
||||||
* to the whole gerber file (i.e) the whole graphic
|
* to the whole gerber file (i.e) the whole graphic
|
||||||
* layer and some can change when reaging the file,
|
* layer and some can change when reading the file,
|
||||||
* so they are stored inside this item there is no
|
* so they are stored inside this item if there is no
|
||||||
* redundancy for these parameters
|
* redundancy for these parameters
|
||||||
*/
|
*/
|
||||||
private:
|
private:
|
||||||
int m_Layer;
|
|
||||||
|
|
||||||
// These values are used to draw this item, according to gerber layers parameters
|
// 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
|
// Because they can change inside a gerber image, they are stored here
|
||||||
// for each item
|
// for each item
|
||||||
|
@ -104,7 +102,7 @@ private:
|
||||||
double m_lyrRotation; // Fine rotation, from OR parameter, in degrees
|
double m_lyrRotation; // Fine rotation, from OR parameter, in degrees
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GERBER_DRAW_ITEM( GBR_LAYOUT* aParent, GERBER_FILE_IMAGE* aGerberparams );
|
GERBER_DRAW_ITEM( GERBER_FILE_IMAGE* aGerberparams );
|
||||||
GERBER_DRAW_ITEM( const GERBER_DRAW_ITEM& aSource );
|
GERBER_DRAW_ITEM( const GERBER_DRAW_ITEM& aSource );
|
||||||
~GERBER_DRAW_ITEM();
|
~GERBER_DRAW_ITEM();
|
||||||
|
|
||||||
|
@ -123,16 +121,7 @@ public:
|
||||||
* Function GetLayer
|
* Function GetLayer
|
||||||
* returns the layer this item is on.
|
* returns the layer this item is on.
|
||||||
*/
|
*/
|
||||||
int GetLayer() const { return m_Layer; }
|
int GetLayer() const;
|
||||||
|
|
||||||
/**
|
|
||||||
* Function SetLayer
|
|
||||||
* sets the layer this item is on.
|
|
||||||
* @param aLayer The layer number.
|
|
||||||
* is virtual because some items (in fact: class DIMENSION)
|
|
||||||
* have a slightly different initialization
|
|
||||||
*/
|
|
||||||
void SetLayer( int aLayer ) { m_Layer = aLayer; }
|
|
||||||
|
|
||||||
bool GetLayerPolarity()
|
bool GetLayerPolarity()
|
||||||
{
|
{
|
||||||
|
@ -216,10 +205,8 @@ public:
|
||||||
const EDA_RECT GetBoundingBox() const; // Virtual
|
const EDA_RECT GetBoundingBox() const; // Virtual
|
||||||
|
|
||||||
/* Display on screen: */
|
/* Display on screen: */
|
||||||
void Draw( EDA_DRAW_PANEL* aPanel,
|
void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
|
||||||
wxDC* aDC,
|
GR_DRAWMODE aDrawMode, const wxPoint&aOffset );
|
||||||
GR_DRAWMODE aDrawMode,
|
|
||||||
const wxPoint&aOffset );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function ConvertSegmentToPolygon
|
* Function ConvertSegmentToPolygon
|
||||||
|
@ -233,8 +220,7 @@ public:
|
||||||
* Function DrawGbrPoly
|
* Function DrawGbrPoly
|
||||||
* a helper function used to draw the polygon stored in m_PolyCorners
|
* a helper function used to draw the polygon stored in m_PolyCorners
|
||||||
*/
|
*/
|
||||||
void DrawGbrPoly( EDA_RECT* aClipBox,
|
void DrawGbrPoly( EDA_RECT* aClipBox, wxDC* aDC, EDA_COLOR_T aColor,
|
||||||
wxDC* aDC, EDA_COLOR_T aColor,
|
|
||||||
const wxPoint& aOffset, bool aFilledShape );
|
const wxPoint& aOffset, bool aFilledShape );
|
||||||
|
|
||||||
/* divers */
|
/* divers */
|
||||||
|
|
|
@ -118,7 +118,7 @@ GERBER_FILE_IMAGE::~GERBER_FILE_IMAGE()
|
||||||
*/
|
*/
|
||||||
GERBER_DRAW_ITEM * GERBER_FILE_IMAGE::GetItemsList()
|
GERBER_DRAW_ITEM * GERBER_FILE_IMAGE::GetItemsList()
|
||||||
{
|
{
|
||||||
return m_parent->GetItemsList();
|
return m_Drawings;
|
||||||
}
|
}
|
||||||
|
|
||||||
D_CODE* GERBER_FILE_IMAGE::GetDCODE( int aDCODE, bool aCreateIfNoExist )
|
D_CODE* GERBER_FILE_IMAGE::GetDCODE( int aDCODE, bool aCreateIfNoExist )
|
||||||
|
@ -323,7 +323,7 @@ void GERBER_FILE_IMAGE::StepAndRepeatItem( const GERBER_DRAW_ITEM& aItem )
|
||||||
move_vector.y = scaletoIU( jj * GetLayerParams().m_StepForRepeat.y,
|
move_vector.y = scaletoIU( jj * GetLayerParams().m_StepForRepeat.y,
|
||||||
GetLayerParams().m_StepForRepeatMetric );
|
GetLayerParams().m_StepForRepeatMetric );
|
||||||
dupItem->MoveXY( move_vector );
|
dupItem->MoveXY( move_vector );
|
||||||
m_parent->GetGerberLayout()->m_Drawings.Append( dupItem );
|
m_Drawings.Append( dupItem );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -374,202 +374,3 @@ void GERBER_FILE_IMAGE::DisplayImageInfo( void )
|
||||||
(double) m_ImageJustifyOffset.y*2.54/1000 );
|
(double) m_ImageJustifyOffset.y*2.54/1000 );
|
||||||
m_parent->AppendMsgPanel( _( "Image Justify Offset" ), msg, DARKRED );
|
m_parent->AppendMsgPanel( _( "Image Justify Offset" ), msg, DARKRED );
|
||||||
}
|
}
|
||||||
|
|
||||||
// GERBER_FILE_IMAGE_LIST is a helper class to handle a list of GERBER_FILE_IMAGE files
|
|
||||||
GERBER_FILE_IMAGE_LIST::GERBER_FILE_IMAGE_LIST()
|
|
||||||
{
|
|
||||||
m_GERBER_List.reserve( GERBER_DRAWLAYERS_COUNT );
|
|
||||||
|
|
||||||
for( unsigned layer = 0; layer < GERBER_DRAWLAYERS_COUNT; ++layer )
|
|
||||||
m_GERBER_List.push_back( NULL );
|
|
||||||
}
|
|
||||||
|
|
||||||
GERBER_FILE_IMAGE_LIST::~GERBER_FILE_IMAGE_LIST()
|
|
||||||
{
|
|
||||||
ClearList();
|
|
||||||
|
|
||||||
for( unsigned layer = 0; layer < m_GERBER_List.size(); ++layer )
|
|
||||||
{
|
|
||||||
delete m_GERBER_List[layer];
|
|
||||||
m_GERBER_List[layer] = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
GERBER_FILE_IMAGE* GERBER_FILE_IMAGE_LIST::GetGbrImage( int aIdx )
|
|
||||||
{
|
|
||||||
if( (unsigned)aIdx < m_GERBER_List.size() )
|
|
||||||
return m_GERBER_List[aIdx];
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* creates a new, empty GERBER_FILE_IMAGE* at index aIdx
|
|
||||||
* or at the first free location if aIdx < 0
|
|
||||||
* @param aIdx = the location to use ( 0 ... GERBER_DRAWLAYERS_COUNT-1 )
|
|
||||||
* @return true if the index used, or -1 if no room to add image
|
|
||||||
*/
|
|
||||||
int GERBER_FILE_IMAGE_LIST::AddGbrImage( GERBER_FILE_IMAGE* aGbrImage, int aIdx )
|
|
||||||
{
|
|
||||||
int idx = aIdx;
|
|
||||||
|
|
||||||
if( idx < 0 )
|
|
||||||
{
|
|
||||||
for( idx = 0; idx < (int)m_GERBER_List.size(); idx++ )
|
|
||||||
{
|
|
||||||
if( !IsUsed( idx ) )
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( idx >= (int)m_GERBER_List.size() )
|
|
||||||
return -1; // No room
|
|
||||||
|
|
||||||
m_GERBER_List[idx] = aGbrImage;
|
|
||||||
|
|
||||||
return idx;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// remove all loaded data in list, but do not delete empty images
|
|
||||||
// (can be reused)
|
|
||||||
void GERBER_FILE_IMAGE_LIST::ClearList()
|
|
||||||
{
|
|
||||||
for( unsigned layer = 0; layer < m_GERBER_List.size(); ++layer )
|
|
||||||
ClearImage( layer );
|
|
||||||
}
|
|
||||||
|
|
||||||
// remove the loaded data of image aIdx, but do not delete it
|
|
||||||
void GERBER_FILE_IMAGE_LIST::ClearImage( int aIdx )
|
|
||||||
{
|
|
||||||
if( aIdx >= 0 && aIdx < (int)m_GERBER_List.size() && m_GERBER_List[aIdx] )
|
|
||||||
{
|
|
||||||
m_GERBER_List[aIdx]->InitToolTable();
|
|
||||||
m_GERBER_List[aIdx]->ResetDefaultValues();
|
|
||||||
m_GERBER_List[aIdx]->m_InUse = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Build a name for image aIdx which can be used in layers manager
|
|
||||||
const wxString GERBER_FILE_IMAGE_LIST::GetDisplayName( int aIdx )
|
|
||||||
{
|
|
||||||
wxString name;
|
|
||||||
|
|
||||||
GERBER_FILE_IMAGE* gerber = NULL;
|
|
||||||
|
|
||||||
if( aIdx >= 0 && aIdx < (int)m_GERBER_List.size() )
|
|
||||||
gerber = m_GERBER_List[aIdx];
|
|
||||||
|
|
||||||
// if a file is loaded, build the name:
|
|
||||||
// <id> <short filename> <X2 FileFunction info> if a X2 FileFunction info is found
|
|
||||||
// or (if no FileFunction info)
|
|
||||||
// <id> <short filename> *
|
|
||||||
if( gerber && IsUsed(aIdx ) )
|
|
||||||
{
|
|
||||||
wxFileName fn( gerber->m_FileName );
|
|
||||||
wxString filename = fn.GetFullName();
|
|
||||||
|
|
||||||
// if the filename is too long, display a shortened name:
|
|
||||||
const int maxlen = 30;
|
|
||||||
|
|
||||||
if( filename.Length() > maxlen )
|
|
||||||
{
|
|
||||||
wxString shortenedfn = filename.Left(2) + "..." + filename.Right(maxlen-5);
|
|
||||||
filename = shortenedfn;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( gerber->m_FileFunction )
|
|
||||||
{
|
|
||||||
if( gerber->m_FileFunction->IsCopper() )
|
|
||||||
{
|
|
||||||
name.Printf( "%d %s (%s, %s, %s)", aIdx + 1,
|
|
||||||
filename.GetData(),
|
|
||||||
GetChars( gerber->m_FileFunction->GetFileType() ),
|
|
||||||
GetChars( gerber->m_FileFunction->GetBrdLayerId() ),
|
|
||||||
GetChars( gerber->m_FileFunction->GetBrdLayerSide() ) );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
name.Printf( "%d %s (%s, %s)", aIdx + 1,
|
|
||||||
filename.GetData(),
|
|
||||||
GetChars( gerber->m_FileFunction->GetFileType() ),
|
|
||||||
GetChars( gerber->m_FileFunction->GetBrdLayerId() ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
name.Printf( _( "%d %s" ), aIdx + 1, filename.GetData() );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
name.Printf( _( "Graphic layer %d" ), aIdx + 1 );
|
|
||||||
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
// return true if image is used (loaded and not cleared)
|
|
||||||
bool GERBER_FILE_IMAGE_LIST::IsUsed( int aIdx )
|
|
||||||
{
|
|
||||||
if( aIdx >= 0 && aIdx < (int)m_GERBER_List.size() )
|
|
||||||
return m_GERBER_List[aIdx] != NULL && m_GERBER_List[aIdx]->m_InUse;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Helper function, for std::sort.
|
|
||||||
// Sort loaded images by Z order priority, if they have the X2 FileFormat info
|
|
||||||
// returns true if the first argument (ref) is ordered before the second (test).
|
|
||||||
static bool sortZorder( const GERBER_FILE_IMAGE* const& ref, const GERBER_FILE_IMAGE* const& test )
|
|
||||||
{
|
|
||||||
if( !ref && !test )
|
|
||||||
return false; // do not change order: no criteria to sort items
|
|
||||||
|
|
||||||
if( !ref || !ref->m_InUse )
|
|
||||||
return false; // Not used: ref ordered after
|
|
||||||
|
|
||||||
if( !test || !test->m_InUse )
|
|
||||||
return true; // Not used: ref ordered before
|
|
||||||
|
|
||||||
if( !ref->m_FileFunction && !test->m_FileFunction )
|
|
||||||
return false; // do not change order: no criteria to sort items
|
|
||||||
|
|
||||||
if( !ref->m_FileFunction )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if( !test->m_FileFunction )
|
|
||||||
return true;
|
|
||||||
|
|
||||||
if( ref->m_FileFunction->GetZOrder() != test->m_FileFunction->GetZOrder() )
|
|
||||||
return ref->m_FileFunction->GetZOrder() > test->m_FileFunction->GetZOrder();
|
|
||||||
|
|
||||||
return ref->m_FileFunction->GetZSubOrder() > test->m_FileFunction->GetZSubOrder();
|
|
||||||
}
|
|
||||||
|
|
||||||
void GERBER_FILE_IMAGE_LIST::SortImagesByZOrder( GERBER_DRAW_ITEM* aDrawList )
|
|
||||||
{
|
|
||||||
std::sort( m_GERBER_List.begin(), m_GERBER_List.end(), sortZorder );
|
|
||||||
|
|
||||||
// The image order has changed.
|
|
||||||
// Graphic layer numbering must be updated to match the widgets layer order
|
|
||||||
|
|
||||||
// Store the old/new graphic layer info:
|
|
||||||
std::map <int, int> tab_lyr;
|
|
||||||
|
|
||||||
for( unsigned layer = 0; layer < m_GERBER_List.size(); ++layer )
|
|
||||||
{
|
|
||||||
if( m_GERBER_List[layer] )
|
|
||||||
{
|
|
||||||
tab_lyr[m_GERBER_List[layer]->m_GraphicLayer] = layer;
|
|
||||||
m_GERBER_List[layer]->m_GraphicLayer = layer ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// update the graphic layer in items to draw
|
|
||||||
for( GERBER_DRAW_ITEM* item = aDrawList; item; item = item->Next() )
|
|
||||||
{
|
|
||||||
int layer = item->GetLayer();
|
|
||||||
item->SetLayer( tab_lyr[layer] );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// The global image list:
|
|
||||||
GERBER_FILE_IMAGE_LIST g_GERBER_List;
|
|
||||||
|
|
|
@ -22,8 +22,8 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _CLASS_GERBER_H_
|
#ifndef CLASS_GERBER_FILE_IMAGE_H
|
||||||
#define _CLASS_GERBER_H_
|
#define CLASS_GERBER_FILE_IMAGE_H
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
@ -101,6 +101,8 @@ class GERBER_FILE_IMAGE
|
||||||
GERBER_LAYER m_GBRLayerParams; // hold params for the current gerber layer
|
GERBER_LAYER m_GBRLayerParams; // hold params for the current gerber layer
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
DLIST<GERBER_DRAW_ITEM> m_Drawings; // linked list of Gerber Items to draw
|
||||||
|
|
||||||
bool m_InUse; // true if this image is currently in use
|
bool m_InUse; // true if this image is currently in use
|
||||||
// (a file is loaded in it)
|
// (a file is loaded in it)
|
||||||
wxString m_FileName; // Full File Name for this layer
|
wxString m_FileName; // Full File Name for this layer
|
||||||
|
@ -312,72 +314,4 @@ public:
|
||||||
void DisplayImageInfo( void );
|
void DisplayImageInfo( void );
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
#endif // ifndef CLASS_GERBER_FILE_IMAGE_H
|
||||||
* @brief GERBER_FILE_IMAGE_LIST is a helper class to handle a list of GERBER_FILE_IMAGE files
|
|
||||||
* which are loaded and can be displayed
|
|
||||||
* there are 32 images max which can be loaded
|
|
||||||
*/
|
|
||||||
class GERBER_FILE_IMAGE_LIST
|
|
||||||
{
|
|
||||||
// the list of loaded images (1 image = 1 gerber file)
|
|
||||||
std::vector<GERBER_FILE_IMAGE*> m_GERBER_List;
|
|
||||||
|
|
||||||
public:
|
|
||||||
GERBER_FILE_IMAGE_LIST();
|
|
||||||
~GERBER_FILE_IMAGE_LIST();
|
|
||||||
|
|
||||||
//Accessor
|
|
||||||
GERBER_FILE_IMAGE* GetGbrImage( int aIdx );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a GERBER_FILE_IMAGE* at index aIdx
|
|
||||||
* or at the first free location if aIdx < 0
|
|
||||||
* @param aGbrImage = the image to add
|
|
||||||
* @param aIdx = the location to use ( 0 ... GERBER_DRAWLAYERS_COUNT-1 )
|
|
||||||
* @return true if the index used, or -1 if no room to add image
|
|
||||||
*/
|
|
||||||
int AddGbrImage( GERBER_FILE_IMAGE* aGbrImage, int aIdx );
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* remove all loaded data in list
|
|
||||||
*/
|
|
||||||
void ClearList();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* remove the loaded data of image aIdx
|
|
||||||
* @param aIdx = the index ( 0 ... GERBER_DRAWLAYERS_COUNT-1 )
|
|
||||||
*/
|
|
||||||
void ClearImage( int aIdx );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return a name for image aIdx which can be used in layers manager
|
|
||||||
* and layer selector
|
|
||||||
* if a file is loaded, the name is:
|
|
||||||
* "<aIdx+1> <short filename> <X2 FileFunction info> if a X2 FileFunction info is found"
|
|
||||||
* or (if no FileFunction info)
|
|
||||||
* "<aIdx+1> <short filename> *"
|
|
||||||
* if no file loaded, the name is:
|
|
||||||
* "Layer n" with n = aIdx+1
|
|
||||||
* @param aIdx = the index ( 0 ... GERBER_DRAWLAYERS_COUNT-1 )
|
|
||||||
*/
|
|
||||||
const wxString GetDisplayName( int aIdx );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return true if image is used (loaded and with items)
|
|
||||||
* @param aIdx = the index ( 0 ... GERBER_DRAWLAYERS_COUNT-1 )
|
|
||||||
*/
|
|
||||||
bool IsUsed( int aIdx );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sort loaded images by Z order priority, if they have the X2 FileFormat info
|
|
||||||
* @param aDrawList: the draw list associated to the gerber images
|
|
||||||
* (SortImagesByZOrder updates the graphic layer of these items)
|
|
||||||
*/
|
|
||||||
void SortImagesByZOrder( GERBER_DRAW_ITEM* aDrawList );
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
extern GERBER_FILE_IMAGE_LIST g_GERBER_List;
|
|
||||||
|
|
||||||
#endif // ifndef _CLASS_GERBER_H_
|
|
||||||
|
|
|
@ -0,0 +1,231 @@
|
||||||
|
/**
|
||||||
|
* @file class_gerber_file_image.cpp
|
||||||
|
* a GERBER class handle for a given layer info about used D_CODES and how the layer is drawn
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
|
*
|
||||||
|
* Copyright (C) 1992-2016 Jean-Pierre Charras jp.charras at wanadoo.fr
|
||||||
|
* Copyright (C) 1992-2016 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 Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, you may find one here:
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||||
|
* or you may write to the Free Software Foundation, Inc.,
|
||||||
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <fctsys.h>
|
||||||
|
|
||||||
|
#include <gerbview.h>
|
||||||
|
#include <gerbview_frame.h>
|
||||||
|
#include <class_gerber_file_image.h>
|
||||||
|
#include <class_gerber_file_image_list.h>
|
||||||
|
#include <class_X2_gerber_attributes.h>
|
||||||
|
|
||||||
|
|
||||||
|
// GERBER_FILE_IMAGE_LIST is a helper class to handle a list of GERBER_FILE_IMAGE files
|
||||||
|
GERBER_FILE_IMAGE_LIST::GERBER_FILE_IMAGE_LIST()
|
||||||
|
{
|
||||||
|
m_GERBER_List.reserve( GERBER_DRAWLAYERS_COUNT );
|
||||||
|
|
||||||
|
for( unsigned layer = 0; layer < GERBER_DRAWLAYERS_COUNT; ++layer )
|
||||||
|
m_GERBER_List.push_back( NULL );
|
||||||
|
}
|
||||||
|
|
||||||
|
GERBER_FILE_IMAGE_LIST::~GERBER_FILE_IMAGE_LIST()
|
||||||
|
{
|
||||||
|
ClearList();
|
||||||
|
|
||||||
|
for( unsigned layer = 0; layer < m_GERBER_List.size(); ++layer )
|
||||||
|
{
|
||||||
|
delete m_GERBER_List[layer];
|
||||||
|
m_GERBER_List[layer] = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GERBER_FILE_IMAGE* GERBER_FILE_IMAGE_LIST::GetGbrImage( int aIdx )
|
||||||
|
{
|
||||||
|
if( (unsigned)aIdx < m_GERBER_List.size() )
|
||||||
|
return m_GERBER_List[aIdx];
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* creates a new, empty GERBER_FILE_IMAGE* at index aIdx
|
||||||
|
* or at the first free location if aIdx < 0
|
||||||
|
* @param aIdx = the location to use ( 0 ... GERBER_DRAWLAYERS_COUNT-1 )
|
||||||
|
* @return true if the index used, or -1 if no room to add image
|
||||||
|
*/
|
||||||
|
int GERBER_FILE_IMAGE_LIST::AddGbrImage( GERBER_FILE_IMAGE* aGbrImage, int aIdx )
|
||||||
|
{
|
||||||
|
int idx = aIdx;
|
||||||
|
|
||||||
|
if( idx < 0 )
|
||||||
|
{
|
||||||
|
for( idx = 0; idx < (int)m_GERBER_List.size(); idx++ )
|
||||||
|
{
|
||||||
|
if( !IsUsed( idx ) )
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( idx >= (int)m_GERBER_List.size() )
|
||||||
|
return -1; // No room
|
||||||
|
|
||||||
|
m_GERBER_List[idx] = aGbrImage;
|
||||||
|
|
||||||
|
return idx;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// remove all loaded data in list, but do not delete empty images
|
||||||
|
// (can be reused)
|
||||||
|
void GERBER_FILE_IMAGE_LIST::ClearList()
|
||||||
|
{
|
||||||
|
for( unsigned layer = 0; layer < m_GERBER_List.size(); ++layer )
|
||||||
|
ClearImage( layer );
|
||||||
|
}
|
||||||
|
|
||||||
|
// remove the loaded data of image aIdx, but do not delete it
|
||||||
|
void GERBER_FILE_IMAGE_LIST::ClearImage( int aIdx )
|
||||||
|
{
|
||||||
|
if( aIdx >= 0 && aIdx < (int)m_GERBER_List.size() && m_GERBER_List[aIdx] )
|
||||||
|
{
|
||||||
|
m_GERBER_List[aIdx]->InitToolTable();
|
||||||
|
m_GERBER_List[aIdx]->ResetDefaultValues();
|
||||||
|
m_GERBER_List[aIdx]->m_InUse = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Build a name for image aIdx which can be used in layers manager
|
||||||
|
const wxString GERBER_FILE_IMAGE_LIST::GetDisplayName( int aIdx )
|
||||||
|
{
|
||||||
|
wxString name;
|
||||||
|
|
||||||
|
GERBER_FILE_IMAGE* gerber = NULL;
|
||||||
|
|
||||||
|
if( aIdx >= 0 && aIdx < (int)m_GERBER_List.size() )
|
||||||
|
gerber = m_GERBER_List[aIdx];
|
||||||
|
|
||||||
|
// if a file is loaded, build the name:
|
||||||
|
// <id> <short filename> <X2 FileFunction info> if a X2 FileFunction info is found
|
||||||
|
// or (if no FileFunction info)
|
||||||
|
// <id> <short filename> *
|
||||||
|
if( gerber && IsUsed(aIdx ) )
|
||||||
|
{
|
||||||
|
wxFileName fn( gerber->m_FileName );
|
||||||
|
wxString filename = fn.GetFullName();
|
||||||
|
|
||||||
|
// if the filename is too long, display a shortened name:
|
||||||
|
const int maxlen = 30;
|
||||||
|
|
||||||
|
if( filename.Length() > maxlen )
|
||||||
|
{
|
||||||
|
wxString shortenedfn = filename.Left(2) + "..." + filename.Right(maxlen-5);
|
||||||
|
filename = shortenedfn;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( gerber->m_FileFunction )
|
||||||
|
{
|
||||||
|
if( gerber->m_FileFunction->IsCopper() )
|
||||||
|
{
|
||||||
|
name.Printf( "%d %s (%s, %s, %s)", aIdx + 1,
|
||||||
|
filename.GetData(),
|
||||||
|
GetChars( gerber->m_FileFunction->GetFileType() ),
|
||||||
|
GetChars( gerber->m_FileFunction->GetBrdLayerId() ),
|
||||||
|
GetChars( gerber->m_FileFunction->GetBrdLayerSide() ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
name.Printf( "%d %s (%s, %s)", aIdx + 1,
|
||||||
|
filename.GetData(),
|
||||||
|
GetChars( gerber->m_FileFunction->GetFileType() ),
|
||||||
|
GetChars( gerber->m_FileFunction->GetBrdLayerId() ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
name.Printf( _( "%d %s" ), aIdx + 1, filename.GetData() );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
name.Printf( _( "Graphic layer %d" ), aIdx + 1 );
|
||||||
|
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
// return true if image is used (loaded and not cleared)
|
||||||
|
bool GERBER_FILE_IMAGE_LIST::IsUsed( int aIdx )
|
||||||
|
{
|
||||||
|
if( aIdx >= 0 && aIdx < (int)m_GERBER_List.size() )
|
||||||
|
return m_GERBER_List[aIdx] != NULL && m_GERBER_List[aIdx]->m_InUse;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Helper function, for std::sort.
|
||||||
|
// Sort loaded images by Z order priority, if they have the X2 FileFormat info
|
||||||
|
// returns true if the first argument (ref) is ordered before the second (test).
|
||||||
|
static bool sortZorder( const GERBER_FILE_IMAGE* const& ref, const GERBER_FILE_IMAGE* const& test )
|
||||||
|
{
|
||||||
|
if( !ref && !test )
|
||||||
|
return false; // do not change order: no criteria to sort items
|
||||||
|
|
||||||
|
if( !ref || !ref->m_InUse )
|
||||||
|
return false; // Not used: ref ordered after
|
||||||
|
|
||||||
|
if( !test || !test->m_InUse )
|
||||||
|
return true; // Not used: ref ordered before
|
||||||
|
|
||||||
|
if( !ref->m_FileFunction && !test->m_FileFunction )
|
||||||
|
return false; // do not change order: no criteria to sort items
|
||||||
|
|
||||||
|
if( !ref->m_FileFunction )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if( !test->m_FileFunction )
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if( ref->m_FileFunction->GetZOrder() != test->m_FileFunction->GetZOrder() )
|
||||||
|
return ref->m_FileFunction->GetZOrder() > test->m_FileFunction->GetZOrder();
|
||||||
|
|
||||||
|
return ref->m_FileFunction->GetZSubOrder() > test->m_FileFunction->GetZSubOrder();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GERBER_FILE_IMAGE_LIST::SortImagesByZOrder()
|
||||||
|
{
|
||||||
|
std::sort( m_GERBER_List.begin(), m_GERBER_List.end(), sortZorder );
|
||||||
|
|
||||||
|
// The image order has changed.
|
||||||
|
// Graphic layer numbering must be updated to match the widgets layer order
|
||||||
|
|
||||||
|
// Store the old/new graphic layer info:
|
||||||
|
std::map <int, int> tab_lyr;
|
||||||
|
|
||||||
|
for( unsigned layer = 0; layer < m_GERBER_List.size(); ++layer )
|
||||||
|
{
|
||||||
|
GERBER_FILE_IMAGE* gerber = m_GERBER_List[layer];
|
||||||
|
|
||||||
|
if( !gerber )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
tab_lyr[gerber->m_GraphicLayer] = layer;
|
||||||
|
gerber->m_GraphicLayer = layer ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// The global image list:
|
||||||
|
GERBER_FILE_IMAGE_LIST g_GERBER_List;
|
|
@ -0,0 +1,125 @@
|
||||||
|
/*
|
||||||
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2016 Jean-Pierre Charras jp.charras at wanadoo.fr
|
||||||
|
* Copyright (C) 1992-2016 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 Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, you may find one here:
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||||
|
* or you may write to the Free Software Foundation, Inc.,
|
||||||
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CLASS_GERBER_FILE_IMAGE_LIST_H
|
||||||
|
#define CLASS_GERBER_FILE_IMAGE_LIST_H
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include <set>
|
||||||
|
|
||||||
|
//#include <dcode.h>
|
||||||
|
#include <class_gerber_draw_item.h>
|
||||||
|
#include <class_aperture_macro.h>
|
||||||
|
|
||||||
|
/* gerber files have different parameters to define units and how items must be plotted.
|
||||||
|
* some are for the entire file, and other can change along a file.
|
||||||
|
* In Gerber world:
|
||||||
|
* an image is the entire gerber file and its "global" parameters
|
||||||
|
* a layer (that is very different from a board layer) is just a sub set of a file that
|
||||||
|
* have specific parameters
|
||||||
|
* if a Image parameter is set more than once, only the last value is used
|
||||||
|
* Some parameters can change along a file and are not layer specific: they are stored
|
||||||
|
* in GERBER_ITEM items, when instancied.
|
||||||
|
*
|
||||||
|
* In GerbView, to handle these parameters, there are 2 classes:
|
||||||
|
* GERBER_FILE_IMAGE : the main class containing most of parameters and data to plot a graphic layer
|
||||||
|
* Some of them can change along the file
|
||||||
|
* There is one GERBER_FILE_IMAGE per file and one graphic layer per file or GERBER_FILE_IMAGE
|
||||||
|
* GerbView does not read and merge 2 gerber file in one graphic layer:
|
||||||
|
* I believe this is not possible due to the constraints in Image parameters.
|
||||||
|
* GERBER_LAYER : containing the subset of parameters that is layer speficic
|
||||||
|
* A GERBER_FILE_IMAGE must include one GERBER_LAYER to define all parameters to plot a file.
|
||||||
|
* But a GERBER_FILE_IMAGE can use more than one GERBER_LAYER.
|
||||||
|
*/
|
||||||
|
|
||||||
|
class GERBER_FILE_IMAGE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief GERBER_FILE_IMAGE_LIST is a helper class to handle a list of GERBER_FILE_IMAGE files
|
||||||
|
* which are loaded and can be displayed
|
||||||
|
* there are 32 images max which can be loaded
|
||||||
|
*/
|
||||||
|
class GERBER_FILE_IMAGE_LIST
|
||||||
|
{
|
||||||
|
// the list of loaded images (1 image = 1 gerber file)
|
||||||
|
std::vector<GERBER_FILE_IMAGE*> m_GERBER_List;
|
||||||
|
|
||||||
|
public:
|
||||||
|
GERBER_FILE_IMAGE_LIST();
|
||||||
|
~GERBER_FILE_IMAGE_LIST();
|
||||||
|
|
||||||
|
//Accessor
|
||||||
|
GERBER_FILE_IMAGE* GetGbrImage( int aIdx );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a GERBER_FILE_IMAGE* at index aIdx
|
||||||
|
* or at the first free location if aIdx < 0
|
||||||
|
* @param aGbrImage = the image to add
|
||||||
|
* @param aIdx = the location to use ( 0 ... GERBER_DRAWLAYERS_COUNT-1 )
|
||||||
|
* @return true if the index used, or -1 if no room to add image
|
||||||
|
*/
|
||||||
|
int AddGbrImage( GERBER_FILE_IMAGE* aGbrImage, int aIdx );
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* remove all loaded data in list
|
||||||
|
*/
|
||||||
|
void ClearList();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* remove the loaded data of image aIdx
|
||||||
|
* @param aIdx = the index ( 0 ... GERBER_DRAWLAYERS_COUNT-1 )
|
||||||
|
*/
|
||||||
|
void ClearImage( int aIdx );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return a name for image aIdx which can be used in layers manager
|
||||||
|
* and layer selector
|
||||||
|
* if a file is loaded, the name is:
|
||||||
|
* "<aIdx+1> <short filename> <X2 FileFunction info> if a X2 FileFunction info is found"
|
||||||
|
* or (if no FileFunction info)
|
||||||
|
* "<aIdx+1> <short filename> *"
|
||||||
|
* if no file loaded, the name is:
|
||||||
|
* "Layer n" with n = aIdx+1
|
||||||
|
* @param aIdx = the index ( 0 ... GERBER_DRAWLAYERS_COUNT-1 )
|
||||||
|
*/
|
||||||
|
const wxString GetDisplayName( int aIdx );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return true if image is used (loaded and with items)
|
||||||
|
* @param aIdx = the index ( 0 ... GERBER_DRAWLAYERS_COUNT-1 )
|
||||||
|
*/
|
||||||
|
bool IsUsed( int aIdx );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sort loaded images by Z order priority, if they have the X2 FileFormat info
|
||||||
|
* (SortImagesByZOrder updates the graphic layer of these items)
|
||||||
|
*/
|
||||||
|
void SortImagesByZOrder();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
extern GERBER_FILE_IMAGE_LIST g_GERBER_List;
|
||||||
|
|
||||||
|
#endif // ifndef CLASS_GERBER_FILE_IMAGE_LIST_H
|
|
@ -37,7 +37,7 @@
|
||||||
|
|
||||||
#include <gerbview.h>
|
#include <gerbview.h>
|
||||||
#include <gerbview_frame.h>
|
#include <gerbview_frame.h>
|
||||||
#include <class_gerber_file_image.h>
|
#include <class_gerber_file_image_list.h>
|
||||||
#include <layer_widget.h>
|
#include <layer_widget.h>
|
||||||
#include <class_gerbview_layer_widget.h>
|
#include <class_gerbview_layer_widget.h>
|
||||||
|
|
||||||
|
@ -208,7 +208,7 @@ void GERBER_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_SORT_GBR_LAYERS:
|
case ID_SORT_GBR_LAYERS:
|
||||||
g_GERBER_List.SortImagesByZOrder( myframe->GetItemsList() );
|
g_GERBER_List.SortImagesByZOrder();
|
||||||
myframe->ReFillLayerWidget();
|
myframe->ReFillLayerWidget();
|
||||||
myframe->syncLayerBox( true );
|
myframe->syncLayerBox( true );
|
||||||
myframe->GetCanvas()->Refresh();
|
myframe->GetCanvas()->Refresh();
|
||||||
|
|
|
@ -35,7 +35,19 @@
|
||||||
#include <gerbview.h>
|
#include <gerbview.h>
|
||||||
#include <gerbview_frame.h>
|
#include <gerbview_frame.h>
|
||||||
#include <class_gerber_file_image.h>
|
#include <class_gerber_file_image.h>
|
||||||
#include <pcbplot.h>
|
#include <class_gerber_file_image_list.h>
|
||||||
|
|
||||||
|
///@{
|
||||||
|
/// \ingroup config
|
||||||
|
|
||||||
|
#define OPTKEY_LAYERBASE wxT( "PlotLayer_%d" )
|
||||||
|
#define OPTKEY_PRINT_X_FINESCALE_ADJ wxT( "PrintXFineScaleAdj" )
|
||||||
|
#define OPTKEY_PRINT_Y_FINESCALE_ADJ wxT( "PrintYFineScaleAdj" )
|
||||||
|
#define OPTKEY_PRINT_SCALE wxT( "PrintScale" )
|
||||||
|
#define OPTKEY_PRINT_PAGE_FRAME wxT( "PrintPageFrame" )
|
||||||
|
#define OPTKEY_PRINT_MONOCHROME_MODE wxT( "PrintMonochrome" )
|
||||||
|
|
||||||
|
///@}
|
||||||
|
|
||||||
static double s_ScaleList[] =
|
static double s_ScaleList[] =
|
||||||
{ 0, 0.5, 0.7, 0.999, 1.0, 1.4, 2.0, 3.0, 4.0 };
|
{ 0, 0.5, 0.7, 0.999, 1.0, 1.4, 2.0, 3.0, 4.0 };
|
||||||
|
|
|
@ -33,7 +33,6 @@
|
||||||
#include <macros.h>
|
#include <macros.h>
|
||||||
#include <class_drawpanel.h>
|
#include <class_drawpanel.h>
|
||||||
|
|
||||||
#include <pcbplot.h>
|
|
||||||
#include <gerbview.h>
|
#include <gerbview.h>
|
||||||
#include <gerbview_frame.h>
|
#include <gerbview_frame.h>
|
||||||
#include <gerbview_dialog_display_options_frame_base.h>
|
#include <gerbview_dialog_display_options_frame_base.h>
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
#include <gerbview.h>
|
#include <gerbview.h>
|
||||||
#include <gerbview_frame.h>
|
#include <gerbview_frame.h>
|
||||||
#include <class_gerber_file_image.h>
|
#include <class_gerber_file_image.h>
|
||||||
|
#include <class_gerber_file_image_list.h>
|
||||||
#include <printout_controler.h>
|
#include <printout_controler.h>
|
||||||
|
|
||||||
|
|
||||||
|
@ -60,7 +61,7 @@ void GERBVIEW_FRAME::PrintPage( wxDC* aDC, LSET aPrintMasklayer,
|
||||||
PRINT_PARAMETERS* printParameters = (PRINT_PARAMETERS*) aData;
|
PRINT_PARAMETERS* printParameters = (PRINT_PARAMETERS*) aData;
|
||||||
|
|
||||||
// Find the layer to be printed
|
// Find the layer to be printed
|
||||||
int page = printParameters->m_Flags; // contains the page number (not necessarily layer number)
|
int page = printParameters->m_Flags; // contains the page number (not necessarily graphic layer number)
|
||||||
int layer = 0;
|
int layer = 0;
|
||||||
|
|
||||||
// Find the layer number for the printed page (search through the mask and count bits)
|
// Find the layer number for the printed page (search through the mask and count bits)
|
||||||
|
@ -157,57 +158,66 @@ void GERBVIEW_FRAME::DrawItemsDCodeID( wxDC* aDC, GR_DRAWMODE aDrawMode )
|
||||||
|
|
||||||
GRSetDrawMode( aDC, aDrawMode );
|
GRSetDrawMode( aDC, aDrawMode );
|
||||||
|
|
||||||
for( GERBER_DRAW_ITEM* item = GetItemsList(); item != NULL; item = item->Next() )
|
for( int layer = 0; layer < GERBER_DRAWLAYERS_COUNT; ++layer )
|
||||||
{
|
{
|
||||||
if( IsLayerVisible( item->GetLayer() ) == false )
|
GERBER_FILE_IMAGE* gerber = g_GERBER_List.GetGbrImage( layer );
|
||||||
|
|
||||||
|
if( gerber == NULL ) // Graphic layer not yet used
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( item->m_DCode <= 0 )
|
if( IsLayerVisible( layer ) == false )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( item->m_Flashed || item->m_Shape == GBR_ARC )
|
for( GERBER_DRAW_ITEM* item = gerber->GetItemsList(); item != NULL; item = item->Next() )
|
||||||
{
|
{
|
||||||
pos = item->m_Start;
|
|
||||||
|
if( item->m_DCode <= 0 )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if( item->m_Flashed || item->m_Shape == GBR_ARC )
|
||||||
|
{
|
||||||
|
pos = item->m_Start;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pos.x = (item->m_Start.x + item->m_End.x) / 2;
|
||||||
|
pos.y = (item->m_Start.y + item->m_End.y) / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
pos = item->GetABPosition( pos );
|
||||||
|
|
||||||
|
Line.Printf( wxT( "D%d" ), item->m_DCode );
|
||||||
|
|
||||||
|
if( item->GetDcodeDescr() )
|
||||||
|
width = item->GetDcodeDescr()->GetShapeDim( item );
|
||||||
|
else
|
||||||
|
width = std::min( item->m_Size.x, item->m_Size.y );
|
||||||
|
|
||||||
|
orient = TEXT_ORIENT_HORIZ;
|
||||||
|
|
||||||
|
if( item->m_Flashed )
|
||||||
|
{
|
||||||
|
// A reasonable size for text is width/3 because most of time this text has 3 chars.
|
||||||
|
width /= 3;
|
||||||
|
}
|
||||||
|
else // this item is a line
|
||||||
|
{
|
||||||
|
wxPoint delta = item->m_Start - item->m_End;
|
||||||
|
|
||||||
|
if( abs( delta.x ) < abs( delta.y ) )
|
||||||
|
orient = TEXT_ORIENT_VERT;
|
||||||
|
|
||||||
|
// A reasonable size for text is width/2 because text needs margin below and above it.
|
||||||
|
// a margin = width/4 seems good
|
||||||
|
width /= 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
int color = GetVisibleElementColor( DCODES_VISIBLE );
|
||||||
|
|
||||||
|
DrawGraphicText( m_canvas->GetClipBox(), aDC, pos, (EDA_COLOR_T) color, Line,
|
||||||
|
orient, wxSize( width, width ),
|
||||||
|
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
|
||||||
|
0, false, false );
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
pos.x = (item->m_Start.x + item->m_End.x) / 2;
|
|
||||||
pos.y = (item->m_Start.y + item->m_End.y) / 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
pos = item->GetABPosition( pos );
|
|
||||||
|
|
||||||
Line.Printf( wxT( "D%d" ), item->m_DCode );
|
|
||||||
|
|
||||||
if( item->GetDcodeDescr() )
|
|
||||||
width = item->GetDcodeDescr()->GetShapeDim( item );
|
|
||||||
else
|
|
||||||
width = std::min( item->m_Size.x, item->m_Size.y );
|
|
||||||
|
|
||||||
orient = TEXT_ORIENT_HORIZ;
|
|
||||||
|
|
||||||
if( item->m_Flashed )
|
|
||||||
{
|
|
||||||
// A reasonable size for text is width/3 because most of time this text has 3 chars.
|
|
||||||
width /= 3;
|
|
||||||
}
|
|
||||||
else // this item is a line
|
|
||||||
{
|
|
||||||
wxPoint delta = item->m_Start - item->m_End;
|
|
||||||
|
|
||||||
if( abs( delta.x ) < abs( delta.y ) )
|
|
||||||
orient = TEXT_ORIENT_VERT;
|
|
||||||
|
|
||||||
// A reasonable size for text is width/2 because text needs margin below and above it.
|
|
||||||
// a margin = width/4 seems good
|
|
||||||
width /= 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
int color = GetVisibleElementColor( DCODES_VISIBLE );
|
|
||||||
|
|
||||||
DrawGraphicText( m_canvas->GetClipBox(), aDC, pos, (EDA_COLOR_T) color, Line,
|
|
||||||
orient, wxSize( width, width ),
|
|
||||||
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
|
|
||||||
0, false, false );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#include <kicad_device_context.h>
|
#include <kicad_device_context.h>
|
||||||
#include <gerbview_id.h>
|
#include <gerbview_id.h>
|
||||||
#include <class_gerber_file_image.h>
|
#include <class_gerber_file_image.h>
|
||||||
|
#include <class_gerber_file_image_list.h>
|
||||||
#include <dialog_helpers.h>
|
#include <dialog_helpers.h>
|
||||||
#include <class_DCodeSelectionbox.h>
|
#include <class_DCodeSelectionbox.h>
|
||||||
#include <class_gerbview_layer_widget.h>
|
#include <class_gerbview_layer_widget.h>
|
||||||
|
@ -58,7 +59,6 @@ BEGIN_EVENT_TABLE( GERBVIEW_FRAME, EDA_DRAW_FRAME )
|
||||||
// Menu Files:
|
// Menu Files:
|
||||||
EVT_MENU( wxID_FILE, GERBVIEW_FRAME::Files_io )
|
EVT_MENU( wxID_FILE, GERBVIEW_FRAME::Files_io )
|
||||||
EVT_MENU( ID_NEW_BOARD, GERBVIEW_FRAME::Files_io )
|
EVT_MENU( ID_NEW_BOARD, GERBVIEW_FRAME::Files_io )
|
||||||
EVT_MENU( ID_GEN_PLOT, GERBVIEW_FRAME::ToPlotter )
|
|
||||||
EVT_MENU( ID_GERBVIEW_EXPORT_TO_PCBNEW, GERBVIEW_FRAME::ExportDataInPcbnewFormat )
|
EVT_MENU( ID_GERBVIEW_EXPORT_TO_PCBNEW, GERBVIEW_FRAME::ExportDataInPcbnewFormat )
|
||||||
|
|
||||||
EVT_MENU_RANGE( wxID_FILE1, wxID_FILE9, GERBVIEW_FRAME::OnGbrFileHistory )
|
EVT_MENU_RANGE( wxID_FILE1, wxID_FILE9, GERBVIEW_FRAME::OnGbrFileHistory )
|
||||||
|
|
|
@ -69,6 +69,7 @@
|
||||||
#include <gerbview.h>
|
#include <gerbview.h>
|
||||||
#include <gerbview_frame.h>
|
#include <gerbview_frame.h>
|
||||||
#include <class_gerber_file_image.h>
|
#include <class_gerber_file_image.h>
|
||||||
|
#include <class_gerber_file_image_list.h>
|
||||||
#include <class_excellon.h>
|
#include <class_excellon.h>
|
||||||
#include <kicad_string.h>
|
#include <kicad_string.h>
|
||||||
#include <class_X2_gerber_attributes.h>
|
#include <class_X2_gerber_attributes.h>
|
||||||
|
@ -87,16 +88,16 @@ static const int fmtIntegerInch = 2;
|
||||||
|
|
||||||
extern int ReadInt( char*& text, bool aSkipSeparator = true );
|
extern int ReadInt( char*& text, bool aSkipSeparator = true );
|
||||||
extern double ReadDouble( char*& text, bool aSkipSeparator = true );
|
extern double ReadDouble( char*& text, bool aSkipSeparator = true );
|
||||||
|
|
||||||
|
// See ds274d.cpp:
|
||||||
extern void fillFlashedGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
|
extern void fillFlashedGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
|
||||||
APERTURE_T aAperture,
|
APERTURE_T aAperture,
|
||||||
int Dcode_index,
|
int Dcode_index,
|
||||||
int aLayer,
|
|
||||||
const wxPoint& aPos,
|
const wxPoint& aPos,
|
||||||
wxSize aSize,
|
wxSize aSize,
|
||||||
bool aLayerNegative );
|
bool aLayerNegative );
|
||||||
void fillLineGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
|
void fillLineGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
|
||||||
int Dcode_index,
|
int Dcode_index,
|
||||||
int aLayer,
|
|
||||||
const wxPoint& aStart,
|
const wxPoint& aStart,
|
||||||
const wxPoint& aEnd,
|
const wxPoint& aEnd,
|
||||||
wxSize aPenSize,
|
wxSize aPenSize,
|
||||||
|
@ -547,22 +548,19 @@ bool EXCELLON_IMAGE::Execute_Drill_Command( char*& text )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
gbritem = new GERBER_DRAW_ITEM( GetParent()->GetGerberLayout(), this );
|
gbritem = new GERBER_DRAW_ITEM( this );
|
||||||
GetParent()->GetGerberLayout()->m_Drawings.Append( gbritem );
|
m_Drawings.Append( gbritem );
|
||||||
|
|
||||||
if( m_SlotOn ) // Oval hole
|
if( m_SlotOn ) // Oval hole
|
||||||
{
|
{
|
||||||
fillLineGBRITEM( gbritem,
|
fillLineGBRITEM( gbritem, tool->m_Num_Dcode,
|
||||||
tool->m_Num_Dcode, GetParent()->getActiveLayer(),
|
|
||||||
m_PreviousPos, m_CurrentPos,
|
m_PreviousPos, m_CurrentPos,
|
||||||
tool->m_Size, false );
|
tool->m_Size, false );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fillFlashedGBRITEM( gbritem, tool->m_Shape,
|
fillFlashedGBRITEM( gbritem, tool->m_Shape, tool->m_Num_Dcode,
|
||||||
tool->m_Num_Dcode, GetParent()->getActiveLayer(),
|
m_CurrentPos, tool->m_Size, false );
|
||||||
m_CurrentPos,
|
|
||||||
tool->m_Size, false );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
StepAndRepeatItem( *gbritem );
|
StepAndRepeatItem( *gbritem );
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#include <gerbview.h>
|
#include <gerbview.h>
|
||||||
#include <gerbview_frame.h>
|
#include <gerbview_frame.h>
|
||||||
#include <class_gerber_file_image.h>
|
#include <class_gerber_file_image.h>
|
||||||
|
#include <class_gerber_file_image_list.h>
|
||||||
#include <select_layers_to_pcb.h>
|
#include <select_layers_to_pcb.h>
|
||||||
#include <build_version.h>
|
#include <build_version.h>
|
||||||
#include <wildcards_and_files_ext.h>
|
#include <wildcards_and_files_ext.h>
|
||||||
|
@ -219,33 +220,45 @@ bool GBR_TO_PCB_EXPORTER::ExportPcb( LAYER_NUM* aLayerLookUpTable, int aCopperLa
|
||||||
|
|
||||||
// create an image of gerber data
|
// create an image of gerber data
|
||||||
// First: non copper layers:
|
// First: non copper layers:
|
||||||
GERBER_DRAW_ITEM* gerb_item = m_gerbview_frame->GetItemsList();
|
const int pcbCopperLayerMax = 31;
|
||||||
int pcbCopperLayerMax = 31;
|
|
||||||
|
|
||||||
for( ; gerb_item; gerb_item = gerb_item->Next() )
|
for( int layer = 0; layer < GERBER_DRAWLAYERS_COUNT; ++layer )
|
||||||
{
|
{
|
||||||
int layer = gerb_item->GetLayer();
|
GERBER_FILE_IMAGE* gerber = g_GERBER_List.GetGbrImage( layer );
|
||||||
|
|
||||||
|
if( gerber == NULL ) // Graphic layer not yet used
|
||||||
|
continue;
|
||||||
|
|
||||||
LAYER_NUM pcb_layer_number = aLayerLookUpTable[layer];
|
LAYER_NUM pcb_layer_number = aLayerLookUpTable[layer];
|
||||||
|
|
||||||
if( !IsPcbLayer( pcb_layer_number ) )
|
if( !IsPcbLayer( pcb_layer_number ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( pcb_layer_number > pcbCopperLayerMax )
|
if( pcb_layer_number <= pcbCopperLayerMax ) // copper layer
|
||||||
|
continue;
|
||||||
|
|
||||||
|
GERBER_DRAW_ITEM* gerb_item = gerber->GetItemsList();
|
||||||
|
|
||||||
|
for( ; gerb_item; gerb_item = gerb_item->Next() )
|
||||||
export_non_copper_item( gerb_item, pcb_layer_number );
|
export_non_copper_item( gerb_item, pcb_layer_number );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copper layers
|
// Copper layers
|
||||||
gerb_item = m_gerbview_frame->GetItemsList();
|
for( int layer = 0; layer < GERBER_DRAWLAYERS_COUNT; ++layer )
|
||||||
|
|
||||||
for( ; gerb_item; gerb_item = gerb_item->Next() )
|
|
||||||
{
|
{
|
||||||
int layer = gerb_item->GetLayer();
|
GERBER_FILE_IMAGE* gerber = g_GERBER_List.GetGbrImage( layer );
|
||||||
|
|
||||||
|
if( gerber == NULL ) // Graphic layer not yet used
|
||||||
|
continue;
|
||||||
|
|
||||||
LAYER_NUM pcb_layer_number = aLayerLookUpTable[layer];
|
LAYER_NUM pcb_layer_number = aLayerLookUpTable[layer];
|
||||||
|
|
||||||
if( pcb_layer_number < 0 || pcb_layer_number > pcbCopperLayerMax )
|
if( pcb_layer_number < 0 || pcb_layer_number > pcbCopperLayerMax )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
else
|
GERBER_DRAW_ITEM* gerb_item = gerber->GetItemsList();
|
||||||
|
|
||||||
|
for( ; gerb_item; gerb_item = gerb_item->Next() )
|
||||||
export_copper_item( gerb_item, pcb_layer_number );
|
export_copper_item( gerb_item, pcb_layer_number );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
* Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -43,6 +43,7 @@
|
||||||
#include <gerbview_id.h>
|
#include <gerbview_id.h>
|
||||||
#include <hotkeys.h>
|
#include <hotkeys.h>
|
||||||
#include <class_gerber_file_image.h>
|
#include <class_gerber_file_image.h>
|
||||||
|
#include <class_gerber_file_image_list.h>
|
||||||
#include <dialog_helpers.h>
|
#include <dialog_helpers.h>
|
||||||
#include <class_DCodeSelectionbox.h>
|
#include <class_DCodeSelectionbox.h>
|
||||||
#include <class_gerbview_layer_widget.h>
|
#include <class_gerbview_layer_widget.h>
|
||||||
|
@ -169,6 +170,7 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ):
|
||||||
|
|
||||||
setActiveLayer( 0, true );
|
setActiveLayer( 0, true );
|
||||||
Zoom_Automatique( false ); // Gives a default zoom value
|
Zoom_Automatique( false ); // Gives a default zoom value
|
||||||
|
UpdateTitleAndInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -227,21 +229,23 @@ bool GERBVIEW_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
|
||||||
|
|
||||||
double GERBVIEW_FRAME::BestZoom()
|
double GERBVIEW_FRAME::BestZoom()
|
||||||
{
|
{
|
||||||
GERBER_DRAW_ITEM* item = GetGerberLayout()->m_Drawings;
|
|
||||||
|
|
||||||
// gives a minimal value to zoom, if no item in list
|
|
||||||
if( item == NULL )
|
|
||||||
return ZOOM_FACTOR( 350.0 );
|
|
||||||
|
|
||||||
EDA_RECT bbox = GetGerberLayout()->ComputeBoundingBox();
|
EDA_RECT bbox = GetGerberLayout()->ComputeBoundingBox();
|
||||||
|
|
||||||
|
// gives a size to bbox (current page size), if no item in list
|
||||||
|
if( bbox.GetWidth() == 0 || bbox.GetHeight() == 0 )
|
||||||
|
{
|
||||||
|
wxSize pagesize = GetPageSettings().GetSizeMils();
|
||||||
|
bbox.SetSize( wxSize( Mils2iu( pagesize.x ), Mils2iu( pagesize.y ) ) );
|
||||||
|
}
|
||||||
|
|
||||||
wxSize size = m_canvas->GetClientSize();
|
wxSize size = m_canvas->GetClientSize();
|
||||||
|
|
||||||
double x = (double) bbox.GetWidth() / (double) size.x;
|
double x = (double) bbox.GetWidth() * 1.1 / (double) size.x;
|
||||||
double y = (double) bbox.GetHeight() / (double) size.y;
|
double y = (double) bbox.GetHeight() * 1.1 / (double) size.y;
|
||||||
|
double best_zoom = std::max( x, y );
|
||||||
|
|
||||||
SetScrollCenterPosition( bbox.Centre() );
|
SetScrollCenterPosition( bbox.Centre() );
|
||||||
|
|
||||||
double best_zoom = std::max( x, y );
|
|
||||||
return best_zoom;
|
return best_zoom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,9 +264,7 @@ void GERBVIEW_FRAME::LoadSettings( wxConfigBase* aCfg )
|
||||||
if( m_showBorderAndTitleBlock )
|
if( m_showBorderAndTitleBlock )
|
||||||
{
|
{
|
||||||
wxString pageType;
|
wxString pageType;
|
||||||
|
|
||||||
aCfg->Read( cfgShowPageSizeOption, &pageType, wxT( "GERBER" ) );
|
aCfg->Read( cfgShowPageSizeOption, &pageType, wxT( "GERBER" ) );
|
||||||
|
|
||||||
pageInfo.SetType( pageType );
|
pageInfo.SetType( pageType );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -472,8 +474,8 @@ void GERBVIEW_FRAME::Liste_D_Codes()
|
||||||
|
|
||||||
void GERBVIEW_FRAME::UpdateTitleAndInfo()
|
void GERBVIEW_FRAME::UpdateTitleAndInfo()
|
||||||
{
|
{
|
||||||
GERBER_FILE_IMAGE* gerber = g_GERBER_List.GetGbrImage( getActiveLayer() );
|
GERBER_FILE_IMAGE* gerber = g_GERBER_List.GetGbrImage( getActiveLayer() );
|
||||||
wxString text;
|
wxString text;
|
||||||
|
|
||||||
// Display the gerber filename
|
// Display the gerber filename
|
||||||
if( gerber == NULL )
|
if( gerber == NULL )
|
||||||
|
@ -483,6 +485,10 @@ void GERBVIEW_FRAME::UpdateTitleAndInfo()
|
||||||
SetStatusText( wxEmptyString, 0 );
|
SetStatusText( wxEmptyString, 0 );
|
||||||
text.Printf( _( "Drawing layer %d not in use" ), getActiveLayer() + 1 );
|
text.Printf( _( "Drawing layer %d not in use" ), getActiveLayer() + 1 );
|
||||||
m_TextInfo->SetValue( text );
|
m_TextInfo->SetValue( text );
|
||||||
|
|
||||||
|
if( EnsureTextCtrlWidth( m_TextInfo, &text ) ) // Resized
|
||||||
|
m_auimgr.Update();
|
||||||
|
|
||||||
ClearMsgPanel();
|
ClearMsgPanel();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,16 +110,6 @@ public:
|
||||||
return m_gerberLayout;
|
return m_gerberLayout;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Function GetItemsList
|
|
||||||
* @return the first GERBER_DRAW_ITEM * item of the items list
|
|
||||||
*/
|
|
||||||
GERBER_DRAW_ITEM* GetItemsList()
|
|
||||||
{
|
|
||||||
GERBER_DRAW_ITEM* item = GetGerberLayout()->m_Drawings;
|
|
||||||
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetGerberLayoutBoundingBox
|
* Function GetGerberLayoutBoundingBox
|
||||||
|
@ -578,13 +568,6 @@ public:
|
||||||
*/
|
*/
|
||||||
void Block_Move( wxDC* DC );
|
void Block_Move( wxDC* DC );
|
||||||
|
|
||||||
/**
|
|
||||||
* Function ToPlotter
|
|
||||||
* Open a dialog frame to create plot and drill files
|
|
||||||
* relative to the current board
|
|
||||||
*/
|
|
||||||
void ToPlotter( wxCommandEvent& event );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function ToPrinter
|
* Function ToPrinter
|
||||||
* Open a dialog frame to print layers
|
* Open a dialog frame to print layers
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
|
|
||||||
#include <gerbview_frame.h>
|
#include <gerbview_frame.h>
|
||||||
#include <class_gerber_file_image.h>
|
#include <class_gerber_file_image.h>
|
||||||
|
#include <class_gerber_file_image_list.h>
|
||||||
#include <class_gerbview_layer_widget.h>
|
#include <class_gerbview_layer_widget.h>
|
||||||
|
|
||||||
bool GERBVIEW_FRAME::Clear_DrawLayers( bool query )
|
bool GERBVIEW_FRAME::Clear_DrawLayers( bool query )
|
||||||
|
@ -45,7 +46,15 @@ bool GERBVIEW_FRAME::Clear_DrawLayers( bool query )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetGerberLayout()->m_Drawings.DeleteAll();
|
for( int layer = 0; layer < GERBER_DRAWLAYERS_COUNT; ++layer )
|
||||||
|
{
|
||||||
|
GERBER_FILE_IMAGE* gerber = g_GERBER_List.GetGbrImage( layer );
|
||||||
|
|
||||||
|
if( gerber == NULL ) // Graphic layer not yet used
|
||||||
|
continue;
|
||||||
|
|
||||||
|
gerber->m_Drawings.DeleteAll();
|
||||||
|
}
|
||||||
|
|
||||||
g_GERBER_List.ClearList();
|
g_GERBER_List.ClearList();
|
||||||
|
|
||||||
|
@ -72,18 +81,10 @@ void GERBVIEW_FRAME::Erase_Current_DrawLayer( bool query )
|
||||||
|
|
||||||
SetCurItem( NULL );
|
SetCurItem( NULL );
|
||||||
|
|
||||||
GERBER_DRAW_ITEM* item = GetGerberLayout()->m_Drawings;
|
GERBER_FILE_IMAGE* gerber = g_GERBER_List.GetGbrImage( layer );
|
||||||
GERBER_DRAW_ITEM * next;
|
|
||||||
|
|
||||||
for( ; item; item = next )
|
if( gerber ) // gerber == NULL should not occur
|
||||||
{
|
gerber->m_Drawings.DeleteAll();
|
||||||
next = item->Next();
|
|
||||||
|
|
||||||
if( item->GetLayer() != layer )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
item->DeleteStructure();
|
|
||||||
}
|
|
||||||
|
|
||||||
g_GERBER_List.ClearImage( layer );
|
g_GERBER_List.ClearImage( layer );
|
||||||
|
|
||||||
|
|
|
@ -32,9 +32,11 @@
|
||||||
|
|
||||||
#include <gerbview.h>
|
#include <gerbview.h>
|
||||||
#include <gerbview_frame.h>
|
#include <gerbview_frame.h>
|
||||||
|
#include <class_gerber_file_image.h>
|
||||||
|
#include <class_gerber_file_image_list.h>
|
||||||
|
|
||||||
|
|
||||||
/* localize a gerber item and return a pointer to it.
|
/* locate a gerber item and return a pointer to it.
|
||||||
* Display info about this item
|
* Display info about this item
|
||||||
*/
|
*/
|
||||||
GERBER_DRAW_ITEM* GERBVIEW_FRAME::Locate( const wxPoint& aPosition, int aTypeloc )
|
GERBER_DRAW_ITEM* GERBVIEW_FRAME::Locate( const wxPoint& aPosition, int aTypeloc )
|
||||||
|
@ -47,25 +49,14 @@ GERBER_DRAW_ITEM* GERBVIEW_FRAME::Locate( const wxPoint& aPosition, int aTypeloc
|
||||||
ref = GetNearestGridPosition( ref );
|
ref = GetNearestGridPosition( ref );
|
||||||
|
|
||||||
int layer = getActiveLayer();
|
int layer = getActiveLayer();
|
||||||
|
GERBER_FILE_IMAGE* gerber = g_GERBER_List.GetGbrImage( layer );
|
||||||
|
|
||||||
// Search first on active layer
|
// Search first on active layer
|
||||||
GERBER_DRAW_ITEM* gerb_item = GetItemsList();
|
GERBER_DRAW_ITEM* gerb_item;
|
||||||
|
|
||||||
for( ; gerb_item; gerb_item = gerb_item->Next() )
|
if( gerber ) // A not used graphic layer can be selected. So gerber can be NULL
|
||||||
{
|
{
|
||||||
if( gerb_item->GetLayer()!= layer )
|
for( gerb_item = gerber->GetItemsList(); gerb_item; gerb_item = gerb_item->Next() )
|
||||||
continue;
|
|
||||||
|
|
||||||
if( gerb_item->HitTest( ref ) )
|
|
||||||
{
|
|
||||||
found = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !found ) // Search on all layers
|
|
||||||
{
|
|
||||||
for( gerb_item = GetItemsList(); gerb_item; gerb_item = gerb_item->Next() )
|
|
||||||
{
|
{
|
||||||
if( gerb_item->HitTest( ref ) )
|
if( gerb_item->HitTest( ref ) )
|
||||||
{
|
{
|
||||||
|
@ -75,6 +66,26 @@ GERBER_DRAW_ITEM* GERBVIEW_FRAME::Locate( const wxPoint& aPosition, int aTypeloc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( !found ) // Search on all layers
|
||||||
|
{
|
||||||
|
for( layer = 0; layer < GERBER_DRAWLAYERS_COUNT; ++layer )
|
||||||
|
{
|
||||||
|
gerber = g_GERBER_List.GetGbrImage( layer );
|
||||||
|
|
||||||
|
if( gerber == NULL ) // Graphic layer not yet used
|
||||||
|
continue;
|
||||||
|
|
||||||
|
for( gerb_item = gerber->GetItemsList(); gerb_item; gerb_item = gerb_item->Next() )
|
||||||
|
{
|
||||||
|
if( gerb_item->HitTest( ref ) )
|
||||||
|
{
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if( found )
|
if( found )
|
||||||
{
|
{
|
||||||
MSG_PANEL_ITEMS items;
|
MSG_PANEL_ITEMS items;
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include <gerbview.h>
|
#include <gerbview.h>
|
||||||
#include <gerbview_frame.h>
|
#include <gerbview_frame.h>
|
||||||
#include <class_gerber_file_image.h>
|
#include <class_gerber_file_image.h>
|
||||||
|
#include <class_gerber_file_image_list.h>
|
||||||
#include <dialog_helpers.h>
|
#include <dialog_helpers.h>
|
||||||
|
|
||||||
/* Process the command triggered by the left button of the mouse
|
/* Process the command triggered by the left button of the mouse
|
||||||
|
|
|
@ -1,36 +0,0 @@
|
||||||
/*
|
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2007-2014 Jean-Pierre Charras jp.charras at wanadoo.fr
|
|
||||||
* Copyright (C) 1992-2014 KiCad Developers, see change_log.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 Free Software Foundation; either version 2
|
|
||||||
* of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, you may find one here:
|
|
||||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
||||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
||||||
* or you may write to the Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <fctsys.h>
|
|
||||||
#include <common.h>
|
|
||||||
|
|
||||||
#include <gerbview.h>
|
|
||||||
#include <gerbview_frame.h>
|
|
||||||
#include <pcbplot.h>
|
|
||||||
|
|
||||||
/** TODO */
|
|
||||||
void GERBVIEW_FRAME::ToPlotter(wxCommandEvent& event)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,44 +0,0 @@
|
||||||
/*
|
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2007 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
|
||||||
* Copyright (C) 1992-2011 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 Free Software Foundation; either version 2
|
|
||||||
* of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, you may find one here:
|
|
||||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
||||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
||||||
* or you may write to the Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @file gerbview/pcbplot.h
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef PCBPLOT_H
|
|
||||||
#define PCBPLOT_H
|
|
||||||
|
|
||||||
///@{
|
|
||||||
/// \ingroup config
|
|
||||||
|
|
||||||
#define OPTKEY_LAYERBASE wxT( "PlotLayer_%d" )
|
|
||||||
#define OPTKEY_PRINT_X_FINESCALE_ADJ wxT( "PrintXFineScaleAdj" )
|
|
||||||
#define OPTKEY_PRINT_Y_FINESCALE_ADJ wxT( "PrintYFineScaleAdj" )
|
|
||||||
#define OPTKEY_PRINT_SCALE wxT( "PrintScale" )
|
|
||||||
#define OPTKEY_PRINT_PAGE_FRAME wxT( "PrintPageFrame" )
|
|
||||||
#define OPTKEY_PRINT_MONOCHROME_MODE wxT( "PrintMonochrome" )
|
|
||||||
|
|
||||||
///@}
|
|
||||||
|
|
||||||
#endif // ifndef PCBPLOT_H
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include <gerbview.h>
|
#include <gerbview.h>
|
||||||
#include <gerbview_frame.h>
|
#include <gerbview_frame.h>
|
||||||
#include <class_gerber_file_image.h>
|
#include <class_gerber_file_image.h>
|
||||||
|
#include <class_gerber_file_image_list.h>
|
||||||
|
|
||||||
#include <html_messagebox.h>
|
#include <html_messagebox.h>
|
||||||
#include <macros.h>
|
#include <macros.h>
|
||||||
|
|
|
@ -106,14 +106,12 @@
|
||||||
* @param aLayerNegative = true if the current layer is negative
|
* @param aLayerNegative = true if the current layer is negative
|
||||||
*/
|
*/
|
||||||
void fillFlashedGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
|
void fillFlashedGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
|
||||||
APERTURE_T aAperture,
|
APERTURE_T aAperture,
|
||||||
int Dcode_index,
|
int Dcode_index,
|
||||||
int aLayer,
|
const wxPoint& aPos,
|
||||||
const wxPoint& aPos,
|
wxSize aSize,
|
||||||
wxSize aSize,
|
bool aLayerNegative )
|
||||||
bool aLayerNegative )
|
|
||||||
{
|
{
|
||||||
aGbrItem->SetLayer( aLayer );
|
|
||||||
aGbrItem->m_Size = aSize;
|
aGbrItem->m_Size = aSize;
|
||||||
aGbrItem->m_Start = aPos;
|
aGbrItem->m_Start = aPos;
|
||||||
aGbrItem->m_End = aGbrItem->m_Start;
|
aGbrItem->m_End = aGbrItem->m_Start;
|
||||||
|
@ -160,13 +158,11 @@ void fillFlashedGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
|
||||||
*/
|
*/
|
||||||
void fillLineGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
|
void fillLineGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
|
||||||
int Dcode_index,
|
int Dcode_index,
|
||||||
int aLayer,
|
|
||||||
const wxPoint& aStart,
|
const wxPoint& aStart,
|
||||||
const wxPoint& aEnd,
|
const wxPoint& aEnd,
|
||||||
wxSize aPenSize,
|
wxSize aPenSize,
|
||||||
bool aLayerNegative )
|
bool aLayerNegative )
|
||||||
{
|
{
|
||||||
aGbrItem->SetLayer( aLayer );
|
|
||||||
aGbrItem->m_Flashed = false;
|
aGbrItem->m_Flashed = false;
|
||||||
|
|
||||||
aGbrItem->m_Size = aPenSize;
|
aGbrItem->m_Size = aPenSize;
|
||||||
|
@ -209,7 +205,7 @@ void fillLineGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
|
||||||
* false when arc is inside one quadrant
|
* false when arc is inside one quadrant
|
||||||
* @param aLayerNegative = true if the current layer is negative
|
* @param aLayerNegative = true if the current layer is negative
|
||||||
*/
|
*/
|
||||||
static void fillArcGBRITEM( GERBER_DRAW_ITEM* aGbrItem, int Dcode_index, int aLayer,
|
static void fillArcGBRITEM( GERBER_DRAW_ITEM* aGbrItem, int Dcode_index,
|
||||||
const wxPoint& aStart, const wxPoint& aEnd,
|
const wxPoint& aStart, const wxPoint& aEnd,
|
||||||
const wxPoint& aRelCenter, wxSize aPenSize,
|
const wxPoint& aRelCenter, wxSize aPenSize,
|
||||||
bool aClockwise, bool aMultiquadrant,
|
bool aClockwise, bool aMultiquadrant,
|
||||||
|
@ -218,7 +214,6 @@ static void fillArcGBRITEM( GERBER_DRAW_ITEM* aGbrItem, int Dcode_index, int aL
|
||||||
wxPoint center, delta;
|
wxPoint center, delta;
|
||||||
|
|
||||||
aGbrItem->m_Shape = GBR_ARC;
|
aGbrItem->m_Shape = GBR_ARC;
|
||||||
aGbrItem->SetLayer( aLayer );
|
|
||||||
aGbrItem->m_Size = aPenSize;
|
aGbrItem->m_Size = aPenSize;
|
||||||
aGbrItem->m_Flashed = false;
|
aGbrItem->m_Flashed = false;
|
||||||
|
|
||||||
|
@ -343,12 +338,11 @@ static void fillArcPOLY( GERBER_DRAW_ITEM* aGbrItem,
|
||||||
/* in order to calculate arc parameters, we use fillArcGBRITEM
|
/* in order to calculate arc parameters, we use fillArcGBRITEM
|
||||||
* so we muse create a dummy track and use its geometric parameters
|
* so we muse create a dummy track and use its geometric parameters
|
||||||
*/
|
*/
|
||||||
static GERBER_DRAW_ITEM dummyGbrItem( NULL, NULL );
|
static GERBER_DRAW_ITEM dummyGbrItem( NULL );
|
||||||
static const int drawlayer = 0;
|
|
||||||
|
|
||||||
aGbrItem->SetLayerPolarity( aLayerNegative );
|
aGbrItem->SetLayerPolarity( aLayerNegative );
|
||||||
|
|
||||||
fillArcGBRITEM( &dummyGbrItem, 0, drawlayer,
|
fillArcGBRITEM( &dummyGbrItem, 0,
|
||||||
aStart, aEnd, rel_center, wxSize(0, 0),
|
aStart, aEnd, rel_center, wxSize(0, 0),
|
||||||
aClockwise, aMultiquadrant, aLayerNegative );
|
aClockwise, aMultiquadrant, aLayerNegative );
|
||||||
|
|
||||||
|
@ -550,9 +544,9 @@ bool GERBER_FILE_IMAGE::Execute_G_Command( char*& text, int G_command )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GC_TURN_OFF_POLY_FILL:
|
case GC_TURN_OFF_POLY_FILL:
|
||||||
if( m_Exposure && m_parent->GetGerberLayout()->m_Drawings ) // End of polygon
|
if( m_Exposure && GetItemsList() ) // End of polygon
|
||||||
{
|
{
|
||||||
GERBER_DRAW_ITEM * gbritem = m_parent->GetGerberLayout()->m_Drawings.GetLast();
|
GERBER_DRAW_ITEM * gbritem = m_Drawings.GetLast();
|
||||||
StepAndRepeatItem( *gbritem );
|
StepAndRepeatItem( *gbritem );
|
||||||
}
|
}
|
||||||
m_Exposure = false;
|
m_Exposure = false;
|
||||||
|
@ -581,16 +575,11 @@ bool GERBER_FILE_IMAGE::Execute_DCODE_Command( char*& text, int D_commande )
|
||||||
|
|
||||||
APERTURE_T aperture = APT_CIRCLE;
|
APERTURE_T aperture = APT_CIRCLE;
|
||||||
GERBER_DRAW_ITEM* gbritem;
|
GERBER_DRAW_ITEM* gbritem;
|
||||||
GBR_LAYOUT* layout = m_parent->GetGerberLayout();
|
|
||||||
|
|
||||||
int activeLayer = m_parent->getActiveLayer();
|
|
||||||
|
|
||||||
int dcode = 0;
|
int dcode = 0;
|
||||||
D_CODE* tool = NULL;
|
D_CODE* tool = NULL;
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
// D( printf( "%22s: D_CODE<%d>\n", __func__, D_commande ); )
|
|
||||||
|
|
||||||
if( D_commande >= FIRST_DCODE ) // This is a "Set tool" command
|
if( D_commande >= FIRST_DCODE ) // This is a "Set tool" command
|
||||||
{
|
{
|
||||||
if( D_commande > (TOOLS_MAX_COUNT - 1) )
|
if( D_commande > (TOOLS_MAX_COUNT - 1) )
|
||||||
|
@ -619,10 +608,9 @@ bool GERBER_FILE_IMAGE::Execute_DCODE_Command( char*& text, int D_commande )
|
||||||
if( !m_Exposure ) // Start a new polygon outline:
|
if( !m_Exposure ) // Start a new polygon outline:
|
||||||
{
|
{
|
||||||
m_Exposure = true;
|
m_Exposure = true;
|
||||||
gbritem = new GERBER_DRAW_ITEM( layout, this );
|
gbritem = new GERBER_DRAW_ITEM( this );
|
||||||
layout->m_Drawings.Append( gbritem );
|
m_Drawings.Append( gbritem );
|
||||||
gbritem->m_Shape = GBR_POLYGON;
|
gbritem->m_Shape = GBR_POLYGON;
|
||||||
gbritem->SetLayer( activeLayer );
|
|
||||||
gbritem->m_Flashed = false;
|
gbritem->m_Flashed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -630,7 +618,7 @@ bool GERBER_FILE_IMAGE::Execute_DCODE_Command( char*& text, int D_commande )
|
||||||
{
|
{
|
||||||
case GERB_INTERPOL_ARC_NEG:
|
case GERB_INTERPOL_ARC_NEG:
|
||||||
case GERB_INTERPOL_ARC_POS:
|
case GERB_INTERPOL_ARC_POS:
|
||||||
gbritem = layout->m_Drawings.GetLast();
|
gbritem = m_Drawings.GetLast();
|
||||||
|
|
||||||
// D( printf( "Add arc poly %d,%d to %d,%d fill %d interpol %d 360_enb %d\n",
|
// D( printf( "Add arc poly %d,%d to %d,%d fill %d interpol %d 360_enb %d\n",
|
||||||
// m_PreviousPos.x, m_PreviousPos.y, m_CurrentPos.x,
|
// m_PreviousPos.x, m_PreviousPos.y, m_CurrentPos.x,
|
||||||
|
@ -643,7 +631,7 @@ bool GERBER_FILE_IMAGE::Execute_DCODE_Command( char*& text, int D_commande )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
gbritem = layout->m_Drawings.GetLast();
|
gbritem = m_Drawings.GetLast();
|
||||||
|
|
||||||
// D( printf( "Add poly edge %d,%d to %d,%d fill %d\n",
|
// D( printf( "Add poly edge %d,%d to %d,%d fill %d\n",
|
||||||
// m_PreviousPos.x, m_PreviousPos.y,
|
// m_PreviousPos.x, m_PreviousPos.y,
|
||||||
|
@ -663,9 +651,9 @@ bool GERBER_FILE_IMAGE::Execute_DCODE_Command( char*& text, int D_commande )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2: // code D2: exposure OFF (i.e. "move to")
|
case 2: // code D2: exposure OFF (i.e. "move to")
|
||||||
if( m_Exposure && layout->m_Drawings ) // End of polygon
|
if( m_Exposure && GetItemsList() ) // End of polygon
|
||||||
{
|
{
|
||||||
gbritem = layout->m_Drawings.GetLast();
|
gbritem = m_Drawings.GetLast();
|
||||||
StepAndRepeatItem( *gbritem );
|
StepAndRepeatItem( *gbritem );
|
||||||
}
|
}
|
||||||
m_Exposure = false;
|
m_Exposure = false;
|
||||||
|
@ -695,13 +683,13 @@ bool GERBER_FILE_IMAGE::Execute_DCODE_Command( char*& text, int D_commande )
|
||||||
switch( m_Iterpolation )
|
switch( m_Iterpolation )
|
||||||
{
|
{
|
||||||
case GERB_INTERPOL_LINEAR_1X:
|
case GERB_INTERPOL_LINEAR_1X:
|
||||||
gbritem = new GERBER_DRAW_ITEM( layout, this );
|
gbritem = new GERBER_DRAW_ITEM( this );
|
||||||
layout->m_Drawings.Append( gbritem );
|
m_Drawings.Append( gbritem );
|
||||||
|
|
||||||
// D( printf( "Add line %d,%d to %d,%d\n",
|
// D( printf( "Add line %d,%d to %d,%d\n",
|
||||||
// m_PreviousPos.x, m_PreviousPos.y,
|
// m_PreviousPos.x, m_PreviousPos.y,
|
||||||
// m_CurrentPos.x, m_CurrentPos.y ); )
|
// m_CurrentPos.x, m_CurrentPos.y ); )
|
||||||
fillLineGBRITEM( gbritem, dcode, activeLayer, m_PreviousPos,
|
fillLineGBRITEM( gbritem, dcode, m_PreviousPos,
|
||||||
m_CurrentPos, size, GetLayerParams().m_LayerNegative );
|
m_CurrentPos, size, GetLayerParams().m_LayerNegative );
|
||||||
StepAndRepeatItem( *gbritem );
|
StepAndRepeatItem( *gbritem );
|
||||||
break;
|
break;
|
||||||
|
@ -714,14 +702,10 @@ bool GERBER_FILE_IMAGE::Execute_DCODE_Command( char*& text, int D_commande )
|
||||||
|
|
||||||
case GERB_INTERPOL_ARC_NEG:
|
case GERB_INTERPOL_ARC_NEG:
|
||||||
case GERB_INTERPOL_ARC_POS:
|
case GERB_INTERPOL_ARC_POS:
|
||||||
gbritem = new GERBER_DRAW_ITEM( layout, this );
|
gbritem = new GERBER_DRAW_ITEM( this );
|
||||||
layout->m_Drawings.Append( gbritem );
|
m_Drawings.Append( gbritem );
|
||||||
|
|
||||||
// D( printf( "Add arc %d,%d to %d,%d center %d, %d interpol %d 360_enb %d\n",
|
fillArcGBRITEM( gbritem, dcode, m_PreviousPos,
|
||||||
// m_PreviousPos.x, m_PreviousPos.y, m_CurrentPos.x,
|
|
||||||
// m_CurrentPos.y, m_IJPos.x,
|
|
||||||
// m_IJPos.y, m_Iterpolation, m_360Arc_enbl ); )
|
|
||||||
fillArcGBRITEM( gbritem, dcode, activeLayer, m_PreviousPos,
|
|
||||||
m_CurrentPos, m_IJPos, size,
|
m_CurrentPos, m_IJPos, size,
|
||||||
( m_Iterpolation == GERB_INTERPOL_ARC_NEG ) ?
|
( m_Iterpolation == GERB_INTERPOL_ARC_NEG ) ?
|
||||||
false : true, m_360Arc_enbl, GetLayerParams().m_LayerNegative );
|
false : true, m_360Arc_enbl, GetLayerParams().m_LayerNegative );
|
||||||
|
@ -752,10 +736,9 @@ bool GERBER_FILE_IMAGE::Execute_DCODE_Command( char*& text, int D_commande )
|
||||||
aperture = tool->m_Shape;
|
aperture = tool->m_Shape;
|
||||||
}
|
}
|
||||||
|
|
||||||
gbritem = new GERBER_DRAW_ITEM( layout, this );
|
gbritem = new GERBER_DRAW_ITEM( this );
|
||||||
layout->m_Drawings.Append( gbritem );
|
m_Drawings.Append( gbritem );
|
||||||
fillFlashedGBRITEM( gbritem, aperture,
|
fillFlashedGBRITEM( gbritem, aperture, dcode, m_CurrentPos,
|
||||||
dcode, activeLayer, m_CurrentPos,
|
|
||||||
size, GetLayerParams().m_LayerNegative );
|
size, GetLayerParams().m_LayerNegative );
|
||||||
StepAndRepeatItem( *gbritem );
|
StepAndRepeatItem( *gbritem );
|
||||||
m_PreviousPos = m_CurrentPos;
|
m_PreviousPos = m_CurrentPos;
|
||||||
|
|
|
@ -584,8 +584,9 @@ bool GERBER_FILE_IMAGE::ExecuteRS274XCommand( int command, char* buff, char*& te
|
||||||
|
|
||||||
else
|
else
|
||||||
GetLayerParams().m_LayerNegative = false;
|
GetLayerParams().m_LayerNegative = false;
|
||||||
DBG( printf( "%22s: LAYER_POLARITY m_LayerNegative=%s\n", __func__,
|
|
||||||
GetLayerParams().m_LayerNegative ? "true" : "false" ); )
|
// DBG( printf( "%22s: LAYER_POLARITY m_LayerNegative=%s\n", __func__,
|
||||||
|
// GetLayerParams().m_LayerNegative ? "true" : "false" ); )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case INCLUDE_FILE:
|
case INCLUDE_FILE:
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include <gerbview_frame.h>
|
#include <gerbview_frame.h>
|
||||||
#include <gerbview_id.h>
|
#include <gerbview_id.h>
|
||||||
#include <class_gerber_file_image.h>
|
#include <class_gerber_file_image.h>
|
||||||
|
#include <class_gerber_file_image_list.h>
|
||||||
|
|
||||||
#include <select_layers_to_pcb.h>
|
#include <select_layers_to_pcb.h>
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#include <gerbview_id.h>
|
#include <gerbview_id.h>
|
||||||
#include <hotkeys.h>
|
#include <hotkeys.h>
|
||||||
#include <class_gerber_file_image.h>
|
#include <class_gerber_file_image.h>
|
||||||
|
#include <class_gerber_file_image_list.h>
|
||||||
#include <class_gbr_layer_box_selector.h>
|
#include <class_gbr_layer_box_selector.h>
|
||||||
#include <class_DCodeSelectionbox.h>
|
#include <class_DCodeSelectionbox.h>
|
||||||
#include <dialog_helpers.h>
|
#include <dialog_helpers.h>
|
||||||
|
|
Loading…
Reference in New Issue