mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-20 00:21:31 +00:00
Include optimization: move some things from common.h to point-of-use
This commit is contained in:
parent
80cb1db2e6
commit
c04e19f9ac
3d-viewer
common
CMakeLists.txtbin_mod.cppbitmap.cppcommon.cpp
dialogs
drawing_sheet
kiface_i.cppkiid.cpplockfile.cppplotters
plugins
preview_items
project.cppsettings
single_top.cpptool
widgets
wx_stl_compat.cppcvpcb
eeschema
class_library.cppeeschema_settings.cpperc.cpp
netlist_exporters
sch_field.cppsch_plugins
sch_reference_list.hschematic_settings.cppsymbol_async_loader.cpptools
gerbview
include
kicad
pagelayout_editor/tools
pcb_calculator/attenuators
pcbnew
build_BOM_from_board.cpp
connectivity
dialogs
dialog_board_statistics.cppdialog_drc.cppdialog_exchange_footprints.cppdialog_footprint_wizard_list.cppdialog_graphic_item_properties.cpppanel_fp_lib_table.cpp
exporters
export_footprint_associations.cppexport_footprints_placefile.cppexport_gencad.cppexport_hyperlynx.cppexport_idf.cppexport_vrml.cppgen_drill_report_files.cppgendrill_Excellon_writer.cppgerber_placefile_writer.cpp
files.cppfootprint.cppfootprint_edit_frame.cppfootprint_info_impl.cppfootprint_libraries_utils.cppfp_shape.cppnetinfo_list.cpppcb_draw_panel_gal.cpppcb_shape.cpppcbnew.cppplot_brditems_plotter.cppplugins
cadstar
eagle
geda
kicad
swig
toolbars_pcb_editor.cpptools
@ -24,14 +24,11 @@
|
||||
|
||||
#define GLM_FORCE_RADIANS
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
#include <mutex>
|
||||
#include <sstream>
|
||||
#include <utility>
|
||||
|
||||
#include <wx/datetime.h>
|
||||
#include <wx/dir.h>
|
||||
#include <wx/filename.h>
|
||||
#include <wx/log.h>
|
||||
#include <wx/stdpaths.h>
|
||||
@ -44,9 +41,6 @@
|
||||
#include <boost/uuid/sha1.hpp>
|
||||
#endif
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/ext.hpp>
|
||||
|
||||
#include "3d_cache.h"
|
||||
#include "3d_info.h"
|
||||
#include "3d_plugin_manager.h"
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include <gl_context_mgr.h>
|
||||
#include <profile.h> // To use GetRunningMicroSecs or another profiling utility
|
||||
#include <bitmaps.h>
|
||||
#include <macros.h>
|
||||
#include <menus_helpers.h>
|
||||
#include <pgm_base.h>
|
||||
#include <settings/settings_manager.h>
|
||||
|
@ -396,6 +396,7 @@ set( COMMON_SRCS
|
||||
wildcards_and_files_ext.cpp
|
||||
drawing_sheet/ds_painter.cpp
|
||||
wxdataviewctrl_helpers.cpp
|
||||
wx_stl_compat.cpp
|
||||
wx_filename.cpp
|
||||
xnode.cpp
|
||||
)
|
||||
|
@ -23,11 +23,8 @@
|
||||
*/
|
||||
|
||||
#include <bin_mod.h>
|
||||
#include <common.h>
|
||||
#include <filehistory.h>
|
||||
#include <pgm_base.h>
|
||||
#include <settings/app_settings.h>
|
||||
#include <settings/common_settings.h>
|
||||
#include <settings/settings_manager.h>
|
||||
|
||||
|
||||
|
@ -44,7 +44,6 @@
|
||||
#include <eda_base_frame.h>
|
||||
#include <eda_draw_frame.h>
|
||||
#include <paths.h>
|
||||
#include <settings/common_settings.h>
|
||||
|
||||
|
||||
static std::unique_ptr<BITMAP_STORE> s_BitmapStore;
|
||||
|
@ -347,49 +347,6 @@ bool EnsureFileDirectoryExists( wxFileName* aTargetFullFileName,
|
||||
}
|
||||
|
||||
|
||||
// add this only if it is not in wxWidgets (for instance before 3.1.0)
|
||||
#ifdef USE_KICAD_WXSTRING_HASH
|
||||
size_t std::hash<wxString>::operator()( const wxString& s ) const
|
||||
{
|
||||
return std::hash<std::wstring>{}( s.ToStdWstring() );
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef USE_KICAD_WXPOINT_LESS_AND_HASH
|
||||
size_t std::hash<wxPoint>::operator() ( const wxPoint& k ) const
|
||||
{
|
||||
auto xhash = std::hash<int>()( k.x );
|
||||
|
||||
// 0x9e3779b9 is 2^33 / ( 1 + sqrt(5) )
|
||||
// Adding this value ensures that consecutive bits of y will not be close to each other
|
||||
// decreasing the likelihood of hash collision in similar values of x and y
|
||||
return xhash ^ ( std::hash<int>()( k.y ) + 0x9e3779b9 + ( xhash << 6 ) + ( xhash >> 2 ) );
|
||||
}
|
||||
|
||||
bool std::less<wxPoint>::operator()( const wxPoint& aA, const wxPoint& aB ) const
|
||||
{
|
||||
if( aA.x == aB.x )
|
||||
return aA.y < aB.y;
|
||||
|
||||
return aA.x < aB.x;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
std::ostream& operator<<( std::ostream& out, const wxSize& size )
|
||||
{
|
||||
out << " width=\"" << size.GetWidth() << "\" height=\"" << size.GetHeight() << "\"";
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
std::ostream& operator<<( std::ostream& out, const wxPoint& pt )
|
||||
{
|
||||
out << " x=\"" << pt.x << "\" y=\"" << pt.y << "\"";
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Performance enhancements to file and directory operations.
|
||||
*
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include <filename_resolver.h>
|
||||
#include <env_vars.h>
|
||||
#include <grid_tricks.h>
|
||||
#include <pgm_base.h>
|
||||
#include <widgets/wx_grid.h>
|
||||
#include <widgets/grid_text_button_helpers.h>
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2021 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
|
||||
@ -25,6 +25,7 @@
|
||||
#include <eda_item.h>
|
||||
#include <gr_basic.h>
|
||||
#include <kiface_i.h>
|
||||
#include <macros.h>
|
||||
#include <math/util.h> // for KiROUND, Clamp
|
||||
#include <project.h>
|
||||
#include <title_block.h>
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (C) 2007 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2021 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
|
||||
@ -23,9 +23,10 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <dialog_helpers.h>
|
||||
#include <eda_draw_frame.h>
|
||||
#include <kicad_string.h>
|
||||
#include <dialog_helpers.h>
|
||||
#include <macros.h>
|
||||
|
||||
|
||||
// wxWidgets spends *far* too long calcuating column widths (most of it, believe it or
|
||||
|
@ -23,6 +23,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#include <common.h>
|
||||
#include <pgm_base.h>
|
||||
#include <base_screen.h>
|
||||
#include <eda_draw_frame.h>
|
||||
|
@ -23,15 +23,11 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <macros.h> // FROM_UTF8()
|
||||
#include <wx/stdpaths.h>
|
||||
|
||||
#include <kiface_i.h>
|
||||
#include <pgm_base.h>
|
||||
#include <kiway.h>
|
||||
#include <search_stack.h>
|
||||
#include <systemdirsappend.h>
|
||||
|
||||
#include <common.h>
|
||||
|
||||
/// Initialize aDst SEARCH_STACK with KIFACE (DSO) specific settings.
|
||||
/// A non-member function so it an be moved easily, plus it's nobody's business.
|
||||
static void setSearchPaths( SEARCH_STACK* aDst, KIWAY::FACE_T aId )
|
||||
|
@ -23,7 +23,6 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <common.h> // AsLegacyTimestampString, AsString
|
||||
#include <kiid.h>
|
||||
|
||||
#include <boost/uuid/uuid_generators.hpp>
|
||||
|
@ -22,13 +22,14 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <build_version.h>
|
||||
#include <lockfile.h>
|
||||
|
||||
#include <wx/filename.h>
|
||||
#include <wx/snglinst.h>
|
||||
|
||||
#include <common.h>
|
||||
|
||||
std::unique_ptr<wxSingleInstanceChecker> LockFile( const wxString& aFileName )
|
||||
{
|
||||
|
@ -27,17 +27,20 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <trigo.h>
|
||||
#include <algorithm>
|
||||
#include <wx/zstream.h>
|
||||
|
||||
#include <wx/filename.h>
|
||||
#include <wx/mstream.h>
|
||||
#include <render_settings.h>
|
||||
#include <wx/zstream.h>
|
||||
|
||||
#include <advanced_config.h>
|
||||
#include <macros.h>
|
||||
#include <render_settings.h>
|
||||
#include <trigo.h>
|
||||
|
||||
#include "plotters_pslike.h"
|
||||
|
||||
|
||||
|
||||
std::string PDF_PLOTTER::encodeStringForPlotter( const wxString& aText )
|
||||
{
|
||||
// returns a string compatible with PDF string convention from a unicode string.
|
||||
|
@ -94,8 +94,8 @@
|
||||
#include <base64.h>
|
||||
#include <eda_base_frame.h>
|
||||
#include <eda_rect.h>
|
||||
#include <common.h>
|
||||
#include <kicad_string.h>
|
||||
#include <macros.h>
|
||||
#include <trigo.h>
|
||||
|
||||
#include <cstdint>
|
||||
|
@ -22,9 +22,11 @@
|
||||
* @file cadstar_archive_parser.cpp
|
||||
* @brief Helper functions and common defines between schematic and PCB Archive files
|
||||
*/
|
||||
#include <wx/filename.h>
|
||||
|
||||
#include <plugins/cadstar/cadstar_archive_parser.h>
|
||||
#include <eda_text.h>
|
||||
#include <macros.h>
|
||||
#include <trigo.h>
|
||||
|
||||
// Ratio derived from CADSTAR default font. See doxygen comment in cadstar_archive_parser.h
|
||||
|
@ -27,11 +27,10 @@
|
||||
|
||||
#include <plugins/eagle/eagle_parser.h>
|
||||
|
||||
#include <kicad_string.h>
|
||||
#include <richio.h>
|
||||
|
||||
#include <functional>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
#include <cstdio>
|
||||
|
||||
constexpr auto DEFAULT_ALIGNMENT = ETEXT::BOTTOM_LEFT;
|
||||
|
@ -29,8 +29,8 @@
|
||||
#ifndef _EAGLE_PARSER_H_
|
||||
#define _EAGLE_PARSER_H_
|
||||
|
||||
#include <cerrno>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
|
||||
#include <wx/xml/xml.h>
|
||||
@ -38,10 +38,8 @@
|
||||
#include <wx/filename.h>
|
||||
|
||||
#include <layers_id_colors_and_visibility.h>
|
||||
#include <convert_to_biu.h>
|
||||
#include <trigo.h>
|
||||
#include <kicad_string.h>
|
||||
#include <common.h> // needed for wxString hash template
|
||||
#include <core/wx_stl_compat.h>
|
||||
|
||||
class FOOTPRINT;
|
||||
struct EINSTANCE;
|
||||
|
@ -29,7 +29,6 @@
|
||||
#include <gal/graphics_abstraction_layer.h>
|
||||
#include <view/view.h>
|
||||
|
||||
#include <common.h>
|
||||
#include <base_units.h>
|
||||
#include <trigo.h>
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include <preview_items/draw_context.h>
|
||||
#include <preview_items/preview_utils.h>
|
||||
#include <view/view.h>
|
||||
#include <common.h>
|
||||
|
||||
|
||||
using namespace KIGFX::PREVIEW;
|
||||
|
||||
@ -94,4 +94,4 @@ void TWO_POINT_ASSISTANT::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
|
||||
|
||||
// place the text next to cursor, on opposite side from drawing
|
||||
DrawTextNextToCursor( aView, end, origin - end, cursorStrings, aLayer == LAYER_SELECT_OVERLAY );
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include <kicad_string.h>
|
||||
#include <kiface_ids.h>
|
||||
#include <kiway.h>
|
||||
#include <macros.h>
|
||||
#include <pgm_base.h>
|
||||
#include <project.h>
|
||||
#include <project/project_file.h>
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include <regex>
|
||||
#include <wx/debug.h>
|
||||
#include <wx/dir.h>
|
||||
#include <wx/filename.h>
|
||||
#include <wx/stdpaths.h>
|
||||
#include <wx/utils.h>
|
||||
@ -36,14 +37,12 @@
|
||||
#include <project/project_archiver.h>
|
||||
#include <project/project_file.h>
|
||||
#include <project/project_local_settings.h>
|
||||
#include <settings/app_settings.h>
|
||||
#include <settings/color_settings.h>
|
||||
#include <settings/common_settings.h>
|
||||
#include <settings/settings_manager.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
|
||||
|
||||
|
||||
/// Project settings path will be <projectname> + this
|
||||
#define PROJECT_BACKUPS_DIR_SUFFIX wxT( "-backups" )
|
||||
|
||||
|
@ -44,6 +44,7 @@
|
||||
#include <kiway.h>
|
||||
#include <pgm_base.h>
|
||||
#include <kiway_player.h>
|
||||
#include <macros.h>
|
||||
#include <confirm.h>
|
||||
#include <settings/settings_manager.h>
|
||||
|
||||
|
@ -24,17 +24,15 @@
|
||||
|
||||
#include <bitmaps.h>
|
||||
#include <build_version.h>
|
||||
#include <common.h> // for SearchHelpFileFullPath
|
||||
#include <tool/actions.h>
|
||||
#include <tool/tool_manager.h>
|
||||
#include <eda_draw_frame.h>
|
||||
#include <class_draw_panel_gal.h>
|
||||
#include <view/view.h>
|
||||
#include <view/view_controls.h>
|
||||
#include <gal/graphics_abstraction_layer.h>
|
||||
#include <base_screen.h>
|
||||
#include <tool/common_control.h>
|
||||
#include <id.h>
|
||||
#include <project.h>
|
||||
#include <kiface_i.h>
|
||||
#include <kicad_curl/kicad_curl_easy.h>
|
||||
#include <dialogs/dialog_configure_paths.h>
|
||||
|
@ -32,7 +32,6 @@
|
||||
|
||||
#include <widgets/gal_options_panel.h>
|
||||
#include <eda_draw_frame.h>
|
||||
#include <common.h>
|
||||
|
||||
#include <config_map.h>
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user