Loading eeschema/dialogs/dialog_lib_edit_pin.cpp +7 −3 Original line number Original line Diff line number Diff line Loading @@ -15,10 +15,13 @@ wxSize DIALOG_LIB_EDIT_PIN::s_LastSize; DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN( wxWindow* parent, LIB_PIN* aPin ) : DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN( wxWindow* parent, LIB_PIN* aPin ) : DIALOG_LIB_EDIT_PIN_BASE( parent ) DIALOG_LIB_EDIT_PIN_BASE( parent ) { { // Creates a dummy pin to show on a panel, insside this dialog: m_dummyPin = new LIB_PIN( *aPin ); m_dummyPin = new LIB_PIN( *aPin ); // m_dummyPin changes do not proparagte to a parent, so set parent to null // m_dummyPin changes do not proparagte to other pins of the current lib component, // so set parent to null and clear flags m_dummyPin->SetParent( NULL ); m_dummyPin->SetParent( NULL ); m_dummyPin->ClearFlags(); m_panelShowPin->SetBackgroundColour( MakeColour( g_DrawBgColor ) ); m_panelShowPin->SetBackgroundColour( MakeColour( g_DrawBgColor ) ); Loading Loading @@ -60,7 +63,7 @@ void DIALOG_LIB_EDIT_PIN::OnPaintShowPanel( wxPaintEvent& event ) // Give a parent to m_dummyPin only from draw purpose. // Give a parent to m_dummyPin only from draw purpose. // In fact m_dummyPin should not have a parent, but draw functions need a parent // In fact m_dummyPin should not have a parent, but draw functions need a parent // to know some options // to know some options, about pin texts LIB_EDIT_FRAME* libframe = (LIB_EDIT_FRAME*) GetParent(); LIB_EDIT_FRAME* libframe = (LIB_EDIT_FRAME*) GetParent(); m_dummyPin->SetParent( libframe->GetComponent() ); m_dummyPin->SetParent( libframe->GetComponent() ); Loading @@ -79,7 +82,6 @@ void DIALOG_LIB_EDIT_PIN::OnPaintShowPanel( wxPaintEvent& event ) NEGATE( offset.y ); NEGATE( offset.y ); GRResetPenAndBrush( &dc ); GRResetPenAndBrush( &dc ); m_dummyPin->SetVisible( true ); // TODO find a better way to show invisible pin here m_dummyPin->Draw( NULL, &dc, offset, -1, wxCOPY, m_dummyPin->Draw( NULL, &dc, offset, -1, wxCOPY, NULL, DefaultTransform ); NULL, DefaultTransform ); Loading Loading @@ -115,6 +117,8 @@ void DIALOG_LIB_EDIT_PIN::OnOKButtonClick( wxCommandEvent& event ) // Called when a pin properties changes // Called when a pin properties changes void DIALOG_LIB_EDIT_PIN::OnPropertiesChange( wxCommandEvent& event ) void DIALOG_LIB_EDIT_PIN::OnPropertiesChange( wxCommandEvent& event ) { { if( ! IsShown() ) // do nothing at init time return; int units = ((LIB_EDIT_FRAME*)GetParent())->m_InternalUnits; int units = ((LIB_EDIT_FRAME*)GetParent())->m_InternalUnits; int pinNameSize = ReturnValueFromString( g_UserUnit, GetNameTextSize(), units ); int pinNameSize = ReturnValueFromString( g_UserUnit, GetNameTextSize(), units ); int pinNumSize = ReturnValueFromString( g_UserUnit, GetPadNameTextSize(), units); int pinNumSize = ReturnValueFromString( g_UserUnit, GetPadNameTextSize(), units); Loading eeschema/lib_pin.cpp +21 −17 Original line number Original line Diff line number Diff line Loading @@ -470,9 +470,9 @@ void LIB_PIN::SetVisible( bool visible ) return; return; if( visible ) if( visible ) m_attributes &= ~PINNOTDRAW; m_attributes &= ~PIN_INVISIBLE; else else m_attributes |= PINNOTDRAW; m_attributes |= PIN_INVISIBLE; SetModified(); SetModified(); Loading @@ -488,9 +488,9 @@ void LIB_PIN::SetVisible( bool visible ) continue; continue; if( visible ) if( visible ) pinList[i]->m_attributes &= ~PINNOTDRAW; pinList[i]->m_attributes &= ~PIN_INVISIBLE; else else pinList[i]->m_attributes |= PINNOTDRAW; pinList[i]->m_attributes |= PIN_INVISIBLE; SetModified(); SetModified(); } } Loading Loading @@ -619,13 +619,12 @@ bool LIB_PIN::Save( FILE* ExportFile ) m_Unit, m_Convert, Etype ) < 0 ) m_Unit, m_Convert, Etype ) < 0 ) return false; return false; if( ( m_shape ) || ( m_attributes & PINNOTDRAW ) ) if( m_shape || !IsVisible() ) { { if( fprintf( ExportFile, " " ) < 0 ) if( fprintf( ExportFile, " " ) < 0 ) return false; return false; } } if( m_attributes & PINNOTDRAW if( !IsVisible() && fprintf( ExportFile, "N" ) < 0 ) && fprintf( ExportFile, "N" ) < 0 ) return false; return false; if( m_shape & INVERT if( m_shape & INVERT && fprintf( ExportFile, "I" ) < 0 ) && fprintf( ExportFile, "I" ) < 0 ) Loading Loading @@ -741,7 +740,7 @@ bool LIB_PIN::Load( char* line, wxString& errorMsg ) break; break; case 'N': case 'N': m_attributes |= PINNOTDRAW; m_attributes |= PIN_INVISIBLE; break; break; case 'I': case 'I': Loading Loading @@ -797,16 +796,21 @@ void LIB_PIN::drawGraphic( EDA_DRAW_PANEL* aPanel, void* aData, void* aData, const TRANSFORM& aTransform ) const TRANSFORM& aTransform ) { { // Invisible pins are only drawn on request. In libedit they are drawn // Invisible pins are only drawn on request. // in g_InvisibleItemColor because we must see them. // They are drawn in g_InvisibleItemColor. SCH_EDIT_FRAME* frame = (SCH_EDIT_FRAME*) wxGetApp().GetTopWindow(); // in schematic, they are drawn only if m_ShowAllPins is true. // In other windows, they are always drawn because we must see them. if( m_attributes & PINNOTDRAW ) if( ! IsVisible() ) { { if( frame->m_LibeditFrame && frame->m_LibeditFrame->IsActive() ) EDA_DRAW_FRAME* frame = NULL; aColor = g_InvisibleItemColor; if( aPanel && aPanel->GetParent() ) else if( !frame->m_ShowAllPins ) frame = (EDA_DRAW_FRAME*)aPanel->GetParent(); if( frame && frame->m_Ident == SCHEMATIC_FRAME && ! ((SCH_EDIT_FRAME*)frame)->m_ShowAllPins ) return; return; aColor = g_InvisibleItemColor; } } LIB_COMPONENT* Entry = GetParent(); LIB_COMPONENT* Entry = GetParent(); Loading Loading @@ -1673,7 +1677,7 @@ void LIB_PIN::DoMirrorHorizontal( const wxPoint& center ) void LIB_PIN::DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill, void LIB_PIN::DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill, const TRANSFORM& aTransform ) const TRANSFORM& aTransform ) { { if( m_attributes & PINNOTDRAW ) if( ! IsVisible() ) return; return; int orient = ReturnPinDrawOrient( aTransform ); int orient = ReturnPinDrawOrient( aTransform ); Loading eeschema/lib_pin.h +2 −2 Original line number Original line Diff line number Diff line Loading @@ -52,7 +52,7 @@ enum ElectricPinType { extern const wxChar* MsgPinElectricType[]; extern const wxChar* MsgPinElectricType[]; /* Pin visibility flag bit. */ /* Pin visibility flag bit. */ #define PINNOTDRAW 1 /* Set makes pin invisible */ #define PIN_INVISIBLE 1 /* Set makes pin invisible */ /** /** Loading Loading @@ -350,7 +350,7 @@ public: * * * @return True if draw object is visible otherwise false. * @return True if draw object is visible otherwise false. */ */ bool IsVisible() { return ( m_attributes & PINNOTDRAW ) == 0; } bool IsVisible() { return ( m_attributes & PIN_INVISIBLE ) == 0; } /** /** * @return the size of the "pen" that be used to draw or plot this item. * @return the size of the "pen" that be used to draw or plot this item. Loading Loading
eeschema/dialogs/dialog_lib_edit_pin.cpp +7 −3 Original line number Original line Diff line number Diff line Loading @@ -15,10 +15,13 @@ wxSize DIALOG_LIB_EDIT_PIN::s_LastSize; DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN( wxWindow* parent, LIB_PIN* aPin ) : DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN( wxWindow* parent, LIB_PIN* aPin ) : DIALOG_LIB_EDIT_PIN_BASE( parent ) DIALOG_LIB_EDIT_PIN_BASE( parent ) { { // Creates a dummy pin to show on a panel, insside this dialog: m_dummyPin = new LIB_PIN( *aPin ); m_dummyPin = new LIB_PIN( *aPin ); // m_dummyPin changes do not proparagte to a parent, so set parent to null // m_dummyPin changes do not proparagte to other pins of the current lib component, // so set parent to null and clear flags m_dummyPin->SetParent( NULL ); m_dummyPin->SetParent( NULL ); m_dummyPin->ClearFlags(); m_panelShowPin->SetBackgroundColour( MakeColour( g_DrawBgColor ) ); m_panelShowPin->SetBackgroundColour( MakeColour( g_DrawBgColor ) ); Loading Loading @@ -60,7 +63,7 @@ void DIALOG_LIB_EDIT_PIN::OnPaintShowPanel( wxPaintEvent& event ) // Give a parent to m_dummyPin only from draw purpose. // Give a parent to m_dummyPin only from draw purpose. // In fact m_dummyPin should not have a parent, but draw functions need a parent // In fact m_dummyPin should not have a parent, but draw functions need a parent // to know some options // to know some options, about pin texts LIB_EDIT_FRAME* libframe = (LIB_EDIT_FRAME*) GetParent(); LIB_EDIT_FRAME* libframe = (LIB_EDIT_FRAME*) GetParent(); m_dummyPin->SetParent( libframe->GetComponent() ); m_dummyPin->SetParent( libframe->GetComponent() ); Loading @@ -79,7 +82,6 @@ void DIALOG_LIB_EDIT_PIN::OnPaintShowPanel( wxPaintEvent& event ) NEGATE( offset.y ); NEGATE( offset.y ); GRResetPenAndBrush( &dc ); GRResetPenAndBrush( &dc ); m_dummyPin->SetVisible( true ); // TODO find a better way to show invisible pin here m_dummyPin->Draw( NULL, &dc, offset, -1, wxCOPY, m_dummyPin->Draw( NULL, &dc, offset, -1, wxCOPY, NULL, DefaultTransform ); NULL, DefaultTransform ); Loading Loading @@ -115,6 +117,8 @@ void DIALOG_LIB_EDIT_PIN::OnOKButtonClick( wxCommandEvent& event ) // Called when a pin properties changes // Called when a pin properties changes void DIALOG_LIB_EDIT_PIN::OnPropertiesChange( wxCommandEvent& event ) void DIALOG_LIB_EDIT_PIN::OnPropertiesChange( wxCommandEvent& event ) { { if( ! IsShown() ) // do nothing at init time return; int units = ((LIB_EDIT_FRAME*)GetParent())->m_InternalUnits; int units = ((LIB_EDIT_FRAME*)GetParent())->m_InternalUnits; int pinNameSize = ReturnValueFromString( g_UserUnit, GetNameTextSize(), units ); int pinNameSize = ReturnValueFromString( g_UserUnit, GetNameTextSize(), units ); int pinNumSize = ReturnValueFromString( g_UserUnit, GetPadNameTextSize(), units); int pinNumSize = ReturnValueFromString( g_UserUnit, GetPadNameTextSize(), units); Loading
eeschema/lib_pin.cpp +21 −17 Original line number Original line Diff line number Diff line Loading @@ -470,9 +470,9 @@ void LIB_PIN::SetVisible( bool visible ) return; return; if( visible ) if( visible ) m_attributes &= ~PINNOTDRAW; m_attributes &= ~PIN_INVISIBLE; else else m_attributes |= PINNOTDRAW; m_attributes |= PIN_INVISIBLE; SetModified(); SetModified(); Loading @@ -488,9 +488,9 @@ void LIB_PIN::SetVisible( bool visible ) continue; continue; if( visible ) if( visible ) pinList[i]->m_attributes &= ~PINNOTDRAW; pinList[i]->m_attributes &= ~PIN_INVISIBLE; else else pinList[i]->m_attributes |= PINNOTDRAW; pinList[i]->m_attributes |= PIN_INVISIBLE; SetModified(); SetModified(); } } Loading Loading @@ -619,13 +619,12 @@ bool LIB_PIN::Save( FILE* ExportFile ) m_Unit, m_Convert, Etype ) < 0 ) m_Unit, m_Convert, Etype ) < 0 ) return false; return false; if( ( m_shape ) || ( m_attributes & PINNOTDRAW ) ) if( m_shape || !IsVisible() ) { { if( fprintf( ExportFile, " " ) < 0 ) if( fprintf( ExportFile, " " ) < 0 ) return false; return false; } } if( m_attributes & PINNOTDRAW if( !IsVisible() && fprintf( ExportFile, "N" ) < 0 ) && fprintf( ExportFile, "N" ) < 0 ) return false; return false; if( m_shape & INVERT if( m_shape & INVERT && fprintf( ExportFile, "I" ) < 0 ) && fprintf( ExportFile, "I" ) < 0 ) Loading Loading @@ -741,7 +740,7 @@ bool LIB_PIN::Load( char* line, wxString& errorMsg ) break; break; case 'N': case 'N': m_attributes |= PINNOTDRAW; m_attributes |= PIN_INVISIBLE; break; break; case 'I': case 'I': Loading Loading @@ -797,16 +796,21 @@ void LIB_PIN::drawGraphic( EDA_DRAW_PANEL* aPanel, void* aData, void* aData, const TRANSFORM& aTransform ) const TRANSFORM& aTransform ) { { // Invisible pins are only drawn on request. In libedit they are drawn // Invisible pins are only drawn on request. // in g_InvisibleItemColor because we must see them. // They are drawn in g_InvisibleItemColor. SCH_EDIT_FRAME* frame = (SCH_EDIT_FRAME*) wxGetApp().GetTopWindow(); // in schematic, they are drawn only if m_ShowAllPins is true. // In other windows, they are always drawn because we must see them. if( m_attributes & PINNOTDRAW ) if( ! IsVisible() ) { { if( frame->m_LibeditFrame && frame->m_LibeditFrame->IsActive() ) EDA_DRAW_FRAME* frame = NULL; aColor = g_InvisibleItemColor; if( aPanel && aPanel->GetParent() ) else if( !frame->m_ShowAllPins ) frame = (EDA_DRAW_FRAME*)aPanel->GetParent(); if( frame && frame->m_Ident == SCHEMATIC_FRAME && ! ((SCH_EDIT_FRAME*)frame)->m_ShowAllPins ) return; return; aColor = g_InvisibleItemColor; } } LIB_COMPONENT* Entry = GetParent(); LIB_COMPONENT* Entry = GetParent(); Loading Loading @@ -1673,7 +1677,7 @@ void LIB_PIN::DoMirrorHorizontal( const wxPoint& center ) void LIB_PIN::DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill, void LIB_PIN::DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill, const TRANSFORM& aTransform ) const TRANSFORM& aTransform ) { { if( m_attributes & PINNOTDRAW ) if( ! IsVisible() ) return; return; int orient = ReturnPinDrawOrient( aTransform ); int orient = ReturnPinDrawOrient( aTransform ); Loading
eeschema/lib_pin.h +2 −2 Original line number Original line Diff line number Diff line Loading @@ -52,7 +52,7 @@ enum ElectricPinType { extern const wxChar* MsgPinElectricType[]; extern const wxChar* MsgPinElectricType[]; /* Pin visibility flag bit. */ /* Pin visibility flag bit. */ #define PINNOTDRAW 1 /* Set makes pin invisible */ #define PIN_INVISIBLE 1 /* Set makes pin invisible */ /** /** Loading Loading @@ -350,7 +350,7 @@ public: * * * @return True if draw object is visible otherwise false. * @return True if draw object is visible otherwise false. */ */ bool IsVisible() { return ( m_attributes & PINNOTDRAW ) == 0; } bool IsVisible() { return ( m_attributes & PIN_INVISIBLE ) == 0; } /** /** * @return the size of the "pen" that be used to draw or plot this item. * @return the size of the "pen" that be used to draw or plot this item. Loading