Commit a0c5e040 authored by charras's avatar charras

Minor changes

parent 3db5876c
...@@ -15,6 +15,19 @@ email address. ...@@ -15,6 +15,19 @@ email address.
for it. for it.
2009-oct-30 UPDATE Wayne Stambaugh <stambaughw@verizon.net>
================================================================================
Replace library editor pin properties dialog box and minor update.
* Replaced library pin properties dialog with wxFormBuilder version.
* Remove DialogBlocks version of pin properties dialog.
* Add pin properties dialog support code to pin object.
* Create single event handler for displaying pin properties dialog.
* Remove left over DialogBlocks project file for annotate dialog.
* Fixed escape key bug in library editor new component dialog.
* Add GetUnitsLabel() to get human readable units for dialog labels.
* Translate French comments in all modified files.
* Some minor clean up of Doxygen comments.
2009-oct-30 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr> 2009-oct-30 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================ ================================================================================
++pcbnew ++pcbnew
......
...@@ -47,7 +47,7 @@ void DialogLabelEditor::init() ...@@ -47,7 +47,7 @@ void DialogLabelEditor::init()
{ {
wxString msg; wxString msg;
bool multine = false; bool multine = false;
if( m_CurrentText->m_MultilineAllowed ) if( m_CurrentText->m_MultilineAllowed )
{ {
m_TextLabel = m_textCtrlMultiline; m_TextLabel = m_textCtrlMultiline;
...@@ -166,6 +166,7 @@ void DialogLabelEditor::onEnterKey( wxCommandEvent& event ) ...@@ -166,6 +166,7 @@ void DialogLabelEditor::onEnterKey( wxCommandEvent& event )
void DialogLabelEditor::OnButtonOKClick( wxCommandEvent& event ) void DialogLabelEditor::OnButtonOKClick( wxCommandEvent& event )
{ {
TextPropertiesAccept( event ); TextPropertiesAccept( event );
EndModal( wxID_OK );
} }
...@@ -176,6 +177,6 @@ void DialogLabelEditor::OnButtonOKClick( wxCommandEvent& event ) ...@@ -176,6 +177,6 @@ void DialogLabelEditor::OnButtonOKClick( wxCommandEvent& event )
void DialogLabelEditor::OnButtonCANCEL_Click( wxCommandEvent& event ) void DialogLabelEditor::OnButtonCANCEL_Click( wxCommandEvent& event )
{ {
m_Parent->DrawPanel->MouseToCursorSchema(); m_Parent->DrawPanel->MouseToCursorSchema();
EndModal( -1 ); EndModal( wxID_CANCEL );
} }
...@@ -139,12 +139,15 @@ void WinEDA_SchematicFrame::EditSchematicText( SCH_TEXT* TextStruct, ...@@ -139,12 +139,15 @@ void WinEDA_SchematicFrame::EditSchematicText( SCH_TEXT* TextStruct,
if( TextStruct == NULL ) if( TextStruct == NULL )
return; return;
// Erase old text on screen
DrawPanel->CursorOff( DC ); DrawPanel->CursorOff( DC );
RedrawOneStruct( DrawPanel, DC, TextStruct, g_XorMode ); RedrawOneStruct( DrawPanel, DC, TextStruct, g_XorMode );
DialogLabelEditor::ShowModally( this, TextStruct ); DialogLabelEditor::ShowModally( this, TextStruct );
RedrawOneStruct( DrawPanel, DC, TextStruct, GR_DEFAULT_DRAWMODE ); // Redraw nex text, if exists
if( ! TextStruct->m_Text.IsEmpty() )
RedrawOneStruct( DrawPanel, DC, TextStruct, GR_DEFAULT_DRAWMODE );
DrawPanel->CursorOn( DC ); DrawPanel->CursorOn( DC );
} }
...@@ -163,11 +166,11 @@ void WinEDA_SchematicFrame::ChangeTextOrient( SCH_TEXT* TextStruct, wxDC* DC ) ...@@ -163,11 +166,11 @@ void WinEDA_SchematicFrame::ChangeTextOrient( SCH_TEXT* TextStruct, wxDC* DC )
if( TextStruct->m_Flags == 0 ) if( TextStruct->m_Flags == 0 )
SaveCopyInUndoList( TextStruct, UR_CHANGED ); SaveCopyInUndoList( TextStruct, UR_CHANGED );
/* Effacement du texte en cours */ /* Erase old text */
DrawPanel->CursorOff( DC ); DrawPanel->CursorOff( DC );
RedrawOneStruct( DrawPanel, DC, TextStruct, g_XorMode ); RedrawOneStruct( DrawPanel, DC, TextStruct, g_XorMode );
/* Rotation du texte */ /* Rot text */
int orient; int orient;
switch( TextStruct->Type() ) switch( TextStruct->Type() )
...@@ -187,7 +190,7 @@ void WinEDA_SchematicFrame::ChangeTextOrient( SCH_TEXT* TextStruct, wxDC* DC ) ...@@ -187,7 +190,7 @@ void WinEDA_SchematicFrame::ChangeTextOrient( SCH_TEXT* TextStruct, wxDC* DC )
GetScreen()->SetModify(); GetScreen()->SetModify();
/* Reaffichage */ /* redraw the new tewt */
RedrawOneStruct( DrawPanel, DC, TextStruct, g_XorMode ); RedrawOneStruct( DrawPanel, DC, TextStruct, g_XorMode );
DrawPanel->CursorOn( DC ); DrawPanel->CursorOn( DC );
} }
......
No preview for this file type
This source diff could not be displayed because it is too large. You can view the blob instead.
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Dec 29 2008) // C++ code generated with wxFormBuilder (version Apr 16 2008)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -152,7 +152,7 @@ DIALOG_DESIGN_RULES_BASE::DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID ...@@ -152,7 +152,7 @@ DIALOG_DESIGN_RULES_BASE::DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID
m_panelNetClassesEditor->SetSizer( bpanelNetClassesSizer ); m_panelNetClassesEditor->SetSizer( bpanelNetClassesSizer );
m_panelNetClassesEditor->Layout(); m_panelNetClassesEditor->Layout();
bpanelNetClassesSizer->Fit( m_panelNetClassesEditor ); bpanelNetClassesSizer->Fit( m_panelNetClassesEditor );
m_DRnotebook->AddPage( m_panelNetClassesEditor, _("Net Classes Editor"), true ); m_DRnotebook->AddPage( m_panelNetClassesEditor, _("Net Classes Editor"), false );
m_panelGolbalDesignRules = new wxPanel( m_DRnotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL ); m_panelGolbalDesignRules = new wxPanel( m_DRnotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL );
wxBoxSizer* bpanelGlobRulesSizer; wxBoxSizer* bpanelGlobRulesSizer;
bpanelGlobRulesSizer = new wxBoxSizer( wxVERTICAL ); bpanelGlobRulesSizer = new wxBoxSizer( wxVERTICAL );
...@@ -267,7 +267,7 @@ DIALOG_DESIGN_RULES_BASE::DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID ...@@ -267,7 +267,7 @@ DIALOG_DESIGN_RULES_BASE::DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID
wxStaticBoxSizer* sViaSizeBox; wxStaticBoxSizer* sViaSizeBox;
sViaSizeBox = new wxStaticBoxSizer( new wxStaticBox( m_panelGolbalDesignRules, wxID_ANY, _("Custom Via Sizes:") ), wxVERTICAL ); sViaSizeBox = new wxStaticBoxSizer( new wxStaticBox( m_panelGolbalDesignRules, wxID_ANY, _("Custom Via Sizes:") ), wxVERTICAL );
m_staticText7 = new wxStaticText( m_panelGolbalDesignRules, wxID_ANY, _("A blank or 0 => default Netclass value"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText7 = new wxStaticText( m_panelGolbalDesignRules, wxID_ANY, _("Drill value: a blank or 0 => default Netclass value"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText7->Wrap( -1 ); m_staticText7->Wrap( -1 );
sViaSizeBox->Add( m_staticText7, 0, wxALL, 5 ); sViaSizeBox->Add( m_staticText7, 0, wxALL, 5 );
...@@ -356,7 +356,7 @@ DIALOG_DESIGN_RULES_BASE::DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID ...@@ -356,7 +356,7 @@ DIALOG_DESIGN_RULES_BASE::DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID
m_panelGolbalDesignRules->SetSizer( bpanelGlobRulesSizer ); m_panelGolbalDesignRules->SetSizer( bpanelGlobRulesSizer );
m_panelGolbalDesignRules->Layout(); m_panelGolbalDesignRules->Layout();
bpanelGlobRulesSizer->Fit( m_panelGolbalDesignRules ); bpanelGlobRulesSizer->Fit( m_panelGolbalDesignRules );
m_DRnotebook->AddPage( m_panelGolbalDesignRules, _("Global Design Rules"), false ); m_DRnotebook->AddPage( m_panelGolbalDesignRules, _("Global Design Rules"), true );
bMainSizer->Add( m_DRnotebook, 1, wxEXPAND | wxALL, 5 ); bMainSizer->Add( m_DRnotebook, 1, wxEXPAND | wxALL, 5 );
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
<property name="minimum_size">-1,-1</property> <property name="minimum_size">-1,-1</property>
<property name="name">DIALOG_DESIGN_RULES_BASE</property> <property name="name">DIALOG_DESIGN_RULES_BASE</property>
<property name="pos"></property> <property name="pos"></property>
<property name="size">900,600</property> <property name="size">900,640</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property> <property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass"></property> <property name="subclass"></property>
<property name="title">Design Rules Editor</property> <property name="title">Design Rules Editor</property>
...@@ -128,7 +128,7 @@ ...@@ -128,7 +128,7 @@
<object class="notebookpage" expanded="1"> <object class="notebookpage" expanded="1">
<property name="bitmap"></property> <property name="bitmap"></property>
<property name="label">Net Classes Editor</property> <property name="label">Net Classes Editor</property>
<property name="select">1</property> <property name="select">0</property>
<object class="wxPanel" expanded="1"> <object class="wxPanel" expanded="1">
<property name="bg"></property> <property name="bg"></property>
<property name="context_help"></property> <property name="context_help"></property>
...@@ -969,7 +969,7 @@ ...@@ -969,7 +969,7 @@
<object class="notebookpage" expanded="1"> <object class="notebookpage" expanded="1">
<property name="bitmap"></property> <property name="bitmap"></property>
<property name="label">Global Design Rules</property> <property name="label">Global Design Rules</property>
<property name="select">0</property> <property name="select">1</property>
<object class="wxPanel" expanded="1"> <object class="wxPanel" expanded="1">
<property name="bg"></property> <property name="bg"></property>
<property name="context_help"></property> <property name="context_help"></property>
...@@ -1895,7 +1895,7 @@ ...@@ -1895,7 +1895,7 @@
<property name="font"></property> <property name="font"></property>
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">A blank or 0 =&gt; default Netclass value</property> <property name="label">Drill value: a blank or 0 =&gt; default Netclass value</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">m_staticText7</property> <property name="name">m_staticText7</property>
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Dec 29 2008) // C++ code generated with wxFormBuilder (version Apr 16 2008)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -108,7 +108,7 @@ class DIALOG_DESIGN_RULES_BASE : public wxDialog ...@@ -108,7 +108,7 @@ class DIALOG_DESIGN_RULES_BASE : public wxDialog
public: public:
DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Design Rules Editor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 900,600 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Design Rules Editor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 900,640 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_DESIGN_RULES_BASE(); ~DIALOG_DESIGN_RULES_BASE();
}; };
......
...@@ -56,10 +56,10 @@ void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::MyInit() ...@@ -56,10 +56,10 @@ void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::MyInit()
} }
// Enable/disable the option "copy current to net" if we ause only default netclass values // Enable/disable the option "copy current to net" if we ause only default netclass values
if( ! board->m_TrackWidthSelector && !board->m_ViaSizeSelector ) if( !board->m_TrackWidthSelector && !board->m_ViaSizeSelector )
{ {
m_Net2CurrValueButton->Enable(false); m_Net2CurrValueButton->Enable( false );
m_Net2CurrValueText->Enable(false); m_Net2CurrValueText->Enable( false );
} }
// Display current values, and current netclass values: // Display current values, and current netclass values:
...@@ -74,6 +74,7 @@ void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::MyInit() ...@@ -74,6 +74,7 @@ void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::MyInit()
else else
msg = _( "Default" ); msg = _( "Default" );
m_gridDisplayCurrentSettings->SetCellValue( 1, 0, msg ); m_gridDisplayCurrentSettings->SetCellValue( 1, 0, msg );
// recompute the column widths here, after setting texts // recompute the column widths here, after setting texts
value = netclass->GetViaDiameter(); value = netclass->GetViaDiameter();
...@@ -127,7 +128,7 @@ void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::MyInit() ...@@ -127,7 +128,7 @@ void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::MyInit()
m_gridDisplayCurrentSettings->SetReadOnly( ii, jj, true ); m_gridDisplayCurrentSettings->SetReadOnly( ii, jj, true );
} }
m_gridDisplayCurrentSettings->Fit( ); m_gridDisplayCurrentSettings->Fit();
} }
...@@ -136,23 +137,56 @@ void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::OnOkClick( wxCommandEvent& event ) ...@@ -136,23 +137,56 @@ void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::OnOkClick( wxCommandEvent& event )
/*******************************************************************/ /*******************************************************************/
{ {
bool change = false; bool change = false;
switch( event.GetId() ) switch( event.GetId() )
{ {
case ID_CURRENT_VALUES_TO_CURRENT_NET: case ID_CURRENT_VALUES_TO_CURRENT_NET:
if( !IsOK( this,
_( "Set current Net tracks and vias sizes and drill to the current values?" ) ) )
return;
{
wxBusyCursor dummy;
change = m_Parent->Change_Net_Tracks_And_Vias_Sizes( m_Netcode, false ); change = m_Parent->Change_Net_Tracks_And_Vias_Sizes( m_Netcode, false );
break; }
case ID_NETCLASS_VALUES_TO_CURRENT_NET: break;
case ID_NETCLASS_VALUES_TO_CURRENT_NET:
if( !IsOK( this,
_(
"Set current Net tracks and vias sizes and drill to the Netclass default value?" ) ) )
return;
{
wxBusyCursor dummy;
change = m_Parent->Change_Net_Tracks_And_Vias_Sizes( m_Netcode, true ); change = m_Parent->Change_Net_Tracks_And_Vias_Sizes( m_Netcode, true );
break; }
case ID_ALL_TRACKS_VIAS: break;
case ID_ALL_TRACKS_VIAS:
if( !IsOK( this, _( "Set All Tracks and Vias to Netclass value" ) ) )
return;
{
wxBusyCursor dummy;
change = m_Parent->Reset_All_Tracks_And_Vias_To_Netclass_Values( true, true ); change = m_Parent->Reset_All_Tracks_And_Vias_To_Netclass_Values( true, true );
break; }
case ID_ALL_VIAS: break;
case ID_ALL_VIAS:
if( !IsOK( this, _( "Set All Via to Netclass value" ) ) )
return;
{
wxBusyCursor dummy;
change = m_Parent->Reset_All_Tracks_And_Vias_To_Netclass_Values( false, true ); change = m_Parent->Reset_All_Tracks_And_Vias_To_Netclass_Values( false, true );
break; }
case ID_ALL_TRACKS: break;
case ID_ALL_TRACKS:
if( !IsOK( this, _( "Set All Track to Netclass value" ) ) )
return;
{
wxBusyCursor dummy;
change = m_Parent->Reset_All_Tracks_And_Vias_To_Netclass_Values( true, false ); change = m_Parent->Reset_All_Tracks_And_Vias_To_Netclass_Values( true, false );
break; }
break;
} }
EndModal( 1 ); EndModal( 1 );
......
...@@ -186,24 +186,6 @@ bool WinEDA_PcbFrame::Change_Net_Tracks_And_Vias_Sizes( ...@@ -186,24 +186,6 @@ bool WinEDA_PcbFrame::Change_Net_Tracks_And_Vias_Sizes(
if( aNetcode <= 0 ) if( aNetcode <= 0 )
return false; return false;
NETINFO_ITEM* net = GetBoard()->FindNet( aNetcode );
wxASSERT( net );
wxString netName = net->GetNetname();
wxString msg;
NETCLASS* netClass = net->GetNetClass();
wxASSERT( netClass );
wxString netClassName = netClass->GetName();
if( aUseNetclassValue )
msg.Printf( _(
"Set tracks and vias sizes and drill to the Netclass \"%s\"default value (entire NET \"%s\") ?" ),
GetChars( netClassName ), GetChars( netName ) );
else
msg.Printf( _(
"Set tracks and vias sizes and drill to the current values (entire NET \"%s\") ?" ),
GetChars( netClassName ), GetChars( netName ) );
if( !IsOK( this, msg ) )
return false;
/* Examine segments */ /* Examine segments */
PICKED_ITEMS_LIST itemsListPicker; PICKED_ITEMS_LIST itemsListPicker;
bool change = false; bool change = false;
...@@ -232,22 +214,6 @@ bool WinEDA_PcbFrame::Reset_All_Tracks_And_Vias_To_Netclass_Values( ...@@ -232,22 +214,6 @@ bool WinEDA_PcbFrame::Reset_All_Tracks_And_Vias_To_Netclass_Values(
{ {
TRACK* pt_segm; TRACK* pt_segm;
if( aTrack && aVia )
{
if( !IsOK( this, _( "Set All Tracks and Vias to Netclass value" ) ) )
return false;
}
else if( aVia )
{
if( !IsOK( this, _( "Set All Via to Netclass value" ) ) )
return false;
}
else if( aTrack )
{
if( !IsOK( this, _( "Set All Track to Netclass value" ) ) )
return false;
}
/* read and edit tracks and vias if required */ /* read and edit tracks and vias if required */
PICKED_ITEMS_LIST itemsListPicker; PICKED_ITEMS_LIST itemsListPicker;
bool change = false; bool change = false;
......
...@@ -22,24 +22,32 @@ static void CreateRoutesSection( FILE* file, BOARD* pcb ); ...@@ -22,24 +22,32 @@ static void CreateRoutesSection( FILE* file, BOARD* pcb );
static void CreateSignalsSection( FILE* file, BOARD* pcb ); static void CreateSignalsSection( FILE* file, BOARD* pcb );
static void CreateShapesSection( FILE* file, BOARD* pcb ); static void CreateShapesSection( FILE* file, BOARD* pcb );
static void CreatePadsShapesSection( FILE* file, BOARD* pcb ); static void CreatePadsShapesSection( FILE* file, BOARD* pcb );
static void ModuleWriteShape( FILE* File, MODULE* module ); static void FootprintWriteShape( FILE* File, MODULE* module );
// layer name pour extensions fichiers de tracewxString // layer name for Gencad export
static const wxString GenCAD_Layer_Name[32] = { static const wxString GenCAD_Layer_Name[32] =
wxT( "BOTTOM" ), wxT( "INNER1" ), wxT( "INNER2" ), wxT("INNER3" ), {
wxT( "INNER4" ), wxT( "INNER5" ), wxT( "INNER6" ), wxT("INNER7" ), wxT( "BOTTOM" ), wxT( "INNER1" ), wxT( "INNER2" ),
wxT( "INNER8" ), wxT( "INNER9" ), wxT( "INNER10" ), wxT("INNER11" ), wxT(
wxT( "INNER12" ), wxT( "INNER13" ), wxT( "INNER14" ), wxT( "TOP" ), "INNER3" ),
wxT( "adhecu" ), wxT( "adhecmp" ), wxT( "SOLDERPASTE_BOTTOM" ), wxT("SOLDERPASTE_TOP" ), wxT( "INNER4" ), wxT( "INNER5" ), wxT( "INNER6" ), wxT(
wxT( "SILKSCREEN_BOTTOM" ), wxT( "SILKSCREEN_TOP" ), wxT( "SOLDERMASK_BOTTOM" ), wxT("SOLDERMASK_TOP" ), "INNER7" ),
wxT( "drawings" ), wxT( "comments" ), wxT( "eco1" ), wxT( "eco2" ), wxT( "INNER8" ), wxT( "INNER9" ), wxT( "INNER10" ), wxT(
wxT( "edges" ), wxT( "--" ), wxT( "--" ), wxT( "--" ) "INNER11" ),
wxT( "INNER12" ), wxT( "INNER13" ), wxT( "INNER14" ), wxT( "TOP" ),
wxT( "adhecu" ), wxT( "adhecmp" ), wxT( "SOLDERPASTE_BOTTOM" ),wxT(
"SOLDERPASTE_TOP" ),
wxT( "SILKSCREEN_BOTTOM" ), wxT( "SILKSCREEN_TOP" ), wxT( "SOLDERMASK_BOTTOM" ), wxT(
"SOLDERMASK_TOP" ),
wxT( "drawings" ), wxT( "comments" ), wxT( "eco1" ), wxT( "eco2" ),
wxT( "edges" ), wxT( "--" ), wxT( "--" ), wxT( "--" )
}; };
int offsetX, offsetY; int offsetX, offsetY;
D_PAD* PadList; D_PAD* PadList;
/* routines de conversion des coord ( sous GenCAD axe Y vers le haut) */ /* 2 helper functions to calculate coordinates of modules in gencad values ( GenCAD Y axis from bottom to top)
*/
static int mapXto( int x ) static int mapXto( int x )
{ {
return x - offsetX; return x - offsetX;
...@@ -57,12 +65,12 @@ void WinEDA_PcbFrame::ExportToGenCAD( wxCommandEvent& event ) ...@@ -57,12 +65,12 @@ void WinEDA_PcbFrame::ExportToGenCAD( wxCommandEvent& event )
/***********************************************************/ /***********************************************************/
/* /*
* Exporte le board au format GenCAD 1.4 * Creates an Export file (format GenCAD 1.4) from the current borad.
*/ */
{ {
wxFileName fn = GetScreen()->m_FileName; wxFileName fn = GetScreen()->m_FileName;
wxString msg, ext, wildcard; wxString msg, ext, wildcard;
FILE* file; FILE* file;
ext = wxT( "gcd" ); ext = wxT( "gcd" );
wildcard = _( "GenCAD board files (.gcd)|*.gcd" ); wildcard = _( "GenCAD board files (.gcd)|*.gcd" );
...@@ -81,7 +89,7 @@ void WinEDA_PcbFrame::ExportToGenCAD( wxCommandEvent& event ) ...@@ -81,7 +89,7 @@ void WinEDA_PcbFrame::ExportToGenCAD( wxCommandEvent& event )
DisplayError( this, msg ); return; DisplayError( this, msg ); return;
} }
/* Mise a jour des infos PCB: */ /* Update some board data, to ensure a reliable gencad export: */
GetBoard()->ComputeBoundaryBox(); GetBoard()->ComputeBoundaryBox();
offsetX = m_Auxiliary_Axis_Position.x; offsetX = m_Auxiliary_Axis_Position.x;
...@@ -91,9 +99,12 @@ void WinEDA_PcbFrame::ExportToGenCAD( wxCommandEvent& event ) ...@@ -91,9 +99,12 @@ void WinEDA_PcbFrame::ExportToGenCAD( wxCommandEvent& event )
DrawPanel->PrepareGraphicContext( &dc ); DrawPanel->PrepareGraphicContext( &dc );
Compile_Ratsnest( &dc, TRUE ); Compile_Ratsnest( &dc, TRUE );
/* Mise des modules vus en miroir en position "normale" /* Temporary modification of footprints that are flipped (i.e. on bottom layer)
* (necessaire pour decrire les formes sous GenCAD, * to convert them to non flipped footprints.
* qui sont decrites en vue normale, orientation 0)) */ * This is necessary to easily export shapes to GenCAD,
* that are given as normal orientation (non flipped, rotation = 0))
* these changes will be undone later
*/
MODULE* module; MODULE* module;
for( module = GetBoard()->m_Modules; module != NULL; module = module->Next() ) for( module = GetBoard()->m_Modules; module != NULL; module = module->Next() )
{ {
...@@ -105,20 +116,20 @@ void WinEDA_PcbFrame::ExportToGenCAD( wxCommandEvent& event ) ...@@ -105,20 +116,20 @@ void WinEDA_PcbFrame::ExportToGenCAD( wxCommandEvent& event )
} }
} }
// Creation de l'entete: // Create file header:
CreateHeaderInfoData( file, this ); CreateHeaderInfoData( file, this );
CreateBoardSection( file, GetBoard() ); CreateBoardSection( file, GetBoard() );
/* Creation liste des TRACKS /* Create TRACKS list
* (section $TRACK) id liste des outils de tracage de pistes */ * This is the section $TRACK) (track width sizes) */
CreateTracksInfoData( file, GetBoard() ); CreateTracksInfoData( file, GetBoard() );
/* Creation de la liste des formes utilisees /* Create the shapes list
* (formes des composants principalement */ * (shapes of pads and footprints */
CreatePadsShapesSection( file, GetBoard() ); // doit etre appele avant CreateShapesSection() CreatePadsShapesSection( file, GetBoard() ); // doit etre appele avant CreateShapesSection()
CreateShapesSection( file, GetBoard() ); CreateShapesSection( file, GetBoard() );
/* Creation de la liste des equipotentielles: */ /* Create the list of Nets: */
CreateSignalsSection( file, GetBoard() ); CreateSignalsSection( file, GetBoard() );
CreateDevicesSection( file, GetBoard() ); CreateDevicesSection( file, GetBoard() );
...@@ -127,7 +138,7 @@ void WinEDA_PcbFrame::ExportToGenCAD( wxCommandEvent& event ) ...@@ -127,7 +138,7 @@ void WinEDA_PcbFrame::ExportToGenCAD( wxCommandEvent& event )
fclose( file ); fclose( file );
/* Remise en place des modules vus en miroir */ /* Undo the footprints modifications (flipped footprints) */
for( module = GetBoard()->m_Modules; module != NULL; module = module->Next() ) for( module = GetBoard()->m_Modules; module != NULL; module = module->Next() )
{ {
if( module->flag ) if( module->flag )
...@@ -143,8 +154,8 @@ void WinEDA_PcbFrame::ExportToGenCAD( wxCommandEvent& event ) ...@@ -143,8 +154,8 @@ void WinEDA_PcbFrame::ExportToGenCAD( wxCommandEvent& event )
static int Pad_list_Sort_by_Shapes( const void* refptr, const void* objptr ) static int Pad_list_Sort_by_Shapes( const void* refptr, const void* objptr )
/**************************************************************************/ /**************************************************************************/
{ {
const D_PAD* padref = *(D_PAD**)refptr; const D_PAD* padref = *(D_PAD**) refptr;
const D_PAD* padcmp = *(D_PAD**)objptr; const D_PAD* padcmp = *(D_PAD**) objptr;
return D_PAD::Compare( padref, padcmp ); return D_PAD::Compare( padref, padcmp );
} }
...@@ -154,33 +165,34 @@ static int Pad_list_Sort_by_Shapes( const void* refptr, const void* objptr ) ...@@ -154,33 +165,34 @@ static int Pad_list_Sort_by_Shapes( const void* refptr, const void* objptr )
void CreatePadsShapesSection( FILE* file, BOARD* pcb ) void CreatePadsShapesSection( FILE* file, BOARD* pcb )
/*****************************************************/ /*****************************************************/
/* Cree la liste des formes des pads ( 1 forme par pad ) /* Creates the pads shapes list ( 1 shape per pad )
* initialise le membre .GetSubRatsnest de la struct pad, la valeur 1 ..n * Uses .GetSubRatsnest member of class D_PAD, to handle the shape id (value 1 ..n)
* pour les formes de pad PAD1 a PADn * for pads shapes PAD1 to PADn
*/ */
{ {
std::vector<D_PAD*> pads; std::vector<D_PAD*> pads;
const char* pad_type; const char* pad_type;
fputs( "$PADS\n", file ); fputs( "$PADS\n", file );
if( pcb->GetPadsCount() > 0 ) if( pcb->GetPadsCount() > 0 )
{ {
pads.insert( pads.end(), pcb->m_NetInfo->m_PadsFullList.begin(), pcb->m_NetInfo->m_PadsFullList.end() ); pads.insert( pads.end(),
pcb->m_NetInfo->m_PadsFullList.begin(), pcb->m_NetInfo->m_PadsFullList.end() );
qsort( &pads[0], pcb->GetPadsCount(), sizeof( D_PAD* ), Pad_list_Sort_by_Shapes ); qsort( &pads[0], pcb->GetPadsCount(), sizeof( D_PAD* ), Pad_list_Sort_by_Shapes );
} }
D_PAD* old_pad = NULL; D_PAD* old_pad = NULL;
int pad_name_number = 0; int pad_name_number = 0;
for( unsigned i=0; i<pads.size(); ++i ) for( unsigned i = 0; i<pads.size(); ++i )
{ {
D_PAD* pad = pads[i]; D_PAD* pad = pads[i];
pad->SetSubRatsnest( pad_name_number ); pad->SetSubRatsnest( pad_name_number );
if( old_pad && 0==D_PAD::Compare( old_pad, pad ) ) if( old_pad && 0==D_PAD::Compare( old_pad, pad ) )
continue; // Forme deja generee continue; // already created
old_pad = pad; old_pad = pad;
...@@ -199,23 +211,23 @@ void CreatePadsShapesSection( FILE* file, BOARD* pcb ) ...@@ -199,23 +211,23 @@ void CreatePadsShapesSection( FILE* file, BOARD* pcb )
pad_type = "ROUND"; pad_type = "ROUND";
fprintf( file, " %s %d\n", pad_type, pad->m_Drill.x ); fprintf( file, " %s %d\n", pad_type, pad->m_Drill.x );
fprintf( file, "CIRCLE %d %d %d\n", fprintf( file, "CIRCLE %d %d %d\n",
pad->m_Offset.x, -pad->m_Offset.y, pad->m_Size.x / 2 ); pad->m_Offset.x, -pad->m_Offset.y, dx );
break; break;
case PAD_RECT: case PAD_RECT:
pad_type = "RECTANGULAR"; pad_type = "RECTANGULAR";
fprintf( file, " %s %d\n", pad_type, pad->m_Drill.x ); fprintf( file, " %s %d\n", pad_type, pad->m_Drill.x );
fprintf( file, "RECTANGLE %d %d %d %d\n", fprintf( file, "RECTANGLE %d %d %d %d\n",
-dx + pad->m_Offset.x, -dy - pad->m_Offset.y, pad->m_Offset.x - dx, -(pad->m_Offset.y - dy),
dx + pad->m_Offset.x, -pad->m_Offset.y + dy ); pad->m_Offset.x + dx, -(pad->m_Offset.y + dy) );
break; break;
case PAD_OVAL: /* description du contour par 2 linges et 2 arcs */ case PAD_OVAL: /* Create outline by 2 lines and 2 arcs */
{ {
pad_type = "FINGER"; pad_type = "FINGER";
fprintf( file, " %s %d\n", pad_type, pad->m_Drill.x ); fprintf( file, " %s %d\n", pad_type, pad->m_Drill.x );
int dr = dx - dy; int dr = dx - dy;
if( dr >= 0 ) // ovale horizontal if( dr >= 0 ) // Horizontal oval
{ {
int rayon = dy; int rayon = dy;
fprintf( file, "LINE %d %d %d %d\n", fprintf( file, "LINE %d %d %d %d\n",
...@@ -234,7 +246,7 @@ void CreatePadsShapesSection( FILE* file, BOARD* pcb ) ...@@ -234,7 +246,7 @@ void CreatePadsShapesSection( FILE* file, BOARD* pcb )
-dr + pad->m_Offset.x, -pad->m_Offset.y - rayon, -dr + pad->m_Offset.x, -pad->m_Offset.y - rayon,
-dr + pad->m_Offset.x, -pad->m_Offset.y ); -dr + pad->m_Offset.x, -pad->m_Offset.y );
} }
else // ovale vertical else // Vertical oval
{ {
dr = -dr; dr = -dr;
int rayon = dx; int rayon = dx;
...@@ -271,11 +283,12 @@ void CreatePadsShapesSection( FILE* file, BOARD* pcb ) ...@@ -271,11 +283,12 @@ void CreatePadsShapesSection( FILE* file, BOARD* pcb )
void CreateShapesSection( FILE* file, BOARD* pcb ) void CreateShapesSection( FILE* file, BOARD* pcb )
/**************************************************/ /**************************************************/
/* Creation de la liste des formes des composants. /* Creates the footprint shape list.
* Comme la forme de base (module de librairie peut etre modifiee, * We must use one shape for identical footprint (i.e. come from the same footprint in lib)
* une forme est creee par composant * But because pads shapes and positions can be easily modified on board,
* La forme est donnee normalisee, c'est a dire orientation 0, position 0 non miroir * a shape is created by footprint found.
* Il y aura donc des formes indentiques redondantes * (todo : compare footprints shapes and creates only one shape for all footprints found having the same shape)
* The shape is always given in orientation 0, position 0 not flipped
* *
* Syntaxe: * Syntaxe:
* $SHAPES * $SHAPES
...@@ -288,18 +301,18 @@ void CreateShapesSection( FILE* file, BOARD* pcb ) ...@@ -288,18 +301,18 @@ void CreateShapesSection( FILE* file, BOARD* pcb )
* $ENDSHAPES * $ENDSHAPES
*/ */
{ {
MODULE* module; MODULE* module;
D_PAD* pad; D_PAD* pad;
const char* layer; const char* layer;
int orient; int orient;
wxString pinname; wxString pinname;
const char* mirror = "0"; const char* mirror = "0";
fputs( "$SHAPES\n", file ); fputs( "$SHAPES\n", file );
for( module = pcb->m_Modules; module != NULL; module = module->Next() ) for( module = pcb->m_Modules; module != NULL; module = module->Next() )
{ {
ModuleWriteShape( file, module ); FootprintWriteShape( file, module );
for( pad = module->m_Pads; pad != NULL; pad = pad->Next() ) for( pad = module->m_Pads; pad != NULL; pad = pad->Next() )
{ {
layer = "ALL"; layer = "ALL";
...@@ -342,11 +355,11 @@ void CreateShapesSection( FILE* file, BOARD* pcb ) ...@@ -342,11 +355,11 @@ void CreateShapesSection( FILE* file, BOARD* pcb )
void CreateComponentsSection( FILE* file, BOARD* pcb ) void CreateComponentsSection( FILE* file, BOARD* pcb )
/******************************************************/ /******************************************************/
/* Creation de la section $COMPONENTS (Placement des composants /* Creates the section $COMPONENTS (Footprints placement)
* Composants cote CUIVRE: * When a footprint is on bottom side of the board::
* Les formes sont donnees avec l'option "FLIP", c.a.d.: * shapes are given with option "FLIP" and "MIRRORX".
* - ils sont decrits en vue normale (comme s'ils etaient sur cote COMPOSANT) * - But shapes remain given like component not mirrored and not flipped
* - leur orientation est donn�e comme s'ils etaient cote composant. * - orientaion is given like if where not mirrored and not flipped.
*/ */
{ {
MODULE* module = pcb->m_Modules; MODULE* module = pcb->m_Modules;
...@@ -362,8 +375,8 @@ void CreateComponentsSection( FILE* file, BOARD* pcb ) ...@@ -362,8 +375,8 @@ void CreateComponentsSection( FILE* file, BOARD* pcb )
int orient = module->m_Orient; int orient = module->m_Orient;
if( module->flag ) if( module->flag )
{ {
mirror = "MIRRORX"; // Miroir selon axe X mirror = "MIRRORX"; // Mirrored relative to X axis
flip = "FLIP"; // Description normale ( formes a afficher en miroir X) flip = "FLIP"; // Normal shape description ( gencad viewer must show it flipped and mirrored)
NEGATE_AND_NORMALIZE_ANGLE_POS( orient ); NEGATE_AND_NORMALIZE_ANGLE_POS( orient );
} }
else else
...@@ -385,7 +398,7 @@ void CreateComponentsSection( FILE* file, BOARD* pcb ) ...@@ -385,7 +398,7 @@ void CreateComponentsSection( FILE* file, BOARD* pcb )
fprintf( file, "SHAPE %s %s %s\n", fprintf( file, "SHAPE %s %s %s\n",
CONV_TO_UTF8( module->m_Reference->m_Text ), mirror, flip ); CONV_TO_UTF8( module->m_Reference->m_Text ), mirror, flip );
/* Generation des elements textes (ref et valeur seulement) */ /* creates texts (ref and value) */
PtTexte = module->m_Reference; PtTexte = module->m_Reference;
for( ii = 0; ii < 2; ii++ ) for( ii = 0; ii < 2; ii++ )
{ {
...@@ -407,7 +420,7 @@ void CreateComponentsSection( FILE* file, BOARD* pcb ) ...@@ -407,7 +420,7 @@ void CreateComponentsSection( FILE* file, BOARD* pcb )
PtTexte = module->m_Value; PtTexte = module->m_Value;
} }
// commentaire: //put a comment:
fprintf( file, "SHEET Part %s %s\n", CONV_TO_UTF8( module->m_Reference->m_Text ), fprintf( file, "SHEET Part %s %s\n", CONV_TO_UTF8( module->m_Reference->m_Text ),
CONV_TO_UTF8( module->m_Value->m_Text ) ); CONV_TO_UTF8( module->m_Value->m_Text ) );
} }
...@@ -420,7 +433,7 @@ void CreateComponentsSection( FILE* file, BOARD* pcb ) ...@@ -420,7 +433,7 @@ void CreateComponentsSection( FILE* file, BOARD* pcb )
void CreateSignalsSection( FILE* file, BOARD* pcb ) void CreateSignalsSection( FILE* file, BOARD* pcb )
/***************************************************/ /***************************************************/
/* Creation de la liste des equipotentielles: /* Creates the list of Nets:
* $SIGNALS * $SIGNALS
* SIGNAL <equipot name> * SIGNAL <equipot name>
* NODE <component name> <pin name> * NODE <component name> <pin name>
...@@ -429,21 +442,21 @@ void CreateSignalsSection( FILE* file, BOARD* pcb ) ...@@ -429,21 +442,21 @@ void CreateSignalsSection( FILE* file, BOARD* pcb )
* $ENDSIGNALS * $ENDSIGNALS
*/ */
{ {
wxString msg; wxString msg;
NETINFO_ITEM* net; NETINFO_ITEM* net;
D_PAD* pad; D_PAD* pad;
MODULE* module; MODULE* module;
int NbNoConn = 1; int NbNoConn = 1;
fputs( "$SIGNALS\n", file ); fputs( "$SIGNALS\n", file );
for( unsigned ii = 0; ii < pcb->m_NetInfo->GetCount() ; ii++ ) for( unsigned ii = 0; ii < pcb->m_NetInfo->GetCount(); ii++ )
{ {
net = pcb->m_NetInfo->GetNetItem(ii); net = pcb->m_NetInfo->GetNetItem( ii );
if( net->GetNetname() == wxEmptyString ) // dummy equipot (non connexion) if( net->GetNetname() == wxEmptyString ) // dummy equipot (non connexion)
{ {
wxString msg; msg << wxT( "NoConnection" ) << NbNoConn++; wxString msg; msg << wxT( "NoConnection" ) << NbNoConn++;
net->SetNetname(msg); ; net->SetNetname( msg );;
} }
if( net->GetNet() <= 0 ) // dummy equipot (non connexion) if( net->GetNet() <= 0 ) // dummy equipot (non connexion)
...@@ -465,7 +478,7 @@ void CreateSignalsSection( FILE* file, BOARD* pcb ) ...@@ -465,7 +478,7 @@ void CreateSignalsSection( FILE* file, BOARD* pcb )
pad->ReturnStringPadName( padname ); pad->ReturnStringPadName( padname );
msg.Printf( wxT( "NODE %s %.4s" ), msg.Printf( wxT( "NODE %s %.4s" ),
GetChars( module->m_Reference->m_Text ), GetChars( module->m_Reference->m_Text ),
GetChars( padname ) ); GetChars( padname ) );
fputs( CONV_TO_UTF8( msg ), file ); fputs( CONV_TO_UTF8( msg ), file );
fputs( "\n", file ); fputs( "\n", file );
...@@ -481,16 +494,16 @@ void CreateSignalsSection( FILE* file, BOARD* pcb ) ...@@ -481,16 +494,16 @@ void CreateSignalsSection( FILE* file, BOARD* pcb )
bool CreateHeaderInfoData( FILE* file, WinEDA_PcbFrame* frame ) bool CreateHeaderInfoData( FILE* file, WinEDA_PcbFrame* frame )
/*************************************************************/ /*************************************************************/
/* Creation de la section $HEADER ... $ENDHEADER /* Creates the section $HEADER ... $ENDHEADER
*/ */
{ {
wxString msg; wxString msg;
PCB_SCREEN* screen = (PCB_SCREEN*)(frame->GetScreen()); PCB_SCREEN* screen = (PCB_SCREEN*)( frame->GetScreen() );
fputs( "$HEADER\n", file ); fputs( "$HEADER\n", file );
fputs( "GENCAD 1.4\n", file ); fputs( "GENCAD 1.4\n", file );
msg = wxT( "USER " ) + wxGetApp().GetAppName() + wxT( " " ) + msg = wxT( "USER " ) + wxGetApp().GetAppName() + wxT( " " ) +
GetBuildVersion(); GetBuildVersion();
fputs( CONV_TO_UTF8( msg ), file ); fputs( "\n", file ); fputs( CONV_TO_UTF8( msg ), file ); fputs( "\n", file );
msg = wxT( "DRAWING " ) + screen->m_FileName; msg = wxT( "DRAWING " ) + screen->m_FileName;
fputs( CONV_TO_UTF8( msg ), file ); fputs( "\n", file ); fputs( CONV_TO_UTF8( msg ), file ); fputs( "\n", file );
...@@ -513,8 +526,8 @@ static int Track_list_Sort_by_Netcode( const void* refptr, const void* objptr ) ...@@ -513,8 +526,8 @@ static int Track_list_Sort_by_Netcode( const void* refptr, const void* objptr )
/**************************************************************************/ /**************************************************************************/
/* /*
* Routine de tri de la liste des piste par netcode, * Sort function used to sort tracks segments:
* puis par largeur puis par layer * items are sorted by netcode, then by width then by layer
*/ */
{ {
const TRACK* ref, * cmp; const TRACK* ref, * cmp;
...@@ -522,11 +535,11 @@ static int Track_list_Sort_by_Netcode( const void* refptr, const void* objptr ) ...@@ -522,11 +535,11 @@ static int Track_list_Sort_by_Netcode( const void* refptr, const void* objptr )
ref = *( (TRACK**) refptr ); ref = *( (TRACK**) refptr );
cmp = *( (TRACK**) objptr ); cmp = *( (TRACK**) objptr );
if( (diff = ref->GetNet() - cmp->GetNet()) ) if( ( diff = ref->GetNet() - cmp->GetNet() ) )
return diff; return diff;
if( (diff = ref->m_Width - cmp->m_Width) ) if( (diff = ref->m_Width - cmp->m_Width) )
return diff; return diff;
if( (diff = ref->GetLayer() - cmp->GetLayer()) ) if( ( diff = ref->GetLayer() - cmp->GetLayer() ) )
return diff; return diff;
return 0; return 0;
...@@ -537,12 +550,13 @@ static int Track_list_Sort_by_Netcode( const void* refptr, const void* objptr ) ...@@ -537,12 +550,13 @@ static int Track_list_Sort_by_Netcode( const void* refptr, const void* objptr )
void CreateRoutesSection( FILE* file, BOARD* pcb ) void CreateRoutesSection( FILE* file, BOARD* pcb )
/*************************************************/ /*************************************************/
/* Creation de la liste des pistes, vias et zones /* Creates the tracks, vias
* TODO: add zones
* section: * section:
* $ROUTE * $ROUTE
* ... * ...
* $ENROUTE * $ENROUTE
* Les segments de piste doivent etre regroupes par nets * Track segments must be sorted by nets
*/ */
{ {
TRACK* track, ** tracklist; TRACK* track, ** tracklist;
...@@ -550,7 +564,7 @@ void CreateRoutesSection( FILE* file, BOARD* pcb ) ...@@ -550,7 +564,7 @@ void CreateRoutesSection( FILE* file, BOARD* pcb )
int old_netcode, old_width, old_layer; int old_netcode, old_width, old_layer;
int nbitems, ii; int nbitems, ii;
// Calcul du nombre de segments a ecrire // Count items
nbitems = 0; nbitems = 0;
for( track = pcb->m_Track; track != NULL; track = track->Next() ) for( track = pcb->m_Track; track != NULL; track = track->Next() )
nbitems++; nbitems++;
...@@ -561,7 +575,7 @@ void CreateRoutesSection( FILE* file, BOARD* pcb ) ...@@ -561,7 +575,7 @@ void CreateRoutesSection( FILE* file, BOARD* pcb )
nbitems++; nbitems++;
} }
tracklist = (TRACK**) MyMalloc( (nbitems + 1) * sizeof(TRACK *) ); tracklist = (TRACK**) MyMalloc( (nbitems + 1) * sizeof(TRACK*) );
nbitems = 0; nbitems = 0;
for( track = pcb->m_Track; track != NULL; track = track->Next() ) for( track = pcb->m_Track; track != NULL; track = track->Next() )
...@@ -575,7 +589,7 @@ void CreateRoutesSection( FILE* file, BOARD* pcb ) ...@@ -575,7 +589,7 @@ void CreateRoutesSection( FILE* file, BOARD* pcb )
tracklist[nbitems] = NULL; tracklist[nbitems] = NULL;
qsort( tracklist, nbitems, sizeof(TRACK *), Track_list_Sort_by_Netcode ); qsort( tracklist, nbitems, sizeof(TRACK*), Track_list_Sort_by_Netcode );
fputs( "$ROUTES\n", file ); fputs( "$ROUTES\n", file );
...@@ -587,7 +601,7 @@ void CreateRoutesSection( FILE* file, BOARD* pcb ) ...@@ -587,7 +601,7 @@ void CreateRoutesSection( FILE* file, BOARD* pcb )
{ {
old_netcode = track->GetNet(); old_netcode = track->GetNet();
NETINFO_ITEM* net = pcb->FindNet( track->GetNet() ); NETINFO_ITEM* net = pcb->FindNet( track->GetNet() );
wxString netname; wxString netname;
if( net && (net->GetNetname() != wxEmptyString) ) if( net && (net->GetNetname() != wxEmptyString) )
netname = net->GetNetname(); netname = net->GetNetname();
else else
...@@ -633,8 +647,9 @@ void CreateRoutesSection( FILE* file, BOARD* pcb ) ...@@ -633,8 +647,9 @@ void CreateRoutesSection( FILE* file, BOARD* pcb )
void CreateDevicesSection( FILE* file, BOARD* pcb ) void CreateDevicesSection( FILE* file, BOARD* pcb )
/***************************************************/ /***************************************************/
/* Creation de la section de description des proprietes des composants /* Creatthes the section $DEVICES
* ( la forme des composants est dans la section shape ) * This is a list of footprints properties
* ( Shapes are in section $SHAPE )
*/ */
{ {
MODULE* module; MODULE* module;
...@@ -667,8 +682,8 @@ void CreateDevicesSection( FILE* file, BOARD* pcb ) ...@@ -667,8 +682,8 @@ void CreateDevicesSection( FILE* file, BOARD* pcb )
void CreateBoardSection( FILE* file, BOARD* pcb ) void CreateBoardSection( FILE* file, BOARD* pcb )
/*************************************************/ /*************************************************/
/* Creation de la section $BOARD. /* Creatthe section $BOARD.
* On ne cree ici que le rectangle d'encadrement du Board * We output here only the board boudary box
*/ */
{ {
fputs( "$BOARD\n", file ); fputs( "$BOARD\n", file );
...@@ -693,54 +708,54 @@ void CreateBoardSection( FILE* file, BOARD* pcb ) ...@@ -693,54 +708,54 @@ void CreateBoardSection( FILE* file, BOARD* pcb )
void CreateTracksInfoData( FILE* file, BOARD* pcb ) void CreateTracksInfoData( FILE* file, BOARD* pcb )
/****************************************************/ /****************************************************/
/* Creation de la section "$TRACKS" /* Creates the section "$TRACKS"
* Cette section definit les largeurs de pistes utilsees * This sections give the list of widths (tools) used in tracks and vias
* format: * format:
* $TRACK * $TRACK
* TRACK <name> <width> * TRACK <name> <width>
* $ENDTRACK * $ENDTRACK
* *
* on attribue ici comme nom l'epaisseur des traits precede de "TRACK": ex * Each tool name is build like this: "TRACK" + track width.
* pour une largeur de 120 : nom = "TRACK120". * For instance for a width = 120 : name = "TRACK120".
*/ */
{ {
TRACK* track; TRACK* track;
int last_width = -1; int last_width = -1;
/* recherche des epaisseurs utilisees pour les traces: */ /* recherche des epaisseurs utilisees pour les traces: */
std::vector <int> trackinfo; std::vector <int> trackinfo;
unsigned ii; unsigned ii;
for( track = pcb->m_Track; track != NULL; track = track->Next() ) for( track = pcb->m_Track; track != NULL; track = track->Next() )
{ {
if( last_width != track->m_Width ) // recherche d'une epaisseur deja utilisee if( last_width != track->m_Width ) // recherche d'une epaisseur deja utilisee
{ {
for ( ii = 0; ii < trackinfo.size(); ii++ ) for( ii = 0; ii < trackinfo.size(); ii++ )
{ {
if( trackinfo[ii] == track->m_Width ) if( trackinfo[ii] == track->m_Width )
break; break;
} }
if ( ii == trackinfo.size() ) // not found if( ii == trackinfo.size() ) // not found
trackinfo.push_back(track->m_Width); trackinfo.push_back( track->m_Width );
last_width = track->m_Width; last_width = track->m_Width;
} }
} }
for( track = pcb->m_Zone; track != NULL; track = track->Next() ) for( track = pcb->m_Zone; track != NULL; track = track->Next() )
{ {
if( last_width != track->m_Width ) // recherche d'une epaisseur deja utilisee if( last_width != track->m_Width ) // recherche d'une epaisseur deja utilisee
{ {
for ( ii = 0; ii < trackinfo.size(); ii++ ) for( ii = 0; ii < trackinfo.size(); ii++ )
{ {
if( trackinfo[ii] == track->m_Width ) if( trackinfo[ii] == track->m_Width )
break; break;
} }
if ( ii == trackinfo.size() ) // not found if( ii == trackinfo.size() ) // not found
trackinfo.push_back(track->m_Width); trackinfo.push_back( track->m_Width );
last_width = track->m_Width; last_width = track->m_Width;
} }
...@@ -758,28 +773,28 @@ void CreateTracksInfoData( FILE* file, BOARD* pcb ) ...@@ -758,28 +773,28 @@ void CreateTracksInfoData( FILE* file, BOARD* pcb )
/***************************************************/ /***************************************************/
void ModuleWriteShape( FILE* file, MODULE* module ) void FootprintWriteShape( FILE* file, MODULE* module )
/***************************************************/ /***************************************************/
/* Sauvegarde de la forme d'un MODULE (section SHAPE) /* Creates the shape of a footprint (section SHAPE)
* La forme est donnee "normalisee" (Orient 0, vue normale ( non miroir) * The shape is always given "normal" (Orient 0, not mirrored)
* Syntaxe: * Syntax:
* SHAPE <shape_name> * SHAPE <shape_name>
* shape_descr (line, arc ..): * shape_descr (line, arc ..):
* LINE startX startY endX endY * LINE startX startY endX endY
* ARC startX startY endX endY centreX scentreY * ARC startX startY endX endY centreX centreY
* PAD_CIRCLE centreX scentreY radius * PAD_CIRCLE centreX scentreY radius
*/ */
{ {
EDGE_MODULE* PtEdge; EDGE_MODULE* PtEdge;
EDA_BaseStruct* PtStruct; EDA_BaseStruct* PtStruct;
int Yaxis_sign = -1; // Controle changement signe axe Y (selon module normal/miroir et conevtions d'axe) int Yaxis_sign = -1; // Controle changement signe axe Y (selon module normal/miroir et conventions d'axe)
/* Generation du fichier module: */ /* creates header: */
fprintf( file, "\nSHAPE %s\n", CONV_TO_UTF8( module->m_Reference->m_Text ) ); fprintf( file, "\nSHAPE %s\n", CONV_TO_UTF8( module->m_Reference->m_Text ) );
/* Attributs du module */ /* creates Attributs */
if( module->m_Attributs != MOD_DEFAULT ) if( module->m_Attributs != MOD_DEFAULT )
{ {
fprintf( file, "ATTRIBUTE" ); fprintf( file, "ATTRIBUTE" );
...@@ -791,7 +806,7 @@ void ModuleWriteShape( FILE* file, MODULE* module ) ...@@ -791,7 +806,7 @@ void ModuleWriteShape( FILE* file, MODULE* module )
} }
/* Generation des elements Drawing modules */ /* creates Drawing */
PtStruct = module->m_Drawings; PtStruct = module->m_Drawings;
for( ; PtStruct != NULL; PtStruct = PtStruct->Next() ) for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
{ {
...@@ -814,8 +829,8 @@ void ModuleWriteShape( FILE* file, MODULE* module ) ...@@ -814,8 +829,8 @@ void ModuleWriteShape( FILE* file, MODULE* module )
case S_CIRCLE: case S_CIRCLE:
{ {
int rayon = (int) hypot( int rayon = (int) hypot(
(double) (PtEdge->m_End0.x - PtEdge->m_Start0.x), (double) ( PtEdge->m_End0.x - PtEdge->m_Start0.x ),
(double) (PtEdge->m_End0.y - PtEdge->m_Start0.y) ); (double) ( PtEdge->m_End0.y - PtEdge->m_Start0.y ) );
fprintf( file, "CIRCLE %d %d %d\n", fprintf( file, "CIRCLE %d %d %d\n",
PtEdge->m_Start0.x, Yaxis_sign * PtEdge->m_Start0.y, PtEdge->m_Start0.x, Yaxis_sign * PtEdge->m_Start0.y,
rayon ); rayon );
...@@ -838,15 +853,13 @@ void ModuleWriteShape( FILE* file, MODULE* module ) ...@@ -838,15 +853,13 @@ void ModuleWriteShape( FILE* file, MODULE* module )
default: default:
DisplayError( NULL, wxT( "Type Edge Module inconnu" ) ); DisplayError( NULL, wxT( "Type Edge Module inconnu" ) );
break; break;
} } /* end switch PtEdge->m_Shape */
/* Fin switch type edge */
break; break;
default: default:
break; break;
} } /* End switch Items type */
/* Fin switch gestion des Items draw */
} }
} }
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