Re: [Kicad-developers] [PATCH] Don't reference CMAKE_INSTALL_PREFIX in installation paths
On Sat, Apr 28, 2018 at 09:56:48PM +0200, Simon Richter wrote: > > This is substituted at configuration time, creating an absolute path, which > breaks overriding CMAKE_INSTALL_PREFIX at installation time, breaking the > workflow for installation using GNU stow. > --- > CMakeLists.txt | 10 +- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/CMakeLists.txt b/CMakeLists.txt > index 1ef7c344d..d74ac52fd 100644 > --- a/CMakeLists.txt > +++ b/CMakeLists.txt > @@ -431,7 +431,7 @@ if( NOT APPLE ) > else() > # everything without leading / is relative to CMAKE_INSTALL_PREFIX. > # CMAKE_INSTALL_PREFIX is root of .dmg image > -set( KICAD_BIN ${CMAKE_INSTALL_PREFIX} > +set( KICAD_BIN "." > CACHE PATH "Location of KiCad binaries." FORCE ) > > # some paths to single app bundle > @@ -861,25 +861,25 @@ if( UNIX AND NOT APPLE ) > > # Install Mime directory > install( DIRECTORY ${UNIX_ICON_FILES} > -DESTINATION ${CMAKE_INSTALL_PREFIX}/share > +DESTINATION share > COMPONENT resources > ) > > # Install Icons > install( DIRECTORY ${UNIX_MIME_FILES} > -DESTINATION ${CMAKE_INSTALL_PREFIX}/share > +DESTINATION share > COMPONENT resources > ) > > # Install Applications directory (.desktop files) > install( DIRECTORY ${UNIX_APPLICATIONS_FILES} > -DESTINATION ${CMAKE_INSTALL_PREFIX}/share > +DESTINATION share > COMPONENT resources > ) > > # Install AppStream directory (app store entry) > install( DIRECTORY ${UNIX_APPDATA_FILES} > -DESTINATION ${CMAKE_INSTALL_PREFIX}/share > +DESTINATION share > COMPONENT resources > ) > endif() Could we use the appropriate GNUInstallDirs variables instead? Using relative paths like `share` doesn't play very nice in scenarios where `datarootdir` is not ${prefix}/share. On Exherbo for example we support targeting multiple architectures and for that architecture-dependent stuff is installed into /usr/${CHOST}/{bin,lib,include} and architecture-independent things into /usr/share. `DESTINATION share` and CMAKE_INSTALL_PREFIX=/usr/${CHOST} will result in data being installed into /usr/${CHOST}/share which we try to prevent Best regards > ___ > 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 ___ 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 00/12] Minor cleanups and improvements
Hey Orson, I actually didn't skip any patch, #8 ("Remove orphaned code files") should is there: https://lists.launchpad.net/kicad-developers/msg31304.html I rebased my patches and pushed them to my Github repository, I think it's easier for both of us that way :-) Please pull from https://github.com/marv/kicad-dev/tree/housekeeping Best regards, Marvin On Sun, Nov 05, 2017 at 10:21:41PM +0100, Maciej Suminski wrote: > Hi Marvin, > > Have you skipped patch 0008 intentionally? Some of the changes from this > set do not apply cleanly, would you rebase them? > > Regards, > Orson > > On 11/02/2017 09:58 PM, Marvin Schmidt wrote: > > Just a set of small code cleanups to fix a bunch of warnings > > and remove dead code. > > Other than that the 'build:' commits avoid/remove/fix the > > installation of certain files: > > - it doesn't make much sense to install the INSTALL.txt > > - *.bat scripts shouldn't be installed on UNIX systems > > - use CMAKE_INSTALL_* consistently to install files in the > >correct places > > > > Marvin Schmidt (12): > > build: Don't install INSTALL.txt > > build: Use CMAKE_INSTALL_DATADIR > > build: Remove dead code > > build: Don't install *.bat scripts on Unix > > Fix a typo > > Remove unused #define > > Remove some dead code > > Remove orphaned code files > > Remove some extra semicolons > > Remove duplicate #include > > Remove some else-after-return's > > Use std::remove_pointer instead of own implementation (NFC) > > > > 3d-viewer/3d_cache/dialogs/3d_cache_dialogs.h | 2 +- > > 3d-viewer/3d_cache/sg/sg_helpers.cpp| 2 +- > > 3d-viewer/3d_cache/sg/sg_helpers.h | 2 +- > > 3d-viewer/3d_cache/sg/sg_node.h | 2 +- > > 3d-viewer/3d_cache/str_rsort.h | 2 +- > > 3d-viewer/3d_canvas/eda_3d_canvas.h | 2 +- > > 3d-viewer/3d_model_viewer/c3d_model_viewer.h| 2 +- > > 3d-viewer/3d_viewer/eda_3d_viewer.h | 2 +- > > CMakeLists.txt | 17 +-- > > common/bitmap.cpp | 4 +- > > common/class_undoredo_container.cpp | 39 --- > > common/eagle_parser.cpp | 4 +- > > common/single_top.cpp | 2 +- > > common/view/view.cpp| 2 +- > > common/widgets/mathplot.cpp | 6 +- > > common/wxunittext.cpp | 142 > > --- > > eeschema/dialogs/dialog_bom.cpp | 2 +- > > eeschema/pin_shape.cpp | 2 +- > > eeschema/plot_schematic_HPGL.cpp| 2 +- > > eeschema/sch_io_mgr.cpp | 2 +- > > eeschema/sch_io_mgr.h | 2 +- > > eeschema/sch_item_struct.cpp| 7 -- > > eeschema/sch_item_struct.h | 4 - > > eeschema/sch_screen.cpp | 3 - > > gerbview/class_gerber_draw_item.h | 2 +- > > gerbview/class_gerbview_layer_widget.cpp| 2 +- > > include/class_draw_panel_gal.h | 2 +- > > include/core/typeinfo.h | 22 +--- > > include/geometry/rtree.h| 2 +- > > include/plugins/3dapi/ifsg_api.h| 2 +- > > include/plugins/3dapi/sg_types.h| 2 +- > > include/system/libcontext.h | 4 +- > > include/tool/tool_base.h| 2 +- > > include/tool/tool_dispatcher.h | 2 +- > > include/ttl/halfedge/hetraits.h | 2 +- > > include/ttl/halfedge/hetriang.h | 4 +- > > include/wxunittext.h| 144 > > > > kicad/kicad.cpp | 2 +- > > pcb_calculator/UnitSelector.cpp | 10 +- > > pcbnew/class_drawsegment.cpp| 2 +- > > pcbnew/class_module.h | 2 +- > > pcbnew/class_netclass.h | 2 +- > > pcbnew/class_pad.h | 2 +- > > pcbnew/class_zone.cpp | 2 +- > > pcbnew/class_zone_settings.cpp | 2 +- > > pcbnew/dialogs/dialog_footprint_wizard_list.cpp | 6 +- > > pcbnew/exporters/export_gencad.cpp | 4 +- > &
Re: [Kicad-developers] [PATCH 0/3] Minor fixes for VECTOR2 and BOX2
Hey Orson, thanks for pushing those patches! Just wondering: why did you alter them? I intentionally left one of the `#include ` in place because the Rotate function uses sin and cos (which should really be std::{sin,cos} by the way) and ordered the includes alphabetically Best regards, Marvin On Sun, Nov 05, 2017 at 11:04:48PM +0100, Maciej Suminski wrote: > Hi Marvin, > > Thank you for the patches. I have just pushed them to the master branch. > > Regards, > Orson > > On 10/31/2017 12:17 PM, Marvin Schmidt wrote: > > I was irritated by the usage of the vector_traits class as you usually > > use it to gather more information about a certain type using > > something like `traits::property`. Here the vector2d classes > > queries the traits class to get the extended coordinate type but also > > derives from it to get the limits of that type which are hardcoded in > > the traits class. The second patch removes the hardcoded limits from > > the traits class and the inheritance of the vector2d class from the traits > > class. Instead the vector2d class uses the std::numeric_limits facility > > to get the limits of the extended coordinate type it got through the > > traits class > > > > The other two patches are just minor fixes. The wrong use of the > > typename keyword in the box2 class might have been triggering a bug > > in the MSVC compiler though (not sure about that as I can't test it, > > just seems possible from workaround I've seen) > > > > Marvin Schmidt (3): > > vector2d: Remove duplicate #include > > vector2d: Fix traits usage and use std::numeric_limits > > box2: Remove wrong use of typename keyword > > > > include/math/box2.h | 2 +- > > include/math/vector2d.h | 10 +- > > 2 files changed, 6 insertions(+), 6 deletions(-) > > > > ___ > 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 ___ 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/12] Remove unused #define
--- eeschema/sch_screen.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/eeschema/sch_screen.cpp b/eeschema/sch_screen.cpp index 02f2030d1..50d921b2d 100644 --- a/eeschema/sch_screen.cpp +++ b/eeschema/sch_screen.cpp @@ -66,9 +66,6 @@ static double SchematicZoomList[] = 13.0, 16.0, 20.0, 26.0, 32.0, 48.0, 64.0, 80.0, 128.0 }; -#define MM_TO_SCH_UNITS 1000.0 / 25.4 //schematic internal unites are mils - - /* Default grid sizes for the schematic editor. * Do NOT add others values (mainly grid values in mm), because they * can break the schematic: Because wires and pins are considered as -- 2.14.1 ___ 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 03/12] build: Remove dead code
--- CMakeLists.txt | 8 1 file changed, 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 54d477e22..3a8ee4518 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -693,14 +693,6 @@ if( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES ) endif() -if( EXISTS ${CMAKE_SOURCE_DIR}/include/config.h ) -# This file may exist ( created by an alternate process to the svn test above), -# e.g. could be created by a checkout script that produces a source tar file. -# This directive means the about box will have the svn date & revision in it, -# but the hard coded release date ( program version) will be preserved. -add_definitions( -DHAVE_SVN_REVISION ) -endif() - if( APPLE ) # Remove app bundles in ${KICAD_BIN} before installing anything new. # Must be defined before all includes so that it is executed first. -- 2.14.1 ___ 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 02/12] build: Use CMAKE_INSTALL_DATADIR
--- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5d01d6577..54d477e22 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -380,9 +380,9 @@ if( NOT APPLE ) CACHE PATH "Location of KiCad user-loaded plugins" ) endif() -set( KICAD_DATA share/kicad +set( KICAD_DATA ${CMAKE_INSTALL_DATADIR}/kicad CACHE PATH "Location of KiCad data files." ) -set( KICAD_DOCS share/doc/kicad +set( KICAD_DOCS ${CMAKE_INSTALL_DATADIR}/doc/kicad CACHE PATH "Location of KiCad documentation files." ) set( KICAD_DEMOS ${KICAD_DATA}/demos CACHE PATH "Location of KiCad demo files." ) -- 2.14.1 ___ 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/12] build: Don't install *.bat scripts on Unix
--- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3a8ee4518..efd02e103 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -774,6 +774,7 @@ if( UNIX ) install( DIRECTORY scripts DESTINATION ${KICAD_DOCS} COMPONENT resources +PATTERN "*.bat" EXCLUDE ) endif() -- 2.14.1 ___ 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 08/12] Remove orphaned code files
--- common/wxunittext.cpp | 142 - include/wxunittext.h | 144 -- 2 files changed, 286 deletions(-) delete mode 100644 common/wxunittext.cpp delete mode 100644 include/wxunittext.h diff --git a/common/wxunittext.cpp b/common/wxunittext.cpp deleted file mode 100644 index 646fb90b6..0 --- a/common/wxunittext.cpp +++ /dev/null @@ -1,142 +0,0 @@ -/* - * This program source code file is part of KiCad, a free EDA CAD application. - * - * Copyright (C) 2014 CERN - * Author: Maciej Suminski - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, you may find one here: - * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html - * or you may search the http://www.gnu.org website for the version 2 license, - * or you may write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include "wxunittext.h" -#include -#include -#include -#include -#include -#include -#include - -WX_UNIT_TEXT::WX_UNIT_TEXT( wxWindow* aParent, const wxString& aLabel, double aValue, double aStep ) : -wxPanel( aParent, wxID_ANY ), -m_step( aStep ) -{ -// Use the currently selected units -m_units = g_UserUnit; - -wxBoxSizer* sizer; -sizer = new wxBoxSizer( wxHORIZONTAL ); - -// Helper label -m_inputLabel = new wxStaticText( this, wxID_ANY, aLabel, - wxDefaultPosition, wxDefaultSize, 0 ); -wxSize size = m_inputLabel->GetMinSize(); -size.SetWidth( 150 ); -m_inputLabel->SetMinSize( size ); -sizer->Add( m_inputLabel, 1, wxALIGN_CENTER_VERTICAL | wxALL | wxEXPAND, 5 ); - -// Main input control -m_inputValue = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, - wxTE_PROCESS_ENTER ); - -SetValue( aValue ); -sizer->Add( m_inputValue, 0, wxALIGN_CENTER_VERTICAL | wxALL ); - -wxFloatingPointValidator validator( 4, NULL, wxNUM_VAL_NO_TRAILING_ZEROES ); -validator.SetRange( 0.0, std::numeric_limits::max() ); -m_inputValue->SetValidator( validator ); - -// Spin buttons for modifying values using the mouse -m_spinButton = new wxSpinButton( this, wxID_ANY ); -m_spinButton->SetRange( std::numeric_limits::min(), std::numeric_limits::max() ); - -m_spinButton->SetCanFocus( false ); -sizer->Add( m_spinButton, 0, wxALIGN_CENTER_VERTICAL | wxALL ); - -Connect( wxEVT_SPIN_UP, wxSpinEventHandler( WX_UNIT_TEXT::onSpinUpEvent ), NULL, this ); -Connect( wxEVT_SPIN_DOWN, wxSpinEventHandler( WX_UNIT_TEXT::onSpinDownEvent ), NULL, this ); - -sizer->AddSpacer( 5 ); - -// Create units label -m_unitLabel = new wxStaticText( this, wxID_ANY, GetUnitsLabel( g_UserUnit ), -wxDefaultPosition, wxDefaultSize, 0 ); -sizer->Add( m_unitLabel, 0, wxALIGN_CENTER_VERTICAL | wxALL ); - -SetSizer( sizer ); -Layout(); -} - - -WX_UNIT_TEXT::~WX_UNIT_TEXT() -{ -} - - -void WX_UNIT_TEXT::SetUnits( EDA_UNITS_T aUnits, bool aConvert ) -{ -assert( !aConvert );// TODO conversion does not work yet - -m_unitLabel->SetLabel( GetUnitsLabel( g_UserUnit ) ); -} - - -void WX_UNIT_TEXT::SetValue( double aValue ) -{ -if( aValue >= 0.0 ) -{ -m_inputValue->SetValue( wxString( Double2Str( aValue ).c_str(), wxConvUTF8 ) ); -m_inputValue->MarkDirty(); -} -else -{ -m_inputValue->SetValue( DEFAULT_VALUE ); -} -} - - -boost::optional WX_UNIT_TEXT::GetValue() const -{ -wxString text = m_inputValue->GetValue(); -double value; - -if( text == DEFAULT_VALUE ) -return boost::optional( -1.0 ); - -if( !text.ToDouble( &value ) ) -return boost::optional(); - -return boost::optional( value ); -} - - -void WX_UNIT_TEXT::onSpinUpEvent( wxSpinEvent& aEvent ) -{ -SetValue( *GetValue() + m_step ); -} - - -void WX_UNIT_TEXT::onSpinDownEvent( wxSpinEvent& aEvent ) -{ -double newValue = *GetValue() - m_step; - -if( newValue >= 0.0 ) -SetValue( newValue ); -} - - -const wxString WX_UNIT_TEXT::DEFAULT_VALUE = _( "default "); diff --git a/include/wxunittext.h b/include/wxunittext.h deleted file mode 100644 index f86d4aa55..0 --- a/include/wxunittext.h +++ /dev/null @@ -1,144 +0,0 @@ -/* - * This program source
[Kicad-developers] [PATCH 07/12] Remove some dead code
--- eeschema/sch_item_struct.cpp | 7 --- eeschema/sch_item_struct.h | 4 2 files changed, 11 deletions(-) diff --git a/eeschema/sch_item_struct.cpp b/eeschema/sch_item_struct.cpp index 6e4f98c8d..873a8921a 100644 --- a/eeschema/sch_item_struct.cpp +++ b/eeschema/sch_item_struct.cpp @@ -40,13 +40,6 @@ const wxString traceFindItem = wxT( "KICAD_TRACE_FIND_ITEM" ); - -bool sort_schematic_items( const SCH_ITEM* aItem1, const SCH_ITEM* aItem2 ) -{ -return *aItem1 < *aItem2; -} - - /* Constructor and destructor for SCH_ITEM */ /* They are not inline because this creates problems with gcc at linking time * in debug mode diff --git a/eeschema/sch_item_struct.h b/eeschema/sch_item_struct.h index a532561e8..48409040e 100644 --- a/eeschema/sch_item_struct.h +++ b/eeschema/sch_item_struct.h @@ -427,8 +427,4 @@ private: virtual bool doIsConnected( const wxPoint& aPosition ) const { return false; } }; - -extern bool sort_schematic_items( const SCH_ITEM* aItem1, const SCH_ITEM* aItem2 ); - - #endif /* SCH_ITEM_STRUCT_H */ -- 2.14.1 ___ 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 10/12] Remove duplicate #include
--- common/class_undoredo_container.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/common/class_undoredo_container.cpp b/common/class_undoredo_container.cpp index ada087480..88eec3001 100644 --- a/common/class_undoredo_container.cpp +++ b/common/class_undoredo_container.cpp @@ -25,8 +25,6 @@ #include #include -#include - #include #include -- 2.14.1 ___ 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 11/12] Remove some else-after-return's
--- common/class_undoredo_container.cpp | 37 +++-- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/common/class_undoredo_container.cpp b/common/class_undoredo_container.cpp index 88eec3001..e3f974eb3 100644 --- a/common/class_undoredo_container.cpp +++ b/common/class_undoredo_container.cpp @@ -178,8 +178,8 @@ EDA_ITEM* PICKED_ITEMS_LIST::GetPickedItem( unsigned int aIdx ) const { if( aIdx < m_ItemsList.size() ) return m_ItemsList[aIdx].GetItem(); -else -return NULL; + +return NULL; } @@ -187,8 +187,8 @@ EDA_ITEM* PICKED_ITEMS_LIST::GetPickedItemLink( unsigned int aIdx ) const { if( aIdx < m_ItemsList.size() ) return m_ItemsList[aIdx].GetLink(); -else -return NULL; + +return NULL; } @@ -196,8 +196,8 @@ UNDO_REDO_T PICKED_ITEMS_LIST::GetPickedItemStatus( unsigned int aIdx ) const { if( aIdx < m_ItemsList.size() ) return m_ItemsList[aIdx].GetStatus(); -else -return UR_UNSPECIFIED; + +return UR_UNSPECIFIED; } @@ -205,8 +205,8 @@ STATUS_FLAGS PICKED_ITEMS_LIST::GetPickerFlags( unsigned aIdx ) const { if( aIdx < m_ItemsList.size() ) return m_ItemsList[aIdx].GetFlags(); -else -return 0; + +return 0; } @@ -217,8 +217,8 @@ bool PICKED_ITEMS_LIST::SetPickedItem( EDA_ITEM* aItem, unsigned aIdx ) m_ItemsList[aIdx].SetItem( aItem ); return true; } -else -return false; + +return false; } @@ -229,8 +229,8 @@ bool PICKED_ITEMS_LIST::SetPickedItemLink( EDA_ITEM* aLink, unsigned aIdx ) m_ItemsList[aIdx].SetLink( aLink ); return true; } -else -return false; + +return false; } @@ -242,8 +242,8 @@ bool PICKED_ITEMS_LIST::SetPickedItem( EDA_ITEM* aItem, UNDO_REDO_T aStatus, uns m_ItemsList[aIdx].SetStatus( aStatus ); return true; } -else -return false; + +return false; } @@ -254,8 +254,8 @@ bool PICKED_ITEMS_LIST::SetPickedItemStatus( UNDO_REDO_T aStatus, unsigned aIdx m_ItemsList[aIdx].SetStatus( aStatus ); return true; } -else -return false; + +return false; } @@ -266,8 +266,8 @@ bool PICKED_ITEMS_LIST::SetPickerFlags( STATUS_FLAGS aFlags, unsigned aIdx ) m_ItemsList[aIdx].SetFlags( aFlags ); return true; } -else -return false; + +return false; } @@ -275,6 +275,7 @@ bool PICKED_ITEMS_LIST::RemovePicker( unsigned aIdx ) { if( aIdx >= m_ItemsList.size() ) return false; + m_ItemsList.erase( m_ItemsList.begin() + aIdx ); return true; } -- 2.14.1 ___ 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/12] Use std::remove_pointer instead of own implementation (NFC)
--- include/core/typeinfo.h | 22 +- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/include/core/typeinfo.h b/include/core/typeinfo.h index 34c3324e6..537171348 100644 --- a/include/core/typeinfo.h +++ b/include/core/typeinfo.h @@ -28,19 +28,7 @@ #ifndef SWIG -#include - -template -struct remove_pointer -{ -typedef T type; -}; - -template -struct remove_pointer -{ -typedef typename remove_pointer::type type; -}; +#include /** * Function IsA() @@ -52,13 +40,13 @@ struct remove_pointer template bool IsA( const I* aObject ) { -return aObject && remove_pointer::type::ClassOf( aObject ); +return aObject && std::remove_pointer::type::ClassOf( aObject ); } template bool IsA( const I& aObject ) { -return remove_pointer::type::ClassOf( &aObject ); +return std::remove_pointer::type::ClassOf( &aObject ); } /** @@ -72,10 +60,10 @@ bool IsA( const I& aObject ) template Casted dyn_cast( From aObject ) { -if( remove_pointer::type::ClassOf ( aObject ) ) +if( std::remove_pointer::type::ClassOf ( aObject ) ) return static_cast( aObject ); -return NULL; +return nullptr; } class EDA_ITEM; -- 2.14.1 ___ 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 09/12] Remove some extra semicolons
--- 3d-viewer/3d_cache/dialogs/3d_cache_dialogs.h | 2 +- 3d-viewer/3d_cache/sg/sg_helpers.cpp| 2 +- 3d-viewer/3d_cache/sg/sg_helpers.h | 2 +- 3d-viewer/3d_cache/sg/sg_node.h | 2 +- 3d-viewer/3d_cache/str_rsort.h | 2 +- 3d-viewer/3d_canvas/eda_3d_canvas.h | 2 +- 3d-viewer/3d_model_viewer/c3d_model_viewer.h| 2 +- 3d-viewer/3d_viewer/eda_3d_viewer.h | 2 +- common/bitmap.cpp | 4 ++-- common/eagle_parser.cpp | 4 ++-- common/single_top.cpp | 2 +- common/view/view.cpp| 2 +- common/widgets/mathplot.cpp | 6 +++--- eeschema/dialogs/dialog_bom.cpp | 2 +- eeschema/pin_shape.cpp | 2 +- eeschema/plot_schematic_HPGL.cpp| 2 +- eeschema/sch_io_mgr.cpp | 2 +- eeschema/sch_io_mgr.h | 2 +- gerbview/class_gerber_draw_item.h | 2 +- include/class_draw_panel_gal.h | 2 +- include/geometry/rtree.h| 2 +- include/plugins/3dapi/ifsg_api.h| 2 +- include/plugins/3dapi/sg_types.h| 2 +- include/system/libcontext.h | 4 ++-- include/tool/tool_base.h| 2 +- include/tool/tool_dispatcher.h | 2 +- include/ttl/halfedge/hetraits.h | 2 +- include/ttl/halfedge/hetriang.h | 4 ++-- kicad/kicad.cpp | 2 +- pcb_calculator/UnitSelector.cpp | 10 +- pcbnew/class_drawsegment.cpp| 2 +- pcbnew/class_module.h | 2 +- pcbnew/class_netclass.h | 2 +- pcbnew/class_pad.h | 2 +- pcbnew/class_zone.cpp | 2 +- pcbnew/class_zone_settings.cpp | 2 +- pcbnew/dialogs/dialog_footprint_wizard_list.cpp | 6 +++--- pcbnew/exporters/export_gencad.cpp | 4 ++-- pcbnew/exporters/export_vrml.cpp| 2 +- pcbnew/moduleframe.cpp | 2 +- pcbnew/router/pns_kicad_iface.h | 2 +- pcbnew/router/pns_router.h | 2 +- pcbnew/tools/tool_event_utils.h | 2 +- pcbnew/tools/zone_create_helper.cpp | 2 +- plugins/3d/idf/s3d_plugin_idf.cpp | 2 +- plugins/3d/vrml/wrlfacet.cpp| 2 +- plugins/3d/vrml/x3d/x3d_ops.h | 2 +- polygon/clipper.cpp | 2 +- 48 files changed, 61 insertions(+), 61 deletions(-) diff --git a/3d-viewer/3d_cache/dialogs/3d_cache_dialogs.h b/3d-viewer/3d_cache/dialogs/3d_cache_dialogs.h index 02cfaa71e..317efd49d 100644 --- a/3d-viewer/3d_cache/dialogs/3d_cache_dialogs.h +++ b/3d-viewer/3d_cache/dialogs/3d_cache_dialogs.h @@ -36,6 +36,6 @@ namespace S3D wxString& prevModelSelectDir, int& prevModelWildcard, S3D_INFO* aModel ); bool Configure3DPaths( wxWindow* aParent, S3D_FILENAME_RESOLVER* aResolver ); -}; +} #endif // CACHE_DIALOGS_3D_H diff --git a/3d-viewer/3d_cache/sg/sg_helpers.cpp b/3d-viewer/3d_cache/sg/sg_helpers.cpp index e2b380943..fec16bfef 100644 --- a/3d-viewer/3d_cache/sg/sg_helpers.cpp +++ b/3d-viewer/3d_cache/sg/sg_helpers.cpp @@ -362,7 +362,7 @@ bool S3D::degenerate( glm::dvec3* pts ) return true; return false; -}; +} static void calcTriad( glm::dvec3* pts, glm::dvec3& tri ) diff --git a/3d-viewer/3d_cache/sg/sg_helpers.h b/3d-viewer/3d_cache/sg/sg_helpers.h index a2f024139..34de4eb1b 100644 --- a/3d-viewer/3d_cache/sg/sg_helpers.h +++ b/3d-viewer/3d_cache/sg/sg_helpers.h @@ -242,6 +242,6 @@ namespace S3D // read an RGB color bool ReadColor( std::istream& aFile, SGCOLOR& aColor ); -}; +} #endif // SG_HELPERS_H diff --git a/3d-viewer/3d_cache/sg/sg_node.h b/3d-viewer/3d_cache/sg/sg_node.h index fc6e646f2..575a1aad0 100644 --- a/3d-viewer/3d_cache/sg/sg_node.h +++ b/3d-viewer/3d_cache/sg/sg_node.h @@ -66,7 +66,7 @@ namespace S3D void FREE_SMESH( SMESH& aMesh); void FREE_S3DMODEL( S3DMODEL& aModel ); -}; +} /** diff --git a/3d-viewer/3d_cache/str_rsort.h b/3d-viewer/3d_cache/str_rsort.h index 13c00e05f..35044c6d7 100644 --- a/3d-viewer/3d_cache/str_rsort.h +++ b/3d-viewer/3d_cache/str_rsort.h @@ -82,6 +82,6 @@ namespace S3D } }; -}; // end NAMESPACE +} // end NAMESPACE #endif // STR_RSORT_H diff --git a/3d-viewer/3d_canvas/eda_3d_canvas.h b/3d-viewer/3d_canvas/eda_3d_canvas.h index 6b20a2b29..e0d601a61 100644 --- a/3d-viewer/3d_canvas/eda_3d_canvas.h +++ b/3d-viewer/3d_canvas/eda_3d_canvas.h @@ -161,7 +161,7 @@ class EDA_3D_CANVAS : public wxGLCanvas void OnTimerTimeout_Redraw( wxTimerEvent& event )
[Kicad-developers] [PATCH 05/12] Fix a typo
--- gerbview/class_gerbview_layer_widget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gerbview/class_gerbview_layer_widget.cpp b/gerbview/class_gerbview_layer_widget.cpp index 6e9b8e312..498dac397 100644 --- a/gerbview/class_gerbview_layer_widget.cpp +++ b/gerbview/class_gerbview_layer_widget.cpp @@ -367,7 +367,7 @@ void GERBER_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled ) /* * Virtual Function useAlternateBitmap * return true if bitmaps shown in Render layer list - * must be alternate bitmap (when a gerber i�mage is loaded), or false to use "normal" bitmap + * must be alternate bitmap (when a gerber image is loaded), or false to use "normal" bitmap */ bool GERBER_LAYER_WIDGET::useAlternateBitmap(int aRow) { -- 2.14.1 ___ 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 00/12] Minor cleanups and improvements
Just a set of small code cleanups to fix a bunch of warnings and remove dead code. Other than that the 'build:' commits avoid/remove/fix the installation of certain files: - it doesn't make much sense to install the INSTALL.txt - *.bat scripts shouldn't be installed on UNIX systems - use CMAKE_INSTALL_* consistently to install files in the correct places Marvin Schmidt (12): build: Don't install INSTALL.txt build: Use CMAKE_INSTALL_DATADIR build: Remove dead code build: Don't install *.bat scripts on Unix Fix a typo Remove unused #define Remove some dead code Remove orphaned code files Remove some extra semicolons Remove duplicate #include Remove some else-after-return's Use std::remove_pointer instead of own implementation (NFC) 3d-viewer/3d_cache/dialogs/3d_cache_dialogs.h | 2 +- 3d-viewer/3d_cache/sg/sg_helpers.cpp| 2 +- 3d-viewer/3d_cache/sg/sg_helpers.h | 2 +- 3d-viewer/3d_cache/sg/sg_node.h | 2 +- 3d-viewer/3d_cache/str_rsort.h | 2 +- 3d-viewer/3d_canvas/eda_3d_canvas.h | 2 +- 3d-viewer/3d_model_viewer/c3d_model_viewer.h| 2 +- 3d-viewer/3d_viewer/eda_3d_viewer.h | 2 +- CMakeLists.txt | 17 +-- common/bitmap.cpp | 4 +- common/class_undoredo_container.cpp | 39 --- common/eagle_parser.cpp | 4 +- common/single_top.cpp | 2 +- common/view/view.cpp| 2 +- common/widgets/mathplot.cpp | 6 +- common/wxunittext.cpp | 142 --- eeschema/dialogs/dialog_bom.cpp | 2 +- eeschema/pin_shape.cpp | 2 +- eeschema/plot_schematic_HPGL.cpp| 2 +- eeschema/sch_io_mgr.cpp | 2 +- eeschema/sch_io_mgr.h | 2 +- eeschema/sch_item_struct.cpp| 7 -- eeschema/sch_item_struct.h | 4 - eeschema/sch_screen.cpp | 3 - gerbview/class_gerber_draw_item.h | 2 +- gerbview/class_gerbview_layer_widget.cpp| 2 +- include/class_draw_panel_gal.h | 2 +- include/core/typeinfo.h | 22 +--- include/geometry/rtree.h| 2 +- include/plugins/3dapi/ifsg_api.h| 2 +- include/plugins/3dapi/sg_types.h| 2 +- include/system/libcontext.h | 4 +- include/tool/tool_base.h| 2 +- include/tool/tool_dispatcher.h | 2 +- include/ttl/halfedge/hetraits.h | 2 +- include/ttl/halfedge/hetriang.h | 4 +- include/wxunittext.h| 144 kicad/kicad.cpp | 2 +- pcb_calculator/UnitSelector.cpp | 10 +- pcbnew/class_drawsegment.cpp| 2 +- pcbnew/class_module.h | 2 +- pcbnew/class_netclass.h | 2 +- pcbnew/class_pad.h | 2 +- pcbnew/class_zone.cpp | 2 +- pcbnew/class_zone_settings.cpp | 2 +- pcbnew/dialogs/dialog_footprint_wizard_list.cpp | 6 +- pcbnew/exporters/export_gencad.cpp | 4 +- pcbnew/exporters/export_vrml.cpp| 2 +- pcbnew/moduleframe.cpp | 2 +- pcbnew/router/pns_kicad_iface.h | 2 +- pcbnew/router/pns_router.h | 2 +- pcbnew/tools/tool_event_utils.h | 2 +- pcbnew/tools/zone_create_helper.cpp | 2 +- plugins/3d/idf/s3d_plugin_idf.cpp | 2 +- plugins/3d/vrml/wrlfacet.cpp| 2 +- plugins/3d/vrml/x3d/x3d_ops.h | 2 +- polygon/clipper.cpp | 2 +- 57 files changed, 89 insertions(+), 413 deletions(-) delete mode 100644 common/wxunittext.cpp delete mode 100644 include/wxunittext.h -- 2.14.1 ___ 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 01/12] build: Don't install INSTALL.txt
--- CMakeLists.txt | 4 1 file changed, 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9405416a3..5d01d6577 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -775,10 +775,6 @@ add_custom_target( uninstall # Installation # -install( FILES INSTALL.txt -DESTINATION ${KICAD_DOCS} -COMPONENT resources ) - ### # Install scripts ### -- 2.14.1 ___ 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/3] vector2d: Fix traits usage and use std::numeric_limits
--- include/math/vector2d.h | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/include/math/vector2d.h b/include/math/vector2d.h index 8bf2da588..d67f9b72f 100644 --- a/include/math/vector2d.h +++ b/include/math/vector2d.h @@ -29,8 +29,8 @@ #define VECTOR2D_H_ #include -#include #include +#include #include #include @@ -55,8 +55,6 @@ template <> struct VECTOR2_TRAITS { typedef int64_t extended_type; -static const extended_type ECOORD_MAX = 0x7fffULL; -static const extended_type ECOORD_MIN = 0x8000ULL; }; // Forward declarations for template friends @@ -74,12 +72,15 @@ std::ostream& operator<<( std::ostream& aStream, const VECTOR2& aVector ); * */ template -class VECTOR2 : public VECTOR2_TRAITS +class VECTOR2 { public: typedef typename VECTOR2_TRAITS::extended_type extended_type; typedef T coord_type; +static constexpr extended_type ECOORD_MAX = std::numeric_limits::max(); +static constexpr extended_type ECOORD_MIN = std::numeric_limits::min(); + T x, y; // Constructors -- 2.14.1 ___ 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] box2: Remove wrong use of typename keyword
--- include/math/box2.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/math/box2.h b/include/math/box2.h index 5bf6ddd03..fb6fd9d5c 100644 --- a/include/math/box2.h +++ b/include/math/box2.h @@ -47,7 +47,7 @@ private: public: typedef typename Vec::coord_type coord_type; typedef typename Vec::extended_type ecoord_type; -typedef typename std::numeric_limits coord_limits; +typedef std::numeric_limits coord_limits; BOX2() {}; -- 2.14.1 ___ 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] vector2d: Remove duplicate #include
--- include/math/vector2d.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/math/vector2d.h b/include/math/vector2d.h index abe3734ac..8bf2da588 100644 --- a/include/math/vector2d.h +++ b/include/math/vector2d.h @@ -32,7 +32,6 @@ #include #include #include -#include #include -- 2.14.1 ___ 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/3] Minor fixes for VECTOR2 and BOX2
I was irritated by the usage of the vector_traits class as you usually use it to gather more information about a certain type using something like `traits::property`. Here the vector2d classes queries the traits class to get the extended coordinate type but also derives from it to get the limits of that type which are hardcoded in the traits class. The second patch removes the hardcoded limits from the traits class and the inheritance of the vector2d class from the traits class. Instead the vector2d class uses the std::numeric_limits facility to get the limits of the extended coordinate type it got through the traits class The other two patches are just minor fixes. The wrong use of the typename keyword in the box2 class might have been triggering a bug in the MSVC compiler though (not sure about that as I can't test it, just seems possible from workaround I've seen) Marvin Schmidt (3): vector2d: Remove duplicate #include vector2d: Fix traits usage and use std::numeric_limits box2: Remove wrong use of typename keyword include/math/box2.h | 2 +- include/math/vector2d.h | 10 +- 2 files changed, 6 insertions(+), 6 deletions(-) -- 2.14.1 ___ 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] How I Learned to Stop Worrying (about whitespace) and Love clang-format
Hi everybody! I've been following the KiCad development for some time and I feel like quite some time is wasted on whitespaces. Be it either when new contributors send in reviews (I find the coding style rather hard to get acustomed to as well, personally) or when fixing them by hand when seeing them (To make things worse, this often happens in a single commit together with functional changes which makes it really hard to see the relevant bits). All in all it feels like the code base is in a very inconsistent state. According to the developer documentation you should use uncrustify with the provided config to make sure the your code doesn't violate the code style, but it seems nobody really does that since running it on the code base yields a big diff stat. I would like to propose using clang-format to enforce a consistent code style and tried to put together a config which resembles the current style as close as possible. There are a few things that can't be achieved the way it's currently defined by the style guide. So I want to ask whether you guys are willing to make some compromises in that regard? Considering the benefits of not having to deal with code formattings etc. and the time it saves I think it's well worth it. Additionally the use of clang-format will allow the usage of all the great clang tools for further tool-based code cleanups/improvements while maintaining the defined code style Opinions? Best regards, Marvin ___ 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 missing include in kicad_string.h
Without this include the HAVE_STRTOKR define won't be available to the preprocessor and the strtok_r function will be declared unconditionally and eventually clash with the declaration from the system provided equivalent: ../../include/kicad_string.h:171:71: error: declaration of 'char* strtok_r(char*, const char*, char**)' has a different exception specifier extern "C" char* strtok_r( char* str, const char* delim, char** nextp ); ^ In file included from /usr/x86_64-pc-linux-gnu/include/wx-3.0/wx/string.h:38:0, from ../../include/kicad_string.h:33, from ../../pcbnew/netlist_reader.cpp:31: /usr/x86_64-pc-linux-gnu/include/string.h:354:14: error: from previous declaration 'char* strtok_r(char*, const char*, char**) throw ()' --- include/kicad_string.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/kicad_string.h b/include/kicad_string.h index e65486c..d3136a3 100644 --- a/include/kicad_string.h +++ b/include/kicad_string.h @@ -30,6 +30,8 @@ #ifndef KICAD_STRING_H_ #define KICAD_STRING_H_ +#include "config.h" + #include #include -- 2.10.1 ___ 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 04/12] Avoid C99 style compound statement
On Fri, May 27, 2016 at 04:32:51PM +0200, Simon Richter wrote: > > Support for C99 in C++ programs is a gcc extension. > --- > eeschema/autoplace_fields.cpp | 5 - > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/eeschema/autoplace_fields.cpp b/eeschema/autoplace_fields.cpp > index 9af6247..96ee6c0 100644 > --- a/eeschema/autoplace_fields.cpp > +++ b/eeschema/autoplace_fields.cpp > @@ -410,7 +410,10 @@ protected: > } > > if( collision != COLLIDE_NONE ) > -colliding.push_back( (SIDE_AND_COLL){ side, collision } ); > +{ > +SIDE_AND_COLL tmp = { side, collision }; > +colliding.push_back( tmp ); > +} You can just use colliding.push_back({ side, collision }); or colliding.push_back(SIDE_AND_COLL{side, collision}); here. The C++ compiler can deduce the type of the argument from the container type. Both versions construct an object in-place and allow the compiler to take advantage of move semantics as far as I can tell. ___ 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