Commit 41064434 authored by jean-pierre charras's avatar jean-pierre charras

Eeschema, Libedit: fixes color artifacts when moving/placing a pin.

Very minor other fixes.
parent 02bacd66
...@@ -37,6 +37,16 @@ PLOTTER::PLOTTER( ) ...@@ -37,6 +37,16 @@ PLOTTER::PLOTTER( )
negativeMode = false; negativeMode = false;
} }
PLOTTER::~PLOTTER()
{
// Emergency cleanup, but closing the file is
// usually made in EndPlot().
if( outputFile )
{
fclose( outputFile );
}
}
/* /*
* Open or create the plot file aFullFilename * Open or create the plot file aFullFilename
* return true if success, false if the file connot be created/opened * return true if success, false if the file connot be created/opened
......
...@@ -31,18 +31,7 @@ ...@@ -31,18 +31,7 @@
#include <gr_basic.h> #include <gr_basic.h>
#include <class_drawpanel.h> #include <class_drawpanel.h>
#include <wxEeschemaStruct.h> #include <wxEeschemaStruct.h>
#include <base_units.h>
#include <general.h> #include <general.h>
#include <class_library.h>
#include <sch_bus_entry.h>
#include <sch_component.h>
#include <sch_junction.h>
#include <sch_line.h>
#include <sch_no_connect.h>
#include <sch_polyline.h>
#include <sch_sheet.h>
#include <sch_sheet_path.h>
void DrawDanglingSymbol( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& pos, EDA_COLOR_T Color ) void DrawDanglingSymbol( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& pos, EDA_COLOR_T Color )
......
...@@ -114,8 +114,10 @@ bool LIB_ITEM::operator<( const LIB_ITEM& aOther ) const ...@@ -114,8 +114,10 @@ bool LIB_ITEM::operator<( const LIB_ITEM& aOther ) const
} }
void LIB_ITEM::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset, EDA_COLOR_T aColor, void LIB_ITEM::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
GR_DRAWMODE aDrawMode, void* aData, const TRANSFORM& aTransform ) const wxPoint& aOffset, EDA_COLOR_T aColor,
GR_DRAWMODE aDrawMode, void* aData,
const TRANSFORM& aTransform )
{ {
if( InEditMode() ) if( InEditMode() )
{ {
...@@ -131,7 +133,8 @@ void LIB_ITEM::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset, ...@@ -131,7 +133,8 @@ void LIB_ITEM::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
{ {
GRSetDrawMode( aDC, g_XorMode ); GRSetDrawMode( aDC, g_XorMode );
drawEditGraphics( aPanel->GetClipBox(), aDC, color ); drawEditGraphics( aPanel->GetClipBox(), aDC, color );
drawGraphic( aPanel, aDC, wxPoint( 0, 0 ), color, g_XorMode, aData, aTransform ); drawGraphic( aPanel, aDC, wxPoint( 0, 0 ), color, g_XorMode, aData,
aTransform );
} }
#endif #endif
// Calculate the new attributes at the current cursor position. // Calculate the new attributes at the current cursor position.
...@@ -139,7 +142,8 @@ void LIB_ITEM::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset, ...@@ -139,7 +142,8 @@ void LIB_ITEM::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
// Draw the items using the new attributes. // Draw the items using the new attributes.
drawEditGraphics( aPanel->GetClipBox(), aDC, color ); drawEditGraphics( aPanel->GetClipBox(), aDC, color );
drawGraphic( aPanel, aDC, wxPoint( 0, 0 ), color, g_XorMode, aData, aTransform ); drawGraphic( aPanel, aDC, wxPoint( 0, 0 ), color, g_XorMode, aData,
aTransform );
m_Fill = fillMode; m_Fill = fillMode;
} }
......
...@@ -1091,8 +1091,10 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel, ...@@ -1091,8 +1091,10 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel,
if( (Color < 0) && IsSelected() ) if( (Color < 0) && IsSelected() )
Color = GetItemSelectedColor(); Color = GetItemSelectedColor();
NameColor = (EDA_COLOR_T) ( Color == -1 ? ReturnLayerColor( LAYER_PINNAM ) : Color ); NameColor = (EDA_COLOR_T) ( Color == UNSPECIFIED_COLOR ?
NumColor = (EDA_COLOR_T) ( Color == -1 ? ReturnLayerColor( LAYER_PINNUM ) : Color ); ReturnLayerColor( LAYER_PINNAM ) : Color );
NumColor = (EDA_COLOR_T) ( Color == UNSPECIFIED_COLOR ?
ReturnLayerColor( LAYER_PINNUM ) : Color );
/* Create the pin num string */ /* Create the pin num string */
ReturnPinStringNum( StringPinNum ); ReturnPinStringNum( StringPinNum );
......
...@@ -75,7 +75,7 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& aPosition ) ...@@ -75,7 +75,7 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& aPosition )
switch( item->Type() ) switch( item->Type() )
{ {
case LIB_PIN_T: case LIB_PIN_T:
PlacePin( DC ); PlacePin();
break; break;
default: default:
...@@ -89,7 +89,7 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& aPosition ) ...@@ -89,7 +89,7 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& aPosition )
if( no_item_edited ) if( no_item_edited )
CreatePin( DC ); CreatePin( DC );
else else
PlacePin( DC ); PlacePin();
break; break;
case ID_LIBEDIT_BODY_LINE_BUTT: case ID_LIBEDIT_BODY_LINE_BUTT:
......
...@@ -584,7 +584,12 @@ public: ...@@ -584,7 +584,12 @@ public:
*/ */
virtual bool HandleBlockEnd( wxDC* DC ); virtual bool HandleBlockEnd( wxDC* DC );
void PlacePin( wxDC* DC ); /**
* Function PlacePin
* Place at cursor location the pin currently moved (i.e. pin pointed by m_drawItem)
* (and the linked pins, if any)
*/
void PlacePin();
/** /**
* Function GlobalSetPins * Function GlobalSetPins
......
...@@ -195,7 +195,7 @@ static void AbortPinMove( EDA_DRAW_PANEL* Panel, wxDC* DC ) ...@@ -195,7 +195,7 @@ static void AbortPinMove( EDA_DRAW_PANEL* Panel, wxDC* DC )
/** /**
* Managed cursor callback for placing component pins. * Managed cursor callback for placing component pins.
*/ */
void LIB_EDIT_FRAME::PlacePin( wxDC* DC ) void LIB_EDIT_FRAME::PlacePin()
{ {
LIB_PIN* Pin; LIB_PIN* Pin;
LIB_PIN* CurrentPin = (LIB_PIN*) m_drawItem; LIB_PIN* CurrentPin = (LIB_PIN*) m_drawItem;
...@@ -268,13 +268,9 @@ another pin. Continue?" ) ); ...@@ -268,13 +268,9 @@ another pin. Continue?" ) );
Pin->ClearFlags(); Pin->ClearFlags();
} }
m_canvas->CrossHairOff( DC );
bool showPinText = true;
CurrentPin->Draw( m_canvas, DC, wxPoint( 0, 0 ), UNSPECIFIED_COLOR, GR_DEFAULT_DRAWMODE,
&showPinText, DefaultTransform );
m_canvas->CrossHairOn( DC );
m_drawItem = NULL; m_drawItem = NULL;
m_canvas->Refresh();
} }
...@@ -286,42 +282,44 @@ another pin. Continue?" ) ); ...@@ -286,42 +282,44 @@ another pin. Continue?" ) );
*/ */
void LIB_EDIT_FRAME::StartMovePin( wxDC* DC ) void LIB_EDIT_FRAME::StartMovePin( wxDC* DC )
{ {
LIB_PIN* Pin; LIB_PIN* currentPin = (LIB_PIN*) m_drawItem;
LIB_PIN* CurrentPin = (LIB_PIN*) m_drawItem;
wxPoint startPos; wxPoint startPos;
TempCopyComponent(); TempCopyComponent();
// Mark pins for moving. // Mark pins for moving.
Pin = m_component->GetNextPin(); LIB_PIN* pin = m_component->GetNextPin();
for( ; Pin != NULL; Pin = m_component->GetNextPin( Pin ) ) for( ; pin != NULL; pin = m_component->GetNextPin( pin ) )
{ {
Pin->ClearFlags(); pin->ClearFlags();
if( Pin == CurrentPin ) if( pin == currentPin )
continue; continue;
if( ( Pin->GetPosition() == CurrentPin->GetPosition() ) if( ( pin->GetPosition() == currentPin->GetPosition() )
&& ( Pin->GetOrientation() == CurrentPin->GetOrientation() ) && ( pin->GetOrientation() == currentPin->GetOrientation() )
&& SynchronizePins() ) && SynchronizePins() )
Pin->SetFlags( IS_LINKED | IS_MOVED ); pin->SetFlags( IS_LINKED | IS_MOVED );
} }
CurrentPin->SetFlags( IS_LINKED | IS_MOVED ); currentPin->SetFlags( IS_LINKED | IS_MOVED );
PinPreviousPos = OldPos = CurrentPin->GetPosition(); PinPreviousPos = OldPos = currentPin->GetPosition();
startPos.x = OldPos.x; startPos.x = OldPos.x;
startPos.y = -OldPos.y; startPos.y = -OldPos.y;
m_canvas->CrossHairOff( DC ); // m_canvas->CrossHairOff( DC );
GetScreen()->SetCrossHairPosition( startPos ); GetScreen()->SetCrossHairPosition( startPos );
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
MSG_PANEL_ITEMS items; MSG_PANEL_ITEMS items;
CurrentPin->GetMsgPanelInfo( items ); currentPin->GetMsgPanelInfo( items );
SetMsgPanel( items ); SetMsgPanel( items );
m_canvas->SetMouseCapture( DrawMovePin, AbortPinMove ); m_canvas->SetMouseCapture( DrawMovePin, AbortPinMove );
m_canvas->CrossHairOn( DC ); // m_canvas->CrossHairOn( DC );
// Refresh the screen to avoid color artifacts when drawing
// the pin in Edit mode and moving it from its start position
m_canvas->Refresh();
} }
...@@ -353,7 +351,8 @@ static void DrawMovePin( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosi ...@@ -353,7 +351,8 @@ static void DrawMovePin( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosi
// Redraw pin in new position // Redraw pin in new position
CurrentPin->SetPosition( aPanel->GetScreen()->GetCrossHairPosition( true ) ); CurrentPin->SetPosition( aPanel->GetScreen()->GetCrossHairPosition( true ) );
CurrentPin->Draw( aPanel, aDC, wxPoint( 0, 0 ), UNSPECIFIED_COLOR, g_XorMode, &showPinText, DefaultTransform ); CurrentPin->Draw( aPanel, aDC, wxPoint( 0, 0 ), UNSPECIFIED_COLOR, g_XorMode,
&showPinText, DefaultTransform );
PinPreviousPos = CurrentPin->GetPosition(); PinPreviousPos = CurrentPin->GetPosition();
...@@ -558,12 +557,13 @@ void LIB_EDIT_FRAME::RepeatPinItem( wxDC* DC, LIB_PIN* SourcePin ) ...@@ -558,12 +557,13 @@ void LIB_EDIT_FRAME::RepeatPinItem( wxDC* DC, LIB_PIN* SourcePin )
wxPoint savepos = GetScreen()->GetCrossHairPosition(); wxPoint savepos = GetScreen()->GetCrossHairPosition();
m_canvas->CrossHairOff( DC ); m_canvas->CrossHairOff( DC );
GetScreen()->SetCrossHairPosition( wxPoint( Pin->GetPosition().x, -Pin->GetPosition().y ) ); GetScreen()->SetCrossHairPosition( wxPoint( Pin->GetPosition().x,
-Pin->GetPosition().y ) );
// Add this new pin in list, and creates pins for others parts if needed // Add this new pin in list, and creates pins for others parts if needed
m_drawItem = Pin; m_drawItem = Pin;
ClearTempCopyComponent(); ClearTempCopyComponent();
PlacePin( DC ); PlacePin();
m_lastDrawItem = Pin; m_lastDrawItem = Pin;
GetScreen()->SetCrossHairPosition( savepos ); GetScreen()->SetCrossHairPosition( savepos );
......
...@@ -44,6 +44,8 @@ class TITLE_BLOCK ...@@ -44,6 +44,8 @@ class TITLE_BLOCK
{ {
public: public:
// TITLE_BLOCK(); // TITLE_BLOCK();
virtual ~TITLE_BLOCK() {}; // a virtual dtor seems needed to build
// python lib without warning
void SetTitle( const wxString& aTitle ) { m_title = aTitle; } void SetTitle( const wxString& aTitle ) { m_title = aTitle; }
const wxString& GetTitle() const { return m_title; } const wxString& GetTitle() const { return m_title; }
......
...@@ -61,14 +61,7 @@ public: ...@@ -61,14 +61,7 @@ public:
PLOTTER( ); PLOTTER( );
virtual ~PLOTTER() virtual ~PLOTTER();
{
// Emergency cleanup
if( outputFile )
{
fclose( outputFile );
}
}
/** /**
* Returns the effective plot engine in use. It's not very OO but for * Returns the effective plot engine in use. It's not very OO but for
......
...@@ -575,7 +575,7 @@ void CONNECTIONS::Propagate_SubNets() ...@@ -575,7 +575,7 @@ void CONNECTIONS::Propagate_SubNets()
pad->SetSubNet( curr_pad->GetSubNet() ); pad->SetSubNet( curr_pad->GetSubNet() );
} }
} }
else // the track segment is not attached to a cluster else // the current pad is not attached to a cluster
{ {
if( pad->GetSubNet() > 0 ) if( pad->GetSubNet() > 0 )
{ {
...@@ -599,7 +599,7 @@ void CONNECTIONS::Propagate_SubNets() ...@@ -599,7 +599,7 @@ void CONNECTIONS::Propagate_SubNets()
if( curr_track ) if( curr_track )
curr_track->SetSubNet( sub_netcode ); curr_track->SetSubNet( sub_netcode );
// Examine connections between trcaks and pads // Examine connections between tracks and pads
for( ; curr_track != NULL; curr_track = curr_track->Next() ) for( ; curr_track != NULL; curr_track = curr_track->Next() )
{ {
// First: handling connections to pads // First: handling connections to pads
......
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