Allow spaces in sheet filenames.

Fixes https://gitlab.com/kicad/code/kicad/issues/5736
This commit is contained in:
Jeff Young 2020-10-06 14:17:45 +01:00
parent 0bc7bbbadb
commit e9d372f4b7
10 changed files with 65 additions and 64 deletions

View File

@ -101,8 +101,8 @@ set( EESCHEMA_DLGS
dialogs/dialog_edit_sheet_pin.cpp
dialogs/dialog_sch_import_settings.cpp
dialogs/dialog_sch_import_settings_base.cpp
dialogs/dialog_sch_sheet_props.cpp
dialogs/dialog_sch_sheet_props_base.cpp
dialogs/dialog_sheet_properties.cpp
dialogs/dialog_sheet_properties_base.cpp
dialogs/dialog_schematic_find.cpp
dialogs/dialog_schematic_find_base.cpp
dialogs/dialog_schematic_setup.cpp

View File

@ -22,7 +22,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <dialog_sch_sheet_props.h>
#include <dialog_sheet_properties.h>
#include <kiface_i.h>
#include <wx/string.h>
#include <wx/tooltip.h>
@ -39,9 +39,9 @@
#include <trace_helpers.h>
#include "panel_eeschema_color_settings.h"
DIALOG_SCH_SHEET_PROPS::DIALOG_SCH_SHEET_PROPS( SCH_EDIT_FRAME* aParent, SCH_SHEET* aSheet,
bool* aClearAnnotationNewItems ) :
DIALOG_SCH_SHEET_PROPS_BASE( aParent ),
DIALOG_SHEET_PROPERTIES::DIALOG_SHEET_PROPERTIES( SCH_EDIT_FRAME* aParent, SCH_SHEET* aSheet,
bool* aClearAnnotationNewItems ) :
DIALOG_SCH_SHEET_PROPERTIES_BASE( aParent ),
m_frame( aParent ),
m_clearAnnotationNewItems( aClearAnnotationNewItems ),
m_borderWidth( aParent, m_borderWidthLabel, m_borderWidthCtrl, m_borderWidthUnits, true )
@ -86,14 +86,14 @@ DIALOG_SCH_SHEET_PROPS::DIALOG_SCH_SHEET_PROPS( SCH_EDIT_FRAME* aParent, SCH_SHE
// wxFormBuilder doesn't include this event...
m_grid->Connect( wxEVT_GRID_CELL_CHANGING,
wxGridEventHandler( DIALOG_SCH_SHEET_PROPS::OnGridCellChanging ),
wxGridEventHandler( DIALOG_SHEET_PROPERTIES::OnGridCellChanging ),
NULL, this );
FinishDialogSettings();
}
DIALOG_SCH_SHEET_PROPS::~DIALOG_SCH_SHEET_PROPS()
DIALOG_SHEET_PROPERTIES::~DIALOG_SHEET_PROPERTIES()
{
auto cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
wxASSERT( cfg );
@ -105,7 +105,7 @@ DIALOG_SCH_SHEET_PROPS::~DIALOG_SCH_SHEET_PROPS()
m_grid->DestroyTable( m_fields );
m_grid->Disconnect( wxEVT_GRID_CELL_CHANGING,
wxGridEventHandler( DIALOG_SCH_SHEET_PROPS::OnGridCellChanging ),
wxGridEventHandler( DIALOG_SHEET_PROPERTIES::OnGridCellChanging ),
NULL, this );
// Delete the GRID_TRICKS.
@ -113,7 +113,7 @@ DIALOG_SCH_SHEET_PROPS::~DIALOG_SCH_SHEET_PROPS()
}
bool DIALOG_SCH_SHEET_PROPS::TransferDataToWindow()
bool DIALOG_SHEET_PROPERTIES::TransferDataToWindow()
{
if( !wxDialog::TransferDataToWindow() )
return false;
@ -170,7 +170,7 @@ bool DIALOG_SCH_SHEET_PROPS::TransferDataToWindow()
}
bool DIALOG_SCH_SHEET_PROPS::Validate()
bool DIALOG_SHEET_PROPERTIES::Validate()
{
wxString msg;
LIB_ID id;
@ -229,7 +229,7 @@ static bool positioningChanged( FIELDS_GRID_TABLE<SCH_FIELD>* a, std::vector<SCH
}
bool DIALOG_SCH_SHEET_PROPS::TransferDataFromWindow()
bool DIALOG_SHEET_PROPERTIES::TransferDataFromWindow()
{
if( !wxDialog::TransferDataFromWindow() ) // Calls our Validate() method.
return false;
@ -328,7 +328,7 @@ bool DIALOG_SCH_SHEET_PROPS::TransferDataFromWindow()
}
bool DIALOG_SCH_SHEET_PROPS::onSheetFilenameChanged( const wxString& aNewFilename )
bool DIALOG_SHEET_PROPERTIES::onSheetFilenameChanged( const wxString& aNewFilename )
{
wxString msg;
@ -569,7 +569,7 @@ bool DIALOG_SCH_SHEET_PROPS::onSheetFilenameChanged( const wxString& aNewFilenam
}
void DIALOG_SCH_SHEET_PROPS::OnGridCellChanging( wxGridEvent& event )
void DIALOG_SHEET_PROPERTIES::OnGridCellChanging( wxGridEvent& event )
{
bool success = true;
wxGridCellEditor* editor = m_grid->GetCellEditor( event.GetRow(), event.GetCol() );
@ -619,7 +619,7 @@ void DIALOG_SCH_SHEET_PROPS::OnGridCellChanging( wxGridEvent& event )
}
void DIALOG_SCH_SHEET_PROPS::OnAddField( wxCommandEvent& event )
void DIALOG_SHEET_PROPERTIES::OnAddField( wxCommandEvent& event )
{
if( !m_grid->CommitPendingChanges() )
return;
@ -644,7 +644,7 @@ void DIALOG_SCH_SHEET_PROPS::OnAddField( wxCommandEvent& event )
}
void DIALOG_SCH_SHEET_PROPS::OnDeleteField( wxCommandEvent& event )
void DIALOG_SHEET_PROPERTIES::OnDeleteField( wxCommandEvent& event )
{
int curRow = m_grid->GetGridCursorRow();
@ -673,7 +673,7 @@ void DIALOG_SCH_SHEET_PROPS::OnDeleteField( wxCommandEvent& event )
}
void DIALOG_SCH_SHEET_PROPS::OnMoveUp( wxCommandEvent& event )
void DIALOG_SHEET_PROPERTIES::OnMoveUp( wxCommandEvent& event )
{
if( !m_grid->CommitPendingChanges() )
return;
@ -695,7 +695,7 @@ void DIALOG_SCH_SHEET_PROPS::OnMoveUp( wxCommandEvent& event )
}
void DIALOG_SCH_SHEET_PROPS::OnMoveDown( wxCommandEvent& event )
void DIALOG_SHEET_PROPERTIES::OnMoveDown( wxCommandEvent& event )
{
if( !m_grid->CommitPendingChanges() )
return;
@ -717,7 +717,7 @@ void DIALOG_SCH_SHEET_PROPS::OnMoveDown( wxCommandEvent& event )
}
void DIALOG_SCH_SHEET_PROPS::AdjustGridColumns( int aWidth )
void DIALOG_SHEET_PROPERTIES::AdjustGridColumns( int aWidth )
{
m_width = aWidth;
// Account for scroll bars
@ -734,7 +734,7 @@ void DIALOG_SCH_SHEET_PROPS::AdjustGridColumns( int aWidth )
}
void DIALOG_SCH_SHEET_PROPS::OnUpdateUI( wxUpdateUIEvent& event )
void DIALOG_SHEET_PROPERTIES::OnUpdateUI( wxUpdateUIEvent& event )
{
wxString shownColumns = m_grid->GetShownColumns();
@ -763,7 +763,7 @@ void DIALOG_SCH_SHEET_PROPS::OnUpdateUI( wxUpdateUIEvent& event )
}
void DIALOG_SCH_SHEET_PROPS::OnSizeGrid( wxSizeEvent& event )
void DIALOG_SHEET_PROPERTIES::OnSizeGrid( wxSizeEvent& event )
{
auto new_size = event.GetSize().GetX();
@ -777,7 +777,7 @@ void DIALOG_SCH_SHEET_PROPS::OnSizeGrid( wxSizeEvent& event )
}
void DIALOG_SCH_SHEET_PROPS::OnInitDlg( wxInitDialogEvent& event )
void DIALOG_SHEET_PROPERTIES::OnInitDlg( wxInitDialogEvent& event )
{
TransferDataToWindow();

View File

@ -22,25 +22,25 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __dialog_sch_sheet_props__
#define __dialog_sch_sheet_props__
#ifndef DIALOG_SHEET_PROPERTIES_H
#define DIALOG_SHEET_PROPERTIES_H
#include <fields_grid_table.h>
#include <widgets/unit_binder.h>
#include <dialog_sch_sheet_props_base.h>
#include <dialog_sheet_properties_base.h>
class SCH_SHEET;
class SCH_EDIT_FRAME;
class DIALOG_SCH_SHEET_PROPS : public DIALOG_SCH_SHEET_PROPS_BASE
class DIALOG_SHEET_PROPERTIES : public DIALOG_SHEET_PROPERTIES_BASE
{
public:
DIALOG_SCH_SHEET_PROPS( SCH_EDIT_FRAME* aParent, SCH_SHEET* aSheet,
bool* aClearAnnotationNewItems );
DIALOG_SHEET_PROPERTIES( SCH_EDIT_FRAME* aParent, SCH_SHEET* aSheet,
bool* aClearAnnotationNewItems );
~DIALOG_SCH_SHEET_PROPS() override;
~DIALOG_SHEET_PROPERTIES() override;
private:
SCH_EDIT_FRAME* m_frame;
@ -75,4 +75,4 @@ private:
void AdjustGridColumns( int aWidth );
};
#endif // __dialog_sch_sheet_props__
#endif // DIALOG_SHEET_PROPERTIES_H

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jul 10 2019)
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -7,11 +7,11 @@
#include "widgets/wx_grid.h"
#include "dialog_sch_sheet_props_base.h"
#include "dialog_sheet_properties_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_SCH_SHEET_PROPS_BASE::DIALOG_SCH_SHEET_PROPS_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
DIALOG_SHEET_PROPERTIES_BASE::DIALOG_SHEET_PROPERTIES_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 );
@ -201,24 +201,24 @@ DIALOG_SCH_SHEET_PROPS_BASE::DIALOG_SCH_SHEET_PROPS_BASE( wxWindow* parent, wxWi
mainSizer->Fit( this );
// Connect Events
this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_SCH_SHEET_PROPS_BASE::OnInitDlg ) );
this->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SCH_SHEET_PROPS_BASE::OnUpdateUI ) );
m_grid->Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_SCH_SHEET_PROPS_BASE::OnSizeGrid ), NULL, this );
m_bpAdd->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SCH_SHEET_PROPS_BASE::OnAddField ), NULL, this );
m_bpMoveUp->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SCH_SHEET_PROPS_BASE::OnMoveUp ), NULL, this );
m_bpMoveDown->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SCH_SHEET_PROPS_BASE::OnMoveDown ), NULL, this );
m_bpDelete->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SCH_SHEET_PROPS_BASE::OnDeleteField ), NULL, this );
this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_SHEET_PROPERTIES_BASE::OnInitDlg ) );
this->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SHEET_PROPERTIES_BASE::OnUpdateUI ) );
m_grid->Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_SHEET_PROPERTIES_BASE::OnSizeGrid ), NULL, this );
m_bpAdd->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SHEET_PROPERTIES_BASE::OnAddField ), NULL, this );
m_bpMoveUp->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SHEET_PROPERTIES_BASE::OnMoveUp ), NULL, this );
m_bpMoveDown->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SHEET_PROPERTIES_BASE::OnMoveDown ), NULL, this );
m_bpDelete->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SHEET_PROPERTIES_BASE::OnDeleteField ), NULL, this );
}
DIALOG_SCH_SHEET_PROPS_BASE::~DIALOG_SCH_SHEET_PROPS_BASE()
DIALOG_SHEET_PROPERTIES_BASE::~DIALOG_SHEET_PROPERTIES_BASE()
{
// Disconnect Events
this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_SCH_SHEET_PROPS_BASE::OnInitDlg ) );
this->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SCH_SHEET_PROPS_BASE::OnUpdateUI ) );
m_grid->Disconnect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_SCH_SHEET_PROPS_BASE::OnSizeGrid ), NULL, this );
m_bpAdd->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SCH_SHEET_PROPS_BASE::OnAddField ), NULL, this );
m_bpMoveUp->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SCH_SHEET_PROPS_BASE::OnMoveUp ), NULL, this );
m_bpMoveDown->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SCH_SHEET_PROPS_BASE::OnMoveDown ), NULL, this );
m_bpDelete->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SCH_SHEET_PROPS_BASE::OnDeleteField ), NULL, this );
this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_SHEET_PROPERTIES_BASE::OnInitDlg ) );
this->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SHEET_PROPERTIES_BASE::OnUpdateUI ) );
m_grid->Disconnect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_SHEET_PROPERTIES_BASE::OnSizeGrid ), NULL, this );
m_bpAdd->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SHEET_PROPERTIES_BASE::OnAddField ), NULL, this );
m_bpMoveUp->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SHEET_PROPERTIES_BASE::OnMoveUp ), NULL, this );
m_bpMoveDown->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SHEET_PROPERTIES_BASE::OnMoveDown ), NULL, this );
m_bpDelete->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SHEET_PROPERTIES_BASE::OnDeleteField ), NULL, this );
}

