Commit 83ecd437 authored by Dick Hollenbeck's avatar Dick Hollenbeck Committed by Wayne Stambaugh

Eeschema impovements.

* Improve schematic label edit dialog.
* Rename SCH_SCREEN::BuildSchCmpLinksToLibCmp() to SCH_SCREEN::CheckComponentsToPartsLinks()
  for improved readability.
parents cbf487c5 9dce5b6a
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include <drawtxt.h> #include <drawtxt.h>
#include <confirm.h> #include <confirm.h>
#include <sch_text.h> #include <sch_text.h>
#include <typeinfo>
#include <dialog_edit_label_base.h> #include <dialog_edit_label_base.h>
...@@ -50,6 +51,30 @@ class DIALOG_LABEL_EDITOR : public DIALOG_LABEL_EDITOR_BASE ...@@ -50,6 +51,30 @@ class DIALOG_LABEL_EDITOR : public DIALOG_LABEL_EDITOR_BASE
public: public:
DIALOG_LABEL_EDITOR( SCH_EDIT_FRAME* parent, SCH_TEXT* aTextItem ); 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: private:
void InitDialog( ); void InitDialog( );
virtual void OnEnterKey( wxCommandEvent& aEvent ); virtual void OnEnterKey( wxCommandEvent& aEvent );
......
...@@ -269,7 +269,9 @@ again." ); ...@@ -269,7 +269,9 @@ again." );
aScreen->Show( 0, std::cout ); aScreen->Show( 0, std::cout );
#endif #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(); aScreen->TestDanglingEnds();
msgDiag.Printf( _( "Done Loading <%s>" ), GetChars( aScreen->GetFileName() ) ); msgDiag.Printf( _( "Done Loading <%s>" ), GetChars( aScreen->GetFileName() ) );
......
...@@ -540,7 +540,8 @@ bool SCH_SCREEN::Save( FILE* aFile ) const ...@@ -540,7 +540,8 @@ bool SCH_SCREEN::Save( FILE* aFile ) const
return true; return true;
} }
void SCH_SCREEN::BuildSchCmpLinksToLibCmp()
void SCH_SCREEN::CheckComponentsToPartsLinks()
{ {
// Initialize or reinitialize the pointer to the LIB_PART for each component // 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) // found in m_drawList, but only if needed (change in lib or schematic)
...@@ -561,12 +562,14 @@ void SCH_SCREEN::BuildSchCmpLinksToLibCmp() ...@@ -561,12 +562,14 @@ void SCH_SCREEN::BuildSchCmpLinksToLibCmp()
SCH_COMPONENT::ResolveAll( c, libs ); SCH_COMPONENT::ResolveAll( c, libs );
m_modification_sync = mod_hash; // note the last mod_hash 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 ) 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. /* 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 ...@@ -574,7 +577,7 @@ void SCH_SCREEN::Draw( EDA_DRAW_PANEL* aCanvas, wxDC* aDC, GR_DRAWMODE aDrawMode
* their SCH_SCREEN::Draw() draws nothing * their SCH_SCREEN::Draw() draws nothing
*/ */
BuildSchCmpLinksToLibCmp(); CheckComponentsToPartsLinks();
for( SCH_ITEM* item = m_drawList.begin(); item; item = item->Next() ) 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 ...@@ -596,7 +599,7 @@ void SCH_SCREEN::Draw( EDA_DRAW_PANEL* aCanvas, wxDC* aDC, GR_DRAWMODE aDrawMode
*/ */
void SCH_SCREEN::Plot( PLOTTER* aPlotter ) void SCH_SCREEN::Plot( PLOTTER* aPlotter )
{ {
BuildSchCmpLinksToLibCmp(); CheckComponentsToPartsLinks();
for( SCH_ITEM* item = m_drawList.begin(); item; item = item->Next() ) for( SCH_ITEM* item = m_drawList.begin(); item; item = item->Next() )
{ {
...@@ -1406,7 +1409,7 @@ void SCH_SCREENS::BuildScreenList( EDA_ITEM* aItem ) ...@@ -1406,7 +1409,7 @@ void SCH_SCREENS::BuildScreenList( EDA_ITEM* aItem )
// up to date (the cost is low if this is the case) // 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 // We do this update here, because most of time this function is called
// to create a netlist, or an ERC, which need this update // to create a netlist, or an ERC, which need this update
screen->BuildSchCmpLinksToLibCmp(); screen->CheckComponentsToPartsLinks();
AddScreenToList( screen ); AddScreenToList( screen );
EDA_ITEM* strct = screen->GetDrawItems(); EDA_ITEM* strct = screen->GetDrawItems();
......
...@@ -195,14 +195,15 @@ public: ...@@ -195,14 +195,15 @@ public:
void Place( SCH_EDIT_FRAME* frame, wxDC* DC ) { }; void Place( SCH_EDIT_FRAME* frame, wxDC* DC ) { };
/** /**
* Initialize or reinitialize the pointer * Function CheckComponentsToPartsLink
* to the LIB_PART for each component found in m_drawList * initializes or reinitializes the weak reference
* must be called: * to the LIB_PART for each SCH_COMPONENT found in m_drawList.
* in Draw function * It must be called from:
* when loading a schematic file * - Draw function
* before creating a netlist (in case a library is modified) * - when loading a schematic file
*/ * - before creating a netlist (in case a library is modified)
void BuildSchCmpLinksToLibCmp(); */
void CheckComponentsToPartsLinks();
/** /**
* Function Draw * Function Draw
......
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