Commit 0bebc34a authored by Garth Corral's avatar Garth Corral

Merge trunk @ 5376

parents 267bca58 77fb1897
...@@ -54,15 +54,15 @@ if( Bazaar_EXECUTABLE ) ...@@ -54,15 +54,15 @@ if( Bazaar_EXECUTABLE )
# Fetch the Bazaar executable version. # Fetch the Bazaar executable version.
execute_process( COMMAND ${Bazaar_EXECUTABLE} --version execute_process( COMMAND ${Bazaar_EXECUTABLE} --version
OUTPUT_VARIABLE bzr_version_output OUTPUT_VARIABLE _bzr_version_output
ERROR_VARIABLE _bzr_version_error ERROR_VARIABLE _bzr_version_error
RESULT_VARIABLE _bzr_version_result RESULT_VARIABLE _bzr_version_result
OUTPUT_STRIP_TRAILING_WHITESPACE ) OUTPUT_STRIP_TRAILING_WHITESPACE )
if( ${_bzr_version_result} EQUAL 0 ) if( ${_bzr_version_result} EQUAL 0 )
set( Bazaar_FOUND TRUE ) set( Bazaar_FOUND TRUE )
string( REGEX REPLACE "^(.*\n)? \(bzr\) ([^\n]+).*" string( REGEX REPLACE "^[\n]*Bazaar \\(bzr\\) ([0-9.a-z]+).*"
"\\2" Bazaar_VERSION "${_bzr_version_output}" ) "\\1" Bazaar_VERSION "${_bzr_version_output}" )
message( STATUS "Bazaar version control system version ${Bazaar_VERSION} found." ) message( STATUS "Bazaar version control system version ${Bazaar_VERSION} found." )
endif( ${_bzr_version_result} EQUAL 0 ) endif( ${_bzr_version_result} EQUAL 0 )
......
...@@ -646,7 +646,8 @@ WARN_LOGFILE = ...@@ -646,7 +646,8 @@ WARN_LOGFILE =
# directories like "/usr/src/myproject". Separate the files or directories # directories like "/usr/src/myproject". Separate the files or directories
# with spaces. # with spaces.
INPUT = stable-release-policy.md \ INPUT = coding-style-policy.md \
stable-release-policy.md \
road-map.md road-map.md
# This tag can be used to specify the character encoding of the source files # This tag can be used to specify the character encoding of the source files
......
This diff is collapsed.
...@@ -645,7 +645,8 @@ WARN_LOGFILE = ...@@ -645,7 +645,8 @@ WARN_LOGFILE =
# directories like "/usr/src/myproject". Separate the files or directories # directories like "/usr/src/myproject". Separate the files or directories
# with spaces. # with spaces.
INPUT = Documentation/development/stable-release-policy.md \ INPUT = Documentation/development/coding-style-policy.md \
Documentation/development/stable-release-policy.md \
Documentation/development/road-map.md \ Documentation/development/road-map.md \
kicad \ kicad \
pcbnew \ pcbnew \
......
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2013 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2013 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
...@@ -629,6 +629,13 @@ void EDA_BASE_FRAME::CopyVersionInfoToClipboard( wxCommandEvent& event ) ...@@ -629,6 +629,13 @@ void EDA_BASE_FRAME::CopyVersionInfoToClipboard( wxCommandEvent& event )
tmp << wxT( "OFF\n" ); tmp << wxT( "OFF\n" );
#endif #endif
tmp << wxT( " KICAD_USE_WEBKIT=" );
#ifdef KICAD_USE_WEBKIT
tmp << wxT( "ON\n" );
#else
tmp << wxT( "OFF\n" );
#endif
wxMessageBox( tmp, _("Version Information (copied to the clipboard)") ); wxMessageBox( tmp, _("Version Information (copied to the clipboard)") );
wxTheClipboard->SetData( new wxTextDataObject( tmp ) ); wxTheClipboard->SetData( new wxTextDataObject( tmp ) );
......
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2014 KiCad Developers, see CHANGELOG.TXT for contributors. * Copyright (C) 2015 KiCad Developers, see CHANGELOG.TXT for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#endif #endif
#ifndef KICAD_BUILD_VERSION #ifndef KICAD_BUILD_VERSION
# define KICAD_BUILD_VERSION "(2014-jul-16 BZR unknown)" # define KICAD_BUILD_VERSION "(after 2015-jan-16 BZR unknown)"
#endif #endif
/** /**
......
...@@ -212,29 +212,26 @@ void AddUnitSymbol( wxStaticText& Stext, EDA_UNITS_T aUnit ) ...@@ -212,29 +212,26 @@ void AddUnitSymbol( wxStaticText& Stext, EDA_UNITS_T aUnit )
} }
wxArrayString* wxStringSplit( wxString aString, wxChar aSplitter ) void wxStringSplit( const wxString& aText, wxArrayString& aStrings, wxChar aSplitter )
{ {
wxArrayString* list = new wxArrayString(); wxString tmp;
while( 1 ) for( unsigned ii = 0; ii < aText.Length(); ii++ )
{ {
int index = aString.Find( aSplitter ); if( aText[ii] == aSplitter )
{
if( index == wxNOT_FOUND ) aStrings.Add( tmp );
break; tmp.Clear();
}
wxString tmp; else
tmp = aString.Mid( 0, index ); tmp << aText[ii];
aString = aString.Mid( index + 1, aString.size() - index );
list->Add( tmp );
} }
if( !aString.IsEmpty() ) if( !tmp.IsEmpty() )
{ {
list->Add( aString ); aStrings.Add( tmp );
} }
return list;
} }
......
...@@ -490,6 +490,7 @@ void PARAM_CFG_LIBNAME_LIST::ReadParam( wxConfigBase* aConfig ) const ...@@ -490,6 +490,7 @@ void PARAM_CFG_LIBNAME_LIST::ReadParam( wxConfigBase* aConfig ) const
id_lib << indexlib; id_lib << indexlib;
indexlib++; indexlib++;
libname = aConfig->Read( id_lib, wxT( "" ) ); libname = aConfig->Read( id_lib, wxT( "" ) );
if( libname.IsEmpty() ) if( libname.IsEmpty() )
break; break;
// file names are stored using Unix notation // file names are stored using Unix notation
......
...@@ -636,6 +636,7 @@ void PLOTTER::Text( const wxPoint& aPos, ...@@ -636,6 +636,7 @@ void PLOTTER::Text( const wxPoint& aPos,
{ {
// EDA_TEXT needs for calculations of the position of every // EDA_TEXT needs for calculations of the position of every
// line according to orientation and justifications // line according to orientation and justifications
wxArrayString strings;
EDA_TEXT* multilineText = new EDA_TEXT( aText ); EDA_TEXT* multilineText = new EDA_TEXT( aText );
multilineText->SetSize( aSize ); multilineText->SetSize( aSize );
multilineText->SetTextPosition( aPos ); multilineText->SetTextPosition( aPos );
...@@ -646,15 +647,15 @@ void PLOTTER::Text( const wxPoint& aPos, ...@@ -646,15 +647,15 @@ void PLOTTER::Text( const wxPoint& aPos,
multilineText->SetMultilineAllowed( aMultilineAllowed ); multilineText->SetMultilineAllowed( aMultilineAllowed );
std::vector<wxPoint> positions; std::vector<wxPoint> positions;
wxArrayString* list = wxStringSplit( aText, '\n' ); wxStringSplit( aText, strings, '\n' );
positions.reserve( list->Count() ); positions.reserve( strings.Count() );
multilineText->GetPositionsOfLinesOfMultilineText( multilineText->GetPositionsOfLinesOfMultilineText(
positions, list->Count() ); positions, strings.Count() );
for( unsigned ii = 0; ii < list->Count(); ii++ ) for( unsigned ii = 0; ii < strings.Count(); ii++ )
{ {
wxString& txt = list->Item( ii ); wxString& txt = strings.Item( ii );
DrawGraphicText( NULL, NULL, positions[ii], aColor, txt, DrawGraphicText( NULL, NULL, positions[ii], aColor, txt,
aOrient, aSize, aOrient, aSize,
aH_justify, aV_justify, aH_justify, aV_justify,
...@@ -663,8 +664,8 @@ void PLOTTER::Text( const wxPoint& aPos, ...@@ -663,8 +664,8 @@ void PLOTTER::Text( const wxPoint& aPos,
NULL, NULL,
this ); this );
} }
delete multilineText; delete multilineText;
delete list;
} }
else else
{ {
......
...@@ -120,23 +120,23 @@ EDA_RECT EDA_TEXT::GetTextBox( int aLine, int aThickness, bool aInvertY ) const ...@@ -120,23 +120,23 @@ EDA_RECT EDA_TEXT::GetTextBox( int aLine, int aThickness, bool aInvertY ) const
{ {
EDA_RECT rect; EDA_RECT rect;
wxPoint pos; wxPoint pos;
wxArrayString* list = NULL; wxArrayString strings;
wxString text = GetShownText(); wxString text = GetShownText();
int thickness = ( aThickness < 0 ) ? m_Thickness : aThickness; int thickness = ( aThickness < 0 ) ? m_Thickness : aThickness;
int linecount = 1; int linecount = 1;
if( m_MultilineAllowed ) if( m_MultilineAllowed )
{ {
list = wxStringSplit( text, '\n' ); wxStringSplit( text, strings, '\n' );
if ( list->GetCount() ) // GetCount() == 0 for void strings if ( strings.GetCount() ) // GetCount() == 0 for void strings
{ {
if( aLine >= 0 && (aLine < (int)list->GetCount()) ) if( aLine >= 0 && (aLine < (int)strings.GetCount()) )
text = list->Item( aLine ); text = strings.Item( aLine );
else else
text = list->Item( 0 ); text = strings.Item( 0 );
linecount = list->GetCount(); linecount = strings.GetCount();
} }
} }
...@@ -157,19 +157,17 @@ EDA_RECT EDA_TEXT::GetTextBox( int aLine, int aThickness, bool aInvertY ) const ...@@ -157,19 +157,17 @@ EDA_RECT EDA_TEXT::GetTextBox( int aLine, int aThickness, bool aInvertY ) const
rect.Move( wxPoint( 0, -extra_dy / 2 ) ); // move origin by the half extra interval rect.Move( wxPoint( 0, -extra_dy / 2 ) ); // move origin by the half extra interval
// for multiline texts and aLine < 0, merge all rectangles // for multiline texts and aLine < 0, merge all rectangles
if( m_MultilineAllowed && list && aLine < 0 ) if( m_MultilineAllowed && aLine < 0 )
{ {
for( unsigned ii = 1; ii < list->GetCount(); ii++ ) for( unsigned ii = 1; ii < strings.GetCount(); ii++ )
{ {
text = list->Item( ii ); text = strings.Item( ii );
dx = LenSize( text ); dx = LenSize( text );
textsize.x = std::max( textsize.x, dx ); textsize.x = std::max( textsize.x, dx );
textsize.y += dy; textsize.y += dy;
} }
} }
delete list;
rect.SetSize( textsize ); rect.SetSize( textsize );
/* Now, calculate the rect origin, according to text justification /* Now, calculate the rect origin, according to text justification
...@@ -272,19 +270,18 @@ void EDA_TEXT::Draw( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset, ...@@ -272,19 +270,18 @@ void EDA_TEXT::Draw( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset,
if( m_MultilineAllowed ) if( m_MultilineAllowed )
{ {
std::vector<wxPoint> positions; std::vector<wxPoint> positions;
wxArrayString* list = wxStringSplit( GetShownText(), '\n' ); wxArrayString strings;
positions.reserve( list->Count() ); wxStringSplit( GetShownText(), strings, '\n' );
positions.reserve( strings.Count() );
GetPositionsOfLinesOfMultilineText(positions, list->Count() ); GetPositionsOfLinesOfMultilineText(positions, strings.Count() );
for( unsigned ii = 0; ii < list->Count(); ii++ ) for( unsigned ii = 0; ii < strings.Count(); ii++ )
{ {
wxString& txt = list->Item( ii ); wxString& txt = strings.Item( ii );
drawOneLineOfText( aClipBox, aDC, aOffset, aColor, drawOneLineOfText( aClipBox, aDC, aOffset, aColor,
aDrawMode, aFillMode, txt, positions[ii] ); aDrawMode, aFillMode, txt, positions[ii] );
} }
delete (list);
} }
else else
drawOneLineOfText( aClipBox, aDC, aOffset, aColor, drawOneLineOfText( aClipBox, aDC, aOffset, aColor,
...@@ -489,22 +486,21 @@ void EDA_TEXT::TransformTextShapeToSegmentList( std::vector<wxPoint>& aCornerBuf ...@@ -489,22 +486,21 @@ void EDA_TEXT::TransformTextShapeToSegmentList( std::vector<wxPoint>& aCornerBuf
if( IsMultilineAllowed() ) if( IsMultilineAllowed() )
{ {
wxArrayString* list = wxStringSplit( GetShownText(), '\n' ); wxArrayString strings_list;
wxStringSplit( GetShownText(), strings_list, wxChar('\n') );
std::vector<wxPoint> positions; std::vector<wxPoint> positions;
positions.reserve( list->Count() ); positions.reserve( strings_list.Count() );
GetPositionsOfLinesOfMultilineText( positions, list->Count() ); GetPositionsOfLinesOfMultilineText( positions,strings_list.Count() );
for( unsigned ii = 0; ii < list->Count(); ii++ ) for( unsigned ii = 0; ii < strings_list.Count(); ii++ )
{ {
wxString txt = list->Item( ii ); wxString txt = strings_list.Item( ii );
DrawGraphicText( NULL, NULL, positions[ii], color, DrawGraphicText( NULL, NULL, positions[ii], color,
txt, GetOrientation(), size, txt, GetOrientation(), size,
GetHorizJustify(), GetVertJustify(), GetHorizJustify(), GetVertJustify(),
GetThickness(), IsItalic(), GetThickness(), IsItalic(),
true, addTextSegmToBuffer ); true, addTextSegmToBuffer );
} }
delete list;
} }
else else
{ {
......
...@@ -51,23 +51,20 @@ void HTML_MESSAGE_BOX::ListClear() ...@@ -51,23 +51,20 @@ void HTML_MESSAGE_BOX::ListClear()
void HTML_MESSAGE_BOX::ListSet( const wxString& aList ) void HTML_MESSAGE_BOX::ListSet( const wxString& aList )
{ {
// wxArrayString* wxStringSplit( wxString txt, wxChar splitter ); wxArrayString strings_list;
wxStringSplit( aList, strings_list, wxChar( '\n' ) );
wxArrayString* strings_list = wxStringSplit( aList, wxChar( '\n' ) );
wxString msg = wxT( "<ul>" ); wxString msg = wxT( "<ul>" );
for ( unsigned ii = 0; ii < strings_list->GetCount(); ii++ ) for ( unsigned ii = 0; ii < strings_list.GetCount(); ii++ )
{ {
msg += wxT( "<li>" ); msg += wxT( "<li>" );
msg += strings_list->Item( ii ) + wxT( "</li>" ); msg += strings_list.Item( ii ) + wxT( "</li>" );
} }
msg += wxT( "</ul>" ); msg += wxT( "</ul>" );
m_htmlWindow->AppendToPage( msg ); m_htmlWindow->AppendToPage( msg );
delete strings_list;
} }
......
...@@ -331,8 +331,14 @@ bool PROJECT::ConfigLoad( const SEARCH_STACK& aSList, const wxString& aGroupNam ...@@ -331,8 +331,14 @@ bool PROJECT::ConfigLoad( const SEARCH_STACK& aSList, const wxString& aGroupNam
m_pro_date_and_time = timestamp; m_pro_date_and_time = timestamp;
// We do not want expansion of env var values when reading our project config file
bool state = cfg.get()->IsExpandingEnvVars();
cfg.get()->SetExpandEnvVars( false );
wxConfigLoadParams( cfg.get(), aParams, aGroupName ); wxConfigLoadParams( cfg.get(), aParams, aGroupName );
cfg.get()->SetExpandEnvVars( state );
return true; return true;
} }
......
...@@ -8,7 +8,7 @@ endif() ...@@ -8,7 +8,7 @@ endif()
add_definitions( -DCVPCB ) add_definitions( -DCVPCB )
if( KICAD_USE_WEBKITT AND BUILD_GITHUB_PLUGIN ) if( KICAD_USE_WEBKIT AND BUILD_GITHUB_PLUGIN )
set( WEBVIEWER_WXLIB "webviewer" ) set( WEBVIEWER_WXLIB "webviewer" )
add_definitions( -DKICAD_USE_WEBKIT ) add_definitions( -DKICAD_USE_WEBKIT )
endif() endif()
...@@ -31,6 +31,8 @@ set( CVPCB_DIALOGS ...@@ -31,6 +31,8 @@ set( CVPCB_DIALOGS
dialogs/fp_conflict_assignment_selector.cpp dialogs/fp_conflict_assignment_selector.cpp
dialogs/dialog_display_options.cpp dialogs/dialog_display_options.cpp
dialogs/dialog_display_options_base.cpp dialogs/dialog_display_options_base.cpp
dialogs/dialog_config_equfiles_base.cpp
dialogs/dialog_config_equfiles.cpp
../pcbnew/dialogs/dialog_fp_lib_table.cpp ../pcbnew/dialogs/dialog_fp_lib_table.cpp
../pcbnew/dialogs/dialog_fp_lib_table_base.cpp ../pcbnew/dialogs/dialog_fp_lib_table_base.cpp
../pcbnew/dialogs/dialog_fp_plugin_options.cpp ../pcbnew/dialogs/dialog_fp_plugin_options.cpp
......
This diff is collapsed.
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2015 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
*/
#ifndef AUTOSEL_H
#define AUTOSEL_H
// A helper class to handle info read in .equ files, which gives a footprint FPID
// corresponding to a component value.
// Each line is something like:
// 'FT232BL' 'QFP:LQFP-32_7x7mm_Pitch0.8mm'
//
class FOOTPRINT_EQUIVALENCE
{
public:
wxString m_ComponentValue; // The value of a component
wxString m_FootprintFPID; // the footprint FPID corresponding to this value
FOOTPRINT_EQUIVALENCE() {}
};
typedef boost::ptr_vector< FOOTPRINT_EQUIVALENCE > FOOTPRINT_EQUIVALENCE_LIST;
#endif // ifndef AUTOSEL_H
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2007 Jean-Pierre Charras, jean-pierre.charras * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -50,7 +50,7 @@ PARAM_CFG_ARRAY& CVPCB_MAINFRAME::GetProjectFileParameters() ...@@ -50,7 +50,7 @@ PARAM_CFG_ARRAY& CVPCB_MAINFRAME::GetProjectFileParameters()
m_projectFileParams.push_back( new PARAM_CFG_BASE( GROUP_PCB_LIBS, PARAM_COMMAND_ERASE ) ); m_projectFileParams.push_back( new PARAM_CFG_BASE( GROUP_PCB_LIBS, PARAM_COMMAND_ERASE ) );
m_projectFileParams.push_back( new PARAM_CFG_LIBNAME_LIST( m_projectFileParams.push_back( new PARAM_CFG_LIBNAME_LIST(
wxT( "EquName" ), &m_AliasLibNames, GROUP_CVP_EQU ) ); wxT( "EquName" ), &m_EquFilesNames, GROUP_CVP_EQU ) );
m_projectFileParams.push_back( new PARAM_CFG_WXSTRING( m_projectFileParams.push_back( new PARAM_CFG_WXSTRING(
wxT( "NetIExt" ), &m_NetlistFileExtension ) ); wxT( "NetIExt" ), &m_NetlistFileExtension ) );
...@@ -64,9 +64,8 @@ void CVPCB_MAINFRAME::LoadProjectFile() ...@@ -64,9 +64,8 @@ void CVPCB_MAINFRAME::LoadProjectFile()
PROJECT& prj = Prj(); PROJECT& prj = Prj();
m_ModuleLibNames.Clear(); m_ModuleLibNames.Clear();
m_AliasLibNames.Clear(); m_EquFilesNames.Clear();
// was: Pgm().ReadProjectConfig( fn.GetFullPath(), GROUP, GetProjectFileParameters(), false );
prj.ConfigLoad( Kiface().KifaceSearch(), GROUP_CVP, GetProjectFileParameters() ); prj.ConfigLoad( Kiface().KifaceSearch(), GROUP_CVP, GetProjectFileParameters() );
if( m_NetlistFileExtension.IsEmpty() ) if( m_NetlistFileExtension.IsEmpty() )
...@@ -77,27 +76,15 @@ void CVPCB_MAINFRAME::LoadProjectFile() ...@@ -77,27 +76,15 @@ void CVPCB_MAINFRAME::LoadProjectFile()
void CVPCB_MAINFRAME::SaveProjectFile( wxCommandEvent& aEvent ) void CVPCB_MAINFRAME::SaveProjectFile( wxCommandEvent& aEvent )
{ {
PROJECT& prj = Prj(); PROJECT& prj = Prj();
wxFileName fn = prj.AbsolutePath( m_NetlistFileName.GetFullPath() ); SetTitle( wxString::Format( _( "Project file: '%s'" ), GetChars( prj.GetProjectFullName() ) ) );
wxFileName fn = prj.GetProjectFullName();
fn.SetExt( ProjectFileExtension ); if( !IsWritable( fn ) )
if( aEvent.GetId() == ID_SAVE_PROJECT_AS || !m_NetlistFileName.IsOk() )
{ {
wxFileDialog dlg( this, _( "Save Project File" ), fn.GetPath(), wxMessageBox( _( "Project file '%s' is not writable" ), fn.GetFullPath() );
wxEmptyString, ProjectFileWildcard, wxFD_SAVE );
if( dlg.ShowModal() == wxID_CANCEL )
return; return;
fn = dlg.GetPath();
if( !fn.HasExt() )
fn.SetExt( ProjectFileExtension );
} }
if( !IsWritable( fn ) )
return;
wxString pro_name = fn.GetFullPath(); wxString pro_name = fn.GetFullPath();
prj.ConfigSave( Kiface().KifaceSearch(), GROUP_CVP, GetProjectFileParameters(), pro_name ); prj.ConfigSave( Kiface().KifaceSearch(), GROUP_CVP, GetProjectFileParameters(), pro_name );
......
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2009 Jean-Pierre Charras, jean-pierre.charras * Copyright (C) 2015 Jean-Pierre Charras, jean-pierre.charras
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
* *
...@@ -69,8 +69,8 @@ BEGIN_EVENT_TABLE( CVPCB_MAINFRAME, EDA_BASE_FRAME ) ...@@ -69,8 +69,8 @@ BEGIN_EVENT_TABLE( CVPCB_MAINFRAME, EDA_BASE_FRAME )
EVT_MENU( wxID_HELP, CVPCB_MAINFRAME::GetKicadHelp ) EVT_MENU( wxID_HELP, CVPCB_MAINFRAME::GetKicadHelp )
EVT_MENU( wxID_ABOUT, CVPCB_MAINFRAME::GetKicadAbout ) EVT_MENU( wxID_ABOUT, CVPCB_MAINFRAME::GetKicadAbout )
EVT_MENU( ID_SAVE_PROJECT, CVPCB_MAINFRAME::SaveProjectFile ) EVT_MENU( ID_SAVE_PROJECT, CVPCB_MAINFRAME::SaveProjectFile )
EVT_MENU( ID_SAVE_PROJECT_AS, CVPCB_MAINFRAME::SaveProjectFile )
EVT_MENU( ID_CVPCB_CONFIG_KEEP_OPEN_ON_SAVE, CVPCB_MAINFRAME::OnKeepOpenOnSave ) EVT_MENU( ID_CVPCB_CONFIG_KEEP_OPEN_ON_SAVE, CVPCB_MAINFRAME::OnKeepOpenOnSave )
EVT_MENU( ID_CVPCB_EQUFILES_LIST_EDIT, CVPCB_MAINFRAME::OnEditEquFilesList )
// Toolbar events // Toolbar events
EVT_TOOL( ID_CVPCB_QUIT, CVPCB_MAINFRAME::OnQuit ) EVT_TOOL( ID_CVPCB_QUIT, CVPCB_MAINFRAME::OnQuit )
...@@ -80,7 +80,7 @@ BEGIN_EVENT_TABLE( CVPCB_MAINFRAME, EDA_BASE_FRAME ) ...@@ -80,7 +80,7 @@ BEGIN_EVENT_TABLE( CVPCB_MAINFRAME, EDA_BASE_FRAME )
EVT_TOOL( ID_CVPCB_GOTO_FIRSTNA, CVPCB_MAINFRAME::ToFirstNA ) EVT_TOOL( ID_CVPCB_GOTO_FIRSTNA, CVPCB_MAINFRAME::ToFirstNA )
EVT_TOOL( ID_CVPCB_GOTO_PREVIOUSNA, CVPCB_MAINFRAME::ToPreviousNA ) EVT_TOOL( ID_CVPCB_GOTO_PREVIOUSNA, CVPCB_MAINFRAME::ToPreviousNA )
EVT_TOOL( ID_CVPCB_DEL_ASSOCIATIONS, CVPCB_MAINFRAME::DelAssociations ) EVT_TOOL( ID_CVPCB_DEL_ASSOCIATIONS, CVPCB_MAINFRAME::DelAssociations )
EVT_TOOL( ID_CVPCB_AUTO_ASSOCIE, CVPCB_MAINFRAME::AssocieModule ) EVT_TOOL( ID_CVPCB_AUTO_ASSOCIE, CVPCB_MAINFRAME::AutomaticFootprintMatching )
EVT_TOOL( ID_PCB_DISPLAY_FOOTPRINT_DOC, CVPCB_MAINFRAME::DisplayDocFile ) EVT_TOOL( ID_PCB_DISPLAY_FOOTPRINT_DOC, CVPCB_MAINFRAME::DisplayDocFile )
EVT_TOOL( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST, EVT_TOOL( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST,
CVPCB_MAINFRAME::OnSelectFilteringFootprint ) CVPCB_MAINFRAME::OnSelectFilteringFootprint )
...@@ -160,6 +160,7 @@ CVPCB_MAINFRAME::CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent ) : ...@@ -160,6 +160,7 @@ CVPCB_MAINFRAME::CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent ) :
m_auimgr.SetManagedWindow( this ); m_auimgr.SetManagedWindow( this );
UpdateTitle();
EDA_PANEINFO horiz; EDA_PANEINFO horiz;
horiz.HorizontalToolbarPane(); horiz.HorizontalToolbarPane();
...@@ -369,10 +370,12 @@ void CVPCB_MAINFRAME::ToPreviousNA( wxCommandEvent& event ) ...@@ -369,10 +370,12 @@ void CVPCB_MAINFRAME::ToPreviousNA( wxCommandEvent& event )
void CVPCB_MAINFRAME::SaveQuitCvpcb( wxCommandEvent& aEvent ) void CVPCB_MAINFRAME::SaveQuitCvpcb( wxCommandEvent& aEvent )
{ {
if( aEvent.GetId() == wxID_SAVEAS ) wxString fullFilename;
m_NetlistFileName.Clear();
if( aEvent.GetId() != wxID_SAVEAS )
fullFilename = m_NetlistFileName.GetFullPath();
if( SaveCmpLinkFile( m_NetlistFileName.GetFullPath() ) > 0 ) if( SaveCmpLinkFile( fullFilename ) > 0 )
{ {
m_modified = false; m_modified = false;
...@@ -684,32 +687,33 @@ void CVPCB_MAINFRAME::DisplayStatus() ...@@ -684,32 +687,33 @@ void CVPCB_MAINFRAME::DisplayStatus()
} }
msg.Empty(); msg.Empty();
wxString filters;
if( m_footprintListBox ) if( m_footprintListBox )
{ {
if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST ) ) if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST ) )
msg = _( "key words" ); filters = _( "key words" );
if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST ) ) if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST ) )
{ {
if( !msg.IsEmpty() ) if( !filters.IsEmpty() )
msg += wxT( ", " ); filters += wxT( "+" );
msg += _( "pin count" ); filters += _( "pin count" );
} }
if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST ) ) if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST ) )
{ {
if( !msg.IsEmpty() ) if( !filters.IsEmpty() )
msg += wxT( ", " ); filters += wxT( "+" );
msg += _( "library" ); filters += _( "library" );
} }
if( msg.IsEmpty() ) if( filters.IsEmpty() )
msg = _( "No filtering" ); msg = _( "No filtering" );
else else
msg = _( "Filtered by " ) + msg; msg.Printf( _( "Filtered by %s" ), GetChars( filters ) );
msg << wxT( ": " ) << m_footprintListBox->GetCount(); msg << wxT( ": " ) << m_footprintListBox->GetCount();
...@@ -744,18 +748,21 @@ bool CVPCB_MAINFRAME::LoadFootprintFiles() ...@@ -744,18 +748,21 @@ bool CVPCB_MAINFRAME::LoadFootprintFiles()
void CVPCB_MAINFRAME::UpdateTitle() void CVPCB_MAINFRAME::UpdateTitle()
{ {
wxString title = wxString::Format( wxT( "Cvpcb %s " ), GetChars( GetBuildVersion() ) ); wxString title = wxString::Format( wxT( "Cvpcb %s " ), GetChars( GetBuildVersion() ) );
PROJECT& prj = Prj();
wxFileName fn = prj.GetProjectFullName();
if( m_NetlistFileName.IsOk() && m_NetlistFileName.FileExists() ) if( fn.IsOk() && !prj.GetProjectFullName().IsEmpty() && fn.FileExists() )
{ {
title += m_NetlistFileName.GetFullPath(); title += wxString::Format( _("Project: '%s' (netlist: '%s')"),
GetChars( fn.GetFullPath() ),
GetChars( m_NetlistFileName.GetFullName() )
);
if( !m_NetlistFileName.IsFileWritable() ) if( !fn.IsFileWritable() )
title += _( " [Read Only]" ); title += _( " [Read Only]" );
} }
else else
{ title += _( "[no project]" );
title += _( "[no file]" );
}
SetTitle( title ); SetTitle( title );
} }
......
...@@ -51,10 +51,10 @@ ...@@ -51,10 +51,10 @@
COLORS_DESIGN_SETTINGS g_ColorsSettings; COLORS_DESIGN_SETTINGS g_ColorsSettings;
// Constant string definitions for CvPcb // Constant string definitions for CvPcb
const wxString FootprintAliasFileExtension( wxT( "equ" ) ); const wxString EquFileExtension( wxT( "equ" ) );
// Wildcard for schematic retroannotation (import footprint names in schematic): // Wildcard for schematic retroannotation (import footprint names in schematic):
const wxString FootprintAliasFileWildcard( _( "KiCad footprint alias files (*.equ)|*.equ" ) ); const wxString EquFilesWildcard( _( "Component/footprint equ files (*.equ)|*.equ" ) );
#if 0 // add this logic to OpenProjectFiles() #if 0 // add this logic to OpenProjectFiles()
......
...@@ -36,8 +36,8 @@ ...@@ -36,8 +36,8 @@
#define LISTB_STYLE ( wxSUNKEN_BORDER | wxLC_NO_HEADER | wxLC_REPORT | wxLC_VIRTUAL | \ #define LISTB_STYLE ( wxSUNKEN_BORDER | wxLC_NO_HEADER | wxLC_REPORT | wxLC_VIRTUAL | \
wxLC_SINGLE_SEL | wxVSCROLL | wxHSCROLL ) wxLC_SINGLE_SEL | wxVSCROLL | wxHSCROLL )
extern const wxString FootprintAliasFileExtension; extern const wxString EquFileExtension;
extern const wxString FootprintAliasFileWildcard; extern const wxString EquFilesWildcard;
#endif /* __CVPCB_H__ */ #endif /* __CVPCB_H__ */
...@@ -56,5 +56,6 @@ enum id_cvpcb_frm ...@@ -56,5 +56,6 @@ enum id_cvpcb_frm
ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST, ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST,
ID_CVPCB_CONFIG_KEEP_OPEN_ON_SAVE, ID_CVPCB_CONFIG_KEEP_OPEN_ON_SAVE,
ID_CVPCB_LIBRARY_LIST, ID_CVPCB_LIBRARY_LIST,
ID_CVPCB_EQUFILES_LIST_EDIT,
ID_CVPCB_LIB_TABLE_EDIT ID_CVPCB_LIB_TABLE_EDIT
}; };
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include <wxBasePcbFrame.h> #include <wxBasePcbFrame.h>
#include <config_params.h> #include <config_params.h>
#include <autosel.h>
/* Forward declarations of all top-level window classes. */ /* Forward declarations of all top-level window classes. */
...@@ -66,7 +67,7 @@ public: ...@@ -66,7 +67,7 @@ public:
wxAuiToolBar* m_mainToolBar; wxAuiToolBar* m_mainToolBar;
wxFileName m_NetlistFileName; wxFileName m_NetlistFileName;
wxArrayString m_ModuleLibNames; wxArrayString m_ModuleLibNames;
wxArrayString m_AliasLibNames; wxArrayString m_EquFilesNames;
wxString m_NetlistFileExtension; wxString m_NetlistFileExtension;
wxString m_DocModulesFileName; wxString m_DocModulesFileName;
FOOTPRINT_LIST m_footprints; FOOTPRINT_LIST m_footprints;
...@@ -137,10 +138,16 @@ public: ...@@ -137,10 +138,16 @@ public:
/** /**
* Function OnEditLibraryTable * Function OnEditLibraryTable
* envokes the footpirnt library table edit dialog. * envokes the footprint library table edit dialog.
*/ */
void OnEditFootprintLibraryTable( wxCommandEvent& aEvent ); void OnEditFootprintLibraryTable( wxCommandEvent& aEvent );
/**
* Function OnEditEquFilesList
* envokes the equ files list edit dialog.
*/
void OnEditEquFilesList( wxCommandEvent& aEvent );
void OnKeepOpenOnSave( wxCommandEvent& event ); void OnKeepOpenOnSave( wxCommandEvent& event );
void DisplayModule( wxCommandEvent& event ); void DisplayModule( wxCommandEvent& event );
...@@ -152,7 +159,7 @@ public: ...@@ -152,7 +159,7 @@ public:
* format of a line: * format of a line:
* 'cmp_ref' 'footprint_name' * 'cmp_ref' 'footprint_name'
*/ */
void AssocieModule( wxCommandEvent& event ); void AutomaticFootprintMatching( wxCommandEvent& event );
void DisplayDocFile( wxCommandEvent& event ); void DisplayDocFile( wxCommandEvent& event );
...@@ -171,6 +178,7 @@ public: ...@@ -171,6 +178,7 @@ public:
* @param aFootprintName = the selected footprint * @param aFootprintName = the selected footprint
*/ */
void SetNewPkg( const wxString& aFootprintName ); void SetNewPkg( const wxString& aFootprintName );
void BuildCmpListBox(); void BuildCmpListBox();
void BuildFOOTPRINTS_LISTBOX(); void BuildFOOTPRINTS_LISTBOX();
void BuildLIBRARY_LISTBOX(); void BuildLIBRARY_LISTBOX();
...@@ -286,6 +294,17 @@ public: ...@@ -286,6 +294,17 @@ public:
COMPONENT* GetSelectedComponent(); COMPONENT* GetSelectedComponent();
private:
/**
* read the .equ files and populate the list of equvalents
* @param aList the list to populate
* @param aErrorMessages is a pointer to a wxString to store error messages
* (can be NULL)
* @return the error count ( 0 = no error)
*/
int buildEquivalenceList( FOOTPRINT_EQUIVALENCE_LIST& aList, wxString * aErrorMessages = NULL );
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
......
/**
* @file dialog_config_equfiles.cpp
*/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <fctsys.h>
#include <pgm_base.h>
#include <common.h>
#include <confirm.h>
#include <gestfich.h>
#include <id.h>
#include <project.h> // For PROJECT_VAR_NAME definition
#include <fp_lib_table.h> // For KISYSMOD definition
#include <cvpcb.h>
#include <cvpcb_mainframe.h>
#include <dialog_config_equfiles.h>
#include <wildcards_and_files_ext.h>
DIALOG_CONFIG_EQUFILES::DIALOG_CONFIG_EQUFILES( CVPCB_MAINFRAME* aParent ) :
DIALOG_CONFIG_EQUFILES_BASE( aParent )
{
m_Parent = aParent;
m_Config = Pgm().CommonSettings();
PROJECT& prj = Prj();
SetTitle( wxString::Format( _( "Project file: '%s'" ), GetChars( prj.GetProjectFullName() ) ) );
Init( );
GetSizer()->SetSizeHints( this );
Center();
}
void CVPCB_MAINFRAME::OnEditEquFilesList( wxCommandEvent& aEvent )
{
DIALOG_CONFIG_EQUFILES dlg( this );
dlg.ShowModal();
}
void DIALOG_CONFIG_EQUFILES::Init()
{
m_sdbSizerOK->SetDefault();
m_ListChanged = false;
m_ListEquiv->InsertItems( m_Parent->m_EquFilesNames, 0 );
if( getEnvVarCount() < 2 )
m_gridEnvVars->AppendRows(2 - getEnvVarCount() );
wxString evValue;
int row = 0;
m_gridEnvVars->SetCellValue( row++, 0, PROJECT_VAR_NAME );
m_gridEnvVars->SetCellValue( row, 0, FP_LIB_TABLE::GlobalPathEnvVariableName() );
for( row = 0; row < getEnvVarCount(); row++ )
{
if( wxGetEnv( m_gridEnvVars->GetCellValue( row, 0 ), &evValue ) )
m_gridEnvVars->SetCellValue( row, 1, evValue );
}
m_gridEnvVars->AutoSizeColumns();
}
void DIALOG_CONFIG_EQUFILES::OnEditEquFile( wxCommandEvent& event )
{
wxString editorname = Pgm().GetEditorName();
if( editorname.IsEmpty() )
{
wxMessageBox( _( "No editor defined in Kicad. Please chose it" ) );
return;
}
wxArrayInt selections;
m_ListEquiv->GetSelections( selections );
wxString fullFileNames, tmp;
for( unsigned ii = 0; ii < selections.GetCount(); ii++ )
{
tmp = m_ListEquiv->GetString( selections[ii] );
fullFileNames << wxT( " \"" ) << wxExpandEnvVars( tmp ) << wxT( "\"" );
m_ListChanged = true;
}
ExecuteFile( this, editorname, fullFileNames );
}
void DIALOG_CONFIG_EQUFILES::OnCancelClick( wxCommandEvent& event )
{
EndModal( wxID_CANCEL );
}
void DIALOG_CONFIG_EQUFILES::OnOkClick( wxCommandEvent& event )
{
// Save new equ file list if the files list was modified
if( m_ListChanged )
{
// Recreate equ list
m_Parent->m_EquFilesNames.Clear();
for( unsigned ii = 0; ii < m_ListEquiv->GetCount(); ii++ )
m_Parent->m_EquFilesNames.Add( m_ListEquiv->GetString( ii ) );
wxCommandEvent evt( ID_SAVE_PROJECT );
m_Parent->SaveProjectFile( evt );
}
EndModal( wxID_OK );
}
void DIALOG_CONFIG_EQUFILES::OnCloseWindow( wxCloseEvent& event )
{
EndModal( wxID_CANCEL );
}
/********************************************************************/
void DIALOG_CONFIG_EQUFILES::OnButtonMoveUp( wxCommandEvent& event )
/********************************************************************/
{
wxArrayInt selections;
m_ListEquiv->GetSelections( selections );
if ( selections.GetCount() <= 0 ) // No selection.
return;
if( selections[0] == 0 ) // The first lib is selected. cannot move up it
return;
wxArrayString libnames = m_ListEquiv->GetStrings();
for( size_t ii = 0; ii < selections.GetCount(); ii++ )
{
int jj = selections[ii];
EXCHG( libnames[jj], libnames[jj-1] );
}
m_ListEquiv->Set( libnames );
// Reselect previously selected names
for( size_t ii = 0; ii < selections.GetCount(); ii++ )
{
int jj = selections[ii];
m_ListEquiv->SetSelection( jj-1 );
}
m_ListChanged = true;
}
/*********************************************************************/
void DIALOG_CONFIG_EQUFILES::OnButtonMoveDown( wxCommandEvent& event )
/*********************************************************************/
{
wxArrayInt selections;
m_ListEquiv->GetSelections( selections );
if ( selections.GetCount() <= 0 ) // No selection.
return;
// The last lib is selected. cannot move down it
if( selections.Last() == int( m_ListEquiv->GetCount()-1 ) )
return;
wxArrayString libnames = m_ListEquiv->GetStrings();
for( int ii = selections.GetCount()-1; ii >= 0; ii-- )
{
int jj = selections[ii];
EXCHG( libnames[jj], libnames[jj+1]);
}
m_ListEquiv->Set( libnames );
// Reselect previously selected names
for( size_t ii = 0; ii < selections.GetCount(); ii++ )
{
int jj = selections[ii];
m_ListEquiv->SetSelection(jj+1);
}
m_ListChanged = true;
}
/* Remove a library to the library list.
* The real list (g_LibName_List) is not changed, so the change can be canceled
*/
void DIALOG_CONFIG_EQUFILES::OnRemoveFiles( wxCommandEvent& event )
{
wxArrayInt selections;
m_ListEquiv->GetSelections( selections );
std::sort( selections.begin(), selections.end() );
for( int ii = selections.GetCount()-1; ii >= 0; ii-- )
{
m_ListEquiv->Delete(selections[ii] );
m_ListChanged = true;
}
}
/* Insert or add a library to the library list:
* The new library is put in list before (insert button) the selection,
* or added (add button) to end of list
*/
void DIALOG_CONFIG_EQUFILES::OnAddFiles( wxCommandEvent& event )
{
wxString equFilename, wildcard;
wxFileName fn;
wildcard = EquFilesWildcard;
wxListBox* list = m_ListEquiv;
// Get a default path to open the file dialog:
wxString libpath;
wxArrayInt selectedRows = m_gridEnvVars->GetSelectedRows();
int row = selectedRows.GetCount() ? selectedRows[0] :
m_gridEnvVars->GetGridCursorRow();
libpath = m_gridEnvVars->GetCellValue( wxGridCellCoords( row, 1 ) );
wxFileDialog FilesDialog( this, _( "Equ files:" ), libpath,
wxEmptyString, wildcard,
wxFD_DEFAULT_STYLE | wxFD_MULTIPLE );
if( FilesDialog.ShowModal() != wxID_OK )
return;
wxArrayString Filenames;
FilesDialog.GetPaths( Filenames );
for( unsigned jj = 0; jj < Filenames.GetCount(); jj++ )
{
fn = Filenames[jj];
equFilename.Empty();
if( isPathRelativeAllowed() ) // try to use relative path
{
for( row = 0; row < getEnvVarCount(); row++ )
{
libpath = m_gridEnvVars->GetCellValue( wxGridCellCoords( row, 1 ) );
if( fn.MakeRelativeTo( libpath ) )
{
equFilename.Printf( wxT("${%s}%c%s"),
GetChars( m_gridEnvVars->GetCellValue( wxGridCellCoords( row, 0 ) ) ),
fn.GetPathSeparator(),
GetChars( fn.GetFullPath() ) );
break;
}
}
}
if( equFilename.IsEmpty() )
equFilename = Filenames[jj];
// Add or insert new library name, if not already in list
if( list->FindString( equFilename, fn.IsCaseSensitive() ) == wxNOT_FOUND )
{
m_ListChanged = true;
equFilename.Replace( wxT("\\"), wxT("/") ); // Use unix separators only.
list->Append( equFilename );
}
else
{
wxString msg;
msg.Printf( _( "File '%s' already exists in list" ), equFilename.GetData() );
DisplayError( this, msg );
}
}
}
/**
* @file dialog_config_equfiles.h
*/
/*
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 2010-2015 Jean-Pierre Charras jp.charras at wanadoo.fr
* Copyright (C) 1992-2015 Kicad Developers, see CHANGELOG.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
*/
#ifndef _DIALOG_CONFIG_EQUFILES_H_
#define _DIALOG_CONFIG_EQUFILES_H_
#include <dialog_config_equfiles_base.h>
class DIALOG_CONFIG_EQUFILES : public DIALOG_CONFIG_EQUFILES_BASE
{
private:
CVPCB_MAINFRAME* m_Parent;
wxConfigBase* m_Config;
wxString m_UserLibDirBufferImg;
bool m_ListChanged;
private:
void Init();
// Virtual event handlers
void OnCloseWindow( wxCloseEvent& event );
void OnOkClick( wxCommandEvent& event );
void OnCancelClick( wxCommandEvent& event );
void OnAddFiles( wxCommandEvent& event );
void OnEditEquFile( wxCommandEvent& event );
void OnRemoveFiles( wxCommandEvent& event );
void OnButtonMoveUp( wxCommandEvent& event );
void OnButtonMoveDown( wxCommandEvent& event );
int getEnvVarCount() // Get the number of rows in env var table
{
return m_gridEnvVars->GetTable()->GetRowsCount();
}
bool isPathRelativeAllowed()
{
return m_rbPathOptionChoice->GetSelection() == 1;
}
public:
DIALOG_CONFIG_EQUFILES( CVPCB_MAINFRAME* parent );
~DIALOG_CONFIG_EQUFILES() {};
};
#endif // _DIALOG_CONFIG_EQUFILES_H_
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 5 2014)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_config_equfiles_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_CONFIG_EQUFILES_BASE::DIALOG_CONFIG_EQUFILES_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbEquivChoiceSizer;
sbEquivChoiceSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Footprint/Component equ files (.equ files)") ), wxHORIZONTAL );
wxBoxSizer* bSizerFlist;
bSizerFlist = new wxBoxSizer( wxVERTICAL );
m_ListEquiv = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_EXTENDED|wxLB_HSCROLL|wxLB_NEEDED_SB|wxLB_SINGLE );
m_ListEquiv->SetMinSize( wxSize( 350,-1 ) );
bSizerFlist->Add( m_ListEquiv, 1, wxRIGHT|wxLEFT|wxEXPAND, 5 );
sbEquivChoiceSizer->Add( bSizerFlist, 1, wxEXPAND, 5 );
wxBoxSizer* bSizerButtons;
bSizerButtons = new wxBoxSizer( wxVERTICAL );
m_buttonAddEqu = new wxButton( this, ID_ADD_EQU, _("Add"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerButtons->Add( m_buttonAddEqu, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_buttonRemoveEqu = new wxButton( this, ID_REMOVE_EQU, _("Remove"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonRemoveEqu->SetToolTip( _("Unload the selected library") );
bSizerButtons->Add( m_buttonRemoveEqu, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_buttonMoveUp = new wxButton( this, ID_EQU_UP, _("Move Up"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerButtons->Add( m_buttonMoveUp, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_buttonMoveDown = new wxButton( this, ID_EQU_DOWN, _("Move Down"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerButtons->Add( m_buttonMoveDown, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_buttonEdit = new wxButton( this, wxID_ANY, _("Edit Equ File"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerButtons->Add( m_buttonEdit, 0, wxALL|wxEXPAND, 5 );
sbEquivChoiceSizer->Add( bSizerButtons, 0, wxALIGN_CENTER_VERTICAL, 5 );
bMainSizer->Add( sbEquivChoiceSizer, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* bSizerLower;
bSizerLower = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bSizerEnvVar;
bSizerEnvVar = new wxBoxSizer( wxVERTICAL );
m_staticText2 = new wxStaticText( this, wxID_ANY, _("Available environment variables for relative paths:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText2->Wrap( -1 );
bSizerEnvVar->Add( m_staticText2, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_gridEnvVars = new wxGrid( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
// Grid
m_gridEnvVars->CreateGrid( 2, 2 );
m_gridEnvVars->EnableEditing( true );
m_gridEnvVars->EnableGridLines( true );
m_gridEnvVars->EnableDragGridSize( false );
m_gridEnvVars->SetMargins( 0, 0 );
// Columns
m_gridEnvVars->EnableDragColMove( false );
m_gridEnvVars->EnableDragColSize( true );
m_gridEnvVars->SetColLabelSize( 25 );
m_gridEnvVars->SetColLabelValue( 0, _("Name") );
m_gridEnvVars->SetColLabelValue( 1, _("Value") );
m_gridEnvVars->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Rows
m_gridEnvVars->AutoSizeRows();
m_gridEnvVars->EnableDragRowSize( true );
m_gridEnvVars->SetRowLabelSize( 30 );
m_gridEnvVars->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Label Appearance
// Cell Defaults
m_gridEnvVars->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
bSizerEnvVar->Add( m_gridEnvVars, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSizerLower->Add( bSizerEnvVar, 1, wxEXPAND, 5 );
wxString m_rbPathOptionChoiceChoices[] = { _("Absolute path"), _("Relative path") };
int m_rbPathOptionChoiceNChoices = sizeof( m_rbPathOptionChoiceChoices ) / sizeof( wxString );
m_rbPathOptionChoice = new wxRadioBox( this, wxID_ANY, _("Path option:"), wxDefaultPosition, wxDefaultSize, m_rbPathOptionChoiceNChoices, m_rbPathOptionChoiceChoices, 1, wxRA_SPECIFY_COLS );
m_rbPathOptionChoice->SetSelection( 1 );
bSizerLower->Add( m_rbPathOptionChoice, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
bMainSizer->Add( bSizerLower, 0, wxEXPAND, 5 );
m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bMainSizer->Add( m_staticline2, 0, wxEXPAND|wxALL, 5 );
m_sdbSizer = new wxStdDialogButtonSizer();
m_sdbSizerOK = new wxButton( this, wxID_OK );
m_sdbSizer->AddButton( m_sdbSizerOK );
m_sdbSizerCancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer->AddButton( m_sdbSizerCancel );
m_sdbSizer->Realize();
bMainSizer->Add( m_sdbSizer, 0, wxALL|wxEXPAND, 5 );
this->SetSizer( bMainSizer );
this->Layout();
this->Centre( wxBOTH );
// Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnCloseWindow ) );
m_buttonAddEqu->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnAddFiles ), NULL, this );
m_buttonRemoveEqu->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnRemoveFiles ), NULL, this );
m_buttonMoveUp->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnButtonMoveUp ), NULL, this );
m_buttonMoveDown->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnButtonMoveDown ), NULL, this );
m_buttonEdit->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnEditEquFile ), NULL, this );
m_sdbSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnCancelClick ), NULL, this );
m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnOkClick ), NULL, this );
}
DIALOG_CONFIG_EQUFILES_BASE::~DIALOG_CONFIG_EQUFILES_BASE()
{
// Disconnect Events
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnCloseWindow ) );
m_buttonAddEqu->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnAddFiles ), NULL, this );
m_buttonRemoveEqu->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnRemoveFiles ), NULL, this );
m_buttonMoveUp->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnButtonMoveUp ), NULL, this );
m_buttonMoveDown->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnButtonMoveDown ), NULL, this );
m_buttonEdit->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnEditEquFile ), NULL, this );
m_sdbSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnCancelClick ), NULL, this );
m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnOkClick ), NULL, this );
}
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 5 2014)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_CONFIG_EQUFILES_BASE_H__
#define __DIALOG_CONFIG_EQUFILES_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class DIALOG_SHIM;
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/listbox.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/sizer.h>
#include <wx/button.h>
#include <wx/statbox.h>
#include <wx/stattext.h>
#include <wx/grid.h>
#include <wx/radiobox.h>
#include <wx/statline.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_CONFIG_EQUFILES_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_CONFIG_EQUFILES_BASE : public DIALOG_SHIM
{
private:
protected:
enum
{
ID_ADD_EQU = 1000,
ID_REMOVE_EQU,
ID_EQU_UP,
ID_EQU_DOWN
};
wxListBox* m_ListEquiv;
wxButton* m_buttonAddEqu;
wxButton* m_buttonRemoveEqu;
wxButton* m_buttonMoveUp;
wxButton* m_buttonMoveDown;
wxButton* m_buttonEdit;
wxStaticText* m_staticText2;
wxGrid* m_gridEnvVars;
wxRadioBox* m_rbPathOptionChoice;
wxStaticLine* m_staticline2;
wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizerOK;
wxButton* m_sdbSizerCancel;
// Virtual event handlers, overide them in your derived class
virtual void OnCloseWindow( wxCloseEvent& event ) { event.Skip(); }
virtual void OnAddFiles( wxCommandEvent& event ) { event.Skip(); }
virtual void OnRemoveFiles( wxCommandEvent& event ) { event.Skip(); }
virtual void OnButtonMoveUp( wxCommandEvent& event ) { event.Skip(); }
virtual void OnButtonMoveDown( wxCommandEvent& event ) { event.Skip(); }
virtual void OnEditEquFile( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_CONFIG_EQUFILES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 454,338 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_CONFIG_EQUFILES_BASE();
};
#endif //__DIALOG_CONFIG_EQUFILES_BASE_H__
This diff is collapsed.
/////////////////////////////////////////////////////////////////////////////
// Name: dialog_display_options.h
// Author: jean-pierre Charras
// Licence: GPL
/////////////////////////////////////////////////////////////////////////////
#ifndef _DIALOG_CVPCB_CONFIG_H_
#define _DIALOG_CVPCB_CONFIG_H_
#include <dialog_cvpcb_config_fbp.h>
class DIALOG_CVPCB_CONFIG : public DIALOG_CVPCB_CONFIG_FBP
{
private:
CVPCB_MAINFRAME* m_Parent;
wxConfigBase* m_Config;
wxString m_UserLibDirBufferImg;
bool m_LibListChanged;
bool m_LibPathChanged;
private:
void Init();
// Virtual event handlers
void OnCloseWindow( wxCloseEvent& event );
void OnOkClick( wxCommandEvent& event );
void OnCancelClick( wxCommandEvent& event );
void OnAddOrInsertLibClick( wxCommandEvent& event );
void OnRemoveLibClick( wxCommandEvent& event );
void OnBrowseModDocFile( wxCommandEvent& event );
void OnAddOrInsertPath( wxCommandEvent& event );
void OnRemoveUserPath( wxCommandEvent& event );
void OnButtonUpClick( wxCommandEvent& event );
void OnButtonDownClick( wxCommandEvent& event );
public:
DIALOG_CVPCB_CONFIG( CVPCB_MAINFRAME* parent );
~DIALOG_CVPCB_CONFIG() {};
};
#endif
// _DIALOG_CVPCB_CONFIG_H_
This diff is collapsed.
...@@ -95,11 +95,11 @@ void CVPCB_MAINFRAME::ReCreateMenuBar() ...@@ -95,11 +95,11 @@ void CVPCB_MAINFRAME::ReCreateMenuBar()
// Save the .cmp file // Save the .cmp file
AddMenuItem( filesMenu, wxID_SAVE, AddMenuItem( filesMenu, wxID_SAVE,
_( "&Save\tCtrl+S" ), SAVE_HLP_MSG, KiBitmap( save_xpm ) ); _( "&Save Cmp File\tCtrl+S" ), SAVE_HLP_MSG, KiBitmap( save_xpm ) );
// Save as the .cmp file // Save as the .cmp file
AddMenuItem( filesMenu, wxID_SAVEAS, AddMenuItem( filesMenu, wxID_SAVEAS,
_( "Save &As...\tCtrl+Shift+S" ), SAVE_AS_HLP_MSG, KiBitmap( save_xpm ) ); _( "Save Cmp File &As...\tCtrl+Shift+S" ), SAVE_AS_HLP_MSG, KiBitmap( save_xpm ) );
// Separator // Separator
filesMenu->AppendSeparator(); filesMenu->AppendSeparator();
...@@ -116,6 +116,12 @@ void CVPCB_MAINFRAME::ReCreateMenuBar() ...@@ -116,6 +116,12 @@ void CVPCB_MAINFRAME::ReCreateMenuBar()
_( "Edit Li&brary Table" ), _( "Setup footprint libraries" ), _( "Edit Li&brary Table" ), _( "Setup footprint libraries" ),
KiBitmap( library_table_xpm ) ); KiBitmap( library_table_xpm ) );
AddMenuItem( preferencesMenu, ID_CVPCB_EQUFILES_LIST_EDIT,
_( "Edit &Equ Files List" ),
_( "Setup equ files list (.equ files)\n"
"They are files which give the footprint name from the component value"),
KiBitmap( library_table_xpm ) );
// Language submenu // Language submenu
Pgm().AddMenuLanguageList( preferencesMenu ); Pgm().AddMenuLanguageList( preferencesMenu );
...@@ -134,11 +140,6 @@ void CVPCB_MAINFRAME::ReCreateMenuBar() ...@@ -134,11 +140,6 @@ void CVPCB_MAINFRAME::ReCreateMenuBar()
_( "Save changes to the project configuration file" ), _( "Save changes to the project configuration file" ),
KiBitmap( save_setup_xpm ) ); KiBitmap( save_setup_xpm ) );
AddMenuItem( preferencesMenu, ID_SAVE_PROJECT_AS,
_( "&Save Project File As" ),
_( "Save changes to a new project configuration file" ),
KiBitmap( save_setup_xpm ) );
// Menu Help: // Menu Help:
wxMenu* helpMenu = new wxMenu; wxMenu* helpMenu = new wxMenu;
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras * Copyright (C) 2015 Jean-Pierre Charras, jean-pierre.charras
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
* *
...@@ -385,8 +385,9 @@ int CVPCB_MAINFRAME::SaveCmpLinkFile( const wxString& aFullFileName ) ...@@ -385,8 +385,9 @@ int CVPCB_MAINFRAME::SaveCmpLinkFile( const wxString& aFullFileName )
} }
else else
{ {
wxFileDialog dlg( this, _( "Save Component Footprint Link File" ), wxEmptyString, wxFileDialog dlg( this, _( "Save Component Footprint Link File" ),
_( "Unnamed file" ), ComponentFileWildcard, wxFD_SAVE ); Prj().GetProjectPath(),
wxT( "noname" ), ComponentFileWildcard, wxFD_SAVE );
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )
return -1; return -1;
...@@ -395,47 +396,13 @@ int CVPCB_MAINFRAME::SaveCmpLinkFile( const wxString& aFullFileName ) ...@@ -395,47 +396,13 @@ int CVPCB_MAINFRAME::SaveCmpLinkFile( const wxString& aFullFileName )
if( !fn.HasExt() ) if( !fn.HasExt() )
fn.SetExt( ComponentFileExtension ); fn.SetExt( ComponentFileExtension );
#if 0 // RHH 6-Jul-14: We did not auto generate the
// footprint table. And the dialog which does suppport editing does the saving.
// Besides, this is not the place to do this, it belies the name of this
// function.
// Save the project specific footprint library table.
if( !Prj().PcbFootprintLibs()->IsEmpty( false ) )
{
wxString fp_lib_tbl = Prj().FootprintLibTblName();
if( wxFileName::FileExists( fp_lib_tbl )
&& IsOK( this, _( "A footprint library table already exists in this path.\n\nDo "
"you want to overwrite it?" ) ) )
{
try
{
Prj().PcbFootprintLibs()->Save( fp_lib_tbl );
}
catch( const IO_ERROR& ioe )
{
wxString msg = wxString::Format( _(
"An error occurred attempting to save the "
"footprint library table '%s'\n\n%s" ),
GetChars( fp_lib_tbl ),
GetChars( ioe.errorText )
);
DisplayError( this, msg );
}
} }
}
#endif
}
if( !IsWritable( fn.GetFullPath() ) )
return 0;
if( WriteComponentLinkFile( fn.GetFullPath() ) == 0 ) if( !IsWritable( fn.GetFullPath() ) || WriteComponentLinkFile( fn.GetFullPath() ) == 0 )
{ {
DisplayError( this, _( "Unable to create component footprint link file (.cmp)" ) ); DisplayError( this,
wxString::Format( _( "Unable to create component footprint link file '%s'" ),
fn.GetFullPath() ) );
return 0; return 0;
} }
......
...@@ -69,10 +69,6 @@ void CVPCB_MAINFRAME::ReCreateHToolbar() ...@@ -69,10 +69,6 @@ void CVPCB_MAINFRAME::ReCreateHToolbar()
KiBitmap( show_footprint_xpm ), KiBitmap( show_footprint_xpm ),
_( "View selected footprint" ) ); _( "View selected footprint" ) );
m_mainToolBar->AddTool( ID_CVPCB_AUTO_ASSOCIE, wxEmptyString,
KiBitmap( auto_associe_xpm ),
_( "Perform automatic footprint association" ) );
m_mainToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
m_mainToolBar->AddTool( ID_CVPCB_GOTO_PREVIOUSNA, wxEmptyString, m_mainToolBar->AddTool( ID_CVPCB_GOTO_PREVIOUSNA, wxEmptyString,
KiBitmap( left_xpm ), KiBitmap( left_xpm ),
...@@ -83,6 +79,10 @@ void CVPCB_MAINFRAME::ReCreateHToolbar() ...@@ -83,6 +79,10 @@ void CVPCB_MAINFRAME::ReCreateHToolbar()
_( "Select next unlinked component" ) ); _( "Select next unlinked component" ) );
m_mainToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
m_mainToolBar->AddTool( ID_CVPCB_AUTO_ASSOCIE, wxEmptyString,
KiBitmap( auto_associe_xpm ),
_( "Perform automatic footprint association" ) );
m_mainToolBar->AddTool( ID_CVPCB_DEL_ASSOCIATIONS, wxEmptyString, m_mainToolBar->AddTool( ID_CVPCB_DEL_ASSOCIATIONS, wxEmptyString,
KiBitmap( delete_association_xpm ), KiBitmap( delete_association_xpm ),
_( "Delete all associations (links)" ) ); _( "Delete all associations (links)" ) );
...@@ -92,7 +92,6 @@ void CVPCB_MAINFRAME::ReCreateHToolbar() ...@@ -92,7 +92,6 @@ void CVPCB_MAINFRAME::ReCreateHToolbar()
KiBitmap( datasheet_xpm ), KiBitmap( datasheet_xpm ),
_( "Display footprint documentation" ) ); _( "Display footprint documentation" ) );
m_mainToolBar->AddSeparator();
m_mainToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
m_mainToolBar->AddTool( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST, m_mainToolBar->AddTool( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST,
KiBitmap( module_filtered_list_xpm ), KiBitmap( module_filtered_list_xpm ),
......
...@@ -62,6 +62,7 @@ void SCH_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline ) ...@@ -62,6 +62,7 @@ void SCH_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
char line[1024]; char line[1024];
strncpy( line, cmdline, sizeof(line) - 1 ); strncpy( line, cmdline, sizeof(line) - 1 );
line[ sizeof(line) - 1 ] = '\0';
char* idcmd = strtok( line, " \n\r" ); char* idcmd = strtok( line, " \n\r" );
char* text = strtok( NULL, "\"\n\r" ); char* text = strtok( NULL, "\"\n\r" );
......
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras@wanadoo.fr * Copyright (C) 2013-2015 Jean-Pierre Charras, jp.charras@wanadoo.fr
* Copyright (C) 2013 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2013-2015 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
...@@ -342,6 +342,7 @@ NETLIST_DIALOG::NETLIST_DIALOG( SCH_EDIT_FRAME* parent ) : ...@@ -342,6 +342,7 @@ NETLIST_DIALOG::NETLIST_DIALOG( SCH_EDIT_FRAME* parent ) :
// Add custom panels: // Add custom panels:
InstallCustomPages(); InstallCustomPages();
SetDefaultItem( m_buttonNetlist );
GetSizer()->SetSizeHints( this ); GetSizer()->SetSizeHints( this );
Centre(); Centre();
......
...@@ -335,7 +335,7 @@ bool LIB_EDIT_FRAME::SaveActiveLibrary( bool newFile ) ...@@ -335,7 +335,7 @@ bool LIB_EDIT_FRAME::SaveActiveLibrary( bool newFile )
default_path = search->LastVisitedPath(); default_path = search->LastVisitedPath();
wxFileDialog dlg( this, _( "Part Library Name:" ), default_path, wxFileDialog dlg( this, _( "Part Library Name:" ), default_path,
wxEmptyString, SchematicLibraryFileExtension, wxEmptyString, SchematicLibraryFileWildcard,
wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )
......
...@@ -668,19 +668,18 @@ void SCH_TEXT::Plot( PLOTTER* aPlotter ) ...@@ -668,19 +668,18 @@ void SCH_TEXT::Plot( PLOTTER* aPlotter )
if( m_MultilineAllowed ) if( m_MultilineAllowed )
{ {
std::vector<wxPoint> positions; std::vector<wxPoint> positions;
wxArrayString* list = wxStringSplit( GetShownText(), '\n' ); wxArrayString strings_list;
positions.reserve( list->Count() ); wxStringSplit( GetShownText(), strings_list, '\n' );
positions.reserve( strings_list.Count() );
GetPositionsOfLinesOfMultilineText(positions, list->Count() ); GetPositionsOfLinesOfMultilineText(positions, strings_list.Count() );
for( unsigned ii = 0; ii < list->Count(); ii++ ) for( unsigned ii = 0; ii < strings_list.Count(); ii++ )
{ {
wxString& txt = list->Item( ii ); wxString& txt = strings_list.Item( ii );
aPlotter->Text( positions[ii], color, txt, m_Orient, m_Size, m_HJustify, aPlotter->Text( positions[ii], color, txt, m_Orient, m_Size, m_HJustify,
m_VJustify, thickness, m_Italic, m_Bold ); m_VJustify, thickness, m_Italic, m_Bold );
} }
delete (list);
} }
else else
{ {
......
...@@ -339,11 +339,11 @@ double RoundTo0( double x, double precision ); ...@@ -339,11 +339,11 @@ double RoundTo0( double x, double precision );
/** /**
* Function wxStringSplit * Function wxStringSplit
* splits \a aString to a string list separated at \a aSplitter. * splits \a aString to a string list separated at \a aSplitter.
* @return the list * @param aText is the text to split
* @param aString is the text to split * @param aStrings will contain the splitted lines
* @param aSplitter is the 'split' character * @param aSplitter is the 'split' character
*/ */
wxArrayString* wxStringSplit( wxString aString, wxChar aSplitter ); void wxStringSplit( const wxString& aText, wxArrayString& aStrings, wxChar aSplitter );
/** /**
* Function GetRunningMicroSecs * Function GetRunningMicroSecs
......
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
#define GROUP_SCH_LIBS wxT( "/eeschema/libraries" ) /// library list section #define GROUP_SCH_LIBS wxT( "/eeschema/libraries" ) /// library list section
#define GROUP_CVP wxT("/cvpcb") #define GROUP_CVP wxT("/cvpcb")
#define GROUP_CVP_EQU wxT("/cvpcb/libraries") #define GROUP_CVP_EQU wxT("/cvpcb/equfiles")
#define CONFIG_VERSION 1 #define CONFIG_VERSION 1
......
...@@ -247,7 +247,7 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow ...@@ -247,7 +247,7 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
m_panelRegulators->SetSizer( bSizerMainReg ); m_panelRegulators->SetSizer( bSizerMainReg );
m_panelRegulators->Layout(); m_panelRegulators->Layout();
bSizerMainReg->Fit( m_panelRegulators ); bSizerMainReg->Fit( m_panelRegulators );
m_Notebook->AddPage( m_panelRegulators, _("Regulators"), true ); m_Notebook->AddPage( m_panelRegulators, _("Regulators"), false );
m_panelTrackWidth = new wxPanel( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); m_panelTrackWidth = new wxPanel( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizerTrackWidth; wxBoxSizer* bSizerTrackWidth;
bSizerTrackWidth = new wxBoxSizer( wxHORIZONTAL ); bSizerTrackWidth = new wxBoxSizer( wxHORIZONTAL );
...@@ -593,7 +593,7 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow ...@@ -593,7 +593,7 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
wxBoxSizer* bLeftSizer; wxBoxSizer* bLeftSizer;
bLeftSizer = new wxBoxSizer( wxVERTICAL ); bLeftSizer = new wxBoxSizer( wxVERTICAL );
wxString m_TranslineSelectionChoices[] = { _("Microstrip Line"), _("Coplanar wave guide"), _("Grounded Coplanar wave guide"), _("Rectangular Waveguide"), _("Coaxial Line"), _("Coupled Microstrip Line"), _("Stripline"), _("Twisted Pair") }; wxString m_TranslineSelectionChoices[] = { _("Microstrip Line"), _("Coplanar wave guide"), _("Coplanar wave guide with ground plane"), _("Rectangular Waveguide"), _("Coaxial Line"), _("Coupled Microstrip Line"), _("Stripline"), _("Twisted Pair") };
int m_TranslineSelectionNChoices = sizeof( m_TranslineSelectionChoices ) / sizeof( wxString ); int m_TranslineSelectionNChoices = sizeof( m_TranslineSelectionChoices ) / sizeof( wxString );
m_TranslineSelection = new wxRadioBox( m_panelTransline, wxID_ANY, _("Transmission Line Type:"), wxDefaultPosition, wxDefaultSize, m_TranslineSelectionNChoices, m_TranslineSelectionChoices, 1, wxRA_SPECIFY_COLS ); m_TranslineSelection = new wxRadioBox( m_panelTransline, wxID_ANY, _("Transmission Line Type:"), wxDefaultPosition, wxDefaultSize, m_TranslineSelectionNChoices, m_TranslineSelectionChoices, 1, wxRA_SPECIFY_COLS );
m_TranslineSelection->SetSelection( 0 ); m_TranslineSelection->SetSelection( 0 );
...@@ -998,7 +998,7 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow ...@@ -998,7 +998,7 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
m_panelTransline->SetSizer( bSizeTransline ); m_panelTransline->SetSizer( bSizeTransline );
m_panelTransline->Layout(); m_panelTransline->Layout();
bSizeTransline->Fit( m_panelTransline ); bSizeTransline->Fit( m_panelTransline );
m_Notebook->AddPage( m_panelTransline, _("TransLine"), false ); m_Notebook->AddPage( m_panelTransline, _("TransLine"), true );
m_panelAttenuators = new wxPanel( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); m_panelAttenuators = new wxPanel( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxStaticBoxSizer* sbSizerAtt; wxStaticBoxSizer* sbSizerAtt;
sbSizerAtt = new wxStaticBoxSizer( new wxStaticBox( m_panelAttenuators, wxID_ANY, _("label") ), wxHORIZONTAL ); sbSizerAtt = new wxStaticBoxSizer( new wxStaticBox( m_panelAttenuators, wxID_ANY, _("label") ), wxHORIZONTAL );
......
...@@ -270,7 +270,7 @@ ...@@ -270,7 +270,7 @@
<object class="notebookpage" expanded="1"> <object class="notebookpage" expanded="1">
<property name="bitmap"></property> <property name="bitmap"></property>
<property name="label">Regulators</property> <property name="label">Regulators</property>
<property name="select">1</property> <property name="select">0</property>
<object class="wxPanel" expanded="1"> <object class="wxPanel" expanded="1">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
<property name="LeftDockable">1</property> <property name="LeftDockable">1</property>
...@@ -8181,7 +8181,7 @@ ...@@ -8181,7 +8181,7 @@
<object class="notebookpage" expanded="1"> <object class="notebookpage" expanded="1">
<property name="bitmap"></property> <property name="bitmap"></property>
<property name="label">TransLine</property> <property name="label">TransLine</property>
<property name="select">0</property> <property name="select">1</property>
<object class="wxPanel" expanded="1"> <object class="wxPanel" expanded="1">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
<property name="LeftDockable">1</property> <property name="LeftDockable">1</property>
...@@ -8288,7 +8288,7 @@ ...@@ -8288,7 +8288,7 @@
<property name="caption"></property> <property name="caption"></property>
<property name="caption_visible">1</property> <property name="caption_visible">1</property>
<property name="center_pane">0</property> <property name="center_pane">0</property>
<property name="choices">&quot;Microstrip Line&quot; &quot;Coplanar wave guide&quot; &quot;Grounded Coplanar wave guide&quot; &quot;Rectangular Waveguide&quot; &quot;Coaxial Line&quot; &quot;Coupled Microstrip Line&quot; &quot;Stripline&quot; &quot;Twisted Pair&quot;</property> <property name="choices">&quot;Microstrip Line&quot; &quot;Coplanar wave guide&quot; &quot;Coplanar wave guide with ground plane&quot; &quot;Rectangular Waveguide&quot; &quot;Coaxial Line&quot; &quot;Coupled Microstrip Line&quot; &quot;Stripline&quot; &quot;Twisted Pair&quot;</property>
<property name="close_button">1</property> <property name="close_button">1</property>
<property name="context_help"></property> <property name="context_help"></property>
<property name="context_menu">1</property> <property name="context_menu">1</property>
...@@ -403,22 +403,21 @@ void TEXTE_PCB::TransformShapeWithClearanceToPolygonSet( ...@@ -403,22 +403,21 @@ void TEXTE_PCB::TransformShapeWithClearanceToPolygonSet(
if( IsMultilineAllowed() ) if( IsMultilineAllowed() )
{ {
wxArrayString* list = wxStringSplit( GetShownText(), '\n' ); wxArrayString strings_list;
wxStringSplit( GetShownText(), strings_list, '\n' );
std::vector<wxPoint> positions; std::vector<wxPoint> positions;
positions.reserve( list->Count() ); positions.reserve( strings_list.Count() );
GetPositionsOfLinesOfMultilineText( positions, list->Count() ); GetPositionsOfLinesOfMultilineText( positions, strings_list.Count() );
for( unsigned ii = 0; ii < list->Count(); ii++ ) for( unsigned ii = 0; ii < strings_list.Count(); ii++ )
{ {
wxString txt = list->Item( ii ); wxString txt = strings_list.Item( ii );
DrawGraphicText( NULL, NULL, positions[ii], color, DrawGraphicText( NULL, NULL, positions[ii], color,
txt, GetOrientation(), size, txt, GetOrientation(), size,
GetHorizJustify(), GetVertJustify(), GetHorizJustify(), GetVertJustify(),
GetThickness(), IsItalic(), GetThickness(), IsItalic(),
true, addTextSegmToPoly ); true, addTextSegmToPoly );
} }
delete list;
} }
else else
{ {
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2013 Cirilo Bernardo * Copyright (C) 2013-2015 Cirilo Bernardo
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
...@@ -46,15 +46,6 @@ private: ...@@ -46,15 +46,6 @@ private:
wxConfigBase* m_config; wxConfigBase* m_config;
bool m_idfThouOpt; // remember last preference for units in THOU bool m_idfThouOpt; // remember last preference for units in THOU
void OnCancelClick( wxCommandEvent& event )
{
EndModal( wxID_CANCEL );
}
void OnOkClick( wxCommandEvent& event )
{
EndModal( wxID_OK );
}
public: public:
DIALOG_EXPORT_IDF3( PCB_EDIT_FRAME* parent ) : DIALOG_EXPORT_IDF3( PCB_EDIT_FRAME* parent ) :
DIALOG_EXPORT_IDF3_BASE( parent ) DIALOG_EXPORT_IDF3_BASE( parent )
...@@ -66,6 +57,11 @@ public: ...@@ -66,6 +57,11 @@ public:
m_config->Read( OPTKEY_IDF_THOU, &m_idfThouOpt ); m_config->Read( OPTKEY_IDF_THOU, &m_idfThouOpt );
m_rbUnitSelection->SetSelection( m_idfThouOpt ? 1 : 0 ); m_rbUnitSelection->SetSelection( m_idfThouOpt ? 1 : 0 );
wxWindow* button = FindWindowByLabel( wxT( "OK" ) );
if( button )
SetDefaultItem( button );
GetSizer()->SetSizeHints( this ); GetSizer()->SetSizeHints( this );
Centre(); Centre();
} }
...@@ -112,9 +108,9 @@ void PCB_EDIT_FRAME::ExportToIDF3( wxCommandEvent& event ) ...@@ -112,9 +108,9 @@ void PCB_EDIT_FRAME::ExportToIDF3( wxCommandEvent& event )
wxString fullFilename = dlg.FilePicker()->GetPath(); wxString fullFilename = dlg.FilePicker()->GetPath();
if ( !Export_IDF3( GetBoard(), fullFilename, thou ) ) if( !Export_IDF3( GetBoard(), fullFilename, thou ) )
{ {
wxString msg = _("Unable to create ") + fullFilename; wxString msg = _( "Unable to create " ) + fullFilename;
wxMessageBox( msg ); wxMessageBox( msg );
return; return;
} }
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 6 2013) // C++ code generated with wxFormBuilder (version Jun 5 2014)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -16,20 +16,22 @@ DIALOG_EXPORT_IDF3_BASE::DIALOG_EXPORT_IDF3_BASE( wxWindow* parent, wxWindowID i ...@@ -16,20 +16,22 @@ DIALOG_EXPORT_IDF3_BASE::DIALOG_EXPORT_IDF3_BASE( wxWindow* parent, wxWindowID i
wxBoxSizer* bSizerIDFFile; wxBoxSizer* bSizerIDFFile;
bSizerIDFFile = new wxBoxSizer( wxVERTICAL ); bSizerIDFFile = new wxBoxSizer( wxVERTICAL );
bSizerIDFFile->SetMinSize( wxSize( 500,-1 ) ); m_txtBrdFile = new wxStaticText( this, wxID_ANY, _("File name:"), wxDefaultPosition, wxDefaultSize, 0 );
m_txtBrdFile = new wxStaticText( this, wxID_ANY, _("IDF board file"), wxDefaultPosition, wxDefaultSize, 0 );
m_txtBrdFile->Wrap( -1 ); m_txtBrdFile->Wrap( -1 );
bSizerIDFFile->Add( m_txtBrdFile, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); bSizerIDFFile->Add( m_txtBrdFile, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxTOP, 5 );
m_filePickerIDF = new wxFilePickerCtrl( this, wxID_ANY, wxEmptyString, _("Select an IDF export filename"), wxT("*.emn"), wxDefaultPosition, wxSize( 450,-1 ), wxFLP_OVERWRITE_PROMPT|wxFLP_SAVE|wxFLP_USE_TEXTCTRL ); m_filePickerIDF = new wxFilePickerCtrl( this, wxID_ANY, wxEmptyString, _("Select an IDF export filename"), wxT("*.emn"), wxDefaultPosition, wxSize( 450,-1 ), wxFLP_OVERWRITE_PROMPT|wxFLP_SAVE|wxFLP_USE_TEXTCTRL );
bSizerIDFFile->Add( m_filePickerIDF, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); bSizerIDFFile->Add( m_filePickerIDF, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
wxString m_rbUnitSelectionChoices[] = { _("Millimeters"), _("Mils") }; wxString m_rbUnitSelectionChoices[] = { _("Millimeters"), _("Mils") };
int m_rbUnitSelectionNChoices = sizeof( m_rbUnitSelectionChoices ) / sizeof( wxString ); int m_rbUnitSelectionNChoices = sizeof( m_rbUnitSelectionChoices ) / sizeof( wxString );
m_rbUnitSelection = new wxRadioBox( this, wxID_ANY, _("IDF File Units"), wxDefaultPosition, wxDefaultSize, m_rbUnitSelectionNChoices, m_rbUnitSelectionChoices, 1, wxRA_SPECIFY_COLS ); m_rbUnitSelection = new wxRadioBox( this, wxID_ANY, _("Units"), wxDefaultPosition, wxDefaultSize, m_rbUnitSelectionNChoices, m_rbUnitSelectionChoices, 1, wxRA_SPECIFY_COLS );
m_rbUnitSelection->SetSelection( 0 ); m_rbUnitSelection->SetSelection( 0 );
bSizerIDFFile->Add( m_rbUnitSelection, 0, wxALL, 5 ); bSizerIDFFile->Add( m_rbUnitSelection, 0, wxALL, 5 );
bSizerIDFFile->Add( 0, 0, 1, 0, 5 );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bSizerIDFFile->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 ); bSizerIDFFile->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 );
...@@ -40,11 +42,12 @@ DIALOG_EXPORT_IDF3_BASE::DIALOG_EXPORT_IDF3_BASE( wxWindow* parent, wxWindowID i ...@@ -40,11 +42,12 @@ DIALOG_EXPORT_IDF3_BASE::DIALOG_EXPORT_IDF3_BASE( wxWindow* parent, wxWindowID i
m_sdbSizer1->AddButton( m_sdbSizer1Cancel ); m_sdbSizer1->AddButton( m_sdbSizer1Cancel );
m_sdbSizer1->Realize(); m_sdbSizer1->Realize();
bSizerIDFFile->Add( m_sdbSizer1, 0, wxALIGN_RIGHT, 5 ); bSizerIDFFile->Add( m_sdbSizer1, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
this->SetSizer( bSizerIDFFile ); this->SetSizer( bSizerIDFFile );
this->Layout(); this->Layout();
bSizerIDFFile->Fit( this );
this->Centre( wxBOTH ); this->Centre( wxBOTH );
} }
......
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project> <wxFormBuilder_Project>
<FileVersion major="1" minor="11" /> <FileVersion major="1" minor="13" />
<object class="Project" expanded="1"> <object class="Project" expanded="1">
<property name="class_decoration"></property> <property name="class_decoration"></property>
<property name="code_generation">C++</property> <property name="code_generation">C++</property>
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">DIALOG_EXPORT_IDF3_BASE</property> <property name="name">DIALOG_EXPORT_IDF3_BASE</property>
<property name="pos"></property> <property name="pos"></property>
<property name="size">424,191</property> <property name="size">-1,-1</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property> <property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property> <property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">Export IDFv3</property> <property name="title">Export IDFv3</property>
...@@ -89,13 +89,13 @@ ...@@ -89,13 +89,13 @@
<event name="OnSize"></event> <event name="OnSize"></event>
<event name="OnUpdateUI"></event> <event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="1"> <object class="wxBoxSizer" expanded="1">
<property name="minimum_size">500,-1</property> <property name="minimum_size">-1,-1</property>
<property name="name">bSizerIDFFile</property> <property name="name">bSizerIDFFile</property>
<property name="orient">wxVERTICAL</property> <property name="orient">wxVERTICAL</property>
<property name="permission">none</property> <property name="permission">none</property>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property> <property name="flag">wxBOTTOM|wxLEFT|wxRIGHT|wxTOP</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxStaticText" expanded="1"> <object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
...@@ -125,7 +125,7 @@ ...@@ -125,7 +125,7 @@
<property name="gripper">0</property> <property name="gripper">0</property>
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">IDF board file</property> <property name="label">File name:</property>
<property name="max_size"></property> <property name="max_size"></property>
<property name="maximize_button">0</property> <property name="maximize_button">0</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
...@@ -298,7 +298,7 @@ ...@@ -298,7 +298,7 @@
<property name="gripper">0</property> <property name="gripper">0</property>
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">IDF File Units</property> <property name="label">Units</property>
<property name="majorDimension">1</property> <property name="majorDimension">1</property>
<property name="max_size"></property> <property name="max_size"></property>
<property name="maximize_button">0</property> <property name="maximize_button">0</property>
...@@ -355,6 +355,16 @@ ...@@ -355,6 +355,16 @@
<event name="OnUpdateUI"></event> <event name="OnUpdateUI"></event>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag"></property>
<property name="proportion">1</property>
<object class="spacer" expanded="1">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxEXPAND | wxALL</property> <property name="flag">wxEXPAND | wxALL</property>
...@@ -438,7 +448,7 @@ ...@@ -438,7 +448,7 @@
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALIGN_RIGHT</property> <property name="flag">wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxStdDialogButtonSizer" expanded="1"> <object class="wxStdDialogButtonSizer" expanded="1">
<property name="Apply">0</property> <property name="Apply">0</property>
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 6 2013) // C++ code generated with wxFormBuilder (version Jun 5 2014)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -47,7 +47,7 @@ class DIALOG_EXPORT_IDF3_BASE : public DIALOG_SHIM ...@@ -47,7 +47,7 @@ class DIALOG_EXPORT_IDF3_BASE : public DIALOG_SHIM
public: public:
DIALOG_EXPORT_IDF3_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Export IDFv3"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 424,191 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); DIALOG_EXPORT_IDF3_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Export IDFv3"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_EXPORT_IDF3_BASE(); ~DIALOG_EXPORT_IDF3_BASE();
}; };
......
This diff is collapsed.
...@@ -112,13 +112,38 @@ public: ...@@ -112,13 +112,38 @@ public:
private: private:
void initDlg( wxArrayString& aEnvVariableList ); void initDlg( wxArrayString& aEnvVariableList );
wxString GetSelectedEnvVar(); // return the selected env variable wxString getSelectedEnvVar(); // return the selected env variable
wxString GetSelectedEnvVarValue(); // return the selected env variable value wxString getSelectedEnvVarValue(); // return the selected env variable value
bool setSecondPage(); // Init prms for the second wizard page bool setSecondPage(); // Init prms for the second wizard page
bool setLastPage(); // Init prms for the last wizard page bool setLastPage(); // Init prms for the last wizard page
void selectLibsFiles(); // select a set of library files void selectLibsFiles(); // select a set of library files
void selectLibsFolders(); // select a set of library folders void selectLibsFolders(); // select a set of library folders
void selectLibsGithub(); // select a set of library on Github
/** select a set of library on Github, using the Web viewer to explore
* the repos
*/
void selectLibsGithubWithWebViewer();
/** Get the list of .pretty libraries on Github,
* without using the viewer, from the lib list extracted from the KiCad repos
*/
void getLibsListGithub( wxArrayString& aList );
/** Helper function.
* add the .pretty libraries found in aUrlList, after calculating a nickname and
* replacing the path by an env variable, if allowed and possible
*/
void installGithubLibsFromList( wxArrayString& aUrlList );
/**
* Download the .pretty libraries found in aUrlLis and store them on disk
* in a master folder
* @return true if OK, false on error
* @param aUrlList is the list of Github .pretty libs to download
* @param aErrorMessage is a wxString pointer to store error messages if any.
*/
bool downloadGithubLibsFromList( wxArrayString& aUrlList, wxString * aErrorMessage = NULL );
void updateFromPlugingChoice(); // update dialog options and widgets void updateFromPlugingChoice(); // update dialog options and widgets
// depending on the plugin choice // depending on the plugin choice
int GetEnvVarCount() // Get the number of rows in env var table int GetEnvVarCount() // Get the number of rows in env var table
...@@ -136,6 +161,12 @@ private: ...@@ -136,6 +161,12 @@ private:
return m_rbFpLibFormat->GetSelection() == GITHUB_PLUGIN; return m_rbFpLibFormat->GetSelection() == GITHUB_PLUGIN;
} }
bool IsKicadPlugin() // Helper funct, return true if
{ // the Kicad plugin is the choice
return m_rbFpLibFormat->GetSelection() == KICAD_PLUGIN;
}
int HasGithubEnvVarCompatible(); // Return the first index to one env var int HasGithubEnvVarCompatible(); // Return the first index to one env var
// which defines a url compatible github // which defines a url compatible github
// or -1 if not found // or -1 if not found
...@@ -156,6 +187,9 @@ private: ...@@ -156,6 +187,9 @@ private:
void OnPathManagementSelection( wxCommandEvent& event ); void OnPathManagementSelection( wxCommandEvent& event );
void OnSelectEnvVarCell( wxGridEvent& event ); void OnSelectEnvVarCell( wxGridEvent& event );
void OnPluginSelection( wxCommandEvent& event ); void OnPluginSelection( wxCommandEvent& event );
#ifdef BUILD_GITHUB_PLUGIN
void OnGithubLibsList( wxCommandEvent& event );
#endif
bool ValidateOptions(); bool ValidateOptions();
}; };
......
...@@ -200,6 +200,9 @@ WIZARD_FPLIB_TABLE_BASE::WIZARD_FPLIB_TABLE_BASE( wxWindow* parent, wxWindowID i ...@@ -200,6 +200,9 @@ WIZARD_FPLIB_TABLE_BASE::WIZARD_FPLIB_TABLE_BASE( wxWindow* parent, wxWindowID i
wxBoxSizer* bSizer5; wxBoxSizer* bSizer5;
bSizer5 = new wxBoxSizer( wxHORIZONTAL ); bSizer5 = new wxBoxSizer( wxHORIZONTAL );
m_buttonGithubLibList = new wxButton( m_wizPage3, wxID_ANY, _("Github Libs List"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer5->Add( m_buttonGithubLibList, 0, wxALL, 5 );
m_buttonAddLib = new wxButton( m_wizPage3, wxID_ANY, _("Add FP Libraries"), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonAddLib = new wxButton( m_wizPage3, wxID_ANY, _("Add FP Libraries"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer5->Add( m_buttonAddLib, 0, wxALL, 5 ); bSizer5->Add( m_buttonAddLib, 0, wxALL, 5 );
...@@ -231,6 +234,7 @@ WIZARD_FPLIB_TABLE_BASE::WIZARD_FPLIB_TABLE_BASE( wxWindow* parent, wxWindowID i ...@@ -231,6 +234,7 @@ WIZARD_FPLIB_TABLE_BASE::WIZARD_FPLIB_TABLE_BASE( wxWindow* parent, wxWindowID i
m_gridEnvironmentVariablesList->Connect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( WIZARD_FPLIB_TABLE_BASE::OnSelectEnvVarCell ), NULL, this ); m_gridEnvironmentVariablesList->Connect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( WIZARD_FPLIB_TABLE_BASE::OnSelectEnvVarCell ), NULL, this );
m_buttonAddEV->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WIZARD_FPLIB_TABLE_BASE::OnAddEVariable ), NULL, this ); m_buttonAddEV->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WIZARD_FPLIB_TABLE_BASE::OnAddEVariable ), NULL, this );
m_buttonRemoveEV->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WIZARD_FPLIB_TABLE_BASE::OnRemoveEVariable ), NULL, this ); m_buttonRemoveEV->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WIZARD_FPLIB_TABLE_BASE::OnRemoveEVariable ), NULL, this );
m_buttonGithubLibList->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WIZARD_FPLIB_TABLE_BASE::OnGithubLibsList ), NULL, this );
m_buttonAddLib->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WIZARD_FPLIB_TABLE_BASE::OnAddFpLibs ), NULL, this ); m_buttonAddLib->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WIZARD_FPLIB_TABLE_BASE::OnAddFpLibs ), NULL, this );
m_buttonRemoveLib->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WIZARD_FPLIB_TABLE_BASE::OnRemoveFpLibs ), NULL, this ); m_buttonRemoveLib->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WIZARD_FPLIB_TABLE_BASE::OnRemoveFpLibs ), NULL, this );
} }
...@@ -246,6 +250,7 @@ WIZARD_FPLIB_TABLE_BASE::~WIZARD_FPLIB_TABLE_BASE() ...@@ -246,6 +250,7 @@ WIZARD_FPLIB_TABLE_BASE::~WIZARD_FPLIB_TABLE_BASE()
m_gridEnvironmentVariablesList->Disconnect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( WIZARD_FPLIB_TABLE_BASE::OnSelectEnvVarCell ), NULL, this ); m_gridEnvironmentVariablesList->Disconnect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( WIZARD_FPLIB_TABLE_BASE::OnSelectEnvVarCell ), NULL, this );
m_buttonAddEV->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WIZARD_FPLIB_TABLE_BASE::OnAddEVariable ), NULL, this ); m_buttonAddEV->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WIZARD_FPLIB_TABLE_BASE::OnAddEVariable ), NULL, this );
m_buttonRemoveEV->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WIZARD_FPLIB_TABLE_BASE::OnRemoveEVariable ), NULL, this ); m_buttonRemoveEV->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WIZARD_FPLIB_TABLE_BASE::OnRemoveEVariable ), NULL, this );
m_buttonGithubLibList->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WIZARD_FPLIB_TABLE_BASE::OnGithubLibsList ), NULL, this );
m_buttonAddLib->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WIZARD_FPLIB_TABLE_BASE::OnAddFpLibs ), NULL, this ); m_buttonAddLib->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WIZARD_FPLIB_TABLE_BASE::OnAddFpLibs ), NULL, this );
m_buttonRemoveLib->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WIZARD_FPLIB_TABLE_BASE::OnRemoveFpLibs ), NULL, this ); m_buttonRemoveLib->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WIZARD_FPLIB_TABLE_BASE::OnRemoveFpLibs ), NULL, this );
......
...@@ -1942,6 +1942,94 @@ ...@@ -1942,6 +1942,94 @@
<property name="name">bSizer5</property> <property name="name">bSizer5</property>
<property name="orient">wxHORIZONTAL</property> <property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property> <property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Github Libs List</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_buttonGithubLibList</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnGithubLibsList</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALL</property> <property name="flag">wxALL</property>
......
...@@ -61,6 +61,7 @@ class WIZARD_FPLIB_TABLE_BASE : public wxWizard ...@@ -61,6 +61,7 @@ class WIZARD_FPLIB_TABLE_BASE : public wxWizard
wxStaticText* m_textPath; wxStaticText* m_textPath;
wxStaticText* m_staticText2; wxStaticText* m_staticText2;
wxGrid* m_gridFpListLibs; wxGrid* m_gridFpListLibs;
wxButton* m_buttonGithubLibList;
wxButton* m_buttonAddLib; wxButton* m_buttonAddLib;
wxButton* m_buttonRemoveLib; wxButton* m_buttonRemoveLib;
...@@ -73,6 +74,7 @@ class WIZARD_FPLIB_TABLE_BASE : public wxWizard ...@@ -73,6 +74,7 @@ class WIZARD_FPLIB_TABLE_BASE : public wxWizard
virtual void OnSelectEnvVarCell( wxGridEvent& event ) { event.Skip(); } virtual void OnSelectEnvVarCell( wxGridEvent& event ) { event.Skip(); }
virtual void OnAddEVariable( wxCommandEvent& event ) { event.Skip(); } virtual void OnAddEVariable( wxCommandEvent& event ) { event.Skip(); }
virtual void OnRemoveEVariable( wxCommandEvent& event ) { event.Skip(); } virtual void OnRemoveEVariable( wxCommandEvent& event ) { event.Skip(); }
virtual void OnGithubLibsList( wxCommandEvent& event ) { event.Skip(); }
virtual void OnAddFpLibs( wxCommandEvent& event ) { event.Skip(); } virtual void OnAddFpLibs( wxCommandEvent& event ) { event.Skip(); }
virtual void OnRemoveFpLibs( wxCommandEvent& event ) { event.Skip(); } virtual void OnRemoveFpLibs( wxCommandEvent& event ) { event.Skip(); }
......
...@@ -378,7 +378,7 @@ static void idf_export_module( BOARD* aPcb, MODULE* aModule, ...@@ -378,7 +378,7 @@ static void idf_export_module( BOARD* aPcb, MODULE* aModule,
IDF3_COMP_OUTLINE* outline; IDF3_COMP_OUTLINE* outline;
outline = aIDFBoard.GetComponentOutline( modfile->GetShape3DName() ); outline = aIDFBoard.GetComponentOutline( modfile->GetShape3DFullFilename() );
if( !outline ) if( !outline )
throw( std::runtime_error( aIDFBoard.GetError() ) ); throw( std::runtime_error( aIDFBoard.GetError() ) );
......
...@@ -635,14 +635,15 @@ static void export_vrml_pcbtext( MODEL_VRML& aModel, TEXTE_PCB* text ) ...@@ -635,14 +635,15 @@ static void export_vrml_pcbtext( MODEL_VRML& aModel, TEXTE_PCB* text )
if( text->IsMultilineAllowed() ) if( text->IsMultilineAllowed() )
{ {
wxArrayString* list = wxStringSplit( text->GetShownText(), '\n' ); wxArrayString strings_list;
wxStringSplit( text->GetShownText(), strings_list, '\n' );
std::vector<wxPoint> positions; std::vector<wxPoint> positions;
positions.reserve( list->Count() ); positions.reserve( strings_list.Count() );
text->GetPositionsOfLinesOfMultilineText( positions, list->Count() ); text->GetPositionsOfLinesOfMultilineText( positions, strings_list.Count() );
for( unsigned ii = 0; ii < list->Count(); ii++ ) for( unsigned ii = 0; ii < strings_list.Count(); ii++ )
{ {
wxString txt = list->Item( ii ); wxString& txt = strings_list.Item( ii );
DrawGraphicText( NULL, NULL, positions[ii], color, DrawGraphicText( NULL, NULL, positions[ii], color,
txt, text->GetOrientation(), size, txt, text->GetOrientation(), size,
text->GetHorizJustify(), text->GetVertJustify(), text->GetHorizJustify(), text->GetVertJustify(),
...@@ -650,8 +651,6 @@ static void export_vrml_pcbtext( MODEL_VRML& aModel, TEXTE_PCB* text ) ...@@ -650,8 +651,6 @@ static void export_vrml_pcbtext( MODEL_VRML& aModel, TEXTE_PCB* text )
true, true,
vrml_text_callback ); vrml_text_callback );
} }
delete (list);
} }
else else
{ {
......
...@@ -51,7 +51,7 @@ set( CMAKE_CXX_FLAGS ...@@ -51,7 +51,7 @@ set( CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -Wno-sign-compare -Wno-reorder -Wno-unused-variable -Wno-unused-function -Wno-strict-aliasing" ) "${CMAKE_CXX_FLAGS} -Wno-sign-compare -Wno-reorder -Wno-unused-variable -Wno-unused-function -Wno-strict-aliasing" )
set( GITHUB_PLUGIN_SRCS set( GITHUB_PLUGIN_SRCS
github_plugin.cpp github_plugin.cpp github_getliblist.cpp
) )
add_library( github_plugin STATIC ${GITHUB_PLUGIN_SRCS} ) add_library( github_plugin STATIC ${GITHUB_PLUGIN_SRCS} )
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015 Jean-Pierre Charras jp.charras at wanadoo.fr
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2015 KiCad Developers, see CHANGELOG.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
*/
/*
* While creating a wizard to edit the fp lib tables, and mainly the web viewer
* which can read the list of pretty library on a github repos, I was told there is
* this URL to retrieve info from any particular repo:
*
* https://api.github.com/orgs/KiCad/repos
* or
* https://api.github.com/users/KiCad/repos
*
* This gets just information on the repo in JSON format.
*
* I used avhttp, already used in the pcbnew Github plugin to download
* the json file.
*
* JP Charras.
*/
#if 0
/*
* FIX ME
* I do not include avhttp.hpp here, because it is already included in
* github_plugin.cpp
* and if it is also included in this file, the link fails (double definiton of modules)
* therefore, the GITHUB_GETLIBLIST method which uses avhttp to download dats from gitub
* is in github_plugin.cpp
*/
#ifndef WIN32_LEAN_AND_MEAN
// when WIN32_LEAN_AND_MEAN is defined, some useless includes in <window.h>
// are skipped, and this avoid some compil issues
#define WIN32_LEAN_AND_MEAN
#endif
#ifdef WIN32
// defines needed by avhttp
// Minimal Windows version is XP: Google for _WIN32_WINNT
#define _WIN32_WINNT 0x0501
#define WINVER 0x0501
#endif
#include <wx/wx.h>
#include <avhttp.hpp>
#endif
#include <wx/uri.h>
#include <github_getliblist.h>
#include <macros.h>
#include <common.h>
GITHUB_GETLIBLIST::GITHUB_GETLIBLIST( const wxString& aRepoURL )
{
m_repoURL = aRepoURL;
}
bool GITHUB_GETLIBLIST::GetLibraryList( wxArrayString& aList )
{
std::string fullURLCommand;
int page = 1;
int itemCountMax = 99; // Do not use a valu > 100, it does not work
// Github max items returned is 100 per page
if( !repoURL2listURL( m_repoURL, &fullURLCommand, itemCountMax, page ) )
{
wxString msg = wxString::Format( _( "malformed URL:\n'%s'" ), GetChars( m_repoURL ) );
wxMessageBox( msg );
return false;
}
// The URL lib names are relative to the server name.
// so add the server name to them.
wxURI repo( m_repoURL );
wxString urlPrefix = wxT( "https://" ) + repo.GetServer() + wxT( "/" );;
wxString errorMsg;
const char sep = ','; // Separator fields, in json returned file
wxString tmp;
int items_count_per_page = 0;
while( 1 )
{
bool success = remote_get_json( &fullURLCommand, &errorMsg );
if( !success )
{
wxMessageBox( errorMsg );
return false;
}
for( unsigned ii = 0; ii < m_json_image.size(); ii++ )
{
if( m_json_image[ii] == sep || ii == m_json_image.size() - 1 )
{
if( tmp.StartsWith( wxT( "\"full_name\"" ) ) )
{
#define QUOTE '\"'
// Remove useless quotes:
if( tmp[tmp.Length() - 1] == QUOTE )
tmp.RemoveLast();
if( tmp.EndsWith( wxT( ".pretty" ) ) )
{
aList.Add( tmp.AfterLast( ':' ) );
int idx = aList.GetCount() - 1;
if( aList[idx][0] == QUOTE )
aList[idx].Remove( 0, 1 );
aList[idx].Prepend( urlPrefix );
}
items_count_per_page++;
}
tmp.Clear();
}
else
tmp << m_json_image[ii];
}
if( items_count_per_page >= itemCountMax )
{
page++;
repoURL2listURL( m_repoURL, &fullURLCommand, itemCountMax, page );
items_count_per_page = 0;
m_json_image.clear();
}
else
break;
}
aList.Sort();
return true;
}
bool GITHUB_GETLIBLIST::repoURL2listURL( const wxString& aRepoURL,
std::string* aFullURLCommand,
int aItemCountMax, int aPage )
{
// aListURL is e.g. "https://api.github.com/orgs/KiCad/repos"
// or "https://api.github.com/users/KiCad/repos"
// aRepoURL is e.g. "https://github.com/KiCad"
// Github has a default pagination set to 30 items.
// but allows up to 100 items max if we add the "?per_page=100" option
wxURI repo( aRepoURL );
if( repo.HasServer() && repo.HasPath() )
{
// goal: "https://api.github.com/orgs/KiCad"
wxString target_url( wxT( "https://api.github.com/orgs" ) );
target_url += repo.GetPath();
target_url += wxT( "/repos" );
// Github has a default pagination set to 30 items.
// but allows up to 100 items max. Use this limit
target_url += wxString::Format( "?per_page=%d&page=%d", aItemCountMax, aPage );
*aFullURLCommand = target_url.utf8_str();
return true;
}
return false;
}
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015 Jean-Pierre Charras jp.charras at wanadoo.fr
* Copyright (C) 2015 KiCad Developers, see CHANGELOG.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
*/
#ifndef GITHUB_GETLIBLIST_H_
#define GITHUB_GETLIBLIST_H_
/**
* Class GITHUB_GETLIBLIST
* implements a portion of pcbnew's PLUGIN interface to provide read only access
* to a github repo to extract pretty footprints library list, in json format.
*
* this plugin simply reads in a zip file of the repo and unzips it from RAM as
* needed. Therefore this "Github" plugin is <b>read only for accessing remote
* at https://api.github.com/orgs/KiCad/repos</b>
*/
class GITHUB_GETLIBLIST
{
public:
// -----<API>----------------------------------------------------------
bool GetLibraryList( wxArrayString& aList );
// -----</API>---------------------------------------------------------
GITHUB_GETLIBLIST( const wxString& aRepoURL );
~GITHUB_GETLIBLIST() {}
protected:
/**
* Function repoURL2listURL
* translates a repo URL to the URL name which gives the state of repos URL
* as commonly seen on github.com
*
* @param aRepoURL points to the base of the repo.
* @param aFullURLCommand is URL the full URL command (URL+options).
* @param aItemCountMax is the max item count in apage,
* and is 100 for github repo.
* @param aPage is the page number, if there are more than one page in repo.
* @return bool - true if @a aRepoULR was parseable, else false
*/
bool repoURL2listURL( const wxString& aRepoURL, std::string* aFullURLCommand,
int aItemCountMax, int aPage = 1 );
/**
* Function remote_get_json
* Download a json text from a github repo. The text image
* is received into the m_input_stream.
* @param aFullURLCommand the full command, i.e. the url with options like
* "https://api.github.com/users/KiCad/repos?per_page=100?page=1"
* @param aMsgError a pointer to a wxString which can store an error message
* @return true if OK, false if error (which an error message in *aMsgError
*/
bool remote_get_json( std::string* aFullURLCommand, wxString* aMsgError );
wxString m_github_path; ///< Something like https://api.github.com/orgs/KiCad
std::string m_json_image; ///< image of the text file in its entirety.
wxString m_repoURL; // the URL of the Github repo
};
#endif // GITHUB_GETLIBLIST_H_
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2013 KiCad Developers, see CHANGELOG.TXT for contributors. * Copyright (C) 2015 KiCad Developers, see CHANGELOG.TXT for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
...@@ -101,6 +101,7 @@ Vary: Accept-Encoding ...@@ -101,6 +101,7 @@ Vary: Accept-Encoding
#include <class_module.h> #include <class_module.h>
#include <macros.h> #include <macros.h>
#include <fp_lib_table.h> // ExpandSubstitutions() #include <fp_lib_table.h> // ExpandSubstitutions()
#include <github_getliblist.h>
using namespace std; using namespace std;
...@@ -549,6 +550,57 @@ void GITHUB_PLUGIN::remote_get_zip( const wxString& aRepoURL ) throw( IO_ERROR ) ...@@ -549,6 +550,57 @@ void GITHUB_PLUGIN::remote_get_zip( const wxString& aRepoURL ) throw( IO_ERROR )
} }
} }
// This GITHUB_GETLIBLIST method should not be here, but in github_getliblist.cpp!
// However it is here just because we need to include <avhttp.hpp> to compile it.
// and if we include avhttp in 2 .cpp files, the link fails becuse it detects duplicate
// avhttp functions.
// So until it is fixed, this code is here.
bool GITHUB_GETLIBLIST::remote_get_json( std::string* aFullURLCommand, wxString* aMsgError )
{
boost::asio::io_service io;
avhttp::http_stream h( io );
avhttp::request_opts options;
options.insert( "Accept", "application/json" );
options.insert( "User-Agent", "http://kicad-pcb.org" ); // THAT WOULD BE ME.
h.request_options( options );
try
{
std::ostringstream os;
h.open( *aFullURLCommand ); // only one file, therefore do it synchronously.
os << &h;
// Keep json text file image in RAM.
m_json_image = os.str();
// 4 lines, using SSL, top that.
}
catch( boost::system::system_error& e )
{
// https "GET" has faild, report this to API caller.
static const char errorcmd[] = "https GET command failed"; // Do not translate this message
UTF8 fmt( _( "%s\nCannot get/download json data from: '%s'\nReason: '%s'" ) );
std::string msg = StrPrintf( fmt.c_str(),
errorcmd,
// Report secret list_url to user. The secret
// list_url may go bad at some point in future if github changes
// their server architecture. Then fix repoURL_zipURL() to reflect
// new architecture.
aFullURLCommand->c_str(), e.what() );
if( aMsgError )
{
*aMsgError = msg;
return false;
}
}
return true;
}
#if 0 && defined(STANDALONE) #if 0 && defined(STANDALONE)
......
...@@ -469,20 +469,19 @@ void BRDITEMS_PLOTTER::PlotTextePcb( TEXTE_PCB* pt_texte ) ...@@ -469,20 +469,19 @@ void BRDITEMS_PLOTTER::PlotTextePcb( TEXTE_PCB* pt_texte )
if( pt_texte->IsMultilineAllowed() ) if( pt_texte->IsMultilineAllowed() )
{ {
std::vector<wxPoint> positions; std::vector<wxPoint> positions;
wxArrayString* list = wxStringSplit( shownText, '\n' ); wxArrayString strings_list;
positions.reserve( list->Count() ); wxStringSplit( shownText, strings_list, '\n' );
positions.reserve( strings_list.Count() );
pt_texte->GetPositionsOfLinesOfMultilineText( positions, list->Count() ); pt_texte->GetPositionsOfLinesOfMultilineText( positions, strings_list.Count() );
for( unsigned ii = 0; ii < list->Count(); ii++ ) for( unsigned ii = 0; ii < strings_list.Count(); ii++ )
{ {
wxString& txt = list->Item( ii ); wxString& txt = strings_list.Item( ii );
m_plotter->Text( positions[ii], UNSPECIFIED_COLOR, txt, orient, size, m_plotter->Text( positions[ii], UNSPECIFIED_COLOR, txt, orient, size,
pt_texte->GetHorizJustify(), pt_texte->GetVertJustify(), pt_texte->GetHorizJustify(), pt_texte->GetVertJustify(),
thickness, pt_texte->IsItalic(), allow_bold ); thickness, pt_texte->IsItalic(), allow_bold );
} }
delete list;
} }
else else
{ {
......
...@@ -98,8 +98,8 @@ EC_CONVERGING::EC_CONVERGING( EDIT_LINE& aLine, EDIT_POINTS& aPoints ) : ...@@ -98,8 +98,8 @@ EC_CONVERGING::EC_CONVERGING( EDIT_LINE& aLine, EDIT_POINTS& aPoints ) :
EDIT_POINT& end = aLine.GetEnd(); EDIT_POINT& end = aLine.GetEnd();
// Previous and next points, to make constraining lines (adjacent to the dragged line) // Previous and next points, to make constraining lines (adjacent to the dragged line)
EDIT_POINT& prevOrigin = *aPoints.Previous( origin ); EDIT_POINT& prevOrigin = *aPoints.Previous( origin, false );
EDIT_POINT& nextEnd = *aPoints.Next( end ); EDIT_POINT& nextEnd = *aPoints.Next( end, false );
// Constraints for segments adjacent to the dragged one // Constraints for segments adjacent to the dragged one
m_originSideConstraint = new EC_LINE( origin, prevOrigin ); m_originSideConstraint = new EC_LINE( origin, prevOrigin );
...@@ -147,8 +147,8 @@ void EC_CONVERGING::Apply( EDIT_LINE& aHandle ) ...@@ -147,8 +147,8 @@ void EC_CONVERGING::Apply( EDIT_LINE& aHandle )
m_originSideConstraint->Apply(); m_originSideConstraint->Apply();
m_endSideConstraint->Apply(); m_endSideConstraint->Apply();
EDIT_POINT& prevOrigin = *m_editPoints.Previous( origin ); EDIT_POINT& prevOrigin = *m_editPoints.Previous( origin, false );
EDIT_POINT& nextEnd = *m_editPoints.Next( end ); EDIT_POINT& nextEnd = *m_editPoints.Next( end, false );
// Two segments adjacent to the dragged segment // Two segments adjacent to the dragged segment
SEG originSide = SEG( origin.GetPosition(), prevOrigin.GetPosition() ); SEG originSide = SEG( origin.GetPosition(), prevOrigin.GetPosition() );
......
...@@ -60,22 +60,86 @@ EDIT_POINT* EDIT_POINTS::FindPoint( const VECTOR2I& aLocation ) ...@@ -60,22 +60,86 @@ EDIT_POINT* EDIT_POINTS::FindPoint( const VECTOR2I& aLocation )
std::deque<EDIT_LINE>::iterator lit, litEnd; std::deque<EDIT_LINE>::iterator lit, litEnd;
for( lit = m_lines.begin(), litEnd = m_lines.end(); lit != litEnd; ++lit ) for( lit = m_lines.begin(), litEnd = m_lines.end(); lit != litEnd; ++lit )
{ {
EDIT_LINE& point = *lit; EDIT_LINE& line = *lit;
if( point.WithinPoint( aLocation, size ) ) if( line.WithinPoint( aLocation, size ) )
return &point; return &line;
} }
return NULL; return NULL;
} }
EDIT_POINT* EDIT_POINTS::Previous( const EDIT_POINT& aPoint ) int EDIT_POINTS::GetContourStartIdx( int aPointIdx ) const
{
int lastIdx = 0;
BOOST_FOREACH( int idx, m_contours )
{
if( idx >= aPointIdx )
return lastIdx;
lastIdx = idx + 1;
}
return lastIdx;
}
int EDIT_POINTS::GetContourEndIdx( int aPointIdx ) const
{
BOOST_FOREACH( int idx, m_contours )
{
if( idx >= aPointIdx )
return idx;
}
return m_points.size() - 1;
}
bool EDIT_POINTS::IsContourStart( int aPointIdx ) const
{
BOOST_FOREACH( int idx, m_contours )
{
if( idx + 1 == aPointIdx )
return true;
// the list is sorted, so we cannot expect it any further
if( idx > aPointIdx )
break;
}
return ( aPointIdx == 0 );
}
bool EDIT_POINTS::IsContourEnd( int aPointIdx ) const
{
BOOST_FOREACH( int idx, m_contours )
{
if( idx == aPointIdx )
return true;
// the list is sorted, so we cannot expect it any further
if( idx > aPointIdx )
break;
}
// the end of the list surely is the end of a contour
return ( aPointIdx == (int) m_points.size() - 1 );
}
EDIT_POINT* EDIT_POINTS::Previous( const EDIT_POINT& aPoint, bool aTraverseContours )
{ {
for( unsigned int i = 0; i < m_points.size(); ++i ) for( unsigned int i = 0; i < m_points.size(); ++i )
{ {
if( m_points[i] == aPoint ) if( m_points[i] == aPoint )
{ {
if( !aTraverseContours && IsContourStart( i ) )
return &m_points[GetContourEndIdx( i )];
if( i == 0 ) if( i == 0 )
return &m_points[m_points.size() - 1]; return &m_points[m_points.size() - 1];
else else
...@@ -104,12 +168,15 @@ EDIT_LINE* EDIT_POINTS::Previous( const EDIT_LINE& aLine ) ...@@ -104,12 +168,15 @@ EDIT_LINE* EDIT_POINTS::Previous( const EDIT_LINE& aLine )
} }
EDIT_POINT* EDIT_POINTS::Next( const EDIT_POINT& aPoint ) EDIT_POINT* EDIT_POINTS::Next( const EDIT_POINT& aPoint, bool aTraverseContours )
{ {
for( unsigned int i = 0; i < m_points.size(); ++i ) for( unsigned int i = 0; i < m_points.size(); ++i )
{ {
if( m_points[i] == aPoint ) if( m_points[i] == aPoint )
{ {
if( !aTraverseContours && IsContourEnd( i ) )
return &m_points[GetContourStartIdx( i )];
if( i == m_points.size() - 1 ) if( i == m_points.size() - 1 )
return &m_points[0]; return &m_points[0];
else else
...@@ -152,7 +219,9 @@ void EDIT_POINTS::ViewDraw( int aLayer, KIGFX::GAL* aGal ) const ...@@ -152,7 +219,9 @@ void EDIT_POINTS::ViewDraw( int aLayer, KIGFX::GAL* aGal ) const
aGal->DrawRectangle( point.GetPosition() - size / 2, point.GetPosition() + size / 2 ); aGal->DrawRectangle( point.GetPosition() - size / 2, point.GetPosition() + size / 2 );
BOOST_FOREACH( const EDIT_LINE& line, m_lines ) BOOST_FOREACH( const EDIT_LINE& line, m_lines )
{
aGal->DrawCircle( line.GetPosition(), size / 2 ); aGal->DrawCircle( line.GetPosition(), size / 2 );
}
aGal->PopDepth(); aGal->PopDepth();
} }
...@@ -243,7 +243,6 @@ public: ...@@ -243,7 +243,6 @@ public:
return m_constraint.get(); return m_constraint.get();
} }
/** /**
* Function GetOrigin() * Function GetOrigin()
* *
...@@ -371,16 +370,65 @@ public: ...@@ -371,16 +370,65 @@ public:
m_lines.push_back( EDIT_LINE( aOrigin, aEnd ) ); m_lines.push_back( EDIT_LINE( aOrigin, aEnd ) );
} }
/**
* Function AddBreak()
*
* Adds a break, indicating the end of a contour.
*/
void AddBreak()
{
assert( m_points.size() > 0 );
m_contours.push_back( m_points.size() - 1 );
}
/**
* Function GetContourStartIdx()
*
* Returns index of the contour origin for a point with given index.
* @param aPointIdx is the index of point for which the contour origin is searched.
* @return Index of the contour origin point.
*/
int GetContourStartIdx( int aPointIdx ) const;
/**
* Function GetContourEndIdx()
*
* Returns index of the contour finish for a point with given index.
* @param aPointIdx is the index of point for which the contour finish is searched.
* @return Index of the contour finish point.
*/
int GetContourEndIdx( int aPointIdx ) const;
/**
* Function IsContourStart()
*
* Checks is a point with given index is a contour origin.
* @param aPointIdx is the index of the point to be checked.
* @return True if the point is an origin of a contour.
*/
bool IsContourStart( int aPointIdx ) const;
/**
* Function IsContourEnd()
*
* Checks is a point with given index is a contour finish.
* @param aPointIdx is the index of the point to be checked.
* @return True if the point is a finish of a contour.
*/
bool IsContourEnd( int aPointIdx ) const;
/** /**
* Function Previous() * Function Previous()
* *
* Returns the point that is after the given point in the list. * Returns the point that is after the given point in the list.
* @param aPoint is the point that is supposed to be preceding the searched point. * @param aPoint is the point that is supposed to be preceding the searched point.
* @param aTraverseContours decides if in case of breaks should we return to the origin
* of contour or continue with the next contour.
* @return The point following aPoint in the list. If aPoint is the first in * @return The point following aPoint in the list. If aPoint is the first in
* the list, the last from the list will be returned. If there are no points at all, NULL * the list, the last from the list will be returned. If there are no points at all, NULL
* is returned. * is returned.
*/ */
EDIT_POINT* Previous( const EDIT_POINT& aPoint ); EDIT_POINT* Previous( const EDIT_POINT& aPoint, bool aTraverseContours = true );
EDIT_LINE* Previous( const EDIT_LINE& aLine ); EDIT_LINE* Previous( const EDIT_LINE& aLine );
...@@ -389,11 +437,13 @@ public: ...@@ -389,11 +437,13 @@ public:
* *
* Returns the point that is before the given point in the list. * Returns the point that is before the given point in the list.
* @param aPoint is the point that is supposed to be following the searched point. * @param aPoint is the point that is supposed to be following the searched point.
* @param aTraverseContours decides if in case of breaks should we return to the origin
* of contour or continue with the next contour.
* @return The point preceding aPoint in the list. If aPoint is the last in * @return The point preceding aPoint in the list. If aPoint is the last in
* the list, the first point from the list will be returned. If there are no points at all, * the list, the first point from the list will be returned. If there are no points at all,
* NULL is returned. * NULL is returned.
*/ */
EDIT_POINT* Next( const EDIT_POINT& aPoint ); EDIT_POINT* Next( const EDIT_POINT& aPoint, bool aTraverseContours = true );
EDIT_LINE* Next( const EDIT_LINE& aLine ); EDIT_LINE* Next( const EDIT_LINE& aLine );
...@@ -461,6 +511,7 @@ private: ...@@ -461,6 +511,7 @@ private:
EDA_ITEM* m_parent; ///< Parent of the EDIT_POINTs EDA_ITEM* m_parent; ///< Parent of the EDIT_POINTs
std::deque<EDIT_POINT> m_points; ///< EDIT_POINTs for modifying m_parent std::deque<EDIT_POINT> m_points; ///< EDIT_POINTs for modifying m_parent
std::deque<EDIT_LINE> m_lines; ///< EDIT_LINEs for modifying m_parent std::deque<EDIT_LINE> m_lines; ///< EDIT_LINEs for modifying m_parent
std::list<int> m_contours; ///< Indices of end contour points
}; };
#endif /* EDIT_POINTS_H_ */ #endif /* EDIT_POINTS_H_ */
...@@ -119,20 +119,35 @@ public: ...@@ -119,20 +119,35 @@ public:
int cornersCount = outline->GetCornersCount(); int cornersCount = outline->GetCornersCount();
for( int i = 0; i < cornersCount; ++i ) for( int i = 0; i < cornersCount; ++i )
{
points->AddPoint( outline->GetPos( i ) ); points->AddPoint( outline->GetPos( i ) );
if( outline->IsEndContour( i ) )
points->AddBreak();
}
// Lines have to be added after creating edit points, // Lines have to be added after creating edit points,
// as they use EDIT_POINT references // as they use EDIT_POINT references
for( int i = 0; i < cornersCount - 1; ++i ) for( int i = 0; i < cornersCount - 1; ++i )
{
if( points->IsContourEnd( i ) )
{
points->AddLine( points->Point( i ),
points->Point( points->GetContourStartIdx( i ) ) );
}
else
{ {
points->AddLine( points->Point( i ), points->Point( i + 1 ) ); points->AddLine( points->Point( i ), points->Point( i + 1 ) );
points->Line( i ).SetConstraint( }
new EC_SNAPLINE( points->Line( i ),
points->Line( i ).SetConstraint( new EC_SNAPLINE( points->Line( i ),
boost::bind( &KIGFX::GAL::GetGridPoint, aGal, _1 ) ) ); boost::bind( &KIGFX::GAL::GetGridPoint, aGal, _1 ) ) );
} }
// The last missing line, connecting the last and the first polygon point // The last missing line, connecting the last and the first polygon point
points->AddLine( points->Point( cornersCount - 1 ), points->Point( 0 ) ); points->AddLine( points->Point( cornersCount - 1 ),
points->Point( points->GetContourStartIdx( cornersCount - 1 ) ) );
points->Line( points->LinesSize() - 1 ).SetConstraint( points->Line( points->LinesSize() - 1 ).SetConstraint(
new EC_SNAPLINE( points->Line( points->LinesSize() - 1 ), new EC_SNAPLINE( points->Line( points->LinesSize() - 1 ),
boost::bind( &KIGFX::GAL::GetGridPoint, aGal, _1 ) ) ); boost::bind( &KIGFX::GAL::GetGridPoint, aGal, _1 ) ) );
......
update=30/03/2013 13:45:59 update=11/01/2015 18:31:38
version=1 version=1
last_client=pcbnew last_client=kicad
[general] [general]
version=1 version=1
RootSch= RootSch=
BoardNm= BoardNm=
[cvpcb]
version=1
NetIExt=net
[cvpcb/libraries]
EquName1=devcms
[eeschema] [eeschema]
version=1 version=1
LibDir= LibDir=
...@@ -68,3 +63,6 @@ SolderMaskMinWidth=0.000000000000 ...@@ -68,3 +63,6 @@ SolderMaskMinWidth=0.000000000000
DrawSegmentWidth=0.200000000000 DrawSegmentWidth=0.200000000000
BoardOutlineThickness=0.100000000000 BoardOutlineThickness=0.100000000000
ModuleOutlineThickness=0.150000000000 ModuleOutlineThickness=0.150000000000
[cvpcb]
version=1
NetIExt=net
...@@ -200,6 +200,9 @@ void BOARD_OUTLINE::readOutlines( std::ifstream& aBoardFile, IDF3::IDF_VERSION a ...@@ -200,6 +200,9 @@ void BOARD_OUTLINE::readOutlines( std::ifstream& aBoardFile, IDF3::IDF_VERSION a
// rewind to the start of the last line; the routine invoking // rewind to the start of the last line; the routine invoking
// this is responsible for checking that the current '.END_ ...' // this is responsible for checking that the current '.END_ ...'
// matches the section header. // matches the section header.
if(aBoardFile.eof())
aBoardFile.clear();
aBoardFile.seekg( pos ); aBoardFile.seekg( pos );
if( outlines.size() > 0 ) if( outlines.size() > 0 )
...@@ -2998,6 +3001,9 @@ void IDF3_COMP_OUTLINE::readProperties( std::ifstream& aLibFile ) ...@@ -2998,6 +3001,9 @@ void IDF3_COMP_OUTLINE::readProperties( std::ifstream& aLibFile )
if( token.size() >= 5 && CompareToken( ".END_", token.substr( 0, 5 ) ) ) if( token.size() >= 5 && CompareToken( ".END_", token.substr( 0, 5 ) ) )
{ {
if(aLibFile.eof())
aLibFile.clear();
aLibFile.seekg( pos ); aLibFile.seekg( pos );
return; return;
} }
......
...@@ -2306,7 +2306,7 @@ void IDF3_BOARD::readBoardFile( const std::string& aFileName, bool aNoSubstitute ...@@ -2306,7 +2306,7 @@ void IDF3_BOARD::readBoardFile( const std::string& aFileName, bool aNoSubstitute
try try
{ {
brd.open( aFileName.c_str(), std::ios_base::in ); brd.open( aFileName.c_str(), std::ios_base::in | std::ios_base::binary );
if( !brd.is_open() ) if( !brd.is_open() )
{ {
...@@ -2682,7 +2682,7 @@ void IDF3_BOARD::readLibFile( const std::string& aFileName ) ...@@ -2682,7 +2682,7 @@ void IDF3_BOARD::readLibFile( const std::string& aFileName )
try try
{ {
lib.open( aFileName.c_str(), std::ios_base::in ); lib.open( aFileName.c_str(), std::ios_base::in | std::ios_base::binary );
IDF3::FILE_STATE state = IDF3::FILE_START; IDF3::FILE_STATE state = IDF3::FILE_START;
...@@ -3883,7 +3883,7 @@ IDF3_COMP_OUTLINE* IDF3_BOARD::GetComponentOutline( wxString aFullFileName ) ...@@ -3883,7 +3883,7 @@ IDF3_COMP_OUTLINE* IDF3_BOARD::GetComponentOutline( wxString aFullFileName )
try try
{ {
model.open( fname.c_str(), std::ios_base::in ); model.open( fname.c_str(), std::ios_base::in | std::ios_base::binary );
std::string iline; // the input line std::string iline; // the input line
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment