Cleanup formatting.

This commit is contained in:
Jeff Young 2020-11-07 21:40:56 +00:00
parent 17c9f7c61f
commit ad1e8ebda8
11 changed files with 60 additions and 64 deletions

View File

@ -101,12 +101,12 @@ void BITMAP_BUTTON::OnLeftButtonUp( wxMouseEvent& aEvent )
wxASSERT( pEventHandler );
pEventHandler->CallAfter(
[=]()
{
wxCommandEvent evt( wxEVT_BUTTON, this->GetId() );
evt.SetEventObject( this );
GetEventHandler()->ProcessEvent( evt );
} );
[=]()
{
wxCommandEvent evt( wxEVT_BUTTON, this->GetId() );
evt.SetEventObject( this );
GetEventHandler()->ProcessEvent( evt );
} );
}
clearFlag( wxCONTROL_PRESSED );

View File

@ -59,7 +59,6 @@ wxBitmap COLOR_SWATCH::MakeBitmap( COLOR4D aColor, COLOR4D aBackground, wxSize a
COLOR4D black;
bool rowCycle;
if( aCheckerboardBackground.GetBrightness() > 0.4 )
{
white = COLOR4D::WHITE;
@ -214,9 +213,9 @@ void COLOR_SWATCH::setupEvents()
}
void COLOR_SWATCH::rePostEvent( wxEvent& aEvt )
void COLOR_SWATCH::rePostEvent( wxEvent& aEvent )
{
wxPostEvent( this, aEvt );
wxPostEvent( this, aEvent );
}
@ -232,14 +231,14 @@ static void sendSwatchChangeEvent( COLOR_SWATCH& aSender )
}
void COLOR_SWATCH::SetSwatchColor( COLOR4D aColor, bool sendEvent )
void COLOR_SWATCH::SetSwatchColor( COLOR4D aColor, bool aSendEvent )
{
m_color = aColor;
wxBitmap bm = MakeBitmap( m_color, m_background, m_size, m_checkerboardSize, m_checkerboardBg );
m_swatch->SetBitmap( bm );
if( sendEvent )
if( aSendEvent )
sendSwatchChangeEvent( *this );
}

View File

