Eeschema: allow editing of junction properties diameter and color.
Add missing plot and print changes for the new bus entry properties. ADDED: Junction properties diameter and color can now be edited. Fixes: https://gitlab.com/kicad/code/kicad/issues/4593
This commit is contained in:
parent
853cf2c9b9
commit
2078e629c5
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2017 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2017-2020 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
|
||||
|
@ -594,3 +594,23 @@ void PLOTTER::PlotPoly( const SHAPE_LINE_CHAIN& aCornerList, FILL_T aFill,
|
|||
|
||||
PlotPoly( cornerList, aFill, aWidth, aData );
|
||||
}
|
||||
|
||||
|
||||
wxPenStyle GetwxPenStyle( PLOT_DASH_TYPE aType )
|
||||
{
|
||||
switch( aType )
|
||||
{
|
||||
case PLOT_DASH_TYPE::DEFAULT:
|
||||
case PLOT_DASH_TYPE::SOLID:
|
||||
return wxPENSTYLE_SOLID;
|
||||
case PLOT_DASH_TYPE::DASH:
|
||||
return wxPENSTYLE_SHORT_DASH;
|
||||
case PLOT_DASH_TYPE::DOT:
|
||||
return wxPENSTYLE_DOT;
|
||||
case PLOT_DASH_TYPE::DASHDOT:
|
||||
return wxPENSTYLE_DOT_DASH;
|
||||
default:
|
||||
wxFAIL_MSG( "Unhandled PlotDashType" );
|
||||
return wxPENSTYLE_SOLID;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,6 +60,8 @@ set( EESCHEMA_DLGS
|
|||
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_junction_props.cpp
|
||||
dialogs/dialog_junction_props_base.cpp
|
||||
dialogs/dialog_lib_edit_draw_item.cpp
|
||||
dialogs/dialog_lib_edit_draw_item_base.cpp
|
||||
dialogs/dialog_lib_edit_pin.cpp
|
||||
|
|
|
@ -0,0 +1,192 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2020 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* Copyright (C) 2020 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <bitmaps.h>
|
||||
#include <sch_junction.h>
|
||||
#include <dialog_junction_props.h>
|
||||
#include <dialogs/dialog_color_picker.h>
|
||||
#include <pgm_base.h>
|
||||
#include <settings/settings_manager.h>
|
||||
#include <sch_edit_frame.h>
|
||||
|
||||
const int BUTT_COLOR_MINSIZE_X = 32;
|
||||
const int BUTT_COLOR_MINSIZE_Y = 20;
|
||||
|
||||
|
||||
static COLOR4D GetIndeterminateColor()
|
||||
{
|
||||
COLOR4D indeterminateColor;
|
||||
|
||||
indeterminateColor.r = indeterminateColor.b = indeterminateColor.g =
|
||||
indeterminateColor.a = -1.0;
|
||||
|
||||
return indeterminateColor;
|
||||
}
|
||||
|
||||
|
||||
DIALOG_JUNCTION_PROPS::DIALOG_JUNCTION_PROPS( SCH_EDIT_FRAME* aParent,
|
||||
std::deque<SCH_JUNCTION*>& aJunctions ) :
|
||||
DIALOG_JUNCTION_PROPS_BASE( aParent ),
|
||||
m_frame( aParent ),
|
||||
m_junctions( aJunctions ),
|
||||
m_diameter( aParent, m_staticTextDiameter, m_textCtrlDiameter,
|
||||
m_staticTextDiameterUnits, true )
|
||||
{
|
||||
m_sdbSizerApply->SetLabel( _( "Default" ) );
|
||||
|
||||
SetInitialFocus( m_textCtrlDiameter );
|
||||
|
||||
m_sdbSizerOK->SetDefault();
|
||||
|
||||
// Now all widgets have the size fixed, call FinishDialogSettings
|
||||
FinishDialogSettings();
|
||||
}
|
||||
|
||||
|
||||
bool DIALOG_JUNCTION_PROPS::TransferDataToWindow()
|
||||
{
|
||||
auto firstJunction = m_junctions.front();
|
||||
|
||||
if( std::all_of( m_junctions.begin() + 1, m_junctions.end(),
|
||||
[&]( const SCH_JUNCTION* r )
|
||||
{
|
||||
return r->GetDiameter() == firstJunction->GetDiameter();
|
||||
} ) )
|
||||
{
|
||||
m_diameter.SetValue( firstJunction->GetDiameter() );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_diameter.SetValue( INDETERMINATE_ACTION );
|
||||
}
|
||||
|
||||
if( std::all_of( m_junctions.begin() + 1, m_junctions.end(),
|
||||
[&]( const SCH_JUNCTION* r )
|
||||
{
|
||||
return r->GetColor() == firstJunction->GetColor();
|
||||
} ) )
|
||||
{
|
||||
setColor( firstJunction->GetColor() );
|
||||
}
|
||||
else
|
||||
{
|
||||
setColor( GetIndeterminateColor() );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_JUNCTION_PROPS::onColorButtonClicked( wxCommandEvent& event )
|
||||
{
|
||||
COLOR4D newColor = COLOR4D::UNSPECIFIED;
|
||||
DIALOG_COLOR_PICKER dialog( this, m_selectedColor, false );
|
||||
|
||||
if( dialog.ShowModal() == wxID_OK )
|
||||
newColor = dialog.GetColor();
|
||||
|
||||
if( m_selectedColor == newColor )
|
||||
return;
|
||||
|
||||
setColor( newColor );
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_JUNCTION_PROPS::updateColorButton( COLOR4D& aColor )
|
||||
{
|
||||
wxMemoryDC iconDC;
|
||||
|
||||
if( aColor == COLOR4D::UNSPECIFIED || aColor == GetIndeterminateColor() )
|
||||
{
|
||||
m_buttonColor->SetBitmap( KiBitmap( question_mark_xpm ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
wxBitmap bitmap( std::max( m_buttonColor->GetSize().x, BUTT_COLOR_MINSIZE_X ),
|
||||
std::max( m_buttonColor->GetSize().y, BUTT_COLOR_MINSIZE_Y ) );
|
||||
|
||||
iconDC.SelectObject( bitmap );
|
||||
iconDC.SetPen( *wxBLACK_PEN );
|
||||
|
||||
wxBrush brush( aColor.ToColour() );
|
||||
iconDC.SetBrush( brush );
|
||||
|
||||
// Paint the full bitmap in aColor:
|
||||
iconDC.SetBackground( brush );
|
||||
iconDC.Clear();
|
||||
|
||||
m_buttonColor->SetBitmap( bitmap );
|
||||
}
|
||||
|
||||
m_buttonColor->Refresh();
|
||||
|
||||
Refresh( false );
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_JUNCTION_PROPS::resetDefaults( wxCommandEvent& event )
|
||||
{
|
||||
m_diameter.SetValue( 0 );
|
||||
setColor( COLOR4D::UNSPECIFIED );
|
||||
|
||||
Refresh();
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_JUNCTION_PROPS::setColor( const COLOR4D& aColor )
|
||||
{
|
||||
m_selectedColor = aColor;
|
||||
|
||||
if( aColor == COLOR4D::UNSPECIFIED )
|
||||
{
|
||||
COLOR4D defaultColor = Pgm().GetSettingsManager().GetColorSettings()->GetColor(
|
||||
m_junctions.front()->GetLayer() );
|
||||
updateColorButton( defaultColor );
|
||||
}
|
||||
else
|
||||
{
|
||||
updateColorButton( m_selectedColor );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool DIALOG_JUNCTION_PROPS::TransferDataFromWindow()
|
||||
{
|
||||
PICKED_ITEMS_LIST pickedItems;
|
||||
|
||||
for( auto& junction : m_junctions )
|
||||
pickedItems.PushItem( ITEM_PICKER( junction, UR_CHANGED ) );
|
||||
|
||||
m_frame->SaveCopyInUndoList( pickedItems, UR_CHANGED );
|
||||
|
||||
for( auto& junction : m_junctions )
|
||||
{
|
||||
if( !m_diameter.IsIndeterminate() )
|
||||
junction->SetDiameter( m_diameter.GetValue() );
|
||||
|
||||
if( m_selectedColor != GetIndeterminateColor() )
|
||||
junction->SetColor( m_selectedColor );
|
||||
}
|
||||
|
||||
m_frame->GetCanvas()->Refresh();
|
||||
m_frame->OnModify();
|
||||
|
||||
return true;
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2020 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* Copyright (C) 2020 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __dialog_junction_props__
|
||||
#define __dialog_junction_props__
|
||||
|
||||
#include <gal/color4d.h>
|
||||
#include <widgets/unit_binder.h>
|
||||
#include <dialog_junction_props_base.h>
|
||||
|
||||
|
||||
class SCH_EDIT_FRAME;
|
||||
class SCH_JUNCTION;
|
||||
|
||||
|
||||
class DIALOG_JUNCTION_PROPS : public DIALOG_JUNCTION_PROPS_BASE
|
||||
{
|
||||
public:
|
||||
DIALOG_JUNCTION_PROPS( SCH_EDIT_FRAME* aParent, std::deque<SCH_JUNCTION*>& aJunctions );
|
||||
|
||||
bool TransferDataToWindow() override;
|
||||
bool TransferDataFromWindow() override;
|
||||
|
||||
private:
|
||||
SCH_EDIT_FRAME* m_frame;
|
||||
std::deque<SCH_JUNCTION*> m_junctions;
|
||||
|
||||
UNIT_BINDER m_diameter;
|
||||
COLOR4D m_selectedColor;
|
||||
|
||||
void resetDefaults( wxCommandEvent& event ) override;
|
||||
void onColorButtonClicked( wxCommandEvent& aEvent ) override;
|
||||
|
||||
void setColor( const COLOR4D& aColor );
|
||||
void updateColorButton( COLOR4D& aColor );
|
||||
};
|
||||
|
||||
#endif // __dialog_junction_props__
|
|
@ -0,0 +1,81 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version 3.9.0 Jun 18 2020)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "dialog_junction_props_base.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DIALOG_JUNCTION_PROPS_BASE::DIALOG_JUNCTION_PROPS_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* bSizer2;
|
||||
bSizer2 = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
wxFlexGridSizer* fgSizer2;
|
||||
fgSizer2 = new wxFlexGridSizer( 0, 3, 5, 0 );
|
||||
fgSizer2->AddGrowableCol( 1 );
|
||||
fgSizer2->SetFlexibleDirection( wxBOTH );
|
||||
fgSizer2->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
m_staticTextDiameter = new wxStaticText( this, wxID_ANY, _("Diameter:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextDiameter->Wrap( -1 );
|
||||
fgSizer2->Add( m_staticTextDiameter, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
m_textCtrlDiameter = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer2->Add( m_textCtrlDiameter, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxLEFT, 5 );
|
||||
|
||||
m_staticTextDiameterUnits = new wxStaticText( this, wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextDiameterUnits->Wrap( -1 );
|
||||
fgSizer2->Add( m_staticTextDiameterUnits, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 );
|
||||
|
||||
m_staticTextColor = new wxStaticText( this, wxID_ANY, _("Color:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextColor->Wrap( -1 );
|
||||
fgSizer2->Add( m_staticTextColor, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
m_buttonColor = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
|
||||
fgSizer2->Add( m_buttonColor, 0, wxEXPAND|wxLEFT, 5 );
|
||||
|
||||
|
||||
fgSizer2->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
bSizer2->Add( fgSizer2, 1, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||
bSizer2->Add( m_staticline2, 0, wxEXPAND | wxALL, 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();
|
||||
|
||||
bSizer2->Add( m_sdbSizer, 0, wxBOTTOM|wxEXPAND, 5 );
|
||||
|
||||
|
||||
this->SetSizer( bSizer2 );
|
||||
this->Layout();
|
||||
bSizer2->Fit( this );
|
||||
|
||||
this->Centre( wxBOTH );
|
||||
|
||||
// Connect Events
|
||||
m_buttonColor->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_JUNCTION_PROPS_BASE::onColorButtonClicked ), NULL, this );
|
||||
m_sdbSizerApply->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_JUNCTION_PROPS_BASE::resetDefaults ), NULL, this );
|
||||
}
|
||||
|
||||
DIALOG_JUNCTION_PROPS_BASE::~DIALOG_JUNCTION_PROPS_BASE()
|
||||
{
|
||||
// Disconnect Events
|
||||
m_buttonColor->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_JUNCTION_PROPS_BASE::onColorButtonClicked ), NULL, this );
|
||||
m_sdbSizerApply->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_JUNCTION_PROPS_BASE::resetDefaults ), NULL, this );
|
||||
|
||||
}
|
|
@ -0,0 +1,492 @@
|
|||
<?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">connect</property>
|
||||
<property name="file">dialog_junction_props_base</property>
|
||||
<property name="first_id">1000</property>
|
||||
<property name="help_provider">none</property>
|
||||
<property name="image_path_wrapper_function_name"></property>
|
||||
<property name="indent_with_spaces"></property>
|
||||
<property name="internationalize">1</property>
|
||||
<property name="name">dialog_junction_props_base</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_array_enum">0</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_JUNCTION_PROPS_BASE</property>
|
||||
<property name="pos"></property>
|
||||
<property name="size"></property>
|
||||
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
|
||||
<property name="subclass">DIALOG_SHIM; dialog_shim.h; forward_declare</property>
|
||||
<property name="title">Junction 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">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">wxALL|wxEXPAND</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">fgSizer2</property>
|
||||
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
|
||||
<property name="permission">none</property>
|
||||
<property name="rows">0</property>
|
||||
<property name="vgap">5</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|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">Diameter:</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_staticTextDiameter</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">wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxLEFT</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_textCtrlDiameter</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">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT|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">mils</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_staticTextDiameterUnits</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">wxALIGN_CENTER_VERTICAL|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">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">; ; 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|wxLEFT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBitmapButton" 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="auth_needed">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="bitmap"></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="current"></property>
|
||||
<property name="default">0</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="disabled"></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="focus"></property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">MyButton</property>
|
||||
<property name="margins"></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_buttonColor</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="position"></property>
|
||||
<property name="pressed"></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="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnButtonClick">onColorButtonClicked</event>
|
||||
</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>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND | wxALL</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_staticline2</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">; ; 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 class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxBOTTOM|wxEXPAND</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>
|
|
@ -0,0 +1,62 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version 3.9.0 Jun 18 2020)
|
||||
// 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>
|
||||
#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/bmpbuttn.h>
|
||||
#include <wx/bitmap.h>
|
||||
#include <wx/image.h>
|
||||
#include <wx/icon.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/statline.h>
|
||||
#include <wx/dialog.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class DIALOG_JUNCTION_PROPS_BASE
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class DIALOG_JUNCTION_PROPS_BASE : public DIALOG_SHIM
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
wxStaticText* m_staticTextDiameter;
|
||||
wxTextCtrl* m_textCtrlDiameter;
|
||||
wxStaticText* m_staticTextDiameterUnits;
|
||||
wxStaticText* m_staticTextColor;
|
||||
wxBitmapButton* m_buttonColor;
|
||||
wxStaticLine* m_staticline2;
|
||||
wxStdDialogButtonSizer* m_sdbSizer;
|
||||
wxButton* m_sdbSizerOK;
|
||||
wxButton* m_sdbSizerApply;
|
||||
wxButton* m_sdbSizerCancel;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void onColorButtonClicked( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void resetDefaults( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
|
||||
DIALOG_JUNCTION_PROPS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Junction Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
||||
~DIALOG_JUNCTION_PROPS_BASE();
|
||||
|
||||
};
|
||||
|
|
@ -54,6 +54,7 @@ const KICAD_T EE_COLLECTOR::EditableItems[] = {
|
|||
SCH_BITMAP_T,
|
||||
SCH_LINE_T,
|
||||
SCH_BUS_WIRE_ENTRY_T,
|
||||
SCH_JUNCTION_T,
|
||||
EOT
|
||||
};
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2004 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2004-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2004-2020 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
|
||||
|
@ -32,6 +32,7 @@
|
|||
#include <bitmaps.h>
|
||||
#include <eeschema_config.h>
|
||||
#include <general.h>
|
||||
#include <schematic.h>
|
||||
#include <sch_bus_entry.h>
|
||||
#include <sch_edit_frame.h>
|
||||
#include <sch_line.h>
|
||||
|
@ -131,13 +132,19 @@ const EDA_RECT SCH_BUS_ENTRY_BASE::GetBoundingBox() const
|
|||
|
||||
int SCH_BUS_WIRE_ENTRY::GetPenWidth() const
|
||||
{
|
||||
if( m_stroke.GetWidth() == 0 && Schematic() )
|
||||
return std::max( Schematic()->Settings().m_DefaultWireThickness, 1 );
|
||||
|
||||
return ( m_stroke.GetWidth() == 0 ) ? 1 : m_stroke.GetWidth();
|
||||
}
|
||||
|
||||
|
||||
int SCH_BUS_BUS_ENTRY::GetPenWidth() const
|
||||
{
|
||||
return 1;
|
||||
if( m_stroke.GetWidth() == 0 && Schematic() )
|
||||
return std::max( Schematic()->Settings().m_DefaultBusThickness, 1 );
|
||||
|
||||
return ( m_stroke.GetWidth() == 0 ) ? 1 : m_stroke.GetWidth();
|
||||
}
|
||||
|
||||
|
||||
|
@ -164,11 +171,13 @@ void SCH_BUS_BUS_ENTRY::GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemLis
|
|||
void SCH_BUS_ENTRY_BASE::Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
|
||||
{
|
||||
wxDC* DC = aSettings->GetPrintDC();
|
||||
COLOR4D color = aSettings->GetLayerColor( m_Layer );
|
||||
int penWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
|
||||
COLOR4D color = ( GetStrokeColor() == COLOR4D::UNSPECIFIED ) ?
|
||||
aSettings->GetLayerColor( m_Layer ) : GetStrokeColor();
|
||||
int penWidth = ( GetPenWidth() == 0 ) ? aSettings->GetDefaultPenWidth() : GetPenWidth();
|
||||
|
||||
GRLine( nullptr, DC, m_pos.x + aOffset.x, m_pos.y + aOffset.y, m_End().x + aOffset.x,
|
||||
m_End().y + aOffset.y, penWidth, color );
|
||||
m_End().y + aOffset.y, penWidth, color,
|
||||
GetwxPenStyle( (PLOT_DASH_TYPE) GetStrokeStyle() ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -356,10 +365,15 @@ bool SCH_BUS_ENTRY_BASE::HitTest( const EDA_RECT& aRect, bool aContained, int aA
|
|||
|
||||
void SCH_BUS_ENTRY_BASE::Plot( PLOTTER* aPlotter )
|
||||
{
|
||||
int penWidth = std::max( GetPenWidth(), aPlotter->RenderSettings()->GetDefaultPenWidth() );
|
||||
auto* settings = static_cast<KIGFX::SCH_RENDER_SETTINGS*>( aPlotter->RenderSettings() );
|
||||
|
||||
COLOR4D color = ( GetStrokeColor() == COLOR4D::UNSPECIFIED ) ?
|
||||
settings->GetLayerColor( m_Layer ) : GetStrokeColor();
|
||||
int penWidth = ( GetPenWidth() == 0 ) ? settings->GetDefaultPenWidth() : GetPenWidth();
|
||||
|
||||
aPlotter->SetCurrentLineWidth( penWidth );
|
||||
aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( GetLayer() ) );
|
||||
aPlotter->SetColor( color );
|
||||
aPlotter->SetDash( GetStrokeStyle() );
|
||||
aPlotter->MoveTo( m_pos );
|
||||
aPlotter->FinishTo( m_End() );
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2009 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2020 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
|
||||
|
@ -35,6 +35,7 @@
|
|||
#include <plotter.h>
|
||||
#include <bitmaps.h>
|
||||
|
||||
#include <sch_painter.h>
|
||||
#include <sch_junction.h>
|
||||
#include <netlist_object.h>
|
||||
#include <sch_connection.h>
|
||||
|
@ -42,10 +43,12 @@
|
|||
#include <settings/color_settings.h>
|
||||
|
||||
|
||||
SCH_JUNCTION::SCH_JUNCTION( const wxPoint& pos, SCH_LAYER_ID aLayer ) :
|
||||
SCH_JUNCTION::SCH_JUNCTION( const wxPoint& aPosition, int aDiameter, SCH_LAYER_ID aLayer ) :
|
||||
SCH_ITEM( NULL, SCH_JUNCTION_T )
|
||||
{
|
||||
m_pos = pos;
|
||||
m_pos = aPosition;
|
||||
m_color = COLOR4D::UNSPECIFIED;
|
||||
m_diameter = aDiameter;
|
||||
m_Layer = aLayer;
|
||||
}
|
||||
|
||||
|
@ -63,6 +66,8 @@ void SCH_JUNCTION::SwapData( SCH_ITEM* aItem )
|
|||
|
||||
SCH_JUNCTION* item = (SCH_JUNCTION*) aItem;
|
||||
std::swap( m_pos, item->m_pos );
|
||||
std::swap( m_diameter, item->m_diameter );
|
||||
std::swap( m_color, item->m_color );
|
||||
}
|
||||
|
||||
|
||||
|
@ -81,6 +86,9 @@ const EDA_RECT SCH_JUNCTION::GetBoundingBox() const
|
|||
int size =
|
||||
Schematic() ? Schematic()->Settings().m_JunctionSize : Mils2iu( DEFAULT_JUNCTION_DIAM );
|
||||
|
||||
if( m_diameter != 0 )
|
||||
size = m_diameter;
|
||||
|
||||
rect.SetOrigin( m_pos );
|
||||
rect.Inflate( ( GetPenWidth() + size ) / 2 );
|
||||
|
||||
|
@ -91,10 +99,16 @@ const EDA_RECT SCH_JUNCTION::GetBoundingBox() const
|
|||
void SCH_JUNCTION::Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
|
||||
{
|
||||
wxDC* DC = aSettings->GetPrintDC();
|
||||
COLOR4D color = aSettings->GetLayerColor( GetLayer() );
|
||||
COLOR4D color = ( m_color == COLOR4D::UNSPECIFIED ) ? aSettings->GetLayerColor( GetLayer() ) :
|
||||
m_color ;
|
||||
int diameter =
|
||||
Schematic() ? Schematic()->Settings().m_JunctionSize : Mils2iu( DEFAULT_JUNCTION_DIAM );
|
||||
|
||||
if( m_diameter != 0 )
|
||||
diameter = m_diameter;
|
||||
|
||||
GRFilledCircle( nullptr, DC, m_pos.x + aOffset.x, m_pos.y + aOffset.y,
|
||||
Schematic()->Settings().m_JunctionSize / 2, 0, color, color );
|
||||
diameter / 2, 0, color, color );
|
||||
}
|
||||
|
||||
|
||||
|
@ -150,7 +164,8 @@ void SCH_JUNCTION::Show( int nestLevel, std::ostream& os ) const
|
|||
// XML output:
|
||||
wxString s = GetClass();
|
||||
|
||||
NestedSpace( nestLevel, os ) << '<' << s.Lower().mb_str() << m_pos << "/>\n";
|
||||
NestedSpace( nestLevel, os ) << '<' << s.Lower().mb_str() << m_pos << ", " << m_diameter
|
||||
<< "/>\n";
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -189,8 +204,18 @@ bool SCH_JUNCTION::doIsConnected( const wxPoint& aPosition ) const
|
|||
|
||||
void SCH_JUNCTION::Plot( PLOTTER* aPlotter )
|
||||
{
|
||||
aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( GetLayer() ) );
|
||||
aPlotter->Circle( m_pos, Schematic()->Settings().m_JunctionSize, FILLED_SHAPE );
|
||||
auto* settings = static_cast<KIGFX::SCH_RENDER_SETTINGS*>( aPlotter->RenderSettings() );
|
||||
|
||||
COLOR4D color = ( m_color == COLOR4D::UNSPECIFIED ) ? settings->GetLayerColor( GetLayer() ) :
|
||||
m_color;
|
||||
int diameter =
|
||||
Schematic() ? Schematic()->Settings().m_JunctionSize : Mils2iu( DEFAULT_JUNCTION_DIAM );
|
||||
|
||||
if( m_diameter != 0 )
|
||||
diameter = m_diameter;
|
||||
|
||||
aPlotter->SetColor( color );
|
||||
aPlotter->Circle( m_pos, diameter, FILLED_SHAPE );
|
||||
}
|
||||
|
||||
|
||||
|
@ -213,7 +238,12 @@ bool SCH_JUNCTION::operator <( const SCH_ITEM& aItem ) const
|
|||
if( GetPosition().x != junction->GetPosition().x )
|
||||
return GetPosition().x < junction->GetPosition().x;
|
||||
|
||||
return GetPosition().y < junction->GetPosition().y;
|
||||
if( GetPosition().y != junction->GetPosition().y )
|
||||
return GetPosition().y < junction->GetPosition().y;
|
||||
|
||||
if( GetDiameter() != junction->GetDiameter() )
|
||||
return GetDiameter() < junction->GetDiameter();
|
||||
|
||||
return GetColor() < junction->GetColor();
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2020 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
|
||||
|
@ -27,14 +27,19 @@
|
|||
|
||||
|
||||
#include <sch_item.h>
|
||||
#include <gal/color4d.h>
|
||||
|
||||
class NETLIST_OBJECT_LIST;
|
||||
|
||||
class SCH_JUNCTION : public SCH_ITEM
|
||||
{
|
||||
wxPoint m_pos; // Position of the junction.
|
||||
wxPoint m_pos; // Position of the junction.
|
||||
int m_diameter; // Diameter of the junction. Zero is user default.
|
||||
COLOR4D m_color; // Color of the junction. #COLOR4D::UNSPECIFIED is user default.
|
||||
|
||||
public:
|
||||
SCH_JUNCTION( const wxPoint& pos = wxPoint( 0, 0 ), SCH_LAYER_ID aLayer = LAYER_JUNCTION );
|
||||
SCH_JUNCTION( const wxPoint& aPosition = wxPoint( 0, 0 ), int aDiameter = 0,
|
||||
SCH_LAYER_ID aLayer = LAYER_JUNCTION );
|
||||
|
||||
// Do not create a copy constructor. The one generated by the compiler is adequate.
|
||||
|
||||
|
@ -92,6 +97,12 @@ public:
|
|||
const wxPoint GetPosition() const override { return m_pos; }
|
||||
void SetPosition( const wxPoint& aPosition ) override { m_pos = aPosition; }
|
||||
|
||||
int GetDiameter() const { return m_diameter; }
|
||||
void SetDiameter( int aDiameter ) { m_diameter = aDiameter; }
|
||||
|
||||
COLOR4D GetColor() const { return m_color; }
|
||||
void SetColor( const COLOR4D& aColor ) { m_color = aColor; }
|
||||
|
||||
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
|
||||
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
|
||||
|
||||
|
|
|
@ -44,26 +44,6 @@
|
|||
#include <schematic.h>
|
||||
|
||||
|
||||
static wxPenStyle getwxPenStyle( PLOT_DASH_TYPE aType )
|
||||
{
|
||||
switch( aType )
|
||||
{
|
||||
case PLOT_DASH_TYPE::DEFAULT:
|
||||
case PLOT_DASH_TYPE::SOLID:
|
||||
return wxPENSTYLE_SOLID;
|
||||
case PLOT_DASH_TYPE::DASH:
|
||||
return wxPENSTYLE_SHORT_DASH;
|
||||
case PLOT_DASH_TYPE::DOT:
|
||||
return wxPENSTYLE_DOT;
|
||||
case PLOT_DASH_TYPE::DASHDOT:
|
||||
return wxPENSTYLE_DOT_DASH;
|
||||
default:
|
||||
wxFAIL_MSG( "Unhandled PlotDashType" );
|
||||
return wxPENSTYLE_SOLID;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SCH_LINE::SCH_LINE( const wxPoint& pos, int layer ) :
|
||||
SCH_ITEM( NULL, SCH_LINE_T )
|
||||
{
|
||||
|
@ -310,7 +290,7 @@ void SCH_LINE::Print( RENDER_SETTINGS* aSettings, const wxPoint& offset )
|
|||
color = aSettings->GetLayerColor( m_Layer );
|
||||
|
||||
GRLine( nullptr, DC, start.x, start.y, end.x, end.y, penWidth, color,
|
||||
getwxPenStyle( (PLOT_DASH_TYPE) GetLineStyle() ) );
|
||||
GetwxPenStyle( GetLineStyle() ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -750,7 +730,7 @@ void SCH_LINE::Plot( PLOTTER* aPlotter )
|
|||
if( m_stroke.GetColor() != COLOR4D::UNSPECIFIED )
|
||||
aPlotter->SetColor( m_stroke.GetColor() );
|
||||
else
|
||||
aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( GetLayer() ) );
|
||||
aPlotter->SetColor( settings->GetLayerColor( GetLayer() ) );
|
||||
|
||||
switch( m_Layer )
|
||||
{
|
||||
|
@ -761,6 +741,9 @@ void SCH_LINE::Plot( PLOTTER* aPlotter )
|
|||
|
||||
penWidth = std::max( penWidth, aPlotter->RenderSettings()->GetDefaultPenWidth() );
|
||||
|
||||
if( m_stroke.GetWidth() != 0 )
|
||||
penWidth = m_stroke.GetWidth();
|
||||
|
||||
aPlotter->SetCurrentLineWidth( penWidth );
|
||||
aPlotter->SetDash( GetLineStyle() );
|
||||
|
||||
|
@ -784,12 +767,14 @@ void SCH_LINE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList )
|
|||
|
||||
switch( GetLayer() )
|
||||
{
|
||||
case LAYER_WIRE: msg = _( "Net Wire" ); break;
|
||||
case LAYER_BUS: msg = _( "Bus Wire" ); break;
|
||||
default: msg = _( "Graphical" ); return;
|
||||
case LAYER_WIRE: msg = _( "Wire" ); break;
|
||||
case LAYER_BUS: msg = _( "Bus" ); break;
|
||||
default: msg = _( "Graphical" ); break;
|
||||
}
|
||||
|
||||
aList.push_back( MSG_PANEL_ITEM( _( "Line Type" ), msg, DARKCYAN ) );
|
||||
msg = GetLineStyleName( GetLineStyle() );
|
||||
aList.push_back( MSG_PANEL_ITEM( _( "Line Style" ), msg, DARKCYAN ) );
|
||||
|
||||
SCH_EDIT_FRAME* frame = dynamic_cast<SCH_EDIT_FRAME*>( aFrame );
|
||||
|
||||
|
|
|
@ -261,6 +261,20 @@ COLOR4D SCH_PAINTER::getRenderColor( const EDA_ITEM* aItem, int aLayer, bool aDr
|
|||
if( lineColor != COLOR4D::UNSPECIFIED )
|
||||
color = lineColor;
|
||||
}
|
||||
else if( aItem->Type() == SCH_BUS_WIRE_ENTRY_T )
|
||||
{
|
||||
COLOR4D busEntryColor = static_cast<const SCH_BUS_WIRE_ENTRY*>( aItem )->GetStrokeColor();
|
||||
|
||||
if( busEntryColor != COLOR4D::UNSPECIFIED )
|
||||
color = busEntryColor;
|
||||
}
|
||||
else if( aItem->Type() == SCH_JUNCTION_T )
|
||||
{
|
||||
COLOR4D junctionColor = static_cast<const SCH_JUNCTION*>( aItem )->GetColor();
|
||||
|
||||
if( junctionColor != COLOR4D::UNSPECIFIED )
|
||||
color = junctionColor;
|
||||
}
|
||||
else if( aItem->Type() == SCH_SHEET_T )
|
||||
{
|
||||
SCH_SHEET* sheet = (SCH_SHEET*) aItem;
|
||||
|
@ -1189,12 +1203,17 @@ void SCH_PAINTER::draw( SCH_JUNCTION *aJct, int aLayer )
|
|||
|
||||
COLOR4D color = getRenderColor( aJct, aJct->GetLayer(), drawingShadows );
|
||||
|
||||
int junctionSize = m_schSettings.m_JunctionSize / 2.0;
|
||||
|
||||
if( aJct->GetDiameter() != 0 )
|
||||
junctionSize = aJct->GetDiameter() / 2;
|
||||
|
||||
m_gal->SetIsStroke( drawingShadows );
|
||||
m_gal->SetLineWidth( getLineWidth( aJct, drawingShadows ) );
|
||||
m_gal->SetStrokeColor( color );
|
||||
m_gal->SetIsFill( !drawingShadows );
|
||||
m_gal->SetFillColor( color );
|
||||
m_gal->DrawCircle( aJct->GetPosition(), m_schSettings.m_JunctionSize / 2.0 );
|
||||
m_gal->DrawCircle( aJct->GetPosition(), junctionSize );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -2394,6 +2394,25 @@ SCH_JUNCTION* SCH_SEXPR_PARSER::parseJunction()
|
|||
NeedRIGHT();
|
||||
break;
|
||||
|
||||
case T_diameter:
|
||||
junction->SetDiameter( parseInternalUnits( "junction diameter" ) );
|
||||
NeedRIGHT();
|
||||
break;
|
||||
|
||||
case T_color:
|
||||
{
|
||||
COLOR4D color;
|
||||
|
||||
color.r = parseInt( "red" ) / 255.0;
|
||||
color.g = parseInt( "green" ) / 255.0;
|
||||
color.b = parseInt( "blue" ) / 255.0;
|
||||
color.a = Clamp( parseDouble( "alpha" ), 0.0, 1.0 );
|
||||
|
||||
junction->SetColor( color );
|
||||
NeedRIGHT();
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
Expecting( "at" );
|
||||
}
|
||||
|
|
|
@ -1106,9 +1106,14 @@ void SCH_SEXPR_PLUGIN::saveJunction( SCH_JUNCTION* aJunction, int aNestLevel )
|
|||
{
|
||||
wxCHECK_RET( aJunction != nullptr && m_out != nullptr, "" );
|
||||
|
||||
m_out->Print( aNestLevel, "(junction (at %s %s))\n",
|
||||
m_out->Print( aNestLevel, "(junction (at %s %s) (diameter %s) (color %d %d %d %s))\n",
|
||||
FormatInternalUnits( aJunction->GetPosition().x ).c_str(),
|
||||
FormatInternalUnits( aJunction->GetPosition().y ).c_str() );
|
||||
FormatInternalUnits( aJunction->GetPosition().y ).c_str(),
|
||||
FormatInternalUnits( aJunction->GetDiameter() ).c_str(),
|
||||
KiROUND( aJunction->GetColor().r * 255.0 ),
|
||||
KiROUND( aJunction->GetColor().g * 255.0 ),
|
||||
KiROUND( aJunction->GetColor().b * 255.0 ),
|
||||
Double2Str( aJunction->GetColor().a ).c_str() );
|
||||
}
|
||||
|
||||
|
||||
|
@ -1136,15 +1141,16 @@ void SCH_SEXPR_PLUGIN::saveBusEntry( SCH_BUS_ENTRY_BASE* aBusEntry, int aNestLev
|
|||
}
|
||||
else
|
||||
{
|
||||
m_out->Print( aNestLevel, "(bus_entry (at %s %s) (size %s %s) ",
|
||||
m_out->Print( aNestLevel, "(bus_entry (at %s %s) (size %s %s)\n",
|
||||
FormatInternalUnits( aBusEntry->GetPosition().x ).c_str(),
|
||||
FormatInternalUnits( aBusEntry->GetPosition().y ).c_str(),
|
||||
FormatInternalUnits( aBusEntry->GetSize().GetWidth() ).c_str(),
|
||||
FormatInternalUnits( aBusEntry->GetSize().GetHeight() ).c_str() );
|
||||
|
||||
formatStroke( m_out, 0, aBusEntry->GetStroke() );
|
||||
formatStroke( m_out, aNestLevel + 1, aBusEntry->GetStroke() );
|
||||
|
||||
m_out->Print( 0, ")\n" );
|
||||
m_out->Print( 0, "\n" );
|
||||
m_out->Print( aNestLevel, ")\n" );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ dash
|
|||
dash_dot
|
||||
data
|
||||
date
|
||||
diameter
|
||||
dot
|
||||
edge_clock_high
|
||||
effects
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include <sch_view.h>
|
||||
#include <sch_line.h>
|
||||
#include <sch_bus_entry.h>
|
||||
#include <sch_junction.h>
|
||||
#include <sch_edit_frame.h>
|
||||
#include <schematic.h>
|
||||
#include <ws_proxy_view_item.h>
|
||||
|
@ -51,6 +52,7 @@
|
|||
#include <dialogs/dialog_edit_component_in_schematic.h>
|
||||
#include <dialogs/dialog_edit_sheet_pin.h>
|
||||
#include <dialogs/dialog_edit_one_field.h>
|
||||
#include <dialogs/dialog_junction_props.h>
|
||||
#include "sch_drawing_tools.h"
|
||||
#include <math/util.h> // for KiROUND
|
||||
#include <pgm_base.h>
|
||||
|
@ -208,6 +210,12 @@ bool SCH_EDIT_TOOL::Init()
|
|||
&& eeSelection->AllItemsHaveLineStroke() ) )
|
||||
return false;
|
||||
|
||||
if( aSel.GetSize() != 1
|
||||
&& !( aSel.GetSize() >= 1
|
||||
&& ( firstItem->Type() == SCH_JUNCTION_T )
|
||||
&& eeSelection->AreAllItemsIdentical() ) )
|
||||
return false;
|
||||
|
||||
switch( firstItem->Type() )
|
||||
{
|
||||
case SCH_COMPONENT_T:
|
||||
|
@ -233,6 +241,9 @@ bool SCH_EDIT_TOOL::Init()
|
|||
|
||||
return true;
|
||||
|
||||
case SCH_JUNCTION_T:
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
@ -1278,6 +1289,12 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
|
|||
|
||||
break;
|
||||
|
||||
case SCH_JUNCTION_T:
|
||||
if( !selection.AreAllItemsIdentical() )
|
||||
return 0;
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
if( selection.Size() > 1 )
|
||||
return 0;
|
||||
|
@ -1420,8 +1437,29 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
break;
|
||||
|
||||
case SCH_MARKER_T: // These items have no properties to edit
|
||||
case SCH_JUNCTION_T:
|
||||
{
|
||||
std::deque<SCH_JUNCTION*> junctions;
|
||||
|
||||
for( auto selItem : selection.Items() )
|
||||
{
|
||||
SCH_JUNCTION* junction = dynamic_cast<SCH_JUNCTION*>( selItem );
|
||||
|
||||
wxCHECK( junction, 0 );
|
||||
|
||||
junctions.push_back( junction );
|
||||
}
|
||||
|
||||
DIALOG_JUNCTION_PROPS dlg( m_frame, junctions );
|
||||
|
||||
if( dlg.ShowModal() == wxID_OK )
|
||||
{
|
||||
m_toolMgr->PostEvent( EVENTS::SelectedItemsModified );
|
||||
m_frame->OnModify();
|
||||
}
|
||||
}
|
||||
|
||||
case SCH_MARKER_T: // These items have no properties to edit
|
||||
case SCH_NO_CONNECT_T:
|
||||
break;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2016-2017 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2016-2020 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
|
||||
|
@ -95,6 +95,16 @@ enum class PLOT_DASH_TYPE
|
|||
LAST_TYPE = DASHDOT
|
||||
};
|
||||
|
||||
/**
|
||||
* Convert KiCad line plot styles to wxWidgets device context styles.
|
||||
*
|
||||
* @param aType The KiCad line plot style to convert.
|
||||
*
|
||||
* @return The equivalent wxPenStyle of \a aType.
|
||||
*/
|
||||
wxPenStyle GetwxPenStyle( PLOT_DASH_TYPE aType );
|
||||
|
||||
|
||||
/**
|
||||
* Base plotter engine class. General rule: all the interface with the caller
|
||||
* is done in IU, the IU size is specified with SetViewport. Internal and
|
||||
|
|
Loading…
Reference in New Issue