KiCad PCB EDA Suite
symbdraw.cpp File Reference

Create, move . More...

#include <fctsys.h>
#include <gr_basic.h>
#include <class_drawpanel.h>
#include <confirm.h>
#include <class_sch_screen.h>
#include <base_units.h>
#include <msgpanel.h>
#include <eeschema_id.h>
#include <general.h>
#include <libeditframe.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 <dialogs/dialog_lib_edit_draw_item.h>

Go to the source code of this file.

Functions

static void SymbolDisplayDraw (EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aPosition, bool aErase)
 Manage mouse events when creating new graphic object or modifying an graphic object. More...
 
static void RedrawWhileMovingCursor (EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aPosition, bool aErase)
 
static void AbortSymbolTraceOn (EDA_DRAW_PANEL *Panel, wxDC *DC)
 

Detailed Description

Create, move .

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

Definition in file symbdraw.cpp.

Function Documentation

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

Definition at line 128 of file symbdraw.cpp.

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

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

129 {
130  LIB_EDIT_FRAME* parent = (LIB_EDIT_FRAME*) Panel->GetParent();
131  LIB_ITEM* item = parent->GetDrawItem();
132 
133  if( item == NULL )
134  return;
135 
136  bool newItem = item->IsNew();
137  item->EndEdit( parent->GetCrossHairPosition( true ), true );
138 
139  if( newItem )
140  {
141  delete item;
142  }
143  else
144  parent->RestoreComponent();
145 
146  parent->SetDrawItem( NULL );
147  Panel->Refresh();
148 }
LIB_ITEM * GetDrawItem()
Definition: libeditframe.h:399
void RestoreComponent()
Function RestoreComponent Restore the current edited component from its temporary copy...
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Definition: draw_panel.cpp:326
bool IsNew() const
Definition: base_struct.h:216
virtual void EndEdit(const wxPoint &aPosition, bool aAbort=false)
End an object editing action.
Class LIB_ITEM is the base class for drawable items used by schematic library components.
Definition: lib_draw_item.h:77
void SetDrawItem(LIB_ITEM *drawItem)
EDA_DRAW_FRAME * GetParent() const
Definition: draw_panel.cpp:175
The component library editor main window.
Definition: libeditframe.h:51
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition 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 262 of file symbdraw.cpp.

References DefaultTransform, LIB_ITEM::Draw(), g_XorMode, EDA_DRAW_FRAME::GetCrossHairPosition(), EDA_DRAW_PANEL::GetParent(), LIB_FIELD_T, LIB_ITEM::SetEraseLastDrawItem(), and EDA_ITEM::Type().

Referenced by LIB_EDIT_FRAME::StartMoveDrawSymbol().

264 {
265  LIB_ITEM* item;
266 
267  item = ( (LIB_EDIT_FRAME*) aPanel->GetParent() )->GetDrawItem();
268 
269  if( item == NULL )
270  return;
271 
272  item->SetEraseLastDrawItem( aErase );
273 
274  // if item is the reference field, we must add the current unit id
275  if( item->Type() == LIB_FIELD_T )
276  {
277  int unit = ((LIB_EDIT_FRAME*)aPanel->GetParent())->GetUnit();
278  wxString text = ((LIB_FIELD*)item)->GetFullText( unit );
279 
280  item->Draw( aPanel, aDC, aPanel->GetParent()->GetCrossHairPosition( true ),
281  COLOR4D::UNSPECIFIED, g_XorMode, &text,
283  }
284  else
285  item->Draw( aPanel, aDC, aPanel->GetParent()->GetCrossHairPosition( true ),
286  COLOR4D::UNSPECIFIED, g_XorMode, NULL,
288 }
GR_DRAWMODE g_XorMode
Definition: gr_basic.cpp:51
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
void SetEraseLastDrawItem(bool aErase=true)
Class LIB_FIELD is used in symbol libraries.
Definition: lib_field.h:60
Class LIB_ITEM is the base class for drawable items used by schematic library components.
Definition: lib_draw_item.h:77
EDA_DRAW_FRAME * GetParent() const
Definition: draw_panel.cpp:175
The component library editor main window.
Definition: libeditframe.h:51
TRANSFORM DefaultTransform
Definition: eeschema.cpp:57
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.
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
static void SymbolDisplayDraw ( EDA_DRAW_PANEL aPanel,
wxDC *  aDC,
const wxPoint aPosition,
bool  aErase 
)
static

Manage mouse events when creating new graphic object or modifying an graphic object.

Definition at line 325 of file symbdraw.cpp.

References DefaultTransform, LIB_ITEM::Draw(), g_XorMode, EDA_DRAW_FRAME::GetCrossHairPosition(), EDA_DRAW_PANEL::GetParent(), and LIB_ITEM::SetEraseLastDrawItem().

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

327 {
328  LIB_ITEM* item = ( (LIB_EDIT_FRAME*) aPanel->GetParent() )->GetDrawItem();
329 
330  if( item == NULL )
331  return;
332 
333  item->SetEraseLastDrawItem( aErase );
334  item->Draw( aPanel, aDC, aPanel->GetParent()->GetCrossHairPosition( true ),
335  COLOR4D::UNSPECIFIED, g_XorMode, NULL, DefaultTransform );
336 }
GR_DRAWMODE g_XorMode
Definition: gr_basic.cpp:51
void SetEraseLastDrawItem(bool aErase=true)
Class LIB_ITEM is the base class for drawable items used by schematic library components.
Definition: lib_draw_item.h:77
EDA_DRAW_FRAME * GetParent() const
Definition: draw_panel.cpp:175
The component library editor main window.
Definition: libeditframe.h:51
TRANSFORM DefaultTransform
Definition: eeschema.cpp:57
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.
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...