@ -28,10 +28,10 @@ wxDEFINE_EVENT( EVT_INTERACTIVE_CHOICE, wxCommandEvent );
wxColour FOOTPRINT_CHOICE::m_grey( 0x808080 );
FOOTPRINT_CHOICE::FOOTPRINT_CHOICE( wxWindow* aParent, int aId )
: wxOwnerDrawnComboBox( aParent, aId, wxEmptyString, wxDefaultPosition, wxDefaultSize,
/* n */ 0, /* choices */ nullptr, wxCB_READONLY ),
m_last_selection( 0 )
FOOTPRINT_CHOICE::FOOTPRINT_CHOICE( wxWindow* aParent, int aId ) :
wxOwnerDrawnComboBox( aParent, aId, wxEmptyString, wxDefaultPosition, wxDefaultSize,
/* n */ 0, /* choices */ nullptr, wxCB_READONLY ),
m_last_selection( 0 )
{
}
@ -73,7 +73,7 @@ void FOOTPRINT_CHOICE::OnDrawItem( wxDC& aDC, wxRect const& aRect, int aItem, in
aDC.SetPen( pen );
aDC.DrawLine( aRect.x, aRect.y + aRect.height / 2, aRect.x + aRect.width,
aRect.y + aRect.height / 2 );
aRect.y + aRect.height / 2 );
}
else
{
@ -200,7 +200,9 @@ void FOOTPRINT_CHOICE::TryVetoSelect( wxCommandEvent& aEvent, bool aInner )
wxString text = SafeGetString( sel );
if( text == "" )
{
SetSelectionEither( aInner, m_last_selection );
}
else
{
m_last_selection = sel;

View File

@ -100,16 +100,9 @@ void FOOTPRINT_PREVIEW_WIDGET::OnStatusChange( FOOTPRINT_STATUS aStatus )
{
switch( aStatus )
{
case FPS_NOT_FOUND:
SetStatusText( _( "Footprint not found" ) );
break;
case FPS_LOADING:
SetStatusText( _( "Loading..." ) );
break;
case FPS_READY:
ClearStatus();
case FPS_NOT_FOUND: SetStatusText( _( "Footprint not found" ) ); break;
case FPS_LOADING: SetStatusText( _( "Loading..." ) ); break;
case FPS_READY: ClearStatus(); break;
}
Refresh();

View File

@ -144,7 +144,8 @@ WX_PROGRESS_REPORTER::WX_PROGRESS_REPORTER( wxWindow* aParent, const wxString& a
( aCanAbort ? wxPD_CAN_ABORT : 0 ) |
wxPD_ELAPSED_TIME )
#if wxCHECK_VERSION( 3, 1, 0 )
,m_appProgressIndicator( aParent )
,
m_appProgressIndicator( aParent )
#endif
{
#if wxCHECK_VERSION( 3, 1, 0 )
@ -181,8 +182,8 @@ bool WX_PROGRESS_REPORTER::updateUI()
GAUGE_PROGRESS_REPORTER::GAUGE_PROGRESS_REPORTER( wxWindow* aParent, int aNumPhases ) :
PROGRESS_REPORTER( aNumPhases ),
wxGauge( aParent, wxID_ANY, 1000, wxDefaultPosition, wxDefaultSize,
wxGA_HORIZONTAL, wxDefaultValidator, wxGaugeNameStr )
wxGauge( aParent, wxID_ANY, 1000, wxDefaultPosition, wxDefaultSize, wxGA_HORIZONTAL,
wxDefaultValidator, wxGaugeNameStr )
{
}

View File

@ -31,9 +31,9 @@
SPLIT_BUTTON::SPLIT_BUTTON( wxWindow* aParent, wxWindowID aId, const wxString& aLabel,
const wxPoint& aPos, const wxSize& aSize )
: wxPanel( aParent, aId, aPos, aSize, wxBORDER_NONE | wxTAB_TRAVERSAL, "DropDownButton" ),
m_label( aLabel )
const wxPoint& aPos, const wxSize& aSize ) :
wxPanel( aParent, aId, aPos, aSize, wxBORDER_NONE | wxTAB_TRAVERSAL, "DropDownButton" ),
m_label( aLabel )
{
m_colorNormal = GetForegroundColour();
m_colorDisabled = GetForegroundColour().MakeDisabled();
@ -67,7 +67,8 @@ SPLIT_BUTTON::~SPLIT_BUTTON()
void SPLIT_BUTTON::SetMinSize( const wxSize& aSize )
{
m_unadjustedMinSize = aSize;
wxPanel::SetMinSize( wxSize( aSize.GetWidth() + m_arrowButtonWidth + m_widthPadding, aSize.GetHeight() ) );
wxPanel::SetMinSize( wxSize( aSize.GetWidth() + m_arrowButtonWidth + m_widthPadding,
aSize.GetHeight() ) );
}
@ -138,11 +139,13 @@ void SPLIT_BUTTON::OnLeftButtonUp( wxMouseEvent& aEvent )
wxEvtHandler* pEventHandler = GetEventHandler();
wxASSERT( pEventHandler );
pEventHandler->CallAfter( [=]() {
wxCommandEvent evt( wxEVT_BUTTON, this->GetId() );
evt.SetEventObject( this );
GetEventHandler()->ProcessEvent( evt );
} );
pEventHandler->CallAfter(
[=]()
{
wxCommandEvent evt( wxEVT_BUTTON, this->GetId() );
evt.SetEventObject( this );
GetEventHandler()->ProcessEvent( evt );
} );
}
m_bLButtonDown = false;
@ -207,8 +210,10 @@ void SPLIT_BUTTON::OnPaint( wxPaintEvent& WXUNUSED( aEvent ) )
wxMemoryDC mdc( m_bitmap );
r1.x = ( width - m_bitmap.GetWidth() ) / 2;
if( r1.x < 0 )
r1.x = 0;
r1.y += ( size.GetHeight() - m_bitmap.GetHeight() ) / 2;
dc.Blit( wxPoint( r1.x, r1.y ), m_bitmap.GetSize(), &mdc, wxPoint( 0, 0 ), wxCOPY, true );

View File

@ -26,20 +26,13 @@ BEGIN_EVENT_TABLE( STEPPED_SLIDER, wxSlider )
END_EVENT_TABLE()
STEPPED_SLIDER::STEPPED_SLIDER(
wxWindow* aParent,
wxWindowID aId,
int aValue,
int aMinValue,
int aMaxValue,
const wxPoint& aPos,
const wxSize& aSize,
long aStyle,
const wxValidator& aValidator,
const wxString& aName )
:wxSlider( aParent, aId, aValue, aMinValue, aMaxValue,
aPos, aSize, aStyle, aValidator, aName ),
m_step( 1 )
STEPPED_SLIDER::STEPPED_SLIDER( wxWindow* aParent, wxWindowID aId, int aValue, int aMinValue,
int aMaxValue, const wxPoint& aPos, const wxSize& aSize,
long aStyle, const wxValidator& aValidator,
const wxString& aName ) :
wxSlider( aParent, aId, aValue, aMinValue, aMaxValue, aPos, aSize, aStyle, aValidator,
aName ),
m_step( 1 )
{}

View File

@ -25,11 +25,11 @@
#include <widgets/text_ctrl_eval.h>
TEXT_CTRL_EVAL::TEXT_CTRL_EVAL( wxWindow* aParent, wxWindowID aId, const wxString& aValue,
const wxPoint& aPos, const wxSize& aSize, long aStyle, const wxValidator& aValidator,
const wxString& aName )
: wxTextCtrl( aParent, aId, aValue, aPos, aSize, aStyle | wxTE_PROCESS_ENTER, aValidator,
aName ),
m_eval( EDA_UNITS::UNSCALED )
const wxPoint& aPos, const wxSize& aSize, long aStyle,
const wxValidator& aValidator, const wxString& aName ) :
wxTextCtrl( aParent, aId, aValue, aPos, aSize, aStyle | wxTE_PROCESS_ENTER, aValidator,
aName ),
m_eval( EDA_UNITS::UNSCALED )
{
Connect( wxEVT_SET_FOCUS, wxFocusEventHandler( TEXT_CTRL_EVAL::onTextFocusGet ), NULL, this );
Connect( wxEVT_KILL_FOCUS, wxFocusEventHandler( TEXT_CTRL_EVAL::onTextFocusLost ), NULL, this );

View File

@ -35,9 +35,8 @@
wxDEFINE_EVENT( DELAY_FOCUS, wxCommandEvent );
UNIT_BINDER::UNIT_BINDER( EDA_DRAW_FRAME* aParent,
wxStaticText* aLabel, wxWindow* aValue, wxStaticText* aUnitLabel,
bool allowEval ) :
UNIT_BINDER::UNIT_BINDER( EDA_DRAW_FRAME* aParent, wxStaticText* aLabel, wxWindow* aValue,
wxStaticText* aUnitLabel, bool allowEval ) :
m_frame( aParent ),
m_label( aLabel ),
m_value( aValue ),
@ -315,9 +314,13 @@ double UNIT_BINDER::GetDoubleValue()
value = textEntry->GetValue();
}
else if( staticText )
{
value = staticText->GetLabel();
}
else
{
return 0.0;
}
double displayValue = DoubleValueFromString( m_units, value, m_dataType );
return m_originTransforms.FromDisplay( displayValue, m_coordType );

View File

@ -82,7 +82,7 @@ void WIDGET_SAVE_RESTORE::Add( wxNotebook& ctrl, long& dest )
void WIDGET_SAVE_RESTORE::ReadConfigFromControls()
{
for( auto& ctrl : m_ctrls )
for( WIDGET_SAVE_RESTORE::WIDGET_CTRL_T& ctrl : m_ctrls )
{
switch( ctrl.m_type )
{
@ -129,7 +129,7 @@ void WIDGET_SAVE_RESTORE::RestoreConfigToControls()
if( !m_valid )
return;
for( auto& ctrl : m_ctrls )
for( WIDGET_SAVE_RESTORE::WIDGET_CTRL_T& ctrl : m_ctrls )
{
switch( ctrl.m_type )
{

View File

@ -77,7 +77,7 @@ public:
/**
* Set the current swatch color directly.
*/
void SetSwatchColor( KIGFX::COLOR4D aColor, bool sendEvent );
void SetSwatchColor( KIGFX::COLOR4D aColor, bool aSendEvent );
/**
* Sets the color that will be chosen with the "Reset to Default" button in the chooser
@ -116,7 +116,7 @@ private:
/**
* Pass unwanted events on to listeners of this object
*/
void rePostEvent( wxEvent& aEvt );
void rePostEvent( wxEvent& aEvent );
KIGFX::COLOR4D m_color;
KIGFX::COLOR4D m_background;