KiCad PCB EDA Suite
edit_pcb_text.cpp File Reference

Editing of text on copper and technical layers (TEXTE_PCB class) More...

#include <fctsys.h>
#include <gr_basic.h>
#include <class_drawpanel.h>
#include <pcbnew.h>
#include <pcb_edit_frame.h>
#include <macros.h>
#include <class_board.h>
#include <class_pcb_text.h>
#include <class_board_item.h>

Go to the source code of this file.

Functions

static void Move_Texte_Pcb (EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aPosition, bool aErase)
 
static void Abort_Edit_Pcb_Text (EDA_DRAW_PANEL *Panel, wxDC *DC)
 
static TEXTE_PCB s_TextCopy ((BOARD_ITEM *) NULL)
 

Detailed Description

Editing of text on copper and technical layers (TEXTE_PCB class)

Definition in file edit_pcb_text.cpp.

Function Documentation

void Abort_Edit_Pcb_Text ( EDA_DRAW_PANEL Panel,
wxDC *  DC 
)
static

Definition at line 56 of file edit_pcb_text.cpp.

References EDA_ITEM::ClearFlags(), BOARD_ITEM::DeleteStructure(), TEXTE_PCB::Draw(), BASE_SCREEN::GetCurItem(), EDA_DRAW_PANEL::GetParent(), EDA_DRAW_PANEL::GetScreen(), GR_OR, GR_XOR, EDA_ITEM::IsNew(), EDA_DRAW_PANEL::Refresh(), s_TextCopy(), EDA_DRAW_PANEL::SetMouseCapture(), and TEXTE_PCB::SwapData().

Referenced by PCB_EDIT_FRAME::StartMoveTextePcb().

57 {
58  TEXTE_PCB* TextePcb = (TEXTE_PCB*) Panel->GetScreen()->GetCurItem();
59  ( (PCB_EDIT_FRAME*) Panel->GetParent() )->SetCurItem( NULL );
60 
61  Panel->SetMouseCapture( NULL, NULL );
62 
63  if( TextePcb == NULL ) // Should not occur
64  return;
65 
66 #ifndef USE_WX_OVERLAY
67  TextePcb->Draw( Panel, DC, GR_XOR );
68 #endif
69 
70  if( TextePcb->IsNew() ) // If new: remove it
71  {
72  TextePcb->DeleteStructure();
73  return;
74  }
75 
76 
77  TextePcb->SwapData( &s_TextCopy );
78  TextePcb->ClearFlags();
79 #ifndef USE_WX_OVERLAY
80  TextePcb->Draw( Panel, DC, GR_OR );
81 #else
82  Panel->Refresh();
83 #endif
84 }
virtual BASE_SCREEN * GetScreen()=0
virtual void SwapData(BOARD_ITEM *aImage) override
Swap data between aItem and aImage.
EDA_ITEM * GetCurItem() const
Definition: base_screen.h:233
bool IsNew() const
Definition: base_struct.h:219
void Draw(EDA_DRAW_PANEL *panel, wxDC *DC, GR_DRAWMODE aDrawMode, const wxPoint &offset=ZeroOffset) override
Function Draw BOARD_ITEMs have their own color information.
void DeleteStructure()
Function DeleteStructure deletes this object after UnLink()ing it from its owner if it has one...
virtual EDA_DRAW_FRAME * GetParent() const =0
virtual void SetMouseCapture(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback, END_MOUSE_CAPTURE_CALLBACK aEndMouseCaptureCallback)
Function SetMouseCapture sets the mouse capture and end mouse capture callbacks to aMouseCaptureCallb...
static TEXTE_PCB s_TextCopy((BOARD_ITEM *) NULL)
Definition: gr_basic.h:38
Class PCB_EDIT_FRAME is the main frame for Pcbnew.
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:257
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL)
static void Move_Texte_Pcb ( EDA_DRAW_PANEL aPanel,
wxDC *  aDC,
const wxPoint aPosition,
bool  aErase 
)
static

Definition at line 156 of file edit_pcb_text.cpp.

References TEXTE_PCB::Draw(), EDA_DRAW_FRAME::GetCrossHairPosition(), BASE_SCREEN::GetCurItem(), EDA_DRAW_PANEL::GetParent(), EDA_DRAW_PANEL::GetScreen(), GR_XOR, and EDA_TEXT::SetTextPos().

Referenced by PCB_EDIT_FRAME::StartMoveTextePcb().

158 {
159  TEXTE_PCB* TextePcb = (TEXTE_PCB*) aPanel->GetScreen()->GetCurItem();
160 
161  if( TextePcb == NULL )
162  return;
163 
164  if( aErase )
165  TextePcb->Draw( aPanel, aDC, GR_XOR );
166 
167  TextePcb->SetTextPos( aPanel->GetParent()->GetCrossHairPosition() );
168 
169  TextePcb->Draw( aPanel, aDC, GR_XOR );
170 }
virtual BASE_SCREEN * GetScreen()=0
EDA_ITEM * GetCurItem() const
Definition: base_screen.h:233
void Draw(EDA_DRAW_PANEL *panel, wxDC *DC, GR_DRAWMODE aDrawMode, const wxPoint &offset=ZeroOffset) override
Function Draw BOARD_ITEMs have their own color information.
void SetTextPos(const wxPoint &aPoint)
Definition: eda_text.h:236
virtual EDA_DRAW_FRAME * GetParent() const =0
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Return the current cross hair position in logical (drawing) coordinates.