2008-04-17 16:25:29 +00:00
|
|
|
|
/***************************/
|
|
|
|
|
/* EESchema - PinEdit.cpp */
|
|
|
|
|
/***************************/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2009-09-22 12:27:57 +00:00
|
|
|
|
#include "fctsys.h"
|
|
|
|
|
|
|
|
|
|
#include "program.h"
|
|
|
|
|
#include "libeditfrm.h"
|
|
|
|
|
#include "eeschema_id.h"
|
2009-09-25 18:49:04 +00:00
|
|
|
|
#include "class_libentry.h"
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
|
|
#include "pinedit-dialog.h"
|
2009-10-20 09:17:24 +00:00
|
|
|
|
#include "dialog_display_info_HTML_base.h"
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
|
|
static int CodeOrient[4] =
|
|
|
|
|
{
|
2008-04-17 16:25:29 +00:00
|
|
|
|
PIN_RIGHT,
|
|
|
|
|
PIN_LEFT,
|
|
|
|
|
PIN_UP,
|
|
|
|
|
PIN_DOWN
|
2007-05-06 16:03:28 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#define NBSHAPES 7
|
|
|
|
|
static wxString shape_list[NBSHAPES] =
|
|
|
|
|
{
|
2009-10-20 09:17:24 +00:00
|
|
|
|
_( "line" ), _( "invert" ), _( "clock" ), _( "clock inv" ),
|
2008-04-17 16:25:29 +00:00
|
|
|
|
_( "low in" ), _( "low clock" ), _( "low out" )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
};
|
|
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
|
int CodeShape[NBSHAPES] =
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
2009-09-04 18:57:37 +00:00
|
|
|
|
NONE, INVERT, CLOCK, CLOCK | INVERT, LOWLEVEL_IN, LOWLEVEL_IN | CLOCK,
|
|
|
|
|
LOWLEVEL_OUT
|
2007-05-06 16:03:28 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Routines locales */
|
2009-10-08 13:19:28 +00:00
|
|
|
|
static void CreateImagePins( LIB_PIN* Pin, int unit, int convert,
|
2009-09-25 18:49:04 +00:00
|
|
|
|
bool asDeMorgan );
|
2008-04-17 16:25:29 +00:00
|
|
|
|
static void AbortPinMove( WinEDA_DrawPanel* Panel, wxDC* DC );
|
|
|
|
|
static void DrawMovePin( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
|
|
/* Variables importees */
|
|
|
|
|
|
|
|
|
|
/* Variables locales */
|
|
|
|
|
static wxPoint OldPos, PinPreviousPos;
|
2009-10-20 09:17:24 +00:00
|
|
|
|
static int LastPinType = PIN_INPUT,
|
|
|
|
|
LastPinOrient = PIN_RIGHT,
|
|
|
|
|
LastPinShape = NONE,
|
|
|
|
|
LastPinSize = 300,
|
|
|
|
|
LastPinNameSize = 50,
|
|
|
|
|
LastPinNumSize = 50,
|
2009-05-09 17:29:48 +00:00
|
|
|
|
LastPinCommonConvert = false,
|
|
|
|
|
LastPinCommonUnit = false,
|
2009-10-20 09:17:24 +00:00
|
|
|
|
LastPinNoDraw = false;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "pinedit-dialog.cpp"
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
2008-04-17 16:25:29 +00:00
|
|
|
|
void WinEDA_PinPropertiesFrame::PinPropertiesAccept( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/*************************************************************************/
|
2008-04-17 16:25:29 +00:00
|
|
|
|
|
2008-02-12 21:12:46 +00:00
|
|
|
|
/* Met a jour les differents parametres pour le composant en cours d'<27>dition
|
2008-04-17 16:25:29 +00:00
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
2008-04-17 16:25:29 +00:00
|
|
|
|
wxString msg;
|
|
|
|
|
|
|
|
|
|
LastPinType = m_PinElectricalType->GetSelection();
|
|
|
|
|
LastPinShape = CodeShape[m_PinShape->GetSelection()];
|
|
|
|
|
LastPinOrient = CodeOrient[m_PinOrient->GetSelection()];
|
|
|
|
|
LastPinCommonConvert = m_CommonConvert->GetValue();
|
|
|
|
|
LastPinCommonUnit = m_CommonUnit->GetValue();
|
|
|
|
|
LastPinNoDraw = m_NoDraw->GetValue();
|
2008-08-11 18:21:21 +00:00
|
|
|
|
|
|
|
|
|
msg = m_PinSizeCtrl->GetValue();
|
2009-10-20 09:17:24 +00:00
|
|
|
|
LastPinSize = ReturnValueFromString( g_UnitMetric, msg,
|
|
|
|
|
m_Parent->m_InternalUnits );
|
2008-08-11 18:21:21 +00:00
|
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
|
msg = m_PinNameSizeCtrl->GetValue();
|
2009-09-02 18:12:45 +00:00
|
|
|
|
LastPinNameSize = ReturnValueFromString( g_UnitMetric, msg,
|
|
|
|
|
m_Parent->m_InternalUnits );
|
2008-08-11 18:21:21 +00:00
|
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
|
msg = m_PinNumSizeCtrl->GetValue();
|
2009-09-02 18:12:45 +00:00
|
|
|
|
LastPinNumSize = ReturnValueFromString( g_UnitMetric, msg,
|
|
|
|
|
m_Parent->m_InternalUnits );
|
2008-04-17 16:25:29 +00:00
|
|
|
|
|
2009-09-25 18:49:04 +00:00
|
|
|
|
LIB_DRAW_ITEM* item = m_Parent->GetDrawItem();
|
|
|
|
|
|
|
|
|
|
if( item == NULL )
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if( !( item->m_Flags & IS_NEW ) ) // if IS_NEW, copy for undo is done before place
|
|
|
|
|
m_Parent->SaveCopyInUndoList( item->GetParent() );
|
|
|
|
|
|
|
|
|
|
SetPinName( m_PinNameCtrl->GetValue(), LastPinNameSize );
|
|
|
|
|
msg = m_PinNumCtrl->GetValue();
|
|
|
|
|
|
|
|
|
|
if( msg.IsEmpty() )
|
|
|
|
|
msg = wxT( "~" );
|
|
|
|
|
|
|
|
|
|
SetPinNum( msg, LastPinNumSize );
|
|
|
|
|
NewSizePin( LastPinSize );
|
|
|
|
|
SetPinShape( LastPinShape );
|
|
|
|
|
SetPinType( LastPinType );
|
2009-09-29 18:38:21 +00:00
|
|
|
|
SetPinOrientation( LastPinOrient );
|
|
|
|
|
|
|
|
|
|
// Set all attributes (visibility, common to units and common to
|
|
|
|
|
// convert options)
|
|
|
|
|
SetPinAttributes( true, true, true );
|
2009-09-25 18:49:04 +00:00
|
|
|
|
item->DisplayInfo( m_Parent );
|
2008-04-17 16:25:29 +00:00
|
|
|
|
|
2009-05-09 17:29:48 +00:00
|
|
|
|
m_Parent->DrawPanel->Refresh();
|
2007-05-06 16:03:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2009-09-25 18:49:04 +00:00
|
|
|
|
/*
|
|
|
|
|
* Called when installing the edit pin dialog frame
|
2008-08-11 18:21:21 +00:00
|
|
|
|
* Set pins flags (.m_Flags pins member) to ensure a correctins edition:
|
2009-09-25 18:49:04 +00:00
|
|
|
|
* If 2 or more pins are on the same location (and the same orientation) they
|
|
|
|
|
* are all moved or resized.
|
2008-08-11 18:21:21 +00:00
|
|
|
|
* This is usefull for components which have more than one part per package
|
|
|
|
|
* In this case all parts can be edited at once.
|
2009-09-25 18:49:04 +00:00
|
|
|
|
* Note: if the option "Edit Pin per Pin" (tool of the main toolbar) is
|
|
|
|
|
* activated, only the current part is edited.
|
2008-04-17 16:25:29 +00:00
|
|
|
|
*/
|
2009-09-25 18:49:04 +00:00
|
|
|
|
void WinEDA_LibeditFrame::InitEditOnePin()
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
2009-10-08 13:19:28 +00:00
|
|
|
|
LIB_PIN* Pin;
|
|
|
|
|
LIB_PIN* CurrentPin = (LIB_PIN*) m_drawItem;
|
2008-04-17 16:25:29 +00:00
|
|
|
|
|
2009-09-29 18:38:21 +00:00
|
|
|
|
if( m_component == NULL || CurrentPin == NULL
|
|
|
|
|
|| m_drawItem->Type() != COMPONENT_PIN_DRAW_TYPE )
|
2008-04-17 16:25:29 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2009-09-29 18:38:21 +00:00
|
|
|
|
for( Pin = m_component->GetNextPin(); Pin != NULL;
|
2009-10-20 09:17:24 +00:00
|
|
|
|
Pin = m_component->GetNextPin( Pin ) )
|
2008-04-17 16:25:29 +00:00
|
|
|
|
{
|
|
|
|
|
if( Pin == CurrentPin )
|
|
|
|
|
continue;
|
2009-09-02 18:12:45 +00:00
|
|
|
|
if( ( Pin->m_Pos == CurrentPin->m_Pos )
|
2009-10-20 09:17:24 +00:00
|
|
|
|
&& ( Pin->m_Orient == CurrentPin->m_Orient )
|
|
|
|
|
&& ( !( CurrentPin->m_Flags & IS_NEW ) )
|
|
|
|
|
&& ( g_EditPinByPinIsOn == false ) )
|
2008-04-17 16:25:29 +00:00
|
|
|
|
Pin->m_Flags |= IS_LINKED | IN_EDIT;
|
|
|
|
|
else
|
|
|
|
|
Pin->m_Flags = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
|
CurrentPin->DisplayInfo( this );
|
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
|
|
|
|
*/
|
2009-09-29 18:38:21 +00:00
|
|
|
|
static void AbortPinMove( WinEDA_DrawPanel* Panel, wxDC* DC )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
2009-09-25 18:49:04 +00:00
|
|
|
|
WinEDA_LibeditFrame* parent = (WinEDA_LibeditFrame*) Panel->GetParent();
|
|
|
|
|
|
|
|
|
|
if( parent == NULL )
|
|
|
|
|
return;
|
|
|
|
|
|
2009-10-08 13:19:28 +00:00
|
|
|
|
LIB_PIN* CurrentPin = (LIB_PIN*) parent->GetDrawItem();
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2009-09-29 18:38:21 +00:00
|
|
|
|
if( CurrentPin == NULL || CurrentPin->Type() != COMPONENT_PIN_DRAW_TYPE )
|
|
|
|
|
return;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2009-09-29 18:38:21 +00:00
|
|
|
|
if( CurrentPin->m_Flags & IS_NEW )
|
|
|
|
|
delete CurrentPin;
|
|
|
|
|
else
|
|
|
|
|
CurrentPin->m_Flags = 0;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2009-09-29 18:38:21 +00:00
|
|
|
|
/* clear edit flags */
|
2008-04-17 16:25:29 +00:00
|
|
|
|
Panel->ManageCurseur = NULL;
|
|
|
|
|
Panel->ForceCloseManageCurseur = NULL;
|
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.
|
|
|
|
|
*/
|
2008-04-17 16:25:29 +00:00
|
|
|
|
void WinEDA_LibeditFrame::PlacePin( wxDC* DC )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
2009-10-08 13:19:28 +00:00
|
|
|
|
LIB_PIN* Pin;
|
|
|
|
|
LIB_PIN* CurrentPin = (LIB_PIN*) m_drawItem;
|
|
|
|
|
bool ask_for_pin = true;
|
|
|
|
|
wxPoint newpos;
|
|
|
|
|
bool status;
|
2008-04-17 16:25:29 +00:00
|
|
|
|
|
|
|
|
|
if( CurrentPin == NULL )
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
newpos.x = GetScreen()->m_Curseur.x;
|
|
|
|
|
newpos.y = -GetScreen()->m_Curseur.y;
|
|
|
|
|
|
|
|
|
|
// Tst for an other pin in same new position:
|
2009-09-29 18:38:21 +00:00
|
|
|
|
for( Pin = m_component->GetNextPin(); Pin != NULL;
|
2009-10-20 09:17:24 +00:00
|
|
|
|
Pin = m_component->GetNextPin( Pin ) )
|
2008-04-17 16:25:29 +00:00
|
|
|
|
{
|
2009-09-29 18:38:21 +00:00
|
|
|
|
if( Pin == CurrentPin || newpos != Pin->m_Pos || Pin->m_Flags )
|
2008-04-17 16:25:29 +00:00
|
|
|
|
continue;
|
2009-09-29 18:38:21 +00:00
|
|
|
|
|
2009-05-21 12:45:21 +00:00
|
|
|
|
if( ask_for_pin && !g_EditPinByPinIsOn )
|
2008-04-17 16:25:29 +00:00
|
|
|
|
{
|
2009-05-09 17:29:48 +00:00
|
|
|
|
DrawPanel->m_IgnoreMouseEvents = true;
|
2009-10-20 09:17:24 +00:00
|
|
|
|
status =
|
|
|
|
|
IsOK( this, _( "This position is already occupied by \
|
2009-09-29 18:38:21 +00:00
|
|
|
|
another pin. Continue?" ) );
|
2008-04-17 16:25:29 +00:00
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
2009-05-09 17:29:48 +00:00
|
|
|
|
DrawPanel->m_IgnoreMouseEvents = false;
|
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
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DrawPanel->ManageCurseur = NULL;
|
|
|
|
|
DrawPanel->ForceCloseManageCurseur = NULL;
|
|
|
|
|
GetScreen()->SetModify();
|
|
|
|
|
CurrentPin->m_Pos = newpos;
|
2009-09-29 18:38:21 +00:00
|
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
|
if( CurrentPin->m_Flags & IS_NEW )
|
|
|
|
|
{
|
|
|
|
|
LastPinOrient = CurrentPin->m_Orient;
|
|
|
|
|
LastPinType = CurrentPin->m_PinType;
|
|
|
|
|
LastPinShape = CurrentPin->m_PinShape;
|
2009-09-29 18:38:21 +00:00
|
|
|
|
CreateImagePins( CurrentPin, m_unit, m_convert, m_showDeMorgan );
|
2009-09-25 18:49:04 +00:00
|
|
|
|
m_lastDrawItem = CurrentPin;
|
2009-09-29 18:38:21 +00:00
|
|
|
|
m_component->AddDrawItem( m_drawItem );
|
2008-04-17 16:25:29 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Put linked pins in new position, and clear flags */
|
2009-09-29 18:38:21 +00:00
|
|
|
|
for( Pin = m_component->GetNextPin(); Pin != NULL;
|
2009-10-20 09:17:24 +00:00
|
|
|
|
Pin = m_component->GetNextPin( Pin ) )
|
2008-04-17 16:25:29 +00:00
|
|
|
|
{
|
|
|
|
|
if( Pin->m_Flags == 0 )
|
|
|
|
|
continue;
|
|
|
|
|
Pin->m_Pos = CurrentPin->m_Pos;
|
|
|
|
|
Pin->m_Flags = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DrawPanel->CursorOff( DC );
|
2009-09-04 18:57:37 +00:00
|
|
|
|
bool showPinText = true;
|
|
|
|
|
CurrentPin->Draw( DrawPanel, DC, wxPoint( 0, 0 ), -1, GR_DEFAULT_DRAWMODE,
|
|
|
|
|
&showPinText, DefaultTransformMatrix );
|
2008-04-17 16:25:29 +00:00
|
|
|
|
DrawPanel->CursorOn( DC );
|
|
|
|
|
|
2009-09-25 18:49:04 +00:00
|
|
|
|
m_drawItem = NULL;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
};
|
|
|
|
|
|
2009-09-29 18:38:21 +00:00
|
|
|
|
|
|
|
|
|
void WinEDA_PinPropertiesFrame::SetPinOrientation( int neworient )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
2009-10-08 13:19:28 +00:00
|
|
|
|
LIB_PIN* CurrentPin = (LIB_PIN*) m_Parent->GetDrawItem();
|
|
|
|
|
LIB_PIN* Pin, * RefPin = CurrentPin;
|
2008-04-17 16:25:29 +00:00
|
|
|
|
|
2009-09-29 18:38:21 +00:00
|
|
|
|
if( CurrentPin == NULL || CurrentPin->GetParent() == NULL || RefPin == NULL )
|
2008-04-17 16:25:29 +00:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
m_Parent->GetScreen()->SetModify();
|
|
|
|
|
|
|
|
|
|
/* Rotation */
|
|
|
|
|
RefPin->m_Orient = neworient;
|
|
|
|
|
|
2009-09-29 18:38:21 +00:00
|
|
|
|
Pin = CurrentPin->GetParent()->GetNextPin();
|
|
|
|
|
|
|
|
|
|
for( ; Pin != NULL; Pin = CurrentPin->GetParent()->GetNextPin( Pin ) )
|
2008-04-17 16:25:29 +00:00
|
|
|
|
{
|
|
|
|
|
if( Pin->m_Flags == 0 )
|
|
|
|
|
continue;
|
|
|
|
|
Pin->m_Orient = RefPin->m_Orient;
|
|
|
|
|
if( CurrentPin == NULL )
|
|
|
|
|
Pin->m_Flags = 0;
|
|
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2009-09-29 18:38:21 +00:00
|
|
|
|
/**
|
|
|
|
|
* Prepare le deplacement d'une pin :
|
|
|
|
|
* Localise la pin pointee par le curseur, et si elle existe active
|
|
|
|
|
* la fonction de gestion curseur ( DrawMovePin() ).
|
2008-04-17 16:25:29 +00:00
|
|
|
|
*/
|
2009-09-29 18:38:21 +00:00
|
|
|
|
void WinEDA_LibeditFrame::StartMovePin( wxDC* DC )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
2009-10-08 13:19:28 +00:00
|
|
|
|
LIB_PIN* Pin;
|
|
|
|
|
LIB_PIN* CurrentPin = (LIB_PIN*) m_drawItem;
|
|
|
|
|
wxPoint startPos;
|
2008-04-17 16:25:29 +00:00
|
|
|
|
|
|
|
|
|
/* Marquage des pins a traiter */
|
2009-09-29 18:38:21 +00:00
|
|
|
|
Pin = m_component->GetNextPin();
|
|
|
|
|
for( ; Pin != NULL; Pin = m_component->GetNextPin( Pin ) )
|
2008-04-17 16:25:29 +00:00
|
|
|
|
{
|
|
|
|
|
Pin->m_Flags = 0;
|
|
|
|
|
if( Pin == CurrentPin )
|
|
|
|
|
continue;
|
2009-09-02 18:12:45 +00:00
|
|
|
|
if( ( Pin->m_Pos == CurrentPin->m_Pos )
|
2009-10-20 09:17:24 +00:00
|
|
|
|
&& ( Pin->m_Orient == CurrentPin->m_Orient )
|
|
|
|
|
&& ( g_EditPinByPinIsOn == false ) )
|
2008-04-17 16:25:29 +00:00
|
|
|
|
Pin->m_Flags |= IS_LINKED | IS_MOVED;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CurrentPin->m_Flags |= IS_LINKED | IS_MOVED;
|
|
|
|
|
PinPreviousPos = OldPos = CurrentPin->m_Pos;
|
|
|
|
|
|
|
|
|
|
startPos.x = OldPos.x;
|
|
|
|
|
startPos.y = -OldPos.y;
|
|
|
|
|
DrawPanel->CursorOff( DC );
|
|
|
|
|
GetScreen()->m_Curseur = startPos;
|
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
|
CurrentPin->DisplayInfo( this );
|
2008-04-17 16:25:29 +00:00
|
|
|
|
DrawPanel->ManageCurseur = DrawMovePin;
|
|
|
|
|
DrawPanel->ForceCloseManageCurseur = AbortPinMove;
|
|
|
|
|
|
|
|
|
|
DrawPanel->CursorOn( DC );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
|
/* Routine de deplacement de la Pin courante selon position du curseur souris */
|
2009-09-02 18:12:45 +00:00
|
|
|
|
/* Routine normalement appelee par la routine de gestion du curseur */
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/******************************************************************************/
|
2008-04-17 16:25:29 +00:00
|
|
|
|
static void DrawMovePin( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
2009-09-25 18:49:04 +00:00
|
|
|
|
WinEDA_LibeditFrame* parent = (WinEDA_LibeditFrame*) panel->GetParent();
|
|
|
|
|
|
|
|
|
|
if( parent == NULL )
|
|
|
|
|
return;
|
|
|
|
|
|
2009-10-08 13:19:28 +00:00
|
|
|
|
LIB_PIN* CurrentPin = (LIB_PIN*) parent->GetDrawItem();
|
2009-09-29 18:38:21 +00:00
|
|
|
|
|
|
|
|
|
if( CurrentPin == NULL || CurrentPin->Type() != COMPONENT_PIN_DRAW_TYPE )
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
wxPoint pinpos = CurrentPin->m_Pos;
|
|
|
|
|
bool showPinText = true;
|
2008-04-17 16:25:29 +00:00
|
|
|
|
|
|
|
|
|
/* Erase pin in old position */
|
2009-09-02 18:12:45 +00:00
|
|
|
|
if( erase || ( CurrentPin->m_Flags & IS_NEW ) )
|
2008-04-17 16:25:29 +00:00
|
|
|
|
{
|
2009-09-29 18:38:21 +00:00
|
|
|
|
wxLogDebug( _( "Initial pin position (%d, %d)" ),
|
|
|
|
|
PinPreviousPos.x, PinPreviousPos.y );
|
2008-04-17 16:25:29 +00:00
|
|
|
|
CurrentPin->m_Pos = PinPreviousPos;
|
2009-09-04 18:57:37 +00:00
|
|
|
|
CurrentPin->Draw( panel, DC, wxPoint( 0, 0 ), -1, g_XorMode,
|
|
|
|
|
&showPinText, DefaultTransformMatrix );
|
2008-04-17 16:25:29 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Redraw pin in new position */
|
|
|
|
|
CurrentPin->m_Pos.x = panel->GetScreen()->m_Curseur.x;
|
|
|
|
|
CurrentPin->m_Pos.y = -panel->GetScreen()->m_Curseur.y;
|
2009-09-29 18:38:21 +00:00
|
|
|
|
CurrentPin->Draw( panel, DC, wxPoint( 0, 0 ), -1, wxCOPY,
|
2009-09-04 18:57:37 +00:00
|
|
|
|
&showPinText, DefaultTransformMatrix );
|
2008-04-17 16:25:29 +00:00
|
|
|
|
|
|
|
|
|
PinPreviousPos = CurrentPin->m_Pos;
|
|
|
|
|
|
|
|
|
|
/* 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 */
|
|
|
|
|
if( ( CurrentPin->m_Flags & IS_NEW ) == 0 )
|
2008-04-17 16:25:29 +00:00
|
|
|
|
CurrentPin->m_Pos = pinpos;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************/
|
2008-04-17 16:25:29 +00:00
|
|
|
|
void WinEDA_PinPropertiesFrame::SetPinShape( int newshape )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/**********************************************************/
|
2008-04-17 16:25:29 +00:00
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/* Changement de la forme de la pin courante.
|
2009-10-20 09:17:24 +00:00
|
|
|
|
* Le changement est egalement fait sur les autres pins correspondantes
|
|
|
|
|
* des autres unites de la seule forme convert courante
|
2008-04-17 16:25:29 +00:00
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
2009-10-08 13:19:28 +00:00
|
|
|
|
LIB_PIN* Pin;
|
|
|
|
|
LIB_PIN* CurrentPin = (LIB_PIN*) m_Parent->GetDrawItem();
|
2008-04-17 16:25:29 +00:00
|
|
|
|
|
|
|
|
|
if( CurrentPin )
|
|
|
|
|
{
|
|
|
|
|
CurrentPin->m_PinShape = newshape;
|
|
|
|
|
m_Parent->GetScreen()->SetModify();
|
2009-04-05 20:49:15 +00:00
|
|
|
|
CurrentPin->DisplayInfo( m_Parent );
|
2008-04-17 16:25:29 +00:00
|
|
|
|
|
2009-09-29 18:38:21 +00:00
|
|
|
|
Pin = CurrentPin->GetParent()->GetNextPin();
|
|
|
|
|
for( ; Pin != NULL; Pin = CurrentPin->GetParent()->GetNextPin( Pin ) )
|
2008-04-17 16:25:29 +00:00
|
|
|
|
{
|
2009-09-29 18:38:21 +00:00
|
|
|
|
if( Pin->m_Flags == 0 || Pin->m_Convert != CurrentPin->m_Convert )
|
2008-04-17 16:25:29 +00:00
|
|
|
|
continue;
|
|
|
|
|
Pin->m_PinShape = newshape;
|
|
|
|
|
}
|
|
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************/
|
2008-04-17 16:25:29 +00:00
|
|
|
|
void WinEDA_PinPropertiesFrame::SetPinType( int newtype )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/******************************************************/
|
2008-04-17 16:25:29 +00:00
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/* Changement du type electrique de la pin courante.
|
2009-10-20 09:17:24 +00:00
|
|
|
|
* Le changement est egalement fait sur les autres pins correspondantes
|
|
|
|
|
* des autres unites du boitier
|
2008-04-17 16:25:29 +00:00
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
2009-10-08 13:19:28 +00:00
|
|
|
|
LIB_PIN* Pin;
|
|
|
|
|
LIB_PIN* CurrentPin = (LIB_PIN*) m_Parent->GetDrawItem();
|
2008-04-17 16:25:29 +00:00
|
|
|
|
|
2009-09-22 12:27:57 +00:00
|
|
|
|
if( CurrentPin == NULL || CurrentPin->GetParent() == NULL )
|
2008-04-17 16:25:29 +00:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
CurrentPin->m_PinType = newtype;
|
|
|
|
|
m_Parent->GetScreen()->SetModify();
|
|
|
|
|
|
2009-09-29 18:38:21 +00:00
|
|
|
|
Pin = CurrentPin->GetParent()->GetNextPin();
|
|
|
|
|
for( ; Pin != NULL; Pin = CurrentPin->GetParent()->GetNextPin( Pin ) )
|
2008-04-17 16:25:29 +00:00
|
|
|
|
{
|
|
|
|
|
if( Pin->m_Flags == 0 )
|
|
|
|
|
continue;
|
|
|
|
|
Pin->m_PinType = newtype;
|
|
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/********************************************************************************/
|
2008-04-17 16:25:29 +00:00
|
|
|
|
void WinEDA_PinPropertiesFrame::SetPinName( const wxString& newname, int newsize )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/********************************************************************************/
|
2008-04-17 16:25:29 +00:00
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/* Met a jour le nom et la taille de ce nom de la pin courante
|
2009-10-20 09:17:24 +00:00
|
|
|
|
* si newname == NULL, pas de changement de nom
|
|
|
|
|
* si newsize < 0 : pas de changement de taille
|
2008-04-17 16:25:29 +00:00
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
2009-10-08 13:19:28 +00:00
|
|
|
|
LIB_PIN* Pin;
|
|
|
|
|
LIB_PIN* CurrentPin = (LIB_PIN*) m_Parent->GetDrawItem();
|
|
|
|
|
wxString buf;
|
2008-04-17 16:25:29 +00:00
|
|
|
|
|
2009-09-22 12:27:57 +00:00
|
|
|
|
if( CurrentPin == NULL || CurrentPin->GetParent() == NULL )
|
|
|
|
|
return;
|
|
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
|
buf = newname;
|
|
|
|
|
buf.Replace( wxT( " " ), wxT( "_" ) );
|
|
|
|
|
|
|
|
|
|
if( newsize >= 0 )
|
|
|
|
|
CurrentPin->m_PinNameSize = newsize;
|
|
|
|
|
|
|
|
|
|
CurrentPin->m_PinName = buf;
|
|
|
|
|
|
|
|
|
|
m_Parent->GetScreen()->SetModify();
|
|
|
|
|
|
|
|
|
|
/* Traitement des autres pins */
|
2009-09-29 18:38:21 +00:00
|
|
|
|
Pin = CurrentPin->GetParent()->GetNextPin();
|
|
|
|
|
for( ; Pin != NULL; Pin = CurrentPin->GetParent()->GetNextPin( Pin ) )
|
2008-04-17 16:25:29 +00:00
|
|
|
|
{
|
|
|
|
|
if( (Pin->m_Flags & IS_LINKED) == 0 )
|
|
|
|
|
continue;
|
|
|
|
|
if( newsize >= 0 )
|
|
|
|
|
Pin->m_PinNameSize = newsize;
|
|
|
|
|
Pin->m_PinName = buf;
|
|
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/******************************************************************************/
|
2008-04-17 16:25:29 +00:00
|
|
|
|
void WinEDA_PinPropertiesFrame::SetPinNum( const wxString& newnum, int newsize )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/******************************************************************************/
|
2008-04-17 16:25:29 +00:00
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/* Changement du numero de la pin courante.
|
2009-10-20 09:17:24 +00:00
|
|
|
|
* Le changement est egalement fait sur les autres pins correspondantes
|
|
|
|
|
* a la forme convertie
|
|
|
|
|
* Si newnum == NULL: pas de changement de numero
|
|
|
|
|
* Si newsize < 0 ) pase de changement de taille
|
2008-04-17 16:25:29 +00:00
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
2009-10-08 13:19:28 +00:00
|
|
|
|
LIB_PIN* Pin;
|
|
|
|
|
LIB_PIN* CurrentPin = (LIB_PIN*) m_Parent->GetDrawItem();
|
|
|
|
|
wxString buf;
|
2008-04-17 16:25:29 +00:00
|
|
|
|
|
|
|
|
|
buf = newnum;
|
|
|
|
|
buf.Replace( wxT( " " ), wxT( "_" ) );
|
|
|
|
|
|
2009-09-22 12:27:57 +00:00
|
|
|
|
if( CurrentPin == NULL || CurrentPin->GetParent() == NULL )
|
2008-04-17 16:25:29 +00:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
CurrentPin->m_PinNum = 0;
|
|
|
|
|
|
|
|
|
|
if( newsize >= 0 )
|
|
|
|
|
CurrentPin->m_PinNumSize = newsize;
|
|
|
|
|
CurrentPin->SetPinNumFromString( buf );
|
|
|
|
|
m_Parent->GetScreen()->SetModify();
|
|
|
|
|
|
2009-09-29 18:38:21 +00:00
|
|
|
|
Pin = CurrentPin->GetParent()->GetNextPin();
|
|
|
|
|
for( ; Pin != NULL; Pin = CurrentPin->GetParent()->GetNextPin( Pin ) )
|
2008-04-17 16:25:29 +00:00
|
|
|
|
{
|
2009-09-29 18:38:21 +00:00
|
|
|
|
if( ( Pin->m_Flags & IS_LINKED ) == 0
|
2009-10-20 09:17:24 +00:00
|
|
|
|
|| Pin->m_Unit != CurrentPin->m_Unit )
|
2008-04-17 16:25:29 +00:00
|
|
|
|
continue;
|
|
|
|
|
if( newsize >= 0 )
|
|
|
|
|
Pin->m_PinNumSize = newsize;
|
2009-04-13 05:58:11 +00:00
|
|
|
|
Pin->m_PinNum = CurrentPin->m_PinNum;
|
2008-04-17 16:25:29 +00:00
|
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************/
|
2009-09-18 14:56:05 +00:00
|
|
|
|
void WinEDA_LibeditFrame::DeletePin( wxDC* DC,
|
|
|
|
|
LIB_COMPONENT* LibEntry,
|
2009-10-08 13:19:28 +00:00
|
|
|
|
LIB_PIN* Pin )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/*************************************************/
|
2008-04-17 16:25:29 +00:00
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/* Routine d'effacement de la pin pointee par la souris
|
2009-10-20 09:17:24 +00:00
|
|
|
|
* Si g_EditPinByPinIsOn == false :
|
|
|
|
|
* toutes les pins de meme coordonnee seront effacees.
|
|
|
|
|
* Sinon seule la pin de l'unite en convert courante sera effacee
|
2008-04-17 16:25:29 +00:00
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
2009-10-08 13:19:28 +00:00
|
|
|
|
LIB_PIN* tmp;
|
|
|
|
|
wxPoint PinPos;
|
2008-04-17 16:25:29 +00:00
|
|
|
|
|
2009-09-04 18:57:37 +00:00
|
|
|
|
if( LibEntry == NULL || Pin == NULL )
|
2008-04-17 16:25:29 +00:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
PinPos = Pin->m_Pos;
|
2009-09-25 18:49:04 +00:00
|
|
|
|
LibEntry->RemoveDrawItem( (LIB_DRAW_ITEM*) Pin, DrawPanel, DC );
|
2008-04-17 16:25:29 +00:00
|
|
|
|
|
|
|
|
|
/* Effacement des autres pins de meme coordonnees */
|
2009-05-09 17:29:48 +00:00
|
|
|
|
if( g_EditPinByPinIsOn == false )
|
2008-04-17 16:25:29 +00:00
|
|
|
|
{
|
2009-09-29 18:38:21 +00:00
|
|
|
|
tmp = LibEntry->GetNextPin();
|
|
|
|
|
|
|
|
|
|
while( tmp != NULL )
|
2008-04-17 16:25:29 +00:00
|
|
|
|
{
|
2009-09-29 18:38:21 +00:00
|
|
|
|
Pin = tmp;
|
|
|
|
|
tmp = LibEntry->GetNextPin( Pin );
|
|
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
|
if( Pin->m_Pos != PinPos )
|
|
|
|
|
continue;
|
2009-09-29 18:38:21 +00:00
|
|
|
|
|
2009-09-25 18:49:04 +00:00
|
|
|
|
LibEntry->RemoveDrawItem( (LIB_DRAW_ITEM*) Pin );
|
2008-04-17 16:25:29 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2009-09-29 18:38:21 +00:00
|
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
|
GetScreen()->SetModify();
|
2007-05-06 16:03:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2009-09-29 18:38:21 +00:00
|
|
|
|
/*
|
|
|
|
|
* Create a new pin.
|
|
|
|
|
*/
|
2008-04-17 16:25:29 +00:00
|
|
|
|
void WinEDA_LibeditFrame::CreatePin( wxDC* DC )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
2009-10-08 13:19:28 +00:00
|
|
|
|
LIB_PIN* CurrentPin;
|
|
|
|
|
bool showPinText = true;
|
2008-04-17 16:25:29 +00:00
|
|
|
|
|
2009-09-25 18:49:04 +00:00
|
|
|
|
if( m_component == NULL )
|
2008-04-17 16:25:29 +00:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
/* Effacement des flags */
|
2009-09-29 18:38:21 +00:00
|
|
|
|
m_component->ClearStatus();
|
2008-04-17 16:25:29 +00:00
|
|
|
|
|
2009-10-08 13:19:28 +00:00
|
|
|
|
CurrentPin = new LIB_PIN( m_component );
|
2008-04-17 16:25:29 +00:00
|
|
|
|
|
2009-09-25 18:49:04 +00:00
|
|
|
|
m_drawItem = CurrentPin;
|
2009-09-29 18:38:21 +00:00
|
|
|
|
|
|
|
|
|
if( CurrentPin == NULL || CurrentPin->Type() != COMPONENT_PIN_DRAW_TYPE )
|
2008-04-17 16:25:29 +00:00
|
|
|
|
return;
|
|
|
|
|
CurrentPin->m_Flags = IS_NEW;
|
2009-09-25 18:49:04 +00:00
|
|
|
|
CurrentPin->m_Unit = m_unit;
|
|
|
|
|
CurrentPin->m_Convert = m_convert;
|
2008-04-17 16:25:29 +00:00
|
|
|
|
|
2009-10-20 09:17:24 +00:00
|
|
|
|
/* Flag pins to consider */
|
2009-05-09 17:29:48 +00:00
|
|
|
|
if( g_EditPinByPinIsOn == false )
|
2008-04-17 16:25:29 +00:00
|
|
|
|
CurrentPin->m_Flags |= IS_LINKED;
|
|
|
|
|
|
2009-10-20 09:17:24 +00:00
|
|
|
|
CurrentPin->m_Pos.x = GetScreen()->m_Curseur.x;
|
|
|
|
|
CurrentPin->m_Pos.y = -GetScreen()->m_Curseur.y;
|
|
|
|
|
CurrentPin->m_PinLen = LastPinSize;
|
|
|
|
|
CurrentPin->m_Orient = LastPinOrient;
|
2008-04-17 16:25:29 +00:00
|
|
|
|
CurrentPin->m_PinType = LastPinType;
|
|
|
|
|
CurrentPin->m_PinShape = LastPinShape;
|
|
|
|
|
CurrentPin->m_PinNameSize = LastPinNameSize;
|
|
|
|
|
CurrentPin->m_PinNumSize = LastPinNumSize;
|
|
|
|
|
if( LastPinCommonConvert )
|
|
|
|
|
CurrentPin->m_Convert = 0;
|
|
|
|
|
else
|
2009-09-25 18:49:04 +00:00
|
|
|
|
CurrentPin->m_Convert = m_convert;
|
2008-04-17 16:25:29 +00:00
|
|
|
|
if( LastPinCommonUnit )
|
|
|
|
|
CurrentPin->m_Unit = 0;
|
|
|
|
|
else
|
2009-09-25 18:49:04 +00:00
|
|
|
|
CurrentPin->m_Unit = m_unit;
|
2008-04-17 16:25:29 +00:00
|
|
|
|
if( LastPinNoDraw )
|
|
|
|
|
CurrentPin->m_Attributs |= PINNOTDRAW;
|
|
|
|
|
else
|
|
|
|
|
CurrentPin->m_Attributs &= ~PINNOTDRAW;
|
|
|
|
|
|
|
|
|
|
if( DC )
|
2009-09-29 18:38:21 +00:00
|
|
|
|
CurrentPin->Draw( DrawPanel, DC, wxPoint( 0, 0 ), -1, wxCOPY,
|
2009-09-04 18:57:37 +00:00
|
|
|
|
&showPinText, DefaultTransformMatrix );
|
2008-04-17 16:25:29 +00:00
|
|
|
|
|
2009-09-29 18:38:21 +00:00
|
|
|
|
PinPreviousPos = CurrentPin->m_Pos;
|
|
|
|
|
wxLogDebug( _( "Initial pin position (%d, %d)" ),
|
|
|
|
|
PinPreviousPos.x, PinPreviousPos.y );
|
2009-05-09 17:29:48 +00:00
|
|
|
|
DrawPanel->m_IgnoreMouseEvents = true;
|
2008-04-17 16:25:29 +00:00
|
|
|
|
InstallPineditFrame( this, DC, wxPoint( -1, -1 ) );
|
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
2009-05-09 17:29:48 +00:00
|
|
|
|
DrawPanel->m_IgnoreMouseEvents = false;
|
2008-04-17 16:25:29 +00:00
|
|
|
|
DrawPanel->ManageCurseur = DrawMovePin;
|
|
|
|
|
DrawPanel->ForceCloseManageCurseur = AbortPinMove;
|
|
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
|
CurrentPin->DisplayInfo( this );
|
2008-04-17 16:25:29 +00:00
|
|
|
|
GetScreen()->SetModify();
|
2007-05-06 16:03:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2009-05-09 17:29:48 +00:00
|
|
|
|
/* si draw == true
|
2009-09-29 18:38:21 +00:00
|
|
|
|
* - Ajuste le flag visible / invisible (.U.Pin.Flags bit 0 ) de la pin
|
|
|
|
|
* editee
|
2008-04-17 16:25:29 +00:00
|
|
|
|
*
|
2009-09-29 18:38:21 +00:00
|
|
|
|
* si unit == true
|
|
|
|
|
* - Modifie l'attribut Commun / Particulier U.Pin.Unit = 0 ou Num Unite
|
|
|
|
|
* de la pin editee
|
2008-04-17 16:25:29 +00:00
|
|
|
|
*
|
2009-09-29 18:38:21 +00:00
|
|
|
|
* si convert == true
|
|
|
|
|
* - Modifie l'attribut Commun / Particulier U.Pin.Convert = 0 ou Num Unite
|
|
|
|
|
* de la pin editee
|
2008-04-17 16:25:29 +00:00
|
|
|
|
*
|
|
|
|
|
*/
|
2009-09-29 18:38:21 +00:00
|
|
|
|
void WinEDA_PinPropertiesFrame::SetPinAttributes( bool draw, bool unit,
|
|
|
|
|
bool convert )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
2009-10-08 13:19:28 +00:00
|
|
|
|
LIB_PIN* tmp;
|
|
|
|
|
LIB_PIN* Pin;
|
|
|
|
|
LIB_PIN* CurrentPin = (LIB_PIN*) m_Parent->GetDrawItem();
|
2008-04-17 16:25:29 +00:00
|
|
|
|
|
|
|
|
|
if( CurrentPin == NULL )
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
m_Parent->GetScreen()->SetModify();
|
|
|
|
|
|
2009-09-22 12:27:57 +00:00
|
|
|
|
if( unit )
|
2008-04-17 16:25:29 +00:00
|
|
|
|
{
|
|
|
|
|
if( LastPinCommonUnit )
|
|
|
|
|
CurrentPin->m_Unit = 0;
|
|
|
|
|
else
|
2009-09-25 18:49:04 +00:00
|
|
|
|
CurrentPin->m_Unit = m_Parent->GetUnit();
|
2008-04-17 16:25:29 +00:00
|
|
|
|
|
|
|
|
|
if( CurrentPin->m_Unit == 0 )
|
|
|
|
|
{
|
2009-09-29 18:38:21 +00:00
|
|
|
|
tmp = CurrentPin->GetParent()->GetNextPin();
|
|
|
|
|
|
|
|
|
|
while( tmp != NULL )
|
2008-04-17 16:25:29 +00:00
|
|
|
|
{
|
2009-09-29 18:38:21 +00:00
|
|
|
|
Pin = tmp;
|
|
|
|
|
tmp = CurrentPin->GetParent()->GetNextPin( Pin );
|
|
|
|
|
|
|
|
|
|
if( Pin->m_Flags == 0 || Pin == CurrentPin )
|
2008-04-17 16:25:29 +00:00
|
|
|
|
continue;
|
2009-09-02 18:12:45 +00:00
|
|
|
|
if( CurrentPin->m_Convert
|
2009-10-20 09:17:24 +00:00
|
|
|
|
&& ( CurrentPin->m_Convert != Pin->m_Convert ) )
|
2008-04-17 16:25:29 +00:00
|
|
|
|
continue;
|
|
|
|
|
if( CurrentPin->m_Pos != Pin->m_Pos )
|
|
|
|
|
continue;
|
|
|
|
|
if( Pin->m_Orient != CurrentPin->m_Orient )
|
|
|
|
|
continue;
|
2009-09-04 18:57:37 +00:00
|
|
|
|
|
2009-09-25 18:49:04 +00:00
|
|
|
|
CurrentPin->GetParent()->RemoveDrawItem( (LIB_DRAW_ITEM*) Pin );
|
2008-04-17 16:25:29 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} // end if unit
|
|
|
|
|
|
|
|
|
|
if( convert )
|
|
|
|
|
{
|
|
|
|
|
if( LastPinCommonConvert )
|
|
|
|
|
CurrentPin->m_Convert = 0;
|
|
|
|
|
else
|
2009-09-25 18:49:04 +00:00
|
|
|
|
CurrentPin->m_Convert = m_Parent->GetConvert();
|
2008-04-17 16:25:29 +00:00
|
|
|
|
|
|
|
|
|
if( CurrentPin->m_Convert == 0 ) /* Effacement des pins redondantes */
|
|
|
|
|
{
|
2009-09-29 18:38:21 +00:00
|
|
|
|
tmp = CurrentPin->GetParent()->GetNextPin();
|
|
|
|
|
|
|
|
|
|
while( tmp != NULL )
|
2008-04-17 16:25:29 +00:00
|
|
|
|
{
|
2009-09-29 18:38:21 +00:00
|
|
|
|
Pin = tmp;
|
|
|
|
|
tmp = CurrentPin->GetParent()->GetNextPin( Pin );
|
|
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
|
if( Pin->m_Flags == 0 )
|
|
|
|
|
continue;
|
|
|
|
|
if( Pin == CurrentPin )
|
|
|
|
|
continue;
|
2009-09-29 18:38:21 +00:00
|
|
|
|
if( CurrentPin->m_Unit && ( CurrentPin->m_Unit != Pin->m_Unit ) )
|
2008-04-17 16:25:29 +00:00
|
|
|
|
continue;
|
|
|
|
|
if( CurrentPin->m_Pos != Pin->m_Pos )
|
|
|
|
|
continue;
|
|
|
|
|
if( Pin->m_Orient != CurrentPin->m_Orient )
|
|
|
|
|
continue;
|
2009-09-04 18:57:37 +00:00
|
|
|
|
|
2009-09-25 18:49:04 +00:00
|
|
|
|
CurrentPin->GetParent()->RemoveDrawItem( (LIB_DRAW_ITEM*) Pin );
|
2008-04-17 16:25:29 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} // end if convert
|
|
|
|
|
|
|
|
|
|
if( draw )
|
|
|
|
|
{
|
|
|
|
|
if( LastPinNoDraw )
|
|
|
|
|
CurrentPin->m_Attributs |= PINNOTDRAW;
|
|
|
|
|
else
|
|
|
|
|
CurrentPin->m_Attributs &= ~PINNOTDRAW;
|
|
|
|
|
|
2009-09-29 18:38:21 +00:00
|
|
|
|
Pin = CurrentPin->GetParent()->GetNextPin();
|
|
|
|
|
for( ; Pin != NULL; Pin = CurrentPin->GetParent()->GetNextPin( Pin ) )
|
2008-04-17 16:25:29 +00:00
|
|
|
|
{
|
|
|
|
|
if( Pin->m_Flags == 0 )
|
|
|
|
|
continue;
|
2009-05-09 17:29:48 +00:00
|
|
|
|
if( LastPinNoDraw )
|
2008-04-17 16:25:29 +00:00
|
|
|
|
Pin->m_Attributs |= PINNOTDRAW;
|
2009-05-09 17:29:48 +00:00
|
|
|
|
else
|
|
|
|
|
Pin->m_Attributs &= ~PINNOTDRAW;
|
2008-04-17 16:25:29 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************/
|
2008-04-17 16:25:29 +00:00
|
|
|
|
void WinEDA_PinPropertiesFrame::NewSizePin( int newsize )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/******************************************************/
|
|
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
|
/* Fonction permettant la mise aux dimensions courantes:
|
2009-10-20 09:17:24 +00:00
|
|
|
|
* - longueur, dimension des textes
|
|
|
|
|
* de la pin courante
|
2008-04-17 16:25:29 +00:00
|
|
|
|
*
|
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
2009-10-08 13:19:28 +00:00
|
|
|
|
LIB_PIN* RefPin, * Pin = (LIB_PIN*) m_Parent->GetDrawItem();
|
2008-04-17 16:25:29 +00:00
|
|
|
|
|
2009-09-22 12:27:57 +00:00
|
|
|
|
if( Pin == NULL || Pin->GetParent() == NULL )
|
2008-04-17 16:25:29 +00:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
m_Parent->GetScreen()->SetModify();
|
|
|
|
|
|
|
|
|
|
Pin->m_PinLen = newsize;
|
|
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
|
Pin->DisplayInfo( m_Parent );
|
2008-04-17 16:25:29 +00:00
|
|
|
|
|
|
|
|
|
RefPin = Pin;
|
|
|
|
|
|
2009-05-09 17:29:48 +00:00
|
|
|
|
if( g_EditPinByPinIsOn == false )
|
2008-04-17 16:25:29 +00:00
|
|
|
|
{
|
2009-09-29 18:38:21 +00:00
|
|
|
|
Pin = Pin->GetParent()->GetNextPin();
|
|
|
|
|
for( ; Pin != NULL; Pin = Pin->GetParent()->GetNextPin( Pin ) )
|
2008-04-17 16:25:29 +00:00
|
|
|
|
{
|
|
|
|
|
if( Pin->m_Pos != RefPin->m_Pos )
|
|
|
|
|
continue;
|
|
|
|
|
if( Pin->m_Orient != RefPin->m_Orient )
|
|
|
|
|
continue;
|
|
|
|
|
if( Pin->m_Convert == RefPin->m_Convert )
|
|
|
|
|
Pin->m_PinLen = newsize;
|
|
|
|
|
}
|
|
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
|
|
2009-10-08 13:19:28 +00:00
|
|
|
|
static void CreateImagePins( LIB_PIN* Pin, int unit, int convert,
|
2009-09-25 18:49:04 +00:00
|
|
|
|
bool asDeMorgan )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
2009-10-08 13:19:28 +00:00
|
|
|
|
int ii;
|
|
|
|
|
LIB_PIN* NewPin;
|
|
|
|
|
bool CreateConv = false;
|
2008-04-17 16:25:29 +00:00
|
|
|
|
|
2009-09-22 12:27:57 +00:00
|
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
|
if( g_EditPinByPinIsOn )
|
|
|
|
|
return;
|
|
|
|
|
|
2009-09-25 18:49:04 +00:00
|
|
|
|
if( asDeMorgan && ( Pin->m_Convert != 0 ) )
|
2009-05-09 17:29:48 +00:00
|
|
|
|
CreateConv = true;
|
2008-04-17 16:25:29 +00:00
|
|
|
|
|
|
|
|
|
/* Creation de la pin " convert " pour la part courante */
|
2009-05-09 17:29:48 +00:00
|
|
|
|
if( CreateConv == true )
|
2008-04-17 16:25:29 +00:00
|
|
|
|
{
|
2009-10-08 13:19:28 +00:00
|
|
|
|
NewPin = (LIB_PIN*) Pin->GenCopy();
|
2008-04-17 16:25:29 +00:00
|
|
|
|
if( Pin->m_Convert > 1 )
|
|
|
|
|
NewPin->m_Convert = 1;
|
|
|
|
|
else
|
|
|
|
|
NewPin->m_Convert = 2;
|
2009-09-29 18:38:21 +00:00
|
|
|
|
Pin->GetParent()->AddDrawItem( NewPin );
|
2008-04-17 16:25:29 +00:00
|
|
|
|
}
|
|
|
|
|
|
2009-10-05 17:52:41 +00:00
|
|
|
|
for( ii = 1; ii <= Pin->GetParent()->GetPartCount(); ii++ )
|
2008-04-17 16:25:29 +00:00
|
|
|
|
{
|
2009-09-25 18:49:04 +00:00
|
|
|
|
if( ii == unit || Pin->m_Unit == 0 )
|
2008-04-17 16:25:29 +00:00
|
|
|
|
continue; /* Pin commune a toutes les unites */
|
|
|
|
|
|
|
|
|
|
/* Creation pour la representation "normale" */
|
2009-10-08 13:19:28 +00:00
|
|
|
|
NewPin = (LIB_PIN*) Pin->GenCopy();
|
2009-09-25 18:49:04 +00:00
|
|
|
|
if( convert != 0 )
|
2008-04-17 16:25:29 +00:00
|
|
|
|
NewPin->m_Convert = 1;
|
|
|
|
|
NewPin->m_Unit = ii;
|
2009-09-29 18:38:21 +00:00
|
|
|
|
Pin->GetParent()->AddDrawItem( NewPin );
|
2008-04-17 16:25:29 +00:00
|
|
|
|
|
|
|
|
|
/* Creation pour la representation "Convert" */
|
2009-05-09 17:29:48 +00:00
|
|
|
|
if( CreateConv == false )
|
2008-04-17 16:25:29 +00:00
|
|
|
|
continue;
|
|
|
|
|
|
2009-10-20 09:17:24 +00:00
|
|
|
|
NewPin = (LIB_PIN*) Pin->GenCopy();
|
2008-04-17 16:25:29 +00:00
|
|
|
|
NewPin->m_Convert = 2;
|
|
|
|
|
if( Pin->m_Unit != 0 )
|
|
|
|
|
NewPin->m_Unit = ii;
|
2009-09-29 18:38:21 +00:00
|
|
|
|
Pin->GetParent()->AddDrawItem( NewPin );
|
2008-04-17 16:25:29 +00:00
|
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
|
/* Depending on "id":
|
2009-10-08 13:19:28 +00:00
|
|
|
|
* - Change pin text size (name or num) (range 10 .. 1000 mil)
|
|
|
|
|
* - Change pin lenght.
|
2008-04-17 16:25:29 +00:00
|
|
|
|
*
|
2009-10-08 13:19:28 +00:00
|
|
|
|
* If Pin is selected ( .m_flag == IS_SELECTED ) only the other selected
|
|
|
|
|
* pins are modified
|
2008-04-17 16:25:29 +00:00
|
|
|
|
*/
|
2009-10-08 13:19:28 +00:00
|
|
|
|
void WinEDA_LibeditFrame::GlobalSetPins( wxDC* DC, LIB_PIN* MasterPin, int id )
|
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
2009-10-08 13:19:28 +00:00
|
|
|
|
LIB_PIN* Pin;
|
2009-10-20 09:17:24 +00:00
|
|
|
|
bool selected = ( MasterPin->m_Selected & IS_SELECTED ) != 0;
|
2009-10-08 13:19:28 +00:00
|
|
|
|
bool showPinText = true;
|
2008-04-17 16:25:29 +00:00
|
|
|
|
|
2009-09-25 18:49:04 +00:00
|
|
|
|
if( ( m_component == NULL ) || ( MasterPin == NULL ) )
|
2008-04-17 16:25:29 +00:00
|
|
|
|
return;
|
|
|
|
|
if( MasterPin->Type() != COMPONENT_PIN_DRAW_TYPE )
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
GetScreen()->SetModify();
|
|
|
|
|
|
2009-09-29 18:38:21 +00:00
|
|
|
|
Pin = m_component->GetNextPin();
|
|
|
|
|
for( ; Pin != NULL; Pin = m_component->GetNextPin( Pin ) )
|
2008-04-17 16:25:29 +00:00
|
|
|
|
{
|
2009-09-25 18:49:04 +00:00
|
|
|
|
if( ( Pin->m_Convert ) && ( Pin->m_Convert != m_convert ) )
|
2008-04-17 16:25:29 +00:00
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
// Is it the "selected mode" ?
|
2009-09-29 18:38:21 +00:00
|
|
|
|
if( selected && ( Pin->m_Selected & IS_SELECTED ) == 0 )
|
2008-04-17 16:25:29 +00:00
|
|
|
|
continue;
|
|
|
|
|
|
2009-09-04 18:57:37 +00:00
|
|
|
|
Pin->Draw( DrawPanel, DC, wxPoint( 0, 0 ), -1, g_XorMode,
|
|
|
|
|
&showPinText, DefaultTransformMatrix );
|
2008-04-17 16:25:29 +00:00
|
|
|
|
|
|
|
|
|
switch( id )
|
|
|
|
|
{
|
|
|
|
|
case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNUMSIZE_ITEM:
|
|
|
|
|
Pin->m_PinNumSize = MasterPin->m_PinNumSize;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNAMESIZE_ITEM:
|
|
|
|
|
Pin->m_PinNameSize = MasterPin->m_PinNameSize;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINSIZE_ITEM:
|
|
|
|
|
Pin->m_PinLen = MasterPin->m_PinLen;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2009-09-04 18:57:37 +00:00
|
|
|
|
Pin->Draw( DrawPanel, DC, wxPoint( 0, 0 ), -1, GR_DEFAULT_DRAWMODE,
|
|
|
|
|
&showPinText, DefaultTransformMatrix );
|
2008-04-17 16:25:29 +00:00
|
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/************************************************************************/
|
2009-10-08 13:19:28 +00:00
|
|
|
|
void WinEDA_LibeditFrame::RepeatPinItem( wxDC* DC, LIB_PIN* SourcePin )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/************************************************************************/
|
2008-02-12 21:12:46 +00:00
|
|
|
|
/* Creation d'une nouvelle pin par copie de la pr<70>c<EFBFBD>dente ( fct REPEAT) */
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
2009-10-08 13:19:28 +00:00
|
|
|
|
LIB_PIN* Pin;
|
|
|
|
|
wxString msg;
|
|
|
|
|
int ox = 0, oy = 0;
|
2008-04-17 16:25:29 +00:00
|
|
|
|
|
2009-09-25 18:49:04 +00:00
|
|
|
|
if( m_component == NULL || SourcePin == NULL
|
2009-09-22 12:27:57 +00:00
|
|
|
|
|| SourcePin->Type() != COMPONENT_PIN_DRAW_TYPE )
|
2008-04-17 16:25:29 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2009-10-20 09:17:24 +00:00
|
|
|
|
Pin = (LIB_PIN*) SourcePin->GenCopy();
|
2009-09-29 18:38:21 +00:00
|
|
|
|
m_component->AddDrawItem( Pin );
|
2008-04-17 16:25:29 +00:00
|
|
|
|
|
2009-10-20 09:17:24 +00:00
|
|
|
|
Pin->m_Flags = IS_NEW;
|
2009-09-02 18:12:45 +00:00
|
|
|
|
Pin->m_Pos.x += g_RepeatStep.x;
|
|
|
|
|
ox = Pin->m_Pos.x;
|
|
|
|
|
Pin->m_Pos.y += -g_RepeatStep.y;
|
|
|
|
|
oy = Pin->m_Pos.y; // ici axe Y comme en math
|
2008-04-17 16:25:29 +00:00
|
|
|
|
/*** Increment du numero de label ***/
|
|
|
|
|
IncrementLabelMember( Pin->m_PinName );
|
|
|
|
|
|
|
|
|
|
Pin->ReturnPinStringNum( msg );
|
|
|
|
|
IncrementLabelMember( msg );
|
|
|
|
|
Pin->SetPinNumFromString( msg );
|
|
|
|
|
|
2009-09-25 18:49:04 +00:00
|
|
|
|
m_drawItem = Pin;
|
2008-04-17 16:25:29 +00:00
|
|
|
|
|
|
|
|
|
/* Marquage des pins a traiter */
|
2009-05-09 17:29:48 +00:00
|
|
|
|
if( g_EditPinByPinIsOn == false )
|
2008-04-17 16:25:29 +00:00
|
|
|
|
Pin->m_Flags |= IS_LINKED;
|
|
|
|
|
|
|
|
|
|
wxPoint savepos = GetScreen()->m_Curseur;
|
|
|
|
|
DrawPanel->CursorOff( DC );
|
|
|
|
|
GetScreen()->m_Curseur.x = Pin->m_Pos.x;
|
|
|
|
|
GetScreen()->m_Curseur.y = -Pin->m_Pos.y;
|
|
|
|
|
PlacePin( DC );
|
|
|
|
|
GetScreen()->m_Curseur = savepos;
|
|
|
|
|
|
2009-09-02 18:12:45 +00:00
|
|
|
|
// DrawPanel->MouseToCursorSchema();
|
2008-04-17 16:25:29 +00:00
|
|
|
|
DrawPanel->CursorOn( DC );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
|
Pin->DisplayInfo( this );
|
2008-04-17 16:25:29 +00:00
|
|
|
|
GetScreen()->SetModify();
|
2007-05-06 16:03:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
|
|
2009-10-20 09:17:24 +00:00
|
|
|
|
/* helper function to sort pins by pin num */
|
|
|
|
|
bool sort_by_pin_number( const LIB_PIN* ref, const LIB_PIN* tst )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
2009-10-20 09:17:24 +00:00
|
|
|
|
int test = ref->m_PinNum - tst->m_PinNum;
|
2008-04-17 16:25:29 +00:00
|
|
|
|
|
2009-10-20 09:17:24 +00:00
|
|
|
|
if( test == 0 )
|
|
|
|
|
{
|
|
|
|
|
test = ref->m_Convert - tst->m_Convert;
|
|
|
|
|
}
|
|
|
|
|
if( test == 0 )
|
|
|
|
|
{
|
|
|
|
|
test = ref->m_Unit - tst->m_Unit;
|
|
|
|
|
}
|
|
|
|
|
return test < 0;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
}
|
2008-04-17 16:25:29 +00:00
|
|
|
|
|
|
|
|
|
|
2009-10-20 09:17:24 +00:00
|
|
|
|
/* Test for duplicate pins:
|
|
|
|
|
*/
|
2009-09-25 18:49:04 +00:00
|
|
|
|
void WinEDA_LibeditFrame::OnCheckComponent( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
2009-10-20 09:17:24 +00:00
|
|
|
|
int error;
|
|
|
|
|
LIB_PIN* Pin;
|
|
|
|
|
wxString msg;
|
2008-04-17 16:25:29 +00:00
|
|
|
|
|
2009-09-25 18:49:04 +00:00
|
|
|
|
if( m_component == NULL )
|
|
|
|
|
return;
|
2008-04-17 16:25:29 +00:00
|
|
|
|
|
2009-10-20 09:17:24 +00:00
|
|
|
|
// Build the pin list:
|
|
|
|
|
std::vector <LIB_PIN* >PinList;
|
2009-09-29 18:38:21 +00:00
|
|
|
|
Pin = m_component->GetNextPin();
|
2009-10-20 09:17:24 +00:00
|
|
|
|
for( ; Pin != NULL; Pin = m_component->GetNextPin( Pin ) )
|
2008-04-17 16:25:29 +00:00
|
|
|
|
{
|
2009-10-20 09:17:24 +00:00
|
|
|
|
if( Pin->Type() == COMPONENT_PIN_DRAW_TYPE )
|
|
|
|
|
PinList.push_back( Pin );
|
2008-04-17 16:25:29 +00:00
|
|
|
|
}
|
|
|
|
|
|
2009-10-20 09:17:24 +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
|
|
|
|
|
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:
|
2008-04-17 16:25:29 +00:00
|
|
|
|
error = 0;
|
2009-10-20 09:17:24 +00:00
|
|
|
|
DIALOG_DISPLAY_HTML_TEXT_BASE
|
|
|
|
|
error_display( this, wxID_ANY, _( "Marker Info" ),
|
|
|
|
|
wxDefaultPosition, wxSize( 750, 600 ) );
|
|
|
|
|
for( unsigned ii = 1; ii < PinList.size(); ii++ )
|
2008-04-17 16:25:29 +00:00
|
|
|
|
{
|
2009-10-20 09:17:24 +00:00
|
|
|
|
wxString aux_msg;
|
|
|
|
|
wxString stringPinNum, stringCurrPinNum;
|
|
|
|
|
|
2009-10-08 13:19:28 +00:00
|
|
|
|
LIB_PIN* curr_pin = PinList[ii];
|
2008-04-17 16:25:29 +00:00
|
|
|
|
Pin = PinList[ii - 1];
|
2008-11-24 06:53:43 +00:00
|
|
|
|
|
2009-09-25 18:49:04 +00:00
|
|
|
|
if( Pin->m_PinNum != curr_pin->m_PinNum
|
|
|
|
|
|| Pin->m_Convert != curr_pin->m_Convert
|
|
|
|
|
|| Pin->m_Unit != curr_pin->m_Unit )
|
2008-04-17 16:25:29 +00:00
|
|
|
|
continue;
|
2008-11-24 06:53:43 +00:00
|
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
|
error++;
|
2009-10-20 09:17:24 +00:00
|
|
|
|
Pin->ReturnPinStringNum( stringPinNum );
|
|
|
|
|
curr_pin->ReturnPinStringNum( stringCurrPinNum );
|
|
|
|
|
msg.Printf( _(
|
|
|
|
|
"<b>Duplicate pin %s</b> \"%s\" at location <b>(%.3f, %.3f)</b> conflicts \
|
|
|
|
|
with pin %s \"%s\" at location <b>(%.3f, %.3f)</b>" ),
|
|
|
|
|
GetChars( stringCurrPinNum ),
|
2009-10-16 17:18:23 +00:00
|
|
|
|
GetChars( curr_pin->m_PinName ),
|
2009-10-20 09:17:24 +00:00
|
|
|
|
(float) curr_pin->m_Pos.x / 1000.0, (float) -curr_pin->m_Pos.y / 1000.0,
|
|
|
|
|
GetChars( stringPinNum ),
|
2009-10-16 17:18:23 +00:00
|
|
|
|
GetChars( Pin->m_PinName ),
|
2009-10-20 09:17:24 +00:00
|
|
|
|
(float) Pin->m_Pos.x / 1000.0, (float) -Pin->m_Pos.y / 1000.0 );
|
2008-11-24 06:53:43 +00:00
|
|
|
|
|
2009-10-05 17:52:41 +00:00
|
|
|
|
if( m_component->GetPartCount() > 1 )
|
2008-04-17 16:25:29 +00:00
|
|
|
|
{
|
2009-09-25 18:49:04 +00:00
|
|
|
|
aux_msg.Printf( _( " in part %c" ), 'A' + curr_pin->m_Unit );
|
2008-04-17 16:25:29 +00:00
|
|
|
|
msg += aux_msg;
|
|
|
|
|
}
|
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
|
|
|
|
{
|
|
|
|
|
if( curr_pin->m_Convert )
|
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>" );
|
2009-09-25 18:49:04 +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-09-25 18:49:04 +00:00
|
|
|
|
if( error == 0 )
|
|
|
|
|
DisplayInfoMessage( this, _( "No duplicate pins were found." ) );
|
2009-10-20 09:17:24 +00:00
|
|
|
|
else
|
|
|
|
|
error_display.ShowModal();
|
2007-05-06 16:03:28 +00:00
|
|
|
|
}
|