Separate Line Properties dialog from Bus/Wire, and handle Junctions in Bus/Wire.

Fixes https://gitlab.com/kicad/code/kicad/issues/9979
This commit is contained in:
Jeff Young 2022-03-16 13:43:19 +00:00
parent 1434988bf8
commit e68e2e973e
29 changed files with 1685 additions and 153 deletions

View File

@ -79,8 +79,8 @@ set( EESCHEMA_DLGS
dialogs/dialog_lib_text_properties_base.cpp
dialogs/dialog_lib_textbox_properties.cpp
dialogs/dialog_lib_textbox_properties_base.cpp
dialogs/dialog_line_wire_bus_properties.cpp
dialogs/dialog_line_wire_bus_properties_base.cpp
dialogs/dialog_line_properties.cpp
dialogs/dialog_line_properties_base.cpp
dialogs/dialog_migrate_buses.cpp
dialogs/dialog_migrate_buses_base.cpp
dialogs/dialog_netlist.cpp
@ -116,6 +116,8 @@ set( EESCHEMA_DLGS
dialogs/dialog_update_from_pcb_base.cpp
dialogs/dialog_update_symbol_fields.cpp
dialogs/dialog_update_symbol_fields_base.cpp
dialogs/dialog_wire_bus_properties.cpp
dialogs/dialog_wire_bus_properties_base.cpp
dialogs/panel_eeschema_color_settings.cpp
dialogs/panel_eeschema_display_options.cpp
dialogs/panel_eeschema_display_options_base.cpp

View File

@ -250,7 +250,8 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem( const SCH_SHEET_PATH& aS
SCH_TEXT* sch_text = dynamic_cast<SCH_TEXT*>( aItem );
SCH_JUNCTION* junction = dynamic_cast<SCH_JUNCTION*>( aItem );
m_parent->SaveCopyInUndoList( aSheetPath.LastScreen(), aItem, UNDO_REDO::CHANGED, m_appendUndo );
m_parent->SaveCopyInUndoList( aSheetPath.LastScreen(), aItem, UNDO_REDO::CHANGED, m_appendUndo,
false );
m_appendUndo = true;
if( eda_text )

View File

@ -97,7 +97,7 @@ bool DIALOG_JUNCTION_PROPS::TransferDataFromWindow()
for( SCH_JUNCTION* junction : m_junctions )
pickedItems.PushItem( ITEM_PICKER( m_frame->GetScreen(), junction, UNDO_REDO::CHANGED ) );
m_frame->SaveCopyInUndoList( pickedItems, UNDO_REDO::CHANGED, false );
m_frame->SaveCopyInUndoList( pickedItems, UNDO_REDO::CHANGED, false, false );
for( SCH_JUNCTION* junction : m_junctions )
{

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2017 Seth Hillbrand <hillbrand@ucdavis.edu>
* Copyright (C) 2014-2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2014-2022 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
@ -23,7 +23,7 @@
*/
#include <sch_line.h>
#include <dialog_line_wire_bus_properties.h>
#include <dialog_line_properties.h>
#include <dialogs/dialog_color_picker.h>
#include <settings/settings_manager.h>
#include <sch_edit_frame.h>
@ -31,11 +31,11 @@
#include <widgets/color_swatch.h>
DIALOG_LINE_WIRE_BUS_PROPERTIES::DIALOG_LINE_WIRE_BUS_PROPERTIES( SCH_EDIT_FRAME* aParent,
std::deque<SCH_ITEM*>& aItems ) :
DIALOG_LINE_WIRE_BUS_PROPERTIES_BASE( aParent ),
DIALOG_LINE_PROPERTIES::DIALOG_LINE_PROPERTIES( SCH_EDIT_FRAME* aParent,
std::deque<SCH_LINE*>& aLines ) :
DIALOG_LINE_PROPERTIES_BASE( aParent ),
m_frame( aParent ),
m_strokeItems( aItems ),
m_lines( aLines ),
m_width( aParent, m_staticTextWidth, m_lineWidth, m_staticWidthUnits, true )
{
m_colorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
@ -57,12 +57,12 @@ DIALOG_LINE_WIRE_BUS_PROPERTIES::DIALOG_LINE_WIRE_BUS_PROPERTIES( SCH_EDIT_FRAME
}
bool DIALOG_LINE_WIRE_BUS_PROPERTIES::TransferDataToWindow()
bool DIALOG_LINE_PROPERTIES::TransferDataToWindow()
{
SCH_ITEM* first_stroke_item = m_strokeItems.front();
SCH_LINE* first_stroke_item = m_lines.front();
if( std::all_of( m_strokeItems.begin() + 1, m_strokeItems.end(),
[&]( const SCH_ITEM* r )
if( std::all_of( m_lines.begin() + 1, m_lines.end(),
[&]( const SCH_LINE* r )
{
return r->GetPenWidth() == first_stroke_item->GetPenWidth();
} ) )
@ -74,8 +74,8 @@ bool DIALOG_LINE_WIRE_BUS_PROPERTIES::TransferDataToWindow()
m_width.SetValue( INDETERMINATE_ACTION );
}
if( std::all_of( m_strokeItems.begin() + 1, m_strokeItems.end(),
[&]( const SCH_ITEM* r )
if( std::all_of( m_lines.begin() + 1, m_lines.end(),
[&]( const SCH_LINE* r )
{
return r->GetStroke().GetColor() == first_stroke_item->GetStroke().GetColor();
} ) )
@ -87,8 +87,8 @@ bool DIALOG_LINE_WIRE_BUS_PROPERTIES::TransferDataToWindow()
m_colorSwatch->SetSwatchColor( COLOR4D::UNSPECIFIED, false );
}
if( std::all_of( m_strokeItems.begin() + 1, m_strokeItems.end(),
[&]( const SCH_ITEM* r )
if( std::all_of( m_lines.begin() + 1, m_lines.end(),
[&]( const SCH_LINE* r )
{
return r->GetStroke().GetPlotStyle() == first_stroke_item->GetStroke().GetPlotStyle();
} ) )
@ -112,7 +112,7 @@ bool DIALOG_LINE_WIRE_BUS_PROPERTIES::TransferDataToWindow()
}
void DIALOG_LINE_WIRE_BUS_PROPERTIES::resetDefaults( wxCommandEvent& event )
void DIALOG_LINE_PROPERTIES::resetDefaults( wxCommandEvent& event )
{
m_width.SetValue( 0 );
m_colorSwatch->SetSwatchColor( COLOR4D::UNSPECIFIED, false );
@ -123,35 +123,31 @@ void DIALOG_LINE_WIRE_BUS_PROPERTIES::resetDefaults( wxCommandEvent& event )
}
bool DIALOG_LINE_WIRE_BUS_PROPERTIES::TransferDataFromWindow()
bool DIALOG_LINE_PROPERTIES::TransferDataFromWindow()
{
PICKED_ITEMS_LIST pickedItems;
STROKE_PARAMS stroke;
for( SCH_ITEM* strokeItem : m_strokeItems )
pickedItems.PushItem( ITEM_PICKER( m_frame->GetScreen(), strokeItem, UNDO_REDO::CHANGED ) );
for( SCH_LINE* line : m_lines )
pickedItems.PushItem( ITEM_PICKER( m_frame->GetScreen(), line, UNDO_REDO::CHANGED ) );
m_frame->SaveCopyInUndoList( pickedItems, UNDO_REDO::CHANGED, false );
m_frame->SaveCopyInUndoList( pickedItems, UNDO_REDO::CHANGED, false, false );
for( SCH_ITEM* strokeItem : m_strokeItems )
for( SCH_LINE* line : m_lines )
{
stroke = strokeItem->GetStroke();
if( !m_width.IsIndeterminate() )
stroke.SetWidth( m_width.GetValue() );
line->SetLineWidth( m_width.GetValue() );
auto it = lineTypeNames.begin();
std::advance( it, m_typeCombo->GetSelection() );
if( it == lineTypeNames.end() )
stroke.SetPlotStyle( PLOT_DASH_TYPE::DEFAULT );
line->SetLineStyle( PLOT_DASH_TYPE::DEFAULT );
else
stroke.SetPlotStyle( it->first );
line->SetLineStyle( it->first );
stroke.SetColor( m_colorSwatch->GetSwatchColor() );
line->SetLineColor( m_colorSwatch->GetSwatchColor() );
strokeItem->SetStroke( stroke );
m_frame->UpdateItem( strokeItem, false, true );
m_frame->UpdateItem( line, false, true );
}
m_frame->GetCanvas()->Refresh();

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2017 Seth Hillbrand <hillbrand@ucdavis.edu>
* Copyright (C) 2014-2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2014-2022 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
@ -22,10 +22,10 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef DIALOG_LINE_WIRE_BUS_PROPERTIES_H
#define DIALOG_LINE_WIRE_BUS_PROPERTIES_H
#ifndef DIALOG_LINE_PROPERTIES_H
#define DIALOG_LINE_PROPERTIES_H
#include <dialog_line_wire_bus_properties_base.h>
#include <dialog_line_properties_base.h>
#include <widgets/unit_binder.h>
@ -33,21 +33,21 @@ class SCH_EDIT_FRAME;
class SCH_LINE;
class DIALOG_LINE_WIRE_BUS_PROPERTIES : public DIALOG_LINE_WIRE_BUS_PROPERTIES_BASE
class DIALOG_LINE_PROPERTIES : public DIALOG_LINE_PROPERTIES_BASE
{
public:
DIALOG_LINE_WIRE_BUS_PROPERTIES( SCH_EDIT_FRAME* aParent, std::deque<SCH_ITEM*>& aItems );
DIALOG_LINE_PROPERTIES( SCH_EDIT_FRAME* aParent, std::deque<SCH_LINE*>& aLines );
bool TransferDataToWindow() override;
bool TransferDataFromWindow() override;
private:
SCH_EDIT_FRAME* m_frame;
std::deque<SCH_ITEM*> m_strokeItems;
std::deque<SCH_LINE*> m_lines;
UNIT_BINDER m_width;
void resetDefaults( wxCommandEvent& event ) override;
};
#endif // DIALOG_LINE_WIRE_BUS_PROPERTIES_H
#endif // DIALOG_LINE_PROPERTIES_H

View File

@ -7,15 +7,15 @@
#include "widgets/color_swatch.h"
#include "dialog_line_wire_bus_properties_base.h"
#include "dialog_line_properties_base.h"
///////////////////////////////////////////////////////////////////////////
BEGIN_EVENT_TABLE( DIALOG_LINE_WIRE_BUS_PROPERTIES_BASE, DIALOG_SHIM )
EVT_BUTTON( wxID_APPLY, DIALOG_LINE_WIRE_BUS_PROPERTIES_BASE::_wxFB_resetDefaults )
BEGIN_EVENT_TABLE( DIALOG_LINE_PROPERTIES_BASE, DIALOG_SHIM )
EVT_BUTTON( wxID_APPLY, DIALOG_LINE_PROPERTIES_BASE::_wxFB_resetDefaults )
END_EVENT_TABLE()
DIALOG_LINE_WIRE_BUS_PROPERTIES_BASE::DIALOG_LINE_WIRE_BUS_PROPERTIES_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
DIALOG_LINE_PROPERTIES_BASE::DIALOG_LINE_PROPERTIES_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 );
@ -73,7 +73,7 @@ DIALOG_LINE_WIRE_BUS_PROPERTIES_BASE::DIALOG_LINE_WIRE_BUS_PROPERTIES_BASE( wxWi
mainSizer->Add( fgSizerGeneral, 1, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 10 );
m_helpLabel1 = new wxStaticText( this, wxID_ANY, _("Set width to 0 to use Netclass line widths."), wxDefaultPosition, wxDefaultSize, 0 );
m_helpLabel1 = new wxStaticText( this, wxID_ANY, _("Set width to 0 to use Schematic default line width."), wxDefaultPosition, wxDefaultSize, 0 );
m_helpLabel1->Wrap( 333 );
mainSizer->Add( m_helpLabel1, 0, wxRIGHT|wxLEFT, 10 );
@ -103,6 +103,6 @@ DIALOG_LINE_WIRE_BUS_PROPERTIES_BASE::DIALOG_LINE_WIRE_BUS_PROPERTIES_BASE( wxWi
this->Centre( wxBOTH );
}
DIALOG_LINE_WIRE_BUS_PROPERTIES_BASE::~DIALOG_LINE_WIRE_BUS_PROPERTIES_BASE()
DIALOG_LINE_PROPERTIES_BASE::~DIALOG_LINE_PROPERTIES_BASE()
{
}

View File

@ -11,12 +11,12 @@
<property name="embedded_files_path">res</property>
<property name="encoding">UTF-8</property>
<property name="event_generation">table</property>
<property name="file">dialog_line_wire_bus_properties_base</property>
<property name="file">dialog_line_properties_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="indent_with_spaces"></property>
<property name="internationalize">1</property>
<property name="name">dialog_line_wire_bus_properties</property>
<property name="name">dialog_line_properties</property>
<property name="namespace"></property>
<property name="path">.</property>
<property name="precompiled_header"></property>
@ -43,12 +43,12 @@
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">DIALOG_LINE_WIRE_BUS_PROPERTIES_BASE</property>
<property name="name">DIALOG_LINE_PROPERTIES_BASE</property>
<property name="pos"></property>
<property name="size">-1,-1</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">Line, Wire &amp; Bus Properties</property>
<property name="title">Line Properties</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
@ -616,7 +616,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Set width to 0 to use Netclass line widths.</property>
<property name="label">Set width to 0 to use Schematic default line width.</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>

View File

@ -30,9 +30,9 @@ class COLOR_SWATCH;
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_LINE_WIRE_BUS_PROPERTIES_BASE
/// Class DIALOG_LINE_PROPERTIES_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_LINE_WIRE_BUS_PROPERTIES_BASE : public DIALOG_SHIM
class DIALOG_LINE_PROPERTIES_BASE : public DIALOG_SHIM
{
DECLARE_EVENT_TABLE()
private:
@ -64,8 +64,8 @@ class DIALOG_LINE_WIRE_BUS_PROPERTIES_BASE : public DIALOG_SHIM
public:
DIALOG_LINE_WIRE_BUS_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Line, Wire & Bus Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_LINE_WIRE_BUS_PROPERTIES_BASE();
DIALOG_LINE_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Line Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_LINE_PROPERTIES_BASE();
};

View File

@ -90,7 +90,10 @@ bool DIALOG_SHAPE_PROPERTIES::TransferDataFromWindow()
return false;
if( !m_shape->IsNew() )
m_frame->SaveCopyInUndoList( m_frame->GetScreen(), m_shape, UNDO_REDO::CHANGED, false );
{
m_frame->SaveCopyInUndoList( m_frame->GetScreen(), m_shape, UNDO_REDO::CHANGED, false,
false );
}
STROKE_PARAMS stroke = m_shape->GetStroke();

View File

@ -333,7 +333,7 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataFromWindow()
if( m_currentItem->GetEditFlags() == 0 )
{
m_frame->SaveCopyInUndoList( m_frame->GetScreen(), m_currentItem, UNDO_REDO::CHANGED,
false );
false, false );
}
m_frame->GetCanvas()->Refresh();

View File

@ -0,0 +1,225 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2017 Seth Hillbrand <hillbrand@ucdavis.edu>
* Copyright (C) 2014-2021 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 <sch_line.h>
#include <sch_bus_entry.h>
#include <sch_junction.h>
#include <dialog_wire_bus_properties.h>
#include <dialogs/dialog_color_picker.h>
#include <settings/settings_manager.h>
#include <sch_edit_frame.h>
#include <stroke_params.h>
#include <widgets/color_swatch.h>
DIALOG_WIRE_BUS_PROPERTIES::DIALOG_WIRE_BUS_PROPERTIES( SCH_EDIT_FRAME* aParent,
std::deque<SCH_ITEM*>& aItems ) :
DIALOG_WIRE_BUS_PROPERTIES_BASE( aParent ),
m_frame( aParent ),
m_items( aItems ),
m_wireWidth( aParent, m_staticTextWidth, m_lineWidth, m_staticWidthUnits ),
m_junctionSize( aParent, m_dotSizeLabel, m_dotSizeCtrl, m_dotSizeUnits )
{
m_colorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
m_helpLabel1->SetFont( KIUI::GetInfoFont( this ).Italic() );
m_helpLabel2->SetFont( KIUI::GetInfoFont( this ).Italic() );
SetInitialFocus( m_lineWidth );
for( const std::pair<const PLOT_DASH_TYPE, lineTypeStruct>& typeEntry : lineTypeNames )
m_typeCombo->Append( typeEntry.second.name, KiBitmap( typeEntry.second.bitmap ) );
m_typeCombo->Append( DEFAULT_STYLE );
SetupStandardButtons( { { wxID_APPLY, _( "Default" ) } } );
// Now all widgets have the size fixed, call FinishDialogSettings
finishDialogSettings();
}
bool DIALOG_WIRE_BUS_PROPERTIES::TransferDataToWindow()
{
STROKE_PARAMS stroke;
COLOR4D color;
int dotSize;
for( SCH_ITEM* item : m_items )
{
if( item->HasLineStroke() )
{
stroke = item->GetStroke();
color = stroke.GetColor();
}
else
{
wxASSERT( item->Type() == SCH_JUNCTION_T );
SCH_JUNCTION* junction = static_cast<SCH_JUNCTION*>( item );
color = junction->GetColor();
dotSize = junction->GetDiameter();
}
}
if( std::all_of( m_items.begin(), m_items.end(),
[&]( const SCH_ITEM* item )
{
return !item->HasLineStroke() || item->GetStroke().GetWidth() == stroke.GetWidth();
} ) )
{
m_wireWidth.SetValue( stroke.GetWidth() );
}
else
{
m_wireWidth.SetValue( INDETERMINATE_ACTION );
}
if( std::all_of( m_items.begin(), m_items.end(),
[&]( const SCH_ITEM* item )
{
if( item->HasLineStroke() )
return item->GetStroke().GetColor() == color;
else
return static_cast<const SCH_JUNCTION*>( item )->GetColor() == color;
} ) )
{
m_colorSwatch->SetSwatchColor( color, false );
}
else
{
m_colorSwatch->SetSwatchColor( COLOR4D::UNSPECIFIED, false );
}
if( std::all_of( m_items.begin(), m_items.end(),
[&]( const SCH_ITEM* item )
{
return !item->HasLineStroke()
|| item->GetStroke().GetPlotStyle() == stroke.GetPlotStyle();
} ) )
{
int style = static_cast<int>( stroke.GetPlotStyle() );
if( style == -1 )
m_typeCombo->SetStringSelection( DEFAULT_STYLE );
else if( style < (int) lineTypeNames.size() )
m_typeCombo->SetSelection( style );
else
wxFAIL_MSG( "Line type not found in the type lookup map" );
}
else
{
m_typeCombo->Append( INDETERMINATE_STYLE );
m_typeCombo->SetStringSelection( INDETERMINATE_STYLE );
}
if( std::all_of( m_items.begin(), m_items.end(),
[&]( const SCH_ITEM* item )
{
return item->Type() != SCH_JUNCTION_T
|| static_cast<const SCH_JUNCTION*>( item )->GetDiameter() == dotSize;
} ) )
{
m_junctionSize.SetValue( dotSize );
}
else
{
m_junctionSize.SetValue( INDETERMINATE_ACTION );
}
return true;
}
void DIALOG_WIRE_BUS_PROPERTIES::resetDefaults( wxCommandEvent& event )
{
m_wireWidth.SetValue( 0 );
m_colorSwatch->SetSwatchColor( COLOR4D::UNSPECIFIED, false );
m_typeCombo->SetStringSelection( DEFAULT_STYLE );
m_junctionSize.SetValue( 0 );
Refresh();
}
bool DIALOG_WIRE_BUS_PROPERTIES::TransferDataFromWindow()
{
PICKED_ITEMS_LIST pickedItems;
for( SCH_ITEM* strokeItem : m_items )
pickedItems.PushItem( ITEM_PICKER( m_frame->GetScreen(), strokeItem, UNDO_REDO::CHANGED ) );
m_frame->SaveCopyInUndoList( pickedItems, UNDO_REDO::CHANGED, false, false );
for( SCH_ITEM* item : m_items )
{
if( item->HasLineStroke() )
{
if( !m_wireWidth.IsIndeterminate() )
{
int width = m_wireWidth.GetValue();
if( item->Type() == SCH_LINE_T )
static_cast<SCH_LINE*>( item )->SetLineWidth( width );
else if( dynamic_cast<SCH_BUS_ENTRY_BASE*>( item ) )
static_cast<SCH_BUS_ENTRY_BASE*>( item )->SetPenWidth( width );
}
PLOT_DASH_TYPE lineStyle = PLOT_DASH_TYPE::DEFAULT;
auto it = lineTypeNames.begin();
std::advance( it, m_typeCombo->GetSelection() );
if( it != lineTypeNames.end() )
lineStyle = it->first;
if( item->Type() == SCH_LINE_T )
static_cast<SCH_LINE*>( item )->SetLineStyle( lineStyle );
else if( dynamic_cast<SCH_BUS_ENTRY_BASE*>( item ) )
static_cast<SCH_BUS_ENTRY_BASE*>( item )->SetLineStyle( lineStyle );
COLOR4D color = m_colorSwatch->GetSwatchColor();
if( item->Type() == SCH_LINE_T )
static_cast<SCH_LINE*>( item )->SetLineColor( color );
else if( dynamic_cast<SCH_BUS_ENTRY_BASE*>( item ) )
static_cast<SCH_BUS_ENTRY_BASE*>( item )->SetBusEntryColor( color );
}
else
{
SCH_JUNCTION* junction = static_cast<SCH_JUNCTION*>( item );
junction->SetColor( m_colorSwatch->GetSwatchColor() );
if( !m_junctionSize.IsIndeterminate() )
junction->SetDiameter( m_junctionSize.GetValue() );
}
m_frame->UpdateItem( item, false, true );
}
m_frame->GetCanvas()->Refresh();
m_frame->OnModify();
return true;
}

View File

@ -0,0 +1,54 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2017 Seth Hillbrand <hillbrand@ucdavis.edu>
* Copyright (C) 2014-2022 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
*/
#ifndef DIALOG_WIRE_BUS_PROPERTIES_H
#define DIALOG_WIRE_BUS_PROPERTIES_H
#include <dialog_wire_bus_properties_base.h>
#include <widgets/unit_binder.h>
class SCH_EDIT_FRAME;
class SCH_LINE;
class DIALOG_WIRE_BUS_PROPERTIES : public DIALOG_WIRE_BUS_PROPERTIES_BASE
{
public:
DIALOG_WIRE_BUS_PROPERTIES( SCH_EDIT_FRAME* aParent, std::deque<SCH_ITEM*>& aItems );
bool TransferDataToWindow() override;
bool TransferDataFromWindow() override;
private:
SCH_EDIT_FRAME* m_frame;
std::deque<SCH_ITEM*> m_items;
UNIT_BINDER m_wireWidth;
UNIT_BINDER m_junctionSize;
void resetDefaults( wxCommandEvent& event ) override;
};
#endif // DIALOG_WIRE_BUS_PROPERTIES_H

View File

@ -0,0 +1,122 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "widgets/color_swatch.h"
#include "dialog_wire_bus_properties_base.h"
///////////////////////////////////////////////////////////////////////////
BEGIN_EVENT_TABLE( DIALOG_WIRE_BUS_PROPERTIES_BASE, DIALOG_SHIM )
EVT_BUTTON( wxID_APPLY, DIALOG_WIRE_BUS_PROPERTIES_BASE::_wxFB_resetDefaults )
END_EVENT_TABLE()
DIALOG_WIRE_BUS_PROPERTIES_BASE::DIALOG_WIRE_BUS_PROPERTIES_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* mainSizer;
mainSizer = new wxBoxSizer( wxVERTICAL );
wxFlexGridSizer* fgSizerGeneral;
fgSizerGeneral = new wxFlexGridSizer( 0, 3, 0, 0 );
fgSizerGeneral->AddGrowableCol( 1 );
fgSizerGeneral->SetFlexibleDirection( wxBOTH );
fgSizerGeneral->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticTextWidth = new wxStaticText( this, wxID_ANY, _("Wire/bus width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextWidth->Wrap( -1 );
fgSizerGeneral->Add( m_staticTextWidth, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 3 );
m_lineWidth = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), 0 );
fgSizerGeneral->Add( m_lineWidth, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT, 3 );
m_staticWidthUnits = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticWidthUnits->Wrap( -1 );
m_staticWidthUnits->SetMinSize( wxSize( 40,-1 ) );
fgSizerGeneral->Add( m_staticWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 3 );
m_staticTextColor = new wxStaticText( this, wxID_ANY, _("Color:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextColor->Wrap( -1 );
fgSizerGeneral->Add( m_staticTextColor, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
m_panel1 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_SIMPLE|wxTAB_TRAVERSAL );
wxBoxSizer* bSizer2;
bSizer2 = new wxBoxSizer( wxVERTICAL );
m_colorSwatch = new COLOR_SWATCH( m_panel1, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
bSizer2->Add( m_colorSwatch, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 );
m_panel1->SetSizer( bSizer2 );
m_panel1->Layout();
bSizer2->Fit( m_panel1 );
fgSizerGeneral->Add( m_panel1, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT, 2 );
fgSizerGeneral->Add( 0, 0, 1, wxEXPAND, 5 );
m_staticTextStyle = new wxStaticText( this, wxID_ANY, _("Style:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextStyle->Wrap( -1 );
fgSizerGeneral->Add( m_staticTextStyle, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
m_typeCombo = new wxBitmapComboBox( this, wxID_ANY, _("Combo!"), wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY );
m_typeCombo->SetMinSize( wxSize( 240,-1 ) );
fgSizerGeneral->Add( m_typeCombo, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT, 3 );
fgSizerGeneral->Add( 0, 0, 1, wxEXPAND, 5 );
m_dotSizeLabel = new wxStaticText( this, wxID_ANY, _("Junction size:"), wxDefaultPosition, wxDefaultSize, 0 );
m_dotSizeLabel->Wrap( -1 );
fgSizerGeneral->Add( m_dotSizeLabel, 0, wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
m_dotSizeCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerGeneral->Add( m_dotSizeCtrl, 0, wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
m_dotSizeUnits = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_dotSizeUnits->Wrap( -1 );
fgSizerGeneral->Add( m_dotSizeUnits, 0, wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_CENTER_VERTICAL, 3 );
mainSizer->Add( fgSizerGeneral, 1, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 10 );
m_helpLabel1 = new wxStaticText( this, wxID_ANY, _("Set width to 0 to use Netclass wire/bus widths."), wxDefaultPosition, wxDefaultSize, 0 );
m_helpLabel1->Wrap( 333 );
mainSizer->Add( m_helpLabel1, 0, wxRIGHT|wxLEFT, 10 );
m_helpLabel2 = new wxStaticText( this, wxID_ANY, _("Set color to transparent to use Schematic Editor colors."), wxDefaultPosition, wxDefaultSize, 0 );
m_helpLabel2->Wrap( -1 );
mainSizer->Add( m_helpLabel2, 0, wxBOTTOM|wxRIGHT|wxLEFT, 10 );
m_staticline = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
mainSizer->Add( m_staticline, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
m_sdbSizer = new wxStdDialogButtonSizer();
m_sdbSizerOK = new wxButton( this, wxID_OK );
m_sdbSizer->AddButton( m_sdbSizerOK );
m_sdbSizerApply = new wxButton( this, wxID_APPLY );
m_sdbSizer->AddButton( m_sdbSizerApply );
m_sdbSizerCancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer->AddButton( m_sdbSizerCancel );
m_sdbSizer->Realize();
mainSizer->Add( m_sdbSizer, 0, wxALL|wxALIGN_RIGHT, 5 );
this->SetSizer( mainSizer );
this->Layout();
mainSizer->Fit( this );
this->Centre( wxBOTH );
}
DIALOG_WIRE_BUS_PROPERTIES_BASE::~DIALOG_WIRE_BUS_PROPERTIES_BASE()
{
}

View File

@ -0,0 +1,985 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="15" />
<object class="Project" expanded="1">
<property name="class_decoration"></property>
<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="embedded_files_path">res</property>
<property name="encoding">UTF-8</property>
<property name="event_generation">table</property>
<property name="file">dialog_wire_bus_properties_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="indent_with_spaces"></property>
<property name="internationalize">1</property>
<property name="name">dialog_wire_bus_properties</property>
<property name="namespace"></property>
<property name="path">.</property>
<property name="precompiled_header"></property>
<property name="relative_path">1</property>
<property name="skip_lua_events">1</property>
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_enum">1</property>
<property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1">
<property name="aui_managed">0</property>
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
<property name="bg"></property>
<property name="center">wxBOTH</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="enabled">1</property>
<property name="event_handler">impl_virtual</property>
<property name="extra_style"></property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">DIALOG_WIRE_BUS_PROPERTIES_BASE</property>
<property name="pos"></property>
<property name="size">-1,-1</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">Wire &amp; Bus Properties</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">mainSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">10</property>
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM|wxLEFT</property>
<property name="proportion">1</property>
<object class="wxFlexGridSizer" expanded="1">
<property name="cols">3</property>
<property name="flexible_direction">wxBOTH</property>
<property name="growablecols">1</property>
<property name="growablerows"></property>
<property name="hgap">0</property>
<property name="minimum_size"></property>
<property name="name">fgSizerGeneral</property>
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
<property name="permission">none</property>
<property name="rows">0</property>
<property name="vgap">0</property>
<object class="sizeritem" expanded="0">
<property name="border">3</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Wire/bus width:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticTextWidth</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">3</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength">0</property>
<property name="min_size">-1,-1</property>
<property name="minimize_button">0</property>
<property name="minimum_size">-1,-1</property>
<property name="moveable">1</property>
<property name="name">m_lineWidth</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size">-1,-1</property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">3</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">unit</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size">40,-1</property>
<property name="moveable">1</property>
<property name="name">m_staticWidthUnits</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Color:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticTextColor</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; Not forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">2</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxPanel" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_panel1</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxBORDER_SIMPLE|wxTAB_TRAVERSAL</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer2</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL</property>
<property name="proportion">0</property>
<object class="CustomControl" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="class">COLOR_SWATCH</property>
<property name="close_button">1</property>
<property name="construction"></property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="declaration"></property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="include"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_colorSwatch</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="settings"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="subclass">COLOR_SWATCH; widgets/color_swatch.h; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="spacer" expanded="1">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Style:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticTextStyle</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxBitmapComboBox" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="choices"></property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size">240,-1</property>
<property name="moveable">1</property>
<property name="name">m_typeCombo</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="selection">-1</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxCB_READONLY</property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value">Combo!</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="spacer" expanded="1">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Junction size:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_dotSizeLabel</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_dotSizeCtrl</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">unit</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_dotSizeUnits</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">10</property>
<property name="flag">wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Set width to 0 to use Netclass wire/bus widths.</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_helpLabel1</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">333</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">10</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Set color to transparent to use Schematic Editor colors.</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_helpLabel2</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticLine" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticline</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxLI_HORIZONTAL</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxALIGN_RIGHT</property>
<property name="proportion">0</property>
<object class="wxStdDialogButtonSizer" expanded="1">
<property name="Apply">1</property>
<property name="Cancel">1</property>
<property name="ContextHelp">0</property>
<property name="Help">0</property>
<property name="No">0</property>
<property name="OK">1</property>
<property name="Save">0</property>
<property name="Yes">0</property>
<property name="minimum_size"></property>
<property name="name">m_sdbSizer</property>
<property name="permission">protected</property>
<event name="OnApplyButtonClick">resetDefaults</event>
</object>
</object>
</object>
</object>
</object>
</wxFormBuilder_Project>

View File

@ -0,0 +1,74 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#pragma once
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class COLOR_SWATCH;
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/textctrl.h>
#include <wx/sizer.h>
#include <wx/panel.h>
#include <wx/bmpcbox.h>
#include <wx/statline.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_WIRE_BUS_PROPERTIES_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_WIRE_BUS_PROPERTIES_BASE : public DIALOG_SHIM
{
DECLARE_EVENT_TABLE()
private:
// Private event handlers
void _wxFB_resetDefaults( wxCommandEvent& event ){ resetDefaults( event ); }
protected:
wxStaticText* m_staticTextWidth;
wxTextCtrl* m_lineWidth;
wxStaticText* m_staticWidthUnits;
wxStaticText* m_staticTextColor;
wxPanel* m_panel1;
COLOR_SWATCH* m_colorSwatch;
wxStaticText* m_staticTextStyle;
wxBitmapComboBox* m_typeCombo;
wxStaticText* m_dotSizeLabel;
wxTextCtrl* m_dotSizeCtrl;
wxStaticText* m_dotSizeUnits;
wxStaticText* m_helpLabel1;
wxStaticText* m_helpLabel2;
wxStaticLine* m_staticline;
wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizerOK;
wxButton* m_sdbSizerApply;
wxButton* m_sdbSizerCancel;
// Virtual event handlers, overide them in your derived class
virtual void resetDefaults( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_WIRE_BUS_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Wire & Bus Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_WIRE_BUS_PROPERTIES_BASE();
};

View File

@ -191,6 +191,20 @@ COLOR4D SCH_BUS_ENTRY_BASE::GetBusEntryColor() const
}
void SCH_BUS_ENTRY_BASE::SetPenWidth( int aWidth )
{
m_stroke.SetWidth( aWidth );
m_lastResolvedWidth = aWidth;
}
void SCH_BUS_ENTRY_BASE::SetBusEntryColor( const COLOR4D& aColor )
{
m_stroke.SetColor( aColor );
m_lastResolvedColor = aColor;
}
PLOT_DASH_TYPE SCH_BUS_ENTRY_BASE::GetLineStyle() const
{
if( m_stroke.GetPlotStyle() != PLOT_DASH_TYPE::DEFAULT )
@ -209,6 +223,13 @@ PLOT_DASH_TYPE SCH_BUS_ENTRY_BASE::GetLineStyle() const
}
void SCH_BUS_ENTRY_BASE::SetLineStyle( PLOT_DASH_TYPE aStyle )
{
m_stroke.SetPlotStyle( aStyle );
m_lastResolvedLineStyle = aStyle;
}
int SCH_BUS_WIRE_ENTRY::GetPenWidth() const
{
if( m_stroke.GetWidth() > 0 )

View File

@ -71,15 +71,17 @@ public:
wxSize GetSize() const { return m_size; }
void SetSize( const wxSize& aSize ) { m_size = aSize; }
void SetPenWidth( int aWidth ) { m_stroke.SetWidth( aWidth ); }
void SetPenWidth( int aWidth );
virtual bool HasLineStroke() const override { return true; }
virtual STROKE_PARAMS GetStroke() const override { return m_stroke; }
virtual void SetStroke( const STROKE_PARAMS& aStroke ) override { m_stroke = aStroke; }
PLOT_DASH_TYPE GetLineStyle() const;
void SetLineStyle( PLOT_DASH_TYPE aStyle );
COLOR4D GetBusEntryColor() const;
void SetBusEntryColor( const COLOR4D& aColor );
void SwapData( SCH_ITEM* aItem ) override;

View File

@ -687,9 +687,10 @@ public:
* @param aItemToCopy is the schematic item modified by the command to undo.
* @param aTypeCommand is the command type (see enum UNDO_REDO).
* @param aAppend set to true to add the item to the previous undo list.
* @param aDirtyConnectivity set to true if the change can affect connectivity.
*/
void SaveCopyInUndoList( SCH_SCREEN* aScreen, SCH_ITEM* aItemToCopy, UNDO_REDO aTypeCommand,
bool aAppend );
bool aAppend, bool aDirtyConnectivity = true );
/**
* Create a new entry in undo list of commands.
@ -697,9 +698,10 @@ public:
* @param aItemsList is the list of items modified by the command to undo/
* @param aTypeCommand is the command type (see enum UNDO_REDO).
* @param aAppend set to true to add the item to the previous undo list.
* @param aDirtyConnectivity set to true if the change can affect connectivity.
*/
void SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList, UNDO_REDO aTypeCommand,
bool aAppend );
bool aAppend, bool aDirtyConnectivity = true );
/**
* Restore an undo or redo command to put data pointed by \a aList in the previous state.

View File

@ -173,6 +173,13 @@ void SCH_JUNCTION::Show( int nestLevel, std::ostream& os ) const
#endif
void SCH_JUNCTION::SetDiameter( int aDiameter )
{
m_diameter = aDiameter;
m_lastResolvedDiameter = aDiameter;
}
COLOR4D SCH_JUNCTION::GetJunctionColor() const
{
if( m_color != COLOR4D::UNSPECIFIED )
@ -191,6 +198,13 @@ COLOR4D SCH_JUNCTION::GetJunctionColor() const
}
void SCH_JUNCTION::SetColor( const COLOR4D& aColor )
{
m_color = aColor;
m_lastResolvedColor = aColor;
}
int SCH_JUNCTION::GetEffectiveDiameter() const
{
return getEffectiveShape().GetRadius() * 2;

View File

@ -107,12 +107,12 @@ public:
int GetEffectiveDiameter() const;
int GetDiameter() const { return m_diameter; }
void SetDiameter( int aDiameter ) { m_diameter = aDiameter; }
void SetDiameter( int aDiameter );
COLOR4D GetJunctionColor() const;
COLOR4D GetColor() const { return m_color; }
void SetColor( const COLOR4D& aColor ) { m_color = aColor; }
void SetColor( const COLOR4D& aColor );
bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;

View File

@ -215,6 +215,7 @@ double SCH_LINE::GetLength() const
void SCH_LINE::SetLineColor( const COLOR4D& aColor )
{
m_stroke.SetColor( aColor );
m_lastResolvedColor = GetLineColor();
}
@ -281,6 +282,8 @@ void SCH_LINE::SetLineStyle( const PLOT_DASH_TYPE aStyle )
m_stroke.SetPlotStyle( PLOT_DASH_TYPE::DEFAULT );
else
m_stroke.SetPlotStyle( aStyle );
m_lastResolvedLineStyle = GetLineStyle();
}
@ -321,6 +324,7 @@ PLOT_DASH_TYPE SCH_LINE::GetEffectiveLineStyle() const
void SCH_LINE::SetLineWidth( const int aSize )
{
m_stroke.SetWidth( aSize );
m_lastResolvedWidth = GetPenWidth();
}

View File

@ -103,17 +103,16 @@ void SCH_EDIT_FRAME::StartNewUndo()
}
void SCH_EDIT_FRAME::SaveCopyInUndoList( SCH_SCREEN* aScreen,
SCH_ITEM* aItem,
UNDO_REDO aCommandType,
bool aAppend )
void SCH_EDIT_FRAME::SaveCopyInUndoList( SCH_SCREEN* aScreen, SCH_ITEM* aItem,
UNDO_REDO aCommandType, bool aAppend,
bool aDirtyConnectivity )
{
PICKED_ITEMS_LIST* commandToUndo = nullptr;
wxCHECK( aItem, /* void */ );
// Connectivity may change
aItem->SetConnectivityDirty();
if( aDirtyConnectivity )
aItem->SetConnectivityDirty();
PICKED_ITEMS_LIST* lastUndo = PopCommandFromUndoList();
@ -168,8 +167,8 @@ void SCH_EDIT_FRAME::SaveCopyInUndoList( SCH_SCREEN* aScreen,
void SCH_EDIT_FRAME::SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList,
UNDO_REDO aTypeCommand,
bool aAppend )
UNDO_REDO aTypeCommand, bool aAppend,
bool aDirtyConnectivity )
{
PICKED_ITEMS_LIST* commandToUndo = nullptr;
@ -209,8 +208,8 @@ void SCH_EDIT_FRAME::SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList,
if( !sch_item )
continue;
// Connectivity may change
sch_item->SetConnectivityDirty();
if( aDirtyConnectivity )
sch_item->SetConnectivityDirty();
UNDO_REDO command = commandToUndo->GetPickedItemStatus( ii );

View File

@ -124,17 +124,3 @@ void EE_SELECTION::GetMultiUnitSymbols( SCH_MULTI_UNIT_REFERENCE_MAP& aRefList,
aSelectionPath.AppendMultiUnitSymbol( aRefList, symbol, aIncludePowerSymbols );
}
}
bool EE_SELECTION::AllItemsHaveLineStroke() const
{
for( const EDA_ITEM* item : m_items )
{
const SCH_ITEM* schItem = dynamic_cast<const SCH_ITEM*>( item );
if( !schItem || !schItem->HasLineStroke() )
return false;
}
return true;
}

View File

@ -76,13 +76,6 @@ public:
void GetMultiUnitSymbols( SCH_MULTI_UNIT_REFERENCE_MAP& aRefList,
const SCH_SHEET_PATH& aSelectionPath,
bool aIncludePowerSymbols = true );
/**
* Checks if all items in the selection support line strokes
*
* @return True if all items support line strokes
*/
bool AllItemsHaveLineStroke() const;
};
#endif // EE_SELECTION_H

View File

@ -131,7 +131,8 @@ protected:
///< Similar to m_frame->SaveCopyInUndoList(), but handles items that are owned by their
///< parents.
void saveCopyInUndoList( EDA_ITEM* aItem, UNDO_REDO aType, bool aAppend = false )
void saveCopyInUndoList( EDA_ITEM* aItem, UNDO_REDO aType, bool aAppend = false,
bool aDirtyConnectivity = true )
{
KICAD_T itemType = aItem->Type();
bool selected = aItem->IsSelected();
@ -157,13 +158,13 @@ protected:
{
editFrame->SaveCopyInUndoList( editFrame->GetScreen(),
static_cast<SCH_ITEM*>( aItem->GetParent() ),
UNDO_REDO::CHANGED, aAppend );
UNDO_REDO::CHANGED, aAppend, aDirtyConnectivity );
}
else
{
editFrame->SaveCopyInUndoList( editFrame->GetScreen(),
static_cast<SCH_ITEM*>( aItem ),
aType, aAppend );
static_cast<SCH_ITEM*>( aItem ), aType, aAppend,
aDirtyConnectivity );
}
}

View File

@ -48,7 +48,7 @@
#include <eeschema_settings.h>
#include <dialogs/dialog_label_properties.h>
#include <dialogs/dialog_text_properties.h>
#include <dialogs/dialog_line_wire_bus_properties.h>
#include <dialogs/dialog_wire_bus_properties.h>
#include <dialogs/dialog_junction_props.h>
#include <dialogs/dialog_sheet_pin_properties.h>
#include <string_utils.h>
@ -814,7 +814,7 @@ int SCH_DRAWING_TOOLS::SingleClickPlace( const TOOL_EVENT& aEvent )
std::deque<SCH_ITEM*> strokeItems;
strokeItems.push_back( previewItem );
DIALOG_LINE_WIRE_BUS_PROPERTIES dlg( m_frame, strokeItems );
DIALOG_WIRE_BUS_PROPERTIES dlg( m_frame, strokeItems );
if( dlg.ShowModal() == wxID_OK )
{

View File

@ -56,7 +56,8 @@
#include <wx/gdicmn.h>
#include <dialogs/dialog_change_symbols.h>
#include <dialogs/dialog_image_editor.h>
#include <dialogs/dialog_line_wire_bus_properties.h>
#include <dialogs/dialog_line_properties.h>
#include <dialogs/dialog_wire_bus_properties.h>
#include <dialogs/dialog_symbol_properties.h>
#include <dialogs/dialog_sheet_pin_properties.h>
#include <dialogs/dialog_field_properties.h>
@ -263,10 +264,37 @@ bool SCH_EDIT_TOOL::Init()
case SCH_LINE_T:
case SCH_BUS_WIRE_ENTRY_T:
return eeSelection->AllItemsHaveLineStroke();
case SCH_JUNCTION_T:
return eeSelection->AreAllItemsIdentical();
if( std::all_of( aSel.Items().begin(), aSel.Items().end(),
[&]( const EDA_ITEM* item )
{
return item->Type() == SCH_LINE_T
&& static_cast<const SCH_LINE*>( item )->IsGraphicLine();
} ) )
{
return true;
}
else if( std::all_of( aSel.Items().begin(), aSel.Items().end(),
[&]( const EDA_ITEM* item )
{
return item->Type() == SCH_JUNCTION_T;
} ) )
{
return true;
}
else if( std::all_of( aSel.Items().begin(), aSel.Items().end(),
[&]( const EDA_ITEM* item )
{
const SCH_ITEM* schItem = dynamic_cast<const SCH_ITEM*>( item );
return ( schItem->HasLineStroke() && schItem->IsConnectable() )
|| item->Type() == SCH_JUNCTION_T;
} ) )
{
return true;
}
return false;
default:
return false;
@ -1259,7 +1287,7 @@ int SCH_EDIT_TOOL::AutoplaceFields( const TOOL_EVENT& aEvent )
SCH_ITEM* sch_item = static_cast<SCH_ITEM*>( selection.GetItem( ii ) );
if( !moving && !sch_item->IsNew() )
saveCopyInUndoList( sch_item, UNDO_REDO::CHANGED, ii > 0 );
saveCopyInUndoList( sch_item, UNDO_REDO::CHANGED, ii > 0, false );
if( sch_item->IsType( EE_COLLECTOR::FieldOwners ) )
sch_item->AutoplaceFields( m_frame->GetScreen(), /* aManual */ true );
@ -1370,15 +1398,7 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
{
case SCH_LINE_T:
case SCH_BUS_WIRE_ENTRY_T:
if( !selection.AllItemsHaveLineStroke() )
return 0;
break;
case SCH_JUNCTION_T:
if( !selection.AreAllItemsIdentical() )
return 0;
break;
default:
@ -1556,7 +1576,7 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
{
// save old image in undo list if not already in edit
if( bitmap->GetEditFlags() == 0 )
saveCopyInUndoList( bitmap, UNDO_REDO::CHANGED );
saveCopyInUndoList( bitmap, UNDO_REDO::CHANGED, false, false );
dlg.TransferToImage( bitmap->GetImage() );
@ -1570,50 +1590,73 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
case SCH_LINE_T:
case SCH_BUS_WIRE_ENTRY_T:
{
std::deque<SCH_ITEM*> strokeItems;
for( EDA_ITEM* selItem : selection.Items() )
{
SCH_ITEM* schItem = dynamic_cast<SCH_ITEM*>( selItem );
if( schItem && schItem->HasLineStroke() )
strokeItems.push_back( schItem );
else
return 0;
}
DIALOG_LINE_WIRE_BUS_PROPERTIES dlg( m_frame, strokeItems );
if( dlg.ShowModal() == wxID_OK )
{
m_toolMgr->PostEvent( EVENTS::SelectedItemsModified );
m_frame->OnModify();
}
}
break;
case SCH_JUNCTION_T:
{
std::deque<SCH_JUNCTION*> junctions;
for( EDA_ITEM* selItem : selection.Items() )
if( std::all_of( selection.Items().begin(), selection.Items().end(),
[&]( const EDA_ITEM* item )
{
return item->Type() == SCH_LINE_T
&& static_cast<const SCH_LINE*>( item )->IsGraphicLine();
} ) )
{
SCH_JUNCTION* junction = dynamic_cast<SCH_JUNCTION*>( selItem );
std::deque<SCH_LINE*> lines;
wxCHECK( junction, 0 );
for( EDA_ITEM* selItem : selection.Items() )
lines.push_back( static_cast<SCH_LINE*>( selItem ) );
junctions.push_back( junction );
DIALOG_LINE_PROPERTIES dlg( m_frame, lines );
if( dlg.ShowModal() == wxID_OK )
{
m_toolMgr->PostEvent( EVENTS::SelectedItemsModified );
m_frame->OnModify();
}
}
else if( std::all_of( selection.Items().begin(), selection.Items().end(),
[&]( const EDA_ITEM* item )
{
return item->Type() == SCH_JUNCTION_T;
} ) )
{
std::deque<SCH_JUNCTION*> junctions;
for( EDA_ITEM* selItem : selection.Items() )
junctions.push_back( static_cast<SCH_JUNCTION*>( selItem ) );
DIALOG_JUNCTION_PROPS dlg( m_frame, junctions );
if( dlg.ShowModal() == wxID_OK )
{
m_toolMgr->PostEvent( EVENTS::SelectedItemsModified );
m_frame->OnModify();
}
}
else if( std::all_of( selection.Items().begin(), selection.Items().end(),
[&]( const EDA_ITEM* item )
{
const SCH_ITEM* schItem = dynamic_cast<const SCH_ITEM*>( item );
return ( schItem->HasLineStroke() && schItem->IsConnectable() )
|| item->Type() == SCH_JUNCTION_T;
} ) )
{
std::deque<SCH_ITEM*> items;
for( EDA_ITEM* selItem : selection.Items() )
items.push_back( static_cast<SCH_ITEM*>( selItem ) );
DIALOG_WIRE_BUS_PROPERTIES dlg( m_frame, items );
if( dlg.ShowModal() == wxID_OK )
{
m_toolMgr->PostEvent( EVENTS::SelectedItemsModified );
m_frame->OnModify();
}
}
else
{
return 0;
}
DIALOG_JUNCTION_PROPS dlg( m_frame, junctions );
if( dlg.ShowModal() == wxID_OK )
{
m_toolMgr->PostEvent( EVENTS::SelectedItemsModified );
m_frame->OnModify();
}
}
break;
case SCH_MARKER_T: // These items have no properties to edit

View File

@ -127,7 +127,7 @@ int SCH_EDITOR_CONTROL::PageSetup( const TOOL_EVENT& aEvent )
ITEM_PICKER wrapper( m_frame->GetScreen(), undoItem, UNDO_REDO::PAGESETTINGS );
undoCmd.PushItem( wrapper );
m_frame->SaveCopyInUndoList( undoCmd, UNDO_REDO::PAGESETTINGS, false );
m_frame->SaveCopyInUndoList( undoCmd, UNDO_REDO::PAGESETTINGS, false, false );
DIALOG_EESCHEMA_PAGE_SETTINGS dlg( m_frame, wxSize( MAX_PAGE_SIZE_MILS, MAX_PAGE_SIZE_MILS ) );
dlg.SetWksFileName( BASE_SCREEN::m_DrawingSheetFileName );

View File

@ -190,6 +190,11 @@ public:
return m_items;
}
const std::deque<EDA_ITEM*>& Items() const
{
return m_items;
}
template<class T>
T* FirstOfKind() const
{