From 922aee1532683147a8dfdebc825202e506e95545 Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Tue, 19 Dec 2023 14:29:17 -0500 Subject: [PATCH] Coding policy fixes. --- common/settings/app_settings.cpp | 3 +- common/settings/color_settings.cpp | 6 ++- common/settings/common_settings.cpp | 27 +++++++++----- common/settings/cvpcb_settings.cpp | 5 ++- common/settings/json_settings.cpp | 31 ++++++++++------ common/settings/kicad_settings.cpp | 9 +++-- common/settings/nested_settings.cpp | 6 ++- common/settings/settings_manager.cpp | 22 +++++++---- eeschema/connection_graph.cpp | 11 +++--- eeschema/tools/ee_selection_tool.cpp | 47 ++++++++++++++++-------- include/settings/common_settings.h | 5 ++- kicad/cli/command.cpp | 8 ++-- kicad/cli/command.h | 16 ++++---- kicad/cli/command_fp_export_svg.cpp | 6 ++- kicad/cli/command_fp_upgrade.cpp | 5 ++- kicad/cli/command_pcb_drc.cpp | 15 +++++--- kicad/cli/command_pcb_export_3d.cpp | 9 +++-- kicad/cli/command_pcb_export_base.cpp | 5 ++- kicad/cli/command_pcb_export_base.h | 5 ++- kicad/cli/command_pcb_export_drill.cpp | 3 +- kicad/cli/command_pcb_export_gerbers.cpp | 8 ++-- kicad/cli/command_sch_erc.cpp | 17 ++++++--- kicad/cli/command_sch_export_bom.h | 9 +++-- kicad/cli/command_sch_export_plot.cpp | 6 ++- kicad/cli/command_sym_export_svg.cpp | 10 +++-- kicad/cli/command_sym_upgrade.cpp | 7 +++- kicad/cli/command_version.cpp | 8 ++-- 27 files changed, 200 insertions(+), 109 deletions(-) diff --git a/common/settings/app_settings.cpp b/common/settings/app_settings.cpp index 3b6073a385..790b7b85d5 100644 --- a/common/settings/app_settings.cpp +++ b/common/settings/app_settings.cpp @@ -318,7 +318,8 @@ void APP_SETTINGS_BASE::addParamsForWindow( WINDOW_SETTINGS* aWindow, const std: m_params.emplace_back( new PARAM( aJsonPath + ".pos_y", &aWindow->state.pos_y, 0 ) ); - m_params.emplace_back( new PARAM( aJsonPath + ".display", &aWindow->state.display, 0 ) ); + m_params.emplace_back( new PARAM( aJsonPath + ".display", + &aWindow->state.display, 0 ) ); m_params.emplace_back( new PARAM_LIST( aJsonPath + ".zoom_factors", &aWindow->zoom_factors, {} ) ); diff --git a/common/settings/color_settings.cpp b/common/settings/color_settings.cpp index e4cf4aaaf2..f73eab77b7 100644 --- a/common/settings/color_settings.cpp +++ b/common/settings/color_settings.cpp @@ -43,7 +43,8 @@ COLOR_SETTINGS::COLOR_SETTINGS( const wxString& aFilename, bool aAbsolutePath ) if( aAbsolutePath ) SetLocation( SETTINGS_LOC::NONE ); - m_params.emplace_back( new PARAM( "meta.name", &m_displayName, wxS( "KiCad Default" ) ) ); + m_params.emplace_back( new PARAM( "meta.name", &m_displayName, + wxS( "KiCad Default" ) ) ); m_params.emplace_back( new PARAM( "schematic.override_item_colors", &m_overrideSchItemColors, false ) ); @@ -318,7 +319,8 @@ bool COLOR_SETTINGS::migrateSchema0to1() if( !Contains( "fpedit" ) ) { - wxLogTrace( traceSettings, wxT( "migrateSchema0to1: %s doesn't have fpedit settings; skipping." ), + wxLogTrace( traceSettings, + wxT( "migrateSchema0to1: %s doesn't have fpedit settings; skipping." ), m_filename ); return true; } diff --git a/common/settings/common_settings.cpp b/common/settings/common_settings.cpp index baaa26950e..d0c18e0974 100644 --- a/common/settings/common_settings.cpp +++ b/common/settings/common_settings.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2020 Jon Evans - * Copyright (C) 2020-2022 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2020-2023 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 @@ -151,15 +151,16 @@ COMMON_SETTINGS::COMMON_SETTINGS() : if( var.GetDefinedInSettings() ) { wxLogTrace( traceEnvVars, - wxS( "COMMON_SETTINGS: Env var %s was overridden externally, " ) - "saving previously-loaded value %s", + wxS( "COMMON_SETTINGS: Env var %s was overridden " + "externally, saving previously-loaded value %s" ), var.GetKey(), var.GetSettingsValue() ); value = var.GetSettingsValue(); } else { wxLogTrace( traceEnvVars, - wxS( "COMMON_SETTINGS: Env var %s skipping save (external)" ), + wxS( "COMMON_SETTINGS: Env var %s skipping save " + "(external)" ), var.GetKey() ); continue; } @@ -189,7 +190,8 @@ COMMON_SETTINGS::COMMON_SETTINGS() : { if( m_Env.vars[key].GetDefinedExternally() ) { - wxLogTrace( traceEnvVars, wxS( "COMMON_SETTINGS: %s is defined externally" ), + wxLogTrace( traceEnvVars, + wxS( "COMMON_SETTINGS: %s is defined externally" ), key ); m_Env.vars[key].SetDefinedInSettings(); m_Env.vars[key].SetSettingsValue( val ); @@ -197,14 +199,16 @@ COMMON_SETTINGS::COMMON_SETTINGS() : } else { - wxLogTrace( traceEnvVars, wxS( "COMMON_SETTINGS: Updating %s: %s -> %s"), + wxLogTrace( traceEnvVars, + wxS( "COMMON_SETTINGS: Updating %s: %s -> %s"), key, m_Env.vars[key].GetValue(), val ); m_Env.vars[key].SetValue( val ); } } else { - wxLogTrace( traceEnvVars, wxS( "COMMON_SETTINGS: Loaded new var: %s = %s" ), + wxLogTrace( traceEnvVars, + wxS( "COMMON_SETTINGS: Loaded new var: %s = %s" ), key, val ); m_Env.vars[key] = ENV_VAR_ITEM( key, val ); } @@ -541,7 +545,8 @@ bool COMMON_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg ) { if( envVarBlacklist.count( key ) ) { - wxLogTrace( traceSettings, wxT( "Migrate Env: %s is blacklisted; skipping." ), key ); + wxLogTrace( traceSettings, + wxT( "Migrate Env: %s is blacklisted; skipping." ), key ); continue; } @@ -551,7 +556,8 @@ bool COMMON_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg ) { ptr.push_back( key.ToStdString() ); - wxLogTrace( traceSettings, wxT( "Migrate Env: %s=%s" ), ptr.to_string(), value ); + wxLogTrace( traceSettings, wxT( "Migrate Env: %s=%s" ), + ptr.to_string(), value ); ( *m_internals )[ptr] = value.ToUTF8(); ptr.pop_back(); @@ -617,7 +623,8 @@ void COMMON_SETTINGS::InitializeEnvironment() } else { - wxLogTrace( traceEnvVars, wxS( "InitializeEnvironment: Setting entry %s to default %s" ), + wxLogTrace( traceEnvVars, wxS( "InitializeEnvironment: Setting entry %s to " + "default %s" ), aKey, aDefault ); } }; diff --git a/common/settings/cvpcb_settings.cpp b/common/settings/cvpcb_settings.cpp index cd4d2de2f9..f28ecdbbd3 100644 --- a/common/settings/cvpcb_settings.cpp +++ b/common/settings/cvpcb_settings.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * -* Copyright (C) 2022 KiCad Developers, see AUTHORS.txt for contributors. +* Copyright (C) 2022-2023 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 @@ -51,7 +51,8 @@ CVPCB_SETTINGS::CVPCB_SETTINGS() : addParamsForWindow( &m_FootprintViewer, "footprint_viewer" ); - m_params.emplace_back( new PARAM( "footprint_viewer.zoom", &m_FootprintViewerZoom, 1.0 ) ); + m_params.emplace_back( new PARAM( "footprint_viewer.zoom", &m_FootprintViewerZoom, + 1.0 ) ); m_params.emplace_back( new PARAM( "footprint_viewer.autozoom", &m_FootprintViewerAutoZoomOnSelect, true ) ); diff --git a/common/settings/json_settings.cpp b/common/settings/json_settings.cpp index 5bbec1d405..6f1bf1a25c 100644 --- a/common/settings/json_settings.cpp +++ b/common/settings/json_settings.cpp @@ -199,7 +199,8 @@ bool JSON_SETTINGS::LoadFromFile( const wxString& aDirectory ) else { success = true; - wxLogTrace( traceSettings, wxT( "%s: migrated from legacy format" ), GetFullFilename() ); + wxLogTrace( traceSettings, wxT( "%s: migrated from legacy format" ), + GetFullFilename() ); } if( backed_up ) @@ -296,7 +297,8 @@ bool JSON_SETTINGS::LoadFromFile( const wxString& aDirectory ) if( filever >= 0 && filever < m_schemaVersion ) { - wxLogTrace( traceSettings, wxT( "%s: attempting migration from version %d to %d" ), + wxLogTrace( traceSettings, wxT( "%s: attempting migration from version " + "%d to %d" ), GetFullFilename(), filever, m_schemaVersion ); if( Migrate() ) @@ -305,7 +307,8 @@ bool JSON_SETTINGS::LoadFromFile( const wxString& aDirectory ) } else { - wxLogTrace( traceSettings, wxT( "%s: migration failed!" ), GetFullFilename() ); + wxLogTrace( traceSettings, wxT( "%s: migration failed!" ), + GetFullFilename() ); } } else if( filever > m_schemaVersion ) @@ -326,7 +329,8 @@ bool JSON_SETTINGS::LoadFromFile( const wxString& aDirectory ) success = false; wxLogTrace( traceSettings, wxT( "Json parse error reading %s: %s" ), path.GetFullPath(), error.what() ); - wxLogTrace( traceSettings, wxT( "Attempting migration in case file is in legacy format" ) ); + wxLogTrace( traceSettings, wxT( "Attempting migration in case file is in legacy " + "format" ) ); migrateFromLegacy( path ); } } @@ -338,7 +342,8 @@ bool JSON_SETTINGS::LoadFromFile( const wxString& aDirectory ) for( auto settings : m_nested_settings ) settings->LoadFromFile(); - wxLogTrace( traceSettings, wxT( "Loaded <%s> with schema %d" ), GetFullFilename(), m_schemaVersion ); + wxLogTrace( traceSettings, wxT( "Loaded <%s> with schema %d" ), GetFullFilename(), + m_schemaVersion ); // If we migrated, clean up the legacy file (with no extension) if( m_writeFile && ( legacy_migrated || migrated ) ) @@ -404,8 +409,8 @@ bool JSON_SETTINGS::SaveToFile( const wxString& aDirectory, bool aForce ) if( !m_createIfMissing && !path.FileExists() ) { wxLogTrace( traceSettings, - wxT( "File for %s doesn't exist and m_createIfMissing == false; not saving" ), - GetFullFilename() ); + wxT( "File for %s doesn't exist and m_createIfMissing == false; not saving" ), + GetFullFilename() ); return false; } @@ -420,7 +425,8 @@ bool JSON_SETTINGS::SaveToFile( const wxString& aDirectory, bool aForce ) if( ( path.FileExists() && !path.IsFileWritable() ) || ( !path.FileExists() && !path.IsDirWritable() ) ) { - wxLogTrace( traceSettings, wxT( "File for %s is read-only; not saving" ), GetFullFilename() ); + wxLogTrace( traceSettings, wxT( "File for %s is read-only; not saving" ), + GetFullFilename() ); return false; } @@ -433,13 +439,14 @@ bool JSON_SETTINGS::SaveToFile( const wxString& aDirectory, bool aForce ) if( !modified && !aForce && path.FileExists() ) { - wxLogTrace( traceSettings, wxT( "%s contents not modified, skipping save" ), GetFullFilename() ); + wxLogTrace( traceSettings, wxT( "%s contents not modified, skipping save" ), + GetFullFilename() ); return false; } else if( !modified && !aForce && !m_createIfDefault ) { wxLogTrace( traceSettings, - wxT( "%s contents still default and m_createIfDefault == false; not saving" ), + wxT( "%s contents still default and m_createIfDefault == false; not saving" ), GetFullFilename() ); return false; } @@ -841,7 +848,6 @@ void JSON_SETTINGS::ReleaseNestedSettings( NESTED_SETTINGS* aSettings ) // Specializations to allow conversion between wxString and std::string via JSON_SETTINGS API - template<> std::optional JSON_SETTINGS::Get( const std::string& aPath ) const { if( std::optional opt_json = GetJson( aPath ) ) @@ -856,8 +862,8 @@ template<> void JSON_SETTINGS::Set( const std::string& aPath, wxString ( *m_internals )[aPath] = aVal.ToUTF8(); } -// Specializations to allow directly reading/writing wxStrings from JSON +// Specializations to allow directly reading/writing wxStrings from JSON void to_json( nlohmann::json& aJson, const wxString& aString ) { aJson = aString.ToUTF8(); @@ -892,5 +898,6 @@ ResultType JSON_SETTINGS::fetchOrDefault( const nlohmann::json& aJson, const std template std::string JSON_SETTINGS::fetchOrDefault( const nlohmann::json& aJson, const std::string& aKey, std::string aDefault ); + template bool JSON_SETTINGS::fetchOrDefault( const nlohmann::json& aJson, const std::string& aKey, bool aDefault ); diff --git a/common/settings/kicad_settings.cpp b/common/settings/kicad_settings.cpp index 3ed2e76f49..67a02bcaad 100644 --- a/common/settings/kicad_settings.cpp +++ b/common/settings/kicad_settings.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2020 Jon Evans - * Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2020, 2023 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 @@ -26,6 +26,7 @@ ///! Update the schema version whenever a migration is required const int kicadSchemaVersion = 0; + const nlohmann::json PCM_DEFAULT_REPOSITORIES = nlohmann::json::array( { nlohmann::json( { { "name", "KiCad official repository" }, @@ -48,7 +49,8 @@ KICAD_SETTINGS::KICAD_SETTINGS() : m_params.emplace_back( new PARAM( "system.last_received_update", &m_lastReceivedUpdate, "" ) ); - m_params.emplace_back( new PARAM( "system.check_for_kicad_updates", &m_KiCadUpdateCheck, true ) ); + m_params.emplace_back( new PARAM( "system.check_for_kicad_updates", &m_KiCadUpdateCheck, + true ) ); m_params.emplace_back( new PARAM_LAMBDA( "pcm.repositories", @@ -92,7 +94,8 @@ KICAD_SETTINGS::KICAD_SETTINGS() : m_params.emplace_back( new PARAM( "pcm.lib_auto_remove", &m_PcmLibAutoRemove, true ) ); - m_params.emplace_back( new PARAM( "pcm.lib_prefix", &m_PcmLibPrefix, wxS( "PCM_" ) ) ); + m_params.emplace_back( new PARAM( "pcm.lib_prefix", &m_PcmLibPrefix, + wxS( "PCM_" ) ) ); } diff --git a/common/settings/nested_settings.cpp b/common/settings/nested_settings.cpp index 2de9b1f549..7af1576deb 100644 --- a/common/settings/nested_settings.cpp +++ b/common/settings/nested_settings.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2020 Jon Evans - * Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2020, 2023 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 @@ -24,6 +24,7 @@ #include #include + NESTED_SETTINGS::NESTED_SETTINGS( const std::string& aName, int aVersion, JSON_SETTINGS* aParent, const std::string& aPath ) : JSON_SETTINGS( aName, SETTINGS_LOC::NESTED, aVersion ), @@ -61,7 +62,8 @@ bool NESTED_SETTINGS::LoadFromFile( const wxString& aDirectory ) } catch( ... ) { - wxLogTrace( traceSettings, wxT( "NESTED_SETTINGS %s: Could not load from %s at %s" ), + wxLogTrace( traceSettings, wxT( "NESTED_SETTINGS %s: Could not load from " + "%s at %s" ), m_filename, m_parent->GetFilename(), m_path ); } } diff --git a/common/settings/settings_manager.cpp b/common/settings/settings_manager.cpp index f21f6e09c3..6de4d25dc1 100644 --- a/common/settings/settings_manager.cpp +++ b/common/settings/settings_manager.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2020 Jon Evans - * Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2021, 2023 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 @@ -94,7 +94,8 @@ JSON_SETTINGS* SETTINGS_MANAGER::registerSettings( JSON_SETTINGS* aSettings, boo ptr->SetManager( this ); - wxLogTrace( traceSettings, wxT( "Registered new settings object <%s>" ), ptr->GetFullFilename() ); + wxLogTrace( traceSettings, wxT( "Registered new settings object <%s>" ), + ptr->GetFullFilename() ); if( aLoadNow ) ptr->LoadFromFile( GetPathForSettingsFile( ptr.get() ) ); @@ -237,7 +238,8 @@ COLOR_SETTINGS* SETTINGS_MANAGER::loadColorSettingsByName( const wxString& aName if( !fn.IsOk() || !fn.Exists() ) { - wxLogTrace( traceSettings, wxT( "Theme file %s.json not found, falling back to user" ), aName ); + wxLogTrace( traceSettings, wxT( "Theme file %s.json not found, falling back to user" ), + aName ); return nullptr; } @@ -532,7 +534,8 @@ bool SETTINGS_MANAGER::MigrateIfNeeded() if( m_headless ) { // Special case namely for cli - // Ensure the settings directory at least exists to prevent additional loading errors from subdirectories + // Ensure the settings directory at least exists to prevent additional loading errors + // from subdirectories. // TODO review headless (unit tests) vs cli needs, this should be fine for unit tests though if( !path.DirExists() ) { @@ -635,7 +638,8 @@ bool SETTINGS_MANAGER::GetPreviousVersionPaths( std::vector* aPaths ) // If the env override is set, also check the default paths if( wxGetEnv( wxT( "KICAD_CONFIG_HOME" ), nullptr ) ) - base_paths.emplace_back( wxFileName( PATHS::CalculateUserSettingsPath( false, false ), wxS( "" ) ) ); + base_paths.emplace_back( wxFileName( PATHS::CalculateUserSettingsPath( false, false ), + wxS( "" ) ) ); #ifdef __WXGTK__ // When running inside FlatPak, KIPLATFORM::ENV::GetUserConfigPath() will return a sandboxed @@ -765,6 +769,8 @@ wxString SETTINGS_MANAGER::GetColorSettingsPath() return path.GetPath(); } + + std::string SETTINGS_MANAGER::GetSettingsVersion() { // CMake computes the major.minor string for us. @@ -781,7 +787,8 @@ int SETTINGS_MANAGER::compareVersions( const std::string& aFirst, const std::str if( !extractVersion( aFirst, &a_maj, &a_min ) || !extractVersion( aSecond, &b_maj, &b_min ) ) { - wxLogTrace( traceSettings, wxT( "compareSettingsVersions: bad input (%s, %s)" ), aFirst, aSecond ); + wxLogTrace( traceSettings, wxT( "compareSettingsVersions: bad input (%s, %s)" ), + aFirst, aSecond ); return -1; } @@ -1163,7 +1170,8 @@ bool SETTINGS_MANAGER::BackupProject( REPORTER& aReporter ) const if( !target.DirExists() && !wxMkdir( target.GetPath() ) ) { - wxLogTrace( traceSettings, wxT( "Could not create project backup path %s" ), target.GetPath() ); + wxLogTrace( traceSettings, wxT( "Could not create project backup path %s" ), + target.GetPath() ); return false; } diff --git a/eeschema/connection_graph.cpp b/eeschema/connection_graph.cpp index 461b6ced6c..f3d0a111c2 100644 --- a/eeschema/connection_graph.cpp +++ b/eeschema/connection_graph.cpp @@ -224,7 +224,8 @@ bool CONNECTION_SUBGRAPH::ResolveDrivers( bool aCheckMultipleDrivers ) } -void CONNECTION_SUBGRAPH::getAllConnectedItems( std::set>& aItems, +void CONNECTION_SUBGRAPH::getAllConnectedItems( std::set>& aItems, std::set& aSubgraphs ) { CONNECTION_SUBGRAPH* sg = this; @@ -1370,8 +1371,8 @@ void CONNECTION_GRAPH::generateBusAliasMembers() CONNECTION_SUBGRAPH* new_sg = new CONNECTION_SUBGRAPH( this ); // This connection cannot form a part of the item because the item is not, itself - // connected to this subgraph. It exists as part of a virtual item that may be connected - // to other items but is not in the schematic. + // connected to this subgraph. It exists as part of a virtual item that may be + // connected to other items but is not in the schematic. SCH_CONNECTION* new_conn = new SCH_CONNECTION( item, subgraph->m_sheet ); new_conn->SetGraph( this ); new_conn->SetName( name ); @@ -1399,7 +1400,8 @@ void CONNECTION_GRAPH::generateBusAliasMembers() } } - std::copy( new_subgraphs.begin(), new_subgraphs.end(), std::back_inserter( m_driver_subgraphs ) ); + std::copy( new_subgraphs.begin(), new_subgraphs.end(), + std::back_inserter( m_driver_subgraphs ) ); } void CONNECTION_GRAPH::generateGlobalPowerPinSubGraphs() @@ -2039,7 +2041,6 @@ void CONNECTION_GRAPH::buildConnectionGraph( std::function* a } } - auto updateItemConnectionsTask = [&]( CONNECTION_SUBGRAPH* subgraph ) -> size_t { diff --git a/eeschema/tools/ee_selection_tool.cpp b/eeschema/tools/ee_selection_tool.cpp index 156e78bdeb..053858774e 100644 --- a/eeschema/tools/ee_selection_tool.cpp +++ b/eeschema/tools/ee_selection_tool.cpp @@ -208,12 +208,16 @@ bool EE_SELECTION_TOOL::Init() m_isSymbolViewer = symbolViewerFrame != nullptr; } - auto linesSelection = E_C::MoreThan( 0 ) && E_C::OnlyTypes( { SCH_ITEM_LOCATE_WIRE_T, SCH_ITEM_LOCATE_BUS_T, - SCH_ITEM_LOCATE_GRAPHIC_LINE_T } ); - auto wireOrBusSelection = E_C::Count( 1 ) && E_C::OnlyTypes( { SCH_ITEM_LOCATE_WIRE_T, SCH_ITEM_LOCATE_BUS_T } ); + auto linesSelection = E_C::MoreThan( 0 ) && + E_C::OnlyTypes( { SCH_ITEM_LOCATE_WIRE_T, SCH_ITEM_LOCATE_BUS_T, + SCH_ITEM_LOCATE_GRAPHIC_LINE_T } ); + auto wireOrBusSelection = E_C::Count( 1 ) && + E_C::OnlyTypes( { SCH_ITEM_LOCATE_WIRE_T, + SCH_ITEM_LOCATE_BUS_T } ); auto connectedSelection = E_C::Count( 1 ) && E_C::OnlyTypes( connectedTypes ); auto sheetSelection = E_C::Count( 1 ) && E_C::OnlyTypes( { SCH_SHEET_T } ); - auto crossProbingSelection = E_C::MoreThan( 0 ) && E_C::HasTypes( { SCH_SYMBOL_T, SCH_PIN_T, SCH_SHEET_T } ); + auto crossProbingSelection = E_C::MoreThan( 0 ) && + E_C::HasTypes( { SCH_SYMBOL_T, SCH_PIN_T, SCH_SHEET_T } ); auto schEditSheetPageNumberCondition = [&] ( const SELECTION& aSel ) @@ -279,10 +283,12 @@ bool EE_SELECTION_TOOL::Init() menu.AddItem( EE_ACTIONS::drawBus, schEditCondition && EE_CONDITIONS::Empty, 100 ); menu.AddSeparator( 100 ); - menu.AddItem( ACTIONS::finishInteractive, SCH_LINE_WIRE_BUS_TOOL::IsDrawingLineWireOrBus, 100 ); + menu.AddItem( ACTIONS::finishInteractive, + SCH_LINE_WIRE_BUS_TOOL::IsDrawingLineWireOrBus, 100 ); menu.AddItem( EE_ACTIONS::enterSheet, sheetSelection && EE_CONDITIONS::Idle, 150 ); - menu.AddItem( EE_ACTIONS::selectOnPCB, crossProbingSelection && EE_CONDITIONS::Idle, 150 ); + menu.AddItem( EE_ACTIONS::selectOnPCB, + crossProbingSelection && EE_CONDITIONS::Idle, 150 ); menu.AddItem( EE_ACTIONS::leaveSheet, belowRootSheetCondition, 150 ); menu.AddSeparator( 200 ); @@ -308,7 +314,8 @@ bool EE_SELECTION_TOOL::Init() m_frame->AddStandardSubMenus( m_menu ); m_disambiguateTimer.SetOwner( this ); - Connect( wxEVT_TIMER, wxTimerEventHandler( EE_SELECTION_TOOL::onDisambiguationExpire ), nullptr, this ); + Connect( wxEVT_TIMER, wxTimerEventHandler( EE_SELECTION_TOOL::onDisambiguationExpire ), + nullptr, this ); return true; } @@ -649,10 +656,18 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent ) switch( pin->GetOrientation() ) { - case PIN_ORIENTATION::PIN_LEFT: stub = VECTOR2I( 1 * wireGrid.x, 0 ); break; - case PIN_ORIENTATION::PIN_RIGHT: stub = VECTOR2I( -1 * wireGrid.x, 0 ); break; - case PIN_ORIENTATION::PIN_UP: stub = VECTOR2I( 0, 1 * wireGrid.y ); break; - case PIN_ORIENTATION::PIN_DOWN: stub = VECTOR2I( 0, -1 * wireGrid.y ); break; + case PIN_ORIENTATION::PIN_LEFT: + stub = VECTOR2I( 1 * wireGrid.x, 0 ); + break; + case PIN_ORIENTATION::PIN_RIGHT: + stub = VECTOR2I( -1 * wireGrid.x, 0 ); + break; + case PIN_ORIENTATION::PIN_UP: + stub = VECTOR2I( 0, 1 * wireGrid.y ); + break; + case PIN_ORIENTATION::PIN_DOWN: + stub = VECTOR2I( 0, -1 * wireGrid.y ); + break; } wire->SetEndPoint( pin->GetPosition() + stub ); @@ -747,7 +762,8 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent ) commit.Push( wxS( "Label Pins" ) ); - // Many users will want to drag these items to wire off of the pins, so pre-select them + // Many users will want to drag these items to wire off of the pins, so + // pre-select them. ClearSelection(); AddItemsToSel( &newItems ); } @@ -1127,7 +1143,8 @@ bool EE_SELECTION_TOOL::selectPoint( EE_COLLECTOR& aCollector, const VECTOR2I& a { aCollector[i]->ClearFlags( flags ); - // Need to update end shadows after ctrl-click unselecting one of two selected endpoints + // Need to update end shadows after ctrl-click unselecting one of two selected + // endpoints. if( isLine ) getView()->Update( aCollector[i] ); @@ -1297,7 +1314,6 @@ void EE_SELECTION_TOOL::GuessSelectionCandidates( EE_COLLECTOR& collector, const SCH_SYMBOL* symbol = dynamic_cast( item ); // Lines are hard to hit. Give them a bit more slop to still be considered "exact". - if( line || ( shape && shape->GetShape() == SHAPE_T::POLY ) || ( shape && shape->GetShape() == SHAPE_T::ARC ) ) { @@ -1356,7 +1372,8 @@ void EE_SELECTION_TOOL::GuessSelectionCandidates( EE_COLLECTOR& collector, const if( line ) { - dist = KiROUND( DistanceLinePoint( line->GetStartPoint(), line->GetEndPoint(), pos ) ); + dist = KiROUND( DistanceLinePoint( line->GetStartPoint(), + line->GetEndPoint(), pos ) ); } else if( field ) { diff --git a/include/settings/common_settings.h b/include/settings/common_settings.h index d19d98b68f..7c3c68d743 100644 --- a/include/settings/common_settings.h +++ b/include/settings/common_settings.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2020 Jon Evans - * Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2020, 2023 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 @@ -191,7 +191,8 @@ private: static bool getLegacy3DHollerith( const std::string& aString, size_t& aIndex, wxString& aResult ); - bool readLegacy3DResolverCfg( const wxString& aPath, std::vector& aSearchPaths ); + bool readLegacy3DResolverCfg( const wxString& aPath, + std::vector& aSearchPaths ); public: APPEARANCE m_Appearance; diff --git a/kicad/cli/command.cpp b/kicad/cli/command.cpp index e22cafa4a2..a839c0c7b8 100644 --- a/kicad/cli/command.cpp +++ b/kicad/cli/command.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2022 Mark Roszko - * Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2023 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 @@ -160,7 +160,8 @@ void CLI::COMMAND::addDrawingSheetArg() m_argParser.add_argument( ARG_DRAWING_SHEET ) .default_value( std::string() ) - .help( UTF8STDSTR( _( "Path to drawing sheet, this overrides any existing project defined sheet when used" ) ) ) + .help( UTF8STDSTR( _( "Path to drawing sheet, this overrides any existing project " + "defined sheet when used" ) ) ) .metavar( "SHEET_PATH" ); } @@ -173,7 +174,8 @@ void CLI::COMMAND::addDefineArg() .default_value( std::vector() ) .append() .help( UTF8STDSTR( - _( "Overrides or adds project variables, can be used multiple times to declare multiple variables." + _( "Overrides or adds project variables, can be used multiple times to " + "declare multiple variables." "\nUse in the format of '--define-var key=value' or '-D key=value'" ) ) ) .metavar( "KEY=VALUE" ); } diff --git a/kicad/cli/command.h b/kicad/cli/command.h index 18bd6b5669..5f79b24d84 100644 --- a/kicad/cli/command.h +++ b/kicad/cli/command.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2022 Mark Roszko - * Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2023 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 @@ -63,22 +63,24 @@ public: protected: /** - * Sets up the most common of args used across cli + * Set up the most common of args used across cli * * @param aInput Configures the input arg * @param aOutput Configures the output arg - * @param aInputIsDir Configures whether the input arg description will be for a file or directory - * @param aOutputIsDir Configures whether the output arg description will be for a file or directory + * @param aInputIsDir Configures whether the input arg description will be for a file or + * directory + * @param aOutputIsDir Configures whether the output arg description will be for a file or + * directory */ void addCommonArgs( bool aInput, bool aOutput, bool aInputIsDir, bool aOutputIsDir ); /** - * Sets up the drawing sheet arg used by many of the export commands + * Set up the drawing sheet arg used by many of the export commands */ void addDrawingSheetArg(); /** - * Sets up the drawing sheet arg used by many of the export commands + * Set up the drawing sheet arg used by many of the export commands */ void addDefineArg(); @@ -145,4 +147,4 @@ protected: } -#endif \ No newline at end of file +#endif diff --git a/kicad/cli/command_fp_export_svg.cpp b/kicad/cli/command_fp_export_svg.cpp index f58939a971..06438c97ac 100644 --- a/kicad/cli/command_fp_export_svg.cpp +++ b/kicad/cli/command_fp_export_svg.cpp @@ -34,14 +34,16 @@ CLI::FP_EXPORT_SVG_COMMAND::FP_EXPORT_SVG_COMMAND() : PCB_EXPORT_BASE_COMMAND( "svg", true, true ) { - m_argParser.add_description( UTF8STDSTR( _( "Exports the footprint or entire footprint library to SVG" ) ) ); + m_argParser.add_description( UTF8STDSTR( _( "Exports the footprint or entire footprint " + "library to SVG" ) ) ); addLayerArg( false ); addDefineArg(); m_argParser.add_argument( "-t", ARG_THEME ) .default_value( std::string() ) - .help( UTF8STDSTR( _( "Color theme to use (will default to footprint editor settings)" ) ) ); + .help( UTF8STDSTR( _( "Color theme to use (will default to footprint editor " + "settings)" ) ) ); m_argParser.add_argument( "--fp", ARG_FOOTPRINT ) .default_value( std::string() ) diff --git a/kicad/cli/command_fp_upgrade.cpp b/kicad/cli/command_fp_upgrade.cpp index 3df0115c50..f2c4804d30 100644 --- a/kicad/cli/command_fp_upgrade.cpp +++ b/kicad/cli/command_fp_upgrade.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2022 Mark Roszko - * Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2023 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 @@ -32,7 +32,8 @@ CLI::FP_UPGRADE_COMMAND::FP_UPGRADE_COMMAND() : PCB_EXPORT_BASE_COMMAND( "upgrade", true, true ) { - m_argParser.add_description( UTF8STDSTR( _( "Upgrades the footprint library to the current kicad version format" ) ) ); + m_argParser.add_description( UTF8STDSTR( _( "Upgrades the footprint library to the current " + "kicad version format" ) ) ); m_argParser.add_argument( ARG_FORCE ) .help( UTF8STDSTR( diff --git a/kicad/cli/command_pcb_drc.cpp b/kicad/cli/command_pcb_drc.cpp index b84360c1a0..6f795fbe58 100644 --- a/kicad/cli/command_pcb_drc.cpp +++ b/kicad/cli/command_pcb_drc.cpp @@ -43,7 +43,8 @@ CLI::PCB_DRC_COMMAND::PCB_DRC_COMMAND() : COMMAND( "drc" ) addCommonArgs( true, true, false, false ); addDefineArg(); - m_argParser.add_description( UTF8STDSTR( _( "Runs the Design Rules Check (DRC) on the PCB and creates a report" ) ) ); + m_argParser.add_description( UTF8STDSTR( _( "Runs the Design Rules Check (DRC) on the PCB " + "and creates a report" ) ) ); m_argParser.add_argument( ARG_FORMAT ) .default_value( std::string( "report" ) ) @@ -61,22 +62,26 @@ CLI::PCB_DRC_COMMAND::PCB_DRC_COMMAND() : COMMAND( "drc" ) .metavar( "UNITS" ); m_argParser.add_argument( ARG_SEVERITY_ALL ) - .help( UTF8STDSTR( _( "Report all DRC violations, this is equivalent to including all the other severity arguments" ) ) ) + .help( UTF8STDSTR( _( "Report all DRC violations, this is equivalent to including " + "all the other severity arguments" ) ) ) .implicit_value( true ) .default_value( false ); m_argParser.add_argument( ARG_SEVERITY_ERROR ) - .help( UTF8STDSTR( _( "Report all DRC error level violations, this can be combined with the other severity arguments" ) ) ) + .help( UTF8STDSTR( _( "Report all DRC error level violations, this can be combined " + "with the other severity arguments" ) ) ) .implicit_value( true ) .default_value( false ); m_argParser.add_argument( ARG_SEVERITY_WARNING ) - .help( UTF8STDSTR( _( "Report all DRC warning level violations, this can be combined with the other severity arguments" ) ) ) + .help( UTF8STDSTR( _( "Report all DRC warning level violations, this can be combined " + "with the other severity arguments" ) ) ) .implicit_value( true ) .default_value( false ); m_argParser.add_argument( ARG_SEVERITY_EXCLUSIONS ) - .help( UTF8STDSTR( _( "Report all excluded DRC violations, this can be combined with the other severity arguments" ) ) ) + .help( UTF8STDSTR( _( "Report all excluded DRC violations, this can be combined with " + "the other severity arguments" ) ) ) .implicit_value( true ) .default_value( false ); diff --git a/kicad/cli/command_pcb_export_3d.cpp b/kicad/cli/command_pcb_export_3d.cpp index a0b6b84f0b..187e7d3a34 100644 --- a/kicad/cli/command_pcb_export_3d.cpp +++ b/kicad/cli/command_pcb_export_3d.cpp @@ -126,14 +126,16 @@ CLI::PCB_EXPORT_3D_COMMAND::PCB_EXPORT_3D_COMMAND( const std::string& aNa if( m_format == JOB_EXPORT_PCB_3D::FORMAT::STEP ) { m_argParser.add_argument( ARG_NO_OPTIMIZE_STEP ) - .help( UTF8STDSTR( _( "Do not optimize STEP file (enables writing parametric curves)" ) ) ) + .help( UTF8STDSTR( _( "Do not optimize STEP file (enables writing parametric " + "curves)" ) ) ) .implicit_value( true ) .default_value( false ); } m_argParser.add_argument( ARG_USER_ORIGIN ) .default_value( std::string() ) - .help( UTF8STDSTR( _( "User-specified output origin ex. 1x1in, 1x1inch, 25.4x25.4mm (default unit mm)" ) ) ); + .help( UTF8STDSTR( _( "User-specified output origin ex. 1x1in, 1x1inch, 25.4x25.4mm " + "(default unit mm)" ) ) ); if( m_format == JOB_EXPORT_PCB_3D::FORMAT::VRML ) { @@ -149,7 +151,8 @@ CLI::PCB_EXPORT_3D_COMMAND::PCB_EXPORT_3D_COMMAND( const std::string& aNa "empty, the models will be embedded in main exported VRML file" ) ) ); m_argParser.add_argument( ARG_VRML_MODELS_RELATIVE ) - .help( UTF8STDSTR( _( "Used with --models-dir to output relative paths in the resulting file" ) ) ) + .help( UTF8STDSTR( _( "Used with --models-dir to output relative paths in the " + "resulting file" ) ) ) .implicit_value( true ) .default_value( false ); } diff --git a/kicad/cli/command_pcb_export_base.cpp b/kicad/cli/command_pcb_export_base.cpp index 640b60675a..2bf8e7dc7d 100644 --- a/kicad/cli/command_pcb_export_base.cpp +++ b/kicad/cli/command_pcb_export_base.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2022 Mark Roszko - * Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2023 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 @@ -72,7 +72,8 @@ CLI::PCB_EXPORT_BASE_COMMAND::PCB_EXPORT_BASE_COMMAND( const std::string& aName, } -LSEQ CLI::PCB_EXPORT_BASE_COMMAND::convertLayerStringList( wxString& aLayerString, bool& aLayerArgSet ) const +LSEQ CLI::PCB_EXPORT_BASE_COMMAND::convertLayerStringList( wxString& aLayerString, + bool& aLayerArgSet ) const { LSEQ layerMask; diff --git a/kicad/cli/command_pcb_export_base.h b/kicad/cli/command_pcb_export_base.h index 6232ff13f2..19fd117a37 100644 --- a/kicad/cli/command_pcb_export_base.h +++ b/kicad/cli/command_pcb_export_base.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2022 Mark Roszko - * Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2023 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 @@ -42,7 +42,8 @@ namespace CLI struct PCB_EXPORT_BASE_COMMAND : public COMMAND { - PCB_EXPORT_BASE_COMMAND( const std::string& aName, bool aInputIsDir = false, bool aOutputIsDir = false ); + PCB_EXPORT_BASE_COMMAND( const std::string& aName, bool aInputIsDir = false, + bool aOutputIsDir = false ); protected: int doPerform( KIWAY& aKiway ) override; diff --git a/kicad/cli/command_pcb_export_drill.cpp b/kicad/cli/command_pcb_export_drill.cpp index c75f8ad15f..04d5f17d22 100644 --- a/kicad/cli/command_pcb_export_drill.cpp +++ b/kicad/cli/command_pcb_export_drill.cpp @@ -41,7 +41,8 @@ #define ARG_MAP_FORMAT "--map-format" #define ARG_DRILL_ORIGIN "--drill-origin" -CLI::PCB_EXPORT_DRILL_COMMAND::PCB_EXPORT_DRILL_COMMAND() : PCB_EXPORT_BASE_COMMAND( "drill", false, true ) +CLI::PCB_EXPORT_DRILL_COMMAND::PCB_EXPORT_DRILL_COMMAND() : PCB_EXPORT_BASE_COMMAND( "drill", + false, true ) { m_argParser.add_description( UTF8STDSTR( _( "Generate Drill Files" ) ) ); diff --git a/kicad/cli/command_pcb_export_gerbers.cpp b/kicad/cli/command_pcb_export_gerbers.cpp index 10460271ff..1e47c49d1e 100644 --- a/kicad/cli/command_pcb_export_gerbers.cpp +++ b/kicad/cli/command_pcb_export_gerbers.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2022 Mark Roszko - * Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2023 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 @@ -46,12 +46,14 @@ CLI::PCB_EXPORT_GERBERS_COMMAND::PCB_EXPORT_GERBERS_COMMAND() : m_argParser.add_argument( "--cl", ARG_COMMON_LAYERS ) .default_value( std::string() ) .help( UTF8STDSTR( - _( "Layers to include on each plot, comma separated list of untranslated layer names to include such as " + _( "Layers to include on each plot, comma separated list of untranslated " + "layer names to include such as " "F.Cu,B.Cu" ) ) ) .metavar( "COMMON_LAYER_LIST" ); m_argParser.add_argument( ARG_USE_BOARD_PLOT_PARAMS ) - .help( UTF8STDSTR( _( "Use the Gerber plot settings already configured in the board file" ) ) ) + .help( UTF8STDSTR( _( "Use the Gerber plot settings already configured in the " + "board file" ) ) ) .implicit_value( true ) .default_value( false ); } diff --git a/kicad/cli/command_sch_erc.cpp b/kicad/cli/command_sch_erc.cpp index 9b2e733d24..014d5abda6 100644 --- a/kicad/cli/command_sch_erc.cpp +++ b/kicad/cli/command_sch_erc.cpp @@ -42,7 +42,8 @@ CLI::SCH_ERC_COMMAND::SCH_ERC_COMMAND() : COMMAND( "erc" ) addCommonArgs( true, true, false, false ); addDefineArg(); - m_argParser.add_description( UTF8STDSTR( _( "Runs the Electrical Rules Check (ERC) on the schematic and creates a report" ) ) ); + m_argParser.add_description( UTF8STDSTR( _( "Runs the Electrical Rules Check (ERC) on the " + "schematic and creates a report" ) ) ); m_argParser.add_argument( ARG_FORMAT ) .default_value( std::string( "report" ) ) @@ -54,22 +55,26 @@ CLI::SCH_ERC_COMMAND::SCH_ERC_COMMAND() : COMMAND( "erc" ) _( "Report units; valid options: in, mm, mils" ) ) ); m_argParser.add_argument( ARG_SEVERITY_ALL ) - .help( UTF8STDSTR( _( "Report all ERC violations, this is equivalent to including all the other severity arguments" ) ) ) + .help( UTF8STDSTR( _( "Report all ERC violations, this is equivalent to including " + "all the other severity arguments" ) ) ) .implicit_value( true ) .default_value( false ); m_argParser.add_argument( ARG_SEVERITY_ERROR ) - .help( UTF8STDSTR( _( "Report all ERC error level violations, this can be combined with the other severity arguments" ) ) ) + .help( UTF8STDSTR( _( "Report all ERC error level violations, this can be combined " + "with the other severity arguments" ) ) ) .implicit_value( true ) .default_value( false ); m_argParser.add_argument( ARG_SEVERITY_WARNING ) - .help( UTF8STDSTR( _( "Report all ERC warning level violations, this can be combined with the other severity arguments" ) ) ) + .help( UTF8STDSTR( _( "Report all ERC warning level violations, this can be combined " + "with the other severity arguments" ) ) ) .implicit_value( true ) .default_value( false ); m_argParser.add_argument( ARG_SEVERITY_EXCLUSIONS ) - .help( UTF8STDSTR( _( "Report all excluded ERC violations, this can be combined with the other severity arguments" ) ) ) + .help( UTF8STDSTR( _( "Report all excluded ERC violations, this can be combined " + "with the other severity arguments" ) ) ) .implicit_value( true ) .default_value( false ); @@ -108,6 +113,7 @@ int CLI::SCH_ERC_COMMAND::doPerform( KIWAY& aKiway ) { ercJob->m_severity |= RPT_SEVERITY_EXCLUSION; } + wxString units = From_UTF8( m_argParser.get( ARG_UNITS ).c_str() ); if( units == wxS( "mm" ) ) @@ -129,6 +135,7 @@ int CLI::SCH_ERC_COMMAND::doPerform( KIWAY& aKiway ) } wxString format = From_UTF8( m_argParser.get( ARG_FORMAT ).c_str() ); + if( format == "report" ) { ercJob->m_format = JOB_SCH_ERC::OUTPUT_FORMAT::REPORT; diff --git a/kicad/cli/command_sch_export_bom.h b/kicad/cli/command_sch_export_bom.h index fec5ea5957..4d4c020b87 100644 --- a/kicad/cli/command_sch_export_bom.h +++ b/kicad/cli/command_sch_export_bom.h @@ -27,7 +27,8 @@ namespace CLI { // Options for selecting presets of the export, e.g. GroupedByValue and CSV #define ARG_PRESET "--preset" -#define ARG_PRESET_DESC "Use a named BOM preset setting from the schematic, e.g. \"Grouped By Value\"." +#define ARG_PRESET_DESC "Use a named BOM preset setting from the schematic, e.g. " \ + "\"Grouped By Value\"." #define ARG_FMT_PRESET "--format-preset" #define ARG_FMT_PRESET_DESC "Use a named BOM format preset setting from the schematic, e.g. CSV." @@ -43,13 +44,15 @@ namespace CLI #define ARG_REF_DELIMITER_DESC "Character to place between individual references." #define ARG_REF_RANGE_DELIMITER "--ref-range-delimiter" -#define ARG_REF_RANGE_DELIMITER_DESC "Character to place in ranges of references. Leave blank for no ranges." +#define ARG_REF_RANGE_DELIMITER_DESC "Character to place in ranges of references. Leave " \ + "blank for no ranges." #define ARG_KEEP_TABS "--keep-tabs" #define ARG_KEEP_TABS_DESC "Keep tab characters from input fields. Stripped by default." #define ARG_KEEP_LINE_BREAKS "--keep-line-breaks" -#define ARG_KEEP_LINE_BREAKS_DESC "Keep line break characters from input fields. Stripped by default." +#define ARG_KEEP_LINE_BREAKS_DESC "Keep line break characters from input fields. Stripped " \ + "by default." //Options for controlling the fields and the grouping #define ARG_FIELDS "--fields" diff --git a/kicad/cli/command_sch_export_plot.cpp b/kicad/cli/command_sch_export_plot.cpp index 8f1c1d1403..7a0b7effd6 100644 --- a/kicad/cli/command_sch_export_plot.cpp +++ b/kicad/cli/command_sch_export_plot.cpp @@ -61,7 +61,8 @@ CLI::SCH_EXPORT_PLOT_COMMAND::SCH_EXPORT_PLOT_COMMAND( const std::string& aName, { m_argParser.add_argument( "-t", ARG_THEME ) .default_value( std::string() ) - .help( UTF8STDSTR( _( "Color theme to use (will default to schematic settings)" ) ) ) + .help( UTF8STDSTR( _( "Color theme to use (will default to schematic " + "settings)" ) ) ) .metavar( "THEME_NAME" ); m_argParser.add_argument( "-b", ARG_BLACKANDWHITE ) .help( UTF8STDSTR( _( ARG_BLACKANDWHITE_DESC ) ) ) @@ -94,7 +95,8 @@ CLI::SCH_EXPORT_PLOT_COMMAND::SCH_EXPORT_PLOT_COMMAND( const std::string& aName, m_argParser.add_argument( "-p", ARG_PAGES ) .default_value( std::string() ) - .help( UTF8STDSTR( _( "List of page numbers separated by comma to print, blank or unspecified is equivalent to all pages" ) ) ) + .help( UTF8STDSTR( _( "List of page numbers separated by comma to print, blank or " + "unspecified is equivalent to all pages" ) ) ) .metavar( "PAGE_LIST" ); if( aPlotFormat == SCH_PLOT_FORMAT::HPGL ) diff --git a/kicad/cli/command_sym_export_svg.cpp b/kicad/cli/command_sym_export_svg.cpp index 8586a9f9f1..8a21bb8dce 100644 --- a/kicad/cli/command_sym_export_svg.cpp +++ b/kicad/cli/command_sym_export_svg.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2022 Mark Roszko - * Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2023 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 @@ -29,20 +29,24 @@ #include #include + #define ARG_NO_BACKGROUND_COLOR "--no-background-color" #define ARG_SYMBOL "--symbol" #define ARG_INC_HIDDEN_PINS "--include-hidden-pins" #define ARG_INC_HIDDEN_FIELDS "--include-hidden-fields" + CLI::SYM_EXPORT_SVG_COMMAND::SYM_EXPORT_SVG_COMMAND() : COMMAND( "svg" ) { addCommonArgs( true, true, false, true ); - m_argParser.add_description( UTF8STDSTR( _( "Exports the symbol or entire symbol library to SVG" ) ) ); + m_argParser.add_description( UTF8STDSTR( _( "Exports the symbol or entire symbol library " + "to SVG" ) ) ); m_argParser.add_argument( "-t", ARG_THEME ) .default_value( std::string() ) - .help( UTF8STDSTR( _( "Color theme to use (will default to symbol editor settings)" ) ) ) + .help( UTF8STDSTR( _( "Color theme to use (will default to symbol editor " + "settings)" ) ) ) .metavar( "THEME_NAME" ); m_argParser.add_argument( "-s", ARG_SYMBOL ) diff --git a/kicad/cli/command_sym_upgrade.cpp b/kicad/cli/command_sym_upgrade.cpp index 96c6245bc9..817733e2ea 100644 --- a/kicad/cli/command_sym_upgrade.cpp +++ b/kicad/cli/command_sym_upgrade.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2022 Mark Roszko - * Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2023 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 @@ -28,13 +28,16 @@ #include + #define ARG_FORCE "--force" + CLI::SYM_UPGRADE_COMMAND::SYM_UPGRADE_COMMAND() : COMMAND( "upgrade" ) { addCommonArgs( true, true, false, false ); - m_argParser.add_description( UTF8STDSTR( _( "Upgrades the symbol library to the current kicad version format" ) ) ); + m_argParser.add_description( UTF8STDSTR( _( "Upgrades the symbol library to the current " + "kicad version format" ) ) ); m_argParser.add_argument( ARG_FORCE ) .help( UTF8STDSTR( diff --git a/kicad/cli/command_version.cpp b/kicad/cli/command_version.cpp index afd52127ff..3aed7b69fc 100644 --- a/kicad/cli/command_version.cpp +++ b/kicad/cli/command_version.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2022 Mark Roszko - * Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2023 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 @@ -26,8 +26,10 @@ #include #include + #define ARG_FORMAT "--format" + CLI::VERSION_COMMAND::VERSION_COMMAND() : COMMAND( "version" ) { m_argParser.add_description( UTF8STDSTR( _( "Reports the version info in various formats" ) ) ); @@ -44,8 +46,8 @@ int CLI::VERSION_COMMAND::doPerform( KIWAY& aKiway ) { // were we redirected from the --version? // m_argParser override for bool() returns false if we didnt parse any args normally - // we need to exit here early because it'll exception in the later arg handling code if we dont - // no arg provided also ends up here on the version command + // we need to exit here early because it'll exception in the later arg handling code + // if we don't no arg provided also ends up here on the version command wxPrintf( "%s\n", GetMajorMinorPatchVersion() ); return EXIT_CODES::OK; }