Commit 93a3d4cb authored by jean-pierre charras's avatar jean-pierre charras

Eeschema: back to KICAD_KEEPCASE option, to find parts in lib, when using case...

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.
parent 0cf334a0
...@@ -26,6 +26,19 @@ set( CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules ) ...@@ -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 ) #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. 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 option( USE_WX_GRAPHICS_CONTEXT
"Use wxGraphicsContext for rendering ( default OFF). Warning, this is experimental" ) "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" ) ...@@ -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" ) 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 ) if( USE_WX_OVERLAY OR APPLE )
add_definitions( -DUSE_WX_OVERLAY ) add_definitions( -DUSE_WX_OVERLAY )
endif() endif()
......
...@@ -46,11 +46,11 @@ class LIB_FIELD; ...@@ -46,11 +46,11 @@ class LIB_FIELD;
/// Compiler controlled string compare function, either case independent or not: /// Compiler controlled string compare function, either case independent or not:
inline int Cmp_KEEPCASE( const wxString& aString1, const wxString& aString2 ) inline int Cmp_KEEPCASE( const wxString& aString1, const wxString& aString2 )
{ {
#if 1 #ifdef KICAD_KEEPCASE
// case specificity: // case specificity, the normal behavior:
return aString1.Cmp( aString2 ); return aString1.Cmp( aString2 );
#else #else
// case independence (no more in use) // case independence (only for guys who want that: not recommended)
return aString1.CmpNoCase( aString2 ); return aString1.CmpNoCase( aString2 );
#endif #endif
} }
......
...@@ -902,7 +902,8 @@ LIB_ALIAS* PART_LIBS::FindLibraryEntry( const wxString& aName, const wxString& a ...@@ -902,7 +902,8 @@ 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. /* 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. * Used to find an entry, when the normal (case sensitive) search fails.
*/ */
LIB_ALIAS* PART_LIBS::FindLibraryNearEntry( const wxString& aEntryName, void PART_LIBS::FindLibraryNearEntries( std::vector<LIB_ALIAS*>& aCandidates,
const wxString& aEntryName,
const wxString& aLibraryName ) const wxString& aLibraryName )
{ {
BOOST_FOREACH( PART_LIB& lib, *this ) BOOST_FOREACH( PART_LIB& lib, *this )
...@@ -921,7 +922,7 @@ LIB_ALIAS* PART_LIBS::FindLibraryNearEntry( const wxString& aEntryName, ...@@ -921,7 +922,7 @@ LIB_ALIAS* PART_LIBS::FindLibraryNearEntry( const wxString& aEntryName,
for( ;; ) for( ;; )
{ {
if( entry_name.CmpNoCase( aEntryName ) == 0 ) if( entry_name.CmpNoCase( aEntryName ) == 0 )
return entry; aCandidates.push_back( entry );
entry = lib.GetNextEntry( entry_name ); entry = lib.GetNextEntry( entry_name );
entry_name = entry->GetName(); entry_name = entry->GetName();
...@@ -930,8 +931,6 @@ LIB_ALIAS* PART_LIBS::FindLibraryNearEntry( const wxString& aEntryName, ...@@ -930,8 +931,6 @@ LIB_ALIAS* PART_LIBS::FindLibraryNearEntry( const wxString& aEntryName,
break; break;
} }
} }
return NULL;
} }
......
...@@ -217,23 +217,19 @@ public: ...@@ -217,23 +217,19 @@ public:
const wxString& aLibraryName = wxEmptyString ); const wxString& aLibraryName = wxEmptyString );
/** /**
* Function FindLibraryNearEntry * Function FindLibraryNearEntries
* Searches all libraries in the list for an entry, using a case insensitive comparison. * 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. * Helper function used in dialog to find all candidates.
* Needed because during a long time, eeschema was using a case insensitive search. * During a long time, eeschema was using a case insensitive search.
* Therefore, for old schematics (<= 2013), or libs, * Therefore, for old schematics (<= 2013), or libs, for some components,
* which mixed upper case and lower case entry names, for compatibility reasons, if * the chip name (name of alias in lib) can be broken.
* a normal search fails, this case insensitive search can be made. * This function can be used to display a list of candidates, in component properties dialog.
* 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
* *
* The object can be either a part or an alias. * @param aEntryName - Name of entries to search for (case insensitive).
*
* @param aEntryName - Name of entry to search for (case insensitive).
* @param aLibraryName - Name of the library to search. * @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<LIB_ALIAS*>& aCandidates, const wxString& aEntryName,
const wxString& aLibraryName = wxEmptyString ); const wxString& aLibraryName = wxEmptyString );
/** /**
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include <base_units.h> #include <base_units.h>
#include <general.h> #include <general.h>
#include <sch_base_frame.h>
#include <class_library.h> #include <class_library.h>
#include <sch_component.h> #include <sch_component.h>
#include <dialog_helpers.h> #include <dialog_helpers.h>
...@@ -116,6 +117,8 @@ private: ...@@ -116,6 +117,8 @@ private:
void deleteFieldButtonHandler( wxCommandEvent& event ); void deleteFieldButtonHandler( wxCommandEvent& event );
void moveUpButtonHandler( wxCommandEvent& event ); void moveUpButtonHandler( wxCommandEvent& event );
void showButtonHandler( wxCommandEvent& event ); void showButtonHandler( wxCommandEvent& event );
void OnTestChipName( wxCommandEvent& event );
void OnSelectChipName( wxCommandEvent& event );
SCH_FIELD* findField( const wxString& aFieldName ); SCH_FIELD* findField( const wxString& aFieldName );
...@@ -205,6 +208,65 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnListItemDeselected( wxListEvent& even ...@@ -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<LIB_ALIAS*> 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 ) void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnListItemSelected( wxListEvent& event )
{ {
...@@ -222,9 +284,9 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnCloseDialog( wxCloseEvent& 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 // On wxWidgets 2.8, and on Linux, calling EndQuasiModal here is mandatory
// Otherwise, the main event loop is never restored, and Eeschema does not // Otherwise, the main event loop is never restored, and Eeschema does not
// respond to any event, because the DIALOG_SHIM destructor is never called. // 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. // 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 ); EndQuasiModal( wxID_CANCEL );
} }
...@@ -251,29 +313,10 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions() ...@@ -251,29 +313,10 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions()
if( libs->FindLibraryEntry( newname ) == NULL ) if( libs->FindLibraryEntry( newname ) == NULL )
{ {
if( LIB_ALIAS* entry = libs->FindLibraryNearEntry( newname ) )
{
wxString near_name = entry->GetName();
wxString msg = wxString::Format( _( wxString msg = wxString::Format( _(
"Component '%s' not found!\n" "Component '%s' not found!" ), GetChars( newname ) );
"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 ); DisplayError( this, msg );
} }
}
else // Change component from lib! else // Change component from lib!
{ {
m_Cmp->SetPartName( newname, libs ); m_Cmp->SetPartName( newname, libs );
......
...@@ -37,19 +37,19 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP( ...@@ -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 = new wxStaticText( this, wxID_ANY, _("Units are interchangeable:"), wxDefaultPosition, wxDefaultSize, 0 );
unitsInterchageableText->Wrap( -1 ); 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 = new wxStaticText( this, wxID_ANY, _("Yes"), wxDefaultPosition, wxDefaultSize, 0 );
unitsInterchageableLabel->Wrap( -1 ); unitsInterchageableLabel->Wrap( -1 );
bSizerUnitsInterchangeable->Add( unitsInterchageableLabel, 0, wxALL, 5 ); bSizerUnitsInterchangeable->Add( unitsInterchageableLabel, 0, wxALL, 5 );
optionsSizer->Add( bSizerUnitsInterchangeable, 1, wxEXPAND, 5 ); optionsSizer->Add( bSizerUnitsInterchangeable, 0, wxEXPAND, 5 );
wxString orientationRadioBoxChoices[] = { _("0"), _("+90"), _("180"), _("-90") }; wxString orientationRadioBoxChoices[] = { _("0"), _("+90"), _("180"), _("-90") };
int orientationRadioBoxNChoices = sizeof( orientationRadioBoxChoices ) / sizeof( wxString ); int orientationRadioBoxNChoices = sizeof( orientationRadioBoxChoices ) / sizeof( wxString );
orientationRadioBox = new wxRadioBox( this, wxID_ANY, _("Orientation (Degrees)"), wxDefaultPosition, wxDefaultSize, orientationRadioBoxNChoices, orientationRadioBoxChoices, 1, wxRA_SPECIFY_COLS ); 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") ); orientationRadioBox->SetToolTip( _("Select if the component is to be rotated when drawn") );
optionsSizer->Add( orientationRadioBox, 0, wxEXPAND|wxALL, 5 ); optionsSizer->Add( orientationRadioBox, 0, wxEXPAND|wxALL, 5 );
...@@ -62,25 +62,34 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP( ...@@ -62,25 +62,34 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP(
optionsSizer->Add( mirrorRadioBox, 0, wxALL|wxEXPAND, 5 ); optionsSizer->Add( mirrorRadioBox, 0, wxALL|wxEXPAND, 5 );
m_staticTextChipname = new wxStaticText( this, wxID_ANY, _("Chip Name"), wxDefaultPosition, wxDefaultSize, 0 ); convertCheckBox = new wxCheckBox( this, wxID_ANY, _("Converted Shape"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextChipname->Wrap( -1 ); convertCheckBox->SetToolTip( _("Use the alternate shape of this component.\nFor gates, this is the \"De Morgan\" conversion") );
optionsSizer->Add( m_staticTextChipname, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
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 = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
chipnameTextCtrl->SetMaxLength( 32 ); chipnameTextCtrl->SetMaxLength( 32 );
chipnameTextCtrl->SetToolTip( _("The name of the symbol in the library from which this component came") ); 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 ); wxBoxSizer* bSizerChpinameButt;
convertCheckBox->SetToolTip( _("Use the alternate shape of this component.\nFor gates, this is the \"De Morgan\" conversion") ); 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 ); m_buttonSelectChipName = new wxButton( this, wxID_ANY, _("Select"), wxDefaultPosition, wxDefaultSize, 0 );
defaultsButton->SetToolTip( _("Set position and style of fields and component orientation to default lib value.\nFields texts are not modified.") ); 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 = new wxStaticText( this, wxID_ANY, _("Timestamp"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextTimeStamp->Wrap( -1 ); m_staticTextTimeStamp->Wrap( -1 );
...@@ -91,6 +100,14 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP( ...@@ -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 ); 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 ); 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( ...@@ -132,13 +149,13 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP(
wxString m_FieldHJustifyCtrlChoices[] = { _("Left"), _("Center"), _("Right") }; wxString m_FieldHJustifyCtrlChoices[] = { _("Left"), _("Center"), _("Right") };
int m_FieldHJustifyCtrlNChoices = sizeof( m_FieldHJustifyCtrlChoices ) / sizeof( wxString ); 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 = 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 ); bSizerJustification->Add( m_FieldHJustifyCtrl, 1, wxRIGHT|wxLEFT, 5 );
wxString m_FieldVJustifyCtrlChoices[] = { _("Bottom"), _("Center"), _("Top") }; wxString m_FieldVJustifyCtrlChoices[] = { _("Bottom"), _("Center"), _("Top") };
int m_FieldVJustifyCtrlNChoices = sizeof( m_FieldVJustifyCtrlChoices ) / sizeof( wxString ); 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 = 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 ); bSizerJustification->Add( m_FieldVJustifyCtrl, 1, wxRIGHT|wxLEFT, 5 );
...@@ -200,7 +217,7 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP( ...@@ -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 = 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.") ); 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 ); fieldEditBoxSizer->Add( fieldNameBoxSizer, 0, wxBOTTOM|wxEXPAND, 5 );
...@@ -277,10 +294,11 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP( ...@@ -277,10 +294,11 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP(
this->SetSizer( mainSizer ); this->SetSizer( mainSizer );
this->Layout(); this->Layout();
mainSizer->Fit( this );
// Connect Events // Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnCloseDialog ) ); 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 ); 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_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 ); 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( ...@@ -296,6 +314,8 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::~DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP(
{ {
// Disconnect Events // Disconnect Events
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnCloseDialog ) ); 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 ); 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_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 ); fieldListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnListItemSelected ), NULL, this );
......
...@@ -23,10 +23,11 @@ class DIALOG_SHIM; ...@@ -23,10 +23,11 @@ class DIALOG_SHIM;
#include <wx/choice.h> #include <wx/choice.h>
#include <wx/sizer.h> #include <wx/sizer.h>
#include <wx/radiobox.h> #include <wx/radiobox.h>
#include <wx/textctrl.h>
#include <wx/checkbox.h> #include <wx/checkbox.h>
#include <wx/textctrl.h>
#include <wx/button.h> #include <wx/button.h>
#include <wx/statbox.h> #include <wx/statbox.h>
#include <wx/statline.h>
#include <wx/listctrl.h> #include <wx/listctrl.h>
#include <wx/dialog.h> #include <wx/dialog.h>
...@@ -47,12 +48,14 @@ class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP : public DIALOG_SHIM ...@@ -47,12 +48,14 @@ class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP : public DIALOG_SHIM
wxStaticText* unitsInterchageableLabel; wxStaticText* unitsInterchageableLabel;
wxRadioBox* orientationRadioBox; wxRadioBox* orientationRadioBox;
wxRadioBox* mirrorRadioBox; wxRadioBox* mirrorRadioBox;
wxStaticText* m_staticTextChipname;
wxTextCtrl* chipnameTextCtrl;
wxCheckBox* convertCheckBox; wxCheckBox* convertCheckBox;
wxButton* defaultsButton; wxTextCtrl* chipnameTextCtrl;
wxButton* m_buttonTestChipName;
wxButton* m_buttonSelectChipName;
wxStaticText* m_staticTextTimeStamp; wxStaticText* m_staticTextTimeStamp;
wxTextCtrl* m_textCtrlTimeStamp; wxTextCtrl* m_textCtrlTimeStamp;
wxStaticLine* m_staticline1;
wxButton* defaultsButton;
wxListCtrl* fieldListCtrl; wxListCtrl* fieldListCtrl;
wxButton* addFieldButton; wxButton* addFieldButton;
wxButton* deleteFieldButton; wxButton* deleteFieldButton;
...@@ -82,6 +85,8 @@ class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP : public DIALOG_SHIM ...@@ -82,6 +85,8 @@ class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP : public DIALOG_SHIM
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class
virtual void OnCloseDialog( wxCloseEvent& event ) { event.Skip(); } 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 SetInitCmp( wxCommandEvent& event ) { event.Skip(); }
virtual void OnListItemDeselected( wxListEvent& event ) { event.Skip(); } virtual void OnListItemDeselected( wxListEvent& event ) { event.Skip(); }
virtual void OnListItemSelected( 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 ...@@ -95,7 +100,7 @@ class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP : public DIALOG_SHIM
public: 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(); ~DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP();
}; };
......
...@@ -127,7 +127,7 @@ wxString SCH_BASE_FRAME::SelectComponentFromLibrary( const wxString& aLibname, ...@@ -127,7 +127,7 @@ wxString SCH_BASE_FRAME::SelectComponentFromLibrary( const wxString& aLibname,
if( !aHistoryList.empty() ) 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. // 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 --" // the history is under a node named "-- History --"
// However, because it is translatable, and we need to have a node name starting by "-- " // However, because it is translatable, and we need to have a node name starting by "-- "
......
...@@ -87,17 +87,6 @@ bool SCH_EDIT_FRAME::CreateArchiveLibrary( const wxString& aFileName ) ...@@ -87,17 +87,6 @@ bool SCH_EDIT_FRAME::CreateArchiveLibrary( const wxString& aFileName )
// AddPart() does first clone the part before adding. // AddPart() does first clone the part before adding.
libCache->AddPart( part ); 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 );
}
}
} }
} }
} }
......
...@@ -265,22 +265,6 @@ bool SCH_COMPONENT::Resolve( PART_LIBS* aLibs ) ...@@ -265,22 +265,6 @@ bool SCH_COMPONENT::Resolve( PART_LIBS* aLibs )
return true; 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; return false;
} }
......
...@@ -73,23 +73,6 @@ public: ...@@ -73,23 +73,6 @@ public:
void UpdateStatusBar(); // overload EDA_DRAW_FRAME 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 * Function SelectComponentFromLib
* Calls the library viewer to select component to import into schematic. * Calls the library viewer to select component to import into schematic.
...@@ -112,6 +95,22 @@ protected: ...@@ -112,6 +95,22 @@ protected:
int* aUnit, int* aUnit,
int* aConvert ); 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 * Function OnOpenLibraryViewer
......
...@@ -86,7 +86,6 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME ) ...@@ -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_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, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_NEW_MODULE_FROM_WIZARD, 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_IMPORT_PART, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_EXPORT_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, EVT_TOOL( ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment