Save/restore state of UNIT_BINDER and other textboxes.

This commit is contained in:
Jeff Young 2025-08-08 13:54:14 +01:00
parent 60dbfd3eec
commit 4819487ea2
17 changed files with 497 additions and 544 deletions

View File

@ -34,6 +34,7 @@
#include <settings/settings_manager.h>
#include <tool/tool_manager.h>
#include <kiplatform/ui.h>
#include <widgets/unit_binder.h>
#include <wx/display.h>
#include <wx/evtloop.h>
@ -142,8 +143,6 @@ DIALOG_SHIM::~DIALOG_SHIM()
{
m_isClosing = true;
SaveControlState();
Unbind( wxEVT_CLOSE_WINDOW, &DIALOG_SHIM::OnCloseWindow, this );
Unbind( wxEVT_BUTTON, &DIALOG_SHIM::OnButton, this );
Unbind( wxEVT_PAINT, &DIALOG_SHIM::OnPaint, this );
@ -158,14 +157,12 @@ DIALOG_SHIM::~DIALOG_SHIM()
{
if( wxTextCtrl* textCtrl = dynamic_cast<wxTextCtrl*>( child ) )
{
textCtrl->Disconnect( wxEVT_SET_FOCUS,
wxFocusEventHandler( DIALOG_SHIM::onChildSetFocus ),
textCtrl->Disconnect( wxEVT_SET_FOCUS, wxFocusEventHandler( DIALOG_SHIM::onChildSetFocus ),
nullptr, this );
}
else if( wxStyledTextCtrl* scintilla = dynamic_cast<wxStyledTextCtrl*>( child ) )
{
scintilla->Disconnect( wxEVT_SET_FOCUS,
wxFocusEventHandler( DIALOG_SHIM::onChildSetFocus ),
scintilla->Disconnect( wxEVT_SET_FOCUS, wxFocusEventHandler( DIALOG_SHIM::onChildSetFocus ),
nullptr, this );
}
else
@ -316,6 +313,8 @@ bool DIALOG_SHIM::Show( bool show )
ret = wxDialog::Show( show );
SaveControlState();
if( m_parent )
m_parent->SetFocus();
}
@ -428,10 +427,14 @@ void DIALOG_SHIM::SaveControlState()
if( !key.empty() )
{
if( wxComboBox* combo = dynamic_cast<wxComboBox*>( win ) )
if( m_unitBinders.contains( win ) && !m_unitBinders[ win ]->UnitsInvariant() )
dlgMap[ key ] = m_unitBinders[ win ]->GetValue();
else if( wxComboBox* combo = dynamic_cast<wxComboBox*>( win ) )
dlgMap[ key ] = combo->GetValue();
else if( wxOwnerDrawnComboBox* od_combo = dynamic_cast<wxOwnerDrawnComboBox*>( win ) )
dlgMap[ key ] = od_combo->GetSelection();
else if( wxTextEntry* textEntry = dynamic_cast<wxTextEntry*>( win ) )
dlgMap[ key ] = textEntry->GetValue();
else if( wxChoice* choice = dynamic_cast<wxChoice*>( win ) )
dlgMap[ key ] = choice->GetSelection();
else if( wxCheckBox* check = dynamic_cast<wxCheckBox*>( win ) )
@ -495,7 +498,12 @@ void DIALOG_SHIM::LoadControlState()
{
const nlohmann::json& j = it->second;
if( wxComboBox* combo = dynamic_cast<wxComboBox*>( win ) )
if( m_unitBinders.contains( win ) && !m_unitBinders[ win ]->UnitsInvariant() )
{
if( j.is_number_integer() )
m_unitBinders[ win ]->SetValue( j.get<int>() );
}
else if( wxComboBox* combo = dynamic_cast<wxComboBox*>( win ) )
{
if( j.is_string() )
combo->SetValue( wxString::FromUTF8( j.get<std::string>().c_str() ) );
@ -505,6 +513,11 @@ void DIALOG_SHIM::LoadControlState()
if( j.is_number_integer() )
od_combo->SetSelection( j.get<int>() );
}
else if( wxTextEntry* textEntry = dynamic_cast<wxTextEntry*>( win ) )
{
if( j.is_string() )
textEntry->ChangeValue( wxString::FromUTF8( j.get<std::string>().c_str() ) );
}
else if( wxChoice* choice = dynamic_cast<wxChoice*>( win ) )
{
if( j.is_number_integer() )
@ -563,6 +576,20 @@ void DIALOG_SHIM::LoadControlState()
}
void DIALOG_SHIM::OptOut( wxWindow* aWindow )
{
PROPERTY_HOLDER* props = new PROPERTY_HOLDER();
props->SetProperty( "persist", false );
aWindow->SetClientData( props );
}
void DIALOG_SHIM::RegisterUnitBinder( UNIT_BINDER* aUnitBinder, wxWindow* aWindow )
{
m_unitBinders[ aWindow ] = aUnitBinder;
}
// Recursive descent doing a SelectAll() in wxTextCtrls.
// MacOS User Interface Guidelines state that when tabbing to a text control all its
// text should be selected. Since wxWidgets fails to implement this, we do it here.
@ -719,8 +746,7 @@ int DIALOG_SHIM::ShowQuasiModal()
// Get the optimal parent
wxWindow* parent = GetParentForModalDialog( GetParent(), GetWindowStyle() );
wxASSERT_MSG( !m_qmodal_parent_disabler, wxT( "Caller using ShowQuasiModal() twice on same "
"window?" ) );
wxASSERT_MSG( !m_qmodal_parent_disabler, wxT( "Caller using ShowQuasiModal() twice on same window?" ) );
// quasi-modal: disable only my "optimal" parent
m_qmodal_parent_disabler = new WINDOW_DISABLER( parent );

View File

@ -30,6 +30,7 @@
#include <eda_units.h>
#include <eda_draw_frame.h>
#include <confirm.h>
#include <dialog_shim.h>
#include "widgets/unit_binder.h"
#include "wx/dcclient.h"
@ -55,16 +56,31 @@ UNIT_BINDER::UNIT_BINDER( UNITS_PROVIDER* aUnitsProvider, wxWindow* aEventSource
m_eventSource( aEventSource ),
m_unitLabel( aUnitLabel ),
m_iuScale( &aUnitsProvider->GetIuScale() ),
m_units( aUnitsProvider->GetUserUnits() ),
m_negativeZero( false ),
m_dataType( EDA_DATA_TYPE::DISTANCE ),
m_precision( 0 ),
m_eval( aUnitsProvider->GetUserUnits() ),
m_allowEval( aAllowEval && ( !m_valueCtrl || dynamic_cast<wxTextEntry*>( m_valueCtrl ) ) ),
m_needsEval( false ),
m_selStart( 0 ),
m_selEnd( 0 ),
m_unitsInValue( false ),
m_originTransforms( aUnitsProvider->GetOriginTransforms() ),
m_coordType( ORIGIN_TRANSFORMS::NOT_A_COORD )
{
init( aUnitsProvider );
m_allowEval = aAllowEval && ( !m_valueCtrl || dynamic_cast<wxTextEntry*>( m_valueCtrl ) );
if( m_valueCtrl )
{
// Register the UNIT_BINDER for control state save/restore
wxWindow* parent = m_valueCtrl->GetParent();
while( parent && !dynamic_cast<DIALOG_SHIM*>( parent ) )
parent = parent->GetParent();
if( parent )
static_cast<DIALOG_SHIM*>( parent )->RegisterUnitBinder( this, m_valueCtrl );
}
wxTextEntry* textEntry = dynamic_cast<wxTextEntry*>( m_valueCtrl );
if( textEntry )
@ -129,15 +145,6 @@ UNIT_BINDER::~UNIT_BINDER()
}
void UNIT_BINDER::init( UNITS_PROVIDER* aProvider )
{
m_units = aProvider->GetUserUnits();
m_needsEval = false;
m_selStart = 0;
m_selEnd = 0;
}
void UNIT_BINDER::SetUnits( EDA_UNITS aUnits )
{
m_units = aUnits;
@ -169,9 +176,7 @@ void UNIT_BINDER::onUnitsChanged( wxCommandEvent& aEvent )
{
EDA_BASE_FRAME* provider = static_cast<EDA_BASE_FRAME*>( aEvent.GetClientData() );
if( m_units != EDA_UNITS::UNSCALED
&& m_units != EDA_UNITS::DEGREES
&& m_units != EDA_UNITS::PERCENT )
if( !UnitsInvariant() )
{
int temp = GetIntValue();

View File

@ -33,6 +33,7 @@
#include <core/raii.h>
class EDA_BASE_FRAME;
class UNIT_BINDER;
class wxGridEvent;
class wxGUIEventLoop;
@ -140,6 +141,20 @@ public:
*/
void SaveControlState();
/**
* Opt out of control state saving.
* @param aWindow can be either a specific control, or the whole dialog
*/
void OptOut( wxWindow* aWindow );
/**
* Register a UNIT_BINDER so that it can handle units in control-state save/restore
*
* @param aUnitBinder
* @param aWindow the control window
*/
void RegisterUnitBinder( UNIT_BINDER* aUnitBinder, wxWindow* aWindow );
protected:
/**
* In all dialogs, we must call the same functions to fix minimal dlg size, the default
@ -245,9 +260,9 @@ protected:
bool m_userPositioned;
bool m_userResized;
// Used to support first-esc-cancels-edit logic
std::map<wxWindow*, wxString> m_beforeEditValues;
std::map<wxWindow*, UNIT_BINDER*> m_unitBinders;
};
#endif // DIALOG_SHIM_

View File

@ -70,6 +70,11 @@ public:
*/
virtual void SetUnits( EDA_UNITS aUnits );
bool UnitsInvariant() const
{
return m_units == EDA_UNITS::UNSCALED || m_units == EDA_UNITS::DEGREES || m_units == EDA_UNITS::PERCENT;
}
virtual void SetNegativeZero() { m_negativeZero = true; }
/**
@ -211,7 +216,6 @@ public:
}
protected:
void init( UNITS_PROVIDER* aProvider );
void onClick( wxMouseEvent& aEvent );
void onComboBox( wxCommandEvent& aEvent );

View File

@ -53,9 +53,7 @@ DIALOG_GLOBAL_DELETION::DIALOG_GLOBAL_DELETION( PCB_EDIT_FRAME* parent ) :
m_drawingFilterUnlocked->Enable( m_delDrawings->GetValue() );
// This is a destructive dialog. Don't save control state; we always want to come up in a benign state.
PROPERTY_HOLDER* props = new PROPERTY_HOLDER();
props->SetProperty( "persist", false );
SetClientData( props );
OptOut( this );
SetupStandardButtons();

View File

@ -29,13 +29,10 @@
#include <pcb_edit_frame.h>
#include <trigo.h>
// initialise statics
DIALOG_MOVE_EXACT::MOVE_EXACT_OPTIONS DIALOG_MOVE_EXACT::m_options;
DIALOG_MOVE_EXACT::DIALOG_MOVE_EXACT( PCB_BASE_FRAME *aParent, VECTOR2I& aTranslate,
EDA_ANGLE& aRotate, ROTATION_ANCHOR& aAnchor,
const BOX2I& aBbox ) :
DIALOG_MOVE_EXACT::DIALOG_MOVE_EXACT( PCB_BASE_FRAME *aParent, VECTOR2I& aTranslate, EDA_ANGLE& aRotate,
ROTATION_ANCHOR& aAnchor, const BOX2I& aBbox ) :
DIALOG_MOVE_EXACT_BASE( aParent ),
m_translation( aTranslate ),
m_rotation( aRotate ),
@ -63,8 +60,6 @@ DIALOG_MOVE_EXACT::DIALOG_MOVE_EXACT( PCB_BASE_FRAME *aParent, VECTOR2I& aTransl
m_moveX.SetCoordType( ORIGIN_TRANSFORMS::REL_X_COORD );
m_moveY.SetCoordType( ORIGIN_TRANSFORMS::REL_Y_COORD );
updateDialogControls( m_options.polarCoords );
m_menuIDs.push_back( aAnchor );
m_menuIDs.push_back( ROTATE_AROUND_USER_ORIGIN );
@ -72,20 +67,7 @@ DIALOG_MOVE_EXACT::DIALOG_MOVE_EXACT( PCB_BASE_FRAME *aParent, VECTOR2I& aTransl
m_menuIDs.push_back( ROTATE_AROUND_AUX_ORIGIN );
buildRotationAnchorMenu();
// and set up the entries according to the saved options
m_polarCoords->SetValue( m_options.polarCoords );
m_xEntry->ChangeValue( m_options.entry1 );
m_yEntry->ChangeValue( m_options.entry2 );
// Force the evaluation when setting previous values
m_moveX.RequireEval();
m_moveY.RequireEval();
m_rotate.RequireEval();
m_rotate.SetUnits( EDA_UNITS::DEGREES );
m_rotate.SetValue( m_options.entryRotation );
m_anchorOptions->SetSelection( std::min( m_options.entryAnchorSelection, m_menuIDs.size() ) );
SetupStandardButtons();
@ -97,22 +79,14 @@ void DIALOG_MOVE_EXACT::buildRotationAnchorMenu()
{
wxArrayString menuItems;
for( auto anchorID : m_menuIDs )
for( const ROTATION_ANCHOR& anchorID : m_menuIDs )
{
switch( anchorID )
{
case ROTATE_AROUND_ITEM_ANCHOR:
menuItems.push_back( _( "Rotate around item anchor" ) );
break;
case ROTATE_AROUND_SEL_CENTER:
menuItems.push_back( _( "Rotate around selection center" ) );
break;
case ROTATE_AROUND_USER_ORIGIN:
menuItems.push_back( _( "Rotate around local coordinates origin" ) );
break;
case ROTATE_AROUND_AUX_ORIGIN:
menuItems.push_back( _( "Rotate around drill/place origin" ) );
break;
case ROTATE_AROUND_ITEM_ANCHOR: menuItems.push_back( _( "Rotate around item anchor" ) ); break;
case ROTATE_AROUND_SEL_CENTER: menuItems.push_back( _( "Rotate around selection center" ) ); break;
case ROTATE_AROUND_USER_ORIGIN: menuItems.push_back( _( "Rotate around local coordinates origin" ) ); break;
case ROTATE_AROUND_AUX_ORIGIN: menuItems.push_back( _( "Rotate around drill/place origin" ) ); break;
}
}
@ -241,6 +215,19 @@ void DIALOG_MOVE_EXACT::OnClear( wxCommandEvent& event )
}
bool DIALOG_MOVE_EXACT::TransferDataToWindow()
{
updateDialogControls( m_polarCoords->GetValue() );
// Force the evaluation when setting previous values
m_moveX.RequireEval();
m_moveY.RequireEval();
m_rotate.RequireEval();
return true;
}
bool DIALOG_MOVE_EXACT::TransferDataFromWindow()
{
// for the output, we only deliver a Cartesian vector
@ -251,13 +238,6 @@ bool DIALOG_MOVE_EXACT::TransferDataFromWindow()
m_rotation = m_rotate.GetAngleValue();
m_rotationAnchor = m_menuIDs[ m_anchorOptions->GetSelection() ];
// save the settings
m_options.polarCoords = m_polarCoords->GetValue();
m_options.entry1 = m_xEntry->GetValue();
m_options.entry2 = m_yEntry->GetValue();
m_options.entryRotation = m_rotEntry->GetValue();
m_options.entryAnchorSelection = (size_t) std::max( m_anchorOptions->GetSelection(), 0 );
return ok;
}
@ -302,5 +282,4 @@ void DIALOG_MOVE_EXACT::OnTextChanged( wxCommandEvent& event )
m_stdButtons->GetAffirmativeButton()->Enable();
event.Skip();
}
}

View File

@ -22,8 +22,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __DIALOG_MOVE_EXACT__
#define __DIALOG_MOVE_EXACT__
#pragma once
#include <vector>
#include <math/box2.h>
@ -63,7 +62,7 @@ private:
void OnClear( wxCommandEvent& event ) override;
void OnTextChanged( wxCommandEvent& event ) override;
// Automatically called when clicking on the OK button
bool TransferDataToWindow() override;
bool TransferDataFromWindow() override;
/**
@ -87,30 +86,6 @@ private:
// Update controls and their labels after changing the coordinates type (polar/cartesian)
void updateDialogControls( bool aPolar );
/**
* Persistent dialog options
*/
struct MOVE_EXACT_OPTIONS
{
bool polarCoords;
wxString entry1;
wxString entry2;
wxString entryRotation;
size_t entryAnchorSelection;
MOVE_EXACT_OPTIONS():
polarCoords( false ),
entry1( wxT( "0" ) ),
entry2( wxT( "0" ) ),
entryRotation( wxT( "0" ) ),
entryAnchorSelection( 0 )
{
}
};
// persistent settings
static MOVE_EXACT_OPTIONS m_options;
private:
VECTOR2I& m_translation;
EDA_ANGLE& m_rotation;
@ -128,5 +103,3 @@ private:
double m_stateRadius;
EDA_ANGLE m_stateTheta;
};
#endif // __DIALOG_MOVE_EXACT__

View File

@ -33,7 +33,7 @@
#include <trigo.h>
// initialise statics
DIALOG_POSITION_RELATIVE::POSITION_RELATIVE_OPTIONS DIALOG_POSITION_RELATIVE::m_options;
DIALOG_POSITION_RELATIVE::ANCHOR_TYPE DIALOG_POSITION_RELATIVE::s_anchorType = DIALOG_POSITION_RELATIVE::ANCHOR_ITEM;
DIALOG_POSITION_RELATIVE::DIALOG_POSITION_RELATIVE( PCB_BASE_FRAME* aParent ) :
@ -60,13 +60,8 @@ DIALOG_POSITION_RELATIVE::DIALOG_POSITION_RELATIVE( PCB_BASE_FRAME* aParent ) :
SetInitialFocus( m_xEntry );
// and set up the entries according to the saved options
m_polarCoords->SetValue( m_options.polarCoords );
updateDialogControls( m_polarCoords->IsChecked() );
m_xOffset.SetDoubleValue( m_options.entry1 );
m_yOffset.SetDoubleValue( m_options.entry2 );
SetupStandardButtons();
finishDialogSettings();
@ -241,7 +236,7 @@ void DIALOG_POSITION_RELATIVE::OnSelectPointClick( wxCommandEvent& event )
void DIALOG_POSITION_RELATIVE::updateAnchorInfo( const BOARD_ITEM* aItem )
{
switch( m_options.anchorType )
switch( s_anchorType )
{
case ANCHOR_GRID_ORIGIN:
m_referenceInfo->SetLabel( _( "Reference location: grid origin" ) );
@ -274,7 +269,7 @@ void DIALOG_POSITION_RELATIVE::updateAnchorInfo( const BOARD_ITEM* aItem )
VECTOR2I DIALOG_POSITION_RELATIVE::getAnchorPos()
{
switch( m_options.anchorType )
switch( s_anchorType )
{
case ANCHOR_GRID_ORIGIN:
return static_cast<BOARD*>( m_toolMgr->GetModel() )->GetDesignSettings().GetGridOrigin();
@ -294,14 +289,14 @@ VECTOR2I DIALOG_POSITION_RELATIVE::getAnchorPos()
void DIALOG_POSITION_RELATIVE::OnUseGridOriginClick( wxCommandEvent& event )
{
m_options.anchorType = ANCHOR_GRID_ORIGIN;
s_anchorType = ANCHOR_GRID_ORIGIN;
updateAnchorInfo( nullptr );
}
void DIALOG_POSITION_RELATIVE::OnUseUserOriginClick( wxCommandEvent& event )
{
m_options.anchorType = ANCHOR_USER_ORIGIN;
s_anchorType = ANCHOR_USER_ORIGIN;
updateAnchorInfo( nullptr );
}
@ -313,7 +308,7 @@ void DIALOG_POSITION_RELATIVE::UpdatePickedItem( const EDA_ITEM* aItem )
if( aItem && aItem->IsBOARD_ITEM() )
item = static_cast<const BOARD_ITEM*>( aItem );
m_options.anchorType = ANCHOR_ITEM;
s_anchorType = ANCHOR_ITEM;
updateAnchorInfo( item );
if( item )
@ -325,7 +320,7 @@ void DIALOG_POSITION_RELATIVE::UpdatePickedItem( const EDA_ITEM* aItem )
void DIALOG_POSITION_RELATIVE::UpdatePickedPoint( const std::optional<VECTOR2I>& aPoint )
{
m_options.anchorType = ANCHOR_POINT;
s_anchorType = ANCHOR_POINT;
if( aPoint )
m_anchorItemPosition = *aPoint;
@ -343,11 +338,6 @@ void DIALOG_POSITION_RELATIVE::OnOkClick( wxCommandEvent& event )
if( getTranslationInIU( translation, m_polarCoords->IsChecked() ) )
{
// save the settings
m_options.polarCoords = m_polarCoords->GetValue();
m_options.entry1 = m_xOffset.GetDoubleValue();
m_options.entry2 = m_yOffset.GetDoubleValue();
POSITION_RELATIVE_TOOL* posrelTool = m_toolMgr->GetTool<POSITION_RELATIVE_TOOL>();
posrelTool->RelativeItemSelectionMove( getAnchorPos(), translation );

View File

@ -21,8 +21,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __DIALOG_POSITION_RELATIVE__
#define __DIALOG_POSITION_RELATIVE__
#pragma once
// Include the wxFormBuider header base:
#include <vector>
@ -38,7 +37,7 @@ class DIALOG_POSITION_RELATIVE : public DIALOG_POSITION_RELATIVE_BASE,
public:
// Constructor and destructor
DIALOG_POSITION_RELATIVE( PCB_BASE_FRAME* aParent );
~DIALOG_POSITION_RELATIVE() { };
~DIALOG_POSITION_RELATIVE() = default;
// Implement the RECEIVER interface for the callback from the TOOL
void UpdatePickedItem( const EDA_ITEM* aItem ) override;
@ -84,6 +83,7 @@ private:
// Get the current anchor position.
VECTOR2I getAnchorPos();
private:
/**
* Persistent dialog options.
*/
@ -95,25 +95,9 @@ private:
ANCHOR_POINT
};
struct POSITION_RELATIVE_OPTIONS
{
ANCHOR_TYPE anchorType;
bool polarCoords;
double entry1;
double entry2;
POSITION_RELATIVE_OPTIONS() :
anchorType( ANCHOR_ITEM ),
polarCoords( false ),
entry1( 0 ),
entry2( 0 )
{
}
};
// persistent settings
static POSITION_RELATIVE_OPTIONS m_options;
static ANCHOR_TYPE s_anchorType;
private:
TOOL_MANAGER* m_toolMgr;
VECTOR2I m_anchorItemPosition;
@ -125,5 +109,3 @@ private:
double m_stateRadius;
EDA_ANGLE m_stateTheta;
};
#endif // __DIALOG_POSITION_RELATIVE__

View File

@ -126,23 +126,19 @@ DIALOG_PRINT_PCBNEW::DIALOG_PRINT_PCBNEW( PCB_BASE_EDIT_FRAME* aParent,
finishDialogSettings();
m_popMenu->Bind( wxEVT_COMMAND_MENU_SELECTED,
wxCommandEventHandler( DIALOG_PRINT_PCBNEW::onPopUpLayers ), this,
ID_SELECT_FIRST, ID_SELECT_LAST );
m_popMenu->Bind( wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( DIALOG_PRINT_PCBNEW::onPopUpLayers ),
this, ID_SELECT_FIRST, ID_SELECT_LAST );
m_outputMode->Bind( wxEVT_COMMAND_CHOICE_SELECTED, &DIALOG_PRINT_PCBNEW::onColorModeClicked,
this );
m_outputMode->Bind( wxEVT_COMMAND_CHOICE_SELECTED, &DIALOG_PRINT_PCBNEW::onColorModeClicked, this );
}
DIALOG_PRINT_PCBNEW::~DIALOG_PRINT_PCBNEW()
{
m_popMenu->Unbind( wxEVT_COMMAND_MENU_SELECTED,
wxCommandEventHandler( DIALOG_PRINT_PCBNEW::onPopUpLayers ), this,
ID_SELECT_FIRST, ID_SELECT_LAST );
m_popMenu->Unbind( wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( DIALOG_PRINT_PCBNEW::onPopUpLayers ),
this, ID_SELECT_FIRST, ID_SELECT_LAST );
m_outputMode->Unbind( wxEVT_COMMAND_CHOICE_SELECTED, &DIALOG_PRINT_PCBNEW::onColorModeClicked,
this );
m_outputMode->Unbind( wxEVT_COMMAND_CHOICE_SELECTED, &DIALOG_PRINT_PCBNEW::onColorModeClicked, this );
}

View File

@ -21,7 +21,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <dialog_push_pad_properties.h>
#include <pad.h>
@ -29,23 +28,10 @@
#include <pcb_edit_frame.h>
// Class DIALOG_PUSH_PAD_PROPERTIES static variables
bool DIALOG_PUSH_PAD_PROPERTIES::m_Pad_Shape_Filter = true;
bool DIALOG_PUSH_PAD_PROPERTIES::m_Pad_Layer_Filter = true;
bool DIALOG_PUSH_PAD_PROPERTIES::m_Pad_Orient_Filter = true;
bool DIALOG_PUSH_PAD_PROPERTIES::m_Pad_Type_Filter = true;
DIALOG_PUSH_PAD_PROPERTIES::DIALOG_PUSH_PAD_PROPERTIES( PCB_BASE_FRAME* aParent ) :
DIALOG_PUSH_PAD_PROPERTIES_BASE( aParent ),
m_parent( aParent )
{
// Pad filter selection.
m_Pad_Shape_Filter_CB->SetValue( m_Pad_Shape_Filter );
m_Pad_Layer_Filter_CB->SetValue( m_Pad_Layer_Filter );
m_Pad_Orient_Filter_CB->SetValue( m_Pad_Orient_Filter );
m_Pad_Type_Filter_CB->SetValue( m_Pad_Type_Filter );
SetupStandardButtons( { { wxID_OK, _( "Change Pads on Current Footprint" ) },
{ wxID_APPLY, _( "Change Pads on Identical Footprints" ) } } );
@ -69,11 +55,6 @@ void DIALOG_PUSH_PAD_PROPERTIES::PadPropertiesAccept( wxCommandEvent& event )
KI_FALLTHROUGH;
case wxID_OK:
m_Pad_Shape_Filter = m_Pad_Shape_Filter_CB->GetValue();
m_Pad_Layer_Filter = m_Pad_Layer_Filter_CB->GetValue();
m_Pad_Orient_Filter = m_Pad_Orient_Filter_CB->GetValue();
m_Pad_Type_Filter = m_Pad_Type_Filter_CB->GetValue();
if( IsQuasiModal() )
EndQuasiModal( returncode );
else

View File

@ -21,8 +21,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __DIALOG_GLOBAL_PADS_EDITION_H
#define __DIALOG_GLOBAL_PADS_EDITION_H
#pragma once
#include <dialog_push_pad_properties_base.h>
@ -38,15 +37,8 @@ public:
private:
void PadPropertiesAccept( wxCommandEvent& event ) override;
public:
static bool m_Pad_Shape_Filter;
static bool m_Pad_Layer_Filter;
static bool m_Pad_Orient_Filter;
static bool m_Pad_Type_Filter;
private:
PCB_BASE_FRAME* m_parent;
};
#endif // __DIALOG_GLOBAL_PADS_EDITION_H

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -23,15 +23,19 @@ DIALOG_PUSH_PAD_PROPERTIES_BASE::DIALOG_PUSH_PAD_PROPERTIES_BASE( wxWindow* pare
sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Options") ), wxVERTICAL );
m_Pad_Shape_Filter_CB = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("Do not modify pads having a different shape"), wxDefaultPosition, wxDefaultSize, 0 );
m_Pad_Shape_Filter_CB->SetValue(true);
sbSizer1->Add( m_Pad_Shape_Filter_CB, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_Pad_Layer_Filter_CB = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("Do not modify pads having different layers"), wxDefaultPosition, wxDefaultSize, 0 );
m_Pad_Layer_Filter_CB->SetValue(true);
sbSizer1->Add( m_Pad_Layer_Filter_CB, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_Pad_Orient_Filter_CB = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("Do not modify pads having a different orientation"), wxDefaultPosition, wxDefaultSize, 0 );
m_Pad_Orient_Filter_CB->SetValue(true);
sbSizer1->Add( m_Pad_Orient_Filter_CB, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_Pad_Type_Filter_CB = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("Do not modify pads having a different type"), wxDefaultPosition, wxDefaultSize, 0 );
m_Pad_Type_Filter_CB->SetValue(true);
sbSizer1->Add( m_Pad_Type_Filter_CB, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );

View File

@ -1,39 +1,44 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="15" />
<object class="Project" expanded="1">
<property name="class_decoration"></property>
<FileVersion major="1" minor="18"/>
<object class="Project" expanded="true">
<property name="code_generation">C++</property>
<property name="disconnect_events">1</property>
<property name="disconnect_mode">source_name</property>
<property name="disconnect_php_events">0</property>
<property name="disconnect_python_events">0</property>
<property name="cpp_class_decoration"></property>
<property name="cpp_disconnect_events">1</property>
<property name="cpp_event_generation">connect</property>
<property name="cpp_help_provider">none</property>
<property name="cpp_namespace"></property>
<property name="cpp_precompiled_header"></property>
<property name="cpp_use_array_enum">0</property>
<property name="cpp_use_enum">0</property>
<property name="embedded_files_path">res</property>
<property name="encoding">UTF-8</property>
<property name="event_generation">connect</property>
<property name="file">dialog_push_pad_properties_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="indent_with_spaces"></property>
<property name="internationalize">1</property>
<property name="lua_skip_events">1</property>
<property name="lua_ui_table">UI</property>
<property name="name">dialog_push_pad_properties</property>
<property name="namespace"></property>
<property name="path">.</property>
<property name="precompiled_header"></property>
<property name="php_disconnect_events">0</property>
<property name="php_disconnect_mode">source_name</property>
<property name="php_skip_events">1</property>
<property name="python_disconnect_events">0</property>
<property name="python_disconnect_mode">source_name</property>
<property name="python_image_path_wrapper_function_name"></property>
<property name="python_indent_with_spaces"></property>
<property name="python_skip_events">1</property>
<property name="relative_path">1</property>
<property name="skip_lua_events">1</property>
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_enum">0</property>
<property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1">
<property name="use_native_eol">0</property>
<object class="Dialog" expanded="true">
<property name="aui_managed">0</property>
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
<property name="bg"></property>
<property name="center"></property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="event_handler">impl_virtual</property>
<property name="extra_style"></property>
@ -50,28 +55,29 @@
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">Push Pad Properties</property>
<property name="tooltip"></property>
<property name="two_step_creation">0</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<object class="wxBoxSizer" expanded="1">
<object class="wxBoxSizer" expanded="true">
<property name="minimum_size"></property>
<property name="name">bMainSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<object class="wxBoxSizer" expanded="true">
<property name="minimum_size"></property>
<property name="name">bLeftSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">1</property>
<object class="wxStaticBoxSizer" expanded="1">
<object class="wxStaticBoxSizer" expanded="true">
<property name="id">wxID_ANY</property>
<property name="label">Options</property>
<property name="minimum_size"></property>
@ -79,25 +85,25 @@
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<object class="wxCheckBox" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_layer">0</property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="checked">1</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
@ -105,6 +111,7 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@ -143,25 +150,25 @@
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<object class="wxCheckBox" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_layer">0</property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="checked">1</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
@ -169,6 +176,7 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@ -207,25 +215,25 @@
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<object class="wxCheckBox" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_layer">0</property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="checked">1</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
@ -233,6 +241,7 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@ -271,25 +280,25 @@
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<object class="wxCheckBox" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_layer">0</property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="aui_position">0</property>
<property name="aui_row">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="checked">1</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
@ -297,6 +306,7 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@ -339,11 +349,11 @@
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxStdDialogButtonSizer" expanded="1">
<object class="wxStdDialogButtonSizer" expanded="true">
<property name="Apply">1</property>
<property name="Cancel">1</property>
<property name="ContextHelp">0</property>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -24,7 +24,6 @@
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_PUSH_PAD_PROPERTIES_BASE
///////////////////////////////////////////////////////////////////////////////
@ -42,13 +41,14 @@ class DIALOG_PUSH_PAD_PROPERTIES_BASE : public DIALOG_SHIM
wxButton* m_sdbSizer1Apply;
wxButton* m_sdbSizer1Cancel;
// Virtual event handlers, overide them in your derived class
// Virtual event handlers, override them in your derived class
virtual void PadPropertiesAccept( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_PUSH_PAD_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Push Pad Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_PUSH_PAD_PROPERTIES_BASE();
};

View File

@ -41,8 +41,7 @@ DIALOG_REFERENCE_IMAGE_PROPERTIES::DIALOG_REFERENCE_IMAGE_PROPERTIES( PCB_BASE_F
m_posY( aParent, m_YPosLabel, m_ModPositionY, m_YPosUnit )
{
// Create the image editor page
m_imageEditor =
new PANEL_IMAGE_EDITOR( m_Notebook, aBitmap.GetReferenceImage().MutableImage() );
m_imageEditor = new PANEL_IMAGE_EDITOR( m_Notebook, aBitmap.GetReferenceImage().MutableImage() );
m_Notebook->AddPage( m_imageEditor, _( "Image" ), false );
m_posX.SetCoordType( ORIGIN_TRANSFORMS::ABS_X_COORD );
@ -85,9 +84,8 @@ bool DIALOG_REFERENCE_IMAGE_PROPERTIES::TransferDataToWindow()
m_LayerSelectionCtrl->SetLayerSelection( m_bitmap.GetLayer() );
m_cbLocked->SetValue( m_bitmap.IsLocked() );
m_cbLocked->SetToolTip( _( "Locked items cannot be freely moved and oriented on the canvas "
"and can only be selected when the 'Locked items' checkbox is "
"checked in the selection filter." ) );
m_cbLocked->SetToolTip( _( "Locked items cannot be freely moved and oriented on the canvas and can only be "
"selected when the 'Locked items' checkbox is checked in the selection filter." ) );
return true;
}