[Kicad-developers] [PATCH 11/19] ElectricPinType: Rename PIN_NMAX to PINTYPE_COUNT

2016-02-17 Thread Simon Richter
---
 eeschema/dialogs/dialog_erc.cpp | 18 +-
 eeschema/dialogs/dialog_erc.h   |  4 ++--
 eeschema/erc.cpp|  6 +++---
 eeschema/lib_pin.cpp|  6 +++---
 eeschema/pin_type.h |  2 +-
 5 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/eeschema/dialogs/dialog_erc.cpp b/eeschema/dialogs/dialog_erc.cpp
index 87acb30..19f480e 100644
--- a/eeschema/dialogs/dialog_erc.cpp
+++ b/eeschema/dialogs/dialog_erc.cpp
@@ -49,8 +49,8 @@
 #include 
 #include 
 
-extern int   DiagErc[PIN_NMAX][PIN_NMAX];
-extern int   DefaultDiagErc[PIN_NMAX][PIN_NMAX];
+extern int   DiagErc[PINTYPE_COUNT][PINTYPE_COUNT];
+extern int   DefaultDiagErc[PINTYPE_COUNT][PINTYPE_COUNT];
 
 
 
@@ -63,7 +63,7 @@ bool DIALOG_ERC::m_tstUniqueGlobalLabels = true;// saved only for the curren
 #define ID_MATRIX_0 1800
 
 BEGIN_EVENT_TABLE( DIALOG_ERC, DIALOG_ERC_BASE )
-EVT_COMMAND_RANGE( ID_MATRIX_0, ID_MATRIX_0 + ( PIN_NMAX * PIN_NMAX ) - 1,
+EVT_COMMAND_RANGE( ID_MATRIX_0, ID_MATRIX_0 + ( PINTYPE_COUNT * PINTYPE_COUNT ) - 1,
wxEVT_COMMAND_BUTTON_CLICKED, DIALOG_ERC::ChangeErrorLevel )
 END_EVENT_TABLE()
 
@@ -91,9 +91,9 @@ void DIALOG_ERC::Init()
 {
 m_initialized = false;
 
-for( int ii = 0; ii < PIN_NMAX; ii++ )
+for( int ii = 0; ii < PINTYPE_COUNT; ii++ )
 {
-for( int jj = 0; jj < PIN_NMAX; jj++ )
+for( int jj = 0; jj < PINTYPE_COUNT; jj++ )
 m_buttonList[ii][jj] = NULL;
 }
 
@@ -290,7 +290,7 @@ void DIALOG_ERC::ReBuildMatrixPanel()
 if( m_initialized == false )
 {
 // Print row labels
-for( int ii = 0; ii < PIN_NMAX; ii++ )
+for( int ii = 0; ii < PINTYPE_COUNT; ii++ )
 {
 int y = pos.y + (ii * bitmap_size.y);
 text = new wxStaticText( m_matrixPanel, -1, CommentERC_H[ii],
@@ -305,7 +305,7 @@ void DIALOG_ERC::ReBuildMatrixPanel()
 else
 pos = m_buttonList[0][0]->GetPosition();
 
-for( int ii = 0; ii < PIN_NMAX; ii++ )
+for( int ii = 0; ii < PINTYPE_COUNT; ii++ )
 {
 int y = pos.y + (ii * bitmap_size.y);
 
@@ -323,7 +323,7 @@ void DIALOG_ERC::ReBuildMatrixPanel()
 text = new wxStaticText( m_matrixPanel, -1, CommentERC_V[ii], txtpos );
 }
 
-int event_id = ID_MATRIX_0 + ii + ( jj * PIN_NMAX );
+int event_id = ID_MATRIX_0 + ii + ( jj * PINTYPE_COUNT );
 BITMAP_DEF bitmap_butt = erc_green_xpm;
 
 delete m_buttonList[ii][jj];
@@ -420,7 +420,7 @@ void DIALOG_ERC::ChangeErrorLevel( wxCommandEvent& event )
 wxBitmapButton* butt = (wxBitmapButton*) event.GetEventObject();
 pos  = butt->GetPosition();
 
-x = ii / PIN_NMAX; y = ii % PIN_NMAX;
+x = ii / PINTYPE_COUNT; y = ii % PINTYPE_COUNT;
 
 level = DiagErc[y][x];
 
diff --git a/eeschema/dialogs/dialog_erc.h b/eeschema/dialogs/dialog_erc.h
index d7d9ff8..9cce8b1 100644
--- a/eeschema/dialogs/dialog_erc.h
+++ b/eeschema/dialogs/dialog_erc.h
@@ -27,7 +27,7 @@
 
 #include 
 #include 
-#include // For PIN_NMAX definition
+#include // For PINTYPE_COUNT definition
 
 #include 
 #include "dialog_erc_listbox.h"
@@ -40,7 +40,7 @@ class DIALOG_ERC : public DIALOG_ERC_BASE
 
 private:
 SCH_EDIT_FRAME* m_parent;
-wxBitmapButton* m_buttonList[PIN_NMAX][PIN_NMAX];
+wxBitmapButton* m_buttonList[PINTYPE_COUNT][PINTYPE_COUNT];
 boolm_initialized;
 const SCH_MARKER* m_lastMarkerFound;
 static bool m_writeErcFile;
diff --git a/eeschema/erc.cpp b/eeschema/erc.cpp
index a7f1b58..2e531b1 100644
--- a/eeschema/erc.cpp
+++ b/eeschema/erc.cpp
@@ -121,7 +121,7 @@ const wxString CommentERC_V[] =
  *  at start up: must be loaded by DefaultDiagErc
  *  Can be modified in dialog ERC
  */
-int  DiagErc[PIN_NMAX][PIN_NMAX];
+int  DiagErc[PINTYPE_COUNT][PINTYPE_COUNT];
 
 /**
  * Default Look up table which gives the ERC error level for a pair of connected pins
@@ -130,7 +130,7 @@ int  DiagErc[PIN_NMAX][PIN_NMAX];
  *  note also, to avoid inconsistancy:
  *DefaultDiagErc[i][j] = DefaultDiagErc[j][i]
  */
-int DefaultDiagErc[PIN_NMAX][PIN_NMAX] =
+int DefaultDiagErc[PINTYPE_COUNT][PINTYPE_COUNT] =
 {
 /* I,   O,Bi,   3S,   Pas,  UnS,  PwrI, PwrO, OC,   OE,   NC */
 /* I */  { OK,  OK,   OK,   OK,   OK,   WAR,  OK,   OK,   OK,   OK,   ERR },
@@ -157,7 +157,7 @@ int DefaultDiagErc[PIN_NMAX][PIN_NMAX] =
  * in net.  Nets are OK when their final state is NET_NC or DRV.   Nets with the state
  * NOD have no valid source signal.
  */
-static int MinimalReq[PIN_NMAX][PIN_NMAX] =
+static int MinimalReq[PINTYPE_COUNT][PINTYPE_COUNT] =
 {
 /* In   Out, Bi,  3S,  Pas, UnS, PwrI,PwrO,OC,  OE,  NC */
 /* In*/  { NOD, DRV, DRV, DRV, DRV, DRV, NOD, DRV, DRV, DRV, NPI },
diff --git a/eeschema/lib_pin.cpp b/eeschema/lib_pin.cpp
index ed6d4e4..e210d11 100644
--- a/eeschema/lib_pin.cpp
+++ 

[Kicad-developers] [PATCH 05/19] PinShape: move enum to own header

2016-02-17 Thread Simon Richter
---
 eeschema/lib_pin.h| 21 +--
 eeschema/pin_shape.h  | 50 +++
 eeschema/widgets/pin_shape_combobox.h |  2 +-
 3 files changed, 52 insertions(+), 21 deletions(-)
 create mode 100644 eeschema/pin_shape.h

diff --git a/eeschema/lib_pin.h b/eeschema/lib_pin.h
index 1f6fce0..0cb5fa3 100644
--- a/eeschema/lib_pin.h
+++ b/eeschema/lib_pin.h
@@ -32,6 +32,7 @@
 
 #include 
 
+#include "pin_shape.h"
 
 #define TARGET_PIN_RADIUS   12  // Circle diameter drawn at the active end of pins
 
@@ -58,26 +59,6 @@ enum ElectricPinType {
 #define PIN_INVISIBLE 1/* Set makes pin invisible */
 
 
-enum PinShape
-{
-PINSHAPE_LINE,
-PINSHAPE_INVERTED,
-PINSHAPE_CLOCK,
-PINSHAPE_INVERTED_CLOCK,
-PINSHAPE_INPUT_LOW,
-PINSHAPE_CLOCK_LOW,
-PINSHAPE_OUTPUT_LOW,
-PINSHAPE_FALLING_EDGE_CLOCK,
-PINSHAPE_NONLOGIC
-};
-
-
-enum
-{
-PINSHAPE_COUNT = PINSHAPE_NONLOGIC + 1
-};
-
-
 /**
  *  The component library pin object orientations.
  */
diff --git a/eeschema/pin_shape.h b/eeschema/pin_shape.h
new file mode 100644
index 000..1d96435
--- /dev/null
+++ b/eeschema/pin_shape.h
@@ -0,0 +1,50 @@
+/*
+ * This program source code file is part of KiCad, a free EDA CAD application.
+ *
+ * Copyright (C) 2004-2015 KiCad Developers, see change_log.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
+ */
+
+/**
+ * @file pin_shape.h
+ * @brief Pin shape handling
+ */
+
+#ifndef _PIN_SHAPE_H_
+#define _PIN_SHAPE_H_
+
+enum PinShape
+{
+PINSHAPE_LINE,
+PINSHAPE_INVERTED,
+PINSHAPE_CLOCK,
+PINSHAPE_INVERTED_CLOCK,
+PINSHAPE_INPUT_LOW,
+PINSHAPE_CLOCK_LOW,
+PINSHAPE_OUTPUT_LOW,
+PINSHAPE_FALLING_EDGE_CLOCK,
+PINSHAPE_NONLOGIC
+};
+
+enum
+{
+PINSHAPE_COUNT = PINSHAPE_NONLOGIC + 1
+};
+
+#endif
diff --git a/eeschema/widgets/pin_shape_combobox.h b/eeschema/widgets/pin_shape_combobox.h
index 19c9714..b9ef4e0 100644
--- a/eeschema/widgets/pin_shape_combobox.h
+++ b/eeschema/widgets/pin_shape_combobox.h
@@ -28,7 +28,7 @@
 
 #include 
 
-#include 
+#include 
 
 class PinShapeComboBox : public wxBitmapComboBox
 {
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] [PATCH 12/19] ElectricPinType: Separate PINTYPE_COUNT from enum

2016-02-17 Thread Simon Richter

This allows us to use compiler warnings for enum coverage in switch
statements.
---
 eeschema/lib_pin.cpp | 6 +++---
 eeschema/pin_type.h  | 7 +--
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/eeschema/lib_pin.cpp b/eeschema/lib_pin.cpp
index e210d11..99be160 100644
--- a/eeschema/lib_pin.cpp
+++ b/eeschema/lib_pin.cpp
@@ -92,7 +92,7 @@ static const BITMAP_DEF iconsPinsElectricalType[] =
 
 const wxString LIB_PIN::GetCanonicalElectricalTypeName( ElectricPinType aType )
 {
-assert( aType >= 0 && aType < PINTYPE_COUNT );
+assert( aType >= 0 && aType < (int) PINTYPE_COUNT );
 
 // These strings are the canonical name of the electrictal type
 // Not translated, no space in name, only ASCII chars.
@@ -113,7 +113,7 @@ const wxString LIB_PIN::GetCanonicalElectricalTypeName( ElectricPinType aType )
 wxT( "NotConnected" )
 };
 
-if( aType > PINTYPE_COUNT )
+if( aType > (int) PINTYPE_COUNT )
 return wxT( "???" );
 
 return msgPinElectricType[ aType ];
@@ -354,7 +354,7 @@ void LIB_PIN::SetShape( PinShape aShape )
 
 void LIB_PIN::SetType( ElectricPinType aType )
 {
-assert( aType >= 0 && aType < PINTYPE_COUNT );
+assert( aType >= 0 && aType < (int) PINTYPE_COUNT );
 
 if( m_type != aType )
 {
diff --git a/eeschema/pin_type.h b/eeschema/pin_type.h
index f525347..d1bfbcc 100644
--- a/eeschema/pin_type.h
+++ b/eeschema/pin_type.h
@@ -42,8 +42,11 @@ enum ElectricPinType {
 PIN_POWER_OUT,
 PIN_OPENCOLLECTOR,
 PIN_OPENEMITTER,
-PIN_NC, /* No connect */
-PINTYPE_COUNT   /* End of List (no used as pin type) */
+PIN_NC  /* No connect */
+};
+
+enum {
+PINTYPE_COUNT = PIN_NC + 1
 };
 
 #endif
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] [PATCH 14/19] PinTypeComboBox: fully initialize in c'tor

2016-02-17 Thread Simon Richter
---
 eeschema/dialogs/dialog_lib_edit_pin.cpp | 13 -
 eeschema/dialogs/dialog_lib_edit_pin.h   |  1 -
 eeschema/pinedit.cpp |  2 --
 eeschema/widgets/pin_type_combobox.cpp   | 15 +++
 4 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/eeschema/dialogs/dialog_lib_edit_pin.cpp b/eeschema/dialogs/dialog_lib_edit_pin.cpp
index ae12e34..ce78fda 100644
--- a/eeschema/dialogs/dialog_lib_edit_pin.cpp
+++ b/eeschema/dialogs/dialog_lib_edit_pin.cpp
@@ -161,16 +161,3 @@ void DIALOG_LIB_EDIT_PIN::SetOrientationList( const wxArrayString& list,
 m_choiceOrientation->Insert( list[ii], KiBitmap( aBitmaps[ii] ), ii );
 }
 }
-
-
-void DIALOG_LIB_EDIT_PIN::SetElectricalTypeList( const wxArrayString& list,
- const BITMAP_DEF* aBitmaps )
-{
-for ( unsigned ii = 0; ii < list.GetCount(); ii++ )
-{
-if( aBitmaps == NULL )
-m_choiceElectricalType->Append( list[ii] );
-else
-m_choiceElectricalType->Insert( list[ii], KiBitmap( aBitmaps[ii] ), ii );
-}
-}
diff --git a/eeschema/dialogs/dialog_lib_edit_pin.h b/eeschema/dialogs/dialog_lib_edit_pin.h
index ab23264..ebbcb4e 100644
--- a/eeschema/dialogs/dialog_lib_edit_pin.h
+++ b/eeschema/dialogs/dialog_lib_edit_pin.h
@@ -61,7 +61,6 @@ public:
 }
 int GetOrientation( void ) { return m_choiceOrientation->GetSelection(); }
 
-void SetElectricalTypeList( const wxArrayString& list, const BITMAP_DEF* aBitmaps );
 void SetElectricalType( ElectricPinType type )
 {
 m_choiceElectricalType->SetSelection( type );
diff --git a/eeschema/pinedit.cpp b/eeschema/pinedit.cpp
index dd31c93..86432fc 100644
--- a/eeschema/pinedit.cpp
+++ b/eeschema/pinedit.cpp
@@ -105,8 +105,6 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event )
 dlg.SetOrientationList( LIB_PIN::GetOrientationNames(), LIB_PIN::GetOrientationSymbols() );
 dlg.SetOrientation( LIB_PIN::GetOrientationCodeIndex( pin->GetOrientation() ) );
 dlg.SetStyle( pin->GetShape() );
-dlg.SetElectricalTypeList( LIB_PIN::GetElectricalTypeNames(),
-   LIB_PIN::GetElectricalTypeSymbols() );
 dlg.SetElectricalType( pin->GetType() );
 dlg.SetPinName( pin->GetName() );
 dlg.SetPinNameTextSize( StringFromValue( g_UserUnit, pin->GetNameTextSize() ) );
diff --git a/eeschema/widgets/pin_type_combobox.cpp b/eeschema/widgets/pin_type_combobox.cpp
index 3c2ac7e..c83d14f 100644
--- a/eeschema/widgets/pin_type_combobox.cpp
+++ b/eeschema/widgets/pin_type_combobox.cpp
@@ -28,6 +28,8 @@
 
 #include "pin_type_combobox.h"
 
+#include 
+
 PinTypeComboBox::PinTypeComboBox( wxWindow* parent,
 wxWindowID id,
 const wxString& value,
@@ -40,4 +42,17 @@ PinTypeComboBox::PinTypeComboBox( wxWindow* parent,
 const wxString& name ) :
 wxBitmapComboBox( parent, id, value, pos, size, n, choices, style, validator, name )
 {
+wxArrayString texts = LIB_PIN::GetElectricalTypeNames();
+const BITMAP_DEF* bitmaps = LIB_PIN::GetElectricalTypeSymbols();
+
+for( unsigned ii = 0; ii < PINTYPE_COUNT; ++ii )
+{
+wxString text = texts[ ii ];
+BITMAP_DEF bitmap = bitmaps[ ii ];
+
+if( bitmap == NULL )
+Append( text );
+else
+Insert( text, KiBitmap( bitmap ), ii );
+}
 }
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] [PATCH 19/19] TypeSheetLabel: use enum

2016-02-17 Thread Simon Richter
---
 eeschema/class_netlist_object.h  | 2 +-
 eeschema/dialogs/dialog_edit_label.cpp   | 3 ++-
 eeschema/dialogs/dialog_sch_edit_sheet_pin.h | 8 ++--
 eeschema/edit_label.cpp  | 8 
 eeschema/sch_sheet_pin.cpp   | 2 +-
 eeschema/sch_text.cpp| 4 ++--
 eeschema/sch_text.h  | 6 +++---
 eeschema/schframe.h  | 4 +++-
 eeschema/sheetlab.cpp| 2 +-
 9 files changed, 23 insertions(+), 16 deletions(-)

diff --git a/eeschema/class_netlist_object.h b/eeschema/class_netlist_object.h
index 573..8536064 100644
--- a/eeschema/class_netlist_object.h
+++ b/eeschema/class_netlist_object.h
@@ -107,7 +107,7 @@ public:
 union
 {
 ElectricPinType pin;
-int label;
+TypeSheetLabel label;
 } m_ElectricalType; /* Has meaning only for Pins and
  * hierarchical pins: electrical type */
 int m_BusNetCode;   /* Used for BUS connections */
diff --git a/eeschema/dialogs/dialog_edit_label.cpp b/eeschema/dialogs/dialog_edit_label.cpp
index e861a39..2bdb167 100644
--- a/eeschema/dialogs/dialog_edit_label.cpp
+++ b/eeschema/dialogs/dialog_edit_label.cpp
@@ -301,7 +301,8 @@ void DIALOG_LABEL_EDITOR::TextPropertiesAccept( wxCommandEvent& aEvent )
 m_CurrentText->SetSize( wxSize( value, value ) );
 
 if( m_TextShape )
-m_CurrentText->SetShape( m_TextShape->GetSelection() );
+/// @todo move cast to widget
+m_CurrentText->SetShape( static_cast( m_TextShape->GetSelection() ) );
 
 int style = m_TextStyle->GetSelection();
 
diff --git a/eeschema/dialogs/dialog_sch_edit_sheet_pin.h b/eeschema/dialogs/dialog_sch_edit_sheet_pin.h
index fc35864..4d02b01 100644
--- a/eeschema/dialogs/dialog_sch_edit_sheet_pin.h
+++ b/eeschema/dialogs/dialog_sch_edit_sheet_pin.h
@@ -34,6 +34,9 @@
 
 #include 
 
+// enum TypeSheetLabel
+#include 
+
 
 class DIALOG_SCH_EDIT_SHEET_PIN : public DIALOG_SCH_EDIT_SHEET_PIN_BASE
 {
@@ -49,8 +52,9 @@ public:
 void SetTextWidth( const wxString& aWidth ) { m_textWidth->SetValue( aWidth ); }
 wxString GetTextWidth() const { return m_textWidth->GetValue(); }
 
-void SetConnectionType( int aType ) { m_choiceConnectionType->SetSelection( aType ); }
-int GetConnectionType() const { return m_choiceConnectionType->GetCurrentSelection(); }
+void SetConnectionType( TypeSheetLabel aType ) { m_choiceConnectionType->SetSelection( aType ); }
+/// @todo move cast to widget
+TypeSheetLabel GetConnectionType() const { return static_cast( m_choiceConnectionType->GetCurrentSelection() ); }
 
 void SetTextHeightUnits( const wxString& aUnit ) { m_staticHeightUnits->SetLabel( aUnit ); }
 void SetTextWidthUnits( const wxString& aUnit ) { m_staticWidthUnits->SetLabel( aUnit ); }
diff --git a/eeschema/edit_label.cpp b/eeschema/edit_label.cpp
index 2be1d87..2d8b243 100644
--- a/eeschema/edit_label.cpp
+++ b/eeschema/edit_label.cpp
@@ -41,10 +41,10 @@
 #include 
 
 
-static int   lastGlobalLabelShape = (int) NET_INPUT;
-static int   lastTextOrientation = 0;
-static bool  lastTextBold = false;
-static bool  lastTextItalic = false;
+static TypeSheetLabel   lastGlobalLabelShape = NET_INPUT;
+static int  lastTextOrientation = 0;
+static bool lastTextBold = false;
+static bool lastTextItalic = false;
 
 
 void SCH_EDIT_FRAME::ChangeTextOrient( SCH_TEXT* aTextItem, wxDC* aDC )
diff --git a/eeschema/sch_sheet_pin.cpp b/eeschema/sch_sheet_pin.cpp
index 048ffb1..52cdd5d 100644
--- a/eeschema/sch_sheet_pin.cpp
+++ b/eeschema/sch_sheet_pin.cpp
@@ -466,7 +466,7 @@ void SCH_SHEET_PIN::CreateGraphicShape( std::vector & aPoints, const wx
  * for INPUT type the icon is the OUTPUT shape of SCH_HIERLABEL
  * for OUTPUT type the icon is the INPUT shape of SCH_HIERLABEL
  */
-int tmp = m_shape;
+TypeSheetLabel tmp = m_shape;
 
 switch( m_shape )
 {
diff --git a/eeschema/sch_text.cpp b/eeschema/sch_text.cpp
index c84852c..964409a 100644
--- a/eeschema/sch_text.cpp
+++ b/eeschema/sch_text.cpp
@@ -102,11 +102,11 @@ static int* TemplateShape[5][4] =
 
 SCH_TEXT::SCH_TEXT( const wxPoint& pos, const wxString& text, KICAD_T aType ) :
 SCH_ITEM( NULL, aType ),
-EDA_TEXT( text )
+EDA_TEXT( text ),
+m_shape( NET_INPUT )
 {
 m_Layer = LAYER_NOTES;
 m_Pos = pos;
-m_shape = 0;
 m_isDangling = false;
 m_MultilineAllowed = true;
 m_schematicOrientation = 0;
diff --git a/eeschema/sch_text.h b/eeschema/sch_text.h
index a570bfc..e80448d 100644
--- a/eeschema/sch_text.h
+++ b/eeschema/sch_text.h
@@ -58,7 +58,7 @@ extern const char* SheetLabelType[];/* names of types of labels */
 class SCH_TEXT : public SCH_ITEM, public EDA_TEXT
 {
 protected:
-int m_shape;
+TypeSheetLabel m_shape;
 
 /// True if not connected to another 

[Kicad-developers] [PATCH 18/19] ElectricPinType: move bitmap lookup

2016-02-17 Thread Simon Richter
---
 eeschema/lib_pin.cpp   | 28 +-
 eeschema/lib_pin.h |  8 ---
 eeschema/pin_type.cpp  | 43 ++
 eeschema/pin_type.h|  2 ++
 eeschema/widgets/pin_type_combobox.cpp |  4 +---
 5 files changed, 47 insertions(+), 38 deletions(-)

diff --git a/eeschema/lib_pin.cpp b/eeschema/lib_pin.cpp
index d7a83f7..357b322 100644
--- a/eeschema/lib_pin.cpp
+++ b/eeschema/lib_pin.cpp
@@ -70,26 +70,6 @@ static const BITMAP_DEF iconsPinsOrientations[] =
 };
 
 
-// bitmaps to show pins electrical type in dialog editor
-// must have same order than enum ElectricPinType (see lib_pin.h)
-static const BITMAP_DEF iconsPinsElectricalType[] =
-{
-pintype_input_xpm,
-pintype_output_xpm,
-pintype_bidi_xpm,
-pintype_3states_xpm,
-pintype_passive_xpm,
-pintype_notspecif_xpm,
-pintype_powerinput_xpm,
-pintype_poweroutput_xpm,
-pintype_opencoll_xpm,
-pintype_openemit_xpm,
-pintype_noconnect_xpm
-};
-
-#define PIN_ELECTRICAL_TYPE_CNT DIM( iconsPinsElectricalType )
-
-
 const wxString LIB_PIN::GetCanonicalElectricalTypeName( ElectricPinType aType )
 {
 assert( aType >= 0 && aType < (int) PINTYPE_COUNT );
@@ -2190,12 +2170,6 @@ void LIB_PIN::Rotate()
 }
 
 
-const BITMAP_DEF* LIB_PIN::GetElectricalTypeSymbols()
-{
-return iconsPinsElectricalType;
-}
-
-
 const BITMAP_DEF* LIB_PIN::GetOrientationSymbols()
 {
 return iconsPinsOrientations;
@@ -2204,7 +2178,7 @@ const BITMAP_DEF* LIB_PIN::GetOrientationSymbols()
 
 BITMAP_DEF LIB_PIN::GetMenuImage() const
 {
-return iconsPinsElectricalType[m_type];
+return GetBitmap( m_type );
 }
 
 
diff --git a/eeschema/lib_pin.h b/eeschema/lib_pin.h
index 95e241d..94390d8 100644
--- a/eeschema/lib_pin.h
+++ b/eeschema/lib_pin.h
@@ -440,14 +440,6 @@ public:
  */
 static int GetOrientationCodeIndex( int aCode );
 
-
-/**
- * Get a list of pin electrical bitmaps for menus and dialogs.
- *
- * @return  List of valid pin electrical type bitmaps symbols in .xpm format
- */
-static const BITMAP_DEF* GetElectricalTypeSymbols();
-
 void SetOffset( const wxPoint& aOffset );
 
 bool Inside( EDA_RECT& aRect ) const;
diff --git a/eeschema/pin_type.cpp b/eeschema/pin_type.cpp
index b80e257..42e4e55 100644
--- a/eeschema/pin_type.cpp
+++ b/eeschema/pin_type.cpp
@@ -71,3 +71,46 @@ wxString GetText( ElectricPinType aType )
 assert( !"invalid pin type" );
 return wxT( "???" );
 }
+
+
+BITMAP_DEF GetBitmap( ElectricPinType aType )
+{
+switch( aType )
+{
+case PIN_INPUT:
+return pintype_input_xpm;
+
+case PIN_OUTPUT:
+return pintype_output_xpm;
+
+case PIN_BIDI:
+return pintype_bidi_xpm;
+
+case PIN_TRISTATE:
+return pintype_3states_xpm;
+
+case PIN_PASSIVE:
+return pintype_passive_xpm;
+
+case PIN_UNSPECIFIED:
+return pintype_notspecif_xpm;
+
+case PIN_POWER_IN:
+return pintype_powerinput_xpm;
+
+case PIN_POWER_OUT:
+return pintype_poweroutput_xpm;
+
+case PIN_OPENCOLLECTOR:
+return pintype_opencoll_xpm;
+
+case PIN_OPENEMITTER:
+return pintype_openemit_xpm;
+
+case PIN_NC:
+return pintype_noconnect_xpm;
+};
+
+assert( !"invalid pin type" );
+return NULL;
+}
diff --git a/eeschema/pin_type.h b/eeschema/pin_type.h
index 3910cb2..5c276fb 100644
--- a/eeschema/pin_type.h
+++ b/eeschema/pin_type.h
@@ -29,6 +29,7 @@
 #define PIN_TYPE_H_
 
 #include 
+#include 
 
 /**
  * The component library pin object electrical types used in ERC tests.
@@ -53,5 +54,6 @@ enum {
 
 // UI
 wxString GetText( ElectricPinType );
+BITMAP_DEF GetBitmap( ElectricPinType );
 
 #endif
diff --git a/eeschema/widgets/pin_type_combobox.cpp b/eeschema/widgets/pin_type_combobox.cpp
index 52dc5fb..2b64bbc 100644
--- a/eeschema/widgets/pin_type_combobox.cpp
+++ b/eeschema/widgets/pin_type_combobox.cpp
@@ -42,14 +42,12 @@ PinTypeComboBox::PinTypeComboBox( wxWindow* parent,
 const wxString& name ) :
 wxBitmapComboBox( parent, id, value, pos, size, n, choices, style, validator, name )
 {
-const BITMAP_DEF* bitmaps = LIB_PIN::GetElectricalTypeSymbols();
-
 for( unsigned ii = 0; ii < PINTYPE_COUNT; ++ii )
 {
 ElectricPinType type = static_cast( ii );
 
 wxString text = GetText( type );
-BITMAP_DEF bitmap = bitmaps[ ii ];
+BITMAP_DEF bitmap = GetBitmap( type );
 
 if( bitmap == NULL )
 Append( text );
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] [PATCH 17/19] ElectricPinType: remove list interfaces

2016-02-17 Thread Simon Richter
---
 eeschema/lib_pin.cpp   | 11 ---
 eeschema/lib_pin.h |  6 --
 eeschema/widgets/pin_type_combobox.cpp |  5 +++--
 3 files changed, 3 insertions(+), 19 deletions(-)

diff --git a/eeschema/lib_pin.cpp b/eeschema/lib_pin.cpp
index cbea37c..d7a83f7 100644
--- a/eeschema/lib_pin.cpp
+++ b/eeschema/lib_pin.cpp
@@ -2190,17 +2190,6 @@ void LIB_PIN::Rotate()
 }
 
 
-wxArrayString LIB_PIN::GetElectricalTypeNames( void )
-{
-wxArrayString tmp;
-
-for( unsigned ii = 0; ii < PIN_ELECTRICAL_TYPE_CNT; ii++ )
-tmp.Add( GetText( static_cast( ii ) ) );
-
-return tmp;
-}
-
-
 const BITMAP_DEF* LIB_PIN::GetElectricalTypeSymbols()
 {
 return iconsPinsElectricalType;
diff --git a/eeschema/lib_pin.h b/eeschema/lib_pin.h
index 6cb03d9..95e241d 100644
--- a/eeschema/lib_pin.h
+++ b/eeschema/lib_pin.h
@@ -440,12 +440,6 @@ public:
  */
 static int GetOrientationCodeIndex( int aCode );
 
-/**
- * Get a list of pin electrical type names.
- *
- * @return  List of valid pin electrical type names.
- */
-static wxArrayString GetElectricalTypeNames();
 
 /**
  * Get a list of pin electrical bitmaps for menus and dialogs.
diff --git a/eeschema/widgets/pin_type_combobox.cpp b/eeschema/widgets/pin_type_combobox.cpp
index ae9676d..52dc5fb 100644
--- a/eeschema/widgets/pin_type_combobox.cpp
+++ b/eeschema/widgets/pin_type_combobox.cpp
@@ -42,12 +42,13 @@ PinTypeComboBox::PinTypeComboBox( wxWindow* parent,
 const wxString& name ) :
 wxBitmapComboBox( parent, id, value, pos, size, n, choices, style, validator, name )
 {
-wxArrayString texts = LIB_PIN::GetElectricalTypeNames();
 const BITMAP_DEF* bitmaps = LIB_PIN::GetElectricalTypeSymbols();
 
 for( unsigned ii = 0; ii < PINTYPE_COUNT; ++ii )
 {
-wxString text = texts[ ii ];
+ElectricPinType type = static_cast( ii );
+
+wxString text = GetText( type );
 BITMAP_DEF bitmap = bitmaps[ ii ];
 
 if( bitmap == NULL )
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] [PATCH 16/19] ElectricPinType: move text lookup

2016-02-17 Thread Simon Richter
---
 eeschema/CMakeLists.txt |  1 +
 eeschema/erc.cpp|  8 +++---
 eeschema/lib_pin.cpp| 27 ++
 eeschema/lib_pin.h  |  9 +-
 eeschema/pin_type.cpp   | 73 +
 eeschema/pin_type.h |  5 
 6 files changed, 86 insertions(+), 37 deletions(-)
 create mode 100644 eeschema/pin_type.cpp

diff --git a/eeschema/CMakeLists.txt b/eeschema/CMakeLists.txt
index e9ae4bb..32558a2 100644
--- a/eeschema/CMakeLists.txt
+++ b/eeschema/CMakeLists.txt
@@ -139,6 +139,7 @@ set( EESCHEMA_SRCS
 pinedit.cpp
 pin_number.cpp
 pin_shape.cpp
+pin_type.cpp
 plot_schematic_DXF.cpp
 plot_schematic_HPGL.cpp
 plot_schematic_PS.cpp
diff --git a/eeschema/erc.cpp b/eeschema/erc.cpp
index 2e531b1..eccbeae 100644
--- a/eeschema/erc.cpp
+++ b/eeschema/erc.cpp
@@ -297,7 +297,7 @@ void Diagnose( NETLIST_OBJECT* aNetItemRef, NETLIST_OBJECT* aNetItemTst,
 {
 msg.Printf( _( "Pin %s (%s) of component %s is unconnected." ),
 GetChars( string_pinnum ),
-GetChars( LIB_PIN::GetElectricalTypeName( ii ) ),
+GetChars( GetText( ii ) ),
 GetChars( cmp_ref ) );
 marker->SetData( ERCE_PIN_NOT_CONNECTED,
  aNetItemRef->m_Start,
@@ -314,7 +314,7 @@ void Diagnose( NETLIST_OBJECT* aNetItemRef, NETLIST_OBJECT* aNetItemTst,
 
 msg.Printf( _( "Pin %s (%s) of component %s is not driven (Net %d)." ),
 GetChars( string_pinnum ),
-GetChars( LIB_PIN::GetElectricalTypeName( ii ) ),
+GetChars( GetText( ii ) ),
 GetChars( cmp_ref ),
 aNetItemRef->GetNet() );
 marker->SetData( ERCE_PIN_NOT_DRIVEN,
@@ -356,12 +356,12 @@ void Diagnose( NETLIST_OBJECT* aNetItemRef, NETLIST_OBJECT* aNetItemTst,
 
 msg.Printf( _( "Pin %s (%s) of component %s is connected to " ),
 GetChars( string_pinnum ),
-GetChars( LIB_PIN::GetElectricalTypeName( ii ) ),
+GetChars( GetText( ii ) ),
 GetChars( cmp_ref ) );
 marker->SetData( errortype, aNetItemRef->m_Start, msg, aNetItemRef->m_Start );
 msg.Printf( _( "pin %s (%s) of component %s (net %d)." ),
 GetChars( alt_string_pinnum ),
-GetChars( LIB_PIN::GetElectricalTypeName( jj ) ),
+GetChars( GetText( jj ) ),
 GetChars( alt_cmp ),
 aNetItemRef->GetNet() );
 marker->SetAuxiliaryData( msg, aNetItemTst->m_Start );
diff --git a/eeschema/lib_pin.cpp b/eeschema/lib_pin.cpp
index 99be160..cbea37c 100644
--- a/eeschema/lib_pin.cpp
+++ b/eeschema/lib_pin.cpp
@@ -145,29 +145,6 @@ static const wxString getPinOrientationName( unsigned aPinOrientationCode )
 return pin_orientation_names[ aPinOrientationCode ];
 }
 
-const wxString LIB_PIN::GetElectricalTypeName( ElectricPinType aPinsElectricalType )
-{
-const wxString pin_electrical_type_names[] =
-{   // Keep these translated strings not static
-_( "Input" ),
-_( "Output" ),
-_( "Bidirectional" ),
-_( "Tri-state" ),
-_( "Passive" ),
-_( "Unspecified" ),
-_( "Power input" ),
-_( "Power output" ),
-_( "Open collector" ),
-_( "Open emitter" ),
-_( "Not connected" )
-};
-
-if( aPinsElectricalType > PIN_ELECTRICAL_TYPE_CNT )
-return wxT( "???" );
-
-return pin_electrical_type_names[ aPinsElectricalType ];
-}
-
 /// Utility for getting the size of the 'internal' pin decorators (as a radius)
 // i.e. the clock symbols (falling clock is actually external but is of
 // the same kind)
@@ -2015,7 +1992,7 @@ void LIB_PIN::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
 aList.push_back( MSG_PANEL_ITEM( _( "Number" ), text, DARKCYAN ) );
 
 aList.push_back( MSG_PANEL_ITEM( _( "Type" ),
- LIB_PIN::GetElectricalTypeName( m_type ),
+ GetText( m_type ),
  RED ) );
 
 text = GetText( m_shape );
@@ -2218,7 +2195,7 @@ wxArrayString LIB_PIN::GetElectricalTypeNames( void )
 wxArrayString tmp;
 
 for( unsigned ii = 0; ii < PIN_ELECTRICAL_TYPE_CNT; ii++ )
-tmp.Add( LIB_PIN::GetElectricalTypeName( static_cast( ii ) ) );
+tmp.Add( GetText( static_cast( ii ) ) );
 
 return tmp;
 }
diff --git a/eeschema/lib_pin.h b/eeschema/lib_pin.h
index bfd1f92..6cb03d9 100644
--- a/eeschema/lib_pin.h
+++ b/eeschema/lib_pin.h
@@ -269,19 +269,12 @@ public:
 }
 
 /**
- * return a translated string for messages giving the electrical type of a pin.
- * @param aType is the electrical type (see enum ElectricPinType )
- * @return The electrical name of the pin (see enun 

[Kicad-developers] [PATCH 08/19] PinShape: move bitmap lookup

2016-02-17 Thread Simon Richter

This moves the bitmaps out of the data model as well.
---
 eeschema/lib_pin.cpp| 22 
 eeschema/lib_pin.h  |  7 ---
 eeschema/pin_shape.cpp  | 37 +
 eeschema/pin_shape.h|  2 ++
 eeschema/widgets/pin_shape_combobox.cpp |  7 +++
 5 files changed, 42 insertions(+), 33 deletions(-)

diff --git a/eeschema/lib_pin.cpp b/eeschema/lib_pin.cpp
index 999e74e..0115a42 100644
--- a/eeschema/lib_pin.cpp
+++ b/eeschema/lib_pin.cpp
@@ -70,22 +70,6 @@ static const BITMAP_DEF iconsPinsOrientations[] =
 };
 
 
-// bitmaps to show pins shapes in dialog editor
-// must have same order than pin_style_names
-static BITMAP_DEF iconsPinsShapes[] =
-{
-pinshape_normal_xpm,
-pinshape_invert_xpm,
-pinshape_clock_normal_xpm,
-pinshape_clock_invert_xpm,
-pinshape_active_low_input_xpm,
-pinshape_clock_active_low_xpm,
-pinshape_active_low_output_xpm,
-pinshape_clock_fall_xpm,
-pinshape_nonlogic_xpm
-};
-
-
 // bitmaps to show pins electrical type in dialog editor
 // must have same order than enum ElectricPinType (see lib_pin.h)
 static const BITMAP_DEF iconsPinsElectricalType[] =
@@ -2256,12 +2240,6 @@ const BITMAP_DEF* LIB_PIN::GetOrientationSymbols()
 }
 
 
-const BITMAP_DEF* LIB_PIN::GetStyleSymbols()
-{
-return iconsPinsShapes;
-}
-
-
 BITMAP_DEF LIB_PIN::GetMenuImage() const
 {
 return iconsPinsElectricalType[m_type];
diff --git a/eeschema/lib_pin.h b/eeschema/lib_pin.h
index c7d6fba..f1121d3 100644
--- a/eeschema/lib_pin.h
+++ b/eeschema/lib_pin.h
@@ -466,13 +466,6 @@ public:
 static int GetOrientationCodeIndex( int aCode );
 
 /**
- * Get a list of pin styles bitmaps for menus and dialogs.
- *
- * @return  List of valid pin electrical type bitmaps symbols in .xpm format.
- */
-static const BITMAP_DEF* GetStyleSymbols();
-
-/**
  * Get a list of pin electrical type names.
  *
  * @return  List of valid pin electrical type names.
diff --git a/eeschema/pin_shape.cpp b/eeschema/pin_shape.cpp
index 19a7ff2..65eac24 100644
--- a/eeschema/pin_shape.cpp
+++ b/eeschema/pin_shape.cpp
@@ -65,3 +65,40 @@ wxString GetText( PinShape shape )
 assert( !"Invalid pin shape" );
 return wxT( "?" );
 }
+
+
+BITMAP_DEF GetBitmap( PinShape shape )
+{
+switch( shape )
+{
+case PINSHAPE_LINE:
+return pinshape_normal_xpm;
+
+case PINSHAPE_INVERTED:
+return pinshape_invert_xpm;
+
+case PINSHAPE_CLOCK:
+return pinshape_clock_normal_xpm;
+
+case PINSHAPE_INVERTED_CLOCK:
+return pinshape_clock_invert_xpm;
+
+case PINSHAPE_INPUT_LOW:
+return pinshape_active_low_input_xpm;
+
+case PINSHAPE_CLOCK_LOW:
+return pinshape_clock_active_low_xpm;
+
+case PINSHAPE_OUTPUT_LOW:
+return pinshape_active_low_output_xpm;
+
+case PINSHAPE_FALLING_EDGE_CLOCK:
+return pinshape_clock_fall_xpm;
+
+case PINSHAPE_NONLOGIC:
+return pinshape_nonlogic_xpm;
+}
+
+assert( !"Invalid pin shape" );
+return 0;
+};
diff --git a/eeschema/pin_shape.h b/eeschema/pin_shape.h
index d5ea11d..9adfd3e 100644
--- a/eeschema/pin_shape.h
+++ b/eeschema/pin_shape.h
@@ -30,6 +30,7 @@
 #define _PIN_SHAPE_H_
 
 #include 
+#include 
 
 enum PinShape
 {
@@ -51,5 +52,6 @@ enum
 
 // UI
 wxStringGetText( PinShape shape );
+BITMAP_DEF  GetBitmap( PinShape shape );
 
 #endif
diff --git a/eeschema/widgets/pin_shape_combobox.cpp b/eeschema/widgets/pin_shape_combobox.cpp
index 6579f0d..b2fae58 100644
--- a/eeschema/widgets/pin_shape_combobox.cpp
+++ b/eeschema/widgets/pin_shape_combobox.cpp
@@ -42,18 +42,17 @@ PinShapeComboBox::PinShapeComboBox( wxWindow* parent,
 const wxString& name ) :
 wxBitmapComboBox( parent, id, value, pos, size, n, choices, style, validator, name )
 {
-const BITMAP_DEF* bitmaps = LIB_PIN::GetStyleSymbols();
-
 for( unsigned ii = 0; ii < PINSHAPE_COUNT; ++ii )
 {
 PinShape shape = static_cast( ii );
 
 wxString text = GetText( shape );
+BITMAP_DEF bitmap = GetBitmap( shape );
 
-if( bitmaps == NULL )
+if( bitmap == NULL )
 Append( text );
 else
-Insert( text, KiBitmap( bitmaps[ii] ), ii );
+Insert( text, KiBitmap( bitmap ), ii );
 }
 }
 
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] [PATCH 04/19] PinShapeComboBox: typesafe Get/Set

2016-02-17 Thread Simon Richter

These overrides provide typed access to the current selection, overriding
the regular integer-based accessor/mutator.
---
 eeschema/dialogs/dialog_lib_edit_pin.h  |  2 +-
 eeschema/widgets/pin_shape_combobox.cpp | 12 
 eeschema/widgets/pin_shape_combobox.h   |  5 +
 3 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/eeschema/dialogs/dialog_lib_edit_pin.h b/eeschema/dialogs/dialog_lib_edit_pin.h
index e720b14..3b4e363 100644
--- a/eeschema/dialogs/dialog_lib_edit_pin.h
+++ b/eeschema/dialogs/dialog_lib_edit_pin.h
@@ -71,7 +71,7 @@ public:
 }
 
 void SetStyle( PinShape style ) { m_choiceStyle->SetSelection( style ); }
-PinShape GetStyle( void ) { return static_cast( m_choiceStyle->GetSelection() ); }
+PinShape GetStyle( void ) { return m_choiceStyle->GetSelection(); }
 
 void SetPinName( const wxString& name ) { m_textPinName->SetValue( name ); }
 wxString GetPinName( void ) { return m_textPinName->GetValue(); }
diff --git a/eeschema/widgets/pin_shape_combobox.cpp b/eeschema/widgets/pin_shape_combobox.cpp
index 08f835c..e030534 100644
--- a/eeschema/widgets/pin_shape_combobox.cpp
+++ b/eeschema/widgets/pin_shape_combobox.cpp
@@ -53,3 +53,15 @@ PinShapeComboBox::PinShapeComboBox( wxWindow* parent,
 Insert( list[ii], KiBitmap( bitmaps[ii] ), ii );
 }
 }
+
+
+PinShape PinShapeComboBox::GetSelection()
+{
+return static_cast( wxBitmapComboBox::GetSelection() );
+}
+
+
+void PinShapeComboBox::SetSelection( PinShape aShape )
+{
+wxBitmapComboBox::SetSelection( aShape );
+}
diff --git a/eeschema/widgets/pin_shape_combobox.h b/eeschema/widgets/pin_shape_combobox.h
index 9396770..19c9714 100644
--- a/eeschema/widgets/pin_shape_combobox.h
+++ b/eeschema/widgets/pin_shape_combobox.h
@@ -28,6 +28,8 @@
 
 #include 
 
+#include 
+
 class PinShapeComboBox : public wxBitmapComboBox
 {
 public:
@@ -43,4 +45,7 @@ public:
 long style = 0,
 const wxValidator& validator = wxDefaultValidator,
 const wxString& name = wxBitmapComboBoxNameStr );
+
+PinShapeGetSelection();
+voidSetSelection( PinShape aShape );
 };
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] [PATCH 13/19] PinTypeComboBox: Introduce widget

2016-02-17 Thread Simon Richter
---
 eeschema/CMakeLists.txt   |  1 +
 eeschema/dialogs/dialog_lib_edit_pin.h|  1 +
 eeschema/dialogs/dialog_lib_edit_pin_base.cpp |  3 +-
 eeschema/dialogs/dialog_lib_edit_pin_base.fbp |  2 +-
 eeschema/dialogs/dialog_lib_edit_pin_base.h   |  3 +-
 eeschema/widgets/pin_type_combobox.cpp| 43 +
 eeschema/widgets/pin_type_combobox.h  | 46 +++
 7 files changed, 96 insertions(+), 3 deletions(-)
 create mode 100644 eeschema/widgets/pin_type_combobox.cpp
 create mode 100644 eeschema/widgets/pin_type_combobox.h

diff --git a/eeschema/CMakeLists.txt b/eeschema/CMakeLists.txt
index c6c894c..e9ae4bb 100644
--- a/eeschema/CMakeLists.txt
+++ b/eeschema/CMakeLists.txt
@@ -186,6 +186,7 @@ set( EESCHEMA_SRCS
 netlist_exporters/netlist_exporter_pspice.cpp
 
 widgets/pin_shape_combobox.cpp
+widgets/pin_type_combobox.cpp
 )
 
 
diff --git a/eeschema/dialogs/dialog_lib_edit_pin.h b/eeschema/dialogs/dialog_lib_edit_pin.h
index 0ffdcd8..ab23264 100644
--- a/eeschema/dialogs/dialog_lib_edit_pin.h
+++ b/eeschema/dialogs/dialog_lib_edit_pin.h
@@ -32,6 +32,7 @@
 
 #include 
 #include 
+#include 
 
 #include 
 
diff --git a/eeschema/dialogs/dialog_lib_edit_pin_base.cpp b/eeschema/dialogs/dialog_lib_edit_pin_base.cpp
index af770d7..920a586 100644
--- a/eeschema/dialogs/dialog_lib_edit_pin_base.cpp
+++ b/eeschema/dialogs/dialog_lib_edit_pin_base.cpp
@@ -6,6 +6,7 @@
 ///
 
 #include "pin_shape_combobox.h"
+#include "pin_type_combobox.h"
 #include "wx/bmpcbox.h"
 
 #include "dialog_lib_edit_pin_base.h"
@@ -62,7 +63,7 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID
 	
 	fgSizerPins->Add( m_staticTextEType, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
 	
-	m_choiceElectricalType = new wxBitmapComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY ); 
+	m_choiceElectricalType = new PinTypeComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY ); 
 	fgSizerPins->Add( m_choiceElectricalType, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
 	
 	m_staticTextGstyle = new wxStaticText( this, wxID_ANY, _("Graphic :"), wxDefaultPosition, wxDefaultSize, 0 );
diff --git a/eeschema/dialogs/dialog_lib_edit_pin_base.fbp b/eeschema/dialogs/dialog_lib_edit_pin_base.fbp
index f1647ae..43b1deb 100644
--- a/eeschema/dialogs/dialog_lib_edit_pin_base.fbp
+++ b/eeschema/dialogs/dialog_lib_edit_pin_base.fbp
@@ -784,7 +784,7 @@
 1
 
 wxCB_READONLY
-wxBitmapComboBox; wx/bmpcbox.h
+PinTypeComboBox; pin_type_combobox.h
 0
 
 
diff --git a/eeschema/dialogs/dialog_lib_edit_pin_base.h b/eeschema/dialogs/dialog_lib_edit_pin_base.h
index 890623b..e8b46e9 100644
--- a/eeschema/dialogs/dialog_lib_edit_pin_base.h
+++ b/eeschema/dialogs/dialog_lib_edit_pin_base.h
@@ -13,6 +13,7 @@
 #include 
 class DIALOG_SHIM;
 class PinShapeComboBox;
+class PinTypeComboBox;
 class wxBitmapComboBox;
 
 #include "dialog_shim.h"
@@ -65,7 +66,7 @@ class DIALOG_LIB_EDIT_PIN_BASE : public DIALOG_SHIM
 		wxStaticText* m_staticTextOrient;
 		wxBitmapComboBox* m_choiceOrientation;
 		wxStaticText* m_staticTextEType;
-		wxBitmapComboBox* m_choiceElectricalType;
+		PinTypeComboBox* m_choiceElectricalType;
 		wxStaticText* m_staticTextGstyle;
 		PinShapeComboBox* m_choiceStyle;
 		wxCheckBox* m_checkApplyToAllParts;
diff --git a/eeschema/widgets/pin_type_combobox.cpp b/eeschema/widgets/pin_type_combobox.cpp
new file mode 100644
index 000..3c2ac7e
--- /dev/null
+++ b/eeschema/widgets/pin_type_combobox.cpp
@@ -0,0 +1,43 @@
+/*
+ * This program source code file is part of KiCad, a free EDA CAD application.
+ *
+ * Copyright (C) 2015 Simon Richter <simon.rich...@hogyros.de>
+ *
+ * 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

[Kicad-developers] [PATCH 15/19] PinTypeComboBox: typesafe Get/Set

2016-02-17 Thread Simon Richter
---
 eeschema/dialogs/dialog_lib_edit_pin.h |  2 +-
 eeschema/widgets/pin_type_combobox.cpp | 12 
 eeschema/widgets/pin_type_combobox.h   |  5 +
 3 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/eeschema/dialogs/dialog_lib_edit_pin.h b/eeschema/dialogs/dialog_lib_edit_pin.h
index ebbcb4e..3b93ff2 100644
--- a/eeschema/dialogs/dialog_lib_edit_pin.h
+++ b/eeschema/dialogs/dialog_lib_edit_pin.h
@@ -67,7 +67,7 @@ public:
 }
 ElectricPinType GetElectricalType( void )
 {
-return static_cast( m_choiceElectricalType->GetSelection() );
+return m_choiceElectricalType->GetSelection();
 }
 
 void SetStyle( PinShape style ) { m_choiceStyle->SetSelection( style ); }
diff --git a/eeschema/widgets/pin_type_combobox.cpp b/eeschema/widgets/pin_type_combobox.cpp
index c83d14f..ae9676d 100644
--- a/eeschema/widgets/pin_type_combobox.cpp
+++ b/eeschema/widgets/pin_type_combobox.cpp
@@ -56,3 +56,15 @@ PinTypeComboBox::PinTypeComboBox( wxWindow* parent,
 Insert( text, KiBitmap( bitmap ), ii );
 }
 }
+
+
+ElectricPinType PinTypeComboBox::GetSelection()
+{
+return static_cast( wxBitmapComboBox::GetSelection() );
+}
+
+
+void PinTypeComboBox::SetSelection( ElectricPinType aType )
+{
+wxBitmapComboBox::SetSelection( aType );
+}
diff --git a/eeschema/widgets/pin_type_combobox.h b/eeschema/widgets/pin_type_combobox.h
index 1564839..05ed022 100644
--- a/eeschema/widgets/pin_type_combobox.h
+++ b/eeschema/widgets/pin_type_combobox.h
@@ -28,6 +28,8 @@
 
 #include 
 
+#include 
+
 class PinTypeComboBox : public wxBitmapComboBox
 {
 public:
@@ -43,4 +45,7 @@ public:
 long style = 0,
 const wxValidator& validator = wxDefaultValidator,
 const wxString& name = wxBitmapComboBoxNameStr );
+
+ElectricPinType GetSelection();
+voidSetSelection( ElectricPinType aType );
 };
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] [PATCH 06/19] PinShape: move text lookup

2016-02-17 Thread Simon Richter
---
 eeschema/CMakeLists.txt |  1 +
 eeschema/lib_pin.cpp| 29 +++--
 eeschema/pin_shape.cpp  | 67 +
 eeschema/pin_shape.h|  5 
 4 files changed, 76 insertions(+), 26 deletions(-)
 create mode 100644 eeschema/pin_shape.cpp

diff --git a/eeschema/CMakeLists.txt b/eeschema/CMakeLists.txt
index d282cdb..c6c894c 100644
--- a/eeschema/CMakeLists.txt
+++ b/eeschema/CMakeLists.txt
@@ -138,6 +138,7 @@ set( EESCHEMA_SRCS
 operations_on_items_lists.cpp
 pinedit.cpp
 pin_number.cpp
+pin_shape.cpp
 plot_schematic_DXF.cpp
 plot_schematic_HPGL.cpp
 plot_schematic_PS.cpp
diff --git a/eeschema/lib_pin.cpp b/eeschema/lib_pin.cpp
index 9a2e077..e4b9878 100644
--- a/eeschema/lib_pin.cpp
+++ b/eeschema/lib_pin.cpp
@@ -184,29 +184,6 @@ const wxString LIB_PIN::GetElectricalTypeName( unsigned aPinsElectricalType )
 return pin_electrical_type_names[ aPinsElectricalType ];
 }
 
-static const wxString getPinStyleName( PinShape aPinsStyle )
-{
-const wxString pin_style_names[] =
-{   // Keep these translated strings not static
-_( "Line" ),
-_( "Inverted" ),
-_( "Clock" ),
-_( "Inverted clock" ),
-_( "Input low" ),
-_( "Clock low" ),
-_( "Output low" ),
-_( "Falling edge clock" ),
-_( "NonLogic" ),
-wxT( "???" )
-};
-
-if( aPinsStyle < 0 || aPinsStyle > int( PINSHAPE_COUNT ) )
-aPinsStyle = static_cast( PINSHAPE_COUNT );
-
-return pin_style_names[ aPinsStyle ];
-}
-
-
 /// Utility for getting the size of the 'internal' pin decorators (as a radius)
 // i.e. the clock symbols (falling clock is actually external but is of
 // the same kind)
@@ -2061,7 +2038,7 @@ void LIB_PIN::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
  LIB_PIN::GetElectricalTypeName( m_type ),
  RED ) );
 
-text = getPinStyleName( m_shape );
+text = GetText( m_shape );
 
 aList.push_back( MSG_PANEL_ITEM( _( "Style" ), text, BLUE ) );
 
@@ -2261,7 +2238,7 @@ wxArrayString LIB_PIN::GetStyleNames( void )
 wxArrayString tmp;
 
 for( unsigned ii = 0; ii < PINSHAPE_COUNT; ii++ )
-tmp.Add( getPinStyleName( static_cast( ii ) ) );
+tmp.Add( GetText( static_cast( ii ) ) );
 
 return tmp;
 }
@@ -2307,7 +2284,7 @@ wxString LIB_PIN::GetSelectMenuText() const
 wxString tmp;
 wxString style;
 
-style = getPinStyleName( m_shape );
+style = GetText( m_shape );
 
 tmp.Printf( _( "Pin %s, %s, %s" ),
 GetChars( GetNumberString() ),
diff --git a/eeschema/pin_shape.cpp b/eeschema/pin_shape.cpp
new file mode 100644
index 000..19a7ff2
--- /dev/null
+++ b/eeschema/pin_shape.cpp
@@ -0,0 +1,67 @@
+/*
+ * This program source code file is part of KiCad, a free EDA CAD application.
+ *
+ * Copyright (C) 2004-2015 KiCad Developers, see change_log.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
+ */
+
+/**
+ * @file pin_shape.cpp
+ * @brief Pin shape handling
+ */
+
+#include "pin_shape.h"
+
+#include 
+
+wxString GetText( PinShape shape )
+{
+switch( shape )
+{
+case PINSHAPE_LINE:
+return _( "Line" );
+
+case PINSHAPE_INVERTED:
+return _( "Inverted" );
+
+case PINSHAPE_CLOCK:
+return _( "Clock" );
+
+case PINSHAPE_INVERTED_CLOCK:
+return _( "Inverted clock" );
+
+case PINSHAPE_INPUT_LOW:
+return _( "Input low" );
+
+case PINSHAPE_CLOCK_LOW:
+return _( "Clock low" );
+
+case PINSHAPE_OUTPUT_LOW:
+return _( "Output low" );
+
+case PINSHAPE_FALLING_EDGE_CLOCK:
+return _( "Falling edge clock" );
+
+case PINSHAPE_NONLOGIC:
+return _( "NonLogic" );
+}
+
+assert( !"Invalid pin shape" );
+return wxT( "?" );
+}
diff --git a/eeschema/pin_shape.h b/eeschema/pin_shape.h
index 1d96435..d5ea11d 100644
--- a/eeschema/pin_shape.h
+++ b/eeschema/pin_shape.h
@@ -29,6 +29,8 @@
 #ifndef _PIN_SHAPE_H_
 #define _PIN_SHAPE_H_
 
+#include 
+
 enum PinShape
 {
 

[Kicad-developers] [PATCH 10/19] ElectricPinType: Use enum rather than int where possible

2016-02-17 Thread Simon Richter
---
 eeschema/class_netlist_object.cpp|  6 +++---
 eeschema/class_netlist_object.h  |  8 ++--
 eeschema/dialogs/dialog_lib_edit_pin.cpp |  2 +-
 eeschema/dialogs/dialog_lib_edit_pin.h   |  6 +++---
 eeschema/erc.cpp | 10 +-
 eeschema/lib_pin.cpp | 26 +++-
 eeschema/lib_pin.h   | 34 
 eeschema/pinedit.cpp | 16 +++
 eeschema/sch_component.cpp   |  2 +-
 eeschema/sch_sheet.cpp   |  2 +-
 10 files changed, 56 insertions(+), 56 deletions(-)

diff --git a/eeschema/class_netlist_object.cpp b/eeschema/class_netlist_object.cpp
index a7fe36a..441b2da 100644
--- a/eeschema/class_netlist_object.cpp
+++ b/eeschema/class_netlist_object.cpp
@@ -200,14 +200,14 @@ NETLIST_OBJECT::~NETLIST_OBJECT()
 }
 
 
-int NETLIST_OBJECT::GetElectricalType() const
+ElectricPinType NETLIST_OBJECT::GetElectricalType() const
 {
 if( m_Type == NET_PIN )
-return m_ElectricalType;
+return m_ElectricalType.pin;
 
 if( IsLabelType() )
 {
-switch( m_ElectricalType )
+switch( m_ElectricalType.label )
 {
 case NET_INPUT:
 return PIN_INPUT;
diff --git a/eeschema/class_netlist_object.h b/eeschema/class_netlist_object.h
index 7c9e987..573 100644
--- a/eeschema/class_netlist_object.h
+++ b/eeschema/class_netlist_object.h
@@ -104,7 +104,11 @@ public:
 int m_Flag; /* flag used in calculations */
 SCH_SHEET_PATH  m_SheetPath;// the sheet path which contains this item
 SCH_SHEET_PATH  m_SheetPathInclude; // sheet path which contains the hierarchical label
-int m_ElectricalType;   /* Has meaning only for Pins and
+union
+{
+ElectricPinType pin;
+int label;
+} m_ElectricalType; /* Has meaning only for Pins and
  * hierarchical pins: electrical type */
 int m_BusNetCode;   /* Used for BUS connections */
 int m_Member;   /* for labels type NET_BUSLABELMEMBER ( bus member
@@ -161,7 +165,7 @@ public:
 return m_ConnectionType;
 }
 
-int GetElectricalType() const;
+ElectricPinType GetElectricalType() const;
 
 /**
  * Set m_netNameCandidate to a connected item which will
diff --git a/eeschema/dialogs/dialog_lib_edit_pin.cpp b/eeschema/dialogs/dialog_lib_edit_pin.cpp
index e626325..ae12e34 100644
--- a/eeschema/dialogs/dialog_lib_edit_pin.cpp
+++ b/eeschema/dialogs/dialog_lib_edit_pin.cpp
@@ -134,7 +134,7 @@ void DIALOG_LIB_EDIT_PIN::OnPropertiesChange( wxCommandEvent& event )
 int pinOrient = LIB_PIN::GetOrientationCode( GetOrientation() );
 int pinLength = ValueFromString( g_UserUnit, GetLength() );
 PinShape pinShape = GetStyle();
-int pinType = GetElectricalType();
+ElectricPinType pinType = GetElectricalType();
 
 m_dummyPin->SetName( GetPinName() );
 m_dummyPin->SetNameTextSize( pinNameSize );
diff --git a/eeschema/dialogs/dialog_lib_edit_pin.h b/eeschema/dialogs/dialog_lib_edit_pin.h
index 3b4e363..0ffdcd8 100644
--- a/eeschema/dialogs/dialog_lib_edit_pin.h
+++ b/eeschema/dialogs/dialog_lib_edit_pin.h
@@ -61,13 +61,13 @@ public:
 int GetOrientation( void ) { return m_choiceOrientation->GetSelection(); }
 
 void SetElectricalTypeList( const wxArrayString& list, const BITMAP_DEF* aBitmaps );
-void SetElectricalType( int type )
+void SetElectricalType( ElectricPinType type )
 {
 m_choiceElectricalType->SetSelection( type );
 }
-int GetElectricalType( void )
+ElectricPinType GetElectricalType( void )
 {
-return m_choiceElectricalType->GetSelection();
+return static_cast( m_choiceElectricalType->GetSelection() );
 }
 
 void SetStyle( PinShape style ) { m_choiceStyle->SetSelection( style ); }
diff --git a/eeschema/erc.cpp b/eeschema/erc.cpp
index f714c5b..a7f1b58 100644
--- a/eeschema/erc.cpp
+++ b/eeschema/erc.cpp
@@ -228,9 +228,9 @@ int TestDuplicateSheetNames( bool aCreateMarker )
 void Diagnose( NETLIST_OBJECT* aNetItemRef, NETLIST_OBJECT* aNetItemTst,
int aMinConn, int aDiag )
 {
-SCH_MARKER* marker = NULL;
-SCH_SCREEN* screen;
-int ii, jj;
+SCH_MARKER* marker = NULL;
+SCH_SCREEN* screen;
+ElectricPinType ii, jj;
 
 if( aDiag == OK )
 return;
@@ -374,11 +374,11 @@ void TestOthersItems( NETLIST_OBJECT_LIST* aList,
   int* aMinConnexion )
 {
 unsigned netItemTst = aNetStart;
-int jj;
+ElectricPinType jj;
 int erc = OK;
 
 /* Analysis of the table of connections. */
-int ref_elect_type = aList->GetItem( aNetItemRef )->GetElectricalType();
+ElectricPinType ref_elect_type = aList->GetItem( aNetItemRef )->GetElectricalType();
 int local_minconn = NOC;
 
 if( 

[Kicad-developers] [PATCH 03/19] PinShapeComboBox: Fully initialize in c'tor

2016-02-17 Thread Simon Richter

This makes the widget universally usable without special initialisation.
---
 eeschema/dialogs/dialog_lib_edit_pin.cpp | 12 
 eeschema/dialogs/dialog_lib_edit_pin.h   |  1 -
 eeschema/pinedit.cpp |  1 -
 eeschema/widgets/pin_shape_combobox.cpp  | 12 
 4 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/eeschema/dialogs/dialog_lib_edit_pin.cpp b/eeschema/dialogs/dialog_lib_edit_pin.cpp
index 84f75f1..e626325 100644
--- a/eeschema/dialogs/dialog_lib_edit_pin.cpp
+++ b/eeschema/dialogs/dialog_lib_edit_pin.cpp
@@ -174,15 +174,3 @@ void DIALOG_LIB_EDIT_PIN::SetElectricalTypeList( const wxArrayString& list,
 m_choiceElectricalType->Insert( list[ii], KiBitmap( aBitmaps[ii] ), ii );
 }
 }
-
-
-void DIALOG_LIB_EDIT_PIN::SetStyleList( const wxArrayString& list, const BITMAP_DEF* aBitmaps )
-{
-for ( unsigned ii = 0; ii < list.GetCount(); ii++ )
-{
-if( aBitmaps == NULL )
-m_choiceStyle->Append( list[ii] );
-else
-m_choiceStyle->Insert( list[ii], KiBitmap( aBitmaps[ii] ), ii );
-}
-}
diff --git a/eeschema/dialogs/dialog_lib_edit_pin.h b/eeschema/dialogs/dialog_lib_edit_pin.h
index 158ce04..e720b14 100644
--- a/eeschema/dialogs/dialog_lib_edit_pin.h
+++ b/eeschema/dialogs/dialog_lib_edit_pin.h
@@ -70,7 +70,6 @@ public:
 return m_choiceElectricalType->GetSelection();
 }
 
-void SetStyleList( const wxArrayString& list, const BITMAP_DEF* aBitmaps );
 void SetStyle( PinShape style ) { m_choiceStyle->SetSelection( style ); }
 PinShape GetStyle( void ) { return static_cast( m_choiceStyle->GetSelection() ); }
 
diff --git a/eeschema/pinedit.cpp b/eeschema/pinedit.cpp
index 2185c4f..fc5b71a 100644
--- a/eeschema/pinedit.cpp
+++ b/eeschema/pinedit.cpp
@@ -104,7 +104,6 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event )
 wxString units = GetUnitsLabel( g_UserUnit );
 dlg.SetOrientationList( LIB_PIN::GetOrientationNames(), LIB_PIN::GetOrientationSymbols() );
 dlg.SetOrientation( LIB_PIN::GetOrientationCodeIndex( pin->GetOrientation() ) );
-dlg.SetStyleList( LIB_PIN::GetStyleNames(), LIB_PIN::GetStyleSymbols() );
 dlg.SetStyle( pin->GetShape() );
 dlg.SetElectricalTypeList( LIB_PIN::GetElectricalTypeNames(),
LIB_PIN::GetElectricalTypeSymbols() );
diff --git a/eeschema/widgets/pin_shape_combobox.cpp b/eeschema/widgets/pin_shape_combobox.cpp
index 0c69bb2..08f835c 100644
--- a/eeschema/widgets/pin_shape_combobox.cpp
+++ b/eeschema/widgets/pin_shape_combobox.cpp
@@ -28,6 +28,8 @@
 
 #include "pin_shape_combobox.h"
 
+#include 
+
 PinShapeComboBox::PinShapeComboBox( wxWindow* parent,
 wxWindowID id,
 const wxString& value,
@@ -40,4 +42,14 @@ PinShapeComboBox::PinShapeComboBox( wxWindow* parent,
 const wxString& name ) :
 wxBitmapComboBox( parent, id, value, pos, size, n, choices, style, validator, name )
 {
+wxArrayString list = LIB_PIN::GetStyleNames();
+const BITMAP_DEF* bitmaps = LIB_PIN::GetStyleSymbols();
+
+for ( unsigned ii = 0; ii < list.GetCount(); ii++ )
+{
+if( bitmaps == NULL )
+Append( list[ii] );
+else
+Insert( list[ii], KiBitmap( bitmaps[ii] ), ii );
+}
 }
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] [PATCH] Add icons to pin table's type column

2016-02-17 Thread Simon Richter
Hi,

this makes the pin table a tiny bit more beautiful and/or easier to read,
by adding the icon for the pin type to the left of it.

The refactoring patch from earlier is a prerequisite for this, because it
makes the strings and bitmaps accessible from the context of the data
model class.

   Simon

Simon Richter (1):
  Add icon to pin type column

 eeschema/dialogs/dialog_lib_edit_pin_table.cpp | 51 --
 1 file changed, 47 insertions(+), 4 deletions(-)

-- 
2.1.4

___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] [PATCH] Add icon to pin type column

2016-02-17 Thread Simon Richter
---
 eeschema/dialogs/dialog_lib_edit_pin_table.cpp | 51 --
 1 file changed, 47 insertions(+), 4 deletions(-)

diff --git a/eeschema/dialogs/dialog_lib_edit_pin_table.cpp b/eeschema/dialogs/dialog_lib_edit_pin_table.cpp
index 5a6202e..294ee09 100644
--- a/eeschema/dialogs/dialog_lib_edit_pin_table.cpp
+++ b/eeschema/dialogs/dialog_lib_edit_pin_table.cpp
@@ -162,7 +162,7 @@ DIALOG_LIB_EDIT_PIN_TABLE::DIALOG_LIB_EDIT_PIN_TABLE( wxWindow* parent,
 100,
 wxAlignment( wxALIGN_LEFT | wxALIGN_TOP ),
 wxDATAVIEW_COL_RESIZABLE | wxDATAVIEW_COL_SORTABLE );
-wxDataViewTextRenderer* rend2 = new wxDataViewTextRenderer( wxT( "string" ), wxDATAVIEW_CELL_INERT );
+wxDataViewIconTextRenderer* rend2 = new wxDataViewIconTextRenderer( wxT( "wxDataViewIconText" ), wxDATAVIEW_CELL_INERT );
 wxDataViewColumn* col2 = new wxDataViewColumn( _( "Type" ),
 rend2,
 DataViewModel::PIN_TYPE,
@@ -234,7 +234,23 @@ unsigned int DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::GetColumnCount() const
 
 wxString DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::GetColumnType( unsigned int aCol ) const
 {
-return wxT( "string" );
+switch( aCol )
+{
+case PIN_NUMBER:
+return wxT( "string" );
+
+case PIN_NAME:
+return wxT( "string" );
+
+case PIN_TYPE:
+return wxT( "wxDataViewIconText" );
+
+case PIN_POSITION:
+return wxT( "string" );
+}
+
+assert( ! "Unhandled column" );
+return wxT( "" );
 }
 
 
@@ -410,8 +426,20 @@ void DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Group::GetValue( wxVariant& aValu
 if( aCol == m_GroupingColumn )
 // shortcut
 m_Members.front()->GetValue( aValue, aCol );
-else
+else if( aCol != PIN_TYPE )
 aValue = GetString( aCol );
+else
+{
+PinNumbers values;
+
+for( std::list::const_iterator i = m_Members.begin(); i != m_Members.end(); ++i )
+values.insert( (*i)->GetString( aCol ) );
+
+if( values.size() > 1 )
+aValue << wxDataViewIconText( boost::algorithm::join( values, "," ), wxNullIcon );
+else
+m_Members.front()->GetValue( aValue, aCol );
+}
 }
 
 
@@ -455,7 +483,22 @@ void DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Group::Add( Pin* aPin )
 void DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Pin::GetValue( wxVariant& aValue,
 unsigned int aCol ) const
 {
-aValue = GetString( aCol );
+switch( aCol )
+{
+case PIN_NUMBER:
+case PIN_NAME:
+case PIN_POSITION:
+aValue = GetString( aCol );
+break;
+
+case PIN_TYPE:
+{
+wxIcon icon;
+icon.CopyFromBitmap( KiBitmap ( GetBitmap( m_Backing->GetType() ) ) );
+aValue << wxDataViewIconText( m_Backing->GetElectricalTypeName(), icon );
+}
+break;
+}
 }
 
 
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] [PATCH] Enable C++11

2016-03-09 Thread Simon Richter

This enables C++11 support, if either CMake is sufficiently new to have
this feature built in, or the compiler is supported by the workaround code
(gcc or clang).
---
 CMakeLists.txt | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 071dae6..c8f7bb0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -82,6 +82,11 @@ set( CMAKE_VISIBILITY_INLINES_HIDDEN ON )
 set( CMAKE_POSITION_INDEPENDENT_CODE ON )
 
 
+# Global setting: Use C++11
+set(CMAKE_CXX_STANDARD 11)
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
+
+
 # CMP0063: CMake < 3.3 does not handle hidden visibility for static libraries,
 # and 3.3 is backwards compatible when the minimum version is smaller than 3.3.
 if( POLICY CMP0063 )
@@ -129,6 +134,24 @@ include( PerformFeatureChecks )
 perform_feature_checks()
 
 
+# Workaround: CMake < 3.1 does not support CMAKE_CXX_STANDARD
+if( NOT CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 3.1 )
+message( FATAL_ERROR "Remove compatibility code" )
+endif()
+
+if( CMAKE_VERSION VERSION_LESS 3.1 AND ( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) )
+include(CheckCXXCompilerFlag)
+
+CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
+
+if(COMPILER_SUPPORTS_CXX11)
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
+else()
+message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
+endif()
+endif()
+
+
 #
 # Set flags for GCC, or treat llvm as GCC
 #
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] C++11 support

2016-03-09 Thread Simon Richter
Hi,

after all the C++11 discussion, here is a patch to use C++11 as default,
tested on Linux and MSYS2.

   Simon

Simon Richter (1):
  Enable C++11

 CMakeLists.txt | 23 +++
 1 file changed, 23 insertions(+)

-- 
2.1.4

___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] [PATCH] Enable C++11

2016-03-12 Thread Simon Richter
Hi,

On 12.03.2016 18:04, Mark Roszko wrote:

> But o well, screw it, undoubtedly someone will get the issue
> eventually later but screw wasting time finding what it was.

Agreed. One thing we should look into though is actually getting Ubuntu
bug reports.

I know that there are several people experiencing crashes, with all
different kinds of Ubuntu releases, there are entries in the Ubuntu
crash tracker, and I can reproduce these crashes (weird interaction
between kiface startup calling wxUninitialize, some proxy object being
freed after a callback because the callback registration was the last
remaining reference, and Unity using a hacked theme pack that actually
cares about the proxy object) -- but I have never gotten any report from
anyone about this, and the only way I know was experiencing it myself.

   Simon




signature.asc
Description: OpenPGP digital signature
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] [PATCH] Enable C++11

2016-03-11 Thread Simon Richter
Hi,

On 11.03.2016 17:48, Wayne Stambaugh wrote:

> It still sounds to me that boost needs to be bumped to 1.55 and possibly
> some definitions need to added to the build configuration for Boost to
> build properly.

Hm, compiling worked for me with Boost 1.55 on Debian with no further
changes.

   Simon



signature.asc
Description: OpenPGP digital signature
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] [PATCH 0/2] Two small portability patches

2016-04-06 Thread Simon Richter
Hi,

these should be fairly obvious:

 - all Windows platforms use declspec(dllexport)
 - MSVC does not set a symbol called "MSVC"
 - use wxFileName to access the FS rather than POSIX

   Simon

Simon Richter (2):
  Fix condition for Windows-style DLL export
  Make file test more portable

 3d-viewer/3d_cache/3d_cache.cpp   | 8 +---
 include/plugins/3dapi/ifsg_defs.h | 2 +-
 2 files changed, 2 insertions(+), 8 deletions(-)

-- 
2.1.4

___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] [PATCH 1/2] Fix condition for Windows-style DLL export

2016-04-06 Thread Simon Richter
---
 include/plugins/3dapi/ifsg_defs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/plugins/3dapi/ifsg_defs.h b/include/plugins/3dapi/ifsg_defs.h
index 0523bf1..d0fd56d 100644
--- a/include/plugins/3dapi/ifsg_defs.h
+++ b/include/plugins/3dapi/ifsg_defs.h
@@ -31,7 +31,7 @@
 #ifndef IFSG_DEFS_H
 #define IFSG_DEFS_H
 
-#if defined(__MINGW32__) || defined( MSVC )
+#if defined(_WIN32)
 #define APIEXPORT __declspec(dllexport)
 #define APIIMPORT __declspec(dllimport)
 #define APILOCAL
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] 3D merge: new warnings

2016-04-06 Thread Simon Richter
Hi,

first Jenkins builds after the merge went through, we have a few new
warnings. The msys build is rather silent[1]:

ogl_legacy_utils.cpp:209
 variable 'end' set but not used [-Wunused-but-set-variable]

The MSVC build has a few more new warnings[2], sorted by category here:

vrml.cpp:185
 'e': unreferenced local variable

wrlfacet.cpp:121
 'initializing': conversion from 'double' to 'float', possible loss of data

wrlfacet.cpp:771 [64 bit build only]
 'argument': conversion from 'size_t' to 'int', possible loss of data

clayer_triangles.h:105 [64 bit build only]
 'return': conversion from 'size_t' to 'unsigned int', possible loss of data

clayer_triangles.h:111 [64 bit build only]
 'return': conversion from 'size_t' to 'unsigned int', possible loss of data

There are 90 new "truncation from double to float" warnings, I believe
these are mostly uninteresting. The difference to "conversion" warnings
is that "truncation" happens to compile-time constants.

On the 32 bit build, there are 30 instances of objects not allocated
with the required alignment:

3d_frame.cpp:204
 'EDA_3D_CANVAS': object allocated on the heap may not be aligned 16

c3d_model_viewer.cpp
 'C_OGL_3DMODEL': object allocated on the heap may not be aligned 16

c_ogl_3dmodel.cpp:54
 'CBBOX': object allocated on the heap may not be aligned 16

vrml_v1_modelparser.cpp:91
 'S3D_MESH': object allocated on the heap may not be aligned 16

vrml_v1_modelparser.cpp:127
 'S3D_MESH': object allocated on the heap may not be aligned 16

vrml_v2_modelparser.cpp:165
 'S3D_MESH': object allocated on the heap may not be aligned 16

vrml_v2_modelparser.cpp:203
 'S3D_MESH': object allocated on the heap may not be aligned 16

vrml_v2_modelparser.cpp:241
 'S3D_MESH': object allocated on the heap may not be aligned 16

vrml_v2_modelparser.cpp:344
 'S3D_MESH': object allocated on the heap may not be aligned 16

vrml_v2_modelparser.cpp:485
 'S3D_MESH': object allocated on the heap may not be aligned 16

vrml_v2_modelparser.cpp:806
 'S3D_MESH': object allocated on the heap may not be aligned 16

vrml_v2_modelparser.cpp:852
 'S3D_MESH': object allocated on the heap may not be aligned 16

x3dmodelparser.cpp:97
 'S3D_MESH': object allocated on the heap may not be aligned 16

class_module.cpp:79
 'S3D_MASTER': object allocated on the heap may not be aligned 16

class_module.cpp:149
 'S3D_MASTER': object allocated on the heap may not be aligned 16

class_module.cpp:156
 'S3D_MASTER': object allocated on the heap may not be aligned 16

class_module.cpp:284
 'S3D_MASTER': object allocated on the heap may not be aligned 16

class_module.cpp:299
 'S3D_MASTER': object allocated on the heap may not be aligned 16

dialog_edit_module_for_BoardEditor.cpp:277
 'S3D_MASTER': object allocated on the heap may not be aligned 16

dialog_edit_module_for_BoardEditor.cpp:542
 'S3D_MASTER': object allocated on the heap may not be aligned 16

dialog_edit_module_for_BoardEditor.cpp:602
 'S3D_MASTER': object allocated on the heap may not be aligned 16

dialog_edit_module_for_BoardEditor.cpp:748
 'S3D_MASTER': object allocated on the heap may not be aligned 16

dialog_edit_module_for_BoardEditor.cpp:771
 'S3D_MASTER': object allocated on the heap may not be aligned 16

dialog_edit_module_for_Modedit.cpp:130
 'S3D_MASTER': object allocated on the heap may not be aligned 16

dialog_edit_module_for_Modedit.cpp:409
 'S3D_MASTER': object allocated on the heap may not be aligned 16

dialog_edit_module_for_Modedit.cpp:469
 'S3D_MASTER': object allocated on the heap may not be aligned 16

dialog_edit_module_for_Modedit.cpp:581
 'S3D_MASTER': object allocated on the heap may not be aligned 16

dialog_edit_module_for_Modedit.cpp:604
 'S3D_MASTER': object allocated on the heap may not be aligned 16

legacy_plugin.cpp:1886
 'S3D_MASTER': object allocated on the heap may not be aligned 16

pcb_parser.cpp:311
 'S3D_MASTER': object allocated on the heap may not be aligned 16

The rest appears to be smaller stuff:

ifsg_node.h:171
 'IFSG_NODE': multiple copy constructors specified

The compiler also complains that exception processing is turned off, but
we use math functions that may throw exceptions (Windows converts divide
by zero to an exception) -- I'm just going to turn on exception handling
on MSVC to get rid of the noise.

Finally, there are linker warnings about duplicate definitions for
cimage.obj and trackball.obj -- these appear to be linked twice, but as
they end up in a static library, the first definition shadows the
second, and no compiler error occurs.

   Simon

[1]
http://ci.kicad-pcb.org/job/windows-kicad-msys2-nightlies/555/warnings24Result/new/

[2]
http://ci.kicad-pcb.org/job/windows-kicad-msvc-head/863/warnings35Result/new/



signature.asc
Description: OpenPGP digital signature
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : 

Re: [Kicad-developers] [PATCH] Enable C++11

2016-04-05 Thread Simon Richter
Hi,

On 06.04.2016 05:19, Simon Richter wrote:

> This enables C++11 support, if either CMake is sufficiently new to have
> this feature built in, or the compiler is supported by the workaround code
> (gcc or clang).

Meh, that patch was still in the temp dir where I stage mails before
sending. As C++11 support is already there, please ignore :/

   Simon




signature.asc
Description: OpenPGP digital signature
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] [PATCH] Drop dependency on mm_malloc.h

2016-04-05 Thread Simon Richter
Hi,

apparently, the only mention of the string "mm_malloc" in the entire
codebase is this include, so there should be no ill effects from dropping
it.

   Simon

Simon Richter (1):
  Drop dependency on 

 include/plugins/3dapi/xv3d_types.h | 1 -
 1 file changed, 1 deletion(-)

-- 
2.1.4

___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] [PATCH] Drop dependency on

2016-04-05 Thread Simon Richter

This appears to be unused.
---
 include/plugins/3dapi/xv3d_types.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/include/plugins/3dapi/xv3d_types.h b/include/plugins/3dapi/xv3d_types.h
index 630d057..43222d6 100644
--- a/include/plugins/3dapi/xv3d_types.h
+++ b/include/plugins/3dapi/xv3d_types.h
@@ -37,7 +37,6 @@
 
 #include 
 #include 
-#include 
 
 typedef glm::uvec2  SFVEC2UI;
 typedef glm::ivec2  SFVEC2I;
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] [PATCH] Enable C++11

2016-04-05 Thread Simon Richter

This enables C++11 support, if either CMake is sufficiently new to have
this feature built in, or the compiler is supported by the workaround code
(gcc or clang).
---
 CMakeLists.txt | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 071dae6..c8f7bb0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -82,6 +82,11 @@ set( CMAKE_VISIBILITY_INLINES_HIDDEN ON )
 set( CMAKE_POSITION_INDEPENDENT_CODE ON )
 
 
+# Global setting: Use C++11
+set(CMAKE_CXX_STANDARD 11)
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
+
+
 # CMP0063: CMake < 3.3 does not handle hidden visibility for static libraries,
 # and 3.3 is backwards compatible when the minimum version is smaller than 3.3.
 if( POLICY CMP0063 )
@@ -129,6 +134,24 @@ include( PerformFeatureChecks )
 perform_feature_checks()
 
 
+# Workaround: CMake < 3.1 does not support CMAKE_CXX_STANDARD
+if( NOT CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 3.1 )
+message( FATAL_ERROR "Remove compatibility code" )
+endif()
+
+if( CMAKE_VERSION VERSION_LESS 3.1 AND ( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) )
+include(CheckCXXCompilerFlag)
+
+CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
+
+if(COMPILER_SUPPORTS_CXX11)
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
+else()
+message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
+endif()
+endif()
+
+
 #
 # Set flags for GCC, or treat llvm as GCC
 #
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] [PATCH] Enable C++11

2016-03-19 Thread Simon Richter
Hi Wayne,

On 17.03.2016 20:35, Wayne Stambaugh wrote:

> @Simon, when cmake is < 3.1 you set the -std-c++11 flag for gcc and
> clang instead of the -gnu-c++11.  This seems to be an issue that should
> be addressed.  Maybe this is what is breaking @Mark's builds.  I would
> feel more comfortable if we figure this out before I commit the patch.

It works for me on Debian jessie, with cmake 3.0.2 and gcc 4.9.2, and on
Ubunty trusty with cmake 2.8.12.2 and gcc 4.8.2.

On Ubuntu trusty, wxPython 3.0 is not available as far as I can see, so
that build was without scripting support.

   Simon



signature.asc
Description: OpenPGP digital signature
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] [PATCH 3/8] Use PATH to search for shared libraries on Windows

2016-03-01 Thread Simon Richter
Hi,

On 01.03.2016 16:58, jp charras wrote:

> I do no see what issue patch 1 fixes.

That is one half of the things I did -- the Windows API offers
InterlockedIncrement and InterlockedDecrement only for unsigned types,
while gcc's intrinsic is overloaded, so I had to change that in a common
header anyway, and it doesn't make much sense to use a signed value
here, so I split that from the platform specific parts.

With C++11, it may make more sense to use std::atomic to be fully portable.

   Simon



signature.asc
Description: OpenPGP digital signature
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] 3D file relative paths

2016-04-13 Thread Simon Richter
Hi,

On 13.04.2016 02:40, David Godfrey wrote:

> The use of Env Vars is the only sensible and portable method that can be
> used.

From a distribution point of view: this is unusable. We need to ship
something that can be started from a desktop icon, without extra setup,
and users need to be able to configure everything from the UI, because
we cannot expect them to learn how environment variables are set this week.

Debian policy explicitly forbids this, for a reason.

   Simon



signature.asc
Description: OpenPGP digital signature
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] dyn_cast

2016-04-13 Thread Simon Richter
Hi,

On 13.04.2016 18:13, Chris Pavlina wrote:

> What is the purpose of dyn_cast<> in include/core/typeinfo.h? Why don't we 
> just
> use dynamic_cast<>? And can we either replace the former with the latter, or
> add a comment to the former explaining its purpose?

It uses the parallel type system in EDA_ITEM rather than RTTI, so it
works if RTTI is broken, e.g. when compiling with gcc 2.95.

I believe this should go.

   Simon




signature.asc
Description: OpenPGP digital signature
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] Net Ties

2016-04-22 Thread Simon Richter
Hi,

On 22.04.2016 22:28, Jean-Paul Louis wrote:

> Please give us an example where you would need to connect more than 2 nets.

You can also use net ties to help with the layout of star topologies,
length controlled splits and decoupling capacitors.

Star Topologies: Connect the diode and capacitors in a buck converter to
GND through a net tie. The ratsnest will always show between these three
pins, regardless of whether another GND trace is nearer.

Lenght controlled splits (e.g. for clocks): Split at a defined point,
and use the length tuner tool to make sure both paths have the same length.

Decoupling capacitors: Connect the capacitor to the pin directly, and
place a net tie between them and the supply net. The capacitor will show
up connected to the pin in the ratsnest, allowing you to easily keep
track of capacitors (ideally, that would not have to be represented in
the drawn schematic, because that would be cumbersome to use).

   Simon



signature.asc
Description: OpenPGP digital signature
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] Net Ties

2016-04-22 Thread Simon Richter
Hi Wayne,

On 22.04.2016 15:04, Wayne Stambaugh wrote:

>> I've added UI[1] and save support in eeschema already, still needs
>> mapping to the netlist and pcbnew support.

> Are you aware that changes to the current schematic file format are
> forbidden until we (I) finish implementing the new file format?  This
> was discussed fairly recently so everyone should be aware of this.

Yes, I don't plan to submit this until it is complete and the new file
format is done -- I just need it for my current sensing resistor setup.

> In
> any event, you should have gotten input from the development team before
> heading down this path.

That's the purpose of the mail -- wasting two hours is not too bad, but
I'd rather see for myself that it is possible before stirring up the
mailing list.

   Simon



signature.asc
Description: OpenPGP digital signature
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] Net Ties

2016-04-22 Thread Simon Richter
On 22.04.2016 15:23, Tomasz Wlostowski wrote:

> IMHO it can be done without any changes on the eeschema side by adding a
> special component to the standard library (just like GND/power ports).

Yes, but that'd feel like more of a hack.

> PCBnew could interpret it as a zero-sized copper pad. Some DRC
> modifications would be needed to correctly take into account clearances
> of the nets connected by a tie.

Well, the special pad (which I'd simply use the largest of the connected
netclasses' width for) would be allowed to coincide with other pads and
vias, modify zone fill around itself and even relax DRC rules, so this
would be a *very* special component, so I'm not sure piggybacking it off
component placement is going to do us any favours here.

   Simon



signature.asc
Description: OpenPGP digital signature
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] Net Ties

2016-04-20 Thread Simon Richter
Hi,

as wxWidgets is getting on my nerves with editing widgets in the pin
table not rendering properly, I've started on support for net ties.

In the current iteration, they would be placed the same way as junctions.

Rules:

 - Any wire or pin connected to a net tie is in a separate net (unless
connected elsewhere).
 - The net tie maps to a pseudo-pad that all three nets need to be
connected to.
 - Connecting the nets there does not give a DRC error -- anywhere else
will.
 - The pseudo-pad can be placed on a regular pad if it is on one of the
nets connected to the net tie.

Use cases:

 - Analog and digital supply planes connected with a trace, but
otherwise separate
 - Current sense resistors between a supply rail and a load
 - Decoupling capacitors.

I've added UI[1] and save support in eeschema already, still needs
mapping to the netlist and pcbnew support.

There doesn't appear to be a real standard on how to represent net ties
in the schematic, though. A design note[2] from Linear Technologies uses
45 degree angles on wires to make it look really intentional that the
wires should meet in the same spot, but that would be a major hassle
both to implement and use.

For now I've gone with a larger dot, but that is very unintuitive.
Printing net names next to wires is difficult, because these are still
wires only. Numbers next to the wires might be doable, but confusing, so
if anyone has a good idea how to represent them, please speak up.

   Simon

[1] http://psi5.com/~geier/net-tie.ogv
[2] http://cds.linear.com/docs/en/design-note/dn434f.pdf



signature.asc
Description: OpenPGP digital signature
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] [PATCH] Make EDA_ITEM::Clone() abstract

2016-04-20 Thread Simon Richter
Hi,

On 20.04.2016 22:15, Mark Roszko wrote:

> Since we have C++11 now...why not use the override specifier? :D

We still have to make it abstract though if we want to be told off when
we forget to implement it.

   Simon




signature.asc
Description: OpenPGP digital signature
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] [PATCH v2] Make EDA_ITEM::Clone() abstract

2016-04-26 Thread Simon Richter
---
 3d-viewer/3d_material.h| 3 +++
 3d-viewer/3d_struct.h  | 2 ++
 common/base_struct.cpp | 7 ---
 eeschema/class_libentry.h  | 6 ++
 eeschema/class_sch_screen.h| 3 +++
 gerbview/class_gbr_screen.h| 3 +++
 gerbview/class_gerber_draw_item.h  | 2 ++
 include/base_struct.h  | 9 +
 include/class_pcb_screen.h | 3 +++
 include/origin_viewitem.h  | 3 +++
 include/worksheet_viewitem.h   | 3 +++
 pagelayout_editor/class_pl_editor_screen.h | 3 +++
 pagelayout_editor/pl_editor_undo_redo.cpp  | 3 +++
 pcbnew/class_board.h   | 3 +++
 pcbnew/class_marker_pcb.h  | 3 +++
 pcbnew/class_netinfo.h | 2 ++
 pcbnew/ratsnest_viewitem.h | 3 +++
 pcbnew/router/router_preview_item.h| 3 +++
 pcbnew/tools/bright_box.h  | 2 ++
 pcbnew/tools/edit_points.h | 2 ++
 pcbnew/tools/selection_area.h  | 2 ++
 21 files changed, 55 insertions(+), 15 deletions(-)

diff --git a/3d-viewer/3d_material.h b/3d-viewer/3d_material.h
index 3bff7e6..4d8ab53 100644
--- a/3d-viewer/3d_material.h
+++ b/3d-viewer/3d_material.h
@@ -76,6 +76,9 @@ public:
 {
 return wxT( "S3D_MATERIAL" );
 }
+
+private:
+virtual EDA_ITEM* Clone() const { wxCHECK_MSG( false, nullptr, wxT( "Cannot clone S3D_MATERIAL" ) ); }
 };
 
 void SetOpenGlDefaultMaterial();
diff --git a/3d-viewer/3d_struct.h b/3d-viewer/3d_struct.h
index fc85567..43d0b65 100644
--- a/3d-viewer/3d_struct.h
+++ b/3d-viewer/3d_struct.h
@@ -169,6 +169,8 @@ private:
 voidcalcBBox();
 CBBOX   m_BBox; ///< Model oriented Bouding Box
 CBBOX   m_fastAABBox;   ///< Axis Align Bounding Box that contain the other bounding boxes
+
+virtual EDA_ITEM* Clone() const { wxCHECK_MSG( false, nullptr, wxT( "Cannot clone S3D_MASTER" ) ); }
 };
 
 
diff --git a/common/base_struct.cpp b/common/base_struct.cpp
index 9b6273d..10ca003 100644
--- a/common/base_struct.cpp
+++ b/common/base_struct.cpp
@@ -100,13 +100,6 @@ void EDA_ITEM::SetModified()
 }
 
 
-EDA_ITEM* EDA_ITEM::Clone() const
-{
-wxCHECK_MSG( false, NULL, wxT( "Clone not implemented in derived class " ) + GetClass() +
- wxT( ".  Bad programmer!" ) );
-}
-
-
 SEARCH_RESULT EDA_ITEM::IterateForward( EDA_ITEM* listStart,
 INSPECTOR*inspector,
 const void*   testData,
diff --git a/eeschema/class_libentry.h b/eeschema/class_libentry.h
index 2359349..21e2cb6 100644
--- a/eeschema/class_libentry.h
+++ b/eeschema/class_libentry.h
@@ -180,6 +180,9 @@ public:
 #if defined(DEBUG)
 void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override
 #endif
+
+private:
+virtual EDA_ITEM* Clone() const { wxCHECK_MSG( false, nullptr, wxT( "Cannot clone LIB_PART" ) ); }
 };
 
 extern bool operator<( const LIB_ALIAS& aItem1, const LIB_ALIAS& aItem2 );
@@ -772,6 +775,9 @@ public:
 #if defined(DEBUG)
 void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override
 #endif
+
+private:
+virtual EDA_ITEM* Clone() const { wxCHECK_MSG( false, nullptr, wxT( "Cannot clone LIB_PART" ) ); }
 };
 
 #endif  //  CLASS_LIBENTRY_H
diff --git a/eeschema/class_sch_screen.h b/eeschema/class_sch_screen.h
index a6715f0..7f10f2c 100644
--- a/eeschema/class_sch_screen.h
+++ b/eeschema/class_sch_screen.h
@@ -529,6 +529,9 @@ public:
 #if defined(DEBUG)
 void Show( int nestLevel, std::ostream& os ) const; // overload
 #endif
+
+private:
+virtual EDA_ITEM* Clone() const { wxCHECK_MSG( false, nullptr, wxT( "Cannot clone SCH_SCREEN" ) ); }
 };
 
 
diff --git a/gerbview/class_gbr_screen.h b/gerbview/class_gbr_screen.h
index 19b5f90..b1d13fe 100644
--- a/gerbview/class_gbr_screen.h
+++ b/gerbview/class_gbr_screen.h
@@ -63,6 +63,9 @@ public:
  * virtual pure in BASE_SCREEN, so it must be defined here
  */
 void ClearUndoORRedoList( UNDO_REDO_CONTAINER& aList, int aItemCount = -1 );
+
+private:
+virtual EDA_ITEM* Clone() const { wxCHECK_MSG( false, nullptr, wxT( "Cannot clone GBR_SCREEN" ) ); }
 };
 
 
diff --git a/gerbview/class_gerber_draw_item.h b/gerbview/class_gerber_draw_item.h
index 49e3340..f6d3633 100644
--- a/gerbview/class_gerber_draw_item.h
+++ b/gerbview/class_gerber_draw_item.h
@@ -304,6 +304,8 @@ public:
 void Show( int nestLevel, std::ostream& os ) const;  // override
 #endif
 
+private:
+virtual EDA_ITEM* Clone() const { wxCHECK_MSG( false, nullptr, wxT( "Cannot clone GERBER_DRAW_ITEM" ) ); }
 };
 
 #endif /* CLASS_GERBER_DRAW_ITEM_H */
diff --git a/include/base_struct.h b/include/base_struct.h
index d9903fb..f356828 100644
--- a/include/base_struct.h
+++ b/include/base_struct.h
@@ -332,16 +332,9 @@ public:
  * Function Clone
  * 

[Kicad-developers] [PATCH 2/3] Replace unshared boost::shared_array with std::unique_ptr

2016-04-30 Thread Simon Richter

These are never shared, so std::unique_ptr works fine.
---
 common/gal/opengl/opengl_gal.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/common/gal/opengl/opengl_gal.cpp b/common/gal/opengl/opengl_gal.cpp
index 4325fe7..330e390 100644
--- a/common/gal/opengl/opengl_gal.cpp
+++ b/common/gal/opengl/opengl_gal.cpp
@@ -510,7 +510,7 @@ void OPENGL_GAL::DrawPolygon( const std::deque& aPointList )
 gluTessBeginPolygon( tesselator,  );
 gluTessBeginContour( tesselator );
 
-boost::shared_array points( new GLdouble[3 * aPointList.size()] );
+std::unique_ptr points( new GLdouble[ 3 * aPointList.size() ] );
 int v = 0;
 
 for( std::deque::const_iterator it = aPointList.begin(); it != aPointList.end(); ++it )
@@ -543,7 +543,7 @@ void OPENGL_GAL::DrawPolygon( const VECTOR2D aPointList[], int aListSize )
 gluTessBeginPolygon( tesselator,  );
 gluTessBeginContour( tesselator );
 
-boost::shared_array points( new GLdouble[3 * aListSize] );
+std::unique_ptr points( new GLdouble[3 * aListSize] );
 int v = 0;
 const VECTOR2D* ptr = aPointList;
 
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] [PATCH 1/3] Replace boost::shared_ptr with std::shared_ptr

2016-04-30 Thread Simon Richter
---
 3d-viewer/3d_mesh_model.h  |  4 ++--
 common/gal/opengl/opengl_gal.cpp   |  2 +-
 common/geometry/hetriang.cpp   | 34 +-
 eeschema/class_libentry.h  |  7 +++
 eeschema/sch_component.h   |  5 ++---
 include/gal/cairo/cairo_gal.h  |  5 +++--
 include/gal/opengl/opengl_gal.h|  4 ++--
 include/gal/opengl/vertex_manager.h|  6 +++---
 include/painter.h  |  2 +-
 include/ttl/halfedge/hetriang.h|  9 -
 pcbnew/class_board_connected_item.h|  2 +-
 pcbnew/class_netclass.cpp  |  6 ++
 pcbnew/class_netclass.h|  5 +++--
 pcbnew/dialogs/dialog_design_rules.cpp |  4 +---
 pcbnew/drc_stuff.h |  4 ++--
 pcbnew/legacy_plugin.cpp   |  4 +---
 pcbnew/legacy_plugin.h |  3 ++-
 pcbnew/pcb_painter.h   |  3 ++-
 pcbnew/pcb_parser.cpp  |  4 +---
 pcbnew/ratsnest_data.cpp   | 13 ++---
 pcbnew/ratsnest_data.h |  4 ++--
 pcbnew/router/pns_optimizer.h  |  2 +-
 pcbnew/specctra.h  |  5 +++--
 pcbnew/tools/edit_points.h |  9 +
 pcbnew/tools/point_editor.cpp  |  5 ++---
 pcbnew/tools/point_editor.h|  9 +
 pcbnew/tools/selection_tool.cpp|  2 +-
 27 files changed, 78 insertions(+), 84 deletions(-)

diff --git a/3d-viewer/3d_mesh_model.h b/3d-viewer/3d_mesh_model.h
index 734789f..bc35e43 100644
--- a/3d-viewer/3d_mesh_model.h
+++ b/3d-viewer/3d_mesh_model.h
@@ -31,7 +31,6 @@
 #define __3D_MESH_MODEL_H__
 
 #include 
-#include 
 #include 
 #define GLM_FORCE_RADIANS
 #include 
@@ -39,10 +38,11 @@
 #include "3d_material.h"
 #include "3d_rendering/3d_render_raytracing/shapes3D/cbbox.h"
 
+
 class S3D_MESH;
 
 /** A smart pointer to an S3D_MESH object */
-typedef boost::shared_ptr S3D_MESH_PTR;
+typedef std::shared_ptr S3D_MESH_PTR;
 
 /** A container of smar S3D_MESH object pointers */
 typedef std::vector S3D_MESH_PTRS;
diff --git a/common/gal/opengl/opengl_gal.cpp b/common/gal/opengl/opengl_gal.cpp
index e830c38..4325fe7 100644
--- a/common/gal/opengl/opengl_gal.cpp
+++ b/common/gal/opengl/opengl_gal.cpp
@@ -694,7 +694,7 @@ int OPENGL_GAL::BeginGroup()
 {
 isGrouping = true;
 
-boost::shared_ptr newItem( new VERTEX_ITEM( cachedManager ) );
+std::shared_ptr newItem = std::make_shared( cachedManager );
 int groupNumber = getNewGroupNumber();
 groups.insert( std::make_pair( groupNumber, newItem ) );
 
diff --git a/common/geometry/hetriang.cpp b/common/geometry/hetriang.cpp
index e5cf26c..8383a8e 100644
--- a/common/geometry/hetriang.cpp
+++ b/common/geometry/hetriang.cpp
@@ -46,8 +46,8 @@
 #include 
 #include 
 #include 
-#include 
 #include 
+#include 
 
 using namespace hed;
 
@@ -127,22 +127,22 @@ EDGE_PTR TRIANGULATION::InitTwoEnclosingTriangles( NODES_CONTAINER::iterator aFi
 double dx = ( xmax - xmin ) / fac;
 double dy = ( ymax - ymin ) / fac;
 
-NODE_PTR n1 = boost::make_shared( xmin - dx, ymin - dy );
-NODE_PTR n2 = boost::make_shared( xmax + dx, ymin - dy );
-NODE_PTR n3 = boost::make_shared( xmax + dx, ymax + dy );
-NODE_PTR n4 = boost::make_shared( xmin - dx, ymax + dy );
+NODE_PTR n1 = std::make_shared( xmin - dx, ymin - dy );
+NODE_PTR n2 = std::make_shared( xmax + dx, ymin - dy );
+NODE_PTR n3 = std::make_shared( xmax + dx, ymax + dy );
+NODE_PTR n4 = std::make_shared( xmin - dx, ymax + dy );
 
 // diagonal
-EDGE_PTR e1d = boost::make_shared();
-EDGE_PTR e2d = boost::make_shared();
+EDGE_PTR e1d = std::make_shared();
+EDGE_PTR e2d = std::make_shared();
 
 // lower triangle
-EDGE_PTR e11 = boost::make_shared();
-EDGE_PTR e12 = boost::make_shared();
+EDGE_PTR e11 = std::make_shared();
+EDGE_PTR e12 = std::make_shared();
 
 // upper triangle
-EDGE_PTR e21 = boost::make_shared();
-EDGE_PTR e22 = boost::make_shared();
+EDGE_PTR e21 = std::make_shared();
+EDGE_PTR e22 = std::make_shared();
 
 // lower triangle
 e1d->SetSourceNode( n3 );
@@ -453,12 +453,12 @@ EDGE_PTR TRIANGULATION::SplitTriangle( EDGE_PTR& aEdge, const NODE_PTR& aPoint )
 EDGE_PTR e3( e2->GetNextEdgeInFace() );
 NODE_PTR n3( e3->GetSourceNode() );
 
-EDGE_PTR e1_n = boost::make_shared();
-EDGE_PTR e11_n = boost::make_shared();
-EDGE_PTR e2_n = boost::make_shared();
-EDGE_PTR e22_n = boost::make_shared();
-EDGE_PTR e3_n = boost::make_shared();
-EDGE_PTR e33_n = boost::make_shared();
+EDGE_PTR e1_n = std::make_shared();
+EDGE_PTR e11_n = std::make_shared();
+EDGE_PTR e2_n = std::make_shared();
+EDGE_PTR e22_n = std::make_shared();
+EDGE_PTR e3_n = std::make_shared();
+EDGE_PTR e33_n = std::make_shared();
 
 e1_n->SetSourceNode( n1 );
 e11_n->SetSourceNode( aPoint );
diff --git a/eeschema/class_libentry.h 

[Kicad-developers] [PATCH 0/3] Deboostify shared_ptr

2016-04-30 Thread Simon Richter
Hi,

now that we have C++11, we can use std::shared_ptr, so we no longer need
boost::shared_ptr.

The overload for shared_ptr is not yet in the standard (expected for
C++17), so shared_array cannot be replaced easily, however we only have a
few instances anyway, two of them never leave their scope (so
std::unique_ptr has the correct semantics), and one is used in place
of a more sensible allocator.

   Simon

Simon Richter (3):
  Replace boost::shared_ptr with std::shared_ptr
  Replace unshared boost::shared_array with std::unique_ptr
  Replace last instance of boost::shared_array

 3d-viewer/3d_mesh_model.h  |  4 ++--
 common/gal/opengl/opengl_gal.cpp   | 16 
 common/geometry/hetriang.cpp   | 34 +-
 eeschema/class_libentry.h  |  7 +++
 eeschema/sch_component.h   |  5 ++---
 include/gal/cairo/cairo_gal.h  |  5 +++--
 include/gal/opengl/opengl_gal.h|  9 -
 include/gal/opengl/vertex_manager.h|  6 +++---
 include/painter.h  |  2 +-
 include/ttl/halfedge/hetriang.h|  9 -
 pcbnew/class_board_connected_item.h|  2 +-
 pcbnew/class_netclass.cpp  |  6 ++
 pcbnew/class_netclass.h|  5 +++--
 pcbnew/dialogs/dialog_design_rules.cpp |  4 +---
 pcbnew/drc_stuff.h |  4 ++--
 pcbnew/legacy_plugin.cpp   |  4 +---
 pcbnew/legacy_plugin.h |  3 ++-
 pcbnew/pcb_painter.h   |  3 ++-
 pcbnew/pcb_parser.cpp  |  4 +---
 pcbnew/ratsnest_data.cpp   | 13 ++---
 pcbnew/ratsnest_data.h |  4 ++--
 pcbnew/router/pns_optimizer.h  |  2 +-
 pcbnew/specctra.h  |  5 +++--
 pcbnew/tools/edit_points.h |  9 +
 pcbnew/tools/point_editor.cpp  |  5 ++---
 pcbnew/tools/point_editor.h|  9 +
 pcbnew/tools/selection_tool.cpp|  2 +-
 27 files changed, 87 insertions(+), 94 deletions(-)

-- 
2.1.4

___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] [PATCH 3/3] Replace last instance of boost::shared_array

2016-04-30 Thread Simon Richter

This is a bit tricky, because the smart pointer is actually used only for
delayed deletion, and no users of the object are involved.

This code could probably be replaced with a pool allocator that flushes the
entire pool after rendering is complete, to improve performance.
---
 common/gal/opengl/opengl_gal.cpp | 10 +-
 include/gal/opengl/opengl_gal.h  |  5 ++---
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/common/gal/opengl/opengl_gal.cpp b/common/gal/opengl/opengl_gal.cpp
index 330e390..7729d0c 100644
--- a/common/gal/opengl/opengl_gal.cpp
+++ b/common/gal/opengl/opengl_gal.cpp
@@ -1167,15 +1167,15 @@ void CALLBACK CombineCallback( GLdouble coords[3],
GLdouble* vertex_data[4],
GLfloat weight[4], GLdouble** dataOut, void* aData )
 {
-GLdouble* vertex = new GLdouble[3];
+std::unique_ptr vertex( new GLdouble[3] );
 OPENGL_GAL::TessParams* param = static_cast( aData );
 
-// Save the pointer so we can delete it later
-param->intersectPoints.push_back( boost::shared_array( vertex ) );
+memcpy( vertex.get(), coords, 3 * sizeof(GLdouble) );
 
-memcpy( vertex, coords, 3 * sizeof(GLdouble) );
+*dataOut = vertex.get();
 
-*dataOut = vertex;
+// Save the pointer so we can delete it later
+param->intersectPoints.emplace_back( std::move( vertex ) );
 }
 
 
diff --git a/include/gal/opengl/opengl_gal.h b/include/gal/opengl/opengl_gal.h
index 37ec5d8..42be14a 100644
--- a/include/gal/opengl/opengl_gal.h
+++ b/include/gal/opengl/opengl_gal.h
@@ -40,7 +40,6 @@
 #include 
 
 #include 
-#include 
 #include 
 
 #ifndef CALLBACK
@@ -244,7 +243,7 @@ public:
 VERTEX_MANAGER* vboManager;
 
 /// Intersect points, that have to be freed after tessellation
-std::deque< boost::shared_array >& intersectPoints;
+std::deque< std::unique_ptr >& intersectPoints;
 } TessParams;
 
 protected:
@@ -288,7 +287,7 @@ private:
 /// The tessellator
 GLUtesselator*  tesselator;
 /// Storage for intersecting points
-std::deque< boost::shared_array > tessIntersects;
+std::deque< std::unique_ptr > tessIntersects;
 
 /**
  * @brief Draw a quad for the line.
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] Optimization

2016-04-28 Thread Simon Richter
Hi,

On 27.04.2016 08:42, Lorenzo Marcantonio wrote:

> First guess is that in modern CPUs pipelining, branch prediction and
> cache locality have a bigger effect than raw computation.

FWIW, the fully optimized code even has the compiler replacing the
separate sin() and cos() invocations by a single call to sincos(),
almost cutting computation time in half by computing both at the same
time using vector instructions.

   Simon




signature.asc
Description: OpenPGP digital signature
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] [PATCH] Use std::atomic for portable locale init counting

2016-05-17 Thread Simon Richter
---
 common/common.cpp | 10 +++---
 include/common.h  |  4 +++-
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/common/common.cpp b/common/common.cpp
index 09a2103..4be1988 100644
--- a/common/common.cpp
+++ b/common/common.cpp
@@ -68,14 +68,12 @@ EDA_COLOR_Tg_GhostColor;
  * is thrown, or not.
  */
 
-int LOCALE_IO::m_c_count = 0;
+std::atomic LOCALE_IO::m_c_count(0);
 
 LOCALE_IO::LOCALE_IO()
 {
-wxASSERT_MSG( m_c_count >= 0, wxT( "LOCALE_IO::m_c_count mismanaged." ) );
-
 // use thread safe, atomic operation
-if( __sync_fetch_and_add( _c_count, 1 ) == 0 )
+if( m_c_count++ == 0 )
 {
 // Store the user locale name, to restore this locale later, in dtor
 m_user_locale = setlocale( LC_ALL, 0 );
@@ -87,13 +85,11 @@ LOCALE_IO::LOCALE_IO()
 LOCALE_IO::~LOCALE_IO()
 {
 // use thread safe, atomic operation
-if( __sync_sub_and_fetch( _c_count, 1 ) == 0 )
+if( --m_c_count == 0 )
 {
 // revert to the user locale
 setlocale( LC_ALL, m_user_locale.c_str() );
 }
-
-wxASSERT_MSG( m_c_count >= 0, wxT( "LOCALE_IO::m_c_count mismanaged." ) );
 }
 
 
diff --git a/include/common.h b/include/common.h
index 97bf56d..70e7379 100644
--- a/include/common.h
+++ b/include/common.h
@@ -42,6 +42,8 @@
 #include 
 #include 
 
+#include 
+
 
 class wxAboutDialogInfo;
 class SEARCH_STACK;
@@ -199,7 +201,7 @@ private:
 void setUserLocale( const char* aUserLocale );
 
 // allow for nesting of LOCALE_IO instantiations
-static int  m_c_count;
+static std::atomic m_c_count;
 
 // The locale in use before switching to the "C" locale
 // (the locale can be set by user, and is not always the system locale)
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] [PATCH] Fix spelling "propage" -> "propagate"

2016-05-17 Thread Simon Richter
---
 eeschema/class_netlist_object.h |  2 +-
 eeschema/netlist.cpp| 16 
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/eeschema/class_netlist_object.h b/eeschema/class_netlist_object.h
index d47ebbd..9608f90 100644
--- a/eeschema/class_netlist_object.h
+++ b/eeschema/class_netlist_object.h
@@ -423,7 +423,7 @@ private:
  * used to interconnect group of items already physically connected,
  * when a new connection is found between aOldNetCode and aNewNetCode
  */
-void propageNetCode( int aOldNetCode, int aNewNetCode, bool aIsBus );
+void propagateNetCode( int aOldNetCode, int aNewNetCode, bool aIsBus );
 
 /*
  * This function merges the net codes of groups of objects already connected
diff --git a/eeschema/netlist.cpp b/eeschema/netlist.cpp
index 8a490e8..f3afe97 100644
--- a/eeschema/netlist.cpp
+++ b/eeschema/netlist.cpp
@@ -635,7 +635,7 @@ void NETLIST_OBJECT_LIST::sheetLabelConnect( NETLIST_OBJECT* SheetLabel )
 
 // Propagate Netcode having all the objects of the same Netcode.
 if( ObjetNet->GetNet() )
-propageNetCode( ObjetNet->GetNet(), SheetLabel->GetNet(), IS_WIRE );
+propagateNetCode( ObjetNet->GetNet(), SheetLabel->GetNet(), IS_WIRE );
 else
 ObjetNet->SetNet( SheetLabel->GetNet() );
 }
@@ -677,7 +677,7 @@ void NETLIST_OBJECT_LIST::connectBusLabels()
 LabelInTst->SetNet( Label->GetNet() );
 else
 // Merge the 2 net codes, they are connected.
-propageNetCode( LabelInTst->GetNet(), Label->GetNet(), IS_WIRE );
+propagateNetCode( LabelInTst->GetNet(), Label->GetNet(), IS_WIRE );
 }
 }
 }
@@ -685,7 +685,7 @@ void NETLIST_OBJECT_LIST::connectBusLabels()
 }
 
 
-void NETLIST_OBJECT_LIST::propageNetCode( int aOldNetCode, int aNewNetCode, bool aIsBus )
+void NETLIST_OBJECT_LIST::propagateNetCode( int aOldNetCode, int aNewNetCode, bool aIsBus )
 {
 if( aOldNetCode == aNewNetCode )
 return;
@@ -747,7 +747,7 @@ void NETLIST_OBJECT_LIST::pointToPointConnect( NETLIST_OBJECT* aRef, bool aIsBus
 if( item->GetNet() == 0 )
 item->SetNet( netCode );
 else
-propageNetCode( item->GetNet(), netCode, IS_WIRE );
+propagateNetCode( item->GetNet(), netCode, IS_WIRE );
 }
 break;
 
@@ -799,7 +799,7 @@ void NETLIST_OBJECT_LIST::pointToPointConnect( NETLIST_OBJECT* aRef, bool aIsBus
 if( item->m_BusNetCode == 0 )
 item->m_BusNetCode = netCode;
 else
-propageNetCode( item->m_BusNetCode, netCode, IS_BUS );
+propagateNetCode( item->m_BusNetCode, netCode, IS_BUS );
 }
 break;
 }
@@ -836,14 +836,14 @@ void NETLIST_OBJECT_LIST::segmentToPointConnect( NETLIST_OBJECT* aJonction,
 if( aIsBus == IS_WIRE )
 {
 if( segment->GetNet() )
-propageNetCode( segment->GetNet(), aJonction->GetNet(), aIsBus );
+propagateNetCode( segment->GetNet(), aJonction->GetNet(), aIsBus );
 else
 segment->SetNet( aJonction->GetNet() );
 }
 else
 {
 if( segment->m_BusNetCode )
-propageNetCode( segment->m_BusNetCode, aJonction->m_BusNetCode, aIsBus );
+propagateNetCode( segment->m_BusNetCode, aJonction->m_BusNetCode, aIsBus );
 else
 segment->m_BusNetCode = aJonction->m_BusNetCode;
 }
@@ -887,7 +887,7 @@ void NETLIST_OBJECT_LIST::labelConnect( NETLIST_OBJECT* aLabelRef )
 continue;
 
 if( item->GetNet() )
-propageNetCode( item->GetNet(), aLabelRef->GetNet(), IS_WIRE );
+propagateNetCode( item->GetNet(), aLabelRef->GetNet(), IS_WIRE );
 else
 item->SetNet( aLabelRef->GetNet() );
 }
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] [PATCH] Schematic Cleanup: Split lines at junctions

2016-05-19 Thread Simon Richter
Hi,

On 20.05.2016 00:25, Thor-Arne wrote:

> Delete wire is on the delete button. and delete segment is on the
> backspace key.

Ah, that makes (some) sense. To me, the behaviour of the delete key
looks fairly nonsensical, because it will stop at corners, but not at
junctions, while I'd expect "delete wire" to do the opposite.

This leaves me with a difficult problem though -- I need net ties to
actually generate different nets on both sides, so I need different
wires that aren't combined in order to get different netlist items, but
this makes the delete key behave differently for net ties.

> Please do NOT change the behavior of the delete buton, it is used all
> the time.

Hm, as said I don't find it that useful, because most of the time it
deletes a connection I still need, but leaves dangling segments. Would
it make sense to replace it with a "delete connection" functionality
that would never leave dangling ends?

This still means I'm going to redo this patch stack -- the structural
changes in the cleanup function still make sense IMO, but the logic is
obviously wrong then.

   Simon




signature.asc
Description: OpenPGP digital signature
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] changing language

2016-05-19 Thread Simon Richter
Hi,

On 19.05.2016 09:42, Marco Ciampa wrote:

> Changing language IMHO should pop-up a dialog warning that some items
> could continue to show as last translation option setting until closing
> and reopening of all kicad sessions.

I'm still not sure why we actually need that option. It is 2016, and all
supported platforms have a central setting for language selection.

   Simon



signature.asc
Description: OpenPGP digital signature
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] [PATCH] Schematic Cleanup: Split lines at junctions

2016-05-19 Thread Simon Richter
---
 eeschema/bus-wire-junction.cpp |  3 +++
 eeschema/sch_screen.cpp| 18 ++
 2 files changed, 21 insertions(+)

diff --git a/eeschema/bus-wire-junction.cpp b/eeschema/bus-wire-junction.cpp
index 44dcdf3..36a416d 100644
--- a/eeschema/bus-wire-junction.cpp
+++ b/eeschema/bus-wire-junction.cpp
@@ -431,6 +431,9 @@ SCH_JUNCTION* SCH_EDIT_FRAME::AddJunction( wxDC* aDC, const wxPoint& aPosition,
 OnModify();
 }
 
+// Split segments at junctions
+GetScreen()->SchematicCleanUp();
+
 return junction;
 }
 
diff --git a/eeschema/sch_screen.cpp b/eeschema/sch_screen.cpp
index bd60012..62577b3 100644
--- a/eeschema/sch_screen.cpp
+++ b/eeschema/sch_screen.cpp
@@ -522,6 +522,24 @@ bool SCH_SCREEN::SchematicCleanUp()
 modified = true;
 }
 }
+else if( lhs_isJunction && rhs_isLine )
+{
+auto lhs_pos = item->GetPosition();
+
+SCH_LINE* rhs_line = (SCH_LINE*) testItem;
+
+auto start_pos = rhs_line->GetStartPoint();
+auto end_pos = rhs_line->GetEndPoint();
+
+if( lhs_pos != start_pos && lhs_pos != end_pos && rhs_line->HitTest( lhs_pos, 0 ) )
+{
+// Split segment at junction
+SCH_LINE* new_line = new SCH_LINE( *rhs_line );
+rhs_line->SetEndPoint( lhs_pos );
+new_line->SetStartPoint( lhs_pos );
+Append( new_line );
+}
+}
 }
 }
 
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] [PATCH v2] Rewrite loop conditions in SchematicCleanUp

2016-05-18 Thread Simon Richter

These are a tiny bit more readable, and do not depend on all branches to
correctly advance the loop variable.
---
 eeschema/sch_screen.cpp | 27 +++
 1 file changed, 7 insertions(+), 20 deletions(-)

diff --git a/eeschema/sch_screen.cpp b/eeschema/sch_screen.cpp
index 43610ba..6ade398 100644
--- a/eeschema/sch_screen.cpp
+++ b/eeschema/sch_screen.cpp
@@ -428,20 +428,19 @@ bool SCH_SCREEN::IsTerminalPoint( const wxPoint& aPosition, int aLayer )
 
 bool SCH_SCREEN::SchematicCleanUp()
 {
-SCH_ITEM* item, * testItem;
 bool  modified = false;
 
-item = m_drawList.begin();
-
-for( ; item; item = item->Next() )
+for( SCH_ITEM* item = m_drawList.begin() ; item; item = item->Next() )
 {
 if( ( item->Type() != SCH_LINE_T ) && ( item->Type() != SCH_JUNCTION_T ) )
 continue;
 
-testItem = item->Next();
+bool restart;
 
-while( testItem )
+for( SCH_ITEM* testItem = item->Next(); testItem; testItem = restart ? m_drawList.begin() : testItem->Next() )
 {
+restart = false;
+
 if( ( item->Type() == SCH_LINE_T ) && ( testItem->Type() == SCH_LINE_T ) )
 {
 SCH_LINE* line = (SCH_LINE*) item;
@@ -451,13 +450,9 @@ bool SCH_SCREEN::SchematicCleanUp()
 // Keep the current flags, because the deleted segment can be flagged.
 item->SetFlags( testItem->GetFlags() );
 DeleteItem( testItem );
-testItem = m_drawList.begin();
+restart = true;
 modified = true;
 }
-else
-{
-testItem = testItem->Next();
-}
 }
 else if ( ( ( item->Type() == SCH_JUNCTION_T )
   && ( testItem->Type() == SCH_JUNCTION_T ) ) && ( testItem != item ) )
@@ -467,17 +462,9 @@ bool SCH_SCREEN::SchematicCleanUp()
 // Keep the current flags, because the deleted segment can be flagged.
 item->SetFlags( testItem->GetFlags() );
 DeleteItem( testItem );
-testItem = m_drawList.begin();
+restart = true;
 modified = true;
 }
-else
-{
-testItem = testItem->Next();
-}
-}
-else
-{
-testItem = testItem->Next();
 }
 }
 }
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] [PATCH] Schematic Cleanup: Split lines at junctions

2016-05-19 Thread Simon Richter
Hi jp,

On 19.05.2016 19:44, jp charras wrote:

> It could be worth to *clearly* explain in your patches what bug you want to 
> fix, or what enhancement
> you are adding.

Good point.

The last batch has two goals:

1. fix a long-standing annoyance that deleting a line segment will
delete the entire length of wire, even when I want to delete only a
short piece. http://psi5.com/~geier/wires.ogv shows what I mean.

2. prepare for net ties -- these need to split nets, so having code in
place to split wires at certain points will have nice synergy effects.

For the most part, I've been posting these as a heads-up and RFC; if the
benefit is obvious, it's fine to apply them, but I'm not unhappy if they
aren't applied immediately, because I'm more interested in things that
are obviously wrong or that I've overlooked, and my patch stack is
rebased on top of the current state every time I update anyway.

"Serious" patch submissions start with a [PATCH 00/nn] mail that doesn't
contain a patch and explains the rationale fully, and have longer
descriptions in each separate patch (and incidentally, it'd be nice to
keep those somehow).

   Simon



signature.asc
Description: OpenPGP digital signature
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] Who is responsible for adding to the eeschema draw list?

2016-05-19 Thread Simon Richter
Hi,

I'm touching a bit of eeschema code and am unsure who is responsible for
adding SCH_ITEM objects to SCH_SCREEN's m_DrawList.

Looking at the AddJunction function, it adds the junction to the draw
list if it is also added to the undo list, while the caller adds it
unconditionally.

Where would be the correct place to add it?

   Simon



signature.asc
Description: OpenPGP digital signature
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] [PATCH] Clarify ERC: we're iterating netlist items, not nets

2016-05-17 Thread Simon Richter
---
 eeschema/dialogs/dialog_erc.cpp | 26 +-
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/eeschema/dialogs/dialog_erc.cpp b/eeschema/dialogs/dialog_erc.cpp
index f9d2ca6..3d0b31d 100644
--- a/eeschema/dialogs/dialog_erc.cpp
+++ b/eeschema/dialogs/dialog_erc.cpp
@@ -492,21 +492,21 @@ void DIALOG_ERC::TestErc( wxArrayString* aMessagesList )
 // Reset the connection type indicator
 objectsConnectedList->ResetConnectionsType();
 
-unsigned lastNet;
-unsigned nextNet = lastNet = 0;
+unsigned lastItem;
+unsigned nextItem = lastItem = 0;
 int MinConn= NOC;
 
-for( unsigned net = 0; net < objectsConnectedList->size(); net++ )
+for( unsigned item = 0; item < objectsConnectedList->size(); item++ )
 {
-if( objectsConnectedList->GetItemNet( lastNet ) !=
-objectsConnectedList->GetItemNet( net ) )
+if( objectsConnectedList->GetItemNet( lastItem ) !=
+objectsConnectedList->GetItemNet( item ) )
 {
 // New net found:
 MinConn= NOC;
-nextNet   = net;
+nextItem   = item;
 }
 
-switch( objectsConnectedList->GetItemType( net ) )
+switch( objectsConnectedList->GetItemType( item ) )
 {
 // These items do not create erc problems
 case NET_ITEM_UNSPECIFIED:
@@ -526,11 +526,11 @@ void DIALOG_ERC::TestErc( wxArrayString* aMessagesList )
 // ERC problems when pin sheets do not match hierarchical labels.
 // Each pin sheet must match a hierarchical label
 // Each hierarchical label must match a pin sheet
-objectsConnectedList->TestforNonOrphanLabel( net, nextNet );
+objectsConnectedList->TestforNonOrphanLabel( item, nextItem );
 break;
 case NET_GLOBLABEL:
 if( m_tstUniqueGlobalLabels )
-objectsConnectedList->TestforNonOrphanLabel( net, nextNet );
+objectsConnectedList->TestforNonOrphanLabel( item, nextItem );
 break;
 
 case NET_NOCONNECT:
@@ -538,19 +538,19 @@ void DIALOG_ERC::TestErc( wxArrayString* aMessagesList )
 // ERC problems when a noconnect symbol is connected to more than one pin.
 MinConn = NET_NC;
 
-if( objectsConnectedList->CountPinsInNet( nextNet ) > 1 )
-Diagnose( objectsConnectedList->GetItem( net ), NULL, MinConn, UNC );
+if( objectsConnectedList->CountPinsInNet( nextItem ) > 1 )
+Diagnose( objectsConnectedList->GetItem( item ), NULL, MinConn, UNC );
 
 break;
 
 case NET_PIN:
 
 // Look for ERC problems between pins:
-TestOthersItems( objectsConnectedList.get(), net, nextNet,  );
+TestOthersItems( objectsConnectedList.get(), item, nextItem,  );
 break;
 }
 
-lastNet = net;
+lastItem = item;
 }
 
 // Test similar labels (i;e. labels which are identical when
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] [PATCH] Explain how ERC works.

2016-05-17 Thread Simon Richter
---
 eeschema/dialogs/dialog_erc.cpp | 9 +
 1 file changed, 9 insertions(+)

diff --git a/eeschema/dialogs/dialog_erc.cpp b/eeschema/dialogs/dialog_erc.cpp
index 9a850e5..681a4db 100644
--- a/eeschema/dialogs/dialog_erc.cpp
+++ b/eeschema/dialogs/dialog_erc.cpp
@@ -496,6 +496,15 @@ void DIALOG_ERC::TestErc( wxArrayString* aMessagesList )
 unsigned nextItem = lastItem = 0;
 MINIMAL_CONNECTION MinConn= NOC;
 
+/** The netlist generated by SCH_EDIT_FRAME::BuildNetListBase is sorted
+ * by net number, which means we can group netlist items into ranges
+ * that live in the same net. The range from nextItem to the current
+ * item (exclusive) needs to be checked against the current item. The
+ * lastItem variable is used as a helper to pass the last item's number
+ * from one loop iteration to the next, which simplifies the initial
+ * pass.
+ */
+
 for( unsigned item = 0; item < objectsConnectedList->size(); item++ )
 {
 if( objectsConnectedList->GetItemNet( lastItem ) !=
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] [PATCH] Check sorting of netlist during ERC

2016-05-17 Thread Simon Richter

The ERC code depends on netlist items to be sorted by net code, so verify
that in debug builds. While this condition is stricter than necessary, it
should still hold with the current code, and provide a good canary if a
change to the sorting code might break ERC.
---
 eeschema/dialogs/dialog_erc.cpp | 11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/eeschema/dialogs/dialog_erc.cpp b/eeschema/dialogs/dialog_erc.cpp
index 681a4db..acb3718 100644
--- a/eeschema/dialogs/dialog_erc.cpp
+++ b/eeschema/dialogs/dialog_erc.cpp
@@ -49,6 +49,9 @@
 #include 
 #include 
 
+#include 
+
+
 extern int   DiagErc[PINTYPE_COUNT][PINTYPE_COUNT];
 extern int   DefaultDiagErc[PINTYPE_COUNT][PINTYPE_COUNT];
 
@@ -507,8 +510,12 @@ void DIALOG_ERC::TestErc( wxArrayString* aMessagesList )
 
 for( unsigned item = 0; item < objectsConnectedList->size(); item++ )
 {
-if( objectsConnectedList->GetItemNet( lastItem ) !=
-objectsConnectedList->GetItemNet( item ) )
+auto lastNet = objectsConnectedList->GetItemNet( lastItem );
+auto net = objectsConnectedList->GetItemNet( item );
+
+wxASSERT_MSG( lastNet <= net, wxT( "Netlist not correctly ordered" ) );
+
+if( lastNet != net )
 {
 // New net found:
 MinConn= NOC;
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] [PATCH 5/5] Schematic cleanup: shortcut if no match can happen

2016-05-18 Thread Simon Richter
---
 eeschema/sch_screen.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/eeschema/sch_screen.cpp b/eeschema/sch_screen.cpp
index 52e86f1..a2655a7 100644
--- a/eeschema/sch_screen.cpp
+++ b/eeschema/sch_screen.cpp
@@ -454,6 +454,9 @@ bool SCH_SCREEN::SchematicCleanUp()
 const bool rhs_isLine = ( rhs_type == SCH_LINE_T );
 const bool rhs_isJunction = (rhs_type == SCH_JUNCTION_T );
 
+if( !( rhs_isLine || rhs_isJunction ) )
+continue;
+
 if( lhs_isLine && rhs_isLine )
 {
 SCH_LINE* line = (SCH_LINE*) item;
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] [PATCH 1/5] Rewrite loop conditions in SchematicCleanUp

2016-05-18 Thread Simon Richter

These are a tiny bit more readable, and do not depend on all branches to
correctly advance the loop variable.
---
 eeschema/sch_screen.cpp | 27 +++
 1 file changed, 7 insertions(+), 20 deletions(-)

diff --git a/eeschema/sch_screen.cpp b/eeschema/sch_screen.cpp
index 43610ba..bb3ebe1 100644
--- a/eeschema/sch_screen.cpp
+++ b/eeschema/sch_screen.cpp
@@ -428,20 +428,19 @@ bool SCH_SCREEN::IsTerminalPoint( const wxPoint& aPosition, int aLayer )
 
 bool SCH_SCREEN::SchematicCleanUp()
 {
-SCH_ITEM* item, * testItem;
 bool  modified = false;
 
-item = m_drawList.begin();
-
-for( ; item; item = item->Next() )
+for( SCH_ITEM* item = m_drawList.begin() ; item; item = item->Next() )
 {
 if( ( item->Type() != SCH_LINE_T ) && ( item->Type() != SCH_JUNCTION_T ) )
 continue;
 
-testItem = item->Next();
+bool restart;
 
-while( testItem )
+for( SCH_ITEM* testItem = item->Next(); testItem; testItem = restart ? m_drawList.begin() : item->Next() )
 {
+restart = false;
+
 if( ( item->Type() == SCH_LINE_T ) && ( testItem->Type() == SCH_LINE_T ) )
 {
 SCH_LINE* line = (SCH_LINE*) item;
@@ -451,13 +450,9 @@ bool SCH_SCREEN::SchematicCleanUp()
 // Keep the current flags, because the deleted segment can be flagged.
 item->SetFlags( testItem->GetFlags() );
 DeleteItem( testItem );
-testItem = m_drawList.begin();
+restart = true;
 modified = true;
 }
-else
-{
-testItem = testItem->Next();
-}
 }
 else if ( ( ( item->Type() == SCH_JUNCTION_T )
   && ( testItem->Type() == SCH_JUNCTION_T ) ) && ( testItem != item ) )
@@ -467,17 +462,9 @@ bool SCH_SCREEN::SchematicCleanUp()
 // Keep the current flags, because the deleted segment can be flagged.
 item->SetFlags( testItem->GetFlags() );
 DeleteItem( testItem );
-testItem = m_drawList.begin();
+restart = true;
 modified = true;
 }
-else
-{
-testItem = testItem->Next();
-}
-}
-else
-{
-testItem = testItem->Next();
 }
 }
 }
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] [PATCH 4/5] Schematic Cleanup: Introduce shorthand for rhs line/junction tests

2016-05-18 Thread Simon Richter
---
 eeschema/sch_screen.cpp | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/eeschema/sch_screen.cpp b/eeschema/sch_screen.cpp
index 182bba7..52e86f1 100644
--- a/eeschema/sch_screen.cpp
+++ b/eeschema/sch_screen.cpp
@@ -449,7 +449,12 @@ bool SCH_SCREEN::SchematicCleanUp()
 if( testItem == item )
 continue;
 
-if( lhs_isLine && ( testItem->Type() == SCH_LINE_T ) )
+const auto rhs_type = testItem->Type();
+
+const bool rhs_isLine = ( rhs_type == SCH_LINE_T );
+const bool rhs_isJunction = (rhs_type == SCH_JUNCTION_T );
+
+if( lhs_isLine && rhs_isLine )
 {
 SCH_LINE* line = (SCH_LINE*) item;
 
@@ -462,7 +467,7 @@ bool SCH_SCREEN::SchematicCleanUp()
 modified = true;
 }
 }
