From d4e04dcc9702a4eaf764af98cb2b56887c000be6 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Mon, 19 Jan 2015 20:03:50 +0100 Subject: [PATCH 01/29] Fix bugs detected by Cppcheck. --- common/gal/opengl/opengl_gal.cpp | 3 ++- cvpcb/autosel.cpp | 2 +- pcbnew/class_pcb_text.cpp | 2 +- pcbnew/cross-probing.cpp | 1 + 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/common/gal/opengl/opengl_gal.cpp b/common/gal/opengl/opengl_gal.cpp index 569cacf23d..404e3a0728 100644 --- a/common/gal/opengl/opengl_gal.cpp +++ b/common/gal/opengl/opengl_gal.cpp @@ -812,10 +812,11 @@ void OPENGL_GAL::drawLineQuad( const VECTOR2D& aStartPoint, const VECTOR2D& aEnd VECTOR2D startEndVector = aEndPoint - aStartPoint; double lineLength = startEndVector.EuclideanNorm(); - double scale = 0.5 * lineWidth / lineLength; if( lineLength <= 0.0 ) return; + + double scale = 0.5 * lineWidth / lineLength; // The perpendicular vector also needs transformations glm::vec4 vector = currentManager->GetTransformation() * diff --git a/cvpcb/autosel.cpp b/cvpcb/autosel.cpp index a6419aa745..8f4095f001 100644 --- a/cvpcb/autosel.cpp +++ b/cvpcb/autosel.cpp @@ -218,7 +218,7 @@ void CVPCB_MAINFRAME::AutomaticFootprintMatching( wxCommandEvent& event ) bool equ_is_unique = true; unsigned next = idx+1; - unsigned previous = idx-1; + int previous = idx-1; if( next < equiv_List.size() && equivItem.m_ComponentValue == equiv_List[next].m_ComponentValue ) diff --git a/pcbnew/class_pcb_text.cpp b/pcbnew/class_pcb_text.cpp index f9bdee7f7d..bedc597e55 100644 --- a/pcbnew/class_pcb_text.cpp +++ b/pcbnew/class_pcb_text.cpp @@ -74,7 +74,7 @@ void TEXTE_PCB::Copy( TEXTE_PCB* source ) m_Bold = source->m_Bold; m_HJustify = source->m_HJustify; m_VJustify = source->m_VJustify; - m_MultilineAllowed = m_MultilineAllowed; + m_MultilineAllowed = source->m_MultilineAllowed; m_Text = source->m_Text; } diff --git a/pcbnew/cross-probing.cpp b/pcbnew/cross-probing.cpp index e09da9d899..d2ba0bef97 100644 --- a/pcbnew/cross-probing.cpp +++ b/pcbnew/cross-probing.cpp @@ -45,6 +45,7 @@ void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline ) wxPoint pos; strncpy( line, cmdline, sizeof(line) - 1 ); + line[sizeof(line) - 1] = 0; idcmd = strtok( line, " \n\r" ); text = strtok( NULL, " \n\r" ); From 59f497978a78cd77a5db227b17f96c53d8536d03 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Tue, 20 Jan 2015 08:01:32 +0100 Subject: [PATCH 02/29] Pcbnew, layers manager: Fix an annoying bug I added in rev 5359, in Render options: in Board editor many render options were not displayed (similar fp editor mode). Now fixed. --- pcbnew/class_pcb_layer_widget.cpp | 4 ++-- pcbnew/dragsegm.cpp | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pcbnew/class_pcb_layer_widget.cpp b/pcbnew/class_pcb_layer_widget.cpp index 1e1b89f0b2..013326c2cb 100644 --- a/pcbnew/class_pcb_layer_widget.cpp +++ b/pcbnew/class_pcb_layer_widget.cpp @@ -257,7 +257,7 @@ void PCB_LAYER_WIDGET::ReFillRender() { LAYER_WIDGET::ROW renderRow = s_render_rows[row]; - if( !isAllowedInFpMode( renderRow.id ) ) + if( m_fp_editor_mode && !isAllowedInFpMode( renderRow.id ) ) continue; renderRow.tooltip = wxGetTranslation( s_render_rows[row].tooltip ); @@ -284,7 +284,7 @@ void PCB_LAYER_WIDGET::SyncRenderStates() { int rowId = s_render_rows[row].id; - if( !isAllowedInFpMode( rowId ) ) + if( m_fp_editor_mode && !isAllowedInFpMode( rowId ) ) continue; // this does not fire a UI event diff --git a/pcbnew/dragsegm.cpp b/pcbnew/dragsegm.cpp index fd1c718d8f..3b8a89f281 100644 --- a/pcbnew/dragsegm.cpp +++ b/pcbnew/dragsegm.cpp @@ -320,16 +320,16 @@ void AddSegmentToDragList( int flag, TRACK* aTrack ) DRAG_SEGM_PICKER wrapper( aTrack ); if( flag & STARTPOINT ) - wrapper.m_TempFlags |= 1; - - if( flag & ENDPOINT ) - wrapper.m_TempFlags |= 2; - - if( flag & STARTPOINT ) + { + wrapper.m_TempFlags |= STARTPOINT; aTrack->SetFlags( STARTPOINT ); + } if( flag & ENDPOINT ) + { + wrapper.m_TempFlags |= ENDPOINT; aTrack->SetFlags( ENDPOINT ); + } g_DragSegmentList.push_back( wrapper ); } From 64dd1f74617a6865150af33f8094ad68dca83a35 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Tue, 20 Jan 2015 13:06:44 +0100 Subject: [PATCH 03/29] Eeschema: fix a minor bug and enhances SCH_MARHER::Matches function ( partial use of 0005-SCH_MARKER-fix-a-Woverloaded-virtual.patch, from ) and other very minor fix. --- common/base_struct.cpp | 8 ++++---- eeschema/sch_marker.cpp | 22 ++++++++++------------ eeschema/sch_marker.h | 9 ++++++--- include/base_struct.h | 3 ++- 4 files changed, 22 insertions(+), 20 deletions(-) diff --git a/common/base_struct.cpp b/common/base_struct.cpp index 4db32b92e8..683d404038 100644 --- a/common/base_struct.cpp +++ b/common/base_struct.cpp @@ -49,7 +49,7 @@ enum textbox { EDA_ITEM::EDA_ITEM( EDA_ITEM* parent, KICAD_T idType ) { - InitVars(); + initVars(); m_StructType = idType; m_Parent = parent; } @@ -57,14 +57,14 @@ EDA_ITEM::EDA_ITEM( EDA_ITEM* parent, KICAD_T idType ) EDA_ITEM::EDA_ITEM( KICAD_T idType ) { - InitVars(); + initVars(); m_StructType = idType; } EDA_ITEM::EDA_ITEM( const EDA_ITEM& base ) { - InitVars(); + initVars(); m_StructType = base.m_StructType; m_Parent = base.m_Parent; m_Flags = base.m_Flags; @@ -75,7 +75,7 @@ EDA_ITEM::EDA_ITEM( const EDA_ITEM& base ) } -void EDA_ITEM::InitVars() +void EDA_ITEM::initVars() { m_StructType = TYPE_NOT_INIT; Pnext = NULL; // Linked list: Link (next struct) diff --git a/eeschema/sch_marker.cpp b/eeschema/sch_marker.cpp index d4c0422a1e..3057e06e13 100644 --- a/eeschema/sch_marker.cpp +++ b/eeschema/sch_marker.cpp @@ -125,22 +125,20 @@ void SCH_MARKER::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, } -bool SCH_MARKER::Matches( wxFindReplaceData& aSearchData, wxPoint * aFindLocation ) +bool SCH_MARKER::Matches( wxFindReplaceData& aSearchData, void* aAuxData, + wxPoint * aFindLocation ) { - if( !SCH_ITEM::Matches( m_drc.GetMainText(), aSearchData ) ) + if( SCH_ITEM::Matches( m_drc.GetErrorText(), aSearchData ) || + SCH_ITEM::Matches( m_drc.GetMainText(), aSearchData ) || + SCH_ITEM::Matches( m_drc.GetAuxiliaryText(), aSearchData ) ) { - if( SCH_ITEM::Matches( m_drc.GetAuxiliaryText(), aSearchData ) ) - { - if( aFindLocation ) - *aFindLocation = m_Pos; - return true; - } - return false; + if( aFindLocation ) + *aFindLocation = m_Pos; + + return true; } - if( aFindLocation ) - *aFindLocation = m_Pos; - return true; + return false; } diff --git a/eeschema/sch_marker.h b/eeschema/sch_marker.h index 6c94bb79cc..343ff6b290 100644 --- a/eeschema/sch_marker.h +++ b/eeschema/sch_marker.h @@ -1,8 +1,8 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com - * Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr + * 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 @@ -89,13 +89,16 @@ public: void Rotate( wxPoint aPosition ); /** + * Function Matches, virtual from the base class EDA_ITEM * Compare DRC marker main and auxiliary text against search string. * * @param aSearchData - Criteria to search against. + * @param aAuxData A pointer to optional data required for the search or NULL + * if not used. * @param aFindLocation - a wxPoint where to put the location of matched item. can be NULL. * @return True if the DRC main or auxiliary text matches the search criteria. */ - bool Matches( wxFindReplaceData& aSearchData, wxPoint* aFindLocation ); + bool Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint* aFindLocation ); void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ); diff --git a/include/base_struct.h b/include/base_struct.h index 8a5332df56..360e4ff6b1 100644 --- a/include/base_struct.h +++ b/include/base_struct.h @@ -186,7 +186,7 @@ protected: private: - void InitVars(); + void initVars(); public: @@ -428,6 +428,7 @@ public: /** * Function Matches * compares \a aText against search criteria in \a aSearchData. + * Helper function used in search and replace dialog * * @param aText A reference to a wxString object containing the string to test. * @param aSearchData The criteria to search against. From ebb967c46ff0ed8452bd18cb73556134d9de353d Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Thu, 22 Jan 2015 13:06:34 +0100 Subject: [PATCH 04/29] Pcbnew: fix issues and potential issues when reading board files and mainly old board files, and enhance the DRC tests and Delete Single Pad Net option when reading a netlist: * Delete Single Pad Net option does not delete the net if a zone use this net (i.e. is attached to this pad). * pcb_parser accept now negative netcodes in zones (can happen with old files, which previously could crash Pcbnew) * pcb_parser accept now files with incorrect or missing net count (can happen with old files, which previously could crash Pcbnew) * if a zone has a non-existent net name it now keep this net name, and DRC detect it (previously, the net name was lost, and the DRC did not tected this issue). * Drc test: now detect a "dead" net, i.e. a net with 0 pads, but still used by a zone. It happens easily after a schematic modification, when a net disappears or is renamed. --- pcbnew/class_board.cpp | 72 +++++++++++++++++++++------ pcbnew/class_board_connected_item.cpp | 8 +-- pcbnew/class_drc_item.cpp | 8 +-- pcbnew/class_netinfo.h | 2 +- pcbnew/class_zone.cpp | 24 ++++----- pcbnew/class_zone.h | 9 ++-- pcbnew/drc.cpp | 22 ++++++-- pcbnew/drc_stuff.h | 4 +- pcbnew/pcb_parser.cpp | 71 +++++++++++++++++++++----- pcbnew/pcb_parser.h | 13 ++++- pcbnew/zones_by_polygon.cpp | 4 +- 11 files changed, 172 insertions(+), 65 deletions(-) diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index d52d6d7ff6..d6ec4d4197 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.cpp @@ -6,11 +6,11 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr + * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck * Copyright (C) 2011 Wayne Stambaugh * - * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -2459,14 +2459,14 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets, } } + // We need the pad list, for next tests. + // padlist is the list of pads, sorted by netname. + BuildListOfNets(); + std::vector padlist = GetPads(); + // If needed, remove the single pad nets: if( aDeleteSinglePadNets && !aNetlist.IsDryRun() ) { - BuildListOfNets(); - - std::vector padlist = GetPads(); - - // padlist is the list of pads, sorted by netname. int count = 0; wxString netname; D_PAD* pad = NULL; @@ -2483,17 +2483,41 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets, { if( previouspad && count == 1 ) { - if( aReporter && aReporter->ReportAll() ) + // First, see if we have a copper zone attached to this pad. + // If so, this is not really a single pad net + + for( int ii = 0; ii < GetAreaCount(); ii++ ) { - msg.Printf( _( "Remove single pad net \"%s\" on \"%s\" pad '%s'\n" ), - GetChars( previouspad->GetNetname() ), - GetChars( previouspad->GetParent()->GetReference() ), - GetChars( previouspad->GetPadName() ) ); - aReporter->Report( msg ); + ZONE_CONTAINER* zone = GetArea( ii ); + + if( !zone->IsOnCopperLayer() ) + continue; + + if( zone->GetIsKeepout() ) + continue; + + if( zone->GetNet() == previouspad->GetNet() ) + { + count++; + break; + } } - previouspad->SetNetCode( NETINFO_LIST::UNCONNECTED ); + if( count == 1 ) // Really one pad, and nothing else + { + if( aReporter && aReporter->ReportAll() ) + { + msg.Printf( _( "Remove single pad net \"%s\" on \"%s\" pad '%s'\n" ), + GetChars( previouspad->GetNetname() ), + GetChars( previouspad->GetParent()->GetReference() ), + GetChars( previouspad->GetPadName() ) ); + aReporter->Report( msg ); + } + + previouspad->SetNetCode( NETINFO_LIST::UNCONNECTED ); + } } + netname = pad->GetNetname(); count = 1; } @@ -2515,6 +2539,10 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets, // They should exist in footprints, otherwise the footprint is wrong // note also references or time stamps are updated, so we use only // the reference to find a footprint + // + // Also verify if zones have acceptable nets, i.e. nets with pads. + // Zone with no pad belongs to a "dead" net which happens after changes in schematic + // when no more pad use this net name. if( aReporter && aReporter->ReportErrors() ) { wxString padname; @@ -2543,6 +2571,22 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets, aReporter->Report( msg ); } } + + // Test copper zones to detect "dead" nets (nets without any pad): + for( int ii = 0; ii < GetAreaCount(); ii++ ) + { + ZONE_CONTAINER* zone = GetArea( ii ); + + if( !zone->IsOnCopperLayer() || zone->GetIsKeepout() ) + continue; + + if( zone->GetNet()->GetNodesCount() == 0 ) + { + msg.Printf( _( "* Warning: copper zone (net name '%s'): net has no pad*\n" ), + GetChars( zone->GetNet()->GetNetname() ) ); + aReporter->Report( msg ); + } + } } } diff --git a/pcbnew/class_board_connected_item.cpp b/pcbnew/class_board_connected_item.cpp index 09cc9eafd8..dfe4e96f3e 100644 --- a/pcbnew/class_board_connected_item.cpp +++ b/pcbnew/class_board_connected_item.cpp @@ -1,9 +1,9 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr + * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck - * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -50,10 +50,10 @@ BOARD_CONNECTED_ITEM::BOARD_CONNECTED_ITEM( const BOARD_CONNECTED_ITEM& aItem ) void BOARD_CONNECTED_ITEM::SetNetCode( int aNetCode ) { - assert( aNetCode >= 0 ); +// assert( aNetCode >= 0 ); BOARD* board = GetBoard(); - if( board ) + if( ( aNetCode >= 0 ) && board ) m_netinfo = board->FindNet( aNetCode ); else m_netinfo = &NETINFO_LIST::ORPHANED; diff --git a/pcbnew/class_drc_item.cpp b/pcbnew/class_drc_item.cpp index efb70268e1..ff145f47da 100644 --- a/pcbnew/class_drc_item.cpp +++ b/pcbnew/class_drc_item.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2007 Dick Hollenbeck, dick@softplc.com - * Copyright (C) 2007 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 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 @@ -75,8 +75,10 @@ wxString DRC_ITEM::GetErrorText() const return wxString( _( "Copper area inside copper area" ) ); case COPPERAREA_CLOSE_TO_COPPERAREA: return wxString( _( "Copper areas intersect or are too close" ) ); - case DRCE_NON_EXISTANT_NET_FOR_ZONE_OUTLINE: - return wxString( _( "Copper area has a nonexistent net name" ) ); + + case DRCE_SUSPICIOUS_NET_FOR_ZONE_OUTLINE: + return wxString( _( "Copper area belongs a net which has no pads. This is strange" ) ); + case DRCE_HOLE_NEAR_PAD: return wxString( _( "Hole near pad" ) ); case DRCE_HOLE_NEAR_TRACK: diff --git a/pcbnew/class_netinfo.h b/pcbnew/class_netinfo.h index 3b28a9ed8f..8d8f3df89c 100644 --- a/pcbnew/class_netinfo.h +++ b/pcbnew/class_netinfo.h @@ -320,7 +320,7 @@ public: return NULL; } - ///> Constant that holds the unconnected net number + ///> Constant that holds the unconnected net number (typically 0) static const int UNCONNECTED; ///> NETINFO_ITEM meaning that there was no net assigned for an item, as there was no diff --git a/pcbnew/class_zone.cpp b/pcbnew/class_zone.cpp index e7e3081e34..17938aea9f 100644 --- a/pcbnew/class_zone.cpp +++ b/pcbnew/class_zone.cpp @@ -1,9 +1,9 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr + * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck - * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -625,27 +625,21 @@ void ZONE_CONTAINER::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) { if( GetNetCode() >= 0 ) { - NETINFO_ITEM* equipot = GetNet(); + NETINFO_ITEM* net = GetNet(); - if( equipot ) - msg = equipot->GetNetname(); - else - msg = wxT( "" ); - } - else // a netcode < 0 is an error - { - msg = wxT( " [" ); - msg << GetNetname() + wxT( "]" ); - msg << wxT( " <" ) << _( "Not Found" ) << wxT( ">" ); + if( net ) + msg = net->GetNetname(); + else // Should not occur + msg = _( "" ); } + else // a netcode < 0 is an error + msg = wxT( "" ); aList.push_back( MSG_PANEL_ITEM( _( "NetName" ), msg, RED ) ); -#if 1 // Display net code : (useful in test or debug) msg.Printf( wxT( "%d" ), GetNetCode() ); aList.push_back( MSG_PANEL_ITEM( _( "NetCode" ), msg, RED ) ); -#endif // Display priority level msg.Printf( wxT( "%d" ), GetPriority() ); diff --git a/pcbnew/class_zone.h b/pcbnew/class_zone.h index 17c51cfcf9..13eb37b271 100644 --- a/pcbnew/class_zone.h +++ b/pcbnew/class_zone.h @@ -2,8 +2,8 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com - * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -578,7 +578,6 @@ public: void SetDoNotAllowVias( bool aEnable ) { m_doNotAllowVias = aEnable; } void SetDoNotAllowTracks( bool aEnable ) { m_doNotAllowTracks = aEnable; } - #if defined(DEBUG) virtual void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override #endif @@ -632,8 +631,8 @@ private: /// The index of the corner being moved or -1 if no corner is selected. int m_CornerSelection; - int m_localFlgs; ///< Flags used in polygon calculations. - + /// Variable used in polygon calculations. + int m_localFlgs; /** Segments used to fill the zone (#m_FillMode ==1 ), when fill zone by segment is used. * In this case the segments have #m_ZoneMinThickness width. diff --git a/pcbnew/drc.cpp b/pcbnew/drc.cpp index 03357376b8..93b7c96988 100644 --- a/pcbnew/drc.cpp +++ b/pcbnew/drc.cpp @@ -2,9 +2,9 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2004-2014 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 2004-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2014 Dick Hollenbeck, dick@softplc.com - * Copyright (C) 2014 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 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 @@ -564,6 +564,10 @@ void DRC::testZones() // if a netcode is < 0 the netname was not found when reading a netlist // if a netcode is == 0 the netname is void, and the zone is not connected. // This is allowed, but i am not sure this is a good idea + // + // In recent Pcbnew versions, the netcode is always >= 0, but an internal net name + // is stored, and initalized from the file or the zone properpies editor. + // if it differs from the net name from net code, there is a DRC issue for( int ii = 0; ii < m_pcb->GetAreaCount(); ii++ ) { ZONE_CONTAINER* test_area = m_pcb->GetArea( ii ); @@ -571,13 +575,21 @@ void DRC::testZones() if( !test_area->IsOnCopperLayer() ) continue; - if( test_area->GetNetCode() < 0 ) + int netcode = test_area->GetNetCode(); + + // a netcode < 0 or > 0 and no pad in net is a error or strange + // perhaps a "dead" net, which happens when all pads in this net were removed + // Remark: a netcode < 0 should not happen (this is more a bug somewhere) + int pads_in_net = (test_area->GetNetCode() > 0) ? + test_area->GetNet()->GetNodesCount() : 1; + + if( ( netcode < 0 ) || pads_in_net == 0 ) { m_currentMarker = fillMarker( test_area, - DRCE_NON_EXISTANT_NET_FOR_ZONE_OUTLINE, m_currentMarker ); + DRCE_SUSPICIOUS_NET_FOR_ZONE_OUTLINE, m_currentMarker ); m_pcb->Add( m_currentMarker ); m_mainWindow->GetGalCanvas()->GetView()->Add( m_currentMarker ); - m_currentMarker = 0; + m_currentMarker = NULL; } } diff --git a/pcbnew/drc_stuff.h b/pcbnew/drc_stuff.h index d8f4e7dfe5..6b4b98dec3 100644 --- a/pcbnew/drc_stuff.h +++ b/pcbnew/drc_stuff.h @@ -6,7 +6,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2007 Dick Hollenbeck, dick@softplc.com - * Copyright (C) 2007 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 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 @@ -60,7 +60,7 @@ #define DRCE_MICRO_VIA_INCORRECT_LAYER_PAIR 21 ///< micro via's layer pair incorrect (layers must be adjacent) #define COPPERAREA_INSIDE_COPPERAREA 22 ///< copper area outlines intersect #define COPPERAREA_CLOSE_TO_COPPERAREA 23 ///< copper area outlines are too close -#define DRCE_NON_EXISTANT_NET_FOR_ZONE_OUTLINE 24 ///< copper area outline has an incorrect netcode due to a netname not found +#define DRCE_SUSPICIOUS_NET_FOR_ZONE_OUTLINE 24 ///< copper area has a net but no pads in nets, which is suspicious #define DRCE_HOLE_NEAR_PAD 25 ///< hole too close to pad #define DRCE_HOLE_NEAR_TRACK 26 ///< hole too close to track #define DRCE_TOO_SMALL_TRACK_WIDTH 27 ///< Too small track width diff --git a/pcbnew/pcb_parser.cpp b/pcbnew/pcb_parser.cpp index 1cfc1fb08e..a4c8785f3e 100644 --- a/pcbnew/pcb_parser.cpp +++ b/pcbnew/pcb_parser.cpp @@ -112,6 +112,17 @@ void PCB_PARSER::init() } +void PCB_PARSER::pushValueIntoMap( int aIndex, int aValue ) +{ + // Add aValue in netcode mapping (m_netCodes) at index aNetCode + // ensure there is room in m_netCodes for that, and add room if needed. + + if( (int)m_netCodes.size() <= aIndex ) + m_netCodes.resize( aIndex+1 ); + + m_netCodes[aIndex] = aValue; +} + double PCB_PARSER::parseDouble() throw( IO_ERROR ) { char* tmp; @@ -1194,7 +1205,7 @@ void PCB_PARSER::parseNETINFO_ITEM() throw( IO_ERROR, PARSE_ERROR ) m_board->AppendNet( net ); // Store the new code mapping - m_netCodes[netCode] = net->GetNet(); + pushValueIntoMap( netCode, net->GetNet() ); } } @@ -2526,6 +2537,8 @@ ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER() throw( IO_ERROR, PARSE_ERROR ) int hatchPitch = Mils2iu( CPolyLine::GetDefaultHatchPitchMils() ); wxPoint pt; T token; + int tmp; + wxString netnameFromfile; // the zone net name find in file // bigger scope since each filled_polygon is concatenated in here CPOLYGONS_LIST pts; @@ -2545,20 +2558,19 @@ ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER() throw( IO_ERROR, PARSE_ERROR ) // Init the net code only, not the netname, to be sure // the zone net name is the name read in file. // (When mismatch, the user will be prompted in DRC, to fix the actual name) - zone->SetNetCode( getNetCode( parseInt( "net number" ) ) ); + tmp = getNetCode( parseInt( "net number" ) ); + + if( tmp < 0 ) + tmp = 0; + + zone->SetNetCode( tmp ); + NeedRIGHT(); break; case T_net_name: NeedSYMBOLorNUMBER(); - if( zone->GetNet()->GetNetname() != FromUTF8() ) - { - wxString msg; - msg.Printf( _( "There is a zone that belongs to a not existing net" - "(%s), you should verify it." ), GetChars( FromUTF8() ) ); - DisplayError( NULL, msg ); - zone->SetNetCode( NETINFO_LIST::UNCONNECTED ); - } + netnameFromfile = FromUTF8(); NeedRIGHT(); break; @@ -2829,10 +2841,45 @@ ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER() throw( IO_ERROR, PARSE_ERROR ) if( pts.GetCornersCount() ) zone->AddFilledPolysList( pts ); - // Ensure keepout does not have a net (which have no sense for a keepout zone) - if( zone->GetIsKeepout() ) + // Ensure keepout and non copper zones do not have a net + // (which have no sense for these zones) + // the netcode 0 is used for these zones + bool zone_has_net = zone->IsOnCopperLayer() && !zone->GetIsKeepout(); + + if( !zone_has_net ) zone->SetNetCode( NETINFO_LIST::UNCONNECTED ); + // Ensure the zone net name is valid, and matches the net code, for copper zones + if( zone_has_net && ( zone->GetNet()->GetNetname() != netnameFromfile ) ) + { + // Can happens which old boards, with nonexistent nets ... + // or after being edited by hand + // We try to fix the mismatch. + NETINFO_ITEM* net = m_board->FindNet( netnameFromfile ); + + if( net ) // An existing net has the same net name. use it for the zone + zone->SetNetCode( net->GetNet() ); + else // Not existing net: add a new net to keep trace of the zone netname + { + int newnetcode = m_board->GetNetCount(); + net = new NETINFO_ITEM( m_board, netnameFromfile, newnetcode ); + m_board->AppendNet( net ); + + // Store the new code mapping + pushValueIntoMap( newnetcode, net->GetNet() ); + // and update the zone netcode + zone->SetNetCode( net->GetNet() ); + + // Prompt the user + wxString msg; + msg.Printf( _( "There is a zone that belongs to a not existing net\n" + "\"%s\"\n" + "you should verify and edit it (run DRC test)." ), + GetChars( netnameFromfile ) ); + DisplayError( NULL, msg ); + } + } + return zone.release(); } diff --git a/pcbnew/pcb_parser.h b/pcbnew/pcb_parser.h index 0e2514bc57..d42081e409 100644 --- a/pcbnew/pcb_parser.h +++ b/pcbnew/pcb_parser.h @@ -69,15 +69,24 @@ class PCB_PARSER : public PCB_LEXER std::vector m_netCodes; ///< net codes mapping for boards being loaded ///> Converts net code using the mapping table if available, - ///> otherwise returns unchanged net code + ///> otherwise returns unchanged net code if < 0 or if is is out of range inline int getNetCode( int aNetCode ) { - if( aNetCode < (int) m_netCodes.size() ) + if( ( aNetCode >= 0 ) && ( aNetCode < (int) m_netCodes.size() ) ) return m_netCodes[aNetCode]; return aNetCode; } + /** + * function pushValueIntoMap + * Add aValue value in netcode mapping (m_netCodes) at index aIndex + * ensure there is room in m_netCodes for that, and add room if needed. + * @param aIndex = the index ( expected >=0 )of the location to use in m_netCodes + * @param aValue = the netcode value to map + */ + void pushValueIntoMap( int aIndex, int aValue ); + /** * Function init * clears and re-establishes m_layerMap with the default layer names. diff --git a/pcbnew/zones_by_polygon.cpp b/pcbnew/zones_by_polygon.cpp index 76ae549a9e..4a24ba3017 100644 --- a/pcbnew/zones_by_polygon.cpp +++ b/pcbnew/zones_by_polygon.cpp @@ -1,10 +1,10 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr + * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck * Copyright (C) 2012 Wayne Stambaugh - * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License From ca065833ea30edbcb8eb623febe07be18f815532 Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Thu, 22 Jan 2015 08:42:24 -0500 Subject: [PATCH 05/29] Remove EDA_DRAW_FRAME::IsActive() and replace with wxFrame::IsActive(). --- common/basicframe.cpp | 3 +-- common/draw_frame.cpp | 8 +++----- include/wxstruct.h | 9 +++------ pcbnew/footprint_wizard_frame.cpp | 10 +++++----- pcbnew/modview_frame.cpp | 8 ++++---- 5 files changed, 16 insertions(+), 22 deletions(-) diff --git a/common/basicframe.cpp b/common/basicframe.cpp index ef6867fb34..ca0bcb6b65 100644 --- a/common/basicframe.cpp +++ b/common/basicframe.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 2013 Wayne Stambaugh + * Copyright (C) 2013-2015 Wayne Stambaugh * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or @@ -72,7 +72,6 @@ EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* aParent, FRAME_T aFrameType, m_Ident = aFrameType; m_mainToolBar = NULL; - m_FrameIsActive = true; m_hasAutoSave = false; m_autoSaveState = false; m_autoSaveInterval = -1; diff --git a/common/draw_frame.cpp b/common/draw_frame.cpp index 9b4fb0dba1..63d84ed9c0 100644 --- a/common/draw_frame.cpp +++ b/common/draw_frame.cpp @@ -1,9 +1,9 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2004 Jean-Pierre Charras, jean-pierre.charras@gipsa-lab.inpg.fr - * Copyright (C) 2008-2011 Wayne Stambaugh - * Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 2004-2015 Jean-Pierre Charras, jean-pierre.charras@gipsa-lab.inpg.fr + * Copyright (C) 2008-2015 Wayne Stambaugh + * 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 @@ -226,8 +226,6 @@ void EDA_DRAW_FRAME::EraseMsgBox() void EDA_DRAW_FRAME::OnActivate( wxActivateEvent& event ) { - m_FrameIsActive = event.GetActive(); - if( m_canvas ) m_canvas->SetCanStartBlock( -1 ); diff --git a/include/wxstruct.h b/include/wxstruct.h index 4b0c56a165..af98b1858a 100644 --- a/include/wxstruct.h +++ b/include/wxstruct.h @@ -1,9 +1,9 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com - * Copyright (C) 2011 Wayne Stambaugh - * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2009-2015 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com + * Copyright (C) 2011-2015 Wayne Stambaugh + * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -118,7 +118,6 @@ protected: wxSize m_FrameSize; wxAuiToolBar* m_mainToolBar; ///< Standard horizontal Toolbar - bool m_FrameIsActive; wxString m_FrameName; ///< name used for writing and reading setup ///< It is "SchematicFrame", "PcbFrame" .... wxString m_AboutTitle; ///< Name of program displayed in About. @@ -200,8 +199,6 @@ public: wxString GetName() const { return m_FrameName; } - bool IsActive() const { return m_FrameIsActive; } - bool IsType( FRAME_T aType ) const { return m_Ident == aType; } void GetKicadHelp( wxCommandEvent& event ); diff --git a/pcbnew/footprint_wizard_frame.cpp b/pcbnew/footprint_wizard_frame.cpp index 69d2863aca..98334bdf5e 100644 --- a/pcbnew/footprint_wizard_frame.cpp +++ b/pcbnew/footprint_wizard_frame.cpp @@ -1,10 +1,10 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2012 Miguel Angel Ajo Pelayo - * Copyright (C) 2012 Jean-Pierre Charras, jaen-pierre.charras - * Copyright (C) 2008-2011 Wayne Stambaugh - * Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 2012-2015 Miguel Angel Ajo Pelayo + * Copyright (C) 2012-2015 Jean-Pierre Charras, jaen-pierre.charras + * Copyright (C) 2008-2015 Wayne Stambaugh + * 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 @@ -440,7 +440,7 @@ void FOOTPRINT_WIZARD_FRAME::OnActivate( wxActivateEvent& event ) EDA_DRAW_FRAME::OnActivate( event ); // Ensure we do not have old selection: - if( !m_FrameIsActive ) + if( !event.GetActive() ) return; bool footprintWizardsChanged = false; diff --git a/pcbnew/modview_frame.cpp b/pcbnew/modview_frame.cpp index d11e85ab4e..f73f688f8a 100644 --- a/pcbnew/modview_frame.cpp +++ b/pcbnew/modview_frame.cpp @@ -1,9 +1,9 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 2008-2011 Wayne Stambaugh - * Copyright (C) 2004-2012 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 2012-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 2008-2015 Wayne Stambaugh + * 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 @@ -551,7 +551,7 @@ void FOOTPRINT_VIEWER_FRAME::OnActivate( wxActivateEvent& event ) EDA_DRAW_FRAME::OnActivate( event ); // Ensure we do not have old selection: - if( ! m_FrameIsActive ) + if( !event.GetActive() ) return; // Ensure we have the right library list: From f0a52644ea038f06f1a50e91f9e0166e4c9c057e Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Fri, 23 Jan 2015 12:24:32 +0100 Subject: [PATCH 06/29] Pcbnew: fix Bug #1413701 (Segfault on highlight "unconnected" net 0 in Pcbnew ). Also, remove now useless code and other very minor fixes. --- 3d-viewer/vrml_v2_modelparser.cpp | 4 +--- bitmap2component/bitmap2component.cpp | 5 ++--- common/grid_tricks.cpp | 2 +- gerbview/gerbview_frame.cpp | 5 ----- pcbnew/basepcbframe.cpp | 5 ----- pcbnew/class_board.cpp | 6 ++++-- pcbnew/class_netinfo_item.cpp | 18 ++++++++++-------- pcbnew/pcbframe.cpp | 5 ----- pcbnew/specctra_test.cpp | 4 +--- 9 files changed, 19 insertions(+), 35 deletions(-) diff --git a/3d-viewer/vrml_v2_modelparser.cpp b/3d-viewer/vrml_v2_modelparser.cpp index f1eb4772ef..7748f9a134 100644 --- a/3d-viewer/vrml_v2_modelparser.cpp +++ b/3d-viewer/vrml_v2_modelparser.cpp @@ -88,8 +88,7 @@ void VRML2_MODEL_PARSER::Load( const wxString& aFilename, double aVrmlunits_to_3 glScalef( matScale.x, matScale.y, matScale.z ); - // Switch the locale to standard C (needed to print floating point numbers like 1.3) - SetLocaleTo_C_standard(); + LOCALE_IO toggle; // Temporary switch the locale to standard C to r/w floats childs.clear(); @@ -117,7 +116,6 @@ void VRML2_MODEL_PARSER::Load( const wxString& aFilename, double aVrmlunits_to_3 } fclose( m_file ); - SetLocaleTo_Default(); // revert to the current locale // DBG( printf( "chils size:%lu\n", childs.size() ) ); diff --git a/bitmap2component/bitmap2component.cpp b/bitmap2component/bitmap2component.cpp index a8799aceef..db115853ab 100644 --- a/bitmap2component/bitmap2component.cpp +++ b/bitmap2component/bitmap2component.cpp @@ -37,6 +37,7 @@ #include #include #include +#include #include @@ -437,7 +438,7 @@ void BITMAPCONV_INFO::CreateOutputFile( BMP2CMP_MOD_LAYER aModLayer ) potrace_dpoint_t( *c )[3]; - setlocale( LC_NUMERIC, "C" ); // Switch the locale to standard C + LOCALE_IO toggle; // Temporary switch the locale to standard C to r/w floats // The layer name has meaning only for .kicad_mod files. // For these files the header creates 2 invisible texts: value and ref @@ -530,8 +531,6 @@ void BITMAPCONV_INFO::CreateOutputFile( BMP2CMP_MOD_LAYER aModLayer ) } OuputFileEnd(); - - setlocale( LC_NUMERIC, "" ); // revert to the current locale } diff --git a/common/grid_tricks.cpp b/common/grid_tricks.cpp index 83f412e05c..40801671e0 100644 --- a/common/grid_tricks.cpp +++ b/common/grid_tricks.cpp @@ -65,7 +65,7 @@ void GRID_TRICKS::getSelectedArea() wxArrayInt cols = m_grid->GetSelectedCols(); wxArrayInt rows = m_grid->GetSelectedRows(); - DBG(printf("topLeft.Count():%zd botRight:Count():%zd\n", topLeft.Count(), botRight.Count() );) + DBG(printf("topLeft.Count():%d botRight:Count():%d\n", int( topLeft.Count() ), int( botRight.Count() ) );) if( topLeft.Count() && botRight.Count() ) { diff --git a/gerbview/gerbview_frame.cpp b/gerbview/gerbview_frame.cpp index a391fe714e..29b61c6ca8 100644 --- a/gerbview/gerbview_frame.cpp +++ b/gerbview/gerbview_frame.cpp @@ -269,11 +269,6 @@ void GERBVIEW_FRAME::LoadSettings( wxConfigBase* aCfg ) aCfg->SetPath( wxT( "drl_files" ) ); m_drillFileHistory.Load( *aCfg ); aCfg->SetPath( wxT( ".." ) ); - - // WxWidgets 2.9.1 seems call setlocale( LC_NUMERIC, "" ) - // when reading doubles in config, - // but forget to back to current locale. So we call SetLocaleTo_Default - SetLocaleTo_Default(); } diff --git a/pcbnew/basepcbframe.cpp b/pcbnew/basepcbframe.cpp index 6c18bef2d2..c52463846b 100644 --- a/pcbnew/basepcbframe.cpp +++ b/pcbnew/basepcbframe.cpp @@ -767,11 +767,6 @@ void PCB_BASE_FRAME::LoadSettings( wxConfigBase* aCfg ) if( m_DisplayOptions.m_DisplayModText < LINE || m_DisplayOptions.m_DisplayModText > SKETCH ) m_DisplayOptions.m_DisplayModText = FILLED; - - // WxWidgets 2.9.1 seems call setlocale( LC_NUMERIC, "" ) - // when reading doubles in config, - // but forget to back to current locale. So we call SetLocaleTo_Default - SetLocaleTo_Default( ); } diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index d6ec4d4197..2f93772d39 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.cpp @@ -1212,10 +1212,12 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData, NETINFO_ITEM* BOARD::FindNet( int aNetcode ) const { // the first valid netcode is 1 and the last is m_NetInfo.GetCount()-1. - // zero is reserved for "no connection" and is not used. + // zero is reserved for "no connection" and is not actually a net. // NULL is returned for non valid netcodes - if( aNetcode == NETINFO_LIST::UNCONNECTED ) + wxASSERT( m_NetInfo.GetNetCount() > 0 ); // net zero should exist + + if( aNetcode == NETINFO_LIST::UNCONNECTED && m_NetInfo.GetNetCount() == 0 ) return &NETINFO_LIST::ORPHANED; else return m_NetInfo.GetNetItem( aNetcode ); diff --git a/pcbnew/class_netinfo_item.cpp b/pcbnew/class_netinfo_item.cpp index 627fe0451e..1f1f2672e3 100644 --- a/pcbnew/class_netinfo_item.cpp +++ b/pcbnew/class_netinfo_item.cpp @@ -80,10 +80,7 @@ void NETINFO_ITEM::Draw( EDA_DRAW_PANEL* panel, void NETINFO_ITEM::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) { - int count; wxString txt; - MODULE* module; - D_PAD* pad; double lengthnet = 0.0; // This is the lenght of tracks on pcb double lengthPadToDie = 0.0; // this is the lenght of internal ICs connections @@ -92,12 +89,17 @@ void NETINFO_ITEM::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) txt.Printf( wxT( "%d" ), GetNet() ); aList.push_back( MSG_PANEL_ITEM( _( "Net Code" ), txt, RED ) ); - count = 0; - module = m_parent->GetBoard()->m_Modules; + // Warning: for netcode == NETINFO_LIST::ORPHANED, the parent or the board + // can be NULL + BOARD * board = m_parent ? m_parent->GetBoard() : NULL; - for( ; module != 0; module = module->Next() ) + if( board == NULL ) + return; + + int count = 0; + for( MODULE* module = board->m_Modules; module != NULL; module = module->Next() ) { - for( pad = module->Pads(); pad != 0; pad = pad->Next() ) + for( D_PAD* pad = module->Pads(); pad != 0; pad = pad->Next() ) { if( pad->GetNetCode() == GetNet() ) { @@ -112,7 +114,7 @@ void NETINFO_ITEM::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) count = 0; - for( const TRACK *track = m_parent->GetBoard()->m_Track; track != NULL; track = track->Next() ) + for( const TRACK *track = board->m_Track; track != NULL; track = track->Next() ) { if( track->Type() == PCB_VIA_T ) { diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp index 1acb59a136..0438e84b34 100644 --- a/pcbnew/pcbframe.cpp +++ b/pcbnew/pcbframe.cpp @@ -754,11 +754,6 @@ void PCB_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg ) aCfg->Read( PCB_MAGNETIC_TRACKS_OPT, &g_MagneticTrackOption ); aCfg->Read( SHOW_MICROWAVE_TOOLS, &m_show_microwave_tools ); aCfg->Read( SHOW_LAYER_MANAGER_TOOLS, &m_show_layer_manager_tools ); - - // WxWidgets 2.9.1 seems call setlocale( LC_NUMERIC, "" ) - // when reading doubles in cfg, - // but forget to back to current locale. So we call SetLocaleTo_Default - SetLocaleTo_Default( ); } diff --git a/pcbnew/specctra_test.cpp b/pcbnew/specctra_test.cpp index ab11895393..3a6cc0b47a 100644 --- a/pcbnew/specctra_test.cpp +++ b/pcbnew/specctra_test.cpp @@ -51,7 +51,7 @@ int main( int argc, char** argv ) SPECCTRA_DB db; bool failed = false; - SetLocaleTo_C_standard( ); // Switch the locale to standard C + LOCALE_IO toggle; // Temporary switch the locale to standard C to r/w floats if( argc == 2 ) { @@ -87,8 +87,6 @@ int main( int argc, char** argv ) DSN::SESSION* ses = db.GetSESSION(); ses->Format( &db, 0 ); #endif - - SetLocaleTo_Default( ); // revert to the current locale } //-------------------------------------------------------- From 5447bb59149b7967c01f31ac1ffc7ef21bfe35fb Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Sun, 25 Jan 2015 19:08:52 +0100 Subject: [PATCH 07/29] bugfix: Pcbnew (Windows) crashes using selection tool in OpenGL or Cairo --- include/view/view.h | 15 +++++++++++++++ pcbnew/pcb_draw_panel_gal.cpp | 8 ++++++++ 2 files changed, 23 insertions(+) diff --git a/include/view/view.h b/include/view/view.h index 844f72bd2c..9ab7fe9a6a 100644 --- a/include/view/view.h +++ b/include/view/view.h @@ -292,6 +292,8 @@ public: */ inline void SetLayerVisible( int aLayer, bool aVisible = true ) { + wxASSERT( aLayer < (int) m_layers.size() ); + if( m_layers[aLayer].visible != aVisible ) { // Target has to be redrawn after changing its visibility @@ -307,9 +309,18 @@ public: */ inline bool IsLayerVisible( int aLayer ) const { + wxASSERT( aLayer < (int) m_layers.size() ); + return m_layers.at( aLayer ).visible; } + inline void SetLayerDisplayOnly( int aLayer, bool aDisplayOnly = true ) + { + wxASSERT( aLayer < (int) m_layers.size() ); + + m_layers[aLayer].displayOnly = aDisplayOnly; + } + /** * Function SetLayerTarget() * Changes the rendering target for a particular layer. @@ -318,6 +329,8 @@ public: */ inline void SetLayerTarget( int aLayer, RENDER_TARGET aTarget ) { + wxASSERT( aLayer < (int) m_layers.size() ); + m_layers[aLayer].target = aTarget; } @@ -477,6 +490,8 @@ public: /// Returns true if the layer is cached inline bool IsCached( int aLayer ) const { + wxASSERT( aLayer < (int) m_layers.size() ); + return m_layers.at( aLayer ).target == TARGET_CACHED; } diff --git a/pcbnew/pcb_draw_panel_gal.cpp b/pcbnew/pcb_draw_panel_gal.cpp index 3e05f6af1b..15c6a92b99 100644 --- a/pcbnew/pcb_draw_panel_gal.cpp +++ b/pcbnew/pcb_draw_panel_gal.cpp @@ -123,10 +123,12 @@ EDA_DRAW_PANEL_GAL( aParentWindow, aWindowId, aPosition, aSize, aGalType ) // Netnames are drawn only when scale is sufficient (level of details) // so there is no point in caching them m_view->SetLayerTarget( layer, KIGFX::TARGET_NONCACHED ); + m_view->SetLayerDisplayOnly( layer ); } } m_view->SetLayerTarget( ITEM_GAL_LAYER( ANCHOR_VISIBLE ), KIGFX::TARGET_NONCACHED ); + m_view->SetLayerDisplayOnly( ITEM_GAL_LAYER( ANCHOR_VISIBLE ) ); // Some more required layers settings m_view->SetRequired( ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE ), ITEM_GAL_LAYER( VIA_THROUGH_VISIBLE ) ); @@ -147,7 +149,13 @@ EDA_DRAW_PANEL_GAL( aParentWindow, aWindowId, aPosition, aSize, aGalType ) m_view->SetRequired( ITEM_GAL_LAYER( PAD_BK_VISIBLE ), ITEM_GAL_LAYER( MOD_BK_VISIBLE ) ); m_view->SetLayerTarget( ITEM_GAL_LAYER( GP_OVERLAY ), KIGFX::TARGET_OVERLAY ); + m_view->SetLayerDisplayOnly( ITEM_GAL_LAYER( GP_OVERLAY ) ); m_view->SetLayerTarget( ITEM_GAL_LAYER( RATSNEST_VISIBLE ), KIGFX::TARGET_OVERLAY ); + m_view->SetLayerDisplayOnly( ITEM_GAL_LAYER( RATSNEST_VISIBLE ) ); + + m_view->SetLayerDisplayOnly( ITEM_GAL_LAYER( WORKSHEET ) ); + m_view->SetLayerDisplayOnly( ITEM_GAL_LAYER( GRID_VISIBLE ) ); + m_view->SetLayerDisplayOnly( ITEM_GAL_LAYER( DRC_VISIBLE ) ); // Load display options (such as filled/outline display of items). // Can be made only if the parent windos is a EDA_DRAW_FRAME (or a derived class) From 2647fdfd8996f9335393768529063a3a05b8ea70 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Sun, 25 Jan 2015 19:11:02 +0100 Subject: [PATCH 08/29] Fixed context submenus event handlers (GAL/Windows). --- common/tool/context_menu.cpp | 24 +++++++++++++++++++++--- include/tool/context_menu.h | 8 ++++---- pcbnew/router/router_tool.cpp | 4 ++-- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/common/tool/context_menu.cpp b/common/tool/context_menu.cpp index 57756e66fc..105e283d6b 100644 --- a/common/tool/context_menu.cpp +++ b/common/tool/context_menu.cpp @@ -114,8 +114,8 @@ CONTEXT_MENU& CONTEXT_MENU::operator=( const CONTEXT_MENU& aMenu ) void CONTEXT_MENU::setupEvents() { - Connect( wxEVT_MENU_HIGHLIGHT, wxEventHandler( CONTEXT_MENU::onMenuEvent ), NULL, this ); - Connect( wxEVT_COMMAND_MENU_SELECTED, wxEventHandler( CONTEXT_MENU::onMenuEvent ), NULL, this ); + Connect( wxEVT_MENU_HIGHLIGHT, wxMenuEventHandler( CONTEXT_MENU::onMenuEvent ), NULL, this ); + Connect( wxEVT_COMMAND_MENU_SELECTED, wxMenuEventHandler( CONTEXT_MENU::onMenuEvent ), NULL, this ); } @@ -194,7 +194,7 @@ void CONTEXT_MENU::Clear() } -void CONTEXT_MENU::onMenuEvent( wxEvent& aEvent ) +void CONTEXT_MENU::onMenuEvent( wxMenuEvent& aEvent ) { OPT_TOOL_EVENT evt; @@ -219,7 +219,25 @@ void CONTEXT_MENU::onMenuEvent( wxEvent& aEvent ) } else { + // Under Linux, every submenu can have a separate event handler, under + // Windows all submenus are handled by the main menu. +#ifdef __WINDOWS__ + if( !evt ) { + // Try to find the submenu which holds the selected item + wxMenu*menu = NULL; + FindItem( m_selected, &menu ); + + if( menu ) + { + menu->ProcessEvent( aEvent ); + return; + } + + assert( false ); // The event should be handled above + } +#else evt = m_customHandler( aEvent ); +#endif /* else __WINDOWS__ */ // Handling non-action menu entries (e.g. items in clarification list) if( !evt ) diff --git a/include/tool/context_menu.h b/include/tool/context_menu.h index 72b69315d6..882fb3a365 100644 --- a/include/tool/context_menu.h +++ b/include/tool/context_menu.h @@ -95,12 +95,12 @@ public: } protected: - void setCustomEventHandler( boost::function aHandler ) + void setCustomEventHandler( boost::function aHandler ) { m_customHandler = aHandler; } - virtual OPT_TOOL_EVENT handleCustomEvent( const wxEvent& aEvent ) + virtual OPT_TOOL_EVENT handleCustomEvent( const wxMenuEvent& aEvent ) { return OPT_TOOL_EVENT(); } @@ -116,7 +116,7 @@ private: void setupEvents(); ///> Event handler. - void onMenuEvent( wxEvent& aEvent ); + void onMenuEvent( wxMenuEvent& aEvent ); /** * Function setTool() @@ -144,7 +144,7 @@ private: std::map m_toolActions; /// Custom events handler, allows to translate wxEvents to TOOL_EVENTs. - boost::function m_customHandler; + boost::function m_customHandler; friend class TOOL_INTERACTIVE; }; diff --git a/pcbnew/router/router_tool.cpp b/pcbnew/router/router_tool.cpp index db75478427..4b441474d4 100644 --- a/pcbnew/router/router_tool.cpp +++ b/pcbnew/router/router_tool.cpp @@ -152,7 +152,7 @@ public: } protected: - OPT_TOOL_EVENT handleCustomEvent( const wxEvent& aEvent ) + OPT_TOOL_EVENT handleCustomEvent( const wxMenuEvent& aEvent ) { #if ID_POPUP_PCB_SELECT_VIASIZE1 < ID_POPUP_PCB_SELECT_WIDTH1 #error You have changed event ids order, it breaks code. Check the source code for more details. @@ -183,7 +183,7 @@ protected: bds.SetTrackWidthIndex( 0 ); } - else if( id > ID_POPUP_PCB_SELECT_VIASIZE1 ) // via size has changed + else if( id >= ID_POPUP_PCB_SELECT_VIASIZE1 ) // via size has changed { assert( id < ID_POPUP_PCB_SELECT_WIDTH_END_RANGE ); From 2a4d0bad605e5acd847322dd98e2bf187c19102a Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Tue, 27 Jan 2015 08:34:19 +0100 Subject: [PATCH 09/29] Fix minor aesthetic issues in dialogs (these minor issues (overlapping widgets) exit only with some Windows managers like KDE) --- ...dialog_edit_component_in_schematic_fbp.cpp | 4 +- ...dialog_edit_component_in_schematic_fbp.fbp | 6 +-- .../dialog_edit_component_in_schematic_fbp.h | 2 +- pcbnew/dialogs/dialog_fp_lib_table.cpp | 10 ++--- pcbnew/dialogs/dialog_fp_lib_table_base.cpp | 42 +++++++++---------- pcbnew/dialogs/dialog_fp_lib_table_base.fbp | 24 +++++------ pcbnew/dialogs/dialog_fp_lib_table_base.h | 18 ++++---- 7 files changed, 53 insertions(+), 53 deletions(-) diff --git a/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.cpp b/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.cpp index f848a9294d..e30b30a8bf 100644 --- a/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.cpp +++ b/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.cpp @@ -73,7 +73,7 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP( chipnameTextCtrl->SetMaxLength( 32 ); chipnameTextCtrl->SetToolTip( _("The name of the symbol in the library from which this component came") ); - sbSizerChipName->Add( chipnameTextCtrl, 0, wxEXPAND|wxBOTTOM, 5 ); + sbSizerChipName->Add( chipnameTextCtrl, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 ); wxBoxSizer* bSizerChpinameButt; bSizerChpinameButt = new wxBoxSizer( wxHORIZONTAL ); @@ -211,7 +211,7 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP( fieldValueTextCtrl->SetMaxLength( 0 ); fieldValueTextCtrl->SetToolTip( _("The name of the currently selected field\nSome fixed fields names are not editable") ); - fieldNameBoxSizer->Add( fieldValueTextCtrl, 0, wxEXPAND, 5 ); + fieldNameBoxSizer->Add( fieldValueTextCtrl, 0, wxEXPAND|wxBOTTOM, 5 ); m_show_datasheet_button = new wxButton( this, wxID_ANY, _("Show in Browser"), wxDefaultPosition, wxDefaultSize, 0 ); m_show_datasheet_button->SetToolTip( _("If your datasheet is an http:// link or a complete file path, then it may show in your browser by pressing this button.") ); diff --git a/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.fbp b/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.fbp index a4bbdd3056..d0014b4011 100644 --- a/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.fbp +++ b/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.fbp @@ -44,7 +44,7 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP - 677,586 + 688,586 wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU DIALOG_SHIM; dialog_shim.h Component Properties @@ -744,7 +744,7 @@ 5 - wxEXPAND|wxBOTTOM + wxEXPAND|wxTOP|wxBOTTOM 0 1 @@ -2521,7 +2521,7 @@ 5 - wxEXPAND + wxEXPAND|wxBOTTOM 0 1 diff --git a/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.h b/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.h index 0ee06a1185..2cb3ee39d5 100644 --- a/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.h +++ b/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.h @@ -100,7 +100,7 @@ class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP : public DIALOG_SHIM public: - DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Component Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 677,586 ), long style = wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU ); + DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Component Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 688,586 ), long style = wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU ); ~DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP(); }; diff --git a/pcbnew/dialogs/dialog_fp_lib_table.cpp b/pcbnew/dialogs/dialog_fp_lib_table.cpp index 2fca34e02b..db2a78f787 100644 --- a/pcbnew/dialogs/dialog_fp_lib_table.cpp +++ b/pcbnew/dialogs/dialog_fp_lib_table.cpp @@ -514,7 +514,7 @@ private: m_cur_grid = ( m_pageNdx == 0 ) ? m_global_grid : m_project_grid; } - void appendRowHandler( wxMouseEvent& event ) + void appendRowHandler( wxCommandEvent& event ) { if( m_cur_grid->AppendRows( 1 ) ) { @@ -527,7 +527,7 @@ private: } } - void deleteRowHandler( wxMouseEvent& event ) + void deleteRowHandler( wxCommandEvent& event ) { #if 1 int currRow = getCursorRow(); @@ -564,7 +564,7 @@ private: #endif } - void moveUpHandler( wxMouseEvent& event ) + void moveUpHandler( wxCommandEvent& event ) { int curRow = getCursorRow(); if( curRow >= 1 ) @@ -596,7 +596,7 @@ private: } } - void moveDownHandler( wxMouseEvent& event ) + void moveDownHandler( wxCommandEvent& event ) { FP_TBL_MODEL* tbl = cur_model(); @@ -628,7 +628,7 @@ private: } } - void optionsEditor( wxMouseEvent& event ) + void optionsEditor( wxCommandEvent& event ) { FP_TBL_MODEL* tbl = cur_model(); diff --git a/pcbnew/dialogs/dialog_fp_lib_table_base.cpp b/pcbnew/dialogs/dialog_fp_lib_table_base.cpp index 7aa81c4a27..00dcde2a62 100644 --- a/pcbnew/dialogs/dialog_fp_lib_table_base.cpp +++ b/pcbnew/dialogs/dialog_fp_lib_table_base.cpp @@ -206,14 +206,14 @@ DIALOG_FP_LIB_TABLE_BASE::DIALOG_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID wxBoxSizer* m_bottom_sizer; m_bottom_sizer = new wxBoxSizer( wxVERTICAL ); - m_sdbSizer1 = new wxStdDialogButtonSizer(); - m_sdbSizer1OK = new wxButton( this, wxID_OK ); - m_sdbSizer1->AddButton( m_sdbSizer1OK ); - m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL ); - m_sdbSizer1->AddButton( m_sdbSizer1Cancel ); - m_sdbSizer1->Realize(); + m_sdbSizer = new wxStdDialogButtonSizer(); + m_sdbSizerOK = new wxButton( this, wxID_OK ); + m_sdbSizer->AddButton( m_sdbSizerOK ); + m_sdbSizerCancel = new wxButton( this, wxID_CANCEL ); + m_sdbSizer->AddButton( m_sdbSizerCancel ); + m_sdbSizer->Realize(); - m_bottom_sizer->Add( m_sdbSizer1, 0, wxALL|wxEXPAND, 5 ); + m_bottom_sizer->Add( m_sdbSizer, 0, wxALL|wxEXPAND, 5 ); bSizer1->Add( m_bottom_sizer, 0, wxEXPAND, 5 ); @@ -228,14 +228,14 @@ DIALOG_FP_LIB_TABLE_BASE::DIALOG_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_FP_LIB_TABLE_BASE::onCancelCaptionButtonClick ) ); this->Connect( wxEVT_KEY_DOWN, wxKeyEventHandler( DIALOG_FP_LIB_TABLE_BASE::onKeyDown ) ); m_auinotebook->Connect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, wxAuiNotebookEventHandler( DIALOG_FP_LIB_TABLE_BASE::pageChangedHandler ), NULL, this ); - m_append_button->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::appendRowHandler ), NULL, this ); + m_append_button->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::appendRowHandler ), NULL, this ); m_buttonWizard->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::OnClickLibraryWizard ), NULL, this ); - m_delete_button->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::deleteRowHandler ), NULL, this ); - m_move_up_button->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::moveUpHandler ), NULL, this ); - m_move_down_button->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::moveDownHandler ), NULL, this ); - m_edit_options->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::optionsEditor ), NULL, this ); - m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::onCancelButtonClick ), NULL, this ); - m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::onOKButtonClick ), NULL, this ); + m_delete_button->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::deleteRowHandler ), NULL, this ); + m_move_up_button->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::moveUpHandler ), NULL, this ); + m_move_down_button->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::moveDownHandler ), NULL, this ); + m_edit_options->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::optionsEditor ), NULL, this ); + m_sdbSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::onCancelButtonClick ), NULL, this ); + m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::onOKButtonClick ), NULL, this ); } DIALOG_FP_LIB_TABLE_BASE::~DIALOG_FP_LIB_TABLE_BASE() @@ -244,13 +244,13 @@ DIALOG_FP_LIB_TABLE_BASE::~DIALOG_FP_LIB_TABLE_BASE() this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_FP_LIB_TABLE_BASE::onCancelCaptionButtonClick ) ); this->Disconnect( wxEVT_KEY_DOWN, wxKeyEventHandler( DIALOG_FP_LIB_TABLE_BASE::onKeyDown ) ); m_auinotebook->Disconnect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, wxAuiNotebookEventHandler( DIALOG_FP_LIB_TABLE_BASE::pageChangedHandler ), NULL, this ); - m_append_button->Disconnect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::appendRowHandler ), NULL, this ); + m_append_button->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::appendRowHandler ), NULL, this ); m_buttonWizard->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::OnClickLibraryWizard ), NULL, this ); - m_delete_button->Disconnect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::deleteRowHandler ), NULL, this ); - m_move_up_button->Disconnect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::moveUpHandler ), NULL, this ); - m_move_down_button->Disconnect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::moveDownHandler ), NULL, this ); - m_edit_options->Disconnect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::optionsEditor ), NULL, this ); - m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::onCancelButtonClick ), NULL, this ); - m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::onOKButtonClick ), NULL, this ); + m_delete_button->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::deleteRowHandler ), NULL, this ); + m_move_up_button->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::moveUpHandler ), NULL, this ); + m_move_down_button->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::moveDownHandler ), NULL, this ); + m_edit_options->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::optionsEditor ), NULL, this ); + m_sdbSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::onCancelButtonClick ), NULL, this ); + m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::onOKButtonClick ), NULL, this ); } diff --git a/pcbnew/dialogs/dialog_fp_lib_table_base.fbp b/pcbnew/dialogs/dialog_fp_lib_table_base.fbp index e73011552a..7499807f2b 100644 --- a/pcbnew/dialogs/dialog_fp_lib_table_base.fbp +++ b/pcbnew/dialogs/dialog_fp_lib_table_base.fbp @@ -44,7 +44,7 @@ DIALOG_FP_LIB_TABLE_BASE - 900,600 + 634,600 wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU DIALOG_SHIM; dialog_shim.h PCB Library Tables @@ -1093,7 +1093,7 @@ - + appendRowHandler @@ -1102,7 +1102,7 @@ - appendRowHandler + @@ -1269,7 +1269,7 @@ - + deleteRowHandler @@ -1278,7 +1278,7 @@ - deleteRowHandler + @@ -1357,7 +1357,7 @@ - + moveUpHandler @@ -1366,7 +1366,7 @@ - moveUpHandler + @@ -1445,7 +1445,7 @@ - + moveDownHandler @@ -1454,7 +1454,7 @@ - moveDownHandler + @@ -1533,7 +1533,7 @@ - + optionsEditor @@ -1542,7 +1542,7 @@ - optionsEditor + @@ -1743,7 +1743,7 @@ 0 0 - m_sdbSizer1 + m_sdbSizer protected onCancelButtonClick diff --git a/pcbnew/dialogs/dialog_fp_lib_table_base.h b/pcbnew/dialogs/dialog_fp_lib_table_base.h index 3f1a005670..576479f078 100644 --- a/pcbnew/dialogs/dialog_fp_lib_table_base.h +++ b/pcbnew/dialogs/dialog_fp_lib_table_base.h @@ -58,27 +58,27 @@ class DIALOG_FP_LIB_TABLE_BASE : public DIALOG_SHIM wxButton* m_move_down_button; wxButton* m_edit_options; wxGrid* m_path_subs_grid; - wxStdDialogButtonSizer* m_sdbSizer1; - wxButton* m_sdbSizer1OK; - wxButton* m_sdbSizer1Cancel; + wxStdDialogButtonSizer* m_sdbSizer; + wxButton* m_sdbSizerOK; + wxButton* m_sdbSizerCancel; // Virtual event handlers, overide them in your derived class virtual void onCancelCaptionButtonClick( wxCloseEvent& event ) = 0; virtual void onKeyDown( wxKeyEvent& event ) = 0; virtual void pageChangedHandler( wxAuiNotebookEvent& event ) = 0; - virtual void appendRowHandler( wxMouseEvent& event ) = 0; + virtual void appendRowHandler( wxCommandEvent& event ) = 0; virtual void OnClickLibraryWizard( wxCommandEvent& event ) = 0; - virtual void deleteRowHandler( wxMouseEvent& event ) = 0; - virtual void moveUpHandler( wxMouseEvent& event ) = 0; - virtual void moveDownHandler( wxMouseEvent& event ) = 0; - virtual void optionsEditor( wxMouseEvent& event ) = 0; + virtual void deleteRowHandler( wxCommandEvent& event ) = 0; + virtual void moveUpHandler( wxCommandEvent& event ) = 0; + virtual void moveDownHandler( wxCommandEvent& event ) = 0; + virtual void optionsEditor( wxCommandEvent& event ) = 0; virtual void onCancelButtonClick( wxCommandEvent& event ) = 0; virtual void onOKButtonClick( wxCommandEvent& event ) = 0; public: - DIALOG_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("PCB Library Tables"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 900,600 ), long style = wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU ); + DIALOG_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("PCB Library Tables"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 634,600 ), long style = wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU ); ~DIALOG_FP_LIB_TABLE_BASE(); }; From 813efb77ef30f4322edeca9b681c5f4e499c62c5 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Tue, 27 Jan 2015 10:09:09 +0100 Subject: [PATCH 10/29] Smal change in dialog. --- eeschema/dialogs/dialog_edit_component_in_schematic_fbp.cpp | 6 +++--- eeschema/dialogs/dialog_edit_component_in_schematic_fbp.fbp | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.cpp b/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.cpp index e30b30a8bf..8cec6af050 100644 --- a/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.cpp +++ b/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.cpp @@ -149,16 +149,16 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP( int m_FieldHJustifyCtrlNChoices = sizeof( m_FieldHJustifyCtrlChoices ) / sizeof( wxString ); m_FieldHJustifyCtrl = new wxRadioBox( this, wxID_ANY, _("Horiz. Justify"), wxDefaultPosition, wxDefaultSize, m_FieldHJustifyCtrlNChoices, m_FieldHJustifyCtrlChoices, 1, wxRA_SPECIFY_COLS ); m_FieldHJustifyCtrl->SetSelection( 2 ); - bSizerJustification->Add( m_FieldHJustifyCtrl, 1, wxRIGHT|wxLEFT, 5 ); + bSizerJustification->Add( m_FieldHJustifyCtrl, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); wxString m_FieldVJustifyCtrlChoices[] = { _("Bottom"), _("Center"), _("Top") }; int m_FieldVJustifyCtrlNChoices = sizeof( m_FieldVJustifyCtrlChoices ) / sizeof( wxString ); m_FieldVJustifyCtrl = new wxRadioBox( this, wxID_ANY, _("Vert. Justify"), wxDefaultPosition, wxDefaultSize, m_FieldVJustifyCtrlNChoices, m_FieldVJustifyCtrlChoices, 1, wxRA_SPECIFY_COLS ); m_FieldVJustifyCtrl->SetSelection( 2 ); - bSizerJustification->Add( m_FieldVJustifyCtrl, 1, wxRIGHT|wxLEFT, 5 ); + bSizerJustification->Add( m_FieldVJustifyCtrl, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - fieldEditBoxSizer->Add( bSizerJustification, 0, wxEXPAND|wxBOTTOM, 5 ); + fieldEditBoxSizer->Add( bSizerJustification, 1, wxEXPAND|wxBOTTOM, 5 ); wxBoxSizer* bSizerStyle; bSizerStyle = new wxBoxSizer( wxHORIZONTAL ); diff --git a/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.fbp b/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.fbp index d0014b4011..bce93189bc 100644 --- a/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.fbp +++ b/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.fbp @@ -1774,7 +1774,7 @@ 5 wxEXPAND|wxBOTTOM - 0 + 1 bSizerJustification @@ -1782,7 +1782,7 @@ none 5 - wxRIGHT|wxLEFT + wxBOTTOM|wxRIGHT|wxLEFT 1 1 @@ -1872,7 +1872,7 @@ 5 - wxRIGHT|wxLEFT + wxBOTTOM|wxRIGHT|wxLEFT 1 1 From 6393d226ea411608ef33dc6cecbcdb65e5bc239e Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Tue, 27 Jan 2015 12:01:58 +0100 Subject: [PATCH 11/29] Other minor fixes --- .../dialog_edit_component_in_schematic_fbp.cpp | 6 +++--- .../dialog_edit_component_in_schematic_fbp.fbp | 6 +++--- .../dialogs/dialog_edit_libentry_fields_in_lib.cpp | 2 +- .../dialog_edit_libentry_fields_in_lib_base.cpp | 11 +++++------ .../dialog_edit_libentry_fields_in_lib_base.fbp | 14 +++++++------- .../dialog_edit_libentry_fields_in_lib_base.h | 2 +- eeschema/libedit_undo_redo.cpp | 6 +++--- eeschema/libeditframe.h | 8 +++++++- 8 files changed, 30 insertions(+), 25 deletions(-) diff --git a/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.cpp b/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.cpp index 8cec6af050..5635f6f9ee 100644 --- a/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.cpp +++ b/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.cpp @@ -149,13 +149,13 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP( int m_FieldHJustifyCtrlNChoices = sizeof( m_FieldHJustifyCtrlChoices ) / sizeof( wxString ); m_FieldHJustifyCtrl = new wxRadioBox( this, wxID_ANY, _("Horiz. Justify"), wxDefaultPosition, wxDefaultSize, m_FieldHJustifyCtrlNChoices, m_FieldHJustifyCtrlChoices, 1, wxRA_SPECIFY_COLS ); m_FieldHJustifyCtrl->SetSelection( 2 ); - bSizerJustification->Add( m_FieldHJustifyCtrl, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + bSizerJustification->Add( m_FieldHJustifyCtrl, 1, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); wxString m_FieldVJustifyCtrlChoices[] = { _("Bottom"), _("Center"), _("Top") }; int m_FieldVJustifyCtrlNChoices = sizeof( m_FieldVJustifyCtrlChoices ) / sizeof( wxString ); m_FieldVJustifyCtrl = new wxRadioBox( this, wxID_ANY, _("Vert. Justify"), wxDefaultPosition, wxDefaultSize, m_FieldVJustifyCtrlNChoices, m_FieldVJustifyCtrlChoices, 1, wxRA_SPECIFY_COLS ); m_FieldVJustifyCtrl->SetSelection( 2 ); - bSizerJustification->Add( m_FieldVJustifyCtrl, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + bSizerJustification->Add( m_FieldVJustifyCtrl, 1, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); fieldEditBoxSizer->Add( bSizerJustification, 1, wxEXPAND|wxBOTTOM, 5 ); @@ -188,7 +188,7 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP( bSizerStyle->Add( m_StyleRadioBox, 1, wxEXPAND|wxALL, 5 ); - fieldEditBoxSizer->Add( bSizerStyle, 1, wxEXPAND, 5 ); + fieldEditBoxSizer->Add( bSizerStyle, 1, wxEXPAND|wxBOTTOM, 5 ); wxBoxSizer* fieldNameBoxSizer; fieldNameBoxSizer = new wxBoxSizer( wxVERTICAL ); diff --git a/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.fbp b/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.fbp index bce93189bc..69bc7bbed7 100644 --- a/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.fbp +++ b/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.fbp @@ -1782,7 +1782,7 @@ none 5 - wxBOTTOM|wxRIGHT|wxLEFT + wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND 1 1 @@ -1872,7 +1872,7 @@ 5 - wxBOTTOM|wxRIGHT|wxLEFT + wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND 1 1 @@ -1964,7 +1964,7 @@ 5 - wxEXPAND + wxEXPAND|wxBOTTOM 1 diff --git a/eeschema/dialogs/dialog_edit_libentry_fields_in_lib.cpp b/eeschema/dialogs/dialog_edit_libentry_fields_in_lib.cpp index d42752ee72..75fdff829f 100644 --- a/eeschema/dialogs/dialog_edit_libentry_fields_in_lib.cpp +++ b/eeschema/dialogs/dialog_edit_libentry_fields_in_lib.cpp @@ -266,7 +266,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnOKButtonClick( wxCommandEvent& event /* End unused code */ // save old cmp in undo list - m_parent->SaveCopyInUndoList( m_libEntry, IS_CHANGED ); + m_parent->SaveCopyInUndoList( m_libEntry ); // delete any fields with no name or no value before we copy all of m_FieldsBuf // back into the component diff --git a/eeschema/dialogs/dialog_edit_libentry_fields_in_lib_base.cpp b/eeschema/dialogs/dialog_edit_libentry_fields_in_lib_base.cpp index e01286ed02..c12779d419 100644 --- a/eeschema/dialogs/dialog_edit_libentry_fields_in_lib_base.cpp +++ b/eeschema/dialogs/dialog_edit_libentry_fields_in_lib_base.cpp @@ -57,7 +57,7 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE m_FieldHJustifyCtrl->SetSelection( 1 ); m_FieldHJustifyCtrl->SetToolTip( _("Select if the component is to be rotated when drawn") ); - bSizerJustify->Add( m_FieldHJustifyCtrl, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + bSizerJustify->Add( m_FieldHJustifyCtrl, 1, wxEXPAND|wxALL, 5 ); wxString m_FieldVJustifyCtrlChoices[] = { _("Bottom"), _("Center"), _("Top") }; int m_FieldVJustifyCtrlNChoices = sizeof( m_FieldVJustifyCtrlChoices ) / sizeof( wxString ); @@ -65,10 +65,10 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE m_FieldVJustifyCtrl->SetSelection( 0 ); m_FieldVJustifyCtrl->SetToolTip( _("Pick the graphical transformation to be used when displaying the component, if any") ); - bSizerJustify->Add( m_FieldVJustifyCtrl, 1, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); + bSizerJustify->Add( m_FieldVJustifyCtrl, 1, wxEXPAND|wxALL, 5 ); - fieldEditBoxSizer->Add( bSizerJustify, 0, wxEXPAND|wxBOTTOM, 5 ); + fieldEditBoxSizer->Add( bSizerJustify, 1, wxEXPAND|wxBOTTOM, 5 ); wxBoxSizer* bSizerAspect; bSizerAspect = new wxBoxSizer( wxHORIZONTAL ); @@ -93,10 +93,10 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE int m_StyleRadioBoxNChoices = sizeof( m_StyleRadioBoxChoices ) / sizeof( wxString ); m_StyleRadioBox = new wxRadioBox( this, wxID_ANY, _("Style:"), wxDefaultPosition, wxDefaultSize, m_StyleRadioBoxNChoices, m_StyleRadioBoxChoices, 1, wxRA_SPECIFY_COLS ); m_StyleRadioBox->SetSelection( 0 ); - bSizerAspect->Add( m_StyleRadioBox, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + bSizerAspect->Add( m_StyleRadioBox, 1, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); - fieldEditBoxSizer->Add( bSizerAspect, 0, wxEXPAND|wxTOP, 5 ); + fieldEditBoxSizer->Add( bSizerAspect, 1, wxEXPAND|wxTOP|wxBOTTOM, 5 ); wxBoxSizer* fieldNameBoxSizer; fieldNameBoxSizer = new wxBoxSizer( wxVERTICAL ); @@ -199,7 +199,6 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE this->SetSizer( mainSizer ); this->Layout(); - mainSizer->Fit( this ); // Connect Events this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnCloseDialog ) ); diff --git a/eeschema/dialogs/dialog_edit_libentry_fields_in_lib_base.fbp b/eeschema/dialogs/dialog_edit_libentry_fields_in_lib_base.fbp index 647cfd8e2f..b561e6b9b6 100644 --- a/eeschema/dialogs/dialog_edit_libentry_fields_in_lib_base.fbp +++ b/eeschema/dialogs/dialog_edit_libentry_fields_in_lib_base.fbp @@ -44,7 +44,7 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE - -1,-1 + 542,529 wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU DIALOG_SHIM; dialog_shim.h Field Properties @@ -494,7 +494,7 @@ 5 wxEXPAND|wxBOTTOM - 0 + 1 bSizerJustify @@ -502,7 +502,7 @@ none 5 - wxBOTTOM|wxRIGHT|wxLEFT + wxEXPAND|wxALL 1 1 @@ -592,7 +592,7 @@ 5 - wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND + wxEXPAND|wxALL 1 1 @@ -684,8 +684,8 @@ 5 - wxEXPAND|wxTOP - 0 + wxEXPAND|wxTOP|wxBOTTOM + 1 bSizerAspect @@ -883,7 +883,7 @@ 5 - wxBOTTOM|wxRIGHT|wxLEFT + wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND 1 1 diff --git a/eeschema/dialogs/dialog_edit_libentry_fields_in_lib_base.h b/eeschema/dialogs/dialog_edit_libentry_fields_in_lib_base.h index 5d90a82f6d..bba59ef640 100644 --- a/eeschema/dialogs/dialog_edit_libentry_fields_in_lib_base.h +++ b/eeschema/dialogs/dialog_edit_libentry_fields_in_lib_base.h @@ -84,7 +84,7 @@ class DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE : public DIALOG_SHIM public: - DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Field Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU ); + DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Field Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 542,529 ), long style = wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU ); ~DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE(); }; diff --git a/eeschema/libedit_undo_redo.cpp b/eeschema/libedit_undo_redo.cpp index 81cb7f17e8..a29350081f 100644 --- a/eeschema/libedit_undo_redo.cpp +++ b/eeschema/libedit_undo_redo.cpp @@ -25,13 +25,13 @@ #include #include -#include -#include +//#include +//#include #include #include -void LIB_EDIT_FRAME::SaveCopyInUndoList( EDA_ITEM* ItemToCopy, int unused_flag ) +void LIB_EDIT_FRAME::SaveCopyInUndoList( EDA_ITEM* ItemToCopy ) { LIB_PART* CopyItem; PICKED_ITEMS_LIST* lastcmd; diff --git a/eeschema/libeditframe.h b/eeschema/libeditframe.h index a5562c7185..4abccf5b7d 100644 --- a/eeschema/libeditframe.h +++ b/eeschema/libeditframe.h @@ -506,7 +506,13 @@ private: // General editing public: - void SaveCopyInUndoList( EDA_ITEM* ItemToCopy, int flag_type_command = 0 ); + /** + * Function SaveCopyInUndoList. + * Create a copy of the current component, and save it in the undo list. + * Because a component in library editor does not a lot of primitives, + * the full data is duplicated. It is not worth to try to optimize this save funtion + */ + void SaveCopyInUndoList( EDA_ITEM* ItemToCopy ); private: void GetComponentFromUndoList( wxCommandEvent& event ); From 4a95880be9d46e62fadd58654b3fda81e59177af Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Tue, 27 Jan 2015 09:24:46 -0500 Subject: [PATCH 12/29] Fix FindOpenSSL.cmake version string regex breakage in OpenSSL 1.0.2. --- CMakeModules/FindOpenSSL.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeModules/FindOpenSSL.cmake b/CMakeModules/FindOpenSSL.cmake index fbaf21441d..5c5067ee9a 100644 --- a/CMakeModules/FindOpenSSL.cmake +++ b/CMakeModules/FindOpenSSL.cmake @@ -285,7 +285,7 @@ if (OPENSSL_INCLUDE_DIR) set(OPENSSL_VERSION "${_OPENSSL_VERSION}") elseif(OPENSSL_INCLUDE_DIR AND EXISTS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h") file(STRINGS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h" openssl_version_str - REGEX "^#define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x([0-9a-fA-F])+.*") + REGEX "^#[\t ]*define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x([0-9a-fA-F])+.*") # The version number is encoded as 0xMNNFFPPS: major minor fix patch status # The status gives if this is a developer or prerelease and is ignored here. From 93b0a0831e85779d0f24e9a1055fc17fcf227c6e Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Tue, 27 Jan 2015 13:40:52 -0500 Subject: [PATCH 13/29] Minor fixes and code cleaning. * Check to see if image handler is already initialized to prevent warning on debug builds. * Change LIB_PART destructor message output to use wxLogDebug for debugging on windows builds. * Minor code cleaning and coding policy fixes. --- common/pgm_base.cpp | 12 ++++++++--- eeschema/class_libentry.cpp | 43 ++++++++++++------------------------- 2 files changed, 23 insertions(+), 32 deletions(-) diff --git a/common/pgm_base.cpp b/common/pgm_base.cpp index 1f9710c78b..a708ecdd56 100644 --- a/common/pgm_base.cpp +++ b/common/pgm_base.cpp @@ -383,9 +383,15 @@ bool PGM_BASE::initPgm() App().SetAppName( pgm_name.GetName().Lower() ); // Install some image handlers, mainly for help - wxImage::AddHandler( new wxPNGHandler ); - wxImage::AddHandler( new wxGIFHandler ); - wxImage::AddHandler( new wxJPEGHandler ); + if( wxImage::FindHandler( wxBITMAP_TYPE_PNG ) == NULL ) + wxImage::AddHandler( new wxPNGHandler ); + + if( wxImage::FindHandler( wxBITMAP_TYPE_GIF ) == NULL ) + wxImage::AddHandler( new wxGIFHandler ); + + if( wxImage::FindHandler( wxBITMAP_TYPE_JPEG ) == NULL ) + wxImage::AddHandler( new wxJPEGHandler ); + wxFileSystem::AddHandler( new wxZipFSHandler ); // Analyze the command line & initialize the binary path diff --git a/eeschema/class_libentry.cpp b/eeschema/class_libentry.cpp index 93970d4f0f..e834516693 100644 --- a/eeschema/class_libentry.cpp +++ b/eeschema/class_libentry.cpp @@ -1,9 +1,9 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2004 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 2008-2011 Wayne Stambaugh - * Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 2004-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 2008-2015 Wayne Stambaugh + * 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 @@ -241,17 +241,9 @@ LIB_PART::LIB_PART( LIB_PART& aPart, PART_LIB* aLibrary ) : LIB_PART::~LIB_PART() { -#if defined(DEBUG) && 1 - - if( m_aliases.size() ) - { - int breakhere = 1; - (void) breakhere; - } - - printf( "%s: destroying part '%s' with alias list count of %d\n", - __func__, TO_UTF8( GetName() ), int( m_aliases.size() ) ); -#endif + wxLogDebug( wxT( "%s: destroying part '%s' with alias list count of %d\n" ), + GetChars( wxString::FromAscii( __WXFUNCTION__ ) ), GetChars( GetName() ), + int( m_aliases.size() ) ); // If the part is being deleted directly rather than through the library, // delete all of the aliases. @@ -298,8 +290,9 @@ void LIB_PART::SetName( const wxString& aName ) void LIB_PART::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDc, const wxPoint& aOffset, int aMulti, - int aConvert, GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor, const TRANSFORM& aTransform, - bool aShowPinText, bool aDrawFields, bool aOnlySelected ) + int aConvert, GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor, + const TRANSFORM& aTransform, bool aShowPinText, bool aDrawFields, + bool aOnlySelected ) { BASE_SCREEN* screen = aPanel ? aPanel->GetScreen() : NULL; @@ -469,7 +462,7 @@ void LIB_PART::PlotLibFields( PLOTTER* aPlotter, int aUnit, int aConvert, if( aConvert && item.m_Convert && ( item.m_Convert != aConvert ) ) continue; - // The reference is a special case: we shoud change the basic text + // The reference is a special case: we should change the basic text // to add '?' and the part id LIB_FIELD& field = (LIB_FIELD&) item; wxString tmp = field.GetShownText(); @@ -511,7 +504,8 @@ void LIB_PART::RemoveDrawItem( LIB_ITEM* aItem, EDA_DRAW_PANEL* aPanel, wxDC* aD if( *i == aItem ) { if( aDc != NULL ) - aItem->Draw( aPanel, aDc, wxPoint( 0, 0 ), UNSPECIFIED_COLOR, g_XorMode, NULL, DefaultTransform ); + aItem->Draw( aPanel, aDc, wxPoint( 0, 0 ), UNSPECIFIED_COLOR, + g_XorMode, NULL, DefaultTransform ); drawings.erase( i ); SetModified(); @@ -1466,7 +1460,7 @@ void LIB_PART::RotateSelectedItems( const wxPoint& aCenter ) LIB_ITEM* LIB_PART::LocateDrawItem( int aUnit, int aConvert, - KICAD_T aType, const wxPoint& aPoint ) + KICAD_T aType, const wxPoint& aPoint ) { BOOST_FOREACH( LIB_ITEM& item, drawings ) { @@ -1484,7 +1478,7 @@ LIB_ITEM* LIB_PART::LocateDrawItem( int aUnit, int aConvert, LIB_ITEM* LIB_PART::LocateDrawItem( int aUnit, int aConvert, KICAD_T aType, - const wxPoint& aPoint, const TRANSFORM& aTransform ) + const wxPoint& aPoint, const TRANSFORM& aTransform ) { /* we use LocateDrawItem( int aUnit, int convert, KICAD_T type, const * wxPoint& pt ) to search items. @@ -1763,15 +1757,6 @@ void LIB_PART::AddAlias( const wxString& aName ) } -/** Set the separator char between the subpart id and the reference - * 0 (no separator) or '.' , '-' and '_' - * and the ascii char value to calculate the subpart symbol id from the part number: - * 'A' or '1' only are allowed. (to print U1.A or U1.1) - * if this is a digit, a number is used as id symbol - * Note also if the subpart symbol is a digit, the separator cannot be null. - * @param aSep = the separator symbol (0 (no separator) or '.' , '-' and '_') - * @param aFirstId = the Id of the first part ('A' or '1') - */ void LIB_PART::SetSubpartIdNotation( int aSep, int aFirstId ) { m_subpartFirstId = 'A'; From ba6e2ffbcf7b8b475088ed1f33570e3ce6c1fe78 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Wed, 28 Jan 2015 11:00:48 +0100 Subject: [PATCH 14/29] Footprint Editor: New footprint creation: change defaults for ref and value texts: now Ref text is REF** and Value text is the footprint name. Also Value is put on fab layer (front) muonde.cpp: cleanup this very old code, and fix not working code. --- include/wxBasePcbFrame.h | 36 ++-- include/wxPcbStruct.h | 11 +- pcbnew/class_drawsegment.h | 7 +- pcbnew/librairi.cpp | 38 ++-- pcbnew/modedit.cpp | 4 +- pcbnew/module_editor_frame.h | 18 +- pcbnew/moduleframe.cpp | 8 +- pcbnew/muonde.cpp | 358 ++++++++++++++++------------------- 8 files changed, 234 insertions(+), 246 deletions(-) diff --git a/include/wxBasePcbFrame.h b/include/wxBasePcbFrame.h index 9dea4c89d2..5f0bf6e7a0 100644 --- a/include/wxBasePcbFrame.h +++ b/include/wxBasePcbFrame.h @@ -276,22 +276,6 @@ public: */ void CursorGoto( const wxPoint& aPos, bool aWarp = true ); - /** - * Function Save_Module_In_Library - * Save in an existing library a given footprint - * @param aLibName = name of the library to use - * @param aModule = the given footprint - * @param aOverwrite = true to overwrite an existing footprint, false to - * abort if an existing footprint with same name is found - * @param aDisplayDialog = true to display a dialog to enter or confirm the - * footprint name - * @return : true if OK, false if abort - */ - bool Save_Module_In_Library( const wxString& aLibName, - MODULE* aModule, - bool aOverwrite, - bool aDisplayDialog ); - /** * Function SelectLibrary * puts up a dialog and allows the user to pick a library, for unspecified use. @@ -316,17 +300,19 @@ public: virtual void OnModify(); // Modules (footprints) + /** - * Function Create_1_Module - * Creates a new module or footprint : A new module contains 2 texts : - * First = REFERENCE - * Second = VALUE: "VAL**" - * the new module is added to the board module list - * @param aModuleName = name of the new footprint - * (will be the component reference in board) - * @return a pointer to the new module + * Function CreateNewModule + * Creates a new module or footprint, at position 0,0 + * The new module contains only 2 texts: a reference and a value: + * Reference = REF** + * Value = "VAL**" or Footprint name in lib + * Note: they are dummy texts, which will be replaced by the actual texts + * when the fooprint is placed on a board and a netlist is read + * @param aModuleName = name of the new footprint in library + * @return a reference to the new module */ - MODULE* Create_1_Module( const wxString& aModuleName ); + MODULE* CreateNewModule( const wxString& aModuleName ); void Edit_Module( MODULE* module, wxDC* DC ); void Rotate_Module( wxDC* DC, MODULE* module, double angle, bool incremental ); diff --git a/include/wxPcbStruct.h b/include/wxPcbStruct.h index 74d03e692c..5b55acc974 100644 --- a/include/wxPcbStruct.h +++ b/include/wxPcbStruct.h @@ -1602,12 +1602,15 @@ public: void Edit_Gap( wxDC* DC, MODULE* Module ); /** - * Function Create_MuWaveBasicShape - * create a footprint with pad_count pads for micro wave applications. - * This footprint has pad_count pads: + * Function CreateMuWaveBaseFootprint + * create a basic footprint for micro wave applications. + * @param aValue = the text value + * @param aTextSize = the size of ref and value texts ( <= 0 to use board default values ) + * @param aPadCount = number of pads + * Pads settings are: * PAD_SMD, rectangular, H size = V size = current track width. */ - MODULE* Create_MuWaveBasicShape( const wxString& name, int pad_count ); + MODULE* CreateMuWaveBaseFootprint( const wxString& aValue, int aTextSize, int aPadCount ); /** * Create_MuWaveComponent diff --git a/pcbnew/class_drawsegment.h b/pcbnew/class_drawsegment.h index 8e1e22034e..7316b4e554 100644 --- a/pcbnew/class_drawsegment.h +++ b/pcbnew/class_drawsegment.h @@ -157,8 +157,11 @@ public: */ MODULE* GetParentModule() const; - const std::vector& GetBezierPoints() const { return m_BezierPoints; }; - const std::vector& GetPolyPoints() const { return m_PolyPoints; }; + // Accessors: + const std::vector& GetBezierPoints() const { return m_BezierPoints; } + const std::vector& GetPolyPoints() const { return m_PolyPoints; } + // same accessor, to add/change corners of the polygon + std::vector& GetPolyPoints() { return m_PolyPoints; } void SetBezierPoints( const std::vector& aPoints ) { diff --git a/pcbnew/librairi.cpp b/pcbnew/librairi.cpp index 0b4e5e4882..05d33a7d07 100644 --- a/pcbnew/librairi.cpp +++ b/pcbnew/librairi.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 1992-2012 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 1992-2015 KiCad Developers, see change_log.txt for contributors. * * * This program is free software; you can redistribute it and/or @@ -594,7 +594,7 @@ void PCB_EDIT_FRAME::ArchiveModulesOnBoard( bool aNewModulesOnly ) } -bool PCB_BASE_FRAME::Save_Module_In_Library( const wxString& aLibrary, +bool FOOTPRINT_EDIT_FRAME::SaveFootprintInLibrary( const wxString& aLibrary, MODULE* aModule, bool aOverwrite, bool aDisplayDialog ) @@ -708,15 +708,18 @@ bool PCB_BASE_FRAME::Save_Module_In_Library( const wxString& aLibrary, } -MODULE* PCB_BASE_FRAME::Create_1_Module( const wxString& aModuleName ) +MODULE* PCB_BASE_FRAME::CreateNewModule( const wxString& aModuleName ) { - MODULE* module; - wxString moduleName; - wxPoint newpos; + // Creates a new footprint at position 0,0 which contains the minimal items: + // the reference and the value. + // Value : initialized to the footprint name. + // put on fab layer (front side) + // Reference : initialized to a default value (REF**). + // put on silkscreen layer (front side) - moduleName = aModuleName; + wxString moduleName = aModuleName; - // Ask for the new module reference + // Ask for the new module name if( moduleName.IsEmpty() ) { wxTextEntryDialog dlg( this, FMT_MOD_REF, FMT_MOD_CREATE, moduleName ); @@ -736,28 +739,33 @@ MODULE* PCB_BASE_FRAME::Create_1_Module( const wxString& aModuleName ) } // Creates the new module and add it to the head of the linked list of modules - module = new MODULE( GetBoard() ); + MODULE* module = new MODULE( GetBoard() ); GetBoard()->Add( module ); - // Update parameters: position, timestamp ... - newpos = GetCrossHairPosition(); - module->SetPosition( newpos ); + // Update parameters: timestamp ... module->SetLastEditTime(); // Update its name in lib module->SetFPID( FPID( moduleName ) ); + wxPoint default_pos; + // Update reference: - module->SetReference( moduleName ); + module->SetReference( wxT( "REF**" ) ); module->Reference().SetThickness( GetDesignSettings().m_ModuleTextWidth ); module->Reference().SetSize( GetDesignSettings().m_ModuleTextSize ); + default_pos.y = GetDesignSettings().m_ModuleTextSize.y / 2; + module->Reference().SetPosition( default_pos ); + module->Reference().SetLayer( F_SilkS ); // Set the value field to a default value - module->SetValue( wxT( "VAL**" ) ); + module->SetValue( moduleName ); module->Value().SetThickness( GetDesignSettings().m_ModuleTextWidth ); module->Value().SetSize( GetDesignSettings().m_ModuleTextSize ); - module->SetPosition( wxPoint( 0, 0 ) ); + default_pos.y = -default_pos.y; + module->Value().SetPosition( default_pos ); + module->Value().SetLayer( F_Fab ); SetMsgPanel( module ); return module; diff --git a/pcbnew/modedit.cpp b/pcbnew/modedit.cpp index 04294b08b8..eaf8df7260 100644 --- a/pcbnew/modedit.cpp +++ b/pcbnew/modedit.cpp @@ -300,7 +300,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) SetCrossHairPosition( wxPoint( 0, 0 ) ); - MODULE* module = Create_1_Module( wxEmptyString ); + MODULE* module = CreateNewModule( wxEmptyString ); if( module ) // i.e. if create module command not aborted { @@ -375,7 +375,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) case ID_MODEDIT_SAVE_LIBMODULE: if( GetBoard()->m_Modules && GetCurrentLib().size() ) { - Save_Module_In_Library( GetCurrentLib(), GetBoard()->m_Modules, true, true ); + SaveFootprintInLibrary( GetCurrentLib(), GetBoard()->m_Modules, true, true ); GetScreen()->ClrModify(); } break; diff --git a/pcbnew/module_editor_frame.h b/pcbnew/module_editor_frame.h index f7dd546d65..282fd1ff5a 100644 --- a/pcbnew/module_editor_frame.h +++ b/pcbnew/module_editor_frame.h @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -158,6 +158,22 @@ public: */ void LoadModuleFromBoard( wxCommandEvent& event ); + /** + * Function SaveFootprintInLibrary + * Save in an existing library a given footprint + * @param aLibName = name of the library to use + * @param aModule = the given footprint + * @param aOverwrite = true to overwrite an existing footprint, false to + * abort if an existing footprint with same name is found + * @param aDisplayDialog = true to display a dialog to enter or confirm the + * footprint name + * @return : true if OK, false if abort + */ + bool SaveFootprintInLibrary( const wxString& aLibName, + MODULE* aModule, + bool aOverwrite, + bool aDisplayDialog ); + /** * Virtual Function OnModify() * Must be called after a footprint change diff --git a/pcbnew/moduleframe.cpp b/pcbnew/moduleframe.cpp index 7682d00e2d..a978a1c496 100644 --- a/pcbnew/moduleframe.cpp +++ b/pcbnew/moduleframe.cpp @@ -1,10 +1,10 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck - * Copyright (C) 2012 Wayne Stambaugh - * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2015 Wayne Stambaugh + * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -488,7 +488,7 @@ void FOOTPRINT_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event ) // at case ID_MODEDIT_SAVE_LIBMODULE if( GetBoard()->m_Modules && GetCurrentLib().size() ) { - if( Save_Module_In_Library( GetCurrentLib(), GetBoard()->m_Modules, true, true ) ) + if( SaveFootprintInLibrary( GetCurrentLib(), GetBoard()->m_Modules, true, true ) ) { // save was correct GetScreen()->ClrModify(); diff --git a/pcbnew/muonde.cpp b/pcbnew/muonde.cpp index 1c62e95c6c..7bb6da83f1 100644 --- a/pcbnew/muonde.cpp +++ b/pcbnew/muonde.cpp @@ -1,10 +1,10 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr + * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck - * Copyright (C) 2012 Wayne Stambaugh - * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2015 Wayne Stambaugh + * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -42,6 +42,7 @@ #include #include #include +#include #include #include @@ -49,21 +50,19 @@ #include - -#define COEFF_COUNT 6 - -static std::vector< double > PolyEdges; +static std::vector< wxRealPoint > PolyEdges; static double ShapeScaleX, ShapeScaleY; static wxSize ShapeSize; static int PolyShapeType; -static void Exit_Self( EDA_DRAW_PANEL* Panel, wxDC* DC ); +static void Exit_Self( EDA_DRAW_PANEL* aPanel, wxDC* aDC ); static void gen_arc( std::vector & aBuffer, wxPoint aStartPoint, wxPoint aCenter, int a_ArcAngle ); -static void ShowBoundingBoxMicroWaveInductor( EDA_DRAW_PANEL* apanel, + +static void ShowBoundingBoxMicroWaveInductor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase ); @@ -73,19 +72,20 @@ int BuildCornersList_S_Shape( std::vector & aBuffer, wxPoint aStartPoint, wxPoint aEndPoint, int aLength, int aWidth ); -class SELFPCB +class MUWAVE_INDUCTOR { public: - int forme; // Shape: coil, spiral, etc .. wxPoint m_Start; wxPoint m_End; wxSize m_Size; - int lng; // Trace length. - int m_Width; // Trace width. + int m_lenght; // full length trace. + int m_Width; // Trace width. + // A flag set to true when mu-wave inductor is being created + bool m_Flag; }; -static SELFPCB Mself; -static int Self_On; +// An instance of MUWAVE_INDUCTOR temporary used during mu-wave inductor creation +static MUWAVE_INDUCTOR s_inductor_pattern; /* This function shows on screen the bounding box of the inductor that will be @@ -101,19 +101,19 @@ static void ShowBoundingBoxMicroWaveInductor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GRSetDrawMode( aDC, GR_XOR ); wxPoint poly[5]; - wxPoint pt = Mself.m_End - Mself.m_Start; + wxPoint pt = s_inductor_pattern.m_End - s_inductor_pattern.m_Start; double angle = -ArcTangente( pt.y, pt.x ); int len = KiROUND( EuclideanNorm( pt ) ); // calculate corners pt.x = 0; pt.y = len / 4; RotatePoint( &pt, angle ); - poly[0] = Mself.m_Start + pt; - poly[1] = Mself.m_End + pt; + poly[0] = s_inductor_pattern.m_Start + pt; + poly[1] = s_inductor_pattern.m_End + pt; pt.x = 0; pt.y = -len / 4; RotatePoint( &pt, angle ); - poly[2] = Mself.m_End + pt; - poly[3] = Mself.m_Start + pt; + poly[2] = s_inductor_pattern.m_End + pt; + poly[3] = s_inductor_pattern.m_Start + pt; poly[4] = poly[0]; if( aErase ) @@ -121,48 +121,48 @@ static void ShowBoundingBoxMicroWaveInductor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GRPoly( aPanel->GetClipBox(), aDC, 5, poly, false, 0, YELLOW, YELLOW ); } - Mself.m_End = aPanel->GetParent()->GetCrossHairPosition(); - pt = Mself.m_End - Mself.m_Start; + s_inductor_pattern.m_End = aPanel->GetParent()->GetCrossHairPosition(); + pt = s_inductor_pattern.m_End - s_inductor_pattern.m_Start; angle = -ArcTangente( pt.y, pt.x ); len = KiROUND( EuclideanNorm( pt ) ); // calculate new corners pt.x = 0; pt.y = len / 4; RotatePoint( &pt, angle ); - poly[0] = Mself.m_Start + pt; - poly[1] = Mself.m_End + pt; + poly[0] = s_inductor_pattern.m_Start + pt; + poly[1] = s_inductor_pattern.m_End + pt; pt.x = 0; pt.y = -len / 4; RotatePoint( &pt, angle ); - poly[2] = Mself.m_End + pt; - poly[3] = Mself.m_Start + pt; + poly[2] = s_inductor_pattern.m_End + pt; + poly[3] = s_inductor_pattern.m_Start + pt; poly[4] = poly[0]; GRPoly( aPanel->GetClipBox(), aDC, 5, poly, false, 0, YELLOW, YELLOW ); } -void Exit_Self( EDA_DRAW_PANEL* Panel, wxDC* DC ) +void Exit_Self( EDA_DRAW_PANEL* aPanel, wxDC* aDC ) { - if( Self_On ) - { - Self_On = 0; - Panel->CallMouseCapture( DC, wxDefaultPosition, 0 ); - } + if( aPanel->IsMouseCaptured() ) + aPanel->CallMouseCapture( aDC, wxDefaultPosition, false ); + + s_inductor_pattern.m_Flag = false; + aPanel->SetMouseCapture( NULL, NULL ); } void PCB_EDIT_FRAME::Begin_Self( wxDC* DC ) { - if( Self_On ) + if( s_inductor_pattern.m_Flag ) { Genere_Self( DC ); return; } - Mself.m_Start = GetCrossHairPosition(); - Mself.m_End = Mself.m_Start; + s_inductor_pattern.m_Start = GetCrossHairPosition(); + s_inductor_pattern.m_End = s_inductor_pattern.m_Start; - Self_On = 1; + s_inductor_pattern.m_Flag = true; // Update the initial coordinates. GetScreen()->m_O_Curseur = GetCrossHairPosition(); @@ -182,42 +182,44 @@ MODULE* PCB_EDIT_FRAME::Genere_Self( wxDC* DC ) m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); m_canvas->SetMouseCapture( NULL, NULL ); - if( Self_On == 0 ) + if( s_inductor_pattern.m_Flag == false ) { DisplayError( this, wxT( "Starting point not init.." ) ); return NULL; } - Self_On = 0; + s_inductor_pattern.m_Flag = false; - Mself.m_End = GetCrossHairPosition(); + s_inductor_pattern.m_End = GetCrossHairPosition(); - wxPoint pt = Mself.m_End - Mself.m_Start; + wxPoint pt = s_inductor_pattern.m_End - s_inductor_pattern.m_Start; int min_len = KiROUND( EuclideanNorm( pt ) ); - Mself.lng = min_len; + s_inductor_pattern.m_lenght = min_len; // Enter the desired length. - msg = StringFromValue( g_UserUnit, Mself.lng ); - wxTextEntryDialog dlg( this, _( "Length:" ), _( "Length" ), msg ); + msg = StringFromValue( g_UserUnit, s_inductor_pattern.m_lenght ); + wxTextEntryDialog dlg( this, wxEmptyString, _( "Length of Trace:" ), msg ); if( dlg.ShowModal() != wxID_OK ) return NULL; // canceled by user msg = dlg.GetValue(); - Mself.lng = ValueFromString( g_UserUnit, msg ); + s_inductor_pattern.m_lenght = ValueFromString( g_UserUnit, msg ); // Control values (ii = minimum length) - if( Mself.lng < min_len ) + if( s_inductor_pattern.m_lenght < min_len ) { DisplayError( this, _( "Requested length < minimum length" ) ); return NULL; } // Calculate the elements. - Mself.m_Width = GetDesignSettings().GetCurrentTrackWidth(); + s_inductor_pattern.m_Width = GetDesignSettings().GetCurrentTrackWidth(); std::vector buffer; - ll = BuildCornersList_S_Shape( buffer, Mself.m_Start, Mself.m_End, Mself.lng, Mself.m_Width ); + ll = BuildCornersList_S_Shape( buffer, s_inductor_pattern.m_Start, + s_inductor_pattern.m_End, s_inductor_pattern.m_lenght, + s_inductor_pattern.m_Width ); if( !ll ) { @@ -225,18 +227,21 @@ MODULE* PCB_EDIT_FRAME::Genere_Self( wxDC* DC ) return NULL; } - // Generate module. - MODULE* module; - module = Create_1_Module( wxEmptyString ); + // Generate footprint. the value is also used as footprint name. + msg.Empty(); + wxTextEntryDialog cmpdlg( this, wxEmptyString, _( "Component Value:" ), msg ); + cmpdlg.SetTextValidator( FILE_NAME_CHAR_VALIDATOR( &msg ) ); - if( module == NULL ) - return NULL; + if( ( cmpdlg.ShowModal() != wxID_OK ) || msg.IsEmpty() ) + return NULL; // Aborted by user - // here the module is already in the BOARD, Create_1_Module() does that. - module->SetFPID( FPID( std::string( "MuSelf" ) ) ); + MODULE* module = CreateNewModule( msg ); + + // here the module is already in the BOARD, CreateNewModule() does that. + module->SetFPID( FPID( std::string( "mw_inductor" ) ) ); module->SetAttributes( MOD_VIRTUAL | MOD_CMS ); module->ClearFlags(); - module->SetPosition( Mself.m_End ); + module->SetPosition( s_inductor_pattern.m_End ); // Generate segments for( unsigned jj = 1; jj < buffer.size(); jj++ ) @@ -245,11 +250,11 @@ MODULE* PCB_EDIT_FRAME::Genere_Self( wxDC* DC ) PtSegm = new EDGE_MODULE( module ); PtSegm->SetStart( buffer[jj - 1] ); PtSegm->SetEnd( buffer[jj] ); - PtSegm->SetWidth( Mself.m_Width ); + PtSegm->SetWidth( s_inductor_pattern.m_Width ); PtSegm->SetLayer( module->GetLayer() ); PtSegm->SetShape( S_SEGMENT ); PtSegm->SetStart0( PtSegm->GetStart() - module->GetPosition() ); - PtSegm->SetEnd0( PtSegm->GetEnd() - module->GetPosition() ); + PtSegm->SetEnd0( PtSegm->GetEnd() - module->GetPosition() ); module->GraphicalItems().PushBack( PtSegm ); } @@ -259,10 +264,10 @@ MODULE* PCB_EDIT_FRAME::Genere_Self( wxDC* DC ) module->Pads().PushFront( pad ); pad->SetPadName( wxT( "1" ) ); - pad->SetPosition( Mself.m_End ); + pad->SetPosition( s_inductor_pattern.m_End ); pad->SetPos0( pad->GetPosition() - module->GetPosition() ); - pad->SetSize( wxSize( Mself.m_Width, Mself.m_Width ) ); + pad->SetSize( wxSize( s_inductor_pattern.m_Width, s_inductor_pattern.m_Width ) ); pad->SetLayerSet( LSET( module->GetLayer() ) ); pad->SetAttribute( PAD_SMD ); @@ -274,23 +279,21 @@ MODULE* PCB_EDIT_FRAME::Genere_Self( wxDC* DC ) pad = newpad; pad->SetPadName( wxT( "2" ) ); - pad->SetPosition( Mself.m_Start ); + pad->SetPosition( s_inductor_pattern.m_Start ); pad->SetPos0( pad->GetPosition() - module->GetPosition() ); // Modify text positions. SetMsgPanel( module ); - wxPoint refPos( ( Mself.m_Start.x + Mself.m_End.x ) / 2, - ( Mself.m_Start.y + Mself.m_End.y ) / 2 ); + wxPoint refPos( ( s_inductor_pattern.m_Start.x + s_inductor_pattern.m_End.x ) / 2, + ( s_inductor_pattern.m_Start.y + s_inductor_pattern.m_End.y ) / 2 ); wxPoint valPos = refPos; refPos.y -= module->Reference().GetSize().y; - module->Reference().SetTextPosition( refPos ); + module->Reference().SetPosition( refPos ); valPos.y += module->Value().GetSize().y; - module->Value().SetTextPosition( valPos ); - module->Reference().SetPos0( module->Reference().GetTextPosition() - module->GetPosition() ); - module->Value().SetPos0( module->Value().GetTextPosition() - module->GetPosition() ); + module->Value().SetPosition( valPos ); module->CalculateBoundingBox(); module->Draw( m_canvas, DC, GR_OR ); @@ -364,7 +367,7 @@ int BuildCornersList_S_Shape( std::vector & aBuffer, * The equations are (assuming the area size of the entire shape is Size: * Size.x = 2 * radius + segm_len * Size.y = (segm_count + 2 ) * 2 * radius + 2 * stubs_len - * Mself.lng = 2 * delta // connections to the coil + * s_inductor_pattern.m_lenght = 2 * delta // connections to the coil * + (segm_count-2) * segm_len // length of the strands except 1st and last * + (segm_count) * (PI * radius) // length of rounded * segm_len + / 2 - radius * 2) // length of 1st and last bit @@ -522,39 +525,25 @@ int BuildCornersList_S_Shape( std::vector & aBuffer, } -MODULE* PCB_EDIT_FRAME::Create_MuWaveBasicShape( const wxString& name, int pad_count ) +MODULE* PCB_EDIT_FRAME::CreateMuWaveBaseFootprint( const wxString& aValue, + int aTextSize, int aPadCount ) { - MODULE* module; - int pad_num = 1; - wxString Line; + MODULE* module = CreateNewModule( aValue ); - module = Create_1_Module( name ); - - if( module == NULL ) - return NULL; - - #define DEFAULT_SIZE 30 - module->SetTimeStamp( GetNewTimeStamp() ); - - module->Value().SetSize( wxSize( DEFAULT_SIZE, DEFAULT_SIZE ) ); - - module->Value().SetPos0( wxPoint( 0, -DEFAULT_SIZE ) ); - - module->Value().Offset( wxPoint( 0, module->Value().GetPos0().y ) ); - - module->Value().SetThickness( DEFAULT_SIZE / 4 ); - - module->Reference().SetSize( wxSize( DEFAULT_SIZE, DEFAULT_SIZE ) ); - - module->Reference().SetPos0( wxPoint( 0, DEFAULT_SIZE ) ); - - module->Reference().Offset( wxPoint( 0, module->Reference().GetPos0().y ) ); - - module->Reference().SetThickness( DEFAULT_SIZE / 4 ); + if( aTextSize > 0 ) + { + module->Reference().SetSize( wxSize( aTextSize, aTextSize ) ); + module->Reference().SetThickness( aTextSize/5 ); + module->Value().SetSize( wxSize( aTextSize, aTextSize ) ); + module->Value().SetThickness( aTextSize/5 ); + } // Create 2 pads used in gaps and stubs. The gap is between these 2 pads // the stub is the pad 2 - while( pad_count-- ) + wxString Line; + int pad_num = 1; + + while( aPadCount-- ) { D_PAD* pad = new D_PAD( module ); @@ -585,6 +574,9 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveComponent( int shape_type ) wxString msg, cmp_name; int pad_count = 2; int angle = 0; + // Ref and value text size (O = use board default value. + // will be set to a value depending on the footprint size, if possible + int text_size = 0; // Enter the size of the gap or stub int gap_size = GetDesignSettings().GetCurrentTrackWidth(); @@ -593,18 +585,20 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveComponent( int shape_type ) { case 0: msg = _( "Gap" ); - cmp_name = wxT( "GAP" ); + cmp_name = wxT( "muwave_gap" ); + text_size = gap_size; break; case 1: msg = _( "Stub" ); - cmp_name = wxT( "STUB" ); + cmp_name = wxT( "muwave_stub" ); + text_size = gap_size; pad_count = 2; break; case 2: msg = _( "Arc Stub" ); - cmp_name = wxT( "ASTUB" ); + cmp_name = wxT( "muwave_arcstub" ); pad_count = 1; break; @@ -631,7 +625,7 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveComponent( int shape_type ) { double fcoeff = 10.0, fval; msg.Printf( wxT( "%3.1f" ), angle / fcoeff ); - wxTextEntryDialog angledlg( this, _( "Angle (0.1deg):" ), + wxTextEntryDialog angledlg( this, _( "Angle in degrees:" ), _( "Create microwave module" ), msg ); if( angledlg.ShowModal() != wxID_OK ) @@ -660,7 +654,7 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveComponent( int shape_type ) return NULL; } - module = Create_MuWaveBasicShape( cmp_name, pad_count ); + module = CreateMuWaveBaseFootprint( cmp_name, text_size, pad_count ); pad = module->Pads(); switch( shape_type ) @@ -693,8 +687,8 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveComponent( int shape_type ) edge->SetShape( S_POLYGON ); edge->SetLayer( F_Cu ); - int numPoints = angle / 50 + 3; // Note: angles are in 0.1 degrees - std::vector polyPoints = edge->GetPolyPoints(); + int numPoints = (angle / 50) + 3; // Note: angles are in 0.1 degrees + std::vector& polyPoints = edge->GetPolyPoints(); polyPoints.reserve( numPoints ); edge->m_Start0.y = -pad->GetSize().y / 2; @@ -742,7 +736,7 @@ enum id_mw_cmd { /* Setting polynomial form parameters */ -class WinEDA_SetParamShapeFrame : public wxDialog +class MWAVE_POLYGONAL_SHAPE_DLG : public wxDialog { private: PCB_EDIT_FRAME* m_Parent; @@ -750,8 +744,8 @@ private: EDA_SIZE_CTRL* m_SizeCtrl; public: - WinEDA_SetParamShapeFrame( PCB_EDIT_FRAME* parent, const wxPoint& pos ); - ~WinEDA_SetParamShapeFrame() { }; + MWAVE_POLYGONAL_SHAPE_DLG( PCB_EDIT_FRAME* parent, const wxPoint& pos ); + ~MWAVE_POLYGONAL_SHAPE_DLG() { }; private: void OnOkClick( wxCommandEvent& event ); @@ -780,14 +774,14 @@ private: }; -BEGIN_EVENT_TABLE( WinEDA_SetParamShapeFrame, wxDialog ) - EVT_BUTTON( wxID_OK, WinEDA_SetParamShapeFrame::OnOkClick ) - EVT_BUTTON( wxID_CANCEL, WinEDA_SetParamShapeFrame::OnCancelClick ) - EVT_BUTTON( ID_READ_SHAPE_FILE, WinEDA_SetParamShapeFrame::ReadDataShapeDescr ) +BEGIN_EVENT_TABLE( MWAVE_POLYGONAL_SHAPE_DLG, wxDialog ) + EVT_BUTTON( wxID_OK, MWAVE_POLYGONAL_SHAPE_DLG::OnOkClick ) + EVT_BUTTON( wxID_CANCEL, MWAVE_POLYGONAL_SHAPE_DLG::OnCancelClick ) + EVT_BUTTON( ID_READ_SHAPE_FILE, MWAVE_POLYGONAL_SHAPE_DLG::ReadDataShapeDescr ) END_EVENT_TABLE() -WinEDA_SetParamShapeFrame::WinEDA_SetParamShapeFrame( PCB_EDIT_FRAME* parent, +MWAVE_POLYGONAL_SHAPE_DLG::MWAVE_POLYGONAL_SHAPE_DLG( PCB_EDIT_FRAME* parent, const wxPoint& framepos ) : wxDialog( parent, -1, _( "Complex shape" ), framepos, wxSize( 350, 280 ), wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER ) @@ -815,8 +809,7 @@ WinEDA_SetParamShapeFrame::WinEDA_SetParamShapeFrame( PCB_EDIT_FRAME* parent, wxString shapelist[3] = { - _( "Normal" ), _( "Symmetrical" ), - _( "Mirrored" ) + _( "Normal" ), _( "Symmetrical" ), _( "Mirrored" ) }; m_ShapeOptionCtrl = new wxRadioBox( this, -1, _( "Shape Option" ), @@ -827,49 +820,42 @@ WinEDA_SetParamShapeFrame::WinEDA_SetParamShapeFrame( PCB_EDIT_FRAME* parent, m_SizeCtrl = new EDA_SIZE_CTRL( this, _( "Size" ), ShapeSize, g_UserUnit, LeftBoxSizer ); - GetSizer()->Fit( this ); GetSizer()->SetSizeHints( this ); } -void WinEDA_SetParamShapeFrame::OnCancelClick( wxCommandEvent& event ) +void MWAVE_POLYGONAL_SHAPE_DLG::OnCancelClick( wxCommandEvent& event ) { PolyEdges.clear(); - EndModal( -1 ); + EndModal( wxID_CANCEL ); } -void WinEDA_SetParamShapeFrame::OnOkClick( wxCommandEvent& event ) +void MWAVE_POLYGONAL_SHAPE_DLG::OnOkClick( wxCommandEvent& event ) { ShapeSize = m_SizeCtrl->GetValue(); PolyShapeType = m_ShapeOptionCtrl->GetSelection(); - EndModal( 1 ); + EndModal( wxID_OK ); } -void WinEDA_SetParamShapeFrame::ReadDataShapeDescr( wxCommandEvent& event ) +void MWAVE_POLYGONAL_SHAPE_DLG::ReadDataShapeDescr( wxCommandEvent& event ) { - wxString FullFileName; - wxString ext, mask; - FILE* File; - char* Line; - double unitconv = 10000; - char* param1, * param2; + static wxString lastpath; // To remember the last open path during a session + wxString mask = wxT( "*.*" ); - ext = wxT( ".txt" ); - mask = wxT( "*" ) + ext; - FullFileName = EDA_FileSelector( _( "Read descr shape file" ), - wxEmptyString, - FullFileName, - ext, - mask, - this, - wxFD_OPEN, - true ); + wxString FullFileName = EDA_FileSelector( _( "Read descr shape file" ), + lastpath, FullFileName, + wxEmptyString, mask, + this, wxFD_OPEN, true ); if( FullFileName.IsEmpty() ) return; - File = wxFopen( FullFileName, wxT( "rt" ) ); + wxFileName fn( FullFileName ); + lastpath = fn.GetPath(); + PolyEdges.clear(); + + FILE* File = wxFopen( FullFileName, wxT( "rt" ) ); if( File == NULL ) { @@ -877,25 +863,27 @@ void WinEDA_SetParamShapeFrame::ReadDataShapeDescr( wxCommandEvent& event ) return; } - FILE_LINE_READER fileReader( File, FullFileName ); + double unitconv = IU_PER_MM; + ShapeScaleX = ShapeScaleY = 1.0; + FILE_LINE_READER fileReader( File, FullFileName ); FILTER_READER reader( fileReader ); LOCALE_IO toggle; while( reader.ReadLine() ) { - Line = reader.Line(); - param1 = strtok( Line, " =\n\r" ); - param2 = strtok( NULL, " \t\n\r" ); + char* Line = reader.Line(); + char* param1 = strtok( Line, " =\n\r" ); + char* param2 = strtok( NULL, " \t\n\r" ); if( strnicmp( param1, "Unit", 4 ) == 0 ) { if( strnicmp( param2, "inch", 4 ) == 0 ) - unitconv = 10000; + unitconv = IU_PER_MILS*1000; if( strnicmp( param2, "mm", 2 ) == 0 ) - unitconv = 10000 / 25.4; + unitconv = IU_PER_MM; } if( strnicmp( param1, "$ENDCOORD", 8 ) == 0 ) @@ -912,20 +900,16 @@ void WinEDA_SetParamShapeFrame::ReadDataShapeDescr( wxCommandEvent& event ) if( strnicmp( param1, "$ENDCOORD", 8 ) == 0 ) break; - PolyEdges.push_back( atof( param1 ) ); - PolyEdges.push_back( atof( param2 ) ); + wxRealPoint coord( atof( param1 ), atof( param2 ) ); + PolyEdges.push_back( coord ); } } if( strnicmp( Line, "XScale", 6 ) == 0 ) - { ShapeScaleX = atof( param2 ); - } if( strnicmp( Line, "YScale", 6 ) == 0 ) - { ShapeScaleY = atof( param2 ); - } } ShapeScaleX *= unitconv; @@ -943,17 +927,16 @@ MODULE* PCB_EDIT_FRAME::Create_MuWavePolygonShape() int pad_count = 2; EDGE_MODULE* edge; - WinEDA_SetParamShapeFrame* frame = new WinEDA_SetParamShapeFrame( this, wxPoint( -1, -1 ) ); + MWAVE_POLYGONAL_SHAPE_DLG dlg( this, wxPoint( -1, -1 ) ); - int ok = frame->ShowModal(); - - frame->Destroy(); + int ret = dlg.ShowModal(); m_canvas->MoveCursorToCrossHair(); - if( ok != 1 ) + if( ret != wxID_OK ) { PolyEdges.clear(); + return NULL; } if( PolyShapeType == 2 ) // mirrored @@ -974,77 +957,66 @@ MODULE* PCB_EDIT_FRAME::Create_MuWavePolygonShape() return NULL; } - cmp_name = wxT( "POLY" ); + cmp_name = wxT( "muwave_polygon" ); + + // Create a footprint with 2 pads, orientation = 0, pos 0 + module = CreateMuWaveBaseFootprint( cmp_name, 0, pad_count ); + + // We try to place the footprint anchor to the middle of the shape len + wxPoint offset; + offset.x = -ShapeSize.x / 2; - module = Create_MuWaveBasicShape( cmp_name, pad_count ); pad1 = module->Pads(); - - pad1->SetX0( -ShapeSize.x / 2 ); - pad1->SetX( pad1->GetPos0().x + pad1->GetPosition().x ); + pad1->SetX0( offset.x ); + pad1->SetX( pad1->GetPos0().x ); pad2 = (D_PAD*) pad1->Next(); - pad2->SetX0( pad1->GetPos0().x + ShapeSize.x ); - pad2->SetX( pad2->GetPos0().x + pad2->GetPosition().x ); + pad2->SetX0( offset.x + ShapeSize.x ); + pad2->SetX( pad2->GetPos0().x ); + // Add a polygonal edge (corners will be added later) on copper layer edge = new EDGE_MODULE( module ); - - module->GraphicalItems().PushFront( edge ); - edge->SetShape( S_POLYGON ); edge->SetLayer( F_Cu ); - std::vector polyPoints = edge->GetPolyPoints(); - polyPoints.reserve( 2 * PolyEdges.size() + 2 ); + module->GraphicalItems().PushFront( edge ); + + // Get the corner buffer of the polygonal edge + std::vector& polyPoints = edge->GetPolyPoints(); + polyPoints.reserve( PolyEdges.size() + 2 ); // Init start point coord: - polyPoints.push_back( wxPoint( pad1->GetPos0().x, 0 ) ); + polyPoints.push_back( wxPoint( offset.x, 0 ) ); wxPoint first_coordinate, last_coordinate; for( unsigned ii = 0; ii < PolyEdges.size(); ii++ ) // Copy points { - last_coordinate.x = KiROUND( PolyEdges[ii] * ShapeScaleX ) + pad1->GetPos0().x; - last_coordinate.y = -KiROUND( PolyEdges[ii] * ShapeScaleY ); + last_coordinate.x = KiROUND( PolyEdges[ii].x * ShapeScaleX ); + last_coordinate.y = -KiROUND( PolyEdges[ii].y * ShapeScaleY ); + last_coordinate += offset; polyPoints.push_back( last_coordinate ); } + // finish the polygonal shape + if( last_coordinate.y != 0 ) + polyPoints.push_back( wxPoint( last_coordinate.x, 0 ) ); + first_coordinate.y = polyPoints[1].y; switch( PolyShapeType ) { - case 0: // Single - case 2: // Single mirrored - - // Init end point coord: - pad2->SetX0( last_coordinate.x ); - polyPoints.push_back( wxPoint( last_coordinate.x, 0 ) ); - - pad1->SetSize( wxSize( std::abs( first_coordinate.y ), - std::abs( first_coordinate.y ) ) ); - pad2->SetSize( wxSize( std::abs( last_coordinate.y ), - std::abs( last_coordinate.y ) ) ); - - pad1->SetY0( first_coordinate.y / 2 ); - pad2->SetY0( last_coordinate.y / 2 ); - - pad1->SetY( pad1->GetPos0().y + module->GetPosition().y ); - pad2->SetY( pad2->GetPos0().y + module->GetPosition().y ); + case 0: // shape from file + case 2: // shape from file, mirrored (the mirror is already done) break; - case 1: // Symmetric - for( int ndx = polyPoints.size() - 1; ndx>=0; --ndx ) + case 1: // Symmetric shape: add the symmetric (mirrored) shape + for( int ndx = polyPoints.size() - 1; ndx >= 0; --ndx ) { wxPoint pt = polyPoints[ndx]; - pt.y = -pt.y; // mirror about X axis - polyPoints.push_back( pt ); } - - pad1->SetSize( wxSize( 2 * std::abs( first_coordinate.y ), - 2 * std::abs( first_coordinate.y ) ) ); - pad2->SetSize( wxSize( 2 * std::abs( last_coordinate.y ), - 2 * std::abs( last_coordinate.y ) ) ); break; } From 3838082bf3b93ed22c2570eb9edcc83fbf6b741b Mon Sep 17 00:00:00 2001 From: Alexander Golubev Date: Wed, 28 Jan 2015 16:43:46 -0500 Subject: [PATCH 15/29] Minor compiler warning and object improvements. * Fix -Woverloaded-virtual warning in DIALOG_LIB_NEW_COMPONENT class definition. * Make EDA_ITEM::Matches( const wxString& wxFindReplaceData& ) protected since it's a helper function that should only be called by derived objects. --- eeschema/dialogs/dialog_lib_new_component.h | 6 ++--- include/base_struct.h | 30 +++++++++++---------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/eeschema/dialogs/dialog_lib_new_component.h b/eeschema/dialogs/dialog_lib_new_component.h index 67ab3296bb..b8b9619fdf 100644 --- a/eeschema/dialogs/dialog_lib_new_component.h +++ b/eeschema/dialogs/dialog_lib_new_component.h @@ -1,8 +1,8 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2009 Wayne Stambaugh - * Copyright (C) 2014 KiCad Developers, see CHANGELOG.TXT for contributors. + * Copyright (C) 2009-2105 Wayne Stambaugh + * 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 @@ -40,7 +40,7 @@ public: DIALOG_LIB_NEW_COMPONENT( wxWindow* parent ); void SetName( const wxString& name ) { m_textName->SetValue( name ); } - wxString GetName( void ) { return m_textName->GetValue(); } + wxString GetName( void ) const { return m_textName->GetValue(); } void SetReference( const wxString& reference ) { diff --git a/include/base_struct.h b/include/base_struct.h index 360e4ff6b1..c88e481c3c 100644 --- a/include/base_struct.h +++ b/include/base_struct.h @@ -1,10 +1,10 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 2008-2013 SoftPLC Corporation, Dick Hollenbeck - * Copyright (C) 2008-2013 Wayne Stambaugh - * Copyright (C) 2004-2013 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 2013-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 2008-2015 SoftPLC Corporation, Dick Hollenbeck + * Copyright (C) 2008-2015 Wayne Stambaugh + * 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 @@ -426,17 +426,7 @@ public: } /** - * Function Matches - * compares \a aText against search criteria in \a aSearchData. * Helper function used in search and replace dialog - * - * @param aText A reference to a wxString object containing the string to test. - * @param aSearchData The criteria to search against. - * @return True if \a aText matches the search criteria in \a aSearchData. - */ - bool Matches( const wxString& aText, wxFindReplaceData& aSearchData ); - - /** * Function Replace * performs a text replace on \a aText using the find and replace criteria in * \a aSearchData on items that support text find and replace. @@ -534,6 +524,18 @@ public: static std::ostream& NestedSpace( int nestLevel, std::ostream& os ); #endif + +protected: + /** + * Function Matches + * compares \a aText against search criteria in \a aSearchData. + * This is a helper function for simplify derived class logic. + * + * @param aText A reference to a wxString object containing the string to test. + * @param aSearchData The criteria to search against. + * @return True if \a aText matches the search criteria in \a aSearchData. + */ + bool Matches( const wxString& aText, wxFindReplaceData& aSearchData ); }; From f5d9d09e0432960924cb55c96a2682b31cea0e32 Mon Sep 17 00:00:00 2001 From: Simon Richter Date: Thu, 29 Jan 2015 10:27:24 -0500 Subject: [PATCH 16/29] Hide EDA_ITEM ctors to prevent direct instantiation of abstract class. --- include/base_struct.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/base_struct.h b/include/base_struct.h index c88e481c3c..18283dbac4 100644 --- a/include/base_struct.h +++ b/include/base_struct.h @@ -188,11 +188,14 @@ private: void initVars(); -public: +protected: EDA_ITEM( EDA_ITEM* parent, KICAD_T idType ); EDA_ITEM( KICAD_T idType ); EDA_ITEM( const EDA_ITEM& base ); + +public: + virtual ~EDA_ITEM() { }; /** From b556fb23249e6466d151de4090ece4dc405c8244 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Thu, 29 Jan 2015 17:01:48 +0100 Subject: [PATCH 17/29] Class BOARD: Rename an overloaded method named SetLayer with the better name SetLayerDescr, and comment it. It also remove some warnings when compiled with option -Woverloaded-virtual --- pcbnew/class_board.cpp | 2 +- pcbnew/class_board.h | 10 +++++++++- pcbnew/pcb_parser.cpp | 4 ++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index 2f93772d39..8fbc69dda5 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.cpp @@ -303,7 +303,7 @@ void BOARD::PopHighLight() } -bool BOARD::SetLayer( LAYER_ID aIndex, const LAYER& aLayer ) +bool BOARD::SetLayerDescr( LAYER_ID aIndex, const LAYER& aLayer ) { if( unsigned( aIndex ) < DIM( m_Layer ) ) { diff --git a/pcbnew/class_board.h b/pcbnew/class_board.h index f25da375bb..84891f780c 100644 --- a/pcbnew/class_board.h +++ b/pcbnew/class_board.h @@ -661,7 +661,15 @@ public: return LSET::Name( aLayerId ); } - bool SetLayer( LAYER_ID aIndex, const LAYER& aLayer ); + /** + * Function SetLayerDescr + * returns the type of the copper layer given by aLayer. + * + * @param aIndex A layer index in m_Layer + * @param aLayer A reference to a LAYER description. + * @return false if the index was out of range. + */ + bool SetLayerDescr( LAYER_ID aIndex, const LAYER& aLayer ); /** * Function GetLayerType diff --git a/pcbnew/pcb_parser.cpp b/pcbnew/pcb_parser.cpp index a4c8785f3e..b08e4527f6 100644 --- a/pcbnew/pcb_parser.cpp +++ b/pcbnew/pcb_parser.cpp @@ -800,7 +800,7 @@ void PCB_PARSER::parseLayers() throw( IO_ERROR, PARSE_ERROR ) if( it->m_visible ) visibleLayers.set( it->m_number ); - m_board->SetLayer( LAYER_ID( it->m_number ), *it ); + m_board->SetLayerDescr( LAYER_ID( it->m_number ), *it ); UTF8 name = it->m_name; @@ -838,7 +838,7 @@ void PCB_PARSER::parseLayers() throw( IO_ERROR, PARSE_ERROR ) // DBG( printf( "aux m_visible:%s\n", layer.m_visible ? "true" : "false" );) - m_board->SetLayer( it->second, layer ); + m_board->SetLayerDescr( it->second, layer ); token = NextTok(); From 789bb9663ca452d87a0d4dcfd64a9b977216a14d Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Thu, 29 Jan 2015 18:23:54 +0100 Subject: [PATCH 18/29] bugfix: Find does not work in high contrast mode in GAL. --- pcbnew/tools/selection_tool.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pcbnew/tools/selection_tool.cpp b/pcbnew/tools/selection_tool.cpp index df5709aae5..85ec289e80 100644 --- a/pcbnew/tools/selection_tool.cpp +++ b/pcbnew/tools/selection_tool.cpp @@ -516,7 +516,14 @@ void SELECTION_TOOL::findCallback( BOARD_ITEM* aItem ) clearSelection(); if( aItem ) - toggleSelection( aItem ); + { + clearSelection(); + select( aItem ); + + // Inform other potentially interested tools + TOOL_EVENT selectEvent( SelectedEvent ); + m_toolMgr->ProcessEvent( selectEvent ); + } m_frame->GetGalCanvas()->ForceRefresh(); } From 8412f2ad4e567228b9e69eaaf900e76e9726df75 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Fri, 30 Jan 2015 19:42:46 +0100 Subject: [PATCH 19/29] ModEdit: add a settings menu option(and the corresponding dialog) to set default values used when creating a footprint or add graphic items to a footprint being edited. These settings are now not common to the board editor, because the footprint editor can be run outside the board editor. download_boost.cmake: ignore .htm* files when installing boost. They are not used, and often have a very very long (and stupid) name which sometimes creates issues. --- CMakeModules/download_boost.cmake | 4 + include/class_board_design_settings.h | 90 +- pcbnew/CMakeLists.txt | 2 + pcbnew/class_board_design_settings.cpp | 24 +- pcbnew/dialogs/dialog_modedit_options.cpp | 133 + .../dialogs/dialog_modedit_options_base.cpp | 197 ++ .../dialogs/dialog_modedit_options_base.fbp | 2643 +++++++++++++++++ pcbnew/dialogs/dialog_modedit_options_base.h | 86 + pcbnew/invoke_pcb_dialog.h | 10 +- pcbnew/librairi.cpp | 23 +- pcbnew/menubar_modedit.cpp | 40 +- pcbnew/modeditoptions.cpp | 75 +- pcbnew/module_editor_frame.h | 22 + pcbnew/moduleframe.cpp | 194 +- 14 files changed, 3471 insertions(+), 72 deletions(-) create mode 100644 pcbnew/dialogs/dialog_modedit_options.cpp create mode 100644 pcbnew/dialogs/dialog_modedit_options_base.cpp create mode 100644 pcbnew/dialogs/dialog_modedit_options_base.fbp create mode 100644 pcbnew/dialogs/dialog_modedit_options_base.h diff --git a/CMakeModules/download_boost.cmake b/CMakeModules/download_boost.cmake index afb7320749..c29888c44d 100644 --- a/CMakeModules/download_boost.cmake +++ b/CMakeModules/download_boost.cmake @@ -311,6 +311,10 @@ ExternalProject_Add_Step( boost bzr_add_boost ExternalProject_Add_Step( boost bzr_init_boost COMMAND bzr init -q + #creates a .bzrignore file in boost root dir, to avoid copying useless files + #moreover these files have a very very long name, and sometimes + #have a too long full file name to be handled by DOS commands + COMMAND echo "*.htm*" > ${PREFIX}/src/boost/.bzrignore COMMENT "creating 'boost scratch repo' specifically for boost to track boost patches" DEPENDERS bzr_add_boost DEPENDEES download diff --git a/include/class_board_design_settings.h b/include/class_board_design_settings.h index 888cba99de..81acc694e5 100644 --- a/include/class_board_design_settings.h +++ b/include/class_board_design_settings.h @@ -1,8 +1,8 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2009-2014 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 1992-2014 KiCad Developers, see CHANGELOG.TXT for contributors. + * Copyright (C) 2009-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 1992-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 @@ -111,15 +111,64 @@ public: double m_SolderPasteMarginRatio; ///< Solder pask margin ratio value of pad size ///< The final margin is the sum of these 2 values - // Variables used in footprint handling + // Variables used in footprint edition (default value in item/footprint creation) + int m_ModuleSegmentWidth; ///< Default width for all graphic lines + // Note: the default layer is the active layer wxSize m_ModuleTextSize; ///< Default footprint texts size - int m_ModuleTextWidth; - int m_ModuleSegmentWidth; + int m_ModuleTextWidth; ///< Default footprint texts thickness + + wxString m_RefDefaultText; ///< Default ref text on fp creation + // if empty, use footprint name as default + bool m_RefDefaultVisibility; ///< Default ref text visibility on fp creation + int m_RefDefaultlayer; ///< Default ref text layer on fp creation + // should be a LAYER_ID, but use an int + // to save this param in config + + wxString m_ValueDefaultText; ///< Default value text on fp creation + // if empty, use footprint name as default + bool m_ValueDefaultVisibility; ///< Default value text visibility on fp creation + int m_ValueDefaultlayer; ///< Default value text layer on fp creation + // should be a LAYER_ID, but use an int + // to save this param in config + + // Miscellaneous wxPoint m_AuxOrigin; ///< origin for plot exports wxPoint m_GridOrigin; ///< origin for grid offsets - D_PAD m_Pad_Master; + D_PAD m_Pad_Master; ///< A dummy pad to store all default parameters + // when importing values or create a new pad +private: + /// Index for #m_ViasDimensionsList to select the current via size. + /// 0 is the index selection of the default value Netclass + unsigned m_viaSizeIndex; + + // Index for m_TrackWidthList to select the value. + /// 0 is the index selection of the default value Netclass + unsigned m_trackWidthIndex; + + ///> Use custom values for track/via sizes (not specified in net class nor in the size lists). + bool m_useCustomTrackVia; + + ///> Custom track width (used after UseCustomTrackViaSize( true ) was called). + int m_customTrackWidth; + + ///> Custom via size (used after UseCustomTrackViaSize( true ) was called). + VIA_DIMENSION m_customViaSize; + + int m_copperLayerCount; ///< Number of copper layers for this design + + LSET m_enabledLayers; ///< Bit-mask for layer enabling + LSET m_visibleLayers; ///< Bit-mask for layer visibility + + int m_visibleElements; ///< Bit-mask for element category visibility + int m_boardThickness; ///< Board thickness for 3D viewer + + /// Current net class name used to display netclass info. + /// This is also the last used netclass after starting a track. + wxString m_currentNetClassName; + +public: BOARD_DESIGN_SETTINGS(); /** @@ -489,35 +538,6 @@ public: inline void SetBoardThickness( int aThickness ) { m_boardThickness = aThickness; } private: - /// Index for #m_ViasDimensionsList to select the current via size. - /// 0 is the index selection of the default value Netclass - unsigned m_viaSizeIndex; - - // Index for m_TrackWidthList to select the value. - /// 0 is the index selection of the default value Netclass - unsigned m_trackWidthIndex; - - ///> Use custom values for track/via sizes (not specified in net class nor in the size lists). - bool m_useCustomTrackVia; - - ///> Custom track width (used after UseCustomTrackViaSize( true ) was called). - int m_customTrackWidth; - - ///> Custom via size (used after UseCustomTrackViaSize( true ) was called). - VIA_DIMENSION m_customViaSize; - - int m_copperLayerCount; ///< Number of copper layers for this design - - LSET m_enabledLayers; ///< Bit-mask for layer enabling - LSET m_visibleLayers; ///< Bit-mask for layer visibility - - int m_visibleElements; ///< Bit-mask for element category visibility - int m_boardThickness; ///< Board thickness for 3D viewer - - /// Current net class name used to display netclass info. - /// This is also the last used netclass after starting a track. - wxString m_currentNetClassName; - void formatNetClass( NETCLASS* aNetClass, OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const throw( IO_ERROR ); }; diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt index 351f5cc845..0e916943cf 100644 --- a/pcbnew/CMakeLists.txt +++ b/pcbnew/CMakeLists.txt @@ -96,6 +96,8 @@ set( PCBNEW_DIALOGS dialogs/dialog_layer_selection_base.cpp dialogs/dialog_layers_setup.cpp dialogs/dialog_layers_setup_base.cpp + dialogs/dialog_modedit_options.cpp + dialogs/dialog_modedit_options_base.cpp dialogs/dialog_netlist.cpp dialogs/dialog_netlist_fbp.cpp dialogs/dialog_pcb_text_properties.cpp diff --git a/pcbnew/class_board_design_settings.cpp b/pcbnew/class_board_design_settings.cpp index 844eb4211f..de8a318421 100644 --- a/pcbnew/class_board_design_settings.cpp +++ b/pcbnew/class_board_design_settings.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -96,16 +96,28 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() : // The final margin is the sum of these 2 values // Usually < 0 because the mask is smaller than pad - m_ModuleTextSize = wxSize( DEFAULT_TEXT_MODULE_SIZE, - DEFAULT_TEXT_MODULE_SIZE ); - m_ModuleTextWidth = DEFAULT_GR_MODULE_THICKNESS; - m_ModuleSegmentWidth = DEFAULT_GR_MODULE_THICKNESS; - // Layer thickness for 3D viewer m_boardThickness = Millimeter2iu( DEFAULT_BOARD_THICKNESS_MM ); m_viaSizeIndex = 0; m_trackWidthIndex = 0; + + // Default values for the footprint editor and fp creation + // (also covers footprints created on the fly by micor-waves tools) + m_ModuleTextSize = wxSize( DEFAULT_TEXT_MODULE_SIZE, + DEFAULT_TEXT_MODULE_SIZE ); + m_ModuleTextWidth = DEFAULT_GR_MODULE_THICKNESS; + m_ModuleSegmentWidth = DEFAULT_GR_MODULE_THICKNESS; + + // These values will be overriden by config values after reading the config + // Default ref text on fp creation. if empty, use footprint name as default + m_RefDefaultText = wxT( "REF**" ); + m_RefDefaultVisibility = true; // Default ref text visibility on fp creation + m_RefDefaultlayer = int( F_SilkS ); // Default ref text layer on fp creation + // Default value text on fp creation. if empty, use footprint name as default + m_ValueDefaultText = wxEmptyString; + m_ValueDefaultVisibility = true; + m_ValueDefaultlayer = int( F_Fab ); } // Add parameters to save in project config. diff --git a/pcbnew/dialogs/dialog_modedit_options.cpp b/pcbnew/dialogs/dialog_modedit_options.cpp new file mode 100644 index 0000000000..438cbae522 --- /dev/null +++ b/pcbnew/dialogs/dialog_modedit_options.cpp @@ -0,0 +1,133 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ +/** + * @file dialog_modedit_options.cpp + */ + +#include +#include +#include +#include +#include + +#include +//#include + +#include +class DIALOG_MODEDIT_OPTIONS : public DIALOG_MODEDIT_OPTIONS_BASE +{ + BOARD_DESIGN_SETTINGS m_brdSettings; + FOOTPRINT_EDIT_FRAME * m_parent; + +public: + DIALOG_MODEDIT_OPTIONS( FOOTPRINT_EDIT_FRAME* aParent ); + +private: + void OnCancelClick( wxCommandEvent& event ) { EndModal( wxID_CANCEL ); } + void OnOkClick( wxCommandEvent& event ); + + void initValues( ); +}; + + +DIALOG_MODEDIT_OPTIONS::DIALOG_MODEDIT_OPTIONS( FOOTPRINT_EDIT_FRAME* aParent ) : + DIALOG_MODEDIT_OPTIONS_BASE( aParent ) +{ + m_parent = aParent; + m_brdSettings = m_parent->GetDesignSettings(); + initValues( ); + + GetSizer()->SetSizeHints( this ); + + Centre(); +} + + +bool InvokeFPEditorPrefsDlg( FOOTPRINT_EDIT_FRAME* aCaller ) +{ + DIALOG_MODEDIT_OPTIONS dlg( aCaller ); + + int ret = dlg.ShowModal(); + + return ret == wxID_OK; +} + + +void DIALOG_MODEDIT_OPTIONS::initValues() +{ + EDA_UNITS_T units = g_UserUnit; + + // Modules: graphic lines width: + m_staticTextGrLineUnit->SetLabel( GetAbbreviatedUnitsLabel( units ) ); + PutValueInLocalUnits( *m_OptModuleGrLineWidth, m_brdSettings.m_ModuleSegmentWidth ); + + // Modules: Texts: Size & width: + m_staticTextTextWidthUnit->SetLabel( GetAbbreviatedUnitsLabel( units ) ); + PutValueInLocalUnits( *m_OptModuleTextWidth, m_brdSettings.m_ModuleTextWidth ); + + m_staticTextTextVSizeUnit->SetLabel( GetAbbreviatedUnitsLabel( units ) ); + PutValueInLocalUnits( *m_OptModuleTextVSize, m_brdSettings.m_ModuleTextSize.y ); + + m_staticTextTextHSizeUnit->SetLabel( GetAbbreviatedUnitsLabel( units ) ); + PutValueInLocalUnits( *m_OptModuleTextHSize, m_brdSettings.m_ModuleTextSize.x ); + + // Ref: default values + m_textCtrlRefText->SetValue( m_brdSettings.m_RefDefaultText ); + int sel = m_brdSettings.m_RefDefaultlayer == F_SilkS ? 0 : 1; + m_choiceLayerReference->SetSelection( sel ); + sel = m_brdSettings.m_RefDefaultVisibility ? 0 : 1; + m_choiceVisibleReference->SetSelection( sel ); + + // Value: default values + m_textCtrlValueText->SetValue( m_brdSettings.m_ValueDefaultText ); + sel = m_brdSettings.m_ValueDefaultlayer == F_SilkS ? 0 : 1; + m_choiceLayerValue->SetSelection( sel ); + sel = m_brdSettings.m_ValueDefaultVisibility ? 0 : 1; + m_choiceVisibleValue->SetSelection( sel ); +} + +void DIALOG_MODEDIT_OPTIONS::OnOkClick( wxCommandEvent& event ) +{ + m_brdSettings.m_ModuleSegmentWidth = ValueFromTextCtrl( *m_OptModuleGrLineWidth ); + m_brdSettings.m_ModuleTextWidth = ValueFromTextCtrl( *m_OptModuleTextWidth ); + m_brdSettings.m_ModuleTextSize.y = ValueFromTextCtrl( *m_OptModuleTextVSize ); + m_brdSettings.m_ModuleTextSize.x = ValueFromTextCtrl( *m_OptModuleTextHSize ); + + // Ref: default values + m_brdSettings.m_RefDefaultText = m_textCtrlRefText->GetValue(); + int sel = m_choiceLayerReference->GetSelection(); + m_brdSettings.m_RefDefaultlayer = sel == 1 ? F_Fab : F_SilkS; + sel = m_choiceVisibleReference->GetSelection(); + m_brdSettings.m_RefDefaultVisibility = sel != 1; + + // Value: default values + m_brdSettings.m_ValueDefaultText = m_textCtrlValueText->GetValue(); + sel = m_choiceLayerValue->GetSelection(); + m_brdSettings.m_ValueDefaultlayer = sel == 1 ? F_Fab : F_SilkS; + sel = m_choiceVisibleValue->GetSelection(); + m_brdSettings.m_ValueDefaultVisibility = sel != 1; + + m_parent->SetDesignSettings( m_brdSettings ); + + EndModal( wxID_OK ); +} diff --git a/pcbnew/dialogs/dialog_modedit_options_base.cpp b/pcbnew/dialogs/dialog_modedit_options_base.cpp new file mode 100644 index 0000000000..d0769d2311 --- /dev/null +++ b/pcbnew/dialogs/dialog_modedit_options_base.cpp @@ -0,0 +1,197 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Jun 5 2014) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "dialog_modedit_options_base.h" + +/////////////////////////////////////////////////////////////////////////// + +DIALOG_MODEDIT_OPTIONS_BASE::DIALOG_MODEDIT_OPTIONS_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style ) +{ + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + wxBoxSizer* bSizerMain; + bSizerMain = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizerUpper; + bSizerUpper = new wxBoxSizer( wxVERTICAL ); + + m_staticText281 = new wxStaticText( this, wxID_ANY, _("On new graphic item creation:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText281->Wrap( -1 ); + m_staticText281->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) ); + + bSizerUpper->Add( m_staticText281, 0, wxALL, 5 ); + + wxFlexGridSizer* fgSizer1; + fgSizer1 = new wxFlexGridSizer( 0, 3, 0, 0 ); + fgSizer1->AddGrowableCol( 1 ); + fgSizer1->SetFlexibleDirection( wxBOTH ); + fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + m_EdgeModEWidthTitle = new wxStaticText( this, wxID_ANY, _("Graphic line width"), wxDefaultPosition, wxDefaultSize, 0 ); + m_EdgeModEWidthTitle->Wrap( -1 ); + fgSizer1->Add( m_EdgeModEWidthTitle, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_OptModuleGrLineWidth = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_OptModuleGrLineWidth->SetMaxLength( 0 ); + fgSizer1->Add( m_OptModuleGrLineWidth, 0, wxEXPAND|wxALL, 5 ); + + m_staticTextGrLineUnit = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextGrLineUnit->Wrap( -1 ); + fgSizer1->Add( m_staticTextGrLineUnit, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_TextModWidthTitle = new wxStaticText( this, wxID_ANY, _("Text width"), wxDefaultPosition, wxDefaultSize, 0 ); + m_TextModWidthTitle->Wrap( -1 ); + fgSizer1->Add( m_TextModWidthTitle, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_OptModuleTextWidth = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_OptModuleTextWidth->SetMaxLength( 0 ); + fgSizer1->Add( m_OptModuleTextWidth, 0, wxEXPAND|wxALL, 5 ); + + m_staticTextTextWidthUnit = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextTextWidthUnit->Wrap( -1 ); + fgSizer1->Add( m_staticTextTextWidthUnit, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_TextModSizeVTitle = new wxStaticText( this, wxID_ANY, _("Text size V"), wxDefaultPosition, wxDefaultSize, 0 ); + m_TextModSizeVTitle->Wrap( -1 ); + fgSizer1->Add( m_TextModSizeVTitle, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_OptModuleTextVSize = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_OptModuleTextVSize->SetMaxLength( 0 ); + fgSizer1->Add( m_OptModuleTextVSize, 0, wxEXPAND|wxALL, 5 ); + + m_staticTextTextVSizeUnit = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextTextVSizeUnit->Wrap( -1 ); + fgSizer1->Add( m_staticTextTextVSizeUnit, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_TextModSizeHTitle = new wxStaticText( this, wxID_ANY, _("Text size H"), wxDefaultPosition, wxDefaultSize, 0 ); + m_TextModSizeHTitle->Wrap( -1 ); + fgSizer1->Add( m_TextModSizeHTitle, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + m_OptModuleTextHSize = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_OptModuleTextHSize->SetMaxLength( 0 ); + fgSizer1->Add( m_OptModuleTextHSize, 0, wxEXPAND|wxALL, 5 ); + + m_staticTextTextHSizeUnit = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextTextHSizeUnit->Wrap( -1 ); + fgSizer1->Add( m_staticTextTextHSizeUnit, 0, wxALL, 5 ); + + + bSizerUpper->Add( fgSizer1, 1, wxEXPAND|wxLEFT, 20 ); + + m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bSizerUpper->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 ); + + m_staticText28 = new wxStaticText( this, wxID_ANY, _("Default values on new footprint creation:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText28->Wrap( -1 ); + m_staticText28->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) ); + + bSizerUpper->Add( m_staticText28, 0, wxALL, 5 ); + + m_staticTextInfo = new wxStaticText( this, wxID_ANY, _("Leave ref or value blank to use the footprint name as default text"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextInfo->Wrap( -1 ); + bSizerUpper->Add( m_staticTextInfo, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + wxFlexGridSizer* fgSizer2; + fgSizer2 = new wxFlexGridSizer( 0, 6, 0, 0 ); + fgSizer2->AddGrowableCol( 1 ); + fgSizer2->AddGrowableCol( 3 ); + fgSizer2->AddGrowableCol( 5 ); + fgSizer2->SetFlexibleDirection( wxBOTH ); + fgSizer2->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + m_staticTextRef = new wxStaticText( this, wxID_ANY, _("Ref"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextRef->Wrap( -1 ); + fgSizer2->Add( m_staticTextRef, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 ); + + m_textCtrlRefText = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_textCtrlRefText->SetToolTip( _("Default text for reference\nLeave blank to use the footprint name") ); + + fgSizer2->Add( m_textCtrlRefText, 0, wxALL|wxEXPAND, 5 ); + + m_staticTextRefLayer = new wxStaticText( this, wxID_ANY, _("Layer"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextRefLayer->Wrap( -1 ); + fgSizer2->Add( m_staticTextRefLayer, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 ); + + wxString m_choiceLayerReferenceChoices[] = { _("SilkScreen"), _("Fab. Layer") }; + int m_choiceLayerReferenceNChoices = sizeof( m_choiceLayerReferenceChoices ) / sizeof( wxString ); + m_choiceLayerReference = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceLayerReferenceNChoices, m_choiceLayerReferenceChoices, 0 ); + m_choiceLayerReference->SetSelection( 0 ); + fgSizer2->Add( m_choiceLayerReference, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + + m_staticText32 = new wxStaticText( this, wxID_ANY, _("Visibility"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText32->Wrap( -1 ); + fgSizer2->Add( m_staticText32, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 ); + + wxString m_choiceVisibleReferenceChoices[] = { _("Visible"), _("Invisible") }; + int m_choiceVisibleReferenceNChoices = sizeof( m_choiceVisibleReferenceChoices ) / sizeof( wxString ); + m_choiceVisibleReference = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceVisibleReferenceNChoices, m_choiceVisibleReferenceChoices, 0 ); + m_choiceVisibleReference->SetSelection( 0 ); + fgSizer2->Add( m_choiceVisibleReference, 0, wxALL|wxEXPAND, 5 ); + + m_staticTextValue = new wxStaticText( this, wxID_ANY, _("Value"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextValue->Wrap( -1 ); + fgSizer2->Add( m_staticTextValue, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 ); + + m_textCtrlValueText = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_textCtrlValueText->SetToolTip( _("Default text for value\nLeave blank to use the footprint name") ); + + fgSizer2->Add( m_textCtrlValueText, 0, wxALL|wxEXPAND, 5 ); + + m_staticTextValLayer = new wxStaticText( this, wxID_ANY, _("Layer"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextValLayer->Wrap( -1 ); + fgSizer2->Add( m_staticTextValLayer, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 ); + + wxString m_choiceLayerValueChoices[] = { _("SilkScreen"), _("Fab. Layer") }; + int m_choiceLayerValueNChoices = sizeof( m_choiceLayerValueChoices ) / sizeof( wxString ); + m_choiceLayerValue = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceLayerValueNChoices, m_choiceLayerValueChoices, 0 ); + m_choiceLayerValue->SetSelection( 1 ); + fgSizer2->Add( m_choiceLayerValue, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + + m_staticTextValVisibility = new wxStaticText( this, wxID_ANY, _("Visibility"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextValVisibility->Wrap( -1 ); + fgSizer2->Add( m_staticTextValVisibility, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 ); + + wxString m_choiceVisibleValueChoices[] = { _("Visible"), _("Invisible") }; + int m_choiceVisibleValueNChoices = sizeof( m_choiceVisibleValueChoices ) / sizeof( wxString ); + m_choiceVisibleValue = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceVisibleValueNChoices, m_choiceVisibleValueChoices, 0 ); + m_choiceVisibleValue->SetSelection( 0 ); + fgSizer2->Add( m_choiceVisibleValue, 0, wxALL|wxEXPAND, 5 ); + + + bSizerUpper->Add( fgSizer2, 0, wxEXPAND|wxLEFT, 20 ); + + m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bSizerUpper->Add( m_staticline2, 0, wxEXPAND | wxALL, 5 ); + + + bSizerMain->Add( bSizerUpper, 1, wxEXPAND, 5 ); + + m_sdbSizer1 = new wxStdDialogButtonSizer(); + m_sdbSizer1OK = new wxButton( this, wxID_OK ); + m_sdbSizer1->AddButton( m_sdbSizer1OK ); + m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL ); + m_sdbSizer1->AddButton( m_sdbSizer1Cancel ); + m_sdbSizer1->Realize(); + + bSizerMain->Add( m_sdbSizer1, 0, wxALIGN_RIGHT|wxEXPAND|wxTOP|wxBOTTOM, 5 ); + + + this->SetSizer( bSizerMain ); + this->Layout(); + + // Connect Events + m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODEDIT_OPTIONS_BASE::OnCancelClick ), NULL, this ); + m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODEDIT_OPTIONS_BASE::OnOkClick ), NULL, this ); +} + +DIALOG_MODEDIT_OPTIONS_BASE::~DIALOG_MODEDIT_OPTIONS_BASE() +{ + // Disconnect Events + m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODEDIT_OPTIONS_BASE::OnCancelClick ), NULL, this ); + m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODEDIT_OPTIONS_BASE::OnOkClick ), NULL, this ); + +} diff --git a/pcbnew/dialogs/dialog_modedit_options_base.fbp b/pcbnew/dialogs/dialog_modedit_options_base.fbp new file mode 100644 index 0000000000..b5dc8fc06e --- /dev/null +++ b/pcbnew/dialogs/dialog_modedit_options_base.fbp @@ -0,0 +1,2643 @@ + + + + + + C++ + 1 + source_name + 0 + 0 + res + UTF-8 + connect + dialog_modedit_options_base + 1000 + none + 1 + dialog_graphic_items_options + + . + + 1 + 1 + 1 + 1 + UI + 0 + 0 + + 0 + wxAUI_MGR_DEFAULT + + + + 1 + 1 + impl_virtual + + + + 0 + wxID_ANY + + + DIALOG_MODEDIT_OPTIONS_BASE + + 502,352 + wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER + DIALOG_SHIM; dialog_shim.h + Footprint Editor Options + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bSizerMain + wxVERTICAL + none + + 5 + wxEXPAND + 1 + + + bSizerUpper + wxVERTICAL + none + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + ,90,92,-1,70,0 + 0 + 0 + wxID_ANY + On new graphic item creation: + + 0 + + + 0 + + 1 + m_staticText281 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 20 + wxEXPAND|wxLEFT + 1 + + 3 + wxBOTH + 1 + + 0 + + fgSizer1 + wxFLEX_GROWMODE_SPECIFIED + none + 0 + 0 + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Graphic line width + + 0 + + + 0 + + 1 + m_EdgeModEWidthTitle + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + m_OptModuleGrLineWidth + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + unit + + 0 + + + 0 + + 1 + m_staticTextGrLineUnit + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Text width + + 0 + + + 0 + + 1 + m_TextModWidthTitle + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + m_OptModuleTextWidth + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + unit + + 0 + + + 0 + + 1 + m_staticTextTextWidthUnit + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Text size V + + 0 + + + 0 + + 1 + m_TextModSizeVTitle + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + m_OptModuleTextVSize + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + unit + + 0 + + + 0 + + 1 + m_staticTextTextVSizeUnit + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Text size H + + 0 + + + 0 + + 1 + m_TextModSizeHTitle + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + m_OptModuleTextHSize + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + unit + + 0 + + + 0 + + 1 + m_staticTextTextHSizeUnit + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND | wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_staticline1 + 1 + + + protected + 1 + + Resizable + 1 + + wxLI_HORIZONTAL + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + ,90,92,-1,70,0 + 0 + 0 + wxID_ANY + Default values on new footprint creation: + + 0 + + + 0 + + 1 + m_staticText28 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_HORIZONTAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Leave ref or value blank to use the footprint name as default text + + 0 + + + 0 + + 1 + m_staticTextInfo + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 20 + wxEXPAND|wxLEFT + 0 + + 6 + wxBOTH + 1,3,5 + + 0 + + fgSizer2 + wxFLEX_GROWMODE_SPECIFIED + none + 0 + 0 + + 5 + wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Ref + + 0 + + + 0 + + 1 + m_staticTextRef + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + + 0 + + 1 + m_textCtrlRefText + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Default text for reference Leave blank to use the footprint name + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Layer + + 0 + + + 0 + + 1 + m_staticTextRefLayer + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "SilkScreen" "Fab. Layer" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_choiceLayerReference + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Visibility + + 0 + + + 0 + + 1 + m_staticText32 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "Visible" "Invisible" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_choiceVisibleReference + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Value + + 0 + + + 0 + + 1 + m_staticTextValue + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + + 0 + + 1 + m_textCtrlValueText + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Default text for value Leave blank to use the footprint name + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Layer + + 0 + + + 0 + + 1 + m_staticTextValLayer + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "SilkScreen" "Fab. Layer" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_choiceLayerValue + 1 + + + protected + 1 + + Resizable + 1 + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Visibility + + 0 + + + 0 + + 1 + m_staticTextValVisibility + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "Visible" "Invisible" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_choiceVisibleValue + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND | wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_staticline2 + 1 + + + protected + 1 + + Resizable + 1 + + wxLI_HORIZONTAL + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_RIGHT|wxEXPAND|wxTOP|wxBOTTOM + 0 + + 0 + 1 + 0 + 0 + 0 + 1 + 0 + 0 + + m_sdbSizer1 + protected + + OnCancelClick + + + + OnOkClick + + + + + + + + diff --git a/pcbnew/dialogs/dialog_modedit_options_base.h b/pcbnew/dialogs/dialog_modedit_options_base.h new file mode 100644 index 0000000000..b11c2398be --- /dev/null +++ b/pcbnew/dialogs/dialog_modedit_options_base.h @@ -0,0 +1,86 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Jun 5 2014) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#ifndef __DIALOG_MODEDIT_OPTIONS_BASE_H__ +#define __DIALOG_MODEDIT_OPTIONS_BASE_H__ + +#include +#include +#include +class DIALOG_SHIM; + +#include "dialog_shim.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////////////// +/// Class DIALOG_MODEDIT_OPTIONS_BASE +/////////////////////////////////////////////////////////////////////////////// +class DIALOG_MODEDIT_OPTIONS_BASE : public DIALOG_SHIM +{ + private: + + protected: + wxStaticText* m_staticText281; + wxStaticText* m_EdgeModEWidthTitle; + wxTextCtrl* m_OptModuleGrLineWidth; + wxStaticText* m_staticTextGrLineUnit; + wxStaticText* m_TextModWidthTitle; + wxTextCtrl* m_OptModuleTextWidth; + wxStaticText* m_staticTextTextWidthUnit; + wxStaticText* m_TextModSizeVTitle; + wxTextCtrl* m_OptModuleTextVSize; + wxStaticText* m_staticTextTextVSizeUnit; + wxStaticText* m_TextModSizeHTitle; + wxTextCtrl* m_OptModuleTextHSize; + wxStaticText* m_staticTextTextHSizeUnit; + wxStaticLine* m_staticline1; + wxStaticText* m_staticText28; + wxStaticText* m_staticTextInfo; + wxStaticText* m_staticTextRef; + wxTextCtrl* m_textCtrlRefText; + wxStaticText* m_staticTextRefLayer; + wxChoice* m_choiceLayerReference; + wxStaticText* m_staticText32; + wxChoice* m_choiceVisibleReference; + wxStaticText* m_staticTextValue; + wxTextCtrl* m_textCtrlValueText; + wxStaticText* m_staticTextValLayer; + wxChoice* m_choiceLayerValue; + wxStaticText* m_staticTextValVisibility; + wxChoice* m_choiceVisibleValue; + wxStaticLine* m_staticline2; + wxStdDialogButtonSizer* m_sdbSizer1; + wxButton* m_sdbSizer1OK; + wxButton* m_sdbSizer1Cancel; + + // Virtual event handlers, overide them in your derived class + virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); } + virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); } + + + public: + + DIALOG_MODEDIT_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Footprint Editor Options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 502,352 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + ~DIALOG_MODEDIT_OPTIONS_BASE(); + +}; + +#endif //__DIALOG_MODEDIT_OPTIONS_BASE_H__ diff --git a/pcbnew/invoke_pcb_dialog.h b/pcbnew/invoke_pcb_dialog.h index 89d5bb5ef4..df9ceaf2d0 100644 --- a/pcbnew/invoke_pcb_dialog.h +++ b/pcbnew/invoke_pcb_dialog.h @@ -46,7 +46,6 @@ class wxTopLevelWindow; class wxPoint; class wxSize; -//class wxRealPoint; class wxString; class BOARD; @@ -55,6 +54,7 @@ class MODULE; // Often this is not used in the prototypes, since wxFrame is good enough and would // represent maximum information hiding. class PCB_BASE_FRAME; +class FOOTPRINT_EDIT_FRAME; class FP_LIB_TABLE; class BOARD; class PCB_PLOT_PARAMS; @@ -124,4 +124,12 @@ bool InvokeLayerSetup( wxTopLevelWindow* aCaller, BOARD* aBoard ); */ bool InvokeSVGPrint( wxTopLevelWindow* aCaller, BOARD* aBoard, PCB_PLOT_PARAMS* aSettings ); +/** + * Function InvokeSVGPrint + * shows the SVG print dialog + * @param aCaller is the FOOTPRINT_EDIT_FRAME which is invoking the dialog. + * @return bool - true if user pressed OK (did not abort), else false. + */ +bool InvokeFPEditorPrefsDlg( FOOTPRINT_EDIT_FRAME* aCaller ); + #endif // INVOKE_A_DIALOG_H_ diff --git a/pcbnew/librairi.cpp b/pcbnew/librairi.cpp index 05d33a7d07..fe6963a717 100644 --- a/pcbnew/librairi.cpp +++ b/pcbnew/librairi.cpp @@ -750,22 +750,33 @@ MODULE* PCB_BASE_FRAME::CreateNewModule( const wxString& aModuleName ) module->SetFPID( FPID( moduleName ) ); wxPoint default_pos; + BOARD_DESIGN_SETTINGS& settings = GetDesignSettings(); // Update reference: - module->SetReference( wxT( "REF**" ) ); - module->Reference().SetThickness( GetDesignSettings().m_ModuleTextWidth ); - module->Reference().SetSize( GetDesignSettings().m_ModuleTextSize ); + if( settings.m_RefDefaultText.IsEmpty() ) + module->SetReference( moduleName ); + else + module->SetReference( settings.m_RefDefaultText ); + + module->Reference().SetThickness( settings.m_ModuleTextWidth ); + module->Reference().SetSize( settings.m_ModuleTextSize ); default_pos.y = GetDesignSettings().m_ModuleTextSize.y / 2; module->Reference().SetPosition( default_pos ); - module->Reference().SetLayer( F_SilkS ); + module->Reference().SetLayer( ToLAYER_ID( settings.m_RefDefaultlayer ) ); + module->Reference().SetVisible( settings.m_RefDefaultVisibility ); // Set the value field to a default value - module->SetValue( moduleName ); + if( settings.m_ValueDefaultText.IsEmpty() ) + module->SetValue( moduleName ); + else + module->SetValue( settings.m_ValueDefaultText ); + module->Value().SetThickness( GetDesignSettings().m_ModuleTextWidth ); module->Value().SetSize( GetDesignSettings().m_ModuleTextSize ); default_pos.y = -default_pos.y; module->Value().SetPosition( default_pos ); - module->Value().SetLayer( F_Fab ); + module->Value().SetLayer( ToLAYER_ID( settings.m_ValueDefaultlayer ) ); + module->Value().SetVisible( settings.m_ValueDefaultVisibility ); SetMsgPanel( module ); return module; diff --git a/pcbnew/menubar_modedit.cpp b/pcbnew/menubar_modedit.cpp index ca6935ef58..ee4146a1ef 100644 --- a/pcbnew/menubar_modedit.cpp +++ b/pcbnew/menubar_modedit.cpp @@ -2,10 +2,10 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr - * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck - * Copyright (C) 2012 Wayne Stambaugh - * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 2015 SoftPLC Corporation, Dick Hollenbeck + * Copyright (C) 2015 Wayne Stambaugh + * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -30,6 +30,7 @@ * @brief (Re)Create the main menubar for the module editor */ #include +#include #include #include @@ -150,7 +151,7 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar() _( "Close footprint editor" ), KiBitmap( exit_xpm ) ); - // Menu Edit: + //----- Edit menu ------------------ wxMenu* editMenu = new wxMenu; // Undo @@ -198,7 +199,7 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar() _( "&User Grid Size" ), _( "Adjust user grid" ), KiBitmap( grid_xpm ) ); - // View menu + //--------- View menu ---------------- wxMenu* viewMenu = new wxMenu; /* Important Note for ZOOM IN and ZOOM OUT commands from menubar: @@ -237,7 +238,7 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar() _( "Show board in 3D viewer" ), KiBitmap( three_d_xpm ) ); - // Menu Place: + //-------- Place menu -------------------- wxMenu* placeMenu = new wxMenu; // Pad @@ -276,7 +277,26 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar() _( "Place footprint reference anchor" ), KiBitmap( anchor_xpm ) ); - // Menu Help: + + //----- Preferences menu ----------------- + wxMenu* prefs_menu = new wxMenu; + + AddMenuItem( prefs_menu, ID_PCB_LIB_TABLE_EDIT, + _( "Li&brary Tables" ), _( "Setup footprint libraries" ), + KiBitmap( library_table_xpm ) ); + + // Settings + AddMenuItem( prefs_menu, wxID_PREFERENCES, + _( "&Settings" ), _( "Select default parameters values in Footprint Editor" ), + KiBitmap( preference_xpm ) ); + + // Language submenu + Pgm().AddMenuLanguageList( prefs_menu ); + + // Hotkey submenu + AddHotkeyConfigMenu( prefs_menu ); + + //----- Help menu -------------------- wxMenu* helpMenu = new wxMenu; // Version info @@ -303,10 +323,10 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar() // Append menus to the menubar menuBar->Append( fileMenu, _( "&File" ) ); menuBar->Append( editMenu, _( "&Edit" ) ); - menuBar->Append( dimensions_Submenu, _( "Di&mensions" ) ); - menuBar->Append( viewMenu, _( "&View" ) ); menuBar->Append( placeMenu, _( "&Place" ) ); + menuBar->Append( prefs_menu, _( "P&references" ) ); + menuBar->Append( dimensions_Submenu, _( "Di&mensions" ) ); menuBar->Append( helpMenu, _( "&Help" ) ); menuBar->Thaw(); diff --git a/pcbnew/modeditoptions.cpp b/pcbnew/modeditoptions.cpp index 2134d2a304..f4e776afcc 100644 --- a/pcbnew/modeditoptions.cpp +++ b/pcbnew/modeditoptions.cpp @@ -3,8 +3,8 @@ * * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck - * Copyright (C) 2012 Wayne Stambaugh - * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2015 Wayne Stambaugh + * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -36,6 +36,7 @@ #include #include #include +#include #include @@ -78,3 +79,73 @@ void FOOTPRINT_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event ) break; } } + + +PARAM_CFG_ARRAY& FOOTPRINT_EDIT_FRAME::GetConfigurationSettings() +{ + DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions(); + BOARD_DESIGN_SETTINGS& settings = GetDesignSettings(); + + if( m_configSettings.empty() ) + { + // Display options: + m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "FpEditorUnits" ), + (int*)&g_UserUnit, MILLIMETRES ) ); + m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorDisplayPolarCoords" ), + &displ_opts->m_DisplayPolarCood, false ) ); + m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorPadDisplayMode" ), + &displ_opts->m_DisplayPadFill, true ) ); + m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "FpEditorGraphicLinesDisplayMode" ), + &displ_opts->m_DisplayModEdge, FILLED, 0, 2 ) ); + m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "FpEditorTextsDisplayMode" ), + &displ_opts->m_DisplayModText, FILLED, 0, 2 ) ); + m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "FpEditorTextsDisplayMode" ), + &displ_opts->m_DisplayModText, FILLED, 0, 2 ) ); + m_configSettings.push_back( new PARAM_CFG_WXSTRING( true, wxT( "FpEditorTextsRefDefaultText" ), + &settings.m_RefDefaultText, wxT( "REF**" ) ) ); + + // design settings + m_configSettings.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorGrlineWidth" ), + &settings.m_ModuleSegmentWidth, + Millimeter2iu( 0.15 ), + Millimeter2iu( 0.01 ), Millimeter2iu( 100.0 ), + NULL, 1/IU_PER_MM ) ); + m_configSettings.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorTextsDefaultSizeH" ), + &settings.m_ModuleTextSize.x, + Millimeter2iu( 1.5 ), + Millimeter2iu( 0.01 ), Millimeter2iu( 100.0 ), + NULL, 1/IU_PER_MM ) ); + m_configSettings.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorTextsDefaultSizeV" ), + &settings.m_ModuleTextSize.y, + Millimeter2iu( 1.5 ), + Millimeter2iu(0.01), Millimeter2iu( 100.0 ), + NULL, 1/IU_PER_MM ) ); + m_configSettings.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorTextsDefaultThickness" ), + &settings.m_ModuleTextWidth, + Millimeter2iu( 0.15 ), + Millimeter2iu( 0.01 ), Millimeter2iu( 20.0 ), + NULL, 1/IU_PER_MM ) ); + + m_configSettings.push_back( new PARAM_CFG_WXSTRING( true, + wxT( "FpEditorRefDefaultText" ), + &settings.m_RefDefaultText, wxT( "REF**" ) ) ); + m_configSettings.push_back( new PARAM_CFG_BOOL( true, + wxT( "FpEditorRefDefaultVisibility" ), + &settings.m_RefDefaultVisibility, true ) ); + m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "FpEditorRefDefaultLayer" ), + &settings.m_RefDefaultlayer, + int( F_SilkS ), int( F_SilkS ), int( F_Fab ) ) ); + + m_configSettings.push_back( new PARAM_CFG_WXSTRING( true, wxT( "FpEditorValueDefaultText" ), + &settings.m_ValueDefaultText, wxT( "" ) ) ); + m_configSettings.push_back( new PARAM_CFG_BOOL( true, + wxT( "FpEditorValueDefaultVisibility" ), + &settings.m_ValueDefaultVisibility, true ) ); + m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "FpEditorValueDefaultLayer" ), + &settings.m_ValueDefaultlayer, + int( F_Fab ), int( F_SilkS ), int( F_Fab ) ) ); + } + + return m_configSettings; +} + diff --git a/pcbnew/module_editor_frame.h b/pcbnew/module_editor_frame.h index 282fd1ff5a..1bd3c040d1 100644 --- a/pcbnew/module_editor_frame.h +++ b/pcbnew/module_editor_frame.h @@ -60,6 +60,23 @@ public: const PCB_PLOT_PARAMS& GetPlotSettings() const; // overload PCB_BASE_FRAME, get parent's void SetPlotSettings( const PCB_PLOT_PARAMS& aSettings ); // overload + void LoadSettings( wxConfigBase* aCfg ); // Virtual + void SaveSettings( wxConfigBase* aCfg ); // Virtual + + /** + * Function GetConfigurationSettings + * returns the footprçint editor settings list. + * + * Currently, only the settings that are needed at start + * up by the main window are defined here. There are other locally used + * settings that are scattered throughout the Pcbnew source code. If you need + * to define a configuration setting that needs to be loaded at run time, + * this is the place to define it. + * + * @return - Reference to the list of applications settings. + */ + PARAM_CFG_ARRAY& GetConfigurationSettings(); + void InstallOptionsFrame( const wxPoint& pos ); void OnCloseWindow( wxCloseEvent& Event ); @@ -67,6 +84,8 @@ public: void Process_Special_Functions( wxCommandEvent& event ); + void ProcessPreferences( wxCommandEvent& event ); + /** * Function RedrawActiveWindoow * draws the footprint editor BOARD, and others elements such as axis and grid. @@ -141,6 +160,7 @@ public: void OnVerticalToolbar( wxCommandEvent& aEvent ); void OnUpdateVerticalToolbar( wxUpdateUIEvent& aEvent ); + void OnUpdateOptionsToolbar( wxUpdateUIEvent& aEvent ); void OnUpdateLibSelected( wxUpdateUIEvent& aEvent ); void OnUpdateModuleSelected( wxUpdateUIEvent& aEvent ); void OnUpdateLibAndModuleSelected( wxUpdateUIEvent& aEvent ); @@ -486,6 +506,8 @@ protected: PCB_LAYER_WIDGET* m_Layers; + PARAM_CFG_ARRAY m_configSettings; ///< List of footprint editor configuration settings. + /** * Function UpdateTitle * updates window title according to getLibNickName(). diff --git a/pcbnew/moduleframe.cpp b/pcbnew/moduleframe.cpp index a978a1c496..a214f33af8 100644 --- a/pcbnew/moduleframe.cpp +++ b/pcbnew/moduleframe.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck + * Copyright (C) 2015 SoftPLC Corporation, Dick Hollenbeck * Copyright (C) 2015 Wayne Stambaugh * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. * @@ -49,9 +49,12 @@ #include #include #include +#include #include +#include #include #include +#include #include #include @@ -115,6 +118,20 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME ) EVT_TOOL( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, FOOTPRINT_EDIT_FRAME::OnSelectOptionToolbar ) EVT_TOOL( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE, FOOTPRINT_EDIT_FRAME::OnSelectOptionToolbar ) + // Preferences et option menus + EVT_MENU( ID_PREFERENCES_HOTKEY_EXPORT_CONFIG, + FOOTPRINT_EDIT_FRAME::ProcessPreferences ) + EVT_MENU( ID_PREFERENCES_HOTKEY_IMPORT_CONFIG, + FOOTPRINT_EDIT_FRAME::ProcessPreferences ) + EVT_MENU( ID_PREFERENCES_HOTKEY_SHOW_EDITOR, + FOOTPRINT_EDIT_FRAME::ProcessPreferences ) + EVT_MENU( ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST, + FOOTPRINT_EDIT_FRAME::ProcessPreferences ) + EVT_MENU( ID_PCB_LIB_TABLE_EDIT, + FOOTPRINT_EDIT_FRAME::ProcessPreferences ) + EVT_MENU( wxID_PREFERENCES, + FOOTPRINT_EDIT_FRAME::ProcessPreferences ) + // popup commands EVT_MENU_RANGE( ID_POPUP_PCB_START_RANGE, ID_POPUP_PCB_END_RANGE, FOOTPRINT_EDIT_FRAME::Process_Special_Functions ) @@ -159,10 +176,20 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME ) EVT_UPDATE_UI( ID_MODEDIT_UPDATE_MODULE_IN_BOARD, FOOTPRINT_EDIT_FRAME::OnUpdateReplaceModuleInBoard ) EVT_UPDATE_UI( ID_NO_TOOL_SELECTED, FOOTPRINT_EDIT_FRAME::OnUpdateVerticalToolbar ) + EVT_UPDATE_UI_RANGE( ID_MODEDIT_PAD_TOOL, ID_MODEDIT_PLACE_GRID_COORD, FOOTPRINT_EDIT_FRAME::OnUpdateVerticalToolbar ) + + // Option toolbar: + EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_PADS_SKETCH, + FOOTPRINT_EDIT_FRAME::OnUpdateOptionsToolbar ) + EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, + FOOTPRINT_EDIT_FRAME::OnUpdateOptionsToolbar ) + EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, + FOOTPRINT_EDIT_FRAME::OnUpdateOptionsToolbar ) EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE, - FOOTPRINT_EDIT_FRAME::OnUpdateVerticalToolbar ) + FOOTPRINT_EDIT_FRAME::OnUpdateOptionsToolbar ) + EVT_UPDATE_UI( ID_GEN_IMPORT_DXF_FILE, FOOTPRINT_EDIT_FRAME::OnUpdateModuleSelected ) @@ -425,11 +452,10 @@ BOARD_DESIGN_SETTINGS& FOOTPRINT_EDIT_FRAME::GetDesignSettings() const // get the BOARD_DESIGN_SETTINGS from the parent editor, not our BOARD. // @todo(DICK) change the routing to some default or the board directly, parent may not exist - PCB_BASE_FRAME* parentFrame = (PCB_BASE_FRAME*) Kiway().Player( FRAME_PCB, true ); +// PCB_BASE_FRAME* parentFrame = (PCB_BASE_FRAME*) Kiway().Player( FRAME_PCB, true ); +// wxASSERT( parentFrame ); - wxASSERT( parentFrame ); - - return parentFrame->GetDesignSettings(); + return GetBoard()->GetDesignSettings(); } @@ -438,11 +464,10 @@ void FOOTPRINT_EDIT_FRAME::SetDesignSettings( const BOARD_DESIGN_SETTINGS& aSett // set the BOARD_DESIGN_SETTINGS into parent editor, not our BOARD. // @todo(DICK) change the routing to some default or the board directly, parent may not exist - PCB_BASE_FRAME* parentFrame = (PCB_BASE_FRAME*) Kiway().Player( FRAME_PCB, true ); +// PCB_BASE_FRAME* parentFrame = (PCB_BASE_FRAME*) Kiway().Player( FRAME_PCB, true ); +// wxASSERT( parentFrame ); - wxASSERT( parentFrame ); - - parentFrame->SetDesignSettings( aSettings ); + GetBoard()->SetDesignSettings( aSettings ); } @@ -452,7 +477,6 @@ const PCB_PLOT_PARAMS& FOOTPRINT_EDIT_FRAME::GetPlotSettings() const // @todo(DICK) change the routing to some default or the board directly, parent may not exist PCB_BASE_FRAME* parentFrame = (PCB_BASE_FRAME*) Kiway().Player( FRAME_PCB, true ); - wxASSERT( parentFrame ); return parentFrame->GetPlotSettings(); @@ -465,13 +489,35 @@ void FOOTPRINT_EDIT_FRAME::SetPlotSettings( const PCB_PLOT_PARAMS& aSettings ) // @todo(DICK) change the routing to some default or the board directly, parent may not exist PCB_BASE_FRAME* parentFrame = (PCB_BASE_FRAME*) Kiway().Player( FRAME_PCB, true ); - wxASSERT( parentFrame ); parentFrame->SetPlotSettings( aSettings ); } +void FOOTPRINT_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg ) +{ + EDA_DRAW_FRAME::LoadSettings( aCfg ); + wxConfigLoadSetups( aCfg, GetConfigurationSettings() ); + + // Ensure some params are valid + BOARD_DESIGN_SETTINGS& settings = GetDesignSettings(); + + if( ( settings.m_RefDefaultlayer != F_SilkS ) && ( settings.m_RefDefaultlayer != F_Fab ) ) + settings.m_RefDefaultlayer = F_SilkS; + + if( ( settings.m_ValueDefaultlayer != F_SilkS ) && ( settings.m_ValueDefaultlayer != F_Fab ) ) + settings.m_ValueDefaultlayer = F_Fab; +} + + +void FOOTPRINT_EDIT_FRAME::SaveSettings( wxConfigBase* aCfg ) +{ + EDA_DRAW_FRAME::SaveSettings( aCfg ); + wxConfigSaveSetups( aCfg, GetConfigurationSettings() ); +} + + void FOOTPRINT_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event ) { if( GetScreen()->IsModify() ) @@ -526,6 +572,43 @@ void FOOTPRINT_EDIT_FRAME::OnUpdateVerticalToolbar( wxUpdateUIEvent& aEvent ) aEvent.Check( GetToolId() == aEvent.GetId() ); } +void FOOTPRINT_EDIT_FRAME::OnUpdateOptionsToolbar( wxUpdateUIEvent& aEvent ) +{ + int id = aEvent.GetId(); + DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions(); + + bool state = false; + + switch( id ) + { + case ID_TB_OPTIONS_SHOW_PADS_SKETCH: + state = !displ_opts->m_DisplayPadFill; + break; + + case ID_TB_OPTIONS_SHOW_VIAS_SKETCH: + state = !displ_opts->m_DisplayViaFill; + break; + + case ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH: + state = displ_opts->m_DisplayModText == SKETCH; + break; + + case ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH: + state = displ_opts->m_DisplayModEdge == SKETCH; + break; + + case ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE: + state = displ_opts->m_ContrastModeDisplay; + break; + + default: + wxMessageBox( wxT( "FOOTPRINT_EDIT_FRAME::OnUpdateOptionsToolbar error" ) ); + break; + } + + aEvent.Check( state ); +} + void FOOTPRINT_EDIT_FRAME::OnUpdateLibSelected( wxUpdateUIEvent& aEvent ) { @@ -754,3 +837,90 @@ void FOOTPRINT_EDIT_FRAME::SetElementVisibility( int aElement, bool aNewState ) m_Layers->SetRenderState( aElement, aNewState ); } + +void FOOTPRINT_EDIT_FRAME::ProcessPreferences( wxCommandEvent& event ) +{ + int id = event.GetId(); + + switch( id ) + { + // Hotkey IDs + case ID_PREFERENCES_HOTKEY_EXPORT_CONFIG: + ExportHotkeyConfigToFile( g_Module_Editor_Hokeys_Descr ); + break; + + case ID_PREFERENCES_HOTKEY_IMPORT_CONFIG: + ImportHotkeyConfigFromFile( g_Module_Editor_Hokeys_Descr ); + break; + + case ID_PREFERENCES_HOTKEY_SHOW_EDITOR: + InstallHotkeyFrame( this, g_Module_Editor_Hokeys_Descr ); + break; + + case ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST: + // Display current hotkey list for the footprint editor. + DisplayHotkeyList( this, g_Module_Editor_Hokeys_Descr ); + break; + + case ID_PCB_LIB_TABLE_EDIT: + { + bool tableChanged = false; + int r = InvokePcbLibTableEditor( this, &GFootprintTable, Prj().PcbFootprintLibs() ); + + if( r & 1 ) + { + try + { + FILE_OUTPUTFORMATTER sf( FP_LIB_TABLE::GetGlobalTableFileName() ); + + GFootprintTable.Format( &sf, 0 ); + tableChanged = true; + } + catch( const IO_ERROR& ioe ) + { + wxString msg = wxString::Format( _( + "Error occurred saving the global footprint library " + "table:\n\n%s" ), + GetChars( ioe.errorText.GetData() ) + ); + wxMessageBox( msg, _( "File Save Error" ), wxOK | wxICON_ERROR ); + } + } + + if( r & 2 ) + { + wxString tblName = Prj().FootprintLibTblName(); + + try + { + Prj().PcbFootprintLibs()->Save( tblName ); + tableChanged = true; + } + catch( const IO_ERROR& ioe ) + { + wxString msg = wxString::Format( _( + "Error occurred saving project specific footprint library " + "table:\n\n%s" ), + GetChars( ioe.errorText ) + ); + wxMessageBox( msg, _( "File Save Error" ), wxOK | wxICON_ERROR ); + } + } + + FOOTPRINT_VIEWER_FRAME* viewer; + viewer = (FOOTPRINT_VIEWER_FRAME*)Kiway().Player( FRAME_PCB_MODULE_VIEWER, false ); + + if( tableChanged && viewer != NULL ) + viewer->ReCreateLibraryList(); + } + break; + + case wxID_PREFERENCES: + InvokeFPEditorPrefsDlg( this ); + break; + + default: + DisplayError( this, wxT( "FOOTPRINT_EDIT_FRAME::ProcessPreferences error" ) ); + } +} + From 3c343b415a5fc8daa5b8f0b7d03adcf9879eb86d Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sun, 1 Feb 2015 08:19:31 +0100 Subject: [PATCH 20/29] Fix the minor bug 1016924 ( Unhandled event id 6263 in pcbnew ). Remove duplicate code. --- cvpcb/class_DisplayFootprintsFrame.cpp | 39 +++++++++----------------- pcbnew/edit.cpp | 10 ++++--- pcbnew/moduleframe.cpp | 14 +-------- pcbnew/pcbnew_config.cpp | 6 ++-- 4 files changed, 23 insertions(+), 46 deletions(-) diff --git a/cvpcb/class_DisplayFootprintsFrame.cpp b/cvpcb/class_DisplayFootprintsFrame.cpp index 49e8958fb2..40bf81822d 100644 --- a/cvpcb/class_DisplayFootprintsFrame.cpp +++ b/cvpcb/class_DisplayFootprintsFrame.cpp @@ -1,9 +1,9 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2007 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com - * Copyright (C) 2011 Wayne Stambaugh - * Copyright (C) 2007-2011 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 2015 Wayne Stambaugh + * Copyright (C) 2007-2015 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -58,6 +58,7 @@ BEGIN_EVENT_TABLE( DISPLAY_FOOTPRINTS_FRAME, PCB_BASE_FRAME ) EVT_SIZE( DISPLAY_FOOTPRINTS_FRAME::OnSize ) EVT_TOOL( ID_OPTIONS_SETUP, DISPLAY_FOOTPRINTS_FRAME::InstallOptionsDisplay ) EVT_TOOL( ID_CVPCB_SHOW3D_FRAME, DISPLAY_FOOTPRINTS_FRAME::Show3D_Frame ) + EVT_TOOL( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar) EVT_TOOL( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, @@ -251,13 +252,10 @@ void DISPLAY_FOOTPRINTS_FRAME::OnUpdateTextDrawMode( wxUpdateUIEvent& aEvent ) wxString msgTextsFill[2] = { _( "Show texts in filled mode" ), _( "Show texts in sketch mode" ) }; - unsigned i = displ_opts->m_DisplayModText + 1; + unsigned i = displ_opts->m_DisplayModText == SKETCH ? 0 : 1; - if ( i > 2 ) - i = 1; - - aEvent.Check( displ_opts->m_DisplayModText == 1 ); - m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, msgTextsFill[i-1] ); + aEvent.Check( displ_opts->m_DisplayModText == SKETCH ); + m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, msgTextsFill[i] ); } @@ -266,16 +264,13 @@ void DISPLAY_FOOTPRINTS_FRAME::OnUpdateLineDrawMode( wxUpdateUIEvent& aEvent ) { DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions(); - wxString msgEdgesFill[3] = { _( "Show outlines in filled mode" ), + wxString msgEdgesFill[2] = { _( "Show outlines in filled mode" ), _( "Show outlines in sketch mode" ) }; - int i = displ_opts->m_DisplayModEdge + 1; + int i = displ_opts->m_DisplayModEdge == SKETCH ? 0 : 1; - if ( i > 2 ) - i = 1; - - aEvent.Check( displ_opts->m_DisplayModEdge == 2 ); - m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, msgEdgesFill[i-1] ); + aEvent.Check( displ_opts->m_DisplayModEdge == SKETCH ); + m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, msgEdgesFill[i] ); } @@ -303,20 +298,12 @@ void DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar( wxCommandEvent& event ) switch( id ) { case ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH: - displ_opts->m_DisplayModText++; - - if( displ_opts->m_DisplayModText > 2 ) - displ_opts->m_DisplayModText = 0; - + displ_opts->m_DisplayModText = displ_opts->m_DisplayModText == FILLED ? SKETCH : FILLED; m_canvas->Refresh( ); break; case ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH: - displ_opts->m_DisplayModEdge++; - - if( displ_opts->m_DisplayModEdge > 2 ) - displ_opts->m_DisplayModEdge = 0; - + displ_opts->m_DisplayModEdge = displ_opts->m_DisplayModEdge == FILLED ? SKETCH : FILLED; m_canvas->Refresh(); break; diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp index cc0db92b17..4e79cb43db 100644 --- a/pcbnew/edit.cpp +++ b/pcbnew/edit.cpp @@ -1,10 +1,10 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr - * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck - * Copyright (C) 2012 Wayne Stambaugh - * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 2015 SoftPLC Corporation, Dick Hollenbeck + * Copyright (C) 2015 Wayne Stambaugh + * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -110,6 +110,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) case ID_POPUP_PCB_DELETE_ZONE: case ID_POPUP_PCB_MOVE_ZONE_CORNER: case ID_POPUP_PCB_DRAG_ZONE_OUTLINE_SEGMENT: + case ID_POPUP_PCB_PLACE_DRAGGED_ZONE_OUTLINE_SEGMENT: case ID_POPUP_PCB_MOVE_ZONE_OUTLINES: case ID_POPUP_PCB_ADD_ZONE_CORNER: case ID_POPUP_PCB_DELETE_TRACKSEG: @@ -609,6 +610,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) case ID_POPUP_PCB_PLACE_ZONE_OUTLINES: case ID_POPUP_PCB_PLACE_ZONE_CORNER: + case ID_POPUP_PCB_PLACE_DRAGGED_ZONE_OUTLINE_SEGMENT: { m_canvas->MoveCursorToCrossHair(); ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem(); diff --git a/pcbnew/moduleframe.cpp b/pcbnew/moduleframe.cpp index a214f33af8..45ecbf24e2 100644 --- a/pcbnew/moduleframe.cpp +++ b/pcbnew/moduleframe.cpp @@ -111,9 +111,7 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME ) EVT_TOOL_RANGE( ID_MODEDIT_PAD_TOOL, ID_MODEDIT_PLACE_GRID_COORD, FOOTPRINT_EDIT_FRAME::OnVerticalToolbar ) - // Options Toolbar - EVT_TOOL( ID_TB_OPTIONS_SHOW_PADS_SKETCH, FOOTPRINT_EDIT_FRAME::OnSelectOptionToolbar ) - EVT_TOOL( ID_TB_OPTIONS_SHOW_VIAS_SKETCH, FOOTPRINT_EDIT_FRAME::OnSelectOptionToolbar ) + // Options Toolbar (ID_TB_OPTIONS_SHOW_PADS_SKETCH id is managed in PCB_BASE_FRAME) EVT_TOOL( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, FOOTPRINT_EDIT_FRAME::OnSelectOptionToolbar ) EVT_TOOL( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, FOOTPRINT_EDIT_FRAME::OnSelectOptionToolbar ) EVT_TOOL( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE, FOOTPRINT_EDIT_FRAME::OnSelectOptionToolbar ) @@ -181,8 +179,6 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME ) FOOTPRINT_EDIT_FRAME::OnUpdateVerticalToolbar ) // Option toolbar: - EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_PADS_SKETCH, - FOOTPRINT_EDIT_FRAME::OnUpdateOptionsToolbar ) EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, FOOTPRINT_EDIT_FRAME::OnUpdateOptionsToolbar ) EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, @@ -581,14 +577,6 @@ void FOOTPRINT_EDIT_FRAME::OnUpdateOptionsToolbar( wxUpdateUIEvent& aEvent ) switch( id ) { - case ID_TB_OPTIONS_SHOW_PADS_SKETCH: - state = !displ_opts->m_DisplayPadFill; - break; - - case ID_TB_OPTIONS_SHOW_VIAS_SKETCH: - state = !displ_opts->m_DisplayViaFill; - break; - case ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH: state = displ_opts->m_DisplayModText == SKETCH; break; diff --git a/pcbnew/pcbnew_config.cpp b/pcbnew/pcbnew_config.cpp index 95fbb6e635..828cf8820d 100644 --- a/pcbnew/pcbnew_config.cpp +++ b/pcbnew/pcbnew_config.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr + * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck * Copyright (C) 2012 Wayne Stambaugh * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors. @@ -96,8 +96,8 @@ void PCB_EDIT_FRAME::Process_Config( wxCommandEvent& event ) { LAYER_ID cur_layer = GetActiveLayer(); - // If after showing the dialog the user removed the active layer, - // then use a sensible alternative layer to set as the active layer. + // If after showing the dialog the user has removed the active layer, + // then select a new active layer (front copper layer). if( !GetBoard()->GetEnabledLayers()[ cur_layer ] ) cur_layer = F_Cu; From bd04e61b6fa8a9960ea5ffe0cd578f8ba92339f0 Mon Sep 17 00:00:00 2001 From: Miguel Angel Ajo Date: Sun, 1 Feb 2015 19:20:20 +0100 Subject: [PATCH 21/29] qa/test.py change to make sure failed tests return 1 in all systems. --- qa/test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qa/test.py b/qa/test.py index 88ce7bd841..3ebb93740f 100644 --- a/qa/test.py +++ b/qa/test.py @@ -12,7 +12,7 @@ if __name__ == '__main__': results = unittest.TextTestRunner(verbosity=100).run(testsuite) # Return an error code if any of the testsuite tests fail - if len(results.errors) > 0: + if not results.wasSuccessful(): sys.exit(1) From 2ff623dcb9371e76f39d8db0b964c36a0a3029ff Mon Sep 17 00:00:00 2001 From: Miguel Angel Ajo Date: Sun, 1 Feb 2015 19:31:47 +0100 Subject: [PATCH 22/29] Fix the pcb bouncing box test adding the track clearance. --- qa/testcases/test_002_board_class.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/qa/testcases/test_002_board_class.py b/qa/testcases/test_002_board_class.py index 98f82abc29..64dff3a6a9 100644 --- a/qa/testcases/test_002_board_class.py +++ b/qa/testcases/test_002_board_class.py @@ -51,8 +51,9 @@ class TestBoardClass(unittest.TestCase): bounding_box = pcb.ComputeBoundingBox() height, width = ToMM(bounding_box.GetSize()) - self.assertAlmostEqual(width, (30-10) + 0.5, 2) - self.assertAlmostEqual(height, (20-10) + 0.5, 2) + clearance = ToMM(track.GetClearance()*2) + self.assertAlmostEqual(width, (30-10) + 0.5 + clearance, 2) + self.assertAlmostEqual(height, (20-10) + 0.5 + clearance, 2) def test_pcb_get_pad(self): pcb = BOARD() From b1cd42cf087ef4fea24ca4bd90de8268d8e77296 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Mon, 2 Feb 2015 09:06:39 +0100 Subject: [PATCH 23/29] Pcbnew: simplify draw code in default canvas and plot functions by removing the plot LINE option, which is not existing in all plotters, not existing in opengl/cairo canvas, and not usefull in default canvas. --- common/class_plotter.cpp | 56 +- common/common_plotDXF_functions.cpp | 10 +- common/common_plotGERBER_functions.cpp | 22 +- common/common_plotHPGL_functions.cpp | 18 +- common/eda_text.cpp | 3 - cvpcb/class_DisplayFootprintsFrame.cpp | 12 +- cvpcb/dialogs/dialog_display_options.cpp | 16 +- cvpcb/dialogs/dialog_display_options_base.cpp | 53 +- cvpcb/dialogs/dialog_display_options_base.fbp | 938 ++++---- cvpcb/dialogs/dialog_display_options_base.h | 19 +- include/eda_text.h | 13 +- include/pcbstruct.h | 6 +- include/wxPcbStruct.h | 3 - pcbnew/basepcbframe.cpp | 14 +- pcbnew/class_dimension.cpp | 21 +- pcbnew/class_drawsegment.cpp | 66 +- pcbnew/class_edge_mod.cpp | 40 +- pcbnew/class_mire.cpp | 31 +- pcbnew/class_pcb_text.cpp | 2 +- pcbnew/class_text_mod.cpp | 7 +- pcbnew/classpcb.cpp | 14 +- pcbnew/dialogs/dialog_display_options.cpp | 47 +- .../dialogs/dialog_display_options_base.cpp | 136 +- .../dialogs/dialog_display_options_base.fbp | 2065 ++++++++--------- pcbnew/dialogs/dialog_display_options_base.h | 41 +- pcbnew/dialogs/dialog_plot.cpp | 6 +- pcbnew/dialogs/dialog_plot_base.cpp | 4 +- pcbnew/dialogs/dialog_plot_base.fbp | 4 +- pcbnew/dialogs/dialog_plot_base.h | 2 +- pcbnew/editedge.cpp | 15 +- pcbnew/exporters/gen_drill_report_files.cpp | 2 +- pcbnew/modeditoptions.cpp | 16 +- pcbnew/moduleframe.cpp | 4 +- pcbnew/pcb_plot_params.cpp | 10 +- pcbnew/pcb_plot_params.h | 13 +- pcbnew/pcb_plot_params_parser.h | 1 - pcbnew/pcbnew_config.cpp | 12 +- pcbnew/plot_board_layers.cpp | 6 +- pcbnew/plot_brditems_plotter.cpp | 49 +- pcbnew/print_board_functions.cpp | 12 +- 40 files changed, 1741 insertions(+), 2068 deletions(-) diff --git a/common/class_plotter.cpp b/common/class_plotter.cpp index ffa4615fd5..12bbac2ed4 100644 --- a/common/class_plotter.cpp +++ b/common/class_plotter.cpp @@ -433,19 +433,16 @@ void PLOTTER::sketchOval( const wxPoint& pos, const wxSize& aSize, double orient void PLOTTER::ThickSegment( const wxPoint& start, const wxPoint& end, int width, EDA_DRAW_MODE_T tracemode ) { - switch( tracemode ) + if( tracemode == FILLED ) { - case FILLED: - case LINE: - SetCurrentLineWidth( tracemode==FILLED ? width : -1 ); + SetCurrentLineWidth( width ); MoveTo( start ); FinishTo( end ); - break; - - case SKETCH: + } + else + { SetCurrentLineWidth( -1 ); segmentAsOval( start, end, width, tracemode ); - break; } } @@ -453,24 +450,15 @@ void PLOTTER::ThickSegment( const wxPoint& start, const wxPoint& end, int width, void PLOTTER::ThickArc( const wxPoint& centre, double StAngle, double EndAngle, int radius, int width, EDA_DRAW_MODE_T tracemode ) { - switch( tracemode ) - { - case LINE: - SetCurrentLineWidth( -1 ); - Arc( centre, StAngle, EndAngle, radius, NO_FILL, -1 ); - break; - - case FILLED: + if( tracemode == FILLED ) Arc( centre, StAngle, EndAngle, radius, NO_FILL, width ); - break; - - case SKETCH: + else + { SetCurrentLineWidth( -1 ); Arc( centre, StAngle, EndAngle, radius - ( width - currentPenWidth ) / 2, NO_FILL, -1 ); Arc( centre, StAngle, EndAngle, radius + ( width - currentPenWidth ) / 2, NO_FILL, -1 ); - break; } } @@ -478,17 +466,10 @@ void PLOTTER::ThickArc( const wxPoint& centre, double StAngle, double EndAngle, void PLOTTER::ThickRect( const wxPoint& p1, const wxPoint& p2, int width, EDA_DRAW_MODE_T tracemode ) { - switch( tracemode ) - { - case LINE: - Rect( p1, p2, NO_FILL, -1 ); - break; - - case FILLED: + if( tracemode == FILLED ) Rect( p1, p2, NO_FILL, width ); - break; - - case SKETCH: + else + { SetCurrentLineWidth( -1 ); wxPoint offsetp1( p1.x - (width - currentPenWidth) / 2, p1.y - (width - currentPenWidth) / 2 ); @@ -500,28 +481,19 @@ void PLOTTER::ThickRect( const wxPoint& p1, const wxPoint& p2, int width, offsetp2.x -= (width - currentPenWidth); offsetp2.y -= (width - currentPenWidth); Rect( offsetp1, offsetp2, NO_FILL, -1 ); - break; } } void PLOTTER::ThickCircle( const wxPoint& pos, int diametre, int width, EDA_DRAW_MODE_T tracemode ) { - switch( tracemode ) - { - case LINE: - Circle( pos, diametre, NO_FILL, -1 ); - break; - - case FILLED: + if( tracemode == FILLED ) Circle( pos, diametre, NO_FILL, width ); - break; - - case SKETCH: + else + { SetCurrentLineWidth( -1 ); Circle( pos, diametre - width + currentPenWidth, NO_FILL, -1 ); Circle( pos, diametre + width - currentPenWidth, NO_FILL, -1 ); - break; } } diff --git a/common/common_plotDXF_functions.cpp b/common/common_plotDXF_functions.cpp index fbca11328f..e6e11cce9d 100644 --- a/common/common_plotDXF_functions.cpp +++ b/common/common_plotDXF_functions.cpp @@ -467,15 +467,7 @@ void DXF_PLOTTER::SetDash( bool dashed ) void DXF_PLOTTER::ThickSegment( const wxPoint& aStart, const wxPoint& aEnd, int aWidth, EDA_DRAW_MODE_T aPlotMode ) { - if( aPlotMode == LINE ) // In line mode, just a line is OK - { - MoveTo( aStart ); - FinishTo( aEnd ); - } - else - { - segmentAsOval( aStart, aEnd, aWidth, aPlotMode ); - } + segmentAsOval( aStart, aEnd, aWidth, aPlotMode ); } /* Plot an arc in DXF format diff --git a/common/common_plotGERBER_functions.cpp b/common/common_plotGERBER_functions.cpp index 50d1802eb8..2646171faf 100644 --- a/common/common_plotGERBER_functions.cpp +++ b/common/common_plotGERBER_functions.cpp @@ -432,19 +432,16 @@ void GERBER_PLOTTER::FlashPadCircle( const wxPoint& pos, int diametre, EDA_DRAW_ wxASSERT( outputFile ); wxSize size( diametre, diametre ); - switch( trace_mode ) + if( trace_mode == SKETCH ) { - case LINE: - case SKETCH: SetCurrentLineWidth( -1 ); Circle( pos, diametre - currentPenWidth, NO_FILL ); - break; - - case FILLED: + } + else + { DPOINT pos_dev = userToDeviceCoordinates( pos ); selectAperture( size, APERTURE::Circle ); emitDcode( pos_dev, 3 ); - break; } } @@ -519,23 +516,20 @@ void GERBER_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& aSize, // Pass through case 0: case 1800: - switch( trace_mode ) + if( trace_mode == SKETCH ) { - case LINE: - case SKETCH: SetCurrentLineWidth( -1 ); Rect( wxPoint( pos.x - (size.x - currentPenWidth) / 2, pos.y - (size.y - currentPenWidth) / 2 ), wxPoint( pos.x + (size.x - currentPenWidth) / 2, pos.y + (size.y - currentPenWidth) / 2 ), NO_FILL ); - break; - - case FILLED: + } + else + { DPOINT pos_dev = userToDeviceCoordinates( pos ); selectAperture( size, APERTURE::Rect ); emitDcode( pos_dev, 3 ); - break; } break; diff --git a/common/common_plotHPGL_functions.cpp b/common/common_plotHPGL_functions.cpp index 1e040b03b1..553b45dd67 100644 --- a/common/common_plotHPGL_functions.cpp +++ b/common/common_plotHPGL_functions.cpp @@ -388,8 +388,8 @@ void HPGL_PLOTTER::ThickSegment( const wxPoint& start, const wxPoint& end, wxPoint center; wxSize size; - // Suppress overlap if pen is too big or in line mode - if( (penDiameter >= width) || (tracemode == LINE) ) + // Suppress overlap if pen is too big + if( penDiameter >= width ) { MoveTo( start ); FinishTo( end ); @@ -491,15 +491,10 @@ void HPGL_PLOTTER::FlashPadCircle( const wxPoint& pos, int diametre, int delta = KiROUND( penDiameter - penOverlap ); int radius = diametre / 2; - if( trace_mode != LINE ) - { - radius = ( diametre - KiROUND( penDiameter ) ) / 2; - } + radius = ( diametre - KiROUND( penDiameter ) ) / 2; if( radius < 0 ) - { radius = 0; - } double rsize = userToDeviceSize( radius ); @@ -534,11 +529,8 @@ void HPGL_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& padsize, size.x = padsize.x / 2; size.y = padsize.y / 2; - if( trace_mode != LINE ) - { - size.x = (padsize.x - (int) penDiameter) / 2; - size.y = (padsize.y - (int) penDiameter) / 2; - } + size.x = (padsize.x - (int) penDiameter) / 2; + size.y = (padsize.y - (int) penDiameter) / 2; if( size.x < 0 ) size.x = 0; diff --git a/common/eda_text.cpp b/common/eda_text.cpp index c592306cc8..c615f67b26 100644 --- a/common/eda_text.cpp +++ b/common/eda_text.cpp @@ -346,9 +346,6 @@ void EDA_TEXT::drawOneLineOfText( EDA_RECT* aClipBox, wxDC* aDC, { int width = m_Thickness; - if( aFillMode == LINE ) - width = 0; - if( aDrawMode != UNSPECIFIED_DRAWMODE ) GRSetDrawMode( aDC, aDrawMode ); diff --git a/cvpcb/class_DisplayFootprintsFrame.cpp b/cvpcb/class_DisplayFootprintsFrame.cpp index 40bf81822d..07b1721ebe 100644 --- a/cvpcb/class_DisplayFootprintsFrame.cpp +++ b/cvpcb/class_DisplayFootprintsFrame.cpp @@ -252,9 +252,9 @@ void DISPLAY_FOOTPRINTS_FRAME::OnUpdateTextDrawMode( wxUpdateUIEvent& aEvent ) wxString msgTextsFill[2] = { _( "Show texts in filled mode" ), _( "Show texts in sketch mode" ) }; - unsigned i = displ_opts->m_DisplayModText == SKETCH ? 0 : 1; + unsigned i = displ_opts->m_DisplayModTextFill == SKETCH ? 0 : 1; - aEvent.Check( displ_opts->m_DisplayModText == SKETCH ); + aEvent.Check( displ_opts->m_DisplayModTextFill == SKETCH ); m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, msgTextsFill[i] ); } @@ -267,9 +267,9 @@ void DISPLAY_FOOTPRINTS_FRAME::OnUpdateLineDrawMode( wxUpdateUIEvent& aEvent ) wxString msgEdgesFill[2] = { _( "Show outlines in filled mode" ), _( "Show outlines in sketch mode" ) }; - int i = displ_opts->m_DisplayModEdge == SKETCH ? 0 : 1; + int i = displ_opts->m_DisplayModEdgeFill == SKETCH ? 0 : 1; - aEvent.Check( displ_opts->m_DisplayModEdge == SKETCH ); + aEvent.Check( displ_opts->m_DisplayModEdgeFill == SKETCH ); m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, msgEdgesFill[i] ); } @@ -298,12 +298,12 @@ void DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar( wxCommandEvent& event ) switch( id ) { case ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH: - displ_opts->m_DisplayModText = displ_opts->m_DisplayModText == FILLED ? SKETCH : FILLED; + displ_opts->m_DisplayModTextFill = displ_opts->m_DisplayModTextFill == FILLED ? SKETCH : FILLED; m_canvas->Refresh( ); break; case ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH: - displ_opts->m_DisplayModEdge = displ_opts->m_DisplayModEdge == FILLED ? SKETCH : FILLED; + displ_opts->m_DisplayModEdgeFill = displ_opts->m_DisplayModEdgeFill == FILLED ? SKETCH : FILLED; m_canvas->Refresh(); break; diff --git a/cvpcb/dialogs/dialog_display_options.cpp b/cvpcb/dialogs/dialog_display_options.cpp index 381cf976c9..9911ebccc6 100644 --- a/cvpcb/dialogs/dialog_display_options.cpp +++ b/cvpcb/dialogs/dialog_display_options.cpp @@ -74,10 +74,10 @@ void DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::initDialog() DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)m_Parent->GetDisplayOptions(); - m_EdgesDisplayOption->SetSelection( displ_opts->m_DisplayModEdge ); - m_TextDisplayOption->SetSelection( displ_opts->m_DisplayModText ); - m_IsShowPadFill->SetValue( displ_opts->m_DisplayPadFill ); - m_IsShowPadNum->SetValue( displ_opts->m_DisplayPadNum ); + m_EdgesDisplayOption->SetValue( not displ_opts->m_DisplayModEdgeFill ); + m_TextDisplayOption->SetValue( not displ_opts->m_DisplayModTextFill ); + m_ShowPadSketch->SetValue( not displ_opts->m_DisplayPadFill ); + m_ShowPadNum->SetValue( displ_opts->m_DisplayPadNum ); m_IsZoomNoCenter->SetValue( m_Parent->GetCanvas()->GetEnableZoomNoCenter() ); m_IsMiddleButtonPan->SetValue( m_Parent->GetCanvas()->GetEnableMiddleButtonPan() ); m_IsMiddleButtonPanLimited->SetValue( m_Parent->GetCanvas()->GetMiddleButtonPanLimited() ); @@ -94,10 +94,10 @@ void DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::UpdateObjectSettings( void ) { DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)m_Parent->GetDisplayOptions(); - displ_opts->m_DisplayModEdge = m_EdgesDisplayOption->GetSelection(); - displ_opts->m_DisplayModText = m_TextDisplayOption->GetSelection(); - displ_opts->m_DisplayPadNum = m_IsShowPadNum->GetValue(); - displ_opts->m_DisplayPadFill = m_IsShowPadFill->GetValue(); + displ_opts->m_DisplayModEdgeFill = not m_EdgesDisplayOption->GetValue(); + displ_opts->m_DisplayModTextFill = not m_TextDisplayOption->GetValue(); + displ_opts->m_DisplayPadNum = m_ShowPadNum->GetValue(); + displ_opts->m_DisplayPadFill = not m_ShowPadSketch->GetValue(); m_Parent->GetCanvas()->SetEnableZoomNoCenter( m_IsZoomNoCenter->GetValue() ); m_Parent->GetCanvas()->SetEnableMiddleButtonPan( m_IsMiddleButtonPan->GetValue() ); m_Parent->GetCanvas()->SetMiddleButtonPanLimited( m_IsMiddleButtonPanLimited->GetValue() ); diff --git a/cvpcb/dialogs/dialog_display_options_base.cpp b/cvpcb/dialogs/dialog_display_options_base.cpp index 8c37a2bee0..5b06c1058e 100644 --- a/cvpcb/dialogs/dialog_display_options_base.cpp +++ b/cvpcb/dialogs/dialog_display_options_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Oct 8 2012) +// C++ code generated with wxFormBuilder (version Jun 5 2014) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -19,38 +19,23 @@ DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE( wxBoxSizer* bUpperSizer; bUpperSizer = new wxBoxSizer( wxHORIZONTAL ); - wxBoxSizer* bSizerLeft; - bSizerLeft = new wxBoxSizer( wxVERTICAL ); + wxStaticBoxSizer* sbSizerDrawMode; + sbSizerDrawMode = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Draw options") ), wxVERTICAL ); - wxString m_EdgesDisplayOptionChoices[] = { _("Line"), _("Filled"), _("Sketch") }; - int m_EdgesDisplayOptionNChoices = sizeof( m_EdgesDisplayOptionChoices ) / sizeof( wxString ); - m_EdgesDisplayOption = new wxRadioBox( this, ID_EDGE_SELECT, _("Edges"), wxDefaultPosition, wxDefaultSize, m_EdgesDisplayOptionNChoices, m_EdgesDisplayOptionChoices, 1, wxRA_SPECIFY_COLS ); - m_EdgesDisplayOption->SetSelection( 0 ); - bSizerLeft->Add( m_EdgesDisplayOption, 1, wxALL|wxEXPAND, 5 ); + m_EdgesDisplayOption = new wxCheckBox( this, wxID_ANY, _("Graphic items sketch mode"), wxDefaultPosition, wxDefaultSize, 0 ); + sbSizerDrawMode->Add( m_EdgesDisplayOption, 0, wxALL, 5 ); - wxString m_TextDisplayOptionChoices[] = { _("Line"), _("Filled"), _("Sketch") }; - int m_TextDisplayOptionNChoices = sizeof( m_TextDisplayOptionChoices ) / sizeof( wxString ); - m_TextDisplayOption = new wxRadioBox( this, ID_TEXT_SELECT, _("Text"), wxDefaultPosition, wxDefaultSize, m_TextDisplayOptionNChoices, m_TextDisplayOptionChoices, 1, wxRA_SPECIFY_COLS ); - m_TextDisplayOption->SetSelection( 0 ); - bSizerLeft->Add( m_TextDisplayOption, 1, wxALL|wxEXPAND, 5 ); + m_TextDisplayOption = new wxCheckBox( this, wxID_ANY, _("Texts sketch mode"), wxDefaultPosition, wxDefaultSize, 0 ); + sbSizerDrawMode->Add( m_TextDisplayOption, 0, wxALL, 5 ); + + m_ShowPadSketch = new wxCheckBox( this, ID_PADFILL_OPT, _("Pad sketch mode"), wxDefaultPosition, wxDefaultSize, 0 ); + sbSizerDrawMode->Add( m_ShowPadSketch, 0, wxEXPAND|wxALL, 5 ); + + m_ShowPadNum = new wxCheckBox( this, wxID_ANY, _("Show pad &number"), wxDefaultPosition, wxDefaultSize, 0 ); + sbSizerDrawMode->Add( m_ShowPadNum, 0, wxALL|wxEXPAND, 5 ); - bUpperSizer->Add( bSizerLeft, 1, wxEXPAND, 5 ); - - wxBoxSizer* bSizerRight; - bSizerRight = new wxBoxSizer( wxVERTICAL ); - - wxStaticBoxSizer* sbSizerPads; - sbSizerPads = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Pads") ), wxVERTICAL ); - - m_IsShowPadFill = new wxCheckBox( this, ID_PADFILL_OPT, _("Fill &pad"), wxDefaultPosition, wxDefaultSize, 0 ); - sbSizerPads->Add( m_IsShowPadFill, 0, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 ); - - m_IsShowPadNum = new wxCheckBox( this, wxID_ANY, _("Show pad &number"), wxDefaultPosition, wxDefaultSize, 0 ); - sbSizerPads->Add( m_IsShowPadNum, 0, wxALL|wxEXPAND, 5 ); - - - bSizerRight->Add( sbSizerPads, 1, wxEXPAND|wxALL, 5 ); + bUpperSizer->Add( sbSizerDrawMode, 1, wxEXPAND|wxALL, 5 ); wxStaticBoxSizer* sbSizerViewOpt; sbSizerViewOpt = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Pan and Zoom") ), wxVERTICAL ); @@ -58,19 +43,16 @@ DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE( m_IsZoomNoCenter = new wxCheckBox( this, wxID_ANY, _("Do not center and warp cusor on zoom"), wxDefaultPosition, wxDefaultSize, 0 ); m_IsZoomNoCenter->SetToolTip( _("Keep the cursor at its current location when zooming") ); - sbSizerViewOpt->Add( m_IsZoomNoCenter, 0, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 ); + sbSizerViewOpt->Add( m_IsZoomNoCenter, 0, wxEXPAND|wxALL, 5 ); m_IsMiddleButtonPan = new wxCheckBox( this, wxID_ANY, _("Use middle mouse button to pan"), wxDefaultPosition, wxDefaultSize, 0 ); - sbSizerViewOpt->Add( m_IsMiddleButtonPan, 0, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 ); + sbSizerViewOpt->Add( m_IsMiddleButtonPan, 0, wxEXPAND|wxALL, 5 ); m_IsMiddleButtonPanLimited = new wxCheckBox( this, wxID_ANY, _("Limit panning to scroll size"), wxDefaultPosition, wxDefaultSize, 0 ); sbSizerViewOpt->Add( m_IsMiddleButtonPanLimited, 0, wxALL|wxEXPAND, 5 ); - bSizerRight->Add( sbSizerViewOpt, 1, wxALL|wxEXPAND, 5 ); - - - bUpperSizer->Add( bSizerRight, 2, wxEXPAND, 5 ); + bUpperSizer->Add( sbSizerViewOpt, 1, wxALL|wxEXPAND, 5 ); bSizerMain->Add( bUpperSizer, 1, wxEXPAND, 5 ); @@ -92,7 +74,6 @@ DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE( this->SetSizer( bSizerMain ); this->Layout(); - bSizerMain->Fit( this ); // Connect Events m_IsMiddleButtonPan->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::OnMiddleBtnPanEnbl ), NULL, this ); diff --git a/cvpcb/dialogs/dialog_display_options_base.fbp b/cvpcb/dialogs/dialog_display_options_base.fbp index 5247c0a142..3e08bd0da7 100644 --- a/cvpcb/dialogs/dialog_display_options_base.fbp +++ b/cvpcb/dialogs/dialog_display_options_base.fbp @@ -1,6 +1,6 @@ - + C++ @@ -20,8 +20,10 @@ . 1 + 1 1 1 + UI 0 0 @@ -42,7 +44,7 @@ DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE - -1,-1 + 425,206 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER DIALOG_SHIM; dialog_shim.h Display Options @@ -102,18 +104,21 @@ none 5 - wxEXPAND + wxEXPAND|wxALL 1 - + + wxID_ANY + Draw options - bSizerLeft + sbSizerDrawMode wxVERTICAL none + 5 - wxALL|wxEXPAND - 1 - + wxALL + 0 + 1 1 1 @@ -127,7 +132,7 @@ 1 0 - "Line" "Filled" "Sketch" + 0 1 1 @@ -141,9 +146,8 @@ 0 0 - ID_EDGE_SELECT - Edges - 1 + wxID_ANY + Graphic items sketch mode 0 @@ -159,10 +163,9 @@ 1 Resizable - 0 1 - wxRA_SPECIFY_COLS + 0 @@ -174,6 +177,7 @@ + @@ -190,7 +194,6 @@ - @@ -201,9 +204,9 @@ 5 - wxALL|wxEXPAND - 1 - + wxALL + 0 + 1 1 1 @@ -217,7 +220,7 @@ 1 0 - "Line" "Filled" "Sketch" + 0 1 1 @@ -231,9 +234,8 @@ 0 0 - ID_TEXT_SELECT - Text - 1 + wxID_ANY + Texts sketch mode 0 @@ -249,10 +251,9 @@ 1 Resizable - 0 1 - wxRA_SPECIFY_COLS + 0 @@ -264,6 +265,183 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_PADFILL_OPT + Pad sketch mode + + 0 + + + 0 + + 1 + m_ShowPadSketch + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Show pad &number + + 0 + + + 0 + + 1 + m_ShowPadNum + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + @@ -280,7 +458,6 @@ - @@ -293,479 +470,278 @@ 5 - wxEXPAND - 2 - + wxALL|wxEXPAND + 1 + + wxID_ANY + Pan and Zoom - bSizerRight + sbSizerViewOpt wxVERTICAL none + 5 wxEXPAND|wxALL - 1 - + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 wxID_ANY - Pads + Do not center and warp cusor on zoom + + 0 + + + 0 - sbSizerPads - wxVERTICAL - none + 1 + m_IsZoomNoCenter + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Keep the cursor at its current location when zooming + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Use middle mouse button to pan + + 0 + + + 0 + + 1 + m_IsMiddleButtonPan + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + OnMiddleBtnPanEnbl + + + + + + + + + + + + + + + + + + + + + - - 5 - wxEXPAND|wxLEFT|wxRIGHT|wxTOP - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_PADFILL_OPT - Fill &pad - - 0 - - - 0 - - 1 - m_IsShowPadFill - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Show pad &number - - 0 - - - 0 - - 1 - m_IsShowPadNum - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 wxALL|wxEXPAND - 1 - + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 wxID_ANY - Pan and Zoom + Limit panning to scroll size + + 0 + + + 0 - sbSizerViewOpt - wxVERTICAL - none + 1 + m_IsMiddleButtonPanLimited + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + - - 5 - wxEXPAND|wxLEFT|wxRIGHT|wxTOP - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Do not center and warp cusor on zoom - - 0 - - - 0 - - 1 - m_IsZoomNoCenter - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - Keep the cursor at its current location when zooming - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxLEFT|wxRIGHT|wxTOP - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Use middle mouse button to pan - - 0 - - - 0 - - 1 - m_IsMiddleButtonPan - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - OnMiddleBtnPanEnbl - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Limit panning to scroll size - - 0 - - - 0 - - 1 - m_IsMiddleButtonPanLimited - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cvpcb/dialogs/dialog_display_options_base.h b/cvpcb/dialogs/dialog_display_options_base.h index cfcf9da349..febdd1f8ef 100644 --- a/cvpcb/dialogs/dialog_display_options_base.h +++ b/cvpcb/dialogs/dialog_display_options_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Oct 8 2012) +// C++ code generated with wxFormBuilder (version Jun 5 2014) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -15,13 +15,12 @@ class DIALOG_SHIM; #include "dialog_shim.h" #include -#include +#include #include #include #include #include #include -#include #include #include #include @@ -29,9 +28,7 @@ class DIALOG_SHIM; /////////////////////////////////////////////////////////////////////////// -#define ID_EDGE_SELECT 1000 -#define ID_TEXT_SELECT 1001 -#define ID_PADFILL_OPT 1002 +#define ID_PADFILL_OPT 1000 /////////////////////////////////////////////////////////////////////////////// /// Class DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE @@ -41,10 +38,10 @@ class DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE : public DIALOG_SHIM private: protected: - wxRadioBox* m_EdgesDisplayOption; - wxRadioBox* m_TextDisplayOption; - wxCheckBox* m_IsShowPadFill; - wxCheckBox* m_IsShowPadNum; + wxCheckBox* m_EdgesDisplayOption; + wxCheckBox* m_TextDisplayOption; + wxCheckBox* m_ShowPadSketch; + wxCheckBox* m_ShowPadNum; wxCheckBox* m_IsZoomNoCenter; wxCheckBox* m_IsMiddleButtonPan; wxCheckBox* m_IsMiddleButtonPanLimited; @@ -63,7 +60,7 @@ class DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE : public DIALOG_SHIM public: - DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Display Options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Display Options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 425,206 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE(); }; diff --git a/include/eda_text.h b/include/eda_text.h index 97a8f77738..cd14c46307 100644 --- a/include/eda_text.h +++ b/include/eda_text.h @@ -52,11 +52,10 @@ enum EDA_TEXT_VJUSTIFY_T { }; -/* Options to show solid segments (segments, texts...) */ +/* Options to draw items with thickness ( segments, arcs, circles, texts...) */ enum EDA_DRAW_MODE_T { - LINE = 0, // segments are drawn as lines - FILLED, // normal mode: segments have thickness - SKETCH // sketch mode: segments have thickness, but are not filled + FILLED = true, // normal mode: solid segments + SKETCH = false // sketch mode: draw segments outlines only }; @@ -199,12 +198,12 @@ public: * @param aOffset = draw offset (usually (0,0)) * @param aColor = text color * @param aDrawMode = GR_OR, GR_XOR.., -1 to use the current mode. - * @param aDisplay_mode = LINE, FILLED or SKETCH + * @param aDisplay_mode = FILLED or SKETCH * @param aAnchor_color = anchor color ( UNSPECIFIED_COLOR = do not draw anchor ). */ void Draw( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset, EDA_COLOR_T aColor, - GR_DRAWMODE aDrawMode, EDA_DRAW_MODE_T aDisplay_mode = LINE, + GR_DRAWMODE aDrawMode, EDA_DRAW_MODE_T aDisplay_mode = FILLED, EDA_COLOR_T aAnchor_color = EDA_COLOR_T(UNSPECIFIED_COLOR) ); /** @@ -318,7 +317,7 @@ private: * @param aOffset = draw offset (usually (0,0)) * @param aColor = text color * @param aDrawMode = GR_OR, GR_XOR.., -1 to use the current mode. - * @param aFillMode = LINE, FILLED or SKETCH + * @param aFillMode = FILLED or SKETCH * @param aText = the single line of text to draw. * @param aPos = the position of this line ). */ diff --git a/include/pcbstruct.h b/include/pcbstruct.h index d55e6f802b..4920709c3a 100644 --- a/include/pcbstruct.h +++ b/include/pcbstruct.h @@ -75,8 +75,8 @@ public: bool m_DisplayViaFill; bool m_DisplayPadNum; // show pads numbers bool m_DisplayPadIsol; - int m_DisplayModEdge; // How to display module drawings (line/ filled / sketch) - int m_DisplayModText; // How to display module texts (line/ filled / sketch) + bool m_DisplayModEdgeFill; // How to display module drawings ( sketch/ filled ) + bool m_DisplayModTextFill; // How to display module texts ( sketch/ filled ) bool m_DisplayPcbTrackFill; // false : tracks are show in sketch mode, true = filled. /// How trace clearances are displayed. @see TRACE_CLEARANCE_DISPLAY_MODE_T. @@ -94,7 +94,7 @@ public: * 3 show netnames on tracks and pads */ - int m_DisplayDrawItems; + bool m_DisplayDrawItemsFill; // How to display graphic items on board ( sketch/ filled ) bool m_ContrastModeDisplay; int m_MaxLinksShowed; // in track creation: number of hairwires shown bool m_Show_Module_Ratsnest; // When moving a footprint: allows displaying a ratsnest diff --git a/include/wxPcbStruct.h b/include/wxPcbStruct.h index 5b55acc974..909b7961ce 100644 --- a/include/wxPcbStruct.h +++ b/include/wxPcbStruct.h @@ -367,9 +367,6 @@ public: * to define a configuration setting that needs to be loaded at run time, * this is the place to define it. * - * @todo: Define the configuration variables as member variables instead of - * global variables or move them to the object class where they are - * used. * @return - Reference to the list of applications settings. */ PARAM_CFG_ARRAY& GetConfigurationSettings(); diff --git a/pcbnew/basepcbframe.cpp b/pcbnew/basepcbframe.cpp index c52463846b..6f076ae8a9 100644 --- a/pcbnew/basepcbframe.cpp +++ b/pcbnew/basepcbframe.cpp @@ -753,20 +753,14 @@ void PCB_BASE_FRAME::LoadSettings( wxConfigBase* aCfg ) aCfg->Read( m_FrameName + DisplayPadFillEntry, &m_DisplayOptions.m_DisplayPadFill, true ); aCfg->Read( m_FrameName + DisplayViaFillEntry, &m_DisplayOptions.m_DisplayViaFill, true ); aCfg->Read( m_FrameName + DisplayPadNumberEntry, &m_DisplayOptions.m_DisplayPadNum, true ); - aCfg->Read( m_FrameName + DisplayModuleEdgeEntry, &m_DisplayOptions.m_DisplayModEdge, ( long )FILLED ); + aCfg->Read( m_FrameName + DisplayModuleEdgeEntry, &m_DisplayOptions.m_DisplayModEdgeFill, true ); aCfg->Read( m_FrameName + FastGrid1Entry, &itmp, ( long )0); m_FastGrid1 = itmp; aCfg->Read( m_FrameName + FastGrid2Entry, &itmp, ( long )0); m_FastGrid2 = itmp; - if( m_DisplayOptions.m_DisplayModEdge < LINE || m_DisplayOptions.m_DisplayModEdge > SKETCH ) - m_DisplayOptions.m_DisplayModEdge = FILLED; - - aCfg->Read( m_FrameName + DisplayModuleTextEntry, &m_DisplayOptions.m_DisplayModText, ( long )FILLED ); - - if( m_DisplayOptions.m_DisplayModText < LINE || m_DisplayOptions.m_DisplayModText > SKETCH ) - m_DisplayOptions.m_DisplayModText = FILLED; + aCfg->Read( m_FrameName + DisplayModuleTextEntry, &m_DisplayOptions.m_DisplayModTextFill, true ); } @@ -780,8 +774,8 @@ void PCB_BASE_FRAME::SaveSettings( wxConfigBase* aCfg ) aCfg->Write( m_FrameName + DisplayPadFillEntry, m_DisplayOptions.m_DisplayPadFill ); aCfg->Write( m_FrameName + DisplayViaFillEntry, m_DisplayOptions.m_DisplayViaFill ); aCfg->Write( m_FrameName + DisplayPadNumberEntry, m_DisplayOptions.m_DisplayPadNum ); - aCfg->Write( m_FrameName + DisplayModuleEdgeEntry, ( long )m_DisplayOptions.m_DisplayModEdge ); - aCfg->Write( m_FrameName + DisplayModuleTextEntry, ( long )m_DisplayOptions.m_DisplayModText ); + aCfg->Write( m_FrameName + DisplayModuleEdgeEntry, m_DisplayOptions.m_DisplayModEdgeFill ); + aCfg->Write( m_FrameName + DisplayModuleTextEntry, m_DisplayOptions.m_DisplayModTextFill ); aCfg->Write( m_FrameName + FastGrid1Entry, ( long )m_FastGrid1 ); aCfg->Write( m_FrameName + FastGrid2Entry, ( long )m_FastGrid2 ); } diff --git a/pcbnew/class_dimension.cpp b/pcbnew/class_dimension.cpp index af6f420f76..cda4b71afd 100644 --- a/pcbnew/class_dimension.cpp +++ b/pcbnew/class_dimension.cpp @@ -334,7 +334,6 @@ void DIMENSION::AdjustDimensionDetails( bool aDoNotChangeText ) void DIMENSION::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE mode_color, const wxPoint& offset ) { - int typeaff, width; EDA_COLOR_T gcolor; BOARD* brd = GetBoard(); @@ -347,18 +346,11 @@ void DIMENSION::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE mode_color, GRSetDrawMode( DC, mode_color ); DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)panel->GetDisplayOptions(); - typeaff = displ_opts ? displ_opts->m_DisplayDrawItems : FILLED; - width = m_Width; + bool filled = displ_opts ? displ_opts->m_DisplayDrawItemsFill : FILLED; + int width = m_Width; - if( DC->LogicalToDeviceXRel( width ) <= MIN_DRAW_WIDTH ) - typeaff = LINE; - - switch( typeaff ) + if( filled ) { - case LINE: - width = 0; - - case FILLED: GRLine( panel->GetClipBox(), DC, m_crossBarO + offset, m_crossBarF + offset, width, gcolor ); GRLine( panel->GetClipBox(), DC, m_featureLineGO + offset, @@ -373,9 +365,9 @@ void DIMENSION::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE mode_color, m_arrowG1F + offset, width, gcolor ); GRLine( panel->GetClipBox(), DC, m_crossBarO + offset, m_arrowG2F + offset, width, gcolor ); - break; - - case SKETCH: + } + else + { GRCSegm( panel->GetClipBox(), DC, m_crossBarO + offset, m_crossBarF + offset, width, gcolor ); GRCSegm( panel->GetClipBox(), DC, m_featureLineGO + offset, @@ -390,7 +382,6 @@ void DIMENSION::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE mode_color, m_arrowG1F + offset, width, gcolor ); GRCSegm( panel->GetClipBox(), DC, m_crossBarO + offset, m_arrowG2F + offset, width, gcolor ); - break; } } diff --git a/pcbnew/class_drawsegment.cpp b/pcbnew/class_drawsegment.cpp index e19f2792ea..2ff4342e29 100644 --- a/pcbnew/class_drawsegment.cpp +++ b/pcbnew/class_drawsegment.cpp @@ -170,7 +170,6 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, { int ux0, uy0, dx, dy; int l_trace; - int mode; int radius; LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; @@ -202,31 +201,24 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, dx = m_End.x + aOffset.x; dy = m_End.y + aOffset.y; - mode = displ_opts ? displ_opts->m_DisplayDrawItems : FILLED; + bool filled = displ_opts ? displ_opts->m_DisplayDrawItemsFill : FILLED; if( m_Flags & FORCE_SKETCH ) - mode = SKETCH; - - if( DC->LogicalToDeviceXRel( l_trace ) <= MIN_DRAW_WIDTH ) - mode = LINE; + filled = SKETCH; switch( m_Shape ) { case S_CIRCLE: radius = KiROUND( Distance( ux0, uy0, dx, dy ) ); - if( mode == LINE ) + if( filled ) { - GRCircle( panel->GetClipBox(), DC, ux0, uy0, radius, color ); - } - else if( mode == SKETCH ) - { - GRCircle( panel->GetClipBox(), DC, ux0, uy0, radius - l_trace, color ); - GRCircle( panel->GetClipBox(), DC, ux0, uy0, radius + l_trace, color ); + GRCircle( panel->GetClipBox(), DC, ux0, uy0, radius, m_Width, color ); } else { - GRCircle( panel->GetClipBox(), DC, ux0, uy0, radius, m_Width, color ); + GRCircle( panel->GetClipBox(), DC, ux0, uy0, radius - l_trace, color ); + GRCircle( panel->GetClipBox(), DC, ux0, uy0, radius + l_trace, color ); } break; @@ -248,22 +240,19 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, EXCHG( StAngle, EndAngle ); } - if( mode == LINE ) + if( filled ) { - GRArc( panel->GetClipBox(), DC, ux0, uy0, StAngle, EndAngle, radius, color ); + GRArc( panel->GetClipBox(), DC, ux0, uy0, StAngle, EndAngle, + radius, m_Width, color ); } - else if( mode == SKETCH ) + else { GRArc( panel->GetClipBox(), DC, ux0, uy0, StAngle, EndAngle, radius - l_trace, color ); GRArc( panel->GetClipBox(), DC, ux0, uy0, StAngle, EndAngle, radius + l_trace, color ); } - else - { - GRArc( panel->GetClipBox(), DC, ux0, uy0, StAngle, EndAngle, - radius, m_Width, color ); - } + break; case S_CURVE: @@ -271,43 +260,32 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, for( unsigned int i=1; i < m_BezierPoints.size(); i++ ) { - if( mode == LINE ) - { - GRLine( panel->GetClipBox(), DC, - m_BezierPoints[i].x, m_BezierPoints[i].y, - m_BezierPoints[i-1].x, m_BezierPoints[i-1].y, 0, - color ); - } - else if( mode == SKETCH ) - { - GRCSegm( panel->GetClipBox(), DC, - m_BezierPoints[i].x, m_BezierPoints[i].y, - m_BezierPoints[i-1].x, m_BezierPoints[i-1].y, - m_Width, color ); - } - else + if( filled ) { GRFillCSegm( panel->GetClipBox(), DC, m_BezierPoints[i].x, m_BezierPoints[i].y, m_BezierPoints[i-1].x, m_BezierPoints[i-1].y, m_Width, color ); } + else + { + GRCSegm( panel->GetClipBox(), DC, + m_BezierPoints[i].x, m_BezierPoints[i].y, + m_BezierPoints[i-1].x, m_BezierPoints[i-1].y, + m_Width, color ); + } } break; default: - if( mode == LINE ) + if( filled ) { - GRLine( panel->GetClipBox(), DC, ux0, uy0, dx, dy, 0, color ); - } - else if( mode == SKETCH ) - { - GRCSegm( panel->GetClipBox(), DC, ux0, uy0, dx, dy, m_Width, color ); + GRFillCSegm( panel->GetClipBox(), DC, ux0, uy0, dx, dy, m_Width, color ); } else { - GRFillCSegm( panel->GetClipBox(), DC, ux0, uy0, dx, dy, m_Width, color ); + GRCSegm( panel->GetClipBox(), DC, ux0, uy0, dx, dy, m_Width, color ); } break; diff --git a/pcbnew/class_edge_mod.cpp b/pcbnew/class_edge_mod.cpp index 018ea36653..cb4aedc191 100644 --- a/pcbnew/class_edge_mod.cpp +++ b/pcbnew/class_edge_mod.cpp @@ -130,7 +130,6 @@ void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, const wxPoint& offset ) { int ux0, uy0, dx, dy, radius, StAngle, EndAngle; - int typeaff; LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; MODULE* module = (MODULE*) m_Parent; @@ -159,25 +158,15 @@ void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, dy = m_End.y - offset.y; GRSetDrawMode( DC, draw_mode ); - typeaff = displ_opts ? displ_opts->m_DisplayModEdge : FILLED; + bool filled = displ_opts ? displ_opts->m_DisplayModEdgeFill : FILLED; if( IsCopperLayer( m_Layer ) ) - { - typeaff = displ_opts ? displ_opts->m_DisplayPcbTrackFill : FILLED; - - if( !typeaff ) - typeaff = SKETCH; - } - - if( DC->LogicalToDeviceXRel( m_Width ) <= MIN_DRAW_WIDTH ) - typeaff = LINE; + filled = displ_opts ? displ_opts->m_DisplayPcbTrackFill : FILLED; switch( m_Shape ) { case S_SEGMENT: - if( typeaff == LINE ) - GRLine( panel->GetClipBox(), DC, ux0, uy0, dx, dy, 0, color ); - else if( typeaff == FILLED ) + if( filled ) GRLine( panel->GetClipBox(), DC, ux0, uy0, dx, dy, m_Width, color ); else // SKETCH Mode @@ -188,21 +177,14 @@ void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, case S_CIRCLE: radius = KiROUND( Distance( ux0, uy0, dx, dy ) ); - if( typeaff == LINE ) + if( filled ) { - GRCircle( panel->GetClipBox(), DC, ux0, uy0, radius, color ); + GRCircle( panel->GetClipBox(), DC, ux0, uy0, radius, m_Width, color ); } - else + else // SKETCH Mode { - if( typeaff == FILLED ) - { - GRCircle( panel->GetClipBox(), DC, ux0, uy0, radius, m_Width, color ); - } - else // SKETCH Mode - { - GRCircle( panel->GetClipBox(), DC, ux0, uy0, radius + (m_Width / 2), color ); - GRCircle( panel->GetClipBox(), DC, ux0, uy0, radius - (m_Width / 2), color ); - } + GRCircle( panel->GetClipBox(), DC, ux0, uy0, radius + (m_Width / 2), color ); + GRCircle( panel->GetClipBox(), DC, ux0, uy0, radius - (m_Width / 2), color ); } break; @@ -223,11 +205,7 @@ void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, EXCHG( StAngle, EndAngle ); } - if( typeaff == LINE ) - { - GRArc( panel->GetClipBox(), DC, ux0, uy0, StAngle, EndAngle, radius, color ); - } - else if( typeaff == FILLED ) + if( filled ) { GRArc( panel->GetClipBox(), DC, ux0, uy0, StAngle, EndAngle, radius, m_Width, color ); } diff --git a/pcbnew/class_mire.cpp b/pcbnew/class_mire.cpp index 8e63f5f275..6c1c2921a7 100644 --- a/pcbnew/class_mire.cpp +++ b/pcbnew/class_mire.cpp @@ -89,7 +89,6 @@ void PCB_TARGET::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE mode_color, { int radius, ox, oy, width; int dx1, dx2, dy1, dy2; - int typeaff; ox = m_Pos.x + offset.x; oy = m_Pos.y + offset.y; @@ -103,29 +102,20 @@ void PCB_TARGET::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE mode_color, GRSetDrawMode( DC, mode_color ); DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)panel->GetDisplayOptions(); - typeaff = displ_opts ? displ_opts->m_DisplayDrawItems : FILLED; + bool filled = displ_opts ? displ_opts->m_DisplayDrawItemsFill : FILLED; width = m_Width; - if( DC->LogicalToDeviceXRel( width ) <= MIN_DRAW_WIDTH ) - typeaff = LINE; - radius = m_Size / 3; + if( GetShape() ) // shape X radius = m_Size / 2; - switch( typeaff ) - { - case LINE: - width = 0; - - case FILLED: + if( filled ) GRCircle( panel->GetClipBox(), DC, ox, oy, radius, width, gcolor ); - break; - - case SKETCH: + else + { GRCircle( panel->GetClipBox(), DC, ox, oy, radius + (width / 2), gcolor ); GRCircle( panel->GetClipBox(), DC, ox, oy, radius - (width / 2), gcolor ); - break; } @@ -142,18 +132,15 @@ void PCB_TARGET::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE mode_color, dy2 = -dy1; } - switch( typeaff ) + if( filled ) { - case LINE: - case FILLED: GRLine( panel->GetClipBox(), DC, ox - dx1, oy - dy1, ox + dx1, oy + dy1, width, gcolor ); GRLine( panel->GetClipBox(), DC, ox - dx2, oy - dy2, ox + dx2, oy + dy2, width, gcolor ); - break; - - case SKETCH: + } + else + { GRCSegm( panel->GetClipBox(), DC, ox - dx1, oy - dy1, ox + dx1, oy + dy1, width, gcolor ); GRCSegm( panel->GetClipBox(), DC, ox - dx2, oy - dy2, ox + dx2, oy + dy2, width, gcolor ); - break; } } diff --git a/pcbnew/class_pcb_text.cpp b/pcbnew/class_pcb_text.cpp index bedc597e55..12c86fa565 100644 --- a/pcbnew/class_pcb_text.cpp +++ b/pcbnew/class_pcb_text.cpp @@ -93,7 +93,7 @@ void TEXTE_PCB::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, EDA_DRAW_MODE_T fillmode = FILLED; DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)panel->GetDisplayOptions(); - if( displ_opts && displ_opts->m_DisplayDrawItems == SKETCH ) + if( displ_opts && displ_opts->m_DisplayDrawItemsFill == SKETCH ) fillmode = SKETCH; EDA_COLOR_T anchor_color = UNSPECIFIED_COLOR; diff --git a/pcbnew/class_text_mod.cpp b/pcbnew/class_text_mod.cpp index 91fad64a4f..c698aba4b5 100644 --- a/pcbnew/class_text_mod.cpp +++ b/pcbnew/class_text_mod.cpp @@ -268,6 +268,7 @@ void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, * hiding. * If the whole module side is disabled this isn't even called */ LAYER_ID text_layer = GetLayer(); + if( (IsFrontLayer( text_layer ) && !brd->IsElementVisible( MOD_TEXT_FR_VISIBLE )) || (IsBackLayer( text_layer ) && !brd->IsElementVisible( MOD_TEXT_BK_VISIBLE )) ) return; @@ -289,10 +290,8 @@ void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, // Draw mode compensation for the width DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)panel->GetDisplayOptions(); int width = m_Thickness; - if( ( displ_opts && displ_opts->m_DisplayModText == LINE ) - || ( DC->LogicalToDeviceXRel( width ) <= MIN_DRAW_WIDTH ) ) - width = 0; - else if( displ_opts && displ_opts->m_DisplayModText == SKETCH ) + + if( displ_opts && displ_opts->m_DisplayModTextFill == SKETCH ) width = -width; GRSetDrawMode( DC, draw_mode ); diff --git a/pcbnew/classpcb.cpp b/pcbnew/classpcb.cpp index a1430fc600..da1127dc61 100644 --- a/pcbnew/classpcb.cpp +++ b/pcbnew/classpcb.cpp @@ -202,16 +202,16 @@ int PCB_SCREEN::MilsToIuScalar() DISPLAY_OPTIONS::DISPLAY_OPTIONS() { - m_DisplayPadFill = FILLED; - m_DisplayViaFill = FILLED; + m_DisplayPadFill = FILLED; + m_DisplayViaFill = FILLED; m_DisplayPadNum = true; m_DisplayPadIsol = true; - m_DisplayModEdge = true; - m_DisplayModText = true; - m_DisplayPcbTrackFill = true; // false = sketch , true = filled + m_DisplayModEdgeFill = FILLED; + m_DisplayModTextFill = FILLED; + m_DisplayPcbTrackFill = FILLED; // false = sketch , true = filled m_ShowTrackClearanceMode = SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS; - m_DisplayViaMode = VIA_HOLE_NOT_SHOW; + m_DisplayViaMode = VIA_HOLE_NOT_SHOW; m_DisplayPolarCood = false; /* false = display absolute coordinates, * true = display polar cordinates */ @@ -222,7 +222,7 @@ DISPLAY_OPTIONS::DISPLAY_OPTIONS() * 1 show netnames on pads * 2 show netnames on tracks * 3 show netnames on tracks and pads */ - m_DisplayDrawItems = true; + m_DisplayDrawItemsFill = FILLED; m_ContrastModeDisplay = false; m_MaxLinksShowed = 3; // in track creation: number of hairwires shown m_Show_Module_Ratsnest = true; // When moving a footprint: allows displaying a ratsnest diff --git a/pcbnew/dialogs/dialog_display_options.cpp b/pcbnew/dialogs/dialog_display_options.cpp index a452bc5747..283be865c9 100644 --- a/pcbnew/dialogs/dialog_display_options.cpp +++ b/pcbnew/dialogs/dialog_display_options.cpp @@ -5,8 +5,8 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2014 Jean-Pierre Charras, jean-pierre.charras at wanadoo.fr - * Copyright (C) 1992-2014 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2015 Jean-Pierre Charras, jean-pierre.charras at wanadoo.fr + * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -61,7 +61,7 @@ DIALOG_DISPLAY_OPTIONS::DIALOG_DISPLAY_OPTIONS( PCB_EDIT_FRAME* parent ) : init(); - m_buttonOK->SetDefault(); + m_sdbSizerOK->SetDefault(); GetSizer()->SetSizeHints( this ); } @@ -70,10 +70,7 @@ void DIALOG_DISPLAY_OPTIONS::init() SetFocus(); DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)m_Parent->GetDisplayOptions(); - if ( displ_opts->m_DisplayPcbTrackFill ) - m_OptDisplayTracks->SetSelection( 1 ); - else - m_OptDisplayTracks->SetSelection( 0 ); + m_OptDisplayTracks->SetValue( displ_opts->m_DisplayPcbTrackFill == SKETCH ); switch ( displ_opts->m_ShowTrackClearanceMode ) { @@ -99,25 +96,18 @@ void DIALOG_DISPLAY_OPTIONS::init() break; } - if ( displ_opts->m_DisplayPadFill ) - m_OptDisplayPads->SetSelection( 1 ); - else - m_OptDisplayPads->SetSelection( 0 ); + m_OptDisplayPads->SetValue( displ_opts->m_DisplayPadFill == SKETCH ); + m_OptDisplayVias->SetValue( displ_opts->m_DisplayViaFill == SKETCH ); - if ( displ_opts->m_DisplayViaFill ) - m_OptDisplayVias->SetSelection( 1 ); - else - m_OptDisplayVias->SetSelection( 0 ); - - m_Show_Page_Limits->SetSelection( m_Parent->ShowPageLimits() ? 0 : 1 ); + m_Show_Page_Limits->SetValue( m_Parent->ShowPageLimits() ); m_OptDisplayViaHole->SetSelection( displ_opts->m_DisplayViaMode ); - m_OptDisplayModTexts->SetSelection( displ_opts->m_DisplayModText ); - m_OptDisplayModEdges->SetSelection( displ_opts->m_DisplayModEdge ); + m_OptDisplayModTexts->SetValue( displ_opts->m_DisplayModTextFill == SKETCH ); + m_OptDisplayModOutlines->SetValue( displ_opts->m_DisplayModEdgeFill == SKETCH ); m_OptDisplayPadClearence->SetValue( displ_opts->m_DisplayPadIsol ); m_OptDisplayPadNumber->SetValue( displ_opts->m_DisplayPadNum ); m_OptDisplayPadNoConn->SetValue( m_Parent->IsElementVisible( PCB_VISIBLE( NO_CONNECTS_VISIBLE ) ) ); - m_OptDisplayDrawings->SetSelection( displ_opts->m_DisplayDrawItems ); + m_OptDisplayDrawings->SetValue( displ_opts->m_DisplayDrawItemsFill == SKETCH ); m_ShowNetNamesOption->SetSelection( displ_opts->m_DisplayNetNamesMode ); } @@ -134,12 +124,9 @@ void DIALOG_DISPLAY_OPTIONS::OnOkClick(wxCommandEvent& event) { DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)m_Parent->GetDisplayOptions(); - if ( m_Show_Page_Limits->GetSelection() == 0 ) - m_Parent->SetShowPageLimits( true ); - else - m_Parent->SetShowPageLimits( false ); + m_Parent->SetShowPageLimits( m_Show_Page_Limits->GetValue() ); - displ_opts->m_DisplayPcbTrackFill = m_OptDisplayTracks->GetSelection() == 1; + displ_opts->m_DisplayPcbTrackFill = not m_OptDisplayTracks->GetValue(); displ_opts->m_DisplayViaMode = (VIA_DISPLAY_MODE_T) m_OptDisplayViaHole->GetSelection(); @@ -166,11 +153,11 @@ void DIALOG_DISPLAY_OPTIONS::OnOkClick(wxCommandEvent& event) break; } - displ_opts->m_DisplayModText = m_OptDisplayModTexts->GetSelection(); - displ_opts->m_DisplayModEdge = m_OptDisplayModEdges->GetSelection(); + displ_opts->m_DisplayModTextFill = not m_OptDisplayModTexts->GetValue(); + displ_opts->m_DisplayModEdgeFill = not m_OptDisplayModOutlines->GetValue(); - displ_opts->m_DisplayPadFill = m_OptDisplayPads->GetSelection() == 1; - displ_opts->m_DisplayViaFill = m_OptDisplayVias->GetSelection() == 1; + displ_opts->m_DisplayPadFill = not m_OptDisplayPads->GetValue(); + displ_opts->m_DisplayViaFill = not m_OptDisplayVias->GetValue(); displ_opts->m_DisplayPadIsol = m_OptDisplayPadClearence->GetValue(); @@ -179,7 +166,7 @@ void DIALOG_DISPLAY_OPTIONS::OnOkClick(wxCommandEvent& event) m_Parent->SetElementVisibility( PCB_VISIBLE(NO_CONNECTS_VISIBLE), m_OptDisplayPadNoConn->GetValue() ); - displ_opts->m_DisplayDrawItems = m_OptDisplayDrawings->GetSelection(); + displ_opts->m_DisplayDrawItemsFill = not m_OptDisplayDrawings->GetValue(); displ_opts->m_DisplayNetNamesMode = m_ShowNetNamesOption->GetSelection(); // Apply changes to the GAL diff --git a/pcbnew/dialogs/dialog_display_options_base.cpp b/pcbnew/dialogs/dialog_display_options_base.cpp index bd26aff8f9..10c4c7ac5c 100644 --- a/pcbnew/dialogs/dialog_display_options_base.cpp +++ b/pcbnew/dialogs/dialog_display_options_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jun 6 2014) +// C++ code generated with wxFormBuilder (version Jun 5 2014) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -14,24 +14,19 @@ DIALOG_DISPLAY_OPTIONS_BASE::DIALOG_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWi this->SetSizeHints( wxDefaultSize, wxDefaultSize ); wxBoxSizer* bMainSizer; - bMainSizer = new wxBoxSizer( wxHORIZONTAL ); + bMainSizer = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bupperSizer; + bupperSizer = new wxBoxSizer( wxHORIZONTAL ); wxStaticBoxSizer* sLeftBoxSizer; sLeftBoxSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Tracks and vias:") ), wxVERTICAL ); - wxString m_OptDisplayTracksChoices[] = { _("Sketch"), _("Filled") }; - int m_OptDisplayTracksNChoices = sizeof( m_OptDisplayTracksChoices ) / sizeof( wxString ); - m_OptDisplayTracks = new wxRadioBox( this, wxID_DISPLAY_TRACK, _("Tracks:"), wxDefaultPosition, wxDefaultSize, m_OptDisplayTracksNChoices, m_OptDisplayTracksChoices, 1, wxRA_SPECIFY_COLS ); - m_OptDisplayTracks->SetSelection( 1 ); - m_OptDisplayTracks->SetToolTip( _("Select how tracks are displayed") ); + m_OptDisplayTracks = new wxCheckBox( this, wxID_ANY, _("Tracks sketch mode"), wxDefaultPosition, wxDefaultSize, 0 ); + sLeftBoxSizer->Add( m_OptDisplayTracks, 0, wxALL, 5 ); - sLeftBoxSizer->Add( m_OptDisplayTracks, 0, wxALL|wxEXPAND, 5 ); - - wxString m_OptDisplayViasChoices[] = { _("Sketch"), _("Filled") }; - int m_OptDisplayViasNChoices = sizeof( m_OptDisplayViasChoices ) / sizeof( wxString ); - m_OptDisplayVias = new wxRadioBox( this, ID_VIAS_SHAPES, _("Via Shapes:"), wxDefaultPosition, wxDefaultSize, m_OptDisplayViasNChoices, m_OptDisplayViasChoices, 1, wxRA_SPECIFY_COLS ); - m_OptDisplayVias->SetSelection( 1 ); - sLeftBoxSizer->Add( m_OptDisplayVias, 0, wxALL|wxEXPAND, 5 ); + m_OptDisplayVias = new wxCheckBox( this, wxID_ANY, _("Vias sketch mode"), wxDefaultPosition, wxDefaultSize, 0 ); + sLeftBoxSizer->Add( m_OptDisplayVias, 0, wxALL, 5 ); wxString m_OptDisplayViaHoleChoices[] = { _("Never"), _("Defined holes"), _("Always") }; int m_OptDisplayViaHoleNChoices = sizeof( m_OptDisplayViaHoleChoices ) / sizeof( wxString ); @@ -39,10 +34,10 @@ DIALOG_DISPLAY_OPTIONS_BASE::DIALOG_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWi m_OptDisplayViaHole->SetSelection( 1 ); m_OptDisplayViaHole->SetToolTip( _("Show (or not) via holes.\nIf Defined Holes is selected, only the non default size holes are shown") ); - sLeftBoxSizer->Add( m_OptDisplayViaHole, 0, wxALL|wxEXPAND, 5 ); + sLeftBoxSizer->Add( m_OptDisplayViaHole, 1, wxALL|wxEXPAND, 5 ); - bMainSizer->Add( sLeftBoxSizer, 0, wxEXPAND|wxALL, 5 ); + bupperSizer->Add( sLeftBoxSizer, 0, wxEXPAND|wxALL, 5 ); wxStaticBoxSizer* sbMiddleLeftSizer; sbMiddleLeftSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Routing help:") ), wxVERTICAL ); @@ -53,7 +48,7 @@ DIALOG_DISPLAY_OPTIONS_BASE::DIALOG_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWi m_ShowNetNamesOption->SetSelection( 3 ); m_ShowNetNamesOption->SetToolTip( _("Show or not net names on pads and/or tracks") ); - sbMiddleLeftSizer->Add( m_ShowNetNamesOption, 0, wxALL, 5 ); + sbMiddleLeftSizer->Add( m_ShowNetNamesOption, 1, wxALL|wxEXPAND, 5 ); wxString m_OptDisplayTracksClearanceChoices[] = { _("Never"), _("New track"), _("New track with via area"), _("New and edited tracks with via area"), _("Always") }; int m_OptDisplayTracksClearanceNChoices = sizeof( m_OptDisplayTracksClearanceChoices ) / sizeof( wxString ); @@ -61,104 +56,87 @@ DIALOG_DISPLAY_OPTIONS_BASE::DIALOG_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWi m_OptDisplayTracksClearance->SetSelection( 3 ); m_OptDisplayTracksClearance->SetToolTip( _("Show( or not) tracks clearance area.\nIf New track is selected, track clearance area is shown only when creating the track.") ); - sbMiddleLeftSizer->Add( m_OptDisplayTracksClearance, 0, wxALL|wxEXPAND, 5 ); + sbMiddleLeftSizer->Add( m_OptDisplayTracksClearance, 1, wxALL|wxEXPAND, 5 ); - bMainSizer->Add( sbMiddleLeftSizer, 0, wxALL|wxEXPAND, 5 ); + bupperSizer->Add( sbMiddleLeftSizer, 0, wxALL|wxEXPAND, 5 ); - wxStaticBoxSizer* sMiddleRightSizer; - sMiddleRightSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Footprints:") ), wxHORIZONTAL ); + wxBoxSizer* b_rightSizer; + b_rightSizer = new wxBoxSizer( wxVERTICAL ); - wxBoxSizer* bLModuleSizer; - bLModuleSizer = new wxBoxSizer( wxVERTICAL ); + wxStaticBoxSizer* sfootprintSizer; + sfootprintSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Footprints:") ), wxVERTICAL ); - wxString m_OptDisplayModEdgesChoices[] = { _("Line"), _("Filled"), _("Sketch") }; - int m_OptDisplayModEdgesNChoices = sizeof( m_OptDisplayModEdgesChoices ) / sizeof( wxString ); - m_OptDisplayModEdges = new wxRadioBox( this, ID_EDGES_MODULES, _("Footprint Edges:"), wxDefaultPosition, wxDefaultSize, m_OptDisplayModEdgesNChoices, m_OptDisplayModEdgesChoices, 1, wxRA_SPECIFY_COLS ); - m_OptDisplayModEdges->SetSelection( 1 ); - bLModuleSizer->Add( m_OptDisplayModEdges, 0, wxALL|wxEXPAND, 5 ); + m_OptDisplayModOutlines = new wxCheckBox( this, wxID_ANY, _("Outlines sketch mode"), wxDefaultPosition, wxDefaultSize, 0 ); + sfootprintSizer->Add( m_OptDisplayModOutlines, 0, wxALL, 5 ); - wxString m_OptDisplayModTextsChoices[] = { _("Line"), _("Filled"), _("Sketch") }; - int m_OptDisplayModTextsNChoices = sizeof( m_OptDisplayModTextsChoices ) / sizeof( wxString ); - m_OptDisplayModTexts = new wxRadioBox( this, ID_TEXT_MODULES, _("Texts:"), wxDefaultPosition, wxDefaultSize, m_OptDisplayModTextsNChoices, m_OptDisplayModTextsChoices, 1, wxRA_SPECIFY_COLS ); - m_OptDisplayModTexts->SetSelection( 1 ); - bLModuleSizer->Add( m_OptDisplayModTexts, 0, wxALL|wxEXPAND, 5 ); + m_OptDisplayModTexts + = new wxCheckBox( this, wxID_ANY, _("Texts sketch mode"), wxDefaultPosition, wxDefaultSize, 0 ); + sfootprintSizer->Add( m_OptDisplayModTexts + , 0, wxALL, 5 ); - - sMiddleRightSizer->Add( bLModuleSizer, 0, 0, 5 ); - - wxStaticBoxSizer* bRModuleSizer; - bRModuleSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Pad Options:") ), wxVERTICAL ); - - wxString m_OptDisplayPadsChoices[] = { _("Sketch"), _("Filled") }; - int m_OptDisplayPadsNChoices = sizeof( m_OptDisplayPadsChoices ) / sizeof( wxString ); - m_OptDisplayPads = new wxRadioBox( this, ID_PADS_SHAPES, _("Pad Shapes:"), wxDefaultPosition, wxDefaultSize, m_OptDisplayPadsNChoices, m_OptDisplayPadsChoices, 1, wxRA_SPECIFY_COLS ); - m_OptDisplayPads->SetSelection( 1 ); - bRModuleSizer->Add( m_OptDisplayPads, 0, wxALL|wxEXPAND, 5 ); + m_OptDisplayPads = new wxCheckBox( this, wxID_ANY, _("Pads sketch mode"), wxDefaultPosition, wxDefaultSize, 0 ); + sfootprintSizer->Add( m_OptDisplayPads, 0, wxALL, 5 ); m_OptDisplayPadClearence = new wxCheckBox( this, wxID_ANY, _("Show pad clearance"), wxDefaultPosition, wxDefaultSize, 0 ); - bRModuleSizer->Add( m_OptDisplayPadClearence, 0, wxALL, 5 ); + sfootprintSizer->Add( m_OptDisplayPadClearence, 0, wxALL, 5 ); m_OptDisplayPadNumber = new wxCheckBox( this, wxID_ANY, _("Show pad number"), wxDefaultPosition, wxDefaultSize, 0 ); m_OptDisplayPadNumber->SetValue(true); - bRModuleSizer->Add( m_OptDisplayPadNumber, 0, wxALL, 5 ); + sfootprintSizer->Add( m_OptDisplayPadNumber, 0, wxALL, 5 ); m_OptDisplayPadNoConn = new wxCheckBox( this, wxID_ANY, _("Show pad NoConnect"), wxDefaultPosition, wxDefaultSize, 0 ); m_OptDisplayPadNoConn->SetValue(true); - bRModuleSizer->Add( m_OptDisplayPadNoConn, 0, wxALL, 5 ); + sfootprintSizer->Add( m_OptDisplayPadNoConn, 0, wxALL, 5 ); - sMiddleRightSizer->Add( bRModuleSizer, 0, 0, 5 ); + b_rightSizer->Add( sfootprintSizer, 0, wxEXPAND|wxALL, 5 ); + + wxStaticBoxSizer* s_otherSizer; + s_otherSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Others:") ), wxVERTICAL ); + + m_OptDisplayDrawings = new wxCheckBox( this, wxID_ANY, _("Graphic items sketch mode"), wxDefaultPosition, wxDefaultSize, 0 ); + m_OptDisplayDrawings->SetValue(true); + s_otherSizer->Add( m_OptDisplayDrawings, 0, wxALL, 5 ); + + m_Show_Page_Limits = new wxCheckBox( this, wxID_ANY, _("Show page limits"), wxDefaultPosition, wxDefaultSize, 0 ); + m_Show_Page_Limits->SetValue(true); + s_otherSizer->Add( m_Show_Page_Limits, 0, wxALL, 5 ); - bMainSizer->Add( sMiddleRightSizer, 0, wxEXPAND|wxALL, 5 ); - - wxBoxSizer* bRightSizer; - bRightSizer = new wxBoxSizer( wxVERTICAL ); - - wxStaticBoxSizer* sRightUpperSizer; - sRightUpperSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Others:") ), wxVERTICAL ); - - wxString m_OptDisplayDrawingsChoices[] = { _("Line"), _("Filled"), _("Sketch") }; - int m_OptDisplayDrawingsNChoices = sizeof( m_OptDisplayDrawingsChoices ) / sizeof( wxString ); - m_OptDisplayDrawings = new wxRadioBox( this, wxID_ANY, _("Display other items:"), wxDefaultPosition, wxDefaultSize, m_OptDisplayDrawingsNChoices, m_OptDisplayDrawingsChoices, 1, wxRA_SPECIFY_COLS ); - m_OptDisplayDrawings->SetSelection( 1 ); - sRightUpperSizer->Add( m_OptDisplayDrawings, 0, wxALL|wxEXPAND, 5 ); - - wxString m_Show_Page_LimitsChoices[] = { _("Yes"), _("No") }; - int m_Show_Page_LimitsNChoices = sizeof( m_Show_Page_LimitsChoices ) / sizeof( wxString ); - m_Show_Page_Limits = new wxRadioBox( this, wxID_ANY, _("Show page limits"), wxDefaultPosition, wxDefaultSize, m_Show_Page_LimitsNChoices, m_Show_Page_LimitsChoices, 1, wxRA_SPECIFY_COLS ); - m_Show_Page_Limits->SetSelection( 1 ); - sRightUpperSizer->Add( m_Show_Page_Limits, 0, wxALL|wxEXPAND, 5 ); + b_rightSizer->Add( s_otherSizer, 1, wxEXPAND|wxALL, 5 ); - bRightSizer->Add( sRightUpperSizer, 1, wxEXPAND, 5 ); + bupperSizer->Add( b_rightSizer, 0, 0, 5 ); - bRightSizer->Add( 10, 10, 0, 0, 5 ); + bMainSizer->Add( bupperSizer, 1, wxEXPAND, 5 ); - m_buttonOK = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 ); - bRightSizer->Add( m_buttonOK, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); + m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bMainSizer->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 ); - m_buttonCANCEL = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); - bRightSizer->Add( m_buttonCANCEL, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); + m_sdbSizer = new wxStdDialogButtonSizer(); + m_sdbSizerOK = new wxButton( this, wxID_OK ); + m_sdbSizer->AddButton( m_sdbSizerOK ); + m_sdbSizerCancel = new wxButton( this, wxID_CANCEL ); + m_sdbSizer->AddButton( m_sdbSizerCancel ); + m_sdbSizer->Realize(); - - bMainSizer->Add( bRightSizer, 0, wxEXPAND|wxALL, 5 ); + bMainSizer->Add( m_sdbSizer, 0, wxEXPAND|wxALL, 5 ); this->SetSizer( bMainSizer ); this->Layout(); // Connect Events - m_buttonOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnOkClick ), NULL, this ); - m_buttonCANCEL->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnCancelClick ), NULL, this ); + m_sdbSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnCancelClick ), NULL, this ); + m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnOkClick ), NULL, this ); } DIALOG_DISPLAY_OPTIONS_BASE::~DIALOG_DISPLAY_OPTIONS_BASE() { // Disconnect Events - m_buttonOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnOkClick ), NULL, this ); - m_buttonCANCEL->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnCancelClick ), NULL, this ); + m_sdbSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnCancelClick ), NULL, this ); + m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnOkClick ), NULL, this ); } diff --git a/pcbnew/dialogs/dialog_display_options_base.fbp b/pcbnew/dialogs/dialog_display_options_base.fbp index 0111ef1e2c..6a98fabb62 100644 --- a/pcbnew/dialogs/dialog_display_options_base.fbp +++ b/pcbnew/dialogs/dialog_display_options_base.fbp @@ -44,7 +44,7 @@ DIALOG_DISPLAY_OPTIONS_BASE - 880,320 + 562,361 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER DIALOG_SHIM; dialog_shim.h Display options @@ -91,706 +91,34 @@ bMainSizer - wxHORIZONTAL + wxVERTICAL none 5 - wxEXPAND|wxALL - 0 - - wxID_ANY - Tracks and vias: + wxEXPAND + 1 + - sLeftBoxSizer - wxVERTICAL - none - - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - "Sketch" "Filled" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_DISPLAY_TRACK - Tracks: - 1 - - 0 - - - 0 - - 1 - m_OptDisplayTracks - 1 - - - protected - 1 - - Resizable - 1 - 1 - - wxRA_SPECIFY_COLS - - 0 - Select how tracks are displayed - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - "Sketch" "Filled" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_VIAS_SHAPES - Via Shapes: - 1 - - 0 - - - 0 - - 1 - m_OptDisplayVias - 1 - - - protected - 1 - - Resizable - 1 - 1 - - wxRA_SPECIFY_COLS - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - "Never" "Defined holes" "Always" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_VIAS_HOLES - Show Via Holes: - 1 - - 0 - - - 0 - - 1 - m_OptDisplayViaHole - 1 - - - protected - 1 - - Resizable - 1 - 1 - - wxRA_SPECIFY_COLS - - 0 - Show (or not) via holes. If Defined Holes is selected, only the non default size holes are shown - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - wxID_ANY - Routing help: - - sbMiddleLeftSizer - wxVERTICAL - none - - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - "Do not show" "On pads" "On tracks" "On pads and tracks" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Show Net Names: - 1 - - 0 - - - 0 - - 1 - m_ShowNetNamesOption - 1 - - - protected - 1 - - Resizable - 3 - 1 - - wxRA_SPECIFY_COLS - - 0 - Show or not net names on pads and/or tracks - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - "Never" "New track" "New track with via area" "New and edited tracks with via area" "Always" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_SHOW_CLEARANCE - Show Tracks Clearance: - 1 - - 0 - - - 0 - - 1 - m_OptDisplayTracksClearance - 1 - - - protected - 1 - - Resizable - 3 - 1 - - wxRA_SPECIFY_COLS - - 0 - Show( or not) tracks clearance area. If New track is selected, track clearance area is shown only when creating the track. - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxALL - 0 - - wxID_ANY - Footprints: - - sMiddleRightSizer + bupperSizer wxHORIZONTAL none - 5 - - 0 - - - bLModuleSizer - wxVERTICAL - none - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - "Line" "Filled" "Sketch" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_EDGES_MODULES - Footprint Edges: - 1 - - 0 - - - 0 - - 1 - m_OptDisplayModEdges - 1 - - - protected - 1 - - Resizable - 1 - 1 - - wxRA_SPECIFY_COLS - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - "Line" "Filled" "Sketch" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_TEXT_MODULES - Texts: - 1 - - 0 - - - 0 - - 1 - m_OptDisplayModTexts - 1 - - - protected - 1 - - Resizable - 1 - 1 - - wxRA_SPECIFY_COLS - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - + wxEXPAND|wxALL 0 wxID_ANY - Pad Options: + Tracks and vias: - bRModuleSizer + sLeftBoxSizer wxVERTICAL none 5 - wxALL|wxEXPAND + wxALL 0 - + 1 1 1 @@ -804,7 +132,7 @@ 1 0 - "Sketch" "Filled" + 0 1 1 @@ -818,9 +146,8 @@ 0 0 - ID_PADS_SHAPES - Pad Shapes: - 1 + wxID_ANY + Tracks sketch mode 0 @@ -828,7 +155,7 @@ 0 1 - m_OptDisplayPads + m_OptDisplayTracks 1 @@ -836,10 +163,9 @@ 1 Resizable - 1 1 - wxRA_SPECIFY_COLS + 0 @@ -851,6 +177,7 @@ + @@ -867,7 +194,6 @@ - @@ -909,7 +235,7 @@ 0 0 wxID_ANY - Show pad clearance + Vias sketch mode 0 @@ -917,7 +243,7 @@ 0 1 - m_OptDisplayPadClearence + m_OptDisplayVias 1 @@ -964,211 +290,10 @@ - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Show pad number - - 0 - - - 0 - - 1 - m_OptDisplayPadNumber - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Show pad NoConnect - - 0 - - - 0 - - 1 - m_OptDisplayPadNoConn - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxALL - 0 - - - bRightSizer - wxVERTICAL - none - - 5 - wxEXPAND - 1 - - wxID_ANY - Others: - - sRightUpperSizer - wxVERTICAL - none - 5 wxALL|wxEXPAND - 0 + 1 1 1 @@ -1183,7 +308,111 @@ 1 0 - "Line" "Filled" "Sketch" + "Never" "Defined holes" "Always" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_VIAS_HOLES + Show Via Holes: + 1 + + 0 + + + 0 + + 1 + m_OptDisplayViaHole + 1 + + + protected + 1 + + Resizable + 1 + 1 + + wxRA_SPECIFY_COLS + + 0 + Show (or not) via holes. If Defined Holes is selected, only the non default size holes are shown + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + wxID_ANY + Routing help: + + sbMiddleLeftSizer + wxVERTICAL + none + + + 5 + wxALL|wxEXPAND + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "Do not show" "On pads" "On tracks" "On pads and tracks" 1 1 @@ -1198,7 +427,7 @@ 0 0 wxID_ANY - Display other items: + Show Net Names: 1 0 @@ -1207,7 +436,7 @@ 0 1 - m_OptDisplayDrawings + m_ShowNetNamesOption 1 @@ -1215,13 +444,13 @@ 1 Resizable - 1 + 3 1 wxRA_SPECIFY_COLS 0 - + Show or not net names on pads and/or tracks wxFILTER_NONE wxDefaultValidator @@ -1258,7 +487,7 @@ 5 wxALL|wxEXPAND - 0 + 1 1 1 @@ -1273,7 +502,7 @@ 1 0 - "Yes" "No" + "Never" "New track" "New track with via area" "New and edited tracks with via area" "Always" 1 1 @@ -1287,8 +516,8 @@ 0 0 - wxID_ANY - Show page limits + ID_SHOW_CLEARANCE + Show Tracks Clearance: 1 0 @@ -1297,7 +526,7 @@ 0 1 - m_Show_Page_Limits + m_OptDisplayTracksClearance 1 @@ -1305,13 +534,13 @@ 1 Resizable - 1 + 3 1 wxRA_SPECIFY_COLS 0 - + Show( or not) tracks clearance area. If New track is selected, track clearance area is shown only when creating the track. wxFILTER_NONE wxDefaultValidator @@ -1351,190 +580,854 @@ 5 0 - - 10 - protected - 10 - - - - 5 - wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_OK - OK - - 0 - - - 0 + - 1 - m_buttonOK - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnOkClick - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_CANCEL - Cancel - - 0 - - - 0 - - 1 - m_buttonCANCEL - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnCancelClick - - - - - - - - - - - - - - - - - - - - - - - + b_rightSizer + wxVERTICAL + none + + 5 + wxEXPAND|wxALL + 0 + + wxID_ANY + Footprints: + + sfootprintSizer + wxVERTICAL + none + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Outlines sketch mode + + 0 + + + 0 + + 1 + m_OptDisplayModOutlines + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Texts sketch mode + + 0 + + + 0 + + 1 + m_OptDisplayModTexts + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Pads sketch mode + + 0 + + + 0 + + 1 + m_OptDisplayPads + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Show pad clearance + + 0 + + + 0 + + 1 + m_OptDisplayPadClearence + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Show pad number + + 0 + + + 0 + + 1 + m_OptDisplayPadNumber + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Show pad NoConnect + + 0 + + + 0 + + 1 + m_OptDisplayPadNoConn + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALL + 1 + + wxID_ANY + Others: + + s_otherSizer + wxVERTICAL + none + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Graphic items sketch mode + + 0 + + + 0 + + 1 + m_OptDisplayDrawings + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Show page limits + + 0 + + + 0 + + 1 + m_Show_Page_Limits + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND | wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_staticline1 + 1 + + + protected + 1 + + Resizable + 1 + + wxLI_HORIZONTAL + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALL + 0 + + 0 + 1 + 0 + 0 + 0 + 1 + 0 + 0 + + m_sdbSizer + protected + + OnCancelClick + + + + OnOkClick + + + + diff --git a/pcbnew/dialogs/dialog_display_options_base.h b/pcbnew/dialogs/dialog_display_options_base.h index 9a99ca4bd3..817c2bd4ee 100644 --- a/pcbnew/dialogs/dialog_display_options_base.h +++ b/pcbnew/dialogs/dialog_display_options_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jun 6 2014) +// C++ code generated with wxFormBuilder (version Jun 5 2014) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -15,14 +15,15 @@ class DIALOG_SHIM; #include "dialog_shim.h" #include -#include +#include #include #include #include #include +#include #include #include -#include +#include #include #include @@ -38,39 +39,37 @@ class DIALOG_DISPLAY_OPTIONS_BASE : public DIALOG_SHIM protected: enum { - wxID_DISPLAY_TRACK = 1000, - ID_VIAS_SHAPES, - ID_VIAS_HOLES, - ID_SHOW_CLEARANCE, - ID_EDGES_MODULES, - ID_TEXT_MODULES, - ID_PADS_SHAPES + ID_VIAS_HOLES = 1000, + ID_SHOW_CLEARANCE }; - wxRadioBox* m_OptDisplayTracks; - wxRadioBox* m_OptDisplayVias; + wxCheckBox* m_OptDisplayTracks; + wxCheckBox* m_OptDisplayVias; wxRadioBox* m_OptDisplayViaHole; wxRadioBox* m_ShowNetNamesOption; wxRadioBox* m_OptDisplayTracksClearance; - wxRadioBox* m_OptDisplayModEdges; - wxRadioBox* m_OptDisplayModTexts; - wxRadioBox* m_OptDisplayPads; + wxCheckBox* m_OptDisplayModOutlines; + wxCheckBox* m_OptDisplayModTexts + ; + wxCheckBox* m_OptDisplayPads; wxCheckBox* m_OptDisplayPadClearence; wxCheckBox* m_OptDisplayPadNumber; wxCheckBox* m_OptDisplayPadNoConn; - wxRadioBox* m_OptDisplayDrawings; - wxRadioBox* m_Show_Page_Limits; - wxButton* m_buttonOK; - wxButton* m_buttonCANCEL; + wxCheckBox* m_OptDisplayDrawings; + wxCheckBox* m_Show_Page_Limits; + wxStaticLine* m_staticline1; + wxStdDialogButtonSizer* m_sdbSizer; + wxButton* m_sdbSizerOK; + wxButton* m_sdbSizerCancel; // Virtual event handlers, overide them in your derived class - virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); } + virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); } public: - DIALOG_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Display options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 880,320 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + DIALOG_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Display options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 562,361 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~DIALOG_DISPLAY_OPTIONS_BASE(); }; diff --git a/pcbnew/dialogs/dialog_plot.cpp b/pcbnew/dialogs/dialog_plot.cpp index 690ef34b9b..d8f5263686 100644 --- a/pcbnew/dialogs/dialog_plot.cpp +++ b/pcbnew/dialogs/dialog_plot.cpp @@ -5,7 +5,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -193,7 +193,7 @@ void DIALOG_PLOT::Init_Dialog() m_scaleOpt->SetSelection( m_plotOpts.GetScaleSelection() ); // Plot mode - m_plotModeOpt->SetSelection( m_plotOpts.GetMode() ); + m_plotModeOpt->SetSelection( m_plotOpts.GetPlotMode() == SKETCH ? 1 : 0 ); // Plot mirror option m_plotMirrorOpt->SetValue( m_plotOpts.GetMirror() ); @@ -576,7 +576,7 @@ void DIALOG_PLOT::applyPlotSettings() tempOptions.SetDrillMarksType( static_cast ( m_drillShapeOpt->GetSelection() ) ); tempOptions.SetMirror( m_plotMirrorOpt->GetValue() ); - tempOptions.SetMode( static_cast( m_plotModeOpt->GetSelection() ) ); + tempOptions.SetPlotMode( m_plotModeOpt->GetSelection() == 1 ? SKETCH : FILLED ); tempOptions.SetPlotViaOnMaskLayer( m_plotNoViaOnMaskOpt->GetValue() ); // Update settings from text fields. Rewrite values back to the fields, diff --git a/pcbnew/dialogs/dialog_plot_base.cpp b/pcbnew/dialogs/dialog_plot_base.cpp index 3c4838ebe7..a5134b39c7 100644 --- a/pcbnew/dialogs/dialog_plot_base.cpp +++ b/pcbnew/dialogs/dialog_plot_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jun 6 2014) +// C++ code generated with wxFormBuilder (version Jun 5 2014) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -159,7 +159,7 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr m_staticText13->Wrap( -1 ); bSizer14->Add( m_staticText13, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - wxString m_plotModeOptChoices[] = { _("Line"), _("Filled"), _("Sketch") }; + wxString m_plotModeOptChoices[] = { _("Filled"), _("Sketch") }; int m_plotModeOptNChoices = sizeof( m_plotModeOptChoices ) / sizeof( wxString ); m_plotModeOpt = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_plotModeOptNChoices, m_plotModeOptChoices, 0 ); m_plotModeOpt->SetSelection( 0 ); diff --git a/pcbnew/dialogs/dialog_plot_base.fbp b/pcbnew/dialogs/dialog_plot_base.fbp index f4cebc7ed9..5363d9cd7f 100644 --- a/pcbnew/dialogs/dialog_plot_base.fbp +++ b/pcbnew/dialogs/dialog_plot_base.fbp @@ -26,7 +26,7 @@ UI 1 0 - + 0 wxAUI_MGR_DEFAULT @@ -2064,7 +2064,7 @@ 1 0 - "Line" "Filled" "Sketch" + "Filled" "Sketch" 1 1 diff --git a/pcbnew/dialogs/dialog_plot_base.h b/pcbnew/dialogs/dialog_plot_base.h index d81971d2dc..13c4972a29 100644 --- a/pcbnew/dialogs/dialog_plot_base.h +++ b/pcbnew/dialogs/dialog_plot_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jun 6 2014) +// C++ code generated with wxFormBuilder (version Jun 5 2014) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! diff --git a/pcbnew/editedge.cpp b/pcbnew/editedge.cpp index e5375b75e7..0dcd2f32cf 100644 --- a/pcbnew/editedge.cpp +++ b/pcbnew/editedge.cpp @@ -114,7 +114,7 @@ void PCB_EDIT_FRAME::Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC ) { EDA_ITEM* PtStruct; DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions(); - int tmp = displ_opts->m_DisplayDrawItems; + bool tmp = displ_opts->m_DisplayDrawItemsFill; if( Segment == NULL ) return; @@ -122,7 +122,7 @@ void PCB_EDIT_FRAME::Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC ) if( Segment->IsNew() ) // Trace in progress. { // Delete current segment. - displ_opts->m_DisplayDrawItems = SKETCH; + displ_opts->m_DisplayDrawItemsFill = SKETCH; Segment->Draw( m_canvas, DC, GR_XOR ); PtStruct = Segment->Back(); Segment ->DeleteStructure(); @@ -130,7 +130,7 @@ void PCB_EDIT_FRAME::Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC ) if( PtStruct && (PtStruct->Type() == PCB_LINE_T ) ) Segment = (DRAWSEGMENT*) PtStruct; - displ_opts->m_DisplayDrawItems = tmp; + displ_opts->m_DisplayDrawItemsFill = tmp; SetCurItem( NULL ); } else if( Segment->GetFlags() == 0 ) @@ -335,14 +335,15 @@ void PCB_EDIT_FRAME::End_Edge( DRAWSEGMENT* Segment, wxDC* DC ) */ static void DrawSegment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase ) { - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)aPanel->GetDisplayOptions(); DRAWSEGMENT* Segment = (DRAWSEGMENT*) aPanel->GetScreen()->GetCurItem(); - int tmp = displ_opts->m_DisplayDrawItems; if( Segment == NULL ) return; - displ_opts->m_DisplayDrawItems = SKETCH; + DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)aPanel->GetDisplayOptions(); + bool tmp = displ_opts->m_DisplayDrawItemsFill; + + displ_opts->m_DisplayDrawItemsFill = SKETCH; if( aErase ) Segment->Draw( aPanel, aDC, GR_XOR ); @@ -362,5 +363,5 @@ static void DrawSegment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosi } Segment->Draw( aPanel, aDC, GR_XOR ); - displ_opts->m_DisplayDrawItems = tmp; + displ_opts->m_DisplayDrawItemsFill = tmp; } diff --git a/pcbnew/exporters/gen_drill_report_files.cpp b/pcbnew/exporters/gen_drill_report_files.cpp index 5a2c6ad5fb..0ce4575905 100644 --- a/pcbnew/exporters/gen_drill_report_files.cpp +++ b/pcbnew/exporters/gen_drill_report_files.cpp @@ -428,7 +428,7 @@ bool EXCELLON_WRITER::PlotDrillMarks( PLOTTER* aPlotter ) wxSize oblong_size; oblong_size = m_holeListBuffer[ii].m_Hole_Size; aPlotter->FlashPadOval( pos, oblong_size, - m_holeListBuffer[ii].m_Hole_Orient, LINE ); + m_holeListBuffer[ii].m_Hole_Orient, SKETCH ); } } diff --git a/pcbnew/modeditoptions.cpp b/pcbnew/modeditoptions.cpp index f4e776afcc..25bdcf3926 100644 --- a/pcbnew/modeditoptions.cpp +++ b/pcbnew/modeditoptions.cpp @@ -60,12 +60,12 @@ void FOOTPRINT_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event ) break; case ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH: - displ_opts->m_DisplayModText = state ? SKETCH : FILLED; + displ_opts->m_DisplayModTextFill = state ? SKETCH : FILLED; m_canvas->Refresh( ); break; case ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH: - displ_opts->m_DisplayModEdge = state ? SKETCH : FILLED; + displ_opts->m_DisplayModEdgeFill = state ? SKETCH : FILLED; m_canvas->Refresh( ); break; @@ -95,12 +95,12 @@ PARAM_CFG_ARRAY& FOOTPRINT_EDIT_FRAME::GetConfigurationSettings() &displ_opts->m_DisplayPolarCood, false ) ); m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorPadDisplayMode" ), &displ_opts->m_DisplayPadFill, true ) ); - m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "FpEditorGraphicLinesDisplayMode" ), - &displ_opts->m_DisplayModEdge, FILLED, 0, 2 ) ); - m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "FpEditorTextsDisplayMode" ), - &displ_opts->m_DisplayModText, FILLED, 0, 2 ) ); - m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "FpEditorTextsDisplayMode" ), - &displ_opts->m_DisplayModText, FILLED, 0, 2 ) ); + m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorGraphicLinesDisplayMode" ), + &displ_opts->m_DisplayModEdgeFill, FILLED ) ); + m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorTextsDisplayMode" ), + &displ_opts->m_DisplayModTextFill, FILLED ) ); + m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorTextsDisplayMode" ), + &displ_opts->m_DisplayModTextFill, FILLED ) ); m_configSettings.push_back( new PARAM_CFG_WXSTRING( true, wxT( "FpEditorTextsRefDefaultText" ), &settings.m_RefDefaultText, wxT( "REF**" ) ) ); diff --git a/pcbnew/moduleframe.cpp b/pcbnew/moduleframe.cpp index 45ecbf24e2..55e18b4666 100644 --- a/pcbnew/moduleframe.cpp +++ b/pcbnew/moduleframe.cpp @@ -578,11 +578,11 @@ void FOOTPRINT_EDIT_FRAME::OnUpdateOptionsToolbar( wxUpdateUIEvent& aEvent ) switch( id ) { case ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH: - state = displ_opts->m_DisplayModText == SKETCH; + state = displ_opts->m_DisplayModTextFill == SKETCH; break; case ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH: - state = displ_opts->m_DisplayModEdge == SKETCH; + state = displ_opts->m_DisplayModEdgeFill == SKETCH; break; case ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE: diff --git a/pcbnew/pcb_plot_params.cpp b/pcbnew/pcb_plot_params.cpp index 1e04a8b6c5..ae8d638144 100644 --- a/pcbnew/pcb_plot_params.cpp +++ b/pcbnew/pcb_plot_params.cpp @@ -2,7 +2,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 1992-2013 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 1992-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 @@ -89,7 +89,7 @@ PCB_PLOT_PARAMS::PCB_PLOT_PARAMS() : m_lineWidth = g_DrawDefaultLineThickness; m_plotFrameRef = false; m_plotViaOnMaskLayer = false; - m_mode = FILLED; + m_plotMode = FILLED; m_useAuxOrigin = false; m_HPGLPenNum = 1; m_HPGLPenSpeed = 20; // this param is always in cm/s @@ -167,7 +167,7 @@ void PCB_PLOT_PARAMS::Format( OUTPUTFORMATTER* aFormatter, aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_viasonmask ), m_plotViaOnMaskLayer ? trueStr : falseStr ); aFormatter->Print( aNestLevel+1, "(%s %d)\n", getTokenName( T_mode ), - m_mode ); + GetPlotMode() == SKETCH ? 2 : 1 ); // Value 0 (LINE mode) no more used aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_useauxorigin ), m_useAuxOrigin ? trueStr : falseStr ); aFormatter->Print( aNestLevel+1, "(%s %d)\n", getTokenName( T_hpglpennumber ), @@ -237,7 +237,7 @@ bool PCB_PLOT_PARAMS::operator==( const PCB_PLOT_PARAMS &aPcbPlotParams ) const return false; if( m_plotViaOnMaskLayer != aPcbPlotParams.m_plotViaOnMaskLayer ) return false; - if( m_mode != aPcbPlotParams.m_mode ) + if( m_plotMode != aPcbPlotParams.m_plotMode ) return false; if( m_useAuxOrigin != aPcbPlotParams.m_useAuxOrigin ) return false; @@ -430,7 +430,7 @@ void PCB_PLOT_PARAMS_PARSER::Parse( PCB_PLOT_PARAMS* aPcbPlotParams ) break; case T_mode: - aPcbPlotParams->m_mode = static_cast( parseInt( 0, 2 ) ); + aPcbPlotParams->SetPlotMode( parseInt( 0, 2 ) > 1 ? SKETCH : FILLED ); break; case T_useauxorigin: diff --git a/pcbnew/pcb_plot_params.h b/pcbnew/pcb_plot_params.h index 47eb89bbb4..308f2404c2 100644 --- a/pcbnew/pcb_plot_params.h +++ b/pcbnew/pcb_plot_params.h @@ -3,7 +3,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 1992-2011 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 1992-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 @@ -49,9 +49,10 @@ private: // (mainly used to disable NPTH pads plotting on copper layers) bool m_skipNPTH_Pads; - /** LINE, FILLED or SKETCH selects how to plot filled objects. - * FILLED is not available with all drivers */ - EDA_DRAW_MODE_T m_mode; + /** FILLED or SKETCH selects how to plot filled objects. + * FILLED or SKETCH not available with all drivers: some have fixed mode + */ + EDA_DRAW_MODE_T m_plotMode; /// Plot format type (chooses the driver to be used) PlotFormat m_format; @@ -178,8 +179,8 @@ public: void SetTextMode( PlotTextMode aVal ) { m_textMode = aVal; } PlotTextMode GetTextMode() const { return m_textMode; } - void SetMode( EDA_DRAW_MODE_T aVal ) { m_mode = aVal; } - EDA_DRAW_MODE_T GetMode() const { return m_mode; } + void SetPlotMode( EDA_DRAW_MODE_T aPlotMode ) { m_plotMode = aPlotMode; } + EDA_DRAW_MODE_T GetPlotMode() const { return m_plotMode; } void SetDrillMarksType( DrillMarksType aVal ) { m_drillMarks = aVal; } DrillMarksType GetDrillMarksType() const { return m_drillMarks; } diff --git a/pcbnew/pcb_plot_params_parser.h b/pcbnew/pcb_plot_params_parser.h index 221bc92570..cc3137ea98 100644 --- a/pcbnew/pcb_plot_params_parser.h +++ b/pcbnew/pcb_plot_params_parser.h @@ -24,7 +24,6 @@ */ #include -//#include class PCB_PLOT_PARAMS; class LINE_READER; diff --git a/pcbnew/pcbnew_config.cpp b/pcbnew/pcbnew_config.cpp index 828cf8820d..1adf75aba5 100644 --- a/pcbnew/pcbnew_config.cpp +++ b/pcbnew/pcbnew_config.cpp @@ -354,12 +354,12 @@ PARAM_CFG_ARRAY& PCB_EDIT_FRAME::GetConfigurationSettings() &displ_opts->m_DisplayPadIsol, true ) ); m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "PadSNum" ), &displ_opts->m_DisplayPadNum, true ) ); - m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "ModAffC" ), - &displ_opts->m_DisplayModEdge, FILLED, 0, 2 ) ); - m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "ModAffT" ), - &displ_opts->m_DisplayModText, FILLED, 0, 2 ) ); - m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "PcbAffT" ), - &displ_opts->m_DisplayDrawItems, FILLED, 0, 2 ) ); + m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "ModAffC" ), + &displ_opts->m_DisplayModEdgeFill, FILLED ) ); + m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "ModAffT" ), + &displ_opts->m_DisplayModTextFill, FILLED ) ); + m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "PcbAffT" ), + &displ_opts->m_DisplayDrawItemsFill, FILLED ) ); m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "PcbShowZonesMode" ), &displ_opts->m_DisplayZonesMode, 0, 0, 2 ) ); diff --git a/pcbnew/plot_board_layers.cpp b/pcbnew/plot_board_layers.cpp index 6d1f397aba..c796ee844e 100644 --- a/pcbnew/plot_board_layers.cpp +++ b/pcbnew/plot_board_layers.cpp @@ -103,7 +103,7 @@ void PlotSilkScreen( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask, if( layersmask_plotpads[F_SilkS] ) color = ColorFromInt( color | aBoard->GetLayerColor( F_SilkS ) ); - itemplotter.PlotPad( pad, color, LINE ); + itemplotter.PlotPad( pad, color, SKETCH ); } } } @@ -137,7 +137,7 @@ void PlotSilkScreen( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask, continue; aPlotter->ThickSegment( seg->GetStart(), seg->GetEnd(), seg->GetWidth(), - itemplotter.GetMode() ); + itemplotter.GetPlotMode() ); } } @@ -285,7 +285,7 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter, itemplotter.SetLayerSet( aLayerMask ); - EDA_DRAW_MODE_T plotMode = aPlotOpt.GetMode(); + EDA_DRAW_MODE_T plotMode = aPlotOpt.GetPlotMode(); // Plot edge layer and graphic items itemplotter.PlotBoardGraphicItems(); diff --git a/pcbnew/plot_brditems_plotter.cpp b/pcbnew/plot_brditems_plotter.cpp index 7dd42a2f06..887ff9c089 100644 --- a/pcbnew/plot_brditems_plotter.cpp +++ b/pcbnew/plot_brditems_plotter.cpp @@ -222,9 +222,6 @@ void BRDITEMS_PLOTTER::PlotTextModule( TEXTE_MODULE* pt_texte, EDA_COLOR_T aColo thickness = pt_texte->GetThickness(); - if( GetMode() == LINE ) - thickness = -1; - if( pt_texte->IsMirrored() ) NEGATE( size.x ); // Text is mirrored @@ -249,7 +246,7 @@ void BRDITEMS_PLOTTER::PlotDimension( DIMENSION* aDim ) DRAWSEGMENT draw; - draw.SetWidth( (GetMode() == LINE) ? -1 : aDim->GetWidth() ); + draw.SetWidth( aDim->GetWidth() ); draw.SetLayer( aDim->GetLayer() ); EDA_COLOR_T color = aDim->GetBoard()->GetLayerColor( aDim->GetLayer() ); @@ -302,7 +299,7 @@ void BRDITEMS_PLOTTER::PlotPcbTarget( PCB_TARGET* aMire ) DRAWSEGMENT draw; draw.SetShape( S_CIRCLE ); - draw.SetWidth( ( GetMode() == LINE ) ? -1 : aMire->GetWidth() ); + draw.SetWidth( aMire->GetWidth() ); draw.SetLayer( aMire->GetLayer() ); draw.SetStart( aMire->GetPosition() ); radius = aMire->GetSize() / 3; @@ -382,12 +379,12 @@ void BRDITEMS_PLOTTER::Plot_1_EdgeModule( EDGE_MODULE* aEdge ) switch( type_trace ) { case S_SEGMENT: - m_plotter->ThickSegment( pos, end, thickness, GetMode() ); + m_plotter->ThickSegment( pos, end, thickness, GetPlotMode() ); break; case S_CIRCLE: radius = KiROUND( GetLineLength( end, pos ) ); - m_plotter->ThickCircle( pos, radius * 2, thickness, GetMode() ); + m_plotter->ThickCircle( pos, radius * 2, thickness, GetPlotMode() ); break; case S_ARC: @@ -396,7 +393,7 @@ void BRDITEMS_PLOTTER::Plot_1_EdgeModule( EDGE_MODULE* aEdge ) double startAngle = ArcTangente( end.y - pos.y, end.x - pos.x ); double endAngle = startAngle + aEdge->GetAngle(); - m_plotter->ThickArc( pos, -endAngle, -startAngle, radius, thickness, GetMode() ); + m_plotter->ThickArc( pos, -endAngle, -startAngle, radius, thickness, GetPlotMode() ); } break; @@ -455,7 +452,7 @@ void BRDITEMS_PLOTTER::PlotTextePcb( TEXTE_PCB* pt_texte ) size = pt_texte->GetSize(); pos = pt_texte->GetTextPosition(); orient = pt_texte->GetOrientation(); - thickness = ( GetMode() == LINE ) ? -1 : pt_texte->GetThickness(); + thickness = pt_texte->GetThickness(); if( pt_texte->IsMirrored() ) size.x = -size.x; @@ -528,7 +525,7 @@ void BRDITEMS_PLOTTER::PlotFilledAreas( ZONE_CONTAINER* aZone ) } // Plot the current filled area and its outline - if( GetMode() == FILLED ) + if( GetPlotMode() == FILLED ) { // Plot the filled area polygon. // The area can be filled by segments or uses solid polygons @@ -544,7 +541,7 @@ void BRDITEMS_PLOTTER::PlotFilledAreas( ZONE_CONTAINER* aZone ) wxPoint end = aZone->FillSegments()[iseg].m_End; m_plotter->ThickSegment( start, end, aZone->GetMinThickness(), - GetMode() ); + GetPlotMode() ); } // Plot the area outline only @@ -558,9 +555,8 @@ void BRDITEMS_PLOTTER::PlotFilledAreas( ZONE_CONTAINER* aZone ) { for( unsigned jj = 1; jjThickSegment( cornerList[jj -1], cornerList[jj], - ( GetMode() == LINE ) ? -1 : aZone->GetMinThickness(), - GetMode() ); + GetPlotMode() ); } m_plotter->SetCurrentLineWidth( -1 ); @@ -576,17 +572,12 @@ void BRDITEMS_PLOTTER::PlotFilledAreas( ZONE_CONTAINER* aZone ) */ void BRDITEMS_PLOTTER::PlotDrawSegment( DRAWSEGMENT* aSeg ) { - int thickness; - int radius = 0; - double StAngle = 0, EndAngle = 0; - if( !m_layerMask[aSeg->GetLayer()] ) return; - if( GetMode() == LINE ) - thickness = GetLineWidth(); - else - thickness = aSeg->GetWidth(); + int radius = 0; + double StAngle = 0, EndAngle = 0; + int thickness = aSeg->GetWidth(); m_plotter->SetColor( getColor( aSeg->GetLayer() ) ); @@ -599,14 +590,14 @@ void BRDITEMS_PLOTTER::PlotDrawSegment( DRAWSEGMENT* aSeg ) { case S_CIRCLE: radius = KiROUND( GetLineLength( end, start ) ); - m_plotter->ThickCircle( start, radius * 2, thickness, GetMode() ); + m_plotter->ThickCircle( start, radius * 2, thickness, GetPlotMode() ); break; case S_ARC: radius = KiROUND( GetLineLength( end, start ) ); StAngle = ArcTangente( end.y - start.y, end.x - start.x ); EndAngle = StAngle + aSeg->GetAngle(); - m_plotter->ThickArc( start, -EndAngle, -StAngle, radius, thickness, GetMode() ); + m_plotter->ThickArc( start, -EndAngle, -StAngle, radius, thickness, GetPlotMode() ); break; case S_CURVE: @@ -616,12 +607,12 @@ void BRDITEMS_PLOTTER::PlotDrawSegment( DRAWSEGMENT* aSeg ) for( unsigned i = 1; i < bezierPoints.size(); i++ ) m_plotter->ThickSegment( bezierPoints[i - 1], bezierPoints[i], - thickness, GetMode() ); + thickness, GetPlotMode() ); } break; default: - m_plotter->ThickSegment( start, end, thickness, GetMode() ); + m_plotter->ThickSegment( start, end, thickness, GetPlotMode() ); } } @@ -646,10 +637,10 @@ void BRDITEMS_PLOTTER::plotOneDrillMark( PAD_DRILL_SHAPE_T aDrillShape, { aDrillSize.y -= getFineWidthAdj(); aDrillSize.y = Clamp( 1, aDrillSize.y, aPadSize.y - 1 ); - m_plotter->FlashPadOval( aDrillPos, aDrillSize, aOrientation, GetMode() ); + m_plotter->FlashPadOval( aDrillPos, aDrillSize, aOrientation, GetPlotMode() ); } else - m_plotter->FlashPadCircle( aDrillPos, aDrillSize.x, GetMode() ); + m_plotter->FlashPadCircle( aDrillPos, aDrillSize.x, GetPlotMode() ); } @@ -671,7 +662,7 @@ void BRDITEMS_PLOTTER::PlotDrillMarks() you could start a layer with negative polarity to scrape the film. - In DXF they go into the 'WHITE' layer. This could be useful. */ - if( GetMode() == FILLED ) + if( GetPlotMode() == FILLED ) m_plotter->SetColor( WHITE ); for( TRACK *pts = m_board->m_Track; pts != NULL; pts = pts->Next() ) @@ -698,6 +689,6 @@ void BRDITEMS_PLOTTER::PlotDrillMarks() } } - if( GetMode() == FILLED ) + if( GetPlotMode() == FILLED ) m_plotter->SetColor( GetColor() ); } diff --git a/pcbnew/print_board_functions.cpp b/pcbnew/print_board_functions.cpp index b6e9c705ca..72024e2467 100644 --- a/pcbnew/print_board_functions.cpp +++ b/pcbnew/print_board_functions.cpp @@ -71,11 +71,11 @@ void FOOTPRINT_EDIT_FRAME::PrintPage( wxDC* aDC, bool nctmp = GetBoard()->IsElementVisible(NO_CONNECTS_VISIBLE); GetBoard()->SetElementVisibility(NO_CONNECTS_VISIBLE, false); displ_opts->m_DisplayPadIsol = false; - displ_opts->m_DisplayModEdge = FILLED; - displ_opts->m_DisplayModText = FILLED; + displ_opts->m_DisplayModEdgeFill = FILLED; + displ_opts->m_DisplayModTextFill = FILLED; displ_opts->m_DisplayPcbTrackFill = true; displ_opts->m_ShowTrackClearanceMode = DO_NOT_SHOW_CLEARANCE; - displ_opts->m_DisplayDrawItems = FILLED; + displ_opts->m_DisplayDrawItemsFill = FILLED; displ_opts->m_DisplayZonesMode = 0; displ_opts->m_DisplayNetNamesMode = 0; @@ -191,11 +191,11 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC, GetBoard()->SetElementVisibility( ANCHOR_VISIBLE, false ); displ_opts->m_DisplayPadIsol = false; - displ_opts->m_DisplayModEdge = FILLED; - displ_opts->m_DisplayModText = FILLED; + displ_opts->m_DisplayModEdgeFill = FILLED; + displ_opts->m_DisplayModTextFill = FILLED; displ_opts->m_DisplayPcbTrackFill = true; displ_opts->m_ShowTrackClearanceMode = DO_NOT_SHOW_CLEARANCE; - displ_opts->m_DisplayDrawItems = FILLED; + displ_opts->m_DisplayDrawItemsFill = FILLED; displ_opts->m_DisplayZonesMode = 0; displ_opts->m_DisplayNetNamesMode = 0; From 5eb7b41fba288c05bc8adc7ec63ffdea166e15c3 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Mon, 2 Feb 2015 17:43:34 +0100 Subject: [PATCH 24/29] Dialogs edit footprint in module editor and edit footprint in board editor: add button to edit the selected 3D shape filename. Dialog edit component in library editor: add button to edit the selected footprint filter. --- .../dialogs/dialog_edit_component_in_lib.cpp | 26 +++ .../dialogs/dialog_edit_component_in_lib.h | 2 +- .../dialog_edit_component_in_lib_base.cpp | 7 +- .../dialog_edit_component_in_lib_base.fbp | 92 ++++++++- .../dialog_edit_component_in_lib_base.h | 4 +- include/validators.h | 5 + .../dialog_edit_module_for_BoardEditor.cpp | 33 ++- .../dialog_edit_module_for_BoardEditor.h | 14 +- ...ialog_edit_module_for_BoardEditor_base.cpp | 16 +- ...ialog_edit_module_for_BoardEditor_base.fbp | 188 +++++++++--------- .../dialog_edit_module_for_BoardEditor_base.h | 11 +- .../dialog_edit_module_for_Modedit.cpp | 35 +++- .../dialogs/dialog_edit_module_for_Modedit.h | 10 +- .../dialog_edit_module_for_Modedit_base.cpp | 11 +- .../dialog_edit_module_for_Modedit_base.fbp | 94 ++++++++- .../dialog_edit_module_for_Modedit_base.h | 4 +- 16 files changed, 420 insertions(+), 132 deletions(-) diff --git a/eeschema/dialogs/dialog_edit_component_in_lib.cpp b/eeschema/dialogs/dialog_edit_component_in_lib.cpp index de6b092356..2b85ddf8be 100644 --- a/eeschema/dialogs/dialog_edit_component_in_lib.cpp +++ b/eeschema/dialogs/dialog_edit_component_in_lib.cpp @@ -107,6 +107,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::initDlg() { m_ButtonDeleteAllFootprintFilter->Enable( false ); m_ButtonDeleteOneFootprintFilter->Enable( false ); + m_buttonEditOneFootprintFilter->Enable( false ); } m_NoteBook->SetSelection( m_lastOpenedPage ); @@ -486,6 +487,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteAllFootprintFilter( wxCommandEvent& m_FootprintFilterListBox->Clear(); m_ButtonDeleteAllFootprintFilter->Enable( false ); m_ButtonDeleteOneFootprintFilter->Enable( false ); + m_buttonEditOneFootprintFilter->Enable( false ); } } @@ -526,6 +528,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::AddFootprintFilter( wxCommandEvent& event m_FootprintFilterListBox->Append( Line ); m_ButtonDeleteAllFootprintFilter->Enable( true ); m_ButtonDeleteOneFootprintFilter->Enable( true ); + m_buttonEditOneFootprintFilter->Enable( true ); } @@ -540,5 +543,28 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteOneFootprintFilter( wxCommandEvent& { m_ButtonDeleteAllFootprintFilter->Enable( false ); m_ButtonDeleteOneFootprintFilter->Enable( false ); + m_buttonEditOneFootprintFilter->Enable( false ); } } + +void DIALOG_EDIT_COMPONENT_IN_LIBRARY::EditOneFootprintFilter( wxCommandEvent& event ) +{ + int idx = m_FootprintFilterListBox->GetSelection(); + + if( idx < 0 ) + return; + + wxString filter = m_FootprintFilterListBox->GetStringSelection(); + + wxTextEntryDialog dlg( this, wxEmptyString, _( "Edit footprint filter" ), filter ); + + if( dlg.ShowModal() != wxID_OK ) + return; // Aborted by user + + filter = dlg.GetValue(); + + if( filter.IsEmpty() ) + return; // do not accept blank filter. + + m_FootprintFilterListBox->SetString( idx, filter ); +} diff --git a/eeschema/dialogs/dialog_edit_component_in_lib.h b/eeschema/dialogs/dialog_edit_component_in_lib.h index c343cf1cc2..b0672abd67 100644 --- a/eeschema/dialogs/dialog_edit_component_in_lib.h +++ b/eeschema/dialogs/dialog_edit_component_in_lib.h @@ -63,7 +63,7 @@ private: void DeleteAllFootprintFilter(wxCommandEvent& event); void DeleteOneFootprintFilter(wxCommandEvent& event); void AddFootprintFilter(wxCommandEvent& event); - + void EditOneFootprintFilter( wxCommandEvent& event ); }; #endif diff --git a/eeschema/dialogs/dialog_edit_component_in_lib_base.cpp b/eeschema/dialogs/dialog_edit_component_in_lib_base.cpp index 8aa344869f..57f59d6d75 100644 --- a/eeschema/dialogs/dialog_edit_component_in_lib_base.cpp +++ b/eeschema/dialogs/dialog_edit_component_in_lib_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Nov 6 2013) +// C++ code generated with wxFormBuilder (version Jun 5 2014) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -225,6 +225,9 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx m_buttonAddFpF = new wxButton( m_PanelFootprintFilter, ID_ADD_FOOTPRINT_FILTER, _("Add"), wxDefaultPosition, wxDefaultSize, 0 ); bFpFilterRightBoxSizer->Add( m_buttonAddFpF, 0, wxALL|wxEXPAND, 5 ); + m_buttonEditOneFootprintFilter = new wxButton( m_PanelFootprintFilter, wxID_ANY, _("Edit"), wxDefaultPosition, wxDefaultSize, 0 ); + bFpFilterRightBoxSizer->Add( m_buttonEditOneFootprintFilter, 0, wxALL|wxEXPAND, 5 ); + m_ButtonDeleteOneFootprintFilter = new wxButton( m_PanelFootprintFilter, ID_DELETE_ONE_FOOTPRINT_FILTER, _("Delete"), wxDefaultPosition, wxDefaultSize, 0 ); bFpFilterRightBoxSizer->Add( m_ButtonDeleteOneFootprintFilter, 0, wxALL|wxEXPAND, 5 ); @@ -266,6 +269,7 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx m_ButtonDeleteOneAlias->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DeleteAliasOfPart ), NULL, this ); m_ButtonDeleteAllAlias->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DeleteAllAliasOfPart ), NULL, this ); m_buttonAddFpF->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::AddFootprintFilter ), NULL, this ); + m_buttonEditOneFootprintFilter->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::EditOneFootprintFilter ), NULL, this ); m_ButtonDeleteOneFootprintFilter->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DeleteOneFootprintFilter ), NULL, this ); m_ButtonDeleteAllFootprintFilter->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DeleteAllFootprintFilter ), NULL, this ); m_stdSizerButtonCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnCancelClick ), NULL, this ); @@ -281,6 +285,7 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::~DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE() m_ButtonDeleteOneAlias->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DeleteAliasOfPart ), NULL, this ); m_ButtonDeleteAllAlias->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DeleteAllAliasOfPart ), NULL, this ); m_buttonAddFpF->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::AddFootprintFilter ), NULL, this ); + m_buttonEditOneFootprintFilter->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::EditOneFootprintFilter ), NULL, this ); m_ButtonDeleteOneFootprintFilter->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DeleteOneFootprintFilter ), NULL, this ); m_ButtonDeleteAllFootprintFilter->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DeleteAllFootprintFilter ), NULL, this ); m_stdSizerButtonCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::OnCancelClick ), NULL, this ); diff --git a/eeschema/dialogs/dialog_edit_component_in_lib_base.fbp b/eeschema/dialogs/dialog_edit_component_in_lib_base.fbp index f112d8a2c8..925397157a 100644 --- a/eeschema/dialogs/dialog_edit_component_in_lib_base.fbp +++ b/eeschema/dialogs/dialog_edit_component_in_lib_base.fbp @@ -1,6 +1,6 @@ - + C++ @@ -899,6 +899,7 @@ + @@ -1080,6 +1081,7 @@ + @@ -3047,6 +3049,94 @@ + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Edit + + 0 + + + 0 + + 1 + m_buttonEditOneFootprintFilter + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + EditOneFootprintFilter + + + + + + + + + + + + + + + + + + + + + + + + + 5 wxALL|wxEXPAND diff --git a/eeschema/dialogs/dialog_edit_component_in_lib_base.h b/eeschema/dialogs/dialog_edit_component_in_lib_base.h index 0624bf8520..2dc78d7912 100644 --- a/eeschema/dialogs/dialog_edit_component_in_lib_base.h +++ b/eeschema/dialogs/dialog_edit_component_in_lib_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Nov 6 2013) +// C++ code generated with wxFormBuilder (version Jun 5 2014) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -88,6 +88,7 @@ class DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE : public DIALOG_SHIM wxStaticText* m_staticTextFootprints; wxListBox* m_FootprintFilterListBox; wxButton* m_buttonAddFpF; + wxButton* m_buttonEditOneFootprintFilter; wxButton* m_ButtonDeleteOneFootprintFilter; wxButton* m_ButtonDeleteAllFootprintFilter; wxStdDialogButtonSizer* m_stdSizerButton; @@ -101,6 +102,7 @@ class DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE : public DIALOG_SHIM virtual void DeleteAliasOfPart( wxCommandEvent& event ) { event.Skip(); } virtual void DeleteAllAliasOfPart( wxCommandEvent& event ) { event.Skip(); } virtual void AddFootprintFilter( wxCommandEvent& event ) { event.Skip(); } + virtual void EditOneFootprintFilter( wxCommandEvent& event ) { event.Skip(); } virtual void DeleteOneFootprintFilter( wxCommandEvent& event ) { event.Skip(); } virtual void DeleteAllFootprintFilter( wxCommandEvent& event ) { event.Skip(); } virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); } diff --git a/include/validators.h b/include/validators.h index 52eb377a5f..d5b3c47552 100644 --- a/include/validators.h +++ b/include/validators.h @@ -27,6 +27,9 @@ * @brief Custom text control validator definitions. */ +#ifndef VALIDATORS_H +#define VALIDATORS_H + #include /** @@ -56,3 +59,5 @@ class FILE_NAME_WITH_PATH_CHAR_VALIDATOR : public wxTextValidator public: FILE_NAME_WITH_PATH_CHAR_VALIDATOR( wxString* aValue = NULL ); }; + +#endif // #ifndef VALIDATORS_H diff --git a/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp b/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp index b91d3d1109..f7430f96fb 100644 --- a/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp +++ b/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp @@ -5,9 +5,9 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2013 Jean-Pierre Charras - * Copyright (C) 2013 Dick Hollenbeck, dick@softplc.com - * Copyright (C) 2004-2013 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 2015 Dick Hollenbeck, dick@softplc.com + * 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 @@ -43,10 +43,13 @@ #include #include +#include #include #include +size_t DIALOG_MODULE_BOARD_EDITOR::m_page = 0; // remember the last open page during session + DIALOG_MODULE_BOARD_EDITOR::DIALOG_MODULE_BOARD_EDITOR( PCB_EDIT_FRAME* aParent, MODULE* aModule, @@ -65,14 +68,19 @@ DIALOG_MODULE_BOARD_EDITOR::DIALOG_MODULE_BOARD_EDITOR( PCB_EDIT_FRAME* aParent InitModeditProperties(); InitBoardProperties(); + m_NoteBook->SetSelection( m_page ); + m_sdbSizerStdButtonsOK->SetDefault(); GetSizer()->SetSizeHints( this ); Centre(); } + DIALOG_MODULE_BOARD_EDITOR::~DIALOG_MODULE_BOARD_EDITOR() { + m_page = m_NoteBook->GetSelection(); + for( unsigned ii = 0; ii < m_Shapes3D_list.size(); ii++ ) delete m_Shapes3D_list[ii]; @@ -417,6 +425,25 @@ void DIALOG_MODULE_BOARD_EDITOR::Remove3DShape( wxCommandEvent& event ) } } +void DIALOG_MODULE_BOARD_EDITOR::Edit3DShapeFileName() +{ + int idx = m_3D_ShapeNameListBox->GetSelection(); + + if( idx < 0 ) + return; + + // Edit filename + wxString filename = m_3D_ShapeNameListBox->GetStringSelection(); + + wxTextEntryDialog dlg( this, wxEmptyString, wxEmptyString, filename ); + dlg.SetTextValidator( FILE_NAME_WITH_PATH_CHAR_VALIDATOR( &filename ) ); + + if( dlg.ShowModal() != wxID_OK || filename.IsEmpty() ) + return; //Aborted by user + + m_3D_ShapeNameListBox->SetString( idx, filename ); +} + void DIALOG_MODULE_BOARD_EDITOR::BrowseAndAdd3DShapeFile() { diff --git a/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.h b/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.h index 6bf70e1b2f..1b27076dbc 100644 --- a/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.h +++ b/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.h @@ -1,8 +1,8 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2010-2014 Jean-Pierre Charras, jean-pierre.charras at wanadoo.fr - * Copyright (C) 1992-2014 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2010-2015 Jean-Pierre Charras, jean-pierre.charras at wanadoo.fr + * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -38,6 +38,7 @@ private: S3DPOINT_VALUE_CTRL * m_3D_Scale; S3DPOINT_VALUE_CTRL * m_3D_Offset; S3DPOINT_VALUE_CTRL * m_3D_Rotation; + static size_t m_page; // remember the last open page during session public: @@ -51,17 +52,22 @@ private: void InitModeditProperties(); void Transfert3DValuesToDisplay( S3D_MASTER * aStruct3DSource ); void TransfertDisplayTo3DValues( int aIndexSelection ); + void Edit3DShapeFileName(); // virtual event functions void OnEditValue( wxCommandEvent& event ); void OnEditReference( wxCommandEvent& event ); void On3DShapeSelection( wxCommandEvent& event ); void On3DShapeNameSelected( wxCommandEvent& event ); - void Add3DShape( wxCommandEvent& event ) + void Edit3DShapeFilename( wxCommandEvent& event ) + { + Edit3DShapeFileName(); + } + void Remove3DShape( wxCommandEvent& event ); + void Add3DShape( wxCommandEvent& event ) { BrowseAndAdd3DShapeFile(); } - void Remove3DShape( wxCommandEvent& event ); void OnCancelClick( wxCommandEvent& event ); void OnOkClick( wxCommandEvent& event ); void GotoModuleEditor( wxCommandEvent& event ); diff --git a/pcbnew/dialogs/dialog_edit_module_for_BoardEditor_base.cpp b/pcbnew/dialogs/dialog_edit_module_for_BoardEditor_base.cpp index ecd0b04eff..d47946603b 100644 --- a/pcbnew/dialogs/dialog_edit_module_for_BoardEditor_base.cpp +++ b/pcbnew/dialogs/dialog_edit_module_for_BoardEditor_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jun 6 2014) +// C++ code generated with wxFormBuilder (version Jun 5 2014) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -356,14 +356,14 @@ DIALOG_MODULE_BOARD_EDITOR_BASE::DIALOG_MODULE_BOARD_EDITOR_BASE( wxWindow* pare wxBoxSizer* bSizer3DButtons; bSizer3DButtons = new wxBoxSizer( wxVERTICAL ); - m_buttonBrowse = new wxButton( m_Panel3D, ID_BROWSE_3D_LIB, _("Browse Shapes"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizer3DButtons->Add( m_buttonBrowse, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); - m_buttonAdd = new wxButton( m_Panel3D, ID_ADD_3D_SHAPE, _("Add 3D Shape"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizer3DButtons->Add( m_buttonAdd, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); + bSizer3DButtons->Add( m_buttonAdd, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); m_buttonRemove = new wxButton( m_Panel3D, ID_REMOVE_3D_SHAPE, _("Remove 3D Shape"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizer3DButtons->Add( m_buttonRemove, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); + bSizer3DButtons->Add( m_buttonRemove, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); + + m_buttonEdit = new wxButton( m_Panel3D, wxID_ANY, _("Edit Filename"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer3DButtons->Add( m_buttonEdit, 0, wxALL|wxEXPAND, 5 ); bLowerSizer3D->Add( bSizer3DButtons, 0, wxALIGN_CENTER_VERTICAL, 5 ); @@ -399,9 +399,9 @@ DIALOG_MODULE_BOARD_EDITOR_BASE::DIALOG_MODULE_BOARD_EDITOR_BASE( wxWindow* pare m_buttonExchange->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::ExchangeModule ), NULL, this ); m_buttonModuleEditor->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::GotoModuleEditor ), NULL, this ); m_3D_ShapeNameListBox->Connect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::On3DShapeNameSelected ), NULL, this ); - m_buttonBrowse->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::Browse3DLib ), NULL, this ); m_buttonAdd->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::Add3DShape ), NULL, this ); m_buttonRemove->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::Remove3DShape ), NULL, this ); + m_buttonEdit->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::Edit3DShapeFilename ), NULL, this ); m_sdbSizerStdButtonsCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::OnCancelClick ), NULL, this ); m_sdbSizerStdButtonsOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::OnOkClick ), NULL, this ); } @@ -415,9 +415,9 @@ DIALOG_MODULE_BOARD_EDITOR_BASE::~DIALOG_MODULE_BOARD_EDITOR_BASE() m_buttonExchange->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::ExchangeModule ), NULL, this ); m_buttonModuleEditor->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::GotoModuleEditor ), NULL, this ); m_3D_ShapeNameListBox->Disconnect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::On3DShapeNameSelected ), NULL, this ); - m_buttonBrowse->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::Browse3DLib ), NULL, this ); m_buttonAdd->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::Add3DShape ), NULL, this ); m_buttonRemove->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::Remove3DShape ), NULL, this ); + m_buttonEdit->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::Edit3DShapeFilename ), NULL, this ); m_sdbSizerStdButtonsCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::OnCancelClick ), NULL, this ); m_sdbSizerStdButtonsOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_BOARD_EDITOR_BASE::OnOkClick ), NULL, this ); diff --git a/pcbnew/dialogs/dialog_edit_module_for_BoardEditor_base.fbp b/pcbnew/dialogs/dialog_edit_module_for_BoardEditor_base.fbp index 8413a47ab2..80a6083222 100644 --- a/pcbnew/dialogs/dialog_edit_module_for_BoardEditor_base.fbp +++ b/pcbnew/dialogs/dialog_edit_module_for_BoardEditor_base.fbp @@ -4764,11 +4764,11 @@ - + 5 wxEXPAND 0 - + bLowerSizer3D wxHORIZONTAL @@ -5069,106 +5069,18 @@ - + 5 wxALIGN_CENTER_VERTICAL 0 - + bSizer3DButtons wxVERTICAL none 5 - wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_BROWSE_3D_LIB - Browse Shapes - - 0 - - - 0 - - 1 - m_buttonBrowse - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - Browse3DLib - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND + wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxTOP|wxRIGHT|wxLEFT 0 1 @@ -5256,7 +5168,7 @@ 5 - wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND + wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxTOP|wxRIGHT|wxLEFT 0 1 @@ -5342,6 +5254,94 @@ + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Edit Filename + + 0 + + + 0 + + 1 + m_buttonEdit + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + Edit3DShapeFilename + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pcbnew/dialogs/dialog_edit_module_for_BoardEditor_base.h b/pcbnew/dialogs/dialog_edit_module_for_BoardEditor_base.h index 335a04ed32..366782bb9a 100644 --- a/pcbnew/dialogs/dialog_edit_module_for_BoardEditor_base.h +++ b/pcbnew/dialogs/dialog_edit_module_for_BoardEditor_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jun 6 2014) +// C++ code generated with wxFormBuilder (version Jun 5 2014) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -42,9 +42,8 @@ class DIALOG_SHIM; #define ID_LISTBOX_ORIENT_SELECT 1001 #define ID_MODULE_PROPERTIES_EXCHANGE 1002 #define ID_GOTO_MODULE_EDITOR 1003 -#define ID_BROWSE_3D_LIB 1004 -#define ID_ADD_3D_SHAPE 1005 -#define ID_REMOVE_3D_SHAPE 1006 +#define ID_ADD_3D_SHAPE 1004 +#define ID_REMOVE_3D_SHAPE 1005 /////////////////////////////////////////////////////////////////////////////// /// Class DIALOG_MODULE_BOARD_EDITOR_BASE @@ -114,9 +113,9 @@ class DIALOG_MODULE_BOARD_EDITOR_BASE : public DIALOG_SHIM wxStaticText* m_staticTextShapeOffset; wxBoxSizer* m_bSizerShapeRotation; wxStaticText* m_staticTextShapeRotation; - wxButton* m_buttonBrowse; wxButton* m_buttonAdd; wxButton* m_buttonRemove; + wxButton* m_buttonEdit; wxStdDialogButtonSizer* m_sdbSizerStdButtons; wxButton* m_sdbSizerStdButtonsOK; wxButton* m_sdbSizerStdButtonsCancel; @@ -128,9 +127,9 @@ class DIALOG_MODULE_BOARD_EDITOR_BASE : public DIALOG_SHIM virtual void ExchangeModule( wxCommandEvent& event ) { event.Skip(); } virtual void GotoModuleEditor( wxCommandEvent& event ) { event.Skip(); } virtual void On3DShapeNameSelected( wxCommandEvent& event ) { event.Skip(); } - virtual void Browse3DLib( wxCommandEvent& event ) { event.Skip(); } virtual void Add3DShape( wxCommandEvent& event ) { event.Skip(); } virtual void Remove3DShape( wxCommandEvent& event ) { event.Skip(); } + virtual void Edit3DShapeFilename( wxCommandEvent& event ) { event.Skip(); } virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); } diff --git a/pcbnew/dialogs/dialog_edit_module_for_Modedit.cpp b/pcbnew/dialogs/dialog_edit_module_for_Modedit.cpp index d196eb23ba..e2186c5f0f 100644 --- a/pcbnew/dialogs/dialog_edit_module_for_Modedit.cpp +++ b/pcbnew/dialogs/dialog_edit_module_for_Modedit.cpp @@ -7,10 +7,10 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 2014 Dick Hollenbeck, dick@softplc.com - * Copyright (C) 2008-2014 Wayne Stambaugh - * Copyright (C) 2004-2014 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 2015 Dick Hollenbeck, dick@softplc.com + * Copyright (C) 2008-2015 Wayne Stambaugh + * 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 @@ -51,6 +51,8 @@ #include #include +size_t DIALOG_MODULE_MODULE_EDITOR::m_page = 0; // remember the last open page during session + DIALOG_MODULE_MODULE_EDITOR::DIALOG_MODULE_MODULE_EDITOR( FOOTPRINT_EDIT_FRAME* aParent, MODULE* aModule ) : @@ -66,6 +68,9 @@ DIALOG_MODULE_MODULE_EDITOR::DIALOG_MODULE_MODULE_EDITOR( FOOTPRINT_EDIT_FRAME* m_FootprintNameCtrl->SetValidator( FILE_NAME_CHAR_VALIDATOR() ); initModeditProperties(); + + m_NoteBook->SetSelection( m_page ); + m_sdbSizerStdButtonsOK->SetDefault(); GetSizer()->SetSizeHints( this ); Centre(); @@ -74,6 +79,8 @@ DIALOG_MODULE_MODULE_EDITOR::DIALOG_MODULE_MODULE_EDITOR( FOOTPRINT_EDIT_FRAME* DIALOG_MODULE_MODULE_EDITOR::~DIALOG_MODULE_MODULE_EDITOR() { + m_page = m_NoteBook->GetSelection(); + for( unsigned ii = 0; ii < m_shapes3D_list.size(); ii++ ) delete m_shapes3D_list[ii]; @@ -287,6 +294,26 @@ void DIALOG_MODULE_MODULE_EDITOR::Remove3DShape(wxCommandEvent& event) } +void DIALOG_MODULE_MODULE_EDITOR::Edit3DShapeFileName() +{ + int idx = m_3D_ShapeNameListBox->GetSelection(); + + if( idx < 0 ) + return; + + // Edit filename + wxString filename = m_3D_ShapeNameListBox->GetStringSelection(); + + wxTextEntryDialog dlg( this, wxEmptyString, wxEmptyString, filename ); + dlg.SetTextValidator( FILE_NAME_WITH_PATH_CHAR_VALIDATOR( &filename ) ); + + if( dlg.ShowModal() != wxID_OK || filename.IsEmpty() ) + return; //Aborted by user + + m_3D_ShapeNameListBox->SetString( idx, filename ); +} + + void DIALOG_MODULE_MODULE_EDITOR::BrowseAndAdd3DShapeFile() { PROJECT& prj = Prj(); diff --git a/pcbnew/dialogs/dialog_edit_module_for_Modedit.h b/pcbnew/dialogs/dialog_edit_module_for_Modedit.h index 2d6aebdbd3..06fac763b2 100644 --- a/pcbnew/dialogs/dialog_edit_module_for_Modedit.h +++ b/pcbnew/dialogs/dialog_edit_module_for_Modedit.h @@ -1,8 +1,8 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2010-2014 Jean-Pierre Charras, jean-pierre.charras at wanadoo.fr - * Copyright (C) 1992-2014 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2010-2015 Jean-Pierre Charras, jean-pierre.charras at wanadoo.fr + * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -42,6 +42,7 @@ private: S3DPOINT_VALUE_CTRL * m_3D_Scale; S3DPOINT_VALUE_CTRL * m_3D_Offset; S3DPOINT_VALUE_CTRL * m_3D_Rotation; + static size_t m_page; // remember the last open page during session public: @@ -54,6 +55,7 @@ private: void initModeditProperties(); void Transfert3DValuesToDisplay( S3D_MASTER * aStruct3DSource ); void TransfertDisplayTo3DValues( int aIndexSelection ); + void Edit3DShapeFileName(); // virtual event functions void OnEditValue( wxCommandEvent& event ); @@ -65,6 +67,10 @@ private: BrowseAndAdd3DShapeFile(); } void Remove3DShape( wxCommandEvent& event ); + void Edit3DShapeFilename( wxCommandEvent& event ) + { + Edit3DShapeFileName(); + } void OnCancelClick( wxCommandEvent& event ); void OnOkClick( wxCommandEvent& event ); }; diff --git a/pcbnew/dialogs/dialog_edit_module_for_Modedit_base.cpp b/pcbnew/dialogs/dialog_edit_module_for_Modedit_base.cpp index 6e404ab13c..2256d65a6a 100644 --- a/pcbnew/dialogs/dialog_edit_module_for_Modedit_base.cpp +++ b/pcbnew/dialogs/dialog_edit_module_for_Modedit_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jun 6 2014) +// C++ code generated with wxFormBuilder (version Jun 5 2014) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -291,10 +291,13 @@ DIALOG_MODULE_MODULE_EDITOR_BASE::DIALOG_MODULE_MODULE_EDITOR_BASE( wxWindow* pa bSizer3DButtons = new wxBoxSizer( wxVERTICAL ); m_buttonBrowse = new wxButton( m_Panel3D, ID_BROWSE_3D_LIB, _("Add 3D Shape"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizer3DButtons->Add( m_buttonBrowse, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); + bSizer3DButtons->Add( m_buttonBrowse, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); m_buttonRemove = new wxButton( m_Panel3D, ID_REMOVE_3D_SHAPE, _("Remove 3D Shape"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizer3DButtons->Add( m_buttonRemove, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); + bSizer3DButtons->Add( m_buttonRemove, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); + + m_buttonEdit = new wxButton( m_Panel3D, wxID_ANY, _("Edit Filename"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer3DButtons->Add( m_buttonEdit, 0, wxALL|wxEXPAND, 5 ); bLowerSizer3D->Add( bSizer3DButtons, 0, wxALIGN_CENTER_VERTICAL, 5 ); @@ -329,6 +332,7 @@ DIALOG_MODULE_MODULE_EDITOR_BASE::DIALOG_MODULE_MODULE_EDITOR_BASE( wxWindow* pa m_3D_ShapeNameListBox->Connect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( DIALOG_MODULE_MODULE_EDITOR_BASE::On3DShapeNameSelected ), NULL, this ); m_buttonBrowse->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_MODULE_EDITOR_BASE::Add3DShape ), NULL, this ); m_buttonRemove->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_MODULE_EDITOR_BASE::Remove3DShape ), NULL, this ); + m_buttonEdit->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_MODULE_EDITOR_BASE::Edit3DShapeFilename ), NULL, this ); m_sdbSizerStdButtonsCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_MODULE_EDITOR_BASE::OnCancelClick ), NULL, this ); m_sdbSizerStdButtonsOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_MODULE_EDITOR_BASE::OnOkClick ), NULL, this ); } @@ -341,6 +345,7 @@ DIALOG_MODULE_MODULE_EDITOR_BASE::~DIALOG_MODULE_MODULE_EDITOR_BASE() m_3D_ShapeNameListBox->Disconnect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( DIALOG_MODULE_MODULE_EDITOR_BASE::On3DShapeNameSelected ), NULL, this ); m_buttonBrowse->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_MODULE_EDITOR_BASE::Add3DShape ), NULL, this ); m_buttonRemove->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_MODULE_EDITOR_BASE::Remove3DShape ), NULL, this ); + m_buttonEdit->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_MODULE_EDITOR_BASE::Edit3DShapeFilename ), NULL, this ); m_sdbSizerStdButtonsCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_MODULE_EDITOR_BASE::OnCancelClick ), NULL, this ); m_sdbSizerStdButtonsOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODULE_MODULE_EDITOR_BASE::OnOkClick ), NULL, this ); diff --git a/pcbnew/dialogs/dialog_edit_module_for_Modedit_base.fbp b/pcbnew/dialogs/dialog_edit_module_for_Modedit_base.fbp index 11bfde271e..2722bffc4f 100644 --- a/pcbnew/dialogs/dialog_edit_module_for_Modedit_base.fbp +++ b/pcbnew/dialogs/dialog_edit_module_for_Modedit_base.fbp @@ -3801,7 +3801,7 @@ 5 wxALL|wxEXPAND 0 - + bLowerSizer3D wxHORIZONTAL @@ -4113,7 +4113,7 @@ none 5 - wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND + wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxTOP|wxRIGHT|wxLEFT 0 1 @@ -4201,7 +4201,7 @@ 5 - wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND + wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxTOP|wxRIGHT|wxLEFT 0 1 @@ -4287,6 +4287,94 @@ + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Edit Filename + + 0 + + + 0 + + 1 + m_buttonEdit + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + Edit3DShapeFilename + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pcbnew/dialogs/dialog_edit_module_for_Modedit_base.h b/pcbnew/dialogs/dialog_edit_module_for_Modedit_base.h index f617580944..e4057ea805 100644 --- a/pcbnew/dialogs/dialog_edit_module_for_Modedit_base.h +++ b/pcbnew/dialogs/dialog_edit_module_for_Modedit_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jun 6 2014) +// C++ code generated with wxFormBuilder (version Jun 5 2014) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -101,6 +101,7 @@ class DIALOG_MODULE_MODULE_EDITOR_BASE : public DIALOG_SHIM wxStaticText* m_staticTextShapeRotation; wxButton* m_buttonBrowse; wxButton* m_buttonRemove; + wxButton* m_buttonEdit; wxStdDialogButtonSizer* m_sdbSizerStdButtons; wxButton* m_sdbSizerStdButtonsOK; wxButton* m_sdbSizerStdButtonsCancel; @@ -111,6 +112,7 @@ class DIALOG_MODULE_MODULE_EDITOR_BASE : public DIALOG_SHIM virtual void On3DShapeNameSelected( wxCommandEvent& event ) { event.Skip(); } virtual void Add3DShape( wxCommandEvent& event ) { event.Skip(); } virtual void Remove3DShape( wxCommandEvent& event ) { event.Skip(); } + virtual void Edit3DShapeFilename( wxCommandEvent& event ) { event.Skip(); } virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); } From 4265fa60bd02fcb73484de8a13a5f61cb594edd8 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Tue, 3 Feb 2015 11:35:46 +0100 Subject: [PATCH 25/29] =?UTF-8?q?Pcbnew=20-=20plot=20dialog:=20fix=20Bug?= =?UTF-8?q?=20#1417435=20(Gerber(and=20some=20others)=20=20plot=20mode=20i?= =?UTF-8?q?s=20fixed=20as=E2=80=9Dsketch=E2=80=9D=20instead=20of=20"filled?= =?UTF-8?q?"=20)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pcbnew/dialogs/dialog_plot.cpp | 12 ++++++------ pcbnew/dialogs/dialog_plot.h | 12 ++++++++++-- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/pcbnew/dialogs/dialog_plot.cpp b/pcbnew/dialogs/dialog_plot.cpp index d8f5263686..2ade29e32b 100644 --- a/pcbnew/dialogs/dialog_plot.cpp +++ b/pcbnew/dialogs/dialog_plot.cpp @@ -193,7 +193,7 @@ void DIALOG_PLOT::Init_Dialog() m_scaleOpt->SetSelection( m_plotOpts.GetScaleSelection() ); // Plot mode - m_plotModeOpt->SetSelection( m_plotOpts.GetPlotMode() == SKETCH ? 1 : 0 ); + setPlotModeChoiceSelection( m_plotOpts.GetPlotMode() ); // Plot mirror option m_plotMirrorOpt->SetValue( m_plotOpts.GetMirror() ); @@ -335,7 +335,7 @@ void DIALOG_PLOT::OnOutputDirectoryBrowseClicked( wxCommandEvent& event ) } -PlotFormat DIALOG_PLOT::GetPlotFormat() +PlotFormat DIALOG_PLOT::getPlotFormat() { // plot format id's are ordered like displayed in m_plotFormatOpt static const PlotFormat plotFmt[] = @@ -356,13 +356,13 @@ PlotFormat DIALOG_PLOT::GetPlotFormat() // and clear also some optional values void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event ) { - switch( GetPlotFormat() ) + switch( getPlotFormat() ) { case PLOT_FORMAT_PDF: case PLOT_FORMAT_SVG: m_drillShapeOpt->Enable( true ); m_plotModeOpt->Enable( false ); - m_plotModeOpt->SetSelection( 1 ); + setPlotModeChoiceSelection( FILLED ); m_plotMirrorOpt->Enable( true ); m_useAuxOriginCheckBox->Enable( false ); m_useAuxOriginCheckBox->SetValue( false ); @@ -422,7 +422,7 @@ void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event ) m_drillShapeOpt->Enable( false ); m_drillShapeOpt->SetSelection( 0 ); m_plotModeOpt->Enable( false ); - m_plotModeOpt->SetSelection( 1 ); + setPlotModeChoiceSelection( FILLED ); m_plotMirrorOpt->Enable( false ); m_plotMirrorOpt->SetValue( false ); m_useAuxOriginCheckBox->Enable( true ); @@ -669,7 +669,7 @@ void DIALOG_PLOT::applyPlotSettings() ConfigBaseWriteDouble( m_config, CONFIG_PS_FINEWIDTH_ADJ, (double)m_PSWidthAdjust / IU_PER_MM ); - tempOptions.SetFormat( GetPlotFormat() ); + tempOptions.SetFormat( getPlotFormat() ); tempOptions.SetUseGerberExtensions( m_useGerberExtensions->GetValue() ); tempOptions.SetUseGerberAttributes( m_useGerberAttributes->GetValue() ); diff --git a/pcbnew/dialogs/dialog_plot.h b/pcbnew/dialogs/dialog_plot.h index b041ba7a55..47f4692ace 100644 --- a/pcbnew/dialogs/dialog_plot.h +++ b/pcbnew/dialogs/dialog_plot.h @@ -57,6 +57,7 @@ private: PCB_PLOT_PARAMS m_plotOpts; + // Event called functions void Init_Dialog(); void Plot( wxCommandEvent& event ); void OnQuit( wxCommandEvent& event ); @@ -66,7 +67,14 @@ private: void OnPopUpLayers( wxCommandEvent& event ); void SetPlotFormat( wxCommandEvent& event ); void OnSetScaleOpt( wxCommandEvent& event ); - void applyPlotSettings(); void CreateDrillFile( wxCommandEvent& event ); - PlotFormat GetPlotFormat(); + + // orther functions + void applyPlotSettings(); + PlotFormat getPlotFormat(); + + void setPlotModeChoiceSelection( EDA_DRAW_MODE_T aPlotMode ) + { + m_plotModeOpt->SetSelection( aPlotMode == SKETCH ? 1 : 0 ); + } }; From bd199b894ec9c5c50b1ed2b5502d55617ac9717c Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Tue, 3 Feb 2015 15:42:33 -0500 Subject: [PATCH 26/29] Set default footprint library table and 3D model library environment variables. --- CMakeModules/config.h.cmake | 9 ++++ common/pgm_base.cpp | 86 ++++++++++++++++++++++++++++++++++--- include/pgm_base.h | 31 ++++++++++--- 3 files changed, 116 insertions(+), 10 deletions(-) diff --git a/CMakeModules/config.h.cmake b/CMakeModules/config.h.cmake index d5aaf1843e..27c1117a16 100644 --- a/CMakeModules/config.h.cmake +++ b/CMakeModules/config.h.cmake @@ -61,6 +61,15 @@ /// The install prefix defined in CMAKE_INSTALL_PREFIX. #define DEFAULT_INSTALL_PATH "@CMAKE_INSTALL_PREFIX@" +/// The install prefix used for KiCad's libraries. +/// These paths are only intended to be reasonable default values that work if +/// the user installs KiCad in the default path for a given platform. +#if defined( APPLE ) +#define KICAD_DATA_PATH "/Library/Application Support/kicad" +#else +#define KICAD_DATA_PATH "@CMAKE_INSTALL_PREFIX@/@KICAD_DATA@" +#endif + /// When defined, build the GITHUB_PLUGIN for pcbnew. #cmakedefine BUILD_GITHUB_PLUGIN diff --git a/common/pgm_base.cpp b/common/pgm_base.cpp index a708ecdd56..1f8b01ff2f 100644 --- a/common/pgm_base.cpp +++ b/common/pgm_base.cpp @@ -51,14 +51,16 @@ #include -#define KICAD_COMMON wxT( "kicad_common" ) +#define KICAD_COMMON wxT( "kicad_common" ) // some key strings used to store parameters in KICAD_COMMON -const wxChar PGM_BASE::workingDirKey[] = wxT( "WorkingDir" ); // public +const wxChar PGM_BASE::workingDirKey[] = wxT( "WorkingDir" ); // public -static const wxChar languageCfgKey[] = wxT( "LanguageID" ); -static const wxChar kicadFpLibPath[] = wxT( "KicadFootprintLibraryPath" ); +static const wxChar languageCfgKey[] = wxT( "LanguageID" ); +static const wxChar kicadFpLibPath[] = wxT( "KicadFootprintLibraryPath" ); +static const wxChar pathEnvVariables[] = wxT( "EnvironmentVariables" ); +static const wxChar traceEnvVars[] = wxT( "KIENVVARS" ); /** @@ -353,7 +355,8 @@ bool PGM_BASE::initPgm() wxInitAllImageHandlers(); - m_pgm_checker = new wxSingleInstanceChecker( pgm_name.GetName().Lower() + wxT( "-" ) + wxGetUserId(), GetKicadLockFilePath() ); + m_pgm_checker = new wxSingleInstanceChecker( pgm_name.GetName().Lower() + wxT( "-" ) + + wxGetUserId(), GetKicadLockFilePath() ); if( m_pgm_checker->IsAnotherRunning() ) { @@ -361,6 +364,7 @@ bool PGM_BASE::initPgm() _( "%s is already running, Continue?" ), GetChars( pgm_name.GetName() ) ); + if( !IsOK( NULL, quiz ) ) return false; } @@ -399,6 +403,17 @@ bool PGM_BASE::initPgm() SetLanguagePath(); + // Useful local environment variable settings. + m_local_env_vars[ wxString( wxT( "KIGITHUB" ) ) ] = + wxString( wxT( "https://github.com/KiCad" ) ); + + wxFileName tmpFileName; + tmpFileName.AssignDir( wxString( wxT( KICAD_DATA_PATH ) ) ); + tmpFileName.AppendDir( wxT( "modules" ) ); + m_local_env_vars[ wxString( wxT( "KISYSMOD" ) ) ] = tmpFileName.GetPath(); + tmpFileName.AppendDir( wxT( "packages3d" ) ); + m_local_env_vars[ wxString( wxT( "KISYS3DMOD" ) ) ] = tmpFileName.GetPath(); + // OS specific instantiation of wxConfigBase derivative: m_common_settings = GetNewConfig( KICAD_COMMON ); @@ -425,6 +440,7 @@ bool PGM_BASE::setExecutablePath() // bundle directory, e.g., /Applications/kicad.app/ wxFileName fn( m_bin_dir ); + if( fn.GetName() == wxT( "kicad" ) ) { // kicad launcher, so just remove the Contents/MacOS part @@ -440,6 +456,7 @@ bool PGM_BASE::setExecutablePath() fn.RemoveLastDir(); fn.RemoveLastDir(); } + m_bin_dir = fn.GetPath() + wxT( "/" ); #else // Use unix notation for paths. I am not sure this is a good idea, @@ -479,6 +496,33 @@ void PGM_BASE::loadCommonSettings() } m_editor_name = m_common_settings->Read( wxT( "Editor" ) ); + + wxString entry, oldPath; + wxArrayString entries; + long index = 0L; + + oldPath = m_common_settings->GetPath(); + m_common_settings->SetPath( pathEnvVariables ); + + while( m_common_settings->GetNextEntry( entry, index ) ) + { + wxLogTrace( traceEnvVars, + wxT( "Enumerating over entry %s, %ld." ), GetChars( entry ), index ); + entries.Add( entry ); + } + + for( unsigned i = 0; i < entries.GetCount(); i++ ) + { + wxString val = m_common_settings->Read( entries[i], wxEmptyString ); + m_local_env_vars[ entries[i] ] = val; + } + + for( std::map::iterator it = m_local_env_vars.begin(); + it != m_local_env_vars.end(); + ++it ) + SetLocalEnvVariable( it->first, it->second ); + + m_common_settings->SetPath( oldPath ); } @@ -491,6 +535,20 @@ void PGM_BASE::saveCommonSettings() wxString cur_dir = wxGetCwd(); m_common_settings->Write( workingDirKey, cur_dir ); + + // Save the local environment variables. + m_common_settings->SetPath( pathEnvVariables ); + + for( std::map::iterator it = m_local_env_vars.begin(); + it != m_local_env_vars.end(); + ++it ) + { + wxLogTrace( traceEnvVars, wxT( "Saving environment varaiable config entry %s as %s" ), + GetChars( it->first ), GetChars( it->second ) ); + m_common_settings->Write( it->first, it->second ); + } + + m_common_settings->SetPath( wxT( ".." ) ); } } @@ -665,3 +723,21 @@ void PGM_BASE::AddMenuLanguageList( wxMenu* MasterMenu ) } } + +bool PGM_BASE::SetLocalEnvVariable( const wxString& aName, const wxString& aValue ) +{ + wxString env; + + // Check to see if the environment variable is already set. + if( wxGetEnv( aName, &env ) ) + { + wxLogTrace( traceEnvVars, wxT( "Environment variable %s already set to %s." ), + GetChars( aName ), GetChars( env ) ); + return env == aValue; + } + + wxLogTrace( traceEnvVars, wxT( "Setting local environment variable %s to %s." ), + GetChars( aName ), GetChars( aValue ) ); + + return wxSetEnv( aName, aValue ); +} diff --git a/include/pgm_base.h b/include/pgm_base.h index 8b151996de..be340e7406 100644 --- a/include/pgm_base.h +++ b/include/pgm_base.h @@ -1,9 +1,9 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com - * Copyright (C) 2008-2011 Wayne Stambaugh - * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2004-2015 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com + * Copyright (C) 2008-2015 Wayne Stambaugh + * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -31,6 +31,7 @@ #ifndef PGM_BASE_H_ #define PGM_BASE_H_ +#include #include #include #include @@ -109,7 +110,7 @@ public: /** * Function UseSystemPdfBrowser * returns true if the PDF browser is the default (system) PDF browser - * and false if the PDF browser is the prefered (selected) browser, else + * and false if the PDF browser is the preferred (selected) browser, else * returns false if there is no selected browser */ VTBL_ENTRY bool UseSystemPdfBrowser() const @@ -119,7 +120,7 @@ public: /** * Function ForceSystemPdfBrowser - * forces the use of system PDF browser, even if a preferend PDF browser is set. + * forces the use of system PDF browser, even if a preferred PDF browser is set. */ VTBL_ENTRY void ForceSystemPdfBrowser( bool aFlg ) { m_use_system_pdf_browser = aFlg; } @@ -168,6 +169,22 @@ public: */ VTBL_ENTRY void WritePdfBrowserInfos(); + /** + * Function SetLocalEnvVariable + * + * Sets the environment variable \a aName to \a aValue. + * + * This function first checks to see if the environment variable \a aName is already + * defined. If it is not defined, then the environment variable \a aName is set to + * a value. Otherwise, the environment variable is left unchanged. This allows the user + * to override environment variables for testing purposes. + * + * @param aName is a wxString containing the environment variable name. + * @param aValue is a wxString containing the environment variable value. + * @return true if the environment variable \a Name was set to \a aValue. + */ + VTBL_ENTRY bool SetLocalEnvVariable( const wxString& aName, const wxString& aValue ); + /** * Function App * returns a bare naked wxApp, which may come from wxPython, SINGLE_TOP, or kicad.exe. @@ -247,6 +264,10 @@ protected: wxString m_editor_name; wxSize m_help_size; + /// Local environment variable expansion settings such as KIGITHUB, KISYSMOD, and KISYS3DMOD. + /// library table. + std::map m_local_env_vars; + wxApp* m_wx_app; // The PGM_* classes can have difficulties at termination if they From 1ed8cdf63a566037b2eb53b49e77bb3aaea02693 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Fri, 6 Feb 2015 11:49:09 +0100 Subject: [PATCH 27/29] Pcbnew build: Set KICAD_USE_WEBKIT option default value to OFF. There are 3 reasons: * Using a Web navigator embedded in Kicad can create security issues in Kicad. * The web kit is not always easily available on Linux. * There is now a tool in kicad fp lib wizard to list and select the .pretty libs available on Github Kicad repo (When the kicad plugin is selected, this tool can download and make a local copy of these libs) However, using -D KICAD_USE_WEBKIT=ON when invoking cmake still build the embedded web viewer. --- CMakeLists.txt | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ecf6608d50..b38fb8eed2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,13 +45,17 @@ option( KICAD_KEEPCASE # * No issues on Windows. # * needs webkitgtk-devel package installed on Linux, and wxWidgets rebuilt with this package. # * Seems also OK on OSX. -# However the default option is on and has effect only if BUILD_GITHUB_PLUGIN is ON -# This option could be removed soon, if no serious issue happens on Linux +# This option has effect only if BUILD_GITHUB_PLUGIN is ON +# +# This option is set to OFF because Kicad developers cannot be sure the use of Webkit does no open +# a security issue when runnig Kicad. +# the probability is low, but not zero. option( KICAD_USE_WEBKIT "Use system web kit to build a web viewer in footprint library wizard to easily select github libraries (default ON)." - ON + OFF ) + option( USE_WX_GRAPHICS_CONTEXT "Use wxGraphicsContext for rendering (default OFF). Warning, this is experimental" ) @@ -90,7 +94,6 @@ option( KICAD_SKIP_BOOST ) mark_as_advanced( KICAD_SKIP_BOOST ) # Normal builders should build Boost. - # when option KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES is enabled: # PYTHON_EXECUTABLE can be defined when invoking cmake # ( use -DPYTHON_EXECUTABLE=/python.exe or python2 ) @@ -99,6 +102,18 @@ mark_as_advanced( KICAD_SKIP_BOOST ) # Normal builders should build Boost. option( BUILD_GITHUB_PLUGIN "Build the GITHUB_PLUGIN for pcbnew." ON ) +# When KICAD_USE_WEBKIT in on, the Kicad web viewer has access to the www. +# Kicad developers cannot be sure the use of Web viewer does no open a security issue when runnig Kicad. +# the probability is low, but not zero. +#so warn the user: +if( KICAD_USE_WEBKIT ) + message( STATUS "by setting KICAD_USE_WEBKIT ON, you are building a web viewer inside Kicad. +Kicad developers cannot be sure the Web access does no open a security issue, +when running a Web Viewer inside Kicad. The probability is low, but not zero. +You are warned" ) +endif() + + # This can be set to a custom name to brag about a particular branch in the "About" dialog: set( KICAD_REPO_NAME "product" CACHE STRING "Name of the tree from which this build came." ) From d52436aed8d6edb5a1562869bb2022a6c082133e Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Fri, 6 Feb 2015 11:54:55 +0100 Subject: [PATCH 28/29] Pcbnew: fix Bug #1418135 (scrollbars never shown in design rules dialog, in netclasses grid list, which prevent to use many netclasses). Also fix very minor other issues. --- pcbnew/clean.cpp | 6 +- pcbnew/dialogs/dialog_design_rules_base.cpp | 6 +- pcbnew/dialogs/dialog_design_rules_base.fbp | 8 +- pcbnew/dialogs/dialog_design_rules_base.h | 2 +- .../dialogs/dialog_display_options_base.cpp | 2 +- .../dialogs/dialog_display_options_base.fbp | 2 +- pcbnew/dialogs/dialog_pns_settings.cpp | 3 + pcbnew/dialogs/dialog_pns_settings_base.cpp | 5 +- pcbnew/dialogs/dialog_pns_settings_base.fbp | 97 +++++++++++++++++-- pcbnew/dialogs/dialog_pns_settings_base.h | 4 +- 10 files changed, 113 insertions(+), 22 deletions(-) diff --git a/pcbnew/clean.cpp b/pcbnew/clean.cpp index b07936d61e..25ff081b6c 100644 --- a/pcbnew/clean.cpp +++ b/pcbnew/clean.cpp @@ -294,6 +294,7 @@ const ZONE_CONTAINER* TRACKS_CLEANER::zoneForTrackEndpoint( const TRACK *aTrack, top_layer = aTrack->GetLayer(); bottom_layer = top_layer; } + return m_Brd->HitTestForAnyFilledArea( aTrack->GetEndPoint( aEndPoint ), top_layer, bottom_layer, aTrack->GetNetCode() ); } @@ -305,8 +306,8 @@ bool TRACKS_CLEANER::testTrackEndpointDangling( TRACK *aTrack, ENDPOINT_T aEndPo bool flag_erase = false; TRACK* other = aTrack->GetTrack( m_Brd->m_Track, NULL, aEndPoint, true, false ); - if( (other == NULL) && - (zoneForTrackEndpoint( aTrack, aEndPoint ) == NULL) ) + + if( (other == NULL) && (zoneForTrackEndpoint( aTrack, aEndPoint ) == NULL) ) flag_erase = true; // Start endpoint is neither on pad, zone or other track else // segment, via or zone connected to this end { @@ -336,6 +337,7 @@ bool TRACKS_CLEANER::testTrackEndpointDangling( TRACK *aTrack, ENDPOINT_T aEndPo aTrack->SetState( BUSY, false ); } } + return flag_erase; } diff --git a/pcbnew/dialogs/dialog_design_rules_base.cpp b/pcbnew/dialogs/dialog_design_rules_base.cpp index 67ed0a5180..a0a7f61816 100644 --- a/pcbnew/dialogs/dialog_design_rules_base.cpp +++ b/pcbnew/dialogs/dialog_design_rules_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Nov 6 2013) +// C++ code generated with wxFormBuilder (version Jun 5 2014) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -54,8 +54,7 @@ DIALOG_DESIGN_RULES_BASE::DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID m_grid->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); // Rows - m_grid->AutoSizeRows(); - m_grid->EnableDragRowSize( true ); + m_grid->EnableDragRowSize( false ); m_grid->SetRowLabelSize( 120 ); m_grid->SetRowLabelValue( 0, _("Default") ); m_grid->SetRowLabelAlignment( wxALIGN_LEFT, wxALIGN_CENTRE ); @@ -65,6 +64,7 @@ DIALOG_DESIGN_RULES_BASE::DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID // Cell Defaults m_grid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP ); m_grid->SetToolTip( _("Net Class parameters") ); + m_grid->SetMinSize( wxSize( -1,150 ) ); sbSizerUpper->Add( m_grid, 1, wxEXPAND, 5 ); diff --git a/pcbnew/dialogs/dialog_design_rules_base.fbp b/pcbnew/dialogs/dialog_design_rules_base.fbp index e36c17226b..69b2143f6c 100644 --- a/pcbnew/dialogs/dialog_design_rules_base.fbp +++ b/pcbnew/dialogs/dialog_design_rules_base.fbp @@ -1,6 +1,6 @@ - + C++ @@ -284,7 +284,7 @@ 0 - 1 + 0 @@ -311,7 +311,7 @@ 0 1 0 - 1 + 0 1 1 @@ -332,7 +332,7 @@ 0 - -1,-1 + -1,150 1 m_grid 1 diff --git a/pcbnew/dialogs/dialog_design_rules_base.h b/pcbnew/dialogs/dialog_design_rules_base.h index d553d4844d..d9565ba41b 100644 --- a/pcbnew/dialogs/dialog_design_rules_base.h +++ b/pcbnew/dialogs/dialog_design_rules_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Nov 6 2013) +// C++ code generated with wxFormBuilder (version Jun 5 2014) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! diff --git a/pcbnew/dialogs/dialog_display_options_base.cpp b/pcbnew/dialogs/dialog_display_options_base.cpp index 10c4c7ac5c..5e30109330 100644 --- a/pcbnew/dialogs/dialog_display_options_base.cpp +++ b/pcbnew/dialogs/dialog_display_options_base.cpp @@ -95,7 +95,7 @@ DIALOG_DISPLAY_OPTIONS_BASE::DIALOG_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWi wxStaticBoxSizer* s_otherSizer; s_otherSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Others:") ), wxVERTICAL ); - m_OptDisplayDrawings = new wxCheckBox( this, wxID_ANY, _("Graphic items sketch mode"), wxDefaultPosition, wxDefaultSize, 0 ); + m_OptDisplayDrawings = new wxCheckBox( this, wxID_ANY, _("Graphic items sketch mode"), wxDefaultPosition, wxDefaultSize, 0 ); m_OptDisplayDrawings->SetValue(true); s_otherSizer->Add( m_OptDisplayDrawings, 0, wxALL, 5 ); diff --git a/pcbnew/dialogs/dialog_display_options_base.fbp b/pcbnew/dialogs/dialog_display_options_base.fbp index 6a98fabb62..bfb48421cc 100644 --- a/pcbnew/dialogs/dialog_display_options_base.fbp +++ b/pcbnew/dialogs/dialog_display_options_base.fbp @@ -1172,7 +1172,7 @@ 0 0 wxID_ANY - Graphic items sketch mode + Graphic items sketch mode 0 diff --git a/pcbnew/dialogs/dialog_pns_settings.cpp b/pcbnew/dialogs/dialog_pns_settings.cpp index 0368294ab1..a243f40c9c 100644 --- a/pcbnew/dialogs/dialog_pns_settings.cpp +++ b/pcbnew/dialogs/dialog_pns_settings.cpp @@ -41,6 +41,9 @@ DIALOG_PNS_SETTINGS::DIALOG_PNS_SETTINGS( wxWindow* aParent, PNS_ROUTING_SETTING m_effort->SetValue( m_settings.OptimizerEffort() ); m_smoothDragged->SetValue( m_settings.SmoothDraggedSegments() ); m_violateDrc->SetValue( m_settings.CanViolateDRC() ); + + GetSizer()->Fit( this ); + GetSizer()->SetSizeHints( this ); } diff --git a/pcbnew/dialogs/dialog_pns_settings_base.cpp b/pcbnew/dialogs/dialog_pns_settings_base.cpp index 7fc9eff220..d1a0a2f201 100644 --- a/pcbnew/dialogs/dialog_pns_settings_base.cpp +++ b/pcbnew/dialogs/dialog_pns_settings_base.cpp @@ -11,7 +11,7 @@ DIALOG_PNS_SETTINGS_BASE::DIALOG_PNS_SETTINGS_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style ) { - this->SetSizeHints( wxSize( 280,480 ), wxDefaultSize ); + this->SetSizeHints( wxSize( 350,-1 ), wxDefaultSize ); wxBoxSizer* bMainSizer; bMainSizer = new wxBoxSizer( wxVERTICAL ); @@ -48,6 +48,9 @@ DIALOG_PNS_SETTINGS_BASE::DIALOG_PNS_SETTINGS_BASE( wxWindow* parent, wxWindowID bOptions->Add( m_suggestEnding, 0, wxALL, 5 ); + m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bOptions->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 ); + wxBoxSizer* bEffort; bEffort = new wxBoxSizer( wxHORIZONTAL ); diff --git a/pcbnew/dialogs/dialog_pns_settings_base.fbp b/pcbnew/dialogs/dialog_pns_settings_base.fbp index b15698ba15..5eb3f90215 100644 --- a/pcbnew/dialogs/dialog_pns_settings_base.fbp +++ b/pcbnew/dialogs/dialog_pns_settings_base.fbp @@ -41,10 +41,10 @@ 0 wxID_ANY - 280,480 + 350,-1 DIALOG_PNS_SETTINGS_BASE - 286,480 + 358,393 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER DIALOG_SHIM; dialog_shim.h Interactive Router settings @@ -183,11 +183,11 @@ - + 5 wxEXPAND|wxALL 1 - + wxID_ANY Options @@ -811,6 +811,87 @@ + + 5 + wxEXPAND | wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_staticline1 + 1 + + + protected + 1 + + Resizable + 1 + + wxLI_HORIZONTAL + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 wxEXPAND @@ -913,11 +994,11 @@ 0 - + 5 wxEXPAND 1 - + bSlider wxVERTICAL @@ -1030,11 +1111,11 @@ - + 5 wxEXPAND 1 - + bSliderLabels wxHORIZONTAL diff --git a/pcbnew/dialogs/dialog_pns_settings_base.h b/pcbnew/dialogs/dialog_pns_settings_base.h index d85930dd44..9e9bbad0ba 100644 --- a/pcbnew/dialogs/dialog_pns_settings_base.h +++ b/pcbnew/dialogs/dialog_pns_settings_base.h @@ -21,6 +21,7 @@ class DIALOG_SHIM; #include #include #include +#include #include #include #include @@ -47,6 +48,7 @@ class DIALOG_PNS_SETTINGS_BASE : public DIALOG_SHIM wxCheckBox* m_smoothDragged; wxCheckBox* m_violateDrc; wxCheckBox* m_suggestEnding; + wxStaticLine* m_staticline1; wxStaticText* m_effortLabel; wxSlider* m_effort; wxStaticText* m_lowLabel; @@ -63,7 +65,7 @@ class DIALOG_PNS_SETTINGS_BASE : public DIALOG_SHIM public: - DIALOG_PNS_SETTINGS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Interactive Router settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 286,480 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + DIALOG_PNS_SETTINGS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Interactive Router settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 358,393 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~DIALOG_PNS_SETTINGS_BASE(); }; From 8f1addc1f831abe5ea4da0114f92a56a4b4cd084 Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Fri, 6 Feb 2015 10:34:11 -0500 Subject: [PATCH 29/29] Fix serious memory leak in schematic part library manager. --- eeschema/class_libentry.cpp | 29 ++++++++++++++++++----------- eeschema/class_libentry.h | 13 +++++++++---- eeschema/class_library.cpp | 22 +++++++++++++++++++--- 3 files changed, 46 insertions(+), 18 deletions(-) diff --git a/eeschema/class_libentry.cpp b/eeschema/class_libentry.cpp index e834516693..bb3f9148c8 100644 --- a/eeschema/class_libentry.cpp +++ b/eeschema/class_libentry.cpp @@ -61,6 +61,9 @@ int LIB_PART::m_subpartIdSeparator = 0; int LIB_PART::m_subpartFirstId = 'A'; +const wxChar traceSchLibMem[] = wxT( "KISCHLIBMEM" ); // public + + LIB_ALIAS::LIB_ALIAS( const wxString& aName, LIB_PART* aRootPart ): EDA_ITEM( LIB_ALIAS_T ), shared( aRootPart ) @@ -85,10 +88,10 @@ LIB_ALIAS::~LIB_ALIAS() { wxASSERT_MSG( shared, wxT( "~LIB_ALIAS() without a LIB_PART" ) ); -#if defined(DEBUG) && 1 - printf( "%s: destroying alias:'%s' of part:'%s' alias count:%d.\n", - __func__, TO_UTF8( name ), TO_UTF8( shared->GetName() ), int( shared->m_aliases.size() ) ); -#endif + wxLogTrace( traceSchLibMem, + wxT( "%s: destroying alias:'%s' of part:'%s'." ), + GetChars( wxString::FromAscii( __WXFUNCTION__ ) ), GetChars( name ), + GetChars( shared->GetName() ) ); if( shared ) shared->RemoveAlias( this ); @@ -241,9 +244,10 @@ LIB_PART::LIB_PART( LIB_PART& aPart, PART_LIB* aLibrary ) : LIB_PART::~LIB_PART() { - wxLogDebug( wxT( "%s: destroying part '%s' with alias list count of %d\n" ), + wxLogTrace( traceSchLibMem, + wxT( "%s: destroying part '%s' with alias list count of %u." ), GetChars( wxString::FromAscii( __WXFUNCTION__ ) ), GetChars( GetName() ), - int( m_aliases.size() ) ); + m_aliases.size() ); // If the part is being deleted directly rather than through the library, // delete all of the aliases. @@ -481,7 +485,7 @@ void LIB_PART::RemoveDrawItem( LIB_ITEM* aItem, EDA_DRAW_PANEL* aPanel, wxDC* aD { wxASSERT( aItem != NULL ); - // none of the MANDATOR_FIELDS may be removed in RAM, but they may be + // none of the MANDATORY_FIELDS may be removed in RAM, but they may be // omitted when saving to disk. if( aItem->Type() == LIB_FIELD_T ) { @@ -1692,10 +1696,13 @@ LIB_ALIAS* LIB_PART::RemoveAlias( LIB_ALIAS* aAlias ) { bool rename = aAlias->IsRoot(); - DBG( printf( "%s: part:'%s' alias:'%s'\n", __func__, - TO_UTF8( m_name ), - TO_UTF8( aAlias->GetName() ) - );) + wxLogTrace( traceSchLibMem, + wxT( "%s: part:'%s', alias:'%s', alias count %u, reference count %d." ), + GetChars( wxString::FromAscii( __WXFUNCTION__ ) ), + GetChars( m_name ), + GetChars( aAlias->GetName() ), + m_aliases.size(), + m_me.use_count() ); it = m_aliases.erase( it ); diff --git a/eeschema/class_libentry.h b/eeschema/class_libentry.h index 21374863df..7c6d086bbf 100644 --- a/eeschema/class_libentry.h +++ b/eeschema/class_libentry.h @@ -1,9 +1,9 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2004 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 2008-2011 Wayne Stambaugh - * Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 2004-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 2008-2015 Wayne Stambaugh + * 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 @@ -34,6 +34,7 @@ #include #include #include +#include class LINE_READER; class OUTPUTFORMATTER; @@ -69,6 +70,10 @@ enum LibrEntryOptions }; +/// WXTRACE value to enable schematic library memory deletion debug output. +extern const wxChar traceSchLibMem[]; + + /** * Part library alias object definition. * @@ -153,7 +158,7 @@ public: /** * Function SaveDocs - * rrite the entry document information to \a aFormatter in "*.dcm" format. + * write the entry document information to \a aFormatter in "*.dcm" format. * * @param aFormatter The #OUTPUTFORMATTER to write the alias documents to. * @return True if success writing else false. diff --git a/eeschema/class_library.cpp b/eeschema/class_library.cpp index 66d57bade5..93f9a91ce0 100644 --- a/eeschema/class_library.cpp +++ b/eeschema/class_library.cpp @@ -1,9 +1,9 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2004 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 2008-2011 Wayne Stambaugh - * Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 2004-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 2008-2015 Wayne Stambaugh + * 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 @@ -73,6 +73,22 @@ PART_LIB::PART_LIB( int aType, const wxString& aFileName ) : PART_LIB::~PART_LIB() { + // When the library is destroyed, all of the alias objects on the heap should be deleted. + for( LIB_ALIAS_MAP::iterator it = m_amap.begin(); it != m_amap.end(); ++it ) + { + wxLogTrace( traceSchLibMem, wxT( "Removing alias %s from library %s." ), + GetChars( it->second->GetName() ), GetChars( GetLogicalName() ) ); + LIB_PART* part = it->second->GetPart(); + LIB_ALIAS* alias = it->second; + delete alias; + + // When the last alias of a part is destroyed, the part is no longer required and it + // too is destroyed. + if( part && part->GetAliasCount() == 0 ) + delete part; + } + + m_amap.clear(); }