CvPcb: serious code cleaning. More comments. Remove useless files and some files renamed with a better name.
This commit is contained in:
parent
2082fbba4f
commit
d7da6083e4
|
@ -36,13 +36,12 @@ set(CVPCB_SRCS
|
|||
class_footprints_listbox.cpp
|
||||
cvframe.cpp
|
||||
cvpcb.cpp
|
||||
genequiv.cpp
|
||||
init.cpp
|
||||
listboxes.cpp
|
||||
loadcmp.cpp
|
||||
menubar.cpp
|
||||
readschematicnetlist.cpp
|
||||
savecmp.cpp
|
||||
read_write_cmpfile.cpp
|
||||
readwrite_dlgs.cpp
|
||||
setvisu.cpp
|
||||
tool_cvpcb.cpp
|
||||
)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 2009 Jean-Pierre Charras, jean-pierre.charras
|
||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
|
@ -242,7 +242,7 @@ void CVPCB_MAINFRAME::OnCloseWindow( wxCloseEvent& Event )
|
|||
{
|
||||
unsigned ii;
|
||||
wxMessageDialog dialog( this,
|
||||
_( "Net and component list modified.\nSave before exit ?" ),
|
||||
_( "Component to Footprint links modified.\nSave before exit ?" ),
|
||||
_( "Confirmation" ),
|
||||
wxYES_NO | wxCANCEL | wxICON_EXCLAMATION | wxYES_DEFAULT );
|
||||
|
||||
|
@ -259,7 +259,7 @@ void CVPCB_MAINFRAME::OnCloseWindow( wxCloseEvent& Event )
|
|||
|
||||
case wxID_OK:
|
||||
case wxID_YES:
|
||||
diag = SaveNetList( m_NetlistFileName.GetFullPath() );
|
||||
diag = SaveCmpLinkFile( m_NetlistFileName.GetFullPath() );
|
||||
|
||||
if( diag > 0 )
|
||||
{
|
||||
|
@ -267,7 +267,7 @@ void CVPCB_MAINFRAME::OnCloseWindow( wxCloseEvent& Event )
|
|||
}
|
||||
else if( diag == 0 )
|
||||
{
|
||||
if( !IsOK( this, _( "Problem when saving files, exit anyway ?" ) ) )
|
||||
if( !IsOK( this, _( "Problem when saving file, exit anyway ?" ) ) )
|
||||
{
|
||||
Event.Veto();
|
||||
return;
|
||||
|
@ -385,7 +385,7 @@ void CVPCB_MAINFRAME::SaveQuitCvpcb( wxCommandEvent& aEvent )
|
|||
if( aEvent.GetId() == wxID_SAVEAS )
|
||||
m_NetlistFileName.Clear();
|
||||
|
||||
if( SaveNetList( m_NetlistFileName.GetFullPath() ) > 0 )
|
||||
if( SaveCmpLinkFile( m_NetlistFileName.GetFullPath() ) > 0 )
|
||||
{
|
||||
m_modified = false;
|
||||
|
||||
|
@ -451,7 +451,7 @@ void CVPCB_MAINFRAME::LoadNetList( wxCommandEvent& event )
|
|||
|
||||
wxGetApp().GetLibraryPathList().Insert( newFileName.GetPath(), 0 );
|
||||
m_NetlistFileName = newFileName;
|
||||
ReadNetList();
|
||||
ReadNetListAndLinkFiles();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -31,6 +31,9 @@ const wxString FootprintAliasFileExtension( wxT( "equ" ) );
|
|||
const wxString RetroFileWildcard( _( "KiCad retroannotation files (*.stf)|*.stf" ) );
|
||||
const wxString FootprintAliasFileWildcard( _( "KiCad footprint alias files (*.equ)|*.equ" ) );
|
||||
|
||||
// Wildcard for cvpcb component to footprint link file ( normal output file )
|
||||
const wxString ComponentFileWildcard( _( "KiCad cmp/footprint link files (*.cmp)|*.cmp" ) );
|
||||
|
||||
const wxString titleLibLoadError( _( "Library Load Error" ) );
|
||||
|
||||
|
||||
|
@ -57,7 +60,7 @@ void EDA_APP::MacOpenFile(const wxString &fileName)
|
|||
wxGetApp().GetLibraryPathList().Insert( filename.GetPath(), 0 );
|
||||
|
||||
frame->m_NetlistFileName = filename;
|
||||
frame->ReadNetList();
|
||||
frame->ReadNetListAndLinkFiles();
|
||||
}
|
||||
|
||||
// Create a new application object
|
||||
|
@ -108,7 +111,7 @@ bool EDA_APP::OnInit()
|
|||
{
|
||||
frame->m_NetlistFileName = filename;
|
||||
|
||||
if( frame->ReadNetList() )
|
||||
if( frame->ReadNetListAndLinkFiles() )
|
||||
{
|
||||
frame->m_NetlistFileExtension = filename.GetExt();
|
||||
return true;
|
||||
|
|
|
@ -29,6 +29,7 @@ extern const wxString ComponentFileExtension;
|
|||
|
||||
extern const wxString RetroFileWildcard;
|
||||
extern const wxString FootprintAliasFileWildcard;
|
||||
extern const wxString ComponentFileWildcard;
|
||||
|
||||
extern const wxString titleLibLoadError;
|
||||
|
||||
|
|
|
@ -110,7 +110,15 @@ public:
|
|||
*/
|
||||
void AssocieModule( wxCommandEvent& event );
|
||||
|
||||
/**
|
||||
* Function WriteStuffList
|
||||
* Creates a file for Eeschema, import footprint selections
|
||||
* in schematic
|
||||
* the file format is
|
||||
* comp = "<reference>" module = "<footprint name">
|
||||
*/
|
||||
void WriteStuffList( wxCommandEvent& event );
|
||||
|
||||
void DisplayDocFile( wxCommandEvent& event );
|
||||
|
||||
/**
|
||||
|
@ -123,37 +131,64 @@ public:
|
|||
|
||||
/**
|
||||
* Function SetNewPkg
|
||||
* set the module to the selected component and selects the next component.
|
||||
* links the footprint to the current selected component
|
||||
* and selects the next component.
|
||||
* @param aFootprintName = the selected footprint
|
||||
*/
|
||||
void SetNewPkg( const wxString& package );
|
||||
void SetNewPkg( const wxString& aFootprintName );
|
||||
void BuildCmpListBox();
|
||||
void BuildFOOTPRINTS_LISTBOX();
|
||||
void CreateScreenCmp();
|
||||
|
||||
/**
|
||||
* Function SaveNetList
|
||||
* backup and save netlist (.net) file to \a aFullFileName.
|
||||
* Function SaveCmpLinkFile
|
||||
* Saves the component - footprint link file (.cmp file) to \a aFullFileName.
|
||||
*
|
||||
* @param aFullFileName A reference wxString object containing the full path and
|
||||
* file name of the netlist to save.
|
||||
* @return 0 if an error occurred saving the netlist to \a aFullFileName.
|
||||
* @param aFullFileName A reference wxString object containing the full
|
||||
* file name of the netlist or cmp file.
|
||||
* If aFullFileName is empty, a file name will be asked to the user
|
||||
* @return 0 if an error occurred saving the link file to \a aFullFileName.
|
||||
* -1 if cancelled
|
||||
* 1 if OK
|
||||
*/
|
||||
int SaveNetList( const wxString& aFullFileName );
|
||||
int SaveCmpLinkFile( const wxString& aFullFileName );
|
||||
|
||||
|
||||
/**
|
||||
* Function SaveComponentList
|
||||
* backup modules to file \a aFullFileName.
|
||||
* Function LoadComponentFile
|
||||
* loads the .cmp link file \a aCmpFileName which stores
|
||||
* the component/footprint association.
|
||||
*
|
||||
* @param aFullFileName Name of net list file to save.
|
||||
* @returns 1 if OK, 0 if error.
|
||||
* @param aFileName The full filename of .cmp file to load
|
||||
* If empty, a filename will be asked to the user
|
||||
*/
|
||||
int SaveComponentList( const wxString& aFullFileName );
|
||||
bool LoadComponentLinkFile( const wxString& aFileName );
|
||||
|
||||
/**
|
||||
* Function WriteComponentLinkFile
|
||||
* Writes the component footprint link file \a aFullFileName on disk.
|
||||
*
|
||||
* @param aFullFileName full filename of .cmp file to write.
|
||||
* @return true if OK, false if error.
|
||||
*/
|
||||
bool WriteComponentLinkFile( const wxString& aFullFileName );
|
||||
|
||||
/**
|
||||
* Function ReadComponentLinkFile
|
||||
* Reads the component footprint link file \a aFullFileName.
|
||||
*
|
||||
* @param aFile = the opened the opened file to read.
|
||||
* ReadComponentLinkFile will close the file
|
||||
* @return true if OK, false if error.
|
||||
*/
|
||||
bool ReadComponentLinkFile( FILE * aFile );
|
||||
|
||||
/**
|
||||
* Function ReadNetList
|
||||
* reads the netlist (.net) file defined by #m_NetlistFileName.
|
||||
* and the corresponding cmp to footprint (.cmp) link file
|
||||
*/
|
||||
bool ReadNetList();
|
||||
bool ReadNetListAndLinkFiles();
|
||||
|
||||
int ReadSchematicNetlist();
|
||||
|
||||
|
@ -200,21 +235,6 @@ public:
|
|||
*/
|
||||
bool LoadFootprintFiles();
|
||||
|
||||
/**
|
||||
* function GenNetlistPcbnew
|
||||
* writes the output netlist file
|
||||
*
|
||||
*/
|
||||
int GenNetlistPcbnew( FILE* f, bool isEESchemaNetlist = true );
|
||||
|
||||
/**
|
||||
* Function LoadComponentFile
|
||||
* loads the .cmp file \a aCmpFileName that stores the component/footprint association.
|
||||
*
|
||||
* @param aFileName The full filename of .cmp file to load
|
||||
*/
|
||||
bool LoadComponentFile( const wxString& aFileName );
|
||||
|
||||
/**
|
||||
* Function GetProjectFileParameters
|
||||
* return project file parameter list for CvPcb.
|
||||
|
|
|
@ -1,52 +0,0 @@
|
|||
/*****************/
|
||||
/* genequiv.cpp */
|
||||
/*****************/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <wxstruct.h>
|
||||
#include <confirm.h>
|
||||
#include <gestfich.h>
|
||||
|
||||
#include <cvpcb.h>
|
||||
#include <cvpcb_mainframe.h>
|
||||
|
||||
|
||||
void CVPCB_MAINFRAME::WriteStuffList( wxCommandEvent& event )
|
||||
{
|
||||
FILE* FileEquiv;
|
||||
wxString Line;
|
||||
wxFileName fn = m_NetlistFileName;
|
||||
|
||||
if( m_components.empty() )
|
||||
return;
|
||||
|
||||
fn.SetExt( RetroFileExtension );
|
||||
|
||||
wxFileDialog dlg( this, wxT( "Save Stuff File" ), fn.GetPath(),
|
||||
fn.GetFullName(), RetroFileWildcard,
|
||||
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
|
||||
if( dlg.ShowModal() == wxID_CANCEL )
|
||||
return;
|
||||
|
||||
FileEquiv = wxFopen( dlg.GetPath(), wxT( "wt" ) );
|
||||
|
||||
if( FileEquiv == 0 )
|
||||
{
|
||||
Line = _( "Unable to create " ) + dlg.GetPath();
|
||||
DisplayError( this, Line, 30 );
|
||||
return;
|
||||
}
|
||||
|
||||
BOOST_FOREACH( COMPONENT_INFO& component, m_components )
|
||||
{
|
||||
if( component.m_Footprint.empty() )
|
||||
continue;
|
||||
|
||||
fprintf( FileEquiv, "comp = %s module = %s\n",
|
||||
EscapedUTF8( component.m_Reference ).c_str(),
|
||||
EscapedUTF8( component.m_Footprint ).c_str() );
|
||||
}
|
||||
|
||||
fclose( FileEquiv );
|
||||
}
|
166
cvpcb/init.cpp
166
cvpcb/init.cpp
|
@ -1,166 +0,0 @@
|
|||
/**
|
||||
* @file init.cpp
|
||||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <common.h>
|
||||
#include <confirm.h>
|
||||
#include <gr_basic.h>
|
||||
#include <gestfich.h>
|
||||
#include <appl_wxstruct.h>
|
||||
#include <macros.h>
|
||||
#include <build_version.h>
|
||||
|
||||
#include <cvpcb.h>
|
||||
#include <cvpcb_mainframe.h>
|
||||
#include <cvstruct.h>
|
||||
|
||||
|
||||
void CVPCB_MAINFRAME::SetNewPkg( const wxString& package )
|
||||
{
|
||||
COMPONENT_INFO* Component;
|
||||
bool isUndefined = false;
|
||||
int NumCmp;
|
||||
wxString msg;
|
||||
|
||||
if( m_components.empty() )
|
||||
return;
|
||||
|
||||
NumCmp = m_ListCmp->GetSelection();
|
||||
|
||||
if( NumCmp < 0 )
|
||||
{
|
||||
NumCmp = 0;
|
||||
m_ListCmp->SetSelection( NumCmp, true );
|
||||
}
|
||||
|
||||
Component = &m_components[ NumCmp ];
|
||||
|
||||
if( Component == NULL )
|
||||
return;
|
||||
|
||||
isUndefined = Component->m_Footprint.IsEmpty();
|
||||
|
||||
Component->m_Footprint = package;
|
||||
|
||||
msg.Printf( CMP_FORMAT, NumCmp + 1,
|
||||
GetChars( Component->m_Reference ),
|
||||
GetChars( Component->m_Value ),
|
||||
GetChars( Component->m_Footprint ) );
|
||||
m_modified = true;
|
||||
|
||||
if( isUndefined )
|
||||
m_undefinedComponentCnt -= 1;
|
||||
|
||||
m_ListCmp->SetString( NumCmp, msg );
|
||||
m_ListCmp->SetSelection( NumCmp, false );
|
||||
|
||||
// We activate next component:
|
||||
if( NumCmp < (m_ListCmp->GetCount() - 1) )
|
||||
NumCmp++;
|
||||
|
||||
m_ListCmp->SetSelection( NumCmp, true );
|
||||
|
||||
DisplayStatus();
|
||||
}
|
||||
|
||||
|
||||
bool CVPCB_MAINFRAME::ReadNetList()
|
||||
{
|
||||
wxString msg;
|
||||
int error_level;
|
||||
|
||||
error_level = ReadSchematicNetlist();
|
||||
|
||||
if( error_level < 0 )
|
||||
{
|
||||
msg.Printf( _( "File <%s> does not appear to be a valid KiCad net list file." ),
|
||||
GetChars( m_NetlistFileName.GetFullPath() ) );
|
||||
::wxMessageBox( msg, _( "File Error" ), wxOK | wxICON_ERROR, this );
|
||||
m_NetlistFileName.Clear();
|
||||
UpdateTitle();
|
||||
return false;
|
||||
}
|
||||
|
||||
LoadComponentFile( m_NetlistFileName.GetFullPath() );
|
||||
|
||||
if( m_ListCmp == NULL )
|
||||
return false;
|
||||
|
||||
LoadProjectFile( m_NetlistFileName.GetFullPath() );
|
||||
LoadFootprintFiles();
|
||||
BuildFOOTPRINTS_LISTBOX();
|
||||
|
||||
m_ListCmp->Clear();
|
||||
m_undefinedComponentCnt = 0;
|
||||
|
||||
BOOST_FOREACH( COMPONENT_INFO& component, m_components )
|
||||
{
|
||||
msg.Printf( CMP_FORMAT, m_ListCmp->GetCount() + 1,
|
||||
GetChars( component.m_Reference ),
|
||||
GetChars( component.m_Value ),
|
||||
GetChars( component.m_Footprint ) );
|
||||
m_ListCmp->AppendLine( msg );
|
||||
|
||||
if( component.m_Footprint.IsEmpty() )
|
||||
m_undefinedComponentCnt += 1;
|
||||
}
|
||||
|
||||
if( !m_components.empty() )
|
||||
m_ListCmp->SetSelection( 0, true );
|
||||
|
||||
DisplayStatus();
|
||||
|
||||
UpdateTitle();
|
||||
|
||||
UpdateFileHistory( m_NetlistFileName.GetFullPath() );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
int CVPCB_MAINFRAME::SaveNetList( const wxString& aFullFileName )
|
||||
{
|
||||
wxFileName fn;
|
||||
|
||||
if( !aFullFileName.IsEmpty() && m_NetlistFileName.IsOk() )
|
||||
{
|
||||
fn = m_NetlistFileName;
|
||||
}
|
||||
else
|
||||
{
|
||||
wxFileDialog dlg( this, _( "Save Net and Component List" ), wxGetCwd(),
|
||||
wxEmptyString, NetlistFileWildcard, wxFD_SAVE );
|
||||
|
||||
if( dlg.ShowModal() == wxID_CANCEL )
|
||||
return -1;
|
||||
|
||||
fn = dlg.GetPath();
|
||||
|
||||
if( !fn.HasExt() )
|
||||
fn.SetExt( NetlistFileExtension );
|
||||
|
||||
m_NetlistFileName = fn;
|
||||
}
|
||||
|
||||
if( !IsWritable( fn.GetFullPath() ) )
|
||||
return 0;
|
||||
|
||||
if( SaveComponentList( fn.GetFullPath() ) == 0 )
|
||||
{
|
||||
DisplayError( this, _( "Unable to create component file (.cmp)" ) );
|
||||
return 0;
|
||||
}
|
||||
#if 0
|
||||
FILE* netlist = wxFopen( fn.GetFullPath(), wxT( "wt" ) );
|
||||
|
||||
if( netlist == 0 )
|
||||
{
|
||||
DisplayError( this, _( "Unable to create net list file" ) );
|
||||
return 0;
|
||||
}
|
||||
|
||||
GenNetlistPcbnew( netlist, m_isEESchemaNetlist );
|
||||
#endif
|
||||
return 1;
|
||||
}
|
|
@ -0,0 +1,180 @@
|
|||
/**
|
||||
* @file cvpcb/read_write_cmpfile.cpp
|
||||
*/
|
||||
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras
|
||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <kicad_string.h>
|
||||
#include <appl_wxstruct.h>
|
||||
|
||||
#include <cvpcb.h>
|
||||
#include <cvpcb_mainframe.h>
|
||||
|
||||
#include <build_version.h>
|
||||
|
||||
|
||||
/* File header. */
|
||||
static char HeaderLinkFile[] = { "Cmp-Mod V01" };
|
||||
|
||||
/* Write the link file:
|
||||
* the header is:
|
||||
* Cmp-Mod V01 Created by CvPcb (2012-02-08 BZR 3403)-testing date = 10/02/2012 20:45:59
|
||||
* and write block per component like:
|
||||
* BeginCmp
|
||||
* TimeStamp = /322D3011;
|
||||
* Reference = BUS1;
|
||||
* ValeurCmp = BUSPC;
|
||||
* IdModule = BUS_PC;
|
||||
* EndCmp
|
||||
*/
|
||||
|
||||
bool CVPCB_MAINFRAME::WriteComponentLinkFile( const wxString& aFullFileName )
|
||||
{
|
||||
FILE* outputFile;
|
||||
wxFileName fn( aFullFileName );
|
||||
wxString Title = wxGetApp().GetTitle() + wxT( " " ) + GetBuildVersion();
|
||||
|
||||
outputFile = wxFopen( fn.GetFullPath(), wxT( "wt" ) );
|
||||
|
||||
if( outputFile == NULL )
|
||||
return false;
|
||||
|
||||
int retval = 0;
|
||||
|
||||
retval |= fprintf( outputFile, "%s", HeaderLinkFile );
|
||||
retval |= fprintf( outputFile, " Created by %s", TO_UTF8( Title ) );
|
||||
retval |= fprintf( outputFile, " date = %s\n", TO_UTF8( DateAndTime() ) );
|
||||
|
||||
BOOST_FOREACH( COMPONENT_INFO& component, m_components )
|
||||
{
|
||||
retval |= fprintf( outputFile, "\nBeginCmp\n" );
|
||||
retval |= fprintf( outputFile, "TimeStamp = %s;\n", TO_UTF8( component.m_TimeStamp ) );
|
||||
retval |= fprintf( outputFile, "Reference = %s;\n", TO_UTF8( component.m_Reference ) );
|
||||
retval |= fprintf( outputFile, "ValeurCmp = %s;\n", TO_UTF8( component.m_Value ) );
|
||||
retval |= fprintf( outputFile, "IdModule = %s;\n", TO_UTF8( component.m_Footprint ) );
|
||||
retval |= fprintf( outputFile, "EndCmp\n" );
|
||||
}
|
||||
|
||||
retval |= fprintf( outputFile, "\nEndListe\n" );
|
||||
fclose( outputFile );
|
||||
return retval >= 0;
|
||||
}
|
||||
|
||||
bool CVPCB_MAINFRAME::ReadComponentLinkFile( FILE * aFile )
|
||||
{
|
||||
wxString timestamp, valeur, ilib, namecmp, msg;
|
||||
bool read_cmp_data = false, eof = false;
|
||||
char Line[1024], * ident, * data;
|
||||
|
||||
// Identification of the type of link file
|
||||
if( fgets( Line, sizeof(Line), aFile ) == 0 ||
|
||||
strnicmp( Line, HeaderLinkFile, 11 ) != 0 )
|
||||
{
|
||||
fclose( aFile );
|
||||
return false;
|
||||
}
|
||||
|
||||
while( !eof && fgets( Line, sizeof(Line), aFile ) != 0 )
|
||||
{
|
||||
if( strnicmp( Line, "EndListe", 8 ) == 0 )
|
||||
break;
|
||||
|
||||
/* Search the beginning of the component description. */
|
||||
if( strnicmp( Line, "BeginCmp", 8 ) != 0 )
|
||||
continue;
|
||||
|
||||
timestamp.Empty();
|
||||
valeur.Empty();
|
||||
ilib.Empty();
|
||||
namecmp.Empty();
|
||||
read_cmp_data = true;
|
||||
|
||||
while( !eof && read_cmp_data )
|
||||
{
|
||||
if( fgets( Line, 1024, aFile ) == 0 )
|
||||
{
|
||||
eof = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if( strnicmp( Line, "EndCmp", 6 ) == 0 )
|
||||
{
|
||||
read_cmp_data = true;
|
||||
break;
|
||||
}
|
||||
|
||||
ident = strtok( Line, "=;\n\r" );
|
||||
data = strtok( NULL, ";\n\r" );
|
||||
|
||||
if( strnicmp( ident, "TimeStamp", 9 ) == 0 )
|
||||
{
|
||||
timestamp = FROM_UTF8( data );
|
||||
timestamp.Trim( true );
|
||||
timestamp.Trim( false );
|
||||
continue;
|
||||
}
|
||||
|
||||
if( strnicmp( ident, "Reference", 9 ) == 0 )
|
||||
{
|
||||
namecmp = FROM_UTF8( data );
|
||||
namecmp.Trim( true );
|
||||
namecmp.Trim( false );
|
||||
continue;
|
||||
}
|
||||
|
||||
if( strnicmp( ident, "ValeurCmp", 9 ) == 0 )
|
||||
{
|
||||
valeur = FROM_UTF8( data );
|
||||
valeur.Trim( true );
|
||||
valeur.Trim( false );
|
||||
continue;
|
||||
}
|
||||
|
||||
if( strnicmp( ident, "IdModule", 8 ) == 0 )
|
||||
{
|
||||
ilib = FROM_UTF8( data );
|
||||
ilib.Trim( true );
|
||||
ilib.Trim( false );
|
||||
continue;
|
||||
}
|
||||
} // End reading one component link block.
|
||||
|
||||
// Search corresponding component info in list and update its parameters.
|
||||
BOOST_FOREACH( COMPONENT_INFO& component, m_components )
|
||||
{
|
||||
if( namecmp != component.m_Reference )
|
||||
continue;
|
||||
|
||||
/* Copy the name of the corresponding module. */
|
||||
component.m_Footprint = ilib;
|
||||
}
|
||||
}
|
||||
|
||||
fclose( aFile );
|
||||
return true;
|
||||
}
|
||||
|
|
@ -0,0 +1,257 @@
|
|||
/**
|
||||
* @file cvpcb/readwrite_dlgs.cpp
|
||||
*/
|
||||
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras
|
||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <common.h>
|
||||
#include <confirm.h>
|
||||
#include <build_version.h>
|
||||
|
||||
#include <cvpcb.h>
|
||||
#include <cvpcb_mainframe.h>
|
||||
#include <cvstruct.h>
|
||||
|
||||
#define titleComponentLibErr _( "Component Library Error" )
|
||||
|
||||
|
||||
void CVPCB_MAINFRAME::SetNewPkg( const wxString& aFootprintName )
|
||||
{
|
||||
COMPONENT_INFO* Component;
|
||||
bool isUndefined = false;
|
||||
int NumCmp;
|
||||
wxString msg;
|
||||
|
||||
if( m_components.empty() )
|
||||
return;
|
||||
|
||||
NumCmp = m_ListCmp->GetSelection();
|
||||
|
||||
if( NumCmp < 0 )
|
||||
{
|
||||
NumCmp = 0;
|
||||
m_ListCmp->SetSelection( NumCmp, true );
|
||||
}
|
||||
|
||||
Component = &m_components[ NumCmp ];
|
||||
|
||||
if( Component == NULL )
|
||||
return;
|
||||
|
||||
isUndefined = Component->m_Footprint.IsEmpty();
|
||||
|
||||
Component->m_Footprint = aFootprintName;
|
||||
|
||||
msg.Printf( CMP_FORMAT, NumCmp + 1,
|
||||
GetChars( Component->m_Reference ),
|
||||
GetChars( Component->m_Value ),
|
||||
GetChars( Component->m_Footprint ) );
|
||||
m_modified = true;
|
||||
|
||||
if( isUndefined )
|
||||
m_undefinedComponentCnt -= 1;
|
||||
|
||||
m_ListCmp->SetString( NumCmp, msg );
|
||||
m_ListCmp->SetSelection( NumCmp, false );
|
||||
|
||||
// We activate next component:
|
||||
if( NumCmp < (m_ListCmp->GetCount() - 1) )
|
||||
NumCmp++;
|
||||
|
||||
m_ListCmp->SetSelection( NumCmp, true );
|
||||
|
||||
DisplayStatus();
|
||||
}
|
||||
|
||||
|
||||
bool CVPCB_MAINFRAME::ReadNetListAndLinkFiles()
|
||||
{
|
||||
wxString msg;
|
||||
int error_level;
|
||||
|
||||
error_level = ReadSchematicNetlist();
|
||||
|
||||
if( error_level < 0 )
|
||||
{
|
||||
msg.Printf( _( "File <%s> does not appear to be a valid KiCad net list file." ),
|
||||
GetChars( m_NetlistFileName.GetFullPath() ) );
|
||||
wxMessageBox( msg, _( "File Error" ), wxOK | wxICON_ERROR, this );
|
||||
m_NetlistFileName.Clear();
|
||||
UpdateTitle();
|
||||
return false;
|
||||
}
|
||||
|
||||
LoadComponentLinkFile( m_NetlistFileName.GetFullPath() );
|
||||
|
||||
if( m_ListCmp == NULL )
|
||||
return false;
|
||||
|
||||
LoadProjectFile( m_NetlistFileName.GetFullPath() );
|
||||
LoadFootprintFiles();
|
||||
BuildFOOTPRINTS_LISTBOX();
|
||||
|
||||
m_ListCmp->Clear();
|
||||
m_undefinedComponentCnt = 0;
|
||||
|
||||
BOOST_FOREACH( COMPONENT_INFO& component, m_components )
|
||||
{
|
||||
msg.Printf( CMP_FORMAT, m_ListCmp->GetCount() + 1,
|
||||
GetChars( component.m_Reference ),
|
||||
GetChars( component.m_Value ),
|
||||
GetChars( component.m_Footprint ) );
|
||||
m_ListCmp->AppendLine( msg );
|
||||
|
||||
if( component.m_Footprint.IsEmpty() )
|
||||
m_undefinedComponentCnt += 1;
|
||||
}
|
||||
|
||||
if( !m_components.empty() )
|
||||
m_ListCmp->SetSelection( 0, true );
|
||||
|
||||
DisplayStatus();
|
||||
|
||||
UpdateTitle();
|
||||
|
||||
UpdateFileHistory( m_NetlistFileName.GetFullPath() );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool CVPCB_MAINFRAME::LoadComponentLinkFile( const wxString& aFileName )
|
||||
{
|
||||
FILE* linkfile;
|
||||
wxFileName fn = aFileName;
|
||||
|
||||
fn.SetExt( ComponentFileExtension );
|
||||
|
||||
linkfile = wxFopen( fn.GetFullPath(), wxT( "rt" ) );
|
||||
if( linkfile == NULL )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "Cannot open CvPcb component file <%s>." ),
|
||||
GetChars( fn.GetFullPath() ) );
|
||||
msg << wxT( "\n" ) << _( "This is normal if you are opening a new netlist file" );
|
||||
wxMessageBox( msg, titleComponentLibErr, wxOK | wxICON_ERROR );
|
||||
return false;
|
||||
}
|
||||
|
||||
// read and close the file
|
||||
if( ! ReadComponentLinkFile( linkfile ) )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( " <%s> does not appear to be a valid KiCad component link file." ),
|
||||
GetChars( fn.GetFullPath() ) );
|
||||
wxMessageBox( msg, titleComponentLibErr, wxOK | wxICON_ERROR );
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int CVPCB_MAINFRAME::SaveCmpLinkFile( const wxString& aFullFileName )
|
||||
{
|
||||
wxFileName fn;
|
||||
|
||||
if( !aFullFileName.IsEmpty() )
|
||||
{
|
||||
fn = m_NetlistFileName;
|
||||
fn.SetExt( ComponentFileExtension );
|
||||
}
|
||||
else
|
||||
{
|
||||
wxFileDialog dlg( this, _( "Save Component/Footprint Link File" ), wxGetCwd(),
|
||||
wxEmptyString, ComponentFileWildcard, wxFD_SAVE );
|
||||
|
||||
if( dlg.ShowModal() == wxID_CANCEL )
|
||||
return -1;
|
||||
|
||||
fn = dlg.GetPath();
|
||||
|
||||
if( !fn.HasExt() )
|
||||
fn.SetExt( ComponentFileExtension );
|
||||
}
|
||||
|
||||
if( !IsWritable( fn.GetFullPath() ) )
|
||||
return 0;
|
||||
|
||||
if( WriteComponentLinkFile( fn.GetFullPath() ) == 0 )
|
||||
{
|
||||
DisplayError( this, _( "Unable to create component file (.cmp)" ) );
|
||||
return 0;
|
||||
}
|
||||
|
||||
wxString msg;
|
||||
msg.Printf( _("File %s saved"), fn.GetFullPath() );
|
||||
SetStatusText( msg );
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Creates a file for Eeschema, import footprint selections in schematic
|
||||
* the file format is
|
||||
* comp = "<reference>" module = "<footprint name">
|
||||
*/
|
||||
|
||||
void CVPCB_MAINFRAME::WriteStuffList( wxCommandEvent& event )
|
||||
{
|
||||
FILE* FileEquiv;
|
||||
wxString Line;
|
||||
wxFileName fn = m_NetlistFileName;
|
||||
|
||||
if( m_components.empty() )
|
||||
return;
|
||||
|
||||
fn.SetExt( RetroFileExtension );
|
||||
|
||||
wxFileDialog dlg( this, wxT( "Save Stuff File" ), fn.GetPath(),
|
||||
fn.GetFullName(), RetroFileWildcard,
|
||||
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
|
||||
if( dlg.ShowModal() == wxID_CANCEL )
|
||||
return;
|
||||
|
||||
FileEquiv = wxFopen( dlg.GetPath(), wxT( "wt" ) );
|
||||
|
||||
if( FileEquiv == 0 )
|
||||
{
|
||||
Line = _( "Unable to create " ) + dlg.GetPath();
|
||||
DisplayError( this, Line, 30 );
|
||||
return;
|
||||
}
|
||||
|
||||
BOOST_FOREACH( COMPONENT_INFO& component, m_components )
|
||||
{
|
||||
if( component.m_Footprint.empty() )
|
||||
continue;
|
||||
|
||||
fprintf( FileEquiv, "comp = %s module = %s\n",
|
||||
EscapedUTF8( component.m_Reference ).c_str(),
|
||||
EscapedUTF8( component.m_Footprint ).c_str() );
|
||||
}
|
||||
|
||||
fclose( FileEquiv );
|
||||
}
|
|
@ -1,174 +0,0 @@
|
|||
/****************/
|
||||
/* savecmp.cpp */
|
||||
/****************/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <wxstruct.h>
|
||||
#include <confirm.h>
|
||||
#include <kicad_string.h>
|
||||
#include <gestfich.h>
|
||||
#include <macros.h>
|
||||
#include <appl_wxstruct.h>
|
||||
|
||||
#include <cvpcb.h>
|
||||
#include <cvpcb_mainframe.h>
|
||||
|
||||
#include <build_version.h>
|
||||
|
||||
|
||||
/* File header. */
|
||||
char EnteteCmpMod[] = { "Cmp-Mod V01" };
|
||||
|
||||
#define titleComponentLibErr _( "Component Library Error" )
|
||||
|
||||
|
||||
int CVPCB_MAINFRAME::SaveComponentList( const wxString& aFullFileName )
|
||||
{
|
||||
FILE* dest;
|
||||
wxFileName fn( aFullFileName );
|
||||
wxString Title = wxGetApp().GetTitle() + wxT( " " ) + GetBuildVersion();
|
||||
|
||||
fn.SetExt( ComponentFileExtension );
|
||||
|
||||
dest = wxFopen( fn.GetFullPath(), wxT( "wt" ) );
|
||||
|
||||
if( dest == NULL )
|
||||
return 0;
|
||||
|
||||
fprintf( dest, "%s", EnteteCmpMod );
|
||||
fprintf( dest, " Created by %s", TO_UTF8( Title ) );
|
||||
fprintf( dest, " date = %s\n", TO_UTF8( DateAndTime() ) );
|
||||
|
||||
BOOST_FOREACH( COMPONENT_INFO& component, m_components )
|
||||
{
|
||||
fprintf( dest, "\nBeginCmp\n" );
|
||||
fprintf( dest, "TimeStamp = %s;\n", TO_UTF8( component.m_TimeStamp ) );
|
||||
fprintf( dest, "Reference = %s;\n", TO_UTF8( component.m_Reference ) );
|
||||
fprintf( dest, "ValeurCmp = %s;\n", TO_UTF8( component.m_Value ) );
|
||||
fprintf( dest, "IdModule = %s;\n", TO_UTF8( component.m_Footprint ) );
|
||||
fprintf( dest, "EndCmp\n" );
|
||||
}
|
||||
|
||||
fprintf( dest, "\nEndListe\n" );
|
||||
fclose( dest );
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
bool CVPCB_MAINFRAME::LoadComponentFile( const wxString& aFileName )
|
||||
{
|
||||
wxString timestamp, valeur, ilib, namecmp, msg;
|
||||
bool read_cmp_data = false, eof = false;
|
||||
char Line[1024], * ident, * data;
|
||||
FILE* source;
|
||||
wxFileName fn = aFileName;
|
||||
|
||||
fn.SetExt( ComponentFileExtension );
|
||||
|
||||
source = wxFopen( fn.GetFullPath(), wxT( "rt" ) );
|
||||
if( source == NULL )
|
||||
{
|
||||
msg.Printf( _( "Cannot open CvPcb component file <%s>." ),
|
||||
GetChars( fn.GetFullPath() ) );
|
||||
msg << wxT( "\n" ) << _( "This is normal if you are opening a new netlist file" );
|
||||
wxMessageBox( msg, titleComponentLibErr, wxOK | wxICON_ERROR );
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Identification of the type of file CmpMod */
|
||||
if( fgets( Line, 79, source ) == 0 )
|
||||
{
|
||||
msg.Printf( _( " <%s> does not appear to be a valid KiCad component library." ),
|
||||
GetChars( fn.GetFullPath() ) );
|
||||
wxMessageBox( msg, titleComponentLibErr, wxOK | wxICON_ERROR );
|
||||
fclose( source );
|
||||
return false;
|
||||
}
|
||||
|
||||
if( strnicmp( Line, EnteteCmpMod, 11 ) != 0 ) /* old file version*/
|
||||
{
|
||||
msg.Printf( _( "<%s> is an old version component file." ) );
|
||||
wxMessageBox( msg, titleComponentLibErr, wxOK | wxICON_ERROR );
|
||||
fclose( source );
|
||||
return false;
|
||||
}
|
||||
|
||||
while( !eof && fgets( Line, 79, source ) != 0 )
|
||||
{
|
||||
if( strnicmp( Line, "EndListe", 8 ) == 0 )
|
||||
break;
|
||||
|
||||
/* Search the beginning of the component description. */
|
||||
if( strnicmp( Line, "BeginCmp", 8 ) != 0 )
|
||||
continue;
|
||||
|
||||
timestamp.Empty();
|
||||
valeur.Empty();
|
||||
ilib.Empty();
|
||||
namecmp.Empty();
|
||||
read_cmp_data = true;
|
||||
|
||||
while( !eof && read_cmp_data )
|
||||
{
|
||||
if( fgets( Line, 1024, source ) == 0 )
|
||||
{
|
||||
eof = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if( strnicmp( Line, "EndCmp", 6 ) == 0 )
|
||||
{
|
||||
read_cmp_data = true;
|
||||
break;
|
||||
}
|
||||
|
||||
ident = strtok( Line, "=;\n\r" );
|
||||
data = strtok( NULL, ";\n\r" );
|
||||
|
||||
if( strnicmp( ident, "TimeStamp", 9 ) == 0 )
|
||||
{
|
||||
timestamp = FROM_UTF8( data );
|
||||
timestamp.Trim( true );
|
||||
timestamp.Trim( false );
|
||||
continue;
|
||||
}
|
||||
|
||||
if( strnicmp( ident, "Reference", 9 ) == 0 )
|
||||
{
|
||||
namecmp = FROM_UTF8( data );
|
||||
namecmp.Trim( true );
|
||||
namecmp.Trim( false );
|
||||
continue;
|
||||
}
|
||||
|
||||
if( strnicmp( ident, "ValeurCmp", 9 ) == 0 )
|
||||
{
|
||||
valeur = FROM_UTF8( data );
|
||||
valeur.Trim( true );
|
||||
valeur.Trim( false );
|
||||
continue;
|
||||
}
|
||||
|
||||
if( strnicmp( ident, "IdModule", 8 ) == 0 )
|
||||
{
|
||||
ilib = FROM_UTF8( data );
|
||||
ilib.Trim( true );
|
||||
ilib.Trim( false );
|
||||
continue;
|
||||
}
|
||||
} /* End reading component description. */
|
||||
|
||||
/* Search corresponding component and NetList Update its parameters. */
|
||||
BOOST_FOREACH( COMPONENT_INFO& component, m_components )
|
||||
{
|
||||
if( namecmp != component.m_Reference )
|
||||
continue;
|
||||
|
||||
/* Copy the name of the corresponding module. */
|
||||
component.m_Footprint = ilib;
|
||||
}
|
||||
}
|
||||
|
||||
fclose( source );
|
||||
return true;
|
||||
}
|
|
@ -1,102 +0,0 @@
|
|||
/***************************/
|
||||
/* writenetlistpcbnew.cpp */
|
||||
/***************************/
|
||||
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <common.h>
|
||||
#include <confirm.h>
|
||||
#include <kicad_string.h>
|
||||
#include <macros.h>
|
||||
#include <appl_wxstruct.h>
|
||||
|
||||
#include <cvpcb.h>
|
||||
#include <cvpcb_mainframe.h>
|
||||
|
||||
static void WriteFootprintFilterInfos( FILE* dest, COMPONENT_LIST& list );
|
||||
|
||||
/**
|
||||
* Create KiCad net list file.
|
||||
*
|
||||
* @todo: None of the printf() call return values are checked for failure,
|
||||
* a value less than zero. Check all printf() return values and
|
||||
* return a true(pass) or false(fail) to the caller.
|
||||
*/
|
||||
int CVPCB_MAINFRAME::GenNetlistPcbnew( FILE* file,bool isEESchemaNetlist )
|
||||
{
|
||||
#define NETLIST_HEAD_STRING "EESchema Netlist Version 1.1"
|
||||
|
||||
if( isEESchemaNetlist )
|
||||
fprintf( file, "# %s created %s\n(\n", NETLIST_HEAD_STRING, TO_UTF8( DateAndTime() ) );
|
||||
else
|
||||
fprintf( file, "( { netlist created %s }\n", TO_UTF8( DateAndTime() ) );
|
||||
|
||||
|
||||
BOOST_FOREACH( COMPONENT_INFO& component, m_components )
|
||||
{
|
||||
fprintf( file, " ( %s ", TO_UTF8( component.m_TimeStamp ) );
|
||||
|
||||
if( !component.m_Footprint.IsEmpty() )
|
||||
fprintf( file, "%s", TO_UTF8( component.m_Footprint ) );
|
||||
else
|
||||
fprintf( file, "$noname$" );
|
||||
|
||||
fprintf( file, " %s ", TO_UTF8( component.m_Reference ) );
|
||||
|
||||
fprintf( file, "%s\n", TO_UTF8( component.m_Value ) );
|
||||
|
||||
component.m_Pins.sort();
|
||||
|
||||
BOOST_FOREACH( PIN& pin, component.m_Pins )
|
||||
{
|
||||
if( !pin.m_Net.IsEmpty() )
|
||||
fprintf( file, " ( %s %s )\n", TO_UTF8( pin.m_Number ), TO_UTF8( pin.m_Net ) );
|
||||
else
|
||||
fprintf( file, " ( %s ? )\n", TO_UTF8( pin.m_Number ) );
|
||||
}
|
||||
|
||||
fprintf( file, " )\n" );
|
||||
}
|
||||
|
||||
fprintf( file, ")\n*\n" );
|
||||
|
||||
if( isEESchemaNetlist )
|
||||
WriteFootprintFilterInfos( file, m_components );
|
||||
|
||||
fclose( file );
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Write the allowed footprint list for each component
|
||||
*/
|
||||
void WriteFootprintFilterInfos( FILE* file, COMPONENT_LIST& list )
|
||||
{
|
||||
bool WriteHeader = false;
|
||||
|
||||
BOOST_FOREACH( COMPONENT_INFO& component, list )
|
||||
{
|
||||
unsigned int FilterCount;
|
||||
FilterCount = component.m_FootprintFilter.GetCount();
|
||||
if( FilterCount == 0 )
|
||||
continue;
|
||||
if( !WriteHeader )
|
||||
{
|
||||
fprintf( file, "{ Allowed footprints by component:\n" );
|
||||
WriteHeader = true;
|
||||
}
|
||||
fprintf( file, "$component %s\n",
|
||||
TO_UTF8( component.m_Reference ) );
|
||||
/* Write the footprint list */
|
||||
for( unsigned int jj = 0; jj < FilterCount; jj++ )
|
||||
{
|
||||
fprintf( file, " %s\n",
|
||||
TO_UTF8( component.m_FootprintFilter[jj] ) );
|
||||
}
|
||||
|
||||
fprintf( file, "$endlist\n" );
|
||||
}
|
||||
|
||||
if( WriteHeader )
|
||||
fprintf( file, "$endfootprintlist\n}\n" );
|
||||
}
|
|
@ -57,13 +57,13 @@ void PCB_EDIT_FRAME::InstallModuleOptionsFrame( MODULE* Module, wxDC* DC )
|
|||
|
||||
|
||||
/*
|
||||
* Position anchor under the cursor.
|
||||
* Move the footprint anchor position to the current cursor position.
|
||||
*/
|
||||
void FOOTPRINT_EDIT_FRAME::Place_Ancre( MODULE* pt_mod )
|
||||
{
|
||||
wxPoint moveVector;
|
||||
EDA_ITEM* PtStruct;
|
||||
D_PAD* pt_pad;
|
||||
EDA_ITEM* item;
|
||||
D_PAD* pad;
|
||||
|
||||
if( pt_mod == NULL )
|
||||
return;
|
||||
|
@ -78,30 +78,30 @@ void FOOTPRINT_EDIT_FRAME::Place_Ancre( MODULE* pt_mod )
|
|||
RotatePoint( &moveVector, -pt_mod->m_Orient );
|
||||
|
||||
/* Update the pad coordinates. */
|
||||
pt_pad = (D_PAD*) pt_mod->m_Pads;
|
||||
pad = (D_PAD*) pt_mod->m_Pads;
|
||||
|
||||
for( ; pt_pad != NULL; pt_pad = pt_pad->Next() )
|
||||
for( ; pad != NULL; pad = pad->Next() )
|
||||
{
|
||||
pt_pad->m_Pos0 += moveVector;
|
||||
pad->m_Pos0 += moveVector;
|
||||
}
|
||||
|
||||
/* Update the draw element coordinates. */
|
||||
PtStruct = pt_mod->m_Drawings;
|
||||
item = pt_mod->m_Drawings;
|
||||
|
||||
for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
|
||||
for( ; item != NULL; item = item->Next() )
|
||||
{
|
||||
switch( PtStruct->Type() )
|
||||
switch( item->Type() )
|
||||
{
|
||||
case PCB_MODULE_EDGE_T:
|
||||
#undef STRUCT
|
||||
#define STRUCT ( (EDGE_MODULE*) PtStruct )
|
||||
#undef STRUCT
|
||||
#define STRUCT ( (EDGE_MODULE*) item )
|
||||
STRUCT->m_Start0 += moveVector;
|
||||
STRUCT->m_End0 += moveVector;
|
||||
break;
|
||||
|
||||
case PCB_MODULE_TEXT_T:
|
||||
#undef STRUCT
|
||||
#define STRUCT ( (TEXTE_MODULE*) PtStruct )
|
||||
#undef STRUCT
|
||||
#define STRUCT ( (TEXTE_MODULE*) item )
|
||||
STRUCT->SetPos0( STRUCT->GetPos0() + moveVector );
|
||||
break;
|
||||
|
||||
|
|
Loading…
Reference in New Issue