Eeschema impovements.

* Improve schematic label edit dialog.
* Rename SCH_SCREEN::BuildSchCmpLinksToLibCmp() to SCH_SCREEN::CheckComponentsToPartsLinks()
  for improved readability.
This commit is contained in:
Dick Hollenbeck 2015-04-03 16:38:24 -04:00 committed by Wayne Stambaugh
commit 83ecd43754
4 changed files with 44 additions and 13 deletions

View File

@ -38,6 +38,7 @@
#include <drawtxt.h>
#include <confirm.h>
#include <sch_text.h>
#include <typeinfo>
#include <dialog_edit_label_base.h>
@ -50,6 +51,30 @@ class DIALOG_LABEL_EDITOR : public DIALOG_LABEL_EDITOR_BASE
public:
DIALOG_LABEL_EDITOR( SCH_EDIT_FRAME* parent, SCH_TEXT* aTextItem );
void SetTitle( const wxString& aTitle ) // OVERRIDE wxTopLevelWindow::SetTitle
{
// This class is shared for numerous tasks: a couple of
// single line labels and multi-line text fields.
// Often the desired size of the multi-line text field editor
// is larger than is needed for the single line label.
// Therefore the session retained sizes of these dialogs needs
// to be class independent, make them title dependent.
switch( m_CurrentText->Type() )
{
case SCH_GLOBAL_LABEL_T:
case SCH_HIERARCHICAL_LABEL_T:
case SCH_LABEL_T:
// labels can share retained settings probably.
break;
default:
m_hash_key = TO_UTF8( aTitle );
m_hash_key += typeid(*this).name();
}
DIALOG_LABEL_EDITOR_BASE::SetTitle( aTitle );
}
private:
void InitDialog( );
virtual void OnEnterKey( wxCommandEvent& aEvent );

View File

@ -269,7 +269,9 @@ again." );
aScreen->Show( 0, std::cout );
#endif
aScreen->BuildSchCmpLinksToLibCmp(); // Build links between each components and its part lib LIB_PART
// Build links between each components and its part lib LIB_PART
aScreen->CheckComponentsToPartsLinks();
aScreen->TestDanglingEnds();
msgDiag.Printf( _( "Done Loading <%s>" ), GetChars( aScreen->GetFileName() ) );

View File

@ -540,7 +540,8 @@ bool SCH_SCREEN::Save( FILE* aFile ) const
return true;
}
void SCH_SCREEN::BuildSchCmpLinksToLibCmp()
void SCH_SCREEN::CheckComponentsToPartsLinks()
{
// Initialize or reinitialize the pointer to the LIB_PART for each component
// found in m_drawList, but only if needed (change in lib or schematic)
@ -561,12 +562,14 @@ void SCH_SCREEN::BuildSchCmpLinksToLibCmp()
SCH_COMPONENT::ResolveAll( c, libs );
m_modification_sync = mod_hash; // note the last mod_hash
// guard against unneeded runs through this code path by printing trace
DBG(printf("%s: resync-ing %s\n", __func__, TO_UTF8( GetFileName() ) );)
}
}
}
void SCH_SCREEN::Draw( EDA_DRAW_PANEL* aCanvas, wxDC* aDC, GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor )
{
/* note: SCH_SCREEN::Draw is useful only for schematic.
@ -574,7 +577,7 @@ void SCH_SCREEN::Draw( EDA_DRAW_PANEL* aCanvas, wxDC* aDC, GR_DRAWMODE aDrawMode
* their SCH_SCREEN::Draw() draws nothing
*/
BuildSchCmpLinksToLibCmp();
CheckComponentsToPartsLinks();
for( SCH_ITEM* item = m_drawList.begin(); item; item = item->Next() )
{
@ -596,7 +599,7 @@ void SCH_SCREEN::Draw( EDA_DRAW_PANEL* aCanvas, wxDC* aDC, GR_DRAWMODE aDrawMode
*/
void SCH_SCREEN::Plot( PLOTTER* aPlotter )
{
BuildSchCmpLinksToLibCmp();
CheckComponentsToPartsLinks();
for( SCH_ITEM* item = m_drawList.begin(); item; item = item->Next() )
{
@ -1406,7 +1409,7 @@ void SCH_SCREENS::BuildScreenList( EDA_ITEM* aItem )
// up to date (the cost is low if this is the case)
// We do this update here, because most of time this function is called
// to create a netlist, or an ERC, which need this update
screen->BuildSchCmpLinksToLibCmp();
screen->CheckComponentsToPartsLinks();
AddScreenToList( screen );
EDA_ITEM* strct = screen->GetDrawItems();

View File

@ -195,14 +195,15 @@ public:
void Place( SCH_EDIT_FRAME* frame, wxDC* DC ) { };
/**
* Initialize or reinitialize the pointer
* to the LIB_PART for each component found in m_drawList
* must be called:
* in Draw function
* when loading a schematic file
* before creating a netlist (in case a library is modified)
* Function CheckComponentsToPartsLink
* initializes or reinitializes the weak reference
* to the LIB_PART for each SCH_COMPONENT found in m_drawList.
* It must be called from:
* - Draw function
* - when loading a schematic file
* - before creating a netlist (in case a library is modified)
*/
void BuildSchCmpLinksToLibCmp();
void CheckComponentsToPartsLinks();
/**
* Function Draw