kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #31618
Re: [FEATURE] Eeschema Line Styles
Attached is the updated line styles patchset. This implements the
COLOR4D_PICKER_DIALOG and ensures that the alpha channel remains opaque.
The dotted line, I agree doesn't look too dotted. This is the wxDOT style
but apparently, it doesn't account for the line caps. I've replaced this
with a user-defined dotted line. This is the smallest length of dot that
we are allowed in wx. Better than the default even if it isn't quite
"dotted".
-Seth
On Tue, Nov 14, 2017 at 3:38 PM, Nick Østergaard <oe.nick@xxxxxxxxx> wrote:
> 2017-11-14 8:59 GMT+01.00, jp charras <jp.charras@xxxxxxxxxx>:
> > Le 13/11/2017 à 23:32, Seth Hillbrand a écrit :
> >> Thanks for the heads up. I rebased the patches to the current master at
> >> d98fc85a836b861c29abae55f439aff2be856add
> >>
> >> The whitespace warnings appear to be wxFormBuilder generated code, so as
> >> long as you don't have
> >> strict whitespace checking, these should apply cleanly.
> >>
> >> Let me know if you have additional problems.
> >>
> >> Best-
> >> Seth
> >>
> >
> > Hi Seth,
> > I tested your patch, and do not have issues.
> >
> > However I noticed you are using to select the line color the wxWidgets
> color
> > selector dialog.
> > We have a much better dialog (used in Pcbnew in GAL mode and Eeschema in
> the
> > color config dialog).
> > see: widgets/color4Dpickerdlg
> > The Alpha channel must be disabled for Eeschema.
> >
> > Please use it.
> >
> > Thanks.
> >
> > --
> > Jean-Pierre CHARRAS
> >
>
> Hi Seth
>
> Thank you, the patched appied. But I only had time to test it now.
>
> I just noticed that it seems like the dotted type is not with real
> dots, but still quite elongated dots. This looks strange, because it
> just look like a line with tiny "holes" in it. Is this how it is
> supposed to be?
>
> Nick
>
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help : https://help.launchpad.net/ListHelp
>
From a14ec9b2ea3995709176f7213a922da7858442a2 Mon Sep 17 00:00:00 2001
From: Seth Hillbrand <hillbrand@xxxxxxxxxxx>
Date: Tue, 14 Nov 2017 15:19:03 -0800
Subject: [PATCH 4/4] Eeschema: Update line syle colorbox
Line style colorbox is updated to follow Kicad colorbox
convention. The alpha channel is also forced to opaque.
---
eeschema/dialogs/dialog_edit_line_style.cpp | 65 ++++++++++++++++++++++--
eeschema/dialogs/dialog_edit_line_style.h | 11 ++--
eeschema/dialogs/dialog_edit_line_style_base.cpp | 41 +++++++--------
eeschema/dialogs/dialog_edit_line_style_base.fbp | 58 +++++++++++----------
eeschema/dialogs/dialog_edit_line_style_base.h | 20 ++++++--
eeschema/sch_line.cpp | 8 ++-
6 files changed, 138 insertions(+), 65 deletions(-)
diff --git a/eeschema/dialogs/dialog_edit_line_style.cpp b/eeschema/dialogs/dialog_edit_line_style.cpp
index 30c103d8f..968525075 100644
--- a/eeschema/dialogs/dialog_edit_line_style.cpp
+++ b/eeschema/dialogs/dialog_edit_line_style.cpp
@@ -23,19 +23,24 @@
*/
#include <cassert>
+#include <widgets/color4Dpickerdlg.h>
#include <dialog_edit_line_style.h>
+const int BUTT_SIZE_X = 32;
+const int BUTT_SIZE_Y = 16;
DIALOG_EDIT_LINE_STYLE::DIALOG_EDIT_LINE_STYLE( wxWindow* parent ) :
DIALOG_EDIT_LINE_STYLE_BASE( parent )
{
m_sdbSizer1Apply->SetLabel( _( "Default" ) );
-
m_lineStyle->SetSelection( 0 );
-
m_lineWidth->SetFocus();
+
defaultStyle = 0;
defaultWidth = "";
+
+ wxBitmap bitmap( BUTT_SIZE_X, BUTT_SIZE_Y );
+ m_colorButton->SetBitmap( bitmap );
m_sdbSizer1OK->SetDefault();
// Now all widgets have the size fixed, call FinishDialogSettings
@@ -47,24 +52,74 @@ DIALOG_EDIT_LINE_STYLE::DIALOG_EDIT_LINE_STYLE( wxWindow* parent ) :
Raise();
}
+void DIALOG_EDIT_LINE_STYLE::onColorButtonClicked( wxCommandEvent& event )
+{
+ COLOR4D newColor = COLOR4D::UNSPECIFIED;
+ COLOR4D_PICKER_DLG dialog( this, selectedColor, false );
+
+ if( dialog.ShowModal() == wxID_OK )
+ newColor = dialog.GetColor();
+
+ if( newColor == COLOR4D::UNSPECIFIED || selectedColor == newColor )
+ return;
+
+ SetColor( newColor, true );
+
+}
+
+void DIALOG_EDIT_LINE_STYLE::updateColorButton( COLOR4D& aColor )
+{
+ wxMemoryDC iconDC;
+
+ wxBitmap bitmap = m_colorButton->GetBitmapLabel();
+ iconDC.SelectObject( bitmap );
+ iconDC.SetPen( *wxBLACK_PEN );
+
+ wxBrush brush;
+ brush.SetColour( aColor.ToColour() );
+ brush.SetStyle( wxBRUSHSTYLE_SOLID );
+
+ iconDC.SetBrush( brush );
+ iconDC.DrawRectangle( 0, 0, BUTT_SIZE_X, BUTT_SIZE_Y );
+
+ m_colorButton->SetBitmapLabel( bitmap );
+ m_colorButton->Refresh();
+
+ Refresh( false );
+}
+
void DIALOG_EDIT_LINE_STYLE::resetDefaults( wxCommandEvent& event )
{
SetStyle( defaultStyle );
SetWidth( defaultWidth );
- SetColor( defaultColor );
+ SetColor( defaultColor, true );
Refresh();
}
-void DIALOG_EDIT_LINE_STYLE::SetColor( const COLOR4D& aColor )
+void DIALOG_EDIT_LINE_STYLE::SetColor( const COLOR4D& aColor, bool aRefresh )
+{
+ assert( aColor.r >= 0.0 && aColor.r <= 1.0 );
+ assert( aColor.g >= 0.0 && aColor.g <= 1.0 );
+ assert( aColor.b >= 0.0 && aColor.b <= 1.0 );
+ assert( aColor.a >= 0.0 && aColor.a <= 1.0 );
+
+ selectedColor = aColor;
+
+ if( aRefresh )
+ updateColorButton( selectedColor );
+}
+
+
+void DIALOG_EDIT_LINE_STYLE::SetDefaultColor( const COLOR4D& aColor )
{
assert( aColor.r >= 0.0 && aColor.r <= 1.0 );
assert( aColor.g >= 0.0 && aColor.g <= 1.0 );
assert( aColor.b >= 0.0 && aColor.b <= 1.0 );
assert( aColor.a >= 0.0 && aColor.a <= 1.0 );
- m_colorPicker->SetColour( aColor.ToColour() );
+ defaultColor = aColor;
}
diff --git a/eeschema/dialogs/dialog_edit_line_style.h b/eeschema/dialogs/dialog_edit_line_style.h
index 522dba98e..0aeeaf562 100644
--- a/eeschema/dialogs/dialog_edit_line_style.h
+++ b/eeschema/dialogs/dialog_edit_line_style.h
@@ -34,6 +34,7 @@
#include <dialog_edit_line_style_base.h>
#include <sch_line.h>
+class WIDGET_EESCHEMA_COLOR_CONFIG;
class DIALOG_EDIT_LINE_STYLE : public DIALOG_EDIT_LINE_STYLE_BASE
{
@@ -44,9 +45,9 @@ public:
void SetDefaultWidth( const wxString& aWidth ) { defaultWidth = aWidth; }
wxString GetWidth() const { return m_lineWidth->GetValue(); }
- COLOR4D GetColor() const { return COLOR4D( m_colorPicker->GetColour() ); }
- void SetColor( const COLOR4D& aColor );
- void SetDefaultColor( const COLOR4D& aColor ) { defaultColor = aColor; }
+ COLOR4D GetColor() const { return selectedColor; }
+ void SetColor( const COLOR4D& aColor, bool aRefresh );
+ void SetDefaultColor( const COLOR4D& aColor );
void SetStyle( const int aStyle );
void SetDefaultStyle( const int aStyle ) { defaultStyle = aStyle; }
@@ -56,12 +57,16 @@ public:
{
m_staticWidthUnits->SetLabel( aUnits );
}
+
private:
int defaultStyle;
wxString defaultWidth;
COLOR4D defaultColor;
+ COLOR4D selectedColor;
void resetDefaults( wxCommandEvent& event ) override;
+ void onColorButtonClicked( wxCommandEvent& aEvent ) override;
+ void updateColorButton( COLOR4D& aColor );
};
#endif // __dialog_edit_line_style__
diff --git a/eeschema/dialogs/dialog_edit_line_style_base.cpp b/eeschema/dialogs/dialog_edit_line_style_base.cpp
index f66282924..295dc2c96 100644
--- a/eeschema/dialogs/dialog_edit_line_style_base.cpp
+++ b/eeschema/dialogs/dialog_edit_line_style_base.cpp
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
-// C++ code generated with wxFormBuilder (version Nov 9 2017)
+// C++ code generated with wxFormBuilder (version Oct 30 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -10,6 +10,7 @@
///////////////////////////////////////////////////////////////////////////
BEGIN_EVENT_TABLE( DIALOG_EDIT_LINE_STYLE_BASE, DIALOG_SHIM )
+ EVT_BUTTON( idColorBtn, DIALOG_EDIT_LINE_STYLE_BASE::_wxFB_onColorButtonClicked )
EVT_BUTTON( wxID_APPLY, DIALOG_EDIT_LINE_STYLE_BASE::_wxFB_resetDefaults )
END_EVENT_TABLE()
@@ -36,51 +37,43 @@ DIALOG_EDIT_LINE_STYLE_BASE::DIALOG_EDIT_LINE_STYLE_BASE( wxWindow* parent, wxWi
m_staticWidth1->Wrap( -1 );
bSizer31->Add( m_staticWidth1, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
- m_lineWidth = new wxTextCtrl( sbSizer1->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
- #ifdef __WXGTK__
- if ( !m_lineWidth->HasFlag( wxTE_MULTILINE ) )
- {
- m_lineWidth->SetMaxLength( 6 );
- }
- #else
- m_lineWidth->SetMaxLength( 6 );
- #endif
- bSizer31->Add( m_lineWidth, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
+ m_lineWidth = new wxTextCtrl( sbSizer1->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 2,-1 ), 0 );
+ bSizer31->Add( m_lineWidth, 1, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_staticWidthUnits = new wxStaticText( sbSizer1->GetStaticBox(), wxID_ANY, _("millimeter"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticWidthUnits->Wrap( -1 );
- bSizer31->Add( m_staticWidthUnits, 1, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
+ bSizer31->Add( m_staticWidthUnits, 1, wxALIGN_CENTER_VERTICAL|wxALL, 1 );
- sbSizer1->Add( bSizer31, 0, wxALL|wxEXPAND, 1 );
+ sbSizer1->Add( bSizer31, 4, wxALL|wxEXPAND, 1 );
- wxBoxSizer* bSizer5;
- bSizer5 = new wxBoxSizer( wxHORIZONTAL );
+ wxBoxSizer* bColorSizer;
+ bColorSizer = new wxBoxSizer( wxHORIZONTAL );
m_staticText5 = new wxStaticText( sbSizer1->GetStaticBox(), wxID_ANY, _("C&olor:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText5->Wrap( -1 );
- bSizer5->Add( m_staticText5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
+ bColorSizer->Add( m_staticText5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
- m_colorPicker = new wxColourPickerCtrl( sbSizer1->GetStaticBox(), wxID_ANY, wxColour( 0, 0, 0 ), wxDefaultPosition, wxDefaultSize, wxCLRP_DEFAULT_STYLE );
- bSizer5->Add( m_colorPicker, 0, wxALL, 5 );
+ m_colorButton = new wxBitmapButton( sbSizer1->GetStaticBox(), idColorBtn, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
+ bColorSizer->Add( m_colorButton, 1, wxALL, 5 );
- bSizer5->Add( 0, 0, 1, wxEXPAND, 5 );
+ bColorSizer->Add( 0, 0, 1, 0, 1 );
- sbSizer1->Add( bSizer5, 0, wxEXPAND|wxALL, 1 );
+ sbSizer1->Add( bColorSizer, 3, wxEXPAND|wxALL, 1 );
- bSizer7->Add( sbSizer1, 3, wxALL|wxEXPAND, 5 );
+ bSizer7->Add( sbSizer1, 2, wxALL, 5 );
wxString m_lineStyleChoices[] = { _("Solid"), _("Dashed"), _("Dotted"), _("Dash-Dot") };
int m_lineStyleNChoices = sizeof( m_lineStyleChoices ) / sizeof( wxString );
m_lineStyle = new wxRadioBox( this, wxID_ANY, _("&Pen Style"), wxDefaultPosition, wxDefaultSize, m_lineStyleNChoices, m_lineStyleChoices, 4, wxRA_SPECIFY_ROWS );
- m_lineStyle->SetSelection( 1 );
- bSizer7->Add( m_lineStyle, 2, wxALL|wxEXPAND, 5 );
+ m_lineStyle->SetSelection( 0 );
+ bSizer7->Add( m_lineStyle, 1, wxALL, 5 );
- dlgBorderSizer->Add( bSizer7, 1, wxEXPAND, 5 );
+ dlgBorderSizer->Add( bSizer7, 0, wxEXPAND, 5 );
dlgBorderSizer->Add( 0, 0, 0, wxALL|wxEXPAND, 1 );
diff --git a/eeschema/dialogs/dialog_edit_line_style_base.fbp b/eeschema/dialogs/dialog_edit_line_style_base.fbp
index c05e92de6..ba5a46d37 100644
--- a/eeschema/dialogs/dialog_edit_line_style_base.fbp
+++ b/eeschema/dialogs/dialog_edit_line_style_base.fbp
@@ -44,7 +44,7 @@
<property name="minimum_size"></property>
<property name="name">DIALOG_EDIT_LINE_STYLE_BASE</property>
<property name="pos"></property>
- <property name="size">399,230</property>
+ <property name="size">410,230</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">Line Style</property>
@@ -105,7 +105,7 @@
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
- <property name="proportion">1</property>
+ <property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer7</property>
@@ -113,8 +113,8 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
- <property name="flag">wxALL|wxEXPAND</property>
- <property name="proportion">3</property>
+ <property name="flag">wxALL</property>
+ <property name="proportion">2</property>
<object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
<property name="label">General</property>
@@ -124,11 +124,11 @@
<property name="parent">1</property>
<property name="permission">none</property>
<event name="OnUpdateUI"></event>
- <object class="sizeritem" expanded="0">
+ <object class="sizeritem" expanded="1">
<property name="border">1</property>
<property name="flag">wxALL|wxEXPAND</property>
- <property name="proportion">0</property>
- <object class="wxBoxSizer" expanded="0">
+ <property name="proportion">4</property>
+ <object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer31</property>
<property name="orient">wxHORIZONTAL</property>
@@ -219,7 +219,7 @@
<object class="sizeritem" expanded="0">
<property name="border">3</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
- <property name="proportion">0</property>
+ <property name="proportion">1</property>
<object class="wxTextCtrl" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
@@ -251,7 +251,7 @@
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
- <property name="maxlength">6</property>
+ <property name="maxlength">0</property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
@@ -265,7 +265,7 @@
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
- <property name="size"></property>
+ <property name="size">2,-1</property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
@@ -308,7 +308,7 @@
</object>
</object>
<object class="sizeritem" expanded="0">
- <property name="border">3</property>
+ <property name="border">1</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="proportion">1</property>
<object class="wxStaticText" expanded="0">
@@ -395,10 +395,10 @@
<object class="sizeritem" expanded="1">
<property name="border">1</property>
<property name="flag">wxEXPAND|wxALL</property>
- <property name="proportion">0</property>
+ <property name="proportion">3</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
- <property name="name">bSizer5</property>
+ <property name="name">bColorSizer</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="0">
@@ -484,11 +484,11 @@
<event name="OnUpdateUI"></event>
</object>
</object>
- <object class="sizeritem" expanded="0">
+ <object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
- <property name="proportion">0</property>
- <object class="wxColourPickerCtrl" expanded="0">
+ <property name="proportion">1</property>
+ <object class="wxBitmapButton" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@@ -499,24 +499,29 @@
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
+ <property name="bitmap">Load From File; </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="colour">0,0,0</property>
<property name="context_help"></property>
<property name="context_menu">1</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="hover"></property>
+ <property name="id">idColorBtn</property>
+ <property name="label">MyButton</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@@ -524,7 +529,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
- <property name="name">m_colorPicker</property>
+ <property name="name">m_colorButton</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@@ -532,9 +537,10 @@
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
+ <property name="selected"></property>
<property name="show">1</property>
<property name="size"></property>
- <property name="style">wxCLRP_DEFAULT_STYLE</property>
+ <property name="style">wxBU_AUTODRAW</property>
<property name="subclass">; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
@@ -545,8 +551,8 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
+ <event name="OnButtonClick">onColorButtonClicked</event>
<event name="OnChar"></event>
- <event name="OnColourChanged"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
@@ -572,8 +578,8 @@
</object>
</object>
<object class="sizeritem" expanded="0">
- <property name="border">5</property>
- <property name="flag">wxEXPAND</property>
+ <property name="border">1</property>
+ <property name="flag"></property>
<property name="proportion">1</property>
<object class="spacer" expanded="0">
<property name="height">0</property>
@@ -587,8 +593,8 @@
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
- <property name="flag">wxALL|wxEXPAND</property>
- <property name="proportion">2</property>
+ <property name="flag">wxALL</property>
+ <property name="proportion">1</property>
<object class="wxRadioBox" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
@@ -635,7 +641,7 @@
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
- <property name="selection">1</property>
+ <property name="selection">0</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxRA_SPECIFY_ROWS</property>
diff --git a/eeschema/dialogs/dialog_edit_line_style_base.h b/eeschema/dialogs/dialog_edit_line_style_base.h
index 4cd6d7066..a348d86c3 100644
--- a/eeschema/dialogs/dialog_edit_line_style_base.h
+++ b/eeschema/dialogs/dialog_edit_line_style_base.h
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
-// C++ code generated with wxFormBuilder (version Nov 9 2017)
+// C++ code generated with wxFormBuilder (version Oct 30 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -20,10 +20,13 @@
#include <wx/settings.h>
#include <wx/textctrl.h>
#include <wx/sizer.h>
-#include <wx/clrpicker.h>
+#include <wx/bitmap.h>
+#include <wx/image.h>
+#include <wx/icon.h>
+#include <wx/bmpbuttn.h>
+#include <wx/button.h>
#include <wx/statbox.h>
#include <wx/radiobox.h>
-#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
@@ -37,15 +40,21 @@ class DIALOG_EDIT_LINE_STYLE_BASE : public DIALOG_SHIM
private:
// Private event handlers
+ void _wxFB_onColorButtonClicked( wxCommandEvent& event ){ onColorButtonClicked( event ); }
void _wxFB_resetDefaults( wxCommandEvent& event ){ resetDefaults( event ); }
protected:
+ enum
+ {
+ idColorBtn = 1000
+ };
+
wxStaticText* m_staticWidth1;
wxTextCtrl* m_lineWidth;
wxStaticText* m_staticWidthUnits;
wxStaticText* m_staticText5;
- wxColourPickerCtrl* m_colorPicker;
+ wxBitmapButton* m_colorButton;
wxRadioBox* m_lineStyle;
wxStdDialogButtonSizer* m_sdbSizer1;
wxButton* m_sdbSizer1OK;
@@ -53,13 +62,14 @@ class DIALOG_EDIT_LINE_STYLE_BASE : public DIALOG_SHIM
wxButton* m_sdbSizer1Cancel;
// Virtual event handlers, overide them in your derived class
+ virtual void onColorButtonClicked( wxCommandEvent& event ) { event.Skip(); }
virtual void resetDefaults( wxCommandEvent& event ) { event.Skip(); }
public:
bool m_isValid;
- DIALOG_EDIT_LINE_STYLE_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Line Style"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 399,230 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
+ DIALOG_EDIT_LINE_STYLE_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Line Style"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 410,230 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_EDIT_LINE_STYLE_BASE();
};
diff --git a/eeschema/sch_line.cpp b/eeschema/sch_line.cpp
index cb133147b..0835645d0 100644
--- a/eeschema/sch_line.cpp
+++ b/eeschema/sch_line.cpp
@@ -237,10 +237,14 @@ void SCH_LINE::SetLineColor( const double r, const double g, const double b, con
{
COLOR4D newColor(r, g, b, a);
- if( newColor == GetDefaultColor() )
+ if( newColor == GetDefaultColor() || newColor == COLOR4D::UNSPECIFIED )
m_color = COLOR4D::UNSPECIFIED;
else
+ {
+ // Eeschema does not allow alpha channel in colors
+ newColor.a = 1.0;
m_color = newColor;
+ }
}
@@ -742,7 +746,7 @@ int SCH_EDIT_FRAME::EditLine( SCH_LINE* aLine, bool aRedraw )
dlg.SetWidth( StringFromValue( g_UserUnit, old_width, false ) );
dlg.SetStyle( old_style );
dlg.SetLineWidthUnits( units );
- dlg.SetColor( old_color );
+ dlg.SetColor( old_color, true );
dlg.Layout();
dlg.Fit();
--
2.11.0
From ed2db79be980d884d8ab1613f741b762c1849ccf Mon Sep 17 00:00:00 2001
From: Seth Hillbrand <hillbrand@xxxxxxxxxxx>
Date: Mon, 13 Nov 2017 09:29:49 -0800
Subject: [PATCH 3/4] Eeschema: Adding dashed line support to DXF plot
NEW: Dashed, dotted and dash-dot line support to DXF plot
in eeschema.
---
common/common_plotDXF_functions.cpp | 95 +++++++++++++++++++++++++++++++++----
include/plot_common.h | 2 +
2 files changed, 89 insertions(+), 8 deletions(-)
diff --git a/common/common_plotDXF_functions.cpp b/common/common_plotDXF_functions.cpp
index 5240088ea..2fd2f6334 100644
--- a/common/common_plotDXF_functions.cpp
+++ b/common/common_plotDXF_functions.cpp
@@ -94,6 +94,19 @@ static const struct
{ "YELLOW4", 2 }
};
+/**
+ * Line types in the boilerplate DXF header. The
+ * element indices correspond to the eeschema line
+ * types.
+ */
+static const char *dxf_lines[] =
+{
+ [ PLOTDASHTYPE_SOLID ] = "CONTINUOUS",
+ [ PLOTDASHTYPE_DASH ] = "DASHED",
+ [ PLOTDASHTYPE_DOT ] = "DOTTED",
+ [ PLOTDASHTYPE_DASHDOT ] = "DASHDOT"
+};
+
// A helper function to create a color name acceptable in DXF files
// DXF files do not use a RGB definition
@@ -144,7 +157,7 @@ bool DXF_PLOTTER::StartPlot()
// DXF HEADER - Boilerplate
// Defines the minimum for drawing i.e. the angle system and the
- // continuous linetype
+ // 4 linetypes (CONTINUOUS, DOTDASH, DASHED and DOTTED)
fputs( " 0\n"
"SECTION\n"
" 2\n"
@@ -172,9 +185,11 @@ bool DXF_PLOTTER::StartPlot()
" 2\n"
"LTYPE\n"
" 70\n"
- "1\n"
+ "4\n"
" 0\n"
"LTYPE\n"
+ " 5\n"
+ "40F\n"
" 2\n"
"CONTINUOUS\n"
" 70\n"
@@ -188,6 +203,70 @@ bool DXF_PLOTTER::StartPlot()
" 40\n"
"0.0\n"
" 0\n"
+ "LTYPE\n"
+ " 5\n"
+ "410\n"
+ " 2\n"
+ "DASHDOT\n"
+ " 70\n"
+ "0\n"
+ " 3\n"
+ "Dash Dot ____ _ ____ _\n"
+ " 72\n"
+ "65\n"
+ " 73\n"
+ "4\n"
+ " 40\n"
+ "2.0\n"
+ " 49\n"
+ "1.25\n"
+ " 49\n"
+ "-0.25\n"
+ " 49\n"
+ "0.25\n"
+ " 49\n"
+ "-0.25\n"
+ " 0\n"
+ "LTYPE\n"
+ " 5\n"
+ "411\n"
+ " 2\n"
+ "DASHED\n"
+ " 70\n"
+ "0\n"
+ " 3\n"
+ "Dashed __ __ __ __ __\n"
+ " 72\n"
+ "65\n"
+ " 73\n"
+ "2\n"
+ " 40\n"
+ "0.75\n"
+ " 49\n"
+ "0.5\n"
+ " 49\n"
+ "-0.25\n"
+ " 0\n"
+ "LTYPE\n"
+ " 5\n"
+ "43B\n"
+ " 2\n"
+ "DOTTED\n"
+ " 70\n"
+ "0\n"
+ " 3\n"
+ "Dotted . . . .\n"
+ " 72\n"
+ "65\n"
+ " 73\n"
+ "2\n"
+ " 40\n"
+ "0.2\n"
+ " 49\n"
+ "0.0\n"
+ " 49\n"
+ "-0.2\n"
+ " 0\n"
"ENDTAB\n",
outputFile );
@@ -483,22 +562,22 @@ void DXF_PLOTTER::PenTo( const wxPoint& pos, char plume )
if( penLastpos != pos && plume == 'D' )
{
+ wxASSERT( m_currentLineType >= 0 && m_currentLineType < 4 );
// DXF LINE
wxString cname = getDXFColorName( m_currentColor );
- fprintf( outputFile, "0\nLINE\n8\n%s\n10\n%g\n20\n%g\n11\n%g\n21\n%g\n",
- TO_UTF8( cname ),
+ const char *lname = dxf_lines[ m_currentLineType ];
+ fprintf( outputFile, "0\nLINE\n8\n%s\n6\n%s\n10\n%g\n20\n%g\n11\n%g\n21\n%g\n",
+ TO_UTF8( cname ), lname,
pen_lastpos_dev.x, pen_lastpos_dev.y, pos_dev.x, pos_dev.y );
}
penLastpos = pos;
}
-/**
- * Dashed lines are not (yet) supported by DXF_PLOTTER
- */
void DXF_PLOTTER::SetDash( int dashed )
{
- // NOP for now
+ wxASSERT( dashed >= 0 && dashed < 4 );
+ m_currentLineType = dashed;
}
diff --git a/include/plot_common.h b/include/plot_common.h
index 462f63ee3..d0d4052f1 100644
--- a/include/plot_common.h
+++ b/include/plot_common.h
@@ -1224,6 +1224,7 @@ public:
{
textAsLines = true;
m_currentColor = COLOR4D::BLACK;
+ m_currentLineType = 0;
}
virtual PlotFormat GetPlotterType() const override
@@ -1309,6 +1310,7 @@ public:
protected:
bool textAsLines;
COLOR4D m_currentColor;
+ int m_currentLineType;
};
class TITLE_BLOCK;
--
2.11.0
From 7575907fa783023652c1e52b99fd4b7ccd920e9f Mon Sep 17 00:00:00 2001
From: Seth Hillbrand <hillbrand@xxxxxxxxxxx>
Date: Sun, 12 Nov 2017 19:53:27 -0800
Subject: [PATCH 2/4] Adds plot functionality to Eeschema line formats
Dotted, dashed and dash-dot lines are provided in
HPGL, PDF, PS and SVG plot outputs along with line
width and color formatting.
DXF format does not currently provide any dashed
line functionality
A bug in HPGL plotted is corrected. Previous HPGL
dashed line commands were incorrect, plotting all
lines as solid.
---
common/class_plotter.cpp | 17 +++++++----
common/common_plotDXF_functions.cpp | 2 +-
common/common_plotHPGL_functions.cpp | 20 +++++++++----
common/common_plotPDF_functions.cpp | 21 ++++++++++---
common/common_plotPS_functions.cpp | 22 ++++++++++----
common/common_plotSVG_functions.cpp | 16 ++++++++--
eeschema/dialogs/dialog_edit_line_style.cpp | 35 +++++++---------------
eeschema/sch_line.cpp | 46 +++++++++++++++++------------
eeschema/sch_line.h | 7 +++--
include/plot_common.h | 34 ++++++++++++++-------
10 files changed, 143 insertions(+), 77 deletions(-)
diff --git a/common/class_plotter.cpp b/common/class_plotter.cpp
index 2fa3501fd..4d6e20f81 100644
--- a/common/class_plotter.cpp
+++ b/common/class_plotter.cpp
@@ -63,8 +63,9 @@ PLOTTER::PLOTTER( )
// Temporary init to avoid not initialized vars, will be set later
m_IUsPerDecimil = 1; // will be set later to the actual value
iuPerDeviceUnit = 1; // will be set later to the actual value
- m_dashMarkLength_mm = 0.5; // Dashed line parameter in mm: segment
- m_dashGapLength_mm = 0.25; // Dashed line parameter in mm: gap
+ m_dotMarkLength_mm = 0.1; // Dotted line parameter in mm: segment
+ // Dashed line parameter is 5 * dotted line mark
+ // Dashed line gap is 3 * dotted line mark
}
PLOTTER::~PLOTTER()
@@ -131,16 +132,22 @@ double PLOTTER::userToDeviceSize( double size ) const
}
+double PLOTTER::GetDotMarkLenIU() const
+{
+ return userToDeviceSize( std::max( 1.0,
+ m_dotMarkLength_mm * 10000 / 25.4 * m_IUsPerDecimil - GetCurrentLineWidth() ) );
+}
+
+
double PLOTTER::GetDashMarkLenIU() const
{
- double mark = userToDeviceSize( m_dashMarkLength_mm*10000/25.4*m_IUsPerDecimil - GetCurrentLineWidth() );
- return ( mark < 0.0 ) ? 0.0 : mark;
+ return std::max( GetDashGapLenIU(), 5.0 * GetDotMarkLenIU() );
}
double PLOTTER::GetDashGapLenIU() const
{
- return userToDeviceSize( m_dashGapLength_mm*10000/25.4*m_IUsPerDecimil + GetCurrentLineWidth() );
+ return 3.0 * GetDotMarkLenIU() + userToDeviceSize( 2 * GetCurrentLineWidth() );
}
void PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, int radius,
diff --git a/common/common_plotDXF_functions.cpp b/common/common_plotDXF_functions.cpp
index fcbe7e8d6..5240088ea 100644
--- a/common/common_plotDXF_functions.cpp
+++ b/common/common_plotDXF_functions.cpp
@@ -496,7 +496,7 @@ void DXF_PLOTTER::PenTo( const wxPoint& pos, char plume )
/**
* Dashed lines are not (yet) supported by DXF_PLOTTER
*/
-void DXF_PLOTTER::SetDash( bool dashed )
+void DXF_PLOTTER::SetDash( int dashed )
{
// NOP for now
}
diff --git a/common/common_plotHPGL_functions.cpp b/common/common_plotHPGL_functions.cpp
index b2548ebab..782508d52 100644
--- a/common/common_plotHPGL_functions.cpp
+++ b/common/common_plotHPGL_functions.cpp
@@ -420,14 +420,24 @@ void HPGL_PLOTTER::PenTo( const wxPoint& pos, char plume )
/**
* HPGL supports dashed lines
*/
-void HPGL_PLOTTER::SetDash( bool dashed )
+void HPGL_PLOTTER::SetDash( int dashed )
{
wxASSERT( outputFile );
- if( dashed )
- fputs( "LI 2;\n", outputFile );
- else
- fputs( "LI;\n", outputFile );
+ switch( dashed )
+ {
+ case PLOTDASHTYPE_DASH:
+ fprintf( outputFile, "LT -2 4 1;\n" );
+ break;
+ case PLOTDASHTYPE_DOT:
+ fprintf( outputFile, "LT -1 2 1;\n" );
+ break;
+ case PLOTDASHTYPE_DASHDOT:
+ fprintf( outputFile, "LT -4 6 1;\n" );
+ break;
+ default:
+ fputs( "LT;\n", outputFile );
+ }
}
diff --git a/common/common_plotPDF_functions.cpp b/common/common_plotPDF_functions.cpp
index a8c1c5056..1404afed8 100644
--- a/common/common_plotPDF_functions.cpp
+++ b/common/common_plotPDF_functions.cpp
@@ -131,14 +131,27 @@ void PDF_PLOTTER::emitSetRGBColor( double r, double g, double b )
/**
* PDF supports dashed lines
*/
-void PDF_PLOTTER::SetDash( bool dashed )
+void PDF_PLOTTER::SetDash( int dashed )
{
wxASSERT( workFile );
- if( dashed )
+ switch( dashed )
+ {
+ case PLOTDASHTYPE_DASH:
fprintf( workFile, "[%d %d] 0 d\n",
- (int) GetDashMarkLenIU(), (int) GetDashGapLenIU() );
- else
+ (int) GetDashMarkLenIU(), (int) GetDashGapLenIU() );
+ break;
+ case PLOTDASHTYPE_DOT:
+ fprintf( workFile, "[%d %d] 0 d\n",
+ (int) GetDotMarkLenIU(), (int) GetDashGapLenIU() );
+ break;
+ case PLOTDASHTYPE_DASHDOT:
+ fprintf( workFile, "[%d %d %d %d] 0 d\n",
+ (int) GetDashMarkLenIU(), (int) GetDashGapLenIU(),
+ (int) GetDotMarkLenIU(), (int) GetDashGapLenIU() );
+ break;
+ default:
fputs( "[] 0 d\n", workFile );
+ }
}
diff --git a/common/common_plotPS_functions.cpp b/common/common_plotPS_functions.cpp
index 23aab5639..ce39fb2ee 100644
--- a/common/common_plotPS_functions.cpp
+++ b/common/common_plotPS_functions.cpp
@@ -545,14 +545,26 @@ void PS_PLOTTER::emitSetRGBColor( double r, double g, double b )
/**
* Postscript supports dashed lines
*/
-void PS_PLOTTER::SetDash( bool dashed )
+void PS_PLOTTER::SetDash( int dashed )
{
- wxASSERT( outputFile );
- if( dashed )
+ switch( dashed )
+ {
+ case PLOTDASHTYPE_DASH:
fprintf( outputFile, "[%d %d] 0 setdash\n",
- (int) GetDashMarkLenIU(), (int) GetDashGapLenIU() );
- else
+ (int) GetDashMarkLenIU(), (int) GetDashGapLenIU() );
+ break;
+ case PLOTDASHTYPE_DOT:
+ fprintf( outputFile, "[%d %d] 0 setdash\n",
+ (int) GetDotMarkLenIU(), (int) GetDashGapLenIU() );
+ break;
+ case PLOTDASHTYPE_DASHDOT:
+ fprintf( outputFile, "[%d %d %d %d] 0 setdash\n",
+ (int) GetDashMarkLenIU(), (int) GetDashGapLenIU(),
+ (int) GetDotMarkLenIU(), (int) GetDashGapLenIU() );
+ break;
+ default:
fputs( "solidline\n", outputFile );
+ }
}
diff --git a/common/common_plotSVG_functions.cpp b/common/common_plotSVG_functions.cpp
index dc0709499..50671d14a 100644
--- a/common/common_plotSVG_functions.cpp
+++ b/common/common_plotSVG_functions.cpp
@@ -233,9 +233,21 @@ void SVG_PLOTTER::setSVGPlotStyle()
m_pen_rgb_color, pen_w );
fputs( "stroke-linecap:round; stroke-linejoin:round;", outputFile );
- if( m_dashed )
+ switch( m_dashed )
+ {
+ case PLOTDASHTYPE_DASH:
fprintf( outputFile, "stroke-dasharray:%g,%g;",
GetDashMarkLenIU(), GetDashGapLenIU() );
+ break;
+ case PLOTDASHTYPE_DOT:
+ fprintf( outputFile, "stroke-dasharray:%g,%g;",
+ GetDotMarkLenIU(), GetDashGapLenIU() );
+ break;
+ case PLOTDASHTYPE_DASHDOT:
+ fprintf( outputFile, "stroke-dasharray:%g,%g,%g,%g;",
+ GetDashMarkLenIU(), GetDashGapLenIU(), GetDotMarkLenIU(), GetDashGapLenIU() );
+ break;
+ }
fputs( "\">\n", outputFile );
@@ -289,7 +301,7 @@ void SVG_PLOTTER::emitSetRGBColor( double r, double g, double b )
/**
* SVG supports dashed lines
*/
-void SVG_PLOTTER::SetDash( bool dashed )
+void SVG_PLOTTER::SetDash( int dashed )
{
if( m_dashed != dashed )
{
diff --git a/eeschema/dialogs/dialog_edit_line_style.cpp b/eeschema/dialogs/dialog_edit_line_style.cpp
index d72b68867..30c103d8f 100644
--- a/eeschema/dialogs/dialog_edit_line_style.cpp
+++ b/eeschema/dialogs/dialog_edit_line_style.cpp
@@ -22,6 +22,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
+#include <cassert>
#include <dialog_edit_line_style.h>
@@ -29,6 +30,7 @@ DIALOG_EDIT_LINE_STYLE::DIALOG_EDIT_LINE_STYLE( wxWindow* parent ) :
DIALOG_EDIT_LINE_STYLE_BASE( parent )
{
m_sdbSizer1Apply->SetLabel( _( "Default" ) );
+
m_lineStyle->SetSelection( 0 );
m_lineWidth->SetFocus();
@@ -57,39 +59,24 @@ void DIALOG_EDIT_LINE_STYLE::resetDefaults( wxCommandEvent& event )
void DIALOG_EDIT_LINE_STYLE::SetColor( const COLOR4D& aColor )
{
+ assert( aColor.r >= 0.0 && aColor.r <= 1.0 );
+ assert( aColor.g >= 0.0 && aColor.g <= 1.0 );
+ assert( aColor.b >= 0.0 && aColor.b <= 1.0 );
+ assert( aColor.a >= 0.0 && aColor.a <= 1.0 );
+
m_colorPicker->SetColour( aColor.ToColour() );
}
void DIALOG_EDIT_LINE_STYLE::SetStyle( const int aStyle )
{
- switch( aStyle )
- {
- case wxPENSTYLE_SHORT_DASH:
- m_lineStyle->SetSelection( 1 );
- break;
- case wxPENSTYLE_DOT:
- m_lineStyle->SetSelection( 2 );
- break;
- case wxPENSTYLE_DOT_DASH:
- m_lineStyle->SetSelection( 3 );
- break;
- default:
- m_lineStyle->SetSelection( 0 );
- break;
- }
+ assert( aStyle >= 0 && aStyle < 4 );
+
+ m_lineStyle->SetSelection( aStyle );
}
int DIALOG_EDIT_LINE_STYLE::GetStyle()
{
- const int retval[4] =
- {
- wxPENSTYLE_SOLID,
- wxPENSTYLE_SHORT_DASH,
- wxPENSTYLE_DOT,
- wxPENSTYLE_DOT_DASH,
- };
-
- return retval[ m_lineStyle->GetSelection() ];
+ return m_lineStyle->GetSelection();
}
diff --git a/eeschema/sch_line.cpp b/eeschema/sch_line.cpp
index 7a23f8bca..cb133147b 100644
--- a/eeschema/sch_line.cpp
+++ b/eeschema/sch_line.cpp
@@ -42,6 +42,15 @@
#include <dialogs/dialog_edit_line_style.h>
+const enum wxPenStyle SCH_LINE::PenStyle[] =
+{
+ [PLOTDASHTYPE_SOLID] = wxPENSTYLE_SOLID,
+ [PLOTDASHTYPE_DASH] = wxPENSTYLE_SHORT_DASH,
+ [PLOTDASHTYPE_DOT] = wxPENSTYLE_DOT,
+ [PLOTDASHTYPE_DASHDOT] = wxPENSTYLE_DOT_DASH
+};
+
+
SCH_LINE::SCH_LINE( const wxPoint& pos, int layer ) :
SCH_ITEM( NULL, SCH_LINE_T )
{
@@ -49,7 +58,7 @@ SCH_LINE::SCH_LINE( const wxPoint& pos, int layer ) :
m_end = pos;
m_startIsDangling = m_endIsDangling = false;
m_size = 0;
- m_style = 0;
+ m_style = -1;
m_color = COLOR4D::UNSPECIFIED;
switch( layer )
@@ -243,34 +252,30 @@ COLOR4D SCH_LINE::GetLineColor() const
return m_color;
}
-
-enum wxPenStyle SCH_LINE::GetDefaultStyle() const
+int SCH_LINE::GetDefaultStyle() const
{
if( m_Layer == LAYER_NOTES )
- return wxPENSTYLE_SHORT_DASH;
+ return PLOTDASHTYPE_DASH;
- return wxPENSTYLE_SOLID;
+ return PLOTDASHTYPE_SOLID;
}
void SCH_LINE::SetLineStyle( const int aStyle )
{
if( aStyle == GetDefaultStyle() )
- m_style = 0;
+ m_style = -1;
else
m_style = aStyle;
}
-enum wxPenStyle SCH_LINE::GetLineStyle() const
+int SCH_LINE::GetLineStyle() const
{
- if( m_style > 0 )
- return (enum wxPenStyle) m_style;
-
- if( m_Layer == LAYER_NOTES )
- return wxPENSTYLE_SHORT_DASH;
+ if( m_style >= 0 )
+ return m_style;
- return wxPENSTYLE_SOLID;
+ return GetDefaultStyle();
}
@@ -328,7 +333,8 @@ void SCH_LINE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset,
if( ( m_Flags & ENDPOINT ) == 0 )
end += offset;
- GRLine( panel->GetClipBox(), DC, start.x, start.y, end.x, end.y, width, color, GetLineStyle() );
+ GRLine( panel->GetClipBox(), DC, start.x, start.y, end.x, end.y, width, color,
+ PenStyle[ GetLineStyle() ] );
if( m_startIsDangling )
DrawDanglingSymbol( panel, DC, start, color );
@@ -685,17 +691,19 @@ bool SCH_LINE::doIsConnected( const wxPoint& aPosition ) const
void SCH_LINE::Plot( PLOTTER* aPlotter )
{
- aPlotter->SetColor( GetLayerColor( GetLayer() ) );
+ if( m_color != COLOR4D::UNSPECIFIED )
+ aPlotter->SetColor( m_color );
+ else
+ aPlotter->SetColor( GetLayerColor( GetLayer() ) );
+
aPlotter->SetCurrentLineWidth( GetPenSize() );
- if( m_Layer == LAYER_NOTES )
- aPlotter->SetDash( true );
+ aPlotter->SetDash( GetLineStyle() );
aPlotter->MoveTo( m_start );
aPlotter->FinishTo( m_end );
- if( m_Layer == LAYER_NOTES )
- aPlotter->SetDash( false );
+ aPlotter->SetDash( 0 );
}
diff --git a/eeschema/sch_line.h b/eeschema/sch_line.h
index db5ab1873..5a81e33bc 100644
--- a/eeschema/sch_line.h
+++ b/eeschema/sch_line.h
@@ -50,6 +50,9 @@ class SCH_LINE : public SCH_ITEM
COLOR4D m_color; ///< Line color
public:
+
+ static const enum wxPenStyle PenStyle[];
+
SCH_LINE( const wxPoint& pos = wxPoint( 0, 0 ), int layer = LAYER_NOTES );
SCH_LINE( const SCH_LINE& aLine );
@@ -79,11 +82,11 @@ public:
void SetEndPoint( const wxPoint& aPosition ) { m_end = aPosition; }
- enum wxPenStyle GetDefaultStyle() const;
+ int GetDefaultStyle() const;
void SetLineStyle( const int aStyle );
- enum wxPenStyle GetLineStyle() const;
+ int GetLineStyle() const;
void SetLineColor( const COLOR4D aColor );
diff --git a/include/plot_common.h b/include/plot_common.h
index ad7942674..462f63ee3 100644
--- a/include/plot_common.h
+++ b/include/plot_common.h
@@ -76,6 +76,16 @@ enum PlotTextMode {
PLOTTEXTMODE_DEFAULT
};
+/**
+ * Enum for choosing dashed line type
+ */
+enum PlotDashType {
+ PLOTDASHTYPE_SOLID,
+ PLOTDASHTYPE_DASH,
+ PLOTDASHTYPE_DOT,
+ PLOTDASHTYPE_DASHDOT,
+ PLOTDASHTYPE_COUNT,
+};
/**
* Base plotter engine class. General rule: all the interface with the caller
@@ -86,8 +96,7 @@ enum PlotTextMode {
class PLOTTER
{
private:
- double m_dashMarkLength_mm ; ///< Dashed line parameter in mm: segment
- double m_dashGapLength_mm; ///< Dashed line parameter in mm: gap
+ double m_dotMarkLength_mm ; ///< Dotted line parameter in mm: segment
public:
// These values are used as flag for pen or aperture selection
@@ -146,7 +155,7 @@ public:
virtual void SetColor( COLOR4D color ) = 0;
- virtual void SetDash( bool dashed ) = 0;
+ virtual void SetDash( int dashed ) = 0;
virtual void SetCreator( const wxString& aCreator )
{
@@ -501,6 +510,8 @@ protected:
*/
virtual double userToDeviceSize( double size ) const;
+ double GetDotMarkLenIU() const;
+
double GetDashMarkLenIU() const;
double GetDashGapLenIU() const;
@@ -576,7 +587,7 @@ public:
}
virtual void SetDefaultLineWidth( int width ) override {}
- virtual void SetDash( bool dashed ) override;
+ virtual void SetDash( int dashed ) override;
virtual void SetColor( COLOR4D color ) override {}
@@ -751,7 +762,7 @@ public:
virtual bool StartPlot() override;
virtual bool EndPlot() override;
virtual void SetCurrentLineWidth( int width, void* aData = NULL ) override;
- virtual void SetDash( bool dashed ) override;
+ virtual void SetDash( int dashed ) override;
virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
double aScale, bool aMirror ) override;
@@ -821,7 +832,7 @@ public:
virtual void StartPage();
virtual void ClosePage();
virtual void SetCurrentLineWidth( int width, void* aData = NULL ) override;
- virtual void SetDash( bool dashed ) override;
+ virtual void SetDash( int dashed ) override;
/** PDF can have multiple pages, so SetPageSettings can be called
* with the outputFile open (but not inside a page stream!) */
@@ -894,7 +905,7 @@ public:
virtual bool StartPlot() override;
virtual bool EndPlot() override;
virtual void SetCurrentLineWidth( int width, void* aData = NULL ) override;
- virtual void SetDash( bool dashed ) override;
+ virtual void SetDash( int dashed ) override;
virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
double aScale, bool aMirror ) override;
@@ -938,7 +949,10 @@ protected:
bool m_graphics_changed; // true if a pen/brush parameter is modified
// color, pen size, fil mode ...
// the new SVG stype must be output on file
- bool m_dashed; // true to use plot dashed line style
+ int m_dashed; // 0 = plot solid line style
+ // 1 = plot dashed line style
+ // 2 = plot dotted line style
+ // 3 = plot dash-dot line style
/**
* function emitSetRGBColor()
@@ -1008,7 +1022,7 @@ public:
virtual void SetDefaultLineWidth( int width ) override;
// RS274X has no dashing, nor colours
- virtual void SetDash( bool dashed ) override {}
+ virtual void SetDash( int dashed ) override {}
virtual void SetColor( COLOR4D color ) override {}
// Currently, aScale and aMirror are not used in gerber plotter
virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
@@ -1246,7 +1260,7 @@ public:
defaultPenWidth = 0;
}
- virtual void SetDash( bool dashed ) override;
+ virtual void SetDash( int dashed ) override;
virtual void SetColor( COLOR4D color ) override;
--
2.11.0
From 83af3c678282659c512fa566b2a77c3be20cc4e9 Mon Sep 17 00:00:00 2001
From: Seth Hillbrand <hillbrand@xxxxxxxxxxx>
Date: Tue, 31 Oct 2017 09:33:37 -0700
Subject: [PATCH 1/4] Eeschema: Adding line styling options
NEW: Adds support in eeschema for changing the default line style,
width and color on a case-by-case basis.
CHANGED: "Wire" lines now optionally include data on the line style,
width and color if they differ from the default.
Fixes: lp:594059
* https://bugs.launchpad.net/kicad/+bug/594059
Fixes: lp:1405026
* https://bugs.launchpad.net/kicad/+bug/1405026
---
common/gr_basic.cpp | 35 +-
eeschema/CMakeLists.txt | 2 +
eeschema/dialogs/dialog_edit_line_style.cpp | 95 +++
eeschema/dialogs/dialog_edit_line_style.h | 67 +++
eeschema/dialogs/dialog_edit_line_style_base.cpp | 111 ++++
eeschema/dialogs/dialog_edit_line_style_base.fbp | 721 +++++++++++++++++++++++
eeschema/dialogs/dialog_edit_line_style_base.h | 67 +++
eeschema/sch_collectors.cpp | 1 +
eeschema/sch_legacy_plugin.cpp | 33 +-
eeschema/sch_line.cpp | 164 +++++-
eeschema/sch_line.h | 25 +
eeschema/schedit.cpp | 2 +
eeschema/schframe.h | 10 +
include/gr_basic.h | 6 +-
14 files changed, 1318 insertions(+), 21 deletions(-)
create mode 100644 eeschema/dialogs/dialog_edit_line_style.cpp
create mode 100644 eeschema/dialogs/dialog_edit_line_style.h
create mode 100644 eeschema/dialogs/dialog_edit_line_style_base.cpp
create mode 100644 eeschema/dialogs/dialog_edit_line_style_base.fbp
create mode 100644 eeschema/dialogs/dialog_edit_line_style_base.h
diff --git a/common/gr_basic.cpp b/common/gr_basic.cpp
index 0ca4edccb..d2cbae4e3 100644
--- a/common/gr_basic.cpp
+++ b/common/gr_basic.cpp
@@ -208,6 +208,7 @@ void GRResetPenAndBrush( wxDC* DC )
*/
void GRSetColorPen( wxDC* DC, COLOR4D Color, int width, wxPenStyle style )
{
+ wxDash dots[2] = { 1, 3 };
// Under OSX and while printing when wxPen is set to 0, renderer follows the request drawing
// nothing & in the bitmap world the minimum is enough to light a pixel, in vectorial one not
if( width <= 1 )
@@ -224,6 +225,11 @@ void GRSetColorPen( wxDC* DC, COLOR4D Color, int width, wxPenStyle style )
{
wxPen pen;
pen.SetColour( Color.ToColour() );
+ if( style == wxPENSTYLE_DOT )
+ {
+ style = wxPENSTYLE_USER_DASH;
+ pen.SetDashes( 2, dots );
+ }
pen.SetWidth( width );
pen.SetStyle( style );
DC->SetPen( pen );
@@ -356,18 +362,19 @@ void GRLine( EDA_RECT* ClipBox,
int x2,
int y2,
int width,
- COLOR4D Color )
+ COLOR4D Color,
+ wxPenStyle aStyle)
{
- GRSetColorPen( DC, Color, width );
+ GRSetColorPen( DC, Color, width, aStyle );
WinClipAndDrawLine( ClipBox, DC, x1, y1, x2, y2, width );
GRLastMoveToX = x2;
GRLastMoveToY = y2;
}
-void GRLine( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aStart, wxPoint aEnd, int aWidth, COLOR4D aColor )
+void GRLine( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aStart, wxPoint aEnd, int aWidth, COLOR4D aColor, wxPenStyle aStyle )
{
- GRLine( aClipBox, aDC, aStart.x, aStart.y, aEnd.x, aEnd.y, aWidth, aColor );
+ GRLine( aClipBox, aDC, aStart.x, aStart.y, aEnd.x, aEnd.y, aWidth, aColor, aStyle );
}
@@ -375,13 +382,15 @@ void GRDashedLine( EDA_RECT* ClipBox, wxDC* DC,
int x1, int y1, int x2, int y2,
int width, COLOR4D Color )
{
- GRLastMoveToX = x2;
- GRLastMoveToY = y2;
- s_DC_lastcolor = COLOR4D::UNSPECIFIED;
- GRSetColorPen( DC, Color, width, wxPENSTYLE_SHORT_DASH );
- WinClipAndDrawLine( ClipBox, DC, x1, y1, x2, y2, width );
- s_DC_lastcolor = COLOR4D::UNSPECIFIED;
- GRSetColorPen( DC, Color, width );
+ GRLine( ClipBox, DC, x1, y1, x2, y2, width, Color, wxPENSTYLE_SHORT_DASH );
+}
+
+
+void GRDottedLine( EDA_RECT* ClipBox, wxDC* DC,
+ int x1, int y1, int x2, int y2,
+ int width, COLOR4D Color )
+{
+ GRLine( ClipBox, DC, x1, y1, x2, y2, width, Color, wxPENSTYLE_DOT );
}
@@ -407,9 +416,7 @@ void GRLineTo( EDA_RECT* ClipBox, wxDC* DC, int x, int y, int width, COLOR4D Col
void GRMixedLine( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
int width, COLOR4D Color )
{
- GRSetColorPen( DC, Color, width, wxPENSTYLE_DOT_DASH );
- GRLine( ClipBox, DC, x1, y1, x2, y2, width, Color );
- GRSetColorPen( DC, Color, width );
+ GRLine( ClipBox, DC, x1, y1, x2, y2, width, Color, wxPENSTYLE_DOT_DASH );
}
diff --git a/eeschema/CMakeLists.txt b/eeschema/CMakeLists.txt
index 8cb429e8a..8bfcd7834 100644
--- a/eeschema/CMakeLists.txt
+++ b/eeschema/CMakeLists.txt
@@ -39,6 +39,8 @@ set( EESCHEMA_DLGS
dialogs/dialog_edit_label_base.cpp
dialogs/dialog_edit_libentry_fields_in_lib.cpp
dialogs/dialog_edit_libentry_fields_in_lib_base.cpp
+ dialogs/dialog_edit_line_style.cpp
+ dialogs/dialog_edit_line_style_base.cpp
dialogs/dialog_edit_one_field.cpp
dialogs/dialog_eeschema_options_base.cpp
dialogs/dialog_eeschema_options.cpp
diff --git a/eeschema/dialogs/dialog_edit_line_style.cpp b/eeschema/dialogs/dialog_edit_line_style.cpp
new file mode 100644
index 000000000..d72b68867
--- /dev/null
+++ b/eeschema/dialogs/dialog_edit_line_style.cpp
@@ -0,0 +1,95 @@
+/*
+ * This program source code file is part of KiCad, a free EDA CAD application.
+ *
+ * Copyright (C) 2017 Seth Hillbrand <hillbrand@xxxxxxxxxxx>
+ * Copyright (C) 2015 KiCad Developers, see CHANGELOG.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 <dialog_edit_line_style.h>
+
+
+DIALOG_EDIT_LINE_STYLE::DIALOG_EDIT_LINE_STYLE( wxWindow* parent ) :
+ DIALOG_EDIT_LINE_STYLE_BASE( parent )
+{
+ m_sdbSizer1Apply->SetLabel( _( "Default" ) );
+ m_lineStyle->SetSelection( 0 );
+
+ m_lineWidth->SetFocus();
+ defaultStyle = 0;
+ defaultWidth = "";
+ m_sdbSizer1OK->SetDefault();
+
+ // Now all widgets have the size fixed, call FinishDialogSettings
+ FinishDialogSettings();
+
+ // On some windows manager (Unity, XFCE), this dialog is
+ // not always raised, depending on this dialog is run.
+ // Force it to be raised
+ Raise();
+}
+
+
+void DIALOG_EDIT_LINE_STYLE::resetDefaults( wxCommandEvent& event )
+{
+ SetStyle( defaultStyle );
+ SetWidth( defaultWidth );
+ SetColor( defaultColor );
+ Refresh();
+}
+
+
+void DIALOG_EDIT_LINE_STYLE::SetColor( const COLOR4D& aColor )
+{
+ m_colorPicker->SetColour( aColor.ToColour() );
+}
+
+
+void DIALOG_EDIT_LINE_STYLE::SetStyle( const int aStyle )
+{
+ switch( aStyle )
+ {
+ case wxPENSTYLE_SHORT_DASH:
+ m_lineStyle->SetSelection( 1 );
+ break;
+ case wxPENSTYLE_DOT:
+ m_lineStyle->SetSelection( 2 );
+ break;
+ case wxPENSTYLE_DOT_DASH:
+ m_lineStyle->SetSelection( 3 );
+ break;
+ default:
+ m_lineStyle->SetSelection( 0 );
+ break;
+ }
+}
+
+
+int DIALOG_EDIT_LINE_STYLE::GetStyle()
+{
+ const int retval[4] =
+ {
+ wxPENSTYLE_SOLID,
+ wxPENSTYLE_SHORT_DASH,
+ wxPENSTYLE_DOT,
+ wxPENSTYLE_DOT_DASH,
+ };
+
+ return retval[ m_lineStyle->GetSelection() ];
+}
diff --git a/eeschema/dialogs/dialog_edit_line_style.h b/eeschema/dialogs/dialog_edit_line_style.h
new file mode 100644
index 000000000..522dba98e
--- /dev/null
+++ b/eeschema/dialogs/dialog_edit_line_style.h
@@ -0,0 +1,67 @@
+/*
+ * This program source code file is part of KiCad, a free EDA CAD application.
+ *
+ * Copyright (C) 2017 Seth Hillbrand <hillbrand@xxxxxxxxxxx>
+ * Copyright (C) 2014 KiCad Developers, see CHANGELOG.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_edit_line_style__
+#define __dialog_edit_line_style__
+
+
+/**
+ * @file
+ * Subclass of DIALOG_EDIT_LINE_STYLE_BASE, which is generated by wxFormBuilder.
+ */
+
+#include <dialog_edit_line_style_base.h>
+#include <sch_line.h>
+
+
+class DIALOG_EDIT_LINE_STYLE : public DIALOG_EDIT_LINE_STYLE_BASE
+{
+public:
+ DIALOG_EDIT_LINE_STYLE( wxWindow* parent );
+
+ void SetWidth( const wxString& aWidth ) { m_lineWidth->SetValue( aWidth ); }
+ void SetDefaultWidth( const wxString& aWidth ) { defaultWidth = aWidth; }
+ wxString GetWidth() const { return m_lineWidth->GetValue(); }
+
+ COLOR4D GetColor() const { return COLOR4D( m_colorPicker->GetColour() ); }
+ void SetColor( const COLOR4D& aColor );
+ void SetDefaultColor( const COLOR4D& aColor ) { defaultColor = aColor; }
+
+ void SetStyle( const int aStyle );
+ void SetDefaultStyle( const int aStyle ) { defaultStyle = aStyle; }
+ int GetStyle();
+
+ void SetLineWidthUnits(const wxString& aUnits)
+ {
+ m_staticWidthUnits->SetLabel( aUnits );
+ }
+private:
+ int defaultStyle;
+ wxString defaultWidth;
+ COLOR4D defaultColor;
+
+ void resetDefaults( wxCommandEvent& event ) override;
+};
+
+#endif // __dialog_edit_line_style__
diff --git a/eeschema/dialogs/dialog_edit_line_style_base.cpp b/eeschema/dialogs/dialog_edit_line_style_base.cpp
new file mode 100644
index 000000000..f66282924
--- /dev/null
+++ b/eeschema/dialogs/dialog_edit_line_style_base.cpp
@@ -0,0 +1,111 @@
+///////////////////////////////////////////////////////////////////////////
+// C++ code generated with wxFormBuilder (version Nov 9 2017)
+// http://www.wxformbuilder.org/
+//
+// PLEASE DO *NOT* EDIT THIS FILE!
+///////////////////////////////////////////////////////////////////////////
+
+#include "dialog_edit_line_style_base.h"
+
+///////////////////////////////////////////////////////////////////////////
+
+BEGIN_EVENT_TABLE( DIALOG_EDIT_LINE_STYLE_BASE, DIALOG_SHIM )
+ EVT_BUTTON( wxID_APPLY, DIALOG_EDIT_LINE_STYLE_BASE::_wxFB_resetDefaults )
+END_EVENT_TABLE()
+
+DIALOG_EDIT_LINE_STYLE_BASE::DIALOG_EDIT_LINE_STYLE_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( wxHORIZONTAL );
+
+ wxBoxSizer* dlgBorderSizer;
+ dlgBorderSizer = new wxBoxSizer( wxVERTICAL );
+
+ wxBoxSizer* bSizer7;
+ bSizer7 = new wxBoxSizer( wxHORIZONTAL );
+
+ wxStaticBoxSizer* sbSizer1;
+ sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("General") ), wxVERTICAL );
+
+ wxBoxSizer* bSizer31;
+ bSizer31 = new wxBoxSizer( wxHORIZONTAL );
+
+ m_staticWidth1 = new wxStaticText( sbSizer1->GetStaticBox(), wxID_ANY, _("&Width:"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_staticWidth1->Wrap( -1 );
+ bSizer31->Add( m_staticWidth1, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
+
+ m_lineWidth = new wxTextCtrl( sbSizer1->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
+ #ifdef __WXGTK__
+ if ( !m_lineWidth->HasFlag( wxTE_MULTILINE ) )
+ {
+ m_lineWidth->SetMaxLength( 6 );
+ }
+ #else
+ m_lineWidth->SetMaxLength( 6 );
+ #endif
+ bSizer31->Add( m_lineWidth, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
+
+ m_staticWidthUnits = new wxStaticText( sbSizer1->GetStaticBox(), wxID_ANY, _("millimeter"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_staticWidthUnits->Wrap( -1 );
+ bSizer31->Add( m_staticWidthUnits, 1, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
+
+
+ sbSizer1->Add( bSizer31, 0, wxALL|wxEXPAND, 1 );
+
+ wxBoxSizer* bSizer5;
+ bSizer5 = new wxBoxSizer( wxHORIZONTAL );
+
+ m_staticText5 = new wxStaticText( sbSizer1->GetStaticBox(), wxID_ANY, _("C&olor:"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_staticText5->Wrap( -1 );
+ bSizer5->Add( m_staticText5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
+
+ m_colorPicker = new wxColourPickerCtrl( sbSizer1->GetStaticBox(), wxID_ANY, wxColour( 0, 0, 0 ), wxDefaultPosition, wxDefaultSize, wxCLRP_DEFAULT_STYLE );
+ bSizer5->Add( m_colorPicker, 0, wxALL, 5 );
+
+
+ bSizer5->Add( 0, 0, 1, wxEXPAND, 5 );
+
+
+ sbSizer1->Add( bSizer5, 0, wxEXPAND|wxALL, 1 );
+
+
+ bSizer7->Add( sbSizer1, 3, wxALL|wxEXPAND, 5 );
+
+ wxString m_lineStyleChoices[] = { _("Solid"), _("Dashed"), _("Dotted"), _("Dash-Dot") };
+ int m_lineStyleNChoices = sizeof( m_lineStyleChoices ) / sizeof( wxString );
+ m_lineStyle = new wxRadioBox( this, wxID_ANY, _("&Pen Style"), wxDefaultPosition, wxDefaultSize, m_lineStyleNChoices, m_lineStyleChoices, 4, wxRA_SPECIFY_ROWS );
+ m_lineStyle->SetSelection( 1 );
+ bSizer7->Add( m_lineStyle, 2, wxALL|wxEXPAND, 5 );
+
+
+ dlgBorderSizer->Add( bSizer7, 1, wxEXPAND, 5 );
+
+
+ dlgBorderSizer->Add( 0, 0, 0, wxALL|wxEXPAND, 1 );
+
+ m_sdbSizer1 = new wxStdDialogButtonSizer();
+ m_sdbSizer1OK = new wxButton( this, wxID_OK );
+ m_sdbSizer1->AddButton( m_sdbSizer1OK );
+ m_sdbSizer1Apply = new wxButton( this, wxID_APPLY );
+ m_sdbSizer1->AddButton( m_sdbSizer1Apply );
+ m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL );
+ m_sdbSizer1->AddButton( m_sdbSizer1Cancel );
+ m_sdbSizer1->Realize();
+
+ dlgBorderSizer->Add( m_sdbSizer1, 0, wxALL|wxEXPAND, 5 );
+
+
+ mainSizer->Add( dlgBorderSizer, 1, wxALL|wxEXPAND, 12 );
+
+
+ this->SetSizer( mainSizer );
+ this->Layout();
+
+ this->Centre( wxBOTH );
+}
+
+DIALOG_EDIT_LINE_STYLE_BASE::~DIALOG_EDIT_LINE_STYLE_BASE()
+{
+}
diff --git a/eeschema/dialogs/dialog_edit_line_style_base.fbp b/eeschema/dialogs/dialog_edit_line_style_base.fbp
new file mode 100644
index 000000000..c05e92de6
--- /dev/null
+++ b/eeschema/dialogs/dialog_edit_line_style_base.fbp
@@ -0,0 +1,721 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<wxFormBuilder_Project>
+ <FileVersion major="1" minor="13" />
+ <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_edit_line_style_base</property>
+ <property name="first_id">1000</property>
+ <property name="help_provider">none</property>
+ <property name="internationalize">1</property>
+ <property name="name">dialog_edit_line_style</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_EDIT_LINE_STYLE_BASE</property>
+ <property name="pos"></property>
+ <property name="size">399,230</property>
+ <property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
+ <property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
+ <property name="title">Line Style</property>
+ <property name="tooltip"></property>
+ <property name="window_extra_style"></property>
+ <property name="window_name"></property>
+ <property name="window_style"></property>
+ <event name="OnActivate"></event>
+ <event name="OnActivateApp"></event>
+ <event name="OnAuiFindManager"></event>
+ <event name="OnAuiPaneButton"></event>
+ <event name="OnAuiPaneClose"></event>
+ <event name="OnAuiPaneMaximize"></event>
+ <event name="OnAuiPaneRestore"></event>
+ <event name="OnAuiRender"></event>
+ <event name="OnChar"></event>
+ <event name="OnClose"></event>
+ <event name="OnEnterWindow"></event>
+ <event name="OnEraseBackground"></event>
+ <event name="OnHibernate"></event>
+ <event name="OnIconize"></event>
+ <event name="OnIdle"></event>
+ <event name="OnInitDialog"></event>
+ <event name="OnKeyDown"></event>
+ <event name="OnKeyUp"></event>
+ <event name="OnKillFocus"></event>
+ <event name="OnLeaveWindow"></event>
+ <event name="OnLeftDClick"></event>
+ <event name="OnLeftDown"></event>
+ <event name="OnLeftUp"></event>
+ <event name="OnMiddleDClick"></event>
+ <event name="OnMiddleDown"></event>
+ <event name="OnMiddleUp"></event>
+ <event name="OnMotion"></event>
+ <event name="OnMouseEvents"></event>
+ <event name="OnMouseWheel"></event>
+ <event name="OnPaint"></event>
+ <event name="OnRightDClick"></event>
+ <event name="OnRightDown"></event>
+ <event name="OnRightUp"></event>
+ <event name="OnSetFocus"></event>
+ <event name="OnSize"></event>
+ <event name="OnUpdateUI"></event>
+ <object class="wxBoxSizer" expanded="1">
+ <property name="minimum_size"></property>
+ <property name="name">mainSizer</property>
+ <property name="orient">wxHORIZONTAL</property>
+ <property name="permission">none</property>
+ <object class="sizeritem" expanded="1">
+ <property name="border">12</property>
+ <property name="flag">wxALL|wxEXPAND</property>
+ <property name="proportion">1</property>
+ <object class="wxBoxSizer" expanded="1">
+ <property name="minimum_size"></property>
+ <property name="name">dlgBorderSizer</property>
+ <property name="orient">wxVERTICAL</property>
+ <property name="permission">none</property>
+ <object class="sizeritem" expanded="1">
+ <property name="border">5</property>
+ <property name="flag">wxEXPAND</property>
+ <property name="proportion">1</property>
+ <object class="wxBoxSizer" expanded="1">
+ <property name="minimum_size"></property>
+ <property name="name">bSizer7</property>
+ <property name="orient">wxHORIZONTAL</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">3</property>
+ <object class="wxStaticBoxSizer" expanded="1">
+ <property name="id">wxID_ANY</property>
+ <property name="label">General</property>
+ <property name="minimum_size"></property>
+ <property name="name">sbSizer1</property>
+ <property name="orient">wxVERTICAL</property>
+ <property name="parent">1</property>
+ <property name="permission">none</property>
+ <event name="OnUpdateUI"></event>
+ <object class="sizeritem" expanded="0">
+ <property name="border">1</property>
+ <property name="flag">wxALL|wxEXPAND</property>
+ <property name="proportion">0</property>
+ <object class="wxBoxSizer" expanded="0">
+ <property name="minimum_size"></property>
+ <property name="name">bSizer31</property>
+ <property name="orient">wxHORIZONTAL</property>
+ <property name="permission">none</property>
+ <object class="sizeritem" expanded="0">
+ <property name="border">3</property>
+ <property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</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">&Width:</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_staticWidth1</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>
+ <event name="OnChar"></event>
+ <event name="OnEnterWindow"></event>
+ <event name="OnEraseBackground"></event>
+ <event name="OnKeyDown"></event>
+ <event name="OnKeyUp"></event>
+ <event name="OnKillFocus"></event>
+ <event name="OnLeaveWindow"></event>
+ <event name="OnLeftDClick"></event>
+ <event name="OnLeftDown"></event>
+ <event name="OnLeftUp"></event>
+ <event name="OnMiddleDClick"></event>
+ <event name="OnMiddleDown"></event>
+ <event name="OnMiddleUp"></event>
+ <event name="OnMotion"></event>
+ <event name="OnMouseEvents"></event>
+ <event name="OnMouseWheel"></event>
+ <event name="OnPaint"></event>
+ <event name="OnRightDClick"></event>
+ <event name="OnRightDown"></event>
+ <event name="OnRightUp"></event>
+ <event name="OnSetFocus"></event>
+ <event name="OnSize"></event>
+ <event name="OnUpdateUI"></event>
+ </object>
+ </object>
+ <object class="sizeritem" expanded="0">
+ <property name="border">3</property>
+ <property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</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">6</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_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"></property>
+ <property name="style"></property>
+ <property name="subclass"></property>
+ <property name="toolbar_pane">0</property>
+ <property name="tooltip"></property>
+ <property name="validator_data_type">bool</property>
+ <property name="validator_style">wxFILTER_NUMERIC</property>
+ <property name="validator_type">wxDefaultValidator</property>
+ <property name="validator_variable">m_isValid</property>
+ <property name="value"></property>
+ <property name="window_extra_style"></property>
+ <property name="window_name"></property>
+ <property name="window_style"></property>
+ <event name="OnChar"></event>
+ <event name="OnEnterWindow"></event>
+ <event name="OnEraseBackground"></event>
+ <event name="OnKeyDown"></event>
+ <event name="OnKeyUp"></event>
+ <event name="OnKillFocus"></event>
+ <event name="OnLeaveWindow"></event>
+ <event name="OnLeftDClick"></event>
+ <event name="OnLeftDown"></event>
+ <event name="OnLeftUp"></event>
+ <event name="OnMiddleDClick"></event>
+ <event name="OnMiddleDown"></event>
+ <event name="OnMiddleUp"></event>
+ <event name="OnMotion"></event>
+ <event name="OnMouseEvents"></event>
+ <event name="OnMouseWheel"></event>
+ <event name="OnPaint"></event>
+ <event name="OnRightDClick"></event>
+ <event name="OnRightDown"></event>
+ <event name="OnRightUp"></event>
+ <event name="OnSetFocus"></event>
+ <event name="OnSize"></event>
+ <event name="OnText"></event>
+ <event name="OnTextEnter"></event>
+ <event name="OnTextMaxLen"></event>
+ <event name="OnTextURL"></event>
+ <event name="OnUpdateUI"></event>
+ </object>
+ </object>
+ <object class="sizeritem" expanded="0">
+ <property name="border">3</property>
+ <property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
+ <property name="proportion">1</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">millimeter</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_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>
+ <event name="OnChar"></event>
+ <event name="OnEnterWindow"></event>
+ <event name="OnEraseBackground"></event>
+ <event name="OnKeyDown"></event>
+ <event name="OnKeyUp"></event>
+ <event name="OnKillFocus"></event>
+ <event name="OnLeaveWindow"></event>
+ <event name="OnLeftDClick"></event>
+ <event name="OnLeftDown"></event>
+ <event name="OnLeftUp"></event>
+ <event name="OnMiddleDClick"></event>
+ <event name="OnMiddleDown"></event>
+ <event name="OnMiddleUp"></event>
+ <event name="OnMotion"></event>
+ <event name="OnMouseEvents"></event>
+ <event name="OnMouseWheel"></event>
+ <event name="OnPaint"></event>
+ <event name="OnRightDClick"></event>
+ <event name="OnRightDown"></event>
+ <event name="OnRightUp"></event>
+ <event name="OnSetFocus"></event>
+ <event name="OnSize"></event>
+ <event name="OnUpdateUI"></event>
+ </object>
+ </object>
+ </object>
+ </object>
+ <object class="sizeritem" expanded="1">
+ <property name="border">1</property>
+ <property name="flag">wxEXPAND|wxALL</property>
+ <property name="proportion">0</property>
+ <object class="wxBoxSizer" expanded="1">
+ <property name="minimum_size"></property>
+ <property name="name">bSizer5</property>
+ <property name="orient">wxHORIZONTAL</property>
+ <property name="permission">none</property>
+ <object class="sizeritem" expanded="0">
+ <property name="border">5</property>
+ <property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</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">C&olor:</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_staticText5</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>
+ <event name="OnChar"></event>
+ <event name="OnEnterWindow"></event>
+ <event name="OnEraseBackground"></event>
+ <event name="OnKeyDown"></event>
+ <event name="OnKeyUp"></event>
+ <event name="OnKillFocus"></event>
+ <event name="OnLeaveWindow"></event>
+ <event name="OnLeftDClick"></event>
+ <event name="OnLeftDown"></event>
+ <event name="OnLeftUp"></event>
+ <event name="OnMiddleDClick"></event>
+ <event name="OnMiddleDown"></event>
+ <event name="OnMiddleUp"></event>
+ <event name="OnMotion"></event>
+ <event name="OnMouseEvents"></event>
+ <event name="OnMouseWheel"></event>
+ <event name="OnPaint"></event>
+ <event name="OnRightDClick"></event>
+ <event name="OnRightDown"></event>
+ <event name="OnRightUp"></event>
+ <event name="OnSetFocus"></event>
+ <event name="OnSize"></event>
+ <event name="OnUpdateUI"></event>
+ </object>
+ </object>
+ <object class="sizeritem" expanded="0">
+ <property name="border">5</property>
+ <property name="flag">wxALL</property>
+ <property name="proportion">0</property>
+ <object class="wxColourPickerCtrl" 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="colour">0,0,0</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_colorPicker</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">wxCLRP_DEFAULT_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="OnChar"></event>
+ <event name="OnColourChanged"></event>
+ <event name="OnEnterWindow"></event>
+ <event name="OnEraseBackground"></event>
+ <event name="OnKeyDown"></event>
+ <event name="OnKeyUp"></event>
+ <event name="OnKillFocus"></event>
+ <event name="OnLeaveWindow"></event>
+ <event name="OnLeftDClick"></event>
+ <event name="OnLeftDown"></event>
+ <event name="OnLeftUp"></event>
+ <event name="OnMiddleDClick"></event>
+ <event name="OnMiddleDown"></event>
+ <event name="OnMiddleUp"></event>
+ <event name="OnMotion"></event>
+ <event name="OnMouseEvents"></event>
+ <event name="OnMouseWheel"></event>
+ <event name="OnPaint"></event>
+ <event name="OnRightDClick"></event>
+ <event name="OnRightDown"></event>
+ <event name="OnRightUp"></event>
+ <event name="OnSetFocus"></event>
+ <event name="OnSize"></event>
+ <event name="OnUpdateUI"></event>
+ </object>
+ </object>
+ <object class="sizeritem" expanded="0">
+ <property name="border">5</property>
+ <property name="flag">wxEXPAND</property>
+ <property name="proportion">1</property>
+ <object class="spacer" expanded="0">
+ <property name="height">0</property>
+ <property name="permission">protected</property>
+ <property name="width">0</property>
+ </object>
+ </object>
+ </object>
+ </object>
+ </object>
+ </object>
+ <object class="sizeritem" expanded="0">
+ <property name="border">5</property>
+ <property name="flag">wxALL|wxEXPAND</property>
+ <property name="proportion">2</property>
+ <object class="wxRadioBox" 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="choices">"Solid" "Dashed" "Dotted" "Dash-Dot"</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">&Pen Style</property>
+ <property name="majorDimension">4</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_lineStyle</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">wxRA_SPECIFY_ROWS</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="OnChar"></event>
+ <event name="OnEnterWindow"></event>
+ <event name="OnEraseBackground"></event>
+ <event name="OnKeyDown"></event>
+ <event name="OnKeyUp"></event>
+ <event name="OnKillFocus"></event>
+ <event name="OnLeaveWindow"></event>
+ <event name="OnLeftDClick"></event>
+ <event name="OnLeftDown"></event>
+ <event name="OnLeftUp"></event>
+ <event name="OnMiddleDClick"></event>
+ <event name="OnMiddleDown"></event>
+ <event name="OnMiddleUp"></event>
+ <event name="OnMotion"></event>
+ <event name="OnMouseEvents"></event>
+ <event name="OnMouseWheel"></event>
+ <event name="OnPaint"></event>
+ <event name="OnRadioBox"></event>
+ <event name="OnRightDClick"></event>
+ <event name="OnRightDown"></event>
+ <event name="OnRightUp"></event>
+ <event name="OnSetFocus"></event>
+ <event name="OnSize"></event>
+ <event name="OnUpdateUI"></event>
+ </object>
+ </object>
+ </object>
+ </object>
+ <object class="sizeritem" expanded="1">
+ <property name="border">1</property>
+ <property name="flag">wxALL|wxEXPAND</property>
+ <property name="proportion">0</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">wxALL|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_sdbSizer1</property>
+ <property name="permission">protected</property>
+ <event name="OnApplyButtonClick">resetDefaults</event>
+ <event name="OnCancelButtonClick"></event>
+ <event name="OnContextHelpButtonClick"></event>
+ <event name="OnHelpButtonClick"></event>
+ <event name="OnNoButtonClick"></event>
+ <event name="OnOKButtonClick"></event>
+ <event name="OnSaveButtonClick"></event>
+ <event name="OnYesButtonClick"></event>
+ </object>
+ </object>
+ </object>
+ </object>
+ </object>
+ </object>
+ </object>
+</wxFormBuilder_Project>
diff --git a/eeschema/dialogs/dialog_edit_line_style_base.h b/eeschema/dialogs/dialog_edit_line_style_base.h
new file mode 100644
index 000000000..4cd6d7066
--- /dev/null
+++ b/eeschema/dialogs/dialog_edit_line_style_base.h
@@ -0,0 +1,67 @@
+///////////////////////////////////////////////////////////////////////////
+// C++ code generated with wxFormBuilder (version Nov 9 2017)
+// http://www.wxformbuilder.org/
+//
+// PLEASE DO *NOT* EDIT THIS FILE!
+///////////////////////////////////////////////////////////////////////////
+
+#ifndef __DIALOG_EDIT_LINE_STYLE_BASE_H__
+#define __DIALOG_EDIT_LINE_STYLE_BASE_H__
+
+#include <wx/artprov.h>
+#include <wx/xrc/xmlres.h>
+#include <wx/intl.h>
+#include "dialog_shim.h"
+#include <wx/string.h>
+#include <wx/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/clrpicker.h>
+#include <wx/statbox.h>
+#include <wx/radiobox.h>
+#include <wx/button.h>
+#include <wx/dialog.h>
+
+///////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////
+/// Class DIALOG_EDIT_LINE_STYLE_BASE
+///////////////////////////////////////////////////////////////////////////////
+class DIALOG_EDIT_LINE_STYLE_BASE : public DIALOG_SHIM
+{
+ DECLARE_EVENT_TABLE()
+ private:
+
+ // Private event handlers
+ void _wxFB_resetDefaults( wxCommandEvent& event ){ resetDefaults( event ); }
+
+
+ protected:
+ wxStaticText* m_staticWidth1;
+ wxTextCtrl* m_lineWidth;
+ wxStaticText* m_staticWidthUnits;
+ wxStaticText* m_staticText5;
+ wxColourPickerCtrl* m_colorPicker;
+ wxRadioBox* m_lineStyle;
+ wxStdDialogButtonSizer* m_sdbSizer1;
+ wxButton* m_sdbSizer1OK;
+ wxButton* m_sdbSizer1Apply;
+ wxButton* m_sdbSizer1Cancel;
+
+ // Virtual event handlers, overide them in your derived class
+ virtual void resetDefaults( wxCommandEvent& event ) { event.Skip(); }
+
+
+ public:
+ bool m_isValid;
+
+ DIALOG_EDIT_LINE_STYLE_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Line Style"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 399,230 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
+ ~DIALOG_EDIT_LINE_STYLE_BASE();
+
+};
+
+#endif //__DIALOG_EDIT_LINE_STYLE_BASE_H__
diff --git a/eeschema/sch_collectors.cpp b/eeschema/sch_collectors.cpp
index 671c611a2..915d9616e 100644
--- a/eeschema/sch_collectors.cpp
+++ b/eeschema/sch_collectors.cpp
@@ -87,6 +87,7 @@ const KICAD_T SCH_COLLECTOR::EditableItems[] = {
SCH_SHEET_PIN_T,
SCH_SHEET_T,
SCH_BITMAP_T,
+ SCH_LINE_T,
EOT
};
diff --git a/eeschema/sch_legacy_plugin.cpp b/eeschema/sch_legacy_plugin.cpp
index 968069576..4b0b86763 100644
--- a/eeschema/sch_legacy_plugin.cpp
+++ b/eeschema/sch_legacy_plugin.cpp
@@ -1147,6 +1147,27 @@ SCH_LINE* SCH_LEGACY_PLUGIN::loadWire( FILE_LINE_READER& aReader )
end.x = parseInt( aReader, line, &line );
end.y = parseInt( aReader, line, &line );
+ if( !is_eol( *line ) )
+ {
+ int size = parseInt( aReader, line, &line );
+ wire->SetLineWidth( size );
+ }
+
+ if( !is_eol( *line ) )
+ {
+ int style = parseInt( aReader, line, &line );
+ wire->SetLineStyle( style );
+ }
+
+ if( !is_eol( *line ) )
+ {
+ double color[ 4 ] = { 0. };
+ for( int i = 0; i < 4 && !is_eol( *line ); i++ )
+ color[i] = parseDouble( aReader, line, &line );
+
+ wire->SetLineColor( color[0], color[1], color[2], color[3] );
+ }
+
wire->SetStartPoint( begin );
wire->SetEndPoint( end );
@@ -1958,6 +1979,9 @@ void SCH_LEGACY_PLUGIN::saveLine( SCH_LINE* aLine )
const char* layer = "Notes";
const char* width = "Line";
+ bool styled = aLine->GetPenSize() != aLine->GetDefaultWidth()
+ || aLine->GetLineStyle() != aLine->GetDefaultStyle()
+ || aLine->GetLineColor() != aLine->GetDefaultColor();
if( aLine->GetLayer() == LAYER_WIRE )
layer = "Wire";
@@ -1965,8 +1989,15 @@ void SCH_LEGACY_PLUGIN::saveLine( SCH_LINE* aLine )
layer = "Bus";
m_out->Print( 0, "Wire %s %s\n", layer, width );
- m_out->Print( 0, "\t%-4d %-4d %-4d %-4d\n", aLine->GetStartPoint().x, aLine->GetStartPoint().y,
+ m_out->Print( 0, "\t%-4d %-4d %-4d %-4d", aLine->GetStartPoint().x, aLine->GetStartPoint().y,
aLine->GetEndPoint().x, aLine->GetEndPoint().y );
+ if( styled )
+ m_out->Print( 0, " %-4d %-4d %-.4f %-.4f %-.4f %-.4f",
+ aLine->GetLineSize(), aLine->GetLineStyle(),
+ aLine->GetLineColor().r, aLine->GetLineColor().g,
+ aLine->GetLineColor().b, aLine->GetLineColor().a );
+
+ m_out->Print( 0, "\n");
}
diff --git a/eeschema/sch_line.cpp b/eeschema/sch_line.cpp
index 21b6fe8fd..7a23f8bca 100644
--- a/eeschema/sch_line.cpp
+++ b/eeschema/sch_line.cpp
@@ -37,8 +37,10 @@
#include <general.h>
#include <protos.h>
#include <sch_line.h>
+#include <schframe.h>
#include <class_netlist_object.h>
+#include <dialogs/dialog_edit_line_style.h>
SCH_LINE::SCH_LINE( const wxPoint& pos, int layer ) :
SCH_ITEM( NULL, SCH_LINE_T )
@@ -46,6 +48,9 @@ SCH_LINE::SCH_LINE( const wxPoint& pos, int layer ) :
m_start = pos;
m_end = pos;
m_startIsDangling = m_endIsDangling = false;
+ m_size = 0;
+ m_style = 0;
+ m_color = COLOR4D::UNSPECIFIED;
switch( layer )
{
@@ -69,6 +74,9 @@ SCH_LINE::SCH_LINE( const SCH_LINE& aLine ) :
{
m_start = aLine.m_start;
m_end = aLine.m_end;
+ m_size = aLine.m_size;
+ m_style = aLine.m_style;
+ m_color = aLine.m_color;
m_startIsDangling = m_endIsDangling = false;
}
@@ -201,8 +209,93 @@ bool SCH_LINE::Load( LINE_READER& aLine, wxString& aErrorMsg )
}
+COLOR4D SCH_LINE::GetDefaultColor() const
+{
+ return GetLayerColor( m_Layer );
+}
+
+
+void SCH_LINE::SetLineColor( const COLOR4D aColor )
+{
+ if( aColor == GetDefaultColor() )
+ m_color = COLOR4D::UNSPECIFIED;
+ else
+ m_color = aColor;
+}
+
+
+void SCH_LINE::SetLineColor( const double r, const double g, const double b, const double a )
+{
+ COLOR4D newColor(r, g, b, a);
+
+ if( newColor == GetDefaultColor() )
+ m_color = COLOR4D::UNSPECIFIED;
+ else
+ m_color = newColor;
+}
+
+
+COLOR4D SCH_LINE::GetLineColor() const
+{
+ if( m_color == COLOR4D::UNSPECIFIED )
+ return GetLayerColor( m_Layer );
+
+ return m_color;
+}
+
+
+enum wxPenStyle SCH_LINE::GetDefaultStyle() const
+{
+ if( m_Layer == LAYER_NOTES )
+ return wxPENSTYLE_SHORT_DASH;
+
+ return wxPENSTYLE_SOLID;
+}
+
+
+void SCH_LINE::SetLineStyle( const int aStyle )
+{
+ if( aStyle == GetDefaultStyle() )
+ m_style = 0;
+ else
+ m_style = aStyle;
+}
+
+
+enum wxPenStyle SCH_LINE::GetLineStyle() const
+{
+ if( m_style > 0 )
+ return (enum wxPenStyle) m_style;
+
+ if( m_Layer == LAYER_NOTES )
+ return wxPENSTYLE_SHORT_DASH;
+
+ return wxPENSTYLE_SOLID;
+}
+
+
+int SCH_LINE::GetDefaultWidth() const
+{
+ if( m_Layer == LAYER_BUS )
+ return GetDefaultBusThickness();
+
+ return GetDefaultLineThickness();
+}
+
+
+void SCH_LINE::SetLineWidth( const int aSize )
+{
+ if( aSize == GetDefaultWidth() )
+ m_size = 0;
+ else
+ m_size = aSize;
+}
+
+
int SCH_LINE::GetPenSize() const
{
+ if( m_size > 0 )
+ return m_size;
if( m_Layer == LAYER_BUS )
return GetDefaultBusThickness();
@@ -219,6 +312,8 @@ void SCH_LINE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset,
if( Color != COLOR4D::UNSPECIFIED )
color = Color;
+ else if( m_color != COLOR4D::UNSPECIFIED )
+ color = m_color;
else
color = GetLayerColor( GetState( BRIGHTENED ) ? LAYER_BRIGHTENED : m_Layer );
@@ -233,10 +328,7 @@ void SCH_LINE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset,
if( ( m_Flags & ENDPOINT ) == 0 )
end += offset;
- if( m_Layer == LAYER_NOTES )
- GRDashedLine( panel->GetClipBox(), DC, start.x, start.y, end.x, end.y, width, color );
- else
- GRLine( panel->GetClipBox(), DC, start, end, width, color );
+ GRLine( panel->GetClipBox(), DC, start.x, start.y, end.x, end.y, width, color, GetLineStyle() );
if( m_startIsDangling )
DrawDanglingSymbol( panel, DC, start, color );
@@ -567,6 +659,20 @@ bool SCH_LINE::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy )
return rect.Intersects( m_start, m_end );
}
+void SCH_LINE::SwapData( SCH_ITEM* aItem )
+{
+ SCH_LINE* item = (SCH_LINE*) aItem;
+
+ std::swap( m_Layer, item->m_Layer );
+
+ std::swap( m_start, item->m_start );
+ std::swap( m_end, item->m_end );
+ std::swap( m_startIsDangling, item->m_startIsDangling );
+ std::swap( m_endIsDangling, item->m_endIsDangling );
+ std::swap( m_style, item->m_style );
+ std::swap( m_size, item->m_size );
+ std::swap( m_color, item->m_color );
+}
bool SCH_LINE::doIsConnected( const wxPoint& aPosition ) const
{
@@ -604,3 +710,53 @@ wxPoint SCH_LINE::MidPoint()
{
return wxPoint( ( m_start.x + m_end.x ) / 2, ( m_start.y + m_end.y ) / 2 );
}
+
+
+int SCH_EDIT_FRAME::EditLine( SCH_LINE* aLine, bool aRedraw )
+{
+ if( aLine == NULL )
+ return wxID_CANCEL;
+
+ // We purposely disallow editing everything except graphic lines
+ if( aLine->GetLayer() != LAYER_NOTES )
+ return wxID_CANCEL;
+
+ DIALOG_EDIT_LINE_STYLE dlg( this );
+ wxString units = GetUnitsLabel( g_UserUnit );
+ int old_style = aLine->GetLineStyle();
+ int old_width = aLine->GetPenSize();
+ COLOR4D old_color = aLine->GetLineColor();
+
+ dlg.SetDefaultStyle( aLine->GetDefaultStyle() );
+ dlg.SetDefaultWidth( StringFromValue( g_UserUnit, aLine->GetDefaultWidth(), false ) );
+ dlg.SetDefaultColor( aLine->GetDefaultColor() );
+
+ dlg.SetWidth( StringFromValue( g_UserUnit, old_width, false ) );
+ dlg.SetStyle( old_style );
+ dlg.SetLineWidthUnits( units );
+ dlg.SetColor( old_color );
+
+ dlg.Layout();
+ dlg.Fit();
+ dlg.SetMinSize( dlg.GetSize() );
+ if( dlg.ShowModal() == wxID_CANCEL )
+ return wxID_CANCEL;
+
+ int new_width = std::max( 1, ValueFromString( dlg.GetWidth() ) );
+ int new_style = dlg.GetStyle();
+ COLOR4D new_color = dlg.GetColor();
+
+ if( new_width != old_width || new_style != old_style || new_color != old_color )
+ {
+ SaveCopyInUndoList( (SCH_ITEM*) aLine, UR_CHANGED );
+ aLine->SetLineWidth( new_width );
+ aLine->SetLineStyle( new_style );
+ aLine->SetLineColor( new_color );
+
+ OnModify();
+ if( aRedraw )
+ m_canvas->Refresh();
+ }
+
+ return wxID_OK;
+}
diff --git a/eeschema/sch_line.h b/eeschema/sch_line.h
index 7b8cf5d1b..db5ab1873 100644
--- a/eeschema/sch_line.h
+++ b/eeschema/sch_line.h
@@ -45,6 +45,9 @@ class SCH_LINE : public SCH_ITEM
bool m_endIsDangling; ///< True if end point is not connected.
wxPoint m_start; ///< Line start point
wxPoint m_end; ///< Line end point
+ int m_size; ///< Line pensize
+ int m_style; ///< Line style
+ COLOR4D m_color; ///< Line color
public:
SCH_LINE( const wxPoint& pos = wxPoint( 0, 0 ), int layer = LAYER_NOTES );
@@ -76,6 +79,26 @@ public:
void SetEndPoint( const wxPoint& aPosition ) { m_end = aPosition; }
+ enum wxPenStyle GetDefaultStyle() const;
+
+ void SetLineStyle( const int aStyle );
+
+ enum wxPenStyle GetLineStyle() const;
+
+ void SetLineColor( const COLOR4D aColor );
+
+ void SetLineColor( const double r, const double g, const double b, const double a );
+
+ COLOR4D GetLineColor() const;
+
+ COLOR4D GetDefaultColor() const;
+
+ int GetDefaultWidth() const;
+
+ void SetLineWidth( const int aSize );
+
+ int GetLineSize() const { return m_size; }
+
const EDA_RECT GetBoundingBox() const override;
/**
@@ -147,6 +170,8 @@ public:
EDA_ITEM* Clone() const override;
+ void SwapData( SCH_ITEM* aItem ) override;
+
#if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const override;
#endif
diff --git a/eeschema/schedit.cpp b/eeschema/schedit.cpp
index b350c5634..e33743b32 100644
--- a/eeschema/schedit.cpp
+++ b/eeschema/schedit.cpp
@@ -1064,6 +1064,8 @@ void SCH_EDIT_FRAME::OnEditItem( wxCommandEvent& aEvent )
break;
case SCH_LINE_T: // These items have no param to edit
+ EditLine( (SCH_LINE*) item, true );
+ break;
case SCH_MARKER_T:
case SCH_JUNCTION_T:
case SCH_NO_CONNECT_T:
diff --git a/eeschema/schframe.h b/eeschema/schframe.h
index 2a8322bf0..d1f702cb0 100644
--- a/eeschema/schframe.h
+++ b/eeschema/schframe.h
@@ -1039,6 +1039,16 @@ private:
/// Loads the cache library associated to the aFileName
bool LoadCacheLibrary( const wxString& aFileName );
+private:
+ /**
+ * Function EditLine
+ * displays the dialog for editing the parameters of \a aLine.
+ * @param aLine The Line/Wire/Bus to edit.
+ * @param aRedraw = true to refresh the screen
+ * @return The user response from the edit dialog.
+ */
+ int EditLine( SCH_LINE* aLine, bool aRedraw );
+
public:
/**
* Function EditSheet
diff --git a/include/gr_basic.h b/include/gr_basic.h
index 1e4d513d6..008d1cf0c 100644
--- a/include/gr_basic.h
+++ b/include/gr_basic.h
@@ -112,13 +112,15 @@ void GRForceBlackPen( bool flagforce );
bool GetGRForceBlackPenState( void );
void GRLine( EDA_RECT* aClipBox, wxDC* aDC,
- wxPoint aStart, wxPoint aEnd, int aWidth, COLOR4D aColor );
+ wxPoint aStart, wxPoint aEnd, int aWidth, COLOR4D aColor, wxPenStyle aStyle = wxPENSTYLE_SOLID );
void GRLine( EDA_RECT* ClipBox, wxDC* DC,
- int x1, int y1, int x2, int y2, int width, COLOR4D Color );
+ int x1, int y1, int x2, int y2, int width, COLOR4D Color, wxPenStyle aStyle = wxPENSTYLE_SOLID );
void GRMixedLine( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
int width, COLOR4D Color );
void GRDashedLine( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
int width, COLOR4D Color );
+void GRDottedLine( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
+ int width, COLOR4D Color );
void GRMoveTo( int x, int y );
void GRLineTo( EDA_RECT* ClipBox, wxDC* DC,
int x, int y, int width, COLOR4D Color );
--
2.11.0
Follow ups
References
-
[FEATURE] Eeschema Line Styles
From: Seth Hillbrand, 2017-11-10
-
Re: [FEATURE] Eeschema Line Styles
From: Wayne Stambaugh, 2017-11-11
-
Re: [FEATURE] Eeschema Line Styles
From: Seth Hillbrand, 2017-11-11
-
Re: [FEATURE] Eeschema Line Styles
From: jp charras, 2017-11-11
-
Re: [FEATURE] Eeschema Line Styles
From: Wayne Stambaugh, 2017-11-11
-
Re: [FEATURE] Eeschema Line Styles
From: Seth Hillbrand, 2017-11-13
-
Re: [FEATURE] Eeschema Line Styles
From: Nick Østergaard, 2017-11-13
-
Re: [FEATURE] Eeschema Line Styles
From: Seth Hillbrand, 2017-11-13
-
Re: [FEATURE] Eeschema Line Styles
From: jp charras, 2017-11-14
-
Re: [FEATURE] Eeschema Line Styles
From: Nick Østergaard, 2017-11-14