View File

@ -11,13 +11,12 @@
<property name="embedded_files_path">res</property>
<property name="encoding">ANSI</property>
<property name="event_generation">connect</property>
<property name="file">dialog_sch_sheet_props_base</property>
<property name="file">dialog_sheet_properties_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="image_path_wrapper_function_name"></property>
<property name="indent_with_spaces"></property>
<property name="internationalize">1</property>
<property name="name">dialog_sch_sheet_props_base</property>
<property name="name">dialog_sheet_properties_base</property>
<property name="namespace"></property>
<property name="path">.</property>
<property name="precompiled_header"></property>
@ -26,7 +25,6 @@
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_array_enum">0</property>
<property name="use_enum">0</property>
<property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1">
@ -45,7 +43,7 @@
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">DIALOG_SCH_SHEET_PROPS_BASE</property>
<property name="name">DIALOG_SHEET_PROPERTIES_BASE</property>
<property name="pos"></property>
<property name="size">-1,-1</property>
<property name="style">wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU</property>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jul 10 2019)
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -36,9 +36,9 @@ class WX_GRID;
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_SCH_SHEET_PROPS_BASE
/// Class DIALOG_SHEET_PROPERTIES_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_SCH_SHEET_PROPS_BASE : public DIALOG_SHIM
class DIALOG_SHEET_PROPERTIES_BASE : public DIALOG_SHIM
{
private:
@ -75,8 +75,8 @@ class DIALOG_SCH_SHEET_PROPS_BASE : public DIALOG_SHIM
public:
DIALOG_SCH_SHEET_PROPS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Sheet Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU );
~DIALOG_SCH_SHEET_PROPS_BASE();
DIALOG_SHEET_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Sheet Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU );
~DIALOG_SHEET_PROPERTIES_BASE();
};

