Remove kicad_string.h from footprint_info.h

This commit is contained in:
Marek Roszko 2020-10-15 18:39:33 -04:00
parent fad0916f0b
commit 52a12c6ccd
18 changed files with 56 additions and 32 deletions

View File

@ -32,6 +32,7 @@
#include <fp_lib_table.h> #include <fp_lib_table.h>
#include <html_messagebox.h> #include <html_messagebox.h>
#include <io_mgr.h> #include <io_mgr.h>
#include <kicad_string.h>
#include <kiface_ids.h> #include <kiface_ids.h>
#include <kiway.h> #include <kiway.h>
#include <lib_id.h> #include <lib_id.h>
@ -77,6 +78,24 @@ bool FOOTPRINT_INFO::InLibrary( const wxString& aLibrary ) const
} }
/**
* Less than operator implementation for FOOTPRINT_INFO
*/
bool operator<( const FOOTPRINT_INFO& lhs, const FOOTPRINT_INFO& rhs )
{
int retv = StrNumCmp( lhs.m_nickname, rhs.m_nickname, false );
if( retv != 0 )
return retv < 0;
// Technically footprint names are not case sensitive because the file name is used
// as the footprint name. On windows this would be problematic because windows does
// not support case sensitive file names by default. This should not cause any issues
// and allow for a future change to use the name defined in the footprint file.
return StrNumCmp( lhs.m_fpname, rhs.m_fpname, false ) < 0;
}
void FOOTPRINT_LIST::DisplayErrors( wxTopLevelWindow* aWindow ) void FOOTPRINT_LIST::DisplayErrors( wxTopLevelWindow* aWindow )
{ {
// @todo: go to a more HTML !<table>! ? centric output, possibly with // @todo: go to a more HTML !<table>! ? centric output, possibly with

View File

@ -21,6 +21,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include <kicad_string.h>
#include <kiplatform/ui.h> #include <kiplatform/ui.h>
#include <widgets/net_selector.h> #include <widgets/net_selector.h>

View File

@ -33,7 +33,6 @@
#include <boost/ptr_container/ptr_vector.hpp> #include <boost/ptr_container/ptr_vector.hpp>
#include <import_export.h> #include <import_export.h>
#include <ki_exception.h> #include <ki_exception.h>
#include <kicad_string.h>
#include <sync_queue.h> #include <sync_queue.h>
#include <lib_tree_item.h> #include <lib_tree_item.h>
#include <atomic> #include <atomic>
@ -138,6 +137,11 @@ public:
*/ */
bool InLibrary( const wxString& aLibrary ) const; bool InLibrary( const wxString& aLibrary ) const;
/**
* Less than comparison operator, intended for sorting FOOTPRINT_INFO objects
*/
friend bool operator<( const FOOTPRINT_INFO& lhs, const FOOTPRINT_INFO& rhs );
protected: protected:
void ensure_loaded() void ensure_loaded()
{ {
@ -162,22 +166,6 @@ protected:
}; };
/// FOOTPRINT object list sort function.
inline bool operator<( const FOOTPRINT_INFO& item1, const FOOTPRINT_INFO& item2 )
{
int retv = StrNumCmp( item1.m_nickname, item2.m_nickname, false );
if( retv != 0 )
return retv < 0;
// Technically footprint names are not case sensitive because the file name is used
// as the footprint name. On windows this would be problematic because windows does
// not support case sensitive file names by default. This should not cause any issues
// and allow for a future change to use the name defined in the footprint file.
return StrNumCmp( item1.m_fpname, item2.m_fpname, false ) < 0;
}
/** /**
* Holds a list of FOOTPRINT_INFO objects, along with a list of IO_ERRORs or * Holds a list of FOOTPRINT_INFO objects, along with a list of IO_ERRORs or
* PARSE_ERRORs that were thrown acquiring the FOOTPRINT_INFOs. * PARSE_ERRORs that were thrown acquiring the FOOTPRINT_INFOs.

View File

@ -27,6 +27,7 @@
#include <class_board_item.h> #include <class_board_item.h>
#include <connectivity/connectivity_data.h> #include <connectivity/connectivity_data.h>
#include <drc/drc_engine.h> #include <drc/drc_engine.h>
#include <kicad_string.h>
using namespace std::placeholders; using namespace std::placeholders;
@ -118,6 +119,22 @@ wxString BOARD_CONNECTED_ITEM::GetNetClassName() const
} }
wxString BOARD_CONNECTED_ITEM::GetNetnameMsg() const
{
if( !GetBoard() )
return wxT( "[** NO BOARD DEFINED **]" );
wxString netname = GetNetname();
if( !netname.length() )
return wxT( "[<no net>]" );
else if( GetNetCode() < 0 )
return wxT( "[" + UnescapeString( netname ) + "](" + _( "Not Found" ) + ")" );
else
return wxT( "[" + UnescapeString( netname ) + "]" );
}
static struct BOARD_CONNECTED_ITEM_DESC static struct BOARD_CONNECTED_ITEM_DESC
{ {
BOARD_CONNECTED_ITEM_DESC() BOARD_CONNECTED_ITEM_DESC()

View File

@ -29,7 +29,6 @@
#include <class_board_item.h> #include <class_board_item.h>
#include <netinfo.h> #include <netinfo.h>
#include <reporter.h> #include <reporter.h>
#include <kicad_string.h>
class NETCLASS; class NETCLASS;
class TRACK; class TRACK;
@ -132,20 +131,7 @@ public:
* @return wxString - the full netname or "<no net>" in square braces, followed by * @return wxString - the full netname or "<no net>" in square braces, followed by
* "(Not Found)" if the netcode is undefined. * "(Not Found)" if the netcode is undefined.
*/ */
wxString GetNetnameMsg() const wxString GetNetnameMsg() const;
{
if( !GetBoard() )
return wxT( "[** NO BOARD DEFINED **]" );
wxString netname = GetNetname();
if( !netname.length() )
return wxT( "[<no net>]" );
else if( GetNetCode() < 0 )
return wxT( "[" + UnescapeString( netname ) + "](" + _( "Not Found" ) + ")" );
else
return wxT( "[" + UnescapeString( netname ) + "]" );
}
/** /**
* Function GetShortNetname * Function GetShortNetname

View File

@ -38,6 +38,7 @@
#include <class_marker_pcb.h> #include <class_marker_pcb.h>
#include <class_pcb_target.h> #include <class_pcb_target.h>
#include <connectivity/connectivity_data.h> #include <connectivity/connectivity_data.h>
#include <kicad_string.h>
#include <pgm_base.h> #include <pgm_base.h>
#include <pcbnew_settings.h> #include <pcbnew_settings.h>
#include <project.h> #include <project.h>

View File

@ -28,6 +28,7 @@
#include <refdes_utils.h> #include <refdes_utils.h>
#include <bitmaps.h> #include <bitmaps.h>
#include <unordered_set> #include <unordered_set>
#include <kicad_string.h>
#include <pcb_edit_frame.h> #include <pcb_edit_frame.h>
#include <class_board.h> #include <class_board.h>
#include <fp_shape.h> #include <fp_shape.h>

View File

@ -38,6 +38,7 @@
#include <geometry/shape_simple.h> #include <geometry/shape_simple.h>
#include <geometry/shape_rect.h> #include <geometry/shape_rect.h>
#include <geometry/shape_compound.h> #include <geometry/shape_compound.h>
#include <kicad_string.h>
#include <pcbnew.h> #include <pcbnew.h>
#include <view/view.h> #include <view/view.h>
#include <class_board.h> #include <class_board.h>

View File

@ -30,6 +30,7 @@
#include <class_track.h> #include <class_track.h>
#include <base_units.h> #include <base_units.h>
#include <bitmaps.h> #include <bitmaps.h>
#include <kicad_string.h>
#include <view/view.h> #include <view/view.h>
#include <settings/color_settings.h> #include <settings/color_settings.h>
#include <settings/settings_manager.h> #include <settings/settings_manager.h>

View File

@ -22,6 +22,7 @@
#include <reporter.h> #include <reporter.h>
#include <class_board.h> #include <class_board.h>
#include <class_track.h> #include <class_track.h>
#include <kicad_string.h>
#include <pcb_expr_evaluator.h> #include <pcb_expr_evaluator.h>

View File

@ -28,6 +28,7 @@
#include <class_track.h> #include <class_track.h>
#include <dialog_select_net_from_list.h> #include <dialog_select_net_from_list.h>
#include <eda_pattern_match.h> #include <eda_pattern_match.h>
#include <kicad_string.h>
#include <wildcards_and_files_ext.h> #include <wildcards_and_files_ext.h>
#include <view/view_controls.h> #include <view/view_controls.h>
#include <pcb_painter.h> #include <pcb_painter.h>

View File

@ -28,6 +28,7 @@
#include <class_board.h> #include <class_board.h>
#include <board_design_settings.h> #include <board_design_settings.h>
#include <project.h> #include <project.h>
#include <kicad_string.h>
#include <tool/tool_manager.h> #include <tool/tool_manager.h>
#include <panel_setup_rules.h> #include <panel_setup_rules.h>
#include <wx_html_report_box.h> #include <wx_html_report_box.h>

View File

@ -27,6 +27,7 @@
#include <fp_lib_table.h> #include <fp_lib_table.h>
#include <html_messagebox.h> #include <html_messagebox.h>
#include <io_mgr.h> #include <io_mgr.h>
#include <kicad_string.h>
#include <kiface_ids.h> #include <kiface_ids.h>
#include <kiway.h> #include <kiway.h>
#include <lib_id.h> #include <lib_id.h>

View File

@ -18,6 +18,7 @@
*/ */
#include <wx/tokenzr.h> #include <wx/tokenzr.h>
#include <kicad_string.h>
#include <eda_pattern_match.h> #include <eda_pattern_match.h>
#include <fp_lib_table.h> #include <fp_lib_table.h>
#include <footprint_info.h> #include <footprint_info.h>

View File

@ -27,6 +27,7 @@
#include <footprint_edit_frame.h> #include <footprint_edit_frame.h>
#include <fp_lib_table.h> #include <fp_lib_table.h>
#include <footprint_info_impl.h> #include <footprint_info_impl.h>
#include <kicad_string.h>
#include <class_board.h> #include <class_board.h>
#include <class_module.h> #include <class_module.h>
#include <tool/tool_manager.h> #include <tool/tool_manager.h>

View File

@ -40,6 +40,7 @@
#include <class_pad.h> #include <class_pad.h>
#include <class_track.h> #include <class_track.h>
#include <class_zone.h> #include <class_zone.h>
#include <kicad_string.h>
#include "pcb_netlist.h" #include "pcb_netlist.h"
#include <connectivity/connectivity_data.h> #include <connectivity/connectivity_data.h>

View File

@ -29,6 +29,7 @@
#include <class_module.h> #include <class_module.h>
#include <class_pad.h> #include <class_pad.h>
#include <pcb_shape.h> #include <pcb_shape.h>
#include <kicad_string.h>
#include <class_zone.h> #include <class_zone.h>
#include <pcb_text.h> #include <pcb_text.h>
#include <class_marker_pcb.h> #include <class_marker_pcb.h>

View File

@ -30,6 +30,7 @@
#include <pcb_shape.h> #include <pcb_shape.h>
#include <pcb_text.h> #include <pcb_text.h>
#include <class_track.h> #include <class_track.h>
#include <kicad_string.h>
#include <fp_shape.h> #include <fp_shape.h>
#include <fp_text.h> #include <fp_text.h>