Commit bcd7a739 authored by CHARRAS's avatar CHARRAS

gerbview enhancement: polygons can be shown in sketch mode. Some translations

parent b30b24c5
/* XPM */
#ifndef XPMMAIN
extern const char *opt_show_polygon_xpm[];
#else
const char * opt_show_polygon_xpm[] = {
"16 16 3 1",
" c None",
"! c black",
"# c #D90000",
" ",
" ####### ",
" # # ",
" # # ",
" # # ",
" # # ",
" # # ",
" # # ",
"# # ",
"# # ",
" # # ",
" # # ",
" # # ",
" # # ",
" # # ",
" ###### "};
#endif
...@@ -233,7 +233,7 @@ char* ptcar; ...@@ -233,7 +233,7 @@ char* ptcar;
int dimH, dimV, drill, type_outil, dummy; int dimH, dimV, drill, type_outil, dummy;
float fdimH, fdimV, fdrill; float fdimH, fdimV, fdrill;
char c_type_outil[256]; char c_type_outil[256];
char Line[1024]; char Line[2000];
wxString msg; wxString msg;
D_CODE * pt_Dcode; D_CODE * pt_Dcode;
FILE * dest; FILE * dest;
...@@ -266,7 +266,7 @@ D_CODE ** ListeDCode; ...@@ -266,7 +266,7 @@ D_CODE ** ListeDCode;
ListeDCode = g_GERBER_Descr_List[layer]->m_Aperture_List; ListeDCode = g_GERBER_Descr_List[layer]->m_Aperture_List;
while( fgets(Line,255,dest) != NULL) while( fgets(Line, sizeof(Line)-1,dest) != NULL)
{ {
if (*Line == ';') continue; /* Commentaire */ if (*Line == ';') continue; /* Commentaire */
if (strlen(Line) < 10 ) continue ; /* Probablemant ligne vide */ if (strlen(Line) < 10 ) continue ; /* Probablemant ligne vide */
......
...@@ -198,9 +198,9 @@ PCB_SCREEN * screen; ...@@ -198,9 +198,9 @@ PCB_SCREEN * screen;
/*******************************************/ /*******************************************/
void WinEDA_GerberFrame::SetToolbars() void WinEDA_GerberFrame::SetToolbars()
/*******************************************/ /*******************************************/
/* Active ou desactive les tools du toolbar horizontal, en fonction des commandes /** Function SetToolbars()
en cours * Set the tools state for the toolbars, accordint to display options
*/ */
{ {
int layer = GetScreen()->m_Active_Layer; int layer = GetScreen()->m_Active_Layer;
GERBER_Descr * Gerber_layer_descr = g_GERBER_Descr_List[layer]; GERBER_Descr * Gerber_layer_descr = g_GERBER_Descr_List[layer];
...@@ -277,6 +277,9 @@ GERBER_Descr * Gerber_layer_descr = g_GERBER_Descr_List[layer]; ...@@ -277,6 +277,9 @@ GERBER_Descr * Gerber_layer_descr = g_GERBER_Descr_List[layer];
m_OptionsToolBar->ToggleTool(ID_TB_OPTIONS_SHOW_TRACKS_SKETCH, m_OptionsToolBar->ToggleTool(ID_TB_OPTIONS_SHOW_TRACKS_SKETCH,
! m_DisplayPcbTrackFill); ! m_DisplayPcbTrackFill);
m_OptionsToolBar->ToggleTool(ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH,
g_DisplayPolygonsModeSketch == 0 ? 0 : 1);
m_OptionsToolBar->ToggleTool(ID_TB_OPTIONS_SHOW_DCODES, m_OptionsToolBar->ToggleTool(ID_TB_OPTIONS_SHOW_DCODES,
DisplayOpt.DisplayPadNum); DisplayOpt.DisplayPadNum);
} }
......
/*******************************************************/ /*******************************************************/
/* Menu General de Trace (PLOT): Fichier inclus PLOT.H */ /* Menu General de Trace (PLOT): Fichier inclus PLOT.H */
/*******************************************************/ /*******************************************************/
#ifndef GERBVIEW_H #ifndef GERBVIEW_H
#define GERBVIEW_H #define GERBVIEW_H
...@@ -10,88 +10,83 @@ ...@@ -10,88 +10,83 @@
#endif #endif
// Type d'action du phototraceur: // Type d'action du phototraceur:
#define GERB_ACTIVE_DRAW 1 // activation de lumiere ( baisser de plume) #define GERB_ACTIVE_DRAW 1 // activation de lumiere ( baisser de plume)
#define GERB_STOP_DRAW 2 // extinction de lumiere ( lever de plume) #define GERB_STOP_DRAW 2 // extinction de lumiere ( lever de plume)
#define GERB_FLASH 3 // Flash #define GERB_FLASH 3 // Flash
typedef enum { typedef enum {
FORMAT_HPGL, FORMAT_HPGL,
FORMAT_GERBER, FORMAT_GERBER,
FORMAT_POST FORMAT_POST
} PlotFormat; } PlotFormat;
//eda_global wxString g_Plot_FileName; //eda_global wxString g_Plot_FileName;
eda_global wxString g_PhotoFilenameExt; eda_global wxString g_PhotoFilenameExt;
eda_global wxString g_DrillFilenameExt; eda_global wxString g_DrillFilenameExt;
eda_global wxString g_PenFilenameExt; eda_global wxString g_PenFilenameExt;
eda_global int g_DCodesColor; eda_global int g_DCodesColor;
eda_global int g_Default_GERBER_Format; eda_global int g_Default_GERBER_Format;
/* Gestion des ouvertures GERBER */ /* Gestion des ouvertures GERBER */
eda_global int g_Plot_Spot_Mini; /* Diametre mini de l'ouverture pour trace GERBER */ eda_global int g_Plot_Spot_Mini; /* Diametre mini de l'ouverture pour trace GERBER */
/*************************************/ /*************************************/
/* Constantes utiles en trace GERBER */ /* Constantes utiles en trace GERBER */
/*************************************/ /*************************************/
/* codes de type de forme d'outils */ /* codes de type de forme d'outils */
enum Gerb_StandardShape enum Gerb_StandardShape {
{ GERB_CIRCLE = 1,
GERB_CIRCLE = 1, GERB_RECT,
GERB_RECT, GERB_LINE,
GERB_LINE, GERB_OVALE,
GERB_OVALE, GERB_SPECIAL_SHAPE
GERB_SPECIAL_SHAPE
}; };
// Interpolation type // Interpolation type
enum Gerb_Interpolation enum Gerb_Interpolation {
{ GERB_INTERPOL_LINEAR_1X = 0,
GERB_INTERPOL_LINEAR_1X = 0, GERB_INTERPOL_LINEAR_10X,
GERB_INTERPOL_LINEAR_10X, GERB_INTERPOL_LINEAR_01X,
GERB_INTERPOL_LINEAR_01X, GERB_INTERPOL_LINEAR_001X,
GERB_INTERPOL_LINEAR_001X, GERB_INTERPOL_ARC_NEG,
GERB_INTERPOL_ARC_NEG, GERB_INTERPOL_ARC_POS,
GERB_INTERPOL_ARC_POS,
}; };
// Command Type (GCodes) // Command Type (GCodes)
enum Gerb_GCommand enum Gerb_GCommand {
{ GC_MOVE = 0,
GC_MOVE = 0, GC_LINEAR_INTERPOL_1X = 1,
GC_LINEAR_INTERPOL_1X = 1, GC_CIRCLE_NEG_INTERPOL = 2,
GC_CIRCLE_NEG_INTERPOL = 2, GC_CIRCLE_POS_INTERPOL = 3,
GC_CIRCLE_POS_INTERPOL = 3, GC_COMMENT = 4,
GC_COMMENT = 4, GC_LINEAR_INTERPOL_10X = 10,
GC_LINEAR_INTERPOL_10X = 10, GC_LINEAR_INTERPOL_0P1X = 11,
GC_LINEAR_INTERPOL_0P1X = 11, GC_LINEAR_INTERPOL_0P01X = 12,
GC_LINEAR_INTERPOL_0P01X = 12, GC_TURN_ON_POLY_FILL = 36,
GC_TURN_ON_POLY_FILL = 36, GC_TURN_OFF_POLY_FILL = 37,
GC_TURN_OFF_POLY_FILL = 37, GC_SELECT_TOOL = 54,
GC_SELECT_TOOL = 54, GC_SPECIFY_INCHES = 70,
GC_SPECIFY_INCHES = 70, GC_SPECIFY_MILLIMETERS = 71,
GC_SPECIFY_MILLIMETERS = 71, GC_TURN_OFF_360_INTERPOL = 74,
GC_TURN_OFF_360_INTERPOL = 74, GC_TURN_ON_360_INTERPOL = 75,
GC_TURN_ON_360_INTERPOL = 75, GC_SPECIFY_ABSOLUES_COORD = 90,
GC_SPECIFY_ABSOLUES_COORD = 90, GC_SPECIFY_RELATIVEES_COORD = 91
GC_SPECIFY_RELATIVEES_COORD = 91
}; };
#define MAX_TOOLS 2048 #define MAX_TOOLS 2048
#define FIRST_DCODE 10 #define FIRST_DCODE 10
enum Gerb_Analyse_Cmd enum Gerb_Analyse_Cmd {
{ CMD_IDLE = 0,
CMD_IDLE = 0, END_BLOCK,
END_BLOCK, ENTER_RS274X_CMD
ENTER_RS274X_CMD
}; };
...@@ -101,65 +96,65 @@ class D_CODE; ...@@ -101,65 +96,65 @@ class D_CODE;
class GERBER_Descr class GERBER_Descr
{ {
public: public:
GERBER_Descr * m_Parent; // Pointeur sur la racine pour layers imbriques GERBER_Descr* m_Parent; // Pointeur sur la racine pour layers imbriques
GERBER_Descr * m_Pback; // Pointeur de chainage arriere pour layers imbriques GERBER_Descr* m_Pback; // Pointeur de chainage arriere pour layers imbriques
GERBER_Descr * m_Pnext; // Pointeur de chainage avant pour layers imbriques GERBER_Descr* m_Pnext; // Pointeur de chainage avant pour layers imbriques
wxString m_FileName; // Full File Name for this layer wxString m_FileName; // Full File Name for this layer
wxString m_Name; // Layer name wxString m_Name; // Layer name
int m_Layer; // Layer Number int m_Layer; // Layer Number
bool m_LayerNegative; // TRUE = Negative Layer bool m_LayerNegative; // TRUE = Negative Layer
bool m_GerbMetric; // FALSE = Inches, TRUE = metric bool m_GerbMetric; // FALSE = Inches, TRUE = metric
bool m_Relative; // FALSE = absolute Coord, RUE = relative Coord bool m_Relative; // FALSE = absolute Coord, RUE = relative Coord
bool m_NoTrailingZeros; // True: zeros a droite supprims bool m_NoTrailingZeros; // True: zeros a droite supprims
bool m_MirorA; // True: miror / axe A (X) bool m_MirorA; // True: miror / axe A (X)
bool m_MirorB; // True: miror / axe B (Y) bool m_MirorB; // True: miror / axe B (Y)
bool m_As_DCode; // TRUE = DCodes in file (FALSE = no DCode-> bool m_As_DCode; // TRUE = DCodes in file (FALSE = no DCode->
// separate DCode file // separate DCode file
wxPoint m_Offset; // Coord Offset wxPoint m_Offset; // Coord Offset
wxSize m_FmtScale; // Fmt 2.3: m_FmtScale = 3, fmt 3.4: m_FmtScale = 4 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 wxSize m_FmtLen; // Nb chars per coord. ex fmt 2.3, m_FmtLen = 5
wxRealPoint m_LayerScale; // scale (X et Y) pour cette layer wxRealPoint m_LayerScale; // scale (X et Y) pour cette layer
int m_Rotation; int m_Rotation;
int m_Iterpolation; // Linear, 90 arc, Circ. int m_Iterpolation; // Linear, 90 arc, Circ.
bool m_ImageNegative; // TRUE = Negative image bool m_ImageNegative; // TRUE = Negative image
int m_Current_Tool; // Current Tool (Dcode) number selected 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_Last_Pen_Command; // Current or last pen state (0..9, set by Dn option with n <10
int m_CommandState; // donne l'etat de l'analyse des commandes gerber int m_CommandState; // donne l'etat de l'analyse des commandes gerber
wxPoint m_CurrentPos; // current specified coord for plot wxPoint m_CurrentPos; // current specified coord for plot
wxPoint m_PreviousPos; // old current specified coord for plot wxPoint m_PreviousPos; // old current specified coord for plot
wxPoint m_IJPos; // IJ coord (for arcs & circles ) wxPoint m_IJPos; // IJ coord (for arcs & circles )
D_CODE * m_Aperture_List[MAX_TOOLS+FIRST_DCODE+1]; // Dcode (Aperture) List for this layer D_CODE* m_Aperture_List[MAX_TOOLS + FIRST_DCODE + 1]; // Dcode (Aperture) List for this layer
FILE * m_Current_File; // Current file to read FILE* m_Current_File; // Current file to read
FILE * m_FilesList[12]; // Files list FILE* m_FilesList[12]; // Files list
int m_FilesPtr; // Stack pointer for files list int m_FilesPtr; // Stack pointer for files list
int m_Selected_Tool; // Pour editions: Tool (Dcode) selectionn int m_Selected_Tool; // Pour editions: Tool (Dcode) selectionn
int m_Transform[2][2]; // The rotation/mirror transformation matrix. int m_Transform[2][2]; // The rotation/mirror transformation matrix.
bool m_360Arc_enbl; // Enbl 360 deg circular interpolation bool m_360Arc_enbl; // Enbl 360 deg circular interpolation
bool m_PolygonFillMode; // Enbl polygon mode (read coord as a polygone descr) bool m_PolygonFillMode; // Enbl polygon mode (read coord as a polygone descr)
int m_PolygonFillModeState; // In polygon mode: 0 = first segm, 1 = next segm int m_PolygonFillModeState; // In polygon mode: 0 = first segm, 1 = next segm
public: public:
GERBER_Descr(int layer); GERBER_Descr( int layer );
~GERBER_Descr(); ~GERBER_Descr();
void Clear_GERBER_Descr(); void Clear_GERBER_Descr();
int ReturnUsedDcodeNumber(); int ReturnUsedDcodeNumber();
void ResetDefaultValues(); void ResetDefaultValues();
void InitToolTable(); void InitToolTable();
// Routines utilises en lecture de ficher gerber // Routines utilises en lecture de ficher gerber
wxPoint ReadXYCoord(char * &Text); wxPoint ReadXYCoord( char*& Text );
wxPoint ReadIJCoord(char * &Text); wxPoint ReadIJCoord( char*& Text );
int ReturnGCodeNumber(char * &Text); int ReturnGCodeNumber( char*& Text );
int ReturnDCodeNumber(char * &Text); int ReturnDCodeNumber( char*& Text );
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 );
bool ReadRS274XCommand(WinEDA_GerberFrame * frame, wxDC * DC, bool ReadRS274XCommand( WinEDA_GerberFrame* frame, wxDC* DC,
char * buff, char * &text); char* buff, char*& text );
bool ExecuteRS274XCommand(int command, char * buff, char * &text); bool ExecuteRS274XCommand( int command, char* buff, char*& text );
}; };
...@@ -168,32 +163,38 @@ public: ...@@ -168,32 +163,38 @@ public:
class D_CODE class D_CODE
{ {
public: public:
wxSize m_Size; /* Dimensions horiz et Vert */ wxSize m_Size; /* Dimensions horiz et Vert */
int m_Shape ; /* shape ( Line, rect , circulaire , ovale .. ) */ int m_Shape; /* shape ( Line, rect , circulaire , ovale .. ) */
int m_Num_Dcode; /* numero de code ( >= 10 ) */ int m_Num_Dcode; /* numero de code ( >= 10 ) */
wxSize m_Drill ; /* dimension du trou central (s'il existe) */ wxSize m_Drill; /* dimension du trou central (s'il existe) */
int m_DrillShape; /* forme du trou central ( rond = 1, rect = 2 ) */ int m_DrillShape; /* forme du trou central ( rond = 1, rect = 2 ) */
bool m_InUse; /* FALSE si non utilis */ bool m_InUse; /* FALSE si non utilis */
bool m_Defined; /* FALSE si non defini */ bool m_Defined; /* FALSE si non defini */
wxString m_SpecialDescr; wxString m_SpecialDescr;
public: public:
D_CODE(int num_dcode); D_CODE( int num_dcode );
~D_CODE(); ~D_CODE();
void Clear_D_CODE_Data(); void Clear_D_CODE_Data();
}; };
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( "Rond" ), wxT( "Rect" ), wxT( "Line" ), wxT( "Oval" ), wxT( "Macro" )
}
#endif #endif
; ;
eda_global GERBER_Descr * g_GERBER_Descr_List[32]; eda_global GERBER_Descr* g_GERBER_Descr_List[32];
eda_global int g_DisplayPolygonsModeSketch; /* How to show filled polygons :
* 0 = filled
* 1 = Sketch mode
*/
#include "pcbnew.h" #include "pcbnew.h"
#endif // ifndef GERBVIEW_H #endif // ifndef GERBVIEW_H
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
/* GERBVIEW - Gestion des Options et Reglages */ /* GERBVIEW - Gestion des Options et Reglages */
/********************************************/ /********************************************/
/* Fichier options.cpp */ /* File options.cpp */
/* /*
* Affichage et modifications des parametres de travail Gerbview * Set the display options for Gerbview
*/ */
...@@ -20,45 +20,42 @@ ...@@ -20,45 +20,42 @@
#include "protos.h" #include "protos.h"
#include <wx/spinctrl.h> #include <wx/spinctrl.h>
/* Fonctions locales */
/* variables locales */
/*****************************************************************/ /*****************************************************************/
void WinEDA_GerberFrame::OnSelectOptionToolbar(wxCommandEvent& event) void WinEDA_GerberFrame::OnSelectOptionToolbar(wxCommandEvent& event)
/*****************************************************************/ /*****************************************************************/
/** Function OnSelectOptionToolbar
* called to validate current choices
*/
{ {
int id = event.GetId(); int id = event.GetId();
wxClientDC dc(DrawPanel);
DrawPanel->PrepareGraphicContext(&dc);
switch ( id ) switch ( id )
{ {
case ID_TB_OPTIONS_SHOW_GRID: case ID_TB_OPTIONS_SHOW_GRID:
m_Draw_Grid = g_ShowGrid = m_OptionsToolBar->GetToolState(id); m_Draw_Grid = g_ShowGrid = m_OptionsToolBar->GetToolState(id);
DrawPanel->ReDraw(&dc, TRUE); DrawPanel->Refresh(TRUE);
break; break;
case ID_TB_OPTIONS_SELECT_UNIT_MM: case ID_TB_OPTIONS_SELECT_UNIT_MM:
g_UnitMetric = MILLIMETRE; g_UnitMetric = MILLIMETRE;
Affiche_Status_Box(); /* Reaffichage des coord curseur */ Affiche_Status_Box();
break; break;
case ID_TB_OPTIONS_SELECT_UNIT_INCH: case ID_TB_OPTIONS_SELECT_UNIT_INCH:
g_UnitMetric = INCHES; g_UnitMetric = INCHES;
Affiche_Status_Box(); /* Reaffichage des coord curseur */ Affiche_Status_Box();
break; break;
case ID_TB_OPTIONS_SHOW_POLAR_COORD: case ID_TB_OPTIONS_SHOW_POLAR_COORD:
Affiche_Message(wxEmptyString); Affiche_Message(wxEmptyString);
DisplayOpt.DisplayPolarCood = m_OptionsToolBar->GetToolState(id); DisplayOpt.DisplayPolarCood = m_OptionsToolBar->GetToolState(id);
Affiche_Status_Box(); /* Reaffichage des coord curseur */ Affiche_Status_Box();
break; break;
case ID_TB_OPTIONS_SELECT_CURSOR: case ID_TB_OPTIONS_SELECT_CURSOR:
DrawPanel->CursorOff(&dc);
g_CursorShape = m_OptionsToolBar->GetToolState(id); g_CursorShape = m_OptionsToolBar->GetToolState(id);
DrawPanel->CursorOn(&dc); DrawPanel->Refresh(TRUE);
break; break;
case ID_TB_OPTIONS_SHOW_PADS_SKETCH: case ID_TB_OPTIONS_SHOW_PADS_SKETCH:
...@@ -72,7 +69,7 @@ wxClientDC dc(DrawPanel); ...@@ -72,7 +69,7 @@ wxClientDC dc(DrawPanel);
m_DisplayPadFill = TRUE; m_DisplayPadFill = TRUE;
DisplayOpt.DisplayPadFill = TRUE; DisplayOpt.DisplayPadFill = TRUE;
} }
DrawPanel->ReDraw(&dc, TRUE); DrawPanel->Refresh(TRUE);
break; break;
case ID_TB_OPTIONS_SHOW_TRACKS_SKETCH: case ID_TB_OPTIONS_SHOW_TRACKS_SKETCH:
...@@ -86,12 +83,19 @@ wxClientDC dc(DrawPanel); ...@@ -86,12 +83,19 @@ wxClientDC dc(DrawPanel);
m_DisplayPcbTrackFill = TRUE; m_DisplayPcbTrackFill = TRUE;
DisplayOpt.DisplayPcbTrackFill = TRUE; DisplayOpt.DisplayPcbTrackFill = TRUE;
} }
DrawPanel->ReDraw(&dc, TRUE); DrawPanel->Refresh(TRUE);
break;
case ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH:
if ( m_OptionsToolBar->GetToolState(id) ) // Polygons filled asked
g_DisplayPolygonsModeSketch = 0;
else g_DisplayPolygonsModeSketch = 1;
DrawPanel->Refresh(TRUE);
break; break;
case ID_TB_OPTIONS_SHOW_DCODES: case ID_TB_OPTIONS_SHOW_DCODES:
DisplayOpt.DisplayPadNum = m_OptionsToolBar->GetToolState(id); DisplayOpt.DisplayPadNum = m_OptionsToolBar->GetToolState(id);
DrawPanel->ReDraw(&dc, TRUE); DrawPanel->Refresh(TRUE);
break; break;
default: default:
...@@ -103,11 +107,9 @@ wxClientDC dc(DrawPanel); ...@@ -103,11 +107,9 @@ wxClientDC dc(DrawPanel);
} }
/*************************************************/ /******************************************************/
/* classe derivee pour la frame de Configuration */
/*************************************************/
class WinEDA_GerberGeneralOptionsFrame: public wxDialog class WinEDA_GerberGeneralOptionsFrame: public wxDialog
/******************************************************/
{ {
private: private:
...@@ -129,7 +131,7 @@ private: ...@@ -129,7 +131,7 @@ private:
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
/* Construction de la table des evenements pour WinEDA_GerberGeneralOptionsFrame */ /* Events table for WinEDA_GerberGeneralOptionsFrame */
BEGIN_EVENT_TABLE(WinEDA_GerberGeneralOptionsFrame, wxDialog) BEGIN_EVENT_TABLE(WinEDA_GerberGeneralOptionsFrame, wxDialog)
EVT_BUTTON(wxID_OK, WinEDA_GerberGeneralOptionsFrame::OnOkClick) EVT_BUTTON(wxID_OK, WinEDA_GerberGeneralOptionsFrame::OnOkClick)
EVT_BUTTON(wxID_CANCEL, WinEDA_GerberGeneralOptionsFrame::OnCancelClick) EVT_BUTTON(wxID_CANCEL, WinEDA_GerberGeneralOptionsFrame::OnCancelClick)
...@@ -138,15 +140,15 @@ END_EVENT_TABLE() ...@@ -138,15 +140,15 @@ END_EVENT_TABLE()
/*************************************************/ /**********************************************************************************************/
/* Constructeur de WinEDA_GerberGeneralOptionsFrame */
/************************************************/
WinEDA_GerberGeneralOptionsFrame::WinEDA_GerberGeneralOptionsFrame(WinEDA_BasePcbFrame *parent, WinEDA_GerberGeneralOptionsFrame::WinEDA_GerberGeneralOptionsFrame(WinEDA_BasePcbFrame *parent,
const wxPoint& framepos): const wxPoint& framepos):
wxDialog(parent, -1, _("Gerbview Options"), wxDialog(parent, -1, _("Gerbview Options"),
framepos, wxSize(300, 240), framepos, wxSize(300, 240),
wxDEFAULT_DIALOG_STYLE|wxFRAME_FLOAT_ON_PARENT ) wxDEFAULT_DIALOG_STYLE|wxFRAME_FLOAT_ON_PARENT )
/**********************************************************************************************/
/** WinEDA_GerberGeneralOptionsFrame Constructor
*/
{ {
m_Parent = parent; m_Parent = parent;
SetFont(*g_DialogFont); SetFont(*g_DialogFont);
...@@ -168,7 +170,7 @@ WinEDA_GerberGeneralOptionsFrame::WinEDA_GerberGeneralOptionsFrame(WinEDA_BasePc ...@@ -168,7 +170,7 @@ WinEDA_GerberGeneralOptionsFrame::WinEDA_GerberGeneralOptionsFrame(WinEDA_BasePc
Button->SetForegroundColour(*wxBLUE); Button->SetForegroundColour(*wxBLUE);
RightBoxSizer->Add(Button, 0, wxGROW|wxALL, 5); RightBoxSizer->Add(Button, 0, wxGROW|wxALL, 5);
/* Display Selection affichage des coordonnes polaires */ /* Display / not display polar coordinates: */
wxString list_coord[2] = wxString list_coord[2] =
{ _("No Display"), { _("No Display"),
_("Display") }; _("Display") };
...@@ -178,7 +180,7 @@ wxString list_coord[2] = ...@@ -178,7 +180,7 @@ wxString list_coord[2] =
m_PolarDisplay->SetSelection(DisplayOpt.DisplayPolarCood ? 1 : 0); m_PolarDisplay->SetSelection(DisplayOpt.DisplayPolarCood ? 1 : 0);
LeftBoxSizer->Add(m_PolarDisplay, 0, wxGROW|wxALL, 5); LeftBoxSizer->Add(m_PolarDisplay, 0, wxGROW|wxALL, 5);
/* Selection choix des units d'affichage */ /* Selection of units */
wxString list_units[2] = { wxString list_units[2] = {
_("Inches"), _("Inches"),
_("millimeters") }; _("millimeters") };
...@@ -187,7 +189,7 @@ wxString list_units[2] = { ...@@ -187,7 +189,7 @@ wxString list_units[2] = {
m_BoxUnits->SetSelection( g_UnitMetric ? 1 : 0); m_BoxUnits->SetSelection( g_UnitMetric ? 1 : 0);
LeftBoxSizer->Add(m_BoxUnits, 0, wxGROW|wxALL, 5); LeftBoxSizer->Add(m_BoxUnits, 0, wxGROW|wxALL, 5);
/* Selection forme du curseur */ /* Selection of cursor shape */
wxString list_cursors[2] = { _("Small"), _("Big") }; wxString list_cursors[2] = { _("Small"), _("Big") };
m_CursorShape = new wxRadioBox(this, -1, _("Cursor"), wxDefaultPosition, wxDefaultSize, m_CursorShape = new wxRadioBox(this, -1, _("Cursor"), wxDefaultPosition, wxDefaultSize,
2, list_cursors, 1); 2, list_cursors, 1);
...@@ -232,30 +234,25 @@ void WinEDA_GerberGeneralOptionsFrame::OnOkClick(wxCommandEvent& event) ...@@ -232,30 +234,25 @@ void WinEDA_GerberGeneralOptionsFrame::OnOkClick(wxCommandEvent& event)
/******************************************************************/ /*******************************************/
/* classe derivee pour la frame de Configuration WinEDA_LookFrame */ /* Dialog frame to select deisplay options */
/******************************************************************/ /*******************************************/
class WinEDA_LookFrame: public wxDialog class WinEDA_LookFrame: public wxDialog
{ {
private: private:
protected:
public:
WinEDA_BasePcbFrame * m_Parent; WinEDA_BasePcbFrame * m_Parent;
wxRadioBox * m_OptDisplayLines; wxRadioBox * m_OptDisplayLines;
wxRadioBox * m_OptDisplayFlashes; wxRadioBox * m_OptDisplayFlashes;
wxRadioBox * m_OptDisplayPolygons;
wxCheckBox * m_OptDisplayDCodes; wxCheckBox * m_OptDisplayDCodes;
wxRadioBox * m_OptDisplayDrawings; wxRadioBox * m_OptDisplayDrawings;
public:
// Constructor and destructor // Constructor and destructor
WinEDA_LookFrame(WinEDA_BasePcbFrame *parent,const wxPoint& pos); WinEDA_LookFrame(WinEDA_BasePcbFrame *parent,const wxPoint& pos);
~WinEDA_LookFrame() {}; ~WinEDA_LookFrame() {};
private:
void OnOkClick(wxCommandEvent& event); void OnOkClick(wxCommandEvent& event);
void OnCancelClick(wxCommandEvent & event); void OnCancelClick(wxCommandEvent & event);
...@@ -313,6 +310,14 @@ wxString list_opt2[2] = { _("Sketch"), _("Filled") }; ...@@ -313,6 +310,14 @@ wxString list_opt2[2] = { _("Sketch"), _("Filled") };
m_OptDisplayFlashes->SetSelection(1); m_OptDisplayFlashes->SetSelection(1);
LeftBoxSizer->Add(m_OptDisplayFlashes, 0, wxGROW|wxALL, 5); LeftBoxSizer->Add(m_OptDisplayFlashes, 0, wxGROW|wxALL, 5);
// Show Option Draw polygons
m_OptDisplayPolygons = new wxRadioBox(this, -1, _("Polygons:"),
wxDefaultPosition, wxDefaultSize,
2, list_opt2, 1);
if ( g_DisplayPolygonsModeSketch == 0)
m_OptDisplayPolygons->SetSelection(1);
LeftBoxSizer->Add(m_OptDisplayPolygons, 0, wxGROW|wxALL, 5);
wxString list_opt3[3] = { _("Sketch"), _("Filled"), _("Line") }; wxString list_opt3[3] = { _("Sketch"), _("Filled"), _("Line") };
m_OptDisplayDrawings = new wxRadioBox(this, -1, _("Display other items:"), m_OptDisplayDrawings = new wxRadioBox(this, -1, _("Display other items:"),
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
...@@ -354,6 +359,11 @@ void WinEDA_LookFrame::OnOkClick(wxCommandEvent& event) ...@@ -354,6 +359,11 @@ void WinEDA_LookFrame::OnOkClick(wxCommandEvent& event)
else else
DisplayOpt.DisplayPadFill = FALSE; DisplayOpt.DisplayPadFill = FALSE;
if ( m_OptDisplayPolygons->GetSelection() == 0 )
g_DisplayPolygonsModeSketch = 1;
else
g_DisplayPolygonsModeSketch = 0;
DisplayOpt.DisplayPadNum = m_OptDisplayDCodes->GetValue(); DisplayOpt.DisplayPadNum = m_OptDisplayDCodes->GetValue();
DisplayOpt.DisplayDrawItems = m_OptDisplayDrawings->GetSelection(); DisplayOpt.DisplayDrawItems = m_OptDisplayDrawings->GetSelection();
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
* G75 Active interpolation circulaire sur 360 degre * G75 Active interpolation circulaire sur 360 degre
* G90 Mode Coordonnees absolues * G90 Mode Coordonnees absolues
* G91 Mode Coordonnees Relatives * G91 Mode Coordonnees Relatives
* *
* Coordonnees X,Y * Coordonnees X,Y
* X,Y sont suivies de + ou - et de m+n chiffres (non separes) * X,Y sont suivies de + ou - et de m+n chiffres (non separes)
* m = partie entiere * m = partie entiere
...@@ -45,20 +45,20 @@ ...@@ -45,20 +45,20 @@
* m = 3, n = 4 (format 3.4) * m = 3, n = 4 (format 3.4)
* ex: * ex:
* G__ X00345Y-06123 D__* * G__ X00345Y-06123 D__*
* *
* Outils et D_CODES * Outils et D_CODES
* numero d'outil ( identification des formes ) * numero d'outil ( identification des formes )
* 1 a 99 (classique) * 1 a 99 (classique)
* 1 a 999 * 1 a 999
* D_CODES: * D_CODES:
* *
* D01 ... D9 = codes d'action: * D01 ... D9 = codes d'action:
* D01 = activation de lumiere (baisser de plume) lors du déplacement * D01 = activation de lumiere (baisser de plume) lors du déplacement
* D02 = extinction de lumiere (lever de plume) lors du déplacement * D02 = extinction de lumiere (lever de plume) lors du déplacement
* D03 = Flash * D03 = Flash
* D09 = VAPE Flash * D09 = VAPE Flash
* D51 = precede par G54 -> Select VAPE * D51 = precede par G54 -> Select VAPE
* *
* D10 ... D255 = Indentification d'outils ( d'ouvertures ) * D10 ... D255 = Indentification d'outils ( d'ouvertures )
* Ne sont pas tj dans l'ordre ( voir tableau dans PCBPLOT.H) * Ne sont pas tj dans l'ordre ( voir tableau dans PCBPLOT.H)
*/ */
...@@ -72,25 +72,25 @@ ...@@ -72,25 +72,25 @@
/* Routine de Lecture d'un fichier de D Codes. /* Routine de Lecture d'un fichier de D Codes.
* Accepte format standard ou ALSPCB * Accepte format standard ou ALSPCB
* un ';' demarre un commentaire. * un ';' demarre un commentaire.
* *
* Format Standard: * Format Standard:
* tool, Horiz, Vert, drill, vitesse, acc. ,Type ; [DCODE (commentaire)] * tool, Horiz, Vert, drill, vitesse, acc. ,Type ; [DCODE (commentaire)]
* ex: 1, 12, 12, 0, 0, 0, 3 ; D10 * ex: 1, 12, 12, 0, 0, 0, 3 ; D10
* *
* Format ALSPCB: * Format ALSPCB:
* Ver , Hor , Type , Tool [,Drill] * Ver , Hor , Type , Tool [,Drill]
* ex: 0.012, 0.012, L , D10 * ex: 0.012, 0.012, L , D10
* *
* Classe les caract en buf_tmp sous forme de tableau de structures D_CODE. * Classe les caract en buf_tmp sous forme de tableau de structures D_CODE.
* Retourne: * Retourne:
* < 0 si erreur: * < 0 si erreur:
* -1 = Fichier non trouve * -1 = Fichier non trouve
* -2 = Erreur lecture fichier * -2 = Erreur lecture fichier
* Rang de D_code maxi lu ( nbr de dcodes ) * Rang de D_code maxi lu ( nbr de dcodes )
* *
* *
* Representation interne: * Representation interne:
* *
* Les lignes sont représentées par des TRACKS standards * Les lignes sont représentées par des TRACKS standards
* Les Flash sont représentées par des DRAWSEGMENTS * Les Flash sont représentées par des DRAWSEGMENTS
* - ronds ou ovales: DRAWSEGMENTS * - ronds ou ovales: DRAWSEGMENTS
...@@ -105,24 +105,28 @@ bool WinEDA_GerberFrame::Read_GERBER_File( wxDC* DC, ...@@ -105,24 +105,28 @@ bool WinEDA_GerberFrame::Read_GERBER_File( wxDC* DC,
const wxString& D_Code_FullFileName ) const wxString& D_Code_FullFileName )
/********************************************************/ /********************************************************/
/* Lecture de 1 fichier gerber. /* Read a gerber file (RS274D or RS274X format).
* Format * Normal format:
* Imperial * Imperial
* Absolu * Absolute
* fin de bloc = * * end of block = *
* CrLf apres chaque commande * CrLf after each command
* G codes repetes * G codes repetes
*/ */
{ {
int G_commande = 0, D_commande = 0; /* Numero de commande G et D codes */ int G_commande = 0,
char Line[1024]; // Buffer des lignes du fichier gerber en cours 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
*/
wxString msg; wxString msg;
char* text; char* text;
int layer = GetScreen()->m_Active_Layer; int layer; /* current layer used in gerbview */
GERBER_Descr* gerber_layer; GERBER_Descr* gerber_layer;
wxPoint pos; wxPoint pos;
int error = 0; int error = 0;
layer = GetScreen()->m_Active_Layer;
if( g_GERBER_Descr_List[layer] == NULL ) if( g_GERBER_Descr_List[layer] == NULL )
{ {
...@@ -130,16 +134,16 @@ bool WinEDA_GerberFrame::Read_GERBER_File( wxDC* DC, ...@@ -130,16 +134,16 @@ bool WinEDA_GerberFrame::Read_GERBER_File( wxDC* DC,
} }
gerber_layer = g_GERBER_Descr_List[layer]; gerber_layer = g_GERBER_Descr_List[layer];
/* Mise a jour de l'echelle gerber : */ /* Set the gerber scale: */
gerber_layer->ResetDefaultValues(); gerber_layer->ResetDefaultValues();
/* Lecture du fichier de Trace */ /* Read the gerber file */
gerber_layer->m_Current_File = wxFopen( GERBER_FullFileName, wxT( "rt" ) ); gerber_layer->m_Current_File = wxFopen( GERBER_FullFileName, wxT( "rt" ) );
if( gerber_layer->m_Current_File == 0 ) if( gerber_layer->m_Current_File == 0 )
{ {
msg = _( "File " ) + GERBER_FullFileName + _( " not found" ); msg = _( "File " ) + GERBER_FullFileName + _( " not found" );
DisplayError( this, msg, 10 ); DisplayError( this, msg, 10 );
return FALSE; return FALSE;
} }
...@@ -152,20 +156,20 @@ bool WinEDA_GerberFrame::Read_GERBER_File( wxDC* DC, ...@@ -152,20 +156,20 @@ bool WinEDA_GerberFrame::Read_GERBER_File( wxDC* DC,
while( TRUE ) while( TRUE )
{ {
if( fgets( Line, 255, gerber_layer->m_Current_File ) == NULL ) // E.O.F if( fgets( Line, sizeof(Line) - 1, gerber_layer->m_Current_File ) == NULL ) // E.O.F
{ {
if( gerber_layer->m_FilesPtr == 0 ) if( gerber_layer->m_FilesPtr == 0 )
break; break;
fclose( gerber_layer->m_Current_File ); fclose( gerber_layer->m_Current_File );
gerber_layer->m_FilesPtr--; gerber_layer->m_FilesPtr--;
gerber_layer->m_Current_File = gerber_layer->m_Current_File =
gerber_layer->m_FilesList[gerber_layer->m_FilesPtr]; gerber_layer->m_FilesList[gerber_layer->m_FilesPtr];
continue; continue;
} }
text = StrPurge( Line ); text = StrPurge( Line );
while( text && *text ) while( text && *text )
...@@ -187,21 +191,22 @@ bool WinEDA_GerberFrame::Read_GERBER_File( wxDC* DC, ...@@ -187,21 +191,22 @@ bool WinEDA_GerberFrame::Read_GERBER_File( wxDC* DC,
gerber_layer->m_CommandState = CMD_IDLE; gerber_layer->m_CommandState = CMD_IDLE;
while( *text ) while( *text )
text++; text++;
break; break;
case 'G': /* Ligne type Gxx : commande */ case 'G': /* Line type Gxx : command */
G_commande = gerber_layer->ReturnGCodeNumber( text ); G_commande = gerber_layer->ReturnGCodeNumber( text );
gerber_layer->Execute_G_Command( text, G_commande ); gerber_layer->Execute_G_Command( text, G_commande );
break; break;
case 'D': /* Ligne type Dxx : Selection d'un outil ou commande si xx = 0..9*/ case 'D': /* Line type Dxx : Tool selection (xx > 0) or command if xx = 0..9*/
D_commande = gerber_layer->ReturnDCodeNumber( text ); D_commande = gerber_layer->ReturnDCodeNumber( text );
gerber_layer->Execute_DCODE_Command( this, DC, gerber_layer->Execute_DCODE_Command( this, DC,
text, D_commande ); text, D_commande );
break; break;
case 'X': case 'X':
case 'Y': /* Commande de deplacement ou de Trace */ case 'Y': /* Move or draw command */
pos = gerber_layer->ReadXYCoord( text ); pos = gerber_layer->ReadXYCoord( text );
if( *text == '*' ) // command like X12550Y19250* if( *text == '*' ) // command like X12550Y19250*
{ {
...@@ -211,7 +216,7 @@ bool WinEDA_GerberFrame::Read_GERBER_File( wxDC* DC, ...@@ -211,7 +216,7 @@ bool WinEDA_GerberFrame::Read_GERBER_File( wxDC* DC,
break; break;
case 'I': case 'I':
case 'J': /* Commande de deplacement ou de Trace */ case 'J': /* Auxiliary Move command */
pos = gerber_layer->ReadIJCoord( text ); pos = gerber_layer->ReadIJCoord( text );
break; break;
...@@ -219,7 +224,7 @@ bool WinEDA_GerberFrame::Read_GERBER_File( wxDC* DC, ...@@ -219,7 +224,7 @@ bool WinEDA_GerberFrame::Read_GERBER_File( wxDC* DC,
if( gerber_layer->m_CommandState != ENTER_RS274X_CMD ) if( gerber_layer->m_CommandState != ENTER_RS274X_CMD )
{ {
gerber_layer->m_CommandState = ENTER_RS274X_CMD; gerber_layer->m_CommandState = ENTER_RS274X_CMD;
if( !gerber_layer->ReadRS274XCommand( this, DC, Line, text ) ) if( !gerber_layer->ReadRS274XCommand( this, DC, Line, text ) )
{ {
error++; error++;
...@@ -227,7 +232,6 @@ bool WinEDA_GerberFrame::Read_GERBER_File( wxDC* DC, ...@@ -227,7 +232,6 @@ bool WinEDA_GerberFrame::Read_GERBER_File( wxDC* DC,
} }
else //Error else //Error
{ {
wxBell();
error++; error++;
gerber_layer->m_CommandState = CMD_IDLE; gerber_layer->m_CommandState = CMD_IDLE;
text++; text++;
...@@ -235,7 +239,7 @@ bool WinEDA_GerberFrame::Read_GERBER_File( wxDC* DC, ...@@ -235,7 +239,7 @@ bool WinEDA_GerberFrame::Read_GERBER_File( wxDC* DC,
break; break;
default: default:
text++; text++;
error++; error++;
break; break;
} }
...@@ -252,7 +256,9 @@ bool WinEDA_GerberFrame::Read_GERBER_File( wxDC* DC, ...@@ -252,7 +256,9 @@ bool WinEDA_GerberFrame::Read_GERBER_File( wxDC* DC,
setlocale( LC_NUMERIC, "" ); setlocale( LC_NUMERIC, "" );
/* Init tableau des DCodes et Lecture fichier DCODES */ /* Init DCodes list and perhaps read a DCODES file,
* if the gerber file is only a RS274D file (without any aperture information)
*/
if( !gerber_layer->m_As_DCode ) if( !gerber_layer->m_As_DCode )
{ {
wxString DCodeFileName; wxString DCodeFileName;
......
/********************************************/ /**********************************************/
/* PCBNEW - Gestion des Options et Reglages */ /* GERBVIEW - Gestion des Options et Reglages */
/********************************************/ /**********************************************/
/* Fichier reglage.cpp */ /* Fichier reglage.cpp */
/* /*
* Affichage et modifications des parametres de travail de PcbNew * Options for file extensions
* Parametres = dimensions des via, pistes, isolements, options...
*/ */
...@@ -18,148 +17,136 @@ ...@@ -18,148 +17,136 @@
#include "protos.h" #include "protos.h"
/* Fonctions locales */
/* variables locales */
/***********/ /***********/
enum { enum {
ID_SAVE_CFG = 1000 ID_SAVE_CFG = 1000
}; };
/* Routines Locales */ /* Routines Locales */
/*************************************************/ class WinEDA_ConfigFrame : public wxDialog
/* classe derivee pour la frame de Configuration */
/*************************************************/
class WinEDA_ConfigFrame: public wxDialog
{ {
private: private:
WinEDA_GerberFrame * m_Parent; WinEDA_GerberFrame* m_Parent;
wxListBox * ListLibr; wxListBox* ListLibr;
int LibModified; int LibModified;
WinEDA_EnterText * TextDrillExt; WinEDA_EnterText* TextDrillExt;
WinEDA_EnterText * TextPhotoExt; WinEDA_EnterText* TextPhotoExt;
WinEDA_EnterText * TextPenExt; WinEDA_EnterText* TextPenExt;
// Constructor and destructor // Constructor and destructor
public: public:
WinEDA_ConfigFrame(WinEDA_GerberFrame *parent,const wxPoint& pos); WinEDA_ConfigFrame( WinEDA_GerberFrame* parent, const wxPoint& pos );
~WinEDA_ConfigFrame() {}; ~WinEDA_ConfigFrame() { };
private: private:
void SaveCfg(wxCommandEvent & event); void SaveCfg( wxCommandEvent& event );
void OnOkClick(wxCommandEvent & event); void OnOkClick( wxCommandEvent& event );
void OnCancelClick(wxCommandEvent & event); void OnCancelClick( wxCommandEvent& event );
DECLARE_EVENT_TABLE()
DECLARE_EVENT_TABLE()
}; };
/* Construction de la table des evenements pour WinEDA_ConfigFrame */ /* Construction de la table des evenements pour WinEDA_ConfigFrame */
BEGIN_EVENT_TABLE(WinEDA_ConfigFrame, wxDialog) BEGIN_EVENT_TABLE( WinEDA_ConfigFrame, wxDialog )
EVT_BUTTON(ID_SAVE_CFG, WinEDA_ConfigFrame::SaveCfg) EVT_BUTTON( ID_SAVE_CFG, WinEDA_ConfigFrame::SaveCfg )
EVT_BUTTON(wxID_OK, WinEDA_ConfigFrame::OnOkClick) EVT_BUTTON( wxID_OK, WinEDA_ConfigFrame::OnOkClick )
EVT_BUTTON(wxID_CANCEL, WinEDA_ConfigFrame::OnCancelClick) EVT_BUTTON( wxID_CANCEL, WinEDA_ConfigFrame::OnCancelClick )
END_EVENT_TABLE() END_EVENT_TABLE()
/*****************************************************************/
void WinEDA_GerberFrame::InstallConfigFrame( const wxPoint& pos )
/*****************************************************************/
/*****************************************************************/ /** Function InstallConfigFrame
/* void WinEDA_GerberFrame::InstallConfigFrame(const wxPoint & pos) */ * install the dialog box to configure some gerbview options
/*****************************************************************/ * manly the default file extensions
*/
void WinEDA_GerberFrame::InstallConfigFrame(const wxPoint & pos)
{ {
WinEDA_ConfigFrame * CfgFrame = new WinEDA_ConfigFrame(this, pos); WinEDA_ConfigFrame* CfgFrame = new WinEDA_ConfigFrame( this, pos );
CfgFrame->ShowModal();
CfgFrame->Destroy();
}
CfgFrame->ShowModal();
CfgFrame->Destroy();
}
/************************************************************/
/* Constructeur de WinEDA_ConfigFrame: la fenetre de config */
/************************************************************/
WinEDA_ConfigFrame::WinEDA_ConfigFrame(WinEDA_GerberFrame *parent, /************************************************************/
const wxPoint& framepos): WinEDA_ConfigFrame::WinEDA_ConfigFrame( WinEDA_GerberFrame* parent,
wxDialog(parent, -1, wxEmptyString, framepos, wxSize(300, 180), const wxPoint& framepos ) :
wxDEFAULT_DIALOG_STYLE|wxFRAME_FLOAT_ON_PARENT ) wxDialog( parent, -1, wxEmptyString, framepos, wxSize( 300, 180 ),
wxDEFAULT_DIALOG_STYLE | wxFRAME_FLOAT_ON_PARENT )
/************************************************************/
{ {
const int LEN_EXT = 100; const int LEN_EXT = 100;
wxString title; wxString title;
m_Parent = parent; m_Parent = parent;
SetFont(* g_DialogFont); SetFont( *g_DialogFont );
title = _("from ") + g_EDA_Appl->m_CurrentOptionFile; /* Shows the config filename currently used : */
SetTitle(title); title = _( "from " ) + g_EDA_Appl->m_CurrentOptionFile;
SetTitle( title );
LibModified = FALSE;
wxBoxSizer * MainBoxSizer = new wxBoxSizer(wxHORIZONTAL); LibModified = FALSE;
SetSizer(MainBoxSizer); wxBoxSizer* MainBoxSizer = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer * RightBoxSizer = new wxBoxSizer(wxVERTICAL); SetSizer( MainBoxSizer );
wxBoxSizer * LeftBoxSizer = new wxBoxSizer(wxVERTICAL); wxBoxSizer* RightBoxSizer = new wxBoxSizer( wxVERTICAL );
MainBoxSizer->Add(LeftBoxSizer, 0, wxGROW|wxALL, 5); wxBoxSizer* LeftBoxSizer = new wxBoxSizer( wxVERTICAL );
MainBoxSizer->Add(RightBoxSizer, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); MainBoxSizer->Add( LeftBoxSizer, 0, wxGROW | wxALL, 5 );
MainBoxSizer->Add( RightBoxSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
/* Creation des boutons de commande */
wxButton * Button = new wxButton(this, ID_SAVE_CFG, _("Save Cfg...")); /* Created the buttons */
RightBoxSizer->Add(Button, 0, wxGROW|wxALL, 5); wxButton* Button = new wxButton( this, ID_SAVE_CFG, _( "Save Cfg..." ) );
RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
// Provide a spacer to improve appearance of dialog box
RightBoxSizer->AddSpacer(20); // Provide a spacer to improve appearance of dialog box
RightBoxSizer->AddSpacer( 20 );
Button = new wxButton(this, wxID_OK, _("OK"));
Button->SetForegroundColour(*wxRED); Button = new wxButton( this, wxID_OK, _( "OK" ) );
RightBoxSizer->Add(Button, 0, wxGROW|wxALL, 5); Button->SetForegroundColour( *wxRED );
RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
Button = new wxButton(this, wxID_CANCEL, _("Cancel"));
Button->SetForegroundColour(*wxBLUE); Button = new wxButton( this, wxID_CANCEL, _( "Cancel" ) );
RightBoxSizer->Add(Button, 0, wxGROW|wxALL, 5); Button->SetForegroundColour( *wxBLUE );
RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
wxSize size;
size.x = LEN_EXT; wxSize size;
size.y = -1; size.x = LEN_EXT;
TextDrillExt = new WinEDA_EnterText(this, size.y = -1;
_("Drill File Ext:"), g_DrillFilenameExt, TextDrillExt = new WinEDA_EnterText( this,
LeftBoxSizer, size); _( "Drill File Ext:" ), g_DrillFilenameExt,
LeftBoxSizer, size );
TextPhotoExt = new WinEDA_EnterText(this,
_("Gerber File Ext:"), g_PhotoFilenameExt, TextPhotoExt = new WinEDA_EnterText( this,
LeftBoxSizer, size); _( "Gerber File Ext:" ), g_PhotoFilenameExt,
LeftBoxSizer, size );
TextPenExt = new WinEDA_EnterText(this,
_("D code File Ext:"), g_PenFilenameExt, TextPenExt = new WinEDA_EnterText( this,
LeftBoxSizer, size); _( "D code File Ext:" ), g_PenFilenameExt,
LeftBoxSizer, size );
GetSizer()->Fit(this);
GetSizer()->SetSizeHints(this); GetSizer()->Fit( this );
GetSizer()->SetSizeHints( this );
} }
/*****************************************************************/
/* Fonctions de base de WinEDA_ConfigFrame: la fenetre de config */
/*****************************************************************/
/******************************************************************/ /******************************************************************/
void WinEDA_ConfigFrame::OnOkClick(wxCommandEvent& WXUNUSED(event)) void WinEDA_ConfigFrame::OnOkClick( wxCommandEvent& WXUNUSED (event) )
/******************************************************************/ /******************************************************************/
{ {
g_DrillFilenameExt = TextDrillExt->GetValue(); g_DrillFilenameExt = TextDrillExt->GetValue();
g_PhotoFilenameExt = TextPhotoExt->GetValue(); g_PhotoFilenameExt = TextPhotoExt->GetValue();
g_PenFilenameExt = TextPenExt->GetValue(); g_PenFilenameExt = TextPenExt->GetValue();
EndModal( 1 ); EndModal( 1 );
} }
/******************************************************************/ /******************************************************************/
void WinEDA_ConfigFrame::OnCancelClick(wxCommandEvent& WXUNUSED(event)) void WinEDA_ConfigFrame::OnCancelClick( wxCommandEvent& WXUNUSED (event) )
/******************************************************************/ /******************************************************************/
{ {
EndModal( -1 ); EndModal( -1 );
...@@ -167,8 +154,8 @@ void WinEDA_ConfigFrame::OnCancelClick(wxCommandEvent& WXUNUSED(event)) ...@@ -167,8 +154,8 @@ void WinEDA_ConfigFrame::OnCancelClick(wxCommandEvent& WXUNUSED(event))
/******************************************************/ /******************************************************/
void WinEDA_ConfigFrame::SaveCfg(wxCommandEvent& event) void WinEDA_ConfigFrame::SaveCfg( wxCommandEvent& event )
/******************************************************/ /******************************************************/
{ {
m_Parent->Update_config(); m_Parent->Update_config();
} }
...@@ -27,7 +27,6 @@ void WinEDA_GerberFrame::ReCreateMenuBar( void ) ...@@ -27,7 +27,6 @@ void WinEDA_GerberFrame::ReCreateMenuBar( void )
{ {
int ii; int ii;
wxMenuBar* menuBar = GetMenuBar(); wxMenuBar* menuBar = GetMenuBar();
// wxMenuItem* item;
if( menuBar == NULL ) if( menuBar == NULL )
{ {
...@@ -162,7 +161,7 @@ void WinEDA_GerberFrame::ReCreateMenuBar( void ) ...@@ -162,7 +161,7 @@ void WinEDA_GerberFrame::ReCreateMenuBar( void )
// Associate the menu bar with the frame // Associate the menu bar with the frame
SetMenuBar( menuBar ); SetMenuBar( menuBar );
} }
else // simple mise a jour de la liste des fichiers anciens else // Only an update of the files list
{ {
wxMenuItem* item; wxMenuItem* item;
int max_file = m_Parent->m_LastProjectMaxCount; int max_file = m_Parent->m_LastProjectMaxCount;
...@@ -342,6 +341,9 @@ void WinEDA_GerberFrame::ReCreateHToolbar( void ) ...@@ -342,6 +341,9 @@ void WinEDA_GerberFrame::ReCreateHToolbar( void )
/**********************************************/ /**********************************************/
void WinEDA_GerberFrame::ReCreateVToolbar( void ) void WinEDA_GerberFrame::ReCreateVToolbar( void )
/**********************************************/ /**********************************************/
/**
create or update the right vertical toolbar
*/
{ {
if( m_VToolBar ) if( m_VToolBar )
return; return;
...@@ -398,6 +400,9 @@ void WinEDA_GerberFrame::ReCreateVToolbar( void ) ...@@ -398,6 +400,9 @@ void WinEDA_GerberFrame::ReCreateVToolbar( void )
/************************************************/ /************************************************/
void WinEDA_GerberFrame::ReCreateOptToolbar( void ) void WinEDA_GerberFrame::ReCreateOptToolbar( void )
/************************************************/ /************************************************/
/**
create or update the left vertical toolbar (option toolbar
*/
{ {
if( m_OptionsToolBar ) if( m_OptionsToolBar )
return; return;
...@@ -437,14 +442,21 @@ void WinEDA_GerberFrame::ReCreateOptToolbar( void ) ...@@ -437,14 +442,21 @@ void WinEDA_GerberFrame::ReCreateOptToolbar( void )
wxNullBitmap, wxNullBitmap,
TRUE, TRUE,
-1, -1, (wxObject*) NULL, -1, -1, (wxObject*) NULL,
_( "Show Spots Sketch" ) ); _( "Show Spots in Sketch Mode" ) );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_TRACKS_SKETCH, m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_TRACKS_SKETCH,
BITMAP( showtrack_xpm ), BITMAP( showtrack_xpm ),
wxNullBitmap, wxNullBitmap,
TRUE, TRUE,
-1, -1, (wxObject*) NULL, -1, -1, (wxObject*) NULL,
_( "Show Lines Sketch" ) ); _( "Show Lines in Sketch Mode" ) );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH,
BITMAP( opt_show_polygon_xpm ),
wxNullBitmap,
TRUE,
-1, -1, (wxObject*) NULL,
_( "Show Polygons in Sketch Mode" ) );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_DCODES, m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_DCODES,
BITMAP( show_dcodenumber_xpm ), BITMAP( show_dcodenumber_xpm ),
......
...@@ -28,7 +28,8 @@ void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref, int printmaskl ...@@ -28,7 +28,8 @@ void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref, int printmaskl
/* routine de trace du pcb, avec selection des couches */ /* routine de trace du pcb, avec selection des couches */
{ {
DISPLAY_OPTIONS save_opt; DISPLAY_OPTIONS save_opt;
int DisplayPolygonsModeImg;
save_opt = DisplayOpt; save_opt = DisplayOpt;
if( printmasklayer & ALL_CU_LAYERS ) if( printmasklayer & ALL_CU_LAYERS )
DisplayOpt.DisplayPadFill = FILLED; DisplayOpt.DisplayPadFill = FILLED;
...@@ -43,6 +44,8 @@ void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref, int printmaskl ...@@ -43,6 +44,8 @@ void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref, int printmaskl
DisplayOpt.DisplayTrackIsol = 0; DisplayOpt.DisplayTrackIsol = 0;
DisplayOpt.DisplayDrawItems = FILLED; DisplayOpt.DisplayDrawItems = FILLED;
DisplayOpt.DisplayZones = 1; DisplayOpt.DisplayZones = 1;
DisplayPolygonsModeImg = g_DisplayPolygonsModeSketch;
g_DisplayPolygonsModeSketch = 0;
( (WinEDA_GerberFrame*) m_Parent )->Trace_Gerber( DC, GR_COPY, printmasklayer ); ( (WinEDA_GerberFrame*) m_Parent )->Trace_Gerber( DC, GR_COPY, printmasklayer );
...@@ -50,6 +53,7 @@ void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref, int printmaskl ...@@ -50,6 +53,7 @@ void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref, int printmaskl
m_Parent->TraceWorkSheet( DC, GetScreen(), 0 ); m_Parent->TraceWorkSheet( DC, GetScreen(), 0 );
DisplayOpt = save_opt; DisplayOpt = save_opt;
g_DisplayPolygonsModeSketch = DisplayPolygonsModeImg;
} }
...@@ -112,13 +116,14 @@ void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int draw_mode, int printmasklay ...@@ -112,13 +116,14 @@ void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int draw_mode, int printmasklay
if ( printmasklayer != -1 ) if ( printmasklayer != -1 )
if ( (track->ReturnMaskLayer() & printmasklayer) == 0 ) continue; if ( (track->ReturnMaskLayer() & printmasklayer) == 0 ) continue;
if( track->GetNet() == 0 ) // StartPoint if( track->GetNet() == 0 ) // StartPoint
{ {
if( nbpoints ) if( nbpoints ) // we have found a new polygon: Draw the old polygon
{ {
int Color = g_DesignSettings.m_LayerColor[track->GetLayer()]; int Color = g_DesignSettings.m_LayerColor[track->GetLayer()];
int filled = (g_DisplayPolygonsModeSketch == 0) ? 1 : 0;
GRClosedPoly( &DrawPanel->m_ClipBox, DC, nbpoints, coord, GRClosedPoly( &DrawPanel->m_ClipBox, DC, nbpoints, coord,
1, Color, Color ); filled, Color, Color );
} }
nbpoints = 2; nbpoints = 2;
ptcoord = coord; ptcoord = coord;
...@@ -142,8 +147,9 @@ void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int draw_mode, int printmasklay ...@@ -142,8 +147,9 @@ void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int draw_mode, int printmasklay
if( track->Next() == NULL ) // Last point if( track->Next() == NULL ) // Last point
{ {
int Color = g_DesignSettings.m_LayerColor[track->GetLayer()]; int Color = g_DesignSettings.m_LayerColor[track->GetLayer()];
int filled = (g_DisplayPolygonsModeSketch == 0) ? 1 : 0;
GRClosedPoly( &DrawPanel->m_ClipBox, DC, nbpoints, coord, GRClosedPoly( &DrawPanel->m_ClipBox, DC, nbpoints, coord,
1, Color, Color ); filled, Color, Color );
} }
} }
......
...@@ -72,6 +72,7 @@ ...@@ -72,6 +72,7 @@
#include "../bitmaps/Options_Segment.xpm" #include "../bitmaps/Options_Segment.xpm"
#include "../bitmaps/Options_Rectangle.xpm" #include "../bitmaps/Options_Rectangle.xpm"
#include "../bitmaps/Display_Options.xpm" #include "../bitmaps/Display_Options.xpm"
#include "../bitmaps/opt_show_polygon.xpm"
#include "../bitmaps/Mirror_V.xpm" #include "../bitmaps/Mirror_V.xpm"
#include "../bitmaps/Mirror_H.xpm" #include "../bitmaps/Mirror_H.xpm"
......
...@@ -814,7 +814,7 @@ enum main_id { ...@@ -814,7 +814,7 @@ enum main_id {
ID_TB_OPTIONS_SHOW_DCODES, ID_TB_OPTIONS_SHOW_DCODES,
ID_TB_OPTIONS_SHOW_HIGHT_CONTRAST_MODE, ID_TB_OPTIONS_SHOW_HIGHT_CONTRAST_MODE,
ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR1, ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR1,
ID_TB_OPTIONS_UNUSED5, ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH,
ID_TB_OPTIONS_UNUSED6, ID_TB_OPTIONS_UNUSED6,
ID_TB_OPTIONS_UNUSED7, ID_TB_OPTIONS_UNUSED7,
ID_TB_OPTIONS_UNUSED8, ID_TB_OPTIONS_UNUSED8,
......
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