Minor fixes, dead code removal, and coding policy fixes.
* Use version of DateAndTime that returns a wxString and delete the version that takes a char* as it is no longer required. * Merge StrNumICmp() and StrLenNumICmp() into StrLenNumCmp() to create a single function for comparing strings with integers and remove a lot of duplicate code. * Remove unused strupper from string.cpp. * Use wxArrayString for sorting the EDA_LIST_DIALOG contents.
This commit is contained in:
parent
b88505dd85
commit
cd0b231656
|
@ -42,7 +42,7 @@ BASE_SCREEN::BASE_SCREEN( KICAD_T aType ) : EDA_ITEM( aType )
|
||||||
{
|
{
|
||||||
m_drawList = NULL; /* Draw items list */
|
m_drawList = NULL; /* Draw items list */
|
||||||
m_UndoRedoCountMax = 10; /* undo/Redo command Max depth, 10 is a reasonable value */
|
m_UndoRedoCountMax = 10; /* undo/Redo command Max depth, 10 is a reasonable value */
|
||||||
m_FirstRedraw = TRUE;
|
m_FirstRedraw = true;
|
||||||
m_ScreenNumber = 1;
|
m_ScreenNumber = 1;
|
||||||
m_NumberOfScreen = 1; /* Hierarchy: Root: ScreenNumber = 1 */
|
m_NumberOfScreen = 1; /* Hierarchy: Root: ScreenNumber = 1 */
|
||||||
m_Zoom = 32.0;
|
m_Zoom = 32.0;
|
||||||
|
|
|
@ -44,8 +44,6 @@ void GERBER_PLOTTER::set_viewport( wxPoint aOffset, double aScale, bool aMirror
|
||||||
*/
|
*/
|
||||||
bool GERBER_PLOTTER::start_plot( FILE* aFile )
|
bool GERBER_PLOTTER::start_plot( FILE* aFile )
|
||||||
{
|
{
|
||||||
char Line[1024];
|
|
||||||
|
|
||||||
wxASSERT( !output_file );
|
wxASSERT( !output_file );
|
||||||
final_file = aFile;
|
final_file = aFile;
|
||||||
|
|
||||||
|
@ -59,9 +57,9 @@ bool GERBER_PLOTTER::start_plot( FILE* aFile )
|
||||||
if( output_file == NULL )
|
if( output_file == NULL )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
DateAndTime( Line );
|
|
||||||
wxString Title = creator + wxT( " " ) + GetBuildVersion();
|
wxString Title = creator + wxT( " " ) + GetBuildVersion();
|
||||||
fprintf( output_file, "G04 (created by %s) date %s*\n", TO_UTF8( Title ), Line );
|
fprintf( output_file, "G04 (created by %s) date %s*\n",
|
||||||
|
TO_UTF8( Title ), TO_UTF8( DateAndTime() ) );
|
||||||
|
|
||||||
// Specify linear interpol (G01), unit = INCH (G70), abs format (G90):
|
// Specify linear interpol (G01), unit = INCH (G70), abs format (G90):
|
||||||
fputs( "G01*\nG70*\nG90*\n", output_file );
|
fputs( "G01*\nG70*\nG90*\n", output_file );
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* confirm.cpp
|
* @file confirm.cpp
|
||||||
* utilities to display some error, warning and info short messges
|
* utilities to display some error, warning and info short messges
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "fctsys.h"
|
#include "fctsys.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
@ -9,11 +9,7 @@
|
||||||
#include "wx/html/htmlwin.h"
|
#include "wx/html/htmlwin.h"
|
||||||
#include "html_messagebox.h"
|
#include "html_messagebox.h"
|
||||||
|
|
||||||
/* Display an error or warning message.
|
|
||||||
* TODO:
|
|
||||||
* If display time > 0 the dialog disappears after displayTime ( in 0.1 second )
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void DisplayError( wxWindow* parent, const wxString& text, int displaytime )
|
void DisplayError( wxWindow* parent, const wxString& text, int displaytime )
|
||||||
{
|
{
|
||||||
wxMessageDialog* dialog;
|
wxMessageDialog* dialog;
|
||||||
|
@ -30,12 +26,7 @@ void DisplayError( wxWindow* parent, const wxString& text, int displaytime )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Display an informational message.
|
void DisplayInfoMessage( wxWindow* parent, const wxString& text, int displaytime )
|
||||||
* TODO:
|
|
||||||
* If display time > 0 the message disappears after displayTime (in 0.1 second )
|
|
||||||
*/
|
|
||||||
void DisplayInfoMessage( wxWindow* parent, const wxString& text,
|
|
||||||
int displaytime )
|
|
||||||
{
|
{
|
||||||
wxMessageDialog* dialog;
|
wxMessageDialog* dialog;
|
||||||
|
|
||||||
|
@ -47,8 +38,6 @@ void DisplayInfoMessage( wxWindow* parent, const wxString& text,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Display a simple message window in html format.
|
|
||||||
*/
|
|
||||||
void DisplayHtmlInfoMessage( wxWindow* parent, const wxString& title,
|
void DisplayHtmlInfoMessage( wxWindow* parent, const wxString& title,
|
||||||
const wxString& text, const wxSize& size )
|
const wxString& text, const wxSize& size )
|
||||||
{
|
{
|
||||||
|
@ -63,10 +52,10 @@ bool IsOK( wxWindow* parent, const wxString& text )
|
||||||
{
|
{
|
||||||
int ii;
|
int ii;
|
||||||
|
|
||||||
ii = wxMessageBox( text, _( "Confirmation" ),
|
ii = wxMessageBox( text, _( "Confirmation" ), wxYES_NO | wxCENTRE | wxICON_HAND, parent );
|
||||||
wxYES_NO | wxCENTRE | wxICON_HAND, parent );
|
|
||||||
if( ii == wxYES )
|
|
||||||
return TRUE;
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if( ii == wxYES )
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
|
@ -18,9 +18,6 @@
|
||||||
static bool DrawPageOnClipboard( EDA_DRAW_FRAME* aFrame );
|
static bool DrawPageOnClipboard( EDA_DRAW_FRAME* aFrame );
|
||||||
|
|
||||||
|
|
||||||
/* calls the function to copy the current page or the current bock to
|
|
||||||
* the clipboard
|
|
||||||
*/
|
|
||||||
void EDA_DRAW_FRAME::CopyToClipboard( wxCommandEvent& event )
|
void EDA_DRAW_FRAME::CopyToClipboard( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
DrawPageOnClipboard( this );
|
DrawPageOnClipboard( this );
|
||||||
|
@ -41,7 +38,7 @@ void EDA_DRAW_FRAME::CopyToClipboard( wxCommandEvent& event )
|
||||||
*/
|
*/
|
||||||
bool DrawPageOnClipboard( EDA_DRAW_FRAME* aFrame )
|
bool DrawPageOnClipboard( EDA_DRAW_FRAME* aFrame )
|
||||||
{
|
{
|
||||||
bool success = TRUE;
|
bool success = true;
|
||||||
|
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WINDOWS__
|
||||||
int tmpzoom;
|
int tmpzoom;
|
||||||
|
@ -58,7 +55,7 @@ bool DrawPageOnClipboard( EDA_DRAW_FRAME* aFrame )
|
||||||
|
|
||||||
if( screen->IsBlockActive() )
|
if( screen->IsBlockActive() )
|
||||||
{
|
{
|
||||||
DrawBlock = TRUE;
|
DrawBlock = true;
|
||||||
DrawArea.SetX( screen->m_BlockLocate.GetX() );
|
DrawArea.SetX( screen->m_BlockLocate.GetX() );
|
||||||
DrawArea.SetY( screen->m_BlockLocate.GetY() );
|
DrawArea.SetY( screen->m_BlockLocate.GetY() );
|
||||||
DrawArea.SetWidth( screen->m_BlockLocate.GetWidth() );
|
DrawArea.SetWidth( screen->m_BlockLocate.GetWidth() );
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// Name: svg.cpp
|
// Name: svg.cpp
|
||||||
// Purpose: SVG plot
|
// Purpose: SVG plot
|
||||||
// Author: Chris Elliott
|
// Author: Chris Elliott
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/****************/
|
/**
|
||||||
/* displlst.cpp */
|
* @file displlst.cpp
|
||||||
/****************/
|
*/
|
||||||
|
|
||||||
#include "fctsys.h"
|
#include "fctsys.h"
|
||||||
#include "wxstruct.h"
|
#include "wxstruct.h"
|
||||||
|
@ -27,16 +27,6 @@ BEGIN_EVENT_TABLE( EDA_LIST_DIALOG, wxDialog )
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used to display a list of elements for selection, and display comment of info lines
|
|
||||||
* about the selected item.
|
|
||||||
* @param aParent = apointeur to the parent window
|
|
||||||
* @param aTitle = the title shown on top.
|
|
||||||
* @param aItemList = a wxArrayString: the list of elements.
|
|
||||||
* @param aRefText = an item name if an item must be preselected.
|
|
||||||
* @param aCallBackFunction callback function to display comments
|
|
||||||
* @param aPos = position of the dialog.
|
|
||||||
*/
|
|
||||||
EDA_LIST_DIALOG::EDA_LIST_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aTitle,
|
EDA_LIST_DIALOG::EDA_LIST_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aTitle,
|
||||||
const wxArrayString& aItemList, const wxString& aRefText,
|
const wxArrayString& aItemList, const wxString& aRefText,
|
||||||
void(* aCallBackFunction)(wxString& Text), wxPoint aPos ) :
|
void(* aCallBackFunction)(wxString& Text), wxPoint aPos ) :
|
||||||
|
@ -155,39 +145,24 @@ void EDA_LIST_DIALOG::OnClose( wxCloseEvent& event )
|
||||||
|
|
||||||
/* Sort alphabetically, case insensitive.
|
/* Sort alphabetically, case insensitive.
|
||||||
*/
|
*/
|
||||||
static int SortItems( const wxString** ptr1, const wxString** ptr2 )
|
static int SortItems( const wxString& item1, const wxString& item2 )
|
||||||
{
|
{
|
||||||
return StrNumICmp( (*ptr1)->GetData(), (*ptr2)->GetData() );
|
return StrNumCmp( item1, item2, INT_MAX, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EDA_LIST_DIALOG:: SortList()
|
void EDA_LIST_DIALOG::SortList()
|
||||||
{
|
{
|
||||||
int ii, NbItems = m_listBox->GetCount();
|
wxArrayString list = m_listBox->GetStrings();
|
||||||
const wxString** BufList;
|
|
||||||
|
|
||||||
if( NbItems <= 0 )
|
if( list.IsEmpty() <= 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
BufList = (const wxString**) MyZMalloc( 100 * NbItems * sizeof(wxString*) );
|
list.Sort( SortItems );
|
||||||
|
|
||||||
for( ii = 0; ii < NbItems; ii++ )
|
|
||||||
{
|
|
||||||
BufList[ii] = new wxString( m_listBox->GetString( ii ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
qsort( BufList, NbItems, sizeof(wxString*),
|
|
||||||
( int( * ) ( const void*, const void* ) )SortItems );
|
|
||||||
|
|
||||||
m_listBox->Clear();
|
m_listBox->Clear();
|
||||||
|
|
||||||
for( ii = 0; ii < NbItems; ii++ )
|
m_listBox->Append( list );
|
||||||
{
|
|
||||||
m_listBox->Append( *BufList[ii] );
|
|
||||||
delete BufList[ii];
|
|
||||||
}
|
|
||||||
|
|
||||||
free( BufList );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -102,11 +102,11 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( wxWindow* father, int idtype, const wxString& ti
|
||||||
m_toolId = ID_NO_TOOL_SELECTED;
|
m_toolId = ID_NO_TOOL_SELECTED;
|
||||||
m_ID_last_state = ID_NO_TOOL_SELECTED;
|
m_ID_last_state = ID_NO_TOOL_SELECTED;
|
||||||
m_HTOOL_current_state = 0;
|
m_HTOOL_current_state = 0;
|
||||||
m_Draw_Axis = FALSE; // TRUE to draw axis.
|
m_Draw_Axis = false; // true to draw axis.
|
||||||
m_Draw_Sheet_Ref = FALSE; // TRUE to display reference sheet.
|
m_Draw_Sheet_Ref = false; // true to display reference sheet.
|
||||||
m_Print_Sheet_Ref = TRUE; // TRUE to print reference sheet.
|
m_Print_Sheet_Ref = true; // true to print reference sheet.
|
||||||
m_Draw_Auxiliary_Axis = FALSE; // TRUE draw auxiliary axis.
|
m_Draw_Auxiliary_Axis = false; // true draw auxiliary axis.
|
||||||
m_Draw_Grid_Axis = FALSE; // TRUE to draw the grid axis
|
m_Draw_Grid_Axis = false; // true to draw the grid axis
|
||||||
m_CursorShape = 0;
|
m_CursorShape = 0;
|
||||||
m_LastGridSizeId = 0;
|
m_LastGridSizeId = 0;
|
||||||
m_DrawGrid = true; // hide/Show grid. default = show
|
m_DrawGrid = true; // hide/Show grid. default = show
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
///////////////////////
|
/**
|
||||||
// Name: eda_dde.cpp //
|
* @file eda_dde.cpp
|
||||||
///////////////////////
|
*/
|
||||||
|
|
||||||
#include "fctsys.h"
|
#include "fctsys.h"
|
||||||
#include "eda_dde.h"
|
#include "eda_dde.h"
|
||||||
|
@ -43,11 +43,12 @@ WinEDA_Server* CreateServer( wxWindow* window, int service )
|
||||||
addr.Service( service );
|
addr.Service( service );
|
||||||
|
|
||||||
server = new wxServer( addr );
|
server = new wxServer( addr );
|
||||||
|
|
||||||
if( server )
|
if( server )
|
||||||
{
|
{
|
||||||
server->SetNotify( wxSOCKET_CONNECTION_FLAG );
|
server->SetNotify( wxSOCKET_CONNECTION_FLAG );
|
||||||
server->SetEventHandler( *window, ID_EDA_SOCKET_EVENT_SERV );
|
server->SetEventHandler( *window, ID_EDA_SOCKET_EVENT_SERV );
|
||||||
server->Notify( TRUE );
|
server->Notify( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
return server;
|
return server;
|
||||||
|
@ -65,14 +66,17 @@ void EDA_DRAW_FRAME::OnSockRequest( wxSocketEvent& evt )
|
||||||
{
|
{
|
||||||
case wxSOCKET_INPUT:
|
case wxSOCKET_INPUT:
|
||||||
sock->Read( client_ipc_buffer, 1 );
|
sock->Read( client_ipc_buffer, 1 );
|
||||||
|
|
||||||
if( sock->LastCount() == 0 )
|
if( sock->LastCount() == 0 )
|
||||||
break; // No data, occurs on opening connection
|
break; // No data, occurs on opening connection
|
||||||
|
|
||||||
sock->Read( client_ipc_buffer + 1, IPC_BUF_SIZE - 2 );
|
sock->Read( client_ipc_buffer + 1, IPC_BUF_SIZE - 2 );
|
||||||
len = 1 + sock->LastCount();
|
len = 1 + sock->LastCount();
|
||||||
client_ipc_buffer[len] = 0;
|
client_ipc_buffer[len] = 0;
|
||||||
|
|
||||||
if( RemoteFct )
|
if( RemoteFct )
|
||||||
RemoteFct( client_ipc_buffer );
|
RemoteFct( client_ipc_buffer );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case wxSOCKET_LOST:
|
case wxSOCKET_LOST:
|
||||||
|
@ -94,10 +98,11 @@ void EDA_DRAW_FRAME::OnSockRequestServer( wxSocketEvent& evt )
|
||||||
wxSocketServer* server = (wxSocketServer*) evt.GetSocket();
|
wxSocketServer* server = (wxSocketServer*) evt.GetSocket();
|
||||||
|
|
||||||
sock2 = server->Accept();
|
sock2 = server->Accept();
|
||||||
|
|
||||||
if( sock2 == NULL )
|
if( sock2 == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sock2->Notify( TRUE );
|
sock2->Notify( true );
|
||||||
sock2->SetEventHandler( *this, ID_EDA_SOCKET_EVENT );
|
sock2->SetEventHandler( *this, ID_EDA_SOCKET_EVENT );
|
||||||
sock2->SetNotify( wxSOCKET_INPUT_FLAG | wxSOCKET_LOST_FLAG );
|
sock2->SetNotify( wxSOCKET_INPUT_FLAG | wxSOCKET_LOST_FLAG );
|
||||||
}
|
}
|
||||||
|
@ -117,7 +122,7 @@ void EDA_DRAW_FRAME::OnSockRequestServer( wxSocketEvent& evt )
|
||||||
bool SendCommand( int service, const char* cmdline )
|
bool SendCommand( int service, const char* cmdline )
|
||||||
{
|
{
|
||||||
wxSocketClient* sock_client;
|
wxSocketClient* sock_client;
|
||||||
bool success = FALSE;
|
bool success = false;
|
||||||
wxIPV4address addr;
|
wxIPV4address addr;
|
||||||
|
|
||||||
// Create a connexion
|
// Create a connexion
|
||||||
|
@ -176,12 +181,12 @@ bool SendCommand( int service, const char* cmdline )
|
||||||
|
|
||||||
sock_client = new wxSocketClient();
|
sock_client = new wxSocketClient();
|
||||||
sock_client->SetTimeout( 2 ); // Time out in Seconds
|
sock_client->SetTimeout( 2 ); // Time out in Seconds
|
||||||
sock_client->Connect( addr, FALSE );
|
sock_client->Connect( addr, false );
|
||||||
sock_client->WaitOnConnect( 0, 100 );
|
sock_client->WaitOnConnect( 0, 100 );
|
||||||
|
|
||||||
if( sock_client->Ok() && sock_client->IsConnected() )
|
if( sock_client->Ok() && sock_client->IsConnected() )
|
||||||
{
|
{
|
||||||
success = TRUE;
|
success = true;
|
||||||
sock_client->SetFlags( wxSOCKET_NOWAIT /*wxSOCKET_WAITALL*/ );
|
sock_client->SetFlags( wxSOCKET_NOWAIT /*wxSOCKET_WAITALL*/ );
|
||||||
sock_client->Write( cmdline, strlen( cmdline ) );
|
sock_client->Write( cmdline, strlen( cmdline ) );
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/***************/
|
/**
|
||||||
/* eda_doc.cpp */
|
* @file eda_doc.cpp
|
||||||
/***************/
|
*/
|
||||||
|
|
||||||
#include "fctsys.h"
|
#include "fctsys.h"
|
||||||
#include "appl_wxstruct.h"
|
#include "appl_wxstruct.h"
|
||||||
|
@ -14,24 +14,18 @@
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
|
|
||||||
|
|
||||||
/* Read from Common config the Pdf browser choice
|
|
||||||
*/
|
|
||||||
void EDA_APP::ReadPdfBrowserInfos()
|
void EDA_APP::ReadPdfBrowserInfos()
|
||||||
{
|
{
|
||||||
wxASSERT( m_EDA_CommonConfig != NULL );
|
wxASSERT( m_EDA_CommonConfig != NULL );
|
||||||
|
|
||||||
m_PdfBrowserIsDefault =
|
m_PdfBrowserIsDefault = m_EDA_CommonConfig->Read( wxT( "PdfBrowserIsDefault" ), true );
|
||||||
m_EDA_CommonConfig->Read( wxT( "PdfBrowserIsDefault" ), true );
|
m_PdfBrowser = m_EDA_CommonConfig->Read( wxT( "PdfBrowserName" ), wxEmptyString );
|
||||||
m_PdfBrowser = m_EDA_CommonConfig->Read( wxT( "PdfBrowserName" ),
|
|
||||||
wxEmptyString );
|
|
||||||
|
|
||||||
if( m_PdfBrowser.IsEmpty() )
|
if( m_PdfBrowser.IsEmpty() )
|
||||||
m_PdfBrowserIsDefault = true;
|
m_PdfBrowserIsDefault = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Write into Common config the Pdf browser choice
|
|
||||||
*/
|
|
||||||
void EDA_APP::WritePdfBrowserInfos()
|
void EDA_APP::WritePdfBrowserInfos()
|
||||||
{
|
{
|
||||||
wxASSERT( m_EDA_CommonConfig != NULL );
|
wxASSERT( m_EDA_CommonConfig != NULL );
|
||||||
|
@ -39,8 +33,7 @@ void EDA_APP::WritePdfBrowserInfos()
|
||||||
if( m_PdfBrowser.IsEmpty() )
|
if( m_PdfBrowser.IsEmpty() )
|
||||||
m_PdfBrowserIsDefault = true;
|
m_PdfBrowserIsDefault = true;
|
||||||
|
|
||||||
m_EDA_CommonConfig->Write( wxT( "PdfBrowserIsDefault" ),
|
m_EDA_CommonConfig->Write( wxT( "PdfBrowserIsDefault" ), m_PdfBrowserIsDefault );
|
||||||
m_PdfBrowserIsDefault );
|
|
||||||
m_EDA_CommonConfig->Write( wxT( "PdfBrowserName" ), m_PdfBrowser );
|
m_EDA_CommonConfig->Write( wxT( "PdfBrowserName" ), m_PdfBrowser );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,16 +61,6 @@ static const wxFileTypeInfo EDAfallbacks[] =
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function GetAssociatedDocument
|
|
||||||
* open a document (file) with the suitable browser
|
|
||||||
* @param aFrame = main frame
|
|
||||||
* if DocName is starting by http: or ftp: or www. the default internet
|
|
||||||
* browser is launched
|
|
||||||
* @param aDocName = filename of file to open (Full filename or short filename)
|
|
||||||
* @param aPaths = a wxPathList to explore.
|
|
||||||
* if NULL or aDocName is a full filename, aPath is not used.
|
|
||||||
*/
|
|
||||||
bool GetAssociatedDocument( wxFrame* aFrame,
|
bool GetAssociatedDocument( wxFrame* aFrame,
|
||||||
const wxString& aDocName,
|
const wxString& aDocName,
|
||||||
const wxPathList* aPaths)
|
const wxPathList* aPaths)
|
||||||
|
@ -86,23 +69,23 @@ bool GetAssociatedDocument( wxFrame* aFrame,
|
||||||
wxString docname, fullfilename, file_ext;
|
wxString docname, fullfilename, file_ext;
|
||||||
wxString msg;
|
wxString msg;
|
||||||
wxString command;
|
wxString command;
|
||||||
bool success = FALSE;
|
bool success = false;
|
||||||
|
|
||||||
// Is an internet url
|
// Is an internet url
|
||||||
static const wxString url_header[3] = { wxT( "http:" ), wxT( "ftp:" ),
|
static const wxString url_header[3] = { wxT( "http:" ), wxT( "ftp:" ), wxT( "www." ) };
|
||||||
wxT( "www." ) };
|
|
||||||
|
|
||||||
for( int ii = 0; ii < 3; ii++ )
|
for( int ii = 0; ii < 3; ii++ )
|
||||||
{
|
{
|
||||||
if( aDocName.First( url_header[ii] ) == 0 ) //. seems an internet url
|
if( aDocName.First( url_header[ii] ) == 0 ) //. seems an internet url
|
||||||
{
|
{
|
||||||
wxLaunchDefaultBrowser( aDocName );
|
wxLaunchDefaultBrowser( aDocName );
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
docname = aDocName;
|
docname = aDocName;
|
||||||
#ifdef __WINDOWS__
|
|
||||||
|
#ifdef __WINDOWS__
|
||||||
docname.Replace( UNIX_STRING_DIR_SEP, WIN_STRING_DIR_SEP );
|
docname.Replace( UNIX_STRING_DIR_SEP, WIN_STRING_DIR_SEP );
|
||||||
#else
|
#else
|
||||||
docname.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP );
|
docname.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP );
|
||||||
|
@ -139,10 +122,10 @@ bool GetAssociatedDocument( wxFrame* aFrame,
|
||||||
mask,
|
mask,
|
||||||
aFrame,
|
aFrame,
|
||||||
wxFD_OPEN,
|
wxFD_OPEN,
|
||||||
TRUE,
|
true,
|
||||||
wxPoint( -1, -1 ) );
|
wxPoint( -1, -1 ) );
|
||||||
if( fullfilename.IsEmpty() )
|
if( fullfilename.IsEmpty() )
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !wxFileExists( fullfilename ) )
|
if( !wxFileExists( fullfilename ) )
|
||||||
|
@ -150,11 +133,12 @@ bool GetAssociatedDocument( wxFrame* aFrame,
|
||||||
msg = _( "Doc File " );
|
msg = _( "Doc File " );
|
||||||
msg << wxT("\"") << aDocName << wxT("\"") << _( " not found" );
|
msg << wxT("\"") << aDocName << wxT("\"") << _( " not found" );
|
||||||
DisplayError( aFrame, msg );
|
DisplayError( aFrame, msg );
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxFileName CurrentFileName( fullfilename );
|
wxFileName CurrentFileName( fullfilename );
|
||||||
file_ext = CurrentFileName.GetExt();
|
file_ext = CurrentFileName.GetExt();
|
||||||
|
|
||||||
if( file_ext == wxT( "pdf" ) )
|
if( file_ext == wxT( "pdf" ) )
|
||||||
{
|
{
|
||||||
success = OpenPDF( fullfilename );
|
success = OpenPDF( fullfilename );
|
||||||
|
@ -182,14 +166,14 @@ bool GetAssociatedDocument( wxFrame* aFrame,
|
||||||
|
|
||||||
success = filetype->GetOpenCommand( &command, params );
|
success = filetype->GetOpenCommand( &command, params );
|
||||||
delete filetype;
|
delete filetype;
|
||||||
|
|
||||||
if( success )
|
if( success )
|
||||||
success = ProcessExecute( command );
|
success = ProcessExecute( command );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !success )
|
if( !success )
|
||||||
{
|
{
|
||||||
msg.Printf( _( "Unknown MIME type for doc file <%s>" ),
|
msg.Printf( _( "Unknown MIME type for doc file <%s>" ), GetChars( fullfilename ) );
|
||||||
GetChars( fullfilename ) );
|
|
||||||
DisplayError( aFrame, msg );
|
DisplayError( aFrame, msg );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -197,13 +181,6 @@ bool GetAssociatedDocument( wxFrame* aFrame,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Search if the text Database found all the words in the KeyList.
|
|
||||||
* Give articles in keylist (keylist = Following Keywords
|
|
||||||
* Separated by spaces
|
|
||||||
* Returns:
|
|
||||||
* 0 if no keyword found
|
|
||||||
* 1 if keyword found
|
|
||||||
*/
|
|
||||||
int KeyWordOk( const wxString& KeyList, const wxString& Database )
|
int KeyWordOk( const wxString& KeyList, const wxString& Database )
|
||||||
{
|
{
|
||||||
wxString KeysCopy, DataList;
|
wxString KeysCopy, DataList;
|
||||||
|
@ -226,6 +203,7 @@ int KeyWordOk( const wxString& KeyList, const wxString& Database )
|
||||||
while( Data.HasMoreTokens() )
|
while( Data.HasMoreTokens() )
|
||||||
{
|
{
|
||||||
wxString word = Data.GetNextToken();
|
wxString word = Data.GetNextToken();
|
||||||
|
|
||||||
if( word == Key )
|
if( word == Key )
|
||||||
return 1; // Key found !
|
return 1; // Key found !
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,20 +114,6 @@ static wxString s_KicadBinaryPathList[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function MakeReducedFileName
|
|
||||||
* Calculate the "reduced" filename from
|
|
||||||
* @param fullfilename = full filename
|
|
||||||
* @param default_path = default path
|
|
||||||
* @param default_ext = default extension
|
|
||||||
*
|
|
||||||
* @return the "reduced" filename, i.e.:
|
|
||||||
* without path if it is default_path
|
|
||||||
* with ./ if the path is the current path
|
|
||||||
* without extension if extension is default_ext
|
|
||||||
*
|
|
||||||
* the new flename is in unix like notation ('/' as path separator)
|
|
||||||
*/
|
|
||||||
wxString MakeReducedFileName( const wxString& fullfilename,
|
wxString MakeReducedFileName( const wxString& fullfilename,
|
||||||
const wxString& default_path,
|
const wxString& default_path,
|
||||||
const wxString& default_ext )
|
const wxString& default_ext )
|
||||||
|
@ -140,8 +126,10 @@ wxString MakeReducedFileName( const wxString& fullfilename,
|
||||||
path = wxPathOnly( reduced_filename ) + UNIX_STRING_DIR_SEP;
|
path = wxPathOnly( reduced_filename ) + UNIX_STRING_DIR_SEP;
|
||||||
reduced_filename.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP );
|
reduced_filename.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP );
|
||||||
Cwd.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP );
|
Cwd.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP );
|
||||||
|
|
||||||
if( Cwd.Last() != '/' )
|
if( Cwd.Last() != '/' )
|
||||||
Cwd += UNIX_STRING_DIR_SEP;
|
Cwd += UNIX_STRING_DIR_SEP;
|
||||||
|
|
||||||
path.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP );
|
path.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP );
|
||||||
|
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WINDOWS__
|
||||||
|
@ -154,6 +142,7 @@ wxString MakeReducedFileName( const wxString& fullfilename,
|
||||||
|
|
||||||
// if the path is "default_path" -> remove it
|
// if the path is "default_path" -> remove it
|
||||||
wxString root_path = path.Left( Cwd.Length() );
|
wxString root_path = path.Left( Cwd.Length() );
|
||||||
|
|
||||||
if( root_path == Cwd )
|
if( root_path == Cwd )
|
||||||
{
|
{
|
||||||
reduced_filename.Remove( 0, Cwd.Length() );
|
reduced_filename.Remove( 0, Cwd.Length() );
|
||||||
|
@ -165,6 +154,7 @@ wxString MakeReducedFileName( const wxString& fullfilename,
|
||||||
Cwd.MakeLower();
|
Cwd.MakeLower();
|
||||||
#endif
|
#endif
|
||||||
Cwd.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP );
|
Cwd.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP );
|
||||||
|
|
||||||
if( path == Cwd )
|
if( path == Cwd )
|
||||||
{ // the path is the current path -> path = "./"
|
{ // the path is the current path -> path = "./"
|
||||||
reduced_filename.Remove( 0, Cwd.Length() );
|
reduced_filename.Remove( 0, Cwd.Length() );
|
||||||
|
@ -181,28 +171,22 @@ wxString MakeReducedFileName( const wxString& fullfilename,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function AddDelimiterString
|
|
||||||
* Add un " to the start and the end of string (if not already done).
|
|
||||||
* @param string = string to modify
|
|
||||||
*/
|
|
||||||
void AddDelimiterString( wxString& string )
|
void AddDelimiterString( wxString& string )
|
||||||
{
|
{
|
||||||
wxString text;
|
wxString text;
|
||||||
|
|
||||||
if( !string.StartsWith( wxT( "\"" ) ) )
|
if( !string.StartsWith( wxT( "\"" ) ) )
|
||||||
text = wxT( "\"" );
|
text = wxT( "\"" );
|
||||||
|
|
||||||
text += string;
|
text += string;
|
||||||
|
|
||||||
if( (text.Last() != '"' ) || (text.length() <= 1) )
|
if( (text.Last() != '"' ) || (text.length() <= 1) )
|
||||||
text += wxT( "\"" );
|
text += wxT( "\"" );
|
||||||
|
|
||||||
string = text;
|
string = text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************/
|
|
||||||
/* Selection Directory dialog box: */
|
|
||||||
/***********************************/
|
|
||||||
|
|
||||||
bool EDA_DirectorySelector( const wxString& Title,
|
bool EDA_DirectorySelector( const wxString& Title,
|
||||||
wxString& Path,
|
wxString& Path,
|
||||||
int flag,
|
int flag,
|
||||||
|
@ -210,7 +194,7 @@ bool EDA_DirectorySelector( const wxString& Title,
|
||||||
const wxPoint& Pos )
|
const wxPoint& Pos )
|
||||||
{
|
{
|
||||||
int ii;
|
int ii;
|
||||||
bool selected = FALSE;
|
bool selected = false;
|
||||||
|
|
||||||
wxDirDialog* DirFrame = new wxDirDialog( Frame,
|
wxDirDialog* DirFrame = new wxDirDialog( Frame,
|
||||||
wxString( Title ),
|
wxString( Title ),
|
||||||
|
@ -219,10 +203,11 @@ bool EDA_DirectorySelector( const wxString& Title,
|
||||||
Pos );
|
Pos );
|
||||||
|
|
||||||
ii = DirFrame->ShowModal();
|
ii = DirFrame->ShowModal();
|
||||||
|
|
||||||
if( ii == wxID_OK )
|
if( ii == wxID_OK )
|
||||||
{
|
{
|
||||||
Path = DirFrame->GetPath();
|
Path = DirFrame->GetPath();
|
||||||
selected = TRUE;
|
selected = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
DirFrame->Destroy();
|
DirFrame->Destroy();
|
||||||
|
@ -230,16 +215,6 @@ bool EDA_DirectorySelector( const wxString& Title,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Selection file dialog box:
|
|
||||||
* Dialog title
|
|
||||||
* Default path
|
|
||||||
* default filename
|
|
||||||
* default filename extension
|
|
||||||
* filter for filename list
|
|
||||||
* parent frame
|
|
||||||
* wxFD_SAVE, wxFD_OPEN ..
|
|
||||||
* true = keep the current path
|
|
||||||
*/
|
|
||||||
wxString EDA_FileSelector( const wxString& Title,
|
wxString EDA_FileSelector( const wxString& Title,
|
||||||
const wxString& Path,
|
const wxString& Path,
|
||||||
const wxString& FileName,
|
const wxString& FileName,
|
||||||
|
@ -258,6 +233,7 @@ wxString EDA_FileSelector( const wxString& Title,
|
||||||
|
|
||||||
defaultname.Replace( wxT( "/" ), STRING_DIR_SEP );
|
defaultname.Replace( wxT( "/" ), STRING_DIR_SEP );
|
||||||
defaultpath.Replace( wxT( "/" ), STRING_DIR_SEP );
|
defaultpath.Replace( wxT( "/" ), STRING_DIR_SEP );
|
||||||
|
|
||||||
if( defaultpath.IsEmpty() )
|
if( defaultpath.IsEmpty() )
|
||||||
defaultpath = wxGetCwd();
|
defaultpath = wxGetCwd();
|
||||||
|
|
||||||
|
@ -289,37 +265,18 @@ wxString EDA_FileSelector( const wxString& Title,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function FindKicadHelpPath
|
|
||||||
* Find an absolute path for KiCad "help" (or "help/<language>")
|
|
||||||
* Find path kicad/doc/help/xx/ or kicad/doc/help/:
|
|
||||||
* from BinDir
|
|
||||||
* else from environment variable KICAD
|
|
||||||
* else from one of s_HelpPathList
|
|
||||||
* typically c:/kicad/doc/help or /usr/share/kicad/help
|
|
||||||
* or /usr/local/share/kicad/help
|
|
||||||
* (must have kicad in path name)
|
|
||||||
*
|
|
||||||
* xx = iso639-1 language id (2 letters (generic) or 4 letters):
|
|
||||||
* fr = french (or fr_FR)
|
|
||||||
* en = English (or en_GB or en_US ...)
|
|
||||||
* de = deutch
|
|
||||||
* es = spanish
|
|
||||||
* pt = portuguese (or pt_BR ...)
|
|
||||||
*
|
|
||||||
* default = en (if not found = fr)
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
wxString FindKicadHelpPath()
|
wxString FindKicadHelpPath()
|
||||||
{
|
{
|
||||||
wxString FullPath, LangFullPath, tmp;
|
wxString FullPath, LangFullPath, tmp;
|
||||||
wxString LocaleString;
|
wxString LocaleString;
|
||||||
bool PathFound = FALSE;
|
bool PathFound = false;
|
||||||
|
|
||||||
/* find kicad/help/ */
|
/* find kicad/help/ */
|
||||||
tmp = wxGetApp().m_BinDir;
|
tmp = wxGetApp().m_BinDir;
|
||||||
|
|
||||||
if( tmp.Last() == '/' )
|
if( tmp.Last() == '/' )
|
||||||
tmp.RemoveLast();
|
tmp.RemoveLast();
|
||||||
|
|
||||||
FullPath = tmp.BeforeLast( '/' ); // cd ..
|
FullPath = tmp.BeforeLast( '/' ); // cd ..
|
||||||
FullPath += wxT( "/doc/help/" );
|
FullPath += wxT( "/doc/help/" );
|
||||||
LocaleString = wxGetApp().m_Locale->GetCanonicalName();
|
LocaleString = wxGetApp().m_Locale->GetCanonicalName();
|
||||||
|
@ -331,44 +288,54 @@ wxString FindKicadHelpPath()
|
||||||
if( path_tmp.Contains( wxT( "kicad" ) ) )
|
if( path_tmp.Contains( wxT( "kicad" ) ) )
|
||||||
{
|
{
|
||||||
if( wxDirExists( FullPath ) )
|
if( wxDirExists( FullPath ) )
|
||||||
PathFound = TRUE;
|
PathFound = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* find kicad/help/ from environment variable KICAD */
|
/* find kicad/help/ from environment variable KICAD */
|
||||||
if( !PathFound && wxGetApp().m_Env_Defined )
|
if( !PathFound && wxGetApp().m_Env_Defined )
|
||||||
{
|
{
|
||||||
FullPath = wxGetApp().m_KicadEnv + wxT( "/doc/help/" );
|
FullPath = wxGetApp().m_KicadEnv + wxT( "/doc/help/" );
|
||||||
|
|
||||||
if( wxDirExists( FullPath ) )
|
if( wxDirExists( FullPath ) )
|
||||||
PathFound = TRUE;
|
PathFound = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* find kicad/help/ from "s_HelpPathList" */
|
/* find kicad/help/ from "s_HelpPathList" */
|
||||||
int ii = 0;
|
int ii = 0;
|
||||||
|
|
||||||
while( !PathFound )
|
while( !PathFound )
|
||||||
{
|
{
|
||||||
FullPath = s_HelpPathList[ii++];
|
FullPath = s_HelpPathList[ii++];
|
||||||
|
|
||||||
if( FullPath == wxT( "end_list" ) )
|
if( FullPath == wxT( "end_list" ) )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if( wxDirExists( FullPath ) )
|
if( wxDirExists( FullPath ) )
|
||||||
PathFound = TRUE;
|
PathFound = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( PathFound )
|
if( PathFound )
|
||||||
{
|
{
|
||||||
LangFullPath = FullPath + LocaleString + UNIX_STRING_DIR_SEP;
|
LangFullPath = FullPath + LocaleString + UNIX_STRING_DIR_SEP;
|
||||||
|
|
||||||
if( wxDirExists( LangFullPath ) )
|
if( wxDirExists( LangFullPath ) )
|
||||||
return LangFullPath;
|
return LangFullPath;
|
||||||
|
|
||||||
LangFullPath = FullPath + LocaleString.Left( 2 ) + UNIX_STRING_DIR_SEP;
|
LangFullPath = FullPath + LocaleString.Left( 2 ) + UNIX_STRING_DIR_SEP;
|
||||||
|
|
||||||
if( wxDirExists( LangFullPath ) )
|
if( wxDirExists( LangFullPath ) )
|
||||||
return LangFullPath;
|
return LangFullPath;
|
||||||
|
|
||||||
LangFullPath = FullPath + wxT( "en/" );
|
LangFullPath = FullPath + wxT( "en/" );
|
||||||
|
|
||||||
if( wxDirExists( LangFullPath ) )
|
if( wxDirExists( LangFullPath ) )
|
||||||
|
{
|
||||||
return LangFullPath;
|
return LangFullPath;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LangFullPath = FullPath + wxT( "fr/" );
|
LangFullPath = FullPath + wxT( "fr/" );
|
||||||
|
|
||||||
if( wxDirExists( LangFullPath ) )
|
if( wxDirExists( LangFullPath ) )
|
||||||
return LangFullPath;
|
return LangFullPath;
|
||||||
}
|
}
|
||||||
|
@ -378,17 +345,6 @@ wxString FindKicadHelpPath()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Search the executable file shortname in KiCad binary path
|
|
||||||
* and return full file name if found or shortname
|
|
||||||
* kicad binary path is
|
|
||||||
* kicad/bin
|
|
||||||
*
|
|
||||||
* kicad binary path is found from:
|
|
||||||
* BinDir
|
|
||||||
* or environment variable KICAD
|
|
||||||
* or (default) c:\kicad or /usr/local/kicad
|
|
||||||
* or default binary path
|
|
||||||
*/
|
|
||||||
wxString FindKicadFile( const wxString& shortname )
|
wxString FindKicadFile( const wxString& shortname )
|
||||||
{
|
{
|
||||||
wxString FullFileName;
|
wxString FullFileName;
|
||||||
|
@ -397,15 +353,17 @@ wxString FindKicadFile( const wxString& shortname )
|
||||||
* the KiCad binary path.
|
* the KiCad binary path.
|
||||||
*/
|
*/
|
||||||
FullFileName = wxGetApp().m_BinDir + shortname;
|
FullFileName = wxGetApp().m_BinDir + shortname;
|
||||||
|
|
||||||
if( wxFileExists( FullFileName ) )
|
if( wxFileExists( FullFileName ) )
|
||||||
return FullFileName;
|
return FullFileName;
|
||||||
|
|
||||||
/* Test the presence of the file in the directory shortname
|
/* Test the presence of the file in the directory shortname
|
||||||
* defined by the environment variable KiCAD.
|
* defined by the environment variable KiCad.
|
||||||
*/
|
*/
|
||||||
if( wxGetApp().m_Env_Defined )
|
if( wxGetApp().m_Env_Defined )
|
||||||
{
|
{
|
||||||
FullFileName = wxGetApp().m_KicadEnv + shortname;
|
FullFileName = wxGetApp().m_KicadEnv + shortname;
|
||||||
|
|
||||||
if( wxFileExists( FullFileName ) )
|
if( wxFileExists( FullFileName ) )
|
||||||
return FullFileName;
|
return FullFileName;
|
||||||
}
|
}
|
||||||
|
@ -414,11 +372,14 @@ wxString FindKicadFile( const wxString& shortname )
|
||||||
* /usr/local/kicad/linux or c:/kicad/winexe
|
* /usr/local/kicad/linux or c:/kicad/winexe
|
||||||
* (see s_KicadDataPathList) */
|
* (see s_KicadDataPathList) */
|
||||||
int ii = 0;
|
int ii = 0;
|
||||||
|
|
||||||
while( 1 )
|
while( 1 )
|
||||||
{
|
{
|
||||||
if( s_KicadBinaryPathList[ii] == wxT( "end_list" ) )
|
if( s_KicadBinaryPathList[ii] == wxT( "end_list" ) )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
FullFileName = s_KicadBinaryPathList[ii++] + shortname;
|
FullFileName = s_KicadBinaryPathList[ii++] + shortname;
|
||||||
|
|
||||||
if( wxFileExists( FullFileName ) )
|
if( wxFileExists( FullFileName ) )
|
||||||
return FullFileName;
|
return FullFileName;
|
||||||
}
|
}
|
||||||
|
@ -427,10 +388,7 @@ wxString FindKicadFile( const wxString& shortname )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Call the executable file "ExecFile", with params "param"
|
int ExecuteFile( wxWindow* frame, const wxString& ExecFile, const wxString& param )
|
||||||
*/
|
|
||||||
int ExecuteFile( wxWindow* frame, const wxString& ExecFile,
|
|
||||||
const wxString& param )
|
|
||||||
{
|
{
|
||||||
wxString FullFileName;
|
wxString FullFileName;
|
||||||
|
|
||||||
|
@ -441,6 +399,7 @@ int ExecuteFile( wxWindow* frame, const wxString& ExecFile,
|
||||||
{
|
{
|
||||||
if( !param.IsEmpty() )
|
if( !param.IsEmpty() )
|
||||||
FullFileName += wxT( " " ) + param;
|
FullFileName += wxT( " " ) + param;
|
||||||
|
|
||||||
ProcessExecute( FullFileName );
|
ProcessExecute( FullFileName );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -452,26 +411,16 @@ int ExecuteFile( wxWindow* frame, const wxString& ExecFile,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Return data path common KiCad.
|
|
||||||
* If environment variable defined KiCAD (KiCAD = path to kicad)
|
|
||||||
* Returns <KICAD> /;
|
|
||||||
* Otherwise returns <path of binaries> / (if "kicad" is in the path name)
|
|
||||||
* Otherwise returns / usr / share / kicad /
|
|
||||||
*
|
|
||||||
* Note:
|
|
||||||
* The \ are replaced by / (a la Unix)
|
|
||||||
*/
|
|
||||||
wxString ReturnKicadDatasPath()
|
wxString ReturnKicadDatasPath()
|
||||||
{
|
{
|
||||||
bool PathFound = FALSE;
|
bool PathFound = false;
|
||||||
wxString data_path;
|
wxString data_path;
|
||||||
|
|
||||||
if( wxGetApp().m_Env_Defined ) // Path defined by the KICAD environment
|
if( wxGetApp().m_Env_Defined ) // Path defined by the KICAD environment variable.
|
||||||
// variable.
|
|
||||||
|
|
||||||
{
|
{
|
||||||
data_path = wxGetApp().m_KicadEnv;
|
data_path = wxGetApp().m_KicadEnv;
|
||||||
PathFound = TRUE;
|
PathFound = true;
|
||||||
}
|
}
|
||||||
else // Path of executables.
|
else // Path of executables.
|
||||||
{
|
{
|
||||||
|
@ -486,6 +435,7 @@ wxString ReturnKicadDatasPath()
|
||||||
#endif
|
#endif
|
||||||
if( tmp.Last() == '/' )
|
if( tmp.Last() == '/' )
|
||||||
tmp.RemoveLast();
|
tmp.RemoveLast();
|
||||||
|
|
||||||
data_path = tmp.BeforeLast( '/' ); // id cd ../
|
data_path = tmp.BeforeLast( '/' ); // id cd ../
|
||||||
data_path += UNIX_STRING_DIR_SEP;
|
data_path += UNIX_STRING_DIR_SEP;
|
||||||
|
|
||||||
|
@ -494,12 +444,15 @@ wxString ReturnKicadDatasPath()
|
||||||
// So we search for kicad/share/ first
|
// So we search for kicad/share/ first
|
||||||
wxString old_path = data_path;
|
wxString old_path = data_path;
|
||||||
data_path += wxT( "share/" );
|
data_path += wxT( "share/" );
|
||||||
|
|
||||||
if( wxDirExists( data_path ) )
|
if( wxDirExists( data_path ) )
|
||||||
PathFound = TRUE;
|
{
|
||||||
|
PathFound = true;
|
||||||
|
}
|
||||||
else if( wxDirExists( old_path ) )
|
else if( wxDirExists( old_path ) )
|
||||||
{
|
{
|
||||||
data_path = old_path;
|
data_path = old_path;
|
||||||
PathFound = TRUE;
|
PathFound = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -508,13 +461,16 @@ wxString ReturnKicadDatasPath()
|
||||||
* /usr/local/kicad/ or c:/kicad/
|
* /usr/local/kicad/ or c:/kicad/
|
||||||
* (see s_KicadDataPathList) */
|
* (see s_KicadDataPathList) */
|
||||||
int ii = 0;
|
int ii = 0;
|
||||||
|
|
||||||
while( !PathFound )
|
while( !PathFound )
|
||||||
{
|
{
|
||||||
if( s_KicadDataPathList[ii] == wxT( "end_list" ) )
|
if( s_KicadDataPathList[ii] == wxT( "end_list" ) )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
data_path = s_KicadDataPathList[ii++];
|
data_path = s_KicadDataPathList[ii++];
|
||||||
|
|
||||||
if( wxDirExists( data_path ) )
|
if( wxDirExists( data_path ) )
|
||||||
PathFound = TRUE;
|
PathFound = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( PathFound )
|
if( PathFound )
|
||||||
|
@ -574,12 +530,6 @@ wxString& EDA_APP::GetEditorName()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function OpenPDF
|
|
||||||
* run the PDF viewer and display a PDF file
|
|
||||||
* @param file = PDF file to open
|
|
||||||
* @return true is success, false if no PDF viewer found
|
|
||||||
*/
|
|
||||||
bool OpenPDF( const wxString& file )
|
bool OpenPDF( const wxString& file )
|
||||||
{
|
{
|
||||||
wxString command;
|
wxString command;
|
||||||
|
@ -588,6 +538,7 @@ bool OpenPDF( const wxString& file )
|
||||||
bool success = false;
|
bool success = false;
|
||||||
|
|
||||||
wxGetApp().ReadPdfBrowserInfos();
|
wxGetApp().ReadPdfBrowserInfos();
|
||||||
|
|
||||||
if( !wxGetApp().m_PdfBrowserIsDefault ) // Run the preferred PDF Browser
|
if( !wxGetApp().m_PdfBrowserIsDefault ) // Run the preferred PDF Browser
|
||||||
{
|
{
|
||||||
AddDelimiterString( filename );
|
AddDelimiterString( filename );
|
||||||
|
@ -598,8 +549,10 @@ bool OpenPDF( const wxString& file )
|
||||||
wxFileType* filetype = NULL;
|
wxFileType* filetype = NULL;
|
||||||
wxFileType::MessageParameters params( filename, type );
|
wxFileType::MessageParameters params( filename, type );
|
||||||
filetype = wxTheMimeTypesManager->GetFileTypeFromExtension( wxT( "pdf" ) );
|
filetype = wxTheMimeTypesManager->GetFileTypeFromExtension( wxT( "pdf" ) );
|
||||||
|
|
||||||
if( filetype )
|
if( filetype )
|
||||||
success = filetype->GetOpenCommand( &command, params );
|
success = filetype->GetOpenCommand( &command, params );
|
||||||
|
|
||||||
delete filetype;
|
delete filetype;
|
||||||
#ifndef __WINDOWS__
|
#ifndef __WINDOWS__
|
||||||
|
|
||||||
|
@ -611,6 +564,7 @@ bool OpenPDF( const wxString& file )
|
||||||
if( success && !command.IsEmpty() )
|
if( success && !command.IsEmpty() )
|
||||||
{
|
{
|
||||||
success = ProcessExecute( command );
|
success = ProcessExecute( command );
|
||||||
|
|
||||||
if( success )
|
if( success )
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
@ -654,6 +608,7 @@ bool OpenPDF( const wxString& file )
|
||||||
if( !command.IsEmpty() )
|
if( !command.IsEmpty() )
|
||||||
{
|
{
|
||||||
success = ProcessExecute( command );
|
success = ProcessExecute( command );
|
||||||
|
|
||||||
if( !success )
|
if( !success )
|
||||||
{
|
{
|
||||||
wxString msg = _( "Problem while running the PDF viewer" );
|
wxString msg = _( "Problem while running the PDF viewer" );
|
||||||
|
@ -682,14 +637,15 @@ void OpenFile( const wxString& file )
|
||||||
wxString ext, type;
|
wxString ext, type;
|
||||||
|
|
||||||
ext = CurrentFileName.GetExt();
|
ext = CurrentFileName.GetExt();
|
||||||
wxFileType* filetype =
|
wxFileType* filetype = wxTheMimeTypesManager->GetFileTypeFromExtension( ext );
|
||||||
wxTheMimeTypesManager->GetFileTypeFromExtension( ext );
|
|
||||||
|
|
||||||
bool success = false;
|
bool success = false;
|
||||||
|
|
||||||
wxFileType::MessageParameters params( filename, type );
|
wxFileType::MessageParameters params( filename, type );
|
||||||
|
|
||||||
if( filetype )
|
if( filetype )
|
||||||
success = filetype->GetOpenCommand( &command, params );
|
success = filetype->GetOpenCommand( &command, params );
|
||||||
|
|
||||||
delete filetype;
|
delete filetype;
|
||||||
|
|
||||||
if( success && !command.IsEmpty() )
|
if( success && !command.IsEmpty() )
|
||||||
|
|
|
@ -110,7 +110,7 @@ DLIST<TRACK> g_CurrentTrackList;
|
||||||
|
|
||||||
BOARD* g_ModuleEditor_Pcb = NULL;
|
BOARD* g_ModuleEditor_Pcb = NULL;
|
||||||
|
|
||||||
bool g_Zone_45_Only = FALSE;
|
bool g_Zone_45_Only = false;
|
||||||
|
|
||||||
// Default setting used when creating a new zone
|
// Default setting used when creating a new zone
|
||||||
ZONE_SETTING g_Zone_Default_Setting;
|
ZONE_SETTING g_Zone_Default_Setting;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*********************************************/
|
/**
|
||||||
/* string.cpp */
|
* @file string.cpp
|
||||||
/* some useful functions to handle strings */
|
* @brief Some useful functions to handle strings.
|
||||||
/*********************************************/
|
*/
|
||||||
|
|
||||||
#include "fctsys.h"
|
#include "fctsys.h"
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
|
@ -30,6 +30,7 @@ int ReadDelimitedText( wxString* aDest, const char* aSource )
|
||||||
if( cc == '\\' )
|
if( cc == '\\' )
|
||||||
{
|
{
|
||||||
cc = *aSource++;
|
cc = *aSource++;
|
||||||
|
|
||||||
if( !cc )
|
if( !cc )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -40,9 +41,11 @@ int ReadDelimitedText( wxString* aDest, const char* aSource )
|
||||||
utf8 += cc;
|
utf8 += cc;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
utf8 += cc;
|
utf8 += cc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
*aDest = FROM_UTF8( utf8.c_str() );
|
*aDest = FROM_UTF8( utf8.c_str() );
|
||||||
|
|
||||||
|
@ -75,6 +78,7 @@ int ReadDelimitedText( char* aDest, const char* aSource, int aDestSize )
|
||||||
if( cc == '\\' )
|
if( cc == '\\' )
|
||||||
{
|
{
|
||||||
cc = *aSource++;
|
cc = *aSource++;
|
||||||
|
|
||||||
if( !cc )
|
if( !cc )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -86,9 +90,11 @@ int ReadDelimitedText( char* aDest, const char* aSource, int aDestSize )
|
||||||
*aDest++ = cc;
|
*aDest++ = cc;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
*aDest++ = cc;
|
*aDest++ = cc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
*aDest = 0;
|
*aDest = 0;
|
||||||
|
|
||||||
|
@ -118,8 +124,10 @@ std::string EscapedUTF8( const wxString& aString )
|
||||||
ret += '\\';
|
ret += '\\';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
ret += *it;
|
ret += *it;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ret += '"';
|
ret += '"';
|
||||||
|
|
||||||
|
@ -127,9 +135,6 @@ std::string EscapedUTF8( const wxString& aString )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Remove leading and training spaces, tabs and end of line chars in text
|
|
||||||
* return a pointer on the first n char in text
|
|
||||||
*/
|
|
||||||
char* StrPurge( char* text )
|
char* StrPurge( char* text )
|
||||||
{
|
{
|
||||||
static const char whitespace[] = " \t\n\r\f\v";
|
static const char whitespace[] = " \t\n\r\f\v";
|
||||||
|
@ -149,168 +154,96 @@ char* StrPurge( char* text )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Read lines from File
|
|
||||||
* Skip void lines and comments (starting by #)
|
|
||||||
* return the first non void line.
|
|
||||||
* increments *LineNum for each line
|
|
||||||
*/
|
|
||||||
char* GetLine( FILE* File, char* Line, int* LineNum, int SizeLine )
|
char* GetLine( FILE* File, char* Line, int* LineNum, int SizeLine )
|
||||||
{
|
{
|
||||||
do {
|
do {
|
||||||
if( fgets( Line, SizeLine, File ) == NULL )
|
if( fgets( Line, SizeLine, File ) == NULL )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if( LineNum )
|
if( LineNum )
|
||||||
*LineNum += 1;
|
*LineNum += 1;
|
||||||
} while( Line[0] == '#' || Line[0] == '\n' || Line[0] == '\r'
|
|
||||||
|| Line[0] == 0 );
|
} while( Line[0] == '#' || Line[0] == '\n' || Line[0] == '\r' || Line[0] == 0 );
|
||||||
|
|
||||||
strtok( Line, "\n\r" );
|
strtok( Line, "\n\r" );
|
||||||
return Line;
|
return Line;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* return in aBuffer the date and time
|
|
||||||
* time is the local time.
|
|
||||||
*/
|
|
||||||
char* DateAndTime( char* aBuffer )
|
|
||||||
{
|
|
||||||
wxString datetime;
|
|
||||||
|
|
||||||
datetime = DateAndTime();
|
|
||||||
strcpy( aBuffer, TO_UTF8( datetime ) );
|
|
||||||
|
|
||||||
return aBuffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* return the date and time in a wxString
|
|
||||||
* note: does the same thing than strftime()
|
|
||||||
* time is the local time.
|
|
||||||
*/
|
|
||||||
wxString DateAndTime()
|
wxString DateAndTime()
|
||||||
{
|
{
|
||||||
wxString Line;
|
|
||||||
|
|
||||||
wxDateTime datetime = wxDateTime::Now();
|
wxDateTime datetime = wxDateTime::Now();
|
||||||
|
|
||||||
datetime.SetCountry( wxDateTime::Country_Default );
|
datetime.SetCountry( wxDateTime::Country_Default );
|
||||||
Line = datetime.Format( wxDefaultDateTimeFormat, wxDateTime::Local );
|
return datetime.Format( wxDefaultDateTimeFormat, wxDateTime::Local );
|
||||||
|
|
||||||
return Line;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
int StrNumCmp( const wxChar* aString1, const wxChar* aString2, int aLength, bool aIgnoreCase )
|
||||||
* sort() function
|
|
||||||
* Same as strncmp() but numbers in strings
|
|
||||||
* are compared according to the value, not the ascii value of each digit
|
|
||||||
*/
|
|
||||||
int StrLenNumCmp( const wxChar* str1, const wxChar* str2, int NbMax )
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int nb1 = 0, nb2 = 0;
|
int nb1 = 0, nb2 = 0;
|
||||||
|
|
||||||
if( ( str1 == NULL ) || ( str2 == NULL ) )
|
if( ( aString1 == NULL ) || ( aString2 == NULL ) )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
for( i = 0; i < NbMax; i++ )
|
for( i = 0; i < aLength; i++ )
|
||||||
{
|
{
|
||||||
if( isdigit( *str1 ) && isdigit( *str2 ) ) /* digit found */
|
if( isdigit( *aString1 ) && isdigit( *aString2 ) ) /* digit found */
|
||||||
{
|
{
|
||||||
nb1 = 0; nb2 = 0;
|
nb1 = 0;
|
||||||
while( isdigit( *str1 ) )
|
nb2 = 0;
|
||||||
|
|
||||||
|
while( isdigit( *aString1 ) )
|
||||||
{
|
{
|
||||||
nb1 = nb1 * 10 + *str1 - '0'; str1++;
|
nb1 = nb1 * 10 + *aString1 - '0';
|
||||||
|
aString1++;
|
||||||
}
|
}
|
||||||
|
|
||||||
while( isdigit( *str2 ) )
|
while( isdigit( *aString2 ) )
|
||||||
{
|
{
|
||||||
nb2 = nb2 * 10 + *str2 - '0'; str2++;
|
nb2 = nb2 * 10 + *aString2 - '0';
|
||||||
|
aString2++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( nb1 < nb2 )
|
if( nb1 < nb2 )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if( nb1 > nb2 )
|
if( nb1 > nb2 )
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( *str1 < *str2 )
|
if( aIgnoreCase )
|
||||||
|
{
|
||||||
|
if( toupper( *aString1 ) < toupper( *aString2 ) )
|
||||||
return -1;
|
return -1;
|
||||||
if( *str1 > *str2 )
|
|
||||||
|
if( toupper( *aString1 ) > toupper( *aString2 ) )
|
||||||
return 1;
|
return 1;
|
||||||
if( ( *str1 == 0 ) && ( *str2 == 0 ) )
|
|
||||||
|
if( ( *aString1 == 0 ) && ( *aString2 == 0 ) )
|
||||||
return 0;
|
return 0;
|
||||||
str1++; str2++;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( *aString1 < *aString2 )
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if( *aString1 > *aString2 )
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
if( ( *aString1 == 0 ) && ( *aString2 == 0 ) )
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
aString1++;
|
||||||
|
aString2++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* sort() function
|
|
||||||
* Same as stricmp() but numbers in strings
|
|
||||||
* are compared according to the value, not the ascii value of each digit
|
|
||||||
*/
|
|
||||||
int StrNumICmp( const wxChar* str1, const wxChar* str2 )
|
|
||||||
{
|
|
||||||
return StrLenNumICmp( str1, str2, 32735 );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* sort() function
|
|
||||||
* Same as strnicmp() but numbers in strings
|
|
||||||
* are compared according to the value, not the ascii value of each digit
|
|
||||||
*/
|
|
||||||
int StrLenNumICmp( const wxChar* str1, const wxChar* str2, int NbMax )
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
int nb1 = 0, nb2 = 0;
|
|
||||||
|
|
||||||
if( ( str1 == NULL ) || ( str2 == NULL ) )
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
for( i = 0; i < NbMax; i++ )
|
|
||||||
{
|
|
||||||
if( isdigit( *str1 ) && isdigit( *str2 ) ) /* find number */
|
|
||||||
{
|
|
||||||
nb1 = 0; nb2 = 0;
|
|
||||||
while( isdigit( *str1 ) )
|
|
||||||
{
|
|
||||||
nb1 = nb1 * 10 + *str1 - '0'; str1++;
|
|
||||||
}
|
|
||||||
|
|
||||||
while( isdigit( *str2 ) )
|
|
||||||
{
|
|
||||||
nb2 = nb2 * 10 + *str2 - '0'; str2++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( nb1 < nb2 )
|
|
||||||
return -1;
|
|
||||||
if( nb1 > nb2 )
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( toupper( *str1 ) < toupper( *str2 ) )
|
|
||||||
return -1;
|
|
||||||
if( toupper( *str1 ) > toupper( *str2 ) )
|
|
||||||
return 1;
|
|
||||||
if( (*str1 == 0 ) && ( *str2 == 0 ) )
|
|
||||||
return 0;
|
|
||||||
str1++; str2++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* compare a string to a pattern
|
|
||||||
* ( usual chars * and ? allowed).
|
|
||||||
* if case_sensitive == true, comparison is case sensitive
|
|
||||||
* return true if match else false
|
|
||||||
*/
|
|
||||||
bool WildCompareString( const wxString& pattern, const wxString& string_to_tst,
|
bool WildCompareString( const wxString& pattern, const wxString& string_to_tst,
|
||||||
bool case_sensitive )
|
bool case_sensitive )
|
||||||
{
|
{
|
||||||
|
@ -336,7 +269,8 @@ bool WildCompareString( const wxString& pattern, const wxString& string_to_tst,
|
||||||
while( ( *string ) && ( *wild != '*' ) )
|
while( ( *string ) && ( *wild != '*' ) )
|
||||||
{
|
{
|
||||||
if( ( *wild != *string ) && ( *wild != '?' ) )
|
if( ( *wild != *string ) && ( *wild != '?' ) )
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
wild++; string++;
|
wild++; string++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -370,16 +304,13 @@ bool WildCompareString( const wxString& pattern, const wxString& string_to_tst,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Converts a string used to compensate for internalization of printf().
|
|
||||||
* Generated floats with a comma instead of point.
|
|
||||||
* Obsolete: use SetLocaleTo_C_standard instead
|
|
||||||
*/
|
|
||||||
char* to_point( char* Text )
|
char* to_point( char* Text )
|
||||||
{
|
{
|
||||||
char* line = Text;
|
char* line = Text;
|
||||||
|
|
||||||
if( Text == NULL )
|
if( Text == NULL )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
for( ; *Text != 0; Text++ )
|
for( ; *Text != 0; Text++ )
|
||||||
{
|
{
|
||||||
if( *Text == ',' )
|
if( *Text == ',' )
|
||||||
|
@ -390,27 +321,6 @@ char* to_point( char* Text )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Convert string to upper case.
|
|
||||||
* Returns pointer to the converted string.
|
|
||||||
*/
|
|
||||||
char* strupper( char* Text )
|
|
||||||
{
|
|
||||||
char* code = Text;
|
|
||||||
|
|
||||||
if( Text )
|
|
||||||
{
|
|
||||||
while( *code )
|
|
||||||
{
|
|
||||||
if( ( *code >= 'a' ) && ( *code <= 'z' ) )
|
|
||||||
*code += 'A' - 'a';
|
|
||||||
code++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return Text;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int RefDesStringCompare( const wxString& strFWord, const wxString& strSWord )
|
int RefDesStringCompare( const wxString& strFWord, const wxString& strSWord )
|
||||||
{
|
{
|
||||||
// The different sections of the first string
|
// The different sections of the first string
|
||||||
|
@ -422,10 +332,8 @@ int RefDesStringCompare( const wxString& strFWord, const wxString& strSWord )
|
||||||
int isEqual = 0; // The numerical results of a string compare
|
int isEqual = 0; // The numerical results of a string compare
|
||||||
int iReturn = 0; // The variable that is being returned
|
int iReturn = 0; // The variable that is being returned
|
||||||
|
|
||||||
long lFirstDigit = 0; /* The converted middle section of the first
|
long lFirstDigit = 0; // The converted middle section of the first string
|
||||||
*string */
|
long lSecondDigit = 0; // The converted middle section of the second string
|
||||||
long lSecondDigit = 0; /* The converted middle section of the second
|
|
||||||
*string */
|
|
||||||
|
|
||||||
// Split the two strings into separate parts
|
// Split the two strings into separate parts
|
||||||
SplitString( strFWord, &strFWordBeg, &strFWordMid, &strFWordEnd );
|
SplitString( strFWord, &strFWordBeg, &strFWordMid, &strFWordEnd );
|
||||||
|
@ -482,6 +390,7 @@ int SplitString( wxString strToSplit,
|
||||||
|
|
||||||
// Starting at the end of the string look for the first digit
|
// Starting at the end of the string look for the first digit
|
||||||
int ii;
|
int ii;
|
||||||
|
|
||||||
for( ii = (strToSplit.length() - 1); ii >= 0; ii-- )
|
for( ii = (strToSplit.length() - 1); ii >= 0; ii-- )
|
||||||
{
|
{
|
||||||
if( isdigit( strToSplit[ii] ) )
|
if( isdigit( strToSplit[ii] ) )
|
||||||
|
@ -490,7 +399,9 @@ int SplitString( wxString strToSplit,
|
||||||
|
|
||||||
// If there were no digits then just set the single string
|
// If there were no digits then just set the single string
|
||||||
if( ii < 0 )
|
if( ii < 0 )
|
||||||
|
{
|
||||||
*strBeginning = strToSplit;
|
*strBeginning = strToSplit;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Since there is at least one digit this is the trailing string
|
// Since there is at least one digit this is the trailing string
|
||||||
|
@ -498,6 +409,7 @@ int SplitString( wxString strToSplit,
|
||||||
|
|
||||||
// Go to the end of the digits
|
// Go to the end of the digits
|
||||||
int position = ii + 1;
|
int position = ii + 1;
|
||||||
|
|
||||||
for( ; ii >= 0; ii-- )
|
for( ; ii >= 0; ii-- )
|
||||||
{
|
{
|
||||||
if( !isdigit( strToSplit[ii] ) )
|
if( !isdigit( strToSplit[ii] ) )
|
||||||
|
@ -509,7 +421,7 @@ int SplitString( wxString strToSplit,
|
||||||
*strDigits = strToSplit.substr( 0, position );
|
*strDigits = strToSplit.substr( 0, position );
|
||||||
|
|
||||||
/* We were only looking for the last set of digits everything else is
|
/* We were only looking for the last set of digits everything else is
|
||||||
*part of the preamble */
|
* part of the preamble */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*strDigits = strToSplit.substr( ii + 1, position - ii - 1 );
|
*strDigits = strToSplit.substr( ii + 1, position - ii - 1 );
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*******************/
|
/**
|
||||||
/* class_cvpcb.cpp */
|
* @file class_cvpcb.cpp
|
||||||
/*******************/
|
*/
|
||||||
|
|
||||||
#include "fctsys.h"
|
#include "fctsys.h"
|
||||||
#include "kicad_string.h"
|
#include "kicad_string.h"
|
||||||
|
@ -15,17 +15,19 @@ PIN::PIN()
|
||||||
m_Type = 0; /* Electrical type. */
|
m_Type = 0; /* Electrical type. */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool operator<( const PIN& item1, const PIN& item2 )
|
bool operator<( const PIN& item1, const PIN& item2 )
|
||||||
{
|
{
|
||||||
return ( StrLenNumICmp( item1.m_Number.GetData(),
|
return StrNumCmp( item1.m_Number, item2.m_Number, 4, true ) < 0;
|
||||||
item2.m_Number.GetData(), 4 ) < 0 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool operator==( const PIN& item1, const PIN& item2 )
|
bool operator==( const PIN& item1, const PIN& item2 )
|
||||||
{
|
{
|
||||||
return ( item1.m_Number == item2.m_Number );
|
return ( item1.m_Number == item2.m_Number );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool same_pin_number( const PIN* item1, const PIN* item2 )
|
bool same_pin_number( const PIN* item1, const PIN* item2 )
|
||||||
{
|
{
|
||||||
wxASSERT( item1 != NULL && item2 != NULL );
|
wxASSERT( item1 != NULL && item2 != NULL );
|
||||||
|
@ -33,6 +35,7 @@ bool same_pin_number( const PIN* item1, const PIN* item2 )
|
||||||
return ( item1->m_Number == item2->m_Number );
|
return ( item1->m_Number == item2->m_Number );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool same_pin_net( const PIN* item1, const PIN* item2 )
|
bool same_pin_net( const PIN* item1, const PIN* item2 )
|
||||||
{
|
{
|
||||||
wxASSERT( item1 != NULL && item2 != NULL );
|
wxASSERT( item1 != NULL && item2 != NULL );
|
||||||
|
@ -47,13 +50,13 @@ COMPONENT::COMPONENT()
|
||||||
m_Multi = 0;
|
m_Multi = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
COMPONENT::~COMPONENT()
|
COMPONENT::~COMPONENT()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool operator<( const COMPONENT& item1, const COMPONENT& item2 )
|
bool operator<( const COMPONENT& item1, const COMPONENT& item2 )
|
||||||
{
|
{
|
||||||
return ( StrNumICmp( item1.m_Reference.GetData(),
|
return StrNumCmp( item1.m_Reference, item2.m_Reference, INT_MAX, true ) < 0;
|
||||||
item2.m_Reference.GetData() ) < 0 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,6 @@ int CVPCB_MAINFRAME::SaveComponentList( const wxString& aFullFileName )
|
||||||
{
|
{
|
||||||
FILE* dest;
|
FILE* dest;
|
||||||
wxFileName fn( aFullFileName );
|
wxFileName fn( aFullFileName );
|
||||||
char Line[1024];
|
|
||||||
wxString Title = wxGetApp().GetTitle() + wxT( " " ) + GetBuildVersion();
|
wxString Title = wxGetApp().GetTitle() + wxT( " " ) + GetBuildVersion();
|
||||||
|
|
||||||
fn.SetExt( ComponentFileExtension );
|
fn.SetExt( ComponentFileExtension );
|
||||||
|
@ -38,7 +37,7 @@ int CVPCB_MAINFRAME::SaveComponentList( const wxString& aFullFileName )
|
||||||
|
|
||||||
fprintf( dest, "%s", EnteteCmpMod );
|
fprintf( dest, "%s", EnteteCmpMod );
|
||||||
fprintf( dest, " Created by %s", TO_UTF8( Title ) );
|
fprintf( dest, " Created by %s", TO_UTF8( Title ) );
|
||||||
fprintf( dest, " date = %s\n", DateAndTime( Line ) );
|
fprintf( dest, " date = %s\n", TO_UTF8( DateAndTime() ) );
|
||||||
|
|
||||||
BOOST_FOREACH( COMPONENT& component, m_components )
|
BOOST_FOREACH( COMPONENT& component, m_components )
|
||||||
{
|
{
|
||||||
|
|
|
@ -67,14 +67,11 @@ static void RemoveDuplicatePins( COMPONENT& component )
|
||||||
int CVPCB_MAINFRAME::GenNetlistPcbnew( FILE* file,bool isEESchemaNetlist )
|
int CVPCB_MAINFRAME::GenNetlistPcbnew( FILE* file,bool isEESchemaNetlist )
|
||||||
{
|
{
|
||||||
#define NETLIST_HEAD_STRING "EESchema Netlist Version 1.1"
|
#define NETLIST_HEAD_STRING "EESchema Netlist Version 1.1"
|
||||||
char Line[1024];
|
|
||||||
|
|
||||||
DateAndTime( Line );
|
|
||||||
|
|
||||||
if( isEESchemaNetlist )
|
if( isEESchemaNetlist )
|
||||||
fprintf( file, "# %s created %s\n(\n", NETLIST_HEAD_STRING, Line );
|
fprintf( file, "# %s created %s\n(\n", NETLIST_HEAD_STRING, TO_UTF8( DateAndTime() ) );
|
||||||
else
|
else
|
||||||
fprintf( file, "( { netlist created %s }\n", Line );
|
fprintf( file, "( { netlist created %s }\n", TO_UTF8( DateAndTime() ) );
|
||||||
|
|
||||||
|
|
||||||
BOOST_FOREACH( COMPONENT& component, m_components )
|
BOOST_FOREACH( COMPONENT& component, m_components )
|
||||||
|
@ -83,7 +80,6 @@ int CVPCB_MAINFRAME::GenNetlistPcbnew( FILE* file,bool isEESchemaNetlist )
|
||||||
|
|
||||||
if( !component.m_Module.IsEmpty() )
|
if( !component.m_Module.IsEmpty() )
|
||||||
fprintf( file, "%s", TO_UTF8( component.m_Module ) );
|
fprintf( file, "%s", TO_UTF8( component.m_Module ) );
|
||||||
|
|
||||||
else
|
else
|
||||||
fprintf( file, "$noname$" );
|
fprintf( file, "$noname$" );
|
||||||
|
|
||||||
|
@ -97,9 +93,7 @@ int CVPCB_MAINFRAME::GenNetlistPcbnew( FILE* file,bool isEESchemaNetlist )
|
||||||
BOOST_FOREACH( PIN& pin, component.m_Pins )
|
BOOST_FOREACH( PIN& pin, component.m_Pins )
|
||||||
{
|
{
|
||||||
if( !pin.m_Net.IsEmpty() )
|
if( !pin.m_Net.IsEmpty() )
|
||||||
fprintf( file, " ( %s %s )\n",
|
fprintf( file, " ( %s %s )\n", TO_UTF8( pin.m_Number ), TO_UTF8( pin.m_Net ) );
|
||||||
TO_UTF8( pin.m_Number ),
|
|
||||||
TO_UTF8( pin.m_Net ) );
|
|
||||||
else
|
else
|
||||||
fprintf( file, " ( %s ? )\n", TO_UTF8( pin.m_Number ) );
|
fprintf( file, " ( %s ? )\n", TO_UTF8( pin.m_Number ) );
|
||||||
}
|
}
|
||||||
|
|
|
@ -721,11 +721,10 @@ bool LIB_COMPONENT::Load( LINE_READER& aLineReader, wxString& aErrorMsg )
|
||||||
/* Copy part name and prefix. */
|
/* Copy part name and prefix. */
|
||||||
LIB_FIELD& value = GetValueField();
|
LIB_FIELD& value = GetValueField();
|
||||||
|
|
||||||
strupper( componentName );
|
|
||||||
|
|
||||||
if( componentName[0] != '~' )
|
if( componentName[0] != '~' )
|
||||||
{
|
{
|
||||||
m_name = value.m_Text = FROM_UTF8( componentName );
|
m_name = value.m_Text = FROM_UTF8( componentName );
|
||||||
|
m_name = value.m_Text = m_name.MakeUpper();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -772,9 +772,7 @@ bool CMP_LIBRARY::SaveDocFile( const wxString& aFullFileName )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
char line[256];
|
if( fprintf( docfile, "%s Date: %s\n", DOCFILE_IDENT, TO_UTF8( DateAndTime() ) ) < 0 )
|
||||||
|
|
||||||
if( fprintf( docfile, "%s Date: %s\n", DOCFILE_IDENT, DateAndTime( line ) ) < 0 )
|
|
||||||
{
|
{
|
||||||
fclose( docfile );
|
fclose( docfile );
|
||||||
return false;
|
return false;
|
||||||
|
@ -799,12 +797,8 @@ bool CMP_LIBRARY::SaveDocFile( const wxString& aFullFileName )
|
||||||
|
|
||||||
bool CMP_LIBRARY::SaveHeader( OUTPUTFORMATTER& aFormatter )
|
bool CMP_LIBRARY::SaveHeader( OUTPUTFORMATTER& aFormatter )
|
||||||
{
|
{
|
||||||
char BufLine[1024];
|
|
||||||
|
|
||||||
DateAndTime( BufLine );
|
|
||||||
|
|
||||||
aFormatter.Print( 0, "%s %d.%d Date: %s\n", LIBFILE_IDENT,
|
aFormatter.Print( 0, "%s %d.%d Date: %s\n", LIBFILE_IDENT,
|
||||||
LIB_VERSION_MAJOR, LIB_VERSION_MINOR, BufLine );
|
LIB_VERSION_MAJOR, LIB_VERSION_MINOR, TO_UTF8( DateAndTime() ) );
|
||||||
|
|
||||||
aFormatter.Print( 0, "#encoding utf-8\n");
|
aFormatter.Print( 0, "#encoding utf-8\n");
|
||||||
|
|
||||||
|
|
|
@ -460,7 +460,6 @@ void DIALOG_BUILD_BOM::GenereListeOfItems( const wxString& aFullFileName,
|
||||||
{
|
{
|
||||||
FILE* f;
|
FILE* f;
|
||||||
int itemCount;
|
int itemCount;
|
||||||
char Line[1024];
|
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
if( ( f = wxFopen( aFullFileName, wxT( "wt" ) ) ) == NULL )
|
if( ( f = wxFopen( aFullFileName, wxT( "wt" ) ) ) == NULL )
|
||||||
|
@ -481,11 +480,9 @@ void DIALOG_BUILD_BOM::GenereListeOfItems( const wxString& aFullFileName,
|
||||||
if( itemCount )
|
if( itemCount )
|
||||||
{
|
{
|
||||||
// creates the list file
|
// creates the list file
|
||||||
DateAndTime( Line );
|
|
||||||
|
|
||||||
wxString Title = wxGetApp().GetAppName() + wxT( " " ) + GetBuildVersion();
|
wxString Title = wxGetApp().GetAppName() + wxT( " " ) + GetBuildVersion();
|
||||||
|
|
||||||
fprintf( f, "%s >> Creation date: %s\n", TO_UTF8( Title ), Line );
|
fprintf( f, "%s >> Creation date: %s\n", TO_UTF8( Title ), TO_UTF8( DateAndTime() ) );
|
||||||
|
|
||||||
// sort component list
|
// sort component list
|
||||||
cmplist.SortByReferenceOnly();
|
cmplist.SortByReferenceOnly();
|
||||||
|
|
|
@ -103,9 +103,7 @@ bool LIB_EDIT_FRAME::LoadComponentFromCurrentLib( LIB_ALIAS* aLibEntry )
|
||||||
|
|
||||||
GetScreen()->ClearUndoRedoList();
|
GetScreen()->ClearUndoRedoList();
|
||||||
Zoom_Automatique( false );
|
Zoom_Automatique( false );
|
||||||
DrawPanel->Refresh();
|
|
||||||
SetShowDeMorgan( m_component->HasConversion() );
|
SetShowDeMorgan( m_component->HasConversion() );
|
||||||
m_HToolBar->Refresh();
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -646,14 +646,11 @@ static XNODE* node( const wxString& aName, const wxString& aTextualContent = wxE
|
||||||
XNODE* EXPORT_HELP::makeGenericDesignHeader()
|
XNODE* EXPORT_HELP::makeGenericDesignHeader()
|
||||||
{
|
{
|
||||||
XNODE* xdesign = node( wxT("design") );
|
XNODE* xdesign = node( wxT("design") );
|
||||||
char date[128];
|
|
||||||
|
|
||||||
DateAndTime( date );
|
|
||||||
|
|
||||||
// the root sheet is a special sheet, call it source
|
// the root sheet is a special sheet, call it source
|
||||||
xdesign->AddChild( node( wxT( "source" ), g_RootSheet->GetScreen()->GetFileName() ) );
|
xdesign->AddChild( node( wxT( "source" ), g_RootSheet->GetScreen()->GetFileName() ) );
|
||||||
|
|
||||||
xdesign->AddChild( node( wxT( "date" ), FROM_UTF8( date )) );
|
xdesign->AddChild( node( wxT( "date" ), DateAndTime() ) );
|
||||||
|
|
||||||
// which Eeschema tool
|
// which Eeschema tool
|
||||||
xdesign->AddChild( node( wxT( "tool" ), wxGetApp().GetAppName() + wxChar(' ') +
|
xdesign->AddChild( node( wxT( "tool" ), wxGetApp().GetAppName() + wxChar(' ') +
|
||||||
|
@ -1193,7 +1190,6 @@ bool EXPORT_HELP::WriteGENERICNetList( const wxString& aOutFileName )
|
||||||
bool EXPORT_HELP::WriteNetListPspice( FILE* f, bool use_netnames, bool aUsePrefix )
|
bool EXPORT_HELP::WriteNetListPspice( FILE* f, bool use_netnames, bool aUsePrefix )
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
char line[1024];
|
|
||||||
int nbitems;
|
int nbitems;
|
||||||
wxString text;
|
wxString text;
|
||||||
wxArrayString spiceCommandAtBeginFile;
|
wxArrayString spiceCommandAtBeginFile;
|
||||||
|
@ -1208,9 +1204,8 @@ bool EXPORT_HELP::WriteNetListPspice( FILE* f, bool use_netnames, bool aUsePrefi
|
||||||
wxString delimeters = wxT( "{:,; }" );
|
wxString delimeters = wxT( "{:,; }" );
|
||||||
wxString disableStr = wxT( "N" );
|
wxString disableStr = wxT( "N" );
|
||||||
|
|
||||||
DateAndTime( line );
|
ret |= fprintf( f, "* %s (Spice format) creation date: %s\n\n",
|
||||||
|
NETLIST_HEAD_STRING, TO_UTF8( DateAndTime() ) );
|
||||||
ret |= fprintf( f, "* %s (Spice format) creation date: %s\n\n", NETLIST_HEAD_STRING, line );
|
|
||||||
|
|
||||||
// Prepare list of nets generation (not used here, but...
|
// Prepare list of nets generation (not used here, but...
|
||||||
for( unsigned ii = 0; ii < g_NetObjectslist.size(); ii++ )
|
for( unsigned ii = 0; ii < g_NetObjectslist.size(); ii++ )
|
||||||
|
@ -1236,16 +1231,19 @@ bool EXPORT_HELP::WriteNetListPspice( FILE* f, bool use_netnames, bool aUsePrefi
|
||||||
SCH_TEXT* drawText = (SCH_TEXT*) item;
|
SCH_TEXT* drawText = (SCH_TEXT*) item;
|
||||||
|
|
||||||
text = drawText->m_Text;
|
text = drawText->m_Text;
|
||||||
|
|
||||||
if( text.IsEmpty() )
|
if( text.IsEmpty() )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ident = text.GetChar( 0 );
|
ident = text.GetChar( 0 );
|
||||||
|
|
||||||
if( ident != '.' && ident != '-' && ident != '+' )
|
if( ident != '.' && ident != '-' && ident != '+' )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
text.Remove( 0, 1 ); // Remove the first char.
|
text.Remove( 0, 1 ); // Remove the first char.
|
||||||
text.Remove( 6 ); // text contains 6 char.
|
text.Remove( 6 ); // text contains 6 char.
|
||||||
text.MakeLower();
|
text.MakeLower();
|
||||||
|
|
||||||
if( ( text == wxT( "pspice" ) ) || ( text == wxT( "gnucap" ) ) )
|
if( ( text == wxT( "pspice" ) ) || ( text == wxT( "gnucap" ) ) )
|
||||||
{
|
{
|
||||||
// Put the Y position as an ascii string, for sort by vertical
|
// Put the Y position as an ascii string, for sort by vertical
|
||||||
|
@ -1484,18 +1482,17 @@ bool EXPORT_HELP::WriteNetListPCBNEW( FILE* f, bool with_pcbnew )
|
||||||
{
|
{
|
||||||
wxString field;
|
wxString field;
|
||||||
wxString footprint;
|
wxString footprint;
|
||||||
char dateBuf[256];
|
|
||||||
int ret = 0; // zero now, OR in the sign bit on error
|
int ret = 0; // zero now, OR in the sign bit on error
|
||||||
wxString netName;
|
wxString netName;
|
||||||
|
|
||||||
std::vector< SCH_REFERENCE > cmpList;
|
std::vector< SCH_REFERENCE > cmpList;
|
||||||
|
|
||||||
DateAndTime( dateBuf );
|
|
||||||
|
|
||||||
if( with_pcbnew )
|
if( with_pcbnew )
|
||||||
ret |= fprintf( f, "# %s created %s\n(\n", NETLIST_HEAD_STRING, dateBuf );
|
ret |= fprintf( f, "# %s created %s\n(\n",
|
||||||
|
NETLIST_HEAD_STRING, TO_UTF8( DateAndTime() ) );
|
||||||
else
|
else
|
||||||
ret |= fprintf( f, "( { %s created %s }\n", NETLIST_HEAD_STRING, dateBuf );
|
ret |= fprintf( f, "( { %s created %s }\n",
|
||||||
|
NETLIST_HEAD_STRING, TO_UTF8( DateAndTime() ) );
|
||||||
|
|
||||||
// Prepare list of nets generation
|
// Prepare list of nets generation
|
||||||
for( unsigned ii = 0; ii < g_NetObjectslist.size(); ii++ )
|
for( unsigned ii = 0; ii < g_NetObjectslist.size(); ii++ )
|
||||||
|
@ -1860,15 +1857,13 @@ void EXPORT_HELP::WriteNetListCADSTAR( FILE* f )
|
||||||
wxString StartCmpDesc = StartLine + wxT( "ADD_COM" );
|
wxString StartCmpDesc = StartLine + wxT( "ADD_COM" );
|
||||||
wxString msg;
|
wxString msg;
|
||||||
wxString footprint;
|
wxString footprint;
|
||||||
char Line[1024];
|
|
||||||
SCH_SHEET_PATH* sheet;
|
SCH_SHEET_PATH* sheet;
|
||||||
EDA_ITEM* DrawList;
|
EDA_ITEM* DrawList;
|
||||||
SCH_COMPONENT* Component;
|
SCH_COMPONENT* Component;
|
||||||
wxString Title = wxGetApp().GetAppName() + wxT( " " ) + GetBuildVersion();
|
wxString Title = wxGetApp().GetAppName() + wxT( " " ) + GetBuildVersion();
|
||||||
|
|
||||||
fprintf( f, "%sHEA\n", TO_UTF8( StartLine ) );
|
fprintf( f, "%sHEA\n", TO_UTF8( StartLine ) );
|
||||||
DateAndTime( Line );
|
fprintf( f, "%sTIM %s\n", TO_UTF8( StartLine ), TO_UTF8( DateAndTime() ) );
|
||||||
fprintf( f, "%sTIM %s\n", TO_UTF8( StartLine ), Line );
|
|
||||||
fprintf( f, "%sAPP ", TO_UTF8( StartLine ) );
|
fprintf( f, "%sAPP ", TO_UTF8( StartLine ) );
|
||||||
fprintf( f, "\"%s\"\n", TO_UTF8( Title ) );
|
fprintf( f, "\"%s\"\n", TO_UTF8( Title ) );
|
||||||
fprintf( f, "\n" );
|
fprintf( f, "\n" );
|
||||||
|
@ -1887,6 +1882,7 @@ void EXPORT_HELP::WriteNetListCADSTAR( FILE* f )
|
||||||
for( DrawList = sheet->LastDrawList(); DrawList != NULL; DrawList = DrawList->Next() )
|
for( DrawList = sheet->LastDrawList(); DrawList != NULL; DrawList = DrawList->Next() )
|
||||||
{
|
{
|
||||||
DrawList = Component = findNextComponentAndCreatePinList( DrawList, sheet );
|
DrawList = Component = findNextComponentAndCreatePinList( DrawList, sheet );
|
||||||
|
|
||||||
if( Component == NULL )
|
if( Component == NULL )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,7 @@ private:
|
||||||
void cleanBoard();
|
void cleanBoard();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
GBR_TO_PCB_EXPORTER::GBR_TO_PCB_EXPORTER( GERBVIEW_FRAME * aFrame, FILE * aFile )
|
GBR_TO_PCB_EXPORTER::GBR_TO_PCB_EXPORTER( GERBVIEW_FRAME * aFrame, FILE * aFile )
|
||||||
{
|
{
|
||||||
m_gerbview_frame = aFrame;
|
m_gerbview_frame = aFrame;
|
||||||
|
@ -53,13 +54,13 @@ GBR_TO_PCB_EXPORTER::GBR_TO_PCB_EXPORTER( GERBVIEW_FRAME * aFrame, FILE * aFile
|
||||||
m_pcb = new BOARD( NULL, m_gerbview_frame );
|
m_pcb = new BOARD( NULL, m_gerbview_frame );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GBR_TO_PCB_EXPORTER::~GBR_TO_PCB_EXPORTER()
|
GBR_TO_PCB_EXPORTER::~GBR_TO_PCB_EXPORTER()
|
||||||
{
|
{
|
||||||
delete m_pcb;
|
delete m_pcb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Export data in Pcbnew format
|
/* Export data in Pcbnew format
|
||||||
* remember Pcbnew uses a Y reversed axis, so we must negate all Y coordinates
|
* remember Pcbnew uses a Y reversed axis, so we must negate all Y coordinates
|
||||||
*/
|
*/
|
||||||
|
@ -73,6 +74,7 @@ void GERBVIEW_FRAME::ExportDataInPcbnewFormat( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
if( g_GERBER_List[ii] != NULL )
|
if( g_GERBER_List[ii] != NULL )
|
||||||
no_used_layers = false;
|
no_used_layers = false;
|
||||||
|
|
||||||
ii++;
|
ii++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,6 +108,7 @@ void GERBVIEW_FRAME::ExportDataInPcbnewFormat( wxCommandEvent& event )
|
||||||
LAYERS_MAP_DIALOG* dlg = new LAYERS_MAP_DIALOG( this );
|
LAYERS_MAP_DIALOG* dlg = new LAYERS_MAP_DIALOG( this );
|
||||||
int ok = dlg->ShowModal();
|
int ok = dlg->ShowModal();
|
||||||
dlg->Destroy();
|
dlg->Destroy();
|
||||||
|
|
||||||
if( ok != wxID_OK )
|
if( ok != wxID_OK )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -116,17 +119,20 @@ void GERBVIEW_FRAME::ExportDataInPcbnewFormat( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
FILE * file = wxFopen( FullFileName, wxT( "wt" ) );
|
FILE * file = wxFopen( FullFileName, wxT( "wt" ) );
|
||||||
|
|
||||||
if( file == NULL )
|
if( file == NULL )
|
||||||
{
|
{
|
||||||
msg = _( "Unable to create " ) + FullFileName;
|
msg = _( "Unable to create " ) + FullFileName;
|
||||||
DisplayError( this, msg );
|
DisplayError( this, msg );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GBR_TO_PCB_EXPORTER gbr_exporter( this, file );
|
GBR_TO_PCB_EXPORTER gbr_exporter( this, file );
|
||||||
gbr_exporter.ExportPcb( dlg->GetLayersLookUpTable() );
|
gbr_exporter.ExportPcb( dlg->GetLayersLookUpTable() );
|
||||||
fclose( file );
|
fclose( file );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GBR_TO_PCB_EXPORTER::cleanBoard()
|
void GBR_TO_PCB_EXPORTER::cleanBoard()
|
||||||
{
|
{
|
||||||
// delete redundant vias
|
// delete redundant vias
|
||||||
|
@ -138,9 +144,11 @@ void GBR_TO_PCB_EXPORTER::cleanBoard()
|
||||||
// Search and delete others vias
|
// Search and delete others vias
|
||||||
TRACK* next_track;
|
TRACK* next_track;
|
||||||
TRACK* alt_track = track->Next();
|
TRACK* alt_track = track->Next();
|
||||||
|
|
||||||
for( ; alt_track; alt_track = next_track )
|
for( ; alt_track; alt_track = next_track )
|
||||||
{
|
{
|
||||||
next_track = alt_track->Next();
|
next_track = alt_track->Next();
|
||||||
|
|
||||||
if( alt_track->m_Shape != VIA_THROUGH )
|
if( alt_track->m_Shape != VIA_THROUGH )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -154,6 +162,7 @@ void GBR_TO_PCB_EXPORTER::cleanBoard()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool GBR_TO_PCB_EXPORTER::WriteSetup( )
|
bool GBR_TO_PCB_EXPORTER::WriteSetup( )
|
||||||
{
|
{
|
||||||
fprintf( m_file, "$SETUP\n" );
|
fprintf( m_file, "$SETUP\n" );
|
||||||
|
@ -172,11 +181,13 @@ bool GBR_TO_PCB_EXPORTER::WriteGeneralDescrPcb( )
|
||||||
|
|
||||||
/* Print the copper layer count */
|
/* Print the copper layer count */
|
||||||
nbLayers = m_pcb->GetCopperLayerCount();
|
nbLayers = m_pcb->GetCopperLayerCount();
|
||||||
|
|
||||||
if( nbLayers <= 1 ) // Minimal layers count in Pcbnew is 2
|
if( nbLayers <= 1 ) // Minimal layers count in Pcbnew is 2
|
||||||
{
|
{
|
||||||
nbLayers = 2;
|
nbLayers = 2;
|
||||||
m_pcb->SetCopperLayerCount(2);
|
m_pcb->SetCopperLayerCount(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf( m_file, "$GENERAL\n" );
|
fprintf( m_file, "$GENERAL\n" );
|
||||||
fprintf( m_file, "encoding utf-8\n");
|
fprintf( m_file, "encoding utf-8\n");
|
||||||
fprintf( m_file, "LayerCount %d\n", nbLayers );
|
fprintf( m_file, "LayerCount %d\n", nbLayers );
|
||||||
|
@ -201,22 +212,22 @@ bool GBR_TO_PCB_EXPORTER::WriteGeneralDescrPcb( )
|
||||||
*/
|
*/
|
||||||
bool GBR_TO_PCB_EXPORTER::ExportPcb( int* LayerLookUpTable )
|
bool GBR_TO_PCB_EXPORTER::ExportPcb( int* LayerLookUpTable )
|
||||||
{
|
{
|
||||||
char line[256];
|
|
||||||
BOARD* gerberPcb = m_gerbview_frame->GetBoard();
|
BOARD* gerberPcb = m_gerbview_frame->GetBoard();
|
||||||
|
|
||||||
// create an image of gerber data
|
// create an image of gerber data
|
||||||
BOARD_ITEM* item = gerberPcb->m_Drawings;
|
BOARD_ITEM* item = gerberPcb->m_Drawings;
|
||||||
|
|
||||||
for( ; item; item = item->Next() )
|
for( ; item; item = item->Next() )
|
||||||
{
|
{
|
||||||
GERBER_DRAW_ITEM* gerb_item = (GERBER_DRAW_ITEM*) item;
|
GERBER_DRAW_ITEM* gerb_item = (GERBER_DRAW_ITEM*) item;
|
||||||
int layer = gerb_item->GetLayer();
|
int layer = gerb_item->GetLayer();
|
||||||
int pcb_layer_number = LayerLookUpTable[layer];
|
int pcb_layer_number = LayerLookUpTable[layer];
|
||||||
|
|
||||||
if( pcb_layer_number < 0 || pcb_layer_number > LAST_NO_COPPER_LAYER )
|
if( pcb_layer_number < 0 || pcb_layer_number > LAST_NO_COPPER_LAYER )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( pcb_layer_number > LAST_COPPER_LAYER )
|
if( pcb_layer_number > LAST_COPPER_LAYER )
|
||||||
export_non_copper_item( gerb_item, pcb_layer_number );
|
export_non_copper_item( gerb_item, pcb_layer_number );
|
||||||
|
|
||||||
else
|
else
|
||||||
export_copper_item( gerb_item, pcb_layer_number );
|
export_copper_item( gerb_item, pcb_layer_number );
|
||||||
}
|
}
|
||||||
|
@ -228,7 +239,7 @@ bool GBR_TO_PCB_EXPORTER::ExportPcb( int* LayerLookUpTable )
|
||||||
|
|
||||||
// write PCB header
|
// write PCB header
|
||||||
fprintf( m_file, "PCBNEW-BOARD Version %d date %s\n\n", g_CurrentVersionPCB,
|
fprintf( m_file, "PCBNEW-BOARD Version %d date %s\n\n", g_CurrentVersionPCB,
|
||||||
DateAndTime( line ) );
|
TO_UTF8( DateAndTime() ) );
|
||||||
WriteGeneralDescrPcb( );
|
WriteGeneralDescrPcb( );
|
||||||
WriteSetup( );
|
WriteSetup( );
|
||||||
|
|
||||||
|
@ -273,6 +284,7 @@ void GBR_TO_PCB_EXPORTER::export_non_copper_item( GERBER_DRAW_ITEM* aGbrItem, in
|
||||||
m_pcb->Add( drawitem );
|
m_pcb->Add( drawitem );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GBR_TO_PCB_EXPORTER::export_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aLayer )
|
void GBR_TO_PCB_EXPORTER::export_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aLayer )
|
||||||
{
|
{
|
||||||
switch( aGbrItem->m_Shape )
|
switch( aGbrItem->m_Shape )
|
||||||
|
@ -294,6 +306,7 @@ void GBR_TO_PCB_EXPORTER::export_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GBR_TO_PCB_EXPORTER::export_segline_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aLayer )
|
void GBR_TO_PCB_EXPORTER::export_segline_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aLayer )
|
||||||
{
|
{
|
||||||
TRACK * newtrack = new TRACK( m_pcb );
|
TRACK * newtrack = new TRACK( m_pcb );
|
||||||
|
@ -309,6 +322,7 @@ void GBR_TO_PCB_EXPORTER::export_segline_copper_item( GERBER_DRAW_ITEM* aGbrItem
|
||||||
m_pcb->Add( newtrack );
|
m_pcb->Add( newtrack );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GBR_TO_PCB_EXPORTER::export_segarc_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aLayer )
|
void GBR_TO_PCB_EXPORTER::export_segarc_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aLayer )
|
||||||
{
|
{
|
||||||
double a = atan2( (double)( aGbrItem->m_Start.y - aGbrItem->m_ArcCentre.y ),
|
double a = atan2( (double)( aGbrItem->m_Start.y - aGbrItem->m_ArcCentre.y ),
|
||||||
|
@ -323,12 +337,15 @@ void GBR_TO_PCB_EXPORTER::export_segarc_copper_item( GERBER_DRAW_ITEM* aGbrItem,
|
||||||
* approximate arc by segments (16 segment per 360 deg)
|
* approximate arc by segments (16 segment per 360 deg)
|
||||||
*/
|
*/
|
||||||
#define DELTA 3600/16
|
#define DELTA 3600/16
|
||||||
|
|
||||||
if( arc_angle < 0 )
|
if( arc_angle < 0 )
|
||||||
{
|
{
|
||||||
NEGATE( arc_angle );
|
NEGATE( arc_angle );
|
||||||
EXCHG( start, end );
|
EXCHG( start, end );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPoint curr_start = start;
|
wxPoint curr_start = start;
|
||||||
|
|
||||||
for( int rot = DELTA; rot < (arc_angle - DELTA); rot += DELTA )
|
for( int rot = DELTA; rot < (arc_angle - DELTA); rot += DELTA )
|
||||||
{
|
{
|
||||||
TRACK * newtrack = new TRACK( m_pcb );
|
TRACK * newtrack = new TRACK( m_pcb );
|
||||||
|
@ -344,6 +361,7 @@ void GBR_TO_PCB_EXPORTER::export_segarc_copper_item( GERBER_DRAW_ITEM* aGbrItem,
|
||||||
m_pcb->Add( newtrack );
|
m_pcb->Add( newtrack );
|
||||||
curr_start = curr_end;
|
curr_start = curr_end;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( end != curr_start )
|
if( end != curr_start )
|
||||||
{
|
{
|
||||||
TRACK * newtrack = new TRACK( m_pcb );
|
TRACK * newtrack = new TRACK( m_pcb );
|
||||||
|
|
|
@ -53,7 +53,7 @@ public:
|
||||||
|
|
||||||
wxString m_BinDir; /* KiCad executable path.*/
|
wxString m_BinDir; /* KiCad executable path.*/
|
||||||
wxString m_KicadEnv; /* environment variable KICAD */
|
wxString m_KicadEnv; /* environment variable KICAD */
|
||||||
bool m_Env_Defined; // TRUE if environment KICAD is defined.
|
bool m_Env_Defined; // true if environment KICAD is defined.
|
||||||
|
|
||||||
wxLocale* m_Locale; // The current locale.
|
wxLocale* m_Locale; // The current locale.
|
||||||
int m_LanguageId; // The current language setting.
|
int m_LanguageId; // The current language setting.
|
||||||
|
@ -169,7 +169,7 @@ public: EDA_APP();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function WriteProjectConfig
|
* Function WriteProjectConfig
|
||||||
* Save the current "projet" parameters
|
* Save the current "project" parameters
|
||||||
* saved parameters are parameters that have the .m_Setup member set to false
|
* saved parameters are parameters that have the .m_Setup member set to false
|
||||||
* saving file is the .pro file project
|
* saving file is the .pro file project
|
||||||
*/
|
*/
|
||||||
|
@ -202,7 +202,7 @@ public: EDA_APP();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function ReadProjectConfig
|
* Function ReadProjectConfig
|
||||||
* Read the current "projet" parameters
|
* Read the current "project" parameters
|
||||||
* Parameters are parameters that have the .m_Setup member set to false
|
* Parameters are parameters that have the .m_Setup member set to false
|
||||||
* read file is the .pro file project
|
* read file is the .pro file project
|
||||||
*
|
*
|
||||||
|
@ -237,7 +237,15 @@ public: EDA_APP();
|
||||||
const wxString& GroupName,
|
const wxString& GroupName,
|
||||||
bool ForceUseLocalConfig );
|
bool ForceUseLocalConfig );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function ReadPdfBrowserInfos
|
||||||
|
* read the PDF browser choice from the common configuration.
|
||||||
|
*/
|
||||||
void ReadPdfBrowserInfos();
|
void ReadPdfBrowserInfos();
|
||||||
|
|
||||||
|
/* Function WritePdfBrowserInfos
|
||||||
|
* save the PDF browser choice to the common configuration.
|
||||||
|
*/
|
||||||
void WritePdfBrowserInfos();
|
void WritePdfBrowserInfos();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -113,10 +113,10 @@ public:
|
||||||
* view position (upper left corner of device)
|
* view position (upper left corner of device)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool m_Center; /* Center on screen. If TRUE (0.0) is centered
|
bool m_Center; /* Center on screen. If true (0.0) is centered
|
||||||
* on screen coordinates can be < 0 and
|
* on screen coordinates can be < 0 and
|
||||||
* > 0 except for schematics.
|
* > 0 except for schematics.
|
||||||
* FALSE: when coordinates can only be >= 0
|
* false: when coordinates can only be >= 0
|
||||||
* Schematic */
|
* Schematic */
|
||||||
bool m_FirstRedraw;
|
bool m_FirstRedraw;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/******************************
|
/**
|
||||||
* drawpanel.h:
|
* @file class_drawpanel.h:
|
||||||
* define class EDA_DRAW_PANEL
|
* @brief EDA_DRAW_PANEL class definition.
|
||||||
*************************************/
|
*/
|
||||||
|
|
||||||
#ifndef PANEL_WXSTRUCT_H
|
#ifndef PANEL_WXSTRUCT_H
|
||||||
#define PANEL_WXSTRUCT_H
|
#define PANEL_WXSTRUCT_H
|
||||||
|
@ -43,13 +43,13 @@ public:
|
||||||
int m_scrollIncrementY; // Y axis scroll increment in pixels per unit.
|
int m_scrollIncrementY; // Y axis scroll increment in pixels per unit.
|
||||||
|
|
||||||
bool m_AbortRequest; // Flag to abort long commands
|
bool m_AbortRequest; // Flag to abort long commands
|
||||||
bool m_AbortEnable; // TRUE if abort button or menu to be displayed
|
bool m_AbortEnable; // true if abort button or menu to be displayed
|
||||||
|
|
||||||
bool m_AutoPAN_Enable; // TRUE to allow auto pan
|
bool m_AutoPAN_Enable; // true to allow auto pan
|
||||||
bool m_AutoPAN_Request; // TRUE to request an auto pan (will be made only if
|
bool m_AutoPAN_Request; // true to request an auto pan (will be made only if
|
||||||
// m_AutoPAN_Enable = true)
|
// m_AutoPAN_Enable = true)
|
||||||
int m_IgnoreMouseEvents; // when non-zero (true), then ignore mouse events
|
int m_IgnoreMouseEvents; // when non-zero (true), then ignore mouse events
|
||||||
bool m_Block_Enable; // TRUE to accept Block Commands
|
bool m_Block_Enable; // true to accept Block Commands
|
||||||
|
|
||||||
// useful to avoid false start block in certain cases
|
// useful to avoid false start block in certain cases
|
||||||
// (like switch from a sheet to an other sheet
|
// (like switch from a sheet to an other sheet
|
||||||
|
|
|
@ -137,7 +137,7 @@ extern wxString g_ProductName;
|
||||||
/* Default user lib path can be left void, if the standard lib path is used */
|
/* Default user lib path can be left void, if the standard lib path is used */
|
||||||
extern wxString g_UserLibDirBuffer;
|
extern wxString g_UserLibDirBuffer;
|
||||||
|
|
||||||
extern bool g_ShowPageLimits; // TRUE to display the page limits
|
extern bool g_ShowPageLimits; // true to display the page limits
|
||||||
|
|
||||||
/* File name extension definitions. */
|
/* File name extension definitions. */
|
||||||
extern const wxString ProjectFileExtension;
|
extern const wxString ProjectFileExtension;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* This file is part of the common libary
|
* This file is part of the common library
|
||||||
* @file confirm.h
|
* @file confirm.h
|
||||||
* @see common.h
|
* @see common.h
|
||||||
*/
|
*/
|
||||||
|
@ -9,16 +9,37 @@
|
||||||
#define __INCLUDE__CONFIRM_H__ 1
|
#define __INCLUDE__CONFIRM_H__ 1
|
||||||
|
|
||||||
|
|
||||||
void DisplayError( wxWindow* parent, const wxString& msg,
|
/**
|
||||||
int displaytime = 0 );
|
* Function DisplayError
|
||||||
void DisplayInfoMessage( wxWindow* parent, const wxString& msg,
|
* displays an error or warning message box with \a aMessage.
|
||||||
int displaytime = 0 );
|
*
|
||||||
|
* @warning Setting \a displaytime does not work. Do not use it.
|
||||||
|
*/
|
||||||
|
void DisplayError( wxWindow* parent, const wxString& aMessage, int displaytime = 0 );
|
||||||
|
|
||||||
bool IsOK( wxWindow* parent, const wxString& msg );
|
/**
|
||||||
|
* Function DisplayInfoMessage
|
||||||
|
* displays an informational message box with \a aMessage.
|
||||||
|
*
|
||||||
|
* @warning Setting \a displaytime does not work. Do not use it.
|
||||||
|
*/
|
||||||
|
void DisplayInfoMessage( wxWindow* parent, const wxString& aMessage, int displaytime = 0 );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function IsOK
|
||||||
|
* gets the user response to \a aMessage.
|
||||||
|
*
|
||||||
|
* @return True if user selected the yes button, otherwise false.
|
||||||
|
*/
|
||||||
|
bool IsOK( wxWindow* parent, const wxString& aMessage );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function DisplayHtmlInforMessage
|
||||||
|
* displays \a aMessage in HTML format.
|
||||||
|
*/
|
||||||
void DisplayHtmlInfoMessage( wxWindow* parent, const wxString& title,
|
void DisplayHtmlInfoMessage( wxWindow* parent, const wxString& title,
|
||||||
const wxString& msg,
|
const wxString& aMessage,
|
||||||
const wxSize& size=wxDefaultSize );
|
const wxSize& size = wxDefaultSize );
|
||||||
|
|
||||||
|
|
||||||
#endif /* __INCLUDE__CONFIRM_H__ */
|
#endif /* __INCLUDE__CONFIRM_H__ */
|
||||||
|
|
|
@ -8,22 +8,20 @@
|
||||||
#define __INCLUDE__EDA_DOC_H__ 1
|
#define __INCLUDE__EDA_DOC_H__ 1
|
||||||
|
|
||||||
|
|
||||||
/* Search the text Database for found all the key words in the KeyList.
|
/**
|
||||||
|
* Function KeyWordOk
|
||||||
|
* searches \a aKeyList for any words found in \a aDatabase.
|
||||||
*
|
*
|
||||||
* Returns:
|
* @return 0 if no keyword is found or 1 if keyword is found.
|
||||||
* 0 if no keyword is found
|
|
||||||
* 1 if keyword found.
|
|
||||||
*/
|
*/
|
||||||
int KeyWordOk( const wxString& KeyList,
|
int KeyWordOk( const wxString& aKeyList, const wxString& aDatabase );
|
||||||
const wxString& Database );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetAssociatedDocument
|
* Function GetAssociatedDocument
|
||||||
* open a document (file) with the suitable browser
|
* open a document (file) with the suitable browser
|
||||||
* @param aFrame = main frame
|
* @param aFrame = main frame
|
||||||
* @param aDocName = filename of file to open (Full filename or short filename)
|
* @param aDocName = filename of file to open (Full filename or short filename)
|
||||||
* if DocName is starting by http: or ftp: or www. the default internet
|
* if \a aDocName begins with http: or ftp: or www. the default internet browser is launched
|
||||||
* browser is launched
|
|
||||||
* @param aPaths = a wxPathList to explore.
|
* @param aPaths = a wxPathList to explore.
|
||||||
* if NULL or aDocName is a full filename, aPath is not used.
|
* if NULL or aDocName is a full filename, aPath is not used.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -82,7 +82,8 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function ReadFootprintFiles
|
* Function ReadFootprintFiles
|
||||||
* Read the list of libraries (*.mod files) and populates m_List ( list of availaible modules in libs ).
|
* Read the list of libraries (*.mod files) and populates m_List ( list of availaible
|
||||||
|
* modules in libs ).
|
||||||
* for each module, are stored
|
* for each module, are stored
|
||||||
* the module name
|
* the module name
|
||||||
* documentation string
|
* documentation string
|
||||||
|
@ -104,8 +105,7 @@ public:
|
||||||
/* FOOTPRINT object list sort function. */
|
/* FOOTPRINT object list sort function. */
|
||||||
inline bool operator<( const FOOTPRINT_INFO& item1, const FOOTPRINT_INFO& item2 )
|
inline bool operator<( const FOOTPRINT_INFO& item1, const FOOTPRINT_INFO& item2 )
|
||||||
{
|
{
|
||||||
return ( StrNumICmp( item1.m_Module.GetData(),
|
return StrNumCmp( item1.m_Module, item2.m_Module, INT_MAX, true ) < 0;
|
||||||
item2.m_Module.GetData() ) < 0 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // _FOOTPRINT_INFO_H_
|
#endif // _FOOTPRINT_INFO_H_
|
||||||
|
|
|
@ -32,6 +32,16 @@ bool EDA_DirectorySelector( const wxString& Title,
|
||||||
wxWindow* Frame,
|
wxWindow* Frame,
|
||||||
const wxPoint& Pos );
|
const wxPoint& Pos );
|
||||||
|
|
||||||
|
/* Selection file dialog box:
|
||||||
|
* Dialog title
|
||||||
|
* Default path
|
||||||
|
* default filename
|
||||||
|
* default filename extension
|
||||||
|
* filter for filename list
|
||||||
|
* parent frame
|
||||||
|
* wxFD_SAVE, wxFD_OPEN ..
|
||||||
|
* true = keep the current path
|
||||||
|
*/
|
||||||
wxString EDA_FileSelector( const wxString& Title,
|
wxString EDA_FileSelector( const wxString& Title,
|
||||||
const wxString& Path,
|
const wxString& Path,
|
||||||
const wxString& FileName,
|
const wxString& FileName,
|
||||||
|
@ -43,13 +53,20 @@ wxString EDA_FileSelector( const wxString& Title,
|
||||||
const wxPoint& Pos = wxPoint( -1, -1 ) );
|
const wxPoint& Pos = wxPoint( -1, -1 ) );
|
||||||
|
|
||||||
|
|
||||||
/* Return file name without path or extension.
|
/**
|
||||||
|
* Function MakeReducedFileName
|
||||||
|
* calculate the "reduced" filename from \a fullfilename.
|
||||||
*
|
*
|
||||||
* If the path is in the default KiCad path, ./ is prepended to the
|
* @param fullfilename = full filename
|
||||||
* file name. If the file name has the default extension, the file
|
* @param default_path = default path
|
||||||
* name is returned without an extension.
|
* @param default_ext = default extension
|
||||||
|
* @return the "reduced" filename, i.e.:
|
||||||
|
* without path if it is default_path
|
||||||
|
* with ./ if the path is the current path
|
||||||
|
* without extension if extension is default_ext
|
||||||
|
*
|
||||||
|
* the new filename is in unix like notation ('/' as path separator)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
wxString MakeReducedFileName( const wxString& fullfilename,
|
wxString MakeReducedFileName( const wxString& fullfilename,
|
||||||
const wxString& default_path,
|
const wxString& default_path,
|
||||||
const wxString& default_ext );
|
const wxString& default_ext );
|
||||||
|
@ -57,23 +74,68 @@ wxString MakeReducedFileName( const wxString& fullfilename,
|
||||||
EDA_LIST_DIALOG* GetFileNames( char* Directory, char* Mask );
|
EDA_LIST_DIALOG* GetFileNames( char* Directory, char* Mask );
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function ExecuteFile
|
||||||
|
* calls the executable file \a ExecFile with the command line parameters \a param.
|
||||||
|
*/
|
||||||
int ExecuteFile( wxWindow* frame, const wxString& ExecFile,
|
int ExecuteFile( wxWindow* frame, const wxString& ExecFile,
|
||||||
const wxString& param = wxEmptyString );
|
const wxString& param = wxEmptyString );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function AddDelimiterString
|
||||||
|
* Add un " to the start and the end of string (if not already done).
|
||||||
|
* @param string = string to modify
|
||||||
|
*/
|
||||||
void AddDelimiterString( wxString& string );
|
void AddDelimiterString( wxString& string );
|
||||||
|
|
||||||
/* Find absolute path for kicad/help (or kicad/help/<language>) */
|
/**
|
||||||
|
* Function FindKicadHelpPath
|
||||||
|
* finds the absolute path for KiCad "help" (or "help/<language>")
|
||||||
|
* Find path kicad/doc/help/xx/ or kicad/doc/help/:
|
||||||
|
* from BinDir
|
||||||
|
* else from environment variable KICAD
|
||||||
|
* else from one of s_HelpPathList
|
||||||
|
* typically c:/kicad/doc/help or /usr/share/kicad/help
|
||||||
|
* or /usr/local/share/kicad/help
|
||||||
|
* (must have kicad in path name)
|
||||||
|
*
|
||||||
|
* xx = iso639-1 language id (2 letters (generic) or 4 letters):
|
||||||
|
* fr = french (or fr_FR)
|
||||||
|
* en = English (or en_GB or en_US ...)
|
||||||
|
* de = deutch
|
||||||
|
* es = spanish
|
||||||
|
* pt = portuguese (or pt_BR ...)
|
||||||
|
*
|
||||||
|
* default = en (if not found = fr)
|
||||||
|
*/
|
||||||
wxString FindKicadHelpPath();
|
wxString FindKicadHelpPath();
|
||||||
|
|
||||||
|
/**
|
||||||
/* Return the KiCad common data path. */
|
* Function ReturnKicadDatasPath
|
||||||
|
* returns the data path common to KiCad.
|
||||||
|
* If environment variable KICAD is defined (KICAD = path to kicad)
|
||||||
|
* Returns \<KICAD\> /;
|
||||||
|
* Otherwise returns \<path of binaries\> / (if "kicad" is in the path name)
|
||||||
|
* Otherwise returns /usr /share/kicad/
|
||||||
|
*
|
||||||
|
* Note:
|
||||||
|
* The \\ are replaced by / (a la Unix)
|
||||||
|
*/
|
||||||
wxString ReturnKicadDatasPath();
|
wxString ReturnKicadDatasPath();
|
||||||
|
|
||||||
|
/**
|
||||||
/* Search the executable file shortname in KiCad binary path and return
|
* Function FindKicadFile
|
||||||
* full file name if found or shortname */
|
* searches the executable file shortname in KiCad binary path and return full file
|
||||||
|
* name if found or shortname if the kicad binary path is kicad/bin.
|
||||||
|
*
|
||||||
|
* kicad binary path is found from:
|
||||||
|
* BinDir
|
||||||
|
* or environment variable KICAD
|
||||||
|
* or (default) c:\\kicad or /usr/local/kicad
|
||||||
|
* or default binary path
|
||||||
|
*/
|
||||||
wxString FindKicadFile( const wxString& shortname );
|
wxString FindKicadFile( const wxString& shortname );
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Quote return value of wxFileName::GetFullPath().
|
* Quote return value of wxFileName::GetFullPath().
|
||||||
*
|
*
|
||||||
|
@ -83,7 +145,6 @@ wxString FindKicadFile( const wxString& shortname );
|
||||||
* @param format if provided, can be used to transform the nature of the
|
* @param format if provided, can be used to transform the nature of the
|
||||||
* wrapped filename to another platform.
|
* wrapped filename to another platform.
|
||||||
*/
|
*/
|
||||||
extern wxString QuoteFullPath( wxFileName& fn,
|
extern wxString QuoteFullPath( wxFileName& fn, wxPathFormat format = wxPATH_NATIVE );
|
||||||
wxPathFormat format = wxPATH_NATIVE );
|
|
||||||
|
|
||||||
#endif /* __INCLUDE__GESTFICH_H__ */
|
#endif /* __INCLUDE__GESTFICH_H__ */
|
||||||
|
|
|
@ -11,9 +11,6 @@
|
||||||
|
|
||||||
#include <wx/string.h>
|
#include <wx/string.h>
|
||||||
|
|
||||||
char* strupper( char* Text );
|
|
||||||
char* strlower( char* Text );
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function ReadDelimitedText
|
* Function ReadDelimitedText
|
||||||
|
@ -52,61 +49,60 @@ int ReadDelimitedText( wxString* aDest, const char* aSource );
|
||||||
*/
|
*/
|
||||||
std::string EscapedUTF8( const wxString& aString );
|
std::string EscapedUTF8( const wxString& aString );
|
||||||
|
|
||||||
|
/**
|
||||||
/* Read one line line from a file.
|
* Function GetLine
|
||||||
* Returns the first useful line read by eliminating blank lines and comments.
|
* reads one line line from \a aFile.
|
||||||
|
* @return A pointer the first useful line read by eliminating blank lines and comments.
|
||||||
*/
|
*/
|
||||||
char* GetLine( FILE* File,
|
char* GetLine( FILE* aFile, char* Line, int* LineNum = NULL, int SizeLine = 255 );
|
||||||
char* Line,
|
|
||||||
int* LineNum = NULL,
|
|
||||||
int SizeLine = 255 );
|
|
||||||
|
|
||||||
/* Remove leading and trailing whitespace.
|
/**
|
||||||
|
* Funxtion StrPurge
|
||||||
|
* removes leading and training spaces, tabs and end of line chars in \a text
|
||||||
|
* return a pointer on the first n char in text
|
||||||
*/
|
*/
|
||||||
char* StrPurge( char* text );
|
char* StrPurge( char* text );
|
||||||
|
|
||||||
|
/**
|
||||||
/*Return a string giving the current date and time.
|
* Function DateAndTime
|
||||||
*/
|
* @return a string giving the current date and time.
|
||||||
char* DateAndTime( char* line );
|
*/
|
||||||
wxString DateAndTime();
|
wxString DateAndTime();
|
||||||
|
|
||||||
|
/**
|
||||||
/*
|
* Function StrLenNumCmp
|
||||||
* Routine (compatible with qsort ()) to sort by alphabetical order.
|
* is a routine compatible with qsort() to sort by alphabetical order.
|
||||||
* Equivalent to strncmp () but the numbers are compared by their integer
|
*
|
||||||
* value not by their ASCII code.
|
* This function is equivalent to strncmp() or strnicmp() if \a aIgnoreCase is true
|
||||||
|
* except that strings containing numbers are compared by their integer value not
|
||||||
|
* by their ASCII code.
|
||||||
|
*
|
||||||
|
* @param aString1 A wxChar pointer to the reference string.
|
||||||
|
* @param aString2 A wxChar pointer to the comparison string.
|
||||||
|
* @param aLength The numbere of characters to compare. Set to -1 to compare
|
||||||
|
* the entire string.
|
||||||
|
* @param aIgnoreCase Use true to make the comparison case insensitive.
|
||||||
|
* @return An integer value of -1 if \a aString1 is less than \a aString2, 0 if
|
||||||
|
* \a aString1 is equal to \a aString2, or 1 if \a aString1 is greater
|
||||||
|
* than \a aString2.
|
||||||
*/
|
*/
|
||||||
int StrLenNumCmp( const wxChar* str1,
|
int StrNumCmp( const wxChar* aString1, const wxChar* aString2, int aLength = INT_MAX,
|
||||||
const wxChar* str2,
|
bool aIgnoreCase = false );
|
||||||
int NbMax );
|
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Routine (compatible with qsort ()) to sort by case insensitive alphabetical
|
* Function WildCompareString
|
||||||
* order.
|
* compares a string against wild card (* and ?) pattern using the usual rules.
|
||||||
* Equivalent to strnicmp () but the numbers are compared by their integer
|
* @return true if pattern matched otherwise false.
|
||||||
* value not by their ASCII code.
|
|
||||||
*/
|
*/
|
||||||
int StrNumICmp( const wxChar* str1,
|
|
||||||
const wxChar* str2 );
|
|
||||||
|
|
||||||
|
|
||||||
int StrLenNumICmp( const wxChar* str1,
|
|
||||||
const wxChar* str2,
|
|
||||||
int NbMax );
|
|
||||||
|
|
||||||
/* Compare string against wild card pattern using the usual rules.
|
|
||||||
* (Wildcards *,?).
|
|
||||||
* The reference string is "pattern"
|
|
||||||
* If case_sensitive == TRUE (default), exact comparison
|
|
||||||
* Returns TRUE if pattern matched otherwise FALSE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
bool WildCompareString( const wxString& pattern,
|
bool WildCompareString( const wxString& pattern,
|
||||||
const wxString& string_to_tst,
|
const wxString& string_to_tst,
|
||||||
bool case_sensitive = TRUE );
|
bool case_sensitive = true );
|
||||||
|
|
||||||
/* Replaces decimal point with commas to generated international numbers.
|
/**
|
||||||
|
* Function to_point
|
||||||
|
* converts a string used to compensate for internalization of printf(). It generates
|
||||||
|
* floating point numbers with a comma instead of point.
|
||||||
|
* @deprecated Use SetLocaleTo_C_standard instead.
|
||||||
*/
|
*/
|
||||||
char* to_point( char* Text );
|
char* to_point( char* Text );
|
||||||
|
|
||||||
|
|
|
@ -140,9 +140,9 @@ public:
|
||||||
int m_Default; ///< The default value of the parameter
|
int m_Default; ///< The default value of the parameter
|
||||||
|
|
||||||
public: PARAM_CFG_BOOL( const wxChar* ident, bool* ptparam,
|
public: PARAM_CFG_BOOL( const wxChar* ident, bool* ptparam,
|
||||||
int default_val = FALSE, const wxChar* group = NULL );
|
int default_val = false, const wxChar* group = NULL );
|
||||||
PARAM_CFG_BOOL( bool Insetup, const wxChar* ident, bool* ptparam,
|
PARAM_CFG_BOOL( bool Insetup, const wxChar* ident, bool* ptparam,
|
||||||
int default_val = FALSE, const wxChar* group = NULL );
|
int default_val = false, const wxChar* group = NULL );
|
||||||
|
|
||||||
virtual void ReadParam( wxConfigBase* aConfig );
|
virtual void ReadParam( wxConfigBase* aConfig );
|
||||||
virtual void SaveParam( wxConfigBase* aConfig );
|
virtual void SaveParam( wxConfigBase* aConfig );
|
||||||
|
|
|
@ -53,7 +53,7 @@ public:
|
||||||
|
|
||||||
int DisplayModEdge;
|
int DisplayModEdge;
|
||||||
int DisplayModText;
|
int DisplayModText;
|
||||||
bool DisplayPcbTrackFill; /* FALSE = sketch , TRUE = filled */
|
bool DisplayPcbTrackFill; /* false = sketch , true = filled */
|
||||||
|
|
||||||
/// How trace clearances are displayed. @see TRACE_CLEARANCE_DISPLAY_MODE_T.
|
/// How trace clearances are displayed. @see TRACE_CLEARANCE_DISPLAY_MODE_T.
|
||||||
TRACE_CLEARANCE_DISPLAY_MODE_T ShowTrackClearanceMode;
|
TRACE_CLEARANCE_DISPLAY_MODE_T ShowTrackClearanceMode;
|
||||||
|
|
|
@ -69,7 +69,7 @@ public:
|
||||||
|
|
||||||
int m_DisplayModEdge; // How to display module drawings (line/ filled / sketch)
|
int m_DisplayModEdge; // How to display module drawings (line/ filled / sketch)
|
||||||
int m_DisplayModText; // How to display module texts (line/ filled / sketch)
|
int m_DisplayModText; // How to display module texts (line/ filled / sketch)
|
||||||
bool m_DisplayPcbTrackFill; // FALSE : tracks are show in sketch mode, TRUE = filled.
|
bool m_DisplayPcbTrackFill; // false : tracks are show in sketch mode, true = filled.
|
||||||
EDA_UNITS_T m_UserGridUnit;
|
EDA_UNITS_T m_UserGridUnit;
|
||||||
wxRealPoint m_UserGridSize;
|
wxRealPoint m_UserGridSize;
|
||||||
|
|
||||||
|
|
|
@ -714,7 +714,7 @@ private:
|
||||||
SCH_NO_CONNECT* AddNoConnect( wxDC* aDC, const wxPoint& aPosition );
|
SCH_NO_CONNECT* AddNoConnect( wxDC* aDC, const wxPoint& aPosition );
|
||||||
|
|
||||||
// Junction
|
// Junction
|
||||||
SCH_JUNCTION* AddJunction( wxDC* aDC, const wxPoint& aPosition, bool aPutInUndoList = FALSE );
|
SCH_JUNCTION* AddJunction( wxDC* aDC, const wxPoint& aPosition, bool aPutInUndoList = false );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function MoveItem
|
* Function MoveItem
|
||||||
|
|
|
@ -397,12 +397,12 @@ public:
|
||||||
// = 1000 for Eeschema, = 10000
|
// = 1000 for Eeschema, = 10000
|
||||||
// for Pcbnew and GerbView
|
// for Pcbnew and GerbView
|
||||||
|
|
||||||
bool m_Draw_Axis; // TRUE to show X and Y axis
|
bool m_Draw_Axis; // true to show X and Y axis
|
||||||
bool m_Draw_Grid_Axis; // TRUE to show grid axis.
|
bool m_Draw_Grid_Axis; // true to show grid axis.
|
||||||
bool m_Draw_Sheet_Ref; // TRUE to show frame references
|
bool m_Draw_Sheet_Ref; // true to show frame references
|
||||||
|
|
||||||
bool m_Print_Sheet_Ref; // TRUE to print frame references
|
bool m_Print_Sheet_Ref; // true to print frame references
|
||||||
bool m_Draw_Auxiliary_Axis; /* TRUE to show auxiliary axis.
|
bool m_Draw_Auxiliary_Axis; /* true to show auxiliary axis.
|
||||||
* Used in Pcbnew: the auxiliary
|
* Used in Pcbnew: the auxiliary
|
||||||
* axis is the origin of
|
* axis is the origin of
|
||||||
* coordinates for drill, gerber
|
* coordinates for drill, gerber
|
||||||
|
@ -712,6 +712,10 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual bool HandleBlockEnd( wxDC* DC );
|
virtual bool HandleBlockEnd( wxDC* DC );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function CopyToClipboard
|
||||||
|
* copies the current page or the current block to the clipboard.
|
||||||
|
*/
|
||||||
void CopyToClipboard( wxCommandEvent& event );
|
void CopyToClipboard( wxCommandEvent& event );
|
||||||
|
|
||||||
/* interprocess communication */
|
/* interprocess communication */
|
||||||
|
|
|
@ -166,8 +166,7 @@ bool FOOTPRINT_LIBRARY::ReadSectionIndex()
|
||||||
|
|
||||||
bool FOOTPRINT_LIBRARY::WriteHeader()
|
bool FOOTPRINT_LIBRARY::WriteHeader()
|
||||||
{
|
{
|
||||||
char line[256];
|
fprintf( m_file, "%s %s\n", FOOTPRINT_LIBRARY_HEADER, TO_UTF8( DateAndTime() ) );
|
||||||
fprintf( m_file, "%s %s\n", FOOTPRINT_LIBRARY_HEADER, DateAndTime( line ) );
|
|
||||||
fprintf( m_file, "# encoding utf-8\n" );
|
fprintf( m_file, "# encoding utf-8\n" );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -298,7 +298,7 @@ void GenDrillReportFile( FILE* aFile, BOARD* aPcb,
|
||||||
|
|
||||||
|
|
||||||
fprintf( aFile, "Drill report for %s\n", TO_UTF8( aBoardFilename ) );
|
fprintf( aFile, "Drill report for %s\n", TO_UTF8( aBoardFilename ) );
|
||||||
fprintf( aFile, "Created on %s\n", DateAndTime( line ) );
|
fprintf( aFile, "Created on %s\n", TO_UTF8( DateAndTime() ) );
|
||||||
|
|
||||||
// List which Drill Unit option had been selected for the associated
|
// List which Drill Unit option had been selected for the associated
|
||||||
// drill aFile.
|
// drill aFile.
|
||||||
|
|
|
@ -44,7 +44,7 @@ static int ListeModCmp( const void* o1, const void* o2 )
|
||||||
LIST_MOD* ref = (LIST_MOD*) o1;
|
LIST_MOD* ref = (LIST_MOD*) o1;
|
||||||
LIST_MOD* cmp = (LIST_MOD*) o2;
|
LIST_MOD* cmp = (LIST_MOD*) o2;
|
||||||
|
|
||||||
return StrLenNumCmp( ref->m_Reference, cmp->m_Reference, 16 );
|
return StrNumCmp( ref->m_Reference, cmp->m_Reference, 16 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -79,7 +79,6 @@ void PCB_EDIT_FRAME::GenModulesPosition( wxCommandEvent& event )
|
||||||
MODULE* module;
|
MODULE* module;
|
||||||
LIST_MOD* Liste = 0;
|
LIST_MOD* Liste = 0;
|
||||||
char line[1024];
|
char line[1024];
|
||||||
char Buff[80];
|
|
||||||
wxFileName fnFront;
|
wxFileName fnFront;
|
||||||
wxFileName fnBack;
|
wxFileName fnBack;
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
@ -214,7 +213,7 @@ void PCB_EDIT_FRAME::GenModulesPosition( wxCommandEvent& event )
|
||||||
qsort( Liste, moduleCount, sizeof(LIST_MOD), ListeModCmp );
|
qsort( Liste, moduleCount, sizeof(LIST_MOD), ListeModCmp );
|
||||||
|
|
||||||
// Write file header
|
// Write file header
|
||||||
sprintf( line, "### Module positions - created on %s ###\n", DateAndTime( Buff ) );
|
sprintf( line, "### Module positions - created on %s ###\n", TO_UTF8( DateAndTime() ) );
|
||||||
fputs( line, fpFront );
|
fputs( line, fpFront );
|
||||||
|
|
||||||
if( doBoardBack )
|
if( doBoardBack )
|
||||||
|
@ -325,7 +324,7 @@ void PCB_EDIT_FRAME::GenModuleReport( wxCommandEvent& event )
|
||||||
double conv_unit;
|
double conv_unit;
|
||||||
MODULE* Module;
|
MODULE* Module;
|
||||||
D_PAD* pad;
|
D_PAD* pad;
|
||||||
char line[1024], Buff[80];
|
char line[1024];
|
||||||
wxFileName fn;
|
wxFileName fn;
|
||||||
wxString fnFront, msg;
|
wxString fnFront, msg;
|
||||||
FILE* rptfile;
|
FILE* rptfile;
|
||||||
|
@ -361,7 +360,7 @@ void PCB_EDIT_FRAME::GenModuleReport( wxCommandEvent& event )
|
||||||
SetLocaleTo_C_standard();
|
SetLocaleTo_C_standard();
|
||||||
|
|
||||||
/* Generate header file comments.) */
|
/* Generate header file comments.) */
|
||||||
sprintf( line, "## Module report - date %s\n", DateAndTime( Buff ) );
|
sprintf( line, "## Module report - date %s\n", TO_UTF8( DateAndTime() ) );
|
||||||
fputs( line, rptfile );
|
fputs( line, rptfile );
|
||||||
|
|
||||||
wxString Title = wxGetApp().GetAppName() + wxT( " " ) + GetBuildVersion();
|
wxString Title = wxGetApp().GetAppName() + wxT( " " ) + GetBuildVersion();
|
||||||
|
|
|
@ -502,18 +502,14 @@ void EXCELLON_WRITER::WriteCoordinates( char* aLine, double aCoordX, double aCoo
|
||||||
*/
|
*/
|
||||||
void EXCELLON_WRITER::WriteHeader()
|
void EXCELLON_WRITER::WriteHeader()
|
||||||
{
|
{
|
||||||
char Line[256];
|
|
||||||
|
|
||||||
fputs( "M48\n", m_file ); // The beginning of a header
|
fputs( "M48\n", m_file ); // The beginning of a header
|
||||||
|
|
||||||
if( !m_minimalHeader )
|
if( !m_minimalHeader )
|
||||||
{
|
{
|
||||||
DateAndTime( Line );
|
|
||||||
|
|
||||||
// The next 2 lines in EXCELLON files are comments:
|
// The next 2 lines in EXCELLON files are comments:
|
||||||
wxString msg = wxGetApp().GetTitle() + wxT( " " ) + GetBuildVersion();
|
wxString msg = wxGetApp().GetTitle() + wxT( " " ) + GetBuildVersion();
|
||||||
fprintf( m_file, ";DRILL file {%s} date %s\n", TO_UTF8( msg ),
|
fprintf( m_file, ";DRILL file {%s} date %s\n", TO_UTF8( msg ),
|
||||||
Line );
|
TO_UTF8( DateAndTime() ) );
|
||||||
msg = wxT( ";FORMAT={" );
|
msg = wxT( ";FORMAT={" );
|
||||||
|
|
||||||
// Print precision:
|
// Print precision:
|
||||||
|
@ -532,6 +528,7 @@ void EXCELLON_WRITER::WriteHeader()
|
||||||
* be added here
|
* be added here
|
||||||
*/
|
*/
|
||||||
msg << wxT( " / " );
|
msg << wxT( " / " );
|
||||||
|
|
||||||
const wxString zero_fmt[4] =
|
const wxString zero_fmt[4] =
|
||||||
{
|
{
|
||||||
wxT( "decimal" ),
|
wxT( "decimal" ),
|
||||||
|
|
|
@ -1149,7 +1149,6 @@ int PCB_EDIT_FRAME::ReadPcbFile( LINE_READER* aReader, bool Append )
|
||||||
int PCB_EDIT_FRAME::SavePcbFormatAscii( FILE* aFile )
|
int PCB_EDIT_FRAME::SavePcbFormatAscii( FILE* aFile )
|
||||||
{
|
{
|
||||||
bool rc;
|
bool rc;
|
||||||
char line[256];
|
|
||||||
|
|
||||||
GetBoard()->m_Status_Pcb &= ~CONNEXION_OK;
|
GetBoard()->m_Status_Pcb &= ~CONNEXION_OK;
|
||||||
|
|
||||||
|
@ -1161,7 +1160,7 @@ int PCB_EDIT_FRAME::SavePcbFormatAscii( FILE* aFile )
|
||||||
|
|
||||||
/* Writing file header. */
|
/* Writing file header. */
|
||||||
fprintf( aFile, "PCBNEW-BOARD Version %d date %s\n\n", g_CurrentVersionPCB,
|
fprintf( aFile, "PCBNEW-BOARD Version %d date %s\n\n", g_CurrentVersionPCB,
|
||||||
DateAndTime( line ) );
|
TO_UTF8( DateAndTime() ) );
|
||||||
fprintf( aFile, "# Created by Pcbnew%s\n\n", TO_UTF8( GetBuildVersion() ) );
|
fprintf( aFile, "# Created by Pcbnew%s\n\n", TO_UTF8( GetBuildVersion() ) );
|
||||||
|
|
||||||
GetBoard()->SynchronizeNetsAndNetClasses();
|
GetBoard()->SynchronizeNetsAndNetClasses();
|
||||||
|
|
|
@ -1,3 +1,28 @@
|
||||||
|
/*
|
||||||
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||||
|
* Copyright (C) 2008-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
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file moduleframe.cpp
|
* @file moduleframe.cpp
|
||||||
* @brief Footprint (module) editor main window.
|
* @brief Footprint (module) editor main window.
|
||||||
|
@ -29,9 +54,7 @@ static BOARD_DESIGN_SETTINGS s_ModuleEditorDesignSetting;
|
||||||
|
|
||||||
wxString FOOTPRINT_EDIT_FRAME::m_CurrentLib = wxEmptyString;
|
wxString FOOTPRINT_EDIT_FRAME::m_CurrentLib = wxEmptyString;
|
||||||
|
|
||||||
/******************************/
|
|
||||||
/* class FOOTPRINT_EDIT_FRAME */
|
|
||||||
/******************************/
|
|
||||||
BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
|
BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
|
||||||
EVT_MENU_RANGE( ID_POPUP_PCB_ITEM_SELECTION_START, ID_POPUP_PCB_ITEM_SELECTION_END,
|
EVT_MENU_RANGE( ID_POPUP_PCB_ITEM_SELECTION_START, ID_POPUP_PCB_ITEM_SELECTION_END,
|
||||||
PCB_BASE_FRAME::ProcessItemSelection )
|
PCB_BASE_FRAME::ProcessItemSelection )
|
||||||
|
@ -88,7 +111,7 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
|
||||||
|
|
||||||
EVT_MENU( ID_PCB_DRAWINGS_WIDTHS_SETUP, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
|
EVT_MENU( ID_PCB_DRAWINGS_WIDTHS_SETUP, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
|
||||||
EVT_MENU( ID_PCB_PAD_SETUP, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
|
EVT_MENU( ID_PCB_PAD_SETUP, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
|
||||||
EVT_MENU( ID_PCB_USER_GRID_SETUP, PCB_EDIT_FRAME::Process_Special_Functions )
|
EVT_MENU( ID_PCB_USER_GRID_SETUP, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
|
||||||
|
|
||||||
// Menu 3D Frame
|
// Menu 3D Frame
|
||||||
EVT_MENU( ID_MENU_PCB_SHOW_3D_FRAME, FOOTPRINT_EDIT_FRAME::Show3D_Frame )
|
EVT_MENU( ID_MENU_PCB_SHOW_3D_FRAME, FOOTPRINT_EDIT_FRAME::Show3D_Frame )
|
||||||
|
|
|
@ -189,7 +189,7 @@ int DIALOG_EXCHANGE_MODULE::Maj_ListeCmp( const wxString& reference,
|
||||||
}
|
}
|
||||||
|
|
||||||
fgets( Line, sizeof(Line), FichCmp );
|
fgets( Line, sizeof(Line), FichCmp );
|
||||||
fprintf( NewFile, "Cmp-Mod V01 Genere par PcbNew le %s\n", DateAndTime( Line ) );
|
fprintf( NewFile, "Cmp-Mod V01 Genere par PcbNew le %s\n", TO_UTF8( DateAndTime() ) );
|
||||||
|
|
||||||
bool start_descr = false;
|
bool start_descr = false;
|
||||||
|
|
||||||
|
@ -616,7 +616,7 @@ void PCB_EDIT_FRAME::RecreateCmpFileFromBoard( wxCommandEvent& aEvent )
|
||||||
}
|
}
|
||||||
|
|
||||||
fgets( Line, sizeof(Line), FichCmp );
|
fgets( Line, sizeof(Line), FichCmp );
|
||||||
fprintf( FichCmp, "Cmp-Mod V01 Genere par PcbNew le %s\n", DateAndTime( Line ) );
|
fprintf( FichCmp, "Cmp-Mod V01 Genere par PcbNew le %s\n", TO_UTF8( DateAndTime() ) );
|
||||||
|
|
||||||
for( ; Module != NULL; Module = Module->Next() )
|
for( ; Module != NULL; Module = Module->Next() )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue