Removed wxT() from kicad2step modules and made modifications to the STEP Export GUI
This commit is contained in:
parent
ba65c39b40
commit
8b8626ceeb
|
@ -34,13 +34,13 @@
|
|||
#include "class_board.h"
|
||||
#include "dialog_export_step_base.h"
|
||||
|
||||
#define OPTKEY_STEP_USE_DRILL_ORG wxT( "STEP_UseDrillOrigin" )
|
||||
#define OPTKEY_STEP_USE_AUX_ORG wxT( "STEP_UseAuxOrigin" )
|
||||
#define OPTKEY_STEP_USE_USER_ORG wxT( "STEP_UseUserOrigin" )
|
||||
#define OPTKEY_STEP_UORG_UNITS wxT( "STEP_UserOriginUnits" )
|
||||
#define OPTKEY_STEP_UORG_X wxT( "STEP_UserOriginX" )
|
||||
#define OPTKEY_STEP_UORG_Y wxT( "STEP_UserOriginY" )
|
||||
#define OPTKEY_STEP_NOVIRT wxT( "STEP_NoVirtual" )
|
||||
#define OPTKEY_STEP_USE_DRILL_ORG "STEP_UseDrillOrigin"
|
||||
#define OPTKEY_STEP_USE_AUX_ORG "STEP_UseAuxOrigin"
|
||||
#define OPTKEY_STEP_USE_USER_ORG "STEP_UseUserOrigin"
|
||||
#define OPTKEY_STEP_UORG_UNITS "STEP_UserOriginUnits"
|
||||
#define OPTKEY_STEP_UORG_X "STEP_UserOriginX"
|
||||
#define OPTKEY_STEP_UORG_Y "STEP_UserOriginY"
|
||||
#define OPTKEY_STEP_NOVIRT "STEP_NoVirtual"
|
||||
|
||||
|
||||
class DIALOG_EXPORT_STEP: public DIALOG_EXPORT_STEP_BASE
|
||||
|
@ -83,7 +83,7 @@ public:
|
|||
wxString tmpStr;
|
||||
tmpStr << m_XOrg;
|
||||
m_STEP_Xorg->SetValue( tmpStr );
|
||||
tmpStr = wxT( "" );
|
||||
tmpStr = "";
|
||||
tmpStr << m_YOrg;
|
||||
m_STEP_Yorg->SetValue( tmpStr );
|
||||
|
||||
|
@ -185,7 +185,7 @@ void PCB_EDIT_FRAME::OnExportSTEP( wxCommandEvent& event )
|
|||
{
|
||||
|
||||
wxFileName brdFile = GetBoard()->GetFileName();
|
||||
wxString brdName = brdFile.GetFullPath();
|
||||
wxString brdName;
|
||||
|
||||
if( GetScreen()->IsModify() || brdFile.GetFullPath().empty() )
|
||||
{
|
||||
|
@ -200,13 +200,16 @@ void PCB_EDIT_FRAME::OnExportSTEP( wxCommandEvent& event )
|
|||
brdName = GetAutoSaveFilePrefix();
|
||||
brdName.append( brdFile.GetName() );
|
||||
brdFile.SetName( brdName );
|
||||
brdName = brdFile.GetFullPath();
|
||||
}
|
||||
|
||||
brdName = "\"";
|
||||
brdName.Append( brdFile.GetFullPath() );
|
||||
brdName.Append( "\"" );
|
||||
|
||||
// Build default output file name
|
||||
brdFile = GetBoard()->GetFileName();
|
||||
wxString brdExt = brdFile.GetExt();
|
||||
brdFile.SetExt( wxT( "stp" ) );
|
||||
brdFile.SetExt( "stp" );
|
||||
|
||||
DIALOG_EXPORT_STEP dlg( this );
|
||||
dlg.FilePicker()->SetPath( brdFile.GetFullPath() );
|
||||
|
@ -249,6 +252,8 @@ void PCB_EDIT_FRAME::OnExportSTEP( wxCommandEvent& event )
|
|||
}
|
||||
}
|
||||
|
||||
outputFile.Prepend( "\"" );
|
||||
outputFile.Append( "\"" );
|
||||
bool aUseDrillOrg = dlg.GetDrillOrgOption();
|
||||
bool aUseAuxOrg = dlg.GetAuxOrgOption();
|
||||
bool aUseUserOrg = dlg.GetUserOrgOption();
|
||||
|
@ -269,11 +274,12 @@ void PCB_EDIT_FRAME::OnExportSTEP( wxCommandEvent& event )
|
|||
}
|
||||
}
|
||||
|
||||
wxBusyCursor dummy;
|
||||
wxFileName appK2S( wxStandardPaths::Get().GetExecutablePath() );
|
||||
appK2S.SetName( "kicad2step" );
|
||||
|
||||
wxString cmdK2S = appK2S.GetFullPath();
|
||||
wxString cmdK2S = "\"";
|
||||
cmdK2S.Append( appK2S.GetFullPath() );
|
||||
cmdK2S.Append( "\"" );
|
||||
|
||||
if( aNoVirtual )
|
||||
cmdK2S.Append( " --no-virtual" );
|
||||
|
@ -293,10 +299,20 @@ void PCB_EDIT_FRAME::OnExportSTEP( wxCommandEvent& event )
|
|||
cmdK2S.Append( " " );
|
||||
cmdK2S.Append( brdName );
|
||||
|
||||
if( wxExecute( cmdK2S, wxEXEC_SYNC | wxEXEC_HIDE_CONSOLE ) )
|
||||
std::cerr << "Executing kicad2step:\n " << cmdK2S.ToUTF8() << "\n";
|
||||
int result = 0;
|
||||
|
||||
do
|
||||
{
|
||||
wxMessageBox( _( "Unable to create STEP file." ),
|
||||
_( "STEP EXPORT" ), wxOK );
|
||||
wxBusyCursor dummy;
|
||||
result = wxExecute( cmdK2S, wxEXEC_SYNC | wxEXEC_HIDE_CONSOLE );
|
||||
} while( 0 );
|
||||
|
||||
if( result )
|
||||
{
|
||||
wxMessageBox(
|
||||
_( "Unable to create STEP file; check that the board has a valid outline and models." ),
|
||||
_( "STEP Export" ), wxOK );
|
||||
}
|
||||
|
||||
return;
|
||||
|
|
|
@ -471,12 +471,6 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
|
||||
// disable Export STEP item if kicad2step does not exist
|
||||
wxString strK2S = Pgm().GetExecutablePath();
|
||||
|
||||
#ifdef _WIN32
|
||||
// translate from KiCad's internal UNIX-like path to MSWin paths
|
||||
strK2S.Replace( "/", "\\" );
|
||||
#endif
|
||||
|
||||
wxFileName appK2S( strK2S, "kicad2step" );
|
||||
|
||||
#ifdef _WIN32
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
|
||||
// configuration file version
|
||||
#define CFGFILE_VERSION 1
|
||||
#define S3D_RESOLVER_CONFIG wxT( "3Dresolver.cfg" )
|
||||
#define S3D_RESOLVER_CONFIG "3Dresolver.cfg"
|
||||
|
||||
// flag bits used to track different one-off messages to users
|
||||
#define ERRFLG_ALIAS (1)
|
||||
|
@ -122,7 +122,7 @@ bool S3D_RESOLVER::SetProjectDir( const wxString& aProjDir, bool* flgChanged )
|
|||
if( aProjDir.empty() )
|
||||
return false;
|
||||
|
||||
wxFileName projdir( aProjDir, wxT( "" ) );
|
||||
wxFileName projdir( aProjDir, "" );
|
||||
projdir.Normalize();
|
||||
|
||||
if( false == projdir.DirExists() )
|
||||
|
@ -346,7 +346,7 @@ wxString S3D_RESOLVER::ResolvePath( const wxString& aFileName )
|
|||
|
||||
#ifdef _WIN32
|
||||
// translate from KiCad's internal UNIX-like path to MSWin paths
|
||||
tname.Replace( wxT( "/" ), wxT( "\\" ) );
|
||||
tname.Replace( "/", "\\" );
|
||||
#endif
|
||||
|
||||
// Note: variable expansion must preferably be performed via a
|
||||
|
@ -354,7 +354,7 @@ wxString S3D_RESOLVER::ResolvePath( const wxString& aFileName )
|
|||
// wxFileName::Normalize() routine to perform expansion then
|
||||
// we will have a race condition since wxWidgets does not assure
|
||||
// a threadsafe wrapper for getenv().
|
||||
if( tname.StartsWith( wxT( "${" ) ) || tname.StartsWith( wxT( "$(" ) ) )
|
||||
if( tname.StartsWith( "${" ) || tname.StartsWith( "$(" ) )
|
||||
tname = expandVars( tname );
|
||||
|
||||
wxFileName tmpFN( tname );
|
||||
|
@ -530,24 +530,24 @@ bool S3D_RESOLVER::addPath( const S3D_ALIAS& aPath )
|
|||
S3D_ALIAS tpath = aPath;
|
||||
|
||||
#ifdef _WIN32
|
||||
while( tpath.m_pathvar.EndsWith( wxT( "\\" ) ) )
|
||||
while( tpath.m_pathvar.EndsWith( "\\" ) )
|
||||
tpath.m_pathvar.erase( tpath.m_pathvar.length() - 1 );
|
||||
#else
|
||||
while( tpath.m_pathvar.EndsWith( wxT( "/" ) ) && tpath.m_pathvar.length() > 1 )
|
||||
while( tpath.m_pathvar.EndsWith( "/" ) && tpath.m_pathvar.length() > 1 )
|
||||
tpath.m_pathvar.erase( tpath.m_pathvar.length() - 1 );
|
||||
#endif
|
||||
|
||||
wxFileName path( tpath.m_pathvar, wxT( "" ) );
|
||||
wxFileName path( tpath.m_pathvar, "" );
|
||||
path.Normalize();
|
||||
|
||||
if( !path.DirExists() )
|
||||
{
|
||||
// suppress the message if the missing pathvar is the
|
||||
// legacy KISYS3DMOD variable
|
||||
if( aPath.m_pathvar.compare( wxT( "${KISYS3DMOD}" ) ) )
|
||||
if( aPath.m_pathvar.compare( "${KISYS3DMOD}" ) )
|
||||
{
|
||||
wxString msg = _( "The given path does not exist" );
|
||||
msg.append( wxT( "\n" ) );
|
||||
msg.append( "\n" );
|
||||
msg.append( tpath.m_pathvar );
|
||||
wxLogMessage( "%s\n", msg.ToUTF8() );
|
||||
}
|
||||
|
@ -559,10 +559,10 @@ bool S3D_RESOLVER::addPath( const S3D_ALIAS& aPath )
|
|||
tpath.m_pathexp = path.GetFullPath();
|
||||
|
||||
#ifdef _WIN32
|
||||
while( tpath.m_pathexp.EndsWith( wxT( "\\" ) ) )
|
||||
while( tpath.m_pathexp.EndsWith( "\\" ) )
|
||||
tpath.m_pathexp.erase( tpath.m_pathexp.length() - 1 );
|
||||
#else
|
||||
while( tpath.m_pathexp.EndsWith( wxT( "/" ) ) && tpath.m_pathexp.length() > 1 )
|
||||
while( tpath.m_pathexp.EndsWith( "/" ) && tpath.m_pathexp.length() > 1 )
|
||||
tpath.m_pathexp.erase( tpath.m_pathexp.length() - 1 );
|
||||
#endif
|
||||
}
|
||||
|
@ -577,10 +577,10 @@ bool S3D_RESOLVER::addPath( const S3D_ALIAS& aPath )
|
|||
{
|
||||
wxString msg = _( "Alias: " );
|
||||
msg.append( tpath.m_alias );
|
||||
msg.append( wxT( "\n" ) );
|
||||
msg.append( "\n" );
|
||||
msg.append( _( "This path: " ) );
|
||||
msg.append( tpath.m_pathvar );
|
||||
msg.append( wxT( "\n" ) );
|
||||
msg.append( "\n" );
|
||||
msg.append( _( "Existing path: " ) );
|
||||
msg.append( sPL->m_pathvar );
|
||||
wxMessageBox( msg, _( "Bad alias (duplicate name)" ) );
|
||||
|
@ -678,7 +678,7 @@ bool S3D_RESOLVER::readPathList( void )
|
|||
continue;
|
||||
|
||||
// never add on KISYS3DMOD from a config file
|
||||
if( !al.m_alias.Cmp( wxT( "KISYS3DMOD" ) ) )
|
||||
if( !al.m_alias.Cmp( "KISYS3DMOD" ) )
|
||||
continue;
|
||||
|
||||
if( !getHollerith( cfgLine, idx, al.m_pathvar ) )
|
||||
|
@ -912,7 +912,7 @@ wxString S3D_RESOLVER::ShortenPath( const wxString& aFullPathName )
|
|||
continue;
|
||||
}
|
||||
|
||||
wxFileName fpath( sL->m_pathexp, wxT( "" ) );
|
||||
wxFileName fpath( sL->m_pathexp, "" );
|
||||
wxString fps = fpath.GetPathWithSep();
|
||||
wxString tname;
|
||||
|
||||
|
@ -924,7 +924,7 @@ wxString S3D_RESOLVER::ShortenPath( const wxString& aFullPathName )
|
|||
|
||||
#ifdef _WIN32
|
||||
// ensure only the '/' separator is used in the internal name
|
||||
fname.Replace( wxT( "\\" ), wxT( "/" ) );
|
||||
fname.Replace( "\\", "/" );
|
||||
#endif
|
||||
|
||||
if( sL->m_alias.StartsWith( "${" ) || sL->m_alias.StartsWith( "$(" ) )
|
||||
|
@ -954,7 +954,7 @@ wxString S3D_RESOLVER::ShortenPath( const wxString& aFullPathName )
|
|||
// UNIX separator but this is done for consistency and can
|
||||
// be helpful even when transferring project files from
|
||||
// MSWin to *NIX.
|
||||
fname.Replace( wxT( "\\" ), wxT( "/" ) );
|
||||
fname.Replace( "\\", "/" );
|
||||
#endif
|
||||
|
||||
return fname;
|
||||
|
@ -974,10 +974,10 @@ bool S3D_RESOLVER::SplitAlias( const wxString& aFileName,
|
|||
anAlias.clear();
|
||||
aRelPath.clear();
|
||||
|
||||
if( !aFileName.StartsWith( wxT( ":" ) ) )
|
||||
if( !aFileName.StartsWith( ":" ) )
|
||||
return false;
|
||||
|
||||
size_t tagpos = aFileName.find( wxT( ":" ), 1 );
|
||||
size_t tagpos = aFileName.find( ":", 1 );
|
||||
|
||||
if( wxString::npos == tagpos || 1 == tagpos )
|
||||
return false;
|
||||
|
@ -1092,7 +1092,7 @@ bool S3D_RESOLVER::ValidateFileName( const wxString& aFileName, bool& hasAlias )
|
|||
// Rules:
|
||||
// 1. The generic form of an aliased 3D relative path is:
|
||||
// ALIAS:relative/path
|
||||
// 2. ALIAS is a UTF string excluding wxT( "{}[]()%~<>\"='`;:.,&?/\\|$" )
|
||||
// 2. ALIAS is a UTF string excluding "{}[]()%~<>\"='`;:.,&?/\\|$"
|
||||
// 3. The relative path must be a valid relative path for the platform
|
||||
hasAlias = false;
|
||||
|
||||
|
@ -1105,12 +1105,12 @@ bool S3D_RESOLVER::ValidateFileName( const wxString& aFileName, bool& hasAlias )
|
|||
|
||||
// ensure that the file separators suit the current platform
|
||||
#ifdef __WINDOWS__
|
||||
filename.Replace( wxT( "/" ), wxT( "\\" ) );
|
||||
filename.Replace( "/", "\\" );
|
||||
|
||||
// if we see the :\ pattern then it must be a drive designator
|
||||
if( pos0 != wxString::npos )
|
||||
{
|
||||
size_t pos1 = aFileName.find( wxT( ":\\" ) );
|
||||
size_t pos1 = aFileName.find( ":\\" );
|
||||
|
||||
if( pos1 != wxString::npos && ( pos1 != pos0 || pos1 != 1 ) )
|
||||
return false;
|
||||
|
@ -1120,7 +1120,7 @@ bool S3D_RESOLVER::ValidateFileName( const wxString& aFileName, bool& hasAlias )
|
|||
pos0 = wxString::npos;
|
||||
}
|
||||
#else
|
||||
filename.Replace( wxT( "\\" ), wxT( "/" ) );
|
||||
filename.Replace( "\\", "/" );
|
||||
#endif
|
||||
|
||||
// names may not end with ':'
|
||||
|
@ -1136,7 +1136,7 @@ bool S3D_RESOLVER::ValidateFileName( const wxString& aFileName, bool& hasAlias )
|
|||
lpath = filename.substr( 0, pos0 );
|
||||
|
||||
// check the alias for restricted characters
|
||||
if( wxString::npos != lpath.find_first_of( wxT( "{}[]()%~<>\"='`;:.,&?/\\|$" ) ) )
|
||||
if( wxString::npos != lpath.find_first_of( "{}[]()%~<>\"='`;:.,&?/\\|$" ) )
|
||||
return false;
|
||||
|
||||
hasAlias = true;
|
||||
|
|
|
@ -56,10 +56,10 @@ static wxString GetKicadConfigPath()
|
|||
#if !defined( __WINDOWS__ ) && !defined( __WXMAC__ )
|
||||
wxString envstr;
|
||||
|
||||
if( !wxGetEnv( wxT( "XDG_CONFIG_HOME" ), &envstr ) || envstr.IsEmpty() )
|
||||
if( !wxGetEnv( "XDG_CONFIG_HOME", &envstr ) || envstr.IsEmpty() )
|
||||
{
|
||||
// XDG_CONFIG_HOME is not set, so use the fallback
|
||||
cfgpath.AppendDir( wxT( ".config" ) );
|
||||
cfgpath.AppendDir( ".config" );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -68,7 +68,7 @@ static wxString GetKicadConfigPath()
|
|||
}
|
||||
#endif
|
||||
|
||||
cfgpath.AppendDir( wxT( "kicad" ) );
|
||||
cfgpath.AppendDir( "kicad" );
|
||||
|
||||
if( !cfgpath.DirExists() )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue