45 #include <../common/dialogs/dialog_display_info_HTML_base.h> 131 dlg.SetMinSize( dlg.GetSize() );
133 if( dlg.ShowModal() == wxID_CANCEL )
148 const int acceptable_mingrid = 50;
150 if( (pinpos.
x % acceptable_mingrid) || (pinpos.
y % acceptable_mingrid) )
153 msg.Printf( _(
"This pin is not on a %d mils grid\n" 154 "It will be not easy to connect in schematic\n" 155 "Do you want to continue?"), acceptable_mingrid );
157 if( !
IsOK(
this, msg ) )
247 wxMessageBox( wxT(
"LIB_EDIT_FRAME::PlacePin() error" ) );
257 bool ask_for_pin =
true;
261 if( pin == cur_pin || newpos != pin->GetPosition() || pin->GetFlags() )
265 if( pin->GetConvert() && pin->GetConvert() != cur_pin->
GetConvert() )
272 msg.Printf( _(
"This position is already occupied by another pin, in unit %d.\n" 273 "Continue?" ), pin->GetUnit() );
275 bool status =
IsOK(
this, msg );
295 cur_pin->
Move( newpos );
297 if( cur_pin->
IsNew() )
313 if( pin->GetFlags() == 0 )
348 if( pin->GetPosition() == cur_pin->
GetPosition() &&
360 startPos.
x = OldPos.
x;
361 startPos.
y = -OldPos.
y;
401 void* showOptions =
reinterpret_cast<void*
>( show_opts );
406 cur_pin->
Move( PinPreviousPos );
420 if( !cur_pin->
IsNew() )
421 cur_pin->
Move( pinpos );
461 wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
463 GetEventHandler()->ProcessEvent( cmd );
485 void* showOptions =
reinterpret_cast<void*
>( show_opts );
524 unknownNum.Printf(
"%s-U%c", aPin->
GetNumber(), wxChar(
'A' + ii - 1 ) );
550 if( !part || !aMasterPin )
560 if( pin->GetConvert() && pin->GetConvert() !=
m_convert )
564 if( selected && !pin->IsSelected() )
578 pin->SetLength( aMasterPin->
GetLength() );
629 wxString nextName = pin->
GetName();
695 if( pinList.size() == 0 )
707 _(
"Marker Information" ),
709 wxSize( 750, 600 ) );
713 for(
unsigned ii = 1; ii < pinList.size(); ii++ )
715 LIB_PIN* curr_pin = pinList[ii];
716 LIB_PIN* pin = pinList[ii - 1];
728 "<b>Duplicate pin %s</b> \"%s\" at location <b>(%.3f, %.3f)</b>" 729 " conflicts with pin %s \"%s\" at location <b>(%.3f, %.3f)</b>" ),
750 msg += _(
" of converted" );
752 msg += _(
" of normal" );
755 msg += wxT(
".<br>" );
757 error_display.m_htmlWindow->AppendToPage( msg );
761 int offgrid_error = 0;
763 for(
unsigned ii = 0; ii < pinList.size(); ii++ )
775 "<b>Off grid pin %s</b> \"%s\" at location <b>(%.3f, %.3f)</b>" ),
790 msg += _(
" of converted" );
792 msg += _(
" of normal" );
795 msg += wxT(
".<br>" );
797 error_display.m_htmlWindow->AppendToPage( msg );
800 if( !dup_error && !offgrid_error )
803 error_display.ShowModal();
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
KICAD_T Type() const
Function Type()
void OnCheckComponent(wxCommandEvent &event)
bool GetAddToAllParts(void)
STATUS_FLAGS GetFlags() const
void SetLength(int aLength, bool aTestOtherPins=true)
Set the pin length.
static int GetLastPinLength()
EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
static int LastPinNameSize
void SetLength(const wxString &length)
int GetRepeatPinStep() const
wxString GetPadNameTextSize(void)
void SetAddToAllParts(bool apply)
static bool LastPinCommonUnit
void RestoreComponent()
Restore the current edited component from its temporary copy.
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Update the board display after modifying it bu a python script (note: it is automatically called by a...
Implementation of conversion functions that require both schematic and board internal units...
This file is part of the common library.
static wxArrayString GetOrientationNames()
Get a list of pin orientation names.
void ClearTempCopyComponent()
Delete temporary copy of the current component and clear pointer.
Subclass of DIALOG_LIB_EDIT_PIN_BASE, which is generated by wxFormBuilder.
static int GetLastPinNameSize()
void SetShape(GRAPHIC_PINSHAPE aShape)
Set the shape of the pin to aShape.
void SetStyle(GRAPHIC_PINSHAPE style)
void OnEditPin(wxCommandEvent &event)
static bool LastPinCommonConvert
wxString GetUnitsLabel(EDA_UNITS_T aUnit)
Get a human readable units string.
wxString StringFromValue(EDA_UNITS_T aUnit, int aValue, bool aAddUnitSymbol)
Function StringFromValue returns the string from aValue according to units (inch, mm ...
static int LastPinNumSize
static int GetDefaultPinLength()
void SetName(const wxString &aName, bool aTestOtherPins=true)
Set the pin name.
void SetPinPositionY(const wxString &aSize)
void SetPinNameTextSize(const wxString &size)
void GlobalSetPins(LIB_PIN *aMasterPin, int aId)
Implementing DIALOG_LIB_EDIT_PIN_BASE.
void EndMouseCapture(int aId=-1, int aCursorId=-1, const wxString &aTitle=wxEmptyString, bool aCallEndFunc=true)
Function EndMouseCapture ends mouse a capture.
bool InEditMode() const
Return the draw item editing mode status.
wxString GetPadName(void)
void OnModify()
Must be called after a schematic change in order to set the "modify" flag of the current screen...
static const BITMAP_DEF * GetOrientationSymbols()
Get a list of pin orientation bitmaps for menus and dialogs.
void GetMsgPanelInfo(std::vector< MSG_PANEL_ITEM > &aList) override
Display basic info (type, part and convert) about the current item in message panel.
int GetRepeatDeltaLabel() const
void EnableEditMode(bool aEnable, bool aEditPinByPin=false)
Enable or clear pin editing mode.
void MoveCursorToCrossHair()
Function MoveCursorToCrossHair warps the cursor to the current cross hair position.
int GetNameTextSize() const
void SetOrientationList(const wxArrayString &list, const BITMAP_DEF *aBitmaps)
int GetOrientation() const
static int GetOrientationCodeIndex(int aCode)
Get the index of the orientation code.
void IncrementLabelMember(wxString &name, int aIncrement)
int GetNumberTextSize() const
The base class for drawable items used by schematic library components.
const wxString & GetNumber() const
void RepeatPinItem(wxDC *DC, LIB_PIN *Pin)
void SetElectricalType(ELECTRICAL_PINTYPE type)
ELECTRICAL_PINTYPE GetElectricalType(void)
static bool LastPinVisible
void AddDrawItem(LIB_ITEM *aItem)
Add a new draw aItem to the draw object list.
const wxString & GetName() const
void SetConversion(int aConversion)
Set the body style (conversion) of the pin.
#define IS_NEW
New item, just created.
void SetNumber(const wxString &aNumber)
Set the pin number.
void SetPadNameTextSize(const wxString &size)
void GetPins(LIB_PINS &aList, int aUnit=0, int aConvert=0)
Return a list of pin object pointers from the draw item list.
static int GetPinNumDefaultSize()
void SetOrientation(int orientation)
void SetVisible(bool visible)
#define IS_CHANGED
std::function passed to nested users by ref, avoids copying std::function
LIB_PART * GetParent() const
Class DIALOG_DISPLAY_HTML_TEXT_BASE.
LIB_PART * GetCurPart() const
Return the current part being edited or NULL if none selected.
void SetFlags(STATUS_FLAGS aMask)
void SetDrawItem(LIB_ITEM *drawItem)
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Function SetMsgPanel clears the message panel and populates it with the contents of aList...
void SetAddToAllBodyStyles(bool apply)
Class LIB_ITEM definition.
ELECTRICAL_PINTYPE GetType() const
Get the electrical type of the pin.
void SetPinPositionX(const wxString &aSize)
void TempCopyComponent()
Create a temporary copy of the current edited component.
int ValueFromString(EDA_UNITS_T aUnits, const wxString &aTextValue)
Function ValueFromString converts aTextValue in aUnits to internal units used by the application...
Define a library symbol object.
void SetVisible(bool aVisible)
Set or clear the visibility flag for the pin.
void CreateImagePins(LIB_PIN *aPin)
Adds copies of aPin in components with multiple units in all units.
static ELECTRICAL_PINTYPE LastPinType
void SetLastDrawItem(LIB_ITEM *drawItem)
static int GetLastPinNumSize()
static LIB_ITEM * m_lastDrawItem
EDA_DRAW_FRAME * GetParent() const
bool GetAddToAllBodyStyles(void)
bool IsVisible() const
Return the visibility status of the draw object.
void CrossHairOff(wxDC *DC)
static wxPoint PinPreviousPos
void SetPinPosition(wxPoint aPosition)
move this and all linked pins to the new position used in pin edition.
LIB_PART * GetTempCopyComponent()
static GRAPHIC_PINSHAPE LastPinShape
void SetConvert(int aConvert)
wxPoint GetPosition() const override
Return the current draw object position.
EDA_UNITS_T g_UserUnit
Global variables definitions.
LIB_PIN * GetNextPin(LIB_PIN *aItem=NULL)
Return the next pin object from the draw list.
void deleteItem(wxDC *aDC, LIB_ITEM *aItem)
Deletes the currently selected draw item.
void PlacePin()
Place at cursor location the pin currently moved (i.e.
EDA_DRAW_PANEL * m_canvas
The area to draw on.
std::vector< LIB_PIN * > LIB_PINS
Helper for defining a list of pin object pointers.
void CrossHairOn(wxDC *DC)
void ClearStatus()
Clears the status flag all draw objects in this part.
void SetPartNumber(int aPart)
Set the pin part number.
The symbol library editor main window.
GRAPHIC_PINSHAPE GetStyle(void)
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
TRANSFORM DefaultTransform
virtual void Draw(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aOffset, COLOR4D aColor, GR_DRAWMODE aDrawMode, void *aData, const TRANSFORM &aTransform)
Draw an item.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
static int GetPinNameDefaultSize()
ELECTRICAL_PINTYPE
The component library pin object electrical types used in ERC tests.
wxString GetPinNameTextSize(void)
#define IS_CANCELLED
flag set when edit dialogs are canceled when editing a
void SaveCopyInUndoList(EDA_ITEM *ItemToCopy, UNDO_REDO_T undoType=UR_LIBEDIT)
Create a copy of the current component, and save it in the undo list.
LIB_ITEM * GetDrawItem() const
void SetIgnoreMouseEvents(bool aIgnore)
void SetType(ELECTRICAL_PINTYPE aType, bool aTestOtherPins=true)
Set the electrical type of the pin.
static void AbortPinMove(EDA_DRAW_PANEL *Panel, wxDC *DC)
Clean up after aborting a move pin command.
void Move(const wxPoint &aPosition) override
Move a draw object to aPosition.
std::vector< MSG_PANEL_ITEM > MSG_PANEL_ITEMS
wxString GetPinPositionX()
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
bool SynchronizePins()
Pin edition (add, delete, move...) can be synchronized between units when units are interchangeable b...
Definition of class LIB_EDIT_FRAME.
void SetDlgUnitsLabel(const wxString &units)
void SetOrientation(int aOrientation, bool aTestOtherPins=true)
Set orientation on the pin.
static void DrawMovePin(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aPositon, bool aErase)
wxString GetPinPositionY()
static bool m_showDeMorgan
void SetMouseCapture(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback, END_MOUSE_CAPTURE_CALLBACK aEndMouseCaptureCallback)
Function SetMouseCapture sets the mouse capture and end mouse capture callbacks to aMouseCaptureCallb...
void SetCrossHairPosition(const wxPoint &aPosition, bool aSnapToGrid=true)
Function SetCrossHairPosition sets the screen cross hair position to aPosition in logical (drawing) u...
wxString GetPinName(void)
void SetNameTextSize(int aSize, bool aTestOtherPins=true)
Set the aSize of the pin name text.
Message panel definition file.
void SetPinName(const wxString &name)
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Function DisplayInfoMessage displays an informational message box with aMessage.
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
GRAPHIC_PINSHAPE GetShape() const
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Function IsOK displays a yes/no dialog with aMessage and returns the user response.
void SetPadName(const wxString &number)
bool GetShowElectricalType()
bool sort_by_pin_number(const LIB_PIN *ref, const LIB_PIN *tst)
void SetNumberTextSize(int aSize, bool aTestOtherPins=true)
Set the size of the pin number text.
void StartMovePin(LIB_ITEM *aPin)
Prepare the displacement of a pin.
static int GetOrientationCode(int aIndex)
Get the orientation code by index used to set the pin orientation.
#define IS_MOVED
Item being moved.