Add Global Edit Text and Graphics Properties to Eeschema.
Fixes: lp:1801150 * https://bugs.launchpad.net/kicad/+bug/1801150
This commit is contained in:
parent
743c650129
commit
ad26ece8d4
|
@ -37,6 +37,55 @@
|
|||
#include <base_units.h>
|
||||
#include <convert_to_biu.h>
|
||||
|
||||
// Sadly we store the orientation of hierarchical and global labels using a different
|
||||
// int encoding than that for local labels:
|
||||
// Global Local
|
||||
// Left justified 0 2
|
||||
// Up 1 3
|
||||
// Right justified 2 0
|
||||
// Down 3 1
|
||||
int EDA_TEXT::MapOrientation( KICAD_T labelType, int aOrientation )
|
||||
{
|
||||
if( labelType == SCH_LABEL_T )
|
||||
return aOrientation;
|
||||
|
||||
switch( aOrientation )
|
||||
{
|
||||
case 0: return 2;
|
||||
case 2: return 0;
|
||||
default: return aOrientation;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
EDA_TEXT_HJUSTIFY_T EDA_TEXT::MapHorizJustify( int aHorizJustify )
|
||||
{
|
||||
wxASSERT( aHorizJustify >= GR_TEXT_HJUSTIFY_LEFT && aHorizJustify <= GR_TEXT_HJUSTIFY_RIGHT );
|
||||
|
||||
if( aHorizJustify > GR_TEXT_HJUSTIFY_RIGHT )
|
||||
return GR_TEXT_HJUSTIFY_RIGHT;
|
||||
|
||||
if( aHorizJustify < GR_TEXT_HJUSTIFY_LEFT )
|
||||
return GR_TEXT_HJUSTIFY_LEFT;
|
||||
|
||||
return (EDA_TEXT_HJUSTIFY_T) aHorizJustify;
|
||||
}
|
||||
|
||||
|
||||
EDA_TEXT_VJUSTIFY_T EDA_TEXT::MapVertJustify( int aVertJustify )
|
||||
{
|
||||
wxASSERT( aVertJustify >= GR_TEXT_VJUSTIFY_TOP && aVertJustify <= GR_TEXT_VJUSTIFY_BOTTOM );
|
||||
|
||||
if( aVertJustify > GR_TEXT_VJUSTIFY_BOTTOM )
|
||||
return GR_TEXT_VJUSTIFY_BOTTOM;
|
||||
|
||||
if( aVertJustify < GR_TEXT_VJUSTIFY_TOP )
|
||||
return GR_TEXT_VJUSTIFY_TOP;
|
||||
|
||||
return (EDA_TEXT_VJUSTIFY_T) aVertJustify;
|
||||
}
|
||||
|
||||
|
||||
EDA_TEXT::EDA_TEXT( const wxString& text ) :
|
||||
m_Text( text ),
|
||||
m_e( 1<<TE_VISIBLE )
|
||||
|
|
|
@ -55,6 +55,8 @@ set( EESCHEMA_DLGS
|
|||
dialogs/dialog_erc.cpp
|
||||
dialogs/dialog_erc_base.cpp
|
||||
dialogs/dialog_global_sym_lib_table_config.cpp
|
||||
dialogs/dialog_global_edit_text_and_graphics.cpp
|
||||
dialogs/dialog_global_edit_text_and_graphics_base.cpp
|
||||
dialogs/dialog_lib_edit_draw_item.cpp
|
||||
dialogs/dialog_lib_edit_draw_item_base.cpp
|
||||
dialogs/dialog_lib_edit_pin.cpp
|
||||
|
|
|
@ -178,27 +178,6 @@ DIALOG_LABEL_EDITOR::~DIALOG_LABEL_EDITOR()
|
|||
}
|
||||
|
||||
|
||||
// Sadly we store the orientation of hierarchical and global labels using a different
|
||||
// int encoding than that for local labels:
|
||||
// Global Local
|
||||
// Left justified 0 2
|
||||
// Up 1 3
|
||||
// Right justified 2 0
|
||||
// Down 3 1
|
||||
static int mapOrientation( KICAD_T labelType, int aOrientation )
|
||||
{
|
||||
if( labelType == SCH_LABEL_T )
|
||||
return aOrientation;
|
||||
|
||||
switch( aOrientation )
|
||||
{
|
||||
case 0: return 2;
|
||||
case 2: return 0;
|
||||
default: return aOrientation;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool DIALOG_LABEL_EDITOR::TransferDataToWindow()
|
||||
{
|
||||
if( !wxDialog::TransferDataToWindow() )
|
||||
|
@ -230,8 +209,8 @@ bool DIALOG_LABEL_EDITOR::TransferDataToWindow()
|
|||
}
|
||||
|
||||
// Set text options:
|
||||
int orientation = mapOrientation( m_CurrentText->Type(), m_CurrentText->GetLabelSpinStyle() );
|
||||
m_TextOrient->SetSelection( orientation );
|
||||
int orient = m_CurrentText->GetLabelSpinStyle();
|
||||
m_TextOrient->SetSelection( EDA_TEXT::MapOrientation( m_CurrentText->Type(), orient ) );
|
||||
|
||||
m_TextShape->SetSelection( m_CurrentText->GetShape() );
|
||||
|
||||
|
@ -317,8 +296,8 @@ bool DIALOG_LABEL_EDITOR::TransferDataFromWindow()
|
|||
return false;
|
||||
}
|
||||
|
||||
int orientation = m_TextOrient->GetSelection();
|
||||
m_CurrentText->SetLabelSpinStyle( mapOrientation( m_CurrentText->Type(), orientation ) );
|
||||
int orient = m_TextOrient->GetSelection();
|
||||
m_CurrentText->SetLabelSpinStyle( EDA_TEXT::MapOrientation( m_CurrentText->Type(), orient ) );
|
||||
|
||||
m_CurrentText->SetTextSize( wxSize( m_textSize.GetValue(), m_textSize.GetValue() ) );
|
||||
|
||||
|
|
|
@ -43,36 +43,7 @@
|
|||
#include <sch_validators.h>
|
||||
|
||||
#include <dialog_edit_one_field.h>
|
||||
|
||||
|
||||
// These should probably moved into some other file as helpers.
|
||||
EDA_TEXT_HJUSTIFY_T IntToEdaTextHorizJustify( int aHorizJustify )
|
||||
{
|
||||
wxASSERT( aHorizJustify >= GR_TEXT_HJUSTIFY_LEFT && aHorizJustify <= GR_TEXT_HJUSTIFY_RIGHT );
|
||||
|
||||
if( aHorizJustify > GR_TEXT_HJUSTIFY_RIGHT )
|
||||
return GR_TEXT_HJUSTIFY_RIGHT;
|
||||
|
||||
if( aHorizJustify < GR_TEXT_HJUSTIFY_LEFT )
|
||||
return GR_TEXT_HJUSTIFY_LEFT;
|
||||
|
||||
return (EDA_TEXT_HJUSTIFY_T) aHorizJustify;
|
||||
}
|
||||
|
||||
|
||||
EDA_TEXT_VJUSTIFY_T IntToEdaTextVertJustify( int aVertJustify )
|
||||
{
|
||||
wxASSERT( aVertJustify >= GR_TEXT_VJUSTIFY_TOP && aVertJustify <= GR_TEXT_VJUSTIFY_BOTTOM );
|
||||
|
||||
if( aVertJustify > GR_TEXT_VJUSTIFY_BOTTOM )
|
||||
return GR_TEXT_VJUSTIFY_BOTTOM;
|
||||
|
||||
if( aVertJustify < GR_TEXT_VJUSTIFY_TOP )
|
||||
return GR_TEXT_VJUSTIFY_TOP;
|
||||
|
||||
return (EDA_TEXT_VJUSTIFY_T) aVertJustify;
|
||||
}
|
||||
|
||||
#include <sch_text.h>
|
||||
|
||||
DIALOG_EDIT_ONE_FIELD::DIALOG_EDIT_ONE_FIELD( SCH_BASE_FRAME* aParent, const wxString& aTitle,
|
||||
const EDA_TEXT* aTextItem ) :
|
||||
|
@ -221,8 +192,8 @@ void DIALOG_EDIT_ONE_FIELD::updateText( EDA_TEXT* aText )
|
|||
aText->SetTextAngle( m_isVertical ? TEXT_ANGLE_VERT : TEXT_ANGLE_HORIZ );
|
||||
aText->SetItalic( m_isItalic );
|
||||
aText->SetBold( m_isBold );
|
||||
aText->SetHorizJustify( IntToEdaTextHorizJustify( m_horizontalJustification - 1 ) );
|
||||
aText->SetVertJustify( IntToEdaTextVertJustify( m_verticalJustification - 1 ) );
|
||||
aText->SetHorizJustify( EDA_TEXT::MapHorizJustify( m_horizontalJustification - 1 ) );
|
||||
aText->SetVertJustify( EDA_TEXT::MapVertJustify( m_verticalJustification - 1 ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -285,10 +256,10 @@ void DIALOG_SCH_EDIT_ONE_FIELD::UpdateField( SCH_FIELD* aField, SCH_SHEET_PATH*
|
|||
if( ( aField->GetTextAngle() == TEXT_ANGLE_VERT ) != m_isVertical )
|
||||
positioningModified = true;
|
||||
|
||||
if( aField->GetHorizJustify() != IntToEdaTextHorizJustify( m_horizontalJustification - 1 ) )
|
||||
if( aField->GetHorizJustify() != EDA_TEXT::MapHorizJustify( m_horizontalJustification - 1 ) )
|
||||
positioningModified = true;
|
||||
|
||||
if( aField->GetVertJustify() != IntToEdaTextVertJustify( m_verticalJustification - 1 ) )
|
||||
if( aField->GetVertJustify() != EDA_TEXT::MapVertJustify( m_verticalJustification - 1 ) )
|
||||
positioningModified = true;
|
||||
|
||||
aField->SetText( m_text );
|
||||
|
|
|
@ -0,0 +1,357 @@
|
|||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <kicad_string.h>
|
||||
#include <widgets/unit_binder.h>
|
||||
#include <tool/tool_manager.h>
|
||||
#include <tools/ee_selection_tool.h>
|
||||
#include <tools/sch_edit_tool.h>
|
||||
#include <sch_edit_frame.h>
|
||||
#include <sch_component.h>
|
||||
#include <sch_line.h>
|
||||
#include <sch_connection.h>
|
||||
#include <sch_sheet.h>
|
||||
#include <connection_graph.h>
|
||||
#include <dialog_global_edit_text_and_graphics_base.h>
|
||||
#include <advanced_config.h>
|
||||
|
||||
static bool g_modifyReferences;
|
||||
static bool g_modifyValues;
|
||||
static bool g_modifyOtherFields;
|
||||
static bool g_modifyWires;
|
||||
static bool g_modifyBusses;
|
||||
static bool g_modifyGlobalLabels;
|
||||
static bool g_modifyHierLabels;
|
||||
static bool g_modifySheetTitles;
|
||||
static bool g_modifySheetPins;
|
||||
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_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;
|
||||
|
||||
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;
|
||||
|
||||
// TODO(JE) remove once real-time connectivity is a given
|
||||
if( !ADVANCED_CFG::GetCfg().m_realTimeConnectivity || !CONNECTION_GRAPH::m_allowRealTime )
|
||||
m_parent->RecalculateConnections();
|
||||
|
||||
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();
|
||||
g_modifyBusses = m_busses->GetValue();
|
||||
g_modifyGlobalLabels = m_globalLabels->GetValue();
|
||||
g_modifyHierLabels = m_hierLabels->GetValue();
|
||||
g_modifySheetTitles = m_sheetTitles->GetValue();
|
||||
g_modifySheetPins = m_sheetPins->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_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 );
|
||||
m_busses->SetValue( g_modifyBusses );
|
||||
m_globalLabels->SetValue( g_modifyGlobalLabels );
|
||||
m_hierLabels->SetValue( g_modifyHierLabels );
|
||||
m_sheetTitles->SetValue( g_modifySheetTitles );
|
||||
m_sheetPins->SetValue( g_modifySheetPins );
|
||||
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 );
|
||||
|
||||
if( g_filterByNet && !g_netFilter.IsEmpty() )
|
||||
{
|
||||
m_netFilter->SetValue( g_netFilter );
|
||||
m_netFilterOpt->SetValue( true );
|
||||
}
|
||||
else if( !m_parent->GetSelectedNetName().IsEmpty() )
|
||||
{
|
||||
m_netFilter->SetValue( m_parent->GetSelectedNetName() );
|
||||
}
|
||||
else if( selection.GetSize() )
|
||||
{
|
||||
SCH_ITEM* sch_item = (SCH_ITEM*) selection.Front();
|
||||
SCH_CONNECTION* connection = sch_item->Connection( *g_CurrentSheet );
|
||||
|
||||
if( connection )
|
||||
m_netFilter->SetValue( connection->Name() );
|
||||
}
|
||||
|
||||
m_netFilterOpt->SetValue( g_filterByNet );
|
||||
|
||||
m_textSize.SetValue( INDETERMINATE );
|
||||
m_orientation->SetStringSelection( INDETERMINATE );
|
||||
m_hAlign->SetStringSelection( INDETERMINATE );
|
||||
m_vAlign->SetStringSelection( INDETERMINATE );
|
||||
m_Italic->Set3StateValue( wxCHK_UNDETERMINED );
|
||||
m_Bold->Set3StateValue( wxCHK_UNDETERMINED );
|
||||
m_Visible->Set3StateValue( wxCHK_UNDETERMINED );
|
||||
m_lineWidth.SetValue( INDETERMINATE );
|
||||
|
||||
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 );
|
||||
|
||||
if( eda_text )
|
||||
{
|
||||
if( !m_textSize.IsIndeterminate() )
|
||||
eda_text->SetTextSize( wxSize( m_textSize.GetValue(), m_textSize.GetValue() ) );
|
||||
|
||||
if( m_hAlign->GetStringSelection() != INDETERMINATE )
|
||||
eda_text->SetHorizJustify( EDA_TEXT::MapHorizJustify( m_hAlign->GetSelection() - 1 ) );
|
||||
|
||||
if( m_hAlign->GetStringSelection() != INDETERMINATE )
|
||||
eda_text->SetVertJustify( EDA_TEXT::MapVertJustify( m_vAlign->GetSelection() - 1 ) );
|
||||
|
||||
if( m_Visible->Get3StateValue() != wxCHK_UNDETERMINED )
|
||||
eda_text->SetVisible( m_Visible->GetValue() );
|
||||
|
||||
if( m_Italic->Get3StateValue() != wxCHK_UNDETERMINED )
|
||||
eda_text->SetItalic( m_Visible->GetValue() );
|
||||
|
||||
if( m_Bold->Get3StateValue() != wxCHK_UNDETERMINED )
|
||||
eda_text->SetBold( m_Visible->GetValue() );
|
||||
}
|
||||
|
||||
// No else! Labels are both.
|
||||
if( sch_text )
|
||||
{
|
||||
if( m_orientation->GetStringSelection() != INDETERMINATE )
|
||||
{
|
||||
int orient = m_orientation->GetSelection();
|
||||
sch_text->SetLabelSpinStyle( EDA_TEXT::MapOrientation( sch_text->Type(), orient ) );
|
||||
}
|
||||
}
|
||||
|
||||
if( lineItem )
|
||||
{
|
||||
if( !m_lineWidth.IsIndeterminate() )
|
||||
lineItem->SetLineWidth( m_lineWidth.GetValue() );
|
||||
}
|
||||
|
||||
m_parent->OnModify();
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if( m_wires->GetValue() && aItem->IsType( wireTypes ) )
|
||||
processItem( aSheetPath, aItem );
|
||||
else if( m_busses->GetValue() && aItem->IsType( busTypes ) )
|
||||
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_sheetTitles->GetValue() && aItem->Type() == SCH_SHEET_T )
|
||||
{
|
||||
if( !m_textSize.IsIndeterminate() )
|
||||
static_cast<SCH_SHEET*>( aItem )->SetSheetNameSize( m_textSize.GetValue() );
|
||||
}
|
||||
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()
|
||||
{
|
||||
if( !m_textSize.Validate( 1, 10000 ) ) // 1 mill .. 10 inches
|
||||
return false;
|
||||
|
||||
SCH_SHEET_LIST aSheets( g_RootSheet );
|
||||
|
||||
// Go through sheets
|
||||
for( const SCH_SHEET_PATH& sheetPath : aSheets )
|
||||
{
|
||||
SCH_SCREEN* screen = sheetPath.LastScreen();
|
||||
|
||||
if( screen )
|
||||
{
|
||||
for( SCH_ITEM* item = screen->GetDrawItems(); item; item = item->Next() )
|
||||
visitItem( sheetPath, item );
|
||||
}
|
||||
}
|
||||
|
||||
m_parent->HardRedraw();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
int SCH_EDIT_TOOL::GlobalEdit( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS dlg( m_frame );
|
||||
dlg.ShowModal();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,299 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Dec 30 2017)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "dialog_global_edit_text_and_graphics_base.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE::DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
|
||||
{
|
||||
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
|
||||
|
||||
wxBoxSizer* bMainSizer;
|
||||
bMainSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
wxBoxSizer* bSizerTop;
|
||||
bSizerTop = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
wxStaticBoxSizer* sbScope;
|
||||
sbScope = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Scope") ), wxVERTICAL );
|
||||
|
||||
m_references = new wxCheckBox( sbScope->GetStaticBox(), wxID_ANY, _("Symbol references"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
sbScope->Add( m_references, 0, wxBOTTOM|wxRIGHT|wxLEFT, 4 );
|
||||
|
||||
m_values = new wxCheckBox( sbScope->GetStaticBox(), wxID_ANY, _("Symbol values"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
sbScope->Add( m_values, 0, wxBOTTOM|wxRIGHT|wxLEFT, 4 );
|
||||
|
||||
m_otherFields = new wxCheckBox( sbScope->GetStaticBox(), wxID_ANY, _("Other symbol fields"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
sbScope->Add( m_otherFields, 0, wxBOTTOM|wxRIGHT|wxLEFT, 4 );
|
||||
|
||||
|
||||
sbScope->Add( 0, 0, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
|
||||
|
||||
m_wires = new wxCheckBox( sbScope->GetStaticBox(), wxID_ANY, _("Wires && wire labels"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
sbScope->Add( m_wires, 0, wxBOTTOM|wxRIGHT|wxLEFT, 4 );
|
||||
|
||||
m_busses = new wxCheckBox( sbScope->GetStaticBox(), wxID_ANY, _("Busses && bus labels"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
sbScope->Add( m_busses, 0, wxBOTTOM|wxRIGHT|wxLEFT, 4 );
|
||||
|
||||
m_globalLabels = new wxCheckBox( sbScope->GetStaticBox(), wxID_ANY, _("Global labels"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
sbScope->Add( m_globalLabels, 0, wxBOTTOM|wxRIGHT|wxLEFT, 4 );
|
||||
|
||||
|
||||
sbScope->Add( 0, 0, 1, wxEXPAND|wxTOP|wxBOTTOM, 5 );
|
||||
|
||||
m_hierLabels = new wxCheckBox( sbScope->GetStaticBox(), wxID_ANY, _("Hierarchical labels"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
sbScope->Add( m_hierLabels, 0, wxBOTTOM|wxRIGHT|wxLEFT, 4 );
|
||||
|
||||
m_sheetTitles = new wxCheckBox( sbScope->GetStaticBox(), wxID_ANY, _("Sheet titles"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
sbScope->Add( m_sheetTitles, 0, wxBOTTOM|wxRIGHT|wxLEFT, 4 );
|
||||
|
||||
m_sheetPins = new wxCheckBox( sbScope->GetStaticBox(), wxID_ANY, _("Sheet pins"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
sbScope->Add( m_sheetPins, 0, wxBOTTOM|wxRIGHT|wxLEFT, 4 );
|
||||
|
||||
|
||||
sbScope->Add( 0, 0, 1, wxEXPAND|wxTOP|wxBOTTOM, 5 );
|
||||
|
||||
m_schTextAndGraphics = new wxCheckBox( sbScope->GetStaticBox(), wxID_ANY, _("Schematic text && graphics"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
sbScope->Add( m_schTextAndGraphics, 0, wxBOTTOM|wxRIGHT|wxLEFT, 4 );
|
||||
|
||||
|
||||
bSizerTop->Add( sbScope, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 10 );
|
||||
|
||||
wxStaticBoxSizer* sbFilters;
|
||||
sbFilters = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Filters") ), wxVERTICAL );
|
||||
|
||||
wxFlexGridSizer* fgSizer2;
|
||||
fgSizer2 = new wxFlexGridSizer( 0, 2, 4, 0 );
|
||||
fgSizer2->AddGrowableCol( 1 );
|
||||
fgSizer2->SetFlexibleDirection( wxBOTH );
|
||||
fgSizer2->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
m_fieldnameFilterOpt = new wxCheckBox( sbFilters->GetStaticBox(), wxID_ANY, _("Filter fields by name:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer2->Add( m_fieldnameFilterOpt, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_fieldnameFilter = new wxTextCtrl( sbFilters->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer2->Add( m_fieldnameFilter, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxEXPAND, 5 );
|
||||
|
||||
|
||||
fgSizer2->Add( 0, 0, 1, wxEXPAND|wxTOP|wxBOTTOM, 3 );
|
||||
|
||||
|
||||
fgSizer2->Add( 0, 0, 1, wxEXPAND|wxTOP|wxBOTTOM, 3 );
|
||||
|
||||
m_referenceFilterOpt = new wxCheckBox( sbFilters->GetStaticBox(), wxID_ANY, _("Filter items by parent symbol reference:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer2->Add( m_referenceFilterOpt, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_referenceFilter = new wxTextCtrl( sbFilters->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_referenceFilter->SetMinSize( wxSize( 150,-1 ) );
|
||||
|
||||
fgSizer2->Add( m_referenceFilter, 0, wxEXPAND|wxLEFT, 5 );
|
||||
|
||||
m_symbolFilterOpt = new wxCheckBox( sbFilters->GetStaticBox(), wxID_ANY, _("Filter items by parent symbol library id:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer2->Add( m_symbolFilterOpt, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_symbolFilter = new wxTextCtrl( sbFilters->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer2->Add( m_symbolFilter, 0, wxEXPAND|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
|
||||
fgSizer2->Add( 0, 0, 1, wxEXPAND|wxTOP|wxBOTTOM, 5 );
|
||||
|
||||
|
||||
fgSizer2->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
m_netFilterOpt = new wxCheckBox( sbFilters->GetStaticBox(), wxID_ANY, _("Filter items by net:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer2->Add( m_netFilterOpt, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_netFilter = new wxTextCtrl( sbFilters->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer2->Add( m_netFilter, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxEXPAND, 5 );
|
||||
|
||||
|
||||
sbFilters->Add( fgSizer2, 1, wxEXPAND|wxRIGHT, 5 );
|
||||
|
||||
|
||||
bSizerTop->Add( sbFilters, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 10 );
|
||||
|
||||
|
||||
bMainSizer->Add( bSizerTop, 0, wxEXPAND, 5 );
|
||||
|
||||
|
||||
bMainSizer->Add( 0, 0, 0, wxTOP, 5 );
|
||||
|
||||
|
||||
bMainSizer->Add( 0, 0, 0, wxTOP, 5 );
|
||||
|
||||
wxStaticBoxSizer* sbAction;
|
||||
sbAction = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Set To") ), wxVERTICAL );
|
||||
|
||||
m_specifiedValues = new wxPanel( sbAction->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
wxBoxSizer* bSizer2;
|
||||
bSizer2 = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
wxFlexGridSizer* fgSizer1;
|
||||
fgSizer1 = new wxFlexGridSizer( 0, 5, 0, 0 );
|
||||
fgSizer1->SetFlexibleDirection( wxBOTH );
|
||||
fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
m_textSizeLabel = new wxStaticText( m_specifiedValues, wxID_ANY, _("Text size:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_textSizeLabel->Wrap( -1 );
|
||||
fgSizer1->Add( m_textSizeLabel, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_textSizeCtrl = new wxTextCtrl( m_specifiedValues, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_textSizeCtrl->SetMinSize( wxSize( 120,-1 ) );
|
||||
|
||||
fgSizer1->Add( m_textSizeCtrl, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_textSizeUnits = new wxStaticText( m_specifiedValues, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_textSizeUnits->Wrap( -1 );
|
||||
fgSizer1->Add( m_textSizeUnits, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
|
||||
|
||||
|
||||
fgSizer1->Add( 30, 0, 0, wxEXPAND|wxRIGHT|wxLEFT, 20 );
|
||||
|
||||
m_Bold = new wxCheckBox( m_specifiedValues, wxID_ANY, _("Bold"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER );
|
||||
fgSizer1->Add( m_Bold, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
orientationLabel = new wxStaticText( m_specifiedValues, wxID_ANY, _("Orientation:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
orientationLabel->Wrap( -1 );
|
||||
fgSizer1->Add( orientationLabel, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
wxString m_orientationChoices[] = { _("Right"), _("Up"), _("Left"), _("Down"), _("...") };
|
||||
int m_orientationNChoices = sizeof( m_orientationChoices ) / sizeof( wxString );
|
||||
m_orientation = new wxChoice( m_specifiedValues, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_orientationNChoices, m_orientationChoices, 0 );
|
||||
m_orientation->SetSelection( 0 );
|
||||
fgSizer1->Add( m_orientation, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
fgSizer1->Add( 0, 0, 0, wxEXPAND|wxRIGHT|wxLEFT, 20 );
|
||||
|
||||
m_Italic = new wxCheckBox( m_specifiedValues, wxID_ANY, _("Italic"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER );
|
||||
fgSizer1->Add( m_Italic, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
|
||||
fgSizer1->Add( 0, 0, 1, wxEXPAND|wxTOP|wxBOTTOM, 5 );
|
||||
|
||||
|
||||
fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
hAlignLabel = new wxStaticText( m_specifiedValues, wxID_ANY, _("H Alignment (fields only):"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
hAlignLabel->Wrap( -1 );
|
||||
fgSizer1->Add( hAlignLabel, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
wxString m_hAlignChoices[] = { _("Left"), _("Center"), _("Right"), _("...") };
|
||||
int m_hAlignNChoices = sizeof( m_hAlignChoices ) / sizeof( wxString );
|
||||
m_hAlign = new wxChoice( m_specifiedValues, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_hAlignNChoices, m_hAlignChoices, 0 );
|
||||
m_hAlign->SetSelection( 0 );
|
||||
fgSizer1->Add( m_hAlign, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
m_Visible = new wxCheckBox( m_specifiedValues, wxID_ANY, _("Visible (fields only)"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER );
|
||||
fgSizer1->Add( m_Visible, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
vAlignLabel = new wxStaticText( m_specifiedValues, wxID_ANY, _("V Alignment (fields only):"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
vAlignLabel->Wrap( -1 );
|
||||
fgSizer1->Add( vAlignLabel, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
wxString m_vAlignChoices[] = { _("Top"), _("Center"), _("Bottom"), _("...") };
|
||||
int m_vAlignNChoices = sizeof( m_vAlignChoices ) / sizeof( wxString );
|
||||
m_vAlign = new wxChoice( m_specifiedValues, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_vAlignNChoices, m_vAlignChoices, 0 );
|
||||
m_vAlign->SetSelection( 0 );
|
||||
fgSizer1->Add( m_vAlign, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
fgSizer1->Add( 0, 0, 1, wxEXPAND|wxTOP|wxBOTTOM, 5 );
|
||||
|
||||
|
||||
fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
m_lineWidthLabel = new wxStaticText( m_specifiedValues, wxID_ANY, _("Line width:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_lineWidthLabel->Wrap( -1 );
|
||||
fgSizer1->Add( m_lineWidthLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_LineWidthCtrl = new wxTextCtrl( m_specifiedValues, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer1->Add( m_LineWidthCtrl, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_lineWidthUnits = new wxStaticText( m_specifiedValues, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_lineWidthUnits->Wrap( -1 );
|
||||
fgSizer1->Add( m_lineWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
|
||||
|
||||
|
||||
bSizer2->Add( fgSizer1, 1, wxEXPAND|wxTOP, 2 );
|
||||
|
||||
|
||||
m_specifiedValues->SetSizer( bSizer2 );
|
||||
m_specifiedValues->Layout();
|
||||
bSizer2->Fit( m_specifiedValues );
|
||||
sbAction->Add( m_specifiedValues, 1, wxEXPAND|wxBOTTOM, 12 );
|
||||
|
||||
|
||||
bMainSizer->Add( sbAction, 1, wxEXPAND|wxRIGHT|wxLEFT, 10 );
|
||||
|
||||
m_sdbSizerButtons = new wxStdDialogButtonSizer();
|
||||
m_sdbSizerButtonsOK = new wxButton( this, wxID_OK );
|
||||
m_sdbSizerButtons->AddButton( m_sdbSizerButtonsOK );
|
||||
m_sdbSizerButtonsCancel = new wxButton( this, wxID_CANCEL );
|
||||
m_sdbSizerButtons->AddButton( m_sdbSizerButtonsCancel );
|
||||
m_sdbSizerButtons->Realize();
|
||||
|
||||
bMainSizer->Add( m_sdbSizerButtons, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
this->SetSizer( bMainSizer );
|
||||
this->Layout();
|
||||
bMainSizer->Fit( this );
|
||||
|
||||
// Connect Events
|
||||
this->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE::OnUpdateUI ) );
|
||||
m_fieldnameFilter->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE::OnReferenceFilterText ), NULL, this );
|
||||
m_referenceFilter->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE::OnReferenceFilterText ), NULL, this );
|
||||
m_symbolFilter->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE::OnSymbolFilterText ), NULL, this );
|
||||
}
|
||||
|
||||
DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE::~DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE()
|
||||
{
|
||||
// Disconnect Events
|
||||
this->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE::OnUpdateUI ) );
|
||||
m_fieldnameFilter->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE::OnReferenceFilterText ), NULL, this );
|
||||
m_referenceFilter->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE::OnReferenceFilterText ), NULL, this );
|
||||
m_symbolFilter->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE::OnSymbolFilterText ), NULL, this );
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,92 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Dec 30 2017)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE_H__
|
||||
#define __DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE_H__
|
||||
|
||||
#include <wx/artprov.h>
|
||||
#include <wx/xrc/xmlres.h>
|
||||
#include <wx/intl.h>
|
||||
#include "dialog_shim.h"
|
||||
#include <wx/string.h>
|
||||
#include <wx/checkbox.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/font.h>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/statbox.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/choice.h>
|
||||
#include <wx/panel.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/dialog.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE : public DIALOG_SHIM
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
wxCheckBox* m_references;
|
||||
wxCheckBox* m_values;
|
||||
wxCheckBox* m_otherFields;
|
||||
wxCheckBox* m_wires;
|
||||
wxCheckBox* m_busses;
|
||||
wxCheckBox* m_globalLabels;
|
||||
wxCheckBox* m_hierLabels;
|
||||
wxCheckBox* m_sheetTitles;
|
||||
wxCheckBox* m_sheetPins;
|
||||
wxCheckBox* m_schTextAndGraphics;
|
||||
wxCheckBox* m_fieldnameFilterOpt;
|
||||
wxTextCtrl* m_fieldnameFilter;
|
||||
wxCheckBox* m_referenceFilterOpt;
|
||||
wxTextCtrl* m_referenceFilter;
|
||||
wxCheckBox* m_symbolFilterOpt;
|
||||
wxTextCtrl* m_symbolFilter;
|
||||
wxCheckBox* m_netFilterOpt;
|
||||
wxTextCtrl* m_netFilter;
|
||||
wxPanel* m_specifiedValues;
|
||||
wxStaticText* m_textSizeLabel;
|
||||
wxTextCtrl* m_textSizeCtrl;
|
||||
wxStaticText* m_textSizeUnits;
|
||||
wxCheckBox* m_Bold;
|
||||
wxStaticText* orientationLabel;
|
||||
wxChoice* m_orientation;
|
||||
wxCheckBox* m_Italic;
|
||||
wxStaticText* hAlignLabel;
|
||||
wxChoice* m_hAlign;
|
||||
wxCheckBox* m_Visible;
|
||||
wxStaticText* vAlignLabel;
|
||||
wxChoice* m_vAlign;
|
||||
wxStaticText* m_lineWidthLabel;
|
||||
wxTextCtrl* m_LineWidthCtrl;
|
||||
wxStaticText* m_lineWidthUnits;
|
||||
wxStdDialogButtonSizer* m_sdbSizerButtons;
|
||||
wxButton* m_sdbSizerButtonsOK;
|
||||
wxButton* m_sdbSizerButtonsCancel;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); }
|
||||
virtual void OnReferenceFilterText( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnSymbolFilterText( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
|
||||
DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Edit Text and Graphic Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
||||
~DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE();
|
||||
|
||||
};
|
||||
|
||||
#endif //__DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE_H__
|
|
@ -156,6 +156,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
|
|||
editMenu->AddItem( ACTIONS::findAndReplace, EE_CONDITIONS::ShowAlways );
|
||||
|
||||
editMenu->AddSeparator();
|
||||
editMenu->AddItem( EE_ACTIONS::editTextAndGraphics, EE_CONDITIONS::ShowAlways );
|
||||
editMenu->AddItem( EE_ACTIONS::updateFieldsFromLibrary, EE_CONDITIONS::ShowAlways );
|
||||
|
||||
editMenu->Resolve();
|
||||
|
|
|
@ -661,6 +661,38 @@ EDA_ITEM* SCH_LABEL::Clone() const
|
|||
}
|
||||
|
||||
|
||||
bool SCH_LABEL::IsType( const KICAD_T aScanTypes[] )
|
||||
{
|
||||
static KICAD_T wireTypes[] = { SCH_LINE_LOCATE_WIRE_T, EOT };
|
||||
static KICAD_T busTypes[] = { SCH_LINE_LOCATE_BUS_T, EOT };
|
||||
|
||||
if( SCH_ITEM::IsType( aScanTypes ) )
|
||||
return true;
|
||||
|
||||
for( const KICAD_T* p = aScanTypes; *p != EOT; ++p )
|
||||
{
|
||||
if( *p == SCH_LABEL_LOCATE_WIRE_T )
|
||||
{
|
||||
for( SCH_ITEM* connection : m_connected_items )
|
||||
{
|
||||
if( connection->IsType( wireTypes ) )
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if ( *p == SCH_LABEL_LOCATE_BUS_T )
|
||||
{
|
||||
for( SCH_ITEM* connection : m_connected_items )
|
||||
{
|
||||
if( connection->IsType( busTypes ) )
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
const EDA_RECT SCH_LABEL::GetBoundingBox() const
|
||||
{
|
||||
int linewidth = GetThickness() == 0 ? GetDefaultLineThickness() : GetThickness();
|
||||
|
|
|
@ -219,6 +219,8 @@ public:
|
|||
return wxT( "SCH_LABEL" );
|
||||
}
|
||||
|
||||
bool IsType( const KICAD_T aScanTypes[] ) override ;
|
||||
|
||||
const EDA_RECT GetBoundingBox() const override;
|
||||
|
||||
bool IsConnectable() const override { return true; }
|
||||
|
|
|
@ -462,6 +462,12 @@ TOOL_ACTION EE_ACTIONS::cleanupSheetPins( "eeschema.InteractiveEdit.cleanupSheet
|
|||
_( "Cleanup Sheet Pins" ), _( "Delete unreferenced sheet pins" ),
|
||||
nullptr );
|
||||
|
||||
TOOL_ACTION EE_ACTIONS::editTextAndGraphics( "eeschema.InteractiveEdit.editTextAndGraphics",
|
||||
AS_GLOBAL, 0, "",
|
||||
_( "Edit Text & Graphics Properties..." ),
|
||||
_( "Edit text and graphics properties globally across schematic" ),
|
||||
reset_text_xpm );
|
||||
|
||||
TOOL_ACTION EE_ACTIONS::symbolProperties( "eeschema.InteractiveEdit.symbolProperties",
|
||||
AS_GLOBAL, 0, "",
|
||||
_( "Symbol Properties..." ), _( "Displays symbol properties dialog" ),
|
||||
|
|
|
@ -179,6 +179,7 @@ public:
|
|||
|
||||
// Miscellaneous
|
||||
static TOOL_ACTION cleanupSheetPins;
|
||||
static TOOL_ACTION editTextAndGraphics;
|
||||
static TOOL_ACTION toggleHiddenPins;
|
||||
static TOOL_ACTION toggleSyncedPinsMode;
|
||||
static TOOL_ACTION refreshPreview;
|
||||
|
|
|
@ -1421,4 +1421,5 @@ void SCH_EDIT_TOOL::setTransitions()
|
|||
Go( &SCH_EDIT_TOOL::BreakWire, EE_ACTIONS::breakBus.MakeEvent() );
|
||||
|
||||
Go( &SCH_EDIT_TOOL::CleanupSheetPins, EE_ACTIONS::cleanupSheetPins.MakeEvent() );
|
||||
Go( &SCH_EDIT_TOOL::GlobalEdit, EE_ACTIONS::editTextAndGraphics.MakeEvent() );
|
||||
}
|
||||
|
|
|
@ -59,6 +59,7 @@ public:
|
|||
int BreakWire( const TOOL_EVENT& aEvent );
|
||||
|
||||
int CleanupSheetPins( const TOOL_EVENT& aEvent );
|
||||
int GlobalEdit( const TOOL_EVENT& aEvent );
|
||||
|
||||
///> Deletes the selected items, or the item under the cursor.
|
||||
int DoDelete( const TOOL_EVENT& aEvent );
|
||||
|
|
|
@ -134,6 +134,10 @@ enum KICAD_T
|
|||
SCH_LINE_LOCATE_BUS_T,
|
||||
SCH_LINE_LOCATE_GRAPHIC_LINE_T,
|
||||
|
||||
// Same for picking labes attached to wires and/or busses
|
||||
SCH_LABEL_LOCATE_WIRE_T,
|
||||
SCH_LABEL_LOCATE_BUS_T,
|
||||
|
||||
// matches any type
|
||||
SCH_LOCATE_ANY_T,
|
||||
|
||||
|
|
|
@ -224,7 +224,13 @@ public:
|
|||
|
||||
void Empty() { m_Text.Empty(); }
|
||||
|
||||
/**
|
||||
static int MapOrientation( KICAD_T labelType, int aOrientation );
|
||||
|
||||
static EDA_TEXT_HJUSTIFY_T MapHorizJustify( int aHorizJustify );
|
||||
|
||||
static EDA_TEXT_VJUSTIFY_T MapVertJustify( int aVertJustify );
|
||||
|
||||
/**
|
||||
* Function Print
|
||||
* @param aDC = the current Device Context
|
||||
* @param aOffset = draw offset (usually (0,0))
|
||||
|
|
|
@ -64,8 +64,8 @@ enum UNDO_REDO_T {
|
|||
UR_LIBEDIT, // Specific to the component editor (libedit creates a full copy
|
||||
// of the current component when changed)
|
||||
UR_LIB_RENAME, // As UR_LIBEDIT, but old copy should be removed from library
|
||||
UR_EXCHANGE_T, ///< Use for changing the schematic text type where swapping
|
||||
///< data structure is insufficient to restore the change.
|
||||
UR_EXCHANGE_T, // Use for changing the schematic text type where swapping
|
||||
// data structure is insufficient to restore the change.
|
||||
UR_DRILLORIGIN, // origin changed (like UR_CHANGED, contains the origin and a copy)
|
||||
UR_GRIDORIGIN, // origin changed (like UR_CHANGED, contains the origin and a copy)
|
||||
UR_PAGESETTINGS // page settings or title block changes
|
||||
|
|
|
@ -388,7 +388,8 @@ TOOL_ACTION PCB_ACTIONS::editTracksAndVias( "pcbnew.GlobalEdit.editTracksAndVias
|
|||
|
||||
TOOL_ACTION PCB_ACTIONS::editTextAndGraphics( "pcbnew.GlobalEdit.editTextAndGraphics",
|
||||
AS_GLOBAL, 0, "",
|
||||
_( "Edit Text & Graphic Properties..." ), "",
|
||||
_( "Edit Text & Graphics Properties..." ),
|
||||
_( "Edit Text and graphics properties globally across board" ),
|
||||
reset_text_xpm );
|
||||
|
||||
TOOL_ACTION PCB_ACTIONS::globalDeletions( "pcbnew.GlobalEdit.globalDeletions",
|
||||
|
|
Loading…
Reference in New Issue