Strip out and migrate 3d search paths in favor of env vars
This mainly stops reading/writing 3dresolver.cfg We still keep some sillyness for kicad2step for now Fixes https://gitlab.com/kicad/code/kicad/-/issues/9164
This commit is contained in:
parent
76a7a2b4bc
commit
8e96751af2
|
@ -45,7 +45,7 @@ bool S3D::Select3DModel( wxWindow* aParent, S3D_CACHE* aCache, wxString& prevMod
|
||||||
|
|
||||||
bool S3D::Configure3DPaths( wxWindow* aParent, FILENAME_RESOLVER* aResolver )
|
bool S3D::Configure3DPaths( wxWindow* aParent, FILENAME_RESOLVER* aResolver )
|
||||||
{
|
{
|
||||||
DIALOG_CONFIGURE_PATHS dlg( aParent, aResolver );
|
DIALOG_CONFIGURE_PATHS dlg( aParent );
|
||||||
|
|
||||||
// Use QuasiModal so that HTML help window will work
|
// Use QuasiModal so that HTML help window will work
|
||||||
return( dlg.ShowQuasiModal() == wxID_OK );
|
return( dlg.ShowQuasiModal() == wxID_OK );
|
||||||
|
|
|
@ -54,12 +54,11 @@ enum SEARCH_PATH_GRID_COLUMNS
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
DIALOG_CONFIGURE_PATHS::DIALOG_CONFIGURE_PATHS( wxWindow* aParent, FILENAME_RESOLVER* aResolver ) :
|
DIALOG_CONFIGURE_PATHS::DIALOG_CONFIGURE_PATHS( wxWindow* aParent ) :
|
||||||
DIALOG_CONFIGURE_PATHS_BASE( aParent ),
|
DIALOG_CONFIGURE_PATHS_BASE( aParent ),
|
||||||
m_errorGrid( nullptr ),
|
m_errorGrid( nullptr ),
|
||||||
m_errorRow( -1 ),
|
m_errorRow( -1 ),
|
||||||
m_errorCol( -1 ),
|
m_errorCol( -1 ),
|
||||||
m_resolver( aResolver ),
|
|
||||||
m_gridWidth( 0 ),
|
m_gridWidth( 0 ),
|
||||||
m_gridWidthsDirty( true ),
|
m_gridWidthsDirty( true ),
|
||||||
m_helpBox( nullptr ),
|
m_helpBox( nullptr ),
|
||||||
|
@ -67,10 +66,6 @@ DIALOG_CONFIGURE_PATHS::DIALOG_CONFIGURE_PATHS( wxWindow* aParent, FILENAME_RESO
|
||||||
{
|
{
|
||||||
m_btnAddEnvVar->SetBitmap( KiBitmap( BITMAPS::small_plus ) );
|
m_btnAddEnvVar->SetBitmap( KiBitmap( BITMAPS::small_plus ) );
|
||||||
m_btnDeleteEnvVar->SetBitmap( KiBitmap( BITMAPS::small_trash ) );
|
m_btnDeleteEnvVar->SetBitmap( KiBitmap( BITMAPS::small_trash ) );
|
||||||
m_btnAddSearchPath->SetBitmap( KiBitmap( BITMAPS::small_plus ) );
|
|
||||||
m_btnDeleteSearchPath->SetBitmap( KiBitmap( BITMAPS::small_trash ) );
|
|
||||||
m_btnMoveUp->SetBitmap( KiBitmap( BITMAPS::small_up ) );
|
|
||||||
m_btnMoveDown->SetBitmap( KiBitmap( BITMAPS::small_down ) );
|
|
||||||
|
|
||||||
m_EnvVars->ClearRows();
|
m_EnvVars->ClearRows();
|
||||||
m_EnvVars->AppendCols( 1 ); // for the isExternal flags
|
m_EnvVars->AppendCols( 1 ); // for the isExternal flags
|
||||||
|
@ -81,39 +76,16 @@ DIALOG_CONFIGURE_PATHS::DIALOG_CONFIGURE_PATHS( wxWindow* aParent, FILENAME_RESO
|
||||||
attr->SetEditor( new GRID_CELL_PATH_EDITOR( this, m_EnvVars, &m_curdir, wxEmptyString ) );
|
attr->SetEditor( new GRID_CELL_PATH_EDITOR( this, m_EnvVars, &m_curdir, wxEmptyString ) );
|
||||||
m_EnvVars->SetColAttr( TV_VALUE_COL, attr );
|
m_EnvVars->SetColAttr( TV_VALUE_COL, attr );
|
||||||
|
|
||||||
attr = new wxGridCellAttr;
|
|
||||||
attr->SetEditor( new GRID_CELL_PATH_EDITOR( this, m_SearchPaths, &m_curdir, wxEmptyString ) );
|
|
||||||
m_SearchPaths->SetColAttr( TV_VALUE_COL, attr );
|
|
||||||
|
|
||||||
// Give a bit more room for combobox editors
|
// Give a bit more room for combobox editors
|
||||||
m_EnvVars->SetDefaultRowSize( m_EnvVars->GetDefaultRowSize() + 4 );
|
m_EnvVars->SetDefaultRowSize( m_EnvVars->GetDefaultRowSize() + 4 );
|
||||||
m_SearchPaths->SetDefaultRowSize( m_SearchPaths->GetDefaultRowSize() + 4 );
|
|
||||||
|
|
||||||
m_EnvVars->PushEventHandler( new GRID_TRICKS( m_EnvVars,
|
m_EnvVars->PushEventHandler( new GRID_TRICKS( m_EnvVars,
|
||||||
[this]( wxCommandEvent& aEvent )
|
[this]( wxCommandEvent& aEvent )
|
||||||
{
|
{
|
||||||
OnAddEnvVar( aEvent );
|
OnAddEnvVar( aEvent );
|
||||||
} ) );
|
} ) );
|
||||||
m_SearchPaths->PushEventHandler( new GRID_TRICKS( m_SearchPaths,
|
|
||||||
[this]( wxCommandEvent& aEvent )
|
|
||||||
{
|
|
||||||
OnAddSearchPath( aEvent );
|
|
||||||
} ) );
|
|
||||||
|
|
||||||
m_EnvVars->SetSelectionMode( wxGrid::wxGridSelectionModes::wxGridSelectRows );
|
m_EnvVars->SetSelectionMode( wxGrid::wxGridSelectionModes::wxGridSelectRows );
|
||||||
m_SearchPaths->SetSelectionMode( wxGrid::wxGridSelectionModes::wxGridSelectRows );
|
|
||||||
|
|
||||||
if( m_resolver )
|
|
||||||
{
|
|
||||||
m_SearchPaths->ClearRows();
|
|
||||||
m_SearchPaths->UseNativeColHeader( true );
|
|
||||||
|
|
||||||
// prohibit these characters in the alias names: []{}()%~<>"='`;:.,&?/\|$
|
|
||||||
m_aliasValidator.SetStyle( wxFILTER_EXCLUDE_CHAR_LIST );
|
|
||||||
m_aliasValidator.SetCharExcludes( wxT( "{}[]()%~<>\"='`;:.,&?/\\|$" ) );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
m_sb3DSearchPaths->Show( false );
|
|
||||||
|
|
||||||
SetInitialFocus( m_EnvVars );
|
SetInitialFocus( m_EnvVars );
|
||||||
SetupStandardButtons();
|
SetupStandardButtons();
|
||||||
|
@ -122,9 +94,6 @@ DIALOG_CONFIGURE_PATHS::DIALOG_CONFIGURE_PATHS( wxWindow* aParent, FILENAME_RESO
|
||||||
m_EnvVars->Connect( wxEVT_GRID_CELL_CHANGING,
|
m_EnvVars->Connect( wxEVT_GRID_CELL_CHANGING,
|
||||||
wxGridEventHandler( DIALOG_CONFIGURE_PATHS::OnGridCellChanging ),
|
wxGridEventHandler( DIALOG_CONFIGURE_PATHS::OnGridCellChanging ),
|
||||||
nullptr, this );
|
nullptr, this );
|
||||||
m_SearchPaths->Connect( wxEVT_GRID_CELL_CHANGING,
|
|
||||||
wxGridEventHandler( DIALOG_CONFIGURE_PATHS::OnGridCellChanging ),
|
|
||||||
nullptr, this );
|
|
||||||
|
|
||||||
GetSizer()->SetSizeHints( this );
|
GetSizer()->SetSizeHints( this );
|
||||||
Centre();
|
Centre();
|
||||||
|
@ -134,15 +103,11 @@ DIALOG_CONFIGURE_PATHS::DIALOG_CONFIGURE_PATHS( wxWindow* aParent, FILENAME_RESO
|
||||||
DIALOG_CONFIGURE_PATHS::~DIALOG_CONFIGURE_PATHS()
|
DIALOG_CONFIGURE_PATHS::~DIALOG_CONFIGURE_PATHS()
|
||||||
{
|
{
|
||||||
// Delete the GRID_TRICKS.
|
// Delete the GRID_TRICKS.
|
||||||
m_SearchPaths->PopEventHandler( true );
|
|
||||||
m_EnvVars->PopEventHandler( true );
|
m_EnvVars->PopEventHandler( true );
|
||||||
|
|
||||||
m_EnvVars->Disconnect( wxEVT_GRID_CELL_CHANGING,
|
m_EnvVars->Disconnect( wxEVT_GRID_CELL_CHANGING,
|
||||||
wxGridEventHandler( DIALOG_CONFIGURE_PATHS::OnGridCellChanging ),
|
wxGridEventHandler( DIALOG_CONFIGURE_PATHS::OnGridCellChanging ),
|
||||||
nullptr, this );
|
nullptr, this );
|
||||||
m_SearchPaths->Disconnect( wxEVT_GRID_CELL_CHANGING,
|
|
||||||
wxGridEventHandler( DIALOG_CONFIGURE_PATHS::OnGridCellChanging ),
|
|
||||||
nullptr, this );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -151,26 +116,6 @@ bool DIALOG_CONFIGURE_PATHS::TransferDataToWindow()
|
||||||
if( !wxDialog::TransferDataToWindow() )
|
if( !wxDialog::TransferDataToWindow() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Do 3D search paths first so they get first crack at setting m_curdir
|
|
||||||
|
|
||||||
if( m_resolver )
|
|
||||||
{
|
|
||||||
const std::list<SEARCH_PATH>* paths = m_resolver->GetPaths();
|
|
||||||
|
|
||||||
for( auto it = paths->begin(); it != paths->end(); ++it )
|
|
||||||
{
|
|
||||||
if ( !( *it ).m_Alias.StartsWith( "${" ) && !( *it ).m_Alias.StartsWith( "$(" ) )
|
|
||||||
{
|
|
||||||
AppendSearchPath( it->m_Alias, it->m_Pathvar, it->m_Description );
|
|
||||||
|
|
||||||
if( m_curdir.IsEmpty() )
|
|
||||||
m_curdir = it->m_Pathexp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Environment variables
|
|
||||||
|
|
||||||
const ENV_VAR_MAP& envVars = Pgm().GetLocalEnvVariables();
|
const ENV_VAR_MAP& envVars = Pgm().GetLocalEnvVariables();
|
||||||
|
|
||||||
for( auto it = envVars.begin(); it != envVars.end(); ++it )
|
for( auto it = envVars.begin(); it != envVars.end(); ++it )
|
||||||
|
@ -213,29 +158,9 @@ void DIALOG_CONFIGURE_PATHS::AppendEnvVar( const wxString& aName, const wxString
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DIALOG_CONFIGURE_PATHS::AppendSearchPath( const wxString& aName, const wxString& aPath,
|
|
||||||
const wxString& aDescription )
|
|
||||||
{
|
|
||||||
int i = m_SearchPaths->GetNumberRows();
|
|
||||||
|
|
||||||
m_SearchPaths->AppendRows( 1 );
|
|
||||||
|
|
||||||
m_SearchPaths->SetCellValue( i, SP_ALIAS_COL, aName );
|
|
||||||
|
|
||||||
wxGridCellAttr* nameCellAttr = m_SearchPaths->GetOrCreateCellAttr( i, SP_ALIAS_COL );
|
|
||||||
wxGridCellTextEditor* nameTextEditor = new GRID_CELL_TEXT_EDITOR();
|
|
||||||
nameTextEditor->SetValidator( m_aliasValidator );
|
|
||||||
nameCellAttr->SetEditor( nameTextEditor );
|
|
||||||
nameCellAttr->DecRef();
|
|
||||||
|
|
||||||
m_SearchPaths->SetCellValue( i, SP_PATH_COL, aPath );
|
|
||||||
m_SearchPaths->SetCellValue( i, SP_DESC_COL, aDescription );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool DIALOG_CONFIGURE_PATHS::TransferDataFromWindow()
|
bool DIALOG_CONFIGURE_PATHS::TransferDataFromWindow()
|
||||||
{
|
{
|
||||||
if( !m_EnvVars->CommitPendingChanges() || !m_SearchPaths->CommitPendingChanges() )
|
if( !m_EnvVars->CommitPendingChanges() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if( !wxDialog::TransferDataFromWindow() )
|
if( !wxDialog::TransferDataFromWindow() )
|
||||||
|
@ -301,43 +226,6 @@ bool DIALOG_CONFIGURE_PATHS::TransferDataFromWindow()
|
||||||
|
|
||||||
Pgm().SetLocalEnvVariables();
|
Pgm().SetLocalEnvVariables();
|
||||||
|
|
||||||
// 3D search paths
|
|
||||||
|
|
||||||
if( m_resolver )
|
|
||||||
{
|
|
||||||
std::vector<SEARCH_PATH> alist;
|
|
||||||
SEARCH_PATH alias;
|
|
||||||
|
|
||||||
for( int row = 0; row < m_SearchPaths->GetNumberRows(); ++row )
|
|
||||||
{
|
|
||||||
alias.m_Alias = m_SearchPaths->GetCellValue( row, SP_ALIAS_COL );
|
|
||||||
alias.m_Pathvar = m_SearchPaths->GetCellValue( row, SP_PATH_COL );
|
|
||||||
alias.m_Description = m_SearchPaths->GetCellValue( row, SP_DESC_COL );
|
|
||||||
|
|
||||||
if( alias.m_Alias.IsEmpty() )
|
|
||||||
{
|
|
||||||
m_errorGrid = m_SearchPaths;
|
|
||||||
m_errorRow = row;
|
|
||||||
m_errorCol = SP_ALIAS_COL;
|
|
||||||
m_errorMsg = _( "3D search path alias cannot be empty." );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else if( alias.m_Pathvar.IsEmpty() )
|
|
||||||
{
|
|
||||||
m_errorGrid = m_SearchPaths;
|
|
||||||
m_errorRow = row;
|
|
||||||
m_errorCol = SP_PATH_COL;
|
|
||||||
m_errorMsg = _( "3D search path cannot be empty." );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
alist.push_back( alias );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !m_resolver->UpdatePathList( alist ) )
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -426,21 +314,6 @@ void DIALOG_CONFIGURE_PATHS::OnAddEnvVar( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DIALOG_CONFIGURE_PATHS::OnAddSearchPath( wxCommandEvent& event )
|
|
||||||
{
|
|
||||||
if( !m_SearchPaths->CommitPendingChanges() )
|
|
||||||
return;
|
|
||||||
|
|
||||||
AppendSearchPath( wxEmptyString, wxEmptyString, wxEmptyString);
|
|
||||||
|
|
||||||
m_SearchPaths->MakeCellVisible( m_SearchPaths->GetNumberRows() - 1, SP_ALIAS_COL );
|
|
||||||
m_SearchPaths->SetGridCursor( m_SearchPaths->GetNumberRows() - 1, SP_ALIAS_COL );
|
|
||||||
|
|
||||||
m_SearchPaths->EnableCellEditControl( true );
|
|
||||||
m_SearchPaths->ShowCellEditControl();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void DIALOG_CONFIGURE_PATHS::OnRemoveEnvVar( wxCommandEvent& event )
|
void DIALOG_CONFIGURE_PATHS::OnRemoveEnvVar( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
int curRow = m_EnvVars->GetGridCursorRow();
|
int curRow = m_EnvVars->GetGridCursorRow();
|
||||||
|
@ -463,115 +336,6 @@ void DIALOG_CONFIGURE_PATHS::OnRemoveEnvVar( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DIALOG_CONFIGURE_PATHS::OnDeleteSearchPath( wxCommandEvent& event )
|
|
||||||
{
|
|
||||||
wxArrayInt selectedRows = m_SearchPaths->GetSelectedRows();
|
|
||||||
|
|
||||||
if( selectedRows.empty() && m_SearchPaths->GetGridCursorRow() >= 0 )
|
|
||||||
selectedRows.push_back( m_SearchPaths->GetGridCursorRow() );
|
|
||||||
|
|
||||||
if( selectedRows.empty() )
|
|
||||||
return;
|
|
||||||
|
|
||||||
m_SearchPaths->CommitPendingChanges( true /* silent mode; we don't care if it's valid */ );
|
|
||||||
|
|
||||||
// Reverse sort so deleting a row doesn't change the indexes of the other rows.
|
|
||||||
selectedRows.Sort( []( int* first, int* second ) { return *second - *first; } );
|
|
||||||
|
|
||||||
for( int row : selectedRows )
|
|
||||||
{
|
|
||||||
m_SearchPaths->DeleteRows( row, 1 );
|
|
||||||
|
|
||||||
// if there are still rows in grid, make previous row visible
|
|
||||||
if( m_SearchPaths->GetNumberRows() )
|
|
||||||
{
|
|
||||||
m_SearchPaths->MakeCellVisible( std::max( 0, row-1 ),
|
|
||||||
m_SearchPaths->GetGridCursorCol() );
|
|
||||||
m_SearchPaths->SetGridCursor( std::max( 0, row-1 ),
|
|
||||||
m_SearchPaths->GetGridCursorCol() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void DIALOG_CONFIGURE_PATHS::OnSearchPathMoveUp( wxCommandEvent& event )
|
|
||||||
{
|
|
||||||
if( !m_SearchPaths->CommitPendingChanges() )
|
|
||||||
return;
|
|
||||||
|
|
||||||
int curRow = m_SearchPaths->GetGridCursorRow();
|
|
||||||
int prevRow = curRow - 1;
|
|
||||||
|
|
||||||
if( curRow > 0 )
|
|
||||||
{
|
|
||||||
for( int i = 0; i < m_SearchPaths->GetNumberCols(); ++i )
|
|
||||||
{
|
|
||||||
wxString tmp = m_SearchPaths->GetCellValue( curRow, i );
|
|
||||||
m_SearchPaths->SetCellValue( curRow, i, m_SearchPaths->GetCellValue( prevRow, i ) );
|
|
||||||
m_SearchPaths->SetCellValue( prevRow, i, tmp );
|
|
||||||
}
|
|
||||||
|
|
||||||
m_SearchPaths->SetGridCursor( prevRow, m_SearchPaths->GetGridCursorCol() );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
wxBell();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void DIALOG_CONFIGURE_PATHS::OnSearchPathMoveDown( wxCommandEvent& event )
|
|
||||||
{
|
|
||||||
if( !m_SearchPaths->CommitPendingChanges() )
|
|
||||||
return;
|
|
||||||
|
|
||||||
int curRow = m_SearchPaths->GetGridCursorRow();
|
|
||||||
int nextRow = curRow + 1;
|
|
||||||
|
|
||||||
if( curRow < m_SearchPaths->GetNumberRows() - 1 )
|
|
||||||
{
|
|
||||||
for( int i = 0; i < m_SearchPaths->GetNumberCols(); ++i )
|
|
||||||
{
|
|
||||||
wxString tmp = m_SearchPaths->GetCellValue( curRow, i );
|
|
||||||
m_SearchPaths->SetCellValue( curRow, i, m_SearchPaths->GetCellValue( nextRow, i ) );
|
|
||||||
m_SearchPaths->SetCellValue( nextRow, i, tmp );
|
|
||||||
}
|
|
||||||
|
|
||||||
m_SearchPaths->SetGridCursor( nextRow, m_SearchPaths->GetGridCursorCol() );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
wxBell();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void DIALOG_CONFIGURE_PATHS::OnGridCellRightClick( wxGridEvent& aEvent )
|
|
||||||
{
|
|
||||||
wxASSERT((int) TV_VALUE_COL == (int) SP_PATH_COL );
|
|
||||||
|
|
||||||
if( aEvent.GetCol() == TV_VALUE_COL )
|
|
||||||
{
|
|
||||||
wxMenu menu;
|
|
||||||
|
|
||||||
AddMenuItem( &menu, 1, _( "File Browser..." ), KiBitmap( BITMAPS::small_folder ) );
|
|
||||||
|
|
||||||
if( GetPopupMenuSelectionFromUser( menu ) == 1 )
|
|
||||||
{
|
|
||||||
wxDirDialog dlg( nullptr, _( "Select Path" ), m_curdir,
|
|
||||||
wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST );
|
|
||||||
|
|
||||||
if( dlg.ShowModal() == wxID_OK )
|
|
||||||
{
|
|
||||||
wxGrid* grid = dynamic_cast<wxGrid*>( aEvent.GetEventObject() );
|
|
||||||
grid->SetCellValue( aEvent.GetRow(), TV_VALUE_COL, dlg.GetPath() );
|
|
||||||
m_curdir = dlg.GetPath();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void DIALOG_CONFIGURE_PATHS::OnUpdateUI( wxUpdateUIEvent& event )
|
void DIALOG_CONFIGURE_PATHS::OnUpdateUI( wxUpdateUIEvent& event )
|
||||||
{
|
{
|
||||||
if( m_gridWidthsDirty )
|
if( m_gridWidthsDirty )
|
||||||
|
@ -583,19 +347,6 @@ void DIALOG_CONFIGURE_PATHS::OnUpdateUI( wxUpdateUIEvent& event )
|
||||||
|
|
||||||
m_EnvVars->SetColSize( TV_VALUE_COL, width - m_EnvVars->GetColSize( TV_NAME_COL ) );
|
m_EnvVars->SetColSize( TV_VALUE_COL, width - m_EnvVars->GetColSize( TV_NAME_COL ) );
|
||||||
|
|
||||||
width = m_SearchPaths->GetClientRect().GetWidth();
|
|
||||||
|
|
||||||
m_SearchPaths->AutoSizeColumn( SP_ALIAS_COL );
|
|
||||||
m_SearchPaths->SetColSize( SP_ALIAS_COL,
|
|
||||||
std::max( m_SearchPaths->GetColSize( SP_ALIAS_COL ), 120 ) );
|
|
||||||
|
|
||||||
m_SearchPaths->AutoSizeColumn( SP_PATH_COL );
|
|
||||||
m_SearchPaths->SetColSize( SP_PATH_COL,
|
|
||||||
std::max( m_SearchPaths->GetColSize( SP_PATH_COL ), 300 ) );
|
|
||||||
|
|
||||||
m_SearchPaths->SetColSize( SP_DESC_COL, width -
|
|
||||||
( m_SearchPaths->GetColSize( SP_ALIAS_COL ) +
|
|
||||||
m_SearchPaths->GetColSize( SP_PATH_COL ) ) );
|
|
||||||
m_gridWidth = m_EnvVars->GetSize().GetX();
|
m_gridWidth = m_EnvVars->GetSize().GetX();
|
||||||
m_gridWidthsDirty = false;
|
m_gridWidthsDirty = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// C++ code generated with wxFormBuilder (version 3.9.0 Jul 27 2020)
|
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3)
|
||||||
// http://www.wxformbuilder.org/
|
// http://www.wxformbuilder.org/
|
||||||
//
|
//
|
||||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||||
|
@ -35,9 +35,9 @@ DIALOG_CONFIGURE_PATHS_BASE::DIALOG_CONFIGURE_PATHS_BASE( wxWindow* parent, wxWi
|
||||||
m_EnvVars->SetColSize( 1, 454 );
|
m_EnvVars->SetColSize( 1, 454 );
|
||||||
m_EnvVars->EnableDragColMove( false );
|
m_EnvVars->EnableDragColMove( false );
|
||||||
m_EnvVars->EnableDragColSize( true );
|
m_EnvVars->EnableDragColSize( true );
|
||||||
m_EnvVars->SetColLabelSize( 22 );
|
|
||||||
m_EnvVars->SetColLabelValue( 0, _("Name") );
|
m_EnvVars->SetColLabelValue( 0, _("Name") );
|
||||||
m_EnvVars->SetColLabelValue( 1, _("Path") );
|
m_EnvVars->SetColLabelValue( 1, _("Path") );
|
||||||
|
m_EnvVars->SetColLabelSize( 22 );
|
||||||
m_EnvVars->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
|
m_EnvVars->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
|
||||||
|
|
||||||
// Rows
|
// Rows
|
||||||
|
@ -71,67 +71,6 @@ DIALOG_CONFIGURE_PATHS_BASE::DIALOG_CONFIGURE_PATHS_BASE( wxWindow* parent, wxWi
|
||||||
|
|
||||||
bSizerMain->Add( sbEnvVars, 1, wxEXPAND|wxALL, 5 );
|
bSizerMain->Add( sbEnvVars, 1, wxEXPAND|wxALL, 5 );
|
||||||
|
|
||||||
m_sb3DSearchPaths = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("3D Search Paths") ), wxVERTICAL );
|
|
||||||
|
|
||||||
m_SearchPaths = new WX_GRID( m_sb3DSearchPaths->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
|
|
||||||
// Grid
|
|
||||||
m_SearchPaths->CreateGrid( 1, 3 );
|
|
||||||
m_SearchPaths->EnableEditing( true );
|
|
||||||
m_SearchPaths->EnableGridLines( true );
|
|
||||||
m_SearchPaths->EnableDragGridSize( false );
|
|
||||||
m_SearchPaths->SetMargins( 0, 0 );
|
|
||||||
|
|
||||||
// Columns
|
|
||||||
m_SearchPaths->SetColSize( 0, 150 );
|
|
||||||
m_SearchPaths->SetColSize( 1, 300 );
|
|
||||||
m_SearchPaths->SetColSize( 2, 154 );
|
|
||||||
m_SearchPaths->EnableDragColMove( false );
|
|
||||||
m_SearchPaths->EnableDragColSize( true );
|
|
||||||
m_SearchPaths->SetColLabelSize( 22 );
|
|
||||||
m_SearchPaths->SetColLabelValue( 0, _("Alias") );
|
|
||||||
m_SearchPaths->SetColLabelValue( 1, _("Path") );
|
|
||||||
m_SearchPaths->SetColLabelValue( 2, _("Description") );
|
|
||||||
m_SearchPaths->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
|
|
||||||
|
|
||||||
// Rows
|
|
||||||
m_SearchPaths->AutoSizeRows();
|
|
||||||
m_SearchPaths->EnableDragRowSize( false );
|
|
||||||
m_SearchPaths->SetRowLabelSize( 0 );
|
|
||||||
m_SearchPaths->SetRowLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
|
|
||||||
|
|
||||||
// Label Appearance
|
|
||||||
|
|
||||||
// Cell Defaults
|
|
||||||
m_SearchPaths->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
|
|
||||||
m_SearchPaths->SetMinSize( wxSize( 604,150 ) );
|
|
||||||
|
|
||||||
m_sb3DSearchPaths->Add( m_SearchPaths, 1, wxALL|wxEXPAND, 5 );
|
|
||||||
|
|
||||||
wxBoxSizer* bSizerSearchPathBtns;
|
|
||||||
bSizerSearchPathBtns = new wxBoxSizer( wxHORIZONTAL );
|
|
||||||
|
|
||||||
m_btnAddSearchPath = new wxBitmapButton( m_sb3DSearchPaths->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
|
|
||||||
bSizerSearchPathBtns->Add( m_btnAddSearchPath, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 );
|
|
||||||
|
|
||||||
m_btnMoveUp = new wxBitmapButton( m_sb3DSearchPaths->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
|
|
||||||
bSizerSearchPathBtns->Add( m_btnMoveUp, 0, wxBOTTOM|wxRIGHT, 5 );
|
|
||||||
|
|
||||||
m_btnMoveDown = new wxBitmapButton( m_sb3DSearchPaths->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
|
|
||||||
bSizerSearchPathBtns->Add( m_btnMoveDown, 0, wxBOTTOM|wxRIGHT, 5 );
|
|
||||||
|
|
||||||
|
|
||||||
bSizerSearchPathBtns->Add( 0, 0, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
|
|
||||||
|
|
||||||
m_btnDeleteSearchPath = new wxBitmapButton( m_sb3DSearchPaths->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
|
|
||||||
bSizerSearchPathBtns->Add( m_btnDeleteSearchPath, 0, wxBOTTOM|wxRIGHT, 5 );
|
|
||||||
|
|
||||||
|
|
||||||
m_sb3DSearchPaths->Add( bSizerSearchPathBtns, 0, wxEXPAND, 5 );
|
|
||||||
|
|
||||||
|
|
||||||
bSizerMain->Add( m_sb3DSearchPaths, 1, 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 );
|
||||||
|
@ -155,12 +94,6 @@ DIALOG_CONFIGURE_PATHS_BASE::DIALOG_CONFIGURE_PATHS_BASE( wxWindow* parent, wxWi
|
||||||
m_EnvVars->Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_CONFIGURE_PATHS_BASE::OnGridSize ), NULL, this );
|
m_EnvVars->Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_CONFIGURE_PATHS_BASE::OnGridSize ), NULL, this );
|
||||||
m_btnAddEnvVar->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIGURE_PATHS_BASE::OnAddEnvVar ), NULL, this );
|
m_btnAddEnvVar->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIGURE_PATHS_BASE::OnAddEnvVar ), NULL, this );
|
||||||
m_btnDeleteEnvVar->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIGURE_PATHS_BASE::OnRemoveEnvVar ), NULL, this );
|
m_btnDeleteEnvVar->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIGURE_PATHS_BASE::OnRemoveEnvVar ), NULL, this );
|
||||||
m_SearchPaths->Connect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( DIALOG_CONFIGURE_PATHS_BASE::OnGridCellChange ), NULL, this );
|
|
||||||
m_SearchPaths->Connect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( DIALOG_CONFIGURE_PATHS_BASE::OnGridCellRightClick ), NULL, this );
|
|
||||||
m_btnAddSearchPath->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIGURE_PATHS_BASE::OnAddSearchPath ), NULL, this );
|
|
||||||
m_btnMoveUp->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIGURE_PATHS_BASE::OnSearchPathMoveUp ), NULL, this );
|
|
||||||
m_btnMoveDown->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIGURE_PATHS_BASE::OnSearchPathMoveDown ), NULL, this );
|
|
||||||
m_btnDeleteSearchPath->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIGURE_PATHS_BASE::OnDeleteSearchPath ), NULL, this );
|
|
||||||
m_sdbSizerHelp->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIGURE_PATHS_BASE::OnHelp ), NULL, this );
|
m_sdbSizerHelp->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIGURE_PATHS_BASE::OnHelp ), NULL, this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,12 +104,6 @@ DIALOG_CONFIGURE_PATHS_BASE::~DIALOG_CONFIGURE_PATHS_BASE()
|
||||||
m_EnvVars->Disconnect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_CONFIGURE_PATHS_BASE::OnGridSize ), NULL, this );
|
m_EnvVars->Disconnect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_CONFIGURE_PATHS_BASE::OnGridSize ), NULL, this );
|
||||||
m_btnAddEnvVar->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIGURE_PATHS_BASE::OnAddEnvVar ), NULL, this );
|
m_btnAddEnvVar->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIGURE_PATHS_BASE::OnAddEnvVar ), NULL, this );
|
||||||
m_btnDeleteEnvVar->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIGURE_PATHS_BASE::OnRemoveEnvVar ), NULL, this );
|
m_btnDeleteEnvVar->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIGURE_PATHS_BASE::OnRemoveEnvVar ), NULL, this );
|
||||||
m_SearchPaths->Disconnect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( DIALOG_CONFIGURE_PATHS_BASE::OnGridCellChange ), NULL, this );
|
|
||||||
m_SearchPaths->Disconnect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( DIALOG_CONFIGURE_PATHS_BASE::OnGridCellRightClick ), NULL, this );
|
|
||||||
m_btnAddSearchPath->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIGURE_PATHS_BASE::OnAddSearchPath ), NULL, this );
|
|
||||||
m_btnMoveUp->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIGURE_PATHS_BASE::OnSearchPathMoveUp ), NULL, this );
|
|
||||||
m_btnMoveDown->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIGURE_PATHS_BASE::OnSearchPathMoveDown ), NULL, this );
|
|
||||||
m_btnDeleteSearchPath->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIGURE_PATHS_BASE::OnDeleteSearchPath ), NULL, this );
|
|
||||||
m_sdbSizerHelp->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIGURE_PATHS_BASE::OnHelp ), NULL, this );
|
m_sdbSizerHelp->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIGURE_PATHS_BASE::OnHelp ), NULL, this );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||||
<wxFormBuilder_Project>
|
<wxFormBuilder_Project>
|
||||||
<FileVersion major="1" minor="15" />
|
<FileVersion major="1" minor="16" />
|
||||||
<object class="Project" expanded="1">
|
<object class="Project" expanded="1">
|
||||||
<property name="class_decoration"></property>
|
<property name="class_decoration"></property>
|
||||||
<property name="code_generation">C++</property>
|
<property name="code_generation">C++</property>
|
||||||
|
@ -14,6 +14,7 @@
|
||||||
<property name="file">dialog_configure_paths_base</property>
|
<property name="file">dialog_configure_paths_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_CONFIGURE_PATHS_BASE</property>
|
<property name="name">DIALOG_CONFIGURE_PATHS_BASE</property>
|
||||||
|
@ -25,6 +26,7 @@
|
||||||
<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">
|
||||||
|
@ -50,6 +52,7 @@
|
||||||
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
|
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
|
||||||
<property name="title">Configure Paths</property>
|
<property name="title">Configure Paths</property>
|
||||||
<property name="tooltip"></property>
|
<property name="tooltip"></property>
|
||||||
|
<property name="two_step_creation">0</property>
|
||||||
<property name="window_extra_style"></property>
|
<property name="window_extra_style"></property>
|
||||||
<property name="window_name"></property>
|
<property name="window_name"></property>
|
||||||
<property name="window_style"></property>
|
<property name="window_style"></property>
|
||||||
|
@ -182,6 +185,7 @@
|
||||||
<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>
|
||||||
|
@ -265,6 +269,7 @@
|
||||||
<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>
|
||||||
|
@ -329,423 +334,6 @@
|
||||||
</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">1</property>
|
|
||||||
<object class="wxStaticBoxSizer" expanded="1">
|
|
||||||
<property name="id">wxID_ANY</property>
|
|
||||||
<property name="label">3D Search Paths</property>
|
|
||||||
<property name="minimum_size"></property>
|
|
||||||
<property name="name">m_sb3DSearchPaths</property>
|
|
||||||
<property name="orient">wxVERTICAL</property>
|
|
||||||
<property name="parent">1</property>
|
|
||||||
<property name="permission">protected</property>
|
|
||||||
<object class="sizeritem" expanded="1">
|
|
||||||
<property name="border">5</property>
|
|
||||||
<property name="flag">wxALL|wxEXPAND</property>
|
|
||||||
<property name="proportion">1</property>
|
|
||||||
<object class="wxGrid" 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="autosize_cols">0</property>
|
|
||||||
<property name="autosize_rows">1</property>
|
|
||||||
<property name="best_size"></property>
|
|
||||||
<property name="bg"></property>
|
|
||||||
<property name="caption"></property>
|
|
||||||
<property name="caption_visible">1</property>
|
|
||||||
<property name="cell_bg"></property>
|
|
||||||
<property name="cell_font"></property>
|
|
||||||
<property name="cell_horiz_alignment">wxALIGN_LEFT</property>
|
|
||||||
<property name="cell_text"></property>
|
|
||||||
<property name="cell_vert_alignment">wxALIGN_TOP</property>
|
|
||||||
<property name="center_pane">0</property>
|
|
||||||
<property name="close_button">1</property>
|
|
||||||
<property name="col_label_horiz_alignment">wxALIGN_CENTER</property>
|
|
||||||
<property name="col_label_size">22</property>
|
|
||||||
<property name="col_label_values">"Alias" "Path" "Description"</property>
|
|
||||||
<property name="col_label_vert_alignment">wxALIGN_CENTER</property>
|
|
||||||
<property name="cols">3</property>
|
|
||||||
<property name="column_sizes">150,300,154</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="drag_col_move">0</property>
|
|
||||||
<property name="drag_col_size">1</property>
|
|
||||||
<property name="drag_grid_size">0</property>
|
|
||||||
<property name="drag_row_size">0</property>
|
|
||||||
<property name="editing">1</property>
|
|
||||||
<property name="enabled">1</property>
|
|
||||||
<property name="fg"></property>
|
|
||||||
<property name="floatable">1</property>
|
|
||||||
<property name="font"></property>
|
|
||||||
<property name="grid_line_color"></property>
|
|
||||||
<property name="grid_lines">1</property>
|
|
||||||
<property name="gripper">0</property>
|
|
||||||
<property name="hidden">0</property>
|
|
||||||
<property name="id">wxID_ANY</property>
|
|
||||||
<property name="label_bg"></property>
|
|
||||||
<property name="label_font"></property>
|
|
||||||
<property name="label_text"></property>
|
|
||||||
<property name="margin_height">0</property>
|
|
||||||
<property name="margin_width">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">604,150</property>
|
|
||||||
<property name="moveable">1</property>
|
|
||||||
<property name="name">m_SearchPaths</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="row_label_horiz_alignment">wxALIGN_CENTER</property>
|
|
||||||
<property name="row_label_size">0</property>
|
|
||||||
<property name="row_label_values"></property>
|
|
||||||
<property name="row_label_vert_alignment">wxALIGN_CENTER</property>
|
|
||||||
<property name="row_sizes"></property>
|
|
||||||
<property name="rows">1</property>
|
|
||||||
<property name="show">1</property>
|
|
||||||
<property name="size"></property>
|
|
||||||
<property name="subclass">WX_GRID; widgets/wx_grid.h; 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>
|
|
||||||
<event name="OnGridCellChange">OnGridCellChange</event>
|
|
||||||
<event name="OnGridCellRightClick">OnGridCellRightClick</event>
|
|
||||||
</object>
|
|
||||||
</object>
|
|
||||||
<object class="sizeritem" expanded="1">
|
|
||||||
<property name="border">5</property>
|
|
||||||
<property name="flag">wxEXPAND</property>
|
|
||||||
<property name="proportion">0</property>
|
|
||||||
<object class="wxBoxSizer" expanded="1">
|
|
||||||
<property name="minimum_size"></property>
|
|
||||||
<property name="name">bSizerSearchPathBtns</property>
|
|
||||||
<property name="orient">wxHORIZONTAL</property>
|
|
||||||
<property name="permission">none</property>
|
|
||||||
<object class="sizeritem" expanded="0">
|
|
||||||
<property name="border">5</property>
|
|
||||||
<property name="flag">wxBOTTOM|wxLEFT|wxRIGHT</property>
|
|
||||||
<property name="proportion">0</property>
|
|
||||||
<object class="wxBitmapButton" expanded="0">
|
|
||||||
<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">Add Path</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">-1,-1</property>
|
|
||||||
<property name="moveable">1</property>
|
|
||||||
<property name="name">m_btnAddSearchPath</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">OnAddSearchPath</event>
|
|
||||||
</object>
|
|
||||||
</object>
|
|
||||||
<object class="sizeritem" expanded="0">
|
|
||||||
<property name="border">5</property>
|
|
||||||
<property name="flag">wxBOTTOM|wxRIGHT</property>
|
|
||||||
<property name="proportion">0</property>
|
|
||||||
<object class="wxBitmapButton" expanded="0">
|
|
||||||
<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">Move Up</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">-1,-1</property>
|
|
||||||
<property name="moveable">1</property>
|
|
||||||
<property name="name">m_btnMoveUp</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">OnSearchPathMoveUp</event>
|
|
||||||
</object>
|
|
||||||
</object>
|
|
||||||
<object class="sizeritem" expanded="0">
|
|
||||||
<property name="border">5</property>
|
|
||||||
<property name="flag">wxBOTTOM|wxRIGHT</property>
|
|
||||||
<property name="proportion">0</property>
|
|
||||||
<object class="wxBitmapButton" expanded="0">
|
|
||||||
<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">Move Down</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">-1,-1</property>
|
|
||||||
<property name="moveable">1</property>
|
|
||||||
<property name="name">m_btnMoveDown</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">OnSearchPathMoveDown</event>
|
|
||||||
</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="spacer" expanded="1">
|
|
||||||
<property name="height">0</property>
|
|
||||||
<property name="permission">protected</property>
|
|
||||||
<property name="width">0</property>
|
|
||||||
</object>
|
|
||||||
</object>
|
|
||||||
<object class="sizeritem" expanded="0">
|
|
||||||
<property name="border">5</property>
|
|
||||||
<property name="flag">wxBOTTOM|wxRIGHT</property>
|
|
||||||
<property name="proportion">0</property>
|
|
||||||
<object class="wxBitmapButton" expanded="0">
|
|
||||||
<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">Delete Path</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">-1,-1</property>
|
|
||||||
<property name="moveable">1</property>
|
|
||||||
<property name="name">m_btnDeleteSearchPath</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">OnDeleteSearchPath</event>
|
|
||||||
</object>
|
|
||||||
</object>
|
|
||||||
</object>
|
|
||||||
</object>
|
|
||||||
</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|wxEXPAND</property>
|
<property name="flag">wxALL|wxEXPAND</property>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// C++ code generated with wxFormBuilder (version 3.9.0 Jul 27 2020)
|
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3)
|
||||||
// http://www.wxformbuilder.org/
|
// http://www.wxformbuilder.org/
|
||||||
//
|
//
|
||||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||||
|
@ -42,12 +42,6 @@ class DIALOG_CONFIGURE_PATHS_BASE : public DIALOG_SHIM
|
||||||
WX_GRID* m_EnvVars;
|
WX_GRID* m_EnvVars;
|
||||||
wxBitmapButton* m_btnAddEnvVar;
|
wxBitmapButton* m_btnAddEnvVar;
|
||||||
wxBitmapButton* m_btnDeleteEnvVar;
|
wxBitmapButton* m_btnDeleteEnvVar;
|
||||||
wxStaticBoxSizer* m_sb3DSearchPaths;
|
|
||||||
WX_GRID* m_SearchPaths;
|
|
||||||
wxBitmapButton* m_btnAddSearchPath;
|
|
||||||
wxBitmapButton* m_btnMoveUp;
|
|
||||||
wxBitmapButton* m_btnMoveDown;
|
|
||||||
wxBitmapButton* m_btnDeleteSearchPath;
|
|
||||||
wxStdDialogButtonSizer* m_sdbSizer;
|
wxStdDialogButtonSizer* m_sdbSizer;
|
||||||
wxButton* m_sdbSizerOK;
|
wxButton* m_sdbSizerOK;
|
||||||
wxButton* m_sdbSizerCancel;
|
wxButton* m_sdbSizerCancel;
|
||||||
|
@ -58,18 +52,13 @@ class DIALOG_CONFIGURE_PATHS_BASE : public DIALOG_SHIM
|
||||||
virtual void OnGridSize( wxSizeEvent& event ) { event.Skip(); }
|
virtual void OnGridSize( wxSizeEvent& event ) { event.Skip(); }
|
||||||
virtual void OnAddEnvVar( wxCommandEvent& event ) { event.Skip(); }
|
virtual void OnAddEnvVar( wxCommandEvent& event ) { event.Skip(); }
|
||||||
virtual void OnRemoveEnvVar( wxCommandEvent& event ) { event.Skip(); }
|
virtual void OnRemoveEnvVar( wxCommandEvent& event ) { event.Skip(); }
|
||||||
virtual void OnGridCellChange( wxGridEvent& event ) { event.Skip(); }
|
|
||||||
virtual void OnGridCellRightClick( wxGridEvent& event ) { event.Skip(); }
|
|
||||||
virtual void OnAddSearchPath( wxCommandEvent& event ) { event.Skip(); }
|
|
||||||
virtual void OnSearchPathMoveUp( wxCommandEvent& event ) { event.Skip(); }
|
|
||||||
virtual void OnSearchPathMoveDown( wxCommandEvent& event ) { event.Skip(); }
|
|
||||||
virtual void OnDeleteSearchPath( wxCommandEvent& event ) { event.Skip(); }
|
|
||||||
virtual void OnHelp( wxCommandEvent& event ) { event.Skip(); }
|
virtual void OnHelp( wxCommandEvent& event ) { event.Skip(); }
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
DIALOG_CONFIGURE_PATHS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Configure Paths"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
DIALOG_CONFIGURE_PATHS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Configure Paths"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
||||||
|
|
||||||
~DIALOG_CONFIGURE_PATHS_BASE();
|
~DIALOG_CONFIGURE_PATHS_BASE();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -37,7 +37,6 @@
|
||||||
|
|
||||||
// configuration file version
|
// configuration file version
|
||||||
#define CFGFILE_VERSION 1
|
#define CFGFILE_VERSION 1
|
||||||
#define RESOLVER_CONFIG wxT( "3Dresolver.cfg" )
|
|
||||||
|
|
||||||
// flag bits used to track different one-off messages to users
|
// flag bits used to track different one-off messages to users
|
||||||
#define ERRFLG_ALIAS (1)
|
#define ERRFLG_ALIAS (1)
|
||||||
|
@ -48,8 +47,6 @@
|
||||||
|
|
||||||
static std::mutex mutex_resolver;
|
static std::mutex mutex_resolver;
|
||||||
|
|
||||||
static bool getHollerith( const std::string& aString, size_t& aIndex, wxString& aResult );
|
|
||||||
|
|
||||||
|
|
||||||
FILENAME_RESOLVER::FILENAME_RESOLVER() :
|
FILENAME_RESOLVER::FILENAME_RESOLVER() :
|
||||||
m_pgm( nullptr ),
|
m_pgm( nullptr ),
|
||||||
|
@ -176,9 +173,13 @@ bool FILENAME_RESOLVER::createPathList()
|
||||||
|
|
||||||
if( GetKicadPaths( epaths ) )
|
if( GetKicadPaths( epaths ) )
|
||||||
{
|
{
|
||||||
for( const wxString& curr_path : epaths )
|
for( const wxString& currPath : epaths )
|
||||||
{
|
{
|
||||||
wxString pathVal = ExpandEnvVarSubstitutions( curr_path, m_project );
|
wxString currPathVarFormat = currPath;
|
||||||
|
currPathVarFormat.Prepend( wxS( "${" ) );
|
||||||
|
currPathVarFormat.Append( wxS( "}" ) );
|
||||||
|
|
||||||
|
wxString pathVal = ExpandEnvVarSubstitutions( currPathVarFormat, m_project );
|
||||||
|
|
||||||
if( pathVal.empty() )
|
if( pathVal.empty() )
|
||||||
{
|
{
|
||||||
|
@ -191,19 +192,21 @@ bool FILENAME_RESOLVER::createPathList()
|
||||||
lpath.m_Pathexp = fndummy.GetFullPath();
|
lpath.m_Pathexp = fndummy.GetFullPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
lpath.m_Alias = curr_path;
|
lpath.m_Alias = currPath;
|
||||||
lpath.m_Pathvar = curr_path;
|
lpath.m_Pathvar = currPath;
|
||||||
|
|
||||||
if( !lpath.m_Pathexp.empty() && psep == *lpath.m_Pathexp.rbegin() )
|
if( !lpath.m_Pathexp.empty() && psep == *lpath.m_Pathexp.rbegin() )
|
||||||
lpath.m_Pathexp.erase( --lpath.m_Pathexp.end() );
|
lpath.m_Pathexp.erase( --lpath.m_Pathexp.end() );
|
||||||
|
|
||||||
|
// we add it first with the alias set to the non-variable format
|
||||||
|
m_paths.push_back( lpath );
|
||||||
|
|
||||||
|
// now add it with the "new variable format ${VAR}"
|
||||||
|
lpath.m_Alias = currPathVarFormat;
|
||||||
m_paths.push_back( lpath );
|
m_paths.push_back( lpath );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !m_configDir.empty() )
|
|
||||||
readPathList();
|
|
||||||
|
|
||||||
if( m_paths.empty() )
|
if( m_paths.empty() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -233,7 +236,7 @@ bool FILENAME_RESOLVER::UpdatePathList( const std::vector< SEARCH_PATH >& aPathL
|
||||||
for( const SEARCH_PATH& path : aPathList )
|
for( const SEARCH_PATH& path : aPathList )
|
||||||
addPath( path );
|
addPath( path );
|
||||||
|
|
||||||
return WritePathList( m_configDir, RESOLVER_CONFIG, false );
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -481,118 +484,6 @@ bool FILENAME_RESOLVER::addPath( const SEARCH_PATH& aPath )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool FILENAME_RESOLVER::readPathList()
|
|
||||||
{
|
|
||||||
if( m_configDir.empty() )
|
|
||||||
{
|
|
||||||
std::ostringstream ostr;
|
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
|
||||||
wxString errmsg = "3D configuration directory is unknown";
|
|
||||||
ostr << " * " << errmsg.ToUTF8();
|
|
||||||
wxLogTrace( MASK_3D_RESOLVER, "%s\n", ostr.str().c_str() );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxFileName cfgpath( m_configDir, RESOLVER_CONFIG );
|
|
||||||
|
|
||||||
// This should be the same as wxWidgets 3.0 wxPATH_NORM_ALL which is deprecated in 3.1.
|
|
||||||
// There are known issues with environment variable expansion so maybe we should be using
|
|
||||||
// our own ExpandEnvVarSubstitutions() here instead.
|
|
||||||
cfgpath.Normalize( FN_NORMALIZE_FLAGS | wxPATH_NORM_ENV_VARS );
|
|
||||||
wxString cfgname = cfgpath.GetFullPath();
|
|
||||||
|
|
||||||
size_t nitems = m_paths.size();
|
|
||||||
|
|
||||||
std::ifstream cfgFile;
|
|
||||||
std::string cfgLine;
|
|
||||||
|
|
||||||
if( !wxFileName::Exists( cfgname ) )
|
|
||||||
{
|
|
||||||
std::ostringstream ostr;
|
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
|
||||||
wxString errmsg = "no 3D configuration file";
|
|
||||||
ostr << " * " << errmsg.ToUTF8() << " '";
|
|
||||||
ostr << cfgname.ToUTF8() << "'";
|
|
||||||
wxLogTrace( MASK_3D_RESOLVER, "%s\n", ostr.str().c_str() );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
cfgFile.open( cfgname.ToUTF8() );
|
|
||||||
|
|
||||||
if( !cfgFile.is_open() )
|
|
||||||
{
|
|
||||||
std::ostringstream ostr;
|
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
|
||||||
wxString errmsg = "Could not open configuration file";
|
|
||||||
ostr << " * " << errmsg.ToUTF8() << " '" << cfgname.ToUTF8() << "'";
|
|
||||||
wxLogTrace( MASK_3D_RESOLVER, "%s\n", ostr.str().c_str() );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
int lineno = 0;
|
|
||||||
SEARCH_PATH al;
|
|
||||||
size_t idx;
|
|
||||||
int vnum = 0; // version number
|
|
||||||
|
|
||||||
while( cfgFile.good() )
|
|
||||||
{
|
|
||||||
cfgLine.clear();
|
|
||||||
std::getline( cfgFile, cfgLine );
|
|
||||||
++lineno;
|
|
||||||
|
|
||||||
if( cfgLine.empty() )
|
|
||||||
{
|
|
||||||
if( cfgFile.eof() )
|
|
||||||
break;
|
|
||||||
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( 1 == lineno && cfgLine.compare( 0, 2, "#V" ) == 0 )
|
|
||||||
{
|
|
||||||
// extract the version number and parse accordingly
|
|
||||||
if( cfgLine.size() > 2 )
|
|
||||||
{
|
|
||||||
std::istringstream istr;
|
|
||||||
istr.str( cfgLine.substr( 2 ) );
|
|
||||||
istr >> vnum;
|
|
||||||
}
|
|
||||||
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
idx = 0;
|
|
||||||
|
|
||||||
if( !getHollerith( cfgLine, idx, al.m_Alias ) )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// Don't add KICAD6_3DMODEL_DIR, one of its legacy equivalents, or KIPRJMOD from a
|
|
||||||
// config file. They're system variables are are defined at runtime.
|
|
||||||
if( al.m_Alias == "${KICAD6_3DMODEL_DIR}"
|
|
||||||
|| al.m_Alias == "${KIPRJMOD}" || al.m_Alias == "$(KIPRJMOD)"
|
|
||||||
|| al.m_Alias == "${KISYS3DMOD}" || al.m_Alias == "$(KISYS3DMOD)" )
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !getHollerith( cfgLine, idx, al.m_Pathvar ) )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if( !getHollerith( cfgLine, idx, al.m_Description ) )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
addPath( al );
|
|
||||||
}
|
|
||||||
|
|
||||||
cfgFile.close();
|
|
||||||
|
|
||||||
if( vnum < CFGFILE_VERSION )
|
|
||||||
WritePathList( m_configDir, RESOLVER_CONFIG, false );
|
|
||||||
|
|
||||||
return( m_paths.size() != nitems );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool FILENAME_RESOLVER::WritePathList( const wxString& aDir, const wxString& aFilename,
|
bool FILENAME_RESOLVER::WritePathList( const wxString& aDir, const wxString& aFilename,
|
||||||
bool aResolvePaths )
|
bool aResolvePaths )
|
||||||
{
|
{
|
||||||
|
@ -858,101 +749,6 @@ bool FILENAME_RESOLVER::SplitAlias( const wxString& aFileName,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static bool getHollerith( const std::string& aString, size_t& aIndex, wxString& aResult )
|
|
||||||
{
|
|
||||||
aResult.clear();
|
|
||||||
|
|
||||||
if( aIndex >= aString.size() )
|
|
||||||
{
|
|
||||||
std::ostringstream ostr;
|
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
|
||||||
wxString errmsg = "bad Hollerith string on line";
|
|
||||||
ostr << " * " << errmsg.ToUTF8() << "\n'" << aString << "'";
|
|
||||||
wxLogTrace( MASK_3D_RESOLVER, "%s\n", ostr.str().c_str() );
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t i2 = aString.find( '"', aIndex );
|
|
||||||
|
|
||||||
if( std::string::npos == i2 )
|
|
||||||
{
|
|
||||||
std::ostringstream ostr;
|
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
|
||||||
wxString errmsg = "missing opening quote mark in config file";
|
|
||||||
ostr << " * " << errmsg.ToUTF8() << "\n'" << aString << "'";
|
|
||||||
wxLogTrace( MASK_3D_RESOLVER, "%s\n", ostr.str().c_str() );
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
++i2;
|
|
||||||
|
|
||||||
if( i2 >= aString.size() )
|
|
||||||
{
|
|
||||||
std::ostringstream ostr;
|
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
|
||||||
wxString errmsg = "invalid entry (unexpected end of line)";
|
|
||||||
ostr << " * " << errmsg.ToUTF8() << "\n'" << aString << "'";
|
|
||||||
wxLogTrace( MASK_3D_RESOLVER, "%s\n", ostr.str().c_str() );
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string tnum;
|
|
||||||
|
|
||||||
while( aString[i2] >= '0' && aString[i2] <= '9' )
|
|
||||||
tnum.append( 1, aString[i2++] );
|
|
||||||
|
|
||||||
if( tnum.empty() || aString[i2++] != ':' )
|
|
||||||
{
|
|
||||||
std::ostringstream ostr;
|
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
|
||||||
wxString errmsg = "bad Hollerith string on line";
|
|
||||||
ostr << " * " << errmsg.ToUTF8() << "\n'" << aString << "'";
|
|
||||||
wxLogTrace( MASK_3D_RESOLVER, "%s\n", ostr.str().c_str() );
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::istringstream istr;
|
|
||||||
istr.str( tnum );
|
|
||||||
size_t nchars;
|
|
||||||
istr >> nchars;
|
|
||||||
|
|
||||||
if( (i2 + nchars) >= aString.size() )
|
|
||||||
{
|
|
||||||
std::ostringstream ostr;
|
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
|
||||||
wxString errmsg = "invalid entry (unexpected end of line)";
|
|
||||||
ostr << " * " << errmsg.ToUTF8() << "\n'" << aString << "'";
|
|
||||||
wxLogTrace( MASK_3D_RESOLVER, "%s\n", ostr.str().c_str() );
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( nchars > 0 )
|
|
||||||
{
|
|
||||||
aResult = wxString::FromUTF8( aString.substr( i2, nchars ).c_str() );
|
|
||||||
i2 += nchars;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( i2 >= aString.size() || aString[i2] != '"' )
|
|
||||||
{
|
|
||||||
std::ostringstream ostr;
|
|
||||||
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
|
||||||
wxString errmsg = "missing closing quote mark in config file";
|
|
||||||
ostr << " * " << errmsg.ToUTF8() << "\n'" << aString << "'";
|
|
||||||
wxLogTrace( MASK_3D_RESOLVER, "%s\n", ostr.str().c_str() );
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
aIndex = i2 + 1;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool FILENAME_RESOLVER::ValidateFileName( const wxString& aFileName, bool& hasAlias ) const
|
bool FILENAME_RESOLVER::ValidateFileName( const wxString& aFileName, bool& hasAlias ) const
|
||||||
{
|
{
|
||||||
// Rules:
|
// Rules:
|
||||||
|
@ -1066,32 +862,30 @@ bool FILENAME_RESOLVER::GetKicadPaths( std::list< wxString >& paths ) const
|
||||||
while( mS != mE )
|
while( mS != mE )
|
||||||
{
|
{
|
||||||
// filter out URLs, template directories, and known system paths
|
// filter out URLs, template directories, and known system paths
|
||||||
if( mS->first == wxString( "KICAD_PTEMPLATES" )
|
if( mS->first == wxS( "KICAD_PTEMPLATES" )
|
||||||
|| mS->first == wxString( "KICAD6_FOOTPRINT_DIR" ) )
|
|| mS->first == wxS( "KICAD6_FOOTPRINT_DIR" ) )
|
||||||
{
|
{
|
||||||
++mS;
|
++mS;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( wxString::npos != mS->second.GetValue().find( wxString( "://" ) ) )
|
if( wxString::npos != mS->second.GetValue().find( wxS( "://" ) ) )
|
||||||
{
|
{
|
||||||
++mS;
|
++mS;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString tmp( "${" );
|
//also add the path without the ${} to act as legacy alias support for older files
|
||||||
tmp.Append( mS->first );
|
paths.push_back( mS->first );
|
||||||
tmp.Append( "}" );
|
|
||||||
paths.push_back( tmp );
|
|
||||||
|
|
||||||
if( tmp == "${KICAD6_3DMODEL_DIR}" )
|
if( mS->first == wxS("KICAD6_3DMODEL_DIR") )
|
||||||
hasKisys3D = true;
|
hasKisys3D = true;
|
||||||
|
|
||||||
++mS;
|
++mS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !hasKisys3D )
|
if( !hasKisys3D )
|
||||||
paths.emplace_back("${KICAD6_3DMODEL_DIR}" );
|
paths.emplace_back( wxS("KICAD6_3DMODEL_DIR") );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,9 +19,12 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <set>
|
#include <set>
|
||||||
|
#include <fstream>
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
#include <paths.h>
|
#include <paths.h>
|
||||||
#include <search_stack.h>
|
#include <search_stack.h>
|
||||||
|
#include <settings/settings_manager.h>
|
||||||
#include <settings/common_settings.h>
|
#include <settings/common_settings.h>
|
||||||
#include <settings/json_settings_internals.h>
|
#include <settings/json_settings_internals.h>
|
||||||
#include <settings/parameters.h>
|
#include <settings/parameters.h>
|
||||||
|
@ -42,7 +45,7 @@ const std::set<wxString> envVarBlacklist =
|
||||||
|
|
||||||
|
|
||||||
///! Update the schema version whenever a migration is required
|
///! Update the schema version whenever a migration is required
|
||||||
const int commonSchemaVersion = 2;
|
const int commonSchemaVersion = 3;
|
||||||
|
|
||||||
COMMON_SETTINGS::COMMON_SETTINGS() :
|
COMMON_SETTINGS::COMMON_SETTINGS() :
|
||||||
JSON_SETTINGS( "kicad_common", SETTINGS_LOC::USER, commonSchemaVersion ),
|
JSON_SETTINGS( "kicad_common", SETTINGS_LOC::USER, commonSchemaVersion ),
|
||||||
|
@ -341,6 +344,7 @@ COMMON_SETTINGS::COMMON_SETTINGS() :
|
||||||
|
|
||||||
registerMigration( 0, 1, std::bind( &COMMON_SETTINGS::migrateSchema0to1, this ) );
|
registerMigration( 0, 1, std::bind( &COMMON_SETTINGS::migrateSchema0to1, this ) );
|
||||||
registerMigration( 1, 2, std::bind( &COMMON_SETTINGS::migrateSchema1to2, this ) );
|
registerMigration( 1, 2, std::bind( &COMMON_SETTINGS::migrateSchema1to2, this ) );
|
||||||
|
registerMigration( 2, 3, std::bind( &COMMON_SETTINGS::migrateSchema2to3, this ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -412,6 +416,38 @@ bool COMMON_SETTINGS::migrateSchema1to2()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool COMMON_SETTINGS::migrateSchema2to3()
|
||||||
|
{
|
||||||
|
wxFileName cfgpath;
|
||||||
|
cfgpath.AssignDir( SETTINGS_MANAGER::GetUserSettingsPath() );
|
||||||
|
cfgpath.AppendDir( wxT( "3d" ) );
|
||||||
|
cfgpath.SetFullName( "3Dresolver.cfg" );
|
||||||
|
cfgpath.MakeAbsolute();
|
||||||
|
|
||||||
|
std::vector<LEGACY_3D_SEARCH_PATH> legacyPaths;
|
||||||
|
readLegacy3DResolverCfg( cfgpath.GetFullPath(), legacyPaths );
|
||||||
|
|
||||||
|
for( const LEGACY_3D_SEARCH_PATH& path : legacyPaths )
|
||||||
|
{
|
||||||
|
const wxString& key = path.m_Alias;
|
||||||
|
const wxString& val = path.m_Pathvar;
|
||||||
|
|
||||||
|
if( !m_Env.vars.count( key ) )
|
||||||
|
{
|
||||||
|
wxLogTrace( traceEnvVars, "COMMON_SETTINGS: Loaded new var: %s = %s", key, val );
|
||||||
|
m_Env.vars[key] = ENV_VAR_ITEM( key, val );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( cfgpath.FileExists() )
|
||||||
|
{
|
||||||
|
wxRemoveFile( cfgpath.GetFullPath() );
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool COMMON_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
|
bool COMMON_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
|
||||||
{
|
{
|
||||||
bool ret = true;
|
bool ret = true;
|
||||||
|
@ -536,3 +572,197 @@ void COMMON_SETTINGS::InitializeEnvironment()
|
||||||
path.AppendDir( wxT( "symbols" ) );
|
path.AppendDir( wxT( "symbols" ) );
|
||||||
addVar( wxT( "KICAD6_SYMBOL_DIR" ), path.GetFullPath() );
|
addVar( wxT( "KICAD6_SYMBOL_DIR" ), path.GetFullPath() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool COMMON_SETTINGS::readLegacy3DResolverCfg( const wxString& path,
|
||||||
|
std::vector<LEGACY_3D_SEARCH_PATH>& aSearchPaths )
|
||||||
|
{
|
||||||
|
wxFileName cfgpath( path );
|
||||||
|
|
||||||
|
// This should be the same as wxWidgets 3.0 wxPATH_NORM_ALL which is deprecated in 3.1.
|
||||||
|
// There are known issues with environment variable expansion so maybe we should be using
|
||||||
|
// our own ExpandEnvVarSubstitutions() here instead.
|
||||||
|
cfgpath.Normalize( FN_NORMALIZE_FLAGS | wxPATH_NORM_ENV_VARS );
|
||||||
|
wxString cfgname = cfgpath.GetFullPath();
|
||||||
|
|
||||||
|
std::ifstream cfgFile;
|
||||||
|
std::string cfgLine;
|
||||||
|
|
||||||
|
if( !wxFileName::Exists( cfgname ) )
|
||||||
|
{
|
||||||
|
std::ostringstream ostr;
|
||||||
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
wxString errmsg = "no 3D configuration file";
|
||||||
|
ostr << " * " << errmsg.ToUTF8() << " '";
|
||||||
|
ostr << cfgname.ToUTF8() << "'";
|
||||||
|
wxLogTrace( traceSettings, "%s\n", ostr.str().c_str() );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
cfgFile.open( cfgname.ToUTF8() );
|
||||||
|
|
||||||
|
if( !cfgFile.is_open() )
|
||||||
|
{
|
||||||
|
std::ostringstream ostr;
|
||||||
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
wxString errmsg = "Could not open configuration file";
|
||||||
|
ostr << " * " << errmsg.ToUTF8() << " '" << cfgname.ToUTF8() << "'";
|
||||||
|
wxLogTrace( traceSettings, "%s\n", ostr.str().c_str() );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int lineno = 0;
|
||||||
|
LEGACY_3D_SEARCH_PATH al;
|
||||||
|
size_t idx;
|
||||||
|
int vnum = 0; // version number
|
||||||
|
|
||||||
|
while( cfgFile.good() )
|
||||||
|
{
|
||||||
|
cfgLine.clear();
|
||||||
|
std::getline( cfgFile, cfgLine );
|
||||||
|
++lineno;
|
||||||
|
|
||||||
|
if( cfgLine.empty() )
|
||||||
|
{
|
||||||
|
if( cfgFile.eof() )
|
||||||
|
break;
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( 1 == lineno && cfgLine.compare( 0, 2, "#V" ) == 0 )
|
||||||
|
{
|
||||||
|
// extract the version number and parse accordingly
|
||||||
|
if( cfgLine.size() > 2 )
|
||||||
|
{
|
||||||
|
std::istringstream istr;
|
||||||
|
istr.str( cfgLine.substr( 2 ) );
|
||||||
|
istr >> vnum;
|
||||||
|
}
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
idx = 0;
|
||||||
|
|
||||||
|
if( !getLegacy3DHollerith( cfgLine, idx, al.m_Alias ) )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// Don't add KICAD6_3DMODEL_DIR, one of its legacy equivalents, or KIPRJMOD from a
|
||||||
|
// config file. They're system variables are are defined at runtime.
|
||||||
|
if( al.m_Alias == "${KICAD6_3DMODEL_DIR}" || al.m_Alias == "${KIPRJMOD}"
|
||||||
|
|| al.m_Alias == "$(KIPRJMOD)" || al.m_Alias == "${KISYS3DMOD}"
|
||||||
|
|| al.m_Alias == "$(KISYS3DMOD)" )
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !getLegacy3DHollerith( cfgLine, idx, al.m_Pathvar ) )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if( !getLegacy3DHollerith( cfgLine, idx, al.m_Description ) )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
aSearchPaths.push_back( al );
|
||||||
|
}
|
||||||
|
|
||||||
|
cfgFile.close();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool COMMON_SETTINGS::getLegacy3DHollerith( const std::string& aString, size_t& aIndex,
|
||||||
|
wxString& aResult )
|
||||||
|
{
|
||||||
|
aResult.clear();
|
||||||
|
|
||||||
|
if( aIndex >= aString.size() )
|
||||||
|
{
|
||||||
|
std::ostringstream ostr;
|
||||||
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
wxString errmsg = "bad Hollerith string on line";
|
||||||
|
ostr << " * " << errmsg.ToUTF8() << "\n'" << aString << "'";
|
||||||
|
wxLogTrace( traceSettings, "%s\n", ostr.str().c_str() );
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t i2 = aString.find( '"', aIndex );
|
||||||
|
|
||||||
|
if( std::string::npos == i2 )
|
||||||
|
{
|
||||||
|
std::ostringstream ostr;
|
||||||
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
wxString errmsg = "missing opening quote mark in config file";
|
||||||
|
ostr << " * " << errmsg.ToUTF8() << "\n'" << aString << "'";
|
||||||
|
wxLogTrace( traceSettings, "%s\n", ostr.str().c_str() );
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
++i2;
|
||||||
|
|
||||||
|
if( i2 >= aString.size() )
|
||||||
|
{
|
||||||
|
std::ostringstream ostr;
|
||||||
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
wxString errmsg = "invalid entry (unexpected end of line)";
|
||||||
|
ostr << " * " << errmsg.ToUTF8() << "\n'" << aString << "'";
|
||||||
|
wxLogTrace( traceSettings, "%s\n", ostr.str().c_str() );
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string tnum;
|
||||||
|
|
||||||
|
while( aString[i2] >= '0' && aString[i2] <= '9' )
|
||||||
|
tnum.append( 1, aString[i2++] );
|
||||||
|
|
||||||
|
if( tnum.empty() || aString[i2++] != ':' )
|
||||||
|
{
|
||||||
|
std::ostringstream ostr;
|
||||||
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
wxString errmsg = "bad Hollerith string on line";
|
||||||
|
ostr << " * " << errmsg.ToUTF8() << "\n'" << aString << "'";
|
||||||
|
wxLogTrace( traceSettings, "%s\n", ostr.str().c_str() );
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::istringstream istr;
|
||||||
|
istr.str( tnum );
|
||||||
|
size_t nchars;
|
||||||
|
istr >> nchars;
|
||||||
|
|
||||||
|
if( ( i2 + nchars ) >= aString.size() )
|
||||||
|
{
|
||||||
|
std::ostringstream ostr;
|
||||||
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
wxString errmsg = "invalid entry (unexpected end of line)";
|
||||||
|
ostr << " * " << errmsg.ToUTF8() << "\n'" << aString << "'";
|
||||||
|
wxLogTrace( traceSettings, "%s\n", ostr.str().c_str() );
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( nchars > 0 )
|
||||||
|
{
|
||||||
|
aResult = wxString::FromUTF8( aString.substr( i2, nchars ).c_str() );
|
||||||
|
i2 += nchars;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( i2 >= aString.size() || aString[i2] != '"' )
|
||||||
|
{
|
||||||
|
std::ostringstream ostr;
|
||||||
|
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||||
|
wxString errmsg = "missing closing quote mark in config file";
|
||||||
|
ostr << " * " << errmsg.ToUTF8() << "\n'" << aString << "'";
|
||||||
|
wxLogTrace( traceSettings, "%s\n", ostr.str().c_str() );
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
aIndex = i2 + 1;
|
||||||
|
return true;
|
||||||
|
}
|
|
@ -111,7 +111,7 @@ int COMMON_CONTROL::ConfigurePaths( const TOOL_EVENT& aEvent )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DIALOG_CONFIGURE_PATHS dlg( m_frame, nullptr );
|
DIALOG_CONFIGURE_PATHS dlg( m_frame );
|
||||||
|
|
||||||
if( dlg.ShowModal() == wxID_OK )
|
if( dlg.ShowModal() == wxID_OK )
|
||||||
m_frame->Kiway().CommonSettingsChanged( true, false );
|
m_frame->Kiway().CommonSettingsChanged( true, false );
|
||||||
|
|
|
@ -30,15 +30,13 @@
|
||||||
#include <wx/string.h>
|
#include <wx/string.h>
|
||||||
#include <wx/valtext.h>
|
#include <wx/valtext.h>
|
||||||
|
|
||||||
|
|
||||||
class FILENAME_RESOLVER;
|
|
||||||
class HTML_WINDOW;
|
class HTML_WINDOW;
|
||||||
|
|
||||||
|
|
||||||
class DIALOG_CONFIGURE_PATHS: public DIALOG_CONFIGURE_PATHS_BASE
|
class DIALOG_CONFIGURE_PATHS: public DIALOG_CONFIGURE_PATHS_BASE
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DIALOG_CONFIGURE_PATHS( wxWindow* aParent, FILENAME_RESOLVER* aResolver );
|
DIALOG_CONFIGURE_PATHS( wxWindow* aParent );
|
||||||
~DIALOG_CONFIGURE_PATHS() override;
|
~DIALOG_CONFIGURE_PATHS() override;
|
||||||
|
|
||||||
bool TransferDataToWindow() override;
|
bool TransferDataToWindow() override;
|
||||||
|
@ -46,16 +44,11 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Various button callbacks
|
// Various button callbacks
|
||||||
void OnGridCellRightClick( wxGridEvent& event ) override;
|
|
||||||
void OnGridSize( wxSizeEvent& event ) override;
|
void OnGridSize( wxSizeEvent& event ) override;
|
||||||
void OnUpdateUI( wxUpdateUIEvent& event ) override;
|
void OnUpdateUI( wxUpdateUIEvent& event ) override;
|
||||||
void OnGridCellChanging( wxGridEvent& event );
|
void OnGridCellChanging( wxGridEvent& event );
|
||||||
void OnAddEnvVar( wxCommandEvent& event ) override;
|
void OnAddEnvVar( wxCommandEvent& event ) override;
|
||||||
void OnRemoveEnvVar( wxCommandEvent& event ) override;
|
void OnRemoveEnvVar( wxCommandEvent& event ) override;
|
||||||
void OnAddSearchPath( wxCommandEvent& event ) override;
|
|
||||||
void OnDeleteSearchPath( wxCommandEvent& event ) override;
|
|
||||||
void OnSearchPathMoveUp( wxCommandEvent& event ) override;
|
|
||||||
void OnSearchPathMoveDown( wxCommandEvent& event ) override;
|
|
||||||
void OnHelp( wxCommandEvent& event ) override;
|
void OnHelp( wxCommandEvent& event ) override;
|
||||||
|
|
||||||
void AppendEnvVar( const wxString& aName, const wxString& aPath, bool isExternal );
|
void AppendEnvVar( const wxString& aName, const wxString& aPath, bool isExternal );
|
||||||
|
@ -67,7 +60,6 @@ private:
|
||||||
int m_errorRow;
|
int m_errorRow;
|
||||||
int m_errorCol;
|
int m_errorCol;
|
||||||
|
|
||||||
FILENAME_RESOLVER* m_resolver;
|
|
||||||
wxString m_curdir;
|
wxString m_curdir;
|
||||||
wxTextValidator m_aliasValidator;
|
wxTextValidator m_aliasValidator;
|
||||||
|
|
||||||
|
|
|
@ -161,13 +161,6 @@ private:
|
||||||
*/
|
*/
|
||||||
bool addPath( const SEARCH_PATH& aPath );
|
bool addPath( const SEARCH_PATH& aPath );
|
||||||
|
|
||||||
/**
|
|
||||||
* Read a list of path names from a configuration file.
|
|
||||||
*
|
|
||||||
* @return true if a file was found and contained at least one valid path.
|
|
||||||
*/
|
|
||||||
bool readPathList( void );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check the ${ENV_VAR} component of a path and adds it to the resolver's path list if
|
* Check the ${ENV_VAR} component of a path and adds it to the resolver's path list if
|
||||||
* it is not yet in the list.
|
* it is not yet in the list.
|
||||||
|
|
|
@ -155,6 +155,19 @@ public:
|
||||||
private:
|
private:
|
||||||
bool migrateSchema0to1();
|
bool migrateSchema0to1();
|
||||||
bool migrateSchema1to2();
|
bool migrateSchema1to2();
|
||||||
|
bool migrateSchema2to3();
|
||||||
|
|
||||||
|
struct LEGACY_3D_SEARCH_PATH
|
||||||
|
{
|
||||||
|
wxString m_Alias; // alias to the base path
|
||||||
|
wxString m_Pathvar; // base path as stored in the config file
|
||||||
|
wxString m_Pathexp; // expanded base path
|
||||||
|
wxString m_Description; // description of the aliased path
|
||||||
|
};
|
||||||
|
|
||||||
|
static bool getLegacy3DHollerith( const std::string& aString, size_t& aIndex,
|
||||||
|
wxString& aResult );
|
||||||
|
bool readLegacy3DResolverCfg( const wxString& aPath, std::vector<LEGACY_3D_SEARCH_PATH>& aSearchPaths );
|
||||||
|
|
||||||
public:
|
public:
|
||||||
APPEARANCE m_Appearance;
|
APPEARANCE m_Appearance;
|
||||||
|
|
|
@ -116,7 +116,7 @@ static struct IFACE : public KIFACE_BASE
|
||||||
|
|
||||||
case DIALOG_CONFIGUREPATHS:
|
case DIALOG_CONFIGUREPATHS:
|
||||||
{
|
{
|
||||||
DIALOG_CONFIGURE_PATHS dlg( aParent, aKiway->Prj().Get3DFilenameResolver() );
|
DIALOG_CONFIGURE_PATHS dlg( aParent );
|
||||||
|
|
||||||
// The dialog's constructor probably failed to set its Kiway because the
|
// The dialog's constructor probably failed to set its Kiway because the
|
||||||
// dynamic_cast fails when aParent was allocated by a separate compilation
|
// dynamic_cast fails when aParent was allocated by a separate compilation
|
||||||
|
|
Loading…
Reference in New Issue