Commit bcd7a739 authored by CHARRAS's avatar CHARRAS
Browse files

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

parent b30b24c5
Loading
Loading
Loading
Loading
+27 −0
Original line number Original line Diff line number Diff line
/* 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
+2 −2
Original line number Original line Diff line number Diff line
@@ -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;


	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 */
+6 −3
Original line number Original line Diff line number Diff line
@@ -198,8 +198,8 @@ 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;
@@ -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);
	}
	}
+133 −132
Original line number Original line Diff line number Diff line
@@ -34,14 +34,12 @@ eda_global int g_Default_GERBER_Format;
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,
@@ -50,8 +48,7 @@ enum Gerb_StandardShape
};
};


// 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,
@@ -62,8 +59,7 @@ enum Gerb_Interpolation




// 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,
@@ -87,8 +83,7 @@ enum Gerb_GCommand
#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
@@ -185,15 +180,21 @@ public:


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
+49 −39
Original line number Original line Diff line number Diff line
@@ -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 @@
#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);
				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);
				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);
}
}




	/*************************************************/
/******************************************************/
	/* classe derivee pour la frame de Configuration */
	/*************************************************/

class WinEDA_GerberGeneralOptionsFrame: public wxDialog
class WinEDA_GerberGeneralOptionsFrame: public wxDialog
/******************************************************/
{
{
private:
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()






	/*************************************************/
/**********************************************************************************************/
	/* 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
	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] =
	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] = {
	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)






/******************************************************************/
/*******************************************/
/* 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") };
		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)
	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();
Loading