-else if ( ( lhs_isJunction && ( testItem->Type() == SCH_JUNCTION_T ) ) )
+else if ( lhs_isJunction && rhs_isJunction )
 {
 if ( testItem->HitTest( item->GetPosition() ) )
 {
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] [PATCH 3/5] Schematic Cleanup: Move lhs == rhs test to beginning of loop

2016-05-18 Thread Simon Richter
---
 eeschema/sch_screen.cpp | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/eeschema/sch_screen.cpp b/eeschema/sch_screen.cpp
index fd9b9b2..182bba7 100644
--- a/eeschema/sch_screen.cpp
+++ b/eeschema/sch_screen.cpp
@@ -446,6 +446,9 @@ bool SCH_SCREEN::SchematicCleanUp()
 {
 restart = false;
 
+if( testItem == item )
+continue;
+
 if( lhs_isLine && ( testItem->Type() == SCH_LINE_T ) )
 {
 SCH_LINE* line = (SCH_LINE*) item;
@@ -459,8 +462,7 @@ bool SCH_SCREEN::SchematicCleanUp()
 modified = true;
 }
 }
-else if ( ( lhs_isJunction
-  && ( testItem->Type() == SCH_JUNCTION_T ) ) && ( testItem != item ) )
+else if ( ( lhs_isJunction && ( testItem->Type() == SCH_JUNCTION_T ) ) )
 {
 if ( testItem->HitTest( item->GetPosition() ) )
 {
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] [PATCH 2/5] Schematic Cleanup: introduce shorthand for line/junction tests

2016-05-18 Thread Simon Richter
---
 eeschema/sch_screen.cpp | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/eeschema/sch_screen.cpp b/eeschema/sch_screen.cpp
index bb3ebe1..fd9b9b2 100644
--- a/eeschema/sch_screen.cpp
+++ b/eeschema/sch_screen.cpp
@@ -432,7 +432,12 @@ bool SCH_SCREEN::SchematicCleanUp()
 
 for( SCH_ITEM* item = m_drawList.begin() ; item; item = item->Next() )
 {
-if( ( item->Type() != SCH_LINE_T ) && ( item->Type() != SCH_JUNCTION_T ) )
+const auto lhs_type = item->Type();
+
+const bool lhs_isLine = ( lhs_type == SCH_LINE_T );
+const bool lhs_isJunction = (lhs_type == SCH_JUNCTION_T );
+
+if( !( lhs_isLine || lhs_isJunction ) )
 continue;
 
 bool restart;
@@ -441,7 +446,7 @@ bool SCH_SCREEN::SchematicCleanUp()
 {
 restart = false;
 
-if( ( item->Type() == SCH_LINE_T ) && ( testItem->Type() == SCH_LINE_T ) )
+if( lhs_isLine && ( testItem->Type() == SCH_LINE_T ) )
 {
 SCH_LINE* line = (SCH_LINE*) item;
 
@@ -454,7 +459,7 @@ bool SCH_SCREEN::SchematicCleanUp()
 modified = true;
 }
 }
-else if ( ( ( item->Type() == SCH_JUNCTION_T )
+else if ( ( lhs_isJunction
   && ( testItem->Type() == SCH_JUNCTION_T ) ) && ( testItem != item ) )
 {
 if ( testItem->HitTest( item->GetPosition() ) )
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] [PATCH] SCH_LINE: Split mergeability test and actual merge

2016-05-18 Thread Simon Richter
---
 eeschema/sch_line.cpp   | 58 ++---
 eeschema/sch_line.h | 16 ++
 eeschema/sch_screen.cpp |  3 ++-
 3 files changed, 45 insertions(+), 32 deletions(-)

diff --git a/eeschema/sch_line.cpp b/eeschema/sch_line.cpp
index 72efb5c..372885b 100644
--- a/eeschema/sch_line.cpp
+++ b/eeschema/sch_line.cpp
@@ -284,7 +284,7 @@ bool sort_by_ends_position(const wxPoint * ref, const wxPoint * tst )
  * MergeOverlap try to merge 2 lines that are colinear.
  * this function expects these 2 lines have at least a common end
  */
-bool SCH_LINE::MergeOverlap( SCH_LINE* aLine )
+bool SCH_LINE::CanMerge( const SCH_LINE* aLine ) const
 {
 wxCHECK_MSG( aLine != NULL && aLine->Type() == SCH_LINE_T, false,
  wxT( "Cannot test line segment for overlap." ) );
@@ -292,22 +292,25 @@ bool SCH_LINE::MergeOverlap( SCH_LINE* aLine )
 if( this == aLine || GetLayer() != aLine->GetLayer() )
 return false;
 
+auto rhs_start = aLine->m_start;
+auto rhs_end = aLine->m_end;
+
 // Search for a common end:
-if( m_start == aLine->m_start )
+if( m_start == rhs_start )
 {
-if( m_end == aLine->m_end ) // Trivial case
+if( m_end == rhs_end ) // Trivial case
 return true;
 }
-else if( m_start == aLine->m_end )
+else if( m_start == rhs_end )
 {
-if( m_end == aLine->m_start ) // Trivial case
+if( m_end == rhs_start ) // Trivial case
 return true;
 }
-else if( m_end == aLine->m_end )
+else if( m_end == rhs_end )
 {
-std::swap( aLine->m_start, aLine->m_end );
+std::swap( rhs_start, rhs_end );
 }
-else if( m_end != aLine->m_start )
+else if( m_end != rhs_start )
 {
 // No common end point, segments cannot be merged.
 return false;
@@ -318,14 +321,14 @@ bool SCH_LINE::MergeOverlap( SCH_LINE* aLine )
 /* Test alignment: */
 if( m_start.y == m_end.y )   // Horizontal segment
 {
-if( aLine->m_start.y == aLine->m_end.y )
+if( rhs_start.y == rhs_end.y )
 {
 colinear = true;
 }
 }
 else if( m_start.x == m_end.x )  // Vertical segment
 {
-if( aLine->m_start.x == aLine->m_end.x )
+if( rhs_start.x == rhs_end.x )
 {
 colinear = true;
 }
@@ -333,32 +336,33 @@ bool SCH_LINE::MergeOverlap( SCH_LINE* aLine )
 else
 {
 if( atan2( (double) ( m_start.x - m_end.x ), (double) ( m_start.y - m_end.y ) )
-== atan2( (double) ( aLine->m_start.x - aLine->m_end.x ),
-  (double) ( aLine->m_start.y - aLine->m_end.y ) ) )
+== atan2( (double) ( rhs_start.x - rhs_end.x ),
+  (double) ( rhs_start.y - rhs_end.y ) ) )
 {
 colinear = true;
 }
 }
 
+return colinear;
+}
+
+
+void SCH_LINE::MergeOverlap( SCH_LINE* aLine )
+{
 // Make a segment which merge the 2 segments
 // we must find the extremums
 // i.e. the more to the left and to the right points, or
 // for horizontal segments the uppermost and the lowest point
-if( colinear )
-{
-static std::vector  candidates;
-candidates.clear();
-candidates.push_back( _start );
-candidates.push_back( _end );
-candidates.push_back( >m_start );
-candidates.push_back( >m_end );
-sort( candidates.begin(), candidates.end(), sort_by_ends_position );
-wxPoint tmp = *candidates[3];
-m_start = *candidates[0];
-m_end = tmp;
-return true;
-}
-return false;
+std::vector  candidates;
+candidates.reserve(4);
+candidates.push_back( _start );
+candidates.push_back( _end );
+candidates.push_back( >m_start );
+candidates.push_back( >m_end );
+sort( candidates.begin(), candidates.end(), sort_by_ends_position );
+wxPoint tmp = *candidates[3];
+m_start = *candidates[0];
+m_end = tmp;
 }
 
 
diff --git a/eeschema/sch_line.h b/eeschema/sch_line.h
index e52280c..a35d899 100644
--- a/eeschema/sch_line.h
+++ b/eeschema/sch_line.h
@@ -102,16 +102,24 @@ public:
 virtual void Rotate( wxPoint aPosition ) override;
 
 /**
- * Check line against \a aLine to see if it overlaps and merge if it does.
+ * Check line against \a aLine to see if it overlaps.
+ * @param[in]   aLine   Line to be compared
+ * @return  whether lines can be merged
+ */
+bool CanMerge( const SCH_LINE* aLine ) const;
+
+/**
+ * Merge line with \a aLine
  *
  * This method will change the line to be equivalent of the line and \a aLine if the
  * two lines overlap.  This method is used to merge multiple line segments into a single
  * line.
  *
- * @param aLine - Line to compare.
- * @return True if lines overlap and the line was merged with \a aLine.
+ * This function will 

Re: [Kicad-developers] [PATCH] Rework OpenSSL mutex workaround

2016-05-05 Thread Simon Richter
Hi Wayne,

On 05.05.2016 22:51, Wayne Stambaugh wrote:

> Is this patch for the stable branch, the product branch, or both?

Currently, for the product branch, and ideally it should be trivial to
backport to the stable branch afterwards (it removes a lot of code that
doesn't exist in the stable branch).

I'd probably wait pushing the avhttp -> curl changes to the stable
branch until this has gotten sufficient eyeballs so we can introduce it
without a regression on old Macs.

   Simon



signature.asc
Description: OpenPGP digital signature
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] [PATCH] Rework OpenSSL mutex workaround

2016-05-05 Thread Simon Richter

This allows compiling KiCad without OpenSSL. If CURL uses OpenSSL in the
background, we serialize requests to avoid a bug there, which degrades
performance. Given that no one should link KiCad against OpenSSL really
because of licence conflicts, this is not so bad.
---
 common/CMakeLists.txt |   5 --
 common/kicad_curl/kicad_curl.cpp  | 161 --
 common/kicad_curl/kicad_curl_easy.cpp |  23 +++--
 include/kicad_curl/kicad_curl.h   |  17 
 include/kicad_curl/kicad_curl_easy.h  |   5 ++
 5 files changed, 22 insertions(+), 189 deletions(-)

diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt
index 61255cf..c064a2d 100644
--- a/common/CMakeLists.txt
+++ b/common/CMakeLists.txt
@@ -14,11 +14,6 @@ include_directories(
 )
 
 
-if( NOT APPLE ) # windows and linux use openssl under curl
-find_package( OpenSSL REQUIRED )
-endif()
-
-
 # Generate header files containing shader programs
 # Order of input files is significant
 add_custom_command(
diff --git a/common/kicad_curl/kicad_curl.cpp b/common/kicad_curl/kicad_curl.cpp
index fb4413c..0b25360 100644
--- a/common/kicad_curl/kicad_curl.cpp
+++ b/common/kicad_curl/kicad_curl.cpp
@@ -32,172 +32,11 @@
 
 #include 
 #include 
-#include// MUTEX and MUTLOCK
 #include 
 
 
-
-// These are even more private than class members, and since there is only
-// one instance of KICAD_CURL ever, these statics are hidden here to simplify the
-// client (API) header file.
-static volatile bool s_initialized;
-
-static MUTEX s_lock;// for s_initialized
-
-// Assume that on these platforms libcurl uses OpenSSL
-#if defined(__linux__) || defined(__MINGW32__)
-
-#include 
-
-static MUTEX* s_crypto_locks;
-
-static void lock_callback( int mode, int type, const char* file, int line )
-{
-(void)file;
-(void)line;
-
-wxASSERT( s_crypto_locks && unsigned( type ) < unsigned( CRYPTO_num_locks() ) );
-
-//DBG( printf( "%s: mode=0x%x type=%d file=%s line=%d\n", __func__, mode, type, file, line );)
-
-if( mode & CRYPTO_LOCK )
-{
-s_crypto_locks[ type ].lock();
-}
-else
-{
-s_crypto_locks[ type ].unlock();
-}
-}
-
-
-static void init_locks()
-{
-s_crypto_locks = new MUTEX[ CRYPTO_num_locks() ];
-
-// From http://linux.die.net/man/3/crypto_set_id_callback:
-
-/*
-
-OpenSSL can safely be used in multi-threaded applications provided that at
-least two callback functions are set, locking_function and threadid_func.
-
-locking_function(int mode, int n, const char *file, int line) is needed to
-perform locking on shared data structures. (Note that OpenSSL uses a number
-of global data structures that will be implicitly shared whenever multiple
-threads use OpenSSL.) Multi-threaded applications will crash at random if it
-is not set.
-
-threadid_func( CRYPTO_THREADID *id) is needed to record the
-currently-executing thread's identifier into id. The implementation of this
-callback should not fill in id directly, but should use
-CRYPTO_THREADID_set_numeric() if thread IDs are numeric, or
-CRYPTO_THREADID_set_pointer() if they are pointer-based. If the application
-does not register such a callback using CRYPTO_THREADID_set_callback(), then
-a default implementation is used - on Windows and BeOS this uses the
-system's default thread identifying APIs, and on all other platforms it uses
-the address of errno. The latter is satisfactory for thread-safety if and
-only if the platform has a thread-local error number facility.
-
-Dick: "sounds like CRYPTO_THREADID_set_callback() is not mandatory on our
-2 OpenSSL platforms."
-
-*/
-
-CRYPTO_set_locking_callback( _callback );
-}
-
-
-static void kill_locks()
-{
-CRYPTO_set_locking_callback( NULL );
-
-delete[] s_crypto_locks;
-
-s_crypto_locks = NULL;
-}
-
-#else
-
-inline void init_locks(){ /* dummy */ }
-inline void kill_locks(){ /* dummy */ }
-
-#endif
-
-/// At process termination, using atexit() keeps the CURL stuff out of the
-/// singletops and PGM_BASE.
-static void at_terminate()
-{
-KICAD_CURL::Cleanup();
-}
-
-
-void KICAD_CURL::Init()
-{
-// We test s_initialized twice in an effort to avoid
-// unnecessarily locking s_lock.  This understands that the common case
-// will not need to lock.
-if( !s_initialized )
-{
-MUTLOCK lock( s_lock );
-
-if( !s_initialized )
-{
-if( curl_global_init( CURL_GLOBAL_ALL ) != CURLE_OK )
-{
-THROW_IO_ERROR( "curl_global_init() failed." );
-}
-
-init_locks();
-
-wxLogDebug( "Using %s", GetVersion() );
-
-s_initialized = true;
-}
-}
-}
-
-
-void KICAD_CURL::Cleanup()
-{
-/*
-
-Calling MUTLOCK() from a static destructor will typically be bad, since the
-s_lock may already have been statically destroyed 

Re: [Kicad-developers] [PATCH 0/4] Backport libcurl code from development branch

2016-05-05 Thread Simon Richter
Hi,

On 05.05.2016 20:01, Bernhard Stegmaier wrote:

> Just a note… I may be wrong, but I guess for OS X this is only true if you 
> build against the curl supplied by OS X natively?

Would it make sense to serialize the network accesses if libcurl tells
us that it is using the OpenSSL backend (at runtime)? That way, we
wouldn't need to use any OpenSSL interface from KiCad, so we get rid of
the dependency completely.

This would mean that accesses are slow if you use curl+openssl, but that
is essentially user choice, because distros are not supposed to ship
this combination anyway.

I'd also love to drop OpenSSL from the Windows builds, because Jenkins
spends quite some time on keeping that current.

   Simon



signature.asc
Description: OpenPGP digital signature
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] [PATCH 1/4] Warn about missing override specifiers, if supported (gcc 5.1, clang 3.5)

2016-05-01 Thread Simon Richter
---
 CMakeLists.txt | 12 
 1 file changed, 12 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index f077de3..130b1cc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -152,6 +152,18 @@ if( CMAKE_VERSION VERSION_LESS 3.1 AND ( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_C
 endif()
 
 
+# Warn about missing override specifiers, if supported
+if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
+include(CheckCXXCompilerFlag)
+
+CHECK_CXX_COMPILER_FLAG("-Wsuggest-override" COMPILER_SUPPORTS_WSUGGEST_OVERRIDE)
+
+if(COMPILER_SUPPORTS_WSUGGEST_OVERRIDE)
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wsuggest-override")
+endif()
+endif()
+
+
 #
 # Set flags for GCC, or treat llvm as GCC
 #
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] [PATCH 0/4] Use of "virtual" and "override" keywords

2016-05-01 Thread Simon Richter
Hi,

C++ has a misfeature where methods in derived classes can be virtual
without that being immediately obvious, which makes class definitions a bit
harder to read than strictly necessary because it isn't immediately obvious
what is happening.

In C++11, this is still the case, but at least we can use "override"
specifiers in method declarations to mark overriding functions, and get a
check from the compiler that this is indeed an override -- so if you are
intending to write an override but forget a const-qualifier somewhere, you
get a proper compilation error.

This patchset

 - enables a warning on compilers that support this
 - removes the compiler flags override in the 3d_cache subdirectory
   (this causes all kinds of other interesting issues)
 - adds the "virtual" keyword on all implicitly virtual methods
 - adds the "override" specifier on all overriding methods

   Simon

Simon Richter (4):
  Warn about missing override specifiers, if supported (gcc 5.1, clang
3.5)
  Don't clear compiler flags in 3d_cache directory
  Add "virtual" keyword on implicitly virtual methods
  Add C++11 "override" specifier to overrides

 3d-viewer/3d_cache/CMakeLists.txt  |   2 -
 3d-viewer/3d_cache/dialogs/dlg_3d_pathconfig.h |  10 +-
 3d-viewer/3d_cache/dialogs/dlg_select_3dmodel.h|   2 +-
 3d-viewer/3d_cache/dialogs/panel_prev_model.h  |   2 +-
 3d-viewer/3d_cache/sg/scenegraph.h |  20 +-
 3d-viewer/3d_cache/sg/sg_appearance.h  |  20 +-
 3d-viewer/3d_cache/sg/sg_colors.h  |  20 +-
 3d-viewer/3d_cache/sg/sg_coords.h  |  20 +-
 3d-viewer/3d_cache/sg/sg_faceset.h |  20 +-
 3d-viewer/3d_cache/sg/sg_index.h   |  20 +-
 3d-viewer/3d_cache/sg/sg_normals.h |  20 +-
 3d-viewer/3d_cache/sg/sg_shape.h   |  20 +-
 3d-viewer/3d_draw.cpp  |   2 +-
 3d-viewer/3d_material.h|   4 +-
 .../3d_render_ogl_legacy/c3d_render_ogl_legacy.h   |   4 +-
 .../3d_render_raytracing/accelerators/ccontainer.h |   4 +-
 .../accelerators/ccontainer2d.h|   4 +-
 .../3d_rendering/3d_render_raytracing/cmaterial.h  |   2 +-
 .../shapes2D/cfilledcircle2d.h |  10 +-
 .../3d_render_raytracing/shapes2D/cpolygon2d.h |  20 +-
 .../3d_render_raytracing/shapes2D/cpolygon4pts2d.h |  10 +-
 .../3d_render_raytracing/shapes2D/cring2d.h|  10 +-
 .../shapes2D/croundsegment2d.h |  10 +-
 .../3d_render_raytracing/shapes2D/ctriangle2d.h|  10 +-
 3d-viewer/3d_rendering/ctrack_ball.h   |  10 +-
 3d-viewer/3d_struct.h  |   6 +-
 3d-viewer/3d_viewer.h  |   4 +-
 3d-viewer/dialogs/dialog_3D_view_option.cpp|   8 +-
 3d-viewer/modelparsers.h   |   4 +-
 CMakeLists.txt |  12 ++
 bitmap2component/bitmap2cmp_gui.cpp|  22 +-
 common/confirm.cpp |   6 +-
 common/dialogs/dialog_image_editor.h   |  18 +-
 common/dialogs/dialog_page_settings.h  |  30 +--
 common/dialogs/wx_html_report_panel.h  |  14 +-
 common/single_top.cpp  |  12 +-
 cvpcb/class_DisplayFootprintsFrame.h   |  30 +--
 cvpcb/cvpcb.cpp|   8 +-
 cvpcb/cvpcb_mainframe.h|  10 +-
 cvpcb/dialogs/dialog_config_equfiles.h |  14 +-
 cvpcb/dialogs/dialog_display_options.h |   8 +-
 cvpcb/dialogs/fp_conflict_assignment_selector.h|  10 +-
 cvpcb/listview_classes.h   |   6 +-
 eeschema/class_libentry.h  |   8 +-
 eeschema/class_sch_screen.h|   6 +-
 eeschema/dialogs/dialog_annotate.cpp   |   6 +-
 eeschema/dialogs/dialog_bom.cpp|  20 +-
 eeschema/dialogs/dialog_choose_component.h |  18 +-
 eeschema/dialogs/dialog_edit_component_in_lib.h|  22 +-
 .../dialogs/dialog_edit_component_in_schematic.cpp |  24 +--
 eeschema/dialogs/dialog_edit_label.cpp |  10 +-
 .../dialogs/dialog_edit_libentry_fields_in_lib.cpp |  20 +-
 eeschema/dialogs/dialog_edit_one_field.h   |  12 +-
 eeschema/dialogs/dialog_eeschema_config.cpp|  20 +-
 eeschema/dialogs/dialog_eeschema_options.h |  10 +-
 eeschema/dialogs/dialog_erc.h  |  14 +-
 eeschema/dialogs/dialog_lib_edit_pin.h |  12 +-
 eeschema/dialogs/dialog_lib_edit_pin_table.cpp |  38 ++--
 eeschema/dialogs/dialog_lib_edit_pin_table.h   |   2 +-
 eeschema/dialogs/dialog_lib_edit_text.h|   4 +-
 eeschema/dialogs/dialog_lib_new_component.h|   4 +-
 eeschema/dialogs/dialog_netlist.cpp|  16 +-
 eesche

[Kicad-developers] [PATCH 2/4] Don't clear compiler flags in 3d_cache directory

2016-05-01 Thread Simon Richter
---
 3d-viewer/3d_cache/CMakeLists.txt | 2 --
 1 file changed, 2 deletions(-)

diff --git a/3d-viewer/3d_cache/CMakeLists.txt b/3d-viewer/3d_cache/CMakeLists.txt
index 82ed6de..cc06e9d 100644
--- a/3d-viewer/3d_cache/CMakeLists.txt
+++ b/3d-viewer/3d_cache/CMakeLists.txt
@@ -1,3 +1 @@
-# unset CMAKE_CXX_FLAGS because it's contaminated with too many options
-set( CMAKE_CXX_FLAGS "" )
 add_subdirectory( sg )
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] [PATCH 4/4] Remove unused FindOpenSSL.cmake

2016-05-05 Thread Simon Richter
---
 CMakeModules/FindOpenSSL.cmake | 342 -
 1 file changed, 342 deletions(-)
 delete mode 100644 CMakeModules/FindOpenSSL.cmake

diff --git a/CMakeModules/FindOpenSSL.cmake b/CMakeModules/FindOpenSSL.cmake
deleted file mode 100644
index de91787..000
--- a/CMakeModules/FindOpenSSL.cmake
+++ /dev/null
@@ -1,342 +0,0 @@
-#.rst:
-# FindOpenSSL
-# ---
-#
-# Try to find the OpenSSL encryption library
-#
-# Once done this will define
-#
-# ::
-#
-#   OPENSSL_ROOT_DIR - Set this variable to the root installation of OpenSSL
-#
-#
-#
-# Read-Only variables:
-#
-# ::
-#
-#   OPENSSL_FOUND - system has the OpenSSL library
-#   OPENSSL_INCLUDE_DIR - the OpenSSL include directory
-#   OPENSSL_LIBRARIES - The libraries needed to use OpenSSL
-#   OPENSSL_VERSION - This is set to $major.$minor.$revision$path (eg. 0.9.8s)
-
-#=
-# Copyright 2006-2009 Kitware, Inc.
-# Copyright 2006 Alexander Neundorf 
-# Copyright 2009-2011 Mathieu Malaterre 
-#
-# Distributed under the OSI-approved BSD License (the "License");
-# see accompanying file Copyright.txt for details.
-#
-# This software is distributed WITHOUT ANY WARRANTY; without even the
-# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the License for more information.
-#=
-# (To distribute this file outside of CMake, substitute the full
-#  License text for the above reference.)
-
-if (UNIX)
-  find_package(PkgConfig QUIET)
-  pkg_check_modules(_OPENSSL QUIET openssl)
-endif ()
-
-if (WIN32)
-  # http://www.slproweb.com/products/Win32OpenSSL.html
-  set(_OPENSSL_ROOT_HINTS
-${OPENSSL_ROOT_DIR}
-"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]"
-"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (64-bit)_is1;Inno Setup: App Path]"
-ENV OPENSSL_ROOT_DIR
-)
-  file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _programfiles)
-  set(_OPENSSL_ROOT_PATHS
-"${_programfiles}/OpenSSL"
-"${_programfiles}/OpenSSL-Win32"
-"${_programfiles}/OpenSSL-Win64"
-"C:/OpenSSL/"
-"C:/OpenSSL-Win32/"
-"C:/OpenSSL-Win64/"
-)
-  unset(_programfiles)
-else ()
-  set(_OPENSSL_ROOT_HINTS
-${OPENSSL_ROOT_DIR}
-ENV OPENSSL_ROOT_DIR
-)
-endif ()
-
-set(_OPENSSL_ROOT_HINTS_AND_PATHS
-HINTS ${_OPENSSL_ROOT_HINTS}
-PATHS ${_OPENSSL_ROOT_PATHS}
-)
-
-find_path(OPENSSL_INCLUDE_DIR
-  NAMES
-openssl/ssl.h
-${_OPENSSL_ROOT_HINTS_AND_PATHS}
-  HINTS
-${_OPENSSL_INCLUDEDIR}
-  PATH_SUFFIXES
-include
-)
-
-if(WIN32 AND NOT CYGWIN)
-  if(MSVC)
-# /MD and /MDd are the standard values - if someone wants to use
-# others, the libnames have to change here too
-# use also ssl and ssleay32 in debug as fallback for openssl < 0.9.8b
-# TODO: handle /MT and static lib
-# In Visual C++ naming convention each of these four kinds of Windows libraries has it's standard suffix:
-#   * MD for dynamic-release
-#   * MDd for dynamic-debug
-#   * MT for static-release
-#   * MTd for static-debug
-
-# Implementation details:
-# We are using the libraries located in the VC subdir instead of the parent directory eventhough :
-# libeay32MD.lib is identical to ../libeay32.lib, and
-# ssleay32MD.lib is identical to ../ssleay32.lib
-find_library(LIB_EAY_DEBUG
-  NAMES
-libeay32MDd
-libeay32d
-${_OPENSSL_ROOT_HINTS_AND_PATHS}
-  PATH_SUFFIXES
-"lib"
-"VC"
-"lib/VC"
-)
-
-find_library(LIB_EAY_RELEASE
-  NAMES
-libeay32MD
-libeay32
-${_OPENSSL_ROOT_HINTS_AND_PATHS}
-  PATH_SUFFIXES
-"lib"
-"VC"
-"lib/VC"
-)
-
-find_library(SSL_EAY_DEBUG
-  NAMES
-ssleay32MDd
-ssleay32d
-${_OPENSSL_ROOT_HINTS_AND_PATHS}
-  PATH_SUFFIXES
-"lib"
-"VC"
-"lib/VC"
-)
-
-find_library(SSL_EAY_RELEASE
-  NAMES
-ssleay32MD
-ssleay32
-ssl
-${_OPENSSL_ROOT_HINTS_AND_PATHS}
-  PATH_SUFFIXES
-"lib"
-"VC"
-"lib/VC"
-)
-
-set(LIB_EAY_LIBRARY_DEBUG "${LIB_EAY_DEBUG}")
-set(LIB_EAY_LIBRARY_RELEASE "${LIB_EAY_RELEASE}")
-set(SSL_EAY_LIBRARY_DEBUG "${SSL_EAY_DEBUG}")
-set(SSL_EAY_LIBRARY_RELEASE "${SSL_EAY_RELEASE}")
-
-include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
-select_library_configurations(LIB_EAY)
-select_library_configurations(SSL_EAY)
-
-mark_as_advanced(LIB_EAY_LIBRARY_DEBUG LIB_EAY_LIBRARY_RELEASE
- SSL_EAY_LIBRARY_DEBUG SSL_EAY_LIBRARY_RELEASE)
-set( OPENSSL_LIBRARIES ${SSL_EAY_LIBRARY} ${LIB_EAY_LIBRARY} )
-  

[Kicad-developers] [PATCH 0/4] Backport libcurl code from development branch

2016-05-05 Thread Simon Richter
Hi,

this backports Mark's avhttp -> libcurl transition to the stable series.
With these, I've been able to build a stable version of KiCad with the
GitHub plugin enabled that does not link against OpenSSL, which should
allow everyone to ship binaries with the Github plugin enabled.

   Simon

Mark Roszko (2):
  Replace the avhttp library used by the github plugin with libcurl.
  Replace avhttp with libcurl: Some fixes: 1. Fixed an assumption
somebody originally made in the plugin that std::string had
contiguous storage. This is not specced behavior pre C++11 so we
gamble by calling .reserve() which should give a far better
guarantee. 2. Added copy to clipboard information for curl
3. Removed some openssl references in compiling.md 4. Renamed
struct vars to be uppercase to match "public var" code style policy

Simon Richter (2):
  Add missing dependency github_plugin -> pcbcommon
  Remove unused FindOpenSSL.cmake


 CMakeLists.txt |   5 +
 CMakeModules/FindOpenSSL.cmake | 342 -
 Documentation/development/compiling.md |  12 +-
 common/CMakeLists.txt  |   6 +-
 common/basicframe.cpp  |   3 +
 common/kicad_curl/kicad_curl.cpp   |  80 
 common/kicad_curl/kicad_curl_easy.cpp  | 163 
 common/pgm_base.cpp|   9 +
 include/kicad_curl/kicad_curl.h|  89 +
 include/kicad_curl/kicad_curl_easy.h   | 166 
 pcbnew/CMakeLists.txt  |   2 +
 pcbnew/github/CMakeLists.txt   |  41 +---
 pcbnew/github/github_getliblist.cpp|  69 ---
 pcbnew/github/github_getliblist.h  |   4 +-
 pcbnew/github/github_plugin.cpp| 152 +++
 pcbnew/github/github_plugin.h  |   6 +-
 16 files changed, 601 insertions(+), 548 deletions(-)
 delete mode 100644 CMakeModules/FindOpenSSL.cmake
 create mode 100644 common/kicad_curl/kicad_curl.cpp
 create mode 100644 common/kicad_curl/kicad_curl_easy.cpp
 create mode 100644 include/kicad_curl/kicad_curl.h
 create mode 100644 include/kicad_curl/kicad_curl_easy.h

-- 
2.1.4

___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] [PATCH 1/4] Replace the avhttp library used by the github plugin with libcurl.

2016-05-05 Thread Simon Richter

From: Mark Roszko 

---
 CMakeLists.txt|   5 +
 common/CMakeLists.txt |   6 +-
 common/kicad_curl/kicad_curl.cpp  |  54 +++
 common/kicad_curl/kicad_curl_easy.cpp | 163 +
 common/pgm_base.cpp   |   9 ++
 include/kicad_curl/kicad_curl.h   |  82 +
 include/kicad_curl/kicad_curl_easy.h  | 166 ++
 pcbnew/github/CMakeLists.txt  |  39 +---
 pcbnew/github/github_getliblist.cpp   |  68 +++---
 pcbnew/github/github_getliblist.h |   4 +-
 pcbnew/github/github_plugin.cpp   | 151 ++-
 pcbnew/github/github_plugin.h |   6 +-
 12 files changed, 560 insertions(+), 193 deletions(-)
 create mode 100644 common/kicad_curl/kicad_curl.cpp
 create mode 100644 common/kicad_curl/kicad_curl_easy.cpp
 create mode 100644 include/kicad_curl/kicad_curl.h
 create mode 100644 include/kicad_curl/kicad_curl_easy.h

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6e44994..20f2d96 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -550,6 +550,11 @@ if( NOT GLEW_FOUND )
 check_find_package_result( GLEW_FOUND "GLEW" )
 endif()
 
+#
+# Find CURL library #
+#
+find_package( CURL REQUIRED )
+
 ##
 # Find Cairo library #
 ##
diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt
index 46708f7..cce78ed 100644
--- a/common/CMakeLists.txt
+++ b/common/CMakeLists.txt
@@ -4,6 +4,7 @@ include_directories(
 ./dialog_about
 ${CAIRO_INCLUDE_DIR}
 ${GLEW_INCLUDE_DIR}
+${CURL_INCLUDE_DIRS}
 ../3d-viewer
 ../pcbnew
 ../polygon
@@ -252,6 +253,9 @@ endif()
 
 set( COMMON_SRCS
 ${COMMON_SRCS}
+kicad_curl/kicad_curl.cpp
+kicad_curl/kicad_curl_easy.cpp
+
 view/view.cpp
 view/view_item.cpp
 view/view_group.cpp
@@ -277,7 +281,7 @@ set( COMMON_SRCS
 add_library( common STATIC ${COMMON_SRCS} )
 add_dependencies( common lib-dependencies )
 add_dependencies( common version_header )
-target_link_libraries( common ${Boost_LIBRARIES} )
+target_link_libraries( common ${Boost_LIBRARIES} ${CURL_LIBRARIES} )
 
 
 set( PCB_COMMON_SRCS
diff --git a/common/kicad_curl/kicad_curl.cpp b/common/kicad_curl/kicad_curl.cpp
new file mode 100644
index 000..7424eec
--- /dev/null
+++ b/common/kicad_curl/kicad_curl.cpp
@@ -0,0 +1,54 @@
+/*
+ * This program source code file is part of KiCad, a free EDA CAD application.
+ *
+ * Copyright (C) 2015 Mark Roszko 
+ * 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 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, 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 
+
+bool KICAD_CURL::Init()
+{
+if ( curl_global_init( CURL_GLOBAL_ALL ) != CURLE_OK )
+{
+return false;
+}
+else
+{
+m_initialized = true;
+return true;
+}
+}
+
+
+void KICAD_CURL::Cleanup()
+{
+if( m_initialized )
+curl_global_cleanup();
+}
+
+
+std::string KICAD_CURL::GetVersion()
+{
+return std::string( curl_version() );
+}
+
+
+bool KICAD_CURL::m_initialized = false;
\ No newline at end of file
diff --git a/common/kicad_curl/kicad_curl_easy.cpp b/common/kicad_curl/kicad_curl_easy.cpp
new file mode 100644
index 000..71a410d
--- /dev/null
+++ b/common/kicad_curl/kicad_curl_easy.cpp
@@ -0,0 +1,163 @@
+/*
+ * This program source code file is part of KiCad, a free EDA CAD application.
+ *
+ * Copyright (C) 2015 Mark Roszko 
+ * 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 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * 

[Kicad-developers] [PATCH 2/4] Add missing dependency github_plugin -> pcbcommon

2016-05-05 Thread Simon Richter

The GitHub plugin needs the generated PCB parser code.
---
 pcbnew/CMakeLists.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt
index 1249069..6fa6ede 100644
--- a/pcbnew/CMakeLists.txt
+++ b/pcbnew/CMakeLists.txt
@@ -536,6 +536,8 @@ add_subdirectory( pcad2kicadpcb_plugin )
 if( BUILD_GITHUB_PLUGIN )
 add_subdirectory( github )
 add_dependencies( github_plugin lib-dependencies )
+# github_plugin depends on make_lexer outputs in common
+add_dependencies( github_plugin pcbcommon )
 endif()
 
 
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] [PATCH 3/4] Replace avhttp with libcurl: Some fixes: 1. Fixed an assumption somebody originally made in the plugin that std::string had contiguous storage. This is not specced behav

2016-05-05 Thread Simon Richter

From: unknown 

---
 Documentation/development/compiling.md | 12 +---
 common/basicframe.cpp  |  3 +++
 common/kicad_curl/kicad_curl.cpp   | 26 ++
 common/kicad_curl/kicad_curl_easy.cpp  | 26 +-
 include/kicad_curl/kicad_curl.h|  7 +++
 include/kicad_curl/kicad_curl_easy.h   |  6 +++---
 pcbnew/github/CMakeLists.txt   |  2 --
 pcbnew/github/github_getliblist.cpp|  5 +++--
 pcbnew/github/github_plugin.cpp|  3 ++-
 9 files changed, 58 insertions(+), 32 deletions(-)

diff --git a/Documentation/development/compiling.md b/Documentation/development/compiling.md
index 11e8af4..de0e3ed 100644
--- a/Documentation/development/compiling.md
+++ b/Documentation/development/compiling.md
@@ -78,14 +78,6 @@ specific patches required to build a working Boost library.  These patches can b
 [patches folder][] in the KiCad source.  These patches are named by the platform name they should
 be applied against.
 
-## OpenSSL Secure Socket Layer Library ## {#openssl}
-
-The [OpenSSL][] library is only required when the KiCad build is configured with the Github plugin
-enabled.  See the [KiCad Build Configuration Options](#build_opts)` section for more information.
-Please note that KiCad will download and build version 1.0.1e of OpenSSL by default.  You should
-probably use the version of OpenSSL installed on your system as it will most likely be more up to
-date and contain the latest security fixes.
-
 ## GLEW OpenGL Extension Wrangler Library ## {#glew}
 
 The [OpenGL Extension Wrangler][GLEW] is an OpenGL helper library used by the KiCad graphics
@@ -274,7 +266,7 @@ the following commands:
   mingw-w64-x86_64-boost \
   mingw-w64-x86_64-cairo \
   mingw-w64-x86_64-glew \
-  mingw-w64-x86_64-openssl \
+  mingw-w64-x86_64-curl \
   mingw-w64-x86_64-wxPython \
   mingw-w64-x86_64-wxWidgets
 cd kicad-source
@@ -286,7 +278,6 @@ the following commands:
   -DCMAKE_PREFIX_PATH=/mingw64 \
   -DCMAKE_INSTALL_PREFIX=/mingw64 \
   -DDEFAULT_INSTALL_PATH=/mingw64 \
-  -DOPENSSL_ROOT_DIR=/mingw64 \
   -DKICAD_SKIP_BOOST=ON \
   -DKICAD_SCRIPTING=ON \
   -DKICAD_SCRIPTING_MODULES=ON \
@@ -383,7 +374,6 @@ Boost patches in the KiCad source [patch folder][].
 [wxWidgets]: http://wxwidgets.org/
 [patches folder]: http://bazaar.launchpad.net/~kicad-product-committers/kicad/product/files/head:/patches/
 [Boost]: http://www.boost.org/
-[OpenSSL]: https://www.openssl.org/
 [GLEW]: http://glew.sourceforge.net/
 [GLUT]: https://www.opengl.org/resources/libraries/glut/
 [Cairo]: http://cairographics.org/
diff --git a/common/basicframe.cpp b/common/basicframe.cpp
index 05af429..e39a5b2 100644
--- a/common/basicframe.cpp
+++ b/common/basicframe.cpp
@@ -28,6 +28,7 @@
  * @brief EDA_BASE_FRAME class implementation.
  */
 
+#include  /* Include before any wx file */
 #include 
 #include 
 #include 
@@ -573,6 +574,8 @@ void EDA_BASE_FRAME::CopyVersionInfoToClipboard( wxCommandEvent&  event )
 << ( BOOST_VERSION / 100 % 1000 ) << wxT( "." )
 << ( BOOST_VERSION % 100 ) << wxT( "\n" );
 
+msg_version <<  KICAD_CURL::GetSimpleVersion() << wxT( "\n" );
+
 msg_version << wxT( " USE_WX_GRAPHICS_CONTEXT=" );
 #ifdef USE_WX_GRAPHICS_CONTEXT
 msg_version << wxT( "ON\n" );
diff --git a/common/kicad_curl/kicad_curl.cpp b/common/kicad_curl/kicad_curl.cpp
index 7424eec..0df2528 100644
--- a/common/kicad_curl/kicad_curl.cpp
+++ b/common/kicad_curl/kicad_curl.cpp
@@ -51,4 +51,30 @@ std::string KICAD_CURL::GetVersion()
 }
 
 
+std::string KICAD_CURL::GetSimpleVersion()
+{
+curl_version_info_data *info = curl_version_info(CURLVERSION_NOW);
+
+std::string res;
+
+if( info->version )
+{
+res += "libcurl version: " + std::string(info->version);
+}
+
+res += " (";
+if( info->features & CURL_VERSION_SSL )
+{
+res += "with SSL - ";
+res += std::string(info->ssl_version);
+}
+else
+{
+res += "without SSL";
+}
+res += ")";
+
+return res;
+}
+
 bool KICAD_CURL::m_initialized = false;
\ No newline at end of file
diff --git a/common/kicad_curl/kicad_curl_easy.cpp b/common/kicad_curl/kicad_curl_easy.cpp
index 71a410d..4dadf04 100644
--- a/common/kicad_curl/kicad_curl_easy.cpp
+++ b/common/kicad_curl/kicad_curl_easy.cpp
@@ -43,8 +43,8 @@ KICAD_CURL_EASY::KICAD_CURL_EASY()
 THROW_IO_ERROR( "Unable to initialize CURL session" );
 }
 
-m_Buffer.payload = (char*)malloc( 1 );
-m_Buffer.size = 0;
+m_Buffer.Payload = (char*)malloc( 1 );
+m_Buffer.Size = 0;
 
 curl_easy_setopt( m_CURL, CURLOPT_WRITEFUNCTION, write_callback );
 curl_easy_setopt( m_CURL, CURLOPT_WRITEDATA, (void *)_Buffer );
@@ -53,7 +53,7 @@ KICAD_CURL_EASY::KICAD_CURL_EASY()
 
 

[Kicad-developers] [PATCH] Kill unused NETLIST_EXPORTER_GENERIC::writeListOfNets

2016-05-04 Thread Simon Richter

This function is unused, and looks similar to the tree builder above, so it
might likely be left over from a refactoring effort.
---
 .../netlist_exporters/netlist_exporter_generic.cpp | 73 --
 .../netlist_exporters/netlist_exporter_generic.h   |  7 ---
 2 files changed, 80 deletions(-)

diff --git a/eeschema/netlist_exporters/netlist_exporter_generic.cpp b/eeschema/netlist_exporters/netlist_exporter_generic.cpp
index 420d8e3..398e62f 100644
--- a/eeschema/netlist_exporters/netlist_exporter_generic.cpp
+++ b/eeschema/netlist_exporters/netlist_exporter_generic.cpp
@@ -489,79 +489,6 @@ XNODE* NETLIST_EXPORTER_GENERIC::makeListOfNets()
 }
 
 
-bool NETLIST_EXPORTER_GENERIC::writeListOfNets( FILE* f, NETLIST_OBJECT_LIST& aObjectsList )
-{
-int ret = 0;
-int netCode;
-int lastNetCode = -1;
-int sameNetcodeCount = 0;
-wxStringnetName;
-wxStringref;
-wxStringnetcodeName;
-charfirstItemInNet[256];
-
-for( unsigned ii = 0; ii < aObjectsList.size(); ii++ )
-{
-SCH_COMPONENT*  comp;
-NETLIST_OBJECT* nitem = aObjectsList[ii];
-
-// New net found, write net id;
-if( ( netCode = nitem->GetNet() ) != lastNetCode )
-{
-sameNetcodeCount = 0;  // Items count for this net
-netName = nitem->GetNetName();
-
-netcodeName.Printf( wxT( "Net %d " ), netCode );
-netcodeName << wxT( "\"" ) << netName << wxT( "\"" );
-
-// Add the netname without prefix, in cases we need only the
-// "short" netname
-netcodeName += wxT( " \"" ) + nitem->GetShortNetName() + wxT( "\"" );
-lastNetCode  = netCode;
-}
-
-if( nitem->m_Type != NET_PIN )
-continue;
-
-if( nitem->m_Flag != 0 ) // Redundant pin, skip it
-continue;
-
-comp = nitem->GetComponentParent();
-
-// Get the reference for the net name and the main parent component
-ref = comp->GetRef( >m_SheetPath );
-if( ref[0] == wxChar( '#' ) )
-continue; // Pseudo component (Like Power symbol)
-
-// Print the pin list for this net, use special handling if
-// 2 or more items are connected:
-
-// if first item for this net found, defer printing this connection
-// until a second item will is found
-if( ++sameNetcodeCount == 1 )
-{
-snprintf( firstItemInNet, sizeof(firstItemInNet), " %s %.4s\n",
-  TO_UTF8( ref ),
-  (const char*) [ii]->m_PinNum );
-}
-
-// Second item for this net found, print the Net name, and the
-// first item
-if( sameNetcodeCount == 2 )
-{
-ret |= fprintf( f, "%s\n", TO_UTF8( netcodeName ) );
-ret |= fputs( firstItemInNet, f );
-}
-
-if( sameNetcodeCount >= 2 )
-ret |= fprintf( f, " %s %.4s\n", TO_UTF8( ref ),
- (const char*) >m_PinNum );
-}
-
-return ret >= 0;
-}
-
-
 XNODE* NETLIST_EXPORTER_GENERIC::node( const wxString& aName, const wxString& aTextualContent /* = wxEmptyString*/ )
 {
 XNODE* n = new XNODE( wxXML_ELEMENT_NODE, aName );
diff --git a/eeschema/netlist_exporters/netlist_exporter_generic.h b/eeschema/netlist_exporters/netlist_exporter_generic.h
index 89d57d5..71d3e51 100644
--- a/eeschema/netlist_exporters/netlist_exporter_generic.h
+++ b/eeschema/netlist_exporters/netlist_exporter_generic.h
@@ -80,13 +80,6 @@ protected:
 XNODE* node( const wxString& aName, const wxString& aTextualContent = wxEmptyString );
 
 /**
- * Function writeGENERICListOfNets
- * writes out nets (ranked by Netcode), and elements that are
- * connected as part of that net.
- */
-bool writeListOfNets( FILE* f, NETLIST_OBJECT_LIST& aObjectsList );
-
-/**
  * Function makeGenericRoot
  * builds the entire document tree for the generic export.  This is factored
  * out here so we can write the tree in either S-expression file format
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] Debian and Ubuntu packaging.

2016-05-05 Thread Simon Richter
On 02.05.2016 21:44, Chris Pavlina wrote:

> Perhaps we could provide our own Debian and Ubuntu packages, like the Ubuntu
> nightly PPA.

That still wouldn't be legal, though -- the OpenSSL licence is
incompatible with the GPL, and the result is undistributable, so any
time the KiCad project ships binaries, that happens in a grey area anyway.

Ideally, we'd drop OpenSSL and use GNUTLS -- libcurl can be linked
against GNUTLS, and if we don't use any other crypto functions and only
explicitly link against OpenSSL because it needs special initialization
magic, that would be the sanest way to go.

   Simon



signature.asc
Description: OpenPGP digital signature
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] [RFC] On net ties, microwave tools & custom pad shapes, altogether.

2016-05-05 Thread Simon Richter
Hi,

On 03.05.2016 14:40, Tomasz Wlostowski wrote:

> - net_tie: DRC treats the primitive as non-conducting and doesn't throw
> a short circuit error (see drawing A)

That requires the net tie to have a size that is at least larger than
the minimum clearance of any of the netclasses involved.

My current use case is a pad that is part of a large zone, and a single
trace that is connected to the pad, but should not be merged with the
zone (so I can connect both sides of a current detection shunt to an
op-amp), can this be sanely mapped here?

The other difficult use case I can see is splitting a clock line with
length control, by defining the common part and the split ends as
distinct nets, tying them together in a single spot and then using the
length matching tools.

So far, my approach was to treat net ties as circular copper pads with
the diameter set to the width of the smallest netclass connected (so in
essence it is always covered, the area is mainly useful for grabbing and
moving it).

DRC is not the main problem with net ties, but rather interaction
between traces, zones and pads. I've attached what I'd think would be
appropriate behaviour for a few cases:

 - two traces simply meet, without error.
 - trace-zone clearance is respected until the trace's endpoint, and the
connection made beyond the endpoint
 - trace-zone clearance is ignored inside pads that are connected to the
zone.

The more complex cases still need definitions, but these are the cases I
think are immediately useful.

The classic net tie between two zones can be realized by placing the
control point between the zones, and drawing a trace in each direction.

Last but not least, I'm still not convinced that representing these as
components and footprints with special tags has real advantages over
creating special types within the schematic, netlist and PCB file --
while the file format may be syntactically backwards compatible, older
versions still would not understand the magic tags and possibly generate
incorrect gerber output as the special handling requirements are ignored.

In addition, it is bad UI: components gain more and more special tags,
leading to clutter in the component editor, while program features are
hidden in the library -- to actually use a net tie you'd have to know
that something like that is available as a component, then select a
variant with the appropriate number of pins, place it and connect
everything, so I'd really prefer a separate tool here (FWIW, I'd also
like to see power symbols generated from a small set of drawings rather
than stored in a library, because the library approach already gave us a
hundred symbols to select from, but there is still no "+2V5A" symbol).

   Simon


signature.asc
Description: OpenPGP digital signature
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] Debian and Ubuntu packaging.

2016-05-05 Thread Simon Richter
Hi Wayne,

On 02.05.2016 21:09, Wayne Stambaugh wrote:

> Do we have any Debian developers on our mailing list?  I though I saw a
> Simon Richter on Planet Debian.  Is that you Simon?

Yes.

> Can someone tell me
> why the Debian package devs decided to build KiCad with the GitHub
> plugin disabled?  Is it a build issue or a licensing issue?

That is a licencing problem, one of the GNOME people has a short
summary[1]. The way out is to either drop OpenSSL or get permission from
the copyright holders to add an exception clause to the licence and not
link against any GPL'd code that doesn't have such an exception itself.

This licence incompatibility technically makes all binaries
undistributable, and even if no one is actively suing people, this may
be an impediment to enforcing the GPL in case it is ever necessary, and
leads to a bit of legal uncertainty for some distributors (for example,
German and Austrian law would allow other vendors of EDA software to
request an injunction against the distribution of these binaries, and if
granted, the distributor would be liable for their attorneys' fees).

Debian at some point decided to simply follow the letter of the law,
which was instrumental in the creation of the GNUTLS project.

I think we should be able to drop OpenSSL in favour of GNUTLS with
little effort, which would avoid the problem.

   Simon

[1] https://people.gnome.org/~markmc/openssl-and-the-gpl.html



signature.asc
Description: OpenPGP digital signature
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] [PATCH 0/4] Backport libcurl code from development branch

2016-05-05 Thread Simon Richter
Hi Wayne,

On 05.05.2016 16:15, Wayne Stambaugh wrote:

> Thanks Simon!  Nice work.  I just tested this on windows and it appears
> to work fine.  I'm assuming you tested this on Linux.

Yes, briefly. These are just the two "switch to CURL" patches from the
devel branch, and one small fix, so not much of the credit is mine here.

> Would one of our
> osx devs please apply these patches to the 4 stable branch and make sure
> that it builds and works correctly on osx?  Once I finish vetting Chris`
> file versioning patch, I'll apply that to the stable release and push a
> 4.0.3 stable release so the github plugin can be enabled.

Hm, I didn't pull in the OpenSSL locking workaround for OSX, so it's not
that trivial, apparently.

> I didn't see any credit to Dick for the work he did on libcurl
> transition so that will need to be added to commit message.

I've taken over the original commit messages from the commits I
cherry-picked.

   Simon



signature.asc
Description: OpenPGP digital signature
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] Bitmap fonts

2016-04-14 Thread Simon Richter
Hi,

On 14.04.2016 20:27, Vesa Solonen wrote:

> Orson, please have a look how rendering is done on gEDA gschem. IIRC
> font rendering is by Peter Clifton and he went on to optimize stroke
> (pixel)grid fitting, etc. The actual renderer is Cairo, but could we use
> Cairo to make the font textures for OpenGL display?

I've asked a few demoscene people, and got a pointer to

http://wdobbie.com/post/gpu-text-rendering-with-vector-textures/

That looks exactly like what we need.

   Simon



signature.asc
Description: OpenPGP digital signature
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] Bitmap fonts

2016-04-14 Thread Simon Richter
Hi,

On 14.04.2016 11:33, Maciej Sumiński wrote:

> Currently, the most expensive thing to draw is stroked text, as there
> are lots of labels on tracks and pads. To reduce the drawing cost (and
> memory requirements), texts that are not targeted to Gerber files (i.e.
> pad & track labels) might be displayed using bitmap fonts. This way, a
> single letter cost is reduced from tens of triangles to just two.

Do these actually need to be stored, or can they be generated on the fly
from some simpler representation?

   Simon



signature.asc
Description: OpenPGP digital signature
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] [PATCH] Make EDA_ITEM::Clone() abstract

2016-04-20 Thread Simon Richter
Make this function abstract in the base, and provide private functions
emitting error messages in all types that are actually instantiated.

---
 3d-viewer/3d_material.h| 3 +++
 3d-viewer/3d_struct.h  | 2 ++
 common/base_struct.cpp | 7 ---
 eeschema/class_libentry.h  | 6 ++
 eeschema/class_sch_screen.h| 3 +++
 gerbview/class_gbr_screen.h| 3 +++
 gerbview/class_gerber_draw_item.h  | 2 ++
 include/base_struct.h  | 9 +
 include/class_pcb_screen.h | 3 +++
 include/origin_viewitem.h  | 3 +++
 include/worksheet_viewitem.h   | 3 +++
 pagelayout_editor/class_pl_editor_screen.h | 3 +++
 pagelayout_editor/pl_editor_undo_redo.cpp  | 3 +++
 pcbnew/class_board.h   | 3 +++
 pcbnew/class_marker_pcb.h  | 3 +++
 pcbnew/class_netinfo.h | 2 ++
 pcbnew/ratsnest_viewitem.h | 3 +++
 pcbnew/tools/bright_box.h  | 2 ++
 pcbnew/tools/edit_points.h | 2 ++
 pcbnew/tools/selection_area.h  | 2 ++
 20 files changed, 52 insertions(+), 15 deletions(-)

diff --git a/3d-viewer/3d_material.h b/3d-viewer/3d_material.h
index 3bff7e6..4d8ab53 100644
--- a/3d-viewer/3d_material.h
+++ b/3d-viewer/3d_material.h
@@ -76,6 +76,9 @@ public:
 {
 return wxT( "S3D_MATERIAL" );
 }
+
+private:
+virtual EDA_ITEM* Clone() const { wxCHECK_MSG( false, nullptr, wxT( "Cannot clone S3D_MATERIAL" ) ); }
 };
 
 void SetOpenGlDefaultMaterial();
diff --git a/3d-viewer/3d_struct.h b/3d-viewer/3d_struct.h
index fc85567..43d0b65 100644
--- a/3d-viewer/3d_struct.h
+++ b/3d-viewer/3d_struct.h
@@ -169,6 +169,8 @@ private:
 voidcalcBBox();
 CBBOX   m_BBox; ///< Model oriented Bouding Box
 CBBOX   m_fastAABBox;   ///< Axis Align Bounding Box that contain the other bounding boxes
+
+virtual EDA_ITEM* Clone() const { wxCHECK_MSG( false, nullptr, wxT( "Cannot clone S3D_MASTER" ) ); }
 };
 
 
diff --git a/common/base_struct.cpp b/common/base_struct.cpp
index 9b6273d..10ca003 100644
--- a/common/base_struct.cpp
+++ b/common/base_struct.cpp
@@ -100,13 +100,6 @@ void EDA_ITEM::SetModified()
 }
 
 
-EDA_ITEM* EDA_ITEM::Clone() const
-{
-wxCHECK_MSG( false, NULL, wxT( "Clone not implemented in derived class " ) + GetClass() +
- wxT( ".  Bad programmer!" ) );
-}
-
-
 SEARCH_RESULT EDA_ITEM::IterateForward( EDA_ITEM* listStart,
 INSPECTOR*inspector,
 const void*   testData,
diff --git a/eeschema/class_libentry.h b/eeschema/class_libentry.h
index b81859e..beac211 100644
--- a/eeschema/class_libentry.h
+++ b/eeschema/class_libentry.h
@@ -180,6 +180,9 @@ public:
 #if defined(DEBUG)
 void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override
 #endif
+
+private:
+virtual EDA_ITEM* Clone() const { wxCHECK_MSG( false, nullptr, wxT( "Cannot clone LIB_PART" ) ); }
 };
 
 extern bool operator<( const LIB_ALIAS& aItem1, const LIB_ALIAS& aItem2 );
@@ -768,6 +771,9 @@ public:
 #if defined(DEBUG)
 void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override
 #endif
+
+private:
+virtual EDA_ITEM* Clone() const { wxCHECK_MSG( false, nullptr, wxT( "Cannot clone LIB_PART" ) ); }
 };
 
 #endif  //  CLASS_LIBENTRY_H
diff --git a/eeschema/class_sch_screen.h b/eeschema/class_sch_screen.h
index 2fb4043..79906b1 100644
--- a/eeschema/class_sch_screen.h
+++ b/eeschema/class_sch_screen.h
@@ -523,6 +523,9 @@ public:
 #if defined(DEBUG)
 void Show( int nestLevel, std::ostream& os ) const; // overload
 #endif
+
+private:
+virtual EDA_ITEM* Clone() const { wxCHECK_MSG( false, nullptr, wxT( "Cannot clone SCH_SCREEN" ) ); }
 };
 
 
diff --git a/gerbview/class_gbr_screen.h b/gerbview/class_gbr_screen.h
index 19b5f90..b1d13fe 100644
--- a/gerbview/class_gbr_screen.h
+++ b/gerbview/class_gbr_screen.h
@@ -63,6 +63,9 @@ public:
  * virtual pure in BASE_SCREEN, so it must be defined here
  */
 void ClearUndoORRedoList( UNDO_REDO_CONTAINER& aList, int aItemCount = -1 );
+
+private:
+virtual EDA_ITEM* Clone() const { wxCHECK_MSG( false, nullptr, wxT( "Cannot clone GBR_SCREEN" ) ); }
 };
 
 
diff --git a/gerbview/class_gerber_draw_item.h b/gerbview/class_gerber_draw_item.h
index 49e3340..f6d3633 100644
--- a/gerbview/class_gerber_draw_item.h
+++ b/gerbview/class_gerber_draw_item.h
@@ -304,6 +304,8 @@ public:
 void Show( int nestLevel, std::ostream& os ) const;  // override
 #endif
 
+private:
+virtual EDA_ITEM* Clone() const { wxCHECK_MSG( false, nullptr, wxT( "Cannot clone GERBER_DRAW_ITEM" ) ); }
 };
 
 #endif /* CLASS_GERBER_DRAW_ITEM_H */
diff --git a/include/base_struct.h b/include/base_struct.h
index e6238f3..ac6f59c 100644
--- a/include/base_struct.h

Re: [Kicad-developers] [PATCH 0/4] Use of "virtual" and "override" keywords

2016-07-12 Thread Simon Richter
Hi Wayne,

On 12.07.2016 16:07, Wayne Stambaugh wrote:

> I was looking over this patch set and before I apply it I want to be
> sure that all base class functions declared as virtual are explicitly
> declared as override in the derived classes.  It's a very large patch
> set and I don't have time to confirm that this is the intent of these
> patches.

The patches will need to be rebased anyway, there have been several changes.

The first patch enables a warning for all functions that override
virtual functions in base classes but have no "override" -- that is how
I identified the implicitly virtual functions.

Whether we also add a "virtual" in addition to the "override" is a
question of code legibility, personally I find it more obvious to be
explicit here. It might also be an idea to place these in a separate
block inside the class definition, e.g.:

struct A {
virtual void a() = 0;
};

struct B : A {
virtual void b() = 0;
};

struct C : B {
// A
virtual void a() override;

// B
virtual void b() override;
};

This is what I do in my projects, and I've found it to be a tremendous
help, as it tells me that this function is likely to be called by code
that doesn't know the concrete type, but only the base class mentioned
in the comment above.

   Simon



signature.asc
Description: OpenPGP digital signature
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] Project Wiki?

2016-07-25 Thread Simon Richter
Hi,

one of the outcomes at CERN was that we want to use the Blueprints
system in Launchpad more, and get consensus on major developments before
they are started.

For this, it would be great if there was a wiki, but I'm not sure who
would or should host it. The alternative would be to develop the initial
document using the pad, and finally archiving it somewhere.

Which way should I go, and if we want a wiki, who should host it?

   Simon



signature.asc
Description: OpenPGP digital signature
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] Project Wiki?

