Commit 035979d3 authored by jean-pierre charras's avatar jean-pierre charras

More work on Gerbview: code cleaning and cosmetic enhancements.

parent 0687921f
......@@ -22,6 +22,7 @@ set(GERBVIEW_SRCS
controle.cpp
dcode.cpp
deltrack.cpp
dialog_gerber_config.cpp
dialog_print_using_printer.cpp
dialog_print_using_printer_base.cpp
dummy_functions.cpp
......@@ -41,7 +42,6 @@ set(GERBVIEW_SRCS
options.cpp
pcbplot.cpp
readgerb.cpp
reglage.cpp
rs274d.cpp
rs274x.cpp
select_layers_to_pcb.cpp
......
......@@ -36,7 +36,6 @@
#include "gerbview.h"
#include "class_gerber_draw_item.h"
#include "protos.h"
#define BLOCK_COLOR BROWN
......
......@@ -33,6 +33,7 @@
#include "macros.h"
#include "gerbview.h"
#include "class_GERBER.h"
/* Format Gerber: NOTES:
* Tools and D_CODES
......@@ -53,10 +54,10 @@
*/
GERBER::GERBER( WinEDA_GerberFrame * aParent, int aLayer )
GERBER::GERBER( WinEDA_GerberFrame* aParent, int aLayer )
{
m_Parent = aParent;
m_Layer = aLayer; // Layer Number
m_Layer = aLayer; // Layer Number
m_Selected_Tool = FIRST_DCODE;
......@@ -118,33 +119,34 @@ APERTURE_MACRO* GERBER::FindApertureMacro( const APERTURE_MACRO& aLookup )
void GERBER::ResetDefaultValues()
{
m_FileName.Empty();
m_Name = wxT( "no name" ); // Layer name
m_LayerNegative = FALSE; // TRUE = Negative Layer
m_ImageNegative = FALSE; // TRUE = Negative image
m_GerbMetric = FALSE; // FALSE = Inches, TRUE = metric
m_Relative = FALSE; // FALSE = absolute Coord, RUE =
// relative Coord
m_NoTrailingZeros = FALSE; // True: trailing zeros deleted
m_MirorA = FALSE; // True: miror / axe A (X)
m_MirorB = FALSE; // True: miror / axe B (Y)
m_Has_DCode = FALSE; // TRUE = DCodes in file (FALSE = no
// DCode->
// separate DCode file
m_ImageName = wxT( "no image name" ); // Image name from the IN command
m_LayerName = wxT( "no layer name" ); // Layer name from the LN command
m_LayerNegative = FALSE; // TRUE = Negative Layer
m_ImageNegative = FALSE; // TRUE = Negative image
m_GerbMetric = FALSE; // FALSE = Inches, TRUE = metric
m_Relative = FALSE; // FALSE = absolute Coord, RUE =
// relative Coord
m_NoTrailingZeros = FALSE; // True: trailing zeros deleted
m_MirorA = FALSE; // True: miror / axe A (X)
m_MirorB = FALSE; // True: miror / axe B (Y)
m_Has_DCode = FALSE; // TRUE = DCodes in file
// FALSE = no DCode->
// search for separate DCode file
m_FmtScale.x = m_FmtScale.y = g_Default_GERBER_Format % 10;
m_FmtLen.x = m_FmtLen.y = m_FmtScale.x + (g_Default_GERBER_Format / 10);
m_LayerScale.x = m_LayerScale.y = 1.0; // scale (X and Y) this
m_LayerScale.x = m_LayerScale.y = 1.0; // scale (X and Y) this
// layer
m_Rotation = 0;
m_Iterpolation = GERB_INTERPOL_LINEAR_1X; // Linear, 90 arc, Circ.
m_360Arc_enbl = FALSE; // 360 deg circular
m_Rotation = 0;
m_Iterpolation = GERB_INTERPOL_LINEAR_1X; // Linear, 90 arc, Circ.
m_360Arc_enbl = FALSE; // 360 deg circular
// interpolation disable
m_Current_Tool = 0; // Current Tool (Dcode)
m_Current_Tool = 0; // Current Tool (Dcode)
// number selected
m_CommandState = 0; // gives tate of the
m_CommandState = 0; // gives tate of the
// stacking order analysis
m_CurrentPos.x = m_CurrentPos.y = 0; // current specified coord
m_CurrentPos.x = m_CurrentPos.y = 0; // current specified coord
// for plot
m_PreviousPos.x = m_PreviousPos.y = 0; // old current specified
// coord for plot
......@@ -182,26 +184,27 @@ void GERBER::InitToolTable()
m_Aperture_List[count]->m_Num_Dcode = count + FIRST_DCODE;
m_Aperture_List[count]->Clear_D_CODE_Data();
}
m_aperture_macros.clear();
}
/** function ReportMessage
* Add a message (a string) in message list
* for instance when reading a Gerber file
* @param aMessage = the straing to add in list
*/
void GERBER::ReportMessage(const wxString aMessage )
void GERBER::ReportMessage( const wxString aMessage )
{
m_Parent->ReportMessage( aMessage );
}
/** function ClearMessageList
* Clear the message list
* Call it before reading a Gerber file
*/
void GERBER::ClearMessageList( )
void GERBER::ClearMessageList()
{
m_Parent->ClearMessageList( );
m_Parent->ClearMessageList();
}
/******************/
/* class_GERBER.h */
/******************/
#ifndef _CLASS_GERBER_H_
#define _CLASS_GERBER_H_
#include <vector>
#include <set>
#include "dcode.h"
#include "class_gerber_draw_item.h"
#include "class_aperture_macro.h"
class WinEDA_GerberFrame;
class BOARD;
class D_CODE;
/**
* Class GERBER
* holds the data for one gerber file or layer
*/
class GERBER
{
WinEDA_GerberFrame* m_Parent; // the parent WinEDA_GerberFrame (used to display messages...)
D_CODE* m_Aperture_List[TOOLS_MAX_COUNT]; ///< Dcode (Aperture) List for this layer
bool m_Exposure; ///< whether an aperture macro tool is flashed on or off
BOARD* m_Pcb;
public:
wxString m_FileName; // Full File Name for this layer
wxString m_ImageName; // Image name, from IN <name>* command
wxString m_LayerName; // Layer name, from LN <name>* command
int m_Layer; // Layer Number
bool m_LayerNegative; // TRUE = Negative Layer
bool m_GerbMetric; // FALSE = Inches, TRUE = metric
bool m_Relative; // FALSE = absolute Coord, RUE = relative Coord
bool m_NoTrailingZeros; // True: remove tailing zeros.
bool m_MirorA; // True: miror / axe A (X)
bool m_MirorB; // True: miror / axe B (Y)
bool m_Has_DCode; // TRUE = DCodes in file
// (FALSE = no DCode -> separate DCode file
wxPoint m_Offset; // Coord Offset
wxSize m_FmtScale; // Fmt 2.3: m_FmtScale = 3, fmt 3.4: m_FmtScale = 4
wxSize m_FmtLen; // Nb chars per coord. ex fmt 2.3, m_FmtLen = 5
wxRealPoint m_LayerScale; // scale (X and Y) of layer.
int m_Rotation;
int m_Iterpolation; // Linear, 90 arc, Circ.
bool m_ImageNegative; // TRUE = Negative image
int m_Current_Tool; // Current Tool (Dcode) number selected
int m_Last_Pen_Command; // Current or last pen state (0..9, set by Dn option with n <10
int m_CommandState; // state of gerber analysis command.
wxPoint m_CurrentPos; // current specified coord for plot
wxPoint m_PreviousPos; // old current specified coord for plot
wxPoint m_IJPos; // IJ coord (for arcs & circles )
FILE* m_Current_File; // Current file to read
#define INCLUDE_FILES_COUNT_MAX 10
FILE* m_FilesList[INCLUDE_FILES_COUNT_MAX+2]; // Included files list
int m_FilesPtr; // Stack pointer for files list
int m_Selected_Tool; // Pour editions: Tool (Dcode) selectionn�
bool m_360Arc_enbl; // Enbl 360 deg circular interpolation
bool m_PolygonFillMode; // Enbl polygon mode (read coord as a polygon descr)
int m_PolygonFillModeState; // In polygon mode: 0 = first segm, 1 = next segm
APERTURE_MACRO_SET m_aperture_macros; ///< a collection of APERTURE_MACROS, sorted by name
public:
GERBER( WinEDA_GerberFrame* aParent, int layer );
~GERBER();
void Clear_GERBER();
int ReturnUsedDcodeNumber();
void ResetDefaultValues();
/** function ReportMessage
* Add a message (a string) in message list
* for instance when reading a Gerber file
* @param aMessage = the straing to add in list
*/
void ReportMessage( const wxString aMessage );
/** function ClearMessageList
* Clear the message list
* Call it before reading a Gerber file
*/
void ClearMessageList();
/**
* Function InitToolTable
*/
void InitToolTable();
wxPoint ReadXYCoord( char*& Text );
wxPoint ReadIJCoord( char*& Text );
int ReturnGCodeNumber( char*& Text );
int ReturnDCodeNumber( char*& Text );
bool Execute_G_Command( char*& text, int G_commande );
bool Execute_DCODE_Command( WinEDA_GerberFrame* frame,
char*& text, int D_commande );
/**
* Function ReadRS274XCommand
* reads a single RS274X command terminated with a %
*/
bool ReadRS274XCommand( WinEDA_GerberFrame * frame,
char aBuff[GERBER_BUFZ], char* & text );
/**
* Function ExecuteRS274XCommand
* executes 1 command
*/
bool ExecuteRS274XCommand( int command, char aBuff[GERBER_BUFZ],
char* & text );
/**
* Function ReadApertureMacro
* reads in an aperture macro and saves it in m_aperture_macros.
* @param aBuff a character buffer at least GERBER_BUFZ long that can be
* used to read successive lines from the gerber file.
* @param text A reference to a character pointer which gives the initial
* text to read from.
* @param gerber_file Which file to read from for continuation.
* @return bool - true if a macro was read in successfully, else false.
*/
bool ReadApertureMacro( char aBuff[GERBER_BUFZ], char* & text,
FILE * gerber_file );
/**
* Function GetDCODE
* returns a pointer to the D_CODE within this GERBER for the given
* \a aDCODE.
* @param aDCODE The numeric value of the D_CODE to look up.
* @param createIfNoExist If true, then create the D_CODE if it does not
* exist.
* @return D_CODE* - the one implied by the given \a aDCODE, or NULL
* if the requested \a aDCODE is out of range.
*/
D_CODE* GetDCODE( int aDCODE, bool createIfNoExist = true );
/**
* Function FindApertureMacro
* looks up a previously read in aperture macro.
* @param aLookup A dummy APERTURE_MACRO with [only] the name field set.
* @return APERTURE_MACRO* - the one with a matching name, or NULL if
* not found.
*/
APERTURE_MACRO* FindApertureMacro( const APERTURE_MACRO& aLookup );
};
#endif // ifndef _CLASS_GERBER_H_
......@@ -38,6 +38,7 @@
#include "class_board_design_settings.h"
#include "colors_selection.h"
#include "class_gerber_draw_item.h"
#include "class_GERBER.h"
/**********************************************************/
......
......@@ -8,8 +8,6 @@
#include "pcbnew.h"
#include "gerbview.h"
#include "protos.h"
BOARD_ITEM* WinEDA_GerberFrame::GerberGeneralLocateAndDisplay()
{
......
......@@ -11,6 +11,7 @@
#include "gerbview.h"
#include "class_gerber_draw_item.h"
#include "class_GERBER.h"
#define DEFAULT_SIZE 100
......
......@@ -4,7 +4,6 @@
#include "fctsys.h"
#include "common.h"
//#include "class_drawpanel.h"
#include "gerbview.h"
#include "class_gerber_draw_item.h"
......
/***************/
/* reglage.cpp */
/***************/
/*****************************/
/* dialog_gerber_config.cpp */
/****************************/
/*
* Options for file extensions
......@@ -11,8 +11,6 @@
#include "appl_wxstruct.h"
#include "common.h"
#include "gerbview.h"
#include "pcbplot.h"
#include "protos.h"
enum
......
......@@ -11,9 +11,9 @@
#include "gerbview.h"
#include "pcbplot.h"
#include "protos.h"
#include "kicad_device_context.h"
#include "gerbview_id.h"
#include "class_GERBER.h"
/* Process the command triggered by the left button of the mouse when a tool
......
......@@ -14,7 +14,6 @@
#include "gerbview.h"
#include "class_board_design_settings.h"
#include "class_gerber_draw_item.h"
#include "protos.h"
static int SavePcbFormatAscii( WinEDA_GerberFrame* frame,
FILE* File, int* LayerLookUpTable );
......@@ -62,7 +61,7 @@ void WinEDA_GerberFrame::ExportDataInPcbnewFormat( wxCommandEvent& event )
return;
int* LayerLookUpTable;
if( ( LayerLookUpTable = InstallDialogLayerPairChoice( this ) ) != NULL )
if( ( LayerLookUpTable = InstallDialogLayerPairChoice( ) ) != NULL )
{
if( wxFileExists( FullFileName ) )
{
......
......@@ -10,7 +10,6 @@
#include "gerbview.h"
#include "pcbplot.h"
#include "protos.h"
static void LoadDCodeFile( WinEDA_GerberFrame* frame,
......
......@@ -16,9 +16,11 @@
#include "class_gerber_draw_item.h"
#include "pcbplot.h"
#include "bitmaps.h"
#include "protos.h"
#include "gerbview_id.h"
#include "hotkeys.h"
#include "class_GERBER.h"
#include "build_version.h"
/****************************************/
......@@ -367,6 +369,7 @@ void WinEDA_GerberFrame::SetGridColor(int aColor)
GetBoard()->SetVisibleElementColor( GERBER_GRID_VISIBLE, aColor );
}
/**
* Function SetElementVisibility
* changes the visibility of an element category
......@@ -384,6 +387,7 @@ void WinEDA_GerberFrame::SetElementVisibility( int aGERBER_VISIBLE, bool aNewSta
void WinEDA_GerberFrame::syncLayerWidget( )
{
m_LayersManager->SelectLayer( getActiveLayer() );
UpdateTitleAndInfo();
}
/**
......@@ -395,6 +399,7 @@ void WinEDA_GerberFrame::syncLayerWidget( )
void WinEDA_GerberFrame::syncLayerBox()
{
m_SelLayerBox->SetSelection( getActiveLayer() );
UpdateTitleAndInfo();
}
/** function SetLanguage
......@@ -473,3 +478,41 @@ void WinEDA_GerberFrame::Liste_D_Codes( )
if( ii < 0 )
return;
}
/** function UpdateTitleAndInfo
* displays the short filename (if exists) of the selected layer
* on the caption of the main gerbview window
* and the name of the layer (found in the gerber file: LN <name> command)
* in the status bar
*/
void WinEDA_GerberFrame::UpdateTitleAndInfo()
{
GERBER* gerber = g_GERBER_List[GetScreen()->m_Active_Layer];
wxString text;
// Display the gerber filename
if( gerber == NULL )
{
text = wxGetApp().GetAppName() + wxT( " " ) + GetBuildVersion();
SetStatusText( wxEmptyString, 0 );
m_TextInfo->Clear();
SetTitle( text );
return;
}
text = _( "File:" );
text << wxT( " " ) << gerber->m_FileName;
// Display Image Name and Layer Name (from the current gerber data):
text.Printf( _("Image name: \"%s\" Layer name \"%s\""),
GetChars(gerber->m_ImageName), GetChars(gerber->m_LayerName) );
SetStatusText( text, 0 );
// Display data format like fmt in X3.4Y3.4 or fmt mm X2.3 Y3.5
text.Printf(wxT("fmt %s X%d.%d Y%d.%d"),
gerber->m_GerbMetric ? wxT("mm") : wxT("in"),
gerber->m_FmtLen.x - gerber->m_FmtScale.x, gerber->m_FmtScale.x,
gerber->m_FmtLen.y - gerber->m_FmtScale.y, gerber->m_FmtScale.y );
m_TextInfo->SetValue( text );
}
......@@ -13,7 +13,6 @@
#include "wxGerberFrame.h"
#include "pcbplot.h"
#include "bitmaps.h"
#include "protos.h"
#include "zones.h"
#include "class_board_design_settings.h"
#include "colors_selection.h"
......@@ -24,6 +23,7 @@
#include <wx/file.h>
#include <wx/snglinst.h>
extern bool Read_Config();
wxString g_PhotoFilenameExt;
wxString g_DrillFilenameExt;
......@@ -33,10 +33,8 @@ wxString g_PenFilenameExt;
COLORS_DESIGN_SETTINGS g_ColorsSettings;
int g_Default_GERBER_Format;
int g_Plot_Spot_Mini; /* Diameter of the opening mini-track for GERBER. */
int g_DisplayPolygonsModeSketch;
const wxString GerbviewProjectFileExt( wxT( "cnf" ) );
const wxString GerbviewProjectFileWildcard( _( "GerbView project files (.cnf)|*.cnf" ) );
......
......@@ -13,7 +13,9 @@
#include "class_aperture_macro.h"
class WinEDA_GerberFrame;
class BOARD;
//class BOARD;
class GERBER;
// Type of photoplotter action:
#define GERB_ACTIVE_DRAW 1 // Activate light (lower pen)
......@@ -39,14 +41,18 @@ enum GERBER_VISIBLE
END_GERBER_VISIBLE_LIST // sentinel
};
/**
* size of single line of a text from a gerber file.
* warning: some files can have very long lines, so the buffer must be large.
*/
#define GERBER_BUFZ 4000
extern wxString g_PhotoFilenameExt;
extern wxString g_DrillFilenameExt;
extern wxString g_PenFilenameExt;
extern int g_Default_GERBER_Format;
extern int g_Plot_Spot_Mini; /* Diameter of the opening mini-track for
* GERBER */
extern int g_DisplayPolygonsModeSketch;
extern const wxString GerbviewProjectFileExt;
extern const wxString GerbviewProjectFileWildcard;
......@@ -100,160 +106,13 @@ enum Gerb_Analyse_Cmd
ENTER_RS274X_CMD
};
class D_CODE;
/**
* Class GERBER
* holds the data for one gerber file or layer
*/
class GERBER
{
WinEDA_GerberFrame * m_Parent; // the parent WinEDA_GerberFrame (used to display messages...)
D_CODE* m_Aperture_List[TOOLS_MAX_COUNT]; ///< Dcode (Aperture) List for this layer
bool m_Exposure; ///< whether an aperture macro tool is flashed on or off
BOARD* m_Pcb;
public:
wxString m_FileName; // Full File Name for this layer
wxString m_Name; // Layer name
int m_Layer; // Layer Number
bool m_LayerNegative; // TRUE = Negative Layer
bool m_GerbMetric; // FALSE = Inches, TRUE = metric
bool m_Relative; // FALSE = absolute Coord, RUE = relative Coord
bool m_NoTrailingZeros; // True: remove tailing zeros.
bool m_MirorA; // True: miror / axe A (X)
bool m_MirorB; // True: miror / axe B (Y)
bool m_Has_DCode; // TRUE = DCodes in file (FALSE = no DCode->
// separate DCode file
wxPoint m_Offset; // Coord Offset
wxSize m_FmtScale; // Fmt 2.3: m_FmtScale = 3, fmt 3.4: m_FmtScale = 4
wxSize m_FmtLen; // Nb chars per coord. ex fmt 2.3, m_FmtLen = 5
wxRealPoint m_LayerScale; // scale (X and Y) of layer.
int m_Rotation;
int m_Iterpolation; // Linear, 90 arc, Circ.
bool m_ImageNegative; // TRUE = Negative image
int m_Current_Tool; // Current Tool (Dcode) number selected
int m_Last_Pen_Command; // Current or last pen state (0..9, set by Dn option with n <10
int m_CommandState; // state of gerber analysis command.
wxPoint m_CurrentPos; // current specified coord for plot
wxPoint m_PreviousPos; // old current specified coord for plot
wxPoint m_IJPos; // IJ coord (for arcs & circles )
FILE* m_Current_File; // Current file to read
FILE* m_FilesList[12]; // Files list
int m_FilesPtr; // Stack pointer for files list
int m_Selected_Tool; // Pour editions: Tool (Dcode) selectionn�
bool m_360Arc_enbl; // Enbl 360 deg circular interpolation
bool m_PolygonFillMode; // Enbl polygon mode (read coord as a polygon descr)
int m_PolygonFillModeState; // In polygon mode: 0 = first segm, 1 = next segm
APERTURE_MACRO_SET m_aperture_macros; ///< a collection of APERTURE_MACROS, sorted by name
public:
GERBER( WinEDA_GerberFrame * aParent, int layer );
~GERBER();
void Clear_GERBER();
int ReturnUsedDcodeNumber();
void ResetDefaultValues();
/** function ReportMessage
* Add a message (a string) in message list
* for instance when reading a Gerber file
* @param aMessage = the straing to add in list
*/
void ReportMessage(const wxString aMessage );
/** function ClearMessageList
* Clear the message list
* Call it before reading a Gerber file
*/
void ClearMessageList( );
/**
* Function InitToolTable
*/
void InitToolTable();
wxPoint ReadXYCoord( char*& Text );
wxPoint ReadIJCoord( char*& Text );
int ReturnGCodeNumber( char*& Text );
int ReturnDCodeNumber( char*& Text );
bool Execute_G_Command( char*& text, int G_commande );
bool Execute_DCODE_Command( WinEDA_GerberFrame* frame,
char*& text, int D_commande );
/**
* size of single line of a text 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,
char aBuff[GERBER_BUFZ], char*& text );
/**
* Function ExecuteRS274XCommand
* executes 1 command
*/
bool ExecuteRS274XCommand( int command, char aBuff[GERBER_BUFZ],
char*& text );
/**
* Function ReadApertureMacro
* reads in an aperture macro and saves it in m_aperture_macros.
* @param aBuff a character buffer at least GERBER_BUFZ long that can be
* used to read successive lines from the gerber file.
* @param text A reference to a character pointer which gives the initial
* text to read from.
* @param gerber_file Which file to read from for continuation.
* @return bool - true if a macro was read in successfully, else false.
*/
bool ReadApertureMacro( char aBuff[GERBER_BUFZ], char*& text,
FILE* gerber_file );
/**
* Function GetDCODE
* returns a pointer to the D_CODE within this GERBER for the given
* \a aDCODE.
* @param aDCODE The numeric value of the D_CODE to look up.
* @param createIfNoExist If true, then create the D_CODE if it does not
* exist.
* @return D_CODE* - the one implied by the given \a aDCODE, or NULL
* if the requested \a aDCODE is out of range.
*/
D_CODE* GetDCODE( int aDCODE, bool createIfNoExist=true );
/**
* Function FindApertureMacro
* looks up a previously read in aperture macro.
* @param aLookup A dummy APERTURE_MACRO with [only] the name field set.
* @return APERTURE_MACRO* - the one with a matching name, or NULL if
* not found.
*/
APERTURE_MACRO* FindApertureMacro( const APERTURE_MACRO& aLookup );
};
/**************/
/* rs274x.cpp */
/**************/
bool GetEndOfBlock( char buff[GERBER_BUFZ], char*& text, FILE* gerber_file );
extern GERBER* g_GERBER_List[32];
extern int g_DisplayPolygonsModeSketch;
#include "pcbcommon.h"
#include "wxGerberFrame.h"
......
......@@ -337,22 +337,6 @@ static PARAM_CFG_SETCOLOR ColorDCodesCfg
WHITE
);
static PARAM_CFG_INT GERBERSpotMiniCfg
(
wxT("GERBmin"),
&g_Plot_Spot_Mini,
15,
2,0xFFFF
);
static PARAM_CFG_INT TimeOutCfg
(
wxT("TimeOut"),
&g_TimeOut,
600,
0,60000
);
static PARAM_CFG_BOOL DisplPolairCfg
(
INSETUP,
......@@ -404,8 +388,6 @@ PARAM_CFG_BASE * ParamCfgList[] =
& ColorLayer30Cfg,
& ColorLayer31Cfg,
& ColorDCodesCfg,
& GERBERSpotMiniCfg,
& TimeOutCfg,
& DisplPolairCfg,
NULL
};
......@@ -10,7 +10,7 @@
#include "gerbview.h"
#include "class_gerber_draw_item.h"
//#include "protos.h"
#include "class_GERBER.h"
bool WinEDA_GerberFrame::Clear_Pcb( bool query )
......@@ -30,7 +30,10 @@ bool WinEDA_GerberFrame::Clear_Pcb( bool query )
for( layer = 0; layer < 32; layer++ )
{
if( g_GERBER_List[layer] )
{
g_GERBER_List[layer]->InitToolTable();
g_GERBER_List[layer]->ResetDefaultValues();
}
}
GetBoard()->m_BoundaryBox.SetOrigin( 0, 0 );
......@@ -68,7 +71,10 @@ void WinEDA_GerberFrame::Erase_Current_Layer( bool query )
}
if( g_GERBER_List[layer] )
{
g_GERBER_List[layer]->InitToolTable();
g_GERBER_List[layer]->ResetDefaultValues();
}
ScreenPcb->SetModify();
ScreenPcb->SetRefreshReq();
......
......@@ -9,7 +9,6 @@
#include "pcbnew.h"
#include "gerbview.h"
#include "trigo.h"
#include "protos.h"
/* Display the character of the localized STRUCTURE and return a pointer
......@@ -17,6 +16,7 @@
*/
BOARD_ITEM* WinEDA_GerberFrame::Locate( int typeloc )
{
// TODO
MsgPanel->EraseMsgBox();
return NULL;
}
......
/***************************************************/
/* tool_gerber.cpp: Build tool bars and main menu */
/***************************************************/
/*************************************/
/* menubar.cpp: Build the main menu */
/*************************************/
#include "fctsys.h"
#include "wx/wupdlock.h"
......@@ -9,8 +9,6 @@
#include "common.h"
#include "macros.h"
#include "gerbview.h"
#include "pcbplot.h"
#include "protos.h"
#include "bitmaps.h"
#include "gerbview_id.h"
#include "hotkeys.h"
......
......@@ -8,8 +8,6 @@
#include "confirm.h"
#include "gerbview.h"
#include "pcbplot.h"
#include "protos.h"
/* Prepare the right-click pullup menu.
......
......@@ -14,7 +14,6 @@
#include "pcbplot.h"
#include "gerbview.h"
#include "protos.h"
#include "gerbview_id.h"
......
......@@ -7,7 +7,6 @@
#include "gerbview.h"
#include "pcbplot.h"
#include "protos.h"
......
/* declarations prototype */
int* InstallDialogLayerPairChoice( WinEDA_GerberFrame* parent );
bool Read_Config();
......@@ -8,8 +8,7 @@
#include "kicad_string.h"
#include "gestfich.h"
#include "gerbview.h"
#include "pcbplot.h"
#include "protos.h"
#include "class_GERBER.h"
#include "dialog_load_error.h"
......
......@@ -3,15 +3,14 @@
/********************/
#include "fctsys.h"
#include "polygons_defs.h"
//#include "polygons_defs.h"
#include "common.h"
#include "confirm.h"
#include "macros.h"
//#include "confirm.h"
//#include "macros.h"
#include "gerbview.h"
#include "pcbplot.h"
#include "trigo.h"
#include "protos.h"
#include "class_gerber_draw_item.h"
#include "class_GERBER.h"
#include <math.h>
......@@ -776,9 +775,9 @@ bool GERBER::Execute_G_Command( char*& text, int G_commande )
case GC_MOVE: // Non existent
default:
{
wxString msg; msg.Printf( wxT( "G%0.2d command not handled" ),
G_commande );
DisplayError( NULL, msg );
wxString msg;
msg.Printf( wxT( "G%0.2d command not handled" ), G_commande );
ReportMessage( msg );
return false;
}
}
......
......@@ -4,11 +4,9 @@
#include "fctsys.h"
#include "common.h"
#include "confirm.h"
#include "macros.h"
//#include "macros.h"
#include "gerbview.h"
#include "pcbplot.h"
#include "protos.h"
#include "class_GERBER.h"
#define CODE( x, y ) ( ( (x) << 8 ) + (y) )
......@@ -291,7 +289,6 @@ bool GERBER::ExecuteRS274XCommand( int command,
case IMAGE_ROTATION:
case IMAGE_OFFSET:
case PLOTTER_FILM:
case LAYER_NAME:
case KNOCKOUT:
case STEP_AND_REPEAT:
case ROTATE:
......@@ -303,12 +300,19 @@ bool GERBER::ExecuteRS274XCommand( int command,
break;
case IMAGE_NAME:
m_Name.Empty();
m_ImageName.Empty();
while( *text != '*' )
{
m_Name.Append( *text++ );
m_ImageName.Append( *text++ );
}
break;
case LAYER_NAME:
m_LayerName.Empty();
while( *text != '*' )
{
m_LayerName.Append( *text++ );
}
break;
case IMAGE_POLARITY:
......@@ -330,10 +334,10 @@ bool GERBER::ExecuteRS274XCommand( int command,
break;
case INCLUDE_FILE:
if( m_FilesPtr >= 10 )
if( m_FilesPtr >= INCLUDE_FILES_COUNT_MAX )
{
ok = FALSE;
DisplayError( NULL, _( "Too many include files!!" ) );
ReportMessage( _( "Too many include files!!" ) );
break;
}
strcpy( line, text );
......@@ -343,8 +347,8 @@ bool GERBER::ExecuteRS274XCommand( int command,
m_Current_File = fopen( line, "rt" );
if( m_Current_File == 0 )
{
msg.Printf( wxT( "file <%s> not found." ), line );
DisplayError( NULL, msg, 10 );
msg.Printf( wxT( "include file <%s> not found." ), line );
ReportMessage( msg );
ok = FALSE;
m_Current_File = m_FilesList[m_FilesPtr];
break;
......
......@@ -8,8 +8,7 @@
#include "common.h"
#include "gerbview.h"
#include "class_board_design_settings.h"
#include "protos.h"
#include "class_GERBER.h"
#include "wx/statline.h"
......@@ -66,9 +65,9 @@ END_EVENT_TABLE()
* between gerber layers and pcbnew layers
* return the "lookup table" if ok, or NULL
*/
int* InstallDialogLayerPairChoice( WinEDA_GerberFrame * parent )
int* WinEDA_GerberFrame::InstallDialogLayerPairChoice( )
{
WinEDA_SwapLayerFrame* frame = new WinEDA_SwapLayerFrame( parent );
WinEDA_SwapLayerFrame* frame = new WinEDA_SwapLayerFrame( this );
int ii = frame->ShowModal();
......
/***************************************************/
/* tool_gerber.cpp: Build tool bars and main menu */
/***************************************************/
/*************************************/
/* tool_gerber.cpp: Build tool bars */
/*************************************/
#include "fctsys.h"
#include "wx/wupdlock.h"
#include "appl_wxstruct.h"
//#include "appl_wxstruct.h"
#include "common.h"
#include "macros.h"
#include "gerbview.h"
#include "pcbplot.h"
#include "protos.h"
#include "bitmaps.h"
#include "gerbview_id.h"
#include "hotkeys.h"
#include "class_GERBER.h"
void WinEDA_GerberFrame::ReCreateHToolbar( void )
......@@ -121,6 +120,10 @@ void WinEDA_GerberFrame::ReCreateHToolbar( void )
choices );
m_HToolBar->AddControl( m_SelLayerTool );
m_TextInfo = new wxTextCtrl(m_HToolBar, wxID_ANY, wxEmptyString,
wxDefaultPosition, wxSize(150,-1),
wxTE_READONLY );
m_HToolBar->AddControl( m_TextInfo );
// after adding the buttons to the toolbar, must call Realize() to reflect
// the changes
......
......@@ -7,22 +7,16 @@
*/
#include "fctsys.h"
#include "polygons_defs.h"
#include "gr_basic.h"
#include "common.h"
#include "class_drawpanel.h"
#include "drawtxt.h"
#include "gerbview.h"
#include "pcbplot.h"
#include "protos.h"
#include "class_board_design_settings.h"
#include "colors_selection.h"
#include "class_gerber_draw_item.h"
/***************/
/* tracepcb.cpp */
/***************/
#include "class_GERBER.h"
static void Show_Items_DCode_Value( WinEDA_DrawPanel* panel, wxDC* DC,
BOARD* Pcb, int drawmode );
......@@ -94,6 +88,10 @@ void WinEDA_GerberFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
DrawPanel->DrawCursor( DC );
// Display the filename and the layer name (found in the gerber files, if any)
// relative to the active layer
UpdateTitleAndInfo();
}
/********************************************************************/
......
......@@ -46,6 +46,8 @@ protected:
public:
WinEDAChoiceBox* m_SelLayerBox;
WinEDAChoiceBox* m_SelLayerTool;
wxTextCtrl* m_TextInfo; // a wxTextCtrl used to display some info about
// gerber data (format..)
private:
bool m_show_layer_manager_tools;
......@@ -176,6 +178,16 @@ public:
*/
void syncLayerBox();
/** function UpdateTitleAndInfo
* displays the short filename (if exists) of the selected layer
* on the caption of the main gerbview window
* and some other parameters
* Name of the layer (found in the gerber file: LN <name> command) in the status bar
* Name of the Image (found in the gerber file: IN <name> command) in the status bar
* and other data in toolbar
*/
void UpdateTitleAndInfo();
/**
* Load applications settings specific to the PCBNew.
*
......@@ -389,6 +401,14 @@ public:
int aPrintMask, bool aPrintMirrorMode,
void * aData = NULL);
/** InstallDialogLayerPairChoice
* Install a dialog frame to choose the equivalence
* between gerber layers and pcbnew layers
* @return the "lookup table" if ok, or NULL
*/
int* InstallDialogLayerPairChoice( );
DECLARE_EVENT_TABLE()
};
......
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