2019-06-30 22:06:34 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2019 KiCad Developers, see AUTHORS.txt for contributors.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2020-01-13 01:44:19 +00:00
|
|
|
#include <connection_graph.h>
|
|
|
|
#include <dialog_global_edit_text_and_graphics_base.h>
|
2019-06-30 22:06:34 +00:00
|
|
|
#include <fctsys.h>
|
|
|
|
#include <kicad_string.h>
|
|
|
|
#include <sch_component.h>
|
|
|
|
#include <sch_connection.h>
|
2020-01-13 01:44:19 +00:00
|
|
|
#include <sch_edit_frame.h>
|
|
|
|
#include <sch_line.h>
|
2019-06-30 22:06:34 +00:00
|
|
|
#include <sch_sheet.h>
|
2020-05-13 02:00:37 +00:00
|
|
|
#include <schematic.h>
|
2019-06-30 22:06:34 +00:00
|
|
|
#include <advanced_config.h>
|
2020-01-13 01:44:19 +00:00
|
|
|
#include <tool/tool_manager.h>
|
|
|
|
#include <tools/ee_selection_tool.h>
|
|
|
|
#include <tools/sch_edit_tool.h>
|
|
|
|
#include <widgets/unit_binder.h>
|
2019-06-30 22:06:34 +00:00
|
|
|
|
|
|
|
static bool g_modifyReferences;
|
|
|
|
static bool g_modifyValues;
|
|
|
|
static bool g_modifyOtherFields;
|
|
|
|
static bool g_modifyWires;
|
2020-04-02 13:58:35 +00:00
|
|
|
static bool g_modifyBuses;
|
2019-06-30 22:06:34 +00:00
|
|
|
static bool g_modifyGlobalLabels;
|
|
|
|
static bool g_modifyHierLabels;
|
|
|
|
static bool g_modifySheetTitles;
|
2020-04-02 12:57:07 +00:00
|
|
|
static bool g_modifyOtherSheetFields;
|
2019-06-30 22:06:34 +00:00
|
|
|
static bool g_modifySheetPins;
|
2020-04-02 12:57:07 +00:00
|
|
|
static bool g_modifySheetBorders;
|
2019-06-30 22:06:34 +00:00
|
|
|
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;
|
2020-05-06 21:56:18 +00:00
|
|
|
static bool g_filterByType;
|
|
|
|
static bool g_typeFilterIsPower;
|
2019-06-30 22:06:34 +00:00
|
|
|
static bool g_filterByNet;
|
|
|
|
static wxString g_netFilter;
|
|
|
|
|
|
|
|
|
|
|
|
class DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS : public DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE
|
|
|
|
{
|
|
|
|
SCH_EDIT_FRAME* m_parent;
|
|
|
|
|
|
|
|
UNIT_BINDER m_textSize;
|
|
|
|
UNIT_BINDER m_lineWidth;
|
|
|
|
|
2020-02-04 13:01:06 +00:00
|
|
|
bool m_hasChange;
|
|
|
|
|
2019-06-30 22:06:34 +00:00
|
|
|
public:
|
|
|
|
DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS( SCH_EDIT_FRAME* parent );
|
|
|
|
~DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS() override;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void OnUpdateUI( wxUpdateUIEvent& event ) override;
|
|
|
|
void OnReferenceFilterText( wxCommandEvent& event ) override
|
|
|
|
{
|
|
|
|
m_referenceFilterOpt->SetValue( true );
|
|
|
|
}
|
|
|
|
void OnSymbolFilterText( wxCommandEvent& event ) override
|
|
|
|
{
|
|
|
|
m_symbolFilterOpt->SetValue( true );
|
|
|
|
}
|
|
|
|
|
|
|
|
bool TransferDataToWindow() override;
|
|
|
|
bool TransferDataFromWindow() override;
|
|
|
|
|
|
|
|
void visitItem( const SCH_SHEET_PATH& aSheetPath, SCH_ITEM* aItem );
|
|
|
|
void processItem( const SCH_SHEET_PATH& aSheetPath, SCH_ITEM* aItem );
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS( SCH_EDIT_FRAME* parent ) :
|
|
|
|
DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE( parent ),
|
|
|
|
m_textSize( parent, m_textSizeLabel, m_textSizeCtrl, m_textSizeUnits, true ),
|
|
|
|
m_lineWidth( parent, m_lineWidthLabel, m_LineWidthCtrl, m_lineWidthUnits, true )
|
|
|
|
{
|
|
|
|
m_parent = parent;
|
2020-02-04 13:01:06 +00:00
|
|
|
m_hasChange = false;
|
2019-06-30 22:06:34 +00:00
|
|
|
|
|
|
|
// TODO(JE) remove once real-time connectivity is a given
|
|
|
|
if( !ADVANCED_CFG::GetCfg().m_realTimeConnectivity || !CONNECTION_GRAPH::m_allowRealTime )
|
2019-11-10 23:24:27 +00:00
|
|
|
m_parent->RecalculateConnections( NO_CLEANUP );
|
2019-06-30 22:06:34 +00:00
|
|
|
|
|
|
|
m_sdbSizerButtonsOK->SetDefault();
|
|
|
|
|
|
|
|
FinishDialogSettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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();
|
2020-04-02 13:58:35 +00:00
|
|
|
g_modifyBuses = m_buses->GetValue();
|
2019-06-30 22:06:34 +00:00
|
|
|
g_modifyGlobalLabels = m_globalLabels->GetValue();
|
|
|
|
g_modifyHierLabels = m_hierLabels->GetValue();
|
|
|
|
g_modifySheetTitles = m_sheetTitles->GetValue();
|
2020-04-02 12:57:07 +00:00
|
|
|
g_modifyOtherSheetFields = m_sheetFields->GetValue();
|
2019-06-30 22:06:34 +00:00
|
|
|
g_modifySheetPins = m_sheetPins->GetValue();
|
2020-04-02 12:57:07 +00:00
|
|
|
g_modifySheetBorders = m_sheetBorders->GetValue();
|
2019-06-30 22:06:34 +00:00
|
|
|
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();
|
2020-05-06 21:56:18 +00:00
|
|
|
g_filterByType = m_typeFilterOpt->GetValue();
|
|
|
|
g_typeFilterIsPower = m_typeFilter->GetSelection() == 1;
|
2019-06-30 22:06:34 +00:00
|
|
|
g_filterByNet = m_netFilterOpt->GetValue();
|
|
|
|
g_netFilter = m_netFilter->GetValue();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataToWindow()
|
|
|
|
{
|
|
|
|
EE_SELECTION_TOOL* selectionTool = m_parent->GetToolManager()->GetTool<EE_SELECTION_TOOL>();
|
|
|
|
SELECTION& selection = selectionTool->GetSelection();
|
|
|
|
|
|
|
|
m_references->SetValue( g_modifyReferences );
|
|
|
|
m_values->SetValue( g_modifyValues );
|
|
|
|
m_otherFields->SetValue( g_modifyOtherFields );
|
|
|
|
m_wires->SetValue( g_modifyWires );
|
2020-04-02 13:58:35 +00:00
|
|
|
m_buses->SetValue( g_modifyBuses );
|
2019-06-30 22:06:34 +00:00
|
|
|
m_globalLabels->SetValue( g_modifyGlobalLabels );
|
|
|
|
m_hierLabels->SetValue( g_modifyHierLabels );
|
|
|
|
m_sheetTitles->SetValue( g_modifySheetTitles );
|
2020-04-02 12:57:07 +00:00
|
|
|
m_sheetFields->SetValue( g_modifyOtherSheetFields );
|
2019-06-30 22:06:34 +00:00
|
|
|
m_sheetPins->SetValue( g_modifySheetPins );
|
2020-04-02 12:57:07 +00:00
|
|
|
m_sheetBorders->SetValue( g_modifySheetBorders );
|
2019-06-30 22:06:34 +00:00
|
|
|
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 );
|
2020-05-06 21:56:18 +00:00
|
|
|
m_typeFilter->SetSelection( g_typeFilterIsPower ? 1 : 0 );
|
|
|
|
m_typeFilterOpt->SetValue( g_filterByType );
|
2019-06-30 22:06:34 +00:00
|
|
|
|
|
|
|
if( g_filterByNet && !g_netFilter.IsEmpty() )
|
|
|
|
{
|
|
|
|
m_netFilter->SetValue( g_netFilter );
|
|
|
|
m_netFilterOpt->SetValue( true );
|
|
|
|
}
|
2020-05-24 14:46:05 +00:00
|
|
|
else if( m_parent->GetHighlightedConnection() )
|
2019-06-30 22:06:34 +00:00
|
|
|
{
|
2020-05-24 14:46:05 +00:00
|
|
|
m_netFilter->SetValue( m_parent->GetHighlightedConnection()->Name() );
|
2019-06-30 22:06:34 +00:00
|
|
|
}
|
|
|
|
else if( selection.GetSize() )
|
|
|
|
{
|
|
|
|
SCH_ITEM* sch_item = (SCH_ITEM*) selection.Front();
|
2020-05-13 02:00:37 +00:00
|
|
|
SCH_CONNECTION* connection = sch_item->Connection( m_parent->GetCurrentSheet() );
|
2019-06-30 22:06:34 +00:00
|
|
|
|
|
|
|
if( connection )
|
|
|
|
m_netFilter->SetValue( connection->Name() );
|
|
|
|
}
|
|
|
|
|
|
|
|
m_netFilterOpt->SetValue( g_filterByNet );
|
|
|
|
|
2020-05-05 15:40:18 +00:00
|
|
|
m_textSize.SetValue( INDETERMINATE_ACTION );
|
|
|
|
m_orientation->SetStringSelection( INDETERMINATE_ACTION );
|
|
|
|
m_hAlign->SetStringSelection( INDETERMINATE_ACTION );
|
|
|
|
m_vAlign->SetStringSelection( INDETERMINATE_ACTION );
|
2019-06-30 22:06:34 +00:00
|
|
|
m_Italic->Set3StateValue( wxCHK_UNDETERMINED );
|
|
|
|
m_Bold->Set3StateValue( wxCHK_UNDETERMINED );
|
|
|
|
m_Visible->Set3StateValue( wxCHK_UNDETERMINED );
|
2020-05-05 15:40:18 +00:00
|
|
|
m_lineWidth.SetValue( INDETERMINATE_ACTION );
|
|
|
|
m_lineStyle->SetStringSelection( INDETERMINATE_ACTION );
|
2019-07-02 13:51:48 +00:00
|
|
|
m_setColor->SetValue( false );
|
2020-04-02 12:57:07 +00:00
|
|
|
m_setBgColor->SetValue( false );
|
2019-06-30 22:06:34 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::OnUpdateUI( wxUpdateUIEvent& )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem( const SCH_SHEET_PATH& aSheetPath,
|
|
|
|
SCH_ITEM* aItem )
|
|
|
|
{
|
|
|
|
auto eda_text = dynamic_cast<EDA_TEXT*>( aItem );
|
|
|
|
auto sch_text = dynamic_cast<SCH_TEXT*>( aItem );
|
|
|
|
auto lineItem = dynamic_cast<SCH_LINE*>( aItem );
|
|
|
|
|
2020-05-30 23:01:24 +00:00
|
|
|
m_parent->SaveCopyInUndoList( aItem, UR_CHANGED, m_hasChange );
|
|
|
|
|
2019-06-30 22:06:34 +00:00
|
|
|
if( eda_text )
|
|
|
|
{
|
|
|
|
if( !m_textSize.IsIndeterminate() )
|
2020-02-04 13:01:06 +00:00
|
|
|
{
|
2019-06-30 22:06:34 +00:00
|
|
|
eda_text->SetTextSize( wxSize( m_textSize.GetValue(), m_textSize.GetValue() ) );
|
2020-02-04 13:01:06 +00:00
|
|
|
m_hasChange = true;
|
|
|
|
}
|
2019-06-30 22:06:34 +00:00
|
|
|
|
2020-05-05 15:40:18 +00:00
|
|
|
if( m_hAlign->GetStringSelection() != INDETERMINATE_ACTION )
|
2020-02-04 13:01:06 +00:00
|
|
|
{
|
2019-06-30 22:06:34 +00:00
|
|
|
eda_text->SetHorizJustify( EDA_TEXT::MapHorizJustify( m_hAlign->GetSelection() - 1 ) );
|
2020-02-04 13:01:06 +00:00
|
|
|
m_hasChange = true;
|
|
|
|
}
|
2019-06-30 22:06:34 +00:00
|
|
|
|
2020-05-05 15:40:18 +00:00
|
|
|
if( m_hAlign->GetStringSelection() != INDETERMINATE_ACTION )
|
2020-02-04 13:01:06 +00:00
|
|
|
{
|
2019-06-30 22:06:34 +00:00
|
|
|
eda_text->SetVertJustify( EDA_TEXT::MapVertJustify( m_vAlign->GetSelection() - 1 ) );
|
2020-02-04 13:01:06 +00:00
|
|
|
m_hasChange = true;
|
|
|
|
}
|
2019-06-30 22:06:34 +00:00
|
|
|
|
|
|
|
if( m_Visible->Get3StateValue() != wxCHK_UNDETERMINED )
|
2020-02-04 13:01:06 +00:00
|
|
|
{
|
2019-06-30 22:06:34 +00:00
|
|
|
eda_text->SetVisible( m_Visible->GetValue() );
|
2020-02-04 13:01:06 +00:00
|
|
|
m_hasChange = true;
|
|
|
|
}
|
2019-06-30 22:06:34 +00:00
|
|
|
|
|
|
|
if( m_Italic->Get3StateValue() != wxCHK_UNDETERMINED )
|
2020-02-04 13:01:06 +00:00
|
|
|
{
|
2020-03-01 00:22:59 +00:00
|
|
|
eda_text->SetItalic( m_Italic->GetValue() );
|
2020-02-04 13:01:06 +00:00
|
|
|
m_hasChange = true;
|
|
|
|
}
|
2019-06-30 22:06:34 +00:00
|
|
|
|
|
|
|
if( m_Bold->Get3StateValue() != wxCHK_UNDETERMINED )
|
2020-02-04 13:01:06 +00:00
|
|
|
{
|
2020-03-01 00:22:59 +00:00
|
|
|
eda_text->SetBold( m_Bold->GetValue() );
|
2020-02-04 13:01:06 +00:00
|
|
|
m_hasChange = true;
|
|
|
|
}
|
2019-06-30 22:06:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// No else! Labels are both.
|
|
|
|
if( sch_text )
|
|
|
|
{
|
2020-05-05 15:40:18 +00:00
|
|
|
if( m_orientation->GetStringSelection() != INDETERMINATE_ACTION )
|
2019-06-30 22:06:34 +00:00
|
|
|
{
|
2020-03-29 01:12:29 +00:00
|
|
|
sch_text->SetLabelSpinStyle( (LABEL_SPIN_STYLE::SPIN) m_orientation->GetSelection() );
|
2020-02-04 13:01:06 +00:00
|
|
|
m_hasChange = true;
|
2019-06-30 22:06:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( lineItem )
|
|
|
|
{
|
|
|
|
if( !m_lineWidth.IsIndeterminate() )
|
2020-02-04 13:01:06 +00:00
|
|
|
{
|
2019-06-30 22:06:34 +00:00
|
|
|
lineItem->SetLineWidth( m_lineWidth.GetValue() );
|
2020-02-04 13:01:06 +00:00
|
|
|
m_hasChange = true;
|
|
|
|
}
|
2019-07-02 13:51:48 +00:00
|
|
|
|
2020-05-30 22:49:12 +00:00
|
|
|
if( m_lineStyle->GetStringSelection() != INDETERMINATE_ACTION )
|
2019-07-02 13:51:48 +00:00
|
|
|
{
|
2020-05-30 22:49:12 +00:00
|
|
|
lineItem->SetLineStyle( m_lineStyle->GetSelection() );
|
|
|
|
m_hasChange = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( m_setColor->GetValue() )
|
|
|
|
{
|
|
|
|
lineItem->SetLineColor( m_colorSwatch->GetSwatchColor() );
|
|
|
|
m_hasChange = true;
|
2019-07-02 13:51:48 +00:00
|
|
|
}
|
2019-06-30 22:06:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem( const SCH_SHEET_PATH& aSheetPath,
|
|
|
|
SCH_ITEM* aItem )
|
|
|
|
{
|
|
|
|
if( m_netFilterOpt->GetValue() && !m_netFilter->GetValue().IsEmpty() )
|
|
|
|
{
|
|
|
|
SCH_CONNECTION* connection = aItem->Connection( aSheetPath );
|
|
|
|
|
|
|
|
if( !connection )
|
|
|
|
return;
|
|
|
|
|
|
|
|
if( !WildCompareString( m_netFilter->GetValue(), connection->Name(), false ) )
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( m_referenceFilterOpt->GetValue() && !m_referenceFilter->GetValue().IsEmpty() )
|
|
|
|
{
|
|
|
|
if( aItem->Type() == SCH_COMPONENT_T )
|
|
|
|
{
|
|
|
|
wxString ref = static_cast<SCH_COMPONENT*>( aItem )->GetRef( &aSheetPath );
|
|
|
|
|
|
|
|
if( !WildCompareString( m_referenceFilter->GetValue(), ref, false ) )
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( m_symbolFilterOpt->GetValue() && !m_symbolFilter->GetValue().IsEmpty() )
|
|
|
|
{
|
|
|
|
if( aItem->Type() == SCH_COMPONENT_T )
|
|
|
|
{
|
|
|
|
wxString id = static_cast<SCH_COMPONENT*>( aItem )->GetLibId().Format();
|
|
|
|
|
|
|
|
if( !WildCompareString( m_symbolFilter->GetValue(), id, false ) )
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-06 21:56:18 +00:00
|
|
|
if( m_typeFilterOpt->GetValue() )
|
|
|
|
{
|
|
|
|
if( aItem->Type() == SCH_COMPONENT_T )
|
|
|
|
{
|
|
|
|
bool isPower = static_cast<SCH_COMPONENT*>( aItem )->GetPartRef()->IsPower();
|
|
|
|
|
|
|
|
if( isPower != ( m_typeFilter->GetSelection() == 1 ) )
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-06-30 22:06:34 +00:00
|
|
|
static KICAD_T wireTypes[] = { SCH_LINE_LOCATE_WIRE_T, SCH_LABEL_LOCATE_WIRE_T, EOT };
|
|
|
|
static KICAD_T busTypes[] = { SCH_LINE_LOCATE_BUS_T, SCH_LABEL_LOCATE_BUS_T, EOT };
|
|
|
|
static KICAD_T schTextAndGraphics[] = { SCH_TEXT_T, SCH_LINE_LOCATE_GRAPHIC_LINE_T, EOT };
|
|
|
|
|
|
|
|
if( aItem->Type() == SCH_COMPONENT_T )
|
|
|
|
{
|
|
|
|
SCH_COMPONENT* component = (SCH_COMPONENT*) aItem;
|
|
|
|
|
|
|
|
if( m_references->GetValue() )
|
|
|
|
processItem( aSheetPath, component->GetField( REFERENCE ) );
|
|
|
|
|
|
|
|
if( m_values->GetValue() )
|
|
|
|
processItem( aSheetPath, component->GetField( VALUE ) );
|
|
|
|
|
|
|
|
if( m_otherFields->GetValue() )
|
|
|
|
{
|
|
|
|
for( int i = 2; i < component->GetFieldCount(); ++i )
|
|
|
|
{
|
|
|
|
SCH_FIELD* field = component->GetField( i );
|
|
|
|
const wxString& fieldName = field->GetName();
|
|
|
|
|
|
|
|
if( !m_fieldnameFilterOpt->GetValue() || m_fieldnameFilter->GetValue().IsEmpty()
|
|
|
|
|| WildCompareString( m_fieldnameFilter->GetValue(), fieldName, false ) )
|
|
|
|
{
|
|
|
|
processItem( aSheetPath, field );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-04-02 12:57:07 +00:00
|
|
|
else if( aItem->Type() == SCH_SHEET_T )
|
|
|
|
{
|
|
|
|
SCH_SHEET* sheet = static_cast<SCH_SHEET*>( aItem );
|
|
|
|
|
|
|
|
if( m_sheetTitles->GetValue() )
|
|
|
|
processItem( aSheetPath, &sheet->GetFields()[ SHEETNAME ] );
|
|
|
|
|
|
|
|
if( m_sheetFields->GetValue() )
|
|
|
|
{
|
|
|
|
for( SCH_FIELD& field : sheet->GetFields() )
|
|
|
|
{
|
|
|
|
if( field.GetId() == SHEETNAME )
|
|
|
|
continue;
|
|
|
|
|
|
|
|
const wxString& fieldName = field.GetName();
|
|
|
|
|
|
|
|
if( !m_fieldnameFilterOpt->GetValue() || m_fieldnameFilter->GetValue().IsEmpty()
|
|
|
|
|| WildCompareString( m_fieldnameFilter->GetValue(), fieldName, false ) )
|
|
|
|
{
|
|
|
|
processItem( aSheetPath, &field );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( m_sheetBorders->GetValue() )
|
|
|
|
{
|
|
|
|
if( !m_lineWidth.IsIndeterminate() )
|
|
|
|
{
|
|
|
|
sheet->SetBorderWidth( m_lineWidth.GetValue() );
|
|
|
|
m_hasChange = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( m_setColor->GetValue() )
|
|
|
|
{
|
|
|
|
sheet->SetBorderColor( m_colorSwatch->GetSwatchColor() );
|
|
|
|
m_hasChange = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( m_setBgColor->GetValue() )
|
|
|
|
{
|
|
|
|
sheet->SetBackgroundColor( m_bgColorSwatch->GetSwatchColor() );
|
|
|
|
m_hasChange = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-06-30 22:06:34 +00:00
|
|
|
else if( m_wires->GetValue() && aItem->IsType( wireTypes ) )
|
|
|
|
processItem( aSheetPath, aItem );
|
2020-04-02 13:34:34 +00:00
|
|
|
else if( m_buses->GetValue() && aItem->IsType( busTypes ) )
|
2019-06-30 22:06:34 +00:00
|
|
|
processItem( aSheetPath, aItem );
|
|
|
|
else if( m_globalLabels->GetValue() && aItem->Type() == SCH_GLOBAL_LABEL_T )
|
|
|
|
processItem( aSheetPath, aItem );
|
|
|
|
else if( m_hierLabels->GetValue() && aItem->Type() == SCH_HIER_LABEL_T )
|
|
|
|
processItem( aSheetPath, aItem );
|
|
|
|
else if( m_sheetPins->GetValue() && aItem->Type() == SCH_SHEET_PIN_T )
|
|
|
|
processItem( aSheetPath, aItem );
|
|
|
|
else if( m_schTextAndGraphics->GetValue() && aItem->IsType( schTextAndGraphics ) )
|
|
|
|
processItem( aSheetPath, aItem );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataFromWindow()
|
|
|
|
{
|
2020-06-14 15:08:47 +00:00
|
|
|
if( !m_textSize.Validate( 1.0, 10000.0, EDA_UNITS::INCHES, true ) ) // 1 mil .. 10 inches
|
2019-06-30 22:06:34 +00:00
|
|
|
return false;
|
|
|
|
|
2020-05-30 23:01:24 +00:00
|
|
|
SCH_SHEET_PATH currentSheet = m_parent->GetCurrentSheet();
|
|
|
|
|
2019-06-30 22:06:34 +00:00
|
|
|
// Go through sheets
|
2020-05-13 02:00:37 +00:00
|
|
|
for( const SCH_SHEET_PATH& sheetPath : m_parent->Schematic().GetSheets() )
|
2019-06-30 22:06:34 +00:00
|
|
|
{
|
|
|
|
SCH_SCREEN* screen = sheetPath.LastScreen();
|
|
|
|
|
|
|
|
if( screen )
|
|
|
|
{
|
2020-05-30 23:01:24 +00:00
|
|
|
m_parent->SetCurrentSheet( sheetPath );
|
2020-02-04 13:01:06 +00:00
|
|
|
m_hasChange = false;
|
|
|
|
|
2019-06-25 23:39:58 +00:00
|
|
|
for( auto item : screen->Items() )
|
2019-06-30 22:06:34 +00:00
|
|
|
visitItem( sheetPath, item );
|
2020-02-04 13:01:06 +00:00
|
|
|
|
|
|
|
if( m_hasChange )
|
|
|
|
{
|
|
|
|
m_parent->OnModify();
|
|
|
|
m_parent->HardRedraw();
|
|
|
|
}
|
2019-06-30 22:06:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-30 23:01:24 +00:00
|
|
|
// Reset the view to where we left the user
|
|
|
|
m_parent->SetCurrentSheet( currentSheet );
|
|
|
|
|
2019-06-30 22:06:34 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int SCH_EDIT_TOOL::GlobalEdit( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
|
|
|
DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS dlg( m_frame );
|
|
|
|
dlg.ShowModal();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|