Replace boost::optional with std::optional
This commit is contained in:
parent
c491cd01c5
commit
f1261e71d4
|
@ -62,10 +62,10 @@ const wxString& ARRAY_AXIS::GetAlphabet() const
|
|||
}
|
||||
|
||||
|
||||
OPT<int> ARRAY_AXIS::getNumberingOffset( const wxString& str ) const
|
||||
std::optional<int> ARRAY_AXIS::getNumberingOffset( const wxString& str ) const
|
||||
{
|
||||
if( str.length() == 0 )
|
||||
return OPT<int>{};
|
||||
return std::optional<int>{};
|
||||
|
||||
const wxString& alphabet = GetAlphabet();
|
||||
|
||||
|
@ -77,7 +77,7 @@ OPT<int> ARRAY_AXIS::getNumberingOffset( const wxString& str ) const
|
|||
int chIndex = alphabet.Find( str[i], false );
|
||||
|
||||
if( chIndex == wxNOT_FOUND )
|
||||
return OPT<int>{};
|
||||
return std::optional<int>{};
|
||||
|
||||
const bool start0 = schemeNonUnitColsStartAt0( m_type );
|
||||
|
||||
|
@ -89,7 +89,7 @@ OPT<int> ARRAY_AXIS::getNumberingOffset( const wxString& str ) const
|
|||
offset += chIndex;
|
||||
}
|
||||
|
||||
return OPT<int>{ offset };
|
||||
return std::optional<int>{ offset };
|
||||
}
|
||||
|
||||
|
||||
|
@ -101,7 +101,7 @@ void ARRAY_AXIS::SetAxisType( NUMBERING_TYPE aType )
|
|||
|
||||
bool ARRAY_AXIS::SetOffset( const wxString& aOffsetName )
|
||||
{
|
||||
OPT<int> offset = getNumberingOffset( aOffsetName );
|
||||
std::optional<int> offset = getNumberingOffset( aOffsetName );
|
||||
|
||||
// The string does not decode to a valid offset
|
||||
if( !offset )
|
||||
|
|
|
@ -117,7 +117,7 @@ wxString ENV_VAR::LookUpEnvVarHelp( const wxString& aEnvVar )
|
|||
|
||||
|
||||
template<>
|
||||
OPT<double> ENV_VAR::GetEnvVar( const wxString& aEnvVarName )
|
||||
std::optional<double> ENV_VAR::GetEnvVar( const wxString& aEnvVarName )
|
||||
{
|
||||
wxString env;
|
||||
|
||||
|
@ -129,14 +129,14 @@ OPT<double> ENV_VAR::GetEnvVar( const wxString& aEnvVarName )
|
|||
return value;
|
||||
}
|
||||
|
||||
return NULLOPT;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
OPT<wxString> ENV_VAR::GetEnvVar( const wxString& aEnvVarName )
|
||||
std::optional<wxString> ENV_VAR::GetEnvVar( const wxString& aEnvVarName )
|
||||
{
|
||||
OPT<wxString> optValue;
|
||||
std::optional<wxString> optValue;
|
||||
|
||||
wxString env;
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include <gal/dpi_scaling.h>
|
||||
|
||||
#include <core/optional.h>
|
||||
#include <optional>
|
||||
|
||||
#include <env_vars.h>
|
||||
#include <settings/common_settings.h>
|
||||
|
@ -47,9 +47,9 @@ const wxChar* const traceHiDpi = wxT( "KICAD_TRACE_HIGH_DPI" );
|
|||
*
|
||||
* @return the scale factor, if set
|
||||
*/
|
||||
static OPT<double> getKiCadConfiguredScale( const COMMON_SETTINGS& aConfig )
|
||||
static std::optional<double> getKiCadConfiguredScale( const COMMON_SETTINGS& aConfig )
|
||||
{
|
||||
OPT<double> scale;
|
||||
std::optional<double> scale;
|
||||
double canvas_scale = aConfig.m_Appearance.canvas_scale;
|
||||
|
||||
if( canvas_scale > 0.0 )
|
||||
|
@ -72,10 +72,10 @@ static OPT<double> getKiCadConfiguredScale( const COMMON_SETTINGS& aConfig )
|
|||
*
|
||||
* @return the scale factor, if set
|
||||
*/
|
||||
static OPT<double> getEnvironmentScale()
|
||||
static std::optional<double> getEnvironmentScale()
|
||||
{
|
||||
const wxPortId port_id = wxPlatformInfo::Get().GetPortId();
|
||||
OPT<double> scale;
|
||||
std::optional<double> scale;
|
||||
|
||||
if( port_id == wxPORT_GTK )
|
||||
{
|
||||
|
@ -100,7 +100,7 @@ DPI_SCALING::DPI_SCALING( COMMON_SETTINGS* aConfig, const wxWindow* aWindow )
|
|||
|
||||
double DPI_SCALING::GetScaleFactor() const
|
||||
{
|
||||
OPT<double> val;
|
||||
std::optional<double> val;
|
||||
|
||||
if( m_config )
|
||||
{
|
||||
|
@ -140,7 +140,7 @@ bool DPI_SCALING::GetCanvasIsAutoScaled() const
|
|||
return true;
|
||||
}
|
||||
|
||||
const bool automatic = getKiCadConfiguredScale( *m_config ) == boost::none;
|
||||
const bool automatic = getKiCadConfiguredScale( *m_config ) == std::nullopt;
|
||||
wxLogTrace( traceHiDpi, "Scale is automatic: %d", automatic );
|
||||
return automatic;
|
||||
}
|
||||
|
|
|
@ -181,7 +181,7 @@ wxString Convert<wxString>( const wxString& aValue );
|
|||
/**
|
||||
* Model an optional XML attribute.
|
||||
*
|
||||
* This was implemented as an alternative to OPT. This class should be replaced with a
|
||||
* This was implemented as an alternative to std::optional. This class should be replaced with a
|
||||
* simple typedef per type using std::optional when C++17 is published.
|
||||
*/
|
||||
template <typename T>
|
||||
|
|
|
@ -152,7 +152,7 @@ void POLYGON_GEOM_MANAGER::updateLeaderPoints( const VECTOR2I& aEndPoint, LEADER
|
|||
const VECTOR2I line_vec( aEndPoint - last_pt );
|
||||
// get a restricted 45/H/V line from the last fixed point to the cursor
|
||||
auto new_end = last_pt + GetVectorSnapped45( line_vec );
|
||||
OPT_VECTOR2I pt = boost::make_optional( false, VECTOR2I() );
|
||||
OPT_VECTOR2I pt;
|
||||
|
||||
if( m_lockedPoints.SegmentCount() > 1 )
|
||||
{
|
||||
|
|
|
@ -35,8 +35,8 @@
|
|||
const int netSettingsSchemaVersion = 3; // netclass assignment patterns
|
||||
|
||||
|
||||
static OPT<int> getInPcbUnits( const nlohmann::json& aObj, const std::string& aKey,
|
||||
OPT<int> aDefault = OPT<int>() )
|
||||
static std::optional<int> getInPcbUnits( const nlohmann::json& aObj, const std::string& aKey,
|
||||
std::optional<int> aDefault = std::optional<int>() )
|
||||
{
|
||||
if( aObj.contains( aKey ) && aObj[aKey].is_number() )
|
||||
return PcbMm2iu( aObj[aKey].get<double>() );
|
||||
|
|
|
@ -252,7 +252,7 @@ COLOR_SETTINGS::COLOR_SETTINGS( const wxString& aFilename, bool aAbsolutePath )
|
|||
"3d_viewer.silkscreen_bottom",
|
||||
"3d_viewer.solderpaste" } )
|
||||
{
|
||||
if( OPT<COLOR4D> optval = Get<COLOR4D>( path ) )
|
||||
if( std::optional<COLOR4D> optval = Get<COLOR4D>( path ) )
|
||||
Set( path, optval->WithAlpha( 1.0 ) );
|
||||
}
|
||||
|
||||
|
@ -262,11 +262,11 @@ COLOR_SETTINGS::COLOR_SETTINGS( const wxString& aFilename, bool aAbsolutePath )
|
|||
registerMigration( 3, 4,
|
||||
[&]()
|
||||
{
|
||||
if( OPT<COLOR4D> optval = Get<COLOR4D>( "board.grid" ) )
|
||||
Set( "board.page_limits", optval.get() );
|
||||
if( std::optional<COLOR4D> optval = Get<COLOR4D>( "board.grid" ) )
|
||||
Set( "board.page_limits", optval.value() );
|
||||
|
||||
if( OPT<COLOR4D> optval = Get<COLOR4D>( "schematic.grid" ) )
|
||||
Set( "schematic.page_limits", optval.get() );
|
||||
if( std::optional<COLOR4D> optval = Get<COLOR4D>( "schematic.grid" ) )
|
||||
Set( "schematic.page_limits", optval.value() );
|
||||
|
||||
return true;
|
||||
} );
|
||||
|
|
|
@ -471,7 +471,7 @@ bool COMMON_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
|
|||
ret &= fromLegacy<bool>( aCfg, "ZoomNoCenter", "input.center_on_zoom" );
|
||||
|
||||
// This was stored inverted in legacy config
|
||||
if( OPT<bool> value = Get<bool>( "input.center_on_zoom" ) )
|
||||
if( std::optional<bool> value = Get<bool>( "input.center_on_zoom" ) )
|
||||
Set( "input.center_on_zoom", !( *value ) );
|
||||
|
||||
ret &= fromLegacy<int>( aCfg, "OpenGLAntialiasingMode", "graphics.opengl_antialiasing_mode" );
|
||||
|
|
|
@ -471,7 +471,7 @@ bool JSON_SETTINGS::SaveToFile( const wxString& aDirectory, bool aForce )
|
|||
}
|
||||
|
||||
|
||||
OPT<nlohmann::json> JSON_SETTINGS::GetJson( const std::string& aPath ) const
|
||||
std::optional<nlohmann::json> JSON_SETTINGS::GetJson( const std::string& aPath ) const
|
||||
{
|
||||
nlohmann::json::json_pointer ptr = m_internals->PointerFromString( aPath );
|
||||
|
||||
|
@ -479,21 +479,21 @@ OPT<nlohmann::json> JSON_SETTINGS::GetJson( const std::string& aPath ) const
|
|||
{
|
||||
try
|
||||
{
|
||||
return OPT<nlohmann::json>{ m_internals->at( ptr ) };
|
||||
return std::optional<nlohmann::json>{ m_internals->at( ptr ) };
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
return OPT<nlohmann::json>{};
|
||||
return std::optional<nlohmann::json>{};
|
||||
}
|
||||
|
||||
|
||||
template<typename ValueType>
|
||||
OPT<ValueType> JSON_SETTINGS::Get( const std::string& aPath ) const
|
||||
std::optional<ValueType> JSON_SETTINGS::Get( const std::string& aPath ) const
|
||||
{
|
||||
if( OPT<nlohmann::json> ret = GetJson( aPath ) )
|
||||
if( std::optional<nlohmann::json> ret = GetJson( aPath ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -504,20 +504,20 @@ OPT<ValueType> JSON_SETTINGS::Get( const std::string& aPath ) const
|
|||
}
|
||||
}
|
||||
|
||||
return NULLOPT;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
|
||||
// Instantiate all required templates here to allow reducing scope of json.hpp
|
||||
template OPT<bool> JSON_SETTINGS::Get<bool>( const std::string& aPath ) const;
|
||||
template OPT<double> JSON_SETTINGS::Get<double>( const std::string& aPath ) const;
|
||||
template OPT<float> JSON_SETTINGS::Get<float>( const std::string& aPath ) const;
|
||||
template OPT<int> JSON_SETTINGS::Get<int>( const std::string& aPath ) const;
|
||||
template OPT<unsigned int> JSON_SETTINGS::Get<unsigned int>( const std::string& aPath ) const;
|
||||
template OPT<unsigned long long> JSON_SETTINGS::Get<unsigned long long>( const std::string& aPath ) const;
|
||||
template OPT<std::string> JSON_SETTINGS::Get<std::string>( const std::string& aPath ) const;
|
||||
template OPT<nlohmann::json> JSON_SETTINGS::Get<nlohmann::json>( const std::string& aPath ) const;
|
||||
template OPT<KIGFX::COLOR4D> JSON_SETTINGS::Get<KIGFX::COLOR4D>( const std::string& aPath ) const;
|
||||
template std::optional<bool> JSON_SETTINGS::Get<bool>( const std::string& aPath ) const;
|
||||
template std::optional<double> JSON_SETTINGS::Get<double>( const std::string& aPath ) const;
|
||||
template std::optional<float> JSON_SETTINGS::Get<float>( const std::string& aPath ) const;
|
||||
template std::optional<int> JSON_SETTINGS::Get<int>( const std::string& aPath ) const;
|
||||
template std::optional<unsigned int> JSON_SETTINGS::Get<unsigned int>( const std::string& aPath ) const;
|
||||
template std::optional<unsigned long long> JSON_SETTINGS::Get<unsigned long long>( const std::string& aPath ) const;
|
||||
template std::optional<std::string> JSON_SETTINGS::Get<std::string>( const std::string& aPath ) const;
|
||||
template std::optional<nlohmann::json> JSON_SETTINGS::Get<nlohmann::json>( const std::string& aPath ) const;
|
||||
template std::optional<KIGFX::COLOR4D> JSON_SETTINGS::Get<KIGFX::COLOR4D>( const std::string& aPath ) const;
|
||||
|
||||
|
||||
template<typename ValueType>
|
||||
|
@ -770,12 +770,12 @@ void JSON_SETTINGS::ReleaseNestedSettings( NESTED_SETTINGS* aSettings )
|
|||
|
||||
// Specializations to allow conversion between wxString and std::string via JSON_SETTINGS API
|
||||
|
||||
template<> OPT<wxString> JSON_SETTINGS::Get( const std::string& aPath ) const
|
||||
template<> std::optional<wxString> JSON_SETTINGS::Get( const std::string& aPath ) const
|
||||
{
|
||||
if( OPT<nlohmann::json> opt_json = GetJson( aPath ) )
|
||||
if( std::optional<nlohmann::json> opt_json = GetJson( aPath ) )
|
||||
return wxString( opt_json->get<std::string>().c_str(), wxConvUTF8 );
|
||||
|
||||
return NULLOPT;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -35,14 +35,14 @@ void PARAM_LAMBDA<ValueType>::Load( JSON_SETTINGS* aSettings, bool aResetIfMissi
|
|||
|
||||
if( std::is_same<ValueType, nlohmann::json>::value )
|
||||
{
|
||||
if( OPT<nlohmann::json> optval = aSettings->GetJson( m_path ) )
|
||||
if( std::optional<nlohmann::json> optval = aSettings->GetJson( m_path ) )
|
||||
m_setter( *optval );
|
||||
else
|
||||
m_setter( m_default );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( OPT<ValueType> optval = aSettings->Get<ValueType>( m_path ) )
|
||||
if( std::optional<ValueType> optval = aSettings->Get<ValueType>( m_path ) )
|
||||
m_setter( *optval );
|
||||
else
|
||||
m_setter( m_default );
|
||||
|
@ -55,12 +55,12 @@ bool PARAM_LAMBDA<ValueType>::MatchesFile( JSON_SETTINGS* aSettings ) const
|
|||
{
|
||||
if( std::is_same<ValueType, nlohmann::json>::value )
|
||||
{
|
||||
if( OPT<nlohmann::json> optval = aSettings->GetJson( m_path ) )
|
||||
if( std::optional<nlohmann::json> optval = aSettings->GetJson( m_path ) )
|
||||
return *optval == m_getter();
|
||||
}
|
||||
else
|
||||
{
|
||||
if( OPT<ValueType> optval = aSettings->Get<ValueType>( m_path ) )
|
||||
if( std::optional<ValueType> optval = aSettings->Get<ValueType>( m_path ) )
|
||||
return *optval == m_getter();
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ void PARAM_LIST<ValueType>::Load( JSON_SETTINGS* aSettings, bool aResetIfMissing
|
|||
if( m_readOnly )
|
||||
return;
|
||||
|
||||
if( OPT<nlohmann::json> js = aSettings->GetJson( m_path ) )
|
||||
if( std::optional<nlohmann::json> js = aSettings->GetJson( m_path ) )
|
||||
{
|
||||
std::vector<ValueType> val;
|
||||
|
||||
|
@ -114,7 +114,7 @@ void PARAM_LIST<ValueType>::Store( JSON_SETTINGS* aSettings ) const
|
|||
template <typename ValueType>
|
||||
bool PARAM_LIST<ValueType>::MatchesFile( JSON_SETTINGS* aSettings ) const
|
||||
{
|
||||
if( OPT<nlohmann::json> js = aSettings->GetJson( m_path ) )
|
||||
if( std::optional<nlohmann::json> js = aSettings->GetJson( m_path ) )
|
||||
{
|
||||
if( js->is_array() )
|
||||
{
|
||||
|
@ -151,7 +151,7 @@ void PARAM_PATH_LIST::Store( JSON_SETTINGS* aSettings ) const
|
|||
|
||||
bool PARAM_PATH_LIST::MatchesFile( JSON_SETTINGS* aSettings ) const
|
||||
{
|
||||
if( OPT<nlohmann::json> js = aSettings->GetJson( m_path ) )
|
||||
if( std::optional<nlohmann::json> js = aSettings->GetJson( m_path ) )
|
||||
{
|
||||
if( js->is_array() )
|
||||
{
|
||||
|
@ -174,7 +174,7 @@ void PARAM_MAP<Value>::Load( JSON_SETTINGS* aSettings, bool aResetIfMissing ) co
|
|||
if( m_readOnly )
|
||||
return;
|
||||
|
||||
if( OPT<nlohmann::json> js = aSettings->GetJson( m_path ) )
|
||||
if( std::optional<nlohmann::json> js = aSettings->GetJson( m_path ) )
|
||||
{
|
||||
if( js->is_object() )
|
||||
{
|
||||
|
@ -204,7 +204,7 @@ void PARAM_MAP<Value>::Store( JSON_SETTINGS* aSettings ) const
|
|||
template <typename Value>
|
||||
bool PARAM_MAP<Value>::MatchesFile( JSON_SETTINGS* aSettings ) const
|
||||
{
|
||||
if( OPT<nlohmann::json> js = aSettings->GetJson( m_path ) )
|
||||
if( std::optional<nlohmann::json> js = aSettings->GetJson( m_path ) )
|
||||
{
|
||||
if( js->is_object() )
|
||||
{
|
||||
|
@ -234,7 +234,7 @@ void PARAM_WXSTRING_MAP::Load( JSON_SETTINGS* aSettings, bool aResetIfMissing )
|
|||
if( m_readOnly )
|
||||
return;
|
||||
|
||||
if( OPT<nlohmann::json> js = aSettings->GetJson( m_path ) )
|
||||
if( std::optional<nlohmann::json> js = aSettings->GetJson( m_path ) )
|
||||
{
|
||||
if( js->is_object() )
|
||||
{
|
||||
|
@ -267,7 +267,7 @@ void PARAM_WXSTRING_MAP::Store( JSON_SETTINGS* aSettings ) const
|
|||
|
||||
bool PARAM_WXSTRING_MAP::MatchesFile( JSON_SETTINGS* aSettings ) const
|
||||
{
|
||||
if( OPT<nlohmann::json> js = aSettings->GetJson( m_path ) )
|
||||
if( std::optional<nlohmann::json> js = aSettings->GetJson( m_path ) )
|
||||
{
|
||||
if( js->is_object() )
|
||||
{
|
||||
|
|
|
@ -361,7 +361,7 @@ void SETTINGS_MANAGER::SaveColorSettings( COLOR_SETTINGS* aSettings, const std::
|
|||
aSettings->GetFilename(),
|
||||
aNamespace );
|
||||
|
||||
OPT<nlohmann::json> backup = aSettings->GetJson( aNamespace );
|
||||
std::optional<nlohmann::json> backup = aSettings->GetJson( aNamespace );
|
||||
wxString path = GetColorSettingsPath();
|
||||
|
||||
aSettings->LoadFromFile( path );
|
||||
|
|
|
@ -74,7 +74,7 @@ void GRID_HELPER::SetAuxAxes( bool aEnable, const VECTOR2I& aOrigin )
|
|||
}
|
||||
else
|
||||
{
|
||||
m_auxAxis = OPT<VECTOR2I>();
|
||||
m_auxAxis = std::optional<VECTOR2I>();
|
||||
m_toolMgr->GetView()->SetVisible( &m_viewAxis, false );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,11 +33,11 @@ void PICKER_TOOL_BASE::reset()
|
|||
m_cursor = KICURSOR::ARROW;
|
||||
m_snap = true;
|
||||
|
||||
m_picked = NULLOPT;
|
||||
m_clickHandler = NULLOPT;
|
||||
m_motionHandler = NULLOPT;
|
||||
m_cancelHandler = NULLOPT;
|
||||
m_finalizeHandler = NULLOPT;
|
||||
m_picked = std::nullopt;
|
||||
m_clickHandler = std::nullopt;
|
||||
m_motionHandler = std::nullopt;
|
||||
m_cancelHandler = std::nullopt;
|
||||
m_finalizeHandler = std::nullopt;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -351,7 +351,7 @@ bool SELECTION_TOOL::doSelectionMenu( COLLECTOR* aCollector )
|
|||
unhighlight( current, BRIGHTENED, &highlightGroup );
|
||||
}
|
||||
|
||||
OPT<int> id = evt->GetCommandId();
|
||||
std::optional<int> id = evt->GetCommandId();
|
||||
|
||||
// User has selected the "Select All" option
|
||||
if( id == limit + 1 )
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
#include <eda_draw_frame.h>
|
||||
|
||||
#include <core/arraydim.h>
|
||||
#include <core/optional.h>
|
||||
#include <optional>
|
||||
#include <wx/log.h>
|
||||
#include <wx/stc/stc.h>
|
||||
#include <wx/settings.h>
|
||||
|
@ -177,7 +177,7 @@ bool TOOL_DISPATCHER::handleMouseButton( wxEvent& aEvent, int aIndex, bool aMoti
|
|||
{
|
||||
BUTTON_STATE* st = m_buttons[aIndex];
|
||||
wxEventType type = aEvent.GetEventType();
|
||||
OPT<TOOL_EVENT> evt;
|
||||
std::optional<TOOL_EVENT> evt;
|
||||
bool isClick = false;
|
||||
|
||||
// bool up = type == st->upEvent;
|
||||
|
@ -358,9 +358,9 @@ int translateSpecialCode( int aKeyCode )
|
|||
}
|
||||
|
||||
|
||||
OPT<TOOL_EVENT> TOOL_DISPATCHER::GetToolEvent( wxKeyEvent* aKeyEvent, bool* keyIsSpecial )
|
||||
std::optional<TOOL_EVENT> TOOL_DISPATCHER::GetToolEvent( wxKeyEvent* aKeyEvent, bool* keyIsSpecial )
|
||||
{
|
||||
OPT<TOOL_EVENT> evt;
|
||||
std::optional<TOOL_EVENT> evt;
|
||||
int key = aKeyEvent->GetKeyCode();
|
||||
int unicode_key = aKeyEvent->GetUnicodeKey();
|
||||
|
||||
|
@ -443,7 +443,7 @@ void TOOL_DISPATCHER::DispatchWxEvent( wxEvent& aEvent )
|
|||
bool motion = false;
|
||||
bool buttonEvents = false;
|
||||
VECTOR2D pos;
|
||||
OPT<TOOL_EVENT> evt;
|
||||
std::optional<TOOL_EVENT> evt;
|
||||
bool keyIsEscape = false; // True if the keypress was the escape key
|
||||
bool keyIsSpecial = false; // True if the key is a special key code
|
||||
wxWindow* focus = wxWindow::FindFocus();
|
||||
|
|
|
@ -212,11 +212,9 @@ bool TOOL_EVENT::IsDblClick( int aButtonMask ) const
|
|||
|
||||
bool TOOL_EVENT::IsCancelInteractive() const
|
||||
{
|
||||
return( ( m_commandStr.is_initialized()
|
||||
&& m_commandStr.get() == ACTIONS::cancelInteractive.GetName() )
|
||||
|| ( m_commandId.is_initialized()
|
||||
&& m_commandId.get() == ACTIONS::cancelInteractive.GetId() )
|
||||
|| ( m_actions == TA_CANCEL_TOOL ) );
|
||||
return ( ( m_commandStr && m_commandStr.value() == ACTIONS::cancelInteractive.GetName() )
|
||||
|| ( m_commandId && m_commandId.value() == ACTIONS::cancelInteractive.GetId() )
|
||||
|| ( m_actions == TA_CANCEL_TOOL ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -231,22 +229,19 @@ bool TOOL_EVENT::IsSelectionEvent() const
|
|||
|
||||
bool TOOL_EVENT::IsPointEditor() const
|
||||
{
|
||||
return( ( m_commandStr.is_initialized()
|
||||
&& m_commandStr.get().find( "PointEditor" ) != GetCommandStr()->npos )
|
||||
|| ( m_commandId.is_initialized()
|
||||
&& m_commandId.get() == ACTIONS::activatePointEditor.GetId() ) );
|
||||
return ( ( m_commandStr && m_commandStr.value().find( "PointEditor" ) != GetCommandStr()->npos )
|
||||
|| ( m_commandId && m_commandId.value() == ACTIONS::activatePointEditor.GetId() ) );
|
||||
}
|
||||
|
||||
|
||||
bool TOOL_EVENT::IsMoveTool() const
|
||||
{
|
||||
return( m_commandStr.is_initialized()
|
||||
&& m_commandStr.get().find( "InteractiveMove" ) != GetCommandStr()->npos );
|
||||
return ( m_commandStr
|
||||
&& m_commandStr.value().find( "InteractiveMove" ) != GetCommandStr()->npos );
|
||||
}
|
||||
|
||||
|
||||
bool TOOL_EVENT::IsSimulator() const
|
||||
{
|
||||
return( m_commandStr.is_initialized()
|
||||
&& m_commandStr.get().find( "Simulation" ) != GetCommandStr()->npos );
|
||||
return ( m_commandStr && m_commandStr.value().find( "Simulation" ) != GetCommandStr()->npos );
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
*/
|
||||
|
||||
#include <core/kicad_algo.h>
|
||||
#include <core/optional.h>
|
||||
#include <optional>
|
||||
#include <map>
|
||||
#include <stack>
|
||||
#include <trace_helpers.h>
|
||||
|
@ -879,7 +879,7 @@ void TOOL_MANAGER::DispatchContextMenu( const TOOL_EVENT& aEvent )
|
|||
if( vc.m_forceCursorPosition )
|
||||
m_cursorSettings[idState.first] = vc.m_forcedPosition;
|
||||
else
|
||||
m_cursorSettings[idState.first] = NULLOPT;
|
||||
m_cursorSettings[idState.first] = std::nullopt;
|
||||
}
|
||||
|
||||
if( m_viewControls )
|
||||
|
@ -916,7 +916,7 @@ void TOOL_MANAGER::DispatchContextMenu( const TOOL_EVENT& aEvent )
|
|||
m_menuOwner = -1;
|
||||
|
||||
// Restore cursor settings
|
||||
for( const std::pair<const TOOL_ID, OPT<VECTOR2D>>& cursorSetting : m_cursorSettings )
|
||||
for( const std::pair<const TOOL_ID, std::optional<VECTOR2D>>& cursorSetting : m_cursorSettings )
|
||||
{
|
||||
auto it = m_toolIdIndex.find( cursorSetting.first );
|
||||
wxASSERT( it != m_toolIdIndex.end() );
|
||||
|
@ -1103,13 +1103,13 @@ void TOOL_MANAGER::saveViewControls( TOOL_STATE* aState )
|
|||
if( !curr.m_forceCursorPosition || curr.m_forcedPosition != m_menuCursor )
|
||||
{
|
||||
if( !curr.m_forceCursorPosition )
|
||||
it->second = NULLOPT;
|
||||
it->second = std::nullopt;
|
||||
else
|
||||
it->second = curr.m_forcedPosition;
|
||||
}
|
||||
else
|
||||
{
|
||||
OPT<VECTOR2D> cursor = it->second;
|
||||
std::optional<VECTOR2D> cursor = it->second;
|
||||
|
||||
if( cursor )
|
||||
{
|
||||
|
@ -1147,8 +1147,8 @@ bool TOOL_MANAGER::processEvent( const TOOL_EVENT& aEvent )
|
|||
if( GetToolHolder() && !GetToolHolder()->GetDoImmediateActions() )
|
||||
{
|
||||
// An tool-selection-event has no position
|
||||
if( mod_event.GetCommandStr().is_initialized()
|
||||
&& mod_event.GetCommandStr().get() != GetToolHolder()->CurrentToolName()
|
||||
if( mod_event.GetCommandStr()
|
||||
&& mod_event.GetCommandStr().value() != GetToolHolder()->CurrentToolName()
|
||||
&& !mod_event.ForceImmediate() )
|
||||
{
|
||||
mod_event.SetHasPosition( false );
|
||||
|
|
|
@ -60,7 +60,7 @@ void ZOOM_TOOL::Reset( RESET_REASON aReason )
|
|||
|
||||
int ZOOM_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
std::string tool = aEvent.GetCommandStr().value();
|
||||
m_frame->PushTool( tool );
|
||||
|
||||
auto setCursor =
|
||||
|
|
|
@ -467,7 +467,7 @@ EESCHEMA_SETTINGS::EESCHEMA_SETTINGS() :
|
|||
{
|
||||
// We used to have a bug on GTK which would set the lib tree column width way
|
||||
// too narrow.
|
||||
if( OPT<int> optval = Get<int>( "lib_tree.column_width" ) )
|
||||
if( std::optional<int> optval = Get<int>( "lib_tree.column_width" ) )
|
||||
{
|
||||
if( optval < 150 )
|
||||
Set( "lib_tree.column_width", 300 );
|
||||
|
@ -487,7 +487,7 @@ bool EESCHEMA_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
|
|||
// this index and the possible eeschema grids list that we have to subtract.
|
||||
std::string gridSizePtr = "window.grid.last_size";
|
||||
|
||||
if( OPT<int> currentSize = Get<int>( gridSizePtr ) )
|
||||
if( std::optional<int> currentSize = Get<int>( gridSizePtr ) )
|
||||
{
|
||||
Set( gridSizePtr, *currentSize - 4 );
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include <memory>
|
||||
#include <unordered_set>
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
#include <wx/regex.h>
|
||||
#include <bus_alias.h>
|
||||
#include <sch_sheet_path.h>
|
||||
|
|
|
@ -222,10 +222,10 @@ SCHEMATIC_SETTINGS::SCHEMATIC_SETTINGS( JSON_SETTINGS* aParent, const std::strin
|
|||
registerMigration( 0, 1,
|
||||
[&]() -> bool
|
||||
{
|
||||
OPT<double> tor = Get<double>( "drawing.text_offset_ratio" );
|
||||
std::optional<double> tor = Get<double>( "drawing.text_offset_ratio" );
|
||||
|
||||
if( tor.is_initialized() )
|
||||
Set( "drawing.label_size_ratio", tor.get() );
|
||||
if( tor )
|
||||
Set( "drawing.label_size_ratio", tor.value() );
|
||||
|
||||
return true;
|
||||
} );
|
||||
|
|
|
@ -101,10 +101,10 @@ namespace SIM_VALUE_PARSER
|
|||
bool isOk = true;
|
||||
bool isEmpty = true;
|
||||
std::string significand;
|
||||
OPT<long> intPart;
|
||||
OPT<long> fracPart;
|
||||
OPT<long> exponent;
|
||||
OPT<long> metricSuffixExponent;
|
||||
std::optional<long> intPart;
|
||||
std::optional<long> fracPart;
|
||||
std::optional<long> exponent;
|
||||
std::optional<long> metricSuffixExponent;
|
||||
};
|
||||
|
||||
PARSE_RESULT Parse( const wxString& aString,
|
||||
|
@ -415,7 +415,7 @@ template <>
|
|||
bool SIM_VALUE_INST<bool>::FromString( const wxString& aString, NOTATION aNotation )
|
||||
{
|
||||
SIM_VALUE_PARSER::PARSE_RESULT parseResult = SIM_VALUE_PARSER::Parse( aString, aNotation );
|
||||
m_value = NULLOPT;
|
||||
m_value = std::nullopt;
|
||||
|
||||
if( !parseResult.isOk )
|
||||
return false;
|
||||
|
@ -441,7 +441,7 @@ template <>
|
|||
bool SIM_VALUE_INST<long>::FromString( const wxString& aString, NOTATION aNotation )
|
||||
{
|
||||
SIM_VALUE_PARSER::PARSE_RESULT parseResult = SIM_VALUE_PARSER::Parse( aString, aNotation );
|
||||
m_value = NULLOPT;
|
||||
m_value = std::nullopt;
|
||||
|
||||
if( !parseResult.isOk )
|
||||
return false;
|
||||
|
@ -464,7 +464,7 @@ template <>
|
|||
bool SIM_VALUE_INST<double>::FromString( const wxString& aString, NOTATION aNotation )
|
||||
{
|
||||
SIM_VALUE_PARSER::PARSE_RESULT parseResult = SIM_VALUE_PARSER::Parse( aString, aNotation );
|
||||
m_value = NULLOPT;
|
||||
m_value = std::nullopt;
|
||||
|
||||
if( !parseResult.isOk )
|
||||
return false;
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#define SIM_VALUE_H
|
||||
|
||||
#include <wx/string.h>
|
||||
#include <core/optional.h>
|
||||
#include <optional>
|
||||
#include <memory>
|
||||
#include <pegtl.hpp>
|
||||
|
||||
|
@ -118,7 +118,7 @@ public:
|
|||
private:
|
||||
wxString getMetricSuffix();
|
||||
|
||||
OPT<T> m_value = NULLOPT;
|
||||
std::optional<T> m_value = std::nullopt;
|
||||
};
|
||||
|
||||
typedef SIM_VALUE_INST<bool> SIM_VALUE_BOOL;
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include <sch_screen.h>
|
||||
#include <lib_item.h>
|
||||
#include <ee_collectors.h>
|
||||
#include <core/optional.h>
|
||||
#include <optional>
|
||||
|
||||
class SCH_EDIT_FRAME;
|
||||
class SYMBOL_LIB_TABLE;
|
||||
|
|
|
@ -93,7 +93,7 @@ bool SYMBOL_EDITOR_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
|
|||
// this index and the possible eeschema grids list that we have to subtract.
|
||||
std::string gridSizePtr = "window.grid.last_size";
|
||||
|
||||
if( OPT<int> currentSize = Get<int>( gridSizePtr ) )
|
||||
if( std::optional<int> currentSize = Get<int>( gridSizePtr ) )
|
||||
{
|
||||
Set( gridSizePtr, *currentSize - 4 );
|
||||
}
|
||||
|
|
|
@ -539,17 +539,17 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
m_disambiguateTimer.Stop();
|
||||
|
||||
// context sub-menu selection? Handle unit selection or bus unfolding
|
||||
if( evt->GetCommandId().get() >= ID_POPUP_SCH_SELECT_UNIT_CMP
|
||||
&& evt->GetCommandId().get() <= ID_POPUP_SCH_SELECT_UNIT_SYM_MAX )
|
||||
if( evt->GetCommandId().value() >= ID_POPUP_SCH_SELECT_UNIT_CMP
|
||||
&& evt->GetCommandId().value() <= ID_POPUP_SCH_SELECT_UNIT_SYM_MAX )
|
||||
{
|
||||
SCH_SYMBOL* symbol = dynamic_cast<SCH_SYMBOL*>( m_selection.Front() );
|
||||
int unit = evt->GetCommandId().get() - ID_POPUP_SCH_SELECT_UNIT_CMP;
|
||||
int unit = evt->GetCommandId().value() - ID_POPUP_SCH_SELECT_UNIT_CMP;
|
||||
|
||||
if( symbol )
|
||||
static_cast<SCH_EDIT_FRAME*>( m_frame )->SelectUnit( symbol, unit );
|
||||
}
|
||||
else if( evt->GetCommandId().get() >= ID_POPUP_SCH_UNFOLD_BUS
|
||||
&& evt->GetCommandId().get() <= ID_POPUP_SCH_UNFOLD_BUS_END )
|
||||
else if( evt->GetCommandId().value() >= ID_POPUP_SCH_UNFOLD_BUS
|
||||
&& evt->GetCommandId().value() <= ID_POPUP_SCH_UNFOLD_BUS_END )
|
||||
{
|
||||
wxString* net = new wxString( *evt->Parameter<wxString*>() );
|
||||
m_toolMgr->RunAction( EE_ACTIONS::unfoldBus, true, net );
|
||||
|
|
|
@ -144,7 +144,7 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent )
|
|||
wxFAIL_MSG( "PlaceSymbol(): unexpected request" );
|
||||
}
|
||||
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
std::string tool = aEvent.GetCommandStr().value();
|
||||
m_frame->PushTool( tool );
|
||||
|
||||
auto addSymbol =
|
||||
|
@ -250,7 +250,7 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent )
|
|||
// The tool hotkey is interpreted as a click when drawing
|
||||
bool isSyntheticClick = symbol
|
||||
&& evt->IsActivate() && evt->HasPosition()
|
||||
&& evt->GetCommandStr().get().compare( tool ) == 0;
|
||||
&& evt->GetCommandStr().value().compare( tool ) == 0;
|
||||
|
||||
if( evt->IsCancelInteractive() )
|
||||
{
|
||||
|
@ -394,10 +394,10 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
else if( evt->Category() == TC_COMMAND && evt->Action() == TA_CHOICE_MENU_CHOICE )
|
||||
{
|
||||
if( evt->GetCommandId().get() >= ID_POPUP_SCH_SELECT_UNIT_CMP
|
||||
&& evt->GetCommandId().get() <= ID_POPUP_SCH_SELECT_UNIT_SYM_MAX )
|
||||
if( evt->GetCommandId().value() >= ID_POPUP_SCH_SELECT_UNIT_CMP
|
||||
&& evt->GetCommandId().value() <= ID_POPUP_SCH_SELECT_UNIT_SYM_MAX )
|
||||
{
|
||||
int unit = evt->GetCommandId().get() - ID_POPUP_SCH_SELECT_UNIT_CMP;
|
||||
int unit = evt->GetCommandId().value() - ID_POPUP_SCH_SELECT_UNIT_CMP;
|
||||
|
||||
if( symbol )
|
||||
{
|
||||
|
@ -457,7 +457,7 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
|
|||
m_view->AddToPreview( image->Clone() );
|
||||
}
|
||||
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
std::string tool = aEvent.GetCommandStr().value();
|
||||
m_frame->PushTool( tool );
|
||||
|
||||
auto setCursor =
|
||||
|
@ -508,7 +508,7 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
|
|||
// The tool hotkey is interpreted as a click when drawing
|
||||
bool isSyntheticClick = image
|
||||
&& evt->IsActivate() && evt->HasPosition()
|
||||
&& evt->GetCommandStr().get().compare( tool ) == 0;
|
||||
&& evt->GetCommandStr().value().compare( tool ) == 0;
|
||||
|
||||
if( evt->IsCancelInteractive() )
|
||||
{
|
||||
|
@ -743,7 +743,7 @@ int SCH_DRAWING_TOOLS::SingleClickPlace( const TOOL_EVENT& aEvent )
|
|||
aEvent.Position() :
|
||||
controls->GetMousePosition() );
|
||||
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
std::string tool = aEvent.GetCommandStr().value();
|
||||
m_frame->PushTool( tool );
|
||||
|
||||
auto setCursor =
|
||||
|
@ -1127,7 +1127,7 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
|||
|
||||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
std::string tool = aEvent.GetCommandStr().value();
|
||||
m_frame->PushTool( tool );
|
||||
auto setCursor =
|
||||
[&]()
|
||||
|
@ -1200,7 +1200,7 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
|||
// The tool hotkey is interpreted as a click when drawing
|
||||
bool isSyntheticClick = item
|
||||
&& evt->IsActivate() && evt->HasPosition()
|
||||
&& evt->GetCommandStr().get().compare( tool ) == 0;
|
||||
&& evt->GetCommandStr().value().compare( tool ) == 0;
|
||||
|
||||
if( evt->IsCancelInteractive() )
|
||||
{
|
||||
|
@ -1479,7 +1479,7 @@ int SCH_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
|||
|
||||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
std::string tool = aEvent.GetCommandStr().value();
|
||||
m_frame->PushTool( tool );
|
||||
|
||||
auto setCursor =
|
||||
|
@ -1516,7 +1516,7 @@ int SCH_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
|||
// The tool hotkey is interpreted as a click when drawing
|
||||
bool isSyntheticClick = item
|
||||
&& evt->IsActivate() && evt->HasPosition()
|
||||
&& evt->GetCommandStr().get().compare( tool ) == 0;
|
||||
&& evt->GetCommandStr().value().compare( tool ) == 0;
|
||||
|
||||
if( evt->IsCancelInteractive() )
|
||||
{
|
||||
|
@ -1686,7 +1686,7 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
|
|||
|
||||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
std::string tool = aEvent.GetCommandStr().value();
|
||||
m_frame->PushTool( tool );
|
||||
|
||||
auto setCursor =
|
||||
|
@ -1723,7 +1723,7 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
|
|||
// The tool hotkey is interpreted as a click when drawing
|
||||
bool isSyntheticClick = sheet
|
||||
&& evt->IsActivate() && evt->HasPosition()
|
||||
&& evt->GetCommandStr().get().compare( tool ) == 0;
|
||||
&& evt->GetCommandStr().value().compare( tool ) == 0;
|
||||
|
||||
if( evt->IsCancelInteractive() )
|
||||
{
|
||||
|
|
|
@ -1199,7 +1199,7 @@ int SCH_EDIT_TOOL::DoDelete( const TOOL_EVENT& aEvent )
|
|||
|
||||
int SCH_EDIT_TOOL::DeleteItemCursor( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
std::string tool = aEvent.GetCommandStr().value();
|
||||
PICKER_TOOL* picker = m_toolMgr->GetTool<PICKER_TOOL>();
|
||||
|
||||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||
|
|
|
@ -924,7 +924,7 @@ int SCH_EDITOR_CONTROL::SimProbe( const TOOL_EVENT& aEvent )
|
|||
m_toolMgr->RunAction( EE_ACTIONS::selectionActivate, false );
|
||||
} );
|
||||
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
std::string tool = aEvent.GetCommandStr().value();
|
||||
m_toolMgr->RunAction( ACTIONS::pickerTool, true, &tool );
|
||||
|
||||
return 0;
|
||||
|
@ -1014,7 +1014,7 @@ int SCH_EDITOR_CONTROL::SimTune( const TOOL_EVENT& aEvent )
|
|||
m_toolMgr->RunAction( EE_ACTIONS::selectionActivate, false );
|
||||
} );
|
||||
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
std::string tool = aEvent.GetCommandStr().value();
|
||||
m_toolMgr->RunAction( ACTIONS::pickerTool, true, &tool );
|
||||
|
||||
return 0;
|
||||
|
@ -1332,7 +1332,7 @@ int SCH_EDITOR_CONTROL::HighlightNetCursor( const TOOL_EVENT& aEvent )
|
|||
if( !ADVANCED_CFG::GetCfg().m_RealTimeConnectivity || !CONNECTION_GRAPH::m_allowRealTime )
|
||||
m_frame->RecalculateConnections( NO_CLEANUP );
|
||||
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
std::string tool = aEvent.GetCommandStr().value();
|
||||
PICKER_TOOL* picker = m_toolMgr->GetTool<PICKER_TOOL>();
|
||||
|
||||
// Deactivate other tools; particularly important if another PICKER is currently running
|
||||
|
|
|
@ -300,7 +300,7 @@ int SCH_LINE_WIRE_BUS_TOOL::DrawSegments( const TOOL_EVENT& aEvent )
|
|||
|
||||
DRAW_SEGMENT_EVENT_PARAMS* params = aEvent.Parameter<DRAW_SEGMENT_EVENT_PARAMS*>();
|
||||
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
std::string tool = aEvent.GetCommandStr().value();
|
||||
m_frame->PushTool( tool );
|
||||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||
|
||||
|
@ -329,7 +329,7 @@ int SCH_LINE_WIRE_BUS_TOOL::UnfoldBus( const TOOL_EVENT& aEvent )
|
|||
wxString net;
|
||||
SCH_LINE* segment = nullptr;
|
||||
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
std::string tool = aEvent.GetCommandStr().value();
|
||||
m_frame->PushTool( tool );
|
||||
Activate();
|
||||
|
||||
|
@ -350,7 +350,7 @@ int SCH_LINE_WIRE_BUS_TOOL::UnfoldBus( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
if( evt->Action() == TA_CHOICE_MENU_CHOICE )
|
||||
{
|
||||
OPT<int> id = evt->GetCommandId();
|
||||
std::optional<int> id = evt->GetCommandId();
|
||||
|
||||
if( id && ( *id > 0 ) )
|
||||
net = *evt->Parameter<wxString*>();
|
||||
|
@ -645,7 +645,7 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const std::string& aTool, int aType,
|
|||
// The tool hotkey is interpreted as a click when drawing
|
||||
bool isSyntheticClick = ( segment || m_busUnfold.in_progress )
|
||||
&& evt->IsActivate() && evt->HasPosition()
|
||||
&& evt->GetCommandStr().get().compare( aTool ) == 0;
|
||||
&& evt->GetCommandStr().value().compare( aTool ) == 0;
|
||||
|
||||
setCursor();
|
||||
grid.SetMask( GRID_HELPER::ALL );
|
||||
|
@ -980,8 +980,8 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const std::string& aTool, int aType,
|
|||
}
|
||||
else if( evt->Category() == TC_COMMAND && evt->Action() == TA_CHOICE_MENU_CHOICE )
|
||||
{
|
||||
if( evt->GetCommandId().get() >= ID_POPUP_SCH_UNFOLD_BUS
|
||||
&& evt->GetCommandId().get() <= ID_POPUP_SCH_UNFOLD_BUS_END )
|
||||
if( evt->GetCommandId().value() >= ID_POPUP_SCH_UNFOLD_BUS
|
||||
&& evt->GetCommandId().value() <= ID_POPUP_SCH_UNFOLD_BUS_END )
|
||||
{
|
||||
wxASSERT_MSG( !segment, "Bus unfold event received when already drawing!" );
|
||||
|
||||
|
|
|
@ -144,7 +144,7 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
// Must be done after Activate() so that it gets set into the correct context
|
||||
controls->ShowCursor( true );
|
||||
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
std::string tool = aEvent.GetCommandStr().value();
|
||||
m_frame->PushTool( tool );
|
||||
|
||||
if( selection.Empty() )
|
||||
|
@ -803,11 +803,11 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
else if( evt->Action() == TA_CHOICE_MENU_CHOICE )
|
||||
{
|
||||
if( evt->GetCommandId().get() >= ID_POPUP_SCH_SELECT_UNIT_CMP
|
||||
&& evt->GetCommandId().get() <= ID_POPUP_SCH_SELECT_UNIT_SYM_MAX )
|
||||
if( evt->GetCommandId().value() >= ID_POPUP_SCH_SELECT_UNIT_CMP
|
||||
&& evt->GetCommandId().value() <= ID_POPUP_SCH_SELECT_UNIT_SYM_MAX )
|
||||
{
|
||||
SCH_SYMBOL* symbol = dynamic_cast<SCH_SYMBOL*>( selection.Front() );
|
||||
int unit = evt->GetCommandId().get() - ID_POPUP_SCH_SELECT_UNIT_CMP;
|
||||
int unit = evt->GetCommandId().value() - ID_POPUP_SCH_SELECT_UNIT_CMP;
|
||||
|
||||
if( symbol )
|
||||
{
|
||||
|
|
|
@ -101,7 +101,7 @@ private:
|
|||
///< of edit reference point).
|
||||
VECTOR2I m_cursor;
|
||||
|
||||
boost::optional<VECTOR2I> m_anchorPos;
|
||||
OPT_VECTOR2I m_anchorPos;
|
||||
|
||||
// A map of labels to scaling factors. Used to scale the movement vector for labels that
|
||||
// are attached to wires which have only one end moving.
|
||||
|
|
|
@ -95,7 +95,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
|||
|
||||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
std::string tool = aEvent.GetCommandStr().value();
|
||||
m_frame->PushTool( tool );
|
||||
|
||||
auto setCursor =
|
||||
|
@ -147,7 +147,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
|||
// The tool hotkey is interpreted as a click when drawing
|
||||
bool isSyntheticClick = item
|
||||
&& evt->IsActivate() && evt->HasPosition()
|
||||
&& evt->GetCommandStr().get().compare( tool ) == 0;
|
||||
&& evt->GetCommandStr().value().compare( tool ) == 0;
|
||||
|
||||
if( evt->IsCancelInteractive() )
|
||||
{
|
||||
|
@ -341,7 +341,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
|||
|
||||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
std::string tool = aEvent.GetCommandStr().value();
|
||||
m_frame->PushTool( tool );
|
||||
|
||||
auto setCursor =
|
||||
|
@ -378,7 +378,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
|||
// The tool hotkey is interpreted as a click when drawing
|
||||
bool isSyntheticClick = item
|
||||
&& evt->IsActivate() && evt->HasPosition()
|
||||
&& evt->GetCommandStr().get().compare( tool ) == 0;
|
||||
&& evt->GetCommandStr().value().compare( tool ) == 0;
|
||||
|
||||
if( evt->IsCancelInteractive() )
|
||||
{
|
||||
|
@ -542,7 +542,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
|||
|
||||
int SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
std::string tool = aEvent.GetCommandStr().value();
|
||||
m_frame->PushTool( tool );
|
||||
|
||||
auto setCursor =
|
||||
|
|
|
@ -332,7 +332,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::DoDelete( const TOOL_EVENT& aEvent )
|
|||
|
||||
int SYMBOL_EDITOR_EDIT_TOOL::DeleteItemCursor( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
std::string tool = aEvent.GetCommandStr().value();
|
||||
PICKER_TOOL* picker = m_toolMgr->GetTool<PICKER_TOOL>();
|
||||
|
||||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||
|
|
|
@ -110,7 +110,7 @@ int SYMBOL_EDITOR_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
return 0;
|
||||
}
|
||||
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
std::string tool = aEvent.GetCommandStr().value();
|
||||
m_frame->PushTool( tool );
|
||||
|
||||
Activate();
|
||||
|
|
|
@ -207,7 +207,7 @@ int GERBVIEW_INSPECTION_TOOL::MeasureTool( const TOOL_EVENT& aEvent )
|
|||
EDA_UNITS units = m_frame->GetUserUnits();
|
||||
KIGFX::PREVIEW::RULER_ITEM ruler( twoPtMgr, units, false, false );
|
||||
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
std::string tool = aEvent.GetCommandStr().value();
|
||||
m_frame->PushTool( tool );
|
||||
|
||||
auto setCursor =
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#ifndef ARRAY_AXIS__H
|
||||
#define ARRAY_AXIS__H
|
||||
|
||||
#include <core/optional.h>
|
||||
#include <optional>
|
||||
|
||||
#include <wx/string.h>
|
||||
|
||||
|
@ -107,7 +107,7 @@ private:
|
|||
* @param str a numbering string, say "B" or "5"
|
||||
* @return the offset, if found, else empty
|
||||
*/
|
||||
OPT<int> getNumberingOffset( const wxString& str ) const;
|
||||
std::optional<int> getNumberingOffset( const wxString& str ) const;
|
||||
|
||||
NUMBERING_TYPE m_type;
|
||||
int m_offset;
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
# ifndef ___OPTIONAL_H___
|
||||
# define ___OPTIONAL_H___
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
template<typename T>
|
||||
using OPT = boost::optional<T>;
|
||||
|
||||
const auto NULLOPT = boost::none;
|
||||
|
||||
# endif //___OPTIONAL_HPP___
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
#include <wx/string.h>
|
||||
#include <vector>
|
||||
#include <core/optional.h>
|
||||
#include <optional>
|
||||
|
||||
namespace ENV_VAR
|
||||
{
|
||||
|
@ -63,29 +63,29 @@ namespace ENV_VAR
|
|||
* Get an environment variable as a specific type, if set correctly
|
||||
*
|
||||
* @param aEnvVarName the name of the environment variable
|
||||
* @return an OPT containing the value, if set and parseable, otherwise empty.
|
||||
* @return an std::optional containing the value, if set and parseable, otherwise empty.
|
||||
*/
|
||||
template <typename VAL_TYPE>
|
||||
OPT<VAL_TYPE> GetEnvVar( const wxString& aEnvVarName );
|
||||
std::optional<VAL_TYPE> GetEnvVar( const wxString& aEnvVarName );
|
||||
|
||||
/**
|
||||
* Get a string environment variable, if it is set.
|
||||
*
|
||||
* @param aEnvVarName the name of the environment variable
|
||||
* @return an OPT containing the value, if set, otherwise empty.
|
||||
* @return an std::optional containing the value, if set, otherwise empty.
|
||||
*/
|
||||
template<>
|
||||
OPT<wxString> GetEnvVar( const wxString& aEnvVarName );
|
||||
std::optional<wxString> GetEnvVar( const wxString& aEnvVarName );
|
||||
|
||||
/**
|
||||
* Get a double from an environment variable, if set
|
||||
*
|
||||
* @param aEnvVarName the name of the environment variable
|
||||
* @return an OPT containing the value, if set and parseable as a double,
|
||||
* @return an std::optional containing the value, if set and parseable as a double,
|
||||
* otherwise empty.
|
||||
*/
|
||||
template <>
|
||||
OPT<double> GetEnvVar( const wxString& aEnvVarName );
|
||||
std::optional<double> GetEnvVar( const wxString& aEnvVarName );
|
||||
};
|
||||
|
||||
#endif /* ENV_VARS_H */
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include "property_mgr.h"
|
||||
#include "property.h"
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
#include <optional>
|
||||
|
||||
/**
|
||||
* Class that other classes need to inherit from, in order to be inspectable.
|
||||
|
@ -101,12 +101,12 @@ public:
|
|||
}
|
||||
|
||||
template<typename T>
|
||||
boost::optional<T> Get( const wxString& aProperty ) const
|
||||
std::optional<T> Get( const wxString& aProperty ) const
|
||||
{
|
||||
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
|
||||
TYPE_ID thisType = TYPE_HASH( *this );
|
||||
PROPERTY_BASE* prop = propMgr.GetProperty( thisType, aProperty );
|
||||
boost::optional<T> ret;
|
||||
std::optional<T> ret;
|
||||
|
||||
if( prop )
|
||||
{
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
|
||||
#include <gal/color4d.h>
|
||||
#include <core/optional.h>
|
||||
#include <optional>
|
||||
#include <macros_swig.h>
|
||||
|
||||
class LINE_READER;
|
||||
|
@ -125,18 +125,18 @@ protected:
|
|||
|
||||
/// The units on these parameters is Internal Units (1 nm)
|
||||
|
||||
OPT<int> m_Clearance; ///< clearance when routing
|
||||
std::optional<int> m_Clearance; ///< clearance when routing
|
||||
|
||||
OPT<int> m_TrackWidth; ///< track width used to route NETs in this NETCLASS
|
||||
OPT<int> m_ViaDia; ///< via diameter
|
||||
OPT<int> m_ViaDrill; ///< via drill hole diameter
|
||||
std::optional<int> m_TrackWidth; ///< track width used to route NETs in this NETCLASS
|
||||
std::optional<int> m_ViaDia; ///< via diameter
|
||||
std::optional<int> m_ViaDrill; ///< via drill hole diameter
|
||||
|
||||
OPT<int> m_uViaDia; ///< microvia diameter
|
||||
OPT<int> m_uViaDrill; ///< microvia drill hole diameter
|
||||
std::optional<int> m_uViaDia; ///< microvia diameter
|
||||
std::optional<int> m_uViaDrill; ///< microvia drill hole diameter
|
||||
|
||||
OPT<int> m_diffPairWidth;
|
||||
OPT<int> m_diffPairGap;
|
||||
OPT<int> m_diffPairViaGap;
|
||||
std::optional<int> m_diffPairWidth;
|
||||
std::optional<int> m_diffPairGap;
|
||||
std::optional<int> m_diffPairViaGap;
|
||||
|
||||
int m_wireWidth;
|
||||
int m_busWidth;
|
||||
|
|
|
@ -130,7 +130,7 @@ public:
|
|||
if( m_readOnly )
|
||||
return;
|
||||
|
||||
if( OPT<COLOR4D> optval = aSettings->Get<COLOR4D>( m_path ) )
|
||||
if( std::optional<COLOR4D> optval = aSettings->Get<COLOR4D>( m_path ) )
|
||||
( *m_map )[ m_key ] = *optval;
|
||||
else if( aResetIfMissing )
|
||||
( *m_map )[ m_key ] = m_default;
|
||||
|
@ -158,7 +158,7 @@ public:
|
|||
|
||||
bool MatchesFile( JSON_SETTINGS* aSettings ) const override
|
||||
{
|
||||
if( OPT<COLOR4D> optval = aSettings->Get<COLOR4D>( m_path ) )
|
||||
if( std::optional<COLOR4D> optval = aSettings->Get<COLOR4D>( m_path ) )
|
||||
return m_map->count( m_key ) && ( *optval == m_map->at( m_key ) );
|
||||
|
||||
// If the JSON doesn't exist, the map shouldn't exist either
|
||||
|
|
|
@ -26,7 +26,8 @@
|
|||
#include <utility>
|
||||
#include <wx/string.h>
|
||||
|
||||
#include <core/optional.h>
|
||||
#include <functional>
|
||||
#include <optional>
|
||||
#include <nlohmann/json_fwd.hpp>
|
||||
|
||||
class wxConfigBase;
|
||||
|
@ -131,7 +132,7 @@ c * @return true if the file was saved
|
|||
* @param aPath is a string containing one or more keys separated by '.'
|
||||
* @return a JSON object from within this one
|
||||
*/
|
||||
OPT<nlohmann::json> GetJson( const std::string& aPath ) const;
|
||||
std::optional<nlohmann::json> GetJson( const std::string& aPath ) const;
|
||||
|
||||
/**
|
||||
* Fetches a value from within the JSON document.
|
||||
|
@ -141,7 +142,7 @@ c * @return true if the file was saved
|
|||
* @return a value from within this document
|
||||
*/
|
||||
template<typename ValueType>
|
||||
OPT<ValueType> Get( const std::string& aPath ) const;
|
||||
std::optional<ValueType> Get( const std::string& aPath ) const;
|
||||
|
||||
/**
|
||||
* Stores a value into the JSON document
|
||||
|
@ -324,7 +325,7 @@ protected:
|
|||
|
||||
// Specializations to allow conversion between wxString and std::string via JSON_SETTINGS API
|
||||
|
||||
template<> OPT<wxString> JSON_SETTINGS::Get( const std::string& aPath ) const;
|
||||
template<> std::optional<wxString> JSON_SETTINGS::Get( const std::string& aPath ) const;
|
||||
|
||||
template<> void JSON_SETTINGS::Set<wxString>( const std::string& aPath, wxString aVal );
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include <utility>
|
||||
#include <math/util.h>
|
||||
|
||||
#include <core/optional.h>
|
||||
#include <optional>
|
||||
#include <settings/json_settings.h>
|
||||
|
||||
|
||||
|
@ -107,7 +107,7 @@ public:
|
|||
if( m_readOnly )
|
||||
return;
|
||||
|
||||
if( OPT<ValueType> optval = aSettings->Get<ValueType>( m_path ) )
|
||||
if( std::optional<ValueType> optval = aSettings->Get<ValueType>( m_path ) )
|
||||
{
|
||||
ValueType val = *optval;
|
||||
|
||||
|
@ -140,7 +140,7 @@ public:
|
|||
|
||||
bool MatchesFile( JSON_SETTINGS* aSettings ) const override
|
||||
{
|
||||
if( OPT<ValueType> optval = aSettings->Get<ValueType>( m_path ) )
|
||||
if( std::optional<ValueType> optval = aSettings->Get<ValueType>( m_path ) )
|
||||
return *optval == *m_ptr;
|
||||
|
||||
return false;
|
||||
|
@ -184,7 +184,7 @@ public:
|
|||
|
||||
bool MatchesFile( JSON_SETTINGS* aSettings ) const override
|
||||
{
|
||||
if( OPT<wxString> optval = aSettings->Get<wxString>( m_path ) )
|
||||
if( std::optional<wxString> optval = aSettings->Get<wxString>( m_path ) )
|
||||
return fromFileFormat( *optval ) == *m_ptr;
|
||||
|
||||
return false;
|
||||
|
@ -230,7 +230,7 @@ public:
|
|||
if( m_readOnly )
|
||||
return;
|
||||
|
||||
if( OPT<int> val = aSettings->Get<int>( m_path ) )
|
||||
if( std::optional<int> val = aSettings->Get<int>( m_path ) )
|
||||
{
|
||||
if( *val >= static_cast<int>( m_min ) && *val <= static_cast<int>( m_max ) )
|
||||
*m_ptr = static_cast<EnumType>( *val );
|
||||
|
@ -259,7 +259,7 @@ public:
|
|||
|
||||
bool MatchesFile( JSON_SETTINGS* aSettings ) const override
|
||||
{
|
||||
if( OPT<int> val = aSettings->Get<int>( m_path ) )
|
||||
if( std::optional<int> val = aSettings->Get<int>( m_path ) )
|
||||
return *val == static_cast<int>( *m_ptr );
|
||||
|
||||
return false;
|
||||
|
@ -362,7 +362,7 @@ public:
|
|||
|
||||
double dval = m_default * m_scale;
|
||||
|
||||
if( OPT<double> optval = aSettings->Get<double>( m_path ) )
|
||||
if( std::optional<double> optval = aSettings->Get<double>( m_path ) )
|
||||
dval = *optval;
|
||||
else if( !aResetIfMissing )
|
||||
return;
|
||||
|
@ -395,7 +395,7 @@ public:
|
|||
|
||||
bool MatchesFile( JSON_SETTINGS* aSettings ) const override
|
||||
{
|
||||
if( OPT<double> optval = aSettings->Get<double>( m_path ) )
|
||||
if( std::optional<double> optval = aSettings->Get<double>( m_path ) )
|
||||
return *optval == ( *m_ptr * m_scale );
|
||||
|
||||
return false;
|
||||
|
|
|
@ -127,7 +127,7 @@ protected:
|
|||
std::vector<ANCHOR> m_anchors;
|
||||
|
||||
TOOL_MANAGER* m_toolMgr;
|
||||
OPT<VECTOR2I> m_auxAxis;
|
||||
std::optional<VECTOR2I> m_auxAxis;
|
||||
|
||||
int m_maskTypes; // Mask of allowed snap types
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#ifndef PICKER_TOOL_H
|
||||
#define PICKER_TOOL_H
|
||||
|
||||
#include <core/optional.h>
|
||||
#include <optional>
|
||||
#include <gal/cursors.h>
|
||||
#include <math/vector2d.h>
|
||||
#include <tool/tool_interactive.h>
|
||||
|
@ -113,12 +113,12 @@ protected:
|
|||
KICURSOR m_cursor;
|
||||
bool m_snap;
|
||||
|
||||
OPT<CLICK_HANDLER> m_clickHandler;
|
||||
OPT<MOTION_HANDLER> m_motionHandler;
|
||||
OPT<CANCEL_HANDLER> m_cancelHandler;
|
||||
OPT<FINALIZE_HANDLER> m_finalizeHandler;
|
||||
std::optional<CLICK_HANDLER> m_clickHandler;
|
||||
std::optional<MOTION_HANDLER> m_motionHandler;
|
||||
std::optional<CANCEL_HANDLER> m_cancelHandler;
|
||||
std::optional<FINALIZE_HANDLER> m_finalizeHandler;
|
||||
|
||||
OPT<VECTOR2D> m_picked;
|
||||
std::optional<VECTOR2D> m_picked;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#ifndef SELECTION_H
|
||||
#define SELECTION_H
|
||||
|
||||
#include <core/optional.h>
|
||||
#include <optional>
|
||||
#include <core/typeinfo.h>
|
||||
#include <deque>
|
||||
#include <eda_rect.h>
|
||||
|
@ -228,7 +228,7 @@ public:
|
|||
|
||||
bool HasReferencePoint() const
|
||||
{
|
||||
return m_referencePoint != NULLOPT;
|
||||
return m_referencePoint != std::nullopt;
|
||||
}
|
||||
|
||||
VECTOR2I GetReferencePoint() const
|
||||
|
@ -246,7 +246,7 @@ public:
|
|||
|
||||
void ClearReferencePoint()
|
||||
{
|
||||
m_referencePoint = NULLOPT;
|
||||
m_referencePoint = std::nullopt;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -263,7 +263,7 @@ public:
|
|||
bool OnlyContains( std::vector<KICAD_T> aList ) const;
|
||||
|
||||
protected:
|
||||
OPT<VECTOR2I> m_referencePoint;
|
||||
std::optional<VECTOR2I> m_referencePoint;
|
||||
std::deque<EDA_ITEM*> m_items;
|
||||
EDA_ITEM* m_lastAddedItem;
|
||||
bool m_isHover;
|
||||
|
|
|
@ -74,7 +74,7 @@ public:
|
|||
/**
|
||||
* Map a wxWidgets key event to a TOOL_EVENT.
|
||||
*/
|
||||
OPT<TOOL_EVENT> GetToolEvent( wxKeyEvent* aKeyEvent, bool* aSpecialKeyFlag );
|
||||
std::optional<TOOL_EVENT> GetToolEvent( wxKeyEvent* aKeyEvent, bool* aSpecialKeyFlag );
|
||||
|
||||
private:
|
||||
///< The time threshold for a mouse button press that distinguishes between a single mouse
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include <iterator>
|
||||
|
||||
#include <math/vector2d.h>
|
||||
#include <core/optional.h>
|
||||
#include <optional>
|
||||
|
||||
#include <tool/tool_action.h>
|
||||
|
||||
|
@ -454,12 +454,12 @@ public:
|
|||
m_param = reinterpret_cast<void*>( aParam );
|
||||
}
|
||||
|
||||
OPT<int> GetCommandId() const
|
||||
std::optional<int> GetCommandId() const
|
||||
{
|
||||
return m_commandId;
|
||||
}
|
||||
|
||||
OPT<std::string> GetCommandStr() const
|
||||
std::optional<std::string> GetCommandStr() const
|
||||
{
|
||||
return m_commandStr;
|
||||
}
|
||||
|
@ -543,11 +543,11 @@ private:
|
|||
///< The first tool to receive the event
|
||||
TOOL_BASE* m_firstResponder;
|
||||
|
||||
OPT<int> m_commandId;
|
||||
OPT<std::string> m_commandStr;
|
||||
std::optional<int> m_commandId;
|
||||
std::optional<std::string> m_commandStr;
|
||||
};
|
||||
|
||||
typedef OPT<TOOL_EVENT> OPT_TOOL_EVENT;
|
||||
typedef std::optional<TOOL_EVENT> OPT_TOOL_EVENT;
|
||||
|
||||
/**
|
||||
* A list of TOOL_EVENTs, with overloaded || operators allowing for concatenating TOOL_EVENTs
|
||||
|
@ -587,7 +587,7 @@ public:
|
|||
*/
|
||||
const std::string Format() const;
|
||||
|
||||
OPT<const TOOL_EVENT&> Matches( const TOOL_EVENT& aEvent ) const
|
||||
OPT_TOOL_EVENT Matches( const TOOL_EVENT& aEvent ) const
|
||||
{
|
||||
for( const TOOL_EVENT& event : m_events )
|
||||
{
|
||||
|
@ -595,7 +595,7 @@ public:
|
|||
return event;
|
||||
}
|
||||
|
||||
return OPT<const TOOL_EVENT&>();
|
||||
return OPT_TOOL_EVENT();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -556,7 +556,7 @@ private:
|
|||
ACTION_MANAGER* m_actionMgr;
|
||||
|
||||
///< Original cursor position, if overridden by the context menu handler
|
||||
std::map<TOOL_ID, OPT<VECTOR2D>> m_cursorSettings;
|
||||
std::map<TOOL_ID, std::optional<VECTOR2D>> m_cursorSettings;
|
||||
|
||||
EDA_ITEM* m_model;
|
||||
KIGFX::VIEW* m_view;
|
||||
|
|
|
@ -21,7 +21,8 @@
|
|||
#ifndef INFOBAR_H_
|
||||
#define INFOBAR_H_
|
||||
|
||||
#include <core/optional.h>
|
||||
#include <functional>
|
||||
#include <optional>
|
||||
#include <wx/event.h>
|
||||
#include <wx/infobar.h>
|
||||
#include <wx/timer.h>
|
||||
|
@ -254,7 +255,7 @@ protected:
|
|||
wxAuiManager* m_auiManager; ///< The AUI manager that contains this infobar
|
||||
MESSAGE_TYPE m_type; ///< The type of message being displayed
|
||||
|
||||
OPT<std::function<void(void)>> m_callback; ///< Optional callback made when closing infobar
|
||||
std::optional<std::function<void(void)>> m_callback; ///< Optional callback made when closing infobar
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
|
|
@ -258,7 +258,7 @@ void PANEL_PACKAGES_VIEW::setPackageDetails( const PACKAGE_VIEW_DATA& aPackageDa
|
|||
write_contact( _( "Author" ), package.author );
|
||||
|
||||
if( package.maintainer )
|
||||
write_contact( _( "Maintainer" ), package.maintainer.get() );
|
||||
write_contact( _( "Maintainer" ), package.maintainer.value() );
|
||||
|
||||
if( package.resources.size() > 0 )
|
||||
{
|
||||
|
@ -383,12 +383,12 @@ void PANEL_PACKAGES_VIEW::unsetPackageDetails()
|
|||
}
|
||||
|
||||
|
||||
wxString PANEL_PACKAGES_VIEW::toHumanReadableSize( const boost::optional<uint64_t> size ) const
|
||||
wxString PANEL_PACKAGES_VIEW::toHumanReadableSize( const std::optional<uint64_t> size ) const
|
||||
{
|
||||
if( !size )
|
||||
return "-";
|
||||
|
||||
uint64_t b = size.get();
|
||||
uint64_t b = size.value();
|
||||
|
||||
if( b >= 1024 * 1024 )
|
||||
return wxString::Format( "%.1f MB", b / 1000.0 / 1000.0 );
|
||||
|
@ -497,7 +497,7 @@ void PANEL_PACKAGES_VIEW::OnDownloadVersionClicked( wxCommandEvent& event )
|
|||
return;
|
||||
}
|
||||
|
||||
const wxString& url = ver_it->download_url.get();
|
||||
const wxString& url = ver_it->download_url.value();
|
||||
|
||||
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
|
||||
KICAD_SETTINGS* app_settings = mgr.GetAppSettings<KICAD_SETTINGS>();
|
||||
|
@ -527,7 +527,7 @@ void PANEL_PACKAGES_VIEW::OnDownloadVersionClicked( wxCommandEvent& event )
|
|||
{
|
||||
std::ifstream stream( path.ToUTF8(), std::ios_base::binary );
|
||||
|
||||
bool matches = m_pcm->VerifyHash( stream, ver_it->download_sha256.get() );
|
||||
bool matches = m_pcm->VerifyHash( stream, ver_it->download_sha256.value() );
|
||||
|
||||
stream.close();
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ private:
|
|||
void unsetPackageDetails();
|
||||
|
||||
///< Bytes to Kb/Mb/Gb string or "-" if absent
|
||||
wxString toHumanReadableSize( const boost::optional<uint64_t> size ) const;
|
||||
wxString toHumanReadableSize( const std::optional<uint64_t> size ) const;
|
||||
|
||||
///< Returns true if it the download operation can be performed
|
||||
bool canDownload() const;
|
||||
|
|
|
@ -334,7 +334,7 @@ void PLUGIN_CONTENT_MANAGER::ValidateJson( const nlohmann::json& aJson,
|
|||
|
||||
|
||||
bool PLUGIN_CONTENT_MANAGER::fetchPackages( const wxString& aUrl,
|
||||
const boost::optional<wxString>& aHash,
|
||||
const std::optional<wxString>& aHash,
|
||||
std::vector<PCM_PACKAGE>& aPackages,
|
||||
PROGRESS_REPORTER* aReporter )
|
||||
{
|
||||
|
@ -352,7 +352,7 @@ bool PLUGIN_CONTENT_MANAGER::fetchPackages( const wxString& aUr
|
|||
|
||||
std::istringstream isstream( packages_stream.str() );
|
||||
|
||||
if( aHash && !VerifyHash( isstream, aHash.get() ) )
|
||||
if( aHash && !VerifyHash( isstream, aHash.value() ) )
|
||||
{
|
||||
if( m_dialog )
|
||||
wxLogError( _( "Packages hash doesn't match. Repository may be corrupted." ) );
|
||||
|
@ -507,7 +507,7 @@ const bool PLUGIN_CONTENT_MANAGER::CacheRepository( const wxString& aRepositoryI
|
|||
if( current_repo.resources )
|
||||
{
|
||||
// Check resources file date, redownload if needed
|
||||
PCM_RESOURCE_REFERENCE& resources = current_repo.resources.get();
|
||||
PCM_RESOURCE_REFERENCE& resources = current_repo.resources.value();
|
||||
|
||||
wxFileName resource_file( repo_cache.GetPath(), "resources.zip" );
|
||||
|
||||
|
@ -535,7 +535,7 @@ const bool PLUGIN_CONTENT_MANAGER::CacheRepository( const wxString& aRepositoryI
|
|||
std::ios_base::binary );
|
||||
|
||||
|
||||
if( resources.sha256 && !VerifyHash( read_stream, resources.sha256.get() ) )
|
||||
if( resources.sha256 && !VerifyHash( read_stream, resources.sha256.value() ) )
|
||||
{
|
||||
read_stream.close();
|
||||
|
||||
|
@ -586,7 +586,7 @@ void PLUGIN_CONTENT_MANAGER::updateInstalledPackagesMetadata( const wxString& aR
|
|||
if( repository->package_map.count( installation_entry.package.identifier ) == 0 )
|
||||
continue;
|
||||
|
||||
boost::optional<PACKAGE_VERSION> current_version;
|
||||
std::optional<PACKAGE_VERSION> current_version;
|
||||
|
||||
auto current_version_it =
|
||||
std::find_if( installation_entry.package.versions.begin(),
|
||||
|
@ -614,7 +614,7 @@ void PLUGIN_CONTENT_MANAGER::updateInstalledPackagesMetadata( const wxString& aR
|
|||
|
||||
if( current_version_it == installation_entry.package.versions.end() )
|
||||
{
|
||||
installation_entry.package.versions.emplace_back( current_version.get() );
|
||||
installation_entry.package.versions.emplace_back( current_version.value() );
|
||||
|
||||
// Re-sort the versions by descending version
|
||||
std::sort( installation_entry.package.versions.begin(),
|
||||
|
@ -636,7 +636,7 @@ void PLUGIN_CONTENT_MANAGER::preparePackage( PCM_PACKAGE& aPackage )
|
|||
int epoch = 0, major = 0, minor = 0, patch = 0;
|
||||
|
||||
if( ver.version_epoch )
|
||||
epoch = ver.version_epoch.get();
|
||||
epoch = ver.version_epoch.value();
|
||||
|
||||
wxStringTokenizer version_tokenizer( ver.version, "." );
|
||||
|
||||
|
@ -676,7 +676,7 @@ void PLUGIN_CONTENT_MANAGER::preparePackage( PCM_PACKAGE& aPackage )
|
|||
ver.compatible = false;
|
||||
|
||||
if( ver.kicad_version_max
|
||||
&& parse_version_tuple( ver.kicad_version_max.get(), 999 ) < m_kicad_version )
|
||||
&& parse_version_tuple( ver.kicad_version_max.value(), 999 ) < m_kicad_version )
|
||||
ver.compatible = false;
|
||||
|
||||
#ifdef __WXMSW__
|
||||
|
@ -978,7 +978,7 @@ int PLUGIN_CONTENT_MANAGER::GetPackageSearchRank( const PCM_PACKAGE& aPackage,
|
|||
rank += find_term_matches( aPackage.author.name );
|
||||
|
||||
if( aPackage.maintainer )
|
||||
rank += 3 * find_term_matches( aPackage.maintainer.get().name );
|
||||
rank += 3 * find_term_matches( aPackage.maintainer.value().name );
|
||||
|
||||
// Match on resources
|
||||
for( const auto& entry : aPackage.resources )
|
||||
|
|
|
@ -335,7 +335,7 @@ private:
|
|||
* @param aReporter progress dialog to use for download
|
||||
* @return true if packages were successfully downloaded, verified and parsed
|
||||
*/
|
||||
bool fetchPackages( const wxString& aUrl, const boost::optional<wxString>& aHash,
|
||||
bool fetchPackages( const wxString& aUrl, const std::optional<wxString>& aHash,
|
||||
std::vector<PCM_PACKAGE>& aPackages, PROGRESS_REPORTER* aReporter );
|
||||
|
||||
/**
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
template <typename T>
|
||||
void to_optional( const json& j, const char* key, boost::optional<T>& dest )
|
||||
void to_optional( const json& j, const char* key, std::optional<T>& dest )
|
||||
{
|
||||
if( j.contains( key ) )
|
||||
{
|
||||
|
@ -40,25 +40,25 @@ void to_json( json& j, const PACKAGE_VERSION& v )
|
|||
{ "kicad_version", v.kicad_version } };
|
||||
|
||||
if( v.version_epoch )
|
||||
j["version_epoch"] = v.version_epoch.get();
|
||||
j["version_epoch"] = v.version_epoch.value();
|
||||
|
||||
if( v.download_url )
|
||||
j["download_url"] = v.download_url.get();
|
||||
j["download_url"] = v.download_url.value();
|
||||
|
||||
if( v.download_sha256 )
|
||||
j["download_sha256"] = v.download_sha256.get();
|
||||
j["download_sha256"] = v.download_sha256.value();
|
||||
|
||||
if( v.download_size )
|
||||
j["download_size"] = v.download_size.get();
|
||||
j["download_size"] = v.download_size.value();
|
||||
|
||||
if( v.install_size )
|
||||
j["install_size"] = v.install_size.get();
|
||||
j["install_size"] = v.install_size.value();
|
||||
|
||||
if( v.platforms.size() > 0 )
|
||||
nlohmann::to_json( j["platforms"], v.platforms );
|
||||
|
||||
if( v.kicad_version_max )
|
||||
j["kicad_version_max"] = v.kicad_version_max.get();
|
||||
j["kicad_version_max"] = v.kicad_version_max.value();
|
||||
|
||||
if( v.keep_on_update.size() > 0 )
|
||||
nlohmann::to_json( j["keep_on_update"], v.keep_on_update );
|
||||
|
@ -99,7 +99,7 @@ void to_json( json& j, const PCM_PACKAGE& p )
|
|||
{ "versions", p.versions } };
|
||||
|
||||
if( p.maintainer )
|
||||
j["maintainer"] = p.maintainer.get();
|
||||
j["maintainer"] = p.maintainer.value();
|
||||
|
||||
if( p.tags.size() > 0 )
|
||||
j["tags"] = p.tags;
|
||||
|
@ -136,7 +136,7 @@ void to_json( json& j, const PCM_RESOURCE_REFERENCE& r )
|
|||
j = json{ { "url", r.url }, { "update_timestamp", r.update_timestamp } };
|
||||
|
||||
if( r.sha256 )
|
||||
j["sha256"] = r.sha256.get();
|
||||
j["sha256"] = r.sha256.value();
|
||||
}
|
||||
|
||||
|
||||
|
@ -154,13 +154,13 @@ void to_json( json& j, const PCM_REPOSITORY& r )
|
|||
j = json{ { "name", r.name }, { "packages", r.packages } };
|
||||
|
||||
if( r.resources )
|
||||
j["resources"] = r.resources.get();
|
||||
j["resources"] = r.resources.value();
|
||||
|
||||
if( r.manifests )
|
||||
j["manifests"] = r.manifests.get();
|
||||
j["manifests"] = r.manifests.value();
|
||||
|
||||
if( r.maintainer )
|
||||
j["maintainer"] = r.maintainer.get();
|
||||
j["maintainer"] = r.maintainer.value();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include "core/wx_stl_compat.h"
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
#include <optional>
|
||||
#include <map>
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <string>
|
||||
|
@ -73,15 +73,15 @@ struct PCM_CONTACT
|
|||
struct PACKAGE_VERSION
|
||||
{
|
||||
wxString version;
|
||||
boost::optional<int> version_epoch;
|
||||
boost::optional<wxString> download_url;
|
||||
boost::optional<wxString> download_sha256;
|
||||
boost::optional<uint64_t> download_size;
|
||||
boost::optional<uint64_t> install_size;
|
||||
std::optional<int> version_epoch;
|
||||
std::optional<wxString> download_url;
|
||||
std::optional<wxString> download_sha256;
|
||||
std::optional<uint64_t> download_size;
|
||||
std::optional<uint64_t> install_size;
|
||||
PCM_PACKAGE_VERSION_STATUS status;
|
||||
std::vector<std::string> platforms;
|
||||
wxString kicad_version;
|
||||
boost::optional<wxString> kicad_version_max;
|
||||
std::optional<wxString> kicad_version_max;
|
||||
std::vector<std::string> keep_on_update;
|
||||
|
||||
// Not serialized fields
|
||||
|
@ -99,7 +99,7 @@ struct PCM_PACKAGE
|
|||
wxString identifier;
|
||||
PCM_PACKAGE_TYPE type;
|
||||
PCM_CONTACT author;
|
||||
boost::optional<PCM_CONTACT> maintainer;
|
||||
std::optional<PCM_CONTACT> maintainer;
|
||||
wxString license;
|
||||
STRING_MAP resources;
|
||||
std::vector<std::string> tags;
|
||||
|
@ -111,20 +111,20 @@ struct PCM_PACKAGE
|
|||
///< Repository reference to a resource
|
||||
struct PCM_RESOURCE_REFERENCE
|
||||
{
|
||||
wxString url;
|
||||
boost::optional<wxString> sha256;
|
||||
uint64_t update_timestamp;
|
||||
wxString url;
|
||||
std::optional<wxString> sha256;
|
||||
uint64_t update_timestamp;
|
||||
};
|
||||
|
||||
|
||||
///< Repository metadata
|
||||
struct PCM_REPOSITORY
|
||||
{
|
||||
wxString name;
|
||||
PCM_RESOURCE_REFERENCE packages;
|
||||
boost::optional<PCM_RESOURCE_REFERENCE> resources;
|
||||
boost::optional<PCM_RESOURCE_REFERENCE> manifests;
|
||||
boost::optional<PCM_CONTACT> maintainer;
|
||||
wxString name;
|
||||
PCM_RESOURCE_REFERENCE packages;
|
||||
std::optional<PCM_RESOURCE_REFERENCE> resources;
|
||||
std::optional<PCM_RESOURCE_REFERENCE> manifests;
|
||||
std::optional<PCM_CONTACT> maintainer;
|
||||
|
||||
// Not serialized fields
|
||||
std::vector<PCM_PACKAGE> package_list;
|
||||
|
|
|
@ -79,7 +79,7 @@ void PCM_TASK_MANAGER::DownloadAndInstall( const PCM_PACKAGE& aPackage, const wx
|
|||
return;
|
||||
}
|
||||
|
||||
int code = downloadFile( file_path.GetFullPath(), find_pkgver->download_url.get() );
|
||||
int code = downloadFile( file_path.GetFullPath(), find_pkgver->download_url.value() );
|
||||
|
||||
if( code != CURLE_OK )
|
||||
{
|
||||
|
@ -162,13 +162,13 @@ void PCM_TASK_MANAGER::installDownloadedPackage( const PCM_PACKAGE& aPackage,
|
|||
if( isUpdate )
|
||||
compile_keep_on_update_regex( aPackage, *pkgver, keep_on_update );
|
||||
|
||||
const boost::optional<wxString>& hash = pkgver->download_sha256;
|
||||
const std::optional<wxString>& hash = pkgver->download_sha256;
|
||||
bool hash_match = true;
|
||||
|
||||
if( hash )
|
||||
{
|
||||
std::ifstream stream( aFilePath.GetFullPath().ToUTF8(), std::ios::binary );
|
||||
hash_match = m_pcm->VerifyHash( stream, hash.get() );
|
||||
hash_match = m_pcm->VerifyHash( stream, hash.value() );
|
||||
}
|
||||
|
||||
if( !hash_match )
|
||||
|
|
|
@ -32,11 +32,11 @@
|
|||
#include <ostream> // for operator<<, ostream, basic_os...
|
||||
#include <type_traits> // for swap
|
||||
|
||||
#include <core/optional.h>
|
||||
#include <optional>
|
||||
#include <math/vector2d.h>
|
||||
#include <geometry/eda_angle.h>
|
||||
|
||||
typedef OPT<VECTOR2I> OPT_VECTOR2I;
|
||||
typedef std::optional<VECTOR2I> OPT_VECTOR2I;
|
||||
|
||||
class SEG
|
||||
{
|
||||
|
|
|
@ -670,7 +670,7 @@ public:
|
|||
*
|
||||
* @return (optional) first found self-intersection point.
|
||||
*/
|
||||
const OPT<INTERSECTION> SelfIntersecting() const;
|
||||
const std::optional<INTERSECTION> SelfIntersecting() const;
|
||||
|
||||
/**
|
||||
* Simplify the line chain by removing colinear adjacent segments and duplicate vertices.
|
||||
|
|
|
@ -31,8 +31,8 @@
|
|||
#include <limits>
|
||||
#include <algorithm>
|
||||
|
||||
// Needed for the OPT definition
|
||||
#include <core/optional.h>
|
||||
// Needed for the std::optional definition
|
||||
#include <optional>
|
||||
|
||||
/**
|
||||
* A 2D bounding box built on top of an origin point and size vector.
|
||||
|
@ -506,7 +506,7 @@ private:
|
|||
typedef BOX2<VECTOR2I> BOX2I;
|
||||
typedef BOX2<VECTOR2D> BOX2D;
|
||||
|
||||
typedef OPT<BOX2I> OPT_BOX2I;
|
||||
typedef std::optional<BOX2I> OPT_BOX2I;
|
||||
|
||||
// FIXME should be removed to avoid multiple typedefs for the same type
|
||||
typedef BOX2D DBOX;
|
||||
|
|
|
@ -330,7 +330,7 @@ void CornerListToPolygon( SHAPE_POLY_SET& outline, std::vector<ROUNDED_CORNER>&
|
|||
|
||||
if( outlineIn.Side( pt ) > 0 )
|
||||
{
|
||||
VECTOR2I intersect = outlineIn.IntersectLines( SEG( prevPt, pt ) ).get();
|
||||
VECTOR2I intersect = outlineIn.IntersectLines( SEG( prevPt, pt ) ).value();
|
||||
outline.Append( intersect );
|
||||
outline.Append( pt );
|
||||
arcEnd = SEG( cornerPosition, arcCenter ).ReflectPoint( intersect );
|
||||
|
|
|
@ -113,7 +113,7 @@ CIRCLE& CIRCLE::ConstructFromTanTanPt( const SEG& aLineA, const SEG& aLineB, con
|
|||
// In this code, the prefix "h" denotes "the homothetic image"
|
||||
OPT_VECTOR2I intersectCalc = aLineA.IntersectLines( aLineB );
|
||||
wxCHECK_MSG( intersectCalc, *this, wxT( "Lines do not intersect but are not parallel?" ) );
|
||||
intersectPoint = intersectCalc.get();
|
||||
intersectPoint = intersectCalc.value();
|
||||
|
||||
if( aP == intersectPoint )
|
||||
{
|
||||
|
@ -157,11 +157,11 @@ CIRCLE& CIRCLE::ConstructFromTanTanPt( const SEG& aLineA, const SEG& aLineB, con
|
|||
wxCHECK_MSG( actTanA, *this, wxT( "No solutions exist!" ) );
|
||||
|
||||
// Find circle center by perpendicular intersection with the angle bisector
|
||||
SEG perpendicularToTanA = aLineA.PerpendicularSeg( actTanA.get() );
|
||||
SEG perpendicularToTanA = aLineA.PerpendicularSeg( actTanA.value() );
|
||||
OPT_VECTOR2I actCenter = perpendicularToTanA.IntersectLines( anglebisector );
|
||||
wxCHECK_MSG( actCenter, *this, wxT( "No solutions exist!" ) );
|
||||
|
||||
Center = actCenter.get();
|
||||
Center = actCenter.value();
|
||||
Radius = aLineA.LineDistance( Center );
|
||||
}
|
||||
else
|
||||
|
@ -172,11 +172,11 @@ CIRCLE& CIRCLE::ConstructFromTanTanPt( const SEG& aLineA, const SEG& aLineB, con
|
|||
wxCHECK_MSG( actTanB, *this, wxT( "No solutions exist!" ) );
|
||||
|
||||
// Find circle center by perpendicular intersection with the angle bisector
|
||||
SEG perpendicularToTanB = aLineB.PerpendicularSeg( actTanB.get() );
|
||||
SEG perpendicularToTanB = aLineB.PerpendicularSeg( actTanB.value() );
|
||||
OPT_VECTOR2I actCenter = perpendicularToTanB.IntersectLines( anglebisector );
|
||||
wxCHECK_MSG( actCenter, *this, wxT( "No solutions exist!" ) );
|
||||
|
||||
Center = actCenter.get();
|
||||
Center = actCenter.value();
|
||||
Radius = aLineB.LineDistance( Center );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -135,14 +135,14 @@ SHAPE_ARC::SHAPE_ARC( const SEG& aSegmentA, const SEG& aSegmentB, int aRadius, i
|
|||
}
|
||||
else
|
||||
{
|
||||
VECTOR2I pToA = aSegmentA.B - p.get();
|
||||
VECTOR2I pToB = aSegmentB.B - p.get();
|
||||
VECTOR2I pToA = aSegmentA.B - p.value();
|
||||
VECTOR2I pToB = aSegmentB.B - p.value();
|
||||
|
||||
if( pToA.EuclideanNorm() == 0 )
|
||||
pToA = aSegmentA.A - p.get();
|
||||
pToA = aSegmentA.A - p.value();
|
||||
|
||||
if( pToB.EuclideanNorm() == 0 )
|
||||
pToB = aSegmentB.A - p.get();
|
||||
pToB = aSegmentB.A - p.value();
|
||||
|
||||
EDA_ANGLE pToAangle( pToA );
|
||||
EDA_ANGLE pToBangle( pToB );
|
||||
|
@ -153,8 +153,8 @@ SHAPE_ARC::SHAPE_ARC( const SEG& aSegmentA, const SEG& aSegmentB, int aRadius, i
|
|||
EDA_ANGLE angPC = pToAangle - alpha / 2;
|
||||
VECTOR2I arcCenter;
|
||||
|
||||
arcCenter.x = p.get().x + KiROUND( distPC * angPC.Cos() );
|
||||
arcCenter.y = p.get().y + KiROUND( distPC * angPC.Sin() );
|
||||
arcCenter.x = p.value().x + KiROUND( distPC * angPC.Cos() );
|
||||
arcCenter.y = p.value().y + KiROUND( distPC * angPC.Sin() );
|
||||
|
||||
// The end points of the arc are the orthogonal projected lines from the line segments
|
||||
// to the center of the arc
|
||||
|
|
|
@ -1635,7 +1635,7 @@ bool SHAPE_LINE_CHAIN::CheckClearance( const VECTOR2I& aP, const int aDist ) con
|
|||
}
|
||||
|
||||
|
||||
const OPT<SHAPE_LINE_CHAIN::INTERSECTION> SHAPE_LINE_CHAIN::SelfIntersecting() const
|
||||
const std::optional<SHAPE_LINE_CHAIN::INTERSECTION> SHAPE_LINE_CHAIN::SelfIntersecting() const
|
||||
{
|
||||
for( int s1 = 0; s1 < SegmentCount(); s1++ )
|
||||
{
|
||||
|
@ -1679,7 +1679,7 @@ const OPT<SHAPE_LINE_CHAIN::INTERSECTION> SHAPE_LINE_CHAIN::SelfIntersecting() c
|
|||
}
|
||||
}
|
||||
|
||||
return OPT<SHAPE_LINE_CHAIN::INTERSECTION>();
|
||||
return std::optional<SHAPE_LINE_CHAIN::INTERSECTION>();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ int PL_DRAWING_TOOLS::PlaceItem( const TOOL_EVENT& aEvent )
|
|||
|
||||
m_toolMgr->RunAction( PL_ACTIONS::clearSelection, true );
|
||||
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
std::string tool = aEvent.GetCommandStr().value();
|
||||
m_frame->PushTool( tool );
|
||||
|
||||
auto setCursor =
|
||||
|
@ -226,7 +226,7 @@ int PL_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
|||
|
||||
m_toolMgr->RunAction( PL_ACTIONS::clearSelection, true );
|
||||
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
std::string tool = aEvent.GetCommandStr().value();
|
||||
m_frame->PushTool( tool );
|
||||
|
||||
auto setCursor =
|
||||
|
|
|
@ -117,7 +117,7 @@ int PL_EDIT_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
unique_peers.insert( drawItem->GetPeer() );
|
||||
}
|
||||
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
std::string tool = aEvent.GetCommandStr().value();
|
||||
m_frame->PushTool( tool );
|
||||
|
||||
Activate();
|
||||
|
@ -389,7 +389,7 @@ int PL_EDIT_TOOL::DoDelete( const TOOL_EVENT& aEvent )
|
|||
|
||||
int PL_EDIT_TOOL::DeleteItemCursor( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
std::string tool = aEvent.GetCommandStr().value();
|
||||
PICKER_TOOL* picker = m_toolMgr->GetTool<PICKER_TOOL>();
|
||||
|
||||
// Deactivate other tools; particularly important if another PICKER is currently running
|
||||
|
|
|
@ -756,16 +756,16 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS( JSON_SETTINGS* aParent, const std:
|
|||
// Schema 1 to 2: move mask and paste margin settings back to board.
|
||||
// The parameters are removed, so we just have to manually load them here and
|
||||
// they will get saved with the board
|
||||
if( OPT<double> optval = Get<double>( "rules.solder_mask_clearance" ) )
|
||||
if( std::optional<double> optval = Get<double>( "rules.solder_mask_clearance" ) )
|
||||
m_SolderMaskExpansion = static_cast<int>( *optval * IU_PER_MM );
|
||||
|
||||
if( OPT<double> optval = Get<double>( "rules.solder_mask_min_width" ) )
|
||||
if( std::optional<double> optval = Get<double>( "rules.solder_mask_min_width" ) )
|
||||
m_SolderMaskMinWidth = static_cast<int>( *optval * IU_PER_MM );
|
||||
|
||||
if( OPT<double> optval = Get<double>( "rules.solder_paste_clearance" ) )
|
||||
if( std::optional<double> optval = Get<double>( "rules.solder_paste_clearance" ) )
|
||||
m_SolderPasteMargin = static_cast<int>( *optval * IU_PER_MM );
|
||||
|
||||
if( OPT<double> optval = Get<double>( "rules.solder_paste_margin_ratio" ) )
|
||||
if( std::optional<double> optval = Get<double>( "rules.solder_paste_margin_ratio" ) )
|
||||
m_SolderPasteMarginRatio = *optval;
|
||||
|
||||
try
|
||||
|
@ -967,7 +967,7 @@ bool BOARD_DESIGN_SETTINGS::LoadFromFile( const wxString& aDirectory )
|
|||
std::string bp = "board.design_settings.rule_severities.";
|
||||
std::string rs = "rule_severities.";
|
||||
|
||||
if( OPT<bool> v = project->Get<bool>( bp + "legacy_no_courtyard_defined" ) )
|
||||
if( std::optional<bool> v = project->Get<bool>( bp + "legacy_no_courtyard_defined" ) )
|
||||
{
|
||||
if( *v )
|
||||
Set( rs + drcName( DRCE_MISSING_COURTYARD ), "error" );
|
||||
|
@ -978,7 +978,7 @@ bool BOARD_DESIGN_SETTINGS::LoadFromFile( const wxString& aDirectory )
|
|||
migrated = true;
|
||||
}
|
||||
|
||||
if( OPT<bool> v = project->Get<bool>( bp + "legacy_courtyards_overlap" ) )
|
||||
if( std::optional<bool> v = project->Get<bool>( bp + "legacy_courtyards_overlap" ) )
|
||||
{
|
||||
if( *v )
|
||||
Set( rs + drcName( DRCE_OVERLAPPING_FOOTPRINTS ), "error" );
|
||||
|
|
|
@ -812,7 +812,7 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aSegList, SHAPE_POLY_SET&
|
|||
selfIntersecting = true;
|
||||
}
|
||||
|
||||
if( boost::optional<VECTOR2I> pt = seg1.Get().Intersect( seg2.Get(), true ) )
|
||||
if( OPT_VECTOR2I pt = seg1.Get().Intersect( seg2.Get(), true ) )
|
||||
{
|
||||
if( aErrorHandler )
|
||||
{
|
||||
|
@ -820,7 +820,7 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aSegList, SHAPE_POLY_SET&
|
|||
BOARD_ITEM* b = fetchOwner( *seg2 );
|
||||
|
||||
if( a && b )
|
||||
(*aErrorHandler)( _( "(self-intersecting)" ), a, b, pt.get() );
|
||||
(*aErrorHandler)( _( "(self-intersecting)" ), a, b, pt.value() );
|
||||
}
|
||||
|
||||
selfIntersecting = true;
|
||||
|
|
|
@ -476,7 +476,7 @@ public:
|
|||
return *m_items.at( aRow );
|
||||
}
|
||||
|
||||
OPT<LIST_ITEM_ITER> findItem( int aNetCode )
|
||||
std::optional<LIST_ITEM_ITER> findItem( int aNetCode )
|
||||
{
|
||||
auto i = std::lower_bound(
|
||||
m_items.begin(), m_items.end(), aNetCode, LIST_ITEM_NETCODE_CMP_LESS() );
|
||||
|
@ -487,7 +487,7 @@ public:
|
|||
return { i };
|
||||
}
|
||||
|
||||
OPT<LIST_ITEM_ITER> findItem( NETINFO_ITEM* aNet )
|
||||
std::optional<LIST_ITEM_ITER> findItem( NETINFO_ITEM* aNet )
|
||||
{
|
||||
if( aNet != nullptr )
|
||||
return findItem( aNet->GetNetCode() );
|
||||
|
@ -495,7 +495,7 @@ public:
|
|||
return {};
|
||||
}
|
||||
|
||||
OPT<LIST_ITEM_ITER> addItem( std::unique_ptr<LIST_ITEM> aItem )
|
||||
std::optional<LIST_ITEM_ITER> addItem( std::unique_ptr<LIST_ITEM> aItem )
|
||||
{
|
||||
if( aItem == nullptr )
|
||||
return {};
|
||||
|
@ -654,7 +654,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
std::unique_ptr<LIST_ITEM> deleteItem( const OPT<LIST_ITEM_ITER>& aRow )
|
||||
std::unique_ptr<LIST_ITEM> deleteItem( const std::optional<LIST_ITEM_ITER>& aRow )
|
||||
{
|
||||
if( !aRow )
|
||||
return {};
|
||||
|
@ -701,11 +701,11 @@ public:
|
|||
AfterReset();
|
||||
}
|
||||
|
||||
void updateItem( const OPT<LIST_ITEM_ITER>& aRow )
|
||||
void updateItem( const std::optional<LIST_ITEM_ITER>& aRow )
|
||||
{
|
||||
if( aRow )
|
||||
{
|
||||
const std::unique_ptr<LIST_ITEM>& listItem = *aRow.get();
|
||||
const std::unique_ptr<LIST_ITEM>& listItem = *aRow.value();
|
||||
|
||||
if( listItem->Parent() )
|
||||
ItemChanged( wxDataViewItem( listItem->Parent() ) );
|
||||
|
@ -1257,7 +1257,7 @@ std::vector<CN_ITEM*> DIALOG_NET_INSPECTOR::relevantConnectivityItems() const
|
|||
}
|
||||
|
||||
|
||||
void DIALOG_NET_INSPECTOR::updateDisplayedRowValues( const OPT<LIST_ITEM_ITER>& aRow )
|
||||
void DIALOG_NET_INSPECTOR::updateDisplayedRowValues( const std::optional<LIST_ITEM_ITER>& aRow )
|
||||
{
|
||||
if( !aRow )
|
||||
return;
|
||||
|
@ -1318,14 +1318,14 @@ void DIALOG_NET_INSPECTOR::OnBoardItemAdded( BOARD& aBoard, BOARD_ITEM* aBoardIt
|
|||
}
|
||||
else if( BOARD_CONNECTED_ITEM* i = dynamic_cast<BOARD_CONNECTED_ITEM*>( aBoardItem ) )
|
||||
{
|
||||
OPT<LIST_ITEM_ITER> r = m_data_model->findItem( i->GetNet() );
|
||||
std::optional<LIST_ITEM_ITER> r = m_data_model->findItem( i->GetNet() );
|
||||
|
||||
if( r )
|
||||
{
|
||||
// try to handle frequent operations quickly.
|
||||
if( PCB_TRACK* track = dynamic_cast<PCB_TRACK*>( i ) )
|
||||
{
|
||||
const std::unique_ptr<LIST_ITEM>& list_item = *r.get();
|
||||
const std::unique_ptr<LIST_ITEM>& list_item = *r.value();
|
||||
int len = track->GetLength();
|
||||
|
||||
list_item->AddLayerWireLength( len, static_cast<int>( track->GetLayer() ) );
|
||||
|
@ -1348,7 +1348,7 @@ void DIALOG_NET_INSPECTOR::OnBoardItemAdded( BOARD& aBoard, BOARD_ITEM* aBoardIt
|
|||
{
|
||||
for( const PAD* pad : footprint->Pads() )
|
||||
{
|
||||
OPT<LIST_ITEM_ITER> r = m_data_model->findItem( pad->GetNet() );
|
||||
std::optional<LIST_ITEM_ITER> r = m_data_model->findItem( pad->GetNet() );
|
||||
|
||||
if( !r )
|
||||
{
|
||||
|
@ -1363,7 +1363,7 @@ void DIALOG_NET_INSPECTOR::OnBoardItemAdded( BOARD& aBoard, BOARD_ITEM* aBoardIt
|
|||
|
||||
if( r )
|
||||
{
|
||||
const std::unique_ptr<LIST_ITEM>& list_item = *r.get();
|
||||
const std::unique_ptr<LIST_ITEM>& list_item = *r.value();
|
||||
int len = pad->GetPadToDieLength();
|
||||
|
||||
list_item->AddPadCount( 1 );
|
||||
|
@ -1398,11 +1398,11 @@ void DIALOG_NET_INSPECTOR::OnBoardItemRemoved( BOARD& aBoard, BOARD_ITEM* aBoard
|
|||
{
|
||||
for( const PAD* pad : footprint->Pads() )
|
||||
{
|
||||
OPT<LIST_ITEM_ITER> r = m_data_model->findItem( pad->GetNet() );
|
||||
std::optional<LIST_ITEM_ITER> r = m_data_model->findItem( pad->GetNet() );
|
||||
|
||||
if( r )
|
||||
{
|
||||
const std::unique_ptr<LIST_ITEM>& list_item = *r.get();
|
||||
const std::unique_ptr<LIST_ITEM>& list_item = *r.value();
|
||||
int len = pad->GetPadToDieLength();
|
||||
|
||||
list_item->SubPadCount( 1 );
|
||||
|
@ -1417,14 +1417,14 @@ void DIALOG_NET_INSPECTOR::OnBoardItemRemoved( BOARD& aBoard, BOARD_ITEM* aBoard
|
|||
}
|
||||
else if( BOARD_CONNECTED_ITEM* i = dynamic_cast<BOARD_CONNECTED_ITEM*>( aBoardItem ) )
|
||||
{
|
||||
OPT<LIST_ITEM_ITER> r = m_data_model->findItem( i->GetNet() );
|
||||
std::optional<LIST_ITEM_ITER> r = m_data_model->findItem( i->GetNet() );
|
||||
|
||||
if( r )
|
||||
{
|
||||
// try to handle frequent operations quickly.
|
||||
if( PCB_TRACK* track = dynamic_cast<PCB_TRACK*>( i ) )
|
||||
{
|
||||
const std::unique_ptr<LIST_ITEM>& list_item = *r.get();
|
||||
const std::unique_ptr<LIST_ITEM>& list_item = *r.value();
|
||||
int len = track->GetLength();
|
||||
|
||||
list_item->SubLayerWireLength( len, static_cast<int>( track->GetLayer() ) );
|
||||
|
@ -1490,7 +1490,7 @@ void DIALOG_NET_INSPECTOR::OnBoardHighlightNetChanged( BOARD& aBoard )
|
|||
|
||||
for( int code : selected_codes )
|
||||
{
|
||||
if( OPT<LIST_ITEM_ITER> r = m_data_model->findItem( code ) )
|
||||
if( std::optional<LIST_ITEM_ITER> r = m_data_model->findItem( code ) )
|
||||
new_selection.Add( wxDataViewItem( &***r ) );
|
||||
}
|
||||
|
||||
|
@ -1523,7 +1523,7 @@ void DIALOG_NET_INSPECTOR::updateNet( NETINFO_ITEM* aNet )
|
|||
// if the net had no pads before, it might not be in the displayed list yet.
|
||||
// if it had pads and now doesn't anymore, we might need to remove it from the list.
|
||||
|
||||
OPT<LIST_ITEM_ITER> cur_net_row = m_data_model->findItem( aNet );
|
||||
std::optional<LIST_ITEM_ITER> cur_net_row = m_data_model->findItem( aNet );
|
||||
|
||||
const unsigned int node_count = m_brd->GetNodesCount( aNet->GetNetCode() );
|
||||
|
||||
|
@ -1542,7 +1542,7 @@ void DIALOG_NET_INSPECTOR::updateNet( NETINFO_ITEM* aNet )
|
|||
return;
|
||||
}
|
||||
|
||||
const std::unique_ptr<LIST_ITEM>& cur_list_item = *cur_net_row.get();
|
||||
const std::unique_ptr<LIST_ITEM>& cur_list_item = *cur_net_row.value();
|
||||
|
||||
if( cur_list_item->GetNetName() != new_list_item->GetNetName() )
|
||||
{
|
||||
|
@ -1766,7 +1766,7 @@ void DIALOG_NET_INSPECTOR::buildNetsList()
|
|||
|
||||
if( r )
|
||||
{
|
||||
const std::unique_ptr<LIST_ITEM>& list_item = *r.get();
|
||||
const std::unique_ptr<LIST_ITEM>& list_item = *r.value();
|
||||
sel.Add( wxDataViewItem( list_item.get() ) );
|
||||
}
|
||||
else
|
||||
|
@ -2108,7 +2108,7 @@ void DIALOG_NET_INSPECTOR::onRenameNet( wxCommandEvent& aEvent )
|
|||
|
||||
new_item->SetChipWireLength( removed_item->GetChipWireLength() );
|
||||
|
||||
OPT<LIST_ITEM_ITER> added_row = m_data_model->addItem( std::move( new_item ) );
|
||||
std::optional<LIST_ITEM_ITER> added_row = m_data_model->addItem( std::move( new_item ) );
|
||||
|
||||
wxDataViewItemArray new_sel;
|
||||
new_sel.Add( wxDataViewItem( &***added_row ) );
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <core/optional.h>
|
||||
#include <optional>
|
||||
#include <dialog_net_inspector_base.h>
|
||||
|
||||
class PCB_EDIT_FRAME;
|
||||
|
@ -102,7 +102,7 @@ private:
|
|||
void onUnitsChanged( wxCommandEvent& event );
|
||||
void onBoardChanged( wxCommandEvent& event );
|
||||
|
||||
void updateDisplayedRowValues( const OPT<LIST_ITEM_ITER>& aRow );
|
||||
void updateDisplayedRowValues( const std::optional<LIST_ITEM_ITER>& aRow );
|
||||
|
||||
// special zero-netcode item. unconnected pads etc might use different
|
||||
// (dummy) NETINFO_ITEM. redirect all of them to this item, which we get
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
#include <dialogs/dialog_track_via_properties_base.h>
|
||||
#include <widgets/unit_binder.h>
|
||||
#include <core/optional.h>
|
||||
#include <optional>
|
||||
#include <layer_ids.h>
|
||||
|
||||
class PCB_SELECTION;
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include <base_units.h>
|
||||
#include <confirm.h>
|
||||
#include <widgets/text_ctrl_eval.h>
|
||||
#include <core/optional.h>
|
||||
#include <optional>
|
||||
#include <eda_draw_frame.h>
|
||||
|
||||
#include "board_design_settings.h"
|
||||
|
|
|
@ -62,7 +62,7 @@ void DRC_RULE::AddConstraint( DRC_CONSTRAINT& aConstraint )
|
|||
}
|
||||
|
||||
|
||||
OPT<DRC_CONSTRAINT> DRC_RULE::FindConstraint( DRC_CONSTRAINT_T aType )
|
||||
std::optional<DRC_CONSTRAINT> DRC_RULE::FindConstraint( DRC_CONSTRAINT_T aType )
|
||||
{
|
||||
for( DRC_CONSTRAINT& c : m_Constraints)
|
||||
{
|
||||
|
@ -70,5 +70,5 @@ OPT<DRC_CONSTRAINT> DRC_RULE::FindConstraint( DRC_CONSTRAINT_T aType )
|
|||
return c;
|
||||
}
|
||||
|
||||
return OPT<DRC_CONSTRAINT>();
|
||||
return std::optional<DRC_CONSTRAINT>();
|
||||
}
|
|
@ -25,7 +25,7 @@
|
|||
#define DRC_RULE_PROTO_H
|
||||
|
||||
#include <core/typeinfo.h>
|
||||
#include <core/optional.h>
|
||||
#include <optional>
|
||||
#include <core/minoptmax.h>
|
||||
#include <layer_ids.h>
|
||||
#include <netclass.h>
|
||||
|
@ -102,7 +102,7 @@ public:
|
|||
};
|
||||
|
||||
void AddConstraint( DRC_CONSTRAINT& aConstraint );
|
||||
OPT<DRC_CONSTRAINT> FindConstraint( DRC_CONSTRAINT_T aType );
|
||||
std::optional<DRC_CONSTRAINT> FindConstraint( DRC_CONSTRAINT_T aType );
|
||||
|
||||
public:
|
||||
bool m_Unary;
|
||||
|
|
|
@ -200,7 +200,7 @@ bool DRC_TEST_PROVIDER_COPPER_CLEARANCE::testTrackAgainstItem( PCB_TRACK* track,
|
|||
drcItem->SetItems( track, other );
|
||||
drcItem->SetViolatingRule( constraint.GetParentRule() );
|
||||
|
||||
reportViolation( drcItem, intersection.get(), layer );
|
||||
reportViolation( drcItem, intersection.value(), layer );
|
||||
|
||||
return m_drcEngine->GetReportAllTrackErrors();
|
||||
}
|
||||
|
|
|
@ -185,7 +185,7 @@ static void extractDiffPairCoupledItems( DIFF_PAIR_ITEMS& aDp )
|
|||
for( BOARD_CONNECTED_ITEM* itemP : aDp.itemsP )
|
||||
{
|
||||
PCB_TRACK* sp = dyn_cast<PCB_TRACK*>( itemP );
|
||||
OPT<DIFF_PAIR_COUPLED_SEGMENTS> bestCoupled;
|
||||
std::optional<DIFF_PAIR_COUPLED_SEGMENTS> bestCoupled;
|
||||
int bestGap = std::numeric_limits<int>::max();
|
||||
|
||||
if( !sp )
|
||||
|
@ -348,9 +348,9 @@ bool test::DRC_TEST_PROVIDER_DIFF_PAIR_COUPLING::Run()
|
|||
|
||||
drc_dbg(10, wxT( " coupled prims : %d\n" ), (int) it.second.coupled.size() );
|
||||
|
||||
OPT<DRC_CONSTRAINT> gapConstraint =
|
||||
std::optional<DRC_CONSTRAINT> gapConstraint =
|
||||
it.first.parentRule->FindConstraint( DIFF_PAIR_GAP_CONSTRAINT );
|
||||
OPT<DRC_CONSTRAINT> maxUncoupledConstraint =
|
||||
std::optional<DRC_CONSTRAINT> maxUncoupledConstraint =
|
||||
it.first.parentRule->FindConstraint( DIFF_PAIR_MAX_UNCOUPLED_CONSTRAINT );
|
||||
|
||||
for( BOARD_CONNECTED_ITEM* item : it.second.itemsN )
|
||||
|
|
|
@ -386,17 +386,17 @@ bool DRC_TEST_PROVIDER_MATCHED_LENGTH::runInternal( bool aDelayReportMode )
|
|||
}
|
||||
|
||||
|
||||
OPT<DRC_CONSTRAINT> lengthConstraint = rule->FindConstraint( LENGTH_CONSTRAINT );
|
||||
std::optional<DRC_CONSTRAINT> lengthConstraint = rule->FindConstraint( LENGTH_CONSTRAINT );
|
||||
|
||||
if( lengthConstraint && lengthConstraint->GetSeverity() != RPT_SEVERITY_IGNORE )
|
||||
checkLengths( *lengthConstraint, matchedConnections );
|
||||
|
||||
OPT<DRC_CONSTRAINT> skewConstraint = rule->FindConstraint( SKEW_CONSTRAINT );
|
||||
std::optional<DRC_CONSTRAINT> skewConstraint = rule->FindConstraint( SKEW_CONSTRAINT );
|
||||
|
||||
if( skewConstraint && skewConstraint->GetSeverity() != RPT_SEVERITY_IGNORE )
|
||||
checkSkews( *skewConstraint, matchedConnections );
|
||||
|
||||
OPT<DRC_CONSTRAINT> viaCountConstraint = rule->FindConstraint( VIA_COUNT_CONSTRAINT );
|
||||
std::optional<DRC_CONSTRAINT> viaCountConstraint = rule->FindConstraint( VIA_COUNT_CONSTRAINT );
|
||||
|
||||
if( viaCountConstraint && viaCountConstraint->GetSeverity() != RPT_SEVERITY_IGNORE )
|
||||
checkViaCounts( *viaCountConstraint, matchedConnections );
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include <gal/gal_display_options.h>
|
||||
#include <lib_id.h>
|
||||
#include <kiway_player.h>
|
||||
#include <core/optional.h>
|
||||
#include <optional>
|
||||
|
||||
#include <widgets/footprint_preview_widget.h>
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ int MICROWAVE_TOOL::addMicrowaveFootprint( const TOOL_EVENT& aEvent )
|
|||
|
||||
MICROWAVE_PLACER placer( this, aEvent.Parameter<MICROWAVE_FOOTPRINT_SHAPE>() );
|
||||
|
||||
doInteractiveItemPlacement( aEvent.GetCommandStr().get(), &placer,
|
||||
doInteractiveItemPlacement( aEvent.GetCommandStr().value(), &placer,
|
||||
_( "Place microwave feature" ),
|
||||
IPO_REPEAT | IPO_ROTATE | IPO_FLIP );
|
||||
|
||||
|
@ -114,7 +114,7 @@ int MICROWAVE_TOOL::drawMicrowaveInductor( const TOOL_EVENT& aEvent )
|
|||
KIGFX::VIEW_CONTROLS& controls = *getViewControls();
|
||||
PCB_EDIT_FRAME& frame = *getEditFrame<PCB_EDIT_FRAME>();
|
||||
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
std::string tool = aEvent.GetCommandStr().value();
|
||||
frame.PushTool( tool );
|
||||
|
||||
auto setCursor =
|
||||
|
|
|
@ -281,7 +281,7 @@ bool PAD::GetBestAnchorPosition( VECTOR2I& aPos )
|
|||
minDistEdge = std::max( GetSize().x, GetSize().y );
|
||||
}
|
||||
|
||||
OPT<VECTOR2I> bestAnchor( []()->OPT<VECTOR2I> { return NULLOPT; }() );
|
||||
std::optional<VECTOR2I> bestAnchor( []()->std::optional<VECTOR2I> { return std::nullopt; }() );
|
||||
|
||||
for( int y = 0; y < stepsY ; y++ )
|
||||
{
|
||||
|
|
|
@ -479,7 +479,7 @@ OPT_VECTOR2I PCB_DIMENSION_BASE::segPolyIntersection( const SHAPE_POLY_SET& aPol
|
|||
VECTOR2I endpoint( aStart ? aSeg.B : aSeg.A );
|
||||
|
||||
if( aPoly.Contains( start ) )
|
||||
return NULLOPT;
|
||||
return std::nullopt;
|
||||
|
||||
for( SHAPE_POLY_SET::CONST_SEGMENT_ITERATOR seg = aPoly.CIterateSegments(); seg; ++seg )
|
||||
{
|
||||
|
@ -492,7 +492,7 @@ OPT_VECTOR2I PCB_DIMENSION_BASE::segPolyIntersection( const SHAPE_POLY_SET& aPol
|
|||
}
|
||||
|
||||
if( start == endpoint )
|
||||
return NULLOPT;
|
||||
return std::nullopt;
|
||||
|
||||
return OPT_VECTOR2I( endpoint );
|
||||
}
|
||||
|
@ -504,7 +504,7 @@ OPT_VECTOR2I PCB_DIMENSION_BASE::segCircleIntersection( CIRCLE& aCircle, SEG& aS
|
|||
VECTOR2I endpoint( aStart ? aSeg.B : aSeg.A );
|
||||
|
||||
if( aCircle.Contains( start ) )
|
||||
return NULLOPT;
|
||||
return std::nullopt;
|
||||
|
||||
std::vector<VECTOR2I> intersections = aCircle.Intersect( aSeg );
|
||||
|
||||
|
@ -516,7 +516,7 @@ OPT_VECTOR2I PCB_DIMENSION_BASE::segCircleIntersection( CIRCLE& aCircle, SEG& aS
|
|||
}
|
||||
|
||||
if( start == endpoint )
|
||||
return NULLOPT;
|
||||
return std::nullopt;
|
||||
|
||||
return OPT_VECTOR2I( endpoint );
|
||||
}
|
||||
|
@ -1018,8 +1018,8 @@ void PCB_DIM_LEADER::updateGeometry()
|
|||
|
||||
SEG arrowSeg( m_start, m_end );
|
||||
SEG textSeg( m_end, m_text.GetPosition() );
|
||||
OPT_VECTOR2I arrowSegEnd = boost::make_optional( false, VECTOR2I() );;
|
||||
OPT_VECTOR2I textSegEnd = boost::make_optional( false, VECTOR2I() );
|
||||
OPT_VECTOR2I arrowSegEnd;
|
||||
OPT_VECTOR2I textSegEnd;
|
||||
|
||||
if( m_textBorder == DIM_TEXT_BORDER::CIRCLE )
|
||||
{
|
||||
|
@ -1212,10 +1212,10 @@ void PCB_DIM_RADIAL::updateGeometry()
|
|||
OPT_VECTOR2I textSegEnd = segPolyIntersection( polyBox, textSeg );
|
||||
|
||||
if( arrowSegEnd )
|
||||
arrowSeg.B = arrowSegEnd.get();
|
||||
arrowSeg.B = arrowSegEnd.value();
|
||||
|
||||
if( textSegEnd )
|
||||
textSeg.B = textSegEnd.get();
|
||||
textSeg.B = textSegEnd.value();
|
||||
|
||||
m_shapes.emplace_back( new SHAPE_SEGMENT( arrowSeg ) );
|
||||
|
||||
|
|
|
@ -558,8 +558,8 @@ PCBNEW_SETTINGS::PCBNEW_SETTINGS()
|
|||
registerMigration( 0, 1,
|
||||
[&]()
|
||||
{
|
||||
if( OPT<int> optval = Get<int>( "pcb_display.rotation_angle" ) )
|
||||
Set( "editing.rotation_angle", optval.get() );
|
||||
if( std::optional<int> optval = Get<int>( "pcb_display.rotation_angle" ) )
|
||||
Set( "editing.rotation_angle", optval.value() );
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -587,7 +587,7 @@ PCBNEW_SETTINGS::PCBNEW_SETTINGS()
|
|||
{
|
||||
// We used to have a bug on GTK which would set the lib tree column width way
|
||||
// too narrow.
|
||||
if( OPT<int> optval = Get<int>( "lib_tree.column_width" ) )
|
||||
if( std::optional<int> optval = Get<int>( "lib_tree.column_width" ) )
|
||||
{
|
||||
if( optval < 150 )
|
||||
Set( "lib_tree.column_width", 300 );
|
||||
|
|
|
@ -1289,7 +1289,7 @@ void ALTIUM_PCB::HelperParseDimensions6Linear( const ADIMENSION6& aElem )
|
|||
VECTOR2I directionNormalVector = VECTOR2I( -direction.y, direction.x );
|
||||
SEG segm1( referencePoint0, referencePoint0 + directionNormalVector );
|
||||
SEG segm2( referencePoint1, referencePoint1 + direction );
|
||||
VECTOR2I intersection( segm1.Intersect( segm2, true, true ).get() );
|
||||
VECTOR2I intersection( segm1.Intersect( segm2, true, true ).value() );
|
||||
dimension->SetEnd( intersection );
|
||||
|
||||
int height = static_cast<int>( EuclideanNorm( direction ) );
|
||||
|
|
|
@ -1667,7 +1667,7 @@ void EAGLE_PLUGIN::orientFPText( FOOTPRINT* aFootprint, const EELEMENT& e, FP_TE
|
|||
aFPText->SetText( *a.value );
|
||||
}
|
||||
|
||||
if( a.x && a.y ) // OPT
|
||||
if( a.x && a.y ) // std::optional
|
||||
{
|
||||
VECTOR2I pos( kicad_x( *a.x ), kicad_y( *a.y ) );
|
||||
aFPText->SetTextPos( pos );
|
||||
|
|
|
@ -268,7 +268,7 @@ int LENGTH_TUNER_TOOL::MainLoop( const TOOL_EVENT& aEvent )
|
|||
// Deselect all items
|
||||
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
|
||||
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
std::string tool = aEvent.GetCommandStr().value();
|
||||
frame()->PushTool( tool );
|
||||
|
||||
auto setCursor =
|
||||
|
|
|
@ -222,7 +222,7 @@ private:
|
|||
int m_netP, m_netN;
|
||||
|
||||
DP_PRIMITIVE_PAIR m_start;
|
||||
OPT<DP_PRIMITIVE_PAIR> m_prevPair;
|
||||
std::optional<DP_PRIMITIVE_PAIR> m_prevPair;
|
||||
|
||||
///< current algorithm iteration
|
||||
int m_iteration;
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <core/optional.h>
|
||||
#include <optional>
|
||||
|
||||
#include <base_units.h> // God forgive me doing this...
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <core/optional.h>
|
||||
#include <optional>
|
||||
|
||||
#include <math/box2.h>
|
||||
#include <math/vector2d.h>
|
||||
|
@ -578,7 +578,7 @@ const LINE LINE::ClipToNearestObstacle( NODE* aNode ) const
|
|||
|
||||
SHAPE_LINE_CHAIN dragCornerInternal( const SHAPE_LINE_CHAIN& aOrigin, const VECTOR2I& aP )
|
||||
{
|
||||
OPT<SHAPE_LINE_CHAIN> picked;
|
||||
std::optional<SHAPE_LINE_CHAIN> picked;
|
||||
int i;
|
||||
int d = 2;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <core/optional.h>
|
||||
#include <optional>
|
||||
#include <memory>
|
||||
|
||||
#include "pns_arc.h"
|
||||
|
|
|
@ -162,7 +162,7 @@ public:
|
|||
CQS_IGNORE_HOLE_CLEARANCE = 2 ///< check everything except hole2hole / hole2copper
|
||||
};
|
||||
|
||||
typedef OPT<OBSTACLE> OPT_OBSTACLE;
|
||||
typedef std::optional<OBSTACLE> OPT_OBSTACLE;
|
||||
typedef std::vector<ITEM*> ITEM_VECTOR;
|
||||
typedef std::vector<OBSTACLE> OBSTACLES;
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
#include <list>
|
||||
#include <memory>
|
||||
#include <core/optional.h>
|
||||
#include <optional>
|
||||
#include <math/box2.h>
|
||||
|
||||
#include "pns_routing_settings.h"
|
||||
|
|
|
@ -796,7 +796,7 @@ NODE* SHOVE::reduceSpringback( const ITEM_SET& aHeadSet, VIA_HANDLE& aDraggedVia
|
|||
if( spTag.m_node == m_springbackDoNotTouchNode )
|
||||
break;
|
||||
|
||||
OPT<OBSTACLE> obs = spTag.m_node->CheckColliding( aHeadSet );
|
||||
std::optional<OBSTACLE> obs = spTag.m_node->CheckColliding( aHeadSet );
|
||||
|
||||
if( !obs && !spTag.m_locked )
|
||||
{
|
||||
|
@ -1356,7 +1356,7 @@ SHOVE::SHOVE_STATUS SHOVE::shoveIteration( int aIter )
|
|||
return SH_OK;
|
||||
}
|
||||
|
||||
bool viaFixup = fixupViaCollisions( ¤tLine, nearest.get() );
|
||||
bool viaFixup = fixupViaCollisions( ¤tLine, nearest.value() );
|
||||
|
||||
PNS_DBG( Dbg(), Message, wxString::Format( "iter %d: VF %d", aIter, viaFixup?1:0 ) );
|
||||
|
||||
|
@ -1443,7 +1443,7 @@ SHOVE::SHOVE_STATUS SHOVE::shoveIteration( int aIter )
|
|||
st = onCollidingSegment( currentLine, (SEGMENT*) ni );
|
||||
|
||||
if( st == SH_TRY_WALK )
|
||||
st = onCollidingSolid( currentLine, ni, nearest.get() );
|
||||
st = onCollidingSolid( currentLine, ni, nearest.value() );
|
||||
|
||||
PNS_DBGN( Dbg(), EndGroup );
|
||||
|
||||
|
@ -1456,7 +1456,7 @@ SHOVE::SHOVE_STATUS SHOVE::shoveIteration( int aIter )
|
|||
st = onCollidingArc( currentLine, static_cast<ARC*>( ni ) );
|
||||
|
||||
if( st == SH_TRY_WALK )
|
||||
st = onCollidingSolid( currentLine, ni, nearest.get() );
|
||||
st = onCollidingSolid( currentLine, ni, nearest.value() );
|
||||
|
||||
PNS_DBGN( Dbg(), EndGroup );
|
||||
|
||||
|
@ -1464,10 +1464,10 @@ SHOVE::SHOVE_STATUS SHOVE::shoveIteration( int aIter )
|
|||
|
||||
case ITEM::VIA_T:
|
||||
PNS_DBG( Dbg(), BeginGroup, wxString::Format( "iter %d: collide-via (fixup: %d)", aIter, 0 ), 0 );
|
||||
st = onCollidingVia( ¤tLine, (VIA*) ni, nearest.get() );
|
||||
st = onCollidingVia( ¤tLine, (VIA*) ni, nearest.value() );
|
||||
|
||||
if( st == SH_TRY_WALK )
|
||||
st = onCollidingSolid( currentLine, ni, nearest.get() );
|
||||
st = onCollidingSolid( currentLine, ni, nearest.value() );
|
||||
|
||||
PNS_DBGN( Dbg(), EndGroup );
|
||||
|
||||
|
@ -1475,7 +1475,7 @@ SHOVE::SHOVE_STATUS SHOVE::shoveIteration( int aIter )
|
|||
|
||||
case ITEM::SOLID_T:
|
||||
PNS_DBG( Dbg(), BeginGroup, wxString::Format( "iter %d: walk-solid ", aIter ), 0);
|
||||
st = onCollidingSolid( currentLine, (SOLID*) ni, nearest.get() );
|
||||
st = onCollidingSolid( currentLine, (SOLID*) ni, nearest.value() );
|
||||
|
||||
PNS_DBGN( Dbg(), EndGroup );
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ public:
|
|||
|
||||
private:
|
||||
typedef std::vector<SHAPE_LINE_CHAIN> HULL_SET;
|
||||
typedef OPT<LINE> OPT_LINE;
|
||||
typedef std::optional<LINE> OPT_LINE;
|
||||
typedef std::pair<LINE, LINE> LINE_PAIR;
|
||||
typedef std::vector<LINE_PAIR> LINE_PAIR_VEC;
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#define __PNS_SIZES_SETTINGS_H
|
||||
|
||||
#include <map>
|
||||
#include <core/optional.h>
|
||||
#include <optional>
|
||||
|
||||
#include "pcb_track.h" // for VIATYPE_T
|
||||
|
||||
|
@ -87,10 +87,10 @@ public:
|
|||
int ViaDrill() const { return m_viaDrill; }
|
||||
void SetViaDrill( int aDrill ) { m_viaDrill = aDrill; }
|
||||
|
||||
OPT<int> PairedLayer( int aLayerId )
|
||||
std::optional<int> PairedLayer( int aLayerId )
|
||||
{
|
||||
if( m_layerPairs.find(aLayerId) == m_layerPairs.end() )
|
||||
return OPT<int>();
|
||||
return std::optional<int>();
|
||||
|
||||
return m_layerPairs[aLayerId];
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <core/optional.h>
|
||||
#include <optional>
|
||||
|
||||
#include <geometry/shape_line_chain.h>
|
||||
|
||||
|
@ -76,7 +76,7 @@ void WALKAROUND::RestrictToSet( bool aEnabled, const std::set<ITEM*>& aSet )
|
|||
|
||||
WALKAROUND::WALKAROUND_STATUS WALKAROUND::singleStep( LINE& aPath, bool aWindingDirection )
|
||||
{
|
||||
OPT<OBSTACLE>& current_obs =
|
||||
std::optional<OBSTACLE>& current_obs =
|
||||
aWindingDirection ? m_currentObstacle[0] : m_currentObstacle[1];
|
||||
|
||||
if( !current_obs )
|
||||
|
|
|
@ -636,7 +636,7 @@ void ROUTER_TOOL::switchLayerOnViaPlacement()
|
|||
m_router->SwitchLayer( al );
|
||||
}
|
||||
|
||||
OPT<int> newLayer = m_router->Sizes().PairedLayer( cl );
|
||||
std::optional<int> newLayer = m_router->Sizes().PairedLayer( cl );
|
||||
|
||||
if( !newLayer )
|
||||
newLayer = m_router->Sizes().GetLayerTop();
|
||||
|
@ -1487,7 +1487,7 @@ int ROUTER_TOOL::MainLoop( const TOOL_EVENT& aEvent )
|
|||
// Deselect all items
|
||||
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
|
||||
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
std::string tool = aEvent.GetCommandStr().value();
|
||||
frame->PushTool( tool );
|
||||
|
||||
auto setCursor =
|
||||
|
|
|
@ -966,7 +966,7 @@ int BOARD_EDITOR_CONTROL::PlaceFootprint( const TOOL_EVENT& aEvent )
|
|||
|
||||
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
|
||||
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
std::string tool = aEvent.GetCommandStr().value();
|
||||
m_frame->PushTool( tool );
|
||||
|
||||
auto setCursor =
|
||||
|
@ -1490,7 +1490,7 @@ void BOARD_EDITOR_CONTROL::DoSetDrillOrigin( KIGFX::VIEW* aView, PCB_BASE_FRAME*
|
|||
|
||||
int BOARD_EDITOR_CONTROL::DrillOrigin( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
std::string tool = aEvent.GetCommandStr().value();
|
||||
PCB_PICKER_TOOL* picker = m_toolMgr->GetTool<PCB_PICKER_TOOL>();
|
||||
|
||||
// Deactivate other tools; particularly important if another PICKER is currently running
|
||||
|
|
|
@ -1478,7 +1478,7 @@ int BOARD_INSPECTION_TOOL::ClearHighlight( const TOOL_EVENT& aEvent )
|
|||
#if 0
|
||||
int BOARD_INSPECTION_TOOL::HighlightNetTool( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
std::string tool = aEvent.GetCommandStr().value();
|
||||
PCB_PICKER_TOOL* picker = m_toolMgr->GetTool<PCB_PICKER_TOOL>();
|
||||
|
||||
// Deactivate other tools; particularly important if another PICKER is currently running
|
||||
|
@ -1512,7 +1512,7 @@ int BOARD_INSPECTION_TOOL::HighlightNetTool( const TOOL_EVENT& aEvent )
|
|||
|
||||
int BOARD_INSPECTION_TOOL::LocalRatsnestTool( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
std::string tool = aEvent.GetCommandStr().value();
|
||||
PCB_PICKER_TOOL* picker = m_toolMgr->GetTool<PCB_PICKER_TOOL>();
|
||||
BOARD* board = getModel<BOARD>();
|
||||
|
||||
|
|
|
@ -400,7 +400,7 @@ SHAPE_POLY_SET CONVERT_TOOL::makePolysFromChainedSegs( const std::deque<EDA_ITEM
|
|||
{
|
||||
item->ClearFlags( SKIP_STRUCT );
|
||||
|
||||
if( OPT<SEG> seg = getStartEndPoints( item, nullptr ) )
|
||||
if( std::optional<SEG> seg = getStartEndPoints( item, nullptr ) )
|
||||
{
|
||||
toCheck.push_back( item );
|
||||
connections[findInsertionPoint( seg->A )].emplace_back( std::make_pair( 0, item ) );
|
||||
|
@ -447,7 +447,7 @@ SHAPE_POLY_SET CONVERT_TOOL::makePolysFromChainedSegs( const std::deque<EDA_ITEM
|
|||
}
|
||||
else
|
||||
{
|
||||
OPT<SEG> nextSeg = getStartEndPoints( aItem, &width );
|
||||
std::optional<SEG> nextSeg = getStartEndPoints( aItem, &width );
|
||||
wxASSERT( nextSeg );
|
||||
|
||||
VECTOR2I& point = ( aAnchor == nextSeg->A ) ? nextSeg->B : nextSeg->A;
|
||||
|
@ -471,7 +471,7 @@ SHAPE_POLY_SET CONVERT_TOOL::makePolysFromChainedSegs( const std::deque<EDA_ITEM
|
|||
|
||||
insert( aItem, aAnchor, aDirection );
|
||||
|
||||
OPT<SEG> anchors = getStartEndPoints( aItem, &width );
|
||||
std::optional<SEG> anchors = getStartEndPoints( aItem, &width );
|
||||
wxASSERT( anchors );
|
||||
|
||||
VECTOR2I nextAnchor = ( aAnchor == anchors->A ) ? anchors->B : anchors->A;
|
||||
|
@ -485,7 +485,7 @@ SHAPE_POLY_SET CONVERT_TOOL::makePolysFromChainedSegs( const std::deque<EDA_ITEM
|
|||
}
|
||||
};
|
||||
|
||||
OPT<SEG> anchors = getStartEndPoints( candidate, &width );
|
||||
std::optional<SEG> anchors = getStartEndPoints( candidate, &width );
|
||||
wxASSERT( anchors );
|
||||
|
||||
// Start with the first object and walk "right"
|
||||
|
@ -837,7 +837,7 @@ int CONVERT_TOOL::SegmentToArc( const TOOL_EVENT& aEvent )
|
|||
// Offset the midpoint along the normal a little bit so that it's more obviously an arc
|
||||
const double offsetRatio = 0.1;
|
||||
|
||||
if( OPT<SEG> seg = getStartEndPoints( source, nullptr ) )
|
||||
if( std::optional<SEG> seg = getStartEndPoints( source, nullptr ) )
|
||||
{
|
||||
start = seg->A;
|
||||
end = seg->B;
|
||||
|
@ -901,7 +901,7 @@ int CONVERT_TOOL::SegmentToArc( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
|
||||
OPT<SEG> CONVERT_TOOL::getStartEndPoints( EDA_ITEM* aItem, int* aWidth )
|
||||
std::optional<SEG> CONVERT_TOOL::getStartEndPoints( EDA_ITEM* aItem, int* aWidth )
|
||||
{
|
||||
switch( aItem->Type() )
|
||||
{
|
||||
|
@ -916,16 +916,16 @@ OPT<SEG> CONVERT_TOOL::getStartEndPoints( EDA_ITEM* aItem, int* aWidth )
|
|||
case SHAPE_T::ARC:
|
||||
case SHAPE_T::POLY:
|
||||
if( shape->GetStart() == shape->GetEnd() )
|
||||
return NULLOPT;
|
||||
return std::nullopt;
|
||||
|
||||
if( aWidth )
|
||||
*aWidth = shape->GetWidth();
|
||||
|
||||
return boost::make_optional<SEG>( { VECTOR2I( shape->GetStart() ),
|
||||
VECTOR2I( shape->GetEnd() ) } );
|
||||
return std::make_optional<SEG>( VECTOR2I( shape->GetStart() ),
|
||||
VECTOR2I( shape->GetEnd() ) );
|
||||
|
||||
default:
|
||||
return NULLOPT;
|
||||
return std::nullopt;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -936,8 +936,7 @@ OPT<SEG> CONVERT_TOOL::getStartEndPoints( EDA_ITEM* aItem, int* aWidth )
|
|||
if( aWidth )
|
||||
*aWidth = line->GetWidth();
|
||||
|
||||
return boost::make_optional<SEG>( { VECTOR2I( line->GetStart() ),
|
||||
VECTOR2I( line->GetEnd() ) } );
|
||||
return std::make_optional<SEG>( VECTOR2I( line->GetStart() ), VECTOR2I( line->GetEnd() ) );
|
||||
}
|
||||
|
||||
case PCB_ARC_T:
|
||||
|
@ -947,12 +946,11 @@ OPT<SEG> CONVERT_TOOL::getStartEndPoints( EDA_ITEM* aItem, int* aWidth )
|
|||
if( aWidth )
|
||||
*aWidth = arc->GetWidth();
|
||||
|
||||
return boost::make_optional<SEG>( { VECTOR2I( arc->GetStart() ),
|
||||
VECTOR2I( arc->GetEnd() ) } );
|
||||
return std::make_optional<SEG>( VECTOR2I( arc->GetStart() ), VECTOR2I( arc->GetEnd() ) );
|
||||
}
|
||||
|
||||
default:
|
||||
return NULLOPT;
|
||||
return std::nullopt;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue