KiCad PCB EDA Suite
PNS_TUNE_STATUS_POPUP Class Reference

#include <pns_tune_status_popup.h>

Inheritance diagram for PNS_TUNE_STATUS_POPUP:
STATUS_TEXT_POPUP STATUS_POPUP

Public Member Functions

 PNS_TUNE_STATUS_POPUP (EDA_DRAW_FRAME *aParent)
 
 ~PNS_TUNE_STATUS_POPUP () override
 
void UpdateStatus (PNS::ROUTER *aRouter)
 
void SetText (const wxString &aText)
 Display a text. More...
 
void SetTextColor (const wxColour &aColor)
 Change text color. More...
 
virtual void Popup (wxWindow *aFocus=nullptr)
 
virtual void PopupFor (int aMsecs)
 
virtual void Move (const wxPoint &aWhere)
 
virtual void Move (const VECTOR2I &aWhere)
 
void Expire (int aMsecs)
 Hides the popup after a specified time. More...
 

Protected Member Functions

void updateSize ()
 
void onCharHook (wxKeyEvent &aEvent)
 
void onExpire (wxTimerEvent &aEvent)
 

Expire timer even handler

More...
 

Protected Attributes

wxStaticText * m_statusLine
 
wxPanel * m_panel
 
wxBoxSizer * m_topSizer
 
wxTimer m_expireTimer
 

Detailed Description

Definition at line 37 of file pns_tune_status_popup.h.

Constructor & Destructor Documentation

◆ PNS_TUNE_STATUS_POPUP()

PNS_TUNE_STATUS_POPUP::PNS_TUNE_STATUS_POPUP ( EDA_DRAW_FRAME aParent)
inline

Definition at line 40 of file pns_tune_status_popup.h.

40  :
41  STATUS_TEXT_POPUP( aParent )
42  { }
STATUS_TEXT_POPUP(wxWindow *aParent)

◆ ~PNS_TUNE_STATUS_POPUP()

PNS_TUNE_STATUS_POPUP::~PNS_TUNE_STATUS_POPUP ( )
inlineoverride

Definition at line 46 of file pns_tune_status_popup.h.

46 { Hide(); }

Member Function Documentation

◆ Expire()

void STATUS_POPUP::Expire ( int  aMsecs)
inherited

Hides the popup after a specified time.

Parameters
aMsecsis the time expressed in milliseconds

Definition at line 95 of file status_popup.cpp.

96 {
97  m_expireTimer.StartOnce( aMsecs );
98 }
wxTimer m_expireTimer
Definition: status_popup.h:73

References STATUS_POPUP::m_expireTimer.

Referenced by STATUS_POPUP::PopupFor().

◆ Move() [1/2]

void STATUS_POPUP::Move ( const wxPoint &  aWhere)
virtualinherited

Definition at line 89 of file status_popup.cpp.

90 {
91  SetPosition( aWhere );
92 }
void SetPosition(wxString aStr, const wxString &aDefaultMeasurementUnit, int *aX, int *aY, const wxString &aActualConversion)

References PCAD2KICAD::SetPosition().

Referenced by SCH_EDIT_TOOL::DeleteItemCursor(), PCBNEW_CONTROL::DeleteItemCursor(), PAD_TOOL::EnumeratePads(), and LENGTH_TUNER_TOOL::updateStatusPopup().

◆ Move() [2/2]

void STATUS_POPUP::Move ( const VECTOR2I aWhere)
virtualinherited

Definition at line 83 of file status_popup.cpp.

84 {
85  SetPosition( wxPoint( aWhere.x, aWhere.y ) );
86 }
void SetPosition(wxString aStr, const wxString &aDefaultMeasurementUnit, int *aX, int *aY, const wxString &aActualConversion)

References PCAD2KICAD::SetPosition(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ onCharHook()

void STATUS_POPUP::onCharHook ( wxKeyEvent &  aEvent)
protectedinherited

Definition at line 53 of file status_popup.cpp.

54 {
55  // Key events from the status popup don't get put through the wxWidgets event system on
56  // OSX, so we have to fall back to the CHAR_HOOK to forward hotkeys from the popup to
57  // the canvas / frame.
58  aEvent.SetEventType( wxEVT_CHAR );
59 
60  EDA_DRAW_FRAME* frame = dynamic_cast<EDA_DRAW_FRAME*>( GetParent() );
61 
62  if( frame )
63  frame->GetCanvas()->OnEvent( aEvent );
64  else
65  GetParent()->GetEventHandler()->ProcessEvent( aEvent );
66 }
void OnEvent(wxEvent &aEvent)
Used to forward events to the canvas from popups, etc.
virtual EDA_DRAW_PANEL_GAL * GetCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
The base class for create windows for drawing purpose.

References EDA_DRAW_FRAME::GetCanvas(), and EDA_DRAW_PANEL_GAL::OnEvent().

Referenced by STATUS_POPUP::STATUS_POPUP().

◆ onExpire()

void STATUS_POPUP::onExpire ( wxTimerEvent &  aEvent)
protectedinherited

Expire timer even handler

Definition at line 108 of file status_popup.cpp.

109 {
110  Hide();
111 }

Referenced by STATUS_POPUP::STATUS_POPUP().

◆ Popup()

void STATUS_POPUP::Popup ( wxWindow *  aFocus = nullptr)
virtualinherited

Definition at line 69 of file status_popup.cpp.

70 {
71  Show( true );
72  Raise();
73 }

Referenced by PAD_TOOL::EnumeratePads(), LENGTH_TUNER_TOOL::performTuning(), and STATUS_POPUP::PopupFor().

◆ PopupFor()

void STATUS_POPUP::PopupFor ( int  aMsecs)
virtualinherited

Definition at line 76 of file status_popup.cpp.

77 {
78  Popup();
79  Expire( aMsecs );
80 }
virtual void Popup(wxWindow *aFocus=nullptr)
void Expire(int aMsecs)
Hides the popup after a specified time.

References STATUS_POPUP::Expire(), and STATUS_POPUP::Popup().

Referenced by SCH_EDIT_TOOL::DeleteItemCursor(), and PCBNEW_CONTROL::DeleteItemCursor().

◆ SetText()

void STATUS_TEXT_POPUP::SetText ( const wxString &  aText)
inherited

Display a text.

Parameters
aTextis the text to be displayed.

Definition at line 125 of file status_popup.cpp.

126 {
127  m_statusLine->SetLabel( aText );
128  updateSize();
129 }
wxStaticText * m_statusLine
Definition: status_popup.h:101

References STATUS_TEXT_POPUP::m_statusLine, and STATUS_POPUP::updateSize().

Referenced by SCH_EDIT_TOOL::DeleteItemCursor(), PCBNEW_CONTROL::DeleteItemCursor(), PAD_TOOL::EnumeratePads(), and UpdateStatus().

◆ SetTextColor()

void STATUS_TEXT_POPUP::SetTextColor ( const wxColour &  aColor)
inherited

Change text color.

Parameters
aColoris the new text color.

Definition at line 132 of file status_popup.cpp.

133 {
134  m_statusLine->SetForegroundColour( aColor );
135 }
wxStaticText * m_statusLine
Definition: status_popup.h:101

References STATUS_TEXT_POPUP::m_statusLine.

Referenced by UpdateStatus().

◆ updateSize()

void STATUS_POPUP::updateSize ( )
protectedinherited

Definition at line 101 of file status_popup.cpp.

102 {
103  m_topSizer->Fit( m_panel );
104  SetClientSize( m_panel->GetSize() );
105 }
wxPanel * m_panel
Definition: status_popup.h:71
wxBoxSizer * m_topSizer
Definition: status_popup.h:72

References STATUS_POPUP::m_panel, and STATUS_POPUP::m_topSizer.

Referenced by STATUS_TEXT_POPUP::SetText().

◆ UpdateStatus()

void PNS_TUNE_STATUS_POPUP::UpdateStatus ( PNS::ROUTER aRouter)

Definition at line 27 of file pns_tune_status_popup.cpp.

28 {
29  PNS::MEANDER_PLACER_BASE* placer = dynamic_cast<PNS::MEANDER_PLACER_BASE*>( aRouter->Placer() );
30 
31  if( !placer )
32  return;
33 
34  EDA_DRAW_FRAME* frame = static_cast<EDA_DRAW_FRAME*>( GetParent() );
35 
36  SetText( placer->TuningInfo( frame->GetUserUnits() ) );
37 
38  // Determine the background color first and choose a contrasting value
39  COLOR4D bg( m_panel->GetBackgroundColour() );
40  double h, s, l;
41  bg.ToHSL( h, s, l );
42 
43  switch( placer->TuningStatus() )
44  {
46  if( l < 0.5 )
47  SetTextColor( wxColor( 0, 255, 0 ) );
48  else
49  SetTextColor( wxColor( 0, 128, 0 ) );
50 
51  break;
53  if( l < 0.5 )
54  SetTextColor( wxColor( 255, 128, 128 ) );
55  else
56  SetTextColor( wxColor( 128, 64, 64 ) );
57 
58  break;
60  if( l < 0.5 )
61  SetTextColor( wxColor( 24, 24, 255 ) );
62  else
63  SetTextColor( wxColor( 19, 19, 195 ) );
64 
65  break;
66  }
67 }
void SetTextColor(const wxColour &aColor)
Change text color.
virtual const wxString TuningInfo(EDA_UNITS aUnits) const =0
Function TuningInfo()
PLACEMENT_ALGO * Placer()
Definition: pns_router.h:229
The base class for create windows for drawing purpose.
virtual TUNING_STATUS TuningStatus() const =0
Function TuningStatus()
wxPanel * m_panel
Definition: status_popup.h:71
void ToHSL(double &aOutHue, double &aOutSaturation, double &aOutValue) const
Function ToHSL() Converts current color (stored in RGB) to HSL format.
Definition: color4d.cpp:221
EDA_UNITS GetUserUnits() const
Return the user units currently in use.
void SetText(const wxString &aText)
Display a text.
COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:100

References EDA_BASE_FRAME::GetUserUnits(), STATUS_POPUP::m_panel, PNS::ROUTER::Placer(), STATUS_TEXT_POPUP::SetText(), STATUS_TEXT_POPUP::SetTextColor(), KIGFX::COLOR4D::ToHSL(), PNS::MEANDER_PLACER_BASE::TOO_LONG, PNS::MEANDER_PLACER_BASE::TOO_SHORT, PNS::MEANDER_PLACER_BASE::TUNED, PNS::MEANDER_PLACER_BASE::TuningInfo(), and PNS::MEANDER_PLACER_BASE::TuningStatus().

Referenced by LENGTH_TUNER_TOOL::updateStatusPopup().

Member Data Documentation

◆ m_expireTimer

wxTimer STATUS_POPUP::m_expireTimer
protectedinherited

Definition at line 73 of file status_popup.h.

Referenced by STATUS_POPUP::Expire().

◆ m_panel

wxPanel* STATUS_POPUP::m_panel
protectedinherited

◆ m_statusLine

wxStaticText* STATUS_TEXT_POPUP::m_statusLine
protectedinherited

◆ m_topSizer

wxBoxSizer* STATUS_POPUP::m_topSizer
protectedinherited

The documentation for this class was generated from the following files: