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 <wxPcbStruct.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.


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 

Definition at line 58 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 BOARD_ITEM::SwapData().

Referenced by PCB_EDIT_FRAME::StartMoveTextePcb().

59 {
60  TEXTE_PCB* TextePcb = (TEXTE_PCB*) Panel->GetScreen()->GetCurItem();
61  ( (PCB_EDIT_FRAME*) Panel->GetParent() )->SetCurItem( NULL );
63  Panel->SetMouseCapture( NULL, NULL );
65  if( TextePcb == NULL ) // Should not occur
66  return;
68 #ifndef USE_WX_OVERLAY
69  TextePcb->Draw( Panel, DC, GR_XOR );
70 #endif
72  if( TextePcb->IsNew() ) // If new: remove it
73  {
74  TextePcb->DeleteStructure();
75  return;
76  }
79  TextePcb->SwapData( &s_TextCopy );
80  TextePcb->ClearFlags();
81 #ifndef USE_WX_OVERLAY
82  TextePcb->Draw( Panel, DC, GR_OR );
83 #else
84  Panel->Refresh();
85 #endif
86 }
EDA_ITEM * GetCurItem() const
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...
Definition: draw_panel.cpp:325
bool IsNew() const
Definition: base_struct.h:230
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...
void SwapData(BOARD_ITEM *aImage)
Swap data between aItem and aImage.
Definition: undo_redo.cpp:567
EDA_DRAW_FRAME * GetParent() const
Definition: draw_panel.cpp:174
static TEXTE_PCB s_TextCopy((BOARD_ITEM *) NULL)
Definition: gr_basic.h:42
BASE_SCREEN * GetScreen()
Definition: draw_panel.cpp:187
Definition: base_struct.h:268
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 void Move_Texte_Pcb ( EDA_DRAW_PANEL aPanel,
wxDC *  aDC,
const wxPoint aPosition,
bool  aErase 

Definition at line 158 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().

160 {
161  TEXTE_PCB* TextePcb = (TEXTE_PCB*) aPanel->GetScreen()->GetCurItem();
163  if( TextePcb == NULL )
164  return;
166  if( aErase )
167  TextePcb->Draw( aPanel, aDC, GR_XOR );
169  TextePcb->SetTextPos( aPanel->GetParent()->GetCrossHairPosition() );
171  TextePcb->Draw( aPanel, aDC, GR_XOR );
172 }
EDA_ITEM * GetCurItem() const
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:223
EDA_DRAW_FRAME * GetParent() const
Definition: draw_panel.cpp:174
BASE_SCREEN * GetScreen()
Definition: draw_panel.cpp:187
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...