Merge with main branch r6576

This commit is contained in:
Cirilo Bernardo 2016-02-22 19:58:32 +11:00
commit af0ac955b9
84 changed files with 473 additions and 66956 deletions

View File

@ -173,7 +173,7 @@ void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
GetScreen()->ClearDrawingState();
GetScreen()->ClearBlockCommand();
GetScreen()->SetCurItem( NULL );
GetScreen()->TestDanglingEnds( m_canvas, DC );
GetScreen()->TestDanglingEnds();
if( block->GetCount() )
{
@ -232,7 +232,7 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* aDC )
}
block->ClearItemsList();
GetScreen()->TestDanglingEnds( m_canvas, aDC );
GetScreen()->TestDanglingEnds();
m_canvas->Refresh();
break;
@ -286,7 +286,7 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* aDC )
OnModify();
}
block->ClearItemsList();
GetScreen()->TestDanglingEnds( m_canvas, aDC );
GetScreen()->TestDanglingEnds();
m_canvas->Refresh();
break;
@ -327,7 +327,7 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* aDC )
OnModify();
}
GetScreen()->TestDanglingEnds( m_canvas, aDC );
GetScreen()->TestDanglingEnds();
m_canvas->Refresh();
break;
@ -346,7 +346,7 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* aDC )
OnModify();
}
GetScreen()->TestDanglingEnds( m_canvas, aDC );
GetScreen()->TestDanglingEnds();
m_canvas->Refresh();
break;

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004 Jean-Pierre Charras, jean-pierre.charras@gipsa-lab.inpg.fr
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2004-2016 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -314,7 +314,7 @@ void SCH_EDIT_FRAME::EndSegment( wxDC* DC )
screen->Append( s_wires );
// Correct and remove segments that need to be merged.
screen->SchematicCleanUp( NULL, DC );
screen->SchematicCleanUp();
// A junction could be needed to connect the end point of the last created segment.
if( screen->IsJunctionNeeded( endpoint ) )
@ -429,7 +429,7 @@ SCH_NO_CONNECT* SCH_EDIT_FRAME::AddNoConnect( wxDC* aDC, const wxPoint& aPositio
SetRepeatItem( no_connect );
GetScreen()->Append( no_connect );
GetScreen()->SchematicCleanUp( m_canvas, aDC );
GetScreen()->SchematicCleanUp();
OnModify();
m_canvas->Refresh();
SaveCopyInUndoList( no_connect, UR_NEW );
@ -494,8 +494,17 @@ void SCH_EDIT_FRAME::RepeatDrawItem( wxDC* DC )
( (SCH_TEXT*) my_clone )->IncrementLabel( GetRepeatDeltaLabel() );
GetScreen()->Append( my_clone );
GetScreen()->TestDanglingEnds();
my_clone->Draw( m_canvas, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
if( my_clone->IsConnectable() )
{
GetScreen()->TestDanglingEnds();
m_canvas->Refresh();
}
else
{
my_clone->Draw( m_canvas, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
}
SaveCopyInUndoList( my_clone, UR_NEW );
my_clone->ClearFlags();
}

View File

@ -1672,6 +1672,8 @@ void LIB_PART::SetConversion( bool aSetConvert )
// Duplicate items to create the converted shape
if( aSetConvert )
{
std::vector< LIB_ITEM* > tmp; // Temporarily store the duplicated pins here.
BOOST_FOREACH( LIB_ITEM& item, drawings )
{
// Only pins are duplicated.
@ -1682,9 +1684,13 @@ void LIB_PART::SetConversion( bool aSetConvert )
{
LIB_ITEM* newItem = (LIB_ITEM*) item.Clone();
newItem->m_Convert = 2;
drawings.push_back( newItem );
tmp.push_back( newItem );
}
}
// Transfer the new pins to the LIB_PART.
for( unsigned i = 0; i < tmp.size(); i++ )
drawings.push_back( tmp[i] );
}
else
{

View File

@ -1,9 +1,9 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2013 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -173,8 +173,9 @@ NETLIST_OBJECT::NETLIST_OBJECT()
* contains this pin
*/
m_Flag = 0; /* flag used in calculations */
m_ElectricalType = 0; /* Has meaning only for Pins and hierarchical pins: electrical
* type */
m_ElectricalPinType = PIN_INPUT; /* Has meaning only for Pins: electrical type of the pin
* used to detect conflicts between pins in ERC
*/
m_netCode = 0; /* net code for all items except BUS labels because a BUS
* label has as many net codes as bus members
*/
@ -315,6 +316,32 @@ void NETLIST_OBJECT::ConvertBusToNetListItems( NETLIST_OBJECT_LIST& aNetListItem
}
}
bool NETLIST_OBJECT::IsLabelGlobal() const
{
// return true if the object is a global label
// * a actual global label
// * a pin label coming from a invisible power pin
return ( m_Type == NET_PINLABEL ) ||
( m_Type == NET_GLOBLABEL ) ||
( m_Type == NET_GLOBBUSLABELMEMBER );
}
bool NETLIST_OBJECT::IsLabelBusMemberType() const
{
// return true if the object is a bus label member build from a
// schematic bus label (like label[xx..yy)
// They are labels with very specific properties, especially for connection
// between them: 2 bus label members can be connected only
// if they have the same member value.
return ( m_Type == NET_SHEETBUSLABELMEMBER ) ||
( m_Type == NET_BUSLABELMEMBER ) ||
( m_Type == NET_HIERBUSLABELMEMBER ) ||
( m_Type == NET_GLOBBUSLABELMEMBER );
}
/*
* return the net name of the item
*/
@ -373,7 +400,7 @@ wxString NETLIST_OBJECT::GetShortNetName() const
* Set m_netNameCandidate to a connected item which will
* be used to calcule the net name of the item
* Obviously the candidate can be only a label
* when there is no label on the net a pad which will
* If there is no label on the net, a pad name will be
* used to build a net name (something like Cmp<REF>_Pad<PAD_NAME>
* @param aCandidate = the connected item candidate
*/
@ -385,6 +412,8 @@ void NETLIST_OBJECT::SetNetNameCandidate( NETLIST_OBJECT* aCandidate )
case NET_LABEL:
case NET_PINLABEL:
case NET_GLOBLABEL:
case NET_GLOBBUSLABELMEMBER:
case NET_SHEETBUSLABELMEMBER:
case NET_PIN:
m_netNameCandidate = aCandidate;
break;

View File

@ -59,6 +59,8 @@ enum NETLIST_ITEM_T
* the bus label (like DATA[0..7] is
* converted to n single labels like
* DATA0, DATA1 ...
* These objects are living only in the current
* NETLIST_OBJECT_LIST, not in shematic.
*/
NET_GLOBBUSLABELMEMBER, // see NET_BUSLABELMEMBER, used when a
// global bus label is found
@ -103,8 +105,7 @@ public:
int m_Flag; /* flag used in calculations */
SCH_SHEET_PATH m_SheetPath; // the sheet path which contains this item
SCH_SHEET_PATH m_SheetPathInclude; // sheet path which contains the hierarchical label
int m_ElectricalType; /* Has meaning only for Pins and
* hierarchical pins: electrical type */
ELECTRICAL_PINTYPE m_ElectricalPinType; // Has meaning only for Pins: electrical type of the pin
int m_BusNetCode; /* Used for BUS connections */
int m_Member; /* for labels type NET_BUSLABELMEMBER ( bus member
* created from the BUS label ) member number.
@ -217,10 +218,19 @@ public:
* (i.e. an real global label or a pin label coming
* from a power pin invisible
*/
bool IsLabelGlobal() const
{
return ( m_Type == NET_PINLABEL ) || ( m_Type == NET_GLOBLABEL );
}
bool IsLabelGlobal() const;
/**
* Function IsLabelBusMemberType
* @return true if the object is a bus label member build from a
* schematic bus label (like label[xx..yy], xx and yy are the first and last
* bus member id)
* bus label members have specific properties:
* they do not live in schematic
* they have specific properties in connections:
* 2 bus label members can be connected connected only if they have the same member value.
*/
bool IsLabelBusMemberType() const;
/**
* Function IsLabelType
@ -436,7 +446,7 @@ private:
return Objet1->m_SheetPath.Cmp( Objet2->m_SheetPath ) < 0;
}
/*
/**
* Propagate net codes from a parent sheet to an include sheet,
* from a pin sheet connection
*/
@ -444,8 +454,8 @@ private:
void pointToPointConnect( NETLIST_OBJECT* aRef, bool aIsBus, int start );
/*
* Search connections betweena junction and segments
/**
* Search connections between a junction and segments
* Propagate the junction net code to objects connected by this junction.
* The junction must have a valid net code
* The list of objects is expected sorted by sheets.
@ -453,9 +463,16 @@ private:
*/
void segmentToPointConnect( NETLIST_OBJECT* aJonction, bool aIsBus, int aIdxStart );
/**
* Function connectBusLabels
* Propagate the net code (and create it, if not yet existing) between
* all bus label member objects connected by they name.
* Search is done in the entire list
*/
void connectBusLabels();
/*
/**
* Set the m_FlagOfConnection member of items in list
* depending on the connection type:
* UNCONNECTED, PAD_CONNECT or NOCONNECT_SYMBOL_PRESENT

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -256,20 +256,16 @@ public:
* performs routine schematic cleaning including breaking wire and buses and
* deleting identical objects superimposed on top of each other.
*
* @param aCanvas The window to draw on.
* @param aDC The device context used for drawing to \a aCanvas.
* @return True if any schematic clean up was performed.
*/
bool SchematicCleanUp( EDA_DRAW_PANEL* aCanvas = NULL, wxDC* aDC = NULL );
bool SchematicCleanUp();
/**
* Function TestDanglingEnds
* tests all of the connectible objects in the schematic for unused connection points.
* @param aDC - The device context to draw the dangling status indicators.
* @param aCanvas - The window to draw on.
* @return True if any dangling ends were found.
* @return True if any connection state changes were made.
*/
bool TestDanglingEnds( EDA_DRAW_PANEL* aCanvas = NULL, wxDC* aDC = NULL );
bool TestDanglingEnds();
/**
* Function ExtractWires

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Mar 9 2015)
// C++ code generated with wxFormBuilder (version Mar 28 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 20 2015)
// C++ code generated with wxFormBuilder (version Mar 28 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Mar 9 2015)
// C++ code generated with wxFormBuilder (version Mar 28 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Mar 9 2015)
// C++ code generated with wxFormBuilder (version Mar 28 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 5 2014)
// C++ code generated with wxFormBuilder (version Mar 28 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 5 2014)
// C++ code generated with wxFormBuilder (version Mar 28 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 5 2014)
// C++ code generated with wxFormBuilder (version Mar 28 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -27,24 +27,24 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx
wxStaticBoxSizer* m_OptionsBoxSizer;
m_OptionsBoxSizer = new wxStaticBoxSizer( new wxStaticBox( m_PanelBasic, wxID_ANY, _("General") ), wxVERTICAL );
m_AsConvertButt = new wxCheckBox( m_PanelBasic, wxID_ANY, _("Has alternate symbol (DeMorgan)"), wxDefaultPosition, wxDefaultSize, 0 );
m_AsConvertButt = new wxCheckBox( m_OptionsBoxSizer->GetStaticBox(), wxID_ANY, _("Has alternate symbol (DeMorgan)"), wxDefaultPosition, wxDefaultSize, 0 );
m_AsConvertButt->SetToolTip( _("Check this option if the component has an alternate body style (De Morgan)") );
m_OptionsBoxSizer->Add( m_AsConvertButt, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_ShowPinNumButt = new wxCheckBox( m_PanelBasic, wxID_ANY, _("Show pin number"), wxDefaultPosition, wxDefaultSize, 0 );
m_ShowPinNumButt = new wxCheckBox( m_OptionsBoxSizer->GetStaticBox(), wxID_ANY, _("Show pin number"), wxDefaultPosition, wxDefaultSize, 0 );
m_ShowPinNumButt->SetValue(true);
m_ShowPinNumButt->SetToolTip( _("Show or hide pin numbers") );
m_OptionsBoxSizer->Add( m_ShowPinNumButt, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_ShowPinNameButt = new wxCheckBox( m_PanelBasic, wxID_ANY, _("Show pin name"), wxDefaultPosition, wxDefaultSize, 0 );
m_ShowPinNameButt = new wxCheckBox( m_OptionsBoxSizer->GetStaticBox(), wxID_ANY, _("Show pin name"), wxDefaultPosition, wxDefaultSize, 0 );
m_ShowPinNameButt->SetValue(true);
m_ShowPinNameButt->SetToolTip( _("Show or hide pin names") );
m_OptionsBoxSizer->Add( m_ShowPinNameButt, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_PinsNameInsideButt = new wxCheckBox( m_PanelBasic, wxID_ANY, _("Place pin names inside"), wxDefaultPosition, wxDefaultSize, 0 );
m_PinsNameInsideButt = new wxCheckBox( m_OptionsBoxSizer->GetStaticBox(), wxID_ANY, _("Place pin names inside"), wxDefaultPosition, wxDefaultSize, 0 );
m_PinsNameInsideButt->SetValue(true);
m_PinsNameInsideButt->SetToolTip( _("Check this option to have pin names inside the body and pin number outside.\nIf not checked pins names and pins numbers are outside.") );

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 5 2014)
// C++ code generated with wxFormBuilder (version Mar 28 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 17 2015)
// C++ code generated with wxFormBuilder (version Mar 28 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 17 2015)
// C++ code generated with wxFormBuilder (version Mar 28 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Mar 9 2015)
// C++ code generated with wxFormBuilder (version Mar 28 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Mar 9 2015)
// C++ code generated with wxFormBuilder (version Mar 28 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Mar 9 2015)
// C++ code generated with wxFormBuilder (version Mar 28 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -76,12 +76,12 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE
wxStaticBoxSizer* visibilitySizer;
visibilitySizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Visibility") ), wxVERTICAL );
showCheckBox = new wxCheckBox( this, wxID_ANY, _("Show"), wxDefaultPosition, wxDefaultSize, 0 );
showCheckBox = new wxCheckBox( visibilitySizer->GetStaticBox(), wxID_ANY, _("Show"), wxDefaultPosition, wxDefaultSize, 0 );
showCheckBox->SetToolTip( _("Check if you want this field visible") );
visibilitySizer->Add( showCheckBox, 0, wxALL, 5 );
rotateCheckBox = new wxCheckBox( this, wxID_ANY, _("Rotate"), wxDefaultPosition, wxDefaultSize, 0 );
rotateCheckBox = new wxCheckBox( visibilitySizer->GetStaticBox(), wxID_ANY, _("Rotate"), wxDefaultPosition, wxDefaultSize, 0 );
rotateCheckBox->SetToolTip( _("Check if you want this field's text rotated 90 degrees") );
visibilitySizer->Add( rotateCheckBox, 0, wxALL, 5 );

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Mar 9 2015)
// C++ code generated with wxFormBuilder (version Mar 28 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 5 2014)
// C++ code generated with wxFormBuilder (version Mar 28 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 5 2014)
// C++ code generated with wxFormBuilder (version Mar 28 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Dec 28 2015)
// C++ code generated with wxFormBuilder (version Mar 28 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Dec 28 2015)
// C++ code generated with wxFormBuilder (version Mar 28 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!

View File

@ -2,8 +2,8 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2012-2016 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -480,7 +480,7 @@ void DIALOG_ERC::TestErc( wxArrayString* aMessagesList )
/* Ff wire list has changed, delete Undo Redo list to avoid pointers on deleted
* data problems.
*/
if( screen->SchematicCleanUp( NULL ) )
if( screen->SchematicCleanUp() )
screen->ClearUndoRedoList();
}

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 17 2015)
// C++ code generated with wxFormBuilder (version Mar 28 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 17 2015)
// C++ code generated with wxFormBuilder (version Mar 28 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="11" />
<FileVersion major="1" minor="13" />
<object class="Project" expanded="1">
<property name="class_decoration"></property>
<property name="code_generation">C++</property>
@ -20,8 +20,10 @@
<property name="path">.</property>
<property name="precompiled_header"></property>
<property name="relative_path">1</property>
<property name="skip_lua_events">1</property>
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_enum">1</property>
<property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1">

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 8 2012)
// C++ code generated with wxFormBuilder (version Mar 28 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 8 2012)
// C++ code generated with wxFormBuilder (version Mar 28 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2010 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2014 KiCad Developers, see CHANGELOG.TXT for contributors.
* Copyright (C) 2016 KiCad Developers, see CHANGELOG.TXT for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -134,7 +134,7 @@ void DIALOG_LIB_EDIT_PIN::OnPropertiesChange( wxCommandEvent& event )
int pinOrient = LIB_PIN::GetOrientationCode( GetOrientation() );
int pinLength = ValueFromString( g_UserUnit, GetLength() );
int pinShape = LIB_PIN::GetStyleCode( GetStyle() );
int pinType = GetElectricalType();
ELECTRICAL_PINTYPE pinType = GetElectricalType();
m_dummyPin->SetName( GetPinName() );
m_dummyPin->SetNameTextSize( pinNameSize );

View File

@ -64,9 +64,12 @@ public:
{
m_choiceElectricalType->SetSelection( type );
}
int GetElectricalType( void )
ELECTRICAL_PINTYPE GetElectricalType( void )
{
return m_choiceElectricalType->GetSelection();
// m_choiceElectricalType is expected having the eletrical type names
// order indentical to the ELECTRICAL_PINTYPE enum
return (ELECTRICAL_PINTYPE)m_choiceElectricalType->GetSelection();
}
void SetStyleList( const wxArrayString& list, const BITMAP_DEF* aBitmaps );

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Mar 9 2015)
// C++ code generated with wxFormBuilder (version Mar 28 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -80,11 +80,11 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID
wxStaticBoxSizer* sbSizerPinSharing;
sbSizerPinSharing = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Sharing") ), wxVERTICAL );
m_checkApplyToAllParts = new wxCheckBox( this, wxID_ANY, _("Common to all &units in component"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizerPinSharing->Add( m_checkApplyToAllParts, 0, wxALL, 3 );
m_checkApplyToAllParts = new wxCheckBox( sbSizerPinSharing->GetStaticBox(), wxID_ANY, _("Common to all &units in component"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizerPinSharing->Add( m_checkApplyToAllParts, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_checkApplyToAllConversions = new wxCheckBox( this, wxID_ANY, _("Common to all body &styles (DeMorgan)"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizerPinSharing->Add( m_checkApplyToAllConversions, 0, wxALL, 3 );
m_checkApplyToAllConversions = new wxCheckBox( sbSizerPinSharing->GetStaticBox(), wxID_ANY, _("Common to all body &styles (DeMorgan)"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizerPinSharing->Add( m_checkApplyToAllConversions, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
boarderSizer->Add( sbSizerPinSharing, 0, wxEXPAND|wxALL, 5 );
@ -92,7 +92,7 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID
wxStaticBoxSizer* sbSizerSchematicProperties;
sbSizerSchematicProperties = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Schematic Properties") ), wxVERTICAL );
m_checkShow = new wxCheckBox( this, wxID_ANY, _("&Visible"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkShow = new wxCheckBox( sbSizerSchematicProperties->GetStaticBox(), wxID_ANY, _("&Visible"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkShow->SetValue(true);
sbSizerSchematicProperties->Add( m_checkShow, 0, wxALL, 3 );

View File

@ -1022,7 +1022,7 @@
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxALL</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
@ -1110,7 +1110,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxALL</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Mar 9 2015)
// C++ code generated with wxFormBuilder (version Mar 28 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!

View File

@ -1,7 +1,28 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "dialog_lib_edit_pin_table.h"
#include "lib_pin.h"
#include "pin_number.h"
#include <boost/algorithm/string/join.hpp>
@ -168,14 +189,14 @@ DIALOG_LIB_EDIT_PIN_TABLE::DIALOG_LIB_EDIT_PIN_TABLE( wxWindow* parent,
DataViewModel::PIN_TYPE,
100,
wxAlignment( wxALIGN_LEFT | wxALIGN_TOP ),
wxDATAVIEW_COL_RESIZABLE );
wxDATAVIEW_COL_RESIZABLE | wxDATAVIEW_COL_SORTABLE );
wxDataViewTextRenderer* rend3 = new wxDataViewTextRenderer( wxT( "string" ), wxDATAVIEW_CELL_INERT );
wxDataViewColumn* col3 = new wxDataViewColumn( _( "Position" ),
rend3,
DataViewModel::PIN_POSITION,
100,
wxAlignment( wxALIGN_LEFT | wxALIGN_TOP ),
wxDATAVIEW_COL_RESIZABLE );
wxDATAVIEW_COL_RESIZABLE | wxDATAVIEW_COL_SORTABLE );
m_Pins->AppendColumn( col0 );
m_Pins->SetExpanderColumn( col0 );
m_Pins->AppendColumn( col1 );

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 5 2014)
// C++ code generated with wxFormBuilder (version Mar 28 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 5 2014)
// C++ code generated with wxFormBuilder (version Mar 28 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Mar 9 2015)
// C++ code generated with wxFormBuilder (version Mar 28 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -76,19 +76,19 @@ DIALOG_LIB_EDIT_TEXT_BASE::DIALOG_LIB_EDIT_TEXT_BASE( wxWindow* parent, wxWindow
wxStaticBoxSizer* sOptionsSizer;
sOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Options") ), wxVERTICAL );
m_Orient = new wxCheckBox( this, wxID_ANY, _("Vertical"), wxDefaultPosition, wxDefaultSize, 0 );
m_Orient = new wxCheckBox( sOptionsSizer->GetStaticBox(), wxID_ANY, _("Vertical"), wxDefaultPosition, wxDefaultSize, 0 );
sOptionsSizer->Add( m_Orient, 0, wxALL, 5 );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
m_staticline1 = new wxStaticLine( sOptionsSizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
sOptionsSizer->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 );
m_CommonUnit = new wxCheckBox( this, wxID_ANY, _("Common to all units"), wxDefaultPosition, wxDefaultSize, 0 );
m_CommonUnit = new wxCheckBox( sOptionsSizer->GetStaticBox(), wxID_ANY, _("Common to all units"), wxDefaultPosition, wxDefaultSize, 0 );
sOptionsSizer->Add( m_CommonUnit, 0, wxALL, 5 );
m_CommonConvert = new wxCheckBox( this, wxID_ANY, _("Common to all body styles"), wxDefaultPosition, wxDefaultSize, 0 );
m_CommonConvert = new wxCheckBox( sOptionsSizer->GetStaticBox(), wxID_ANY, _("Common to all body styles"), wxDefaultPosition, wxDefaultSize, 0 );
sOptionsSizer->Add( m_CommonConvert, 0, wxALL|wxEXPAND, 5 );
m_Invisible = new wxCheckBox( this, wxID_ANY, _("Invisible"), wxDefaultPosition, wxDefaultSize, 0 );
m_Invisible = new wxCheckBox( sOptionsSizer->GetStaticBox(), wxID_ANY, _("Invisible"), wxDefaultPosition, wxDefaultSize, 0 );
sOptionsSizer->Add( m_Invisible, 0, wxALL, 5 );

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Mar 9 2015)
// C++ code generated with wxFormBuilder (version Mar 28 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Mar 9 2015)
// C++ code generated with wxFormBuilder (version Mar 28 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Mar 9 2015)
// C++ code generated with wxFormBuilder (version Mar 28 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Mar 13 2015)
// C++ code generated with wxFormBuilder (version Mar 28 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Mar 13 2015)
// C++ code generated with wxFormBuilder (version Mar 28 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Mar 9 2015)
// C++ code generated with wxFormBuilder (version Mar 28 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Mar 9 2015)
// C++ code generated with wxFormBuilder (version Mar 28 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 17 2015)
// C++ code generated with wxFormBuilder (version Mar 28 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 17 2015)
// C++ code generated with wxFormBuilder (version Mar 28 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 5 2014)
// C++ code generated with wxFormBuilder (version Mar 28 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 5 2014)
// C++ code generated with wxFormBuilder (version Mar 28 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Mar 13 2015)
// C++ code generated with wxFormBuilder (version Mar 28 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Mar 13 2015)
// C++ code generated with wxFormBuilder (version Mar 28 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 5 2014)
// C++ code generated with wxFormBuilder (version Mar 28 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!

View File

@ -203,7 +203,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">6</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1">
<property name="BottomDockable">1</property>
@ -387,7 +387,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">6</property>
<property name="flag">wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1">
<property name="BottomDockable">1</property>
@ -644,7 +644,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">6</property>
<property name="flag">wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1">
<property name="BottomDockable">1</property>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 5 2014)
// C++ code generated with wxFormBuilder (version Mar 28 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Mar 9 2015)
// C++ code generated with wxFormBuilder (version Mar 28 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Mar 9 2015)
// C++ code generated with wxFormBuilder (version Mar 28 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jan 1 2016)
// C++ code generated with wxFormBuilder (version Mar 28 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jan 1 2016)
// C++ code generated with wxFormBuilder (version Mar 28 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!

View File

@ -279,7 +279,7 @@ void Diagnose( NETLIST_OBJECT* aNetItemRef, NETLIST_OBJECT* aNetItemTst,
return;
}
ii = aNetItemRef->m_ElectricalType;
ii = aNetItemRef->m_ElectricalPinType;
wxString string_pinnum, cmp_ref;
char ascii_buf[5];
@ -337,7 +337,7 @@ void Diagnose( NETLIST_OBJECT* aNetItemRef, NETLIST_OBJECT* aNetItemTst,
if( aNetItemTst ) /* Error between 2 pins */
{
jj = aNetItemTst->m_ElectricalType;
jj = aNetItemTst->m_ElectricalPinType;
int errortype = ERCE_PIN_TO_PIN_WARNING;
if( aDiag == ERR )
@ -378,7 +378,7 @@ void TestOthersItems( NETLIST_OBJECT_LIST* aList,
int erc = OK;
/* Analysis of the table of connections. */
int ref_elect_type = aList->GetItem( aNetItemRef )->m_ElectricalType;
ELECTRICAL_PINTYPE ref_elect_type = aList->GetItem( aNetItemRef )->m_ElectricalPinType;
int local_minconn = NOC;
if( ref_elect_type == PIN_NC )
@ -476,7 +476,7 @@ void TestOthersItems( NETLIST_OBJECT_LIST* aList,
break;
case NET_PIN:
jj = aList->GetItem( netItemTst )->m_ElectricalType;
jj = aList->GetItem( netItemTst )->m_ElectricalPinType;
local_minconn = std::max( MinimalReq[ref_elect_type][jj], local_minconn );
if( netItemTst <= aNetItemRef )

View File

@ -275,8 +275,10 @@ void SCH_EDIT_FRAME::OrientComponent( COMPONENT_ORIENTATION_T aOrientation )
component->SetOrientation( aOrientation );
m_canvas->CrossHairOn( &dc );
GetScreen()->TestDanglingEnds( m_canvas, &dc );
m_canvas->Refresh();
if( GetScreen()->TestDanglingEnds() )
m_canvas->Refresh();
OnModify();
}
@ -333,8 +335,9 @@ void SCH_EDIT_FRAME::OnSelectUnit( wxCommandEvent& aEvent )
if( m_autoplaceFields )
component->AutoAutoplaceFields( GetScreen() );
screen->TestDanglingEnds( m_canvas, &dc );
m_canvas->Refresh();
if( screen->TestDanglingEnds() )
m_canvas->Refresh();
OnModify();
}
}
@ -371,6 +374,9 @@ void SCH_EDIT_FRAME::ConvertPart( SCH_COMPONENT* DrawComponent, wxDC* DC )
if( DrawComponent->GetConvert() > 2 )
DrawComponent->SetConvert( 1 );
// The alternate symbol may cause a change in the connection status so test the
// connections so the connection indicators are drawn correctly.
GetScreen()->TestDanglingEnds();
DrawComponent->ClearFlags();
DrawComponent->SetFlags( flags ); // Restore m_Flag (modified by SetConvert())
@ -380,7 +386,6 @@ void SCH_EDIT_FRAME::ConvertPart( SCH_COMPONENT* DrawComponent, wxDC* DC )
else
DrawComponent->Draw( m_canvas, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
GetScreen()->TestDanglingEnds( m_canvas, DC );
OnModify();
}
}

View File

@ -2,8 +2,8 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2008-2016 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2016 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -295,7 +295,7 @@ void SCH_EDIT_FRAME::DisplayCurrentSheet()
screen->m_FirstRedraw = false;
SetCrossHairPosition( GetScrollCenterPosition() );
m_canvas->MoveCursorToCrossHair();
screen->SchematicCleanUp( GetCanvas(), NULL );
screen->SchematicCleanUp();
}
else
{

View File

@ -103,7 +103,7 @@ static const int pin_style_codes[] =
#define PIN_STYLE_CNT DIM( pin_style_codes )
// bitmaps to show pins electrical type in dialog editor
// must have same order than enum ElectricPinType (see lib_pin.h)
// must have same order than enum ELECTRICAL_PINTYPE (see lib_pin.h)
static const BITMAP_DEF iconsPinsElectricalType[] =
{
pintype_input_xpm,
@ -127,7 +127,7 @@ const wxString LIB_PIN::GetCanonicalElectricalTypeName( unsigned aType )
// These strings are the canonical name of the electrictal type
// Not translated, no space in name, only ASCII chars.
// to use when the string name must be known and well defined
// must have same order than enum ElectricPinType (see lib_pin.h)
// must have same order than enum ELECTRICAL_PINTYPE (see lib_pin.h)
static const wxChar* msgPinElectricType[] =
{
wxT( "input" ),
@ -405,13 +405,13 @@ void LIB_PIN::SetShape( int aShape )
}
void LIB_PIN::SetType( int aType )
void LIB_PIN::SetType( ELECTRICAL_PINTYPE aType )
{
if( aType < 0 )
aType = 0;
if( aType < PIN_INPUT )
aType = PIN_INPUT;
if( aType >= (int)PIN_ELECTRICAL_TYPE_CNT )
aType = PIN_ELECTRICAL_TYPE_CNT - 1;
if( aType >= PIN_NMAX )
aType = PIN_NC;
if( m_type != aType )
{

View File

@ -38,7 +38,7 @@
/**
* The component library pin object electrical types used in ERC tests.
*/
enum ElectricPinType {
enum ELECTRICAL_PINTYPE {
PIN_INPUT,
PIN_OUTPUT,
PIN_BIDI,
@ -50,7 +50,7 @@ enum ElectricPinType {
PIN_OPENCOLLECTOR,
PIN_OPENEMITTER,
PIN_NC, /* No connect */
PIN_NMAX /* End of List (no used as pin type) */
PIN_NMAX /* End of List (not used as pin type) */
};
@ -96,7 +96,7 @@ class LIB_PIN : public LIB_ITEM
int m_orientation; ///< Pin orientation (Up, Down, Left, Right)
int m_shape; ///< Bitwise ORed of pin shapes (see enum DrawPinShape)
int m_width; ///< Line width of the pin.
int m_type; ///< Electrical type of the pin. See enum ElectricPinType.
ELECTRICAL_PINTYPE m_type; ///< Electrical type of the pin. See enum ELECTRICAL_PINTYPE.
int m_attributes; ///< Set bit 0 to indicate pin is invisible.
wxString m_name;
long m_number; ///< Pin number defined as 4 ASCII characters like "12", "anod",
@ -277,14 +277,14 @@ public:
/**
* Get the electrical type of the pin.
*
* @return The electrical type of the pin (see enun ElectricPinType for values).
* @return The electrical type of the pin (see enun ELECTRICAL_PINTYPE for values).
*/
int GetType() const { return m_type; }
ELECTRICAL_PINTYPE GetType() const { return m_type; }
/**
* return a string giving the electrical type of a pin.
* Can be used when a known, not translated name is needed (for instance in net lists)
* @param aType is the electrical type (see enum ElectricPinType )
* @param aType is the electrical type (see enum ELECTRICAL_PINTYPE )
* @return The electrical name for a pin type (see enun MsgPinElectricType for names).
*/
static const wxString GetCanonicalElectricalTypeName( unsigned aType );
@ -301,7 +301,7 @@ public:
/**
* return a translated string for messages giving the electrical type of a pin.
* @param aType is the electrical type (see enum ElectricPinType )
* @param aType is the electrical type (see enum ELECTRICAL_PINTYPE )
* @return The electrical name of the pin (see enun MsgPinElectricType for names).
*/
static const wxString GetElectricalTypeName( unsigned aType );
@ -321,9 +321,9 @@ public:
* This will also update the electrical type of the pins marked by
* EnableEditMode().
*
* @param aType - The electrical type of the pin(see enun ElectricPinType for values).
* @param aType - The electrical type of the pin(see enun ELECTRICAL_PINTYPE for values).
*/
void SetType( int aType );
void SetType( ELECTRICAL_PINTYPE aType );
/**
* Set the pin length.

View File

@ -228,7 +228,7 @@ bool NETLIST_OBJECT_LIST::BuildNetListInfo( SCH_SHEET_LIST& aSheets )
switch( net_item->m_Type )
{
case NET_ITEM_UNSPECIFIED:
wxMessageBox( wxT( "BuildNetListBase() error" ) );
wxMessageBox( wxT( "BuildNetListInfo() error" ) );
break;
case NET_PIN:
@ -397,8 +397,8 @@ bool NETLIST_OBJECT_LIST::BuildNetListInfo( SCH_SHEET_LIST& aSheets )
}
// Helper function to give a priority to sort labels:
// NET_PINLABEL and NET_GLOBLABEL are global labels
// and the priority is hight
// NET_PINLABEL, NET_GLOBBUSLABELMEMBER and NET_GLOBLABEL are global labels
// and the priority is high
static int getPriority( const NETLIST_OBJECT* Objet )
{
switch( Objet->m_Type )
@ -407,7 +407,8 @@ static int getPriority( const NETLIST_OBJECT* Objet )
case NET_LABEL: return 2;
case NET_HIERLABEL: return 3;
case NET_PINLABEL: return 4;
case NET_GLOBLABEL: return 5;
case NET_GLOBBUSLABELMEMBER: return 5;
case NET_GLOBLABEL: return 6;
default: break;
}
@ -417,11 +418,24 @@ static int getPriority( const NETLIST_OBJECT* Objet )
/* function evalLabelsPriority used by findBestNetNameForEachNet()
* evalLabelsPriority calculates the priority of alabel1 and aLabel2
* return true if alabel1 has a highter priority than aLabel2
* return true if alabel1 has a higher priority than aLabel2
*/
static bool evalLabelsPriority( const NETLIST_OBJECT* aLabel1,
const NETLIST_OBJECT* aLabel2 )
{
// Global labels have the highest prioriy.
// For local labels: names are prefixed by their sheetpath
// use name defined in the more top level hierarchical sheet
// (i.e. shorter timestamp path because paths are /<timestamp1>/<timestamp2>/...
// and timestamp = 8 letters.
// Note: the final net name uses human sheetpath name, not timestamp sheetpath name
// They are equivalent, but not for human readers.
if( ! aLabel1->IsLabelGlobal() && ! aLabel2->IsLabelGlobal() )
{
if( aLabel1->m_SheetPath.Path().Length() != aLabel2->m_SheetPath.Path().Length() )
return aLabel1->m_SheetPath.Path().Length() < aLabel2->m_SheetPath.Path().Length();
}
int priority1 = getPriority( aLabel1 );
int priority2 = getPriority( aLabel2 );
@ -429,29 +443,22 @@ static bool evalLabelsPriority( const NETLIST_OBJECT* aLabel1,
return priority1 > priority2;
// Objects have here the same priority, therefore they have the same type.
// for global labels, we select the best candidate by alphabetic order
// because they have no sheetpath as prefix name
// for other labels, we select them before by sheet deep order
// because the actual name is /sheetpath/label
// and for a given path length, by alphabetic order
if( aLabel1->m_Type == NET_PINLABEL || aLabel1->m_Type == NET_GLOBLABEL )
if( aLabel1->IsLabelGlobal() )
return aLabel1->m_Label.Cmp( aLabel2->m_Label ) < 0;
// not global: names are prefixed by their sheetpath
// use name defined in higher hierarchical sheet
// (i.e. shorter path because paths are /<timestamp1>/<timestamp2>/...
// and timestamp = 8 letters.
if( aLabel1->m_SheetPath.Path().Length() != aLabel2->m_SheetPath.Path().Length() )
return aLabel1->m_SheetPath.Path().Length() < aLabel2->m_SheetPath.Path().Length();
// Sheet paths have the same length: use alphabetic label name order
// Sheet paths have here the same length: use alphabetic label name order
// For labels on sheets having an equivalent deep in hierarchy, use
// alphabetic label name order:
if( aLabel1->m_Label.Cmp( aLabel2->m_Label ) != 0 )
return aLabel1->m_Label.Cmp( aLabel2->m_Label ) < 0;
// For identical labels having the same priority: choose the
// alphabetic label full name order
return aLabel1->m_SheetPath.PathHumanReadable().Cmp(
aLabel2->m_SheetPath.PathHumanReadable() ) < 0;
}
@ -459,6 +466,12 @@ static bool evalLabelsPriority( const NETLIST_OBJECT* aLabel1,
void NETLIST_OBJECT_LIST::findBestNetNameForEachNet()
{
// Important note: NET_SHEETLABEL items of sheet items should *NOT* be considered,
// because they live in a sheet but their names are actually used in the subsheet.
// Moreover, in the parent sheet, the name of NET_SHEETLABEL can be not unique,
// ( for instance when 2 different sheets share the same schematic in complex hierarchies
// and 2 identical NET_SHEETLABEL labels can be connected to 2 different nets
int netcode = 0; // current netcode for tested items
unsigned idxstart = 0; // index of the first item of this net
NETLIST_OBJECT* item;
@ -481,9 +494,10 @@ void NETLIST_OBJECT_LIST::findBestNetNameForEachNet()
GetItem( jj )->SetNetNameCandidate( candidate );
}
if( item == NULL )
if( item == NULL ) // End of list
break;
// Prepare next net analysis:
netcode = item->GetNet();
candidate = NULL;
idxstart = ii;
@ -495,6 +509,7 @@ void NETLIST_OBJECT_LIST::findBestNetNameForEachNet()
case NET_LABEL:
case NET_PINLABEL:
case NET_GLOBLABEL:
case NET_GLOBBUSLABELMEMBER:
// A candidate is found: select the better between the previous
// and this one
if( candidate == NULL )
@ -566,7 +581,7 @@ void NETLIST_OBJECT_LIST::findBestNetNameForEachNet()
// Examine all pins of the net to find the best candidate,
// i.e. the first net name candidate, by alphabetic order
// the net names are names bu_ilt by GetShortNetName
// the net names are built by GetShortNetName
// (Net-<{reference}-Pad{pad number}> like Net-<U3-Pad5>
// Not named nets do not have usually a lot of members.
// Many have only 2 members(a pad and a non connection symbol)
@ -627,16 +642,18 @@ void NETLIST_OBJECT_LIST::sheetLabelConnect( NETLIST_OBJECT* SheetLabel )
void NETLIST_OBJECT_LIST::connectBusLabels()
{
// Propagate the net code between all bus label member objects connected by they name.
// If the net code is not yet existing, a new one is created
// Search is done in the entire list
for( unsigned ii = 0; ii < size(); ii++ )
{
NETLIST_OBJECT* Label = GetItem( ii );
if( (Label->m_Type == NET_SHEETBUSLABELMEMBER)
|| (Label->m_Type == NET_BUSLABELMEMBER)
|| (Label->m_Type == NET_HIERBUSLABELMEMBER) )
if( Label->IsLabelBusMemberType() )
{
if( Label->GetNet() == 0 )
{
// Not yet existiing net code: create a new one.
Label->SetNet( m_lastNetCode );
m_lastNetCode++;
}
@ -644,9 +661,8 @@ void NETLIST_OBJECT_LIST::connectBusLabels()
for( unsigned jj = ii + 1; jj < size(); jj++ )
{
NETLIST_OBJECT* LabelInTst = GetItem( jj );
if( (LabelInTst->m_Type == NET_SHEETBUSLABELMEMBER)
|| (LabelInTst->m_Type == NET_BUSLABELMEMBER)
|| (LabelInTst->m_Type == NET_HIERBUSLABELMEMBER) )
if( LabelInTst->IsLabelBusMemberType() )
{
if( LabelInTst->m_BusNetCode != Label->m_BusNetCode )
continue;
@ -655,8 +671,10 @@ void NETLIST_OBJECT_LIST::connectBusLabels()
continue;
if( LabelInTst->GetNet() == 0 )
// Append this object to the current net
LabelInTst->SetNet( Label->GetNet() );
else
// Merge the 2 net codes, they are connected.
propageNetCode( LabelInTst->GetNet(), Label->GetNet(), IS_WIRE );
}
}

View File

@ -55,7 +55,7 @@ static void DrawMovePin( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosi
static wxPoint OldPos;
static wxPoint PinPreviousPos;
static int LastPinType = PIN_INPUT;
static ELECTRICAL_PINTYPE LastPinType = PIN_INPUT;
static int LastPinOrient = PIN_RIGHT;
static int LastPinShape = NONE;
static bool LastPinCommonConvert = false;

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015 Chris Pavlina <pavlina.chris@gmail.com>
* Copyright (C) 2015 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2015-2016 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -562,8 +562,7 @@ bool SCH_EDIT_FRAME::RescueProject( bool aRunningOnDemand )
Prj().SetElem( PROJECT::ELEM_SCH_PART_LIBS, NULL );
// Clean up wire ends
INSTALL_UNBUFFERED_DC( dc, m_canvas );
GetScreen()->SchematicCleanUp( NULL, &dc );
GetScreen()->SchematicCleanUp();
m_canvas->Refresh( true );
OnModify();

View File

@ -1900,7 +1900,7 @@ void SCH_COMPONENT::GetNetListItem( NETLIST_OBJECT_LIST& aNetListItems,
item->m_SheetPath = *aSheetPath;
item->m_Type = NET_PIN;
item->m_Link = (SCH_ITEM*) this;
item->m_ElectricalType = pin->GetType();
item->m_ElectricalPinType = pin->GetType();
item->m_PinNum = pin->GetNumber();
item->m_Label = pin->GetName();
item->m_Start = item->m_End = pos;

View File

@ -3,8 +3,8 @@
*
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2008-2015 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2008-2016 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -424,7 +424,7 @@ bool SCH_SCREEN::IsTerminalPoint( const wxPoint& aPosition, int aLayer )
}
bool SCH_SCREEN::SchematicCleanUp( EDA_DRAW_PANEL* aCanvas, wxDC* aDC )
bool SCH_SCREEN::SchematicCleanUp()
{
SCH_ITEM* item, * testItem;
bool modified = false;
@ -457,7 +457,8 @@ bool SCH_SCREEN::SchematicCleanUp( EDA_DRAW_PANEL* aCanvas, wxDC* aDC )
testItem = testItem->Next();
}
}
else if ( ( ( item->Type() == SCH_JUNCTION_T ) && ( testItem->Type() == SCH_JUNCTION_T ) ) && ( testItem != item ) )
else if ( ( ( item->Type() == SCH_JUNCTION_T )
&& ( testItem->Type() == SCH_JUNCTION_T ) ) && ( testItem != item ) )
{
if ( testItem->HitTest( item->GetPosition() ) )
{
@ -479,10 +480,7 @@ bool SCH_SCREEN::SchematicCleanUp( EDA_DRAW_PANEL* aCanvas, wxDC* aDC )
}
}
TestDanglingEnds( aCanvas, aDC );
if( aCanvas && modified )
aCanvas->Refresh();
TestDanglingEnds();
return modified;
}
@ -931,28 +929,22 @@ int SCH_SCREEN::UpdatePickList()
}
bool SCH_SCREEN::TestDanglingEnds( EDA_DRAW_PANEL* aCanvas, wxDC* aDC )
bool SCH_SCREEN::TestDanglingEnds()
{
SCH_ITEM* item;
std::vector< DANGLING_END_ITEM > endPoints;
bool hasDanglingEnds = false;
bool hasStateChanged = false;
for( item = m_drawList.begin(); item; item = item->Next() )
item->GetEndPoints( endPoints );
for( item = m_drawList.begin(); item; item = item->Next() )
{
if( item->IsDanglingStateChanged( endPoints ) && ( aCanvas ) && ( aDC ) )
{
item->Draw( aCanvas, aDC, wxPoint( 0, 0 ), g_XorMode );
item->Draw( aCanvas, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
}
if( item->IsDangling() )
hasDanglingEnds = true;
if( item->IsDanglingStateChanged( endPoints ) )
hasStateChanged = true;
}
return hasDanglingEnds;
return hasStateChanged;
}

View File

@ -1092,7 +1092,6 @@ void SCH_SHEET::GetNetListItem( NETLIST_OBJECT_LIST& aNetListItems,
item->m_Comp = &m_pins[i];
item->m_Link = this;
item->m_Type = NET_SHEETLABEL;
item->m_ElectricalType = m_pins[i].GetShape();
item->m_Label = m_pins[i].GetText();
item->m_Start = item->m_End = m_pins[i].GetPosition();
aNetListItems.push_back( item );

View File

@ -187,8 +187,10 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
DeleteConnection( id == ID_POPUP_SCH_DELETE_CONNECTION );
screen->SetCurItem( NULL );
SetRepeatItem( NULL );
screen->TestDanglingEnds( m_canvas, &dc );
m_canvas->Refresh();
if( screen->TestDanglingEnds() )
m_canvas->Refresh();
break;
case ID_POPUP_SCH_BREAK_WIRE:
@ -215,7 +217,8 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
SaveCopyInUndoList( oldItems, UR_WIRE_IMAGE );
}
screen->TestDanglingEnds( m_canvas, &dc );
if( screen->TestDanglingEnds() )
m_canvas->Refresh();
}
break;
@ -227,8 +230,9 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
DeleteItem( item );
screen->SetCurItem( NULL );
SetRepeatItem( NULL );
screen->TestDanglingEnds( m_canvas, &dc );
screen->TestDanglingEnds();
SetSheetNumberAndCount();
m_canvas->Refresh();
OnModify();
break;
@ -239,7 +243,10 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_RESIZE_SHEET:
ReSizeSheet( (SCH_SHEET*) item, &dc );
screen->TestDanglingEnds( m_canvas, &dc );
if( screen->TestDanglingEnds() )
m_canvas->Refresh();
break;
case ID_POPUP_IMPORT_HLABEL_TO_SHEETPIN:
@ -375,7 +382,10 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_ADD_JUNCTION:
m_canvas->MoveCursorToCrossHair();
screen->SetCurItem( AddJunction( &dc, GetCrossHairPosition(), true ) );
screen->TestDanglingEnds( m_canvas, &dc );
if( screen->TestDanglingEnds() )
m_canvas->Refresh();
screen->SetCurItem( NULL );
break;
@ -648,8 +658,8 @@ bool SCH_EDIT_FRAME::DeleteItemAtCrossHair( wxDC* DC )
SetRepeatItem( NULL );
DeleteItem( item );
if( itemHasConnections )
screen->TestDanglingEnds( m_canvas, DC );
if( itemHasConnections && screen->TestDanglingEnds() )
m_canvas->Refresh();
OnModify();
return true;

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -1168,7 +1168,7 @@ void SCH_EDIT_FRAME::OnOpenLibraryEditor( wxCommandEvent& event )
}
}
GetScreen()->SchematicCleanUp( m_canvas, NULL );
GetScreen()->SchematicCleanUp();
m_canvas->Refresh();
}

View File

@ -369,21 +369,27 @@ IO_MGR::PCB_FILE_T plugin_type( const wxString& aFileName, int aCtl )
wxFileName fn = aFileName;
if( fn.GetExt() == IO_MGR::GetFileExtension( IO_MGR::LEGACY ) )
// Note: file extensions are expected to be in ower case.
// This is not always true, especially when importing files, so the string
// comparisons are case insensitive to try to find the suitable plugin.
if( fn.GetExt().CmpNoCase( IO_MGR::GetFileExtension( IO_MGR::LEGACY ) ) == 0 )
{
// both legacy and eagle share a common file extension.
pluginType = ( aCtl & KICTL_EAGLE_BRD ) ? IO_MGR::EAGLE : IO_MGR::LEGACY;
}
else if( fn.GetExt() == IO_MGR::GetFileExtension( IO_MGR::LEGACY ) + backupSuffix )
else if( fn.GetExt().CmpNoCase( IO_MGR::GetFileExtension( IO_MGR::LEGACY ) + backupSuffix ) == 0 )
{
pluginType = IO_MGR::LEGACY;
}
else if( fn.GetExt() == IO_MGR::GetFileExtension( IO_MGR::PCAD ) )
else if( fn.GetExt().CmpNoCase( IO_MGR::GetFileExtension( IO_MGR::PCAD ) ) == 0 )
{
pluginType = IO_MGR::PCAD;
}
else
{
pluginType = IO_MGR::KICAD;
}
return pluginType;
}

View File

@ -53,30 +53,30 @@
*/
void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
{
BOARD_ITEM* DrawStruct = GetCurItem();
BOARD_ITEM* curr_item = GetCurItem();
bool exit = false;
bool no_tool = GetToolId() == ID_NO_TOOL_SELECTED;
if( no_tool || ( DrawStruct && DrawStruct->GetFlags() ) )
if( no_tool || ( curr_item && curr_item->GetFlags() ) )
{
m_canvas->SetAutoPanRequest( false );
if( DrawStruct && DrawStruct->GetFlags() ) // Command in progress
if( curr_item && curr_item->GetFlags() ) // Command in progress
{
m_canvas->SetIgnoreMouseEvents( true );
m_canvas->CrossHairOff( aDC );
switch( DrawStruct->Type() )
switch( curr_item->Type() )
{
case PCB_ZONE_AREA_T:
if( DrawStruct->IsNew() )
if( curr_item->IsNew() )
{
m_canvas->SetAutoPanRequest( true );
Begin_Zone( aDC );
}
else
{
End_Move_Zone_Corner_Or_Outlines( aDC, static_cast<ZONE_CONTAINER*>( DrawStruct ) );
End_Move_Zone_Corner_Or_Outlines( aDC, static_cast<ZONE_CONTAINER*>( curr_item ) );
}
exit = true;
@ -84,60 +84,66 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
case PCB_TRACE_T:
case PCB_VIA_T:
if( DrawStruct->IsDragging() )
if( curr_item->IsDragging() )
{
PlaceDraggedOrMovedTrackSegment( static_cast<TRACK*>( DrawStruct ), aDC );
PlaceDraggedOrMovedTrackSegment( static_cast<TRACK*>( curr_item ), aDC );
exit = true;
}
break;
case PCB_TEXT_T:
Place_Texte_Pcb( static_cast<TEXTE_PCB*>( DrawStruct ), aDC );
Place_Texte_Pcb( static_cast<TEXTE_PCB*>( curr_item ), aDC );
exit = true;
break;
case PCB_MODULE_TEXT_T:
PlaceTexteModule( static_cast<TEXTE_MODULE*>( DrawStruct ), aDC );
PlaceTexteModule( static_cast<TEXTE_MODULE*>( curr_item ), aDC );
exit = true;
break;
case PCB_PAD_T:
PlacePad( static_cast<D_PAD*>( DrawStruct ), aDC );
PlacePad( static_cast<D_PAD*>( curr_item ), aDC );
exit = true;
break;
case PCB_MODULE_T:
PlaceModule( static_cast<MODULE*>( DrawStruct ), aDC );
PlaceModule( static_cast<MODULE*>( curr_item ), aDC );
exit = true;
break;
case PCB_TARGET_T:
PlaceTarget( static_cast<PCB_TARGET*>( DrawStruct ), aDC );
PlaceTarget( static_cast<PCB_TARGET*>( curr_item ), aDC );
exit = true;
break;
case PCB_LINE_T:
if( no_tool ) // when no tools: existing item moving.
{
Place_DrawItem( static_cast<DRAWSEGMENT*>( DrawStruct ), aDC );
Place_DrawItem( static_cast<DRAWSEGMENT*>( curr_item ), aDC );
exit = true;
}
break;
case PCB_DIMENSION_T:
if( ! DrawStruct->IsNew() )
if( ! curr_item->IsNew() )
{ // We are moving the text of an existing dimension. Place it
PlaceDimensionText( static_cast<DIMENSION*>( DrawStruct ), aDC );
PlaceDimensionText( static_cast<DIMENSION*>( curr_item ), aDC );
exit = true;
}
break;
case PCB_MARKER_T: // MARKER_PCB, a marker used to show something
curr_item->ClearFlags(); // Not reason to have flags set
exit = true;
break;
default:
DisplayError( this,
wxT( "PCB_EDIT_FRAME::OnLeftClick() err: DrawType %d m_Flags != 0" ),
DrawStruct->Type() );
wxString::Format(
"PCB_EDIT_FRAME::OnLeftClick() err: curr_item type %d m_Flags != 0 (%X)",
curr_item->Type(), curr_item->GetFlags() ) );
exit = true;
break;
}
@ -151,23 +157,23 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
else if( !wxGetKeyState( WXK_SHIFT ) && !wxGetKeyState( WXK_ALT )
&& !wxGetKeyState( WXK_CONTROL ) )
{
DrawStruct = PcbGeneralLocateAndDisplay();
curr_item = PcbGeneralLocateAndDisplay();
if( DrawStruct )
SendMessageToEESCHEMA( DrawStruct );
if( curr_item )
SendMessageToEESCHEMA( curr_item );
}
}
if( DrawStruct ) // display netclass info for zones, tracks and pads
if( curr_item ) // display netclass info for zones, tracks and pads
{
switch( DrawStruct->Type() )
switch( curr_item->Type() )
{
case PCB_ZONE_AREA_T:
case PCB_TRACE_T:
case PCB_VIA_T:
case PCB_PAD_T:
SetCurrentNetClass(
((BOARD_CONNECTED_ITEM*)DrawStruct)->GetNetClassName() );
((BOARD_CONNECTED_ITEM*)curr_item)->GetNetClassName() );
break;
default:
@ -210,23 +216,23 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
break;
case ID_PCB_SHOW_1_RATSNEST_BUTT:
DrawStruct = PcbGeneralLocateAndDisplay();
Show_1_Ratsnest( DrawStruct, aDC );
curr_item = PcbGeneralLocateAndDisplay();
Show_1_Ratsnest( curr_item, aDC );
if( DrawStruct )
SendMessageToEESCHEMA( DrawStruct );
if( curr_item )
SendMessageToEESCHEMA( curr_item );
break;
case ID_PCB_MIRE_BUTT:
if( (DrawStruct == NULL) || (DrawStruct->GetFlags() == 0) )
if( (curr_item == NULL) || (curr_item->GetFlags() == 0) )
{
SetCurItem( (BOARD_ITEM*) CreateTarget( aDC ) );
m_canvas->MoveCursorToCrossHair();
}
else if( DrawStruct->Type() == PCB_TARGET_T )
else if( curr_item->Type() == PCB_TARGET_T )
{
PlaceTarget( (PCB_TARGET*) DrawStruct, aDC );
PlaceTarget( (PCB_TARGET*) curr_item, aDC );
}
else
{
@ -253,18 +259,18 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
break;
}
if( (DrawStruct == NULL) || (DrawStruct->GetFlags() == 0) )
if( (curr_item == NULL) || (curr_item->GetFlags() == 0) )
{
DrawStruct = (BOARD_ITEM*) Begin_DrawSegment( NULL, shape, aDC );
SetCurItem( DrawStruct );
curr_item = (BOARD_ITEM*) Begin_DrawSegment( NULL, shape, aDC );
SetCurItem( curr_item );
m_canvas->SetAutoPanRequest( true );
}
else if( DrawStruct
&& (DrawStruct->Type() == PCB_LINE_T)
&& DrawStruct->IsNew() )
else if( curr_item
&& (curr_item->Type() == PCB_LINE_T)
&& curr_item->IsNew() )
{
DrawStruct = (BOARD_ITEM*) Begin_DrawSegment( (DRAWSEGMENT*) DrawStruct, shape, aDC );
SetCurItem( DrawStruct );
curr_item = (BOARD_ITEM*) Begin_DrawSegment( (DRAWSEGMENT*) curr_item, shape, aDC );
SetCurItem( curr_item );
m_canvas->SetAutoPanRequest( true );
}
}
@ -277,22 +283,22 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
break;
}
if( (DrawStruct == NULL) || (DrawStruct->GetFlags() == 0) )
if( (curr_item == NULL) || (curr_item->GetFlags() == 0) )
{
DrawStruct = (BOARD_ITEM*) Begin_Route( NULL, aDC );
SetCurItem( DrawStruct );
curr_item = (BOARD_ITEM*) Begin_Route( NULL, aDC );
SetCurItem( curr_item );
if( DrawStruct )
if( curr_item )
m_canvas->SetAutoPanRequest( true );
}
else if( DrawStruct && DrawStruct->IsNew() )
else if( curr_item && curr_item->IsNew() )
{
TRACK* track = Begin_Route( (TRACK*) DrawStruct, aDC );
TRACK* track = Begin_Route( (TRACK*) curr_item, aDC );
// SetCurItem() must not write to the msg panel
// because a track info is displayed while moving the mouse cursor
if( track ) // A new segment was created
SetCurItem( DrawStruct = (BOARD_ITEM*) track, false );
SetCurItem( curr_item = (BOARD_ITEM*) track, false );
m_canvas->SetAutoPanRequest( true );
}
@ -305,21 +311,21 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
* this can be start a new zone or select and move an existing zone outline corner
* if found near the mouse cursor
*/
if( (DrawStruct == NULL) || (DrawStruct->GetFlags() == 0) )
if( (curr_item == NULL) || (curr_item->GetFlags() == 0) )
{
if( Begin_Zone( aDC ) )
{
m_canvas->SetAutoPanRequest( true );
DrawStruct = GetBoard()->m_CurrentZoneContour;
GetScreen()->SetCurItem( DrawStruct );
curr_item = GetBoard()->m_CurrentZoneContour;
GetScreen()->SetCurItem( curr_item );
}
}
else if( DrawStruct && (DrawStruct->Type() == PCB_ZONE_AREA_T) && DrawStruct->IsNew() )
else if( curr_item && (curr_item->Type() == PCB_ZONE_AREA_T) && curr_item->IsNew() )
{ // Add a new corner to the current outline being created:
m_canvas->SetAutoPanRequest( true );
Begin_Zone( aDC );
DrawStruct = GetBoard()->m_CurrentZoneContour;
GetScreen()->SetCurItem( DrawStruct );
curr_item = GetBoard()->m_CurrentZoneContour;
GetScreen()->SetCurItem( curr_item );
}
else
{
@ -336,15 +342,15 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
break;
}
if( (DrawStruct == NULL) || (DrawStruct->GetFlags() == 0) )
if( (curr_item == NULL) || (curr_item->GetFlags() == 0) )
{
SetCurItem( CreateTextePcb( aDC ) );
m_canvas->MoveCursorToCrossHair();
m_canvas->SetAutoPanRequest( true );
}
else if( DrawStruct->Type() == PCB_TEXT_T )
else if( curr_item->Type() == PCB_TEXT_T )
{
Place_Texte_Pcb( (TEXTE_PCB*) DrawStruct, aDC );
Place_Texte_Pcb( (TEXTE_PCB*) curr_item, aDC );
m_canvas->SetAutoPanRequest( false );
}
else
@ -355,20 +361,20 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
break;
case ID_PCB_MODULE_BUTT:
if( (DrawStruct == NULL) || (DrawStruct->GetFlags() == 0) )
if( (curr_item == NULL) || (curr_item->GetFlags() == 0) )
{
m_canvas->MoveCursorToCrossHair();
DrawStruct = (BOARD_ITEM*) LoadModuleFromLibrary(
curr_item = (BOARD_ITEM*) LoadModuleFromLibrary(
wxEmptyString, Prj().PcbFootprintLibs(), true, aDC );
SetCurItem( DrawStruct );
SetCurItem( curr_item );
if( DrawStruct )
StartMoveModule( (MODULE*) DrawStruct, aDC, false );
if( curr_item )
StartMoveModule( (MODULE*) curr_item, aDC, false );
}
else if( DrawStruct->Type() == PCB_MODULE_T )
else if( curr_item->Type() == PCB_MODULE_T )
{
PlaceModule( (MODULE*) DrawStruct, aDC );
PlaceModule( (MODULE*) curr_item, aDC );
m_canvas->SetAutoPanRequest( false );
}
else
@ -385,16 +391,16 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
break;
}
if( !DrawStruct || !DrawStruct->GetFlags() )
if( !curr_item || !curr_item->GetFlags() )
{
DrawStruct = (BOARD_ITEM*) EditDimension( NULL, aDC );
SetCurItem( DrawStruct );
curr_item = (BOARD_ITEM*) EditDimension( NULL, aDC );
SetCurItem( curr_item );
m_canvas->SetAutoPanRequest( true );
}
else if( DrawStruct && (DrawStruct->Type() == PCB_DIMENSION_T) && DrawStruct->IsNew() )
else if( curr_item && (curr_item->Type() == PCB_DIMENSION_T) && curr_item->IsNew() )
{
DrawStruct = (BOARD_ITEM*) EditDimension( (DIMENSION*) DrawStruct, aDC );
SetCurItem( DrawStruct );
curr_item = (BOARD_ITEM*) EditDimension( (DIMENSION*) curr_item, aDC );
SetCurItem( curr_item );
m_canvas->SetAutoPanRequest( true );
}
else
@ -406,14 +412,14 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
break;
case ID_PCB_DELETE_ITEM_BUTT:
if( !DrawStruct || !DrawStruct->GetFlags() )
if( !curr_item || !curr_item->GetFlags() )
{
DrawStruct = PcbGeneralLocateAndDisplay();
curr_item = PcbGeneralLocateAndDisplay();
if( DrawStruct && (DrawStruct->GetFlags() == 0) )
if( curr_item && (curr_item->GetFlags() == 0) )
{
RemoveStruct( DrawStruct, aDC );
SetCurItem( DrawStruct = NULL );
RemoveStruct( curr_item, aDC );
SetCurItem( curr_item = NULL );
}
}
@ -444,36 +450,36 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
*/
void PCB_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
{
BOARD_ITEM* DrawStruct = GetCurItem();
BOARD_ITEM* curr_item = GetCurItem();
switch( GetToolId() )
{
case ID_NO_TOOL_SELECTED:
if( (DrawStruct == NULL) || (DrawStruct->GetFlags() == 0) )
if( (curr_item == NULL) || (curr_item->GetFlags() == 0) )
{
DrawStruct = PcbGeneralLocateAndDisplay();
curr_item = PcbGeneralLocateAndDisplay();
}
if( (DrawStruct == NULL) || (DrawStruct->GetFlags() != 0) )
if( (curr_item == NULL) || (curr_item->GetFlags() != 0) )
break;
SendMessageToEESCHEMA( DrawStruct );
SendMessageToEESCHEMA( curr_item );
// An item is found
SetCurItem( DrawStruct );
SetCurItem( curr_item );
switch( DrawStruct->Type() )
switch( curr_item->Type() )
{
case PCB_TRACE_T:
case PCB_VIA_T:
if( DrawStruct->IsNew() )
if( curr_item->IsNew() )
{
if( End_Route( (TRACK*) DrawStruct, aDC ) )
if( End_Route( (TRACK*) curr_item, aDC ) )
m_canvas->SetAutoPanRequest( false );
}
else if( DrawStruct->GetFlags() == 0 )
else if( curr_item->GetFlags() == 0 )
{
Edit_TrackSegm_Width( aDC, (TRACK*) DrawStruct );
Edit_TrackSegm_Width( aDC, (TRACK*) curr_item );
}
break;
@ -484,19 +490,19 @@ void PCB_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
case PCB_TARGET_T:
case PCB_DIMENSION_T:
case PCB_MODULE_TEXT_T:
OnEditItemRequest( aDC, DrawStruct );
OnEditItemRequest( aDC, curr_item );
m_canvas->MoveCursorToCrossHair();
break;
case PCB_LINE_T:
OnEditItemRequest( aDC, DrawStruct );
OnEditItemRequest( aDC, curr_item );
break;
case PCB_ZONE_AREA_T:
if( DrawStruct->GetFlags() )
if( curr_item->GetFlags() )
break;
OnEditItemRequest( aDC, DrawStruct );
OnEditItemRequest( aDC, curr_item );
break;
default:
@ -506,9 +512,9 @@ void PCB_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
break; // end case 0
case ID_TRACK_BUTT:
if( DrawStruct && DrawStruct->IsNew() )
if( curr_item && curr_item->IsNew() )
{
if( End_Route( (TRACK*) DrawStruct, aDC ) )
if( End_Route( (TRACK*) curr_item, aDC ) )
m_canvas->SetAutoPanRequest( false );
}
@ -527,19 +533,19 @@ void PCB_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
case ID_PCB_ADD_LINE_BUTT:
case ID_PCB_ARC_BUTT:
case ID_PCB_CIRCLE_BUTT:
if( DrawStruct == NULL )
if( curr_item == NULL )
break;
if( DrawStruct->Type() != PCB_LINE_T )
if( curr_item->Type() != PCB_LINE_T )
{
DisplayError( this, wxT( "DrawStruct Type error" ) );
DisplayError( this, wxT( "curr_item Type error" ) );
m_canvas->SetAutoPanRequest( false );
break;
}
if( DrawStruct->IsNew() )
if( curr_item->IsNew() )
{
End_Edge( (DRAWSEGMENT*) DrawStruct, aDC );
End_Edge( (DRAWSEGMENT*) curr_item, aDC );
m_canvas->SetAutoPanRequest( false );
SetCurItem( NULL );
}

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,7 @@
Examples description
====================
A PCAD ASCII sample file can be downloaded from http://www.pcadbegin.webtm.ru
(Provided by its author Andrey Manin <pcadbegin[at]rambler.ru>)
CK1202_V1.pcb - provided by author Andrey Manin <pcadbegin[at]rambler.ru>,
downloaded from http://www.pcadbegin.webtm.ru/schetchik.php?scach=1
http://www.pcadbegin.webtm.ru/schetchik.php?scach=1 (CK1202_V1.pcb)

View File

@ -127,6 +127,9 @@ class FPC_FootprintWizard(HFPW.HelpfulFootprintWizardPlugin):
# right pad side
self.draw.Line(-xstart, posy, -xend, yend)
# set SMD attribute
self.module.SetAttributes(pcbnew.MOD_CMS)
# vertical segment at left of the pad
xstart = xend
yend = posy - (shl_height + linewidth + margin*2)

View File

@ -279,6 +279,24 @@ class HelpfulFootprintWizardPlugin(pcbnew.FootprintWizardPlugin,
"""
pass
def PutOnGridMM(self, value, gridSizeMM=0.05):
"""
Round the value (in KiCAD internal units 1nm) according to the
provided gridSize in mm.
"""
thresh = pcbnew.FromMM(gridSizeMM)
res = round(value/thresh)*thresh
return res
def PutOnGridMils(self, value, gridSizeMil=2):
"""
Round the value (in KiCAD internal units 1nm) according to the
provided gridSize in mil.
"""
thresh = pcbnew.FromMils(gridSizeMil)
res = round(value/thresh)*thresh
return res
def BuildThisFootprint(self):
"""
Draw the footprint.

View File

@ -86,6 +86,9 @@ class BGAWizard(HFPW.HelpfulFootprintWizardPlugin):
self.draw.SetLayer(pcbnew.F_CrtYd)
sizex = (ssx + cmargin) * 2
sizey = (ssy + cmargin) * 2
# round size to nearest 0.1mm, rectangle will thus land on a 0.05mm grid
sizex = self.PutOnGridMM(sizex, 0.1)
sizey = self.PutOnGridMM(sizey, 0.1)
# set courtyard line thickness to the one defined in KLC
self.draw.SetLineThickness(pcbnew.FromMM(0.05))
self.draw.Box(0, 0, sizex, sizey)
@ -98,5 +101,7 @@ class BGAWizard(HFPW.HelpfulFootprintWizardPlugin):
self.draw.Value(0, ypos, text_size)
self.draw.Reference(0, -ypos, text_size)
# set SMD attribute
self.module.SetAttributes(pcbnew.MOD_CMS)
BGAWizard().register()

View File

@ -113,6 +113,9 @@ class QFPWizard(HelpfulFootprintWizardPlugin.HelpfulFootprintWizardPlugin):
self.draw.SetLayer(pcbnew.F_CrtYd)
sizex = (lim_x + cmargin) * 2 + pad_length
sizey = (lim_y + cmargin) * 2 + pad_length
# round size to nearest 0.1mm, rectangle will thus land on a 0.05mm grid
sizex = self.PutOnGridMM(sizex, 0.1)
sizey = self.PutOnGridMM(sizey, 0.1)
# set courtyard line thickness to the one defined in KLC
thick = self.draw.GetLineThickness()
self.draw.SetLineThickness(pcbnew.FromMM(0.05))
@ -127,4 +130,7 @@ class QFPWizard(HelpfulFootprintWizardPlugin.HelpfulFootprintWizardPlugin):
self.draw.Value(0, text_offset, text_size)
self.draw.Reference(0, -text_offset, text_size)
# set SMD attribute
self.module.SetAttributes(pcbnew.MOD_CMS)
QFPWizard().register()

View File

@ -109,6 +109,9 @@ class RowedFootprint(HFPW.HelpfulFootprintWizardPlugin):
self.draw.SetLayer(pcbnew.F_CrtYd)
sizex = (ssx + cmargin) * 2
sizey = (ssy + cmargin) * 2
# round size to nearest 0.1mm, rectangle will thus land on a 0.05mm grid
sizex = self.PutOnGridMM(sizex, 0.1)
sizey = self.PutOnGridMM(sizey, 0.1)
# set courtyard line thickness to the one defined in KLC
self.draw.SetLineThickness(pcbnew.FromMM(0.05))
self.draw.Box(0, 0, sizex, sizey)
@ -128,6 +131,11 @@ class RowedFootprint(HFPW.HelpfulFootprintWizardPlugin):
self.draw.Value(0, 0, text_size)
self.draw.Reference(-text_px, 0, text_size, orientation_degree=90)
# set the attribute
if self.GetName() == "S-DIP":
self.module.SetAttributes(pcbnew.MOD_DEFAULT)
elif self.GetName() == "SOIC":
self.module.SetAttributes(pcbnew.MOD_CMS)
class SDIPWizard(RowedFootprint):

View File

@ -193,6 +193,9 @@ class TouchSliderWizard(HFPW.HelpfulFootprintWizardPlugin):
ypos += t_size + w_text*2
self.draw.Reference(0, -ypos, t_size)
# set SMD attribute
self.module.SetAttributes(MOD_CMS)
# starting pad
pos = wxPointMM(0,0)
band_width = touch_width/bands

View File

@ -102,10 +102,13 @@ class RowedFootprint(HFPW.HelpfulFootprintWizardPlugin):
cmarginx = body[self.courtyard_x_margin_key]
cmarginy = body[self.courtyard_y_margin_key]
self.draw.SetLayer(pcbnew.F_CrtYd)
# set courtyard line thickness to the one defined in KLC
thick = self.draw.GetLineThickness()
sizex = (pin1posX + cmarginx) * 2 + pad_Hsize + thick
sizey = (pin1posY + cmarginy) * 2 + pad_Vsize + thick
# round size to nearest 0.1mm, rectangle will thus land on a 0.05mm grid
sizex = self.PutOnGridMM(sizex, 0.1)
sizey = self.PutOnGridMM(sizey, 0.1)
# set courtyard line thickness to the one defined in KLC
self.draw.SetLineThickness(pcbnew.FromMM(0.05))
self.draw.Box(0, 0, sizex, sizey)
# restore line thickness to previous value
@ -118,6 +121,12 @@ class RowedFootprint(HFPW.HelpfulFootprintWizardPlugin):
self.draw.Value(0, t_posy, text_size)
self.draw.Reference(0, -t_posy, text_size)
# set SMD attribute
if self.GetName() == "ZIP":
self.module.SetAttributes(pcbnew.MOD_DEFAULT)
elif self.GetName() == "ZOIC":
self.module.SetAttributes(pcbnew.MOD_CMS)
def DrawBox(self, sizex, sizey):
# ----------

View File

@ -28,6 +28,7 @@ add_library( s3d_plugin_vrml MODULE
v2/vrml2_color.cpp
v2/vrml2_box.cpp
v2/vrml2_switch.cpp
v2/vrml2_inline.cpp
v1/vrml1_node.cpp
v1/vrml1_base.cpp
v1/vrml1_group.cpp