2016-07-25 Thread Simon Richter
Hi,

On 25.07.2016 17:12, Nick Østergaard wrote:

> Using pads we have no content control, but it is very easy to
> brainstorm stuff.

That would be fine if we can at some point finalize a proposal and
archive it.

> Using hugo, it will be done via github such that
> pull request can be made from everyone and we can control what gets in
> easily. We already have the tooling for hugo.

So we'd just create a subdirectory on the website for design documents?
I like that a lot, as it could be grown into developer documentation as
well (also, create an index page and you've replaced Blueprints).

Should I submit my stuff as a pull request to the website then?

   Simon



signature.asc
Description: OpenPGP digital signature
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] [PATCH] Remove definition of log10(double)

2016-08-12 Thread Simon Richter

This is also defined in , and likely to be a compiler intrinsic.
---
 common/widgets/mathplot.cpp | 6 --
 1 file changed, 6 deletions(-)

diff --git a/common/widgets/mathplot.cpp b/common/widgets/mathplot.cpp
index 3a1896b..f9de3ae 100644
--- a/common/widgets/mathplot.cpp
+++ b/common/widgets/mathplot.cpp
@@ -3332,12 +3332,6 @@ double mpScaleXLog::TransformFromPlot( double xplot )
 }
 
 
-double log10( double x )
-{
-return log( x ) / log( 10.0 );
-}
-
-
 #if 0
 mpFSemiLogXVector::mpFSemiLogXVector( wxString name, int flags ) :
 mpFXYVector( name, flags )
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] PATCH: OS X copy/close bug fix

2016-07-12 Thread Simon Richter
Hi,

On 13.07.2016 01:32, Brano Panak wrote:

> - m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL );
> + m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL , _T("Cancel"));

This will break Alt-C as Cancel on the other architectures. Not a big
loss in my opinion (does the Escape key work?), but others might disagree.

   Simon




signature.asc
Description: OpenPGP digital signature
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] [PATCH 0/4] Use of "virtual" and "override" keywords

2016-07-15 Thread Simon Richter
Hi,

On 14.07.2016 16:17, Mark Roszko wrote:

> If you put virtual blah() in struct C without override, you can be
> creating a new virtual function if the signature does not match and
> its completely valid.

Right, but that is something we can catch with "override".

The reason I like to have them there, besides having it immediately
visible, is the case

struct A {
virtual void foo();
};

struct B : A {
void foo();
};

struct C : B {
void foo();
};

{
B *b = new C;

b->foo();
}

This calls C::foo(), until the signature of A::foo() changes, then it
starts calling B::foo().

   Simon




signature.asc
Description: OpenPGP digital signature
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] 3D-Viewer - Request for merge evaluation

2016-07-18 Thread Simon Richter
Hi,

On 18.07.2016 21:18, Simon Richter wrote:

> If we don't care about the branch history, I've attached a diff between
> the current product branch tip and Mario's branch (fixing one conflict
> in a comment and reverting the bitmaps).

It seems the list dropped the attachment.

Link:   http://psi5.com/~geier/new3d.patch
SHA256: 35d59efc1747bc397fb80c68bebbe6f69d53ba555a3b147aeabcd0cbc246ff1c

   Simon



signature.asc
Description: OpenPGP digital signature
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] 3D-Viewer - Request for merge evaluation

2016-07-18 Thread Simon Richter
Hi,

On 18.07.2016 19:54, Wayne Stambaugh wrote:

> I could not merge your branch into the product branch.  Here is the
> merge error message:

Rebasing that branch is going to be difficult because of all the
backmerges from mainline.

If we don't care about the branch history, I've attached a diff between
the current product branch tip and Mario's branch (fixing one conflict
in a comment and reverting the bitmaps).

   Simon
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] 3D-Viewer - Request for merge evaluation

2016-07-19 Thread Simon Richter
Hi Mário,

> I've updated my branch with latest changes and clean the conflicts,
> As I am not an expert, I am not sure how can I revert the old generated 
> bitmaps,
> would you mind to make a new branch for me?

With bzr, that is difficult.

> I don't mind (and I prefer) that my branch history is lost, i.e. not merged 
> on the main branch. 
> I dont know how that process of merge works, but it will be OK for me if you 
> just copy / add / replace it and just give me credit on the commit email.
> (on a single commit?)

That's the best course then. Can you prepare a commit message for Wayne
so we don't have to go with "misc 3d viewer improvements"?

   Simon




signature.asc
Description: OpenPGP digital signature
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] [PATCH] Fix memory leaks with improper wxBaseConfig* usage (model ownership and ownership-transfer with std::unique_ptr)

2016-06-28 Thread Simon Richter
Hi,

On 28.06.2016 21:30, Michael Steinberg wrote:

> Now I only need to know how I should go about your concerns. Maybe using
> something along the lines of
> 
> using WX_CONFIG_PTR = std::unique_ptr< wxConfigBase >;

No, that isn't readable either, because it doesn't communicate the
semantics.

The full smart pointer template name is IMO the best choice here -- it
makes clear that the current context takes and keeps ownership of
whatever that function returns. It is not too ugly to read, and it makes
the intention clear.

"auto" is useful in places where the type does not matter, or cannot be
described, for example in a lambda, or when working with iterators:

auto less = [](int lhs, int rhs) -> bool { return lhs < rhs; };

auto i = mymap.find("foo");
if( i == mymap.end() ) ...

> A sidenote: if I find myself working on some parts of the code, are
> there objections if I silently add "override" specifiers in related
> code?

I have patches that add "virtual" and "override" to all overrides. So
far, these haven't been committed.

> I find these help a lot.

Indeed, especially "virtual".

   Simon



signature.asc
Description: OpenPGP digital signature
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] Regarding [PATCH] refactor_profile.patch

2016-07-05 Thread Simon Richter
Hi,

On 05.07.2016 01:45, Michael Steinberg wrote:

> I was made aware that MinGW's implementation of std::chrono might be
> lacking, but my testbed is not including that yet, so I cannot
> double-check the implementation.

I've started a build on Jenkins, but it will take a while until the
system gets around to it. I really need to add more nodes.

   Simon



signature.asc
Description: OpenPGP digital signature
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] Stable release 5 road map.

2016-07-05 Thread Simon Richter
Hi,

On 05.07.2016 09:55, Wayne Stambaugh wrote:

> If you are
> working on new features that are not in the version 5 road map, please
> inform me of what you working on and whether or not it will be ready to
> release by FOSDEM 2017.

My current branches:

1. writeable pin table

This could happen before FOSDEM, but is blocked by something that could
be a wx bug (widget not being rendered in the table context). Since that
feature is pretty much isolated in a single file and nothing depends on
it, I'm just going to submit it when it's ready and you decide whether
it can go in.

2. net ties

That is to a large extent blocked by any refactoring work in eeschema,
and the UI/UX is not fully defined yet either -- which we should fix
while we're here, but it won't be ready until after FOSDEM.

   Simon



signature.asc
Description: OpenPGP digital signature
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] KiCad library installation (in Linux and others)

2016-06-29 Thread Simon Richter
Hi,

On 29.06.2016 15:03, Wayne Stambaugh wrote:

> Sounds like we need separate installation instructions for Debian and
> it's derivatives and the PPA and some helpful notes about the differences.

I'm going to poke Jean-Samuel and Georges about this. It is a rather
annoying state of affairs. JS's packages should probably learn to pull
in the libraries (because that is what Fabrizio stumbled over), and both
sets of packages need to be aware of each other and declare conflicts so
the other is uninstalled.

Ideally, we'd merge them both into one, so we can handle the older
Ubuntu releases as simple backports of the existing Debian package.

There is a lot of duplicate effort here. Also, IMO users should stay
away from daily builds unless they have a good reason.

   Simon



signature.asc
Description: OpenPGP digital signature
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] [PATCH] Add FindSWIG.cmake from CMake 3.5 for swig 3.0 support

2016-06-29 Thread Simon Richter

The FindSWIG.cmake shipped with CMake 3.0 does not yet look for the
"cmake3.0" binary, this was added shortly after the 3.0 release.

This file can be removed once the minimum CMake version is 3.1 or greater.
---
 CMakeModules/FindSWIG.cmake | 96 +
 1 file changed, 96 insertions(+)
 create mode 100644 CMakeModules/FindSWIG.cmake

diff --git a/CMakeModules/FindSWIG.cmake b/CMakeModules/FindSWIG.cmake
new file mode 100644
index 000..4e003c6
--- /dev/null
+++ b/CMakeModules/FindSWIG.cmake
@@ -0,0 +1,96 @@
+#.rst:
+# FindSWIG
+# 
+#
+# Find SWIG
+#
+# This module finds an installed SWIG.  It sets the following variables:
+#
+# ::
+#
+#   SWIG_FOUND - set to true if SWIG is found
+#   SWIG_DIR - the directory where swig is installed
+#   SWIG_EXECUTABLE - the path to the swig executable
+#   SWIG_VERSION   - the version number of the swig executable
+#
+#
+#
+# The minimum required version of SWIG can be specified using the
+# standard syntax, e.g.  find_package(SWIG 1.1)
+#
+# All information is collected from the SWIG_EXECUTABLE so the version
+# to be found can be changed from the command line by means of setting
+# SWIG_EXECUTABLE
+
+#=
+# Copyright 2004-2009 Kitware, Inc.
+# Copyright 2011 Mathieu Malaterre 
+# Copyright 2014 Sylvain Joubert 
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in the
+#   documentation and/or other materials provided with the distribution.
+#
+# * Neither the names of Kitware, Inc., the Insight Software Consortium,
+#   nor the names of their contributors may be used to endorse or promote
+#   products derived from this software without specific prior written
+#   permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+find_program(SWIG_EXECUTABLE NAMES swig3.0 swig2.0 swig)
+
+if(SWIG_EXECUTABLE)
+  execute_process(COMMAND ${SWIG_EXECUTABLE} -swiglib
+OUTPUT_VARIABLE SWIG_swiglib_output
+ERROR_VARIABLE SWIG_swiglib_error
+RESULT_VARIABLE SWIG_swiglib_result)
+
+  if(SWIG_swiglib_result)
+if(SWIG_FIND_REQUIRED)
+  message(SEND_ERROR "Command \"${SWIG_EXECUTABLE} -swiglib\" failed with output:\n${SWIG_swiglib_error}")
+else()
+  message(STATUS "Command \"${SWIG_EXECUTABLE} -swiglib\" failed with output:\n${SWIG_swiglib_error}")
+endif()
+  else()
+string(REGEX REPLACE "[\n\r]+" ";" SWIG_swiglib_output ${SWIG_swiglib_output})
+find_path(SWIG_DIR swig.swg PATHS ${SWIG_swiglib_output} NO_CMAKE_FIND_ROOT_PATH)
+if(SWIG_DIR)
+  set(SWIG_USE_FILE UseSWIG.cmake)
+  execute_process(COMMAND ${SWIG_EXECUTABLE} -version
+OUTPUT_VARIABLE SWIG_version_output
+ERROR_VARIABLE SWIG_version_output
+RESULT_VARIABLE SWIG_version_result)
+  if(SWIG_version_result)
+message(SEND_ERROR "Command \"${SWIG_EXECUTABLE} -version\" failed with output:\n${SWIG_version_output}")
+  else()
+string(REGEX REPLACE ".*SWIG Version[^0-9.]*\([0-9.]+\).*" "\\1"
+  SWIG_version_output "${SWIG_version_output}")
+set(SWIG_VERSION ${SWIG_version_output} CACHE STRING "Swig version" FORCE)
+  endif()
+endif()
+  endif()
+endif()
+
+include(FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(SWIG  REQUIRED_VARS SWIG_EXECUTABLE SWIG_DIR
+VERSION_VAR SWIG_VERSION )
+
+mark_as_advanced(SWIG_DIR SWIG_VERSION)
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] [PATCH v2] Add FindSWIG.cmake from CMake 3.5 for swig 3.0 support

2016-06-29 Thread Simon Richter

The FindSWIG.cmake shipped with CMake 3.0 does not yet look for the
"cmake3.0" binary, this was added shortly after the 3.0 release.

This file can be removed once the minimum CMake version is 3.1 or greater.
---
 CMakeModules/FindSWIG.cmake | 96 +
 1 file changed, 96 insertions(+)
 create mode 100644 CMakeModules/FindSWIG.cmake

diff --git a/CMakeModules/FindSWIG.cmake b/CMakeModules/FindSWIG.cmake
new file mode 100644
index 000..df47a0c
--- /dev/null
+++ b/CMakeModules/FindSWIG.cmake
@@ -0,0 +1,96 @@
+#.rst:
+# FindSWIG
+# 
+#
+# Find SWIG
+#
+# This module finds an installed SWIG.  It sets the following variables:
+#
+# ::
+#
+#   SWIG_FOUND - set to true if SWIG is found
+#   SWIG_DIR - the directory where swig is installed
+#   SWIG_EXECUTABLE - the path to the swig executable
+#   SWIG_VERSION   - the version number of the swig executable
+#
+#
+#
+# The minimum required version of SWIG can be specified using the
+# standard syntax, e.g.  find_package(SWIG 1.1)
+#
+# All information is collected from the SWIG_EXECUTABLE so the version
+# to be found can be changed from the command line by means of setting
+# SWIG_EXECUTABLE
+
+#=
+# Copyright 2004-2009 Kitware, Inc.
+# Copyright 2011 Mathieu Malaterre 
+# Copyright 2014 Sylvain Joubert 
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in the
+#   documentation and/or other materials provided with the distribution.
+#
+# * Neither the names of Kitware, Inc., the Insight Software Consortium,
+#   nor the names of their contributors may be used to endorse or promote
+#   products derived from this software without specific prior written
+#   permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+find_program(SWIG_EXECUTABLE NAMES swig3.0 swig2.0 swig)
+
+if(SWIG_EXECUTABLE)
+  execute_process(COMMAND ${SWIG_EXECUTABLE} -swiglib
+OUTPUT_VARIABLE SWIG_swiglib_output
+ERROR_VARIABLE SWIG_swiglib_error
+RESULT_VARIABLE SWIG_swiglib_result)
+
+  if(SWIG_swiglib_result)
+if(SWIG_FIND_REQUIRED)
+  message(SEND_ERROR "Command \"${SWIG_EXECUTABLE} -swiglib\" failed with output:\n${SWIG_swiglib_error}")
+else()
+  message(STATUS "Command \"${SWIG_EXECUTABLE} -swiglib\" failed with output:\n${SWIG_swiglib_error}")
+endif()
+  else()
+string(REGEX REPLACE "[\n\r]+" ";" SWIG_swiglib_output ${SWIG_swiglib_output})
+find_path(SWIG_DIR swig.swg PATHS ${SWIG_swiglib_output} NO_CMAKE_FIND_ROOT_PATH)
+if(SWIG_DIR)
+  set(SWIG_USE_FILE UseSWIG)
+  execute_process(COMMAND ${SWIG_EXECUTABLE} -version
+OUTPUT_VARIABLE SWIG_version_output
+ERROR_VARIABLE SWIG_version_output
+RESULT_VARIABLE SWIG_version_result)
+  if(SWIG_version_result)
+message(SEND_ERROR "Command \"${SWIG_EXECUTABLE} -version\" failed with output:\n${SWIG_version_output}")
+  else()
+string(REGEX REPLACE ".*SWIG Version[^0-9.]*\([0-9.]+\).*" "\\1"
+  SWIG_version_output "${SWIG_version_output}")
+set(SWIG_VERSION ${SWIG_version_output} CACHE STRING "Swig version" FORCE)
+  endif()
+endif()
+  endif()
+endif()
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(SWIG  REQUIRED_VARS SWIG_EXECUTABLE SWIG_DIR
+VERSION_VAR SWIG_VERSION )
+
+mark_as_advanced(SWIG_DIR SWIG_VERSION)
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] [PATCH v2] Add FindSWIG.cmake from CMake 3.5 for swig 3.0 support

2016-06-29 Thread Simon Richter
Difference in v2: Drop the ".cmake" suffix on the included files so they
are looked for on the full search path. That one only became apparent
after I removed the build dir and re-configured the project.

   Simon



signature.asc
Description: OpenPGP digital signature
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] [PATCH] Replace boost::shared_ptr with std::shared_ptr

2016-06-29 Thread Simon Richter
This is a simple 1:1 replacement for all cases where shared_ptr is not used
to point at an array (array handling is not in C++11).
---
 3d-viewer/3d_mesh_model.h  |  4 ++--
 common/gal/opengl/opengl_gal.cpp   |  2 +-
 common/geometry/hetriang.cpp   | 34 +-
 eeschema/class_libentry.h  |  7 +++
 eeschema/sch_component.h   |  5 ++---
 include/gal/cairo/cairo_gal.h  |  5 +++--
 include/gal/opengl/opengl_gal.h|  4 ++--
 include/gal/opengl/vertex_manager.h|  6 +++---
 include/painter.h  |  2 +-
 include/ttl/halfedge/hetriang.h|  9 -
 pcbnew/class_board_connected_item.h|  2 +-
 pcbnew/class_netclass.cpp  |  6 ++
 pcbnew/class_netclass.h|  5 +++--
 pcbnew/dialogs/dialog_design_rules.cpp |  4 +---
 pcbnew/drc_stuff.h |  4 ++--
 pcbnew/legacy_plugin.cpp   |  4 +---
 pcbnew/legacy_plugin.h |  4 +++-
 pcbnew/pcb_painter.h   |  3 ++-
 pcbnew/pcb_parser.cpp  |  4 +---
 pcbnew/ratsnest_data.cpp   | 13 ++---
 pcbnew/ratsnest_data.h |  4 ++--
 pcbnew/router/pns_optimizer.h  |  2 +-
 pcbnew/specctra.h  |  5 +++--
 pcbnew/tools/edit_points.h |  9 +
 pcbnew/tools/point_editor.cpp  |  5 ++---
 pcbnew/tools/point_editor.h|  9 +
 pcbnew/tools/selection_tool.cpp|  2 +-
 27 files changed, 79 insertions(+), 84 deletions(-)

diff --git a/3d-viewer/3d_mesh_model.h b/3d-viewer/3d_mesh_model.h
index 734789f..bc35e43 100644
--- a/3d-viewer/3d_mesh_model.h
+++ b/3d-viewer/3d_mesh_model.h
@@ -31,7 +31,6 @@
 #define __3D_MESH_MODEL_H__
 
 #include 
-#include 
 #include 
 #define GLM_FORCE_RADIANS
 #include 
@@ -39,10 +38,11 @@
 #include "3d_material.h"
 #include "3d_rendering/3d_render_raytracing/shapes3D/cbbox.h"
 
+
 class S3D_MESH;
 
 /** A smart pointer to an S3D_MESH object */
-typedef boost::shared_ptr S3D_MESH_PTR;
+typedef std::shared_ptr S3D_MESH_PTR;
 
 /** A container of smar S3D_MESH object pointers */
 typedef std::vector S3D_MESH_PTRS;
diff --git a/common/gal/opengl/opengl_gal.cpp b/common/gal/opengl/opengl_gal.cpp
index bcbee68..32d353d 100644
--- a/common/gal/opengl/opengl_gal.cpp
+++ b/common/gal/opengl/opengl_gal.cpp
@@ -1049,7 +1049,7 @@ int OPENGL_GAL::BeginGroup()
 {
 isGrouping = true;
 
-boost::shared_ptr newItem( new VERTEX_ITEM( *cachedManager ) 
);
+std::shared_ptr newItem = std::make_shared( 
*cachedManager );
 int groupNumber = getNewGroupNumber();
 groups.insert( std::make_pair( groupNumber, newItem ) );
 
diff --git a/common/geometry/hetriang.cpp b/common/geometry/hetriang.cpp
index e5cf26c..8383a8e 100644
--- a/common/geometry/hetriang.cpp
+++ b/common/geometry/hetriang.cpp
@@ -46,8 +46,8 @@
 #include 
 #include 
 #include 
-#include 
 #include 
+#include 
 
 using namespace hed;
 
@@ -127,22 +127,22 @@ EDGE_PTR TRIANGULATION::InitTwoEnclosingTriangles( 
NODES_CONTAINER::iterator aFi
 double dx = ( xmax - xmin ) / fac;
 double dy = ( ymax - ymin ) / fac;
 
-NODE_PTR n1 = boost::make_shared( xmin - dx, ymin - dy );
-NODE_PTR n2 = boost::make_shared( xmax + dx, ymin - dy );
-NODE_PTR n3 = boost::make_shared( xmax + dx, ymax + dy );
-NODE_PTR n4 = boost::make_shared( xmin - dx, ymax + dy );
+NODE_PTR n1 = std::make_shared( xmin - dx, ymin - dy );
+NODE_PTR n2 = std::make_shared( xmax + dx, ymin - dy );
+NODE_PTR n3 = std::make_shared( xmax + dx, ymax + dy );
+NODE_PTR n4 = std::make_shared( xmin - dx, ymax + dy );
 
 // diagonal
-EDGE_PTR e1d = boost::make_shared();
-EDGE_PTR e2d = boost::make_shared();
+EDGE_PTR e1d = std::make_shared();
+EDGE_PTR e2d = std::make_shared();
 
 // lower triangle
-EDGE_PTR e11 = boost::make_shared();
-EDGE_PTR e12 = boost::make_shared();
+EDGE_PTR e11 = std::make_shared();
+EDGE_PTR e12 = std::make_shared();
 
 // upper triangle
-EDGE_PTR e21 = boost::make_shared();
-EDGE_PTR e22 = boost::make_shared();
+EDGE_PTR e21 = std::make_shared();
+EDGE_PTR e22 = std::make_shared();
 
 // lower triangle
 e1d->SetSourceNode( n3 );
@@ -453,12 +453,12 @@ EDGE_PTR TRIANGULATION::SplitTriangle( EDGE_PTR& aEdge, 
const NODE_PTR& aPoint )
 EDGE_PTR e3( e2->GetNextEdgeInFace() );
 NODE_PTR n3( e3->GetSourceNode() );
 
-EDGE_PTR e1_n = boost::make_shared();
-EDGE_PTR e11_n = boost::make_shared();
-EDGE_PTR e2_n = boost::make_shared();
-EDGE_PTR e22_n = boost::make_shared();
-EDGE_PTR e3_n = boost::make_shared();
-EDGE_PTR e33_n = boost::make_shared();
+EDGE_PTR e1_n = std::make_shared();
+EDGE_PTR e11_n = std::make_shared();
+EDGE_PTR e2_n = std::make_shared();
+EDGE_PTR e22_n = std::make_shared();
+EDGE_PTR e3_n = std::make_shared();
+EDGE_PTR 

Re: [Kicad-developers] [PATCH 5/5] Replace boost::shared_ptr with std::shared_ptr

2016-06-29 Thread Simon Richter
Hi Wayne,

On 29.06.2016 15:57, Wayne Stambaugh wrote:

> I hate to ask you again but this patch no longer applies cleanly.
> Please rebase it and resubmit it when you get a chance.

No problem, that happens almost automatically with git. :)

   Simon




signature.asc
Description: OpenPGP digital signature
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] [PATCH] Rewrite loop conditions in SchematicCleanUp

2016-06-29 Thread Simon Richter
Hi Wayne,

On 29.06.2016 17:29, Wayne Stambaugh wrote:

> This patch needs rebased as well.  Please include the patch as an
> attachment rather than inline.  Bazaar doesn't play as nicely with
> inline mail merges as git does.

The "Rewrite loop conditions" one, or the "BOOST_FOREACH" one? The
former applies cleanly for me, but maybe that is because it got rebased
silently. Resending both as replies to this mail...

   Simon



signature.asc
Description: OpenPGP digital signature
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] [PATCH 1/2] Rewrite loop conditions in SchematicCleanUp

2016-06-29 Thread Simon Richter

These are a tiny bit more readable, and do not depend on all branches to
correctly advance the loop variable.
---
 eeschema/sch_screen.cpp | 27 +++
 1 file changed, 7 insertions(+), 20 deletions(-)

diff --git a/eeschema/sch_screen.cpp b/eeschema/sch_screen.cpp
index 20a18b9..ff20f20 100644
--- a/eeschema/sch_screen.cpp
+++ b/eeschema/sch_screen.cpp
@@ -426,20 +426,19 @@ bool SCH_SCREEN::IsTerminalPoint( const wxPoint& aPosition, int aLayer )
 
 bool SCH_SCREEN::SchematicCleanUp()
 {
-SCH_ITEM* item, * testItem;
 bool  modified = false;
 
-item = m_drawList.begin();
-
-for( ; item; item = item->Next() )
+for( SCH_ITEM* item = m_drawList.begin() ; item; item = item->Next() )
 {
 if( ( item->Type() != SCH_LINE_T ) && ( item->Type() != SCH_JUNCTION_T ) )
 continue;
 
-testItem = item->Next();
+bool restart;
 
-while( testItem )
+for( SCH_ITEM* testItem = item->Next(); testItem; testItem = restart ? m_drawList.begin() : testItem->Next() )
 {
+restart = false;
+
 if( ( item->Type() == SCH_LINE_T ) && ( testItem->Type() == SCH_LINE_T ) )
 {
 SCH_LINE* line = (SCH_LINE*) item;
@@ -449,13 +448,9 @@ bool SCH_SCREEN::SchematicCleanUp()
 // Keep the current flags, because the deleted segment can be flagged.
 item->SetFlags( testItem->GetFlags() );
 DeleteItem( testItem );
-testItem = m_drawList.begin();
+restart = true;
 modified = true;
 }
-else
-{
-testItem = testItem->Next();
-}
 }
 else if ( ( ( item->Type() == SCH_JUNCTION_T )
   && ( testItem->Type() == SCH_JUNCTION_T ) ) && ( testItem != item ) )
@@ -465,17 +460,9 @@ bool SCH_SCREEN::SchematicCleanUp()
 // Keep the current flags, because the deleted segment can be flagged.
 item->SetFlags( testItem->GetFlags() );
 DeleteItem( testItem );
-testItem = m_drawList.begin();
+restart = true;
 modified = true;
 }
-else
-{
-testItem = testItem->Next();
-}
-}
-else
-{
-testItem = testItem->Next();
 }
 }
 }
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] KiCad library installation (in Linux and others)

2016-06-29 Thread Simon Richter
Hi,

On 29.06.2016 11:26, Fabrizio Tappero wrote:

> sudo apt-get install kicad

> ​D
> oing so kicad libs do not get installed and furthermore the version of
> KiCad that you get will inevitably complain about libs not being installed
> ​. S​
> ome people have complained about it.

In Debian, you get a really ancient version by default, because that was
the current stable release at the time of the jessie freeze. You can get
4.0.2 from the backports.org archive, as documented on the Debian
download pages. The changes to 4.0.3 are mostly relevant for MacOS, so
we haven't bothered to update the package.

The libraries are only missing in the PPA packages, because they are
packaged separately in that version. The regular Debian packages pull in
the "kicad-common" package, which contains the libraries.

The error message about the missing libraries happens if kicad is
configured to use libraries from github -- here a reorganization has
taken place after the release. It would be a good idea to tell people
how to adjust their global footprint path.

> sudo add-apt-repository --yes ppa:js-reynaud/kicad-4

That is Ubuntu specific, and while I generally trust Jean-Samuel to do
good work, I'd be wary to install it on anything but Ubuntu. For Ubuntu
xenial and yakkety, the version shipped with Ubuntu universe is good for
users.

I'm also wary of pointing users at the PPA. While I trust Jean-Samuel to
make good packages, his efforts are not at all coordinated with the
normal packaging effort, and the fact that he has a different package
split will lead to problems for users (if you switch from the PPA to
Debian packages, you will get file conflicts, because "kicad-library"
remains behind, for example).

> I know that libraries installed by default might be an option that some
> people might not like. The truth however, I think, is that the patience
> of people who try out kicad for the first time should not be tested.

Yes, the experience could be better.

> I also would like to suggest to include the libs in the Windows and OSX
> installer.

At least the Windows installer has the libraries included. OS X should
have them too, but I haven't checked.

> On a side note. On Ubuntu and similar, in 4.0 verison, there is a
> "kicad-common" package that does not seem to be necessary and if
> installed actually removes the main kicad package. Not sure what is
> happening there.

Conflict between the PPA and the main distribution. That happens because
the PPA and the main distribution are not coordinated.

If you use a PPA, you need to make sure that you pull all the packages
you need from there -- mixing and matching will not work. The
"kicad-common" package contains all the footprints and libraries, but in
a location not expected by the kicad binaries from the PPA.

   Simon




signature.asc
Description: OpenPGP digital signature
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


<    1   2   3   4   5   6   7   8   9   >