Gerbview: code cleanup (with the help of Mark Roszko's work)

This commit is contained in:
jean-pierre charras
2016-05-25 11:45:55 +02:00
parent 75c551f305
commit 1c21410f1f
36 changed files with 44 additions and 202 deletions
+4 -65
View File
@@ -31,18 +31,13 @@
#include <fctsys.h>
#include <common.h>
#include <class_drawpanel.h>
#include <confirm.h>
#include <macros.h>
#include <trigo.h>
#include <gr_basic.h>
#include <base_units.h>
#include <gerbview.h>
#include <gerbview_frame.h>
#include <class_gerber_draw_item.h>
#include <class_GERBER.h>
#include <convert_to_biu.h>
#define DEFAULT_SIZE 100
#define DCODE_DEFAULT_SIZE Millimeter2iu( 0.1 )
/* Format Gerber: NOTES:
* Tools and D_CODES
@@ -82,8 +77,8 @@ D_CODE::~D_CODE()
void D_CODE::Clear_D_CODE_Data()
{
m_Size.x = DEFAULT_SIZE;
m_Size.y = DEFAULT_SIZE;
m_Size.x = DCODE_DEFAULT_SIZE;
m_Size.y = DCODE_DEFAULT_SIZE;
m_Shape = APT_CIRCLE;
m_Drill.x = m_Drill.y = 0;
m_DrillShape = APT_DEF_NO_HOLE;
@@ -155,62 +150,6 @@ int D_CODE::GetShapeDim( GERBER_DRAW_ITEM* aParent )
}
void GERBVIEW_FRAME::CopyDCodesSizeToItems()
{
static D_CODE dummy( 999 ); //Used if D_CODE not found in list
GERBER_DRAW_ITEM* gerb_item = GetItemsList();
for( ; gerb_item; gerb_item = gerb_item->Next() )
{
D_CODE* dcode = gerb_item->GetDcodeDescr();
wxASSERT( dcode );
if( dcode == NULL )
dcode = &dummy;
dcode->m_InUse = true;
gerb_item->m_Size = dcode->m_Size;
if( // Line Item
(gerb_item->m_Shape == GBR_SEGMENT ) /* rectilinear segment */
|| (gerb_item->m_Shape == GBR_ARC ) /* segment arc (rounded tips) */
|| (gerb_item->m_Shape == GBR_CIRCLE ) /* segment in a circle (ring) */
)
{
}
else // Spots ( Flashed Items )
{
switch( dcode->m_Shape )
{
case APT_CIRCLE: /* spot round */
gerb_item->m_Shape = GBR_SPOT_CIRCLE;
break;
case APT_OVAL: /* spot oval*/
gerb_item->m_Shape = GBR_SPOT_OVAL;
break;
case APT_RECT: /* spot rect*/
gerb_item->m_Shape = GBR_SPOT_RECT;
break;
case APT_POLYGON:
gerb_item->m_Shape = GBR_SPOT_POLY;
break;
case APT_MACRO: /* spot defined by a macro */
gerb_item->m_Shape = GBR_SPOT_MACRO;
break;
default:
wxMessageBox( wxT( "GERBVIEW_FRAME::CopyDCodesSizeToItems() error" ) );
break;
}
}
}
}
void D_CODE::DrawFlashedShape( GERBER_DRAW_ITEM* aParent,
EDA_RECT* aClipBox, wxDC* aDC, EDA_COLOR_T aColor,
EDA_COLOR_T aAltColor,