Cleanup formatting.
This commit is contained in:
parent
17c9f7c61f
commit
ad1e8ebda8
|
@ -101,12 +101,12 @@ void BITMAP_BUTTON::OnLeftButtonUp( wxMouseEvent& aEvent )
|
||||||
wxASSERT( pEventHandler );
|
wxASSERT( pEventHandler );
|
||||||
|
|
||||||
pEventHandler->CallAfter(
|
pEventHandler->CallAfter(
|
||||||
[=]()
|
[=]()
|
||||||
{
|
{
|
||||||
wxCommandEvent evt( wxEVT_BUTTON, this->GetId() );
|
wxCommandEvent evt( wxEVT_BUTTON, this->GetId() );
|
||||||
evt.SetEventObject( this );
|
evt.SetEventObject( this );
|
||||||
GetEventHandler()->ProcessEvent( evt );
|
GetEventHandler()->ProcessEvent( evt );
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
clearFlag( wxCONTROL_PRESSED );
|
clearFlag( wxCONTROL_PRESSED );
|
||||||
|
|
|
@ -59,7 +59,6 @@ wxBitmap COLOR_SWATCH::MakeBitmap( COLOR4D aColor, COLOR4D aBackground, wxSize a
|
||||||
COLOR4D black;
|
COLOR4D black;
|
||||||
bool rowCycle;
|
bool rowCycle;
|
||||||
|
|
||||||
|
|
||||||
if( aCheckerboardBackground.GetBrightness() > 0.4 )
|
if( aCheckerboardBackground.GetBrightness() > 0.4 )
|
||||||
{
|
{
|
||||||
white = COLOR4D::WHITE;
|
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;
|
m_color = aColor;
|
||||||
|
|
||||||
wxBitmap bm = MakeBitmap( m_color, m_background, m_size, m_checkerboardSize, m_checkerboardBg );
|
wxBitmap bm = MakeBitmap( m_color, m_background, m_size, m_checkerboardSize, m_checkerboardBg );
|
||||||
m_swatch->SetBitmap( bm );
|
m_swatch->SetBitmap( bm );
|
||||||
|
|
||||||
if( sendEvent )
|
if( aSendEvent )
|
||||||
sendSwatchChangeEvent( *this );
|
sendSwatchChangeEvent( *this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,10 +28,10 @@ wxDEFINE_EVENT( EVT_INTERACTIVE_CHOICE, wxCommandEvent );
|
||||||
wxColour FOOTPRINT_CHOICE::m_grey( 0x808080 );
|
wxColour FOOTPRINT_CHOICE::m_grey( 0x808080 );
|
||||||
|
|
||||||
|
|
||||||
FOOTPRINT_CHOICE::FOOTPRINT_CHOICE( wxWindow* aParent, int aId )
|
FOOTPRINT_CHOICE::FOOTPRINT_CHOICE( wxWindow* aParent, int aId ) :
|
||||||
: wxOwnerDrawnComboBox( aParent, aId, wxEmptyString, wxDefaultPosition, wxDefaultSize,
|
wxOwnerDrawnComboBox( aParent, aId, wxEmptyString, wxDefaultPosition, wxDefaultSize,
|
||||||
/* n */ 0, /* choices */ nullptr, wxCB_READONLY ),
|
/* n */ 0, /* choices */ nullptr, wxCB_READONLY ),
|
||||||
m_last_selection( 0 )
|
m_last_selection( 0 )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ void FOOTPRINT_CHOICE::OnDrawItem( wxDC& aDC, wxRect const& aRect, int aItem, in
|
||||||
|
|
||||||
aDC.SetPen( pen );
|
aDC.SetPen( pen );
|
||||||
aDC.DrawLine( aRect.x, aRect.y + aRect.height / 2, aRect.x + aRect.width,
|
aDC.DrawLine( aRect.x, aRect.y + aRect.height / 2, aRect.x + aRect.width,
|
||||||
aRect.y + aRect.height / 2 );
|
aRect.y + aRect.height / 2 );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -200,7 +200,9 @@ void FOOTPRINT_CHOICE::TryVetoSelect( wxCommandEvent& aEvent, bool aInner )
|
||||||
wxString text = SafeGetString( sel );
|
wxString text = SafeGetString( sel );
|
||||||
|
|
||||||
if( text == "" )
|
if( text == "" )
|
||||||
|
{
|
||||||
SetSelectionEither( aInner, m_last_selection );
|
SetSelectionEither( aInner, m_last_selection );
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_last_selection = sel;
|
m_last_selection = sel;
|
||||||
|
|
|
@ -100,16 +100,9 @@ void FOOTPRINT_PREVIEW_WIDGET::OnStatusChange( FOOTPRINT_STATUS aStatus )
|
||||||
{
|
{
|
||||||
switch( aStatus )
|
switch( aStatus )
|
||||||
{
|
{
|
||||||
case FPS_NOT_FOUND:
|
case FPS_NOT_FOUND: SetStatusText( _( "Footprint not found" ) ); break;
|
||||||
SetStatusText( _( "Footprint not found" ) );
|
case FPS_LOADING: SetStatusText( _( "Loading..." ) ); break;
|
||||||
break;
|
case FPS_READY: ClearStatus(); break;
|
||||||
|
|
||||||
case FPS_LOADING:
|
|
||||||
SetStatusText( _( "Loading..." ) );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FPS_READY:
|
|
||||||
ClearStatus();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Refresh();
|
Refresh();
|
||||||
|
|
|
@ -144,7 +144,8 @@ WX_PROGRESS_REPORTER::WX_PROGRESS_REPORTER( wxWindow* aParent, const wxString& a
|
||||||
( aCanAbort ? wxPD_CAN_ABORT : 0 ) |
|
( aCanAbort ? wxPD_CAN_ABORT : 0 ) |
|
||||||
wxPD_ELAPSED_TIME )
|
wxPD_ELAPSED_TIME )
|
||||||
#if wxCHECK_VERSION( 3, 1, 0 )
|
#if wxCHECK_VERSION( 3, 1, 0 )
|
||||||
,m_appProgressIndicator( aParent )
|
,
|
||||||
|
m_appProgressIndicator( aParent )
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#if wxCHECK_VERSION( 3, 1, 0 )
|
#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 ) :
|
GAUGE_PROGRESS_REPORTER::GAUGE_PROGRESS_REPORTER( wxWindow* aParent, int aNumPhases ) :
|
||||||
PROGRESS_REPORTER( aNumPhases ),
|
PROGRESS_REPORTER( aNumPhases ),
|
||||||
wxGauge( aParent, wxID_ANY, 1000, wxDefaultPosition, wxDefaultSize,
|
wxGauge( aParent, wxID_ANY, 1000, wxDefaultPosition, wxDefaultSize, wxGA_HORIZONTAL,
|
||||||
wxGA_HORIZONTAL, wxDefaultValidator, wxGaugeNameStr )
|
wxDefaultValidator, wxGaugeNameStr )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,9 +31,9 @@
|
||||||
|
|
||||||
|
|
||||||
SPLIT_BUTTON::SPLIT_BUTTON( wxWindow* aParent, wxWindowID aId, const wxString& aLabel,
|
SPLIT_BUTTON::SPLIT_BUTTON( wxWindow* aParent, wxWindowID aId, const wxString& aLabel,
|
||||||
const wxPoint& aPos, const wxSize& aSize )
|
const wxPoint& aPos, const wxSize& aSize ) :
|
||||||
: wxPanel( aParent, aId, aPos, aSize, wxBORDER_NONE | wxTAB_TRAVERSAL, "DropDownButton" ),
|
wxPanel( aParent, aId, aPos, aSize, wxBORDER_NONE | wxTAB_TRAVERSAL, "DropDownButton" ),
|
||||||
m_label( aLabel )
|
m_label( aLabel )
|
||||||
{
|
{
|
||||||
m_colorNormal = GetForegroundColour();
|
m_colorNormal = GetForegroundColour();
|
||||||
m_colorDisabled = GetForegroundColour().MakeDisabled();
|
m_colorDisabled = GetForegroundColour().MakeDisabled();
|
||||||
|
@ -67,7 +67,8 @@ SPLIT_BUTTON::~SPLIT_BUTTON()
|
||||||
void SPLIT_BUTTON::SetMinSize( const wxSize& aSize )
|
void SPLIT_BUTTON::SetMinSize( const wxSize& aSize )
|
||||||
{
|
{
|
||||||
m_unadjustedMinSize = 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();
|
wxEvtHandler* pEventHandler = GetEventHandler();
|
||||||
wxASSERT( pEventHandler );
|
wxASSERT( pEventHandler );
|
||||||
|
|
||||||
pEventHandler->CallAfter( [=]() {
|
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 );
|
||||||
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_bLButtonDown = false;
|
m_bLButtonDown = false;
|
||||||
|
@ -207,8 +210,10 @@ void SPLIT_BUTTON::OnPaint( wxPaintEvent& WXUNUSED( aEvent ) )
|
||||||
wxMemoryDC mdc( m_bitmap );
|
wxMemoryDC mdc( m_bitmap );
|
||||||
|
|
||||||
r1.x = ( width - m_bitmap.GetWidth() ) / 2;
|
r1.x = ( width - m_bitmap.GetWidth() ) / 2;
|
||||||
|
|
||||||
if( r1.x < 0 )
|
if( r1.x < 0 )
|
||||||
r1.x = 0;
|
r1.x = 0;
|
||||||
|
|
||||||
r1.y += ( size.GetHeight() - m_bitmap.GetHeight() ) / 2;
|
r1.y += ( size.GetHeight() - m_bitmap.GetHeight() ) / 2;
|
||||||
|
|
||||||
dc.Blit( wxPoint( r1.x, r1.y ), m_bitmap.GetSize(), &mdc, wxPoint( 0, 0 ), wxCOPY, true );
|
dc.Blit( wxPoint( r1.x, r1.y ), m_bitmap.GetSize(), &mdc, wxPoint( 0, 0 ), wxCOPY, true );
|
||||||
|
|
|
@ -26,20 +26,13 @@ BEGIN_EVENT_TABLE( STEPPED_SLIDER, wxSlider )
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
|
||||||
STEPPED_SLIDER::STEPPED_SLIDER(
|
STEPPED_SLIDER::STEPPED_SLIDER( wxWindow* aParent, wxWindowID aId, int aValue, int aMinValue,
|
||||||
wxWindow* aParent,
|
int aMaxValue, const wxPoint& aPos, const wxSize& aSize,
|
||||||
wxWindowID aId,
|
long aStyle, const wxValidator& aValidator,
|
||||||
int aValue,
|
const wxString& aName ) :
|
||||||
int aMinValue,
|
wxSlider( aParent, aId, aValue, aMinValue, aMaxValue, aPos, aSize, aStyle, aValidator,
|
||||||
int aMaxValue,
|
aName ),
|
||||||
const wxPoint& aPos,
|
m_step( 1 )
|
||||||
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 )
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -25,11 +25,11 @@
|
||||||
#include <widgets/text_ctrl_eval.h>
|
#include <widgets/text_ctrl_eval.h>
|
||||||
|
|
||||||
TEXT_CTRL_EVAL::TEXT_CTRL_EVAL( wxWindow* aParent, wxWindowID aId, const wxString& aValue,
|
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 wxPoint& aPos, const wxSize& aSize, long aStyle,
|
||||||
const wxString& aName )
|
const wxValidator& aValidator, const wxString& aName ) :
|
||||||
: wxTextCtrl( aParent, aId, aValue, aPos, aSize, aStyle | wxTE_PROCESS_ENTER, aValidator,
|
wxTextCtrl( aParent, aId, aValue, aPos, aSize, aStyle | wxTE_PROCESS_ENTER, aValidator,
|
||||||
aName ),
|
aName ),
|
||||||
m_eval( EDA_UNITS::UNSCALED )
|
m_eval( EDA_UNITS::UNSCALED )
|
||||||
{
|
{
|
||||||
Connect( wxEVT_SET_FOCUS, wxFocusEventHandler( TEXT_CTRL_EVAL::onTextFocusGet ), NULL, this );
|
Connect( wxEVT_SET_FOCUS, wxFocusEventHandler( TEXT_CTRL_EVAL::onTextFocusGet ), NULL, this );
|
||||||
Connect( wxEVT_KILL_FOCUS, wxFocusEventHandler( TEXT_CTRL_EVAL::onTextFocusLost ), NULL, this );
|
Connect( wxEVT_KILL_FOCUS, wxFocusEventHandler( TEXT_CTRL_EVAL::onTextFocusLost ), NULL, this );
|
||||||
|
|
|
@ -35,9 +35,8 @@
|
||||||
|
|
||||||
wxDEFINE_EVENT( DELAY_FOCUS, wxCommandEvent );
|
wxDEFINE_EVENT( DELAY_FOCUS, wxCommandEvent );
|
||||||
|
|
||||||
UNIT_BINDER::UNIT_BINDER( EDA_DRAW_FRAME* aParent,
|
UNIT_BINDER::UNIT_BINDER( EDA_DRAW_FRAME* aParent, wxStaticText* aLabel, wxWindow* aValue,
|
||||||
wxStaticText* aLabel, wxWindow* aValue, wxStaticText* aUnitLabel,
|
wxStaticText* aUnitLabel, bool allowEval ) :
|
||||||
bool allowEval ) :
|
|
||||||
m_frame( aParent ),
|
m_frame( aParent ),
|
||||||
m_label( aLabel ),
|
m_label( aLabel ),
|
||||||
m_value( aValue ),
|
m_value( aValue ),
|
||||||
|
@ -315,9 +314,13 @@ double UNIT_BINDER::GetDoubleValue()
|
||||||
value = textEntry->GetValue();
|
value = textEntry->GetValue();
|
||||||
}
|
}
|
||||||
else if( staticText )
|
else if( staticText )
|
||||||
|
{
|
||||||
value = staticText->GetLabel();
|
value = staticText->GetLabel();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
return 0.0;
|
return 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
double displayValue = DoubleValueFromString( m_units, value, m_dataType );
|
double displayValue = DoubleValueFromString( m_units, value, m_dataType );
|
||||||
return m_originTransforms.FromDisplay( displayValue, m_coordType );
|
return m_originTransforms.FromDisplay( displayValue, m_coordType );
|
||||||
|
|
|
@ -82,7 +82,7 @@ void WIDGET_SAVE_RESTORE::Add( wxNotebook& ctrl, long& dest )
|
||||||
|
|
||||||
void WIDGET_SAVE_RESTORE::ReadConfigFromControls()
|
void WIDGET_SAVE_RESTORE::ReadConfigFromControls()
|
||||||
{
|
{
|
||||||
for( auto& ctrl : m_ctrls )
|
for( WIDGET_SAVE_RESTORE::WIDGET_CTRL_T& ctrl : m_ctrls )
|
||||||
{
|
{
|
||||||
switch( ctrl.m_type )
|
switch( ctrl.m_type )
|
||||||
{
|
{
|
||||||
|
@ -129,7 +129,7 @@ void WIDGET_SAVE_RESTORE::RestoreConfigToControls()
|
||||||
if( !m_valid )
|
if( !m_valid )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for( auto& ctrl : m_ctrls )
|
for( WIDGET_SAVE_RESTORE::WIDGET_CTRL_T& ctrl : m_ctrls )
|
||||||
{
|
{
|
||||||
switch( ctrl.m_type )
|
switch( ctrl.m_type )
|
||||||
{
|
{
|
||||||
|
|
|
@ -77,7 +77,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* Set the current swatch color directly.
|
* 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
|
* 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
|
* Pass unwanted events on to listeners of this object
|
||||||
*/
|
*/
|
||||||
void rePostEvent( wxEvent& aEvt );
|
void rePostEvent( wxEvent& aEvent );
|
||||||
|
|
||||||
KIGFX::COLOR4D m_color;
|
KIGFX::COLOR4D m_color;
|
||||||
KIGFX::COLOR4D m_background;
|
KIGFX::COLOR4D m_background;
|
||||||
|
|
Loading…
Reference in New Issue