44 m_lastTextAngle( 0.0 ),
46 m_drawSpecificConvert( true ),
47 m_drawSpecificUnit( false )
56 auto isDrawingCondition =
60 return item && item->
IsNew();
78 bool ignorePrimePosition =
false;
100 controls->ShowCursor(
true );
112 ignorePrimePosition =
true;
120 grid.SetUseGrid(
getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
122 cursorPos =
grid.Align( controls->GetMousePosition() );
123 controls->ForceCursorPosition(
true, cursorPos );
134 if( evt->IsCancelInteractive() )
148 else if( evt->IsActivate() )
150 if( item && evt->IsMoveTool() )
153 evt->SetPassEvent(
false );
160 evt->SetPassEvent(
false );
164 if( evt->IsPointEditor() )
168 else if( evt->IsMoveTool() )
194 item = pinTool->CreatePin( wxPoint( cursorPos.
x, -cursorPos.
y ), symbol );
202 text->SetPosition( wxPoint( cursorPos.
x, -cursorPos.
y ) );
203 text->SetTextSize( wxSize( Mils2iu( settings->m_Defaults.text_size ),
204 Mils2iu( settings->m_Defaults.text_size ) ) );
217 wxFAIL_MSG( wxT(
"TwoClickPlace(): unknown type" ) );
222 if( evt->IsPrime() && ignorePrimePosition )
223 cursorPos =
grid.Align( controls->GetMousePosition() );
225 controls->WarpCursor( cursorPos,
true );
240 controls->SetCursorPosition( cursorPos,
false );
247 switch( item->
Type() )
250 pinTool->PlacePin( (
LIB_PIN*) item );
256 wxFAIL_MSG( wxT(
"TwoClickPlace(): unknown type" ) );
287 controls->SetAutoPan( item !=
nullptr );
288 controls->CaptureCursor( item !=
nullptr );
291 controls->SetAutoPan(
false );
292 controls->CaptureCursor(
false );
293 controls->ForceCursorPosition(
false );
348 if( evt->IsCancelInteractive() )
358 else if( evt->IsActivate() )
363 if( evt->IsPointEditor() )
367 else if( evt->IsMoveTool() )
378 else if( evt->IsClick(
BUT_LEFT ) && !item )
392 item->
BeginEdit( wxPoint( cursorPos.
x, -cursorPos.
y ) );
419 symbol->AddDrawItem( item );
429 item->
CalcEdit( wxPoint( cursorPos.
x, -cursorPos.
y) );
433 else if( evt->IsDblClick(
BUT_LEFT ) && !item )
484 if( evt->IsCancelInteractive() )
489 else if( evt->IsActivate() )
502 wxPoint offset( -cursorPos.
x, cursorPos.
y );
508 center.
x += offset.x;
509 center.y -= offset.y;
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current symbol.
virtual void ShowCursor(bool aEnabled)
Enable or disables display of cursor.
static TOOL_ACTION properties
static TOOL_ACTION placeSymbolText
static TOOL_ACTION drawSymbolLines
void SetCurrentCursor(KICURSOR aCursor)
Set the current cursor shape for this panel.
static TOOL_ACTION activatePointEditor
#define IS_NEW
New item, just created.
Define a symbol library graphical text item.
void SetOffset(const wxPoint &aOffset)
Move the symbol aOffset.
const VECTOR2D & GetCenter() const
Return the center point of this VIEW (in world space coordinates).
void AddToPreview(EDA_ITEM *aItem, bool aTakeOwnership=true)
void RecacheAllItems()
Rebuild GAL display lists.
void SetFlags(EDA_ITEM_FLAGS aMask)
virtual void CalcEdit(const wxPoint &aPosition)
Calculate the attributes of an item at aPosition when it is being edited.
Define a library symbol object.
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
virtual void SetParent(EDA_ITEM *aParent)
virtual EDA_ITEM * Clone() const
Create a duplicate of this item with linked list members set to NULL.
The base class for drawable items used by schematic library symbols.
static TOOL_ACTION drawSymbolRectangle
void ShowInfoBarMsg(const wxString &aMsg, bool aShowCloseButton=false)
Show the WX_INFOBAR displayed on the top of the canvas with a message and an info icon on the left of...
LIB_SYMBOL * GetCurSymbol() const
Return the current symbol being edited or NULL if none selected.
void Dismiss() override
Dismisses the infobar and updates the containing layout and AUI manager (if one is provided).
static TOOL_ACTION placeSymbolPin
void SetCenter(const VECTOR2D &aCenter)
Set the center point of the VIEW (i.e.
#define IS_MOVING
Item being moved.
static TOOL_ACTION addItemToSel
Selects an item (specified as the event parameter).
virtual void CaptureCursor(bool aEnabled)
Force the cursor to stay within the drawing panel area.
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
void SaveCopyInUndoList(EDA_ITEM *aItem, UNDO_REDO aUndoType=UNDO_REDO::LIBEDIT, bool aAppend=false)
Create a copy of the current symbol, and save it in the undo list.
T * GetAppSettings(bool aLoadNow=true)
Returns a handle to the a given settings by type If the settings have already been loaded,...
static TOOL_ACTION repeatDrawItem
static TOOL_ACTION drawSymbolCircle
An interface for classes handling user events controlling the view behavior such as zooming,...
void AddDrawItem(LIB_ITEM *aItem, bool aSort=true)
Add a new draw aItem to the draw object list and sort according to aSort.
static TOOL_ACTION clearSelection
Clears the current selection.
static TOOL_ACTION finishDrawing
virtual void SetAutoPan(bool aEnabled)
Turn on/off auto panning (this feature is used when there is a tool active (eg.
void SetConvert(int aConvert)
virtual bool ContinueEdit(const wxPoint &aPosition)
Continue an edit in progress at aPosition.
virtual void BeginEdit(const wxPoint &aPosition)
Begin drawing a symbol library draw item at aPosition.
static TOOL_ACTION drawSymbolArc
WX_INFOBAR * GetInfoBar()
void SetPosition(const wxPoint &aPosition) override
virtual void EndEdit()
End an object editing action.
bool NoPrintableChars(const wxString &aString)
Return true if the string is empty or contains only whitespace.
static TOOL_ACTION placeSymbolAnchor
static TOOL_ACTION refreshPreview
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.
static TOOL_ACTION cursorClick
KICAD_T Type() const
Returns the type of object.
The symbol library editor main window.