Beautify Manage Footprint Association Files dialog.

This commit is contained in:
Jeff Young 2023-09-22 00:17:54 +01:00
parent 722a90213c
commit 17df55951d
7 changed files with 775 additions and 865 deletions

View File

@ -1,12 +1,8 @@
/**
* @file dialog_config_equfiles.cpp
*/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -29,11 +25,12 @@
#include <pgm_base.h>
#include <confirm.h>
#include <gestfich.h>
#include <id.h>
#include <widgets/std_bitmap_button.h>
#include <widgets/wx_grid.h>
#include <bitmaps.h>
#include <project.h> // For PROJECT_VAR_NAME definition
#include <fp_lib_table.h> // For KICAD7_FOOTPRINT_DIR definition
#include <cvpcb_mainframe.h>
#include <dialog_config_equfiles.h>
#include <project/project_file.h>
#include <settings/settings_manager.h>
@ -42,26 +39,16 @@
#include <wx/filedlg.h>
DIALOG_CONFIG_EQUFILES::DIALOG_CONFIG_EQUFILES( CVPCB_MAINFRAME* aParent ) :
DIALOG_CONFIG_EQUFILES::DIALOG_CONFIG_EQUFILES( wxWindow* aParent ) :
DIALOG_CONFIG_EQUFILES_BASE( aParent )
{
m_Parent = aParent;
SetTitle( wxString::Format( _( "Project file: '%s'" ), Prj().GetProjectFullName() ) );
PROJECT& prj = Prj();
SetTitle( wxString::Format( _( "Project file: '%s'" ), prj.GetProjectFullName() ) );
Init( );
SetupStandardButtons();
GetSizer()->SetSizeHints( this );
Center();
}
void DIALOG_CONFIG_EQUFILES::Init()
{
m_ListChanged = false;
m_bpAdd->SetBitmap( KiBitmap( BITMAPS::small_folder ) );
m_bpEdit->SetBitmap( KiBitmap( BITMAPS::small_edit ) );
m_bpMoveUp->SetBitmap( KiBitmap( BITMAPS::small_up ) );
m_bpMoveDown->SetBitmap( KiBitmap( BITMAPS::small_down ) );
m_bpDelete->SetBitmap( KiBitmap( BITMAPS::small_trash ) );
PROJECT_FILE& project = Prj().GetProjectFile();
@ -72,31 +59,34 @@ void DIALOG_CONFIG_EQUFILES::Init()
for( const auto& entry : project.m_EquivalenceFiles )
arr.Add( entry );
m_ListEquiv->InsertItems( arr, 0 );
m_filesListBox->InsertItems( arr, 0 );
}
if( getEnvVarCount() < 2 )
m_gridEnvVars->AppendRows(2 - getEnvVarCount() );
m_gridEnvVars->ClearRows();
m_gridEnvVars->AppendRows( 2 );
m_gridEnvVars->SetCellValue( 0, 0, PROJECT_VAR_NAME );
m_gridEnvVars->SetCellValue( 1, 0, FP_LIB_TABLE::GlobalPathEnvVariableName() );
wxString evValue;
int row = 0;
m_gridEnvVars->SetCellValue( row++, 0, PROJECT_VAR_NAME );
m_gridEnvVars->SetCellValue( row, 0, FP_LIB_TABLE::GlobalPathEnvVariableName() );
for( row = 0; row < getEnvVarCount(); row++ )
for( int row = 0; row < m_gridEnvVars->GetTable()->GetRowsCount(); row++ )
{
wxString evValue;
if( wxGetEnv( m_gridEnvVars->GetCellValue( row, 0 ), &evValue ) )
m_gridEnvVars->SetCellValue( row, 1, evValue );
}
m_gridEnvVars->AutoSizeColumns();
SetupStandardButtons();
GetSizer()->SetSizeHints( this );
Center();
}
void DIALOG_CONFIG_EQUFILES::OnEditEquFile( wxCommandEvent& event )
{
wxString editorname = Pgm().GetTextEditor();
wxString editorname = Pgm().GetTextEditor();
if( editorname.IsEmpty() )
{
@ -105,31 +95,24 @@ void DIALOG_CONFIG_EQUFILES::OnEditEquFile( wxCommandEvent& event )
}
wxArrayInt selections;
m_ListEquiv->GetSelections( selections );
m_filesListBox->GetSelections( selections );
for( unsigned ii = 0; ii < selections.GetCount(); ii++ )
{
ExecuteFile( editorname, wxExpandEnvVars( m_ListEquiv->GetString( selections[ii] ) ) );
m_ListChanged = true;
}
ExecuteFile( editorname, wxExpandEnvVars( m_filesListBox->GetString( selections[ii] ) ) );
}
void DIALOG_CONFIG_EQUFILES::OnOkClick( wxCommandEvent& event )
{
// Save new equ file list if the files list was modified
if( m_ListChanged )
{
PROJECT_FILE& project = Prj().GetProjectFile();
PROJECT_FILE& project = Prj().GetProjectFile();
// Recreate equ list
project.m_EquivalenceFiles.clear();
// Recreate equ list
project.m_EquivalenceFiles.clear();
for( unsigned ii = 0; ii < m_ListEquiv->GetCount(); ii++ )
project.m_EquivalenceFiles.emplace_back( m_ListEquiv->GetString( ii ) );
for( unsigned ii = 0; ii < m_filesListBox->GetCount(); ii++ )
project.m_EquivalenceFiles.emplace_back( m_filesListBox->GetString( ii ) );
Pgm().GetSettingsManager().SaveProject();
}
Pgm().GetSettingsManager().SaveProject();
EndModal( wxID_OK );
}
@ -144,8 +127,7 @@ void DIALOG_CONFIG_EQUFILES::OnCloseWindow( wxCloseEvent& event )
void DIALOG_CONFIG_EQUFILES::OnButtonMoveUp( wxCommandEvent& event )
{
wxArrayInt selections;
m_ListEquiv->GetSelections( selections );
m_filesListBox->GetSelections( selections );
if ( selections.GetCount() <= 0 ) // No selection.
return;
@ -153,7 +135,7 @@ void DIALOG_CONFIG_EQUFILES::OnButtonMoveUp( wxCommandEvent& event )
if( selections[0] == 0 ) // The first lib is selected. cannot move up it
return;
wxArrayString libnames = m_ListEquiv->GetStrings();
wxArrayString libnames = m_filesListBox->GetStrings();
for( size_t ii = 0; ii < selections.GetCount(); ii++ )
{
@ -161,32 +143,30 @@ void DIALOG_CONFIG_EQUFILES::OnButtonMoveUp( wxCommandEvent& event )
std::swap( libnames[jj], libnames[jj-1] );
}
m_ListEquiv->Set( libnames );
m_filesListBox->Set( libnames );
// Reselect previously selected names
for( size_t ii = 0; ii < selections.GetCount(); ii++ )
{
int jj = selections[ii];
m_ListEquiv->SetSelection( jj-1 );
m_filesListBox->SetSelection( jj-1 );
}
m_ListChanged = true;
}
void DIALOG_CONFIG_EQUFILES::OnButtonMoveDown( wxCommandEvent& event )
{
wxArrayInt selections;
m_ListEquiv->GetSelections( selections );
m_filesListBox->GetSelections( selections );
if ( selections.GetCount() <= 0 ) // No selection.
return;
// The last lib is selected. cannot move down it
if( selections.Last() == int( m_ListEquiv->GetCount()-1 ) )
if( selections.Last() == int( m_filesListBox->GetCount()-1 ) )
return;
wxArrayString libnames = m_ListEquiv->GetStrings();
wxArrayString libnames = m_filesListBox->GetStrings();
for( int ii = selections.GetCount()-1; ii >= 0; ii-- )
{
@ -194,16 +174,14 @@ void DIALOG_CONFIG_EQUFILES::OnButtonMoveDown( wxCommandEvent& event )
std::swap( libnames[jj], libnames[jj+1] );
}
m_ListEquiv->Set( libnames );
m_filesListBox->Set( libnames );
// Reselect previously selected names
for( size_t ii = 0; ii < selections.GetCount(); ii++ )
{
int jj = selections[ii];
m_ListEquiv->SetSelection( jj+1 );
m_filesListBox->SetSelection( jj+1 );
}
m_ListChanged = true;
}
@ -213,80 +191,63 @@ void DIALOG_CONFIG_EQUFILES::OnButtonMoveDown( wxCommandEvent& event )
void DIALOG_CONFIG_EQUFILES::OnRemoveFiles( wxCommandEvent& event )
{
wxArrayInt selections;
m_ListEquiv->GetSelections( selections );
m_filesListBox->GetSelections( selections );
std::sort( selections.begin(), selections.end() );
for( int ii = selections.GetCount()-1; ii >= 0; ii-- )
{
m_ListEquiv->Delete( selections[ii] );
m_ListChanged = true;
}
m_filesListBox->Delete( selections[ii] );
}
void DIALOG_CONFIG_EQUFILES::OnAddFiles( wxCommandEvent& event )
{
wxString equFilename;
wxFileName fn;
wxListBox* list = m_ListEquiv;
// Get a default path to open the file dialog:
wxString libpath;
wxArrayInt selectedRows = m_gridEnvVars->GetSelectedRows();
int row = selectedRows.GetCount() ? selectedRows[0] : m_gridEnvVars->GetGridCursorRow();
wxString libpath = m_gridEnvVars->GetCellValue( wxGridCellCoords( row, 1 ) );
int row = selectedRows.GetCount() ? selectedRows[0] :
m_gridEnvVars->GetGridCursorRow();
wxFileDialog dlg( this, _( "Footprint Association File" ), libpath, wxEmptyString,
EquFileWildcard(), wxFD_DEFAULT_STYLE | wxFD_MULTIPLE );
libpath = m_gridEnvVars->GetCellValue( wxGridCellCoords( row, 1 ) );
wxFileDialog FilesDialog( this, _( "Footprint Association File" ), libpath,
wxEmptyString, EquFileWildcard(),
wxFD_DEFAULT_STYLE | wxFD_MULTIPLE );
if( FilesDialog.ShowModal() != wxID_OK )
if( dlg.ShowModal() != wxID_OK )
return;
wxArrayString Filenames;
FilesDialog.GetPaths( Filenames );
wxArrayString filenames;
dlg.GetPaths( filenames );
for( unsigned jj = 0; jj < Filenames.GetCount(); jj++ )
for( unsigned jj = 0; jj < filenames.GetCount(); jj++ )
{
fn = Filenames[jj];
equFilename.Empty();
wxFileName fn = filenames[jj];
wxString filepath;
if( isPathRelativeAllowed() ) // try to use relative path
for( row = 0; row < m_gridEnvVars->GetTable()->GetRowsCount(); row++ )
{
for( row = 0; row < getEnvVarCount(); row++ )
{
libpath = m_gridEnvVars->GetCellValue( wxGridCellCoords( row, 1 ) );
libpath = m_gridEnvVars->GetCellValue( wxGridCellCoords( row, 1 ) );
if( fn.MakeRelativeTo( libpath ) )
{
equFilename.Printf( wxT( "${%s}%c%s" ),
m_gridEnvVars->GetCellValue( wxGridCellCoords( row, 0 ) ),
fn.GetPathSeparator(), fn.GetFullPath() );
break;
}
if( fn.MakeRelativeTo( libpath ) )
{
filepath.Printf( wxT( "${%s}%c%s" ),
m_gridEnvVars->GetCellValue( wxGridCellCoords( row, 0 ) ),
wxFileName::GetPathSeparator(),
fn.GetFullPath() );
break;
}
}
if( equFilename.IsEmpty() )
equFilename = Filenames[jj];
if( filepath.IsEmpty() )
filepath = filenames[jj];
// Add or insert new library name, if not already in list
if( list->FindString( equFilename, fn.IsCaseSensitive() ) == wxNOT_FOUND )
if( m_filesListBox->FindString( filepath, wxFileName::IsCaseSensitive() ) == wxNOT_FOUND )
{
m_ListChanged = true;
equFilename.Replace( wxT( "\\" ), wxT( "/" ) ); // Use unix separators only.
list->Append( equFilename );
filepath.Replace( wxT( "\\" ), wxT( "/" ) ); // Use unix separators only.
m_filesListBox->Append( filepath );
}
else
{
wxString msg;
msg.Printf( _( "File '%s' already exists in list." ), equFilename.GetData() );
DisplayError( this, msg );
DisplayError( this, wxString::Format( _( "File '%s' already exists in list." ),
filepath.GetData() ) );
}
}
}

View File

@ -1,12 +1,8 @@
/**
* @file dialog_config_equfiles.h
*/
/*
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 2010-2015 Jean-Pierre Charras jp.charras at wanadoo.fr
* Copyright (C) 1992-2021 Kicad Developers, see AUTHORS.TXT for contributors.
* Copyright (C) 1992-2023 Kicad Developers, see AUTHORS.TXT for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -26,20 +22,18 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef _DIALOG_CONFIG_EQUFILES_H_
#define _DIALOG_CONFIG_EQUFILES_H_
#ifndef DIALOG_CONFIG_EQUFILES_H
#define DIALOG_CONFIG_EQUFILES_H
#include <dialog_config_equfiles_base.h>
class DIALOG_CONFIG_EQUFILES : public DIALOG_CONFIG_EQUFILES_BASE
{
public:
DIALOG_CONFIG_EQUFILES( CVPCB_MAINFRAME* parent );
DIALOG_CONFIG_EQUFILES( wxWindow* parent );
~DIALOG_CONFIG_EQUFILES() {};
private:
void Init();
// Virtual event handlers
void OnCloseWindow( wxCloseEvent& event ) override;
void OnOkClick( wxCommandEvent& event ) override;
@ -48,21 +42,6 @@ private:
void OnRemoveFiles( wxCommandEvent& event ) override;
void OnButtonMoveUp( wxCommandEvent& event ) override;
void OnButtonMoveDown( wxCommandEvent& event ) override;
int getEnvVarCount() // Get the number of rows in env var table
{
return m_gridEnvVars->GetTable()->GetRowsCount();
}
bool isPathRelativeAllowed()
{
return m_rbPathOptionChoice->GetSelection() == 1;
}
CVPCB_MAINFRAME* m_Parent;
wxString m_UserLibDirBufferImg;
bool m_ListChanged;
};
#endif // _DIALOG_CONFIG_EQUFILES_H_
#endif // DIALOG_CONFIG_EQUFILES_H

View File

@ -5,6 +5,9 @@
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "widgets/std_bitmap_button.h"
#include "widgets/wx_grid.h"
#include "dialog_config_equfiles_base.h"
///////////////////////////////////////////////////////////////////////////
@ -16,55 +19,61 @@ DIALOG_CONFIG_EQUFILES_BASE::DIALOG_CONFIG_EQUFILES_BASE( wxWindow* parent, wxWi
wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbEquivChoiceSizer;
sbEquivChoiceSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Symbol Footprint Association Files (.equ)") ), wxHORIZONTAL );
wxBoxSizer* bUpperSizer;
bUpperSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bSizerFlist;
bSizerFlist = new wxBoxSizer( wxVERTICAL );
wxStaticText* listLabel;
listLabel = new wxStaticText( this, wxID_ANY, _("Footprint association files:"), wxDefaultPosition, wxDefaultSize, 0 );
listLabel->Wrap( -1 );
bUpperSizer->Add( listLabel, 0, wxBOTTOM, 2 );
m_ListEquiv = new wxListBox( sbEquivChoiceSizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_EXTENDED|wxLB_HSCROLL|wxLB_NEEDED_SB|wxLB_SINGLE );
m_ListEquiv->SetMinSize( wxSize( 350,-1 ) );
m_filesListBox = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_EXTENDED|wxLB_HSCROLL|wxLB_NEEDED_SB|wxLB_SINGLE );
m_filesListBox->SetMinSize( wxSize( 500,100 ) );
bSizerFlist->Add( m_ListEquiv, 1, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
bUpperSizer->Add( m_filesListBox, 2, wxEXPAND|wxBOTTOM, 3 );
bButtonsSizer = new wxBoxSizer( wxHORIZONTAL );
m_bpAdd = new STD_BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
m_bpAdd->SetToolTip( _("Add association file") );
bButtonsSizer->Add( m_bpAdd, 0, wxRIGHT, 5 );
m_bpMoveUp = new STD_BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
m_bpMoveUp->SetToolTip( _("Move up") );
bButtonsSizer->Add( m_bpMoveUp, 0, wxRIGHT, 5 );
m_bpMoveDown = new STD_BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
m_bpMoveDown->SetToolTip( _("Move down") );
bButtonsSizer->Add( m_bpMoveDown, 0, wxRIGHT, 5 );
m_bpEdit = new STD_BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
m_bpEdit->SetToolTip( _("Edit association file") );
bButtonsSizer->Add( m_bpEdit, 0, wxRIGHT, 5 );
sbEquivChoiceSizer->Add( bSizerFlist, 1, wxEXPAND, 5 );
bButtonsSizer->Add( 20, 0, 0, wxEXPAND, 5 );
wxBoxSizer* bSizerButtons;
bSizerButtons = new wxBoxSizer( wxVERTICAL );
m_bpDelete = new STD_BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
m_bpDelete->SetToolTip( _("Remove association file") );
m_buttonAddEqu = new wxButton( sbEquivChoiceSizer->GetStaticBox(), ID_ADD_EQU, _("Add"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerButtons->Add( m_buttonAddEqu, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
m_buttonRemoveEqu = new wxButton( sbEquivChoiceSizer->GetStaticBox(), ID_REMOVE_EQU, _("Remove"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerButtons->Add( m_buttonRemoveEqu, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
m_buttonMoveUp = new wxButton( sbEquivChoiceSizer->GetStaticBox(), ID_EQU_UP, _("Move Up"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerButtons->Add( m_buttonMoveUp, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
m_buttonMoveDown = new wxButton( sbEquivChoiceSizer->GetStaticBox(), ID_EQU_DOWN, _("Move Down"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerButtons->Add( m_buttonMoveDown, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
m_buttonEdit = new wxButton( sbEquivChoiceSizer->GetStaticBox(), wxID_ANY, _("Edit File"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerButtons->Add( m_buttonEdit, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
bButtonsSizer->Add( m_bpDelete, 0, wxRIGHT|wxLEFT, 10 );
sbEquivChoiceSizer->Add( bSizerButtons, 0, wxALIGN_CENTER_VERTICAL, 5 );
bUpperSizer->Add( bButtonsSizer, 0, wxEXPAND, 5 );
bMainSizer->Add( sbEquivChoiceSizer, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
bUpperSizer->Add( 0, 25, 0, wxEXPAND, 5 );
wxBoxSizer* bSizerLower;
bSizerLower = new wxBoxSizer( wxHORIZONTAL );
wxStaticText* envVarsLabel;
envVarsLabel = new wxStaticText( this, wxID_ANY, _("Available path substitutions:"), wxDefaultPosition, wxDefaultSize, 0 );
envVarsLabel->Wrap( -1 );
bUpperSizer->Add( envVarsLabel, 0, wxBOTTOM, 2 );
wxBoxSizer* bSizerEnvVar;
bSizerEnvVar = new wxBoxSizer( wxVERTICAL );
m_staticText2 = new wxStaticText( this, wxID_ANY, _("Available environment variables for relative paths:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText2->Wrap( -1 );
bSizerEnvVar->Add( m_staticText2, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_gridEnvVars = new wxGrid( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
m_gridEnvVars = new WX_GRID( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
// Grid
m_gridEnvVars->CreateGrid( 2, 2 );
@ -78,32 +87,23 @@ DIALOG_CONFIG_EQUFILES_BASE::DIALOG_CONFIG_EQUFILES_BASE( wxWindow* parent, wxWi
m_gridEnvVars->EnableDragColSize( true );
m_gridEnvVars->SetColLabelValue( 0, _("Name") );
m_gridEnvVars->SetColLabelValue( 1, _("Value") );
m_gridEnvVars->SetColLabelSize( 25 );
m_gridEnvVars->SetColLabelSize( 0 );
m_gridEnvVars->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
// Rows
m_gridEnvVars->AutoSizeRows();
m_gridEnvVars->EnableDragRowSize( true );
m_gridEnvVars->SetRowLabelSize( 30 );
m_gridEnvVars->SetRowLabelSize( 0 );
m_gridEnvVars->SetRowLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
// Label Appearance
// Cell Defaults
m_gridEnvVars->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_CENTER );
bSizerEnvVar->Add( m_gridEnvVars, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bUpperSizer->Add( m_gridEnvVars, 1, wxEXPAND, 5 );
bSizerLower->Add( bSizerEnvVar, 1, wxEXPAND, 5 );
wxString m_rbPathOptionChoiceChoices[] = { _("Absolute"), _("Relative") };
int m_rbPathOptionChoiceNChoices = sizeof( m_rbPathOptionChoiceChoices ) / sizeof( wxString );
m_rbPathOptionChoice = new wxRadioBox( this, wxID_ANY, _("Path Type"), wxDefaultPosition, wxDefaultSize, m_rbPathOptionChoiceNChoices, m_rbPathOptionChoiceChoices, 1, wxRA_SPECIFY_COLS );
m_rbPathOptionChoice->SetSelection( 1 );
bSizerLower->Add( m_rbPathOptionChoice, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
bMainSizer->Add( bSizerLower, 0, wxEXPAND, 5 );
bMainSizer->Add( bUpperSizer, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 10 );
m_sdbSizer = new wxStdDialogButtonSizer();
m_sdbSizerOK = new wxButton( this, wxID_OK );
@ -123,11 +123,11 @@ DIALOG_CONFIG_EQUFILES_BASE::DIALOG_CONFIG_EQUFILES_BASE( wxWindow* parent, wxWi
// Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnCloseWindow ) );
m_buttonAddEqu->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnAddFiles ), NULL, this );
m_buttonRemoveEqu->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnRemoveFiles ), NULL, this );
m_buttonMoveUp->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnButtonMoveUp ), NULL, this );
m_buttonMoveDown->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnButtonMoveDown ), NULL, this );
m_buttonEdit->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnEditEquFile ), NULL, this );
m_bpAdd->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnAddFiles ), NULL, this );
m_bpMoveUp->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnButtonMoveUp ), NULL, this );
m_bpMoveDown->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnButtonMoveDown ), NULL, this );
m_bpEdit->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnEditEquFile ), NULL, this );
m_bpDelete->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnRemoveFiles ), NULL, this );
m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnOkClick ), NULL, this );
}
@ -135,11 +135,11 @@ DIALOG_CONFIG_EQUFILES_BASE::~DIALOG_CONFIG_EQUFILES_BASE()
{
// Disconnect Events
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnCloseWindow ) );
m_buttonAddEqu->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnAddFiles ), NULL, this );
m_buttonRemoveEqu->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnRemoveFiles ), NULL, this );
m_buttonMoveUp->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnButtonMoveUp ), NULL, this );
m_buttonMoveDown->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnButtonMoveDown ), NULL, this );
m_buttonEdit->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnEditEquFile ), NULL, this );
m_bpAdd->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnAddFiles ), NULL, this );
m_bpMoveUp->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnButtonMoveUp ), NULL, this );
m_bpMoveDown->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnButtonMoveDown ), NULL, this );
m_bpEdit->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnEditEquFile ), NULL, this );
m_bpDelete->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnRemoveFiles ), NULL, this );
m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_CONFIG_EQUFILES_BASE::OnOkClick ), NULL, this );
}

File diff suppressed because it is too large Load Diff

View File

@ -10,22 +10,24 @@
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class STD_BITMAP_BUTTON;
class WX_GRID;
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/listbox.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/sizer.h>
#include <wx/button.h>
#include <wx/listbox.h>
#include <wx/bmpbuttn.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/statbox.h>
#include <wx/stattext.h>
#include <wx/button.h>
#include <wx/sizer.h>
#include <wx/grid.h>
#include <wx/radiobox.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
@ -38,23 +40,14 @@ class DIALOG_CONFIG_EQUFILES_BASE : public DIALOG_SHIM
private:
protected:
enum
{
ID_ADD_EQU = 1000,
ID_REMOVE_EQU,
ID_EQU_UP,
ID_EQU_DOWN
};
wxListBox* m_ListEquiv;
wxButton* m_buttonAddEqu;
wxButton* m_buttonRemoveEqu;
wxButton* m_buttonMoveUp;
wxButton* m_buttonMoveDown;
wxButton* m_buttonEdit;
wxStaticText* m_staticText2;
wxGrid* m_gridEnvVars;
wxRadioBox* m_rbPathOptionChoice;
wxListBox* m_filesListBox;
wxBoxSizer* bButtonsSizer;
STD_BITMAP_BUTTON* m_bpAdd;
STD_BITMAP_BUTTON* m_bpMoveUp;
STD_BITMAP_BUTTON* m_bpMoveDown;
STD_BITMAP_BUTTON* m_bpEdit;
STD_BITMAP_BUTTON* m_bpDelete;
WX_GRID* m_gridEnvVars;
wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizerOK;
wxButton* m_sdbSizerCancel;
@ -62,10 +55,10 @@ class DIALOG_CONFIG_EQUFILES_BASE : public DIALOG_SHIM
// Virtual event handlers, override them in your derived class
virtual void OnCloseWindow( wxCloseEvent& event ) { event.Skip(); }
virtual void OnAddFiles( wxCommandEvent& event ) { event.Skip(); }
virtual void OnRemoveFiles( wxCommandEvent& event ) { event.Skip(); }
virtual void OnButtonMoveUp( wxCommandEvent& event ) { event.Skip(); }
virtual void OnButtonMoveDown( wxCommandEvent& event ) { event.Skip(); }
virtual void OnEditEquFile( wxCommandEvent& event ) { event.Skip(); }
virtual void OnRemoveFiles( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }

View File

@ -68,10 +68,8 @@ void CVPCB_MAINFRAME::doReCreateMenuBar()
prefsMenu->Add( ACTIONS::configurePaths );
prefsMenu->Add( ACTIONS::showFootprintLibTable );
prefsMenu->Add( ACTIONS::openPreferences);
prefsMenu->AppendSeparator();
prefsMenu->Add( CVPCB_ACTIONS::showEquFileTable);
prefsMenu->Add( ACTIONS::openPreferences);
prefsMenu->AppendSeparator();
AddMenuLanguageList( prefsMenu, tool );

View File

@ -60,9 +60,9 @@ TOOL_ACTION CVPCB_ACTIONS::showFootprintViewer( TOOL_ACTION_ARGS()
TOOL_ACTION CVPCB_ACTIONS::showEquFileTable( TOOL_ACTION_ARGS()
.Name( "cvpcb.Control.ShowEquFileTable" )
.Scope( AS_GLOBAL )
.MenuText( _( "Manage Footprint Association Files" ) )
.Tooltip( _( "Configure footprint association file (.equ) list. These files are "
"used to automatically assign footprint names from symbol values." ) ) );
.MenuText( _( "Manage Footprint Association Files..." ) )
.Tooltip( _( "Edit the footprint association files list. These files are used to "
"automatically assign footprint names from symbol values." ) ) );
TOOL_ACTION CVPCB_ACTIONS::saveAssociationsToSchematic( TOOL_ACTION_ARGS()
.Name( "cvpcb.Control.SaveAssociationsToSchematic" )