View File

@ -134,8 +134,7 @@ void FIELDS_GRID_TABLE<T>::initGrid( DIALOG_SHIM* aDialog )
exts.push_back( KiCadSchematicFileExtension );
wildCard += AddFileExtListToFilter( exts );
GRID_CELL_PATH_EDITOR* filepathEditor =
new GRID_CELL_PATH_EDITOR( aDialog, &m_curdir, wildCard );
auto filepathEditor = new GRID_CELL_PATH_EDITOR( aDialog, &m_curdir, wildCard );
filepathEditor->SetValidator( m_filepathValidator );
m_filepathAttr->SetEditor( filepathEditor );

View File

@ -412,7 +412,7 @@ bool SCH_FIELD::Replace( wxFindReplaceData& aSearchData, void* aAuxData )
{
// If we allowed this we'd have a bunch of work to do here, including warning
// about it not being undoable, checking for recursive hierarchies, reloading
// sheets, etc. See DIALOG_SCH_SHEET_PROPS::TransferDataFromWindow().
// sheets, etc. See DIALOG_SHEET_PROPERTIES::TransferDataFromWindow().
}
}

View File

@ -48,10 +48,14 @@ SCH_FIELD_VALIDATOR::SCH_FIELD_VALIDATOR( bool aIsLibEditor, int aFieldId, wxSt
{
excludes += " ";
}
else if( ( aFieldId == VALUE && m_isLibEditor ) || aFieldId == SHEETFILENAME_V )
else if( aFieldId == VALUE && m_isLibEditor )
{
excludes += " :/\\";
}
else if( aFieldId == SHEETFILENAME_V )
{
excludes += ":/\\";
}
long style = GetStyle();

View File

@ -37,7 +37,7 @@
#include <sch_painter.h>
#include <schematic.h>
#include <symbol_lib_table.h>
#include <dialogs/dialog_sch_sheet_props.h>
#include <dialogs/dialog_sheet_properties.h>
#include <dialogs/dialog_edit_sheet_pin.h>
#include <tool/actions.h>
@ -467,7 +467,7 @@ bool SCH_EDIT_FRAME::EditSheetProperties( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHi
return false;
// Get the new texts
DIALOG_SCH_SHEET_PROPS dlg( this, aSheet, aClearAnnotationNewItems );
DIALOG_SHEET_PROPERTIES dlg( this, aSheet, aClearAnnotationNewItems );
if( dlg.ShowModal() == wxID_CANCEL )
return false;