2011-10-28 13:43:37 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2018-01-09 07:54:24 +00:00
|
|
|
* Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
2011-10-28 13:43:37 +00:00
|
|
|
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
|
2018-01-09 07:54:24 +00:00
|
|
|
* Copyright (C) 2004-2018 KiCad Developers, see AUTHORS.txt for contributors.
|
2011-10-28 13:43:37 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
2011-09-30 18:15:37 +00:00
|
|
|
/**
|
|
|
|
* @file pinedit.cpp
|
|
|
|
* @brief Eeschema pin edit code.
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <fctsys.h>
|
|
|
|
#include <gr_basic.h>
|
|
|
|
#include <class_drawpanel.h>
|
|
|
|
#include <confirm.h>
|
2012-04-13 18:51:24 +00:00
|
|
|
#include <base_units.h>
|
2013-01-12 17:32:24 +00:00
|
|
|
#include <msgpanel.h>
|
2009-09-22 12:27:57 +00:00
|
|
|
|
2018-01-30 10:49:51 +00:00
|
|
|
#include <lib_edit_frame.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <eeschema_id.h>
|
|
|
|
#include <class_libentry.h>
|
|
|
|
#include <lib_pin.h>
|
|
|
|
#include <general.h>
|
2016-10-18 16:59:26 +00:00
|
|
|
#include <confirm.h>
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <../common/dialogs/dialog_display_info_HTML_base.h>
|
|
|
|
#include <dialog_lib_edit_pin.h>
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
|
2015-04-22 11:39:00 +00:00
|
|
|
extern void IncrementLabelMember( wxString& name, int aIncrement );
|
2011-07-03 18:51:07 +00:00
|
|
|
|
|
|
|
|
2011-01-21 19:30:59 +00:00
|
|
|
static void AbortPinMove( EDA_DRAW_PANEL* Panel, wxDC* DC );
|
2011-02-03 19:27:28 +00:00
|
|
|
static void DrawMovePin( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPositon, bool aErase );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
|
2009-10-30 19:26:25 +00:00
|
|
|
static wxPoint OldPos;
|
|
|
|
static wxPoint PinPreviousPos;
|
2016-02-19 16:51:23 +00:00
|
|
|
static ELECTRICAL_PINTYPE LastPinType = PIN_INPUT;
|
2009-10-30 19:26:25 +00:00
|
|
|
static int LastPinOrient = PIN_RIGHT;
|
2016-02-28 17:33:29 +00:00
|
|
|
static GRAPHIC_PINSHAPE LastPinShape = PINSHAPE_LINE;
|
2009-10-30 19:26:25 +00:00
|
|
|
static bool LastPinCommonConvert = false;
|
|
|
|
static bool LastPinCommonUnit = false;
|
|
|
|
static bool LastPinVisible = true;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2014-05-12 16:57:46 +00:00
|
|
|
// The -1 is a non-valid value to trigger delayed initialization
|
|
|
|
static int LastPinLength = -1;
|
2014-05-16 13:57:53 +00:00
|
|
|
static int LastPinNameSize = -1;
|
|
|
|
static int LastPinNumSize = -1;
|
2014-05-12 16:57:46 +00:00
|
|
|
|
|
|
|
static int GetLastPinLength()
|
|
|
|
{
|
|
|
|
if( LastPinLength == -1 )
|
2014-08-25 16:31:32 +00:00
|
|
|
LastPinLength = LIB_EDIT_FRAME::GetDefaultPinLength();
|
2014-05-12 16:57:46 +00:00
|
|
|
|
|
|
|
return LastPinLength;
|
|
|
|
}
|
2010-11-19 16:28:46 +00:00
|
|
|
|
2014-05-16 13:57:53 +00:00
|
|
|
static int GetLastPinNameSize()
|
|
|
|
{
|
|
|
|
if( LastPinNameSize == -1 )
|
2014-08-25 16:31:32 +00:00
|
|
|
LastPinNameSize = LIB_EDIT_FRAME::GetPinNameDefaultSize();
|
2014-05-16 13:57:53 +00:00
|
|
|
|
|
|
|
return LastPinNameSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int GetLastPinNumSize()
|
|
|
|
{
|
|
|
|
if( LastPinNumSize == -1 )
|
2014-08-25 16:31:32 +00:00
|
|
|
LastPinNumSize = LIB_EDIT_FRAME::GetPinNumDefaultSize();
|
2014-05-16 13:57:53 +00:00
|
|
|
|
|
|
|
return LastPinNumSize;
|
|
|
|
}
|
|
|
|
|
2010-11-19 16:28:46 +00:00
|
|
|
void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2017-12-18 05:21:00 +00:00
|
|
|
if( GetDrawItem() == NULL || GetDrawItem()->Type() != LIB_PIN_T )
|
2009-09-25 18:49:04 +00:00
|
|
|
return;
|
|
|
|
|
2017-12-18 05:21:00 +00:00
|
|
|
STATUS_FLAGS item_flags = GetDrawItem()->GetFlags(); // save flags to restore them after editing
|
|
|
|
LIB_PIN* pin = (LIB_PIN*) GetDrawItem();
|
2009-10-30 19:26:25 +00:00
|
|
|
|
2018-05-23 17:41:37 +00:00
|
|
|
pin->EnableEditMode( true, !SynchronizePins() );
|
2009-10-30 19:26:25 +00:00
|
|
|
|
2018-05-23 17:41:37 +00:00
|
|
|
DIALOG_LIB_EDIT_PIN dlg( this, pin );
|
2009-12-01 15:14:18 +00:00
|
|
|
|
2009-10-30 19:26:25 +00:00
|
|
|
if( dlg.ShowModal() == wxID_CANCEL )
|
|
|
|
{
|
|
|
|
if( pin->IsNew() )
|
2009-11-11 02:44:58 +00:00
|
|
|
{
|
2011-12-21 13:42:02 +00:00
|
|
|
pin->SetFlags( IS_CANCELLED );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->EndMouseCapture();
|
2009-11-11 02:44:58 +00:00
|
|
|
}
|
2008-04-17 16:25:29 +00:00
|
|
|
return;
|
2009-10-30 19:26:25 +00:00
|
|
|
}
|
2008-04-17 16:25:29 +00:00
|
|
|
|
2009-10-30 19:26:25 +00:00
|
|
|
if( pin->IsModified() || pin->IsNew() )
|
2008-04-17 16:25:29 +00:00
|
|
|
{
|
2010-02-18 20:07:29 +00:00
|
|
|
OnModify( );
|
2013-01-12 17:32:24 +00:00
|
|
|
|
|
|
|
MSG_PANEL_ITEMS items;
|
2018-04-10 10:52:12 +00:00
|
|
|
pin->GetMsgPanelInfo( m_UserUnits, items );
|
2013-01-12 17:32:24 +00:00
|
|
|
SetMsgPanel( items );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->Refresh();
|
2008-04-17 16:25:29 +00:00
|
|
|
}
|
|
|
|
|
2018-01-22 12:33:24 +00:00
|
|
|
pin->EnableEditMode( false );
|
2009-12-03 19:11:34 +00:00
|
|
|
|
|
|
|
// Restore pin flags, that can be changed by the dialog editor
|
2011-12-21 13:42:02 +00:00
|
|
|
pin->ClearFlags();
|
|
|
|
pin->SetFlags( item_flags );
|
2018-05-23 17:41:37 +00:00
|
|
|
|
|
|
|
// Save the pin properties to use for the next new pin.
|
|
|
|
LastPinNameSize = pin->GetNameTextSize();
|
|
|
|
LastPinNumSize = pin->GetNumberTextSize();
|
|
|
|
LastPinOrient = pin->GetOrientation();
|
|
|
|
LastPinLength = pin->GetLength();
|
|
|
|
LastPinShape = pin->GetShape();
|
|
|
|
LastPinType = pin->GetType();
|
|
|
|
LastPinCommonConvert = pin->GetConvert() == 0;
|
|
|
|
LastPinCommonUnit = pin->GetUnit() == 0;
|
|
|
|
LastPinVisible = pin->IsVisible();
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2009-09-29 18:38:21 +00:00
|
|
|
/**
|
|
|
|
* Clean up after aborting a move pin command.
|
2008-04-17 16:25:29 +00:00
|
|
|
*/
|
2011-01-21 19:30:59 +00:00
|
|
|
static void AbortPinMove( EDA_DRAW_PANEL* Panel, wxDC* DC )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2010-11-19 16:28:46 +00:00
|
|
|
LIB_EDIT_FRAME* parent = (LIB_EDIT_FRAME*) Panel->GetParent();
|
2009-09-25 18:49:04 +00:00
|
|
|
|
|
|
|
if( parent == NULL )
|
|
|
|
return;
|
|
|
|
|
2011-04-27 19:44:32 +00:00
|
|
|
LIB_PIN* pin = (LIB_PIN*) parent->GetDrawItem();
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2011-04-27 19:44:32 +00:00
|
|
|
if( pin == NULL || pin->Type() != LIB_PIN_T )
|
2009-09-29 18:38:21 +00:00
|
|
|
return;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2011-04-27 19:44:32 +00:00
|
|
|
pin->ClearFlags();
|
|
|
|
|
|
|
|
if( pin->IsNew() )
|
|
|
|
delete pin;
|
2009-09-29 18:38:21 +00:00
|
|
|
else
|
2010-10-23 13:49:14 +00:00
|
|
|
parent->RestoreComponent();
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2012-03-22 07:02:49 +00:00
|
|
|
// clear edit flags
|
2009-09-25 18:49:04 +00:00
|
|
|
parent->SetDrawItem( NULL );
|
|
|
|
parent->SetLastDrawItem( NULL );
|
2008-04-17 16:25:29 +00:00
|
|
|
Panel->Refresh( true );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-09-29 18:38:21 +00:00
|
|
|
/**
|
|
|
|
* Managed cursor callback for placing component pins.
|
|
|
|
*/
|
2013-02-06 11:54:51 +00:00
|
|
|
void LIB_EDIT_FRAME::PlacePin()
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2017-12-18 05:21:00 +00:00
|
|
|
LIB_PIN* cur_pin = (LIB_PIN*) GetDrawItem();
|
2008-04-17 16:25:29 +00:00
|
|
|
|
2009-12-29 10:35:11 +00:00
|
|
|
// Some tests
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
if( !cur_pin || cur_pin->Type() != LIB_PIN_T )
|
2009-12-29 10:35:11 +00:00
|
|
|
{
|
2011-02-11 20:48:13 +00:00
|
|
|
wxMessageBox( wxT( "LIB_EDIT_FRAME::PlacePin() error" ) );
|
2008-04-17 16:25:29 +00:00
|
|
|
return;
|
2009-12-29 10:35:11 +00:00
|
|
|
}
|
2008-04-17 16:25:29 +00:00
|
|
|
|
2018-01-09 07:54:24 +00:00
|
|
|
wxPoint newpos;
|
2013-08-03 05:15:23 +00:00
|
|
|
newpos = GetCrossHairPosition( true );
|
2008-04-17 16:25:29 +00:00
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
LIB_PART* part = GetCurPart();
|
|
|
|
|
2018-04-08 10:28:59 +00:00
|
|
|
// Test for another pin in same new position in other units:
|
2018-01-09 07:54:24 +00:00
|
|
|
bool ask_for_pin = true;
|
|
|
|
|
|
|
|
for( LIB_PIN* pin = part->GetNextPin(); pin; pin = part->GetNextPin( pin ) )
|
2008-04-17 16:25:29 +00:00
|
|
|
{
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
if( pin == cur_pin || newpos != pin->GetPosition() || pin->GetFlags() )
|
2008-04-17 16:25:29 +00:00
|
|
|
continue;
|
2009-09-29 18:38:21 +00:00
|
|
|
|
2018-01-09 07:54:24 +00:00
|
|
|
// test for same body style
|
|
|
|
if( pin->GetConvert() && pin->GetConvert() != cur_pin->GetConvert() )
|
|
|
|
continue;
|
|
|
|
|
2011-10-28 13:43:37 +00:00
|
|
|
if( ask_for_pin && SynchronizePins() )
|
2008-04-17 16:25:29 +00:00
|
|
|
{
|
2011-12-29 20:11:42 +00:00
|
|
|
m_canvas->SetIgnoreMouseEvents( true );
|
2018-01-08 09:48:33 +00:00
|
|
|
wxString msg;
|
|
|
|
msg.Printf( _( "This position is already occupied by another pin, in unit %d.\n"
|
|
|
|
"Continue?" ), pin->GetUnit() );
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
|
2018-01-09 07:54:24 +00:00
|
|
|
bool status = IsOK( this, msg );
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2011-12-29 20:11:42 +00:00
|
|
|
m_canvas->SetIgnoreMouseEvents( false );
|
2010-12-07 16:10:42 +00:00
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
if( !status )
|
|
|
|
return;
|
|
|
|
else
|
2009-05-09 17:29:48 +00:00
|
|
|
ask_for_pin = false;
|
2008-04-17 16:25:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-10-23 13:49:14 +00:00
|
|
|
// Create Undo from GetTempCopyComponent() if exists ( i.e. after a pin move)
|
|
|
|
// or from m_component (pin add ...)
|
|
|
|
if( GetTempCopyComponent() )
|
|
|
|
SaveCopyInUndoList( GetTempCopyComponent() );
|
|
|
|
else
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
SaveCopyInUndoList( part );
|
2010-10-23 13:49:14 +00:00
|
|
|
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->SetMouseCapture( NULL, NULL );
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
cur_pin->Move( newpos );
|
2009-09-29 18:38:21 +00:00
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
if( cur_pin->IsNew() )
|
2008-04-17 16:25:29 +00:00
|
|
|
{
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
LastPinOrient = cur_pin->GetOrientation();
|
|
|
|
LastPinType = cur_pin->GetType();
|
|
|
|
LastPinShape = cur_pin->GetShape();
|
2010-12-07 16:10:42 +00:00
|
|
|
|
2011-10-28 13:43:37 +00:00
|
|
|
if( SynchronizePins() )
|
2018-01-09 07:54:24 +00:00
|
|
|
CreateImagePins( cur_pin );
|
2010-12-07 16:10:42 +00:00
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
m_lastDrawItem = cur_pin;
|
2017-12-18 05:21:00 +00:00
|
|
|
part->AddDrawItem( GetDrawItem() );
|
2008-04-17 16:25:29 +00:00
|
|
|
}
|
|
|
|
|
2012-03-22 07:02:49 +00:00
|
|
|
// Put linked pins in new position, and clear flags
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
for( LIB_PIN* pin = part->GetNextPin(); pin; pin = part->GetNextPin( pin ) )
|
2008-04-17 16:25:29 +00:00
|
|
|
{
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
if( pin->GetFlags() == 0 )
|
2008-04-17 16:25:29 +00:00
|
|
|
continue;
|
2010-12-07 16:10:42 +00:00
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
pin->Move( cur_pin->GetPosition() );
|
|
|
|
pin->ClearFlags();
|
2008-04-17 16:25:29 +00:00
|
|
|
}
|
|
|
|
|
2017-12-18 05:21:00 +00:00
|
|
|
SetDrawItem( NULL );
|
2013-02-06 11:54:51 +00:00
|
|
|
|
2017-11-14 12:53:06 +00:00
|
|
|
OnModify();
|
2013-02-06 11:54:51 +00:00
|
|
|
m_canvas->Refresh();
|
2010-10-04 12:58:07 +00:00
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2009-09-29 18:38:21 +00:00
|
|
|
|
2018-04-04 17:19:17 +00:00
|
|
|
void LIB_EDIT_FRAME::StartMovePin( LIB_ITEM* aItem )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2018-04-04 17:19:17 +00:00
|
|
|
LIB_PIN* cur_pin = (LIB_PIN*) aItem;
|
|
|
|
wxPoint startPos;
|
2008-04-17 16:25:29 +00:00
|
|
|
|
2010-10-23 13:49:14 +00:00
|
|
|
TempCopyComponent();
|
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
LIB_PART* part = GetCurPart();
|
2011-02-28 13:53:49 +00:00
|
|
|
|
2018-01-09 07:54:24 +00:00
|
|
|
// Clear pin flags and mark pins for moving. All pins having the same location
|
|
|
|
// orientation, and body style are flagged.
|
|
|
|
for( LIB_PIN* pin = part->GetNextPin(); pin; pin = part->GetNextPin( pin ) )
|
2008-04-17 16:25:29 +00:00
|
|
|
{
|
2013-02-06 11:54:51 +00:00
|
|
|
pin->ClearFlags();
|
2011-02-28 13:53:49 +00:00
|
|
|
|
2018-01-09 07:54:24 +00:00
|
|
|
if( !SynchronizePins() )
|
|
|
|
continue;
|
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
if( pin == cur_pin )
|
2008-04-17 16:25:29 +00:00
|
|
|
continue;
|
2011-02-28 13:53:49 +00:00
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
if( pin->GetPosition() == cur_pin->GetPosition() &&
|
2018-01-09 07:54:24 +00:00
|
|
|
pin->GetOrientation() == cur_pin->GetOrientation() &&
|
|
|
|
pin->GetConvert() == cur_pin->GetConvert()
|
|
|
|
)
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
{
|
2013-02-06 11:54:51 +00:00
|
|
|
pin->SetFlags( IS_LINKED | IS_MOVED );
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
}
|
2008-04-17 16:25:29 +00:00
|
|
|
}
|
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
cur_pin->SetFlags( IS_LINKED | IS_MOVED );
|
|
|
|
|
|
|
|
PinPreviousPos = OldPos = cur_pin->GetPosition();
|
2008-04-17 16:25:29 +00:00
|
|
|
startPos.x = OldPos.x;
|
|
|
|
startPos.y = -OldPos.y;
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
SetCrossHairPosition( startPos );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2008-04-17 16:25:29 +00:00
|
|
|
|
2013-01-12 17:32:24 +00:00
|
|
|
MSG_PANEL_ITEMS items;
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
|
2018-04-10 10:52:12 +00:00
|
|
|
cur_pin->GetMsgPanelInfo( m_UserUnits, items );
|
2013-01-12 17:32:24 +00:00
|
|
|
SetMsgPanel( items );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->SetMouseCapture( DrawMovePin, AbortPinMove );
|
2013-02-06 11:54:51 +00:00
|
|
|
|
|
|
|
// Refresh the screen to avoid color artifacts when drawing
|
|
|
|
// the pin in Edit mode and moving it from its start position
|
|
|
|
m_canvas->Refresh();
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-10-30 19:26:25 +00:00
|
|
|
/* Move pin to the current mouse position. This function is called by the
|
|
|
|
* cursor management code. */
|
2011-02-03 19:27:28 +00:00
|
|
|
static void DrawMovePin( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
|
|
|
|
bool aErase )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2011-02-03 19:27:28 +00:00
|
|
|
LIB_EDIT_FRAME* parent = (LIB_EDIT_FRAME*) aPanel->GetParent();
|
2009-09-25 18:49:04 +00:00
|
|
|
|
|
|
|
if( parent == NULL )
|
|
|
|
return;
|
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
LIB_PIN* cur_pin = (LIB_PIN*) parent->GetDrawItem();
|
2009-09-29 18:38:21 +00:00
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
if( cur_pin == NULL || cur_pin->Type() != LIB_PIN_T )
|
2009-09-29 18:38:21 +00:00
|
|
|
return;
|
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
wxPoint pinpos = cur_pin->GetPosition();
|
2016-11-04 11:13:22 +00:00
|
|
|
int show_opts = PIN_DRAW_TEXTS | PIN_DRAW_DANGLING | PIN_DANGLING_HIDDEN;
|
|
|
|
|
|
|
|
if( parent->GetShowElectricalType() )
|
|
|
|
show_opts |= PIN_DRAW_ELECTRICAL_TYPE_NAME;
|
|
|
|
|
2016-11-13 07:43:24 +00:00
|
|
|
// In LIB_PIN::Draw() a void* parameter used as flag to pass show_opts.
|
|
|
|
// Build it:
|
|
|
|
void* showOptions = reinterpret_cast<void*>( show_opts );
|
2008-04-17 16:25:29 +00:00
|
|
|
|
2012-03-22 07:02:49 +00:00
|
|
|
// Erase pin in old position
|
2011-02-03 19:27:28 +00:00
|
|
|
if( aErase )
|
2008-04-17 16:25:29 +00:00
|
|
|
{
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
cur_pin->Move( PinPreviousPos );
|
2017-02-20 17:48:27 +00:00
|
|
|
cur_pin->Draw( aPanel, aDC, wxPoint( 0, 0 ), COLOR4D::UNSPECIFIED, g_XorMode,
|
2016-11-04 11:13:22 +00:00
|
|
|
showOptions, DefaultTransform );
|
2008-04-17 16:25:29 +00:00
|
|
|
}
|
|
|
|
|
2012-03-22 07:02:49 +00:00
|
|
|
// Redraw pin in new position
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
cur_pin->Move( aPanel->GetParent()->GetCrossHairPosition( true ) );
|
2017-02-20 17:48:27 +00:00
|
|
|
cur_pin->Draw( aPanel, aDC, wxPoint( 0, 0 ), COLOR4D::UNSPECIFIED, g_XorMode,
|
2016-11-04 11:13:22 +00:00
|
|
|
showOptions, DefaultTransform );
|
2008-04-17 16:25:29 +00:00
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
PinPreviousPos = cur_pin->GetPosition();
|
2008-04-17 16:25:29 +00:00
|
|
|
|
|
|
|
/* Keep the original position for existing pin (for Undo command)
|
2009-09-29 18:38:21 +00:00
|
|
|
* and the current position for a new pin */
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
if( !cur_pin->IsNew() )
|
|
|
|
cur_pin->Move( pinpos );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-09-29 18:38:21 +00:00
|
|
|
/*
|
|
|
|
* Create a new pin.
|
|
|
|
*/
|
2010-11-19 16:28:46 +00:00
|
|
|
void LIB_EDIT_FRAME::CreatePin( wxDC* DC )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
LIB_PART* part = GetCurPart();
|
|
|
|
|
|
|
|
if( !part )
|
2008-04-17 16:25:29 +00:00
|
|
|
return;
|
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
part->ClearStatus();
|
2008-04-17 16:25:29 +00:00
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
LIB_PIN* pin = new LIB_PIN( part );
|
2009-09-29 18:38:21 +00:00
|
|
|
|
2017-12-18 05:21:00 +00:00
|
|
|
SetDrawItem( pin );
|
2009-10-30 19:26:25 +00:00
|
|
|
|
2011-12-21 13:42:02 +00:00
|
|
|
pin->SetFlags( IS_NEW );
|
2010-10-25 15:43:42 +00:00
|
|
|
pin->SetUnit( m_unit );
|
|
|
|
pin->SetConvert( m_convert );
|
2008-04-17 16:25:29 +00:00
|
|
|
|
2012-03-22 07:02:49 +00:00
|
|
|
// Flag pins to consider
|
2011-10-28 13:43:37 +00:00
|
|
|
if( SynchronizePins() )
|
2011-12-21 13:42:02 +00:00
|
|
|
pin->SetFlags( IS_LINKED );
|
2009-10-30 19:26:25 +00:00
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
pin->Move( GetCrossHairPosition( true ) );
|
2014-05-12 16:57:46 +00:00
|
|
|
pin->SetLength( GetLastPinLength() );
|
2010-12-07 16:10:42 +00:00
|
|
|
pin->SetOrientation( LastPinOrient );
|
|
|
|
pin->SetType( LastPinType );
|
|
|
|
pin->SetShape( LastPinShape );
|
2014-05-16 13:57:53 +00:00
|
|
|
pin->SetNameTextSize( GetLastPinNameSize() );
|
|
|
|
pin->SetNumberTextSize( GetLastPinNumSize() );
|
2010-12-07 16:10:42 +00:00
|
|
|
pin->SetConvert( LastPinCommonConvert ? 0 : m_convert );
|
|
|
|
pin->SetUnit( LastPinCommonUnit ? 0 : m_unit );
|
|
|
|
pin->SetVisible( LastPinVisible );
|
|
|
|
PinPreviousPos = pin->GetPosition();
|
2011-12-29 20:11:42 +00:00
|
|
|
m_canvas->SetIgnoreMouseEvents( true );
|
2009-10-30 19:26:25 +00:00
|
|
|
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
|
|
|
|
cmd.SetId( ID_LIBEDIT_EDIT_PIN );
|
|
|
|
GetEventHandler()->ProcessEvent( cmd );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2011-12-29 20:11:42 +00:00
|
|
|
m_canvas->SetIgnoreMouseEvents( false );
|
2009-11-11 02:44:58 +00:00
|
|
|
|
2011-12-21 13:42:02 +00:00
|
|
|
if( pin->GetFlags() & IS_CANCELLED )
|
2009-11-11 02:44:58 +00:00
|
|
|
{
|
2018-04-04 17:19:17 +00:00
|
|
|
deleteItem( DC, pin );
|
2009-11-11 02:44:58 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-10-23 13:49:14 +00:00
|
|
|
ClearTempCopyComponent();
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->SetMouseCapture( DrawMovePin, AbortPinMove );
|
2010-12-07 16:10:42 +00:00
|
|
|
|
2009-12-06 18:04:41 +00:00
|
|
|
if( DC )
|
2016-11-04 11:13:22 +00:00
|
|
|
{
|
|
|
|
int show_opts = PIN_DRAW_TEXTS | PIN_DRAW_DANGLING | PIN_DANGLING_HIDDEN;
|
|
|
|
|
|
|
|
if( GetShowElectricalType() )
|
|
|
|
show_opts |= PIN_DRAW_ELECTRICAL_TYPE_NAME;
|
|
|
|
|
2016-11-13 07:43:24 +00:00
|
|
|
// In LIB_PIN::Draw() a void* parameter used as flag to pass show_opts.
|
|
|
|
// Build it:
|
|
|
|
void* showOptions = reinterpret_cast<void*>( show_opts );
|
2016-11-04 11:13:22 +00:00
|
|
|
|
2017-02-20 17:48:27 +00:00
|
|
|
pin->Draw( m_canvas, DC, wxPoint( 0, 0 ), COLOR4D::UNSPECIFIED, GR_COPY,
|
2016-11-04 11:13:22 +00:00
|
|
|
showOptions, DefaultTransform );
|
|
|
|
}
|
2009-12-06 18:04:41 +00:00
|
|
|
|
2009-11-11 02:44:58 +00:00
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
|
2018-01-09 07:54:24 +00:00
|
|
|
void LIB_EDIT_FRAME::CreateImagePins( LIB_PIN* aPin )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2009-10-08 13:19:28 +00:00
|
|
|
int ii;
|
2018-01-08 09:48:33 +00:00
|
|
|
LIB_PIN* newPin;
|
2008-04-17 16:25:29 +00:00
|
|
|
|
2018-01-08 09:48:33 +00:00
|
|
|
// if "synchronize pins edition" option is off, do not create any similar pin for other
|
|
|
|
// units and/or shapes: each unit is edited regardless other units or body
|
2011-10-28 13:43:37 +00:00
|
|
|
if( !SynchronizePins() )
|
2008-04-17 16:25:29 +00:00
|
|
|
return;
|
|
|
|
|
2018-01-09 07:54:24 +00:00
|
|
|
if( aPin->GetUnit() == 0 ) // Pin common to all units: no need to create similar pins.
|
|
|
|
return;
|
|
|
|
|
2018-01-08 09:48:33 +00:00
|
|
|
// When units are interchangeable, all units are expected to have similar pins
|
|
|
|
// at the same position
|
2018-01-09 07:54:24 +00:00
|
|
|
// to facilitate pin edition, create pins for all other units for the current body style
|
2018-01-08 09:48:33 +00:00
|
|
|
// at the same position as aPin
|
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
for( ii = 1; ii <= aPin->GetParent()->GetUnitCount(); ii++ )
|
2008-04-17 16:25:29 +00:00
|
|
|
{
|
2018-01-09 07:54:24 +00:00
|
|
|
if( ii == aPin->GetUnit() )
|
2018-01-08 09:48:33 +00:00
|
|
|
continue;
|
2008-04-17 16:25:29 +00:00
|
|
|
|
2018-01-08 09:48:33 +00:00
|
|
|
newPin = (LIB_PIN*) aPin->Clone();
|
2010-12-07 16:10:42 +00:00
|
|
|
|
2015-10-27 13:52:54 +00:00
|
|
|
// To avoid mistakes, gives this pin a new pin number because
|
|
|
|
// it does no have the save pin number as the master pin
|
2018-01-08 09:48:33 +00:00
|
|
|
// Because we do not know the actual number, give it a temporary number
|
|
|
|
wxString unknownNum;
|
|
|
|
unknownNum.Printf( "%s-U%c", aPin->GetNumber(), wxChar( 'A' + ii - 1 ) );
|
|
|
|
newPin->SetNumber( unknownNum );
|
2015-10-27 13:52:54 +00:00
|
|
|
|
2018-01-08 09:48:33 +00:00
|
|
|
newPin->SetUnit( ii );
|
|
|
|
aPin->GetParent()->AddDrawItem( newPin );
|
2008-04-17 16:25:29 +00:00
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-01-01 20:52:37 +00:00
|
|
|
/* aMasterPin is the "template" pin
|
|
|
|
* aId is a param to select what should be mofified:
|
|
|
|
* - aId = ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNAMESIZE_ITEM:
|
|
|
|
* Change pins text name size
|
|
|
|
* - aId = ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNUMSIZE_ITEM:
|
|
|
|
* Change pins text num size
|
|
|
|
* - aId = ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINSIZE_ITEM:
|
|
|
|
* Change pins length.
|
2008-04-17 16:25:29 +00:00
|
|
|
*
|
2013-01-01 20:52:37 +00:00
|
|
|
* If aMasterPin is selected ( .m_flag == IS_SELECTED ),
|
|
|
|
* only the other selected pins are modified
|
2008-04-17 16:25:29 +00:00
|
|
|
*/
|
2013-01-01 20:52:37 +00:00
|
|
|
void LIB_EDIT_FRAME::GlobalSetPins( LIB_PIN* aMasterPin, int aId )
|
2009-10-08 13:19:28 +00:00
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
LIB_PART* part = GetCurPart();
|
|
|
|
|
|
|
|
if( !part || !aMasterPin )
|
2008-04-17 16:25:29 +00:00
|
|
|
return;
|
2010-12-07 16:10:42 +00:00
|
|
|
|
2013-01-01 20:52:37 +00:00
|
|
|
if( aMasterPin->Type() != LIB_PIN_T )
|
2008-04-17 16:25:29 +00:00
|
|
|
return;
|
|
|
|
|
2015-02-25 19:43:37 +00:00
|
|
|
bool selected = aMasterPin->IsSelected();
|
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
for( LIB_PIN* pin = part->GetNextPin(); pin; pin = part->GetNextPin( pin ) )
|
2008-04-17 16:25:29 +00:00
|
|
|
{
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
if( pin->GetConvert() && pin->GetConvert() != m_convert )
|
2008-04-17 16:25:29 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
// Is it the "selected mode" ?
|
2013-01-01 20:52:37 +00:00
|
|
|
if( selected && !pin->IsSelected() )
|
2008-04-17 16:25:29 +00:00
|
|
|
continue;
|
|
|
|
|
2013-01-01 20:52:37 +00:00
|
|
|
switch( aId )
|
2008-04-17 16:25:29 +00:00
|
|
|
{
|
|
|
|
case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNUMSIZE_ITEM:
|
2013-01-01 20:52:37 +00:00
|
|
|
pin->SetNumberTextSize( aMasterPin->GetNumberTextSize() );
|
2008-04-17 16:25:29 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNAMESIZE_ITEM:
|
2013-01-01 20:52:37 +00:00
|
|
|
pin->SetNameTextSize( aMasterPin->GetNameTextSize() );
|
2008-04-17 16:25:29 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINSIZE_ITEM:
|
2013-01-01 20:52:37 +00:00
|
|
|
pin->SetLength( aMasterPin->GetLength() );
|
2008-04-17 16:25:29 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2013-01-01 20:52:37 +00:00
|
|
|
// Clear the flag IS_CHANGED, which was set by previous changes (if any)
|
|
|
|
// but not used here.
|
|
|
|
pin->ClearFlags( IS_CHANGED );
|
2008-04-17 16:25:29 +00:00
|
|
|
}
|
2017-12-03 10:50:50 +00:00
|
|
|
|
|
|
|
// Now changes are made, call OnModify() to validate thes changes and set
|
|
|
|
// the global change for UI
|
|
|
|
OnModify();
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-03-22 07:02:49 +00:00
|
|
|
// Create a new pin based on the previous pin with an incremented pin number.
|
2010-11-19 16:28:46 +00:00
|
|
|
void LIB_EDIT_FRAME::RepeatPinItem( wxDC* DC, LIB_PIN* SourcePin )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2009-10-08 13:19:28 +00:00
|
|
|
wxString msg;
|
2008-04-17 16:25:29 +00:00
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
LIB_PART* part = GetCurPart();
|
|
|
|
|
|
|
|
if( !part || !SourcePin || SourcePin->Type() != LIB_PIN_T )
|
2008-04-17 16:25:29 +00:00
|
|
|
return;
|
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
LIB_PIN* pin = (LIB_PIN*) SourcePin->Clone();
|
|
|
|
|
|
|
|
pin->ClearFlags();
|
|
|
|
pin->SetFlags( IS_NEW );
|
2015-04-22 11:39:00 +00:00
|
|
|
wxPoint step;
|
|
|
|
|
|
|
|
switch( pin->GetOrientation() )
|
|
|
|
{
|
|
|
|
case PIN_UP:
|
|
|
|
step.x = GetRepeatPinStep();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PIN_DOWN:
|
|
|
|
step.x = GetRepeatPinStep();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PIN_LEFT:
|
|
|
|
step.y = - GetRepeatPinStep();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PIN_RIGHT:
|
|
|
|
step.y = - GetRepeatPinStep();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
pin->Move( pin->GetPosition() + step );
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
wxString nextName = pin->GetName();
|
2015-04-22 11:39:00 +00:00
|
|
|
IncrementLabelMember( nextName, GetRepeatDeltaLabel() );
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
pin->SetName( nextName );
|
2008-04-17 16:25:29 +00:00
|
|
|
|
2017-08-10 15:00:28 +00:00
|
|
|
msg = pin->GetNumber();
|
2015-04-22 11:39:00 +00:00
|
|
|
IncrementLabelMember( msg, GetRepeatDeltaLabel() );
|
2017-08-10 15:00:28 +00:00
|
|
|
pin->SetNumber( msg );
|
2008-04-17 16:25:29 +00:00
|
|
|
|
2017-12-18 05:21:00 +00:00
|
|
|
SetDrawItem( pin );
|
2008-04-17 16:25:29 +00:00
|
|
|
|
2011-10-28 13:43:37 +00:00
|
|
|
if( SynchronizePins() )
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
pin->SetFlags( IS_LINKED );
|
2008-04-17 16:25:29 +00:00
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
wxPoint savepos = GetCrossHairPosition();
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->CrossHairOff( DC );
|
2013-08-03 05:15:23 +00:00
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
SetCrossHairPosition( wxPoint( pin->GetPosition().x, -pin->GetPosition().y ) );
|
2010-02-16 16:21:52 +00:00
|
|
|
|
2009-12-29 10:35:11 +00:00
|
|
|
// Add this new pin in list, and creates pins for others parts if needed
|
2017-12-18 05:21:00 +00:00
|
|
|
SetDrawItem( pin );
|
2010-10-23 13:49:14 +00:00
|
|
|
ClearTempCopyComponent();
|
2013-02-06 11:54:51 +00:00
|
|
|
PlacePin();
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
m_lastDrawItem = pin;
|
2009-12-29 10:35:11 +00:00
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
SetCrossHairPosition( savepos );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->CrossHairOn( DC );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2013-01-12 17:32:24 +00:00
|
|
|
MSG_PANEL_ITEMS items;
|
2018-04-10 10:52:12 +00:00
|
|
|
pin->GetMsgPanelInfo( m_UserUnits, items );
|
2013-01-12 17:32:24 +00:00
|
|
|
SetMsgPanel( items );
|
2010-02-18 20:07:29 +00:00
|
|
|
OnModify( );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
|
2012-03-22 07:02:49 +00:00
|
|
|
// helper function to sort pins by pin num
|
2009-10-20 09:17:24 +00:00
|
|
|
bool sort_by_pin_number( const LIB_PIN* ref, const LIB_PIN* tst )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2017-08-10 15:00:28 +00:00
|
|
|
int test = ref->GetNumber().Cmp( tst->GetNumber() );
|
2008-04-17 16:25:29 +00:00
|
|
|
|
2009-10-20 09:17:24 +00:00
|
|
|
if( test == 0 )
|
|
|
|
{
|
2010-10-25 15:43:42 +00:00
|
|
|
test = ref->GetConvert() - tst->GetConvert();
|
2009-10-20 09:17:24 +00:00
|
|
|
}
|
2010-12-07 16:10:42 +00:00
|
|
|
|
2009-10-20 09:17:24 +00:00
|
|
|
if( test == 0 )
|
|
|
|
{
|
2010-10-25 15:43:42 +00:00
|
|
|
test = ref->GetUnit() - tst->GetUnit();
|
2009-10-20 09:17:24 +00:00
|
|
|
}
|
2010-12-07 16:10:42 +00:00
|
|
|
|
2009-10-20 09:17:24 +00:00
|
|
|
return test < 0;
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
2008-04-17 16:25:29 +00:00
|
|
|
|
|
|
|
|
2010-11-19 16:28:46 +00:00
|
|
|
void LIB_EDIT_FRAME::OnCheckComponent( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
LIB_PART* part = GetCurPart();
|
|
|
|
|
|
|
|
if( !part )
|
2009-09-25 18:49:04 +00:00
|
|
|
return;
|
2008-04-17 16:25:29 +00:00
|
|
|
|
2014-06-05 01:06:52 +00:00
|
|
|
const int MIN_GRID_SIZE = 25;
|
|
|
|
|
|
|
|
LIB_PINS pinList;
|
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
part->GetPins( pinList );
|
2008-04-17 16:25:29 +00:00
|
|
|
|
2014-06-05 01:06:52 +00:00
|
|
|
if( pinList.size() == 0 )
|
2008-04-17 16:25:29 +00:00
|
|
|
{
|
2009-10-20 09:17:24 +00:00
|
|
|
DisplayInfoMessage( this, _( "No pins!" ) );
|
|
|
|
return;
|
2008-04-17 16:25:29 +00:00
|
|
|
}
|
|
|
|
|
2009-10-20 09:17:24 +00:00
|
|
|
// Sort pins by pin num, so 2 duplicate pins
|
|
|
|
// (pins with the same number) will be consecutive in list
|
2014-06-05 01:06:52 +00:00
|
|
|
sort( pinList.begin(), pinList.end(), sort_by_pin_number );
|
2008-04-17 16:25:29 +00:00
|
|
|
|
2009-10-20 09:17:24 +00:00
|
|
|
// Test for duplicates:
|
2009-10-30 19:26:25 +00:00
|
|
|
DIALOG_DISPLAY_HTML_TEXT_BASE error_display( this, wxID_ANY,
|
|
|
|
_( "Marker Information" ),
|
|
|
|
wxDefaultPosition,
|
|
|
|
wxSize( 750, 600 ) );
|
|
|
|
|
2014-06-05 01:06:52 +00:00
|
|
|
int dup_error = 0;
|
|
|
|
|
|
|
|
for( unsigned ii = 1; ii < pinList.size(); ii++ )
|
2008-04-17 16:25:29 +00:00
|
|
|
{
|
2014-06-05 01:06:52 +00:00
|
|
|
LIB_PIN* curr_pin = pinList[ii];
|
|
|
|
LIB_PIN* pin = pinList[ii - 1];
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2014-06-05 01:06:52 +00:00
|
|
|
if( pin->GetNumber() != curr_pin->GetNumber()
|
2018-03-09 01:52:03 +00:00
|
|
|
|| pin->GetConvert() != curr_pin->GetConvert() )
|
2008-04-17 16:25:29 +00:00
|
|
|
continue;
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2009-10-25 15:54:00 +00:00
|
|
|
dup_error++;
|
2013-04-09 17:49:01 +00:00
|
|
|
|
|
|
|
/* TODO I dare someone to find a way to make happy translators on
|
|
|
|
this thing! Lorenzo */
|
2014-06-05 01:06:52 +00:00
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
wxString msg = wxString::Format( _(
|
|
|
|
"<b>Duplicate pin %s</b> \"%s\" at location <b>(%.3f, %.3f)</b>"
|
|
|
|
" conflicts with pin %s \"%s\" at location <b>(%.3f, %.3f)</b>" ),
|
2017-08-10 15:00:28 +00:00
|
|
|
GetChars( curr_pin->GetNumber() ),
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
GetChars( curr_pin->GetName() ),
|
|
|
|
curr_pin->GetPosition().x / 1000.0,
|
|
|
|
-curr_pin->GetPosition().y / 1000.0,
|
2017-08-10 15:00:28 +00:00
|
|
|
GetChars( pin->GetNumber() ),
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
GetChars( pin->GetName() ),
|
|
|
|
pin->GetPosition().x / 1000.0,
|
|
|
|
-pin->GetPosition().y / 1000.0
|
|
|
|
);
|
|
|
|
|
|
|
|
if( part->GetUnitCount() > 1 )
|
2008-04-17 16:25:29 +00:00
|
|
|
{
|
2018-03-09 01:52:03 +00:00
|
|
|
msg += wxString::Format( _( " in units %c and %c" ),
|
|
|
|
'A' + curr_pin->GetUnit() - 1,
|
|
|
|
'A' + pin->GetUnit() - 1 );
|
2008-04-17 16:25:29 +00:00
|
|
|
}
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2009-09-25 18:49:04 +00:00
|
|
|
if( m_showDeMorgan )
|
2008-04-17 16:25:29 +00:00
|
|
|
{
|
2010-10-25 15:43:42 +00:00
|
|
|
if( curr_pin->GetConvert() )
|
2009-09-28 16:14:45 +00:00
|
|
|
msg += _( " of converted" );
|
2008-04-17 16:25:29 +00:00
|
|
|
else
|
2009-09-25 18:49:04 +00:00
|
|
|
msg += _( " of normal" );
|
2008-04-17 16:25:29 +00:00
|
|
|
}
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2009-10-20 09:17:24 +00:00
|
|
|
msg += wxT( ".<br>" );
|
2014-06-05 01:06:52 +00:00
|
|
|
|
2009-10-25 15:54:00 +00:00
|
|
|
error_display.m_htmlWindow->AppendToPage( msg );
|
|
|
|
}
|
|
|
|
|
|
|
|
// Test for off grid pins:
|
2014-06-05 01:06:52 +00:00
|
|
|
int offgrid_error = 0;
|
2010-12-07 16:10:42 +00:00
|
|
|
|
2014-06-05 01:06:52 +00:00
|
|
|
for( unsigned ii = 0; ii < pinList.size(); ii++ )
|
2009-10-25 15:54:00 +00:00
|
|
|
{
|
2014-06-05 01:06:52 +00:00
|
|
|
LIB_PIN* pin = pinList[ii];
|
2009-10-25 15:54:00 +00:00
|
|
|
|
2014-06-05 01:06:52 +00:00
|
|
|
if( ( (pin->GetPosition().x % MIN_GRID_SIZE) == 0 ) &&
|
|
|
|
( (pin->GetPosition().y % MIN_GRID_SIZE) == 0 ) )
|
2009-10-25 15:54:00 +00:00
|
|
|
continue;
|
|
|
|
|
2014-06-05 01:06:52 +00:00
|
|
|
// "pin" is off grid here.
|
2009-10-25 15:54:00 +00:00
|
|
|
offgrid_error++;
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
wxString msg = wxString::Format( _(
|
|
|
|
"<b>Off grid pin %s</b> \"%s\" at location <b>(%.3f, %.3f)</b>" ),
|
2017-08-10 15:00:28 +00:00
|
|
|
GetChars( pin->GetNumber() ),
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
GetChars( pin->GetName() ),
|
|
|
|
pin->GetPosition().x / 1000.0,
|
|
|
|
-pin->GetPosition().y / 1000.0
|
|
|
|
);
|
2009-10-25 15:54:00 +00:00
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
if( part->GetUnitCount() > 1 )
|
2009-10-25 15:54:00 +00:00
|
|
|
{
|
2018-01-18 10:23:59 +00:00
|
|
|
msg += wxString::Format( _( " in symbol %c" ), 'A' + pin->GetUnit() - 1 );
|
2009-10-25 15:54:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( m_showDeMorgan )
|
|
|
|
{
|
2014-06-05 01:06:52 +00:00
|
|
|
if( pin->GetConvert() )
|
2009-10-25 15:54:00 +00:00
|
|
|
msg += _( " of converted" );
|
|
|
|
else
|
|
|
|
msg += _( " of normal" );
|
|
|
|
}
|
2009-09-25 18:49:04 +00:00
|
|
|
|
2009-10-25 15:54:00 +00:00
|
|
|
msg += wxT( ".<br>" );
|
2014-06-05 01:06:52 +00:00
|
|
|
|
2009-10-20 09:17:24 +00:00
|
|
|
error_display.m_htmlWindow->AppendToPage( msg );
|
2008-04-17 16:25:29 +00:00
|
|
|
}
|
|
|
|
|
2009-10-25 15:54:00 +00:00
|
|
|
if( !dup_error && !offgrid_error )
|
2010-12-07 16:10:42 +00:00
|
|
|
DisplayInfoMessage( this, _( "No off grid or duplicate pins were found." ) );
|
2009-10-20 09:17:24 +00:00
|
|
|
else
|
|
|
|
error_display.ShowModal();
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|