From 93a3d4cb283751e28efa176126fb7d7a7b414fb8 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Wed, 17 Sep 2014 18:04:04 +0200 Subject: [PATCH] Eeschema: back to KICAD_KEEPCASE option, to find parts in lib, when using case sensitive option (default). Schematic component properties dialog: add 2 helper buttons to manage the chip name (name of the corresponding part in lib) - a browse button to chose an other chip name - a test button, to know if the part exists. If not existing, list the parts found when searching using a case insensitive comparison. --- CMakeLists.txt | 17 + eeschema/class_libentry.h | 6 +- eeschema/class_library.cpp | 9 +- eeschema/class_library.h | 22 +- .../dialog_edit_component_in_schematic.cpp | 91 ++- ...dialog_edit_component_in_schematic_fbp.cpp | 54 +- ...dialog_edit_component_in_schematic_fbp.fbp | 725 +++++++++++------- .../dialog_edit_component_in_schematic_fbp.h | 15 +- eeschema/getpart.cpp | 2 +- eeschema/libarch.cpp | 11 - eeschema/sch_component.cpp | 16 - include/sch_base_frame.h | 33 +- pcbnew/moduleframe.cpp | 1 - 13 files changed, 626 insertions(+), 376 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b9f2ea225e..e045d9fbf3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,6 +26,19 @@ set( CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules ) #option( USE_KIWAY_DLLS "Build the major modules as KIFACE DLLs or DSOs, will soon be the norm." ON ) set( USE_KIWAY_DLLS true ) # this is now mandatory, the code is the same anyways, the old code is gone. +# The desire is to migrate designs *away from* case independence, and to create designs which use +# literally (case specific) interpreted component names. But for backwards compatibility, +# you may turn OFF this option if you really must. (Remember that with KiCad using text +# data files, typically you would be better off simply doctoring those files into +# a case literal state with a text editor and move forward into the brave new +# world of case specificity. Also, BOM generators may not work properly when you +# have this option turned OFF, the xml export's referential integrity is broken +# on library part name. Hence the default is ON now, as of 29-Jan-2014. +option( KICAD_KEEPCASE + "ON= case specific string matching on component names, OFF= match names as if they were spelt using uppercase." + ON + ) + option( USE_WX_GRAPHICS_CONTEXT "Use wxGraphicsContext for rendering ( default OFF). Warning, this is experimental" ) @@ -231,6 +244,10 @@ if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) endif( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) +if( KICAD_KEEPCASE ) + add_definitions( -DKICAD_KEEPCASE ) +endif() + if( USE_WX_OVERLAY OR APPLE ) add_definitions( -DUSE_WX_OVERLAY ) endif() diff --git a/eeschema/class_libentry.h b/eeschema/class_libentry.h index 27fc67ffb1..fc88c91ced 100644 --- a/eeschema/class_libentry.h +++ b/eeschema/class_libentry.h @@ -46,11 +46,11 @@ class LIB_FIELD; /// Compiler controlled string compare function, either case independent or not: inline int Cmp_KEEPCASE( const wxString& aString1, const wxString& aString2 ) { -#if 1 - // case specificity: +#ifdef KICAD_KEEPCASE + // case specificity, the normal behavior: return aString1.Cmp( aString2 ); #else - // case independence (no more in use) + // case independence (only for guys who want that: not recommended) return aString1.CmpNoCase( aString2 ); #endif } diff --git a/eeschema/class_library.cpp b/eeschema/class_library.cpp index 7c782c5ecb..66d57bade5 100644 --- a/eeschema/class_library.cpp +++ b/eeschema/class_library.cpp @@ -902,8 +902,9 @@ LIB_ALIAS* PART_LIBS::FindLibraryEntry( const wxString& aName, const wxString& a /* searches all libraries in the list for an entry, using a case insensitive comparison. * Used to find an entry, when the normal (case sensitive) search fails. */ -LIB_ALIAS* PART_LIBS::FindLibraryNearEntry( const wxString& aEntryName, - const wxString& aLibraryName ) +void PART_LIBS::FindLibraryNearEntries( std::vector& aCandidates, + const wxString& aEntryName, + const wxString& aLibraryName ) { BOOST_FOREACH( PART_LIB& lib, *this ) { @@ -921,7 +922,7 @@ LIB_ALIAS* PART_LIBS::FindLibraryNearEntry( const wxString& aEntryName, for( ;; ) { if( entry_name.CmpNoCase( aEntryName ) == 0 ) - return entry; + aCandidates.push_back( entry ); entry = lib.GetNextEntry( entry_name ); entry_name = entry->GetName(); @@ -930,8 +931,6 @@ LIB_ALIAS* PART_LIBS::FindLibraryNearEntry( const wxString& aEntryName, break; } } - - return NULL; } diff --git a/eeschema/class_library.h b/eeschema/class_library.h index c606d64ba9..e7462a809b 100644 --- a/eeschema/class_library.h +++ b/eeschema/class_library.h @@ -217,23 +217,19 @@ public: const wxString& aLibraryName = wxEmptyString ); /** - * Function FindLibraryNearEntry + * Function FindLibraryNearEntries * Searches all libraries in the list for an entry, using a case insensitive comparison. - * Used to find an entry, when the normal (case sensitive) search fails. - * Needed because during a long time, eeschema was using a case insensitive search. - * Therefore, for old schematics (<= 2013), or libs, - * which mixed upper case and lower case entry names, for compatibility reasons, if - * a normal search fails, this case insensitive search can be made. - * Could be also usefull also in some dialogs, when searching parts in libs. - * Remember this is a linear search, therefore slower than the normal binary search + * Helper function used in dialog to find all candidates. + * During a long time, eeschema was using a case insensitive search. + * Therefore, for old schematics (<= 2013), or libs, for some components, + * the chip name (name of alias in lib) can be broken. + * This function can be used to display a list of candidates, in component properties dialog. * - * The object can be either a part or an alias. - * - * @param aEntryName - Name of entry to search for (case insensitive). + * @param aEntryName - Name of entries to search for (case insensitive). * @param aLibraryName - Name of the library to search. - * @return The entry object if found, otherwise NULL. + * @param aCandidates - a std::vector to store candidates */ - LIB_ALIAS* FindLibraryNearEntry( const wxString& aEntryName, + void FindLibraryNearEntries( std::vector& aCandidates, const wxString& aEntryName, const wxString& aLibraryName = wxEmptyString ); /** diff --git a/eeschema/dialogs/dialog_edit_component_in_schematic.cpp b/eeschema/dialogs/dialog_edit_component_in_schematic.cpp index 55d2ef8a16..4a7e637017 100644 --- a/eeschema/dialogs/dialog_edit_component_in_schematic.cpp +++ b/eeschema/dialogs/dialog_edit_component_in_schematic.cpp @@ -39,6 +39,7 @@ #include #include +#include #include #include #include @@ -116,6 +117,8 @@ private: void deleteFieldButtonHandler( wxCommandEvent& event ); void moveUpButtonHandler( wxCommandEvent& event ); void showButtonHandler( wxCommandEvent& event ); + void OnTestChipName( wxCommandEvent& event ); + void OnSelectChipName( wxCommandEvent& event ); SCH_FIELD* findField( const wxString& aFieldName ); @@ -205,6 +208,65 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnListItemDeselected( wxListEvent& even } } +void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnTestChipName( wxCommandEvent& event ) +{ + wxString partname = chipnameTextCtrl->GetValue(); + LIB_PART* entry = Prj().SchLibs()->FindLibPart( partname ); + + wxString msg; + + if( entry ) + { + msg.Printf( _( "Component '%s' found in library '%s'" ), + GetChars( partname ), GetChars( entry->GetLibraryName() ) ); + wxMessageBox( msg ); + return; + } + + msg.Printf( _( "Component '%s' not found in any library" ), GetChars( partname ) ); + +#ifdef KICAD_KEEPCASE + // Try to find components which have a name "near" the current chip name, + // i.e. the same name when the comparison is case insensitive. + // Could be helpful for old designs when lower cases and upper case were + // equivalent. + std::vector candidates; + Prj().SchLibs()->FindLibraryNearEntries( candidates, partname ); + + if( candidates.size() == 0 ) + { + wxMessageBox( msg ); + return; + } + + // Some candidates are found. Show them: + msg << wxT("\n") << _( "However, some candidates are found:" ); + + // add candidate names: + for( unsigned ii = 0; ii < candidates.size(); ii++ ) + { + msg << wxT("\n") << + wxString::Format( _( "'%s' found in library '%s'" ), + GetChars( candidates[ii]->GetName() ), + GetChars( candidates[ii]->GetLibraryName() ) ); + } +#endif + wxMessageBox( msg ); +} + + +void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnSelectChipName( wxCommandEvent& event ) +{ + wxArrayString dummy; + int dummyunit = 1; + wxString chipname = m_Parent->SelectComponentFromLibrary( wxEmptyString, dummy, dummyunit, + true, NULL, NULL ); + if( chipname.IsEmpty() ) + return; + + chipnameTextCtrl->SetValue( chipname ); +} + void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnListItemSelected( wxListEvent& event ) { @@ -222,9 +284,9 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnCloseDialog( wxCloseEvent& event ) // On wxWidgets 2.8, and on Linux, calling EndQuasiModal here is mandatory // Otherwise, the main event loop is never restored, and Eeschema does not // respond to any event, because the DIALOG_SHIM destructor is never called. - // on wxWidgets 3.0, or on Windows, the DIALOG_SHIM destructor is called, + // On wxWidgets 3.0, or on Windows, the DIALOG_SHIM destructor is called, // and calls EndQuasiModal. - // therefore calling EndQuasiModal here is not mandatory but it creates no issues + // therefore calling EndQuasiModal here is not always mandatory but it creates no issues EndQuasiModal( wxID_CANCEL ); } @@ -251,28 +313,9 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions() if( libs->FindLibraryEntry( newname ) == NULL ) { - if( LIB_ALIAS* entry = libs->FindLibraryNearEntry( newname ) ) - { - wxString near_name = entry->GetName(); - wxString msg = wxString::Format( _( - "Component '%s' not found!\n" - "But the component '%s' exists\n" - "Do you want to use it?"), - GetChars( newname ), GetChars( near_name ) ); - - if( IsOK( this, msg ) ) - { - chipnameTextCtrl->SetValue( near_name ); - m_Cmp->SetPartName( near_name, libs ); - } - } - else - { - wxString msg = wxString::Format( _( - "Component '%s' not found!" ), - GetChars( newname ) ); - DisplayError( this, msg ); - } + wxString msg = wxString::Format( _( + "Component '%s' not found!" ), GetChars( newname ) ); + DisplayError( this, msg ); } else // Change component from lib! { diff --git a/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.cpp b/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.cpp index a1e8f219ae..fd3b8f31d0 100644 --- a/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.cpp +++ b/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.cpp @@ -37,19 +37,19 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP( unitsInterchageableText = new wxStaticText( this, wxID_ANY, _("Units are interchangeable:"), wxDefaultPosition, wxDefaultSize, 0 ); unitsInterchageableText->Wrap( -1 ); - bSizerUnitsInterchangeable->Add( unitsInterchageableText, 0, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 5 ); + bSizerUnitsInterchangeable->Add( unitsInterchageableText, 0, wxTOP|wxBOTTOM|wxLEFT, 5 ); unitsInterchageableLabel = new wxStaticText( this, wxID_ANY, _("Yes"), wxDefaultPosition, wxDefaultSize, 0 ); unitsInterchageableLabel->Wrap( -1 ); bSizerUnitsInterchangeable->Add( unitsInterchageableLabel, 0, wxALL, 5 ); - optionsSizer->Add( bSizerUnitsInterchangeable, 1, wxEXPAND, 5 ); + optionsSizer->Add( bSizerUnitsInterchangeable, 0, wxEXPAND, 5 ); wxString orientationRadioBoxChoices[] = { _("0"), _("+90"), _("180"), _("-90") }; int orientationRadioBoxNChoices = sizeof( orientationRadioBoxChoices ) / sizeof( wxString ); orientationRadioBox = new wxRadioBox( this, wxID_ANY, _("Orientation (Degrees)"), wxDefaultPosition, wxDefaultSize, orientationRadioBoxNChoices, orientationRadioBoxChoices, 1, wxRA_SPECIFY_COLS ); - orientationRadioBox->SetSelection( 1 ); + orientationRadioBox->SetSelection( 0 ); orientationRadioBox->SetToolTip( _("Select if the component is to be rotated when drawn") ); optionsSizer->Add( orientationRadioBox, 0, wxEXPAND|wxALL, 5 ); @@ -62,25 +62,34 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP( optionsSizer->Add( mirrorRadioBox, 0, wxALL|wxEXPAND, 5 ); - m_staticTextChipname = new wxStaticText( this, wxID_ANY, _("Chip Name"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextChipname->Wrap( -1 ); - optionsSizer->Add( m_staticTextChipname, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + convertCheckBox = new wxCheckBox( this, wxID_ANY, _("Converted Shape"), wxDefaultPosition, wxDefaultSize, 0 ); + convertCheckBox->SetToolTip( _("Use the alternate shape of this component.\nFor gates, this is the \"De Morgan\" conversion") ); + + optionsSizer->Add( convertCheckBox, 0, wxALL, 5 ); + + wxStaticBoxSizer* sbSizerChipName; + sbSizerChipName = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Chip Name") ), wxVERTICAL ); chipnameTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); chipnameTextCtrl->SetMaxLength( 32 ); chipnameTextCtrl->SetToolTip( _("The name of the symbol in the library from which this component came") ); - optionsSizer->Add( chipnameTextCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + sbSizerChipName->Add( chipnameTextCtrl, 0, wxEXPAND|wxBOTTOM, 5 ); - convertCheckBox = new wxCheckBox( this, wxID_ANY, _("Convert"), wxDefaultPosition, wxDefaultSize, 0 ); - convertCheckBox->SetToolTip( _("Use the alternate shape of this component.\nFor gates, this is the \"De Morgan\" conversion") ); + wxBoxSizer* bSizerChpinameButt; + bSizerChpinameButt = new wxBoxSizer( wxHORIZONTAL ); - optionsSizer->Add( convertCheckBox, 0, wxALL, 5 ); + m_buttonTestChipName = new wxButton( this, wxID_ANY, _("Test"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerChpinameButt->Add( m_buttonTestChipName, 0, wxTOP|wxBOTTOM|wxRIGHT, 5 ); - defaultsButton = new wxButton( this, wxID_ANY, _("Reset to Library Defaults"), wxDefaultPosition, wxDefaultSize, 0 ); - defaultsButton->SetToolTip( _("Set position and style of fields and component orientation to default lib value.\nFields texts are not modified.") ); + m_buttonSelectChipName = new wxButton( this, wxID_ANY, _("Select"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerChpinameButt->Add( m_buttonSelectChipName, 0, wxTOP|wxBOTTOM, 5 ); - optionsSizer->Add( defaultsButton, 0, wxALL|wxEXPAND, 5 ); + + sbSizerChipName->Add( bSizerChpinameButt, 1, wxEXPAND, 5 ); + + + optionsSizer->Add( sbSizerChipName, 0, wxEXPAND|wxALL, 5 ); m_staticTextTimeStamp = new wxStaticText( this, wxID_ANY, _("Timestamp"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextTimeStamp->Wrap( -1 ); @@ -91,6 +100,14 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP( optionsSizer->Add( m_textCtrlTimeStamp, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); + m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + optionsSizer->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 ); + + defaultsButton = new wxButton( this, wxID_ANY, _("Reset to Library Defaults"), wxDefaultPosition, wxDefaultSize, 0 ); + defaultsButton->SetToolTip( _("Set position and style of fields and component orientation to default lib value.\nFields texts are not modified.") ); + + optionsSizer->Add( defaultsButton, 0, wxALL|wxEXPAND, 5 ); + upperSizer->Add( optionsSizer, 0, wxALIGN_TOP|wxEXPAND|wxALL, 5 ); @@ -132,13 +149,13 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP( wxString m_FieldHJustifyCtrlChoices[] = { _("Left"), _("Center"), _("Right") }; int m_FieldHJustifyCtrlNChoices = sizeof( m_FieldHJustifyCtrlChoices ) / sizeof( wxString ); m_FieldHJustifyCtrl = new wxRadioBox( this, wxID_ANY, _("Horiz. Justify"), wxDefaultPosition, wxDefaultSize, m_FieldHJustifyCtrlNChoices, m_FieldHJustifyCtrlChoices, 1, wxRA_SPECIFY_COLS ); - m_FieldHJustifyCtrl->SetSelection( 0 ); + m_FieldHJustifyCtrl->SetSelection( 2 ); bSizerJustification->Add( m_FieldHJustifyCtrl, 1, wxRIGHT|wxLEFT, 5 ); wxString m_FieldVJustifyCtrlChoices[] = { _("Bottom"), _("Center"), _("Top") }; int m_FieldVJustifyCtrlNChoices = sizeof( m_FieldVJustifyCtrlChoices ) / sizeof( wxString ); m_FieldVJustifyCtrl = new wxRadioBox( this, wxID_ANY, _("Vert. Justify"), wxDefaultPosition, wxDefaultSize, m_FieldVJustifyCtrlNChoices, m_FieldVJustifyCtrlChoices, 1, wxRA_SPECIFY_COLS ); - m_FieldVJustifyCtrl->SetSelection( 0 ); + m_FieldVJustifyCtrl->SetSelection( 2 ); bSizerJustification->Add( m_FieldVJustifyCtrl, 1, wxRIGHT|wxLEFT, 5 ); @@ -200,7 +217,7 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP( m_show_datasheet_button = new wxButton( this, wxID_ANY, _("Show in Browser"), wxDefaultPosition, wxDefaultSize, 0 ); m_show_datasheet_button->SetToolTip( _("If your datasheet is an http:// link or a complete file path, then it may show in your browser by pressing this button.") ); - fieldNameBoxSizer->Add( m_show_datasheet_button, 0, wxBOTTOM|wxEXPAND, 5 ); + fieldNameBoxSizer->Add( m_show_datasheet_button, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 ); fieldEditBoxSizer->Add( fieldNameBoxSizer, 0, wxBOTTOM|wxEXPAND, 5 ); @@ -277,10 +294,11 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP( this->SetSizer( mainSizer ); this->Layout(); - mainSizer->Fit( this ); // Connect Events this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnCloseDialog ) ); + m_buttonTestChipName->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnTestChipName ), NULL, this ); + m_buttonSelectChipName->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnSelectChipName ), NULL, this ); defaultsButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::SetInitCmp ), NULL, this ); fieldListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnListItemDeselected ), NULL, this ); fieldListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnListItemSelected ), NULL, this ); @@ -296,6 +314,8 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::~DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP( { // Disconnect Events this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnCloseDialog ) ); + m_buttonTestChipName->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnTestChipName ), NULL, this ); + m_buttonSelectChipName->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnSelectChipName ), NULL, this ); defaultsButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::SetInitCmp ), NULL, this ); fieldListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnListItemDeselected ), NULL, this ); fieldListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnListItemSelected ), NULL, this ); diff --git a/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.fbp b/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.fbp index 35b3857d29..5a64206d3c 100644 --- a/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.fbp +++ b/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.fbp @@ -44,7 +44,7 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP - -1,-1 + 677,586 wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU DIALOG_SHIM; dialog_shim.h Component Properties @@ -288,7 +288,7 @@ 5 wxEXPAND - 1 + 0 bSizerUnitsInterchangeable @@ -296,7 +296,7 @@ none 5 - wxEXPAND|wxTOP|wxBOTTOM|wxLEFT + wxTOP|wxBOTTOM|wxLEFT 0 1 @@ -512,7 +512,7 @@ 1 Resizable - 1 + 0 1 wxRA_SPECIFY_COLS @@ -642,180 +642,6 @@ - - 5 - wxTOP|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Chip Name - - 0 - - - 0 - - 1 - m_staticTextChipname - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - 32 - - 0 - - 1 - chipnameTextCtrl - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - The name of the symbol in the library from which this component came - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 wxALL @@ -849,7 +675,7 @@ 0 0 wxID_ANY - Convert + Converted Shape 0 @@ -904,92 +730,296 @@ - + 5 - wxALL|wxEXPAND + wxEXPAND|wxALL 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 + wxID_ANY - Reset to Library Defaults - - 0 - - - 0 + Chip Name - 1 - defaultsButton - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - Set position and style of fields and component orientation to default lib value. Fields texts are not modified. - - wxFILTER_NONE - wxDefaultValidator - - - - - SetInitCmp - - - - - - - - - - - - - - - - - - - - - - + sbSizerChipName + wxVERTICAL + none + + 5 + wxEXPAND|wxBOTTOM + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 32 + + 0 + + 1 + chipnameTextCtrl + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + The name of the symbol in the library from which this component came + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + + bSizerChpinameButt + wxHORIZONTAL + none + + 5 + wxTOP|wxBOTTOM|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Test + + 0 + + + 0 + + 1 + m_buttonTestChipName + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnTestChipName + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxTOP|wxBOTTOM + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Select + + 0 + + + 0 + + 1 + m_buttonSelectChipName + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnSelectChipName + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1166,6 +1196,175 @@ + + 5 + wxEXPAND | wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_staticline1 + 1 + + + protected + 1 + + Resizable + 1 + + wxLI_HORIZONTAL + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Reset to Library Defaults + + 0 + + + 0 + + 1 + defaultsButton + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Set position and style of fields and component orientation to default lib value. Fields texts are not modified. + + wxFILTER_NONE + wxDefaultValidator + + + + + SetInitCmp + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1631,7 +1830,7 @@ 1 Resizable - 0 + 2 1 wxRA_SPECIFY_COLS @@ -1721,7 +1920,7 @@ 1 Resizable - 0 + 2 1 wxRA_SPECIFY_COLS @@ -2413,7 +2612,7 @@ 5 - wxBOTTOM|wxEXPAND + wxEXPAND|wxTOP|wxBOTTOM 0 1 diff --git a/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.h b/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.h index 86bdd61a07..30b95a85fa 100644 --- a/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.h +++ b/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.h @@ -23,10 +23,11 @@ class DIALOG_SHIM; #include #include #include -#include #include +#include #include #include +#include #include #include @@ -47,12 +48,14 @@ class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP : public DIALOG_SHIM wxStaticText* unitsInterchageableLabel; wxRadioBox* orientationRadioBox; wxRadioBox* mirrorRadioBox; - wxStaticText* m_staticTextChipname; - wxTextCtrl* chipnameTextCtrl; wxCheckBox* convertCheckBox; - wxButton* defaultsButton; + wxTextCtrl* chipnameTextCtrl; + wxButton* m_buttonTestChipName; + wxButton* m_buttonSelectChipName; wxStaticText* m_staticTextTimeStamp; wxTextCtrl* m_textCtrlTimeStamp; + wxStaticLine* m_staticline1; + wxButton* defaultsButton; wxListCtrl* fieldListCtrl; wxButton* addFieldButton; wxButton* deleteFieldButton; @@ -82,6 +85,8 @@ class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP : public DIALOG_SHIM // Virtual event handlers, overide them in your derived class virtual void OnCloseDialog( wxCloseEvent& event ) { event.Skip(); } + virtual void OnTestChipName( wxCommandEvent& event ) { event.Skip(); } + virtual void OnSelectChipName( wxCommandEvent& event ) { event.Skip(); } virtual void SetInitCmp( wxCommandEvent& event ) { event.Skip(); } virtual void OnListItemDeselected( wxListEvent& event ) { event.Skip(); } virtual void OnListItemSelected( wxListEvent& event ) { event.Skip(); } @@ -95,7 +100,7 @@ class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP : public DIALOG_SHIM public: - DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Component Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU ); + DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Component Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 677,586 ), long style = wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU ); ~DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP(); }; diff --git a/eeschema/getpart.cpp b/eeschema/getpart.cpp index e5288c017c..15b321f283 100644 --- a/eeschema/getpart.cpp +++ b/eeschema/getpart.cpp @@ -127,7 +127,7 @@ wxString SCH_BASE_FRAME::SelectComponentFromLibrary( const wxString& aLibname, if( !aHistoryList.empty() ) { - // This is good for a transition for experineced users: giving them a History. Ideally, + // This is good for a transition for experienced users: giving them a History. Ideally, // we actually make this part even faster to access with a popup on ALT-a or something. // the history is under a node named "-- History --" // However, because it is translatable, and we need to have a node name starting by "-- " diff --git a/eeschema/libarch.cpp b/eeschema/libarch.cpp index d7878704c8..03ffd09e52 100644 --- a/eeschema/libarch.cpp +++ b/eeschema/libarch.cpp @@ -87,17 +87,6 @@ bool SCH_EDIT_FRAME::CreateArchiveLibrary( const wxString& aFileName ) // AddPart() does first clone the part before adding. libCache->AddPart( part ); } - else // Search for a part/alias using case insensitive search - { // for compatibility with old versions of schematics - LIB_ALIAS* entry = libs->FindLibraryNearEntry( component->GetPartName() ); - - if( entry && !libCache->FindEntry( entry->GetName() ) ) - { - if( LIB_PART* part = libs->FindLibPart( entry->GetName() ) ) - libCache->AddPart( part ); - } - } - } } } diff --git a/eeschema/sch_component.cpp b/eeschema/sch_component.cpp index 3275d86666..e63913f898 100644 --- a/eeschema/sch_component.cpp +++ b/eeschema/sch_component.cpp @@ -265,22 +265,6 @@ bool SCH_COMPONENT::Resolve( PART_LIBS* aLibs ) return true; } - // the part was not found. try to search with no case comparison - // because during a long time, Eeschema was using upper case only - // for names. - // and we could have loaded an old schematic using upper case only - // and libs using upper+lower case for lib items names - if( LIB_ALIAS* entry = aLibs->FindLibraryNearEntry( m_part_name ) ) - { - // Now find the part (the lib part if we are using an alias) using - // the "near" name - if( LIB_PART* part = aLibs->FindLibPart( entry->GetName() ) ) - { - m_part = part->SharedPtr(); - return true; - } - } - return false; } diff --git a/include/sch_base_frame.h b/include/sch_base_frame.h index 261989c89a..7d09636be2 100644 --- a/include/sch_base_frame.h +++ b/include/sch_base_frame.h @@ -73,23 +73,6 @@ public: void UpdateStatusBar(); // overload EDA_DRAW_FRAME -protected: - - /** - * Function SelectComponentFromLibBrowser - * Calls the library viewer to select component to import into schematic. - * if the library viewer is currently running, it is closed and reopened - * in modal mode. - * @param aPreslectedAlias Preselected component alias. NULL if none. - * @param aUnit Pointer to Unit-number. Input is the pre-selected unit, output - * is the finally selected unit by the user. Can be NULL. - * @param aConvert Pointer to deMorgan conversion. Input is what is pre-selected, - * output is the finally selected deMorgan type by the user. - * @return the component name - */ - wxString SelectComponentFromLibBrowser( LIB_ALIAS* aPreselectedAlias, - int* aUnit, int* aConvert ); - /** * Function SelectComponentFromLib * Calls the library viewer to select component to import into schematic. @@ -112,6 +95,22 @@ protected: int* aUnit, int* aConvert ); +protected: + + /** + * Function SelectComponentFromLibBrowser + * Calls the library viewer to select component to import into schematic. + * if the library viewer is currently running, it is closed and reopened + * in modal mode. + * @param aPreslectedAlias Preselected component alias. NULL if none. + * @param aUnit Pointer to Unit-number. Input is the pre-selected unit, output + * is the finally selected unit by the user. Can be NULL. + * @param aConvert Pointer to deMorgan conversion. Input is what is pre-selected, + * output is the finally selected deMorgan type by the user. + * @return the component name + */ + wxString SelectComponentFromLibBrowser( LIB_ALIAS* aPreselectedAlias, + int* aUnit, int* aConvert ); /** * Function OnOpenLibraryViewer diff --git a/pcbnew/moduleframe.cpp b/pcbnew/moduleframe.cpp index de6a694170..bae419949c 100644 --- a/pcbnew/moduleframe.cpp +++ b/pcbnew/moduleframe.cpp @@ -86,7 +86,6 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME ) EVT_TOOL( ID_MODEDIT_DELETE_PART, FOOTPRINT_EDIT_FRAME::Process_Special_Functions ) EVT_TOOL( ID_MODEDIT_NEW_MODULE, FOOTPRINT_EDIT_FRAME::Process_Special_Functions ) EVT_TOOL( ID_MODEDIT_NEW_MODULE_FROM_WIZARD, FOOTPRINT_EDIT_FRAME::Process_Special_Functions ) - EVT_TOOL( ID_MODEDIT_LOAD_MODULE, FOOTPRINT_EDIT_FRAME::Process_Special_Functions ) EVT_TOOL( ID_MODEDIT_IMPORT_PART, FOOTPRINT_EDIT_FRAME::Process_Special_Functions ) EVT_TOOL( ID_MODEDIT_EXPORT_PART, FOOTPRINT_EDIT_FRAME::Process_Special_Functions ) EVT_TOOL( ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART,