Commit a2a02496 authored by dickelbeck's avatar dickelbeck

gerber viewer cleanups

parent e6e50f3c
...@@ -92,7 +92,10 @@ enum Gerb_Analyse_Cmd { ...@@ -92,7 +92,10 @@ enum Gerb_Analyse_Cmd {
class D_CODE; class D_CODE;
/* Structure de Description d'option d'une layer GERBER : */ /**
* Class GERBER_Descr
* holds the data for one gerber file or layer
*/
class GERBER_Descr class GERBER_Descr
{ {
public: public:
...@@ -152,14 +155,32 @@ public: ...@@ -152,14 +155,32 @@ public:
bool Execute_G_Command( char*& text, int G_commande ); bool Execute_G_Command( char*& text, int G_commande );
bool Execute_DCODE_Command( WinEDA_GerberFrame* frame, wxDC* DC, bool Execute_DCODE_Command( WinEDA_GerberFrame* frame, wxDC* DC,
char*& text, int D_commande ); char*& text, int D_commande );
/**
* size of single line of a text line from a gerber file.
* warning: some files can have very long lines, so the buffer must be large
*/
#define GERBER_BUFZ 4000
/**
* Function ReadRS274XCommand
* reads a single RS274X command terminated with a %
*/
bool ReadRS274XCommand( WinEDA_GerberFrame* frame, wxDC* DC, bool ReadRS274XCommand( WinEDA_GerberFrame* frame, wxDC* DC,
char* buff, char*& text ); char aBuff[GERBER_BUFZ], char*& text );
bool ExecuteRS274XCommand( int command, char* buff, char*& text );
};
/**
* Function ExecuteRS274XCommand
* executes 1 commande
*/
bool ExecuteRS274XCommand( int command, char aBuff[GERBER_BUFZ], char*& text );
};
/* Structure de Description d'un D_CODE GERBER : */
/**
* Class D_CODE
* holds a gerber DCODE definition.
*/
class D_CODE class D_CODE
{ {
public: public:
...@@ -178,10 +199,23 @@ public: ...@@ -178,10 +199,23 @@ public:
void Clear_D_CODE_Data(); void Clear_D_CODE_Data();
}; };
/**************/
/* rs274x.cpp */
/**************/
bool GetEndOfBlock( char buff[GERBER_BUFZ], char*& text, FILE* gerber_file );
/*************/
/* dcode.cpp */
/*************/
D_CODE * ReturnToolDescr( int layer, int Dcode, int * index = NULL );
eda_global const wxChar* g_GERBER_Tool_Type[6] eda_global const wxChar* g_GERBER_Tool_Type[6]
#ifdef MAIN #ifdef MAIN
= { = {
wxT( "????" ), wxT( "Rond" ), wxT( "Rect" ), wxT( "Line" ), wxT( "Oval" ), wxT( "Macro" ) wxT( "????" ), wxT( "Round" ), wxT( "Rect" ), wxT( "Line" ), wxT( "Oval" ), wxT( "Macro" )
} }
......
...@@ -124,16 +124,3 @@ void Trace_1_texte_pcb(WinEDA_DrawPanel * panel, wxDC * DC, ...@@ -124,16 +124,3 @@ void Trace_1_texte_pcb(WinEDA_DrawPanel * panel, wxDC * DC,
void Affiche_DCodes_Pistes(WinEDA_DrawPanel * panel, wxDC * DC, void Affiche_DCodes_Pistes(WinEDA_DrawPanel * panel, wxDC * DC,
BOARD * Pcb, int drawmode); BOARD * Pcb, int drawmode);
/*************/
/* dcode.cpp */
/*************/
class D_CODE;
D_CODE * ReturnToolDescr(int layer, int Dcode, int * index = NULL);
/**************/
/* rs274x.cpp */
/**************/
bool GetEndOfBlock( char * buff, char * &text, FILE *gerber_file);
...@@ -115,10 +115,10 @@ bool WinEDA_GerberFrame::Read_GERBER_File( wxDC* DC, ...@@ -115,10 +115,10 @@ bool WinEDA_GerberFrame::Read_GERBER_File( wxDC* DC,
*/ */
{ {
int G_commande = 0, int G_commande = 0,
D_commande = 0; /* command number for G et D commands (like G04 or D02) */ D_commande = 0; /* command number for G et D commands (like G04 or D02) */
char Line[4000]; /* Buffer to read 1 line of the gerber file
* warning: some files can have very long lines, so the buffer must be large char Line[GERBER_BUFZ];
*/
wxString msg; wxString msg;
char* text; char* text;
int layer; /* current layer used in gerbview */ int layer; /* current layer used in gerbview */
...@@ -158,7 +158,7 @@ bool WinEDA_GerberFrame::Read_GERBER_File( wxDC* DC, ...@@ -158,7 +158,7 @@ bool WinEDA_GerberFrame::Read_GERBER_File( wxDC* DC,
while( TRUE ) while( TRUE )
{ {
if( fgets( Line, sizeof(Line) - 1, gerber_layer->m_Current_File ) == NULL ) // E.O.F if( fgets( Line, sizeof(Line), gerber_layer->m_Current_File ) == NULL ) // E.O.F
{ {
if( gerber_layer->m_FilesPtr == 0 ) if( gerber_layer->m_FilesPtr == 0 )
break; break;
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment