Normalize drawing sheet path to env vars & prj, not just prj.

Also cleans up the dialog a bit.

Also changes the workings of NormalizePath to return the input if
it couldn't be shortened which saves open coding that behaviour in
all its callers.

Fixes https://gitlab.com/kicad/code/kicad/issues/9036
This commit is contained in:
Jeff Young 2021-09-23 16:44:39 +01:00
parent 0dce303c49
commit 574bef2237
19 changed files with 609 additions and 470 deletions

View File

@ -17,6 +17,9 @@
* with this program. If not, see <http://www.gnu.org/licenses/>. * with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <env_paths.h>
#include <pgm_base.h>
#include <bitmaps.h>
#include <base_screen.h> #include <base_screen.h>
#include <confirm.h> #include <confirm.h>
#include <core/arraydim.h> #include <core/arraydim.h>
@ -81,6 +84,8 @@ DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS( EDA_DRAW_FRAME* aParent, double aI
m_customSizeY( aParent, m_userSizeYLabel, m_userSizeYCtrl, m_userSizeYUnits ) m_customSizeY( aParent, m_userSizeYLabel, m_userSizeYCtrl, m_userSizeYUnits )
{ {
m_projectPath = Prj().GetProjectPath(); m_projectPath = Prj().GetProjectPath();
m_browseButton->SetBitmap( KiBitmap( BITMAPS::small_folder ) );
m_maxPageSizeMils = aMaxUserSizeMils; m_maxPageSizeMils = aMaxUserSizeMils;
m_tb = m_parent->GetTitleBlock(); m_tb = m_parent->GetTitleBlock();
m_customFmt = false; m_customFmt = false;
@ -240,24 +245,20 @@ void DIALOG_PAGES_SETTINGS::OnPaperSizeChoice( wxCommandEvent& event )
if( paperType.Contains( PAGE_INFO::Custom ) ) if( paperType.Contains( PAGE_INFO::Custom ) )
{ {
m_staticTextOrient->Enable( false );
m_orientationComboBox->Enable( false ); m_orientationComboBox->Enable( false );
m_staticTextCustSize->Enable( true );
m_customSizeX.Enable( true ); m_customSizeX.Enable( true );
m_customSizeY.Enable( true ); m_customSizeY.Enable( true );
m_customFmt = true; m_customFmt = true;
} }
else else
{ {
m_staticTextOrient->Enable( true );
m_orientationComboBox->Enable( true ); m_orientationComboBox->Enable( true );
#if 0 m_staticTextCustSize->Enable( false );
// ForcePortrait() does not exist, but could be useful.
// so I leave these lines, which could be seen as a todo feature
if( paperType.ForcePortrait() )
{
m_orientationComboBox->SetStringSelection( _( "Portrait" ) );
m_orientationComboBox->Enable( false );
}
#endif
m_customSizeX.Enable( false ); m_customSizeX.Enable( false );
m_customSizeY.Enable( false ); m_customSizeY.Enable( false );
m_customFmt = false; m_customFmt = false;
@ -465,7 +466,7 @@ bool DIALOG_PAGES_SETTINGS::SavePageSettings()
if( fileName != BASE_SCREEN::m_DrawingSheetFileName ) if( fileName != BASE_SCREEN::m_DrawingSheetFileName )
{ {
wxString fullFileName = DS_DATA_MODEL::MakeFullFileName( fileName, m_projectPath ); wxString fullFileName = DS_DATA_MODEL::ResolvePath( fileName, m_projectPath );
if( !fullFileName.IsEmpty() && !wxFileExists( fullFileName ) ) if( !fullFileName.IsEmpty() && !wxFileExists( fullFileName ) )
{ {
@ -789,42 +790,33 @@ void DIALOG_PAGES_SETTINGS::OnWksFileSelection( wxCommandEvent& event )
} }
// Display a file picker dialog // Display a file picker dialog
wxFileDialog fileDialog( this, _( "Select Drawing Sheet File" ), wxFileDialog fileDialog( this, _( "Select Drawing Sheet File" ), path, name,
path, name, DrawingSheetFileWildcard(), DrawingSheetFileWildcard(), wxFD_DEFAULT_STYLE|wxFD_FILE_MUST_EXIST );
wxFD_DEFAULT_STYLE | wxFD_FILE_MUST_EXIST );
if( fileDialog.ShowModal() != wxID_OK ) if( fileDialog.ShowModal() != wxID_OK )
return; return;
wxString fileName = fileDialog.GetPath(); wxString fileName = fileDialog.GetPath();
wxString shortFileName;
// Try to remove the path, if the path is the current working dir, // Try to use a project-relative path first:
// or the dir of kicad.pro (template), and use a relative path if( !m_projectPath.IsEmpty() && fileName.StartsWith( m_projectPath ) )
wxString shortFileName = DS_DATA_MODEL::MakeShortFileName( fileName, m_projectPath );
// For Win/Linux/macOS compatibility, a relative path is a good idea
if( shortFileName != GetWksFileName() && shortFileName != fileName )
{ {
wxString msg = wxString::Format( _( "The drawing sheet file name has changed.\n" fn = wxFileName( fileName );
"Do you want to use the relative path:\n" fn.MakeRelativeTo( m_projectPath );
"\"%s\"\n" shortFileName = fn.GetFullPath();
"instead of\n" }
"\"%s\"?" ), else
shortFileName, {
fileName ); // Failing that see if we can shorten it with env vars:
shortFileName = NormalizePath( fileName, &Pgm().GetLocalEnvVariables(), nullptr );
if( !IsOK( this, msg ) )
shortFileName = fileName;
} }
std::unique_ptr<DS_DATA_MODEL> ws = std::make_unique<DS_DATA_MODEL>(); std::unique_ptr<DS_DATA_MODEL> ws = std::make_unique<DS_DATA_MODEL>();
if( ws->LoadDrawingSheet( fileName ) ) if( ws->LoadDrawingSheet( fileName ) )
{ {
if( m_drawingSheet != nullptr ) delete m_drawingSheet;
{
delete m_drawingSheet;
}
m_drawingSheet = ws.release(); m_drawingSheet = ws.release();

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.9.0 Nov 1 2020) // C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO *NOT* EDIT THIS FILE! // PLEASE DO *NOT* EDIT THIS FILE!
@ -112,12 +112,15 @@ DIALOG_PAGES_SETTINGS_BASE::DIALOG_PAGES_SETTINGS_BASE( wxWindow* parent, wxWind
m_PaperExport = new wxCheckBox( this, wxID_ANY, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 ); m_PaperExport = new wxCheckBox( this, wxID_ANY, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 );
bleftSizer->Add( m_PaperExport, 0, wxALL, 4 ); bleftSizer->Add( m_PaperExport, 0, wxALL, 4 );
m_staticline31 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bleftSizer->Add( m_staticline31, 0, wxEXPAND|wxTOP|wxBOTTOM, 10 ); bleftSizer->Add( 0, 20, 0, wxEXPAND, 5 );
m_staticTextPreview = new wxStaticText( this, wxID_ANY, _("Preview"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextPreview = new wxStaticText( this, wxID_ANY, _("Preview"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextPreview->Wrap( -1 ); m_staticTextPreview->Wrap( -1 );
bleftSizer->Add( m_staticTextPreview, 0, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT, 10 ); bleftSizer->Add( m_staticTextPreview, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 );
m_staticline31 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bleftSizer->Add( m_staticline31, 0, wxEXPAND|wxBOTTOM, 10 );
m_PageLayoutExampleBitmap = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), wxFULL_REPAINT_ON_RESIZE|wxBORDER_SIMPLE ); m_PageLayoutExampleBitmap = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), wxFULL_REPAINT_ON_RESIZE|wxBORDER_SIMPLE );
m_PageLayoutExampleBitmap->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); m_PageLayoutExampleBitmap->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) );
@ -126,17 +129,52 @@ DIALOG_PAGES_SETTINGS_BASE::DIALOG_PAGES_SETTINGS_BASE( wxWindow* parent, wxWind
bleftSizer->Add( m_PageLayoutExampleBitmap, 1, wxALL|wxEXPAND, 5 ); bleftSizer->Add( m_PageLayoutExampleBitmap, 1, wxALL|wxEXPAND, 5 );
bUpperSizerH->Add( bleftSizer, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); bUpperSizerH->Add( bleftSizer, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bUpperSizerH->Add( 10, 0, 0, wxEXPAND, 5 );
wxBoxSizer* bSizerRight; wxBoxSizer* bSizerRight;
bSizerRight = new wxBoxSizer( wxVERTICAL ); bSizerRight = new wxBoxSizer( wxVERTICAL );
m_staticTextDrawingSheet = new wxStaticText( this, wxID_ANY, _("Drawing Sheet"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextDrawingSheet->Wrap( -1 );
bSizerRight->Add( m_staticTextDrawingSheet, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
m_staticline4 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bSizerRight->Add( m_staticline4, 0, wxEXPAND, 5 );
wxBoxSizer* bSizerFilename;
bSizerFilename = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bSizerfileSelection;
bSizerfileSelection = new wxBoxSizer( wxHORIZONTAL );
m_staticText30 = new wxStaticText( this, wxID_ANY, _("File:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText30->Wrap( -1 );
bSizerfileSelection->Add( m_staticText30, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 );
m_textCtrlFilePicker = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bSizerfileSelection->Add( m_textCtrlFilePicker, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 );
m_browseButton = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
bSizerfileSelection->Add( m_browseButton, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
bSizerFilename->Add( bSizerfileSelection, 1, wxEXPAND, 5 );
bSizerRight->Add( bSizerFilename, 0, wxEXPAND|wxALL, 5 );
bSizerRight->Add( 0, 10, 0, wxEXPAND, 5 );
m_staticTextTitleBlock = new wxStaticText( this, wxID_ANY, _("Title Block Parameters"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextTitleBlock = new wxStaticText( this, wxID_ANY, _("Title Block Parameters"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextTitleBlock->Wrap( -1 ); m_staticTextTitleBlock->Wrap( -1 );
bSizerRight->Add( m_staticTextTitleBlock, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); bSizerRight->Add( m_staticTextTitleBlock, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
m_staticline3 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); m_staticline3 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bSizerRight->Add( m_staticline3, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); bSizerRight->Add( m_staticline3, 0, wxEXPAND, 5 );
wxBoxSizer* SheetInfoSizer; wxBoxSizer* SheetInfoSizer;
SheetInfoSizer = new wxBoxSizer( wxHORIZONTAL ); SheetInfoSizer = new wxBoxSizer( wxHORIZONTAL );
@ -330,36 +368,17 @@ DIALOG_PAGES_SETTINGS_BASE::DIALOG_PAGES_SETTINGS_BASE( wxWindow* parent, wxWind
fgSizer2->Add( m_Comment9Export, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); fgSizer2->Add( m_Comment9Export, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSizerRight->Add( fgSizer2, 0, wxEXPAND|wxALL, 5 ); bSizerRight->Add( fgSizer2, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* bSizerFilename;
bSizerFilename = new wxBoxSizer( wxVERTICAL );
m_staticTextfilename = new wxStaticText( this, wxID_ANY, _("Drawing sheet file"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextfilename->Wrap( -1 );
bSizerFilename->Add( m_staticTextfilename, 0, wxRIGHT|wxLEFT, 5 );
wxBoxSizer* bSizerfileSelection;
bSizerfileSelection = new wxBoxSizer( wxHORIZONTAL );
m_textCtrlFilePicker = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bSizerfileSelection->Add( m_textCtrlFilePicker, 1, wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
m_buttonBrowse = new wxButton( this, wxID_ANY, _("Browse..."), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT );
bSizerfileSelection->Add( m_buttonBrowse, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSizerFilename->Add( bSizerfileSelection, 1, wxEXPAND, 5 ); bUpperSizerH->Add( bSizerRight, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSizerRight->Add( bSizerFilename, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
bUpperSizerH->Add( bSizerRight, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 );
bMainSizer->Add( bUpperSizerH, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 ); bMainSizer->Add( bUpperSizerH, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_staticline5 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bMainSizer->Add( m_staticline5, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
m_sdbSizer = new wxStdDialogButtonSizer(); m_sdbSizer = new wxStdDialogButtonSizer();
m_sdbSizerOK = new wxButton( this, wxID_OK ); m_sdbSizerOK = new wxButton( this, wxID_OK );
m_sdbSizer->AddButton( m_sdbSizerOK ); m_sdbSizer->AddButton( m_sdbSizerOK );
@ -379,6 +398,7 @@ DIALOG_PAGES_SETTINGS_BASE::DIALOG_PAGES_SETTINGS_BASE( wxWindow* parent, wxWind
m_orientationComboBox->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnPageOrientationChoice ), NULL, this ); m_orientationComboBox->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnPageOrientationChoice ), NULL, this );
m_userSizeYCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnUserPageSizeYTextUpdated ), NULL, this ); m_userSizeYCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnUserPageSizeYTextUpdated ), NULL, this );
m_userSizeXCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnUserPageSizeXTextUpdated ), NULL, this ); m_userSizeXCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnUserPageSizeXTextUpdated ), NULL, this );
m_browseButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnWksFileSelection ), NULL, this );
m_TextDate->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnDateTextUpdated ), NULL, this ); m_TextDate->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnDateTextUpdated ), NULL, this );
m_ApplyDate->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnDateApplyClick ), NULL, this ); m_ApplyDate->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnDateApplyClick ), NULL, this );
m_TextRevision->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnRevisionTextUpdated ), NULL, this ); m_TextRevision->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnRevisionTextUpdated ), NULL, this );
@ -394,7 +414,6 @@ DIALOG_PAGES_SETTINGS_BASE::DIALOG_PAGES_SETTINGS_BASE( wxWindow* parent, wxWind
m_TextComment7->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnComment7TextUpdated ), NULL, this ); m_TextComment7->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnComment7TextUpdated ), NULL, this );
m_TextComment8->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnComment8TextUpdated ), NULL, this ); m_TextComment8->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnComment8TextUpdated ), NULL, this );
m_TextComment9->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnComment9TextUpdated ), NULL, this ); m_TextComment9->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnComment9TextUpdated ), NULL, this );
m_buttonBrowse->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnWksFileSelection ), NULL, this );
m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnOkClick ), NULL, this ); m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnOkClick ), NULL, this );
} }
@ -405,6 +424,7 @@ DIALOG_PAGES_SETTINGS_BASE::~DIALOG_PAGES_SETTINGS_BASE()
m_orientationComboBox->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnPageOrientationChoice ), NULL, this ); m_orientationComboBox->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnPageOrientationChoice ), NULL, this );
m_userSizeYCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnUserPageSizeYTextUpdated ), NULL, this ); m_userSizeYCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnUserPageSizeYTextUpdated ), NULL, this );
m_userSizeXCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnUserPageSizeXTextUpdated ), NULL, this ); m_userSizeXCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnUserPageSizeXTextUpdated ), NULL, this );
m_browseButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnWksFileSelection ), NULL, this );
m_TextDate->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnDateTextUpdated ), NULL, this ); m_TextDate->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnDateTextUpdated ), NULL, this );
m_ApplyDate->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnDateApplyClick ), NULL, this ); m_ApplyDate->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnDateApplyClick ), NULL, this );
m_TextRevision->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnRevisionTextUpdated ), NULL, this ); m_TextRevision->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnRevisionTextUpdated ), NULL, this );
@ -420,7 +440,6 @@ DIALOG_PAGES_SETTINGS_BASE::~DIALOG_PAGES_SETTINGS_BASE()
m_TextComment7->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnComment7TextUpdated ), NULL, this ); m_TextComment7->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnComment7TextUpdated ), NULL, this );
m_TextComment8->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnComment8TextUpdated ), NULL, this ); m_TextComment8->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnComment8TextUpdated ), NULL, this );
m_TextComment9->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnComment9TextUpdated ), NULL, this ); m_TextComment9->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnComment9TextUpdated ), NULL, this );
m_buttonBrowse->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnWksFileSelection ), NULL, this );
m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnOkClick ), NULL, this ); m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnOkClick ), NULL, this );
} }

View File

@ -14,7 +14,6 @@
<property name="file">dialog_page_settings_base</property> <property name="file">dialog_page_settings_base</property>
<property name="first_id">1000</property> <property name="first_id">1000</property>
<property name="help_provider">none</property> <property name="help_provider">none</property>
<property name="image_path_wrapper_function_name"></property>
<property name="indent_with_spaces"></property> <property name="indent_with_spaces"></property>
<property name="internationalize">1</property> <property name="internationalize">1</property>
<property name="name">dialog_page_settings_base</property> <property name="name">dialog_page_settings_base</property>
@ -26,7 +25,6 @@
<property name="skip_php_events">1</property> <property name="skip_php_events">1</property>
<property name="skip_python_events">1</property> <property name="skip_python_events">1</property>
<property name="ui_table">UI</property> <property name="ui_table">UI</property>
<property name="use_array_enum">0</property>
<property name="use_enum">0</property> <property name="use_enum">0</property>
<property name="use_microsoft_bom">0</property> <property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1"> <object class="Dialog" expanded="1">
@ -71,7 +69,7 @@
<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">wxEXPAND|wxRIGHT|wxLEFT</property> <property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1"> <object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property> <property name="minimum_size"></property>
@ -987,66 +985,18 @@
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">10</property> <property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property> <property name="flag">wxEXPAND</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxStaticLine" expanded="1"> <object class="spacer" expanded="1">
<property name="BottomDockable">1</property> <property name="height">20</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_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="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_staticline31</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property> <property name="permission">protected</property>
<property name="pin_button">1</property> <property name="width">0</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxLI_HORIZONTAL</property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">10</property> <property name="border">5</property>
<property name="flag">wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT</property> <property name="flag">wxALIGN_CENTER_HORIZONTAL|wxALL</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>
@ -1105,6 +1055,64 @@
<property name="wrap">-1</property> <property name="wrap">-1</property>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1">
<property name="border">10</property>
<property name="flag">wxEXPAND|wxBOTTOM</property>
<property name="proportion">0</property>
<object class="wxStaticLine" 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_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="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_staticline31</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">wxLI_HORIZONTAL</property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="0"> <object class="sizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property> <property name="flag">wxALL|wxEXPAND</property>
@ -1167,13 +1175,372 @@
</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|wxRIGHT|wxLEFT</property> <property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="spacer" expanded="1">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">10</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">1</property> <property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1"> <object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">bSizerRight</property> <property name="name">bSizerRight</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">
<property name="border">5</property>
<property name="flag">wxALL|wxALIGN_CENTER_HORIZONTAL</property>
<property name="proportion">0</property>
<object class="wxStaticText" 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_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">Drawing Sheet</property>
<property name="markup">0</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_staticTextDrawingSheet</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="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxStaticLine" 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_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="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_staticline4</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">wxLI_HORIZONTAL</property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxALL</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerFilename</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerfileSelection</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" 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_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">File:</property>
<property name="markup">0</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_staticText30</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">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT</property>
<property name="proportion">1</property>
<object class="wxTextCtrl" 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_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="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength"></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_textCtrlFilePicker</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="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxBitmapButton" 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="bitmap"></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="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="disabled"></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="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Select Drawing Sheet File</property>
<property name="margins"></property>
<property name="markup">0</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_browseButton</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="position"></property>
<property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</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">OnWksFileSelection</event>
</object>
</object>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="spacer" expanded="1">
<property name="height">10</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">wxALL|wxALIGN_CENTER_HORIZONTAL</property> <property name="flag">wxALL|wxALIGN_CENTER_HORIZONTAL</property>
@ -1237,7 +1604,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">wxEXPAND|wxRIGHT|wxLEFT</property> <property name="flag">wxEXPAND</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxStaticLine" expanded="1"> <object class="wxStaticLine" expanded="1">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
@ -1438,7 +1805,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">wxEXPAND|wxALL</property> <property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxFlexGridSizer" expanded="1"> <object class="wxFlexGridSizer" expanded="1">
<property name="cols">3</property> <property name="cols">3</property>
@ -1600,7 +1967,6 @@
<property name="aui_name"></property> <property name="aui_name"></property>
<property name="aui_position"></property> <property name="aui_position"></property>
<property name="aui_row"></property> <property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property> <property name="best_size"></property>
<property name="bg"></property> <property name="bg"></property>
<property name="bitmap"></property> <property name="bitmap"></property>
@ -4072,231 +4438,68 @@
</object> </object>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerFilename</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" 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_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">Drawing sheet file</property>
<property name="markup">0</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_staticTextfilename</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="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerfileSelection</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">1</property>
<object class="wxTextCtrl" 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_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="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength"></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_textCtrlFilePicker</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="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT</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="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></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="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="disabled"></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="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Browse...</property>
<property name="margins"></property>
<property name="markup">0</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_buttonBrowse</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="position"></property>
<property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxBU_EXACTFIT</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">OnWksFileSelection</event>
</object>
</object>
</object>
</object>
</object>
</object>
</object> </object>
</object> </object>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticLine" 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_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="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_staticline5</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">wxLI_HORIZONTAL</property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="0"> <object class="sizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALIGN_RIGHT|wxALL</property> <property name="flag">wxALIGN_RIGHT|wxALL</property>

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.9.0 Nov 1 2020) // C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO *NOT* EDIT THIS FILE! // PLEASE DO *NOT* EDIT THIS FILE!
@ -27,6 +27,7 @@
#include <wx/image.h> #include <wx/image.h>
#include <wx/icon.h> #include <wx/icon.h>
#include <wx/statbmp.h> #include <wx/statbmp.h>
#include <wx/bmpbuttn.h>
#include <wx/button.h> #include <wx/button.h>
#include <wx/datectrl.h> #include <wx/datectrl.h>
#include <wx/dateevt.h> #include <wx/dateevt.h>
@ -57,9 +58,14 @@ class DIALOG_PAGES_SETTINGS_BASE : public DIALOG_SHIM
wxTextCtrl* m_userSizeXCtrl; wxTextCtrl* m_userSizeXCtrl;
wxStaticText* m_userSizeXUnits; wxStaticText* m_userSizeXUnits;
wxCheckBox* m_PaperExport; wxCheckBox* m_PaperExport;
wxStaticLine* m_staticline31;
wxStaticText* m_staticTextPreview; wxStaticText* m_staticTextPreview;
wxStaticLine* m_staticline31;
wxStaticBitmap* m_PageLayoutExampleBitmap; wxStaticBitmap* m_PageLayoutExampleBitmap;
wxStaticText* m_staticTextDrawingSheet;
wxStaticLine* m_staticline4;
wxStaticText* m_staticText30;
wxTextCtrl* m_textCtrlFilePicker;
wxBitmapButton* m_browseButton;
wxStaticText* m_staticTextTitleBlock; wxStaticText* m_staticTextTitleBlock;
wxStaticLine* m_staticline3; wxStaticLine* m_staticline3;
wxStaticText* m_TextSheetCount; wxStaticText* m_TextSheetCount;
@ -105,9 +111,7 @@ class DIALOG_PAGES_SETTINGS_BASE : public DIALOG_SHIM
wxStaticText* m_staticTextComment9; wxStaticText* m_staticTextComment9;
wxTextCtrl* m_TextComment9; wxTextCtrl* m_TextComment9;
wxCheckBox* m_Comment9Export; wxCheckBox* m_Comment9Export;
wxStaticText* m_staticTextfilename; wxStaticLine* m_staticline5;
wxTextCtrl* m_textCtrlFilePicker;
wxButton* m_buttonBrowse;
wxStdDialogButtonSizer* m_sdbSizer; wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizerOK; wxButton* m_sdbSizerOK;
wxButton* m_sdbSizerCancel; wxButton* m_sdbSizerCancel;
@ -117,6 +121,7 @@ class DIALOG_PAGES_SETTINGS_BASE : public DIALOG_SHIM
virtual void OnPageOrientationChoice( wxCommandEvent& event ) { event.Skip(); } virtual void OnPageOrientationChoice( wxCommandEvent& event ) { event.Skip(); }
virtual void OnUserPageSizeYTextUpdated( wxCommandEvent& event ) { event.Skip(); } virtual void OnUserPageSizeYTextUpdated( wxCommandEvent& event ) { event.Skip(); }
virtual void OnUserPageSizeXTextUpdated( wxCommandEvent& event ) { event.Skip(); } virtual void OnUserPageSizeXTextUpdated( wxCommandEvent& event ) { event.Skip(); }
virtual void OnWksFileSelection( wxCommandEvent& event ) { event.Skip(); }
virtual void OnDateTextUpdated( wxCommandEvent& event ) { event.Skip(); } virtual void OnDateTextUpdated( wxCommandEvent& event ) { event.Skip(); }
virtual void OnDateApplyClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnDateApplyClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnRevisionTextUpdated( wxCommandEvent& event ) { event.Skip(); } virtual void OnRevisionTextUpdated( wxCommandEvent& event ) { event.Skip(); }
@ -132,7 +137,6 @@ class DIALOG_PAGES_SETTINGS_BASE : public DIALOG_SHIM
virtual void OnComment7TextUpdated( wxCommandEvent& event ) { event.Skip(); } virtual void OnComment7TextUpdated( wxCommandEvent& event ) { event.Skip(); }
virtual void OnComment8TextUpdated( wxCommandEvent& event ) { event.Skip(); } virtual void OnComment8TextUpdated( wxCommandEvent& event ) { event.Skip(); }
virtual void OnComment9TextUpdated( wxCommandEvent& event ) { event.Skip(); } virtual void OnComment9TextUpdated( wxCommandEvent& event ) { event.Skip(); }
virtual void OnWksFileSelection( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }

View File

@ -47,7 +47,6 @@
#include <kiface_base.h> #include <kiface_base.h>
#include <title_block.h> #include <title_block.h>
#include <common.h> #include <common.h>
#include <eda_item.h>
#include <drawing_sheet/ds_data_item.h> #include <drawing_sheet/ds_data_item.h>
#include <drawing_sheet/ds_data_model.h> #include <drawing_sheet/ds_data_model.h>
#include <drawing_sheet/ds_painter.h> #include <drawing_sheet/ds_painter.h>
@ -141,6 +140,7 @@ void DS_DATA_MODEL::Remove( DS_DATA_ITEM* aItem )
int DS_DATA_MODEL::GetItemIndex( DS_DATA_ITEM* aItem ) const int DS_DATA_MODEL::GetItemIndex( DS_DATA_ITEM* aItem ) const
{ {
unsigned idx = 0; unsigned idx = 0;
while( idx < m_list.size() ) while( idx < m_list.size() )
{ {
if( m_list[idx] == aItem ) if( m_list[idx] == aItem )
@ -163,39 +163,9 @@ DS_DATA_ITEM* DS_DATA_MODEL::GetItem( unsigned aIdx ) const
} }
const wxString DS_DATA_MODEL::MakeShortFileName( const wxString& aFullFileName, const wxString DS_DATA_MODEL::ResolvePath( const wxString& aPath, const wxString& aProjectPath )
const wxString& aProjectPath )
{ {
wxString shortFileName = aFullFileName; wxString fullFileName = ExpandEnvVarSubstitutions( aPath, nullptr );
wxFileName fn = aFullFileName;
if( fn.IsRelative() )
return shortFileName;
if( ! aProjectPath.IsEmpty() && aFullFileName.StartsWith( aProjectPath ) )
{
fn.MakeRelativeTo( aProjectPath );
shortFileName = fn.GetFullPath();
return shortFileName;
}
wxString fileName = Kiface().KifaceSearch().FindValidPath( fn.GetFullName() );
if( !fileName.IsEmpty() )
{
fn = fileName;
shortFileName = fn.GetFullName();
return shortFileName;
}
return shortFileName;
}
const wxString DS_DATA_MODEL::MakeFullFileName( const wxString& aShortFileName,
const wxString& aProjectPath )
{
wxString fullFileName = ExpandEnvVarSubstitutions( aShortFileName, nullptr );
if( fullFileName.IsEmpty() ) if( fullFileName.IsEmpty() )
return fullFileName; return fullFileName;
@ -205,8 +175,7 @@ const wxString DS_DATA_MODEL::MakeFullFileName( const wxString& aShortFileName,
if( fn.IsAbsolute() ) if( fn.IsAbsolute() )
return fullFileName; return fullFileName;
// the path is not absolute: search it in project path, and then in // the path is not absolute: search it in project path, and then in kicad valid paths
// kicad valid paths
if( !aProjectPath.IsEmpty() ) if( !aProjectPath.IsEmpty() )
{ {
fn.MakeAbsolute( aProjectPath ); fn.MakeAbsolute( aProjectPath );

View File

@ -111,7 +111,11 @@ wxString NormalizePath( const wxFileName& aFilePath, const ENV_VAR_MAP* aEnvVars
varName = PROJECT_VAR_NAME; varName = PROJECT_VAR_NAME;
} }
if( !varName.IsEmpty() ) if( varName.IsEmpty() )
{
normalizedFullPath = aFilePath.GetFullPath();
}
else
{ {
normalizedFullPath = wxString::Format( "${%s}/", varName ); normalizedFullPath = wxString::Format( "${%s}/", varName );

View File

@ -393,9 +393,6 @@ protected:
m_normalizeBasePath ); m_normalizeBasePath );
} }
if( relPath.IsEmpty() )
relPath = filePath;
SetValue( relPath ); SetValue( relPath );
if( !m_grid->CommitPendingChanges() ) if( !m_grid->CommitPendingChanges() )
@ -421,9 +418,6 @@ protected:
m_normalizeBasePath ); m_normalizeBasePath );
} }
if( relPath.IsEmpty() )
relPath = filePath;
SetValue( relPath ); SetValue( relPath );
if( !m_grid->CommitPendingChanges() ) if( !m_grid->CommitPendingChanges() )

View File

@ -198,10 +198,6 @@ void DIALOG_SYMBOL_REMAP::createProjectSymbolLibTable( REPORTER& aReporter )
// system wide environment variables is probably not a good idea. // system wide environment variables is probably not a good idea.
wxString fullFileName = NormalizePath( fn, &Pgm().GetLocalEnvVariables(), &Prj() ); wxString fullFileName = NormalizePath( fn, &Pgm().GetLocalEnvVariables(), &Prj() );
// Fall back to the absolute library path.
if( fullFileName.IsEmpty() )
fullFileName = lib->GetFullFileName();
wxFileName tmpFn = fullFileName; wxFileName tmpFn = fullFileName;
// Don't add symbol libraries that do not exist. // Don't add symbol libraries that do not exist.

View File

@ -554,7 +554,7 @@ void PANEL_SYM_LIB_TABLE::browseLibrariesHandler( wxCommandEvent& event )
// Do not use the project path in the global library table. This will almost // Do not use the project path in the global library table. This will almost
// assuredly be wrong for a different project. // assuredly be wrong for a different project.
if( path.IsEmpty() || (m_pageNdx == 0 && path.Contains( "${KIPRJMOD}" )) ) if( m_pageNdx == 0 && path.Contains( "${KIPRJMOD}" ) )
path = fn.GetFullPath(); path = fn.GetFullPath();
m_cur_grid->SetCellValue( last_row, COL_URI, path ); m_cur_grid->SetCellValue( last_row, COL_URI, path );
@ -791,7 +791,7 @@ void PANEL_SYM_LIB_TABLE::onConvertLegacyLibraries( wxCommandEvent& event )
// Do not use the project path in the global library table. This will almost // Do not use the project path in the global library table. This will almost
// assuredly be wrong for a different project. // assuredly be wrong for a different project.
if( relPath.IsEmpty() || (m_cur_grid == m_global_grid && relPath.Contains( "${KIPRJMOD}" ) ) ) if( m_cur_grid == m_global_grid && relPath.Contains( "${KIPRJMOD}" ) )
relPath = newLib.GetFullPath(); relPath = newLib.GetFullPath();
m_cur_grid->SetCellValue( row, COL_URI, relPath ); m_cur_grid->SetCellValue( row, COL_URI, relPath );

View File

@ -88,16 +88,14 @@ bool SCH_EDIT_FRAME::LoadProjectSettings()
GetRenderSettings()->m_PinSymbolSize = settings.m_PinSymbolSize; GetRenderSettings()->m_PinSymbolSize = settings.m_PinSymbolSize;
GetRenderSettings()->m_JunctionSize = settings.m_JunctionSize; GetRenderSettings()->m_JunctionSize = settings.m_JunctionSize;
// Verify some values, because the config file can be edited by hand, // Verify some values, because the config file can be edited by hand, and have bad values:
// and have bad values:
LIB_SYMBOL::SetSubpartIdNotation( LIB_SYMBOL::GetSubpartIdSeparator(), LIB_SYMBOL::SetSubpartIdNotation( LIB_SYMBOL::GetSubpartIdSeparator(),
LIB_SYMBOL::GetSubpartFirstId() ); LIB_SYMBOL::GetSubpartFirstId() );
// Load the drawing sheet description file, from the filename stored in // Load the drawing sheet from the filename stored in BASE_SCREEN::m_DrawingSheetFileName.
// BASE_SCREEN::m_DrawingSheetFileName, read in config project file // If empty, or not existing, the default drawing sheet is loaded.
// If empty, or not existing, the default descr is loaded wxString filename = DS_DATA_MODEL::ResolvePath( BASE_SCREEN::m_DrawingSheetFileName,
wxString filename = DS_DATA_MODEL::MakeFullFileName( BASE_SCREEN::m_DrawingSheetFileName, Prj().GetProjectPath() );
Prj().GetProjectPath() );
if( !DS_DATA_MODEL::GetTheInstance().LoadDrawingSheet( filename ) ) if( !DS_DATA_MODEL::GetTheInstance().LoadDrawingSheet( filename ) )
ShowInfoBarError( _( "Error loading drawing sheet." ), true ); ShowInfoBarError( _( "Error loading drawing sheet." ), true );

View File

@ -1373,9 +1373,6 @@ bool SYMBOL_EDIT_FRAME::addLibTableEntry( const wxString& aLibFile, TABLE_SCOPE
normalizedPath = NormalizePath( aLibFile, &envVars, wxEmptyString ); normalizedPath = NormalizePath( aLibFile, &envVars, wxEmptyString );
} }
if( normalizedPath.IsEmpty() )
normalizedPath = aLibFile;
row->SetFullURI( normalizedPath ); row->SetFullURI( normalizedPath );
wxCHECK( libTable->InsertRow( row ), false ); wxCHECK( libTable->InsertRow( row ), false );
@ -1429,9 +1426,6 @@ bool SYMBOL_EDIT_FRAME::replaceLibTableEntry( const wxString& aLibNickname,
wxString normalizedPath = NormalizePath( aLibFile, &envVars, projectPath ); wxString normalizedPath = NormalizePath( aLibFile, &envVars, projectPath );
if( normalizedPath.IsEmpty() )
normalizedPath = aLibFile;
row->SetFullURI( normalizedPath ); row->SetFullURI( normalizedPath );
row->SetType( "KiCad" ); row->SetType( "KiCad" );

View File

@ -719,9 +719,6 @@ bool SYMBOL_LIBRARY_MANAGER::addLibrary( const wxString& aFilePath, bool aCreate
// try to use path normalized to an environmental variable or project path // try to use path normalized to an environmental variable or project path
wxString relPath = NormalizePath( aFilePath, &Pgm().GetLocalEnvVariables(), &m_frame.Prj() ); wxString relPath = NormalizePath( aFilePath, &Pgm().GetLocalEnvVariables(), &m_frame.Prj() );
if( relPath.IsEmpty() )
relPath = aFilePath;
SCH_IO_MGR::SCH_FILE_T schFileType = SCH_IO_MGR::GuessPluginTypeFromLibPath( aFilePath ); SCH_IO_MGR::SCH_FILE_T schFileType = SCH_IO_MGR::GuessPluginTypeFromLibPath( aFilePath );
wxString typeName = SCH_IO_MGR::ShowType( schFileType ); wxString typeName = SCH_IO_MGR::ShowType( schFileType );
SYMBOL_LIB_TABLE_ROW* libRow = new SYMBOL_LIB_TABLE_ROW( libName, relPath, typeName ); SYMBOL_LIB_TABLE_ROW* libRow = new SYMBOL_LIB_TABLE_ROW( libName, relPath, typeName );

View File

@ -360,9 +360,6 @@ LIB_SYMBOL* SYMBOL_LIB_TABLE::LoadSymbol( const wxString& aNickname, const wxStr
LIB_SYMBOL* symbol = row->plugin->LoadSymbol( row->GetFullURI( true ), aSymbolName, LIB_SYMBOL* symbol = row->plugin->LoadSymbol( row->GetFullURI( true ), aSymbolName,
row->GetProperties() ); row->GetProperties() );
if( symbol == nullptr )
return symbol;
// The library cannot know its own name, because it might have been renamed or moved. // The library cannot know its own name, because it might have been renamed or moved.
// Therefore footprints cannot know their own library nickname when residing in // Therefore footprints cannot know their own library nickname when residing in
// a symbol library. // a symbol library.
@ -395,9 +392,8 @@ SYMBOL_LIB_TABLE::SAVE_T SYMBOL_LIB_TABLE::SaveSymbol( const wxString& aNickname
wxString name = aSymbol->GetLibId().GetLibItemName(); wxString name = aSymbol->GetLibId().GetLibItemName();
std::unique_ptr< LIB_SYMBOL > symbol( row->plugin->LoadSymbol( row->GetFullURI( true ), std::unique_ptr<LIB_SYMBOL> symbol( row->plugin->LoadSymbol( row->GetFullURI( true ),
name, name, row->GetProperties() ) );
row->GetProperties() ) );
if( symbol.get() ) if( symbol.get() )
return SAVE_SKIPPED; return SAVE_SKIPPED;
@ -420,8 +416,7 @@ void SYMBOL_LIB_TABLE::DeleteSymbol( const wxString& aNickname, const wxString&
{ {
const SYMBOL_LIB_TABLE_ROW* row = FindRow( aNickname, true ); const SYMBOL_LIB_TABLE_ROW* row = FindRow( aNickname, true );
wxCHECK( row && row->plugin, /* void */ ); wxCHECK( row && row->plugin, /* void */ );
return row->plugin->DeleteSymbol( row->GetFullURI( true ), aSymbolName, return row->plugin->DeleteSymbol( row->GetFullURI( true ), aSymbolName, row->GetProperties() );
row->GetProperties() );
} }
@ -465,10 +460,9 @@ LIB_SYMBOL* SYMBOL_LIB_TABLE::LoadSymbolWithOptionalNickname( const LIB_ID& aLib
{ {
return LoadSymbol( nickname, name ); return LoadSymbol( nickname, name );
} }
// nickname is empty, sequentially search (alphabetically) all libs/nicks for first match:
else else
{ {
// nickname is empty, sequentially search (alphabetically) all libs/nicks for first match:
std::vector<wxString> nicks = GetLogicalLibs(); std::vector<wxString> nicks = GetLogicalLibs();
// Search each library going through libraries alphabetically. // Search each library going through libraries alphabetically.

View File

@ -51,13 +51,14 @@ public:
void EnableWksFileNamePicker( bool aEnable ) void EnableWksFileNamePicker( bool aEnable )
{ {
m_textCtrlFilePicker->Enable( aEnable ); m_textCtrlFilePicker->Enable( aEnable );
m_buttonBrowse->Enable( aEnable ); m_browseButton->Enable( aEnable );
} }
private: private:
virtual void onTransferDataToWindow() {} virtual void onTransferDataToWindow() {}
virtual bool onSavePageSettings() { virtual bool onSavePageSettings()
{
// default just return true savepagesettings to succeed // default just return true savepagesettings to succeed
return true; return true;
} }

View File

@ -170,28 +170,9 @@ public:
const wxString& aSource = wxT( "Sexpr_string" ) ); const wxString& aSource = wxT( "Sexpr_string" ) );
/** /**
* @param aFullFileName is the full filename, which can be a relative. * Resolve a path which might be project-relative or contain env variable references.
* @param aProjectPath is the current project absolute path (can be empty).
* @return a short filename from a full filename:
* if the path is the current project path, or if the path
* is the same as kicad.pro (in template), returns the shortname
* else do nothing and returns a full filename
*/ */
static const wxString MakeShortFileName( const wxString& aFullFileName, static const wxString ResolvePath( const wxString& aPath, const wxString& aProjectPath );
const wxString& aProjectPath );
/**
* @param aShortFileName = the short filename, which can be a relative
* @param aProjectPath = the curr project absolute path (can be empty)
* or absolute path, and can include env variable reference ( ${envvar} expression )
* if the short filename path is relative, it is expected relative to the project path
* or (if aProjectPath is empty or if the file does not exist)
* relative to kicad.pro (in template)
* If aShortFileName is absolute return aShortFileName
* @return a full filename from a short filename.
*/
static const wxString MakeFullFileName( const wxString& aShortFileName,
const wxString& aProjectPath );
double m_WSunits2Iu; // conversion factor between double m_WSunits2Iu; // conversion factor between
// ws units (mils) and draw/plot units // ws units (mils) and draw/plot units

View File

@ -38,8 +38,8 @@ class PROJECT;
* @param aFilePath is the full file path (path and file name) to be normalized. * @param aFilePath is the full file path (path and file name) to be normalized.
* @param aEnvVars is an optional map of environmental variables to try substitution with. * @param aEnvVars is an optional map of environmental variables to try substitution with.
* @param aProject is an optional project, to normalize the file path to the project path. * @param aProject is an optional project, to normalize the file path to the project path.
* @return Normalized full file path (path and file name) if succeeded or empty string if the * @return Normalized full file path (path and file name) if succeeded or the input path if
* path could not be normalized. * the path could not be normalized.
*/ */
wxString NormalizePath( const wxFileName& aFilePath, const ENV_VAR_MAP* aEnvVars, wxString NormalizePath( const wxFileName& aFilePath, const ENV_VAR_MAP* aEnvVars,
const PROJECT* aProject ); const PROJECT* aProject );
@ -50,8 +50,8 @@ wxString NormalizePath( const wxFileName& aFilePath, const ENV_VAR_MAP* aEnvVars
* @param aFilePath is the full file path (path and file name) to be normalized. * @param aFilePath is the full file path (path and file name) to be normalized.
* @param aEnvVars is an optional map of environmental variables to try substitution with. * @param aEnvVars is an optional map of environmental variables to try substitution with.
* @param aProjectPath is an optional string to normalize the file path to the project path. * @param aProjectPath is an optional string to normalize the file path to the project path.
* @return Normalized full file path (path and file name) if succeeded or empty string if the * @return Normalized full file path (path and file name) if succeeded or the input path if
* path could not be normalized. * the path could not be normalized.
*/ */
wxString NormalizePath( const wxFileName& aFilePath, const ENV_VAR_MAP* aEnvVars, wxString NormalizePath( const wxFileName& aFilePath, const ENV_VAR_MAP* aEnvVars,
const wxString& aProjectPath ); const wxString& aProjectPath );

View File

@ -804,8 +804,7 @@ void PANEL_FP_LIB_TABLE::browseLibrariesHandler( wxCommandEvent& event )
if( fileType.m_IsFile ) if( fileType.m_IsFile )
{ {
wxFileDialog dlg( this, title, openDir, wxEmptyString, wxFileDialog dlg( this, title, openDir, wxEmptyString, fileType.m_FileFilter,
fileType.m_FileFilter,
wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_MULTIPLE ); wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_MULTIPLE );
int result = dlg.ShowModal(); int result = dlg.ShowModal();
@ -833,8 +832,7 @@ void PANEL_FP_LIB_TABLE::browseLibrariesHandler( wxCommandEvent& event )
dlg.GetPaths( files ); dlg.GetPaths( files );
#else #else
wxDirDialog dlg( nullptr, title, openDir, wxDirDialog dlg( nullptr, title, openDir, wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST );
wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST );
int result = dlg.ShowModal(); int result = dlg.ShowModal();
@ -925,7 +923,7 @@ void PANEL_FP_LIB_TABLE::browseLibrariesHandler( wxCommandEvent& event )
// Do not use the project path in the global library table. This will almost // Do not use the project path in the global library table. This will almost
// assuredly be wrong for a different project. // assuredly be wrong for a different project.
if( path.IsEmpty() || ( m_pageNdx == 0 && path.Contains( "${KIPRJMOD}" ) ) ) if( m_pageNdx == 0 && path.Contains( "${KIPRJMOD}" ) )
path = fn.GetFullPath(); path = fn.GetFullPath();
m_cur_grid->SetCellValue( last_row, COL_URI, path ); m_cur_grid->SetCellValue( last_row, COL_URI, path );

View File

@ -570,9 +570,6 @@ bool PCB_BASE_EDIT_FRAME::AddLibrary( const wxString& aFilename, FP_LIB_TABLE* a
// try to use path normalized to an environmental variable or project path // try to use path normalized to an environmental variable or project path
wxString normalizedPath = NormalizePath( libPath, &Pgm().GetLocalEnvVariables(), &Prj() ); wxString normalizedPath = NormalizePath( libPath, &Pgm().GetLocalEnvVariables(), &Prj() );
if( normalizedPath.IsEmpty() )
normalizedPath = libPath;
try try
{ {
FP_LIB_TABLE_ROW* row = new FP_LIB_TABLE_ROW( libName, normalizedPath, type, wxEmptyString ); FP_LIB_TABLE_ROW* row = new FP_LIB_TABLE_ROW( libName, normalizedPath, type, wxEmptyString );

View File

@ -38,10 +38,9 @@
#include <pcbplot.h> #include <pcbplot.h>
#include <pcb_painter.h> #include <pcb_painter.h>
#include <project.h> #include <project.h>
#include <invoke_pcb_dialog.h>
#include <widgets/appearance_controls.h> #include <widgets/appearance_controls.h>
#include <widgets/paged_dialog.h>
#include <widgets/panel_selection_filter.h> #include <widgets/panel_selection_filter.h>
#include <widgets/paged_dialog.h>
#include <project/net_settings.h> #include <project/net_settings.h>
#include <project/project_file.h> #include <project/project_file.h>
#include <project/project_local_settings.h> #include <project/project_local_settings.h>
@ -72,11 +71,10 @@ bool PCB_EDIT_FRAME::LoadProjectSettings()
BASE_SCREEN::m_DrawingSheetFileName = project.m_BoardDrawingSheetFile; BASE_SCREEN::m_DrawingSheetFileName = project.m_BoardDrawingSheetFile;
// Load the drawing sheet description file, from the filename stored in // Load the drawing sheet from the filename stored in BASE_SCREEN::m_DrawingSheetFileName.
// BASE_SCREEN::m_DrawingSheetFileName, read in config project file // If empty, or not existing, the default drawing sheet is loaded.
// If empty, or not existing, the default descr is loaded wxString filename = DS_DATA_MODEL::ResolvePath( BASE_SCREEN::m_DrawingSheetFileName,
wxString filename = DS_DATA_MODEL::MakeFullFileName( BASE_SCREEN::m_DrawingSheetFileName, Prj().GetProjectPath());
Prj().GetProjectPath() );
if( !DS_DATA_MODEL::GetTheInstance().LoadDrawingSheet( filename ) ) if( !DS_DATA_MODEL::GetTheInstance().LoadDrawingSheet( filename ) )
{ {