This commit is contained in:
Jeff Young 2019-07-02 21:09:23 +01:00
parent ef03afe289
commit d03041b565
24 changed files with 101 additions and 342 deletions

View File

@ -240,36 +240,6 @@ bool SCH_EDIT_FRAME::SchematicCleanUp( SCH_SCREEN* aScreen )
} }
bool SCH_EDIT_FRAME::AddMissingJunctions( SCH_SCREEN* aScreen )
{
bool added = false;
auto add_junction = [ & ]( const wxPoint& aPosition ) -> void
{
auto junction = new SCH_JUNCTION( aPosition );
AddToScreen( junction, aScreen );
BreakSegments( aPosition );
added = true;
};
for( auto item = aScreen->GetDrawItems(); item; item = item->Next() )
{
if( item->Type() == SCH_LINE_T )
{
auto line = static_cast<SCH_LINE*>( item );
if( aScreen->IsJunctionNeeded( line->GetStartPoint(), true ) )
add_junction( line->GetStartPoint() );
if( aScreen->IsJunctionNeeded( line->GetEndPoint(), true ) )
add_junction( line->GetEndPoint() );
}
}
return added;
}
void SCH_EDIT_FRAME::NormalizeSchematicOnFirstLoad( bool recalculateConnections ) void SCH_EDIT_FRAME::NormalizeSchematicOnFirstLoad( bool recalculateConnections )
{ {
SCH_SHEET_LIST list( g_RootSheet ); SCH_SHEET_LIST list( g_RootSheet );

View File

@ -123,7 +123,7 @@ bool DIALOG_LIB_EDIT_PIN::TransferDataFromWindow()
return false; return false;
} }
if( !m_pin->InEditMode() ) if( m_pin->GetEditFlags() == 0 )
m_frame->SaveCopyInUndoList( m_pin->GetParent() ); m_frame->SaveCopyInUndoList( m_pin->GetParent() );
m_pin->SetName( m_textPinName->GetValue() ); m_pin->SetName( m_textPinName->GetValue() );

View File

@ -269,7 +269,7 @@ BITMAP_DEF LIB_CIRCLE::GetMenuImage() const
void LIB_CIRCLE::BeginEdit( const wxPoint aPosition ) void LIB_CIRCLE::BeginEdit( const wxPoint aPosition )
{ {
m_Pos = m_initialPos = aPosition; m_Pos = aPosition;
} }

View File

@ -23,11 +23,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
/**
* @file class_libentry.h
* @brief Class LIB_ITEM definition.
*/
#ifndef _LIB_ITEM_H_ #ifndef _LIB_ITEM_H_
#define _LIB_ITEM_H_ #define _LIB_ITEM_H_
@ -81,37 +76,28 @@ class LIB_ITEM : public EDA_ITEM
protected: protected:
/** /**
* Unit identification for multiple parts per package. Set to 0 if the * Unit identification for multiple parts per package. Set to 0 if the item is common
* item is common to all units. * to all units.
*/ */
int m_Unit; int m_Unit;
/** /**
* Shape identification for alternate body styles. Set 0 if the item * Shape identification for alternate body styles. Set 0 if the item is common to all
* is common to all body styles. This is commonly referred to as * body styles. This is typially used for representing DeMorgan variants in KiCad.
* DeMorgan style and this is typically how it is used in KiCad.
*/ */
int m_Convert; int m_Convert;
/** /**
* The body fill type. This has meaning only for some items. For a list of * The body fill type. This has meaning only for some items. For a list of fill types
* fill types see #FILL_T. * see #FILL_T.
*/ */
FILL_T m_Fill; FILL_T m_Fill;
bool m_isFillable;
wxPoint m_initialPos; ///< Temporary position when moving an existing item.
wxPoint m_initialCursorPos; ///< Initial cursor position at the beginning of a move.
/** Flag to indicate if draw item is fillable. Default is false. */
bool m_isFillable;
public: public:
LIB_ITEM( KICAD_T aType, LIB_ITEM( KICAD_T aType, LIB_PART* aComponent = NULL, int aUnit = 0, int aConvert = 0,
LIB_PART* aComponent = NULL, FILL_T aFillType = NO_FILL );
int aUnit = 0,
int aConvert = 0,
FILL_T aFillType = NO_FILL );
// Do not create a copy constructor. The one generated by the compiler is adequate. // Do not create a copy constructor. The one generated by the compiler is adequate.
@ -262,13 +248,7 @@ public:
*/ */
virtual void MoveTo( const wxPoint& aPosition ) = 0; virtual void MoveTo( const wxPoint& aPosition ) = 0;
/**
* Return the current draw object position.
*
* @return A wxPoint object containing the position of the object.
*/
virtual wxPoint GetPosition() const = 0; virtual wxPoint GetPosition() const = 0;
void SetPosition( const wxPoint& aPosition ) { MoveTo( aPosition ); } void SetPosition( const wxPoint& aPosition ) { MoveTo( aPosition ); }
/** /**
@ -293,11 +273,6 @@ public:
*/ */
virtual void Rotate( const wxPoint& aCenter, bool aRotateCCW = true ) = 0; virtual void Rotate( const wxPoint& aCenter, bool aRotateCCW = true ) = 0;
/**
* Rotate the draw item.
*/
virtual void Rotate() {}
/** /**
* Plot the draw item using the plot object. * Plot the draw item using the plot object.
* *
@ -309,47 +284,26 @@ public:
virtual void Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill, virtual void Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
const TRANSFORM& aTransform ) = 0; const TRANSFORM& aTransform ) = 0;
/**
* Return the width of the draw item.
*
* @return Width of draw object.
*/
virtual int GetWidth() const = 0; virtual int GetWidth() const = 0;
/**
* Set the width of the draw item to \a aWidth.
*/
virtual void SetWidth( int aWidth ) = 0; virtual void SetWidth( int aWidth ) = 0;
/** /**
* Check if draw object can be filled. * Check if draw object can be filled.
* *
* The default setting is false. If the derived object support filling, * The default setting is false. If the derived object support filling, set the
* set the m_isFillable member to true. * m_isFillable member to true.
*
* @return True if draw object can be filled. Default is false.
*/ */
bool IsFillable() const { return m_isFillable; } bool IsFillable() const { return m_isFillable; }
/**
* Return the draw item editing mode status.
*
* @return True if the item is being edited.
*/
bool InEditMode() const { return ( m_Flags & ( IS_NEW | IS_DRAGGED | IS_MOVED | IS_RESIZED ) ) != 0; }
virtual COLOR4D GetDefaultColor(); virtual COLOR4D GetDefaultColor();
void SetUnit( int aUnit ) { m_Unit = aUnit; } void SetUnit( int aUnit ) { m_Unit = aUnit; }
int GetUnit() const { return m_Unit; } int GetUnit() const { return m_Unit; }
void SetConvert( int aConvert ) { m_Convert = aConvert; } void SetConvert( int aConvert ) { m_Convert = aConvert; }
int GetConvert() const { return m_Convert; } int GetConvert() const { return m_Convert; }
void SetFillMode( FILL_T aFillMode ) { m_Fill = aFillMode; } void SetFillMode( FILL_T aFillMode ) { m_Fill = aFillMode; }
FILL_T GetFillMode() const { return m_Fill; } FILL_T GetFillMode() const { return m_Fill; }
#if defined(DEBUG) #if defined(DEBUG)

View File

@ -25,7 +25,6 @@
#include <fctsys.h> #include <fctsys.h>
#include <pgm_base.h> #include <pgm_base.h>
#include <gr_basic.h> #include <gr_basic.h>
#include <macros.h>
#include <base_struct.h> #include <base_struct.h>
#include <gr_text.h> #include <gr_text.h>
#include <kicad_string.h> #include <kicad_string.h>
@ -35,7 +34,6 @@
#include <base_units.h> #include <base_units.h>
#include <msgpanel.h> #include <msgpanel.h>
#include <bitmaps.h> #include <bitmaps.h>
#include <general.h> #include <general.h>
#include <class_libentry.h> #include <class_libentry.h>
#include <transform.h> #include <transform.h>
@ -92,21 +90,15 @@ void LIB_FIELD::Init( int id )
SetTextAngle( TEXT_ANGLE_HORIZ ); // constructor already did this. SetTextAngle( TEXT_ANGLE_HORIZ ); // constructor already did this.
// fields in RAM must always have names, because we are trying to get // Fields in RAM must always have names, because we are trying to get less dependent on
// less dependent on field ids and more dependent on names. // field ids and more dependent on names. Plus assumptions are made in the field editors.
// Plus assumptions are made in the field editors.
m_name = TEMPLATE_FIELDNAME::GetDefaultFieldName( id ); m_name = TEMPLATE_FIELDNAME::GetDefaultFieldName( id );
switch( id ) // By contrast, VALUE and REFERENCE are are always constructed as initially visible, and
{ // template fieldsnames' initial visibility is controlled by the template fieldname config.
case DATASHEET: if( id == DATASHEET || id == FOOTPRINT )
case FOOTPRINT:
// by contrast, VALUE and REFERENCE are are always constructed as
// initially visible, and template fieldsnames' initial visibility
// is controlled by the template fieldname configuration record.
SetVisible( false ); SetVisible( false );
break;
}
} }
@ -131,18 +123,10 @@ int LIB_FIELD::GetPenSize() const
void LIB_FIELD::print( wxDC* aDC, const wxPoint& aOffset, void* aData, void LIB_FIELD::print( wxDC* aDC, const wxPoint& aOffset, void* aData,
const TRANSFORM& aTransform ) const TRANSFORM& aTransform )
{ {
wxPoint text_pos;
COLOR4D color = IsVisible() ? GetDefaultColor() : GetInvisibleItemColor(); COLOR4D color = IsVisible() ? GetDefaultColor() : GetInvisibleItemColor();
int linewidth = GetPenSize(); int linewidth = GetPenSize();
wxPoint text_pos = aTransform.TransformCoordinate( GetTextPos() ) + aOffset;
text_pos = aTransform.TransformCoordinate( GetTextPos() ) + aOffset; wxString text = aData ? *static_cast<wxString*>( aData ) : m_Text;
wxString text;
if( aData )
text = *(wxString*)aData;
else
text = m_Text;
GRText( aDC, text_pos, color, text, GetTextAngle(), GetTextSize(), GetHorizJustify(), GRText( aDC, text_pos, color, text, GetTextAngle(), GetTextSize(), GetHorizJustify(),
GetVertJustify(), linewidth, IsItalic(), IsBold() ); GetVertJustify(), linewidth, IsItalic(), IsBold() );
@ -158,8 +142,7 @@ bool LIB_FIELD::HitTest( const wxPoint& aPosition, int aAccuracy ) const
// Build a temporary copy of the text for hit testing // Build a temporary copy of the text for hit testing
EDA_TEXT tmp_text( *this ); EDA_TEXT tmp_text( *this );
// Reference designator text has one or 2 additional character (displays // Reference designator text has one or 2 additional character (displays U? or U?A)
// U? or U?A)
if( m_id == REFERENCE ) if( m_id == REFERENCE )
{ {
wxString extended_text = tmp_text.GetText(); wxString extended_text = tmp_text.GetText();
@ -173,10 +156,8 @@ bool LIB_FIELD::HitTest( const wxPoint& aPosition, int aAccuracy ) const
tmp_text.SetTextPos( DefaultTransform.TransformCoordinate( GetTextPos() ) ); tmp_text.SetTextPos( DefaultTransform.TransformCoordinate( GetTextPos() ) );
/* The text orientation may need to be flipped if the // The text orientation may need to be flipped if the transformation matrix causes xy axes
* transformation matrix causes xy axes to be flipped. // to be flipped. This simple algo works only for schematic matrix (rot 90 or/and mirror)
* this simple algo works only for schematic matrix (rot 90 or/and mirror)
*/
bool t1 = ( DefaultTransform.x1 != 0 ) ^ ( GetTextAngle() != 0 ); bool t1 = ( DefaultTransform.x1 != 0 ) ^ ( GetTextAngle() != 0 );
tmp_text.SetTextAngle( t1 ? TEXT_ANGLE_HORIZ : TEXT_ANGLE_VERT ); tmp_text.SetTextAngle( t1 ? TEXT_ANGLE_HORIZ : TEXT_ANGLE_VERT );
@ -294,8 +275,7 @@ void LIB_FIELD::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
if( IsVoid() ) if( IsVoid() )
return; return;
/* Calculate the text orientation, according to the component // Calculate the text orientation, according to the component orientation/mirror
* orientation/mirror */
int orient = (int) GetTextAngle(); int orient = (int) GetTextAngle();
if( aTransform.y1 ) // Rotate component 90 deg. if( aTransform.y1 ) // Rotate component 90 deg.
@ -311,13 +291,10 @@ void LIB_FIELD::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
EDA_TEXT_HJUSTIFY_T hjustify = GR_TEXT_HJUSTIFY_CENTER; EDA_TEXT_HJUSTIFY_T hjustify = GR_TEXT_HJUSTIFY_CENTER;
EDA_TEXT_VJUSTIFY_T vjustify = GR_TEXT_VJUSTIFY_CENTER; EDA_TEXT_VJUSTIFY_T vjustify = GR_TEXT_VJUSTIFY_CENTER;
wxPoint textpos = aTransform.TransformCoordinate( BoundaryBox.Centre() ) wxPoint textpos = aTransform.TransformCoordinate( BoundaryBox.Centre() ) + aOffset;
+ aOffset;
aPlotter->Text( textpos, GetDefaultColor(), GetShownText(), aPlotter->Text( textpos, GetDefaultColor(), GetShownText(), orient, GetTextSize(),
orient, GetTextSize(), hjustify, vjustify, GetPenSize(), IsItalic(), IsBold() );
hjustify, vjustify,
GetPenSize(), IsItalic(), IsBold() );
} }
@ -385,12 +362,6 @@ COLOR4D LIB_FIELD::GetDefaultColor()
} }
void LIB_FIELD::Rotate()
{
SetTextAngle( GetTextAngle() == TEXT_ANGLE_VERT ? TEXT_ANGLE_HORIZ : TEXT_ANGLE_VERT );
}
wxString LIB_FIELD::GetName( bool aTranslate ) const wxString LIB_FIELD::GetName( bool aTranslate ) const
{ {
wxString name; wxString name;

View File

@ -178,8 +178,6 @@ public:
void BeginEdit( const wxPoint aStartPoint ) override; void BeginEdit( const wxPoint aStartPoint ) override;
void Rotate() override;
/** /**
* Sets the field text to \a aText. * Sets the field text to \a aText.
* *

View File

@ -1608,23 +1608,6 @@ int LIB_PIN::GetOrientationIndex( int code )
} }
void LIB_PIN::Rotate()
{
int orient = PIN_RIGHT;
switch( GetOrientation() )
{
case PIN_UP: orient = PIN_LEFT; break;
case PIN_DOWN: orient = PIN_RIGHT; break;
case PIN_LEFT: orient = PIN_DOWN; break;
case PIN_RIGHT: orient = PIN_UP; break;
}
// Set the new orientation
SetOrientation( orient );
}
const BITMAP_DEF* LIB_PIN::GetOrientationSymbols() const BITMAP_DEF* LIB_PIN::GetOrientationSymbols()
{ {
return iconsPinsOrientations; return iconsPinsOrientations;

View File

@ -213,8 +213,6 @@ public:
*/ */
void SetOrientation( int aOrientation, bool aTestOtherPins = true ); void SetOrientation( int aOrientation, bool aTestOtherPins = true );
void Rotate() override;
GRAPHIC_PINSHAPE GetShape() const { return m_shape; } GRAPHIC_PINSHAPE GetShape() const { return m_shape; }
/** /**

View File

@ -292,12 +292,6 @@ const EDA_RECT LIB_TEXT::GetBoundingBox() const
} }
void LIB_TEXT::Rotate()
{
SetTextAngle( GetTextAngle() == TEXT_ANGLE_VERT ? TEXT_ANGLE_HORIZ : TEXT_ANGLE_VERT );
}
void LIB_TEXT::SetText( const wxString& aText ) void LIB_TEXT::SetText( const wxString& aText )
{ {
m_Text = aText; m_Text = aText;

View File

@ -80,15 +80,12 @@ public:
return TextHitTest( aRect, aContained, aAccuracy ); return TextHitTest( aRect, aContained, aAccuracy );
} }
int GetPenSize( ) const override; int GetPenSize( ) const override;
void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override; void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override;
const EDA_RECT GetBoundingBox() const override; const EDA_RECT GetBoundingBox() const override;
void Rotate() override;
void BeginEdit( const wxPoint aStartPoint ) override; void BeginEdit( const wxPoint aStartPoint ) override;
void CalcEdit( const wxPoint& aPosition ) override; void CalcEdit( const wxPoint& aPosition ) override;

View File

@ -30,10 +30,6 @@
#include <sch_draw_panel.h> #include <sch_draw_panel.h>
#include <base_screen.h> #include <base_screen.h>
#include <confirm.h> #include <confirm.h>
#include <eda_doc.h>
#include <sch_edit_frame.h>
#include <msgpanel.h>
#include <confirm.h>
#include <eda_dockart.h> #include <eda_dockart.h>
#include <general.h> #include <general.h>
#include <eeschema_id.h> #include <eeschema_id.h>
@ -43,7 +39,6 @@
#include <widgets/symbol_tree_pane.h> #include <widgets/symbol_tree_pane.h>
#include <widgets/lib_tree.h> #include <widgets/lib_tree.h>
#include <symbol_lib_table.h> #include <symbol_lib_table.h>
#include <eeschema_config.h>
#include <wildcards_and_files_ext.h> #include <wildcards_and_files_ext.h>
#include <wx/progdlg.h> #include <wx/progdlg.h>
#include <tool/tool_manager.h> #include <tool/tool_manager.h>
@ -281,7 +276,7 @@ void LIB_EDIT_FRAME::RebuildSymbolUnitsList()
if( m_unitSelectBox->GetCount() != 0 ) if( m_unitSelectBox->GetCount() != 0 )
m_unitSelectBox->Clear(); m_unitSelectBox->Clear();
LIB_PART* part = GetCurPart(); LIB_PART* part = GetCurPart();
if( !part || part->GetUnitCount() <= 1 ) if( !part || part->GetUnitCount() <= 1 )
{ {
@ -298,8 +293,7 @@ void LIB_EDIT_FRAME::RebuildSymbolUnitsList()
} }
} }
// Ensure the current selected unit is compatible with // Ensure the selected unit is compatible with the number of units of the current part:
// the number of units of the current part:
if( part && part->GetUnitCount() < m_unit ) if( part && part->GetUnitCount() < m_unit )
m_unit = 1; m_unit = 1;

View File

@ -401,8 +401,6 @@ public:
/** /**
* Creates the SVG print file for the current edited component. * Creates the SVG print file for the current edited component.
*
* @param aFullFileName = the full filename
*/ */
void SVG_PlotComponent( const wxString& aFullFileName ); void SVG_PlotComponent( const wxString& aFullFileName );

View File

@ -75,8 +75,8 @@ std::string toUTFTildaText( const wxString& txt )
/** /**
* Used when a LIB_PART is not found in library * Used to draw a dummy shape when a LIB_PART is not found in library
* to draw a dummy shape *
* This component is a 400 mils square with the text ?? * This component is a 400 mils square with the text ??
* DEF DUMMY U 0 40 Y Y 1 0 N * DEF DUMMY U 0 40 Y Y 1 0 N
* F0 "U" 0 -350 60 H V * F0 "U" 0 -350 60 H V
@ -372,8 +372,7 @@ bool SCH_COMPONENT::Resolve( SYMBOL_LIB_TABLE& aLibTable, PART_LIB* aCacheLib )
} }
// Helper sort function, used in SCH_COMPONENT::ResolveAll, to sort // Helper sort function, used in SCH_COMPONENT::ResolveAll, to sort sch component by lib_id
// sch component by lib_id
static bool sort_by_libid( const SCH_COMPONENT* ref, SCH_COMPONENT* cmp ) static bool sort_by_libid( const SCH_COMPONENT* ref, SCH_COMPONENT* cmp )
{ {
if( ref->GetLibId() == cmp->GetLibId() ) if( ref->GetLibId() == cmp->GetLibId() )
@ -615,20 +614,19 @@ const wxString SCH_COMPONENT::GetRef( const SCH_SHEET_PATH* sheet )
wxStringTokenizer tokenizer; wxStringTokenizer tokenizer;
wxString separators( wxT( " " ) ); wxString separators( wxT( " " ) );
for( unsigned ii = 0; ii < m_PathsAndReferences.GetCount(); ii++ ) for( const wxString& entry : m_PathsAndReferences )
{ {
tokenizer.SetString( m_PathsAndReferences[ii], separators ); tokenizer.SetString( entry, separators );
h_path = tokenizer.GetNextToken(); h_path = tokenizer.GetNextToken();
if( h_path.Cmp( path ) == 0 ) if( h_path.Cmp( path ) == 0 )
return tokenizer.GetNextToken(); return tokenizer.GetNextToken();
} }
// if it was not found in m_Paths array, then see if it is in // If it was not found in m_Paths array, then see if it is in m_Field[REFERENCE] -- if so,
// m_Field[REFERENCE] -- if so, use this as a default for this path. // use this as a default for this path. This will happen if we load a version 1 schematic
// this will happen if we load a version 1 schematic file. // file. It will also mean that multiple instances of the same sheet by default all have
// it will also mean that multiple instances of the same sheet by default // the same component references, but perhaps this is best.
// all have the same component references, but perhaps this is best.
if( !GetField( REFERENCE )->GetText().IsEmpty() ) if( !GetField( REFERENCE )->GetText().IsEmpty() )
{ {
SetRef( sheet, GetField( REFERENCE )->GetText() ); SetRef( sheet, GetField( REFERENCE )->GetText() );
@ -651,9 +649,6 @@ bool SCH_COMPONENT::IsReferenceStringValid( const wxString& aReferenceString )
if( text.IsEmpty() ) if( text.IsEmpty() )
ok = false; ok = false;
// Add here other constraints
// Currently:no other constraint
return ok; return ok;
} }
@ -730,9 +725,9 @@ bool SCH_COMPONENT::IsAnnotated( const SCH_SHEET_PATH* aSheet )
wxStringTokenizer tokenizer; wxStringTokenizer tokenizer;
wxString separators( wxT( " " ) ); wxString separators( wxT( " " ) );
for( unsigned ii = 0; ii < m_PathsAndReferences.GetCount(); ii++ ) for( const wxString& entry : m_PathsAndReferences )
{ {
tokenizer.SetString( m_PathsAndReferences[ii], separators ); tokenizer.SetString( entry, separators );
h_path = tokenizer.GetNextToken(); h_path = tokenizer.GetNextToken();
if( h_path.Cmp( path ) == 0 ) if( h_path.Cmp( path ) == 0 )
@ -754,11 +749,8 @@ void SCH_COMPONENT::SetTimeStamp( timestamp_t aNewTimeStamp )
string_oldtimestamp.Printf( wxT( "%08lX" ), (long unsigned) m_TimeStamp ); string_oldtimestamp.Printf( wxT( "%08lX" ), (long unsigned) m_TimeStamp );
EDA_ITEM::SetTimeStamp( aNewTimeStamp ); EDA_ITEM::SetTimeStamp( aNewTimeStamp );
for( unsigned ii = 0; ii < m_PathsAndReferences.GetCount(); ii++ ) for( wxString& entry : m_PathsAndReferences )
{ entry.Replace( string_oldtimestamp.GetData(), string_timestamp.GetData() );
m_PathsAndReferences[ii].Replace( string_oldtimestamp.GetData(),
string_timestamp.GetData() );
}
} }
@ -769,9 +761,9 @@ int SCH_COMPONENT::GetUnitSelection( SCH_SHEET_PATH* aSheet )
wxStringTokenizer tokenizer; wxStringTokenizer tokenizer;
wxString separators( wxT( " " ) ); wxString separators( wxT( " " ) );
for( unsigned ii = 0; ii < m_PathsAndReferences.GetCount(); ii++ ) for( const wxString& entry : m_PathsAndReferences )
{ {
tokenizer.SetString( m_PathsAndReferences[ii], separators ); tokenizer.SetString( entry, separators );
h_path = tokenizer.GetNextToken(); h_path = tokenizer.GetNextToken();
if( h_path.Cmp( path ) == 0 ) if( h_path.Cmp( path ) == 0 )
@ -784,8 +776,8 @@ int SCH_COMPONENT::GetUnitSelection( SCH_SHEET_PATH* aSheet )
} }
} }
// if it was not found in m_Paths array, then use m_unit. // If it was not found in m_Paths array, then use m_unit. This will happen if we load a
// this will happen if we load a version 1 schematic file. // version 1 schematic file.
return m_unit; return m_unit;
} }
@ -801,9 +793,9 @@ void SCH_COMPONENT::SetUnitSelection( SCH_SHEET_PATH* aSheet, int aUnitSelection
wxString separators( wxT( " " ) ); wxString separators( wxT( " " ) );
//check to see if it is already there before inserting it //check to see if it is already there before inserting it
for( unsigned ii = 0; ii < m_PathsAndReferences.GetCount(); ii++ ) for( wxString& entry : m_PathsAndReferences )
{ {
tokenizer.SetString( m_PathsAndReferences[ii], separators ); tokenizer.SetString( entry, separators );
h_path = tokenizer.GetNextToken(); h_path = tokenizer.GetNextToken();
if( h_path.Cmp( path ) == 0 ) if( h_path.Cmp( path ) == 0 )
@ -815,7 +807,7 @@ void SCH_COMPONENT::SetUnitSelection( SCH_SHEET_PATH* aSheet, int aUnitSelection
h_ref << aUnitSelection; // Add part selection h_ref << aUnitSelection; // Add part selection
// Ann the part selection // Ann the part selection
m_PathsAndReferences[ii] = h_ref; entry = h_ref;
notInArray = false; notInArray = false;
} }
} }
@ -836,17 +828,16 @@ SCH_FIELD* SCH_COMPONENT::GetField( int aFieldNdx ) const
wxASSERT( field ); wxASSERT( field );
// use cast to remove const-ness return const_cast<SCH_FIELD*>( field );
return (SCH_FIELD*) field;
} }
wxString SCH_COMPONENT::GetFieldText( const wxString& aFieldName, SCH_EDIT_FRAME* aFrame ) const wxString SCH_COMPONENT::GetFieldText( const wxString& aFieldName, SCH_EDIT_FRAME* aFrame ) const
{ {
for( unsigned int ii = 0; ii < m_Fields.size(); ii++ ) for( const SCH_FIELD& field : m_Fields )
{ {
if( aFieldName == m_Fields[ii].GetName() ) if( aFieldName == field.GetName() )
return m_Fields[ii].GetText(); return field.GetText();
} }
return wxEmptyString; return wxEmptyString;
@ -855,10 +846,10 @@ wxString SCH_COMPONENT::GetFieldText( const wxString& aFieldName, SCH_EDIT_FRAME
void SCH_COMPONENT::GetFields( std::vector<SCH_FIELD*>& aVector, bool aVisibleOnly ) void SCH_COMPONENT::GetFields( std::vector<SCH_FIELD*>& aVector, bool aVisibleOnly )
{ {
for( SCH_FIELD& each_field : m_Fields ) for( SCH_FIELD& field : m_Fields )
{ {
if( !aVisibleOnly || ( each_field.IsVisible() && !each_field.IsVoid() ) ) if( !aVisibleOnly || ( field.IsVisible() && !field.IsVoid() ) )
aVector.push_back( &each_field ); aVector.push_back( &field );
} }
} }
@ -889,12 +880,10 @@ SCH_FIELD* SCH_COMPONENT::FindField( const wxString& aFieldName, bool aIncludeDe
{ {
unsigned start = aIncludeDefaultFields ? 0 : MANDATORY_FIELDS; unsigned start = aIncludeDefaultFields ? 0 : MANDATORY_FIELDS;
for( unsigned i = start; i<m_Fields.size(); ++i ) for( unsigned i = start; i < m_Fields.size(); ++i )
{ {
if( aFieldName == m_Fields[i].GetName( false ) ) if( aFieldName == m_Fields[i].GetName( false ) )
{
return &m_Fields[i]; return &m_Fields[i];
}
} }
return NULL; return NULL;
@ -1066,18 +1055,18 @@ void SCH_COMPONENT::ClearAnnotation( SCH_SHEET_PATH* aSheetPath )
if( aSheetPath ) if( aSheetPath )
path = GetPath( aSheetPath ); path = GetPath( aSheetPath );
for( unsigned int ii = 0; ii < m_PathsAndReferences.GetCount(); ii++ ) for( wxString& entry : m_PathsAndReferences )
{ {
// Break hierarchical reference in path, ref and multi selection: // Break hierarchical reference in path, ref and multi selection:
reference_fields = wxStringTokenize( m_PathsAndReferences[ii], separators ); reference_fields = wxStringTokenize( entry, separators );
// For all components: if aSheetPath is not NULL, // For all components: if aSheetPath is not NULL,
// remove annotation only for the given path // remove annotation only for the given path
if( aSheetPath == NULL || reference_fields[0].Cmp( path ) == 0 ) if( aSheetPath == NULL || reference_fields[0].Cmp( path ) == 0 )
{ {
wxString NewHref = reference_fields[0]; wxString newHref = reference_fields[0];
NewHref << wxT( " " ) << defRef << wxT( " " ) << reference_fields[2]; newHref << wxT( " " ) << defRef << wxT( " " ) << reference_fields[2];
m_PathsAndReferences[ii] = NewHref; entry = newHref;
} }
} }

View File

@ -25,8 +25,6 @@
#include <view/wx_view_controls.h> #include <view/wx_view_controls.h>
#include <ws_proxy_view_item.h>
#include <gal/graphics_abstraction_layer.h> #include <gal/graphics_abstraction_layer.h>
#include <sch_draw_panel.h> #include <sch_draw_panel.h>
#include <sch_view.h> #include <sch_view.h>
@ -38,11 +36,8 @@
#include <functional> #include <functional>
#include <sch_sheet.h> #include <sch_sheet.h>
#include <pgm_base.h> #include <pgm_base.h>
#include <tools/ee_actions.h>
#include <tools/ee_selection_tool.h> #include <tools/ee_selection_tool.h>
using namespace std::placeholders;
SCH_DRAW_PANEL::SCH_DRAW_PANEL( wxWindow* aParentWindow, wxWindowID aWindowId, SCH_DRAW_PANEL::SCH_DRAW_PANEL( wxWindow* aParentWindow, wxWindowID aWindowId,
const wxPoint& aPosition, const wxSize& aSize, const wxPoint& aPosition, const wxSize& aSize,

View File

@ -31,12 +31,8 @@
#include <sch_view.h> #include <sch_view.h>
class SCH_SHEET;
class LIB_PART; class LIB_PART;
class BASE_SCREEN;
class SCH_SCREEN; class SCH_SCREEN;
class COLORS_DESIGN_SETTINGS;
class SCH_EDIT_FRAME;
class SCH_DRAW_PANEL : public EDA_DRAW_PANEL_GAL class SCH_DRAW_PANEL : public EDA_DRAW_PANEL_GAL

View File

@ -32,15 +32,11 @@
#include <html_messagebox.h> #include <html_messagebox.h>
#include <kiface_i.h> #include <kiface_i.h>
#include <kiway.h> #include <kiway.h>
#include <msgpanel.h>
#include <pgm_base.h> #include <pgm_base.h>
#include <profile.h> #include <profile.h>
#include <sch_draw_panel.h>
#include <advanced_config.h> #include <advanced_config.h>
#include <general.h> #include <general.h>
#include <eeschema_id.h> #include <eeschema_id.h>
#include <netlist.h>
#include <class_library.h> #include <class_library.h>
#include <sch_edit_frame.h> #include <sch_edit_frame.h>
#include <symbol_lib_table.h> #include <symbol_lib_table.h>
@ -53,7 +49,6 @@
#include <invoke_sch_dialog.h> #include <invoke_sch_dialog.h>
#include <dialogs/dialog_schematic_find.h> #include <dialogs/dialog_schematic_find.h>
#include <dialog_symbol_remap.h> #include <dialog_symbol_remap.h>
#include <view/view.h>
#include <tool/tool_manager.h> #include <tool/tool_manager.h>
#include <tool/tool_dispatcher.h> #include <tool/tool_dispatcher.h>
#include <tool/action_toolbar.h> #include <tool/action_toolbar.h>
@ -70,10 +65,8 @@
#include <tools/sch_edit_tool.h> #include <tools/sch_edit_tool.h>
#include <tools/ee_inspection_tool.h> #include <tools/ee_inspection_tool.h>
#include <tools/sch_editor_control.h> #include <tools/sch_editor_control.h>
#include <build_version.h>
#include <wildcards_and_files_ext.h> #include <wildcards_and_files_ext.h>
#include <connection_graph.h> #include <connection_graph.h>
#include <sch_view.h>
#include <sch_painter.h> #include <sch_painter.h>
#include <gal/graphics_abstraction_layer.h> #include <gal/graphics_abstraction_layer.h>
@ -235,7 +228,7 @@ END_EVENT_TABLE()
SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ): SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ):
SCH_BASE_FRAME( aKiway, aParent, FRAME_SCH, wxT( "Eeschema" ), SCH_BASE_FRAME( aKiway, aParent, FRAME_SCH, wxT( "Eeschema" ),
wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, SCH_EDIT_FRAME_NAME ), wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, SCH_EDIT_FRAME_NAME ),
m_item_to_repeat( 0 ) m_item_to_repeat( nullptr )
{ {
g_CurrentSheet = new SCH_SHEET_PATH(); g_CurrentSheet = new SCH_SHEET_PATH();
g_ConnectionGraph = new CONNECTION_GRAPH( this ); g_ConnectionGraph = new CONNECTION_GRAPH( this );
@ -363,7 +356,7 @@ void SCH_EDIT_FRAME::setupTools()
void SCH_EDIT_FRAME::SaveCopyForRepeatItem( SCH_ITEM* aItem ) void SCH_EDIT_FRAME::SaveCopyForRepeatItem( SCH_ITEM* aItem )
{ {
// we cannot store a pointer to an item in the display list here since // we cannot store a pointer to an item in the display list here since
// that item may be deleted, such as part of a line concatonation or other. // that item may be deleted, such as part of a line concatenation or other.
// So simply always keep a copy of the object which is to be repeated. // So simply always keep a copy of the object which is to be repeated.
delete m_item_to_repeat; delete m_item_to_repeat;
@ -388,9 +381,9 @@ void SCH_EDIT_FRAME::SetSheetNumberAndCount()
// Examine all sheets path to find the current sheets path, // Examine all sheets path to find the current sheets path,
// and count them from root to the current sheet path: // and count them from root to the current sheet path:
for( unsigned i = 0; i < sheetList.size(); i++ ) for( const SCH_SHEET_PATH& sheet : sheetList )
{ {
wxString sheetpath = sheetList[i].Path(); wxString sheetpath = sheet.Path();
if( sheetpath == current_sheetpath ) // Current sheet path found if( sheetpath == current_sheetpath ) // Current sheet path found
break; break;
@ -656,10 +649,9 @@ void SCH_EDIT_FRAME::OnUpdatePCB( wxCommandEvent& event )
if( Kiface().IsSingle() ) if( Kiface().IsSingle() )
{ {
DisplayError( this, _( "Cannot update the PCB, because the Schematic Editor is" DisplayError( this, _( "Cannot update the PCB, because the Schematic Editor is opened"
" opened in stand-alone mode. In order to create/update" " in stand-alone mode. In order to create/update PCBs from"
" PCBs from schematics, you need to launch Kicad shell" " schematics, launch the Kicad shell and create a project." ) );
" and create a PCB project." ) );
return; return;
} }
@ -702,7 +694,7 @@ void SCH_EDIT_FRAME::ShowFindReplaceDialog( bool aReplace )
if( m_findReplaceStatusPopup ) if( m_findReplaceStatusPopup )
m_findReplaceStatusPopup->Destroy(); m_findReplaceStatusPopup->Destroy();
// Must destroy statup popup first as it holds a pointer to the dialog // Must destroy statusPopup first as it holds a pointer to the dialog
if( m_findReplaceDialog ) if( m_findReplaceDialog )
m_findReplaceDialog->Destroy(); m_findReplaceDialog->Destroy();
@ -866,7 +858,6 @@ void SCH_EDIT_FRAME::OnOpenCvpcb( wxCommandEvent& event )
{ {
player = Kiway().Player( FRAME_CVPCB, true ); player = Kiway().Player( FRAME_CVPCB, true );
player->Show( true ); player->Show( true );
// player->OpenProjectFiles( std::vector<wxString>( 1, fn.GetFullPath() ) );
} }
sendNetlistToCvpcb(); sendNetlistToCvpcb();
@ -956,7 +947,7 @@ void SCH_EDIT_FRAME::AddItemToScreenAndUndoList( SCH_ITEM* aItem, bool aUndoAppe
{ {
SCH_SCREEN* screen = GetScreen(); SCH_SCREEN* screen = GetScreen();
wxCHECK_RET( aItem != NULL, wxT( "Cannot add current aItem to list." ) ); wxCHECK_RET( aItem != NULL, wxT( "Cannot add null item to list." ) );
SCH_SHEET* parentSheet = nullptr; SCH_SHEET* parentSheet = nullptr;
SCH_COMPONENT* parentComponent = nullptr; SCH_COMPONENT* parentComponent = nullptr;
@ -1047,7 +1038,8 @@ void SCH_EDIT_FRAME::UpdateTitle()
if( GetScreen()->GetFileName() == m_DefaultSchematicFileName ) if( GetScreen()->GetFileName() == m_DefaultSchematicFileName )
{ {
title.Printf( _( "Eeschema" ) + wxT( " \u2014 %s" ), GetScreen()->GetFileName() ); title.Printf( _( "Eeschema" ) + wxT( " \u2014 %s" ),
GetScreen()->GetFileName() );
} }
else else
{ {
@ -1055,7 +1047,8 @@ void SCH_EDIT_FRAME::UpdateTitle()
wxFileName fn = fileName; wxFileName fn = fileName;
title.Printf( _( "Eeschema" ) + wxT( " \u2014 %s [%s] \u2014 %s" ), title.Printf( _( "Eeschema" ) + wxT( " \u2014 %s [%s] \u2014 %s" ),
fn.GetFullName(), g_CurrentSheet->PathHumanReadable(), fn.GetFullName(),
g_CurrentSheet->PathHumanReadable(),
fn.GetPath() ); fn.GetPath() );
if( fn.FileExists() ) if( fn.FileExists() )
@ -1156,11 +1149,11 @@ void SCH_EDIT_FRAME::FixupJunctions()
SCH_SHEET_LIST sheetList; SCH_SHEET_LIST sheetList;
sheetList.BuildSheetList( g_RootSheet ); sheetList.BuildSheetList( g_RootSheet );
for( unsigned i = 0; i < sheetList.size(); i++ ) for( const SCH_SHEET_PATH& sheet : sheetList )
{ {
std::vector<wxPoint> anchors; std::vector<wxPoint> anchors;
SetCurrentSheet( sheetList[i] ); SetCurrentSheet( sheet );
GetCurrentSheet().UpdateAllScreenReferences(); GetCurrentSheet().UpdateAllScreenReferences();
auto screen = GetCurrentSheet().LastScreen(); auto screen = GetCurrentSheet().LastScreen();
@ -1172,15 +1165,13 @@ void SCH_EDIT_FRAME::FixupJunctions()
auto cmp = static_cast<SCH_COMPONENT*>( item ); auto cmp = static_cast<SCH_COMPONENT*>( item );
auto xform = cmp->GetTransform(); auto xform = cmp->GetTransform();
for( auto pin : cmp->GetPins() ) for( const SCH_PIN& pin : cmp->GetPins() )
{ {
auto pos = cmp->GetPosition() + xform.TransformCoordinate( pin.GetPosition() ); auto pos = cmp->GetPosition() + xform.TransformCoordinate( pin.GetPosition() );
// Test if a _new_ junction is needed, and add it if missing // Test if a _new_ junction is needed, and add it if missing
if ( screen->IsJunctionNeeded( pos, true ) ) if ( screen->IsJunctionNeeded( pos, true ) )
{
AddJunction( pos ); AddJunction( pos );
}
} }
} }
} }

View File

@ -34,9 +34,7 @@
#include <tool/selection.h> #include <tool/selection.h>
#include <erc_settings.h> #include <erc_settings.h>
#include <sch_draw_panel.h> #include <sch_draw_panel.h>
#include <sch_text.h> // enum PINSHEETLABEL_SHAPE
// enum PINSHEETLABEL_SHAPE
#include <sch_text.h>
#include <tool/selection.h> #include <tool/selection.h>
#include <status_popup.h> #include <status_popup.h>
@ -171,12 +169,12 @@ protected:
* *
* @return true if the auto save was successful otherwise false. * @return true if the auto save was successful otherwise false.
*/ */
virtual bool doAutoSave() override; bool doAutoSave() override;
/** /**
* Returns true if the schematic has been modified. * Returns true if the schematic has been modified.
*/ */
virtual bool isAutoSaveRequired() const override; bool isAutoSaveRequired() const override;
/** /**
* Verify that annotation is complete so that a proper netlist is even * Verify that annotation is complete so that a proper netlist is even
@ -193,7 +191,7 @@ protected:
public: public:
SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ); SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent );
~SCH_EDIT_FRAME(); ~SCH_EDIT_FRAME() override;
SCH_SCREEN* GetScreen() const override; SCH_SCREEN* GetScreen() const override;
@ -217,7 +215,7 @@ public:
bool GetAutoplaceJustify() const { return m_autoplaceJustify; } bool GetAutoplaceJustify() const { return m_autoplaceJustify; }
void SetAutoplaceJustify( bool aEnable ) { m_autoplaceJustify = aEnable; } void SetAutoplaceJustify( bool aEnable ) { m_autoplaceJustify = aEnable; }
const wxString GetNetListFormatName() const { return m_netListFormat; } const wxString& GetNetListFormatName() const { return m_netListFormat; }
void SetNetListFormatName( const wxString& aFormat ) { m_netListFormat = aFormat; } void SetNetListFormatName( const wxString& aFormat ) { m_netListFormat = aFormat; }
bool GetSpiceAjustPassiveValues() const { return m_spiceAjustPassiveValues; } bool GetSpiceAjustPassiveValues() const { return m_spiceAjustPassiveValues; }
@ -230,10 +228,8 @@ public:
/** /**
* Return the project file parameter list for Eeschema. * Return the project file parameter list for Eeschema.
* *
*<p>
* Populate the project file parameter array specific to Eeschema if it hasn't * Populate the project file parameter array specific to Eeschema if it hasn't
* already been populated and return a reference to the array to the caller. * already been populated and return a reference to the array to the caller.
* </p>
*/ */
PARAM_CFG_ARRAY& GetProjectFileParameters(); PARAM_CFG_ARRAY& GetProjectFileParameters();
@ -307,6 +303,9 @@ public:
*/ */
void OnModify() override; void OnModify() override;
/**
* Return a human-readable description of the current screen.
*/
wxString GetScreenDesc() const override; wxString GetScreenDesc() const override;
/** /**
@ -607,7 +606,6 @@ public:
void NewProject(); void NewProject();
void LoadProject(); void LoadProject();
// read and save files
void Save_File( bool doSaveAs = false ); void Save_File( bool doSaveAs = false );
bool SaveProject(); bool SaveProject();
@ -667,8 +665,8 @@ public:
* Checks if any of the screens has unsaved changes and asks the user whether to save or * Checks if any of the screens has unsaved changes and asks the user whether to save or
* drop them. * drop them.
* *
* @return True if user decided to save or drop changes, false if the * @return True if user decided to save or drop changes, false if the operation should be
* operation should be canceled. * canceled.
*/ */
bool AskToSaveChanges(); bool AskToSaveChanges();
@ -684,8 +682,8 @@ public:
SCH_TEXT* CreateNewText( int aType ); SCH_TEXT* CreateNewText( int aType );
/** /**
* Performs routine schematic cleaning including breaking wire and buses and * Performs routine schematic cleaning including breaking wire and buses and deleting
* deleting identical objects superimposed on top of each other. * identical objects superimposed on top of each other.
* *
* NOTE: always appends to the existing undo state. * NOTE: always appends to the existing undo state.
* *
@ -735,18 +733,11 @@ private:
* *
* If file name defined by SCH_SCREEN::m_FileName is not set, the title is set to the * If file name defined by SCH_SCREEN::m_FileName is not set, the title is set to the
* application name appended with no file. * application name appended with no file.
* Otherwise, the title is set to the hierarchical sheet path and the full file name, * Otherwise, the title is set to the hierarchical sheet path and the full file name, and
* and read only is appended to the title if the user does not have write * read only is appended to the title if the user does not have write access to the file.
* access to the file.
*/ */
void UpdateTitle(); void UpdateTitle();
/**
* Checks all wires and adds any junctions that are missing
* (Intended to be called only on file load)
*/
bool AddMissingJunctions( SCH_SCREEN* aScreen );
/** /**
* Perform all cleanup and normalization steps so that the whole schematic * Perform all cleanup and normalization steps so that the whole schematic
* is in a good state. This should only be called when loading a file. * is in a good state. This should only be called when loading a file.
@ -801,8 +792,6 @@ public:
void LoadSheetFromFile( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy, void LoadSheetFromFile( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy,
const wxString& aExistingFilename ); const wxString& aExistingFilename );
wxPoint GetLastSheetPinPosition() const { return m_lastSheetPinPosition; }
private: private:
/** /**
* Load the given filename but sets the path to the current project path. * Load the given filename but sets the path to the current project path.

View File

@ -24,7 +24,6 @@
#include <ee_picker_tool.h> #include <ee_picker_tool.h>
#include <ee_actions.h> #include <ee_actions.h>
#include <view/view_controls.h> #include <view/view_controls.h>
#include <tool/tool_manager.h>
#include <sch_base_frame.h> #include <sch_base_frame.h>
@ -149,9 +148,6 @@ void EE_PICKER_TOOL::setTransitions()
void EE_PICKER_TOOL::resetPicker() void EE_PICKER_TOOL::resetPicker()
{ {
m_cursorCapture = false;
m_autoPanning = false;
m_clickHandler = NULLOPT; m_clickHandler = NULLOPT;
m_motionHandler = NULLOPT; m_motionHandler = NULLOPT;
m_cancelHandler = NULLOPT; m_cancelHandler = NULLOPT;
@ -163,6 +159,6 @@ void EE_PICKER_TOOL::setControls()
{ {
KIGFX::VIEW_CONTROLS* controls = getViewControls(); KIGFX::VIEW_CONTROLS* controls = getViewControls();
controls->CaptureCursor( m_cursorCapture ); controls->CaptureCursor( false );
controls->SetAutoPan( m_autoPanning ); controls->SetAutoPan( false );
} }

View File

@ -55,18 +55,6 @@ public:
///> Main event loop. ///> Main event loop.
int Main( const TOOL_EVENT& aEvent ); int Main( const TOOL_EVENT& aEvent );
/**
* Function SetAutoPanning()
* Sets autopanning mode for the period when the tool is active.
*/
inline void SetAutoPanning( bool aEnable ) { m_autoPanning = aEnable; }
/**
* Function SetAutoPanning()
* Toggles cursor capture mode for the period when the tool is active.
*/
inline void SetCursorCapture( bool aEnable ) { m_cursorCapture = aEnable; }
/** /**
* Function SetClickHandler() * Function SetClickHandler()
* Sets a handler for mouse click event. Handler may decide to receive further click by * Sets a handler for mouse click event. Handler may decide to receive further click by
@ -119,9 +107,6 @@ private:
void setTransitions() override; void setTransitions() override;
private: private:
bool m_cursorCapture;
bool m_autoPanning;
OPT<CLICK_HANDLER> m_clickHandler; OPT<CLICK_HANDLER> m_clickHandler;
OPT<MOTION_HANDLER> m_motionHandler; OPT<MOTION_HANDLER> m_motionHandler;
OPT<CANCEL_HANDLER> m_cancelHandler; OPT<CANCEL_HANDLER> m_cancelHandler;

View File

@ -353,7 +353,7 @@ int LIB_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
LIB_ITEM* item = (LIB_ITEM*) selection.Front(); LIB_ITEM* item = (LIB_ITEM*) selection.Front();
// Save copy for undo if not in edit (edit command already handle the save copy) // Save copy for undo if not in edit (edit command already handle the save copy)
if( !item->InEditMode() ) if( item->GetEditFlags() == 0 )
saveCopyInUndoList( item->GetParent(), UR_LIBEDIT ); saveCopyInUndoList( item->GetParent(), UR_LIBEDIT );
switch( item->Type() ) switch( item->Type() )

View File

@ -31,9 +31,7 @@
PL_PICKER_TOOL::PL_PICKER_TOOL() : PL_PICKER_TOOL::PL_PICKER_TOOL() :
TOOL_INTERACTIVE( "plEditor.InteractivePicker" ), TOOL_INTERACTIVE( "plEditor.InteractivePicker" ),
m_frame( nullptr ), m_frame( nullptr )
m_cursorCapture( false ),
m_autoPanning( false )
{ {
resetPicker(); resetPicker();
} }
@ -58,8 +56,6 @@ bool PL_PICKER_TOOL::Init()
void PL_PICKER_TOOL::Reset( RESET_REASON aReason ) void PL_PICKER_TOOL::Reset( RESET_REASON aReason )
{ {
m_cursorCapture = false;
m_autoPanning = false;
} }
@ -175,9 +171,6 @@ void PL_PICKER_TOOL::setTransitions()
void PL_PICKER_TOOL::resetPicker() void PL_PICKER_TOOL::resetPicker()
{ {
m_cursorCapture = false;
m_autoPanning = false;
m_picked = NULLOPT; m_picked = NULLOPT;
m_motionHandler = NULLOPT; m_motionHandler = NULLOPT;
m_clickHandler = NULLOPT; m_clickHandler = NULLOPT;
@ -190,6 +183,6 @@ void PL_PICKER_TOOL::setControls()
{ {
KIGFX::VIEW_CONTROLS* controls = getViewControls(); KIGFX::VIEW_CONTROLS* controls = getViewControls();
controls->CaptureCursor( m_cursorCapture ); controls->CaptureCursor( false );
controls->SetAutoPan( m_autoPanning ); controls->SetAutoPan( false );
} }

View File

@ -61,18 +61,6 @@ public:
///> Main event loop. ///> Main event loop.
int Main( const TOOL_EVENT& aEvent ); int Main( const TOOL_EVENT& aEvent );
/**
* Function SetAutoPanning()
* Sets autopanning mode for the period when the tool is active.
*/
inline void SetAutoPanning( bool aEnable ) { m_autoPanning = aEnable; }
/**
* Function SetAutoPanning()
* Toggles cursor capture mode for the period when the tool is active.
*/
inline void SetCursorCapture( bool aEnable ) { m_cursorCapture = aEnable; }
/** /**
* Function SetClickHandler() * Function SetClickHandler()
* Sets a handler for mouse click event. Handler may decide to receive further click by * Sets a handler for mouse click event. Handler may decide to receive further click by
@ -127,9 +115,6 @@ private:
private: private:
PL_EDITOR_FRAME* m_frame; PL_EDITOR_FRAME* m_frame;
bool m_cursorCapture;
bool m_autoPanning;
OPT<CLICK_HANDLER> m_clickHandler; OPT<CLICK_HANDLER> m_clickHandler;
OPT<MOTION_HANDLER> m_motionHandler; OPT<MOTION_HANDLER> m_motionHandler;
OPT<CANCEL_HANDLER> m_cancelHandler; OPT<CANCEL_HANDLER> m_cancelHandler;

View File

@ -159,8 +159,6 @@ void PCBNEW_PICKER_TOOL::setTransitions()
void PCBNEW_PICKER_TOOL::reset() void PCBNEW_PICKER_TOOL::reset()
{ {
m_cursorCapture = false;
m_autoPanning = false;
m_layerMask = LSET::AllLayersMask(); m_layerMask = LSET::AllLayersMask();
m_picked = NULLOPT; m_picked = NULLOPT;
@ -178,6 +176,6 @@ void PCBNEW_PICKER_TOOL::setControls()
// Ensure that the view controls do not handle our snapping as we use the GRID_HELPER // Ensure that the view controls do not handle our snapping as we use the GRID_HELPER
controls->SetSnapping( false ); controls->SetSnapping( false );
controls->CaptureCursor( m_cursorCapture ); controls->CaptureCursor( false );
controls->SetAutoPan( m_autoPanning ); controls->SetAutoPan( false );
} }

View File

@ -58,18 +58,6 @@ public:
///> Main event loop. ///> Main event loop.
int Main( const TOOL_EVENT& aEvent ); int Main( const TOOL_EVENT& aEvent );
/**
* Function SetAutoPanning()
* Sets autopanning mode for the period when the tool is active.
*/
inline void SetAutoPanning( bool aEnable ) { m_autoPanning = aEnable; }
/**
* Function SetAutoPanning()
* Toggles cursor capture mode for the period when the tool is active.
*/
inline void SetCursorCapture( bool aEnable ) { m_cursorCapture = aEnable; }
/** /**
* Function SetLayerSet() * Function SetLayerSet()
* Sets the tool's snap layer set * Sets the tool's snap layer set
@ -121,9 +109,6 @@ public:
void setTransitions() override; void setTransitions() override;
private: private:
bool m_cursorCapture;
bool m_autoPanning;
///> The layer set to use for optional snapping ///> The layer set to use for optional snapping
LSET m_layerMask; LSET m_layerMask;