Start removing old open-coded dialog state saving.

(State saving is now handled uniformly in DIALOG_SHIM.)
This commit is contained in:
Jeff Young 2025-08-07 14:16:14 +01:00
parent ac867f6aa7
commit 66ee17cdcd
30 changed files with 1833 additions and 2334 deletions

View File

@ -24,11 +24,7 @@
#include <dialogs/dialog_paste_special.h>
static PASTE_MODE g_paste_mode = PASTE_MODE::UNIQUE_ANNOTATIONS;
DIALOG_PASTE_SPECIAL::DIALOG_PASTE_SPECIAL( wxWindow* aParent,
PASTE_MODE* aMode,
DIALOG_PASTE_SPECIAL::DIALOG_PASTE_SPECIAL( wxWindow* aParent, PASTE_MODE* aMode,
const wxString& aReplacement ) :
DIALOG_PASTE_SPECIAL_BASE( aParent ),
m_mode( aMode )
@ -41,8 +37,7 @@ DIALOG_PASTE_SPECIAL::DIALOG_PASTE_SPECIAL( wxWindow* aParent,
wxT( "" ) ); // Self explanatory
m_pasteOptions->SetItemToolTip( static_cast<int>( PASTE_MODE::REMOVE_ANNOTATIONS ),
wxString::Format( _( "Replaces reference designators "
"with '%s'." ),
wxString::Format( _( "Replaces reference designators with '%s'." ),
aReplacement ) );
m_pasteOptions->SetFocus();
@ -54,14 +49,14 @@ DIALOG_PASTE_SPECIAL::DIALOG_PASTE_SPECIAL( wxWindow* aParent,
bool DIALOG_PASTE_SPECIAL::TransferDataToWindow()
{
m_pasteOptions->SetSelection( static_cast<int>( g_paste_mode ) );
m_pasteOptions->SetSelection( static_cast<int>( *m_mode ) );
return true;
}
bool DIALOG_PASTE_SPECIAL::TransferDataFromWindow()
{
g_paste_mode = *m_mode = static_cast<PASTE_MODE>( m_pasteOptions->GetSelection() );
*m_mode = static_cast<PASTE_MODE>( m_pasteOptions->GetSelection() );
return true;
}

View File

@ -39,42 +39,14 @@
#include <widgets/unit_binder.h>
#include <widgets/font_choice.h>
static bool g_modifyReferences;
static bool g_modifyValues;
static bool g_modifyOtherFields;
static bool g_modifyWires;
static bool g_modifyBuses;
static bool g_modifyGlobalLabels;
static bool g_modifyHierLabels;
static bool g_modifyLabelFields;
static bool g_modifySheetTitles;
static bool g_modifyOtherSheetFields;
static bool g_modifySheetPins;
static bool g_modifySheetBorders;
static bool g_modifySchTextAndGraphics;
static bool g_filterByFieldname;
static wxString g_fieldnameFilter;
static bool g_filterByReference;
static wxString g_referenceFilter;
static bool g_filterBySymbol;
static wxString g_symbolFilter;
static bool g_filterByType;
static bool g_typeFilterIsPower;
static bool g_filterByNet;
static wxString g_netFilter;
static bool g_filterSelected;
class DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS : public DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE
{
SCH_EDIT_FRAME* m_parent;
SCH_SELECTION m_selection;
UNIT_BINDER m_textSize;
UNIT_BINDER m_lineWidth;
UNIT_BINDER m_junctionSize;
public:
DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS( SCH_EDIT_FRAME* parent );
~DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS() override;
@ -102,6 +74,14 @@ protected:
void visitItem( SCH_COMMIT* aCommit, const SCH_SHEET_PATH& aSheetPath, SCH_ITEM* aItem );
void processItem( SCH_COMMIT* aCommit, const SCH_SHEET_PATH& aSheetPath, SCH_ITEM* aItem );
private:
SCH_EDIT_FRAME* m_parent;
SCH_SELECTION m_selection;
UNIT_BINDER m_textSize;
UNIT_BINDER m_lineWidth;
UNIT_BINDER m_junctionSize;
};
@ -138,31 +118,10 @@ DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS( SCH_
DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::~DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS()
{
g_modifyReferences = m_references->GetValue();
g_modifyValues = m_values->GetValue();
g_modifyOtherFields = m_otherFields->GetValue();
g_modifyWires = m_wires->GetValue();
g_modifyBuses = m_buses->GetValue();
g_modifyGlobalLabels = m_globalLabels->GetValue();
g_modifyHierLabels = m_hierLabels->GetValue();
g_modifyLabelFields = m_labelFields->GetValue();
g_modifySheetTitles = m_sheetTitles->GetValue();
g_modifyOtherSheetFields = m_sheetFields->GetValue();
g_modifySheetPins = m_sheetPins->GetValue();
g_modifySheetBorders = m_sheetBorders->GetValue();
g_modifySchTextAndGraphics = m_schTextAndGraphics->GetValue();
g_filterByFieldname = m_fieldnameFilterOpt->GetValue();
g_fieldnameFilter = m_fieldnameFilter->GetValue();
g_filterByReference = m_referenceFilterOpt->GetValue();
g_referenceFilter = m_referenceFilter->GetValue();
g_filterBySymbol = m_symbolFilterOpt->GetValue();
g_symbolFilter = m_symbolFilter->GetValue();
g_filterByType = m_typeFilterOpt->GetValue();
g_typeFilterIsPower = m_typeFilter->GetSelection() == 1;
g_filterByNet = m_netFilterOpt->GetValue();
g_netFilter = m_netFilter->GetValue();
g_filterSelected = m_selectedFilterOpt->GetValue();
}
@ -171,50 +130,14 @@ bool DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataToWindow()
SCH_SELECTION_TOOL* selectionTool = m_parent->GetToolManager()->GetTool<SCH_SELECTION_TOOL>();
m_selection = selectionTool->GetSelection();
m_references->SetValue( g_modifyReferences );
m_values->SetValue( g_modifyValues );
m_otherFields->SetValue( g_modifyOtherFields );
m_wires->SetValue( g_modifyWires );
m_buses->SetValue( g_modifyBuses );
m_globalLabels->SetValue( g_modifyGlobalLabels );
m_hierLabels->SetValue( g_modifyHierLabels );
m_labelFields->SetValue( g_modifyLabelFields );
m_sheetTitles->SetValue( g_modifySheetTitles );
m_sheetFields->SetValue( g_modifyOtherSheetFields );
m_sheetPins->SetValue( g_modifySheetPins );
m_sheetBorders->SetValue( g_modifySheetBorders );
m_schTextAndGraphics->SetValue( g_modifySchTextAndGraphics );
// SetValue() generates events, ChangeValue() does not
m_fieldnameFilter->ChangeValue( g_fieldnameFilter );
m_fieldnameFilterOpt->SetValue( g_filterByFieldname );
m_referenceFilter->ChangeValue( g_referenceFilter );
m_referenceFilterOpt->SetValue( g_filterByReference );
m_symbolFilter->ChangeValue( g_symbolFilter );
m_symbolFilterOpt->SetValue( g_filterBySymbol );
m_typeFilter->SetSelection( g_typeFilterIsPower ? 1 : 0 );
m_typeFilterOpt->SetValue( g_filterByType );
m_selectedFilterOpt->SetValue( g_filterSelected );
m_netFilter->ChangeValue( g_netFilter );
if( g_filterByNet && !g_netFilter.IsEmpty() )
{
m_netFilter->SetValue( g_netFilter );
m_netFilterOpt->SetValue( true );
}
else if( !m_parent->GetHighlightedConnection().IsEmpty() )
{
if( g_netFilter.IsEmpty() && !m_parent->GetHighlightedConnection().IsEmpty() )
m_netFilter->SetValue( m_parent->GetHighlightedConnection() );
}
else if( m_selection.GetSize() )
{
SCH_ITEM* sch_item = (SCH_ITEM*) m_selection.Front();
SCH_CONNECTION* connection = sch_item->Connection();
if( connection )
m_netFilter->SetValue( connection->Name() );
}
m_netFilterOpt->SetValue( g_filterByNet );
m_fontCtrl->Append( INDETERMINATE_ACTION );
m_fontCtrl->SetStringSelection( INDETERMINATE_ACTION );
@ -253,7 +176,7 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem( SCH_COMMIT* aCommit,
if( EDA_TEXT* eda_text = dynamic_cast<EDA_TEXT*>( aItem ) )
{
if( !m_textSize.IsIndeterminate() )
eda_text->SetTextSize( VECTOR2I( m_textSize.GetValue(), m_textSize.GetValue() ) );
eda_text->SetTextSize( VECTOR2I( m_textSize.GetIntValue(), m_textSize.GetIntValue() ) );
if( m_setTextColor->GetValue() )
eda_text->SetTextColor( m_textColorSwatch->GetSwatchColor() );
@ -335,7 +258,7 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem( SCH_COMMIT* aCommit,
STROKE_PARAMS stroke = aItem->GetStroke();
if( !m_lineWidth.IsIndeterminate() )
stroke.SetWidth( m_lineWidth.GetValue() );
stroke.SetWidth( m_lineWidth.GetIntValue() );
if( m_lineStyle->GetStringSelection() != INDETERMINATE_ACTION )
stroke.SetLineStyle( (LINE_STYLE) m_lineStyle->GetSelection() );
@ -362,7 +285,7 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem( SCH_COMMIT* aCommit,
if( SCH_JUNCTION* junction = dynamic_cast<SCH_JUNCTION*>( aItem ) )
{
if( !m_junctionSize.IsIndeterminate() )
junction->SetDiameter( m_junctionSize.GetValue() );
junction->SetDiameter( m_junctionSize.GetIntValue() );
if( m_setDotColor->GetValue() )
junction->SetColor( m_dotColorSwatch->GetSwatchColor() );
@ -479,7 +402,7 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem( SCH_COMMIT* aCommit,
if( m_sheetBorders->GetValue() )
{
if( !m_lineWidth.IsIndeterminate() )
sheet->SetBorderWidth( m_lineWidth.GetValue() );
sheet->SetBorderWidth( m_lineWidth.GetIntValue() );
if( m_setColor->GetValue() )
sheet->SetBorderColor( m_colorSwatch->GetSwatchColor() );

View File

@ -29,24 +29,15 @@
#include "widgets/wx_html_report_panel.h"
// Saved dialog settings
DIALOG_UPDATE_FROM_PCB::DIALOG_UPDATE_FROM_PCB_SAVED_STATE
DIALOG_UPDATE_FROM_PCB::s_savedDialogState{ false, true, true, true, false, true, true };
DIALOG_UPDATE_FROM_PCB::DIALOG_UPDATE_FROM_PCB( SCH_EDIT_FRAME* aParent )
: DIALOG_UPDATE_FROM_PCB_BASE( aParent ),
m_frame( aParent ),
m_editorControl( m_frame->GetToolManager()->GetTool<SCH_EDITOR_CONTROL>() )
DIALOG_UPDATE_FROM_PCB::DIALOG_UPDATE_FROM_PCB( SCH_EDIT_FRAME* aParent ) :
DIALOG_UPDATE_FROM_PCB_BASE( aParent ),
m_frame( aParent )
{
m_messagePanel->SetLabel( _( "Changes to Be Applied" ) );
m_messagePanel->SetFileName( Prj().GetProjectPath() + wxT( "report.txt" ) );
m_messagePanel->SetLazyUpdate( true );
m_messagePanel->GetSizer()->SetSizeHints( this );
m_cbRelinkFootprints->SetValue( s_savedDialogState.MatchByReference );
if( m_cbRelinkFootprints->GetValue() )
{
m_cbUpdateReferences->SetValue( false );
@ -54,16 +45,9 @@ DIALOG_UPDATE_FROM_PCB::DIALOG_UPDATE_FROM_PCB( SCH_EDIT_FRAME* aParent )
}
else
{
m_cbUpdateReferences->SetValue( s_savedDialogState.UpdateReferences );
m_cbUpdateReferences->Enable( true );
}
m_cbUpdateFootprints->SetValue( s_savedDialogState.UpdateFootprints );
m_cbUpdateValues->SetValue( s_savedDialogState.UpdateValues );
m_cbUpdateNetNames->SetValue( s_savedDialogState.UpdateNetNames );
m_cbUpdateAttributes->SetValue( s_savedDialogState.UpdateAttributes );
m_cbUpdateOtherFields->SetValue( s_savedDialogState.UpdateOtherFields );
SetupStandardButtons( { { wxID_OK, _( "Update Schematic" ) },
{ wxID_CANCEL, _( "Close" ) } } );
@ -102,11 +86,6 @@ bool DIALOG_UPDATE_FROM_PCB::TransferDataToWindow()
}
DIALOG_UPDATE_FROM_PCB::~DIALOG_UPDATE_FROM_PCB()
{
}
void DIALOG_UPDATE_FROM_PCB::OnOptionChanged( wxCommandEvent& event )
{
if( event.GetEventObject() == m_cbRelinkFootprints )
@ -118,27 +97,11 @@ void DIALOG_UPDATE_FROM_PCB::OnOptionChanged( wxCommandEvent& event )
}
else
{
m_cbUpdateReferences->SetValue( s_savedDialogState.UpdateReferences );
m_cbUpdateReferences->Enable( true );
}
}
updateData();
if( event.GetEventObject() == m_cbRelinkFootprints )
s_savedDialogState.MatchByReference = m_cbRelinkFootprints->GetValue();
else if( event.GetEventObject() == m_cbUpdateReferences )
s_savedDialogState.UpdateReferences = m_cbUpdateReferences->GetValue();
else if( event.GetEventObject() == m_cbUpdateFootprints )
s_savedDialogState.UpdateFootprints = m_cbUpdateFootprints->GetValue();
else if( event.GetEventObject() == m_cbUpdateValues )
s_savedDialogState.UpdateValues = m_cbUpdateValues->GetValue();
else if( event.GetEventObject() == m_cbUpdateNetNames )
s_savedDialogState.UpdateNetNames = m_cbUpdateNetNames->GetValue();
else if( event.GetEventObject() == m_cbUpdateAttributes )
s_savedDialogState.UpdateAttributes = m_cbUpdateAttributes->GetValue();
else if( event.GetEventObject() == m_cbUpdateOtherFields )
s_savedDialogState.UpdateOtherFields = m_cbUpdateOtherFields->GetValue();
}

View File

@ -22,20 +22,19 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef _DIALOG_UPDATE_FROM_PCB_H_
#define _DIALOG_UPDATE_FROM_PCB_H_
#pragma once
#include <backannotate.h>
#include <dialog_update_from_pcb_base.h>
class SCH_EDIT_FRAME;
class SCH_EDITOR_CONTROL;
class DIALOG_UPDATE_FROM_PCB : public DIALOG_UPDATE_FROM_PCB_BASE
{
public:
DIALOG_UPDATE_FROM_PCB( SCH_EDIT_FRAME* aParent );
~DIALOG_UPDATE_FROM_PCB();
~DIALOG_UPDATE_FROM_PCB() = default;
private:
void updateData();
@ -44,25 +43,6 @@ private:
void OnOptionChanged( wxCommandEvent& event ) override;
void OnUpdateClick( wxCommandEvent& event ) override;
/**
* Container for the dialog last saved state.
*/
struct DIALOG_UPDATE_FROM_PCB_SAVED_STATE
{
// Flags to remember last checkboxes state.
bool MatchByReference;
bool UpdateReferences;
bool UpdateFootprints;
bool UpdateValues;
bool UpdateNetNames;
bool UpdateAttributes;
bool UpdateOtherFields;
};
static DIALOG_UPDATE_FROM_PCB_SAVED_STATE s_savedDialogState;
private:
SCH_EDIT_FRAME* m_frame;
SCH_EDITOR_CONTROL* m_editorControl;
};
#endif

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3)
// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -57,11 +57,13 @@ DIALOG_UPDATE_FROM_PCB_BASE::DIALOG_UPDATE_FROM_PCB_BASE( wxWindow* parent, wxWi
fgSizer2->Add( m_cbUpdateReferences, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_cbUpdateFootprints = new wxCheckBox( sbSizer2->GetStaticBox(), wxID_ANY, _("Footprint assignments"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbUpdateFootprints->SetValue(true);
m_cbUpdateFootprints->SetToolTip( _("Update footprint associations of symbols whose footprints have been replaced with different footprints in PCB.") );
fgSizer2->Add( m_cbUpdateFootprints, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_cbUpdateValues = new wxCheckBox( sbSizer2->GetStaticBox(), wxID_ANY, _("Values"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbUpdateValues->SetValue(true);
m_cbUpdateValues->SetToolTip( _("Update symbols values that have been replaced in the PCB editor.") );
fgSizer2->Add( m_cbUpdateValues, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
@ -70,9 +72,11 @@ DIALOG_UPDATE_FROM_PCB_BASE::DIALOG_UPDATE_FROM_PCB_BASE( wxWindow* parent, wxWi
fgSizer2->Add( m_cbUpdateNetNames, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_cbUpdateAttributes = new wxCheckBox( sbSizer2->GetStaticBox(), wxID_ANY, _("Attributes"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbUpdateAttributes->SetValue(true);
fgSizer2->Add( m_cbUpdateAttributes, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 );
m_cbUpdateOtherFields = new wxCheckBox( sbSizer2->GetStaticBox(), wxID_ANY, _("Other fields"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbUpdateOtherFields->SetValue(true);
m_cbUpdateOtherFields->SetToolTip( _("Update all other fields in the symbol from the footprint") );
fgSizer2->Add( m_cbUpdateOtherFields, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 );

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3)
// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!

View File

@ -27,16 +27,7 @@
#include <string_utils.h>
bool g_removeExtraLibFields = false;
bool g_resetEmptyLibFields = false;
bool g_resetLibFieldText = true;
bool g_resetLibFieldVisibilities = true;
bool g_resetLibFieldEffects = true;
bool g_resetLibFieldPositions = true;
DIALOG_UPDATE_SYMBOL_FIELDS::DIALOG_UPDATE_SYMBOL_FIELDS( SYMBOL_EDIT_FRAME* aParent,
LIB_SYMBOL* aSymbol ) :
DIALOG_UPDATE_SYMBOL_FIELDS::DIALOG_UPDATE_SYMBOL_FIELDS( SYMBOL_EDIT_FRAME* aParent, LIB_SYMBOL* aSymbol ) :
DIALOG_UPDATE_SYMBOL_FIELDS_BASE( aParent ),
m_editFrame( aParent ),
m_symbol( aSymbol)
@ -55,13 +46,6 @@ DIALOG_UPDATE_SYMBOL_FIELDS::DIALOG_UPDATE_SYMBOL_FIELDS( SYMBOL_EDIT_FRAME* aPa
updateFieldsList();
m_removeExtraBox->SetValue( g_removeExtraLibFields );
m_resetEmptyFields->SetValue( g_resetEmptyLibFields );
m_resetFieldText->SetValue( g_resetLibFieldText );
m_resetFieldVisibilities->SetValue( g_resetLibFieldVisibilities );
m_resetFieldEffects->SetValue( g_resetLibFieldEffects );
m_resetFieldPositions->SetValue( g_resetLibFieldPositions );
SetupStandardButtons();
// Now all widgets have the size fixed, call FinishDialogSettings
@ -69,17 +53,6 @@ DIALOG_UPDATE_SYMBOL_FIELDS::DIALOG_UPDATE_SYMBOL_FIELDS( SYMBOL_EDIT_FRAME* aPa
}
DIALOG_UPDATE_SYMBOL_FIELDS::~DIALOG_UPDATE_SYMBOL_FIELDS()
{
g_removeExtraLibFields = m_removeExtraBox->GetValue();
g_resetEmptyLibFields = m_resetEmptyFields->GetValue();
g_resetLibFieldText = m_resetFieldText->GetValue();
g_resetLibFieldVisibilities = m_resetFieldVisibilities->GetValue();
g_resetLibFieldEffects = m_resetFieldEffects->GetValue();
g_resetLibFieldPositions = m_resetFieldPositions->GetValue();
}
void DIALOG_UPDATE_SYMBOL_FIELDS::updateFieldsList()
{
// Load non-mandatory fields from the parent part

View File

@ -18,8 +18,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DIALOG_UPDATE_SYMBOL_FIELDS_H
#define DIALOG_UPDATE_SYMBOL_FIELDS_H
#pragma once
#include <dialog_update_symbol_fields_base.h>
#include <set>
@ -36,7 +35,7 @@ class DIALOG_UPDATE_SYMBOL_FIELDS : public DIALOG_UPDATE_SYMBOL_FIELDS_BASE
{
public:
DIALOG_UPDATE_SYMBOL_FIELDS( SYMBOL_EDIT_FRAME* aParent, LIB_SYMBOL* aSymbol );
~DIALOG_UPDATE_SYMBOL_FIELDS() override;
~DIALOG_UPDATE_SYMBOL_FIELDS() = default;
protected:
void onOkButtonClicked( wxCommandEvent& aEvent ) override;
@ -68,4 +67,3 @@ private:
std::map<FIELD_T, int> m_mandatoryFieldListIndexes;
};
#endif // DIALOG_UPDATE_SYMBOL_FIELDS_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!
@ -70,15 +70,19 @@ DIALOG_UPDATE_SYMBOL_FIELDS_BASE::DIALOG_UPDATE_SYMBOL_FIELDS_BASE( wxWindow* pa
m_updateOptionsSizer->Add( 0, 15, 0, wxEXPAND, 5 );
m_resetFieldText = new wxCheckBox( m_updateOptionsSizer->GetStaticBox(), wxID_ANY, _("Update/reset field text"), wxDefaultPosition, wxDefaultSize, 0 );
m_resetFieldText->SetValue(true);
m_updateOptionsSizer->Add( m_resetFieldText, 0, wxBOTTOM|wxRIGHT, 4 );
m_resetFieldVisibilities = new wxCheckBox( m_updateOptionsSizer->GetStaticBox(), wxID_ANY, _("Update/reset field visibilities"), wxDefaultPosition, wxDefaultSize, 0 );
m_resetFieldVisibilities->SetValue(true);
m_updateOptionsSizer->Add( m_resetFieldVisibilities, 0, wxBOTTOM|wxRIGHT, 4 );
m_resetFieldEffects = new wxCheckBox( m_updateOptionsSizer->GetStaticBox(), wxID_ANY, _("Update/reset field sizes and styles"), wxDefaultPosition, wxDefaultSize, 0 );
m_resetFieldEffects->SetValue(true);
m_updateOptionsSizer->Add( m_resetFieldEffects, 0, wxBOTTOM|wxRIGHT, 4 );
m_resetFieldPositions = new wxCheckBox( m_updateOptionsSizer->GetStaticBox(), wxID_ANY, _("Update/reset field positions"), wxDefaultPosition, wxDefaultSize, 0 );
m_resetFieldPositions->SetValue(true);
m_updateOptionsSizer->Add( m_resetFieldPositions, 0, wxBOTTOM|wxRIGHT, 4 );

File diff suppressed because it is too large Load Diff

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!
@ -20,17 +20,16 @@
#include <wx/textctrl.h>
#include <wx/sizer.h>
#include <wx/checklst.h>
#include <wx/button.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/button.h>
#include <wx/statbox.h>
#include <wx/checkbox.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_UPDATE_SYMBOL_FIELDS_BASE
///////////////////////////////////////////////////////////////////////////////
@ -57,7 +56,7 @@ class DIALOG_UPDATE_SYMBOL_FIELDS_BASE : public DIALOG_SHIM
wxButton* m_sdbSizerOK;
wxButton* m_sdbSizerCancel;
// Virtual event handlers, overide them in your derived class
// Virtual event handlers, override them in your derived class
virtual void onSelectAll( wxCommandEvent& event ) { event.Skip(); }
virtual void onSelectNone( wxCommandEvent& event ) { event.Skip(); }
virtual void onOkButtonClicked( wxCommandEvent& event ) { event.Skip(); }
@ -66,6 +65,7 @@ class DIALOG_UPDATE_SYMBOL_FIELDS_BASE : public DIALOG_SHIM
public:
DIALOG_UPDATE_SYMBOL_FIELDS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Update Symbol Fields"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_UPDATE_SYMBOL_FIELDS_BASE();
};

View File

@ -21,8 +21,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef DIALOG_PASTE_SPECIAL_H
#define DIALOG_PASTE_SPECIAL_H
#pragma once
#include <dialog_paste_special_base.h>
@ -44,8 +43,7 @@ class DIALOG_PASTE_SPECIAL : public DIALOG_PASTE_SPECIAL_BASE
{
public:
DIALOG_PASTE_SPECIAL( wxWindow* aParent, PASTE_MODE* aMode,
const wxString& aReplacement = wxS( "?" ) );
DIALOG_PASTE_SPECIAL( wxWindow* aParent, PASTE_MODE* aMode, const wxString& aReplacement = wxS( "?" ) );
bool TransferDataToWindow() override;
bool TransferDataFromWindow() override;
@ -68,4 +66,3 @@ private:
PASTE_MODE* m_mode;
};
#endif // DIALOG_PASTE_SPECIAL_H

View File

@ -38,21 +38,6 @@
#include <wx/fdrepdlg.h>
//Defined as global because these values have to survive the destructor
bool g_FindOptionCase = false;
bool g_FindOptionWords = false;
bool g_FindOptionWildcards = false;
bool g_FindOptionWrap = true;
bool g_FindIncludeTexts = true;
bool g_FindIncludeValues = true;
bool g_FindIncludeReferences = true;
bool g_FindIncludeHiddenFields = false;
bool g_FindIncludeMarkers = true;
bool g_FindIncludeNets = true;
DIALOG_FIND::DIALOG_FIND( PCB_EDIT_FRAME *aFrame ) :
DIALOG_FIND_BASE( aFrame, wxID_ANY, _( "Find" ) ),
m_frame( aFrame )
@ -73,18 +58,6 @@ DIALOG_FIND::DIALOG_FIND( PCB_EDIT_FRAME *aFrame ) :
m_searchCombo->SelectAll();
}
m_matchCase->SetValue( g_FindOptionCase );
m_matchWords->SetValue( g_FindOptionWords );
m_wildcards->SetValue( g_FindOptionWildcards );
m_wrap->SetValue( g_FindOptionWrap );
m_includeTexts->SetValue( g_FindIncludeTexts );
m_includeValues->SetValue( g_FindIncludeValues );
m_includeReferences->SetValue( g_FindIncludeReferences );
m_checkAllFields->SetValue( g_FindIncludeHiddenFields );
m_includeMarkers->SetValue( g_FindIncludeMarkers );
m_includeNets->SetValue( g_FindIncludeNets );
m_status->SetLabel( wxEmptyString);
m_upToDate = false;
@ -221,75 +194,19 @@ void DIALOG_FIND::search( bool aDirection )
m_frame->GetFindHistoryList().Insert( searchString, 0 );
}
if( g_FindOptionCase != m_matchCase->GetValue() )
{
g_FindOptionCase = m_matchCase->GetValue();
m_upToDate = false;
}
if( g_FindOptionWords != m_matchWords->GetValue() )
{
g_FindOptionWords = m_matchWords->GetValue();
m_upToDate = false;
}
if( g_FindOptionWildcards != m_wildcards->GetValue() )
{
g_FindOptionWildcards = m_wildcards->GetValue();
m_upToDate = false;
}
g_FindOptionWrap = m_wrap->GetValue();
if( g_FindIncludeTexts != m_includeTexts->GetValue() )
{
g_FindIncludeTexts = m_includeTexts->GetValue();
m_upToDate = false;
}
if( g_FindIncludeValues != m_includeValues->GetValue() )
{
g_FindIncludeValues = m_includeValues->GetValue();
m_upToDate = false;
}
if( g_FindIncludeReferences != m_includeReferences->GetValue() )
{
g_FindIncludeReferences = m_includeReferences->GetValue();
m_upToDate = false;
}
if( g_FindIncludeHiddenFields != m_checkAllFields->GetValue() )
{
g_FindIncludeHiddenFields = m_checkAllFields->GetValue();
m_upToDate = false;
}
if( g_FindIncludeMarkers != m_includeMarkers->GetValue() )
{
g_FindIncludeMarkers = m_includeMarkers->GetValue();
m_upToDate = false;
}
if( g_FindIncludeNets != m_includeNets->GetValue() )
{
g_FindIncludeNets = m_includeNets->GetValue();
m_upToDate = false;
}
EDA_SEARCH_DATA& frd = m_frame->GetFindReplaceData();
if( g_FindOptionCase )
if( m_matchCase->GetValue() )
frd.matchCase = true;
if( g_FindOptionWords )
if( m_matchWords->GetValue() )
frd.matchMode = EDA_SEARCH_MATCH_MODE::WHOLEWORD;
else if( g_FindOptionWildcards )
else if( m_wildcards->GetValue() )
frd.matchMode = EDA_SEARCH_MATCH_MODE::WILDCARD;
else
frd.matchMode = EDA_SEARCH_MATCH_MODE::PLAIN;
frd.searchAllFields = g_FindIncludeHiddenFields;
frd.searchAllFields = m_checkAllFields->GetValue();
// Search parameters
frd.findString = searchString;
@ -305,16 +222,16 @@ void DIALOG_FIND::search( bool aDirection )
m_status->SetLabel( _( "Searching..." ) );
m_hitList.clear();
if( g_FindIncludeTexts || g_FindIncludeValues || g_FindIncludeReferences )
if( m_includeTexts->GetValue() || m_includeValues->GetValue() || m_includeReferences->GetValue() )
{
for( FOOTPRINT* fp : board->Footprints() )
{
bool found = false;
if( g_FindIncludeReferences && fp->Reference().Matches( frd, nullptr ) )
if( m_includeReferences->GetValue() && fp->Reference().Matches( frd, nullptr ) )
found = true;
if( !found && g_FindIncludeValues && fp->Value().Matches( frd, nullptr ) )
if( !found && m_includeValues->GetValue() && fp->Value().Matches( frd, nullptr ) )
found = true;
if( !found && m_includeTexts->GetValue() )
@ -350,7 +267,7 @@ void DIALOG_FIND::search( bool aDirection )
m_hitList.push_back( fp );
}
if( g_FindIncludeTexts )
if( m_includeTexts->GetValue() )
{
for( BOARD_ITEM* item : board->Drawings() )
{
@ -373,7 +290,7 @@ void DIALOG_FIND::search( bool aDirection )
}
}
if( g_FindIncludeMarkers )
if( m_includeMarkers->GetValue() )
{
for( PCB_MARKER* marker : board->Markers() )
{
@ -382,7 +299,7 @@ void DIALOG_FIND::search( bool aDirection )
}
}
if( g_FindIncludeNets )
if( m_includeNets->GetValue() )
{
for( NETINFO_ITEM* net : board->GetNetInfo() )
{
@ -496,23 +413,6 @@ bool DIALOG_FIND::Show( bool show )
}
void DIALOG_FIND::OnClose( wxCloseEvent& aEvent )
{
g_FindOptionCase = m_matchCase->GetValue();
g_FindOptionWords = m_matchWords->GetValue();
g_FindOptionWildcards = m_wildcards->GetValue();
g_FindOptionWrap = m_wrap->GetValue();
g_FindIncludeTexts = m_includeTexts->GetValue();
g_FindIncludeValues = m_includeValues->GetValue();
g_FindIncludeMarkers = m_includeMarkers->GetValue();
g_FindIncludeReferences = m_includeReferences->GetValue();
g_FindIncludeNets = m_includeNets->GetValue();
aEvent.Skip();
}
void DIALOG_FIND::OnBoardChanged( wxCommandEvent& event )
{
m_board = m_frame->GetBoard();

View File

@ -23,8 +23,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef DIALOG_FIND_BASE_H
#define DIALOG_FIND_BASE_H
#pragma once
#include <functional>
#include <sys/types.h>
@ -82,7 +81,6 @@ public:
bool Show( bool show = true ) override;
protected:
void OnClose( wxCloseEvent& event ) override;
void OnCloseButtonClick( wxCommandEvent& aEvent ) override;
void OnBoardChanged( wxCommandEvent& event );
@ -93,15 +91,39 @@ private:
void onSearchAgainClick( wxCommandEvent& event ) override;
void onShowSearchPanel( wxHyperlinkEvent& event ) override;
void onOptionChanged( wxCommandEvent& aEvent ) override
{
m_upToDate = false;
aEvent.Skip();
}
void search( bool direction );
// BOARD_LISTENER implementation
void OnBoardItemAdded( BOARD&, BOARD_ITEM* ) override { m_upToDate = false; }
void OnBoardItemsAdded( BOARD&, std::vector<BOARD_ITEM*>& ) override { m_upToDate = false; }
void OnBoardItemRemoved( BOARD&, BOARD_ITEM* ) override { m_upToDate = false; }
void OnBoardItemsRemoved( BOARD&, std::vector<BOARD_ITEM*>& ) override { m_upToDate = false; }
void OnBoardItemChanged( BOARD&, BOARD_ITEM* ) override { m_upToDate = false; }
void OnBoardItemsChanged( BOARD&, std::vector<BOARD_ITEM*>& ) override { m_upToDate = false; }
void OnBoardItemAdded( BOARD&, BOARD_ITEM* ) override
{
m_upToDate = false;
}
void OnBoardItemsAdded( BOARD&, std::vector<BOARD_ITEM*>& ) override
{
m_upToDate = false;
}
void OnBoardItemRemoved( BOARD&, BOARD_ITEM* ) override
{
m_upToDate = false;
}
void OnBoardItemsRemoved( BOARD&, std::vector<BOARD_ITEM*>& ) override
{
m_upToDate = false;
}
void OnBoardItemChanged( BOARD&, BOARD_ITEM* ) override
{
m_upToDate = false;
}
void OnBoardItemsChanged( BOARD&, std::vector<BOARD_ITEM*>& ) override
{
m_upToDate = false;
}
void OnBoardCompositeUpdate( BOARD&, std::vector<BOARD_ITEM*>&,
std::vector<BOARD_ITEM*>&, std::vector<BOARD_ITEM*>& ) override
{
@ -109,13 +131,11 @@ private:
}
private:
PCB_EDIT_FRAME* m_frame;
BOARD* m_board;
std::deque<BOARD_ITEM*> m_hitList;
std::deque<BOARD_ITEM*>::iterator m_it;
bool m_upToDate;
PCB_EDIT_FRAME* m_frame;
BOARD* m_board;
std::deque<BOARD_ITEM*> m_hitList;
std::deque<BOARD_ITEM*>::iterator m_it;
bool m_upToDate;
std::function<void( BOARD_ITEM* )> m_highlightCallback;
};
#endif /* DIALOG_FIND_BASE_H */

View File

@ -158,7 +158,15 @@ DIALOG_FIND_BASE::DIALOG_FIND_BASE( wxWindow* parent, wxWindowID id, const wxStr
// Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_FIND_BASE::OnClose ) );
m_searchCombo->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_FIND_BASE::onTextEnter ), NULL, this );
m_checkAllFields->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::OnOptions ), NULL, this );
m_matchCase->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onOptionChanged ), NULL, this );
m_matchWords->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onOptionChanged ), NULL, this );
m_wildcards->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onOptionChanged ), NULL, this );
m_includeReferences->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onOptionChanged ), NULL, this );
m_includeMarkers->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onOptionChanged ), NULL, this );
m_includeValues->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onOptionChanged ), NULL, this );
m_includeNets->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onOptionChanged ), NULL, this );
m_checkAllFields->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onOptionChanged ), NULL, this );
m_includeTexts->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onOptionChanged ), NULL, this );
m_findNext->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onFindNextClick ), NULL, this );
m_findPrevious->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onFindPreviousClick ), NULL, this );
m_searchAgain->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onSearchAgainClick ), NULL, this );
@ -171,7 +179,15 @@ DIALOG_FIND_BASE::~DIALOG_FIND_BASE()
// Disconnect Events
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_FIND_BASE::OnClose ) );
m_searchCombo->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_FIND_BASE::onTextEnter ), NULL, this );
m_checkAllFields->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::OnOptions ), NULL, this );
m_matchCase->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onOptionChanged ), NULL, this );
m_matchWords->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onOptionChanged ), NULL, this );
m_wildcards->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onOptionChanged ), NULL, this );
m_includeReferences->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onOptionChanged ), NULL, this );
m_includeMarkers->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onOptionChanged ), NULL, this );
m_includeValues->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onOptionChanged ), NULL, this );
m_includeNets->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onOptionChanged ), NULL, this );
m_checkAllFields->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onOptionChanged ), NULL, this );
m_includeTexts->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onOptionChanged ), NULL, this );
m_findNext->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onFindNextClick ), NULL, this );
m_findPrevious->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onFindPreviousClick ), NULL, this );
m_searchAgain->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onSearchAgainClick ), NULL, this );

