KiCad PCB EDA Suite
symbdraw.cpp File Reference

Create, move . More...

#include <fctsys.h>
#include <sch_draw_panel.h>
#include <confirm.h>
#include <base_units.h>
#include <msgpanel.h>
#include <eeschema_id.h>
#include <lib_edit_frame.h>
#include <class_libentry.h>
#include <lib_arc.h>
#include <lib_circle.h>
#include <lib_polyline.h>
#include <lib_rectangle.h>
#include <lib_text.h>
#include <sch_view.h>
#include <dialogs/dialog_lib_edit_draw_item.h>

Go to the source code of this file.

Functions

static void RedrawWhileMovingCursor (EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aPosition, bool aErase)
 
static void AbortSymbolTraceOn (EDA_DRAW_PANEL *aPanel, wxDC *DC)
 

Detailed Description

Create, move .

. graphic shapes used to build and draw a symbol (lines, arcs ..)

Definition in file symbdraw.cpp.

Function Documentation

static void AbortSymbolTraceOn ( EDA_DRAW_PANEL aPanel,
wxDC *  DC 
)
static

Definition at line 108 of file symbdraw.cpp.

References LIB_ITEM::EndEdit(), EDA_DRAW_FRAME::GetCrossHairPosition(), LIB_EDIT_FRAME::GetDrawItem(), EDA_DRAW_PANEL::GetParent(), EDA_ITEM::IsNew(), LIB_EDIT_FRAME::RebuildView(), LIB_EDIT_FRAME::RestoreComponent(), and LIB_EDIT_FRAME::SetDrawItem().

Referenced by LIB_EDIT_FRAME::CreateGraphicItem(), LIB_EDIT_FRAME::StartModifyDrawSymbol(), and LIB_EDIT_FRAME::StartMoveDrawSymbol().

109 {
110  LIB_EDIT_FRAME* parent = (LIB_EDIT_FRAME*) aPanel->GetParent();
111  LIB_ITEM* item = parent->GetDrawItem();
112 
113  if( item == NULL )
114  return;
115 
116  bool newItem = item->IsNew();
117  item->EndEdit( parent->GetCrossHairPosition( true ), true );
118 
119  if( newItem )
120  delete item;
121  else
122  parent->RestoreComponent();
123 
124  parent->SetDrawItem( NULL );
125 
126  auto view = static_cast<SCH_DRAW_PANEL*>(aPanel)->GetView();
127  view->ClearPreview();
128  view->ShowPreview( false );
129  view->ClearHiddenFlags();
130  parent->RebuildView();
131 }
void RestoreComponent()
Restore the current edited component from its temporary copy.
bool IsNew() const
Definition: base_struct.h:219
virtual void EndEdit(const wxPoint &aPosition, bool aAbort=false)
End an object editing action.
The base class for drawable items used by schematic library components.
Definition: lib_draw_item.h:67
virtual EDA_DRAW_FRAME * GetParent() const =0
void SetDrawItem(LIB_ITEM *drawItem)
The symbol library editor main window.
LIB_ITEM * GetDrawItem() const
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Return the current cross hair position in logical (drawing) coordinates.
static void RedrawWhileMovingCursor ( EDA_DRAW_PANEL aPanel,
wxDC *  aDC,
const wxPoint aPosition,
bool  aErase 
)
static

Definition at line 250 of file symbdraw.cpp.

References LIB_ITEM::CalcEdit(), EDA_ITEM::Clone(), EDA_DRAW_FRAME::GetCrossHairPosition(), LIB_EDIT_FRAME::GetDrawItem(), and EDA_DRAW_PANEL::GetParent().

Referenced by LIB_EDIT_FRAME::CreateGraphicItem(), LIB_EDIT_FRAME::StartModifyDrawSymbol(), and LIB_EDIT_FRAME::StartMoveDrawSymbol().

252 {
253  LIB_ITEM* item = ( (LIB_EDIT_FRAME*) aPanel->GetParent() )->GetDrawItem();
254 
255  if( item == NULL )
256  return;
257 
258  auto view = static_cast<SCH_DRAW_PANEL*>(aPanel)->GetView();
259  auto p = aPanel->GetParent()->GetCrossHairPosition( true );
260 
261  item->CalcEdit( p );
262 
263  view->Hide( item );
264  view->ClearPreview();
265  view->AddToPreview( item->Clone() );
266 }
virtual EDA_ITEM * Clone() const
Function Clone creates a duplicate of this item with linked list members set to NULL.
virtual void CalcEdit(const wxPoint &aPosition)
Calculates the attributes of an item at aPosition when it is being edited.
The base class for drawable items used by schematic library components.
Definition: lib_draw_item.h:67
virtual EDA_DRAW_FRAME * GetParent() const =0
The symbol library editor main window.
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Return the current cross hair position in logical (drawing) coordinates.