View File

@ -295,6 +295,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnCheckBox">onOptionChanged</event>
</object>
</object>
<object class="sizeritem" expanded="true">
@ -370,6 +371,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnCheckBox">onOptionChanged</event>
</object>
</object>
<object class="sizeritem" expanded="true">
@ -445,6 +447,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnCheckBox">onOptionChanged</event>
</object>
</object>
<object class="sizeritem" expanded="true">
@ -613,6 +616,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnCheckBox">onOptionChanged</event>
</object>
</object>
<object class="sizeritem" expanded="false">
@ -678,6 +682,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnCheckBox">onOptionChanged</event>
</object>
</object>
<object class="sizeritem" expanded="false">
@ -743,6 +748,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnCheckBox">onOptionChanged</event>
</object>
</object>
<object class="sizeritem" expanded="false">
@ -808,6 +814,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnCheckBox">onOptionChanged</event>
</object>
</object>
<object class="sizeritem" expanded="true">
@ -873,7 +880,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnCheckBox">OnOptions</event>
<event name="OnCheckBox">onOptionChanged</event>
</object>
</object>
<object class="sizeritem" expanded="true">
@ -949,6 +956,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnCheckBox">onOptionChanged</event>
</object>
</object>
</object>

View File

@ -60,7 +60,7 @@ class DIALOG_FIND_BASE : public DIALOG_SHIM
// Virtual event handlers, override them in your derived class
virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
virtual void onTextEnter( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOptions( wxCommandEvent& event ) { event.Skip(); }
virtual void onOptionChanged( wxCommandEvent& event ) { event.Skip(); }
virtual void onFindNextClick( wxCommandEvent& event ) { event.Skip(); }
virtual void onFindPreviousClick( wxCommandEvent& event ) { event.Skip(); }
virtual void onSearchAgainClick( wxCommandEvent& event ) { event.Skip(); }

View File

@ -52,23 +52,6 @@ static DRILL_PRECISION precisionListForInches( 2, 4 );
static DRILL_PRECISION precisionListForMetric( 3, 3 );
// Static members of DIALOG_GENDRILL
int DIALOG_GENDRILL::g_unitDrillIsInch = false; // Only for Excellon format
int DIALOG_GENDRILL::g_zerosFormat = EXCELLON_WRITER::DECIMAL_FORMAT;
bool DIALOG_GENDRILL::g_minimalHeader = false; // Only for Excellon format
bool DIALOG_GENDRILL::g_mirror = false; // Only for Excellon format
bool DIALOG_GENDRILL::g_merge_PTH_NPTH = false; // Only for Excellon format
bool DIALOG_GENDRILL::g_generateMap = false;
bool DIALOG_GENDRILL::g_generateTenting = false;
int DIALOG_GENDRILL::g_mapFileType = 4; // The last choice in m_Choice_Drill_Map
int DIALOG_GENDRILL::g_drillFileType = 0;
bool DIALOG_GENDRILL::g_useRouteModeForOvalHoles = true; // Use G00 route mode to "drill" oval
// holes
DRILL_PRECISION DIALOG_GENDRILL::g_precision;
VECTOR2I DIALOG_GENDRILL::g_drillFileOffset;
/* This function displays the dialog frame for drill tools
*/
int BOARD_EDITOR_CONTROL::GenerateDrillFiles( const TOOL_EVENT& aEvent )
@ -121,17 +104,11 @@ DIALOG_GENDRILL::DIALOG_GENDRILL( PCB_EDIT_FRAME* aPcbEditFrame, JOB_EXPORT_PCB_
}
DIALOG_GENDRILL::~DIALOG_GENDRILL()
{
}
bool DIALOG_GENDRILL::TransferDataFromWindow()
{
if( !m_job )
{
genDrillAndMapFiles( true, m_cbGenerateMap->GetValue(),
m_generateTentingLayers->GetValue() );
genDrillAndMapFiles( true, m_cbGenerateMap->GetValue(), m_generateTentingLayers->GetValue() );
// Keep the window open so that the user can see the result
return false;
}
@ -161,21 +138,32 @@ bool DIALOG_GENDRILL::TransferDataToWindow()
{
if( !m_job )
{
m_rbExcellon->SetValue( g_drillFileType == 0 );
m_rbGerberX2->SetValue( g_drillFileType == 1 );
m_units->SetSelection( g_unitDrillIsInch ? 1 : 0 );
m_zeros->SetSelection( g_zerosFormat );
if( PCBNEW_SETTINGS* cfg = m_pcbEditFrame->GetPcbNewSettings() )
{
m_Check_Merge_PTH_NPTH->SetValue( cfg->m_GenDrill.merge_pth_npth );
m_Check_Minimal->SetValue( cfg->m_GenDrill.minimal_header );
m_Check_Mirror->SetValue( cfg->m_GenDrill.mirror );
m_units->SetSelection( cfg->m_GenDrill.unit_drill_is_inch ? 1 : 0 );
m_altDrillMode->SetValue( !cfg->m_GenDrill.use_route_for_oval_holes );
m_rbExcellon->SetValue( cfg->m_GenDrill.drill_file_type == 0 );
m_rbGerberX2->SetValue( cfg->m_GenDrill.drill_file_type == 1 );
m_cbGenerateMap->SetValue( cfg->m_GenDrill.generate_map );
m_generateTentingLayers->SetValue( cfg->m_GenDrill.generate_tenting );
int zerosFormat = cfg->m_GenDrill.zeros_format;
if( zerosFormat >= 0 && zerosFormat < (int) m_zeros->GetCount() )
m_zeros->SetSelection( zerosFormat );
int mapFileType = cfg->m_GenDrill.map_file_type;
if( mapFileType >= 0 && mapFileType < (int) m_choiceDrillMap->GetCount() )
m_choiceDrillMap->SetSelection( mapFileType );
}
updatePrecisionOptions();
m_Check_Minimal->SetValue( g_minimalHeader );
m_origin->SetSelection( m_drillOriginIsAuxAxis ? 1 : 0 );
m_Check_Mirror->SetValue( g_mirror );
m_Check_Merge_PTH_NPTH->SetValue( g_merge_PTH_NPTH );
m_choiceDrillMap->SetSelection( g_mapFileType );
m_altDrillMode->SetValue( !g_useRouteModeForOvalHoles );
m_cbGenerateMap->SetValue( g_generateMap );
m_generateTentingLayers->SetValue( g_generateTenting );
m_origin->SetSelection( m_plotOpts.GetUseAuxOrigin() ? 1 : 0 );
// Output directory
m_outputDirectoryName->SetValue( m_plotOpts.GetOutputDirectory() );
@ -211,35 +199,11 @@ bool DIALOG_GENDRILL::TransferDataToWindow()
void DIALOG_GENDRILL::initDialog()
{
if( m_job )
{
SetTitle( m_job->GetSettingsDialogTitle() );
}
else
{
if( PCBNEW_SETTINGS* cfg = m_pcbEditFrame->GetPcbNewSettings() )
{
g_merge_PTH_NPTH = cfg->m_GenDrill.merge_pth_npth;
g_minimalHeader = cfg->m_GenDrill.minimal_header;
g_mirror = cfg->m_GenDrill.mirror;
g_unitDrillIsInch = cfg->m_GenDrill.unit_drill_is_inch;
g_useRouteModeForOvalHoles = cfg->m_GenDrill.use_route_for_oval_holes;
g_drillFileType = cfg->m_GenDrill.drill_file_type;
g_mapFileType = cfg->m_GenDrill.map_file_type;
g_zerosFormat = cfg->m_GenDrill.zeros_format;
g_generateMap = cfg->m_GenDrill.generate_map;
g_generateTenting = cfg->m_GenDrill.generate_tenting;
}
// Ensure validity of g_mapFileType
if( g_mapFileType < 0 || g_mapFileType >= (int) m_choiceDrillMap->GetCount() )
g_mapFileType = m_choiceDrillMap->GetCount() - 1; // last item in list = default = PDF
}
// DIALOG_SHIM needs a unique hash_key because classname will be the same for both job and
// non-job versions (which have different sizes).
m_hash_key = TO_UTF8( GetTitle() );
m_drillOriginIsAuxAxis = m_plotOpts.GetUseAuxOrigin();
}
@ -247,8 +211,6 @@ void DIALOG_GENDRILL::onFileFormatSelection( wxCommandEvent& event )
{
bool enbl_Excellon = m_rbExcellon->GetValue();
g_drillFileType = enbl_Excellon ? 0 : 1;
m_unitsLabel->Enable( enbl_Excellon );
m_units->Enable( enbl_Excellon );
m_zerosLabel->Enable( enbl_Excellon );
@ -275,20 +237,30 @@ void DIALOG_GENDRILL::onFileFormatSelection( wxCommandEvent& event )
void DIALOG_GENDRILL::updateConfig()
{
UpdateDrillParams();
// Set output directory and replace backslashes with forward ones
wxString dirStr = m_outputDirectoryName->GetValue();
dirStr.Replace( wxT( "\\" ), wxT( "/" ) );
m_plotOpts.SetOutputDirectory( dirStr );
m_plotOpts.SetUseAuxOrigin( m_origin->GetSelection() == 1 );
if( !m_plotOpts.IsSameAs( m_board->GetPlotOptions() ) )
{
m_board->SetPlotOptions( m_plotOpts );
m_pcbEditFrame->OnModify();
}
if( PCBNEW_SETTINGS* cfg = m_pcbEditFrame->GetPcbNewSettings() )
{
cfg->m_GenDrill.merge_pth_npth = g_merge_PTH_NPTH;
cfg->m_GenDrill.minimal_header = g_minimalHeader;
cfg->m_GenDrill.mirror = g_mirror;
cfg->m_GenDrill.unit_drill_is_inch = g_unitDrillIsInch;
cfg->m_GenDrill.use_route_for_oval_holes = g_useRouteModeForOvalHoles;
cfg->m_GenDrill.drill_file_type = g_drillFileType;
cfg->m_GenDrill.map_file_type = g_mapFileType;
cfg->m_GenDrill.zeros_format = g_zerosFormat;
cfg->m_GenDrill.generate_map = g_generateMap;
cfg->m_GenDrill.generate_tenting = g_generateTenting;
cfg->m_GenDrill.merge_pth_npth = m_Check_Merge_PTH_NPTH->IsChecked();
cfg->m_GenDrill.minimal_header = m_Check_Minimal->IsChecked();
cfg->m_GenDrill.mirror = m_Check_Mirror->IsChecked();
cfg->m_GenDrill.unit_drill_is_inch = ( m_units->GetSelection() == 0 ) ? false : true;
cfg->m_GenDrill.use_route_for_oval_holes = !m_altDrillMode->GetValue();
cfg->m_GenDrill.drill_file_type = m_rbExcellon->GetValue() ? 0 : 1;
cfg->m_GenDrill.map_file_type = m_choiceDrillMap->GetSelection();
cfg->m_GenDrill.zeros_format = m_zeros->GetSelection();
cfg->m_GenDrill.generate_map = m_cbGenerateMap->IsChecked();
cfg->m_GenDrill.generate_tenting = m_generateTentingLayers->IsChecked();
}
}
@ -355,8 +327,7 @@ void DIALOG_GENDRILL::onOutputDirectoryBrowseClicked( wxCommandEvent& event )
{
if( !dirName.MakeRelativeTo( defaultPath ) )
{
wxMessageBox( _( "Cannot make path relative (target volume different from board "
"file volume)!" ),
wxMessageBox( _( "Cannot make path relative (target volume different from board file volume)!" ),
_( "Plot Output Directory" ), wxOK | wxICON_ERROR );
}
}
@ -365,45 +336,6 @@ void DIALOG_GENDRILL::onOutputDirectoryBrowseClicked( wxCommandEvent& event )
}
void DIALOG_GENDRILL::UpdateDrillParams()
{
// Set output directory and replace backslashes with forward ones
wxString dirStr;
dirStr = m_outputDirectoryName->GetValue();
dirStr.Replace( wxT( "\\" ), wxT( "/" ) );
m_plotOpts.SetOutputDirectory( dirStr );
m_drillOriginIsAuxAxis = m_origin->GetSelection() == 1;
m_plotOpts.SetUseAuxOrigin( m_drillOriginIsAuxAxis );
g_mapFileType = m_choiceDrillMap->GetSelection();
g_unitDrillIsInch = ( m_units->GetSelection() == 0 ) ? false : true;
g_minimalHeader = m_Check_Minimal->IsChecked();
g_mirror = m_Check_Mirror->IsChecked();
g_merge_PTH_NPTH = m_Check_Merge_PTH_NPTH->IsChecked();
g_zerosFormat = m_zeros->GetSelection();
g_useRouteModeForOvalHoles = !m_altDrillMode->GetValue();
g_generateMap = m_cbGenerateMap->IsChecked();
g_generateTenting = m_generateTentingLayers->IsChecked();
if( m_origin->GetSelection() == 0 )
g_drillFileOffset = VECTOR2I( 0, 0 );
else
g_drillFileOffset = m_board->GetDesignSettings().GetAuxOrigin();
if( g_unitDrillIsInch )
g_precision = precisionListForInches;
else
g_precision = precisionListForMetric;
if( !m_plotOpts.IsSameAs( m_board->GetPlotOptions() ) )
{
m_board->SetPlotOptions( m_plotOpts );
m_pcbEditFrame->OnModify();
}
}
void DIALOG_GENDRILL::genDrillAndMapFiles( bool aGenDrill, bool aGenMap, bool aGenTenting )
{
updateConfig(); // set params and Save drill options
@ -444,25 +376,36 @@ void DIALOG_GENDRILL::genDrillAndMapFiles( bool aGenDrill, bool aGenMap, bool aG
if( !EnsureFileDirectoryExists( &outputDir, boardFilename, &reporter ) )
{
wxString msg;
msg.Printf( _( "Could not write drill and/or map files to folder '%s'." ),
outputDir.GetPath() );
DisplayError( this, msg );
DisplayError( this, wxString::Format( _( "Could not write drill and/or map files to folder '%s'." ),
outputDir.GetPath() ) );
return;
}
if( g_drillFileType == 0 )
VECTOR2I drillFileOffset;
DRILL_PRECISION precision;
if( m_origin->GetSelection() == 0 )
drillFileOffset = VECTOR2I( 0, 0 );
else
drillFileOffset = m_board->GetDesignSettings().GetAuxOrigin();
if( m_units->GetSelection() == 0 )
precision = precisionListForMetric;
else
precision = precisionListForInches;
if( m_rbExcellon->GetValue() )
{
EXCELLON_WRITER excellonWriter( m_board );
excellonWriter.SetFormat( !g_unitDrillIsInch, (EXCELLON_WRITER::ZEROS_FMT) g_zerosFormat,
g_precision.m_Lhs, g_precision.m_Rhs );
excellonWriter.SetOptions( g_mirror, g_minimalHeader, g_drillFileOffset, g_merge_PTH_NPTH );
excellonWriter.SetRouteModeForOvalHoles( g_useRouteModeForOvalHoles );
excellonWriter.SetFormat( m_units->GetSelection() == 0, (EXCELLON_WRITER::ZEROS_FMT) m_zeros->GetSelection(),
precision.m_Lhs, precision.m_Rhs );
excellonWriter.SetOptions( m_Check_Mirror->IsChecked(), m_Check_Minimal->IsChecked(), drillFileOffset,
m_Check_Merge_PTH_NPTH->IsChecked() );
excellonWriter.SetRouteModeForOvalHoles( !m_altDrillMode->GetValue() );
excellonWriter.SetMapFileFormat( filefmt[choice] );
excellonWriter.SetPageInfo( &m_board->GetPageSettings() );
excellonWriter.CreateDrillandMapFilesSet( outputDir.GetFullPath(), aGenDrill, aGenMap,
&reporter );
excellonWriter.CreateDrillandMapFilesSet( outputDir.GetFullPath(), aGenDrill, aGenMap, &reporter );
}
else
{
@ -471,12 +414,11 @@ void DIALOG_GENDRILL::genDrillAndMapFiles( bool aGenDrill, bool aGenMap, bool aG
// (SetFormat() accept 5 or 6, and any other value set the precision to 5)
// the integer part precision is always 4, and units always mm
gerberWriter.SetFormat( m_plotOpts.GetGerberPrecision() );
gerberWriter.SetOptions( g_drillFileOffset );
gerberWriter.SetOptions( drillFileOffset );
gerberWriter.SetMapFileFormat( filefmt[choice] );
gerberWriter.SetPageInfo( &m_board->GetPageSettings() );
gerberWriter.CreateDrillandMapFilesSet( outputDir.GetFullPath(), aGenDrill, aGenMap,
aGenTenting, &reporter );
gerberWriter.CreateDrillandMapFilesSet( outputDir.GetFullPath(), aGenDrill, aGenMap, aGenTenting, &reporter );
}
}
@ -506,10 +448,10 @@ void DIALOG_GENDRILL::onGenReportFile( wxCommandEvent& event )
// Info is slightly different between Excellon and Gerber
// (file ext, Merge PTH/NPTH option)
if( g_drillFileType == 0 )
if( m_rbExcellon->GetValue() == 0 )
{
EXCELLON_WRITER excellonWriter( m_board );
excellonWriter.SetMergeOption( g_merge_PTH_NPTH );
excellonWriter.SetMergeOption( m_Check_Merge_PTH_NPTH->IsChecked() );
success = excellonWriter.GenDrillReportFile( dlg.GetPath() );
}
else

View File

@ -22,8 +22,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef DIALOG_GENDRILL_H_
#define DIALOG_GENDRILL_H_
#pragma once
#include <gendrill_file_writer_base.h> // for DRILL_PRECISION definition
#include <dialog_gendrill_base.h>
@ -39,12 +38,7 @@ public:
*/
DIALOG_GENDRILL( PCB_EDIT_FRAME* aPcbEditFrame, wxWindow* aParent );
DIALOG_GENDRILL( PCB_EDIT_FRAME* aPcbEditFrame, JOB_EXPORT_PCB_DRILL* aJob, wxWindow* aParent );
~DIALOG_GENDRILL();
/**
* Update board drill/plot parameters
*/
void UpdateDrillParams();
~DIALOG_GENDRILL() = default;
bool TransferDataFromWindow() override;
bool TransferDataToWindow() override;
@ -75,9 +69,8 @@ private:
void onOutputDirectoryBrowseClicked( wxCommandEvent& event ) override;
// Specific functions:
/**
* Call the functions to create EXCELLON drill files and/or drill map files.
* Call to create EXCELLON drill files and/or drill map files.
*
* When all holes are through holes, only one excellon file is created. When there are
* some partial holes (some blind or buried vias), one excellon file is created, for all
@ -89,32 +82,9 @@ private:
void updatePrecisionOptions();
void updateConfig();
private:
static int g_unitDrillIsInch;
static int g_zerosFormat;
static bool g_minimalHeader;
static bool g_mirror;
static bool g_merge_PTH_NPTH;
static bool g_generateMap;
static bool g_generateTenting;
static DRILL_PRECISION g_precision; // Precision for drill files in non-decimal
// format
static VECTOR2I g_drillFileOffset; // Drill offset: 0,0 for absolute
// coordinates, or aux origin
static bool g_useRouteModeForOvalHoles; // True to use a G00 route command for
// oval holes; false to use a G85 canned
// mode for oval holes
private:
PCB_EDIT_FRAME* m_pcbEditFrame;
BOARD* m_board;
PCB_PLOT_PARAMS m_plotOpts;
JOB_EXPORT_PCB_DRILL* m_job;
bool m_drillOriginIsAuxAxis; // Axis selection (main / auxiliary)
// for drill origin coordinates
static int g_mapFileType; // format of map file: PS, PDF ...
static int g_drillFileType; // for Excellon, Gerber
};
#endif // DIALOG_GENDRILL_H_

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6-dirty)
// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -50,6 +50,7 @@ DIALOG_GENDRILL_BASE::DIALOG_GENDRILL_BASE( wxWindow* parent, wxWindowID id, con
bSizerMargins = new wxBoxSizer( wxVERTICAL );
m_rbExcellon = new wxRadioButton( this, wxID_ANY, _("Excellon"), wxDefaultPosition, wxDefaultSize, 0 );
m_rbExcellon->SetValue( true );
bSizerMargins->Add( m_rbExcellon, 0, wxALL, 5 );
wxFlexGridSizer* fgSizerExcellonOptions;
@ -109,7 +110,7 @@ DIALOG_GENDRILL_BASE::DIALOG_GENDRILL_BASE( wxWindow* parent, wxWindowID id, con
wxString m_choiceDrillMapChoices[] = { _("Postscript"), _("Gerber X2"), _("DXF"), _("SVG"), _("PDF") };
int m_choiceDrillMapNChoices = sizeof( m_choiceDrillMapChoices ) / sizeof( wxString );
m_choiceDrillMap = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceDrillMapNChoices, m_choiceDrillMapChoices, 0 );
m_choiceDrillMap->SetSelection( 0 );
m_choiceDrillMap->SetSelection( 4 );
bSizer9->Add( m_choiceDrillMap, 1, wxALL, 5 );

View File

@ -485,7 +485,7 @@
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value">0</property>
<property name="value">1</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
@ -1062,7 +1062,7 @@
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="selection">0</property>
<property name="selection">4</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6-dirty)
// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!

View File

@ -38,28 +38,9 @@
#include <tools/global_edit_tool.h>
#include "dialog_global_edit_teardrops_base.h"
enum TEARDROP_ACTION
{
REMOVE_TEARDROP_IN_SCOPE,
REMOVE_ALL_TEARDROPS,
ADD_TEARDROPS_DEFAULT,
ADD_TEARDROPS_WITH_SPEC_VALUES
};
// Globals to remember control settings during a session
static bool g_vias = true;
static bool g_pthPads = true;
static bool g_smdPads = true;
static bool g_trackToTrack = false;
static bool g_filterByNetclass;
// Globals to remember filters during a session
static wxString g_netclassFilter;
static bool g_filterByNet;
static wxString g_netFilter;
static bool g_filterByLayer;
static int g_layerFilter;
static bool g_filterRoundPads = false;
static bool g_filterSelected = false;
static int g_action = ADD_TEARDROPS_DEFAULT;
class DIALOG_GLOBAL_EDIT_TEARDROPS : public DIALOG_GLOBAL_EDIT_TEARDROPS_BASE
@ -181,27 +162,8 @@ DIALOG_GLOBAL_EDIT_TEARDROPS::DIALOG_GLOBAL_EDIT_TEARDROPS( PCB_EDIT_FRAME* aPar
DIALOG_GLOBAL_EDIT_TEARDROPS::~DIALOG_GLOBAL_EDIT_TEARDROPS()
{
g_vias = m_vias->GetValue();
g_pthPads = m_pthPads->GetValue();
g_smdPads = m_smdPads->GetValue();
g_trackToTrack = m_trackToTrack->GetValue();
g_filterByNetclass = m_netclassFilterOpt->GetValue();
g_netclassFilter = m_netclassFilter->GetStringSelection();
g_filterByNet = m_netFilterOpt->GetValue();
g_netFilter = m_netFilter->GetSelectedNetname();
g_filterByLayer = m_layerFilterOpt->GetValue();
g_layerFilter = m_layerFilter->GetLayerSelection();
g_filterRoundPads = m_roundPadsFilter->GetValue();
g_filterSelected = m_selectedItemsFilter->GetValue();
if( m_removeTeardrops->GetValue() )
g_action = REMOVE_TEARDROP_IN_SCOPE;
else if( m_removeAllTeardrops->GetValue() )
g_action = REMOVE_ALL_TEARDROPS;
else if( m_specifiedValues->GetValue() )
g_action = ADD_TEARDROPS_WITH_SPEC_VALUES;
else
g_action = ADD_TEARDROPS_DEFAULT;
m_netFilter->Disconnect( FILTERED_ITEM_SELECTED,
wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TEARDROPS::OnNetFilterSelect ),
@ -242,62 +204,13 @@ bool DIALOG_GLOBAL_EDIT_TEARDROPS::TransferDataToWindow()
{
BOARD_DESIGN_SETTINGS& bds = m_brd->GetDesignSettings();
g_vias = bds.m_TeardropParamsList.m_TargetVias;
g_pthPads = bds.m_TeardropParamsList.m_TargetPTHPads;
g_smdPads = bds.m_TeardropParamsList.m_TargetSMDPads;
g_trackToTrack = bds.m_TeardropParamsList.m_TargetTrack2Track;
m_vias->SetValue( bds.m_TeardropParamsList.m_TargetVias );
m_pthPads->SetValue( bds.m_TeardropParamsList.m_TargetPTHPads );
m_smdPads->SetValue( bds.m_TeardropParamsList.m_TargetSMDPads );
m_trackToTrack->SetValue( bds.m_TeardropParamsList.m_TargetTrack2Track );
#if 0 // I am not sure this is useful
g_filterRoundPads = bds.m_TeardropParamsList.m_UseRoundShapesOnly;
#endif
PCB_SELECTION_TOOL* selTool = m_parent->GetToolManager()->GetTool<PCB_SELECTION_TOOL>();
m_selection = selTool->GetSelection();
BOARD_CONNECTED_ITEM* item = dynamic_cast<BOARD_CONNECTED_ITEM*>( m_selection.Front() );
m_vias->SetValue( g_vias );
m_pthPads->SetValue( g_pthPads );
m_smdPads->SetValue( g_smdPads );
m_trackToTrack->SetValue( g_trackToTrack );
if( g_filterByNetclass && m_netclassFilter->SetStringSelection( g_netclassFilter ) )
m_netclassFilterOpt->SetValue( true );
else if( item )
m_netclassFilter->SetStringSelection( item->GetNet()->GetNetClass()->GetName() );
if( g_filterByNet && m_brd->FindNet( g_netFilter ) != nullptr )
{
m_netFilter->SetSelectedNet( g_netFilter );
m_netFilterOpt->SetValue( true );
}
else if( item )
{
m_netFilter->SetSelectedNetcode( item->GetNetCode() );
}
if( g_filterByLayer && m_layerFilter->SetLayerSelection( g_layerFilter ) != wxNOT_FOUND )
{
m_layerFilterOpt->SetValue( true );
}
else if( item )
{
if( item->Type() == PCB_ZONE_T ) // a zone can be on more than one layer
m_layerFilter->SetLayerSelection( static_cast<ZONE*>(item)->GetFirstLayer() );
else
m_layerFilter->SetLayerSelection( item->GetLayer() );
}
m_roundPadsFilter->SetValue( g_filterRoundPads );
m_selectedItemsFilter->SetValue( g_filterSelected );
if( g_action == REMOVE_TEARDROP_IN_SCOPE )
m_removeTeardrops->SetValue( true );
else if( g_action == REMOVE_ALL_TEARDROPS )
m_removeAllTeardrops->SetValue( true );
else if( g_action == ADD_TEARDROPS_DEFAULT )
m_addTeardrops->SetValue( true );
else //ADD_TEARDROPS_WITH_SPEC_VALUES
m_specifiedValues->SetValue( true );
m_netclassFilter->SetStringSelection( g_netclassFilter );
m_netFilter->SetSelectedNet( g_netFilter );
m_cbPreferZoneConnection->Set3StateValue( wxCHK_UNDETERMINED );
m_cbTeardropsUseNextTrack->Set3StateValue( wxCHK_UNDETERMINED );
@ -378,8 +291,7 @@ void DIALOG_GLOBAL_EDIT_TEARDROPS::processItem( BOARD_COMMIT* aCommit, BOARD_CON
}
void DIALOG_GLOBAL_EDIT_TEARDROPS::visitItem( BOARD_COMMIT* aCommit,
BOARD_CONNECTED_ITEM* aItem,
void DIALOG_GLOBAL_EDIT_TEARDROPS::visitItem( BOARD_COMMIT* aCommit, BOARD_CONNECTED_ITEM* aItem,
bool aSelectAlways )
{
if( m_selectedItemsFilter->GetValue() )

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf)
// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -114,21 +114,22 @@ DIALOG_GLOBAL_EDIT_TEARDROPS_BASE::DIALOG_GLOBAL_EDIT_TEARDROPS_BASE( wxWindow*
m_removeTeardrops = new wxRadioButton( sbAction->GetStaticBox(), wxID_ANY, _("Remove teardrops"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
m_removeTeardrops->SetToolTip( _("Remove teardrops according to filtering options") );
sbAction->Add( m_removeTeardrops, 0, wxBOTTOM|wxRIGHT, 5 );
sbAction->Add( m_removeTeardrops, 0, wxBOTTOM|wxRIGHT, 10 );
m_removeAllTeardrops = new wxRadioButton( sbAction->GetStaticBox(), wxID_ANY, _("Remove all teardrops"), wxDefaultPosition, wxDefaultSize, 0 );
m_removeAllTeardrops->SetToolTip( _("Remove all teardrops, regardless of filtering options") );
sbAction->Add( m_removeAllTeardrops, 0, wxBOTTOM|wxRIGHT, 5 );
sbAction->Add( m_removeAllTeardrops, 0, wxBOTTOM|wxRIGHT, 10 );
wxBoxSizer* bSizer12;
bSizer12 = new wxBoxSizer( wxHORIZONTAL );
m_addTeardrops = new wxRadioButton( sbAction->GetStaticBox(), wxID_ANY, _("Add teardrops with default values for shape"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer12->Add( m_addTeardrops, 1, wxALIGN_CENTER_VERTICAL|wxTOP, 5 );
m_addTeardrops->SetValue( true );
bSizer12->Add( m_addTeardrops, 1, wxALIGN_CENTER_VERTICAL, 5 );
m_boardSetupLink = new wxHyperlinkCtrl( sbAction->GetStaticBox(), wxID_ANY, _("Edit default values in Board Setup"), wxT("#teardrops"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE );
bSizer12->Add( m_boardSetupLink, 1, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 10 );
bSizer12->Add( m_boardSetupLink, 1, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 10 );
sbAction->Add( bSizer12, 0, wxEXPAND|wxBOTTOM, 15 );

View File

@ -1,34 +1,36 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="17"/>
<FileVersion major="1" minor="18"/>
<object class="Project" expanded="true">
<property name="class_decoration">; </property>
<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_global_edit_teardrops_base</property>
<property name="first_id">6000</property>
<property name="help_provider">none</property>
<property name="image_path_wrapper_function_name"></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_global_edit_teardrops_base</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_array_enum">0</property>
<property name="use_enum">0</property>
<property name="use_microsoft_bom">0</property>
<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>
@ -1039,7 +1041,7 @@
<property name="parent">1</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="border">10</property>
<property name="flag">wxBOTTOM|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxRadioButton" expanded="true">
@ -1104,7 +1106,7 @@
</object>
</object>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="border">10</property>
<property name="flag">wxBOTTOM|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxRadioButton" expanded="true">
@ -1179,7 +1181,7 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxTOP</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">1</property>
<object class="wxRadioButton" expanded="true">
<property name="BottomDockable">1</property>
@ -1236,7 +1238,7 @@
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value">0</property>
<property name="value">1</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
@ -1244,7 +1246,7 @@
</object>
<object class="sizeritem" expanded="true">
<property name="border">10</property>
<property name="flag">wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT</property>
<property name="proportion">1</property>
<object class="wxHyperlinkCtrl" expanded="true">
<property name="BottomDockable">1</property>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf)
// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -37,7 +37,6 @@ class PCB_LAYER_BOX_SELECTOR;
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_GLOBAL_EDIT_TEARDROPS_BASE
///////////////////////////////////////////////////////////////////////////////

View File

@ -65,36 +65,12 @@ enum
};
static bool g_modifyReferences;
static bool g_modifyValues;
static bool g_modifyOtherFootprintFields;
static bool g_modifyFootprintGraphics;
static bool g_modifyFootprintDimensions;
static bool g_modifyFootprintTexts;
static bool g_modifyBoardText;
static bool g_modifyBoardGraphics;
static bool g_filterByLayer;
static int g_layerFilter;
static bool g_filterByReference;
static wxString g_referenceFilter;
static bool g_filterByFootprint;
static wxString g_footprintFilter;
static bool g_filterSelected = false;
static bool g_setToSpecifiedValues = true;
class DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS : public DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE
{
PCB_BASE_EDIT_FRAME* m_parent;
BOARD_DESIGN_SETTINGS* m_brdSettings;
PCB_SELECTION m_selection;
bool m_isBoardEditor;
UNIT_BINDER m_lineWidth;
UNIT_BINDER m_textWidth;
UNIT_BINDER m_textHeight;
UNIT_BINDER m_thickness;
public:
DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS( PCB_BASE_EDIT_FRAME* parent );
~DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS() override;
@ -122,6 +98,17 @@ protected:
void visitItem( BOARD_COMMIT& aCommit, BOARD_ITEM* aItem );
void processItem( BOARD_COMMIT& aCommit, BOARD_ITEM* aItem );
private:
PCB_BASE_EDIT_FRAME* m_parent;
BOARD_DESIGN_SETTINGS* m_brdSettings;
PCB_SELECTION m_selection;
bool m_isBoardEditor;
UNIT_BINDER m_lineWidth;
UNIT_BINDER m_textWidth;
UNIT_BINDER m_textHeight;
UNIT_BINDER m_thickness;
};
@ -165,11 +152,6 @@ DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS( PCB_
m_grid->SetDefaultCellFont( KIUI::GetInfoFont( this ) );
m_grid->SetDefaultRowSize( m_grid->GetDefaultRowSize() - FromDIP( 2 ) );
if( g_setToSpecifiedValues == true )
m_setToSpecifiedValues->SetValue( true );
else
m_setToLayerDefaults->SetValue( true );
SetupStandardButtons( { { wxID_OK, _( "Apply and Close" ) },
{ wxID_CANCEL, _( "Close" ) } } );
@ -179,32 +161,11 @@ DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS( PCB_
DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::~DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS()
{
g_modifyReferences = m_references->GetValue();
g_modifyValues = m_values->GetValue();
g_modifyOtherFootprintFields = m_otherFootprintFields->GetValue();
g_modifyFootprintGraphics = m_footprintGraphics->GetValue();
g_modifyFootprintDimensions = m_footprintDimensions->GetValue();
g_modifyFootprintTexts = m_footprintTexts->GetValue();
if( m_isBoardEditor )
{
g_modifyBoardText = m_boardText->GetValue();
g_modifyBoardGraphics = m_boardGraphics->GetValue();
}
g_filterByLayer = m_layerFilterOpt->GetValue();
g_layerFilter = m_layerFilter->GetLayerSelection();
if( m_isBoardEditor )
{
g_filterByReference = m_referenceFilterOpt->GetValue();
g_referenceFilter = m_referenceFilter->GetValue();
g_filterByFootprint = m_footprintFilterOpt->GetValue();
g_footprintFilter = m_footprintFilter->GetValue();
}
g_filterSelected = m_selectedItemsFilter->GetValue();
g_setToSpecifiedValues = m_setToSpecifiedValues->GetValue();
}
@ -213,33 +174,13 @@ bool DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataToWindow()
PCB_SELECTION_TOOL* selTool = m_parent->GetToolManager()->GetTool<PCB_SELECTION_TOOL>();
m_selection = selTool->GetSelection();
m_references->SetValue( g_modifyReferences );
m_values->SetValue( g_modifyValues );
m_otherFootprintFields->SetValue( g_modifyOtherFootprintFields );
m_footprintGraphics->SetValue( g_modifyFootprintGraphics );
m_footprintDimensions->SetValue( g_modifyFootprintDimensions );
m_footprintTexts->SetValue( g_modifyFootprintTexts );
if( m_isBoardEditor )
{
m_boardText->SetValue( g_modifyBoardText );
m_boardGraphics->SetValue( g_modifyBoardGraphics );
}
if( m_layerFilter->SetLayerSelection( g_layerFilter ) != wxNOT_FOUND )
m_layerFilterOpt->SetValue( g_filterByLayer );
if( m_isBoardEditor )
{
// SetValue() generates events, ChangeValue() does not
m_referenceFilter->ChangeValue( g_referenceFilter );
m_referenceFilterOpt->SetValue( g_filterByReference );
m_footprintFilter->ChangeValue( g_footprintFilter );
m_footprintFilterOpt->SetValue( g_filterByFootprint );
}
m_selectedItemsFilter->SetValue( g_filterSelected );
m_lineWidth.SetValue( INDETERMINATE_ACTION );
m_fontCtrl->Append( INDETERMINATE_ACTION );
@ -380,13 +321,13 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem( BOARD_COMMIT& aCommit, B
if( text )
{
if( !m_textWidth.IsIndeterminate() )
text->SetTextSize( VECTOR2I( m_textWidth.GetValue(), text->GetTextSize().y ) );
text->SetTextSize( VECTOR2I( m_textWidth.GetIntValue(), text->GetTextSize().y ) );
if( !m_textHeight.IsIndeterminate() )
text->SetTextSize( VECTOR2I( text->GetTextSize().x, m_textHeight.GetValue() ) );
text->SetTextSize( VECTOR2I( text->GetTextSize().x, m_textHeight.GetIntValue() ) );
if( !m_thickness.IsIndeterminate() )
text->SetTextThickness( m_thickness.GetValue() );
text->SetTextThickness( m_thickness.GetIntValue() );
// Must be after SetTextSize()
if( m_bold->Get3StateValue() != wxCHK_UNDETERMINED )
@ -432,12 +373,12 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem( BOARD_COMMIT& aCommit, B
if( shape )
{
STROKE_PARAMS stroke = shape->GetStroke();
stroke.SetWidth( m_lineWidth.GetValue() );
stroke.SetWidth( m_lineWidth.GetIntValue() );
shape->SetStroke( stroke );
}
if( dimension )
dimension->SetLineThickness( m_lineWidth.GetValue() );
dimension->SetLineThickness( m_lineWidth.GetIntValue() );
}
}
else

View File

@ -53,20 +53,8 @@ enum {
// Globals to remember control settings during a session
static bool g_modifyTracks = true;
static bool g_modifyVias = true;
static bool g_filterByNetclass;
static wxString g_netclassFilter;
static bool g_filterByNet;
static wxString g_netFilter;
static bool g_filterByLayer;
static int g_layerFilter;
static bool g_filterByTrackWidth = false;
static int g_trackWidthFilter = 0;
static bool g_filterByViaSize = false;
static int g_viaSizeFilter = 0;
static bool g_filterSelected = false;
static bool g_setToSpecifiedValues = true;
DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS( PCB_EDIT_FRAME* aParent ) :
@ -91,11 +79,6 @@ DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS( PCB_EDIT
m_layerCtrl->SetUndefinedLayerName( INDETERMINATE_ACTION );
m_layerCtrl->Resync();
if( g_setToSpecifiedValues == true )
m_setToSpecifiedValues->SetValue( true );
else
m_setToDesignRuleValues->SetValue( true );
SetupStandardButtons( { { wxID_OK, _( "Apply and Close" ) },
{ wxID_CANCEL, _( "Close" ) } } );
@ -103,8 +86,7 @@ DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS( PCB_EDIT
wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::OnNetFilterSelect ),
nullptr, this );
m_parent->Bind( EDA_EVT_UNITS_CHANGED, &DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::onUnitsChanged,
this );
m_parent->Bind( EDA_EVT_UNITS_CHANGED, &DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::onUnitsChanged, this );
finishDialogSettings();
}
@ -112,27 +94,14 @@ DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS( PCB_EDIT
DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::~DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS()
{
g_modifyTracks = m_tracks->GetValue();
g_modifyVias = m_vias->GetValue();
g_filterByNetclass = m_netclassFilterOpt->GetValue();
g_netclassFilter = m_netclassFilter->GetStringSelection();
g_filterByNet = m_netFilterOpt->GetValue();
g_netFilter = m_netFilter->GetSelectedNetname();
g_filterByLayer = m_layerFilterOpt->GetValue();
g_layerFilter = m_layerFilter->GetLayerSelection();
g_filterByTrackWidth = m_filterByTrackWidth->GetValue();
g_trackWidthFilter = m_trackWidthFilter.GetIntValue();
g_filterByViaSize = m_filterByViaSize->GetValue();
g_viaSizeFilter = m_viaSizeFilter.GetIntValue();
g_filterSelected = m_selectedItemsFilter->GetValue();
g_setToSpecifiedValues = m_setToSpecifiedValues->GetValue();
m_netFilter->Disconnect( FILTERED_ITEM_SELECTED,
wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::OnNetFilterSelect ),
nullptr, this );
m_parent->Unbind( EDA_EVT_UNITS_CHANGED,
&DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::onUnitsChanged, this );
m_parent->Unbind( EDA_EVT_UNITS_CHANGED, &DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::onUnitsChanged, this );
}
@ -184,63 +153,16 @@ void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::buildFilterLists()
bool DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::TransferDataToWindow()
{
PCB_SELECTION_TOOL* selTool = m_parent->GetToolManager()->GetTool<PCB_SELECTION_TOOL>();
m_selection = selTool->GetSelection();
BOARD_CONNECTED_ITEM* item = dynamic_cast<BOARD_CONNECTED_ITEM*>( m_selection.Front() );
m_netclassFilter->SetStringSelection( g_netclassFilter );
m_tracks->SetValue( g_modifyTracks );
m_vias->SetValue( g_modifyVias );
if( g_filterByNetclass && m_netclassFilter->SetStringSelection( g_netclassFilter ) )
{
m_netclassFilterOpt->SetValue( true );
}
else if( item )
{
m_netclassFilter->SetStringSelection( item->GetNet()->GetNetClass()->GetName() );
}
if( g_filterByNet && m_brd->FindNet( g_netFilter ) != nullptr )
{
if( m_brd->FindNet( g_netFilter ) != nullptr )
m_netFilter->SetSelectedNet( g_netFilter );
m_netFilterOpt->SetValue( true );
}
else if( item )
{
m_netFilter->SetSelectedNetcode( item->GetNetCode() );
}
if( g_filterByLayer && m_layerFilter->SetLayerSelection( g_layerFilter ) != wxNOT_FOUND )
{
m_layerFilterOpt->SetValue( true );
}
else if( item )
{
if( item->Type() == PCB_ZONE_T ) // a zone can be on more than one layer
m_layerFilter->SetLayerSelection( static_cast<ZONE*>(item)->GetFirstLayer() );
else
m_layerFilter->SetLayerSelection( item->GetLayer() );
}
if( g_filterByTrackWidth )
{
m_filterByTrackWidth->SetValue( true );
m_trackWidthFilter.SetValue( g_trackWidthFilter );
}
if( g_filterByViaSize )
{
m_filterByViaSize->SetValue( true );
m_viaSizeFilter.SetValue( g_viaSizeFilter );
}
m_trackWidthCtrl->SetSelection( (int) m_trackWidthCtrl->GetCount() - 1 );
m_viaSizesCtrl->SetSelection( (int) m_viaSizesCtrl->GetCount() - 1 );
m_annularRingsCtrl->SetSelection( (int) m_annularRingsCtrl->GetCount() - 1 );
m_layerCtrl->SetStringSelection( INDETERMINATE_ACTION );
m_selectedItemsFilter->SetValue( g_filterSelected );
wxCommandEvent dummy;
onActionButtonChange( dummy );
@ -264,8 +186,7 @@ void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::onActionButtonChange( wxCommandEvent& e
}
void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::processItem( PICKED_ITEMS_LIST* aUndoList,
PCB_TRACK* aItem )
void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::processItem( PICKED_ITEMS_LIST* aUndoList, PCB_TRACK* aItem )
{
BOARD_DESIGN_SETTINGS& brdSettings = m_brd->GetDesignSettings();
bool isTrack = aItem->Type() == PCB_TRACE_T;

View File

@ -40,6 +40,10 @@ protected:
{
m_netclassFilterOpt->SetValue( true );
}
void OnNetFilterSelect( wxCommandEvent& event )
{
m_netFilterOpt->SetValue( true );
}
void OnLayerFilterSelect( wxCommandEvent& event ) override
{
m_layerFilterOpt->SetValue( true );
@ -62,11 +66,6 @@ private:
bool TransferDataToWindow() override;
bool TransferDataFromWindow() override;
void OnNetFilterSelect( wxCommandEvent& event )
{
m_netFilterOpt->SetValue( true );
}
void buildFilterLists();
private: