Nuke base_units from orbit
This commit is contained in:
parent
4ae2225b6d
commit
b00178adb3
|
@ -49,12 +49,12 @@ void PANEL_3D_RAYTRACING_OPTIONS::loadSettings( EDA_3D_VIEWER_SETTINGS* aCfg )
|
||||||
m_numSamples_Reflections->SetValue( aCfg->m_Render.raytrace_nrsamples_reflections );
|
m_numSamples_Reflections->SetValue( aCfg->m_Render.raytrace_nrsamples_reflections );
|
||||||
m_numSamples_Refractions->SetValue( aCfg->m_Render.raytrace_nrsamples_refractions );
|
m_numSamples_Refractions->SetValue( aCfg->m_Render.raytrace_nrsamples_refractions );
|
||||||
|
|
||||||
m_spreadFactor_Shadows->SetValue( StringFromValue( EDA_UNITS::PERCENT,
|
m_spreadFactor_Shadows->SetValue( EDA_UNIT_UTILS::UI::StringFromValue(
|
||||||
aCfg->m_Render.raytrace_spread_shadows * 100.0f ) );
|
pcbIUScale, EDA_UNITS::PERCENT, aCfg->m_Render.raytrace_spread_shadows * 100.0f ) );
|
||||||
m_spreadFactor_Reflections->SetValue( StringFromValue( EDA_UNITS::PERCENT,
|
m_spreadFactor_Reflections->SetValue( EDA_UNIT_UTILS::UI::StringFromValue(
|
||||||
aCfg->m_Render.raytrace_spread_reflections * 100.0f ) );
|
pcbIUScale, EDA_UNITS::PERCENT, aCfg->m_Render.raytrace_spread_reflections * 100.0f ) );
|
||||||
m_spreadFactor_Refractions->SetValue( StringFromValue( EDA_UNITS::PERCENT,
|
m_spreadFactor_Refractions->SetValue( EDA_UNIT_UTILS::UI::StringFromValue(
|
||||||
aCfg->m_Render.raytrace_spread_refractions * 100.0f ) );
|
pcbIUScale, EDA_UNITS::PERCENT, aCfg->m_Render.raytrace_spread_refractions * 100.0f ) );
|
||||||
|
|
||||||
m_recursiveLevel_Reflections->SetValue( aCfg->m_Render.raytrace_recursivelevel_reflections );
|
m_recursiveLevel_Reflections->SetValue( aCfg->m_Render.raytrace_recursivelevel_reflections );
|
||||||
m_recursiveLevel_Refractions->SetValue( aCfg->m_Render.raytrace_recursivelevel_refractions );
|
m_recursiveLevel_Refractions->SetValue( aCfg->m_Render.raytrace_recursivelevel_refractions );
|
||||||
|
@ -70,7 +70,8 @@ void PANEL_3D_RAYTRACING_OPTIONS::loadSettings( EDA_3D_VIEWER_SETTINGS* aCfg )
|
||||||
auto transfer_value =
|
auto transfer_value =
|
||||||
[]( wxTextCtrl* aCtrl, int aValue )
|
[]( wxTextCtrl* aCtrl, int aValue )
|
||||||
{
|
{
|
||||||
aCtrl->SetValue( StringFromValue( EDA_UNITS::UNSCALED, aValue ) );
|
aCtrl->SetValue(
|
||||||
|
EDA_UNIT_UTILS::UI::StringFromValue( pcbIUScale, EDA_UNITS::UNSCALED, aValue ) );
|
||||||
};
|
};
|
||||||
|
|
||||||
transfer_color( aCfg->m_Render.raytrace_lightColorCamera, m_colourPickerCameraLight );
|
transfer_color( aCfg->m_Render.raytrace_lightColorCamera, m_colourPickerCameraLight );
|
||||||
|
@ -136,11 +137,17 @@ bool PANEL_3D_RAYTRACING_OPTIONS::TransferDataFromWindow()
|
||||||
cfg->m_Render.raytrace_nrsamples_refractions = m_numSamples_Refractions->GetValue();
|
cfg->m_Render.raytrace_nrsamples_refractions = m_numSamples_Refractions->GetValue();
|
||||||
|
|
||||||
cfg->m_Render.raytrace_spread_shadows =
|
cfg->m_Render.raytrace_spread_shadows =
|
||||||
DoubleValueFromString( EDA_UNITS::PERCENT, m_spreadFactor_Shadows->GetValue() ) / 100.0f;
|
EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, EDA_UNITS::PERCENT,
|
||||||
|
m_spreadFactor_Shadows->GetValue() )
|
||||||
|
/ 100.0f;
|
||||||
cfg->m_Render.raytrace_spread_reflections =
|
cfg->m_Render.raytrace_spread_reflections =
|
||||||
DoubleValueFromString( EDA_UNITS::PERCENT, m_spreadFactor_Reflections->GetValue() ) / 100.0f;
|
EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, EDA_UNITS::PERCENT,
|
||||||
|
m_spreadFactor_Reflections->GetValue() )
|
||||||
|
/ 100.0f;
|
||||||
cfg->m_Render.raytrace_spread_refractions =
|
cfg->m_Render.raytrace_spread_refractions =
|
||||||
DoubleValueFromString( EDA_UNITS::PERCENT, m_spreadFactor_Refractions->GetValue() ) / 100.0f;
|
EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, EDA_UNITS::PERCENT,
|
||||||
|
m_spreadFactor_Refractions->GetValue() )
|
||||||
|
/ 100.0f;
|
||||||
|
|
||||||
cfg->m_Render.raytrace_recursivelevel_reflections = m_recursiveLevel_Reflections->GetValue();
|
cfg->m_Render.raytrace_recursivelevel_reflections = m_recursiveLevel_Reflections->GetValue();
|
||||||
cfg->m_Render.raytrace_recursivelevel_refractions = m_recursiveLevel_Refractions->GetValue();
|
cfg->m_Render.raytrace_recursivelevel_refractions = m_recursiveLevel_Refractions->GetValue();
|
||||||
|
@ -161,7 +168,8 @@ bool PANEL_3D_RAYTRACING_OPTIONS::TransferDataFromWindow()
|
||||||
auto get_value =
|
auto get_value =
|
||||||
[]( wxTextCtrl* aCtrl )
|
[]( wxTextCtrl* aCtrl )
|
||||||
{
|
{
|
||||||
return DoubleValueFromString( EDA_UNITS::UNSCALED, aCtrl->GetValue() );
|
return EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, EDA_UNITS::UNSCALED,
|
||||||
|
aCtrl->GetValue() );
|
||||||
};
|
};
|
||||||
|
|
||||||
cfg->m_Render.raytrace_lightElevation[0] = get_value( m_lightElevation1 );
|
cfg->m_Render.raytrace_lightElevation[0] = get_value( m_lightElevation1 );
|
||||||
|
|
|
@ -222,7 +222,8 @@ void PANEL_PREVIEW_3D_MODEL::loadSettings()
|
||||||
*/
|
*/
|
||||||
static double rotationFromString( const wxString& aValue )
|
static double rotationFromString( const wxString& aValue )
|
||||||
{
|
{
|
||||||
double rotation = DoubleValueFromString( EDA_UNITS::DEGREES, aValue );
|
double rotation =
|
||||||
|
EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, EDA_UNITS::DEGREES, aValue );
|
||||||
|
|
||||||
if( rotation > MAX_ROTATION )
|
if( rotation > MAX_ROTATION )
|
||||||
{
|
{
|
||||||
|
@ -319,17 +320,26 @@ void PANEL_PREVIEW_3D_MODEL::updateOrientation( wxCommandEvent &event )
|
||||||
// Write settings back to the parent
|
// Write settings back to the parent
|
||||||
FP_3DMODEL* modelInfo = &m_parentModelList->at( (unsigned) m_selected );
|
FP_3DMODEL* modelInfo = &m_parentModelList->at( (unsigned) m_selected );
|
||||||
|
|
||||||
modelInfo->m_Scale.x = DoubleValueFromString( EDA_UNITS::UNSCALED, xscale->GetValue() );
|
modelInfo->m_Scale.x = EDA_UNIT_UTILS::UI::DoubleValueFromString(
|
||||||
modelInfo->m_Scale.y = DoubleValueFromString( EDA_UNITS::UNSCALED, yscale->GetValue() );
|
pcbIUScale, EDA_UNITS::UNSCALED, xscale->GetValue() );
|
||||||
modelInfo->m_Scale.z = DoubleValueFromString( EDA_UNITS::UNSCALED, zscale->GetValue() );
|
modelInfo->m_Scale.y = EDA_UNIT_UTILS::UI::DoubleValueFromString(
|
||||||
|
pcbIUScale, EDA_UNITS::UNSCALED, yscale->GetValue() );
|
||||||
|
modelInfo->m_Scale.z = EDA_UNIT_UTILS::UI::DoubleValueFromString(
|
||||||
|
pcbIUScale, EDA_UNITS::UNSCALED, zscale->GetValue() );
|
||||||
|
|
||||||
modelInfo->m_Rotation.x = rotationFromString( xrot->GetValue() );
|
modelInfo->m_Rotation.x = rotationFromString( xrot->GetValue() );
|
||||||
modelInfo->m_Rotation.y = rotationFromString( yrot->GetValue() );
|
modelInfo->m_Rotation.y = rotationFromString( yrot->GetValue() );
|
||||||
modelInfo->m_Rotation.z = rotationFromString( zrot->GetValue() );
|
modelInfo->m_Rotation.z = rotationFromString( zrot->GetValue() );
|
||||||
|
|
||||||
modelInfo->m_Offset.x = DoubleValueFromString( m_userUnits, xoff->GetValue() ) / IU_PER_MM;
|
modelInfo->m_Offset.x = EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, m_userUnits,
|
||||||
modelInfo->m_Offset.y = DoubleValueFromString( m_userUnits, yoff->GetValue() ) / IU_PER_MM;
|
xoff->GetValue() )
|
||||||
modelInfo->m_Offset.z = DoubleValueFromString( m_userUnits, zoff->GetValue() ) / IU_PER_MM;
|
/ pcbIUScale.IU_PER_MM;
|
||||||
|
modelInfo->m_Offset.y = EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, m_userUnits,
|
||||||
|
yoff->GetValue() )
|
||||||
|
/ pcbIUScale.IU_PER_MM;
|
||||||
|
modelInfo->m_Offset.z = EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, m_userUnits,
|
||||||
|
zoff->GetValue() )
|
||||||
|
/ pcbIUScale.IU_PER_MM;
|
||||||
|
|
||||||
// Update the dummy footprint for the preview
|
// Update the dummy footprint for the preview
|
||||||
UpdateDummyFootprint( false );
|
UpdateDummyFootprint( false );
|
||||||
|
@ -363,7 +373,7 @@ void PANEL_PREVIEW_3D_MODEL::doIncrementScale( wxSpinEvent& event, double aSign
|
||||||
else if( spinCtrl == m_spinZscale )
|
else if( spinCtrl == m_spinZscale )
|
||||||
textCtrl = zscale;
|
textCtrl = zscale;
|
||||||
|
|
||||||
double curr_value = DoubleValueFromString( EDA_UNITS::UNSCALED, textCtrl->GetValue() );
|
double curr_value = EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, EDA_UNITS::UNSCALED, textCtrl->GetValue() );
|
||||||
|
|
||||||
curr_value += ( SCALE_INCREMENT * aSign );
|
curr_value += ( SCALE_INCREMENT * aSign );
|
||||||
curr_value = std::max( 1/MAX_SCALE, curr_value );
|
curr_value = std::max( 1/MAX_SCALE, curr_value );
|
||||||
|
@ -383,7 +393,8 @@ void PANEL_PREVIEW_3D_MODEL::doIncrementRotation( wxSpinEvent& aEvent, double aS
|
||||||
else if( spinCtrl == m_spinZrot )
|
else if( spinCtrl == m_spinZrot )
|
||||||
textCtrl = zrot;
|
textCtrl = zrot;
|
||||||
|
|
||||||
double curr_value = DoubleValueFromString( EDA_UNITS::DEGREES, textCtrl->GetValue() );
|
double curr_value = EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, EDA_UNITS::DEGREES,
|
||||||
|
textCtrl->GetValue() );
|
||||||
|
|
||||||
curr_value += ( ROTATION_INCREMENT * aSign );
|
curr_value += ( ROTATION_INCREMENT * aSign );
|
||||||
curr_value = std::max( -MAX_ROTATION, curr_value );
|
curr_value = std::max( -MAX_ROTATION, curr_value );
|
||||||
|
@ -405,7 +416,9 @@ void PANEL_PREVIEW_3D_MODEL::doIncrementOffset( wxSpinEvent& event, double aSign
|
||||||
textCtrl = zoff;
|
textCtrl = zoff;
|
||||||
|
|
||||||
double step_mm = OFFSET_INCREMENT_MM;
|
double step_mm = OFFSET_INCREMENT_MM;
|
||||||
double curr_value_mm = DoubleValueFromString( m_userUnits, textCtrl->GetValue() ) / IU_PER_MM;
|
double curr_value_mm =
|
||||||
|
EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, m_userUnits, textCtrl->GetValue() )
|
||||||
|
/ pcbIUScale.IU_PER_MM;
|
||||||
|
|
||||||
if( m_userUnits == EDA_UNITS::MILS || m_userUnits == EDA_UNITS::INCHES )
|
if( m_userUnits == EDA_UNITS::MILS || m_userUnits == EDA_UNITS::INCHES )
|
||||||
{
|
{
|
||||||
|
@ -432,7 +445,8 @@ void PANEL_PREVIEW_3D_MODEL::onMouseWheelScale( wxMouseEvent& event )
|
||||||
if( event.GetWheelRotation() >= 0 )
|
if( event.GetWheelRotation() >= 0 )
|
||||||
step = -step;
|
step = -step;
|
||||||
|
|
||||||
double curr_value = DoubleValueFromString( EDA_UNITS::UNSCALED, textCtrl->GetValue() );
|
double curr_value = EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, EDA_UNITS::UNSCALED,
|
||||||
|
textCtrl->GetValue() );
|
||||||
|
|
||||||
curr_value += step;
|
curr_value += step;
|
||||||
curr_value = std::max( 1/MAX_SCALE, curr_value );
|
curr_value = std::max( 1/MAX_SCALE, curr_value );
|
||||||
|
@ -454,7 +468,8 @@ void PANEL_PREVIEW_3D_MODEL::onMouseWheelRot( wxMouseEvent& event )
|
||||||
if( event.GetWheelRotation() >= 0 )
|
if( event.GetWheelRotation() >= 0 )
|
||||||
step = -step;
|
step = -step;
|
||||||
|
|
||||||
double curr_value = DoubleValueFromString( EDA_UNITS::DEGREES, textCtrl->GetValue() );
|
double curr_value = EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, EDA_UNITS::DEGREES,
|
||||||
|
textCtrl->GetValue() );
|
||||||
|
|
||||||
curr_value += step;
|
curr_value += step;
|
||||||
curr_value = std::max( -MAX_ROTATION, curr_value );
|
curr_value = std::max( -MAX_ROTATION, curr_value );
|
||||||
|
@ -484,7 +499,9 @@ void PANEL_PREVIEW_3D_MODEL::onMouseWheelOffset( wxMouseEvent& event )
|
||||||
if( event.GetWheelRotation() >= 0 )
|
if( event.GetWheelRotation() >= 0 )
|
||||||
step_mm = -step_mm;
|
step_mm = -step_mm;
|
||||||
|
|
||||||
double curr_value_mm = DoubleValueFromString( m_userUnits, textCtrl->GetValue() ) / IU_PER_MM;
|
double curr_value_mm = EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, m_userUnits,
|
||||||
|
textCtrl->GetValue() )
|
||||||
|
/ pcbIUScale.IU_PER_MM;
|
||||||
|
|
||||||
curr_value_mm += step_mm;
|
curr_value_mm += step_mm;
|
||||||
curr_value_mm = std::max( -MAX_OFFSET, curr_value_mm );
|
curr_value_mm = std::max( -MAX_OFFSET, curr_value_mm );
|
||||||
|
|
|
@ -1,400 +0,0 @@
|
||||||
/*
|
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2012 CERN
|
|
||||||
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public License
|
|
||||||
* as published by the Free Software Foundation; either version 2
|
|
||||||
* of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, you may find one here:
|
|
||||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
||||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
||||||
* or you may write to the Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Wayne Stambaugh <stambaughw@gmail.com>
|
|
||||||
* @file base_units.cpp
|
|
||||||
* @brief Code to handle objects that require both schematic and board internal units.
|
|
||||||
* @note This file is an ugly hack to solve the problem of formatting the base units
|
|
||||||
* for either schematics or boards in objects that are include in both domains.
|
|
||||||
* At some point in the future. This code should be rolled back into the
|
|
||||||
* appropriate object and build with the correct internal unit formatting
|
|
||||||
* depending on the application.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <base_units.h>
|
|
||||||
#include <string_utils.h>
|
|
||||||
#include <math/util.h> // for KiROUND
|
|
||||||
#include <macros.h>
|
|
||||||
|
|
||||||
|
|
||||||
#if defined( PCBNEW ) || defined( CVPCB ) || defined( EESCHEMA ) || defined( GERBVIEW ) || defined( PL_EDITOR )
|
|
||||||
#define IU_TO_MM( x ) ( x / IU_PER_MM )
|
|
||||||
#define IU_TO_IN( x ) ( x / IU_PER_MILS / 1000 )
|
|
||||||
#define IU_TO_MILS( x ) ( x / IU_PER_MILS )
|
|
||||||
#define MM_TO_IU( x ) ( x * IU_PER_MM )
|
|
||||||
#define IN_TO_IU( x ) ( x * IU_PER_MILS * 1000 )
|
|
||||||
#define MILS_TO_IU( x ) ( x * IU_PER_MILS )
|
|
||||||
#else
|
|
||||||
#error "Cannot resolve internal units due to no definition of EESCHEMA, CVPCB or PCBNEW."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
double To_User_Unit( EDA_UNITS aUnit, double aValue )
|
|
||||||
{
|
|
||||||
switch( aUnit )
|
|
||||||
{
|
|
||||||
case EDA_UNITS::MILLIMETRES:
|
|
||||||
return IU_TO_MM( aValue );
|
|
||||||
|
|
||||||
case EDA_UNITS::MILS:
|
|
||||||
return IU_TO_MILS( aValue );
|
|
||||||
|
|
||||||
case EDA_UNITS::INCHES:
|
|
||||||
return IU_TO_IN( aValue );
|
|
||||||
|
|
||||||
case EDA_UNITS::DEGREES:
|
|
||||||
return aValue;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return aValue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert a value to a string using double notation.
|
|
||||||
*
|
|
||||||
* For readability, the mantissa has 0, 1, 3 or 4 digits, depending on units
|
|
||||||
* for unit = inch the mantissa has 3 digits (Eeschema) or 4 digits
|
|
||||||
* for unit = mil the mantissa has 0 digits (Eeschema) or 1 digits
|
|
||||||
* for unit = mm the mantissa has 3 digits (Eeschema) or 4 digits
|
|
||||||
* Should be used only to display info in status,
|
|
||||||
* but not in dialogs, because 4 digits only
|
|
||||||
* could truncate the actual value
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
// A lower-precision (for readability) version of StringFromValue()
|
|
||||||
wxString MessageTextFromValue( EDA_UNITS aUnits, int aValue, bool aAddUnitLabel,
|
|
||||||
EDA_DATA_TYPE aType )
|
|
||||||
{
|
|
||||||
return MessageTextFromValue( aUnits, double( aValue ), aAddUnitLabel, aType );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// A lower-precision (for readability) version of StringFromValue()
|
|
||||||
wxString MessageTextFromValue( EDA_UNITS aUnits, long long int aValue, bool aAddUnitLabel,
|
|
||||||
EDA_DATA_TYPE aType )
|
|
||||||
{
|
|
||||||
return MessageTextFromValue( aUnits, double( aValue ), aAddUnitLabel, aType );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
wxString MessageTextFromValue( EDA_ANGLE aValue, bool aAddUnitLabel )
|
|
||||||
{
|
|
||||||
if( aAddUnitLabel )
|
|
||||||
return wxString::Format( wxT( "%.1f°" ), aValue.AsDegrees() );
|
|
||||||
else
|
|
||||||
return wxString::Format( wxT( "%.1f" ), aValue.AsDegrees() );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// A lower-precision (for readability) version of StringFromValue()
|
|
||||||
wxString MessageTextFromValue( EDA_UNITS aUnits, double aValue, bool aAddUnitLabel,
|
|
||||||
EDA_DATA_TYPE aType )
|
|
||||||
{
|
|
||||||
wxString text;
|
|
||||||
const wxChar* format;
|
|
||||||
double value = aValue;
|
|
||||||
|
|
||||||
switch( aType )
|
|
||||||
{
|
|
||||||
case EDA_DATA_TYPE::VOLUME:
|
|
||||||
value = To_User_Unit( aUnits, value );
|
|
||||||
// Fall through to continue computation
|
|
||||||
KI_FALLTHROUGH;
|
|
||||||
|
|
||||||
case EDA_DATA_TYPE::AREA:
|
|
||||||
value = To_User_Unit( aUnits, value );
|
|
||||||
// Fall through to continue computation
|
|
||||||
KI_FALLTHROUGH;
|
|
||||||
|
|
||||||
case EDA_DATA_TYPE::DISTANCE:
|
|
||||||
value = To_User_Unit( aUnits, value );
|
|
||||||
}
|
|
||||||
|
|
||||||
switch( aUnits )
|
|
||||||
{
|
|
||||||
default:
|
|
||||||
case EDA_UNITS::MILLIMETRES:
|
|
||||||
#if defined( EESCHEMA )
|
|
||||||
format = wxT( "%.2f" );
|
|
||||||
#else
|
|
||||||
format = wxT( "%.4f" );
|
|
||||||
#endif
|
|
||||||
break;
|
|
||||||
|
|
||||||
case EDA_UNITS::MILS:
|
|
||||||
#if defined( EESCHEMA )
|
|
||||||
format = wxT( "%.0f" );
|
|
||||||
#else
|
|
||||||
format = wxT( "%.2f" );
|
|
||||||
#endif
|
|
||||||
break;
|
|
||||||
|
|
||||||
case EDA_UNITS::INCHES:
|
|
||||||
#if defined( EESCHEMA )
|
|
||||||
format = wxT( "%.3f" );
|
|
||||||
#else
|
|
||||||
format = wxT( "%.4f" );
|
|
||||||
#endif
|
|
||||||
break;
|
|
||||||
|
|
||||||
case EDA_UNITS::DEGREES:
|
|
||||||
// 3 digits in mantissa should be good for rotation in degree
|
|
||||||
format = wxT( "%.3f" );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case EDA_UNITS::UNSCALED:
|
|
||||||
format = wxT( "%.0f" );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
text.Printf( format, value );
|
|
||||||
|
|
||||||
if( aAddUnitLabel )
|
|
||||||
text += EDA_UNIT_UTILS::GetAbbreviatedUnitsLabel( aUnits, aType );
|
|
||||||
|
|
||||||
return text;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert a value to a string using double notation.
|
|
||||||
*
|
|
||||||
* For readability, the mantissa has 3 or more digits,
|
|
||||||
* the trailing 0 are removed if the mantissa has more than 3 digits
|
|
||||||
* and some trailing 0
|
|
||||||
* This function should be used to display values in dialogs because a value
|
|
||||||
* entered in mm (for instance 2.0 mm) could need up to 8 digits mantissa
|
|
||||||
* if displayed in inch to avoid truncation or rounding made just by the printf function.
|
|
||||||
* otherwise the actual value is rounded when read from dialog and converted
|
|
||||||
* in internal units, and therefore modified.
|
|
||||||
*/
|
|
||||||
wxString StringFromValue( EDA_UNITS aUnits, double aValue, bool aAddUnitSymbol,
|
|
||||||
EDA_DATA_TYPE aType )
|
|
||||||
{
|
|
||||||
double value_to_print = aValue;
|
|
||||||
|
|
||||||
switch( aType )
|
|
||||||
{
|
|
||||||
case EDA_DATA_TYPE::VOLUME:
|
|
||||||
value_to_print = To_User_Unit( aUnits, value_to_print );
|
|
||||||
KI_FALLTHROUGH;
|
|
||||||
|
|
||||||
case EDA_DATA_TYPE::AREA:
|
|
||||||
value_to_print = To_User_Unit( aUnits, value_to_print );
|
|
||||||
KI_FALLTHROUGH;
|
|
||||||
|
|
||||||
case EDA_DATA_TYPE::DISTANCE:
|
|
||||||
value_to_print = To_User_Unit( aUnits, value_to_print );
|
|
||||||
}
|
|
||||||
|
|
||||||
char buf[50];
|
|
||||||
|
|
||||||
if( value_to_print != 0.0 && fabs( value_to_print ) <= 0.0001 )
|
|
||||||
{
|
|
||||||
int len = snprintf( buf, sizeof( buf ) - 1, "%.10f", value_to_print );
|
|
||||||
|
|
||||||
while( --len > 0 && buf[len] == '0' )
|
|
||||||
buf[len] = '\0';
|
|
||||||
|
|
||||||
if( len >= 0 && ( buf[len]=='.' || buf[len]==',' ) )
|
|
||||||
buf[len] = '\0';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
snprintf( buf, sizeof( buf ) - 1, "%.10g", value_to_print );
|
|
||||||
}
|
|
||||||
|
|
||||||
wxString stringValue( buf, wxConvUTF8 );
|
|
||||||
|
|
||||||
if( aAddUnitSymbol )
|
|
||||||
stringValue += EDA_UNIT_UTILS::GetAbbreviatedUnitsLabel( aUnits, aType );
|
|
||||||
|
|
||||||
return stringValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
double From_User_Unit( EDA_UNITS aUnits, double aValue )
|
|
||||||
{
|
|
||||||
switch( aUnits )
|
|
||||||
{
|
|
||||||
case EDA_UNITS::MILLIMETRES:
|
|
||||||
return MM_TO_IU( aValue );
|
|
||||||
|
|
||||||
case EDA_UNITS::MILS:
|
|
||||||
return MILS_TO_IU( aValue );
|
|
||||||
|
|
||||||
case EDA_UNITS::INCHES:
|
|
||||||
return IN_TO_IU( aValue );
|
|
||||||
|
|
||||||
default:
|
|
||||||
case EDA_UNITS::DEGREES:
|
|
||||||
case EDA_UNITS::UNSCALED:
|
|
||||||
case EDA_UNITS::PERCENT:
|
|
||||||
return aValue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
double DoubleValueFromString( EDA_UNITS aUnits, const wxString& aTextValue, EDA_DATA_TYPE aType )
|
|
||||||
{
|
|
||||||
double dtmp = 0;
|
|
||||||
|
|
||||||
// Acquire the 'right' decimal point separator
|
|
||||||
const struct lconv* lc = localeconv();
|
|
||||||
|
|
||||||
wxChar decimal_point = lc->decimal_point[0];
|
|
||||||
wxString buf( aTextValue.Strip( wxString::both ) );
|
|
||||||
|
|
||||||
// Convert any entered decimal point separators to the 'right' one
|
|
||||||
buf.Replace( wxT( "." ), wxString( decimal_point, 1 ) );
|
|
||||||
buf.Replace( wxT( "," ), wxString( decimal_point, 1 ) );
|
|
||||||
|
|
||||||
// Find the end of the numeric part
|
|
||||||
unsigned brk_point = 0;
|
|
||||||
|
|
||||||
while( brk_point < buf.Len() )
|
|
||||||
{
|
|
||||||
wxChar ch = buf[brk_point];
|
|
||||||
|
|
||||||
if( !( (ch >= '0' && ch <= '9') || (ch == decimal_point) || (ch == '-') || (ch == '+') ) )
|
|
||||||
break;
|
|
||||||
|
|
||||||
++brk_point;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Extract the numeric part
|
|
||||||
buf.Left( brk_point ).ToDouble( &dtmp );
|
|
||||||
|
|
||||||
// Check the optional unit designator (2 ch significant)
|
|
||||||
wxString unit( buf.Mid( brk_point ).Strip( wxString::leading ).Left( 2 ).Lower() );
|
|
||||||
|
|
||||||
if( aUnits == EDA_UNITS::MILLIMETRES || aUnits == EDA_UNITS::MILS
|
|
||||||
|| aUnits == EDA_UNITS::INCHES )
|
|
||||||
{
|
|
||||||
if( unit == wxT( "mm" ) )
|
|
||||||
{
|
|
||||||
aUnits = EDA_UNITS::MILLIMETRES;
|
|
||||||
}
|
|
||||||
else if( unit == wxT( "mi" ) || unit == wxT( "th" ) )
|
|
||||||
{
|
|
||||||
aUnits = EDA_UNITS::MILS;
|
|
||||||
}
|
|
||||||
else if( unit == wxT( "in" ) || unit == wxT( "\"" ) )
|
|
||||||
{
|
|
||||||
aUnits = EDA_UNITS::INCHES;
|
|
||||||
}
|
|
||||||
else if( unit == "oz" ) // 1 oz = 1.37 mils
|
|
||||||
{
|
|
||||||
aUnits = EDA_UNITS::MILS;
|
|
||||||
dtmp *= 1.37;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if( aUnits == EDA_UNITS::DEGREES )
|
|
||||||
{
|
|
||||||
if( unit == wxT( "ra" ) ) // Radians
|
|
||||||
dtmp *= 180.0f / M_PI;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch( aType )
|
|
||||||
{
|
|
||||||
case EDA_DATA_TYPE::VOLUME:
|
|
||||||
dtmp = From_User_Unit( aUnits, dtmp );
|
|
||||||
KI_FALLTHROUGH;
|
|
||||||
|
|
||||||
case EDA_DATA_TYPE::AREA:
|
|
||||||
dtmp = From_User_Unit( aUnits, dtmp );
|
|
||||||
KI_FALLTHROUGH;
|
|
||||||
|
|
||||||
case EDA_DATA_TYPE::DISTANCE:
|
|
||||||
dtmp = From_User_Unit( aUnits, dtmp );
|
|
||||||
}
|
|
||||||
|
|
||||||
return dtmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
long long int ValueFromString( EDA_UNITS aUnits, const wxString& aTextValue, EDA_DATA_TYPE aType )
|
|
||||||
{
|
|
||||||
double value = DoubleValueFromString( aUnits, aTextValue, aType );
|
|
||||||
|
|
||||||
return KiROUND<double, long long int>( value );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
std::string FormatInternalUnits( int aValue )
|
|
||||||
{
|
|
||||||
char buf[50];
|
|
||||||
double engUnits = aValue;
|
|
||||||
int len;
|
|
||||||
|
|
||||||
engUnits /= IU_PER_MM;
|
|
||||||
|
|
||||||
if( engUnits != 0.0 && fabs( engUnits ) <= 0.0001 )
|
|
||||||
{
|
|
||||||
len = snprintf( buf, sizeof(buf), "%.10f", engUnits );
|
|
||||||
|
|
||||||
// Make sure snprintf() didn't fail and the locale numeric separator is correct.
|
|
||||||
wxCHECK( len >= 0 && len < 50 && strchr( buf, ',' ) == nullptr, std::string( "" ) );
|
|
||||||
|
|
||||||
while( --len > 0 && buf[len] == '0' )
|
|
||||||
buf[len] = '\0';
|
|
||||||
|
|
||||||
if( buf[len] == '.' )
|
|
||||||
buf[len] = '\0';
|
|
||||||
else
|
|
||||||
++len;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
len = snprintf( buf, sizeof(buf), "%.10g", engUnits );
|
|
||||||
|
|
||||||
// Make sure snprintf() didn't fail and the locale numeric separator is correct.
|
|
||||||
wxCHECK( len >= 0 && len < 50 && strchr( buf, ',' ) == nullptr , std::string( "" ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
return std::string( buf, len );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
std::string FormatInternalUnits( const wxPoint& aPoint )
|
|
||||||
{
|
|
||||||
return FormatInternalUnits( aPoint.x ) + " " + FormatInternalUnits( aPoint.y );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
std::string FormatInternalUnits( const VECTOR2I& aPoint )
|
|
||||||
{
|
|
||||||
return FormatInternalUnits( aPoint.x ) + " " + FormatInternalUnits( aPoint.y );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
std::string FormatInternalUnits( const wxSize& aSize )
|
|
||||||
{
|
|
||||||
return FormatInternalUnits( aSize.GetWidth() ) + " " + FormatInternalUnits( aSize.GetHeight() );
|
|
||||||
}
|
|
|
@ -118,8 +118,10 @@ bool DIALOG_GRID_SETTINGS::TransferDataFromWindow()
|
||||||
|
|
||||||
gridCfg.last_size_idx = m_currentGridCtrl->GetSelection();
|
gridCfg.last_size_idx = m_currentGridCtrl->GetSelection();
|
||||||
m_parent->SetGridOrigin( wxPoint( m_gridOriginX.GetValue(), m_gridOriginY.GetValue() ) );
|
m_parent->SetGridOrigin( wxPoint( m_gridOriginX.GetValue(), m_gridOriginY.GetValue() ) );
|
||||||
gridCfg.user_grid_x = StringFromValue( GetUserUnits(), m_userGridX.GetValue(), true );
|
gridCfg.user_grid_x = EDA_UNIT_UTILS::UI::StringFromValue( m_parent->GetIuScale(), GetUserUnits(),
|
||||||
gridCfg.user_grid_y = StringFromValue( GetUserUnits(), m_userGridY.GetValue(), true );
|
m_userGridX.GetValue(), true );
|
||||||
|
gridCfg.user_grid_y = EDA_UNIT_UTILS::UI::StringFromValue( m_parent->GetIuScale(), GetUserUnits(),
|
||||||
|
m_userGridY.GetValue(), true );
|
||||||
gridCfg.fast_grid_1 = m_grid1Ctrl->GetSelection();
|
gridCfg.fast_grid_1 = m_grid1Ctrl->GetSelection();
|
||||||
gridCfg.fast_grid_2 = m_grid2Ctrl->GetSelection();
|
gridCfg.fast_grid_2 = m_grid2Ctrl->GetSelection();
|
||||||
|
|
||||||
|
@ -148,8 +150,10 @@ bool DIALOG_GRID_SETTINGS::TransferDataToWindow()
|
||||||
|
|
||||||
m_currentGridCtrl->SetSelection( settings->m_Window.grid.last_size_idx );
|
m_currentGridCtrl->SetSelection( settings->m_Window.grid.last_size_idx );
|
||||||
|
|
||||||
m_userGridX.SetValue( ValueFromString( GetUserUnits(), gridCfg.user_grid_x ) );
|
m_userGridX.SetValue( EDA_UNIT_UTILS::UI::ValueFromString( m_parent->GetIuScale(),
|
||||||
m_userGridY.SetValue( ValueFromString( GetUserUnits(), gridCfg.user_grid_y ) );
|
GetUserUnits(), gridCfg.user_grid_x ) );
|
||||||
|
m_userGridY.SetValue( EDA_UNIT_UTILS::UI::ValueFromString( m_parent->GetIuScale(),
|
||||||
|
GetUserUnits(), gridCfg.user_grid_y ) );
|
||||||
|
|
||||||
m_gridOriginX.SetValue( m_parent->GetGridOrigin().x );
|
m_gridOriginX.SetValue( m_parent->GetGridOrigin().x );
|
||||||
m_gridOriginY.SetValue( m_parent->GetGridOrigin().y );
|
m_gridOriginY.SetValue( m_parent->GetGridOrigin().y );
|
||||||
|
|
|
@ -235,10 +235,11 @@ bool PANEL_SETUP_NETCLASSES::TransferDataToWindow()
|
||||||
int row = 0;
|
int row = 0;
|
||||||
|
|
||||||
auto setCell =
|
auto setCell =
|
||||||
[&]( int aRow, int aCol, int aValue )
|
[&]( int aRow, int aCol, int aValue )
|
||||||
{
|
{
|
||||||
m_netclassGrid->SetCellValue( aRow, aCol, StringFromValue( units, aValue, true ) );
|
m_netclassGrid->SetCellValue( aRow, aCol,
|
||||||
};
|
EDA_UNIT_UTILS::UI::StringFromValue( m_frame->GetIuScale(), units, aValue, true ) );
|
||||||
|
};
|
||||||
|
|
||||||
auto netclassToGridRow =
|
auto netclassToGridRow =
|
||||||
[&]( int aRow, const std::shared_ptr<NETCLASS>& nc )
|
[&]( int aRow, const std::shared_ptr<NETCLASS>& nc )
|
||||||
|
@ -341,7 +342,7 @@ bool PANEL_SETUP_NETCLASSES::TransferDataFromWindow()
|
||||||
auto getCell =
|
auto getCell =
|
||||||
[this, units]( int aRow, int aCol ) -> long long int
|
[this, units]( int aRow, int aCol ) -> long long int
|
||||||
{
|
{
|
||||||
return ValueFromString( units, m_netclassGrid->GetCellValue( aRow, aCol ) );
|
return EDA_UNIT_UTILS::UI::ValueFromString( m_frame->GetIuScale(),units, m_netclassGrid->GetCellValue( aRow, aCol ) );
|
||||||
};
|
};
|
||||||
|
|
||||||
auto getCellStr =
|
auto getCellStr =
|
||||||
|
|
|
@ -139,15 +139,19 @@ void DS_DRAW_ITEM_BASE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame,
|
||||||
|
|
||||||
aList.emplace_back( _( "First Page Option" ), msg );
|
aList.emplace_back( _( "First Page Option" ), msg );
|
||||||
|
|
||||||
msg = MessageTextFromValue( EDA_UNITS::UNSCALED, dataItem->m_RepeatCount );
|
msg = EDA_UNIT_UTILS::UI::MessageTextFromValue( aFrame->GetIuScale(), EDA_UNITS::UNSCALED,
|
||||||
|
dataItem->m_RepeatCount );
|
||||||
aList.emplace_back( _( "Repeat Count" ), msg );
|
aList.emplace_back( _( "Repeat Count" ), msg );
|
||||||
|
|
||||||
msg = MessageTextFromValue( EDA_UNITS::UNSCALED, dataItem->m_IncrementLabel );
|
msg = EDA_UNIT_UTILS::UI::MessageTextFromValue( aFrame->GetIuScale(), EDA_UNITS::UNSCALED,
|
||||||
|
dataItem->m_IncrementLabel );
|
||||||
aList.emplace_back( _( "Repeat Label Increment" ), msg );
|
aList.emplace_back( _( "Repeat Label Increment" ), msg );
|
||||||
|
|
||||||
msg.Printf( wxT( "(%s, %s)" ),
|
msg.Printf( wxT( "(%s, %s)" ),
|
||||||
MessageTextFromValue( aFrame->GetUserUnits(), dataItem->m_IncrementVector.x ),
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( aFrame->GetIuScale(), aFrame->GetUserUnits(),
|
||||||
MessageTextFromValue( aFrame->GetUserUnits(), dataItem->m_IncrementVector.y ) );
|
dataItem->m_IncrementVector.x ),
|
||||||
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( aFrame->GetIuScale(), aFrame->GetUserUnits(),
|
||||||
|
dataItem->m_IncrementVector.y ) );
|
||||||
|
|
||||||
aList.emplace_back( _( "Repeat Position Increment" ), msg );
|
aList.emplace_back( _( "Repeat Position Increment" ), msg );
|
||||||
|
|
||||||
|
@ -380,8 +384,10 @@ bool DS_DRAW_ITEM_RECT::HitTest( const BOX2I& aRect, bool aContained, int aAccur
|
||||||
wxString DS_DRAW_ITEM_RECT::GetSelectMenuText( EDA_UNITS aUnits ) const
|
wxString DS_DRAW_ITEM_RECT::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||||
{
|
{
|
||||||
return wxString::Format( _( "Rectangle, width %s height %s" ),
|
return wxString::Format( _( "Rectangle, width %s height %s" ),
|
||||||
MessageTextFromValue( aUnits, std::abs( GetStart().x - GetEnd().x ) ),
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( drawSheetIUScale, aUnits,
|
||||||
MessageTextFromValue( aUnits, std::abs( GetStart().y - GetEnd().y ) ) );
|
std::abs( GetStart().x - GetEnd().x ) ),
|
||||||
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( drawSheetIUScale, aUnits,
|
||||||
|
std::abs( GetStart().y - GetEnd().y ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -413,7 +419,7 @@ bool DS_DRAW_ITEM_LINE::HitTest( const VECTOR2I& aPosition, int aAccuracy ) cons
|
||||||
wxString DS_DRAW_ITEM_LINE::GetSelectMenuText( EDA_UNITS aUnits ) const
|
wxString DS_DRAW_ITEM_LINE::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||||
{
|
{
|
||||||
return wxString::Format( _( "Line, length %s" ),
|
return wxString::Format( _( "Line, length %s" ),
|
||||||
MessageTextFromValue( aUnits, EuclideanNorm( GetStart() - GetEnd() ) ) );
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( drawSheetIUScale, aUnits, EuclideanNorm( GetStart() - GetEnd() ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -81,8 +81,9 @@ END_EVENT_TABLE()
|
||||||
|
|
||||||
EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType,
|
EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType,
|
||||||
const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize,
|
const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize,
|
||||||
long aStyle, const wxString & aFrameName ) :
|
long aStyle, const wxString& aFrameName, const EDA_IU_SCALE& aIuScale ) :
|
||||||
KIWAY_PLAYER( aKiway, aParent, aFrameType, aTitle, aPos, aSize, aStyle, aFrameName )
|
KIWAY_PLAYER( aKiway, aParent, aFrameType, aTitle, aPos, aSize, aStyle, aFrameName ),
|
||||||
|
m_iuScale( aIuScale )
|
||||||
{
|
{
|
||||||
m_socketServer = nullptr;
|
m_socketServer = nullptr;
|
||||||
m_mainToolBar = nullptr;
|
m_mainToolBar = nullptr;
|
||||||
|
@ -577,9 +578,10 @@ void EDA_DRAW_FRAME::DisplayGridMsg()
|
||||||
{
|
{
|
||||||
wxString line;
|
wxString line;
|
||||||
|
|
||||||
line.Printf( "grid %s",
|
line.Printf( "grid %s", EDA_UNIT_UTILS::UI::MessageTextFromValue(
|
||||||
MessageTextFromValue( GetUserUnits(), GetCanvas()->GetGAL()->GetGridSize().x,
|
GetIuScale(), GetUserUnits(),
|
||||||
false ) );
|
GetCanvas()->GetGAL()->GetGridSize().x,
|
||||||
|
false ) );
|
||||||
|
|
||||||
SetStatusText( line, 4 );
|
SetStatusText( line, 4 );
|
||||||
}
|
}
|
||||||
|
|
|
@ -574,24 +574,24 @@ void EDA_SHAPE::ShapeGetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PA
|
||||||
case SHAPE_T::CIRCLE:
|
case SHAPE_T::CIRCLE:
|
||||||
aList.emplace_back( shape, _( "Circle" ) );
|
aList.emplace_back( shape, _( "Circle" ) );
|
||||||
|
|
||||||
msg = MessageTextFromValue( units, GetRadius() );
|
msg = EDA_UNIT_UTILS::UI::MessageTextFromValue( aFrame->GetIuScale(), units, GetRadius() );
|
||||||
aList.emplace_back( _( "Radius" ), msg );
|
aList.emplace_back( _( "Radius" ), msg );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SHAPE_T::ARC:
|
case SHAPE_T::ARC:
|
||||||
aList.emplace_back( shape, _( "Arc" ) );
|
aList.emplace_back( shape, _( "Arc" ) );
|
||||||
|
|
||||||
msg = MessageTextFromValue( GetArcAngle() );
|
msg = EDA_UNIT_UTILS::UI::MessageTextFromValue( GetArcAngle() );
|
||||||
aList.emplace_back( _( "Angle" ), msg );
|
aList.emplace_back( _( "Angle" ), msg );
|
||||||
|
|
||||||
msg = MessageTextFromValue( units, GetRadius() );
|
msg = EDA_UNIT_UTILS::UI::MessageTextFromValue( aFrame->GetIuScale(), units, GetRadius() );
|
||||||
aList.emplace_back( _( "Radius" ), msg );
|
aList.emplace_back( _( "Radius" ), msg );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SHAPE_T::BEZIER:
|
case SHAPE_T::BEZIER:
|
||||||
aList.emplace_back( shape, _( "Curve" ) );
|
aList.emplace_back( shape, _( "Curve" ) );
|
||||||
|
|
||||||
msg = MessageTextFromValue( units, GetLength() );
|
msg = EDA_UNIT_UTILS::UI::MessageTextFromValue( aFrame->GetIuScale(), units, GetLength() );
|
||||||
aList.emplace_back( _( "Length" ), msg );
|
aList.emplace_back( _( "Length" ), msg );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -608,10 +608,12 @@ void EDA_SHAPE::ShapeGetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PA
|
||||||
else
|
else
|
||||||
aList.emplace_back( shape, _( "Rectangle" ) );
|
aList.emplace_back( shape, _( "Rectangle" ) );
|
||||||
|
|
||||||
msg = MessageTextFromValue( units, std::abs( GetEnd().x - GetStart().x ) );
|
msg = EDA_UNIT_UTILS::UI::MessageTextFromValue( aFrame->GetIuScale(), units,
|
||||||
|
std::abs( GetEnd().x - GetStart().x ) );
|
||||||
aList.emplace_back( _( "Width" ), msg );
|
aList.emplace_back( _( "Width" ), msg );
|
||||||
|
|
||||||
msg = MessageTextFromValue( units, std::abs( GetEnd().y - GetStart().y ) );
|
msg = EDA_UNIT_UTILS::UI::MessageTextFromValue( aFrame->GetIuScale(), units,
|
||||||
|
std::abs( GetEnd().y - GetStart().y ) );
|
||||||
aList.emplace_back( _( "Height" ), msg );
|
aList.emplace_back( _( "Height" ), msg );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -619,13 +621,14 @@ void EDA_SHAPE::ShapeGetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PA
|
||||||
{
|
{
|
||||||
aList.emplace_back( shape, _( "Segment" ) );
|
aList.emplace_back( shape, _( "Segment" ) );
|
||||||
|
|
||||||
msg = MessageTextFromValue( units, GetLineLength( GetStart(), GetEnd() ) );
|
msg = EDA_UNIT_UTILS::UI::MessageTextFromValue( aFrame->GetIuScale(), units,
|
||||||
|
GetLineLength( GetStart(), GetEnd() ) );
|
||||||
aList.emplace_back( _( "Length" ), msg );
|
aList.emplace_back( _( "Length" ), msg );
|
||||||
|
|
||||||
// angle counter-clockwise from 3'o-clock
|
// angle counter-clockwise from 3'o-clock
|
||||||
EDA_ANGLE angle( atan2( (double)( GetStart().y - GetEnd().y ),
|
EDA_ANGLE angle( atan2( (double)( GetStart().y - GetEnd().y ),
|
||||||
(double)( GetEnd().x - GetStart().x ) ), RADIANS_T );
|
(double)( GetEnd().x - GetStart().x ) ), RADIANS_T );
|
||||||
aList.emplace_back( _( "Angle" ), MessageTextFromValue( angle ) );
|
aList.emplace_back( _( "Angle" ), EDA_UNIT_UTILS::UI::MessageTextFromValue( angle ) );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -634,7 +637,7 @@ void EDA_SHAPE::ShapeGetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PA
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_stroke.GetMsgPanelInfo( units, aList );
|
m_stroke.GetMsgPanelInfo( aFrame->GetIuScale(), units, aList );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -87,18 +87,21 @@ GR_TEXT_V_ALIGN_T EDA_TEXT::MapVertJustify( int aVertJustify )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EDA_TEXT::EDA_TEXT( int aDefaultSizeIu, const wxString& aText ) :
|
EDA_TEXT::EDA_TEXT( const EDA_IU_SCALE& aIuScale, const wxString& aText ) :
|
||||||
m_text( aText ),
|
m_text( aText ),
|
||||||
|
m_IuScale( aIuScale ),
|
||||||
m_bounding_box_cache_valid( false ),
|
m_bounding_box_cache_valid( false ),
|
||||||
m_bounding_box_cache_line( -1 ),
|
m_bounding_box_cache_line( -1 ),
|
||||||
m_bounding_box_cache_inverted( false )
|
m_bounding_box_cache_inverted( false )
|
||||||
{
|
{
|
||||||
SetTextSize( VECTOR2I( aDefaultSizeIu, aDefaultSizeIu ) );
|
SetTextSize( VECTOR2I( EDA_UNIT_UTILS::Mils2IU( m_IuScale, DEFAULT_SIZE_TEXT ),
|
||||||
|
EDA_UNIT_UTILS::Mils2IU( m_IuScale, DEFAULT_SIZE_TEXT ) ) );
|
||||||
cacheShownText();
|
cacheShownText();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EDA_TEXT::EDA_TEXT( const EDA_TEXT& aText )
|
EDA_TEXT::EDA_TEXT( const EDA_TEXT& aText ) :
|
||||||
|
m_IuScale( aText.m_IuScale )
|
||||||
{
|
{
|
||||||
m_text = aText.m_text;
|
m_text = aText.m_text;
|
||||||
m_shown_text = aText.m_shown_text;
|
m_shown_text = aText.m_shown_text;
|
||||||
|
@ -780,8 +783,8 @@ void EDA_TEXT::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControl
|
||||||
|
|
||||||
// Text size
|
// Text size
|
||||||
aFormatter->Print( 0, " (size %s %s)",
|
aFormatter->Print( 0, " (size %s %s)",
|
||||||
FormatInternalUnits( GetTextHeight() ).c_str(),
|
EDA_UNIT_UTILS::FormatInternalUnits( m_IuScale, GetTextHeight() ).c_str(),
|
||||||
FormatInternalUnits( GetTextWidth() ).c_str() );
|
EDA_UNIT_UTILS::FormatInternalUnits( m_IuScale, GetTextWidth() ).c_str() );
|
||||||
|
|
||||||
if( GetLineSpacing() != 1.0 )
|
if( GetLineSpacing() != 1.0 )
|
||||||
{
|
{
|
||||||
|
@ -792,7 +795,7 @@ void EDA_TEXT::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControl
|
||||||
if( GetTextThickness() )
|
if( GetTextThickness() )
|
||||||
{
|
{
|
||||||
aFormatter->Print( 0, " (thickness %s)",
|
aFormatter->Print( 0, " (thickness %s)",
|
||||||
FormatInternalUnits( GetTextThickness() ).c_str() );
|
EDA_UNIT_UTILS::FormatInternalUnits( m_IuScale, GetTextThickness() ).c_str() );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( IsBold() )
|
if( IsBold() )
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
#include <eda_units.h>
|
#include <eda_units.h>
|
||||||
#include <math/util.h> // for KiROUND
|
#include <math/util.h> // for KiROUND
|
||||||
|
#include <convert_to_biu.h>
|
||||||
#include <macros.h>
|
#include <macros.h>
|
||||||
|
|
||||||
bool EDA_UNIT_UTILS::IsImperialUnit( EDA_UNITS aUnit )
|
bool EDA_UNIT_UTILS::IsImperialUnit( EDA_UNITS aUnit )
|
||||||
|
@ -133,4 +134,417 @@ std::string EDA_UNIT_UTILS::FormatAngle( const EDA_ANGLE& aAngle )
|
||||||
len = snprintf( temp, sizeof( temp ), "%.10g", aAngle.AsDegrees() );
|
len = snprintf( temp, sizeof( temp ), "%.10g", aAngle.AsDegrees() );
|
||||||
|
|
||||||
return std::string( temp, len );
|
return std::string( temp, len );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
std::string EDA_UNIT_UTILS::FormatInternalUnits( const EDA_IU_SCALE& aIuScale, int aValue )
|
||||||
|
{
|
||||||
|
char buf[50];
|
||||||
|
double engUnits = aValue;
|
||||||
|
int len;
|
||||||
|
|
||||||
|
engUnits /= aIuScale.IU_PER_MM;
|
||||||
|
|
||||||
|
if( engUnits != 0.0 && fabs( engUnits ) <= 0.0001 )
|
||||||
|
{
|
||||||
|
len = snprintf( buf, sizeof( buf ), "%.10f", engUnits );
|
||||||
|
|
||||||
|
// Make sure snprintf() didn't fail and the locale numeric separator is correct.
|
||||||
|
wxCHECK( len >= 0 && len < 50 && strchr( buf, ',' ) == nullptr, std::string( "" ) );
|
||||||
|
|
||||||
|
while( --len > 0 && buf[len] == '0' )
|
||||||
|
buf[len] = '\0';
|
||||||
|
|
||||||
|
if( buf[len] == '.' )
|
||||||
|
buf[len] = '\0';
|
||||||
|
else
|
||||||
|
++len;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
len = snprintf( buf, sizeof( buf ), "%.10g", engUnits );
|
||||||
|
|
||||||
|
// Make sure snprintf() didn't fail and the locale numeric separator is correct.
|
||||||
|
wxCHECK( len >= 0 && len < 50 && strchr( buf, ',' ) == nullptr, std::string( "" ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
return std::string( buf, len );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
std::string EDA_UNIT_UTILS::FormatInternalUnits( const EDA_IU_SCALE& aIuScale,
|
||||||
|
const wxPoint& aPoint )
|
||||||
|
{
|
||||||
|
return FormatInternalUnits( aIuScale, aPoint.x ) + " "
|
||||||
|
+ FormatInternalUnits( aIuScale, aPoint.y );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
std::string EDA_UNIT_UTILS::FormatInternalUnits( const EDA_IU_SCALE& aIuScale,
|
||||||
|
const VECTOR2I& aPoint )
|
||||||
|
{
|
||||||
|
return FormatInternalUnits( aIuScale, aPoint.x ) + " "
|
||||||
|
+ FormatInternalUnits( aIuScale, aPoint.y );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
std::string EDA_UNIT_UTILS::FormatInternalUnits( const EDA_IU_SCALE& aIuScale, const wxSize& aSize )
|
||||||
|
{
|
||||||
|
return FormatInternalUnits( aIuScale, aSize.GetWidth() ) + " "
|
||||||
|
+ FormatInternalUnits( aIuScale, aSize.GetHeight() );
|
||||||
|
}
|
||||||
|
|
||||||
|
#define IU_TO_MM( x, scale ) ( x / scale.IU_PER_MM )
|
||||||
|
#define IU_TO_IN( x, scale ) ( x / scale.IU_PER_MILS / 1000 )
|
||||||
|
#define IU_TO_MILS( x, scale ) ( x / scale.IU_PER_MILS )
|
||||||
|
#define MM_TO_IU( x, scale ) ( x * scale.IU_PER_MM )
|
||||||
|
#define IN_TO_IU( x, scale ) ( x * scale.IU_PER_MILS * 1000 )
|
||||||
|
#define MILS_TO_IU( x, scale ) ( x * scale.IU_PER_MILS )
|
||||||
|
|
||||||
|
double EDA_UNIT_UTILS::UI::ToUserUnit( const EDA_IU_SCALE& aIuScale, EDA_UNITS aUnit,
|
||||||
|
double aValue )
|
||||||
|
{
|
||||||
|
switch( aUnit )
|
||||||
|
{
|
||||||
|
case EDA_UNITS::MILLIMETRES:
|
||||||
|
return IU_TO_MM( aValue, aIuScale );
|
||||||
|
|
||||||
|
case EDA_UNITS::MILS:
|
||||||
|
return IU_TO_MILS( aValue, aIuScale );
|
||||||
|
|
||||||
|
case EDA_UNITS::INCHES:
|
||||||
|
return IU_TO_IN( aValue, aIuScale );
|
||||||
|
|
||||||
|
case EDA_UNITS::DEGREES:
|
||||||
|
return aValue;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return aValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert a value to a string using double notation.
|
||||||
|
*
|
||||||
|
* For readability, the mantissa has 3 or more digits,
|
||||||
|
* the trailing 0 are removed if the mantissa has more than 3 digits
|
||||||
|
* and some trailing 0
|
||||||
|
* This function should be used to display values in dialogs because a value
|
||||||
|
* entered in mm (for instance 2.0 mm) could need up to 8 digits mantissa
|
||||||
|
* if displayed in inch to avoid truncation or rounding made just by the printf function.
|
||||||
|
* otherwise the actual value is rounded when read from dialog and converted
|
||||||
|
* in internal units, and therefore modified.
|
||||||
|
*/
|
||||||
|
wxString EDA_UNIT_UTILS::UI::StringFromValue( const EDA_IU_SCALE& aIuScale, EDA_UNITS aUnits,
|
||||||
|
double aValue, bool aAddUnitSymbol,
|
||||||
|
EDA_DATA_TYPE aType )
|
||||||
|
{
|
||||||
|
double value_to_print = aValue;
|
||||||
|
|
||||||
|
switch( aType )
|
||||||
|
{
|
||||||
|
case EDA_DATA_TYPE::VOLUME:
|
||||||
|
value_to_print = ToUserUnit( aIuScale, aUnits, value_to_print );
|
||||||
|
KI_FALLTHROUGH;
|
||||||
|
|
||||||
|
case EDA_DATA_TYPE::AREA:
|
||||||
|
value_to_print = ToUserUnit( aIuScale, aUnits, value_to_print );
|
||||||
|
KI_FALLTHROUGH;
|
||||||
|
|
||||||
|
case EDA_DATA_TYPE::DISTANCE:
|
||||||
|
value_to_print = ToUserUnit( aIuScale, aUnits, value_to_print );
|
||||||
|
}
|
||||||
|
|
||||||
|
char buf[50];
|
||||||
|
|
||||||
|
if( value_to_print != 0.0 && fabs( value_to_print ) <= 0.0001 )
|
||||||
|
{
|
||||||
|
int len = snprintf( buf, sizeof( buf ) - 1, "%.10f", value_to_print );
|
||||||
|
|
||||||
|
while( --len > 0 && buf[len] == '0' )
|
||||||
|
buf[len] = '\0';
|
||||||
|
|
||||||
|
if( len >= 0 && ( buf[len] == '.' || buf[len] == ',' ) )
|
||||||
|
buf[len] = '\0';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
snprintf( buf, sizeof( buf ) - 1, "%.10g", value_to_print );
|
||||||
|
}
|
||||||
|
|
||||||
|
wxString stringValue( buf, wxConvUTF8 );
|
||||||
|
|
||||||
|
if( aAddUnitSymbol )
|
||||||
|
stringValue += EDA_UNIT_UTILS::GetAbbreviatedUnitsLabel( aUnits, aType );
|
||||||
|
|
||||||
|
return stringValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert a value to a string using double notation.
|
||||||
|
*
|
||||||
|
* For readability, the mantissa has 0, 1, 3 or 4 digits, depending on units
|
||||||
|
* for unit = inch the mantissa has 3 digits (Eeschema) or 4 digits
|
||||||
|
* for unit = mil the mantissa has 0 digits (Eeschema) or 1 digits
|
||||||
|
* for unit = mm the mantissa has 3 digits (Eeschema) or 4 digits
|
||||||
|
* Should be used only to display info in status,
|
||||||
|
* but not in dialogs, because 4 digits only
|
||||||
|
* could truncate the actual value
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
// A lower-precision (for readability) version of StringFromValue()
|
||||||
|
wxString EDA_UNIT_UTILS::UI::MessageTextFromValue( const EDA_IU_SCALE& aIuScale, EDA_UNITS aUnits,
|
||||||
|
int aValue,
|
||||||
|
bool aAddUnitLabel,
|
||||||
|
EDA_DATA_TYPE aType )
|
||||||
|
{
|
||||||
|
return MessageTextFromValue( aIuScale, aUnits, double( aValue ), aAddUnitLabel, aType );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// A lower-precision (for readability) version of StringFromValue()
|
||||||
|
wxString EDA_UNIT_UTILS::UI::MessageTextFromValue( const EDA_IU_SCALE& aIuScale, EDA_UNITS aUnits,
|
||||||
|
long long int aValue,
|
||||||
|
bool aAddUnitLabel,
|
||||||
|
EDA_DATA_TYPE aType )
|
||||||
|
{
|
||||||
|
return MessageTextFromValue( aIuScale, aUnits, double( aValue ), aAddUnitLabel, aType );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
wxString EDA_UNIT_UTILS::UI::MessageTextFromValue( EDA_ANGLE aValue, bool aAddUnitLabel )
|
||||||
|
{
|
||||||
|
if( aAddUnitLabel )
|
||||||
|
return wxString::Format( wxT( "%.1f°" ), aValue.AsDegrees() );
|
||||||
|
else
|
||||||
|
return wxString::Format( wxT( "%.1f" ), aValue.AsDegrees() );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// A lower-precision (for readability) version of StringFromValue()
|
||||||
|
wxString EDA_UNIT_UTILS::UI::MessageTextFromValue( const EDA_IU_SCALE& aIuScale, EDA_UNITS aUnits,
|
||||||
|
double aValue, bool aAddUnitLabel,
|
||||||
|
EDA_DATA_TYPE aType )
|
||||||
|
{
|
||||||
|
wxString text;
|
||||||
|
const wxChar* format;
|
||||||
|
double value = aValue;
|
||||||
|
|
||||||
|
switch( aType )
|
||||||
|
{
|
||||||
|
case EDA_DATA_TYPE::VOLUME:
|
||||||
|
value = ToUserUnit( aIuScale, aUnits, value );
|
||||||
|
// Fall through to continue computation
|
||||||
|
KI_FALLTHROUGH;
|
||||||
|
|
||||||
|
case EDA_DATA_TYPE::AREA:
|
||||||
|
value = ToUserUnit( aIuScale, aUnits, value );
|
||||||
|
// Fall through to continue computation
|
||||||
|
KI_FALLTHROUGH;
|
||||||
|
|
||||||
|
case EDA_DATA_TYPE::DISTANCE:
|
||||||
|
value = ToUserUnit( aIuScale, aUnits, value );
|
||||||
|
}
|
||||||
|
|
||||||
|
switch( aUnits )
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
case EDA_UNITS::MILLIMETRES:
|
||||||
|
#if defined( EESCHEMA )
|
||||||
|
format = wxT( "%.2f" );
|
||||||
|
#else
|
||||||
|
format = wxT( "%.4f" );
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EDA_UNITS::MILS:
|
||||||
|
#if defined( EESCHEMA )
|
||||||
|
format = wxT( "%.0f" );
|
||||||
|
#else
|
||||||
|
format = wxT( "%.2f" );
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EDA_UNITS::INCHES:
|
||||||
|
#if defined( EESCHEMA )
|
||||||
|
format = wxT( "%.3f" );
|
||||||
|
#else
|
||||||
|
format = wxT( "%.4f" );
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EDA_UNITS::DEGREES:
|
||||||
|
// 3 digits in mantissa should be good for rotation in degree
|
||||||
|
format = wxT( "%.3f" );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EDA_UNITS::UNSCALED:
|
||||||
|
format = wxT( "%.0f" );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
text.Printf( format, value );
|
||||||
|
|
||||||
|
if( aAddUnitLabel )
|
||||||
|
text += EDA_UNIT_UTILS::GetAbbreviatedUnitsLabel( aUnits, aType );
|
||||||
|
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
double EDA_UNIT_UTILS::UI::FromUserUnit( const EDA_IU_SCALE& aIuScale, EDA_UNITS aUnits,
|
||||||
|
double aValue )
|
||||||
|
{
|
||||||
|
switch( aUnits )
|
||||||
|
{
|
||||||
|
case EDA_UNITS::MILLIMETRES:
|
||||||
|
return MM_TO_IU( aValue, aIuScale );
|
||||||
|
|
||||||
|
case EDA_UNITS::MILS:
|
||||||
|
return MILS_TO_IU( aValue, aIuScale );
|
||||||
|
|
||||||
|
case EDA_UNITS::INCHES:
|
||||||
|
return IN_TO_IU( aValue, aIuScale );
|
||||||
|
|
||||||
|
default:
|
||||||
|
case EDA_UNITS::DEGREES:
|
||||||
|
case EDA_UNITS::UNSCALED:
|
||||||
|
case EDA_UNITS::PERCENT:
|
||||||
|
return aValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
double EDA_UNIT_UTILS::UI::DoubleValueFromString( const wxString& aTextValue )
|
||||||
|
{
|
||||||
|
double dtmp = 0;
|
||||||
|
|
||||||
|
// Acquire the 'right' decimal point separator
|
||||||
|
const struct lconv* lc = localeconv();
|
||||||
|
|
||||||
|
wxChar decimal_point = lc->decimal_point[0];
|
||||||
|
wxString buf( aTextValue.Strip( wxString::both ) );
|
||||||
|
|
||||||
|
// Convert any entered decimal point separators to the 'right' one
|
||||||
|
buf.Replace( wxT( "." ), wxString( decimal_point, 1 ) );
|
||||||
|
buf.Replace( wxT( "," ), wxString( decimal_point, 1 ) );
|
||||||
|
|
||||||
|
// Find the end of the numeric part
|
||||||
|
unsigned brk_point = 0;
|
||||||
|
|
||||||
|
while( brk_point < buf.Len() )
|
||||||
|
{
|
||||||
|
wxChar ch = buf[brk_point];
|
||||||
|
|
||||||
|
if( !( ( ch >= '0' && ch <= '9' ) || ( ch == decimal_point ) || ( ch == '-' )
|
||||||
|
|| ( ch == '+' ) ) )
|
||||||
|
break;
|
||||||
|
|
||||||
|
++brk_point;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Extract the numeric part
|
||||||
|
buf.Left( brk_point ).ToDouble( &dtmp );
|
||||||
|
|
||||||
|
return dtmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
double EDA_UNIT_UTILS::UI::DoubleValueFromString( const EDA_IU_SCALE& aIuScale, EDA_UNITS aUnits,
|
||||||
|
const wxString& aTextValue, EDA_DATA_TYPE aType )
|
||||||
|
{
|
||||||
|
double dtmp = 0;
|
||||||
|
|
||||||
|
// Acquire the 'right' decimal point separator
|
||||||
|
const struct lconv* lc = localeconv();
|
||||||
|
|
||||||
|
wxChar decimal_point = lc->decimal_point[0];
|
||||||
|
wxString buf( aTextValue.Strip( wxString::both ) );
|
||||||
|
|
||||||
|
// Convert any entered decimal point separators to the 'right' one
|
||||||
|
buf.Replace( wxT( "." ), wxString( decimal_point, 1 ) );
|
||||||
|
buf.Replace( wxT( "," ), wxString( decimal_point, 1 ) );
|
||||||
|
|
||||||
|
// Find the end of the numeric part
|
||||||
|
unsigned brk_point = 0;
|
||||||
|
|
||||||
|
while( brk_point < buf.Len() )
|
||||||
|
{
|
||||||
|
wxChar ch = buf[brk_point];
|
||||||
|
|
||||||
|
if( !( (ch >= '0' && ch <= '9') || (ch == decimal_point) || (ch == '-') || (ch == '+') ) )
|
||||||
|
break;
|
||||||
|
|
||||||
|
++brk_point;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Extract the numeric part
|
||||||
|
buf.Left( brk_point ).ToDouble( &dtmp );
|
||||||
|
|
||||||
|
// Check the optional unit designator (2 ch significant)
|
||||||
|
wxString unit( buf.Mid( brk_point ).Strip( wxString::leading ).Left( 2 ).Lower() );
|
||||||
|
|
||||||
|
if( aUnits == EDA_UNITS::MILLIMETRES || aUnits == EDA_UNITS::MILS
|
||||||
|
|| aUnits == EDA_UNITS::INCHES )
|
||||||
|
{
|
||||||
|
if( unit == wxT( "mm" ) )
|
||||||
|
{
|
||||||
|
aUnits = EDA_UNITS::MILLIMETRES;
|
||||||
|
}
|
||||||
|
else if( unit == wxT( "mi" ) || unit == wxT( "th" ) )
|
||||||
|
{
|
||||||
|
aUnits = EDA_UNITS::MILS;
|
||||||
|
}
|
||||||
|
else if( unit == wxT( "in" ) || unit == wxT( "\"" ) )
|
||||||
|
{
|
||||||
|
aUnits = EDA_UNITS::INCHES;
|
||||||
|
}
|
||||||
|
else if( unit == "oz" ) // 1 oz = 1.37 mils
|
||||||
|
{
|
||||||
|
aUnits = EDA_UNITS::MILS;
|
||||||
|
dtmp *= 1.37;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if( aUnits == EDA_UNITS::DEGREES )
|
||||||
|
{
|
||||||
|
if( unit == wxT( "ra" ) ) // Radians
|
||||||
|
dtmp *= 180.0f / M_PI;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch( aType )
|
||||||
|
{
|
||||||
|
case EDA_DATA_TYPE::VOLUME:
|
||||||
|
dtmp = FromUserUnit( aIuScale, aUnits, dtmp );
|
||||||
|
KI_FALLTHROUGH;
|
||||||
|
|
||||||
|
case EDA_DATA_TYPE::AREA:
|
||||||
|
dtmp = FromUserUnit( aIuScale, aUnits, dtmp );
|
||||||
|
KI_FALLTHROUGH;
|
||||||
|
|
||||||
|
case EDA_DATA_TYPE::DISTANCE:
|
||||||
|
dtmp = FromUserUnit( aIuScale, aUnits, dtmp );
|
||||||
|
}
|
||||||
|
|
||||||
|
return dtmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
long long int EDA_UNIT_UTILS::UI::ValueFromString( const EDA_IU_SCALE& aIuScale, EDA_UNITS aUnits,
|
||||||
|
const wxString& aTextValue, EDA_DATA_TYPE aType )
|
||||||
|
{
|
||||||
|
double value = DoubleValueFromString( aIuScale, aUnits, aTextValue, aType );
|
||||||
|
|
||||||
|
return KiROUND<double, long long int>( value );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
long long int EDA_UNIT_UTILS::UI::ValueFromString( const wxString& aTextValue )
|
||||||
|
{
|
||||||
|
double value = DoubleValueFromString( aTextValue );
|
||||||
|
|
||||||
|
return KiROUND<double, long long int>( value );
|
||||||
}
|
}
|
|
@ -1011,7 +1011,7 @@ bool COMPILER::generateUCode( UCODE* aCode, CONTEXT* aPreflightContext )
|
||||||
m_unitResolver->GetSupportedUnitsMessage() );
|
m_unitResolver->GetSupportedUnitsMessage() );
|
||||||
reportError( CST_CODEGEN, msg, node->srcPos );
|
reportError( CST_CODEGEN, msg, node->srcPos );
|
||||||
|
|
||||||
value = DoubleValueFromString( EDA_UNITS::UNSCALED, *node->value.str );
|
value = EDA_UNIT_UTILS::UI::DoubleValueFromString( *node->value.str );
|
||||||
}
|
}
|
||||||
|
|
||||||
node->SetUop( TR_UOP_PUSH_VALUE, value );
|
node->SetUop( TR_UOP_PUSH_VALUE, value );
|
||||||
|
|
|
@ -34,9 +34,11 @@
|
||||||
|
|
||||||
using namespace KIGFX::PREVIEW;
|
using namespace KIGFX::PREVIEW;
|
||||||
|
|
||||||
ARC_ASSISTANT::ARC_ASSISTANT( const ARC_GEOM_MANAGER& aManager, EDA_UNITS aUnits ) :
|
ARC_ASSISTANT::ARC_ASSISTANT( const ARC_GEOM_MANAGER& aManager, const EDA_IU_SCALE& aIuScale,
|
||||||
|
EDA_UNITS aUnits ) :
|
||||||
EDA_ITEM( NOT_USED ),
|
EDA_ITEM( NOT_USED ),
|
||||||
m_constructMan( aManager ),
|
m_constructMan( aManager ),
|
||||||
|
m_iuScale( aIuScale ),
|
||||||
m_units( aUnits )
|
m_units( aUnits )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -90,8 +92,9 @@ void ARC_ASSISTANT::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
|
||||||
|
|
||||||
initAngle.Normalize720();
|
initAngle.Normalize720();
|
||||||
|
|
||||||
cursorStrings.push_back( DimensionLabel( "r", m_constructMan.GetRadius(), m_units ) );
|
cursorStrings.push_back(
|
||||||
cursorStrings.push_back( DimensionLabel( wxString::FromUTF8( "θ" ), initAngle.AsDegrees(),
|
DimensionLabel( "r", m_constructMan.GetRadius(), m_iuScale, m_units ) );
|
||||||
|
cursorStrings.push_back( DimensionLabel( wxString::FromUTF8( "θ" ), initAngle.AsDegrees(), m_iuScale,
|
||||||
EDA_UNITS::DEGREES ) );
|
EDA_UNITS::DEGREES ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -106,9 +109,9 @@ void ARC_ASSISTANT::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
|
||||||
preview_ctx.DrawLineWithAngleHighlight( origin, m_constructMan.GetLastPoint(), true );
|
preview_ctx.DrawLineWithAngleHighlight( origin, m_constructMan.GetLastPoint(), true );
|
||||||
|
|
||||||
cursorStrings.push_back( DimensionLabel( wxString::FromUTF8( "Δθ" ), subtended.AsDegrees(),
|
cursorStrings.push_back( DimensionLabel( wxString::FromUTF8( "Δθ" ), subtended.AsDegrees(),
|
||||||
EDA_UNITS::DEGREES ) );
|
m_iuScale, EDA_UNITS::DEGREES ) );
|
||||||
cursorStrings.push_back( DimensionLabel( wxString::FromUTF8( "θ" ), endAngle.AsDegrees(),
|
cursorStrings.push_back( DimensionLabel( wxString::FromUTF8( "θ" ), endAngle.AsDegrees(),
|
||||||
EDA_UNITS::DEGREES ) );
|
m_iuScale, EDA_UNITS::DEGREES ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// place the text next to cursor, on opposite side from radius
|
// place the text next to cursor, on opposite side from radius
|
||||||
|
|
|
@ -30,7 +30,8 @@ double KIGFX::PREVIEW::PreviewOverlayDeemphAlpha( bool aDeemph )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
wxString KIGFX::PREVIEW::DimensionLabel( const wxString& prefix, double aVal, EDA_UNITS aUnits,
|
wxString KIGFX::PREVIEW::DimensionLabel( const wxString& prefix, double aVal,
|
||||||
|
const EDA_IU_SCALE& aIuScale, EDA_UNITS aUnits,
|
||||||
bool aIncludeUnits )
|
bool aIncludeUnits )
|
||||||
{
|
{
|
||||||
wxString str;
|
wxString str;
|
||||||
|
@ -52,7 +53,7 @@ wxString KIGFX::PREVIEW::DimensionLabel( const wxString& prefix, double aVal, ED
|
||||||
case EDA_UNITS::UNSCALED: fmtStr = wxT( "%f" ); break;
|
case EDA_UNITS::UNSCALED: fmtStr = wxT( "%f" ); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
str << wxString::Format( fmtStr, To_User_Unit( aUnits, aVal ) );
|
str << wxString::Format( fmtStr, EDA_UNIT_UTILS::UI::ToUserUnit( aIuScale, aUnits, aVal ) );
|
||||||
|
|
||||||
if( aIncludeUnits )
|
if( aIncludeUnits )
|
||||||
str << EDA_UNIT_UTILS::GetAbbreviatedUnitsLabel( aUnits );
|
str << EDA_UNIT_UTILS::GetAbbreviatedUnitsLabel( aUnits );
|
||||||
|
|
|
@ -53,7 +53,7 @@ static int getShadowLayer( KIGFX::GAL* aGal )
|
||||||
|
|
||||||
|
|
||||||
static void drawCursorStrings( KIGFX::VIEW* aView, const VECTOR2D& aCursor,
|
static void drawCursorStrings( KIGFX::VIEW* aView, const VECTOR2D& aCursor,
|
||||||
const VECTOR2D& aRulerVec, EDA_UNITS aUnits,
|
const VECTOR2D& aRulerVec, const EDA_IU_SCALE& aIuScale, EDA_UNITS aUnits,
|
||||||
bool aDrawingDropShadows, bool aFlipX, bool aFlipY )
|
bool aDrawingDropShadows, bool aFlipX, bool aFlipY )
|
||||||
{
|
{
|
||||||
// draw the cursor labels
|
// draw the cursor labels
|
||||||
|
@ -67,13 +67,13 @@ static void drawCursorStrings( KIGFX::VIEW* aView, const VECTOR2D& aCursor,
|
||||||
if( aFlipY )
|
if( aFlipY )
|
||||||
temp.y = -temp.y;
|
temp.y = -temp.y;
|
||||||
|
|
||||||
cursorStrings.push_back( DimensionLabel( "x", temp.x, aUnits ) );
|
cursorStrings.push_back( DimensionLabel( "x", temp.x, aIuScale, aUnits ) );
|
||||||
cursorStrings.push_back( DimensionLabel( "y", temp.y, aUnits ) );
|
cursorStrings.push_back( DimensionLabel( "y", temp.y, aIuScale, aUnits ) );
|
||||||
|
|
||||||
cursorStrings.push_back( DimensionLabel( "r", aRulerVec.EuclideanNorm(), aUnits ) );
|
cursorStrings.push_back( DimensionLabel( "r", aRulerVec.EuclideanNorm(), aIuScale, aUnits ) );
|
||||||
|
|
||||||
EDA_ANGLE angle = -EDA_ANGLE( aRulerVec );
|
EDA_ANGLE angle = -EDA_ANGLE( aRulerVec );
|
||||||
cursorStrings.push_back( DimensionLabel( wxString::FromUTF8( "θ" ), angle.AsDegrees(),
|
cursorStrings.push_back( DimensionLabel( wxString::FromUTF8( "θ" ), angle.AsDegrees(), aIuScale,
|
||||||
EDA_UNITS::DEGREES ) );
|
EDA_UNITS::DEGREES ) );
|
||||||
|
|
||||||
temp = aRulerVec;
|
temp = aRulerVec;
|
||||||
|
@ -148,7 +148,7 @@ static TICK_FORMAT getTickFormatForScale( double aScale, double& aTickSpace, EDA
|
||||||
* @param aMinorTickLen length of minor ticks in IU
|
* @param aMinorTickLen length of minor ticks in IU
|
||||||
*/
|
*/
|
||||||
void drawTicksAlongLine( KIGFX::VIEW* aView, const VECTOR2D& aOrigin, const VECTOR2D& aLine,
|
void drawTicksAlongLine( KIGFX::VIEW* aView, const VECTOR2D& aOrigin, const VECTOR2D& aLine,
|
||||||
double aMinorTickLen, EDA_UNITS aUnits, bool aDrawingDropShadows )
|
double aMinorTickLen, const EDA_IU_SCALE& aIuScale, EDA_UNITS aUnits, bool aDrawingDropShadows )
|
||||||
{
|
{
|
||||||
KIGFX::GAL* gal = aView->GetGAL();
|
KIGFX::GAL* gal = aView->GetGAL();
|
||||||
KIFONT::FONT* font = KIFONT::FONT::GetFont();
|
KIFONT::FONT* font = KIFONT::FONT::GetFont();
|
||||||
|
@ -220,7 +220,7 @@ void drawTicksAlongLine( KIGFX::VIEW* aView, const VECTOR2D& aOrigin, const VECT
|
||||||
|
|
||||||
if( drawLabel )
|
if( drawLabel )
|
||||||
{
|
{
|
||||||
wxString label = DimensionLabel( "", tickSpace * i, aUnits, false );
|
wxString label = DimensionLabel( "", tickSpace * i, aIuScale, aUnits, false );
|
||||||
font->Draw( gal, label, tickPos + labelOffset, labelAttrs );
|
font->Draw( gal, label, tickPos + labelOffset, labelAttrs );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -267,11 +267,12 @@ void drawBacksideTicks( KIGFX::VIEW* aView, const VECTOR2D& aOrigin, const VECTO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
RULER_ITEM::RULER_ITEM( const TWO_POINT_GEOMETRY_MANAGER& aGeomMgr, EDA_UNITS userUnits,
|
RULER_ITEM::RULER_ITEM( const TWO_POINT_GEOMETRY_MANAGER& aGeomMgr, const EDA_IU_SCALE& aIuScale, EDA_UNITS userUnits,
|
||||||
bool aFlipX, bool aFlipY )
|
bool aFlipX, bool aFlipY )
|
||||||
: EDA_ITEM( NOT_USED ), // Never added to anything - just a preview
|
: EDA_ITEM( NOT_USED ), // Never added to anything - just a preview
|
||||||
m_geomMgr( aGeomMgr ),
|
m_geomMgr( aGeomMgr ),
|
||||||
m_userUnits( userUnits ),
|
m_userUnits( userUnits ),
|
||||||
|
m_iuScale( aIuScale ),
|
||||||
m_flipX( aFlipX ),
|
m_flipX( aFlipX ),
|
||||||
m_flipY( aFlipY )
|
m_flipY( aFlipY )
|
||||||
{
|
{
|
||||||
|
@ -330,13 +331,14 @@ void RULER_ITEM::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
|
||||||
|
|
||||||
VECTOR2D rulerVec( end - origin );
|
VECTOR2D rulerVec( end - origin );
|
||||||
|
|
||||||
drawCursorStrings( aView, end, rulerVec, m_userUnits, drawingDropShadows, m_flipX, m_flipY );
|
drawCursorStrings( aView, end, rulerVec, m_iuScale, m_userUnits, drawingDropShadows, m_flipX,
|
||||||
|
m_flipY );
|
||||||
|
|
||||||
// basic tick size
|
// basic tick size
|
||||||
const double minorTickLen = 5.0 / gal->GetWorldScale();
|
const double minorTickLen = 5.0 / gal->GetWorldScale();
|
||||||
const double majorTickLen = minorTickLen * majorTickLengthFactor;
|
const double majorTickLen = minorTickLen * majorTickLengthFactor;
|
||||||
|
|
||||||
drawTicksAlongLine( aView, origin, rulerVec, minorTickLen, m_userUnits, drawingDropShadows );
|
drawTicksAlongLine( aView, origin, rulerVec, minorTickLen, m_iuScale, m_userUnits, drawingDropShadows );
|
||||||
|
|
||||||
drawBacksideTicks( aView, origin, rulerVec, majorTickLen, 2, drawingDropShadows );
|
drawBacksideTicks( aView, origin, rulerVec, majorTickLen, 2, drawingDropShadows );
|
||||||
|
|
||||||
|
|
|
@ -30,11 +30,13 @@
|
||||||
using namespace KIGFX::PREVIEW;
|
using namespace KIGFX::PREVIEW;
|
||||||
|
|
||||||
TWO_POINT_ASSISTANT::TWO_POINT_ASSISTANT( const TWO_POINT_GEOMETRY_MANAGER& aManager,
|
TWO_POINT_ASSISTANT::TWO_POINT_ASSISTANT( const TWO_POINT_GEOMETRY_MANAGER& aManager,
|
||||||
EDA_UNITS aUnits, GEOM_SHAPE aShape ) :
|
const EDA_IU_SCALE& aIuScale, EDA_UNITS aUnits,
|
||||||
|
GEOM_SHAPE aShape ) :
|
||||||
EDA_ITEM( NOT_USED ),
|
EDA_ITEM( NOT_USED ),
|
||||||
m_constructMan( aManager ),
|
m_constructMan( aManager ),
|
||||||
m_units( aUnits ),
|
m_units( aUnits ),
|
||||||
m_shape( aShape )
|
m_shape( aShape ),
|
||||||
|
m_iuScale( aIuScale )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,21 +82,23 @@ void TWO_POINT_ASSISTANT::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
|
||||||
|
|
||||||
if( m_shape == GEOM_SHAPE::SEGMENT )
|
if( m_shape == GEOM_SHAPE::SEGMENT )
|
||||||
{
|
{
|
||||||
cursorStrings.push_back( DimensionLabel( "l", radVec.EuclideanNorm(), m_units ) );
|
cursorStrings.push_back(
|
||||||
|
DimensionLabel( "l", radVec.EuclideanNorm(), m_iuScale, m_units ) );
|
||||||
cursorStrings.push_back( DimensionLabel( wxString::FromUTF8( "θ" ), deltaAngle.AsDegrees(),
|
cursorStrings.push_back( DimensionLabel( wxString::FromUTF8( "θ" ), deltaAngle.AsDegrees(),
|
||||||
EDA_UNITS::DEGREES ) );
|
m_iuScale, EDA_UNITS::DEGREES ) );
|
||||||
}
|
}
|
||||||
else if( m_shape == GEOM_SHAPE::RECT )
|
else if( m_shape == GEOM_SHAPE::RECT )
|
||||||
{
|
{
|
||||||
cursorStrings.push_back( DimensionLabel( "x", std::abs( radVec.x ), m_units ) );
|
cursorStrings.push_back( DimensionLabel( "x", std::abs( radVec.x ), m_iuScale, m_units ) );
|
||||||
cursorStrings.push_back( DimensionLabel( "y", std::abs( radVec.y ), m_units ) );
|
cursorStrings.push_back( DimensionLabel( "y", std::abs( radVec.y ), m_iuScale, m_units ) );
|
||||||
}
|
}
|
||||||
else if( m_shape == GEOM_SHAPE::CIRCLE )
|
else if( m_shape == GEOM_SHAPE::CIRCLE )
|
||||||
{
|
{
|
||||||
KIGFX::PREVIEW::DRAW_CONTEXT preview_ctx( *aView );
|
KIGFX::PREVIEW::DRAW_CONTEXT preview_ctx( *aView );
|
||||||
preview_ctx.DrawLine( origin, end, false );
|
preview_ctx.DrawLine( origin, end, false );
|
||||||
|
|
||||||
cursorStrings.push_back( DimensionLabel( "r", radVec.EuclideanNorm(), m_units ) );
|
cursorStrings.push_back(
|
||||||
|
DimensionLabel( "r", radVec.EuclideanNorm(), m_iuScale, m_units ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// place the text next to cursor, on opposite side from drawing
|
// place the text next to cursor, on opposite side from drawing
|
||||||
|
|
|
@ -44,11 +44,11 @@ wxString RC_ITEM::GetErrorMessage() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
wxString RC_ITEM::ShowCoord( EDA_UNITS aUnits, const VECTOR2I& aPos )
|
wxString RC_ITEM::ShowCoord( const EDA_IU_SCALE& aIuScale, EDA_UNITS aUnits, const VECTOR2I& aPos )
|
||||||
{
|
{
|
||||||
return wxString::Format( wxT( "@(%s, %s)" ),
|
return wxString::Format( wxT( "@(%s, %s)" ),
|
||||||
MessageTextFromValue( aUnits, aPos.x ),
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( aIuScale, aUnits, aPos.x ),
|
||||||
MessageTextFromValue( aUnits, aPos.y ) );
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( aIuScale, aUnits, aPos.y ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ void RC_ITEM::SetItems( const EDA_ITEM* aItem, const EDA_ITEM* bItem,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
wxString RC_ITEM::ShowReport( EDA_UNITS aUnits, SEVERITY aSeverity,
|
wxString RC_ITEM::ShowReport( const EDA_IU_SCALE& aIuScale, EDA_UNITS aUnits, SEVERITY aSeverity,
|
||||||
const std::map<KIID, EDA_ITEM*>& aItemMap ) const
|
const std::map<KIID, EDA_ITEM*>& aItemMap ) const
|
||||||
{
|
{
|
||||||
wxString severity;
|
wxString severity;
|
||||||
|
@ -120,9 +120,9 @@ wxString RC_ITEM::ShowReport( EDA_UNITS aUnits, SEVERITY aSeverity,
|
||||||
GetErrorMessage(),
|
GetErrorMessage(),
|
||||||
GetViolatingRuleDesc(),
|
GetViolatingRuleDesc(),
|
||||||
severity,
|
severity,
|
||||||
ShowCoord( aUnits, mainItem->GetPosition() ),
|
ShowCoord( aIuScale, aUnits, mainItem->GetPosition() ),
|
||||||
mainItem->GetSelectMenuText( aUnits ),
|
mainItem->GetSelectMenuText( aUnits ),
|
||||||
ShowCoord( aUnits, auxItem->GetPosition() ),
|
ShowCoord( aIuScale, aUnits, auxItem->GetPosition() ),
|
||||||
auxItem->GetSelectMenuText( aUnits ) );
|
auxItem->GetSelectMenuText( aUnits ) );
|
||||||
}
|
}
|
||||||
else if( mainItem )
|
else if( mainItem )
|
||||||
|
@ -132,7 +132,7 @@ wxString RC_ITEM::ShowReport( EDA_UNITS aUnits, SEVERITY aSeverity,
|
||||||
GetErrorMessage(),
|
GetErrorMessage(),
|
||||||
GetViolatingRuleDesc(),
|
GetViolatingRuleDesc(),
|
||||||
severity,
|
severity,
|
||||||
ShowCoord( aUnits, mainItem->GetPosition() ),
|
ShowCoord( aIuScale, aUnits, mainItem->GetPosition() ),
|
||||||
mainItem->GetSelectMenuText( aUnits ) );
|
mainItem->GetSelectMenuText( aUnits ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -190,7 +190,8 @@ wxString STROKE_PARAMS::GetLineStyleToken( PLOT_DASH_TYPE aStyle )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void STROKE_PARAMS::GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList,
|
void STROKE_PARAMS::GetMsgPanelInfo( const EDA_IU_SCALE& aIuScale, EDA_UNITS aUnits,
|
||||||
|
std::vector<MSG_PANEL_ITEM>& aList,
|
||||||
bool aIncludeStyle, bool aIncludeWidth )
|
bool aIncludeStyle, bool aIncludeWidth )
|
||||||
{
|
{
|
||||||
if( aIncludeStyle )
|
if( aIncludeStyle )
|
||||||
|
@ -211,25 +212,26 @@ void STROKE_PARAMS::GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITE
|
||||||
|
|
||||||
if( aIncludeWidth )
|
if( aIncludeWidth )
|
||||||
{
|
{
|
||||||
aList.emplace_back( _( "Line Width" ), MessageTextFromValue( aUnits, GetWidth() ) );
|
aList.emplace_back( _( "Line Width" ), EDA_UNIT_UTILS::UI::MessageTextFromValue( aIuScale, aUnits, GetWidth() ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void STROKE_PARAMS::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel ) const
|
void STROKE_PARAMS::Format( OUTPUTFORMATTER* aFormatter, const EDA_IU_SCALE& aIuScale,
|
||||||
|
int aNestLevel ) const
|
||||||
{
|
{
|
||||||
wxASSERT( aFormatter != nullptr );
|
wxASSERT( aFormatter != nullptr );
|
||||||
|
|
||||||
if( GetColor() == KIGFX::COLOR4D::UNSPECIFIED )
|
if( GetColor() == KIGFX::COLOR4D::UNSPECIFIED )
|
||||||
{
|
{
|
||||||
aFormatter->Print( aNestLevel, "(stroke (width %s) (type %s))",
|
aFormatter->Print( aNestLevel, "(stroke (width %s) (type %s))",
|
||||||
FormatInternalUnits(GetWidth() ).c_str(),
|
EDA_UNIT_UTILS::FormatInternalUnits( aIuScale, GetWidth() ).c_str(),
|
||||||
TO_UTF8( GetLineStyleToken( GetPlotStyle() ) ) );
|
TO_UTF8( GetLineStyleToken( GetPlotStyle() ) ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
aFormatter->Print( aNestLevel, "(stroke (width %s) (type %s) (color %d %d %d %s))",
|
aFormatter->Print( aNestLevel, "(stroke (width %s) (type %s) (color %d %d %d %s))",
|
||||||
FormatInternalUnits(GetWidth() ).c_str(),
|
EDA_UNIT_UTILS::FormatInternalUnits( aIuScale, GetWidth() ).c_str(),
|
||||||
TO_UTF8( GetLineStyleToken( GetPlotStyle() ) ),
|
TO_UTF8( GetLineStyleToken( GetPlotStyle() ) ),
|
||||||
KiROUND( GetColor().r * 255.0 ),
|
KiROUND( GetColor().r * 255.0 ),
|
||||||
KiROUND( GetColor().g * 255.0 ),
|
KiROUND( GetColor().g * 255.0 ),
|
||||||
|
|
|
@ -59,12 +59,15 @@ void COMMON_TOOLS::Reset( RESET_REASON aReason )
|
||||||
|
|
||||||
for( const wxString& gridDef : settings.sizes )
|
for( const wxString& gridDef : settings.sizes )
|
||||||
{
|
{
|
||||||
int gridSize = (int) ValueFromString( EDA_UNITS::MILLIMETRES, gridDef );
|
int gridSize = (int) EDA_UNIT_UTILS::UI::ValueFromString( m_frame->GetIuScale(), EDA_UNITS::MILLIMETRES, gridDef );
|
||||||
m_grids.emplace_back( gridSize, gridSize );
|
m_grids.emplace_back( gridSize, gridSize );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_grids.emplace_back( ValueFromString( EDA_UNITS::MILLIMETRES, settings.user_grid_x ),
|
m_grids.emplace_back(
|
||||||
ValueFromString( EDA_UNITS::MILLIMETRES, settings.user_grid_y ) );
|
EDA_UNIT_UTILS::UI::ValueFromString( m_frame->GetIuScale(), EDA_UNITS::MILLIMETRES,
|
||||||
|
settings.user_grid_x ),
|
||||||
|
EDA_UNIT_UTILS::UI::ValueFromString( m_frame->GetIuScale(), EDA_UNITS::MILLIMETRES,
|
||||||
|
settings.user_grid_y ) );
|
||||||
|
|
||||||
OnGridChanged();
|
OnGridChanged();
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,22 +94,26 @@ void GRID_MENU::BuildChoiceList( wxArrayString* aGridsList, APP_SETTINGS_BASE* a
|
||||||
|
|
||||||
for( const wxString& gridSize : aCfg->m_Window.grid.sizes )
|
for( const wxString& gridSize : aCfg->m_Window.grid.sizes )
|
||||||
{
|
{
|
||||||
int val = (int) ValueFromString( EDA_UNITS::MILLIMETRES, gridSize );
|
int val = (int) EDA_UNIT_UTILS::UI::ValueFromString( aParent->GetIuScale(), EDA_UNITS::MILLIMETRES, gridSize );
|
||||||
|
|
||||||
msg.Printf( _( "Grid: %s (%s)" ),
|
msg.Printf(
|
||||||
MessageTextFromValue( primaryUnit, val ),
|
_( "Grid: %s (%s)" ),
|
||||||
MessageTextFromValue( secondaryUnit, val ) );
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( aParent->GetIuScale(), primaryUnit, val ),
|
||||||
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( aParent->GetIuScale(), secondaryUnit,
|
||||||
|
val ) );
|
||||||
|
|
||||||
aGridsList->Add( msg );
|
aGridsList->Add( msg );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !aCfg->m_Window.grid.user_grid_x.empty() )
|
if( !aCfg->m_Window.grid.user_grid_x.empty() )
|
||||||
{
|
{
|
||||||
int val = (int) ValueFromString( EDA_UNITS::INCHES, aCfg->m_Window.grid.user_grid_x );
|
int val = (int) EDA_UNIT_UTILS::UI::ValueFromString( aParent->GetIuScale(),EDA_UNITS::INCHES,
|
||||||
|
aCfg->m_Window.grid.user_grid_x );
|
||||||
|
|
||||||
msg.Printf( _( "User grid: %s (%s)" ),
|
msg.Printf( _( "User grid: %s (%s)" ),
|
||||||
MessageTextFromValue( primaryUnit, val ),
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( aParent->GetIuScale(), primaryUnit, val ),
|
||||||
MessageTextFromValue( secondaryUnit, val ) );
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( aParent->GetIuScale(), secondaryUnit,
|
||||||
|
val ) );
|
||||||
|
|
||||||
aGridsList->Add( msg );
|
aGridsList->Add( msg );
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,12 +37,20 @@
|
||||||
wxDEFINE_EVENT( DELAY_FOCUS, wxCommandEvent );
|
wxDEFINE_EVENT( DELAY_FOCUS, wxCommandEvent );
|
||||||
|
|
||||||
|
|
||||||
UNIT_BINDER::UNIT_BINDER( EDA_BASE_FRAME* aParent, wxStaticText* aLabel, wxWindow* aValueCtrl,
|
UNIT_BINDER::UNIT_BINDER( EDA_DRAW_FRAME* aParent, wxStaticText* aLabel, wxWindow* aValueCtrl,
|
||||||
|
wxStaticText* aUnitLabel, bool allowEval ) :
|
||||||
|
UNIT_BINDER( aParent, aParent->GetIuScale(), aLabel, aValueCtrl, aUnitLabel, allowEval )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
UNIT_BINDER::UNIT_BINDER( EDA_BASE_FRAME* aParent, const EDA_IU_SCALE& aIUScale,
|
||||||
|
wxStaticText* aLabel, wxWindow* aValueCtrl,
|
||||||
wxStaticText* aUnitLabel, bool allowEval ) :
|
wxStaticText* aUnitLabel, bool allowEval ) :
|
||||||
m_frame( aParent ),
|
m_frame( aParent ),
|
||||||
m_label( aLabel ),
|
m_label( aLabel ),
|
||||||
m_valueCtrl( aValueCtrl ),
|
m_valueCtrl( aValueCtrl ),
|
||||||
m_unitLabel( aUnitLabel ),
|
m_unitLabel( aUnitLabel ),
|
||||||
|
m_iuScale( aIUScale ),
|
||||||
m_negativeZero( false ),
|
m_negativeZero( false ),
|
||||||
m_dataType( EDA_DATA_TYPE::DISTANCE ),
|
m_dataType( EDA_DATA_TYPE::DISTANCE ),
|
||||||
m_precision( 0 ),
|
m_precision( 0 ),
|
||||||
|
@ -246,12 +254,12 @@ bool UNIT_BINDER::Validate( double aMin, double aMax, EDA_UNITS aUnits )
|
||||||
|
|
||||||
// TODO: Validate() does not currently support m_dataType being anything other than DISTANCE
|
// TODO: Validate() does not currently support m_dataType being anything other than DISTANCE
|
||||||
// Note: aMin and aMax are not always given in internal units
|
// Note: aMin and aMax are not always given in internal units
|
||||||
if( GetValue() < From_User_Unit( aUnits, aMin ) )
|
if( GetValue() < EDA_UNIT_UTILS::UI::FromUserUnit( m_iuScale, aUnits, aMin ) )
|
||||||
{
|
{
|
||||||
double val_min_iu = From_User_Unit( aUnits, aMin );
|
double val_min_iu = EDA_UNIT_UTILS::UI::FromUserUnit( m_iuScale, aUnits, aMin );
|
||||||
m_errorMessage = wxString::Format( _( "%s must be at least %s." ),
|
m_errorMessage = wxString::Format( _( "%s must be at least %s." ),
|
||||||
valueDescriptionFromLabel( m_label ),
|
valueDescriptionFromLabel( m_label ),
|
||||||
StringFromValue( m_units, val_min_iu, true ) );
|
EDA_UNIT_UTILS::UI::StringFromValue( m_iuScale, m_units, val_min_iu, true ) );
|
||||||
|
|
||||||
textEntry->SelectAll();
|
textEntry->SelectAll();
|
||||||
|
|
||||||
|
@ -261,12 +269,12 @@ bool UNIT_BINDER::Validate( double aMin, double aMax, EDA_UNITS aUnits )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( GetValue() > From_User_Unit( aUnits, aMax ) )
|
if( GetValue() > EDA_UNIT_UTILS::UI::FromUserUnit( m_iuScale, aUnits, aMax ) )
|
||||||
{
|
{
|
||||||
double val_max_iu = From_User_Unit( aUnits, aMax );
|
double val_max_iu = EDA_UNIT_UTILS::UI::FromUserUnit( m_iuScale, aUnits, aMax );
|
||||||
m_errorMessage = wxString::Format( _( "%s must be less than %s." ),
|
m_errorMessage = wxString::Format( _( "%s must be less than %s." ),
|
||||||
valueDescriptionFromLabel( m_label ),
|
valueDescriptionFromLabel( m_label ),
|
||||||
StringFromValue( m_units, val_max_iu, true ) );
|
EDA_UNIT_UTILS::UI::StringFromValue( m_iuScale, m_units, val_max_iu, true ) );
|
||||||
|
|
||||||
textEntry->SelectAll();
|
textEntry->SelectAll();
|
||||||
|
|
||||||
|
@ -286,9 +294,10 @@ void UNIT_BINDER::SetValue( long long int aValue )
|
||||||
double displayValue = m_originTransforms.ToDisplay( value, m_coordType );
|
double displayValue = m_originTransforms.ToDisplay( value, m_coordType );
|
||||||
|
|
||||||
if( displayValue == 0 && m_negativeZero )
|
if( displayValue == 0 && m_negativeZero )
|
||||||
SetValue( wxT( "-" ) + StringFromValue( m_units, displayValue, false, m_dataType ) );
|
SetValue( wxT( "-" ) + EDA_UNIT_UTILS::UI::StringFromValue( m_iuScale, m_units, displayValue, false, m_dataType ) );
|
||||||
else
|
else
|
||||||
SetValue( StringFromValue( m_units, displayValue, false, m_dataType ) );
|
SetValue( EDA_UNIT_UTILS::UI::StringFromValue( m_iuScale, m_units, displayValue,
|
||||||
|
false, m_dataType ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -298,9 +307,12 @@ void UNIT_BINDER::SetDoubleValue( double aValue )
|
||||||
displayValue = setPrecision( displayValue, false );
|
displayValue = setPrecision( displayValue, false );
|
||||||
|
|
||||||
if( displayValue == 0 && m_negativeZero )
|
if( displayValue == 0 && m_negativeZero )
|
||||||
SetValue( wxT( "-" ) + StringFromValue( m_units, displayValue, false, m_dataType ) );
|
SetValue( wxT( "-" )
|
||||||
|
+ EDA_UNIT_UTILS::UI::StringFromValue( m_iuScale, m_units,
|
||||||
|
displayValue, false, m_dataType ) );
|
||||||
else
|
else
|
||||||
SetValue( StringFromValue( m_units, displayValue, false, m_dataType ) );
|
SetValue( EDA_UNIT_UTILS::UI::StringFromValue( m_iuScale, m_units, displayValue,
|
||||||
|
false, m_dataType ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -335,9 +347,12 @@ void UNIT_BINDER::ChangeValue( int aValue )
|
||||||
double displayValue = m_originTransforms.ToDisplay( value, m_coordType );
|
double displayValue = m_originTransforms.ToDisplay( value, m_coordType );
|
||||||
|
|
||||||
if( displayValue == 0 && m_negativeZero )
|
if( displayValue == 0 && m_negativeZero )
|
||||||
ChangeValue( wxT( "-" ) + StringFromValue( m_units, displayValue, false ) );
|
ChangeValue( wxT( "-" )
|
||||||
|
+ EDA_UNIT_UTILS::UI::StringFromValue( m_iuScale, m_units,
|
||||||
|
displayValue, false ) );
|
||||||
else
|
else
|
||||||
ChangeValue( StringFromValue( m_units, displayValue, false ) );
|
ChangeValue( EDA_UNIT_UTILS::UI::StringFromValue( m_iuScale, m_units,
|
||||||
|
displayValue, false ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -347,9 +362,12 @@ void UNIT_BINDER::ChangeDoubleValue( double aValue )
|
||||||
displayValue = setPrecision( displayValue, false );
|
displayValue = setPrecision( displayValue, false );
|
||||||
|
|
||||||
if( displayValue == 0 && m_negativeZero )
|
if( displayValue == 0 && m_negativeZero )
|
||||||
ChangeValue( wxT( "-" ) + StringFromValue( m_units, displayValue, false, m_dataType ) );
|
ChangeValue( wxT( "-" )
|
||||||
|
+ EDA_UNIT_UTILS::UI::StringFromValue( m_iuScale, m_units,
|
||||||
|
displayValue, false, m_dataType ) );
|
||||||
else
|
else
|
||||||
ChangeValue( StringFromValue( m_units, displayValue, false, m_dataType ) );
|
ChangeValue( EDA_UNIT_UTILS::UI::StringFromValue( m_iuScale, m_units,
|
||||||
|
displayValue, false, m_dataType ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -400,7 +418,7 @@ long long int UNIT_BINDER::GetValue()
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
long long int displayValue = ValueFromString( m_units, value, m_dataType );
|
long long int displayValue = EDA_UNIT_UTILS::UI::ValueFromString( m_iuScale, m_units, value, m_dataType );
|
||||||
return m_originTransforms.FromDisplay( displayValue, m_coordType );
|
return m_originTransforms.FromDisplay( displayValue, m_coordType );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -410,11 +428,16 @@ double UNIT_BINDER::setPrecision( double aValue, bool aValueUsesUserUnits )
|
||||||
if( m_precision > 1 )
|
if( m_precision > 1 )
|
||||||
{
|
{
|
||||||
int scale = pow( 10, m_precision );
|
int scale = pow( 10, m_precision );
|
||||||
long long tmp = aValueUsesUserUnits ? aValue : To_User_Unit( m_units, aValue ) * scale;
|
int64_t tmp = aValue;
|
||||||
|
if( !aValueUsesUserUnits )
|
||||||
|
{
|
||||||
|
tmp = EDA_UNIT_UTILS::UI::ToUserUnit( m_iuScale, m_units, aValue ) * scale;
|
||||||
|
}
|
||||||
|
|
||||||
aValue = static_cast<double>( tmp ) / scale;
|
aValue = static_cast<double>( tmp ) / scale;
|
||||||
|
|
||||||
if( !aValueUsesUserUnits )
|
if( !aValueUsesUserUnits )
|
||||||
aValue = From_User_Unit( m_units, aValue );
|
aValue = EDA_UNIT_UTILS::UI::FromUserUnit( m_iuScale, m_units, aValue );
|
||||||
}
|
}
|
||||||
|
|
||||||
return aValue;
|
return aValue;
|
||||||
|
@ -443,7 +466,8 @@ double UNIT_BINDER::GetDoubleValue()
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
double displayValue = DoubleValueFromString( m_units, value, m_dataType );
|
double displayValue = EDA_UNIT_UTILS::UI::DoubleValueFromString( m_iuScale, m_units,
|
||||||
|
value, m_dataType );
|
||||||
displayValue = setPrecision( displayValue, false );
|
displayValue = setPrecision( displayValue, false );
|
||||||
|
|
||||||
return m_originTransforms.FromDisplay( displayValue, m_coordType );
|
return m_originTransforms.FromDisplay( displayValue, m_coordType );
|
||||||
|
|
|
@ -26,7 +26,6 @@ set( CVPCB_DIALOGS
|
||||||
)
|
)
|
||||||
|
|
||||||
set( CVPCB_SRCS
|
set( CVPCB_SRCS
|
||||||
${CMAKE_SOURCE_DIR}/common/base_units.cpp
|
|
||||||
${CMAKE_SOURCE_DIR}/pcbnew/board_stackup_manager/stackup_predefined_prms.cpp
|
${CMAKE_SOURCE_DIR}/pcbnew/board_stackup_manager/stackup_predefined_prms.cpp
|
||||||
${CMAKE_SOURCE_DIR}/pcbnew/footprint_info_impl.cpp
|
${CMAKE_SOURCE_DIR}/pcbnew/footprint_info_impl.cpp
|
||||||
auto_associate.cpp
|
auto_associate.cpp
|
||||||
|
|
|
@ -318,7 +318,6 @@ set( EESCHEMA_SRCS
|
||||||
|
|
||||||
set( EESCHEMA_COMMON_SRCS
|
set( EESCHEMA_COMMON_SRCS
|
||||||
|
|
||||||
${CMAKE_SOURCE_DIR}/common/base_units.cpp
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -304,7 +304,7 @@ ANNOTATE_ALGO_T DIALOG_ANNOTATE::GetAnnotateAlgo()
|
||||||
|
|
||||||
int DIALOG_ANNOTATE::GetStartNumber()
|
int DIALOG_ANNOTATE::GetStartNumber()
|
||||||
{
|
{
|
||||||
return ValueFromString( EDA_UNITS::UNSCALED, m_textNumberAfter->GetValue() );
|
return EDA_UNIT_UTILS::UI::ValueFromString( m_textNumberAfter->GetValue() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -983,7 +983,7 @@ bool DIALOG_ERC::writeReport( const wxString& aFullFileName )
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
msg << marker->GetRCItem()->ShowReport( GetUserUnits(), severity, itemMap );
|
msg << marker->GetRCItem()->ShowReport( schIUScale, GetUserUnits(), severity, itemMap );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -179,23 +179,28 @@ public:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COL_NUMBER_SIZE:
|
case COL_NUMBER_SIZE:
|
||||||
val = StringFromValue( aUserUnits, pin->GetNumberTextSize(), true );
|
val = EDA_UNIT_UTILS::UI::StringFromValue( schIUScale, aUserUnits,
|
||||||
|
pin->GetNumberTextSize(), true );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COL_NAME_SIZE:
|
case COL_NAME_SIZE:
|
||||||
val = StringFromValue( aUserUnits, pin->GetNameTextSize(), true );
|
val = EDA_UNIT_UTILS::UI::StringFromValue( schIUScale, aUserUnits,
|
||||||
|
pin->GetNameTextSize(), true );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COL_LENGTH:
|
case COL_LENGTH:
|
||||||
val = StringFromValue( aUserUnits, pin->GetLength(), true );
|
val = EDA_UNIT_UTILS::UI::StringFromValue( schIUScale, aUserUnits,
|
||||||
|
pin->GetLength(), true );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COL_POSX:
|
case COL_POSX:
|
||||||
val = StringFromValue( aUserUnits, pin->GetPosition().x, true );
|
val = EDA_UNIT_UTILS::UI::StringFromValue( schIUScale, aUserUnits,
|
||||||
|
pin->GetPosition().x, true );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COL_POSY:
|
case COL_POSY:
|
||||||
val = StringFromValue( aUserUnits, -pin->GetPosition().y, true );
|
val = EDA_UNIT_UTILS::UI::StringFromValue( schIUScale, aUserUnits,
|
||||||
|
-pin->GetPosition().y, true );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COL_VISIBLE:
|
case COL_VISIBLE:
|
||||||
|
@ -348,25 +353,29 @@ public:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COL_NUMBER_SIZE:
|
case COL_NUMBER_SIZE:
|
||||||
pin->SetNumberTextSize( ValueFromString( m_frame->GetUserUnits(), aValue ) );
|
pin->SetNumberTextSize( EDA_UNIT_UTILS::UI::ValueFromString( schIUScale, m_frame->GetUserUnits(), aValue ) );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COL_NAME_SIZE:
|
case COL_NAME_SIZE:
|
||||||
pin->SetNameTextSize( ValueFromString( m_frame->GetUserUnits(), aValue ) );
|
pin->SetNameTextSize( EDA_UNIT_UTILS::UI::ValueFromString(
|
||||||
|
schIUScale, m_frame->GetUserUnits(), aValue ) );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COL_LENGTH:
|
case COL_LENGTH:
|
||||||
pin->ChangeLength( ValueFromString( m_frame->GetUserUnits(), aValue ) );
|
pin->ChangeLength( EDA_UNIT_UTILS::UI::ValueFromString(
|
||||||
|
schIUScale, m_frame->GetUserUnits(), aValue ) );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COL_POSX:
|
case COL_POSX:
|
||||||
pin->SetPosition( wxPoint( ValueFromString( m_frame->GetUserUnits(), aValue ),
|
pin->SetPosition( wxPoint( EDA_UNIT_UTILS::UI::ValueFromString(
|
||||||
|
schIUScale, m_frame->GetUserUnits(), aValue ),
|
||||||
pin->GetPosition().y ) );
|
pin->GetPosition().y ) );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COL_POSY:
|
case COL_POSY:
|
||||||
pin->SetPosition( wxPoint( pin->GetPosition().x,
|
pin->SetPosition( wxPoint( pin->GetPosition().x,
|
||||||
-ValueFromString( m_frame->GetUserUnits(), aValue ) ) );
|
-EDA_UNIT_UTILS::UI::ValueFromString(
|
||||||
|
schIUScale, m_frame->GetUserUnits(), aValue ) ) );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COL_VISIBLE:
|
case COL_VISIBLE:
|
||||||
|
@ -454,12 +463,14 @@ public:
|
||||||
break;
|
break;
|
||||||
case COL_NUMBER_SIZE:
|
case COL_NUMBER_SIZE:
|
||||||
case COL_NAME_SIZE:
|
case COL_NAME_SIZE:
|
||||||
res = cmp( ValueFromString( units, lhStr ), ValueFromString( units, rhStr ) );
|
res = cmp( EDA_UNIT_UTILS::UI::ValueFromString( schIUScale, units, lhStr ),
|
||||||
|
EDA_UNIT_UTILS::UI::ValueFromString( schIUScale, units, rhStr ) );
|
||||||
break;
|
break;
|
||||||
case COL_LENGTH:
|
case COL_LENGTH:
|
||||||
case COL_POSX:
|
case COL_POSX:
|
||||||
case COL_POSY:
|
case COL_POSY:
|
||||||
res = cmp( ValueFromString( units, lhStr ), ValueFromString( units, rhStr ) );
|
res = cmp( EDA_UNIT_UTILS::UI::ValueFromString( schIUScale, units, lhStr ),
|
||||||
|
EDA_UNIT_UTILS::UI::ValueFromString( schIUScale, units, rhStr ) );
|
||||||
break;
|
break;
|
||||||
case COL_VISIBLE:
|
case COL_VISIBLE:
|
||||||
case COL_DEMORGAN:
|
case COL_DEMORGAN:
|
||||||
|
|
|
@ -115,8 +115,7 @@ bool PANEL_EESCHEMA_ANNOTATION_OPTIONS::TransferDataFromWindow()
|
||||||
if( schFrame )
|
if( schFrame )
|
||||||
{
|
{
|
||||||
SCHEMATIC_SETTINGS& projSettings = schFrame->Schematic().Settings();
|
SCHEMATIC_SETTINGS& projSettings = schFrame->Schematic().Settings();
|
||||||
projSettings.m_AnnotateStartNum =
|
projSettings.m_AnnotateStartNum = EDA_UNIT_UTILS::UI::ValueFromString( m_textNumberAfter->GetValue() );
|
||||||
ValueFromString( EDA_UNITS::UNSCALED, m_textNumberAfter->GetValue() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -32,8 +32,8 @@
|
||||||
PANEL_EESCHEMA_EDITING_OPTIONS::PANEL_EESCHEMA_EDITING_OPTIONS( wxWindow* aWindow,
|
PANEL_EESCHEMA_EDITING_OPTIONS::PANEL_EESCHEMA_EDITING_OPTIONS( wxWindow* aWindow,
|
||||||
EDA_BASE_FRAME* aUnitsProvider ) :
|
EDA_BASE_FRAME* aUnitsProvider ) :
|
||||||
PANEL_EESCHEMA_EDITING_OPTIONS_BASE( aWindow ),
|
PANEL_EESCHEMA_EDITING_OPTIONS_BASE( aWindow ),
|
||||||
m_hPitch( aUnitsProvider, m_hPitchLabel, m_hPitchCtrl, m_hPitchUnits ),
|
m_hPitch( aUnitsProvider, schIUScale, m_hPitchLabel, m_hPitchCtrl, m_hPitchUnits ),
|
||||||
m_vPitch( aUnitsProvider, m_vPitchLabel, m_vPitchCtrl, m_vPitchUnits )
|
m_vPitch( aUnitsProvider, schIUScale, m_vPitchLabel, m_vPitchCtrl, m_vPitchUnits )
|
||||||
{
|
{
|
||||||
// Make the color swatch show "Clear Color" instead
|
// Make the color swatch show "Clear Color" instead
|
||||||
m_borderColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
|
m_borderColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#include <widgets/unit_binder.h>
|
#include <widgets/unit_binder.h>
|
||||||
#include "panel_eeschema_editing_options_base.h"
|
#include "panel_eeschema_editing_options_base.h"
|
||||||
|
|
||||||
class EDA_BASE_FRAME;
|
class EDA_DRAW_FRAME;
|
||||||
|
|
||||||
|
|
||||||
class PANEL_EESCHEMA_EDITING_OPTIONS : public PANEL_EESCHEMA_EDITING_OPTIONS_BASE
|
class PANEL_EESCHEMA_EDITING_OPTIONS : public PANEL_EESCHEMA_EDITING_OPTIONS_BASE
|
||||||
|
|
|
@ -100,16 +100,19 @@ bool PANEL_SETUP_FORMATTING::TransferDataToWindow()
|
||||||
m_suffixCtrl->ChangeValue( settings.m_IntersheetRefsSuffix );
|
m_suffixCtrl->ChangeValue( settings.m_IntersheetRefsSuffix );
|
||||||
m_listOwnPage->SetValue( settings.m_IntersheetRefsListOwnPage );
|
m_listOwnPage->SetValue( settings.m_IntersheetRefsListOwnPage );
|
||||||
|
|
||||||
m_textOffsetRatioCtrl->SetValue( StringFromValue( EDA_UNITS::PERCENT,
|
m_textOffsetRatioCtrl->SetValue( EDA_UNIT_UTILS::UI::StringFromValue( schIUScale, EDA_UNITS::PERCENT,
|
||||||
settings.m_TextOffsetRatio * 100.0 ) );
|
settings.m_TextOffsetRatio * 100.0 ) );
|
||||||
|
|
||||||
m_dashLengthCtrl->SetValue( StringFromValue( EDA_UNITS::UNSCALED,
|
m_dashLengthCtrl->SetValue( EDA_UNIT_UTILS::UI::StringFromValue(
|
||||||
|
schIUScale, EDA_UNITS::UNSCALED,
|
||||||
settings.m_DashedLineDashRatio ) );
|
settings.m_DashedLineDashRatio ) );
|
||||||
|
|
||||||
m_gapLengthCtrl->SetValue( StringFromValue( EDA_UNITS::UNSCALED,
|
m_gapLengthCtrl->SetValue( EDA_UNIT_UTILS::UI::StringFromValue(
|
||||||
|
schIUScale, EDA_UNITS::UNSCALED,
|
||||||
settings.m_DashedLineGapRatio ) );
|
settings.m_DashedLineGapRatio ) );
|
||||||
|
|
||||||
m_labelSizeRatioCtrl->SetValue( StringFromValue( EDA_UNITS::PERCENT,
|
m_labelSizeRatioCtrl->SetValue( EDA_UNIT_UTILS::UI::StringFromValue(
|
||||||
|
schIUScale, EDA_UNITS::PERCENT,
|
||||||
settings.m_LabelSizeRatio * 100.0 ) );
|
settings.m_LabelSizeRatio * 100.0 ) );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -154,17 +157,21 @@ bool PANEL_SETUP_FORMATTING::TransferDataFromWindow()
|
||||||
settings.m_IntersheetRefsSuffix = m_suffixCtrl->GetValue();
|
settings.m_IntersheetRefsSuffix = m_suffixCtrl->GetValue();
|
||||||
settings.m_IntersheetRefsListOwnPage = m_listOwnPage->GetValue();
|
settings.m_IntersheetRefsListOwnPage = m_listOwnPage->GetValue();
|
||||||
|
|
||||||
settings.m_TextOffsetRatio = DoubleValueFromString( EDA_UNITS::PERCENT,
|
settings.m_TextOffsetRatio =
|
||||||
m_textOffsetRatioCtrl->GetValue() ) / 100.0;
|
EDA_UNIT_UTILS::UI::DoubleValueFromString( schIUScale, EDA_UNITS::PERCENT,
|
||||||
|
m_textOffsetRatioCtrl->GetValue() )
|
||||||
|
/ 100.0;
|
||||||
|
|
||||||
settings.m_DashedLineDashRatio = DoubleValueFromString( EDA_UNITS::UNSCALED,
|
settings.m_DashedLineDashRatio = EDA_UNIT_UTILS::UI::DoubleValueFromString(
|
||||||
m_dashLengthCtrl->GetValue() );
|
schIUScale, EDA_UNITS::UNSCALED, m_dashLengthCtrl->GetValue() );
|
||||||
|
|
||||||
settings.m_DashedLineGapRatio = DoubleValueFromString( EDA_UNITS::UNSCALED,
|
settings.m_DashedLineGapRatio = EDA_UNIT_UTILS::UI::DoubleValueFromString(
|
||||||
m_gapLengthCtrl->GetValue() );
|
schIUScale, EDA_UNITS::UNSCALED, m_gapLengthCtrl->GetValue() );
|
||||||
|
|
||||||
settings.m_LabelSizeRatio = DoubleValueFromString( EDA_UNITS::PERCENT,
|
settings.m_LabelSizeRatio =
|
||||||
m_labelSizeRatioCtrl->GetValue() ) / 100.0;
|
EDA_UNIT_UTILS::UI::DoubleValueFromString( schIUScale, EDA_UNITS::PERCENT,
|
||||||
|
m_labelSizeRatioCtrl->GetValue() )
|
||||||
|
/ 100.0;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -189,9 +196,11 @@ void PANEL_SETUP_FORMATTING::ImportSettingsFrom( SCHEMATIC_SETTINGS& aSettings )
|
||||||
wxString labelSizeRatio = wxString::Format( "%f", aSettings.m_LabelSizeRatio * 100.0 );
|
wxString labelSizeRatio = wxString::Format( "%f", aSettings.m_LabelSizeRatio * 100.0 );
|
||||||
m_labelSizeRatioCtrl->SetValue( labelSizeRatio );
|
m_labelSizeRatioCtrl->SetValue( labelSizeRatio );
|
||||||
|
|
||||||
m_dashLengthCtrl->SetValue( StringFromValue( EDA_UNITS::UNSCALED,
|
m_dashLengthCtrl->SetValue( EDA_UNIT_UTILS::UI::StringFromValue(
|
||||||
|
schIUScale, EDA_UNITS::UNSCALED,
|
||||||
aSettings.m_DashedLineDashRatio ) );
|
aSettings.m_DashedLineDashRatio ) );
|
||||||
|
|
||||||
m_gapLengthCtrl->SetValue( StringFromValue( EDA_UNITS::UNSCALED,
|
m_gapLengthCtrl->SetValue( EDA_UNIT_UTILS::UI::StringFromValue(
|
||||||
|
schIUScale, EDA_UNITS::UNSCALED,
|
||||||
aSettings.m_DashedLineGapRatio ) );
|
aSettings.m_DashedLineGapRatio ) );
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,11 +32,11 @@
|
||||||
PANEL_SYM_EDITING_OPTIONS::PANEL_SYM_EDITING_OPTIONS( wxWindow* aWindow,
|
PANEL_SYM_EDITING_OPTIONS::PANEL_SYM_EDITING_OPTIONS( wxWindow* aWindow,
|
||||||
EDA_BASE_FRAME* aUnitsProvider ) :
|
EDA_BASE_FRAME* aUnitsProvider ) :
|
||||||
PANEL_SYM_EDITING_OPTIONS_BASE( aWindow ),
|
PANEL_SYM_EDITING_OPTIONS_BASE( aWindow ),
|
||||||
m_lineWidth( aUnitsProvider, m_lineWidthLabel, m_lineWidthCtrl, m_lineWidthUnits ),
|
m_lineWidth( aUnitsProvider, schIUScale, m_lineWidthLabel, m_lineWidthCtrl, m_lineWidthUnits ),
|
||||||
m_textSize( aUnitsProvider, m_textSizeLabel, m_textSizeCtrl, m_textSizeUnits ),
|
m_textSize( aUnitsProvider, schIUScale, m_textSizeLabel, m_textSizeCtrl, m_textSizeUnits ),
|
||||||
m_pinLength( aUnitsProvider, m_pinLengthLabel, m_pinLengthCtrl, m_pinLengthUnits ),
|
m_pinLength( aUnitsProvider, schIUScale, m_pinLengthLabel, m_pinLengthCtrl, m_pinLengthUnits ),
|
||||||
m_pinNameSize( aUnitsProvider, m_pinNameSizeLabel, m_pinNameSizeCtrl, m_pinNameSizeUnits ),
|
m_pinNameSize( aUnitsProvider, schIUScale ,m_pinNameSizeLabel, m_pinNameSizeCtrl, m_pinNameSizeUnits ),
|
||||||
m_pinNumberSize( aUnitsProvider, m_pinNumSizeLabel, m_pinNumSizeCtrl, m_pinNumSizeUnits )
|
m_pinNumberSize( aUnitsProvider, schIUScale, m_pinNumSizeLabel, m_pinNumSizeCtrl, m_pinNumSizeUnits )
|
||||||
{
|
{
|
||||||
m_widthHelpText->SetFont( KIUI::GetInfoFont( this ).Italic() );
|
m_widthHelpText->SetFont( KIUI::GetInfoFont( this ).Italic() );
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#include <widgets/unit_binder.h>
|
#include <widgets/unit_binder.h>
|
||||||
#include "panel_sym_editing_options_base.h"
|
#include "panel_sym_editing_options_base.h"
|
||||||
|
|
||||||
class EDA_BASE_FRAME;
|
class EDA_DRAW_FRAME;
|
||||||
|
|
||||||
|
|
||||||
class PANEL_SYM_EDITING_OPTIONS : public PANEL_SYM_EDITING_OPTIONS_BASE
|
class PANEL_SYM_EDITING_OPTIONS : public PANEL_SYM_EDITING_OPTIONS_BASE
|
||||||
|
|
|
@ -583,7 +583,7 @@ wxString FIELDS_GRID_TABLE<T>::GetValue( int aRow, int aCol )
|
||||||
return StringFromBool( field.IsBold() );
|
return StringFromBool( field.IsBold() );
|
||||||
|
|
||||||
case FDC_TEXT_SIZE:
|
case FDC_TEXT_SIZE:
|
||||||
return StringFromValue( m_frame->GetUserUnits(), field.GetTextHeight(), true );
|
return EDA_UNIT_UTILS::UI::StringFromValue( schIUScale, m_frame->GetUserUnits(), field.GetTextHeight(), true );
|
||||||
|
|
||||||
case FDC_ORIENTATION:
|
case FDC_ORIENTATION:
|
||||||
if( field.GetTextAngle().IsHorizontal() )
|
if( field.GetTextAngle().IsHorizontal() )
|
||||||
|
@ -592,10 +592,12 @@ wxString FIELDS_GRID_TABLE<T>::GetValue( int aRow, int aCol )
|
||||||
return _( "Vertical" );
|
return _( "Vertical" );
|
||||||
|
|
||||||
case FDC_POSX:
|
case FDC_POSX:
|
||||||
return StringFromValue( m_frame->GetUserUnits(), field.GetTextPos().x, true );
|
return EDA_UNIT_UTILS::UI::StringFromValue( schIUScale, m_frame->GetUserUnits(),
|
||||||
|
field.GetTextPos().x, true );
|
||||||
|
|
||||||
case FDC_POSY:
|
case FDC_POSY:
|
||||||
return StringFromValue( m_frame->GetUserUnits(), field.GetTextPos().y, true );
|
return EDA_UNIT_UTILS::UI::StringFromValue( schIUScale, m_frame->GetUserUnits(),
|
||||||
|
field.GetTextPos().y, true );
|
||||||
|
|
||||||
case FDC_FONT:
|
case FDC_FONT:
|
||||||
if( field.GetFont() )
|
if( field.GetFont() )
|
||||||
|
@ -709,8 +711,9 @@ void FIELDS_GRID_TABLE<T>::SetValue( int aRow, int aCol, const wxString &aValue
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FDC_TEXT_SIZE:
|
case FDC_TEXT_SIZE:
|
||||||
field.SetTextSize( wxSize( ValueFromString( m_frame->GetUserUnits(), aValue ),
|
field.SetTextSize(
|
||||||
ValueFromString( m_frame->GetUserUnits(), aValue ) ) );
|
wxSize( EDA_UNIT_UTILS::UI::ValueFromString( schIUScale, m_frame->GetUserUnits(), aValue ),
|
||||||
|
EDA_UNIT_UTILS::UI::ValueFromString( schIUScale, m_frame->GetUserUnits(), aValue ) ) );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FDC_ORIENTATION:
|
case FDC_ORIENTATION:
|
||||||
|
@ -728,9 +731,10 @@ void FIELDS_GRID_TABLE<T>::SetValue( int aRow, int aCol, const wxString &aValue
|
||||||
pos = field.GetTextPos();
|
pos = field.GetTextPos();
|
||||||
|
|
||||||
if( aCol == FDC_POSX )
|
if( aCol == FDC_POSX )
|
||||||
pos.x = ValueFromString( m_frame->GetUserUnits(), aValue );
|
pos.x = EDA_UNIT_UTILS::UI::ValueFromString( schIUScale, m_frame->GetUserUnits(), aValue );
|
||||||
else
|
else
|
||||||
pos.y = ValueFromString( m_frame->GetUserUnits(), aValue );
|
pos.y = EDA_UNIT_UTILS::UI::ValueFromString( schIUScale, m_frame->GetUserUnits(),
|
||||||
|
aValue );
|
||||||
|
|
||||||
field.SetTextPos( pos );
|
field.SetTextPos( pos );
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
|
|
||||||
LIB_FIELD::LIB_FIELD( LIB_SYMBOL* aParent, int aId ) :
|
LIB_FIELD::LIB_FIELD( LIB_SYMBOL* aParent, int aId ) :
|
||||||
LIB_ITEM( LIB_FIELD_T, aParent ),
|
LIB_ITEM( LIB_FIELD_T, aParent ),
|
||||||
EDA_TEXT( Mils2iu( DEFAULT_SIZE_TEXT ) )
|
EDA_TEXT( schIUScale )
|
||||||
{
|
{
|
||||||
Init( aId );
|
Init( aId );
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ LIB_FIELD::LIB_FIELD( LIB_SYMBOL* aParent, int aId ) :
|
||||||
|
|
||||||
LIB_FIELD::LIB_FIELD( int aId ) :
|
LIB_FIELD::LIB_FIELD( int aId ) :
|
||||||
LIB_ITEM( LIB_FIELD_T, nullptr ),
|
LIB_ITEM( LIB_FIELD_T, nullptr ),
|
||||||
EDA_TEXT( Mils2iu( DEFAULT_SIZE_TEXT ) )
|
EDA_TEXT( schIUScale )
|
||||||
{
|
{
|
||||||
Init( aId );
|
Init( aId );
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ LIB_FIELD::LIB_FIELD( int aId ) :
|
||||||
|
|
||||||
LIB_FIELD::LIB_FIELD( int aId, const wxString& aName ) :
|
LIB_FIELD::LIB_FIELD( int aId, const wxString& aName ) :
|
||||||
LIB_ITEM( LIB_FIELD_T, nullptr ),
|
LIB_ITEM( LIB_FIELD_T, nullptr ),
|
||||||
EDA_TEXT( Mils2iu( DEFAULT_SIZE_TEXT ) )
|
EDA_TEXT( schIUScale )
|
||||||
{
|
{
|
||||||
Init( aId );
|
Init( aId );
|
||||||
m_name = aName;
|
m_name = aName;
|
||||||
|
@ -515,7 +515,7 @@ void LIB_FIELD::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_I
|
||||||
|
|
||||||
aList.emplace_back( _( "Style" ), GetTextStyleName() );
|
aList.emplace_back( _( "Style" ), GetTextStyleName() );
|
||||||
|
|
||||||
aList.emplace_back( _( "Text Size" ), MessageTextFromValue( aFrame->GetUserUnits(),
|
aList.emplace_back( _( "Text Size" ), EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, aFrame->GetUserUnits(),
|
||||||
GetTextWidth() ) );
|
GetTextWidth() ) );
|
||||||
|
|
||||||
switch ( GetHorizJustify() )
|
switch ( GetHorizJustify() )
|
||||||
|
|
|
@ -1092,7 +1092,7 @@ void LIB_PIN::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITE
|
||||||
aList.emplace_back( _( "Style" ), IsVisible() ? _( "Yes" ) : _( "No" ) );
|
aList.emplace_back( _( "Style" ), IsVisible() ? _( "Yes" ) : _( "No" ) );
|
||||||
|
|
||||||
// Display pin length
|
// Display pin length
|
||||||
aList.emplace_back( _( "Length" ), MessageTextFromValue( units, m_length, true ) );
|
aList.emplace_back( _( "Length" ), EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, units, m_length, true ) );
|
||||||
|
|
||||||
int i = PinOrientationIndex( m_orientation );
|
int i = PinOrientationIndex( m_orientation );
|
||||||
aList.emplace_back( _( "Orientation" ), PinOrientationName( (unsigned) i ) );
|
aList.emplace_back( _( "Orientation" ), PinOrientationName( (unsigned) i ) );
|
||||||
|
@ -1100,8 +1100,8 @@ void LIB_PIN::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITE
|
||||||
VECTOR2I pinpos = GetPosition();
|
VECTOR2I pinpos = GetPosition();
|
||||||
pinpos.y = -pinpos.y; // Display coords are top to bottom; lib item coords are bottom to top
|
pinpos.y = -pinpos.y; // Display coords are top to bottom; lib item coords are bottom to top
|
||||||
|
|
||||||
aList.emplace_back( _( "Pos X" ), MessageTextFromValue( units, pinpos.x, true ) );
|
aList.emplace_back( _( "Pos X" ), EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, units, pinpos.x, true ) );
|
||||||
aList.emplace_back( _( "Pos Y" ), MessageTextFromValue( units, pinpos.y, true ) );
|
aList.emplace_back( _( "Pos Y" ), EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, units, pinpos.y, true ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -437,16 +437,16 @@ wxString LIB_SHAPE::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||||
{
|
{
|
||||||
case SHAPE_T::ARC:
|
case SHAPE_T::ARC:
|
||||||
return wxString::Format( _( "Arc, radius %s" ),
|
return wxString::Format( _( "Arc, radius %s" ),
|
||||||
MessageTextFromValue( aUnits, GetRadius() ) );
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, aUnits, GetRadius() ) );
|
||||||
|
|
||||||
case SHAPE_T::CIRCLE:
|
case SHAPE_T::CIRCLE:
|
||||||
return wxString::Format( _( "Circle, radius %s" ),
|
return wxString::Format( _( "Circle, radius %s" ),
|
||||||
MessageTextFromValue( aUnits, GetRadius() ) );
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, aUnits, GetRadius() ) );
|
||||||
|
|
||||||
case SHAPE_T::RECT:
|
case SHAPE_T::RECT:
|
||||||
return wxString::Format( _( "Rectangle, width %s height %s" ),
|
return wxString::Format( _( "Rectangle, width %s height %s" ),
|
||||||
MessageTextFromValue( aUnits, std::abs( m_start.x - m_end.x ) ),
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, aUnits, std::abs( m_start.x - m_end.x ) ),
|
||||||
MessageTextFromValue( aUnits, std::abs( m_start.y - m_end.y ) ) );
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, aUnits, std::abs( m_start.y - m_end.y ) ) );
|
||||||
|
|
||||||
case SHAPE_T::POLY:
|
case SHAPE_T::POLY:
|
||||||
return wxString::Format( _( "Polyline, %d points" ),
|
return wxString::Format( _( "Polyline, %d points" ),
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
|
|
||||||
LIB_TEXT::LIB_TEXT( LIB_SYMBOL* aParent ) :
|
LIB_TEXT::LIB_TEXT( LIB_SYMBOL* aParent ) :
|
||||||
LIB_ITEM( LIB_TEXT_T, aParent ),
|
LIB_ITEM( LIB_TEXT_T, aParent ),
|
||||||
EDA_TEXT( Mils2iu( DEFAULT_SIZE_TEXT ), wxEmptyString )
|
EDA_TEXT( schIUScale, wxEmptyString )
|
||||||
{
|
{
|
||||||
SetTextSize( wxSize( Mils2iu( DEFAULT_TEXT_SIZE ), Mils2iu( DEFAULT_TEXT_SIZE ) ) );
|
SetTextSize( wxSize( Mils2iu( DEFAULT_TEXT_SIZE ), Mils2iu( DEFAULT_TEXT_SIZE ) ) );
|
||||||
}
|
}
|
||||||
|
@ -371,7 +371,7 @@ void LIB_TEXT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_IT
|
||||||
|
|
||||||
aList.emplace_back( _( "Style" ), GetTextStyleName() );
|
aList.emplace_back( _( "Style" ), GetTextStyleName() );
|
||||||
|
|
||||||
aList.emplace_back( _( "Text Size" ), MessageTextFromValue( aFrame->GetUserUnits(),
|
aList.emplace_back( _( "Text Size" ), EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, aFrame->GetUserUnits(),
|
||||||
GetTextWidth() ) );
|
GetTextWidth() ) );
|
||||||
|
|
||||||
switch ( GetHorizJustify() )
|
switch ( GetHorizJustify() )
|
||||||
|
|
|
@ -45,7 +45,7 @@ using KIGFX::SCH_RENDER_SETTINGS;
|
||||||
LIB_TEXTBOX::LIB_TEXTBOX( LIB_SYMBOL* aParent, int aLineWidth, FILL_T aFillType,
|
LIB_TEXTBOX::LIB_TEXTBOX( LIB_SYMBOL* aParent, int aLineWidth, FILL_T aFillType,
|
||||||
const wxString& text ) :
|
const wxString& text ) :
|
||||||
LIB_SHAPE( aParent, SHAPE_T::RECT, aLineWidth, aFillType, LIB_TEXTBOX_T ),
|
LIB_SHAPE( aParent, SHAPE_T::RECT, aLineWidth, aFillType, LIB_TEXTBOX_T ),
|
||||||
EDA_TEXT( Mils2iu( DEFAULT_SIZE_TEXT ), text )
|
EDA_TEXT( schIUScale, text )
|
||||||
{
|
{
|
||||||
SetTextSize( wxSize( Mils2iu( DEFAULT_TEXT_SIZE ), Mils2iu( DEFAULT_TEXT_SIZE ) ) );
|
SetTextSize( wxSize( Mils2iu( DEFAULT_TEXT_SIZE ), Mils2iu( DEFAULT_TEXT_SIZE ) ) );
|
||||||
SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
|
SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
|
||||||
|
@ -434,15 +434,15 @@ void LIB_TEXTBOX::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL
|
||||||
int style = IsBold() && IsItalic() ? 3 : IsBold() ? 2 : IsItalic() ? 1 : 0;
|
int style = IsBold() && IsItalic() ? 3 : IsBold() ? 2 : IsItalic() ? 1 : 0;
|
||||||
aList.emplace_back( _( "Style" ), textStyle[style] );
|
aList.emplace_back( _( "Style" ), textStyle[style] );
|
||||||
|
|
||||||
aList.emplace_back( _( "Text Size" ), MessageTextFromValue( units, GetTextWidth() ) );
|
aList.emplace_back( _( "Text Size" ), EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, units, GetTextWidth() ) );
|
||||||
|
|
||||||
wxString msg = MessageTextFromValue( units, std::abs( GetEnd().x - GetStart().x ) );
|
wxString msg = EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, units, std::abs( GetEnd().x - GetStart().x ) );
|
||||||
aList.emplace_back( _( "Box Width" ), msg );
|
aList.emplace_back( _( "Box Width" ), msg );
|
||||||
|
|
||||||
msg = MessageTextFromValue( units, std::abs( GetEnd().y - GetStart().y ) );
|
msg = EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, units, std::abs( GetEnd().y - GetStart().y ) );
|
||||||
aList.emplace_back( _( "Box Height" ), msg );
|
aList.emplace_back( _( "Box Height" ), msg );
|
||||||
|
|
||||||
m_stroke.GetMsgPanelInfo( units, aList );
|
m_stroke.GetMsgPanelInfo( schIUScale, units, aList );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,7 @@ SCH_BASE_FRAME::SCH_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aWindo
|
||||||
const wxString& aTitle, const wxPoint& aPosition,
|
const wxString& aTitle, const wxPoint& aPosition,
|
||||||
const wxSize& aSize, long aStyle, const wxString& aFrameName ) :
|
const wxSize& aSize, long aStyle, const wxString& aFrameName ) :
|
||||||
EDA_DRAW_FRAME( aKiway, aParent, aWindowType, aTitle, aPosition, aSize, aStyle,
|
EDA_DRAW_FRAME( aKiway, aParent, aWindowType, aTitle, aPosition, aSize, aStyle,
|
||||||
aFrameName ),
|
aFrameName, schIUScale ),
|
||||||
m_base_frame_defaults( nullptr, "base_Frame_defaults" )
|
m_base_frame_defaults( nullptr, "base_Frame_defaults" )
|
||||||
#if defined( KICAD_USE_3DCONNEXION )
|
#if defined( KICAD_USE_3DCONNEXION )
|
||||||
,m_spaceMouse( nullptr )
|
,m_spaceMouse( nullptr )
|
||||||
|
@ -184,14 +184,16 @@ void SCH_BASE_FRAME::UpdateStatusBar()
|
||||||
VECTOR2D d = cursorPos - screen->m_LocalOrigin;
|
VECTOR2D d = cursorPos - screen->m_LocalOrigin;
|
||||||
|
|
||||||
line.Printf( "X %s Y %s",
|
line.Printf( "X %s Y %s",
|
||||||
MessageTextFromValue( GetUserUnits(), cursorPos.x, false ),
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( GetIuScale(), GetUserUnits(),
|
||||||
MessageTextFromValue( GetUserUnits(), cursorPos.y, false ) );
|
cursorPos.x, false ),
|
||||||
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( GetIuScale(), GetUserUnits(), cursorPos.y, false ) );
|
||||||
SetStatusText( line, 2 );
|
SetStatusText( line, 2 );
|
||||||
|
|
||||||
line.Printf( "dx %s dy %s dist %s",
|
line.Printf( "dx %s dy %s dist %s",
|
||||||
MessageTextFromValue( GetUserUnits(), d.x, false ),
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( GetIuScale(), GetUserUnits(), d.x, false ),
|
||||||
MessageTextFromValue( GetUserUnits(), d.y, false ),
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( GetIuScale(), GetUserUnits(), d.y, false ),
|
||||||
MessageTextFromValue( GetUserUnits(), hypot( d.x, d.y ), false ) );
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( GetIuScale(), GetUserUnits(),
|
||||||
|
hypot( d.x, d.y ), false ) );
|
||||||
SetStatusText( line, 3 );
|
SetStatusText( line, 3 );
|
||||||
|
|
||||||
DisplayGridMsg();
|
DisplayGridMsg();
|
||||||
|
|
|
@ -204,8 +204,8 @@ void SCH_BITMAP::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_
|
||||||
{
|
{
|
||||||
aList.emplace_back( _( "Bitmap" ), wxEmptyString );
|
aList.emplace_back( _( "Bitmap" ), wxEmptyString );
|
||||||
|
|
||||||
aList.emplace_back( _( "Width" ), MessageTextFromValue( aFrame->GetUserUnits(), GetSize().x ) );
|
aList.emplace_back( _( "Width" ), EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, aFrame->GetUserUnits(), GetSize().x ) );
|
||||||
aList.emplace_back( _( "Height" ), MessageTextFromValue( aFrame->GetUserUnits(), GetSize().y ) );
|
aList.emplace_back( _( "Height" ), EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, aFrame->GetUserUnits(), GetSize().y ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@
|
||||||
SCH_FIELD::SCH_FIELD( const VECTOR2I& aPos, int aFieldId, SCH_ITEM* aParent,
|
SCH_FIELD::SCH_FIELD( const VECTOR2I& aPos, int aFieldId, SCH_ITEM* aParent,
|
||||||
const wxString& aName ) :
|
const wxString& aName ) :
|
||||||
SCH_ITEM( aParent, SCH_FIELD_T ),
|
SCH_ITEM( aParent, SCH_FIELD_T ),
|
||||||
EDA_TEXT( Mils2iu( DEFAULT_SIZE_TEXT ), wxEmptyString ),
|
EDA_TEXT( schIUScale, wxEmptyString ),
|
||||||
m_id( 0 ),
|
m_id( 0 ),
|
||||||
m_name( aName ),
|
m_name( aName ),
|
||||||
m_showName( false ),
|
m_showName( false ),
|
||||||
|
@ -725,7 +725,7 @@ void SCH_FIELD::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_I
|
||||||
|
|
||||||
aList.emplace_back( _( "Style" ), GetTextStyleName() );
|
aList.emplace_back( _( "Style" ), GetTextStyleName() );
|
||||||
|
|
||||||
aList.emplace_back( _( "Text Size" ), MessageTextFromValue( aFrame->GetUserUnits(),
|
aList.emplace_back( _( "Text Size" ), EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, aFrame->GetUserUnits(),
|
||||||
GetTextWidth() ) );
|
GetTextWidth() ) );
|
||||||
|
|
||||||
switch ( GetHorizJustify() )
|
switch ( GetHorizJustify() )
|
||||||
|
|
|
@ -853,7 +853,7 @@ void SCH_LABEL_BASE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PA
|
||||||
int style = IsBold() && IsItalic() ? 3 : IsBold() ? 2 : IsItalic() ? 1 : 0;
|
int style = IsBold() && IsItalic() ? 3 : IsBold() ? 2 : IsItalic() ? 1 : 0;
|
||||||
aList.emplace_back( _( "Style" ), textStyle[style] );
|
aList.emplace_back( _( "Style" ), textStyle[style] );
|
||||||
|
|
||||||
aList.emplace_back( _( "Text Size" ), MessageTextFromValue( aFrame->GetUserUnits(),
|
aList.emplace_back( _( "Text Size" ), EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, aFrame->GetUserUnits(),
|
||||||
GetTextWidth() ) );
|
GetTextWidth() ) );
|
||||||
|
|
||||||
switch( GetTextSpinStyle() )
|
switch( GetTextSpinStyle() )
|
||||||
|
|
|
@ -724,7 +724,7 @@ wxString SCH_LINE::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
return wxString::Format( txtfmt,
|
return wxString::Format( txtfmt,
|
||||||
MessageTextFromValue( aUnits, EuclideanNorm( m_start - m_end ) ) );
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, aUnits, EuclideanNorm( m_start - m_end ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -897,7 +897,7 @@ void SCH_LINE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_IT
|
||||||
if( GetEffectiveLineStyle() != lineStyle )
|
if( GetEffectiveLineStyle() != lineStyle )
|
||||||
aList.emplace_back( _( "Line Style" ), _( "from netclass" ) );
|
aList.emplace_back( _( "Line Style" ), _( "from netclass" ) );
|
||||||
else
|
else
|
||||||
m_stroke.GetMsgPanelInfo( aFrame->GetUserUnits(), aList, true, false );
|
m_stroke.GetMsgPanelInfo( schIUScale, aFrame->GetUserUnits(), aList, true, false );
|
||||||
|
|
||||||
SCH_CONNECTION* conn = nullptr;
|
SCH_CONNECTION* conn = nullptr;
|
||||||
|
|
||||||
|
|
|
@ -222,7 +222,7 @@ void SCH_PIN::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITE
|
||||||
|
|
||||||
aList.emplace_back( _( "Visible" ), IsVisible() ? _( "Yes" ) : _( "No" ) );
|
aList.emplace_back( _( "Visible" ), IsVisible() ? _( "Yes" ) : _( "No" ) );
|
||||||
|
|
||||||
aList.emplace_back( _( "Length" ), MessageTextFromValue( units, GetLength() ), true );
|
aList.emplace_back( _( "Length" ), EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, units, GetLength() ), true );
|
||||||
|
|
||||||
int i = PinOrientationIndex( GetOrientation() );
|
int i = PinOrientationIndex( GetOrientation() );
|
||||||
aList.emplace_back( _( "Orientation" ), PinOrientationName( (unsigned) i ) );
|
aList.emplace_back( _( "Orientation" ), PinOrientationName( (unsigned) i ) );
|
||||||
|
|
|
@ -172,7 +172,7 @@ void SCH_SEXPR_PLUGIN_CACHE::SaveSymbol( LIB_SYMBOL* aSymbol, OUTPUTFORMATTER& a
|
||||||
|
|
||||||
if( aSymbol->GetPinNameOffset() != Mils2iu( DEFAULT_PIN_NAME_OFFSET ) )
|
if( aSymbol->GetPinNameOffset() != Mils2iu( DEFAULT_PIN_NAME_OFFSET ) )
|
||||||
aFormatter.Print( 0, " (offset %s)",
|
aFormatter.Print( 0, " (offset %s)",
|
||||||
FormatInternalUnits( aSymbol->GetPinNameOffset() ).c_str() );
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, aSymbol->GetPinNameOffset() ).c_str() );
|
||||||
|
|
||||||
if( !aSymbol->ShowPinNames() )
|
if( !aSymbol->ShowPinNames() )
|
||||||
aFormatter.Print( 0, " hide" );
|
aFormatter.Print( 0, " hide" );
|
||||||
|
@ -402,8 +402,8 @@ void SCH_SEXPR_PLUGIN_CACHE::saveField( LIB_FIELD* aField, OUTPUTFORMATTER& aFor
|
||||||
aFormatter.Quotew( fieldName ).c_str(),
|
aFormatter.Quotew( fieldName ).c_str(),
|
||||||
aFormatter.Quotew( aField->GetText() ).c_str(),
|
aFormatter.Quotew( aField->GetText() ).c_str(),
|
||||||
aField->GetId(),
|
aField->GetId(),
|
||||||
FormatInternalUnits( aField->GetPosition().x ).c_str(),
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, aField->GetPosition().x ).c_str(),
|
||||||
FormatInternalUnits( aField->GetPosition().y ).c_str(),
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, aField->GetPosition().y ).c_str(),
|
||||||
aField->GetTextAngle().AsDegrees() );
|
aField->GetTextAngle().AsDegrees() );
|
||||||
|
|
||||||
if( aField->IsNameShown() )
|
if( aField->IsNameShown() )
|
||||||
|
@ -427,10 +427,10 @@ void SCH_SEXPR_PLUGIN_CACHE::savePin( LIB_PIN* aPin, OUTPUTFORMATTER& aFormatter
|
||||||
aFormatter.Print( aNestLevel, "(pin %s %s (at %s %s %s) (length %s)",
|
aFormatter.Print( aNestLevel, "(pin %s %s (at %s %s %s) (length %s)",
|
||||||
getPinElectricalTypeToken( aPin->GetType() ),
|
getPinElectricalTypeToken( aPin->GetType() ),
|
||||||
getPinShapeToken( aPin->GetShape() ),
|
getPinShapeToken( aPin->GetShape() ),
|
||||||
FormatInternalUnits( aPin->GetPosition().x ).c_str(),
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, aPin->GetPosition().x ).c_str(),
|
||||||
FormatInternalUnits( aPin->GetPosition().y ).c_str(),
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, aPin->GetPosition().y ).c_str(),
|
||||||
EDA_UNIT_UTILS::FormatAngle( getPinAngle( aPin->GetOrientation() ) ).c_str(),
|
EDA_UNIT_UTILS::FormatAngle( getPinAngle( aPin->GetOrientation() ) ).c_str(),
|
||||||
FormatInternalUnits( aPin->GetLength() ).c_str() );
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, aPin->GetLength() ).c_str() );
|
||||||
|
|
||||||
if( !aPin->IsVisible() )
|
if( !aPin->IsVisible() )
|
||||||
aFormatter.Print( 0, " hide\n" );
|
aFormatter.Print( 0, " hide\n" );
|
||||||
|
@ -440,13 +440,13 @@ void SCH_SEXPR_PLUGIN_CACHE::savePin( LIB_PIN* aPin, OUTPUTFORMATTER& aFormatter
|
||||||
// This follows the EDA_TEXT effects formatting for future expansion.
|
// This follows the EDA_TEXT effects formatting for future expansion.
|
||||||
aFormatter.Print( aNestLevel + 1, "(name %s (effects (font (size %s %s))))\n",
|
aFormatter.Print( aNestLevel + 1, "(name %s (effects (font (size %s %s))))\n",
|
||||||
aFormatter.Quotew( aPin->GetName() ).c_str(),
|
aFormatter.Quotew( aPin->GetName() ).c_str(),
|
||||||
FormatInternalUnits( aPin->GetNameTextSize() ).c_str(),
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, aPin->GetNameTextSize() ).c_str(),
|
||||||
FormatInternalUnits( aPin->GetNameTextSize() ).c_str() );
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, aPin->GetNameTextSize() ).c_str() );
|
||||||
|
|
||||||
aFormatter.Print( aNestLevel + 1, "(number %s (effects (font (size %s %s))))\n",
|
aFormatter.Print( aNestLevel + 1, "(number %s (effects (font (size %s %s))))\n",
|
||||||
aFormatter.Quotew( aPin->GetNumber() ).c_str(),
|
aFormatter.Quotew( aPin->GetNumber() ).c_str(),
|
||||||
FormatInternalUnits( aPin->GetNumberTextSize() ).c_str(),
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, aPin->GetNumberTextSize() ).c_str(),
|
||||||
FormatInternalUnits( aPin->GetNumberTextSize() ).c_str() );
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, aPin->GetNumberTextSize() ).c_str() );
|
||||||
|
|
||||||
|
|
||||||
for( const std::pair<const wxString, LIB_PIN::ALT>& alt : aPin->GetAlternates() )
|
for( const std::pair<const wxString, LIB_PIN::ALT>& alt : aPin->GetAlternates() )
|
||||||
|
@ -469,8 +469,8 @@ void SCH_SEXPR_PLUGIN_CACHE::saveText( LIB_TEXT* aText, OUTPUTFORMATTER& aFormat
|
||||||
aFormatter.Print( aNestLevel, "(text%s %s (at %s %s %g)\n",
|
aFormatter.Print( aNestLevel, "(text%s %s (at %s %s %g)\n",
|
||||||
aText->IsPrivate() ? " private" : "",
|
aText->IsPrivate() ? " private" : "",
|
||||||
aFormatter.Quotew( aText->GetText() ).c_str(),
|
aFormatter.Quotew( aText->GetText() ).c_str(),
|
||||||
FormatInternalUnits( aText->GetPosition().x ).c_str(),
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, aText->GetPosition().x ).c_str(),
|
||||||
FormatInternalUnits( aText->GetPosition().y ).c_str(),
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, aText->GetPosition().y ).c_str(),
|
||||||
(double) aText->GetTextAngle().AsTenthsOfADegree() );
|
(double) aText->GetTextAngle().AsTenthsOfADegree() );
|
||||||
|
|
||||||
aText->EDA_TEXT::Format( &aFormatter, aNestLevel, 0 );
|
aText->EDA_TEXT::Format( &aFormatter, aNestLevel, 0 );
|
||||||
|
@ -491,13 +491,13 @@ void SCH_SEXPR_PLUGIN_CACHE::saveTextBox( LIB_TEXTBOX* aTextBox, OUTPUTFORMATTER
|
||||||
VECTOR2I size = aTextBox->GetEnd() - pos;
|
VECTOR2I size = aTextBox->GetEnd() - pos;
|
||||||
|
|
||||||
aFormatter.Print( aNestLevel + 1, "(at %s %s %s) (size %s %s)\n",
|
aFormatter.Print( aNestLevel + 1, "(at %s %s %s) (size %s %s)\n",
|
||||||
FormatInternalUnits( pos.x ).c_str(),
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, pos.x ).c_str(),
|
||||||
FormatInternalUnits( pos.y ).c_str(),
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, pos.y ).c_str(),
|
||||||
EDA_UNIT_UTILS::FormatAngle( aTextBox->GetTextAngle() ).c_str(),
|
EDA_UNIT_UTILS::FormatAngle( aTextBox->GetTextAngle() ).c_str(),
|
||||||
FormatInternalUnits( size.x ).c_str(),
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, size.x ).c_str(),
|
||||||
FormatInternalUnits( size.y ).c_str() );
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, size.y ).c_str() );
|
||||||
|
|
||||||
aTextBox->GetStroke().Format( &aFormatter, aNestLevel + 1 );
|
aTextBox->GetStroke().Format( &aFormatter, schIUScale, aNestLevel + 1 );
|
||||||
aFormatter.Print( 0, "\n" );
|
aFormatter.Print( 0, "\n" );
|
||||||
|
|
||||||
formatFill( &aFormatter, aNestLevel + 1, aTextBox->GetFillMode(), aTextBox->GetFillColor() );
|
formatFill( &aFormatter, aNestLevel + 1, aTextBox->GetFillMode(), aTextBox->GetFillColor() );
|
||||||
|
|
|
@ -686,8 +686,8 @@ void SCH_SEXPR_PLUGIN::saveSymbol( SCH_SYMBOL* aSymbol, SCH_SHEET_PATH* aSheetPa
|
||||||
|
|
||||||
m_out->Print( 0, " (lib_id %s) (at %s %s %s)",
|
m_out->Print( 0, " (lib_id %s) (at %s %s %s)",
|
||||||
m_out->Quotew( aSymbol->GetLibId().Format().wx_str() ).c_str(),
|
m_out->Quotew( aSymbol->GetLibId().Format().wx_str() ).c_str(),
|
||||||
FormatInternalUnits( aSymbol->GetPosition().x ).c_str(),
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, aSymbol->GetPosition().x ).c_str(),
|
||||||
FormatInternalUnits( aSymbol->GetPosition().y ).c_str(),
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, aSymbol->GetPosition().y ).c_str(),
|
||||||
EDA_UNIT_UTILS::FormatAngle( angle ).c_str() );
|
EDA_UNIT_UTILS::FormatAngle( angle ).c_str() );
|
||||||
|
|
||||||
bool mirrorX = aSymbol->GetOrientation() & SYM_MIRROR_X;
|
bool mirrorX = aSymbol->GetOrientation() & SYM_MIRROR_X;
|
||||||
|
@ -833,8 +833,8 @@ void SCH_SEXPR_PLUGIN::saveField( SCH_FIELD* aField, int aNestLevel )
|
||||||
m_out->Quotew( fieldName ).c_str(),
|
m_out->Quotew( fieldName ).c_str(),
|
||||||
m_out->Quotew( aField->GetText() ).c_str(),
|
m_out->Quotew( aField->GetText() ).c_str(),
|
||||||
aField->GetId(),
|
aField->GetId(),
|
||||||
FormatInternalUnits( aField->GetPosition().x ).c_str(),
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, aField->GetPosition().x ).c_str(),
|
||||||
FormatInternalUnits( aField->GetPosition().y ).c_str(),
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, aField->GetPosition().y ).c_str(),
|
||||||
EDA_UNIT_UTILS::FormatAngle( aField->GetTextAngle() ).c_str() );
|
EDA_UNIT_UTILS::FormatAngle( aField->GetTextAngle() ).c_str() );
|
||||||
|
|
||||||
if( aField->IsNameShown() )
|
if( aField->IsNameShown() )
|
||||||
|
@ -863,8 +863,8 @@ void SCH_SEXPR_PLUGIN::saveBitmap( SCH_BITMAP* aBitmap, int aNestLevel )
|
||||||
wxCHECK_RET( image != nullptr, "wxImage* is NULL" );
|
wxCHECK_RET( image != nullptr, "wxImage* is NULL" );
|
||||||
|
|
||||||
m_out->Print( aNestLevel, "(image (at %s %s)",
|
m_out->Print( aNestLevel, "(image (at %s %s)",
|
||||||
FormatInternalUnits( aBitmap->GetPosition().x ).c_str(),
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, aBitmap->GetPosition().x ).c_str(),
|
||||||
FormatInternalUnits( aBitmap->GetPosition().y ).c_str() );
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, aBitmap->GetPosition().y ).c_str() );
|
||||||
|
|
||||||
if( aBitmap->GetImage()->GetScale() != 1.0 )
|
if( aBitmap->GetImage()->GetScale() != 1.0 )
|
||||||
m_out->Print( 0, " (scale %g)", aBitmap->GetImage()->GetScale() );
|
m_out->Print( 0, " (scale %g)", aBitmap->GetImage()->GetScale() );
|
||||||
|
@ -907,10 +907,10 @@ void SCH_SEXPR_PLUGIN::saveSheet( SCH_SHEET* aSheet, int aNestLevel )
|
||||||
wxCHECK_RET( aSheet != nullptr && m_out != nullptr, "" );
|
wxCHECK_RET( aSheet != nullptr && m_out != nullptr, "" );
|
||||||
|
|
||||||
m_out->Print( aNestLevel, "(sheet (at %s %s) (size %s %s)",
|
m_out->Print( aNestLevel, "(sheet (at %s %s) (size %s %s)",
|
||||||
FormatInternalUnits( aSheet->GetPosition().x ).c_str(),
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, aSheet->GetPosition().x ).c_str(),
|
||||||
FormatInternalUnits( aSheet->GetPosition().y ).c_str(),
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, aSheet->GetPosition().y ).c_str(),
|
||||||
FormatInternalUnits( aSheet->GetSize().GetWidth() ).c_str(),
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, aSheet->GetSize().GetWidth() ).c_str(),
|
||||||
FormatInternalUnits( aSheet->GetSize().GetHeight() ).c_str() );
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, aSheet->GetSize().GetHeight() ).c_str() );
|
||||||
|
|
||||||
if( aSheet->GetFieldsAutoplaced() != FIELDS_AUTOPLACED_NO )
|
if( aSheet->GetFieldsAutoplaced() != FIELDS_AUTOPLACED_NO )
|
||||||
m_out->Print( 0, " (fields_autoplaced)" );
|
m_out->Print( 0, " (fields_autoplaced)" );
|
||||||
|
@ -921,7 +921,7 @@ void SCH_SEXPR_PLUGIN::saveSheet( SCH_SHEET* aSheet, int aNestLevel )
|
||||||
aSheet->GetBorderColor() );
|
aSheet->GetBorderColor() );
|
||||||
|
|
||||||
stroke.SetWidth( aSheet->GetBorderWidth() );
|
stroke.SetWidth( aSheet->GetBorderWidth() );
|
||||||
stroke.Format( m_out, aNestLevel + 1 );
|
stroke.Format( m_out, schIUScale, aNestLevel + 1 );
|
||||||
|
|
||||||
m_out->Print( 0, "\n" );
|
m_out->Print( 0, "\n" );
|
||||||
|
|
||||||
|
@ -945,8 +945,8 @@ void SCH_SEXPR_PLUGIN::saveSheet( SCH_SHEET* aSheet, int aNestLevel )
|
||||||
m_out->Print( aNestLevel + 1, "(pin %s %s (at %s %s %s)\n",
|
m_out->Print( aNestLevel + 1, "(pin %s %s (at %s %s %s)\n",
|
||||||
EscapedUTF8( pin->GetText() ).c_str(),
|
EscapedUTF8( pin->GetText() ).c_str(),
|
||||||
getSheetPinShapeToken( pin->GetShape() ),
|
getSheetPinShapeToken( pin->GetShape() ),
|
||||||
FormatInternalUnits( pin->GetPosition().x ).c_str(),
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, pin->GetPosition().x ).c_str(),
|
||||||
FormatInternalUnits( pin->GetPosition().y ).c_str(),
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, pin->GetPosition().y ).c_str(),
|
||||||
EDA_UNIT_UTILS::FormatAngle( getSheetPinAngle( pin->GetSide() ) ).c_str() );
|
EDA_UNIT_UTILS::FormatAngle( getSheetPinAngle( pin->GetSide() ) ).c_str() );
|
||||||
|
|
||||||
pin->Format( m_out, aNestLevel + 1, 0 );
|
pin->Format( m_out, aNestLevel + 1, 0 );
|
||||||
|
@ -965,9 +965,9 @@ void SCH_SEXPR_PLUGIN::saveJunction( SCH_JUNCTION* aJunction, int aNestLevel )
|
||||||
wxCHECK_RET( aJunction != nullptr && m_out != nullptr, "" );
|
wxCHECK_RET( aJunction != nullptr && m_out != nullptr, "" );
|
||||||
|
|
||||||
m_out->Print( aNestLevel, "(junction (at %s %s) (diameter %s) (color %d %d %d %s)\n",
|
m_out->Print( aNestLevel, "(junction (at %s %s) (diameter %s) (color %d %d %d %s)\n",
|
||||||
FormatInternalUnits( aJunction->GetPosition().x ).c_str(),
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, aJunction->GetPosition().x ).c_str(),
|
||||||
FormatInternalUnits( aJunction->GetPosition().y ).c_str(),
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, aJunction->GetPosition().y ).c_str(),
|
||||||
FormatInternalUnits( aJunction->GetDiameter() ).c_str(),
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, aJunction->GetDiameter() ).c_str(),
|
||||||
KiROUND( aJunction->GetColor().r * 255.0 ),
|
KiROUND( aJunction->GetColor().r * 255.0 ),
|
||||||
KiROUND( aJunction->GetColor().g * 255.0 ),
|
KiROUND( aJunction->GetColor().g * 255.0 ),
|
||||||
KiROUND( aJunction->GetColor().b * 255.0 ),
|
KiROUND( aJunction->GetColor().b * 255.0 ),
|
||||||
|
@ -984,8 +984,8 @@ void SCH_SEXPR_PLUGIN::saveNoConnect( SCH_NO_CONNECT* aNoConnect, int aNestLevel
|
||||||
wxCHECK_RET( aNoConnect != nullptr && m_out != nullptr, "" );
|
wxCHECK_RET( aNoConnect != nullptr && m_out != nullptr, "" );
|
||||||
|
|
||||||
m_out->Print( aNestLevel, "(no_connect (at %s %s) (uuid %s))\n",
|
m_out->Print( aNestLevel, "(no_connect (at %s %s) (uuid %s))\n",
|
||||||
FormatInternalUnits( aNoConnect->GetPosition().x ).c_str(),
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, aNoConnect->GetPosition().x ).c_str(),
|
||||||
FormatInternalUnits( aNoConnect->GetPosition().y ).c_str(),
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, aNoConnect->GetPosition().y ).c_str(),
|
||||||
TO_UTF8( aNoConnect->m_Uuid.AsString() ) );
|
TO_UTF8( aNoConnect->m_Uuid.AsString() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1005,12 +1005,12 @@ void SCH_SEXPR_PLUGIN::saveBusEntry( SCH_BUS_ENTRY_BASE* aBusEntry, int aNestLev
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_out->Print( aNestLevel, "(bus_entry (at %s %s) (size %s %s)\n",
|
m_out->Print( aNestLevel, "(bus_entry (at %s %s) (size %s %s)\n",
|
||||||
FormatInternalUnits( aBusEntry->GetPosition().x ).c_str(),
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, aBusEntry->GetPosition().x ).c_str(),
|
||||||
FormatInternalUnits( aBusEntry->GetPosition().y ).c_str(),
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, aBusEntry->GetPosition().y ).c_str(),
|
||||||
FormatInternalUnits( aBusEntry->GetSize().GetWidth() ).c_str(),
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, aBusEntry->GetSize().GetWidth() ).c_str(),
|
||||||
FormatInternalUnits( aBusEntry->GetSize().GetHeight() ).c_str() );
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, aBusEntry->GetSize().GetHeight() ).c_str() );
|
||||||
|
|
||||||
aBusEntry->GetStroke().Format( m_out, aNestLevel + 1 );
|
aBusEntry->GetStroke().Format( m_out, schIUScale, aNestLevel + 1 );
|
||||||
|
|
||||||
m_out->Print( 0, "\n" );
|
m_out->Print( 0, "\n" );
|
||||||
|
|
||||||
|
@ -1077,12 +1077,12 @@ void SCH_SEXPR_PLUGIN::saveLine( SCH_LINE* aLine, int aNestLevel )
|
||||||
|
|
||||||
m_out->Print( aNestLevel, "(%s (pts (xy %s %s) (xy %s %s))\n",
|
m_out->Print( aNestLevel, "(%s (pts (xy %s %s) (xy %s %s))\n",
|
||||||
TO_UTF8( lineType ),
|
TO_UTF8( lineType ),
|
||||||
FormatInternalUnits( aLine->GetStartPoint().x ).c_str(),
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, aLine->GetStartPoint().x ).c_str(),
|
||||||
FormatInternalUnits( aLine->GetStartPoint().y ).c_str(),
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, aLine->GetStartPoint().y ).c_str(),
|
||||||
FormatInternalUnits( aLine->GetEndPoint().x ).c_str(),
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, aLine->GetEndPoint().x ).c_str(),
|
||||||
FormatInternalUnits( aLine->GetEndPoint().y ).c_str() );
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, aLine->GetEndPoint().y ).c_str() );
|
||||||
|
|
||||||
line_stroke.Format( m_out, aNestLevel + 1 );
|
line_stroke.Format( m_out, schIUScale, aNestLevel + 1 );
|
||||||
m_out->Print( 0, "\n" );
|
m_out->Print( 0, "\n" );
|
||||||
|
|
||||||
m_out->Print( aNestLevel + 1, "(uuid %s)\n", TO_UTF8( aLine->m_Uuid.AsString() ) );
|
m_out->Print( aNestLevel + 1, "(uuid %s)\n", TO_UTF8( aLine->m_Uuid.AsString() ) );
|
||||||
|
@ -1107,7 +1107,7 @@ void SCH_SEXPR_PLUGIN::saveText( SCH_TEXT* aText, int aNestLevel )
|
||||||
SCH_DIRECTIVE_LABEL* flag = static_cast<SCH_DIRECTIVE_LABEL*>( aText );
|
SCH_DIRECTIVE_LABEL* flag = static_cast<SCH_DIRECTIVE_LABEL*>( aText );
|
||||||
|
|
||||||
m_out->Print( 0, " (length %s)",
|
m_out->Print( 0, " (length %s)",
|
||||||
FormatInternalUnits( flag->GetPinLength() ).c_str() );
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, flag->GetPinLength() ).c_str() );
|
||||||
}
|
}
|
||||||
|
|
||||||
EDA_ANGLE angle = aText->GetTextAngle();
|
EDA_ANGLE angle = aText->GetTextAngle();
|
||||||
|
@ -1136,16 +1136,16 @@ void SCH_SEXPR_PLUGIN::saveText( SCH_TEXT* aText, int aNestLevel )
|
||||||
if( aText->GetText().Length() < 50 )
|
if( aText->GetText().Length() < 50 )
|
||||||
{
|
{
|
||||||
m_out->Print( 0, " (at %s %s %s)",
|
m_out->Print( 0, " (at %s %s %s)",
|
||||||
FormatInternalUnits( aText->GetPosition().x ).c_str(),
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, aText->GetPosition().x ).c_str(),
|
||||||
FormatInternalUnits( aText->GetPosition().y ).c_str(),
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, aText->GetPosition().y ).c_str(),
|
||||||
EDA_UNIT_UTILS::FormatAngle( angle ).c_str() );
|
EDA_UNIT_UTILS::FormatAngle( angle ).c_str() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_out->Print( 0, "\n" );
|
m_out->Print( 0, "\n" );
|
||||||
m_out->Print( aNestLevel + 1, "(at %s %s %s)",
|
m_out->Print( aNestLevel + 1, "(at %s %s %s)",
|
||||||
FormatInternalUnits( aText->GetPosition().x ).c_str(),
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, aText->GetPosition().x ).c_str(),
|
||||||
FormatInternalUnits( aText->GetPosition().y ).c_str(),
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, aText->GetPosition().y ).c_str(),
|
||||||
EDA_UNIT_UTILS::FormatAngle( angle ).c_str() );
|
EDA_UNIT_UTILS::FormatAngle( angle ).c_str() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1178,13 +1178,13 @@ void SCH_SEXPR_PLUGIN::saveTextBox( SCH_TEXTBOX* aTextBox, int aNestLevel )
|
||||||
VECTOR2I size = aTextBox->GetEnd() - pos;
|
VECTOR2I size = aTextBox->GetEnd() - pos;
|
||||||
|
|
||||||
m_out->Print( aNestLevel + 1, "(at %s %s %s) (size %s %s)\n",
|
m_out->Print( aNestLevel + 1, "(at %s %s %s) (size %s %s)\n",
|
||||||
FormatInternalUnits( pos.x ).c_str(),
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, pos.x ).c_str(),
|
||||||
FormatInternalUnits( pos.y ).c_str(),
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, pos.y ).c_str(),
|
||||||
EDA_UNIT_UTILS::FormatAngle( aTextBox->GetTextAngle() ).c_str(),
|
EDA_UNIT_UTILS::FormatAngle( aTextBox->GetTextAngle() ).c_str(),
|
||||||
FormatInternalUnits( size.x ).c_str(),
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, size.x ).c_str(),
|
||||||
FormatInternalUnits( size.y ).c_str() );
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, size.y ).c_str() );
|
||||||
|
|
||||||
aTextBox->GetStroke().Format( m_out, aNestLevel + 1 );
|
aTextBox->GetStroke().Format( m_out, schIUScale, aNestLevel + 1 );
|
||||||
m_out->Print( 0, "\n" );
|
m_out->Print( 0, "\n" );
|
||||||
formatFill( m_out, aNestLevel + 1, aTextBox->GetFillMode(), aTextBox->GetFillColor() );
|
formatFill( m_out, aNestLevel + 1, aTextBox->GetFillMode(), aTextBox->GetFillColor() );
|
||||||
m_out->Print( 0, "\n" );
|
m_out->Print( 0, "\n" );
|
||||||
|
|
|
@ -214,11 +214,11 @@ void formatArc( OUTPUTFORMATTER* aFormatter, int aNestLevel, EDA_SHAPE* aArc,
|
||||||
{
|
{
|
||||||
aFormatter->Print( aNestLevel, "(arc%s (start %s) (mid %s) (end %s)\n",
|
aFormatter->Print( aNestLevel, "(arc%s (start %s) (mid %s) (end %s)\n",
|
||||||
aIsPrivate ? " private" : "",
|
aIsPrivate ? " private" : "",
|
||||||
FormatInternalUnits( aArc->GetStart() ).c_str(),
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, aArc->GetStart() ).c_str(),
|
||||||
FormatInternalUnits( aArc->GetArcMid() ).c_str(),
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, aArc->GetArcMid() ).c_str(),
|
||||||
FormatInternalUnits( aArc->GetEnd() ).c_str() );
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, aArc->GetEnd() ).c_str() );
|
||||||
|
|
||||||
aStroke.Format( aFormatter, aNestLevel + 1 );
|
aStroke.Format( aFormatter, schIUScale, aNestLevel + 1 );
|
||||||
aFormatter->Print( 0, "\n" );
|
aFormatter->Print( 0, "\n" );
|
||||||
formatFill( aFormatter, aNestLevel + 1, aFillMode, aFillColor );
|
formatFill( aFormatter, aNestLevel + 1, aFillMode, aFillColor );
|
||||||
aFormatter->Print( 0, "\n" );
|
aFormatter->Print( 0, "\n" );
|
||||||
|
@ -236,11 +236,11 @@ void formatCircle( OUTPUTFORMATTER* aFormatter, int aNestLevel, EDA_SHAPE* aCirc
|
||||||
{
|
{
|
||||||
aFormatter->Print( aNestLevel, "(circle%s (center %s %s) (radius %s)\n",
|
aFormatter->Print( aNestLevel, "(circle%s (center %s %s) (radius %s)\n",
|
||||||
aIsPrivate ? " private" : "",
|
aIsPrivate ? " private" : "",
|
||||||
FormatInternalUnits( aCircle->GetStart().x ).c_str(),
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, aCircle->GetStart().x ).c_str(),
|
||||||
FormatInternalUnits( aCircle->GetStart().y ).c_str(),
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, aCircle->GetStart().y ).c_str(),
|
||||||
FormatInternalUnits( aCircle->GetRadius() ).c_str() );
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, aCircle->GetRadius() ).c_str() );
|
||||||
|
|
||||||
aStroke.Format( aFormatter, aNestLevel + 1 );
|
aStroke.Format( aFormatter, schIUScale, aNestLevel + 1 );
|
||||||
aFormatter->Print( 0, "\n" );
|
aFormatter->Print( 0, "\n" );
|
||||||
formatFill( aFormatter, aNestLevel + 1, aFillMode, aFillColor );
|
formatFill( aFormatter, aNestLevel + 1, aFillMode, aFillColor );
|
||||||
aFormatter->Print( 0, "\n" );
|
aFormatter->Print( 0, "\n" );
|
||||||
|
@ -258,11 +258,11 @@ void formatRect( OUTPUTFORMATTER* aFormatter, int aNestLevel, EDA_SHAPE* aRect,
|
||||||
{
|
{
|
||||||
aFormatter->Print( aNestLevel, "(rectangle%s (start %s %s) (end %s %s)\n",
|
aFormatter->Print( aNestLevel, "(rectangle%s (start %s %s) (end %s %s)\n",
|
||||||
aIsPrivate ? " private" : "",
|
aIsPrivate ? " private" : "",
|
||||||
FormatInternalUnits( aRect->GetStart().x ).c_str(),
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, aRect->GetStart().x ).c_str(),
|
||||||
FormatInternalUnits( aRect->GetStart().y ).c_str(),
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, aRect->GetStart().y ).c_str(),
|
||||||
FormatInternalUnits( aRect->GetEnd().x ).c_str(),
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, aRect->GetEnd().x ).c_str(),
|
||||||
FormatInternalUnits( aRect->GetEnd().y ).c_str() );
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, aRect->GetEnd().y ).c_str() );
|
||||||
aStroke.Format( aFormatter, aNestLevel + 1 );
|
aStroke.Format( aFormatter, schIUScale, aNestLevel + 1 );
|
||||||
aFormatter->Print( 0, "\n" );
|
aFormatter->Print( 0, "\n" );
|
||||||
formatFill( aFormatter, aNestLevel + 1, aFillMode, aFillColor );
|
formatFill( aFormatter, aNestLevel + 1, aFillMode, aFillColor );
|
||||||
aFormatter->Print( 0, "\n" );
|
aFormatter->Print( 0, "\n" );
|
||||||
|
@ -285,13 +285,13 @@ void formatBezier( OUTPUTFORMATTER* aFormatter, int aNestLevel, EDA_SHAPE* aBezi
|
||||||
aBezier->GetBezierC2(), aBezier->GetEnd() } )
|
aBezier->GetBezierC2(), aBezier->GetEnd() } )
|
||||||
{
|
{
|
||||||
aFormatter->Print( 0, " (xy %s %s)",
|
aFormatter->Print( 0, " (xy %s %s)",
|
||||||
FormatInternalUnits( pt.x ).c_str(),
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, pt.x ).c_str(),
|
||||||
FormatInternalUnits( pt.y ).c_str() );
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, pt.y ).c_str() );
|
||||||
}
|
}
|
||||||
|
|
||||||
aFormatter->Print( 0, ")\n" ); // Closes pts token on same line.
|
aFormatter->Print( 0, ")\n" ); // Closes pts token on same line.
|
||||||
|
|
||||||
aStroke.Format( aFormatter, aNestLevel + 1 );
|
aStroke.Format( aFormatter, schIUScale, aNestLevel + 1 );
|
||||||
aFormatter->Print( 0, "\n" );
|
aFormatter->Print( 0, "\n" );
|
||||||
formatFill( aFormatter, aNestLevel + 1, aFillMode, aFillColor );
|
formatFill( aFormatter, aNestLevel + 1, aFillMode, aFillColor );
|
||||||
aFormatter->Print( 0, "\n" );
|
aFormatter->Print( 0, "\n" );
|
||||||
|
@ -319,16 +319,16 @@ void formatPoly( OUTPUTFORMATTER* aFormatter, int aNestLevel, EDA_SHAPE* aPolyLi
|
||||||
{
|
{
|
||||||
aFormatter->Print( 0, "\n" );
|
aFormatter->Print( 0, "\n" );
|
||||||
aFormatter->Print( aNestLevel + 2, "(xy %s %s)",
|
aFormatter->Print( aNestLevel + 2, "(xy %s %s)",
|
||||||
FormatInternalUnits( pt.x ).c_str(),
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, pt.x ).c_str(),
|
||||||
FormatInternalUnits( pt.y ).c_str() );
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, pt.y ).c_str() );
|
||||||
newLine = 0;
|
newLine = 0;
|
||||||
lineCount += 1;
|
lineCount += 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
aFormatter->Print( 0, " (xy %s %s)",
|
aFormatter->Print( 0, " (xy %s %s)",
|
||||||
FormatInternalUnits( pt.x ).c_str(),
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, pt.x ).c_str(),
|
||||||
FormatInternalUnits( pt.y ).c_str() );
|
EDA_UNIT_UTILS::FormatInternalUnits( schIUScale, pt.y ).c_str() );
|
||||||
}
|
}
|
||||||
|
|
||||||
newLine += 1;
|
newLine += 1;
|
||||||
|
@ -344,7 +344,7 @@ void formatPoly( OUTPUTFORMATTER* aFormatter, int aNestLevel, EDA_SHAPE* aPolyLi
|
||||||
aFormatter->Print( aNestLevel + 1, ")\n" ); // Closes pts token with multiple lines.
|
aFormatter->Print( aNestLevel + 1, ")\n" ); // Closes pts token with multiple lines.
|
||||||
}
|
}
|
||||||
|
|
||||||
aStroke.Format( aFormatter, aNestLevel + 1 );
|
aStroke.Format( aFormatter, schIUScale, aNestLevel + 1 );
|
||||||
aFormatter->Print( 0, "\n" );
|
aFormatter->Print( 0, "\n" );
|
||||||
formatFill( aFormatter, aNestLevel + 1, aFillMode, aFillColor );
|
formatFill( aFormatter, aNestLevel + 1, aFillMode, aFillColor );
|
||||||
aFormatter->Print( 0, "\n" );
|
aFormatter->Print( 0, "\n" );
|
||||||
|
|
|
@ -374,16 +374,16 @@ wxString SCH_SHAPE::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||||
{
|
{
|
||||||
case SHAPE_T::ARC:
|
case SHAPE_T::ARC:
|
||||||
return wxString::Format( _( "Arc, radius %s" ),
|
return wxString::Format( _( "Arc, radius %s" ),
|
||||||
MessageTextFromValue( aUnits, GetRadius() ) );
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, aUnits, GetRadius() ) );
|
||||||
|
|
||||||
case SHAPE_T::CIRCLE:
|
case SHAPE_T::CIRCLE:
|
||||||
return wxString::Format( _( "Circle, radius %s" ),
|
return wxString::Format( _( "Circle, radius %s" ),
|
||||||
MessageTextFromValue( aUnits, GetRadius() ) );
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, aUnits, GetRadius() ) );
|
||||||
|
|
||||||
case SHAPE_T::RECT:
|
case SHAPE_T::RECT:
|
||||||
return wxString::Format( _( "Rectangle, width %s height %s" ),
|
return wxString::Format( _( "Rectangle, width %s height %s" ),
|
||||||
MessageTextFromValue( aUnits, std::abs( m_start.x - m_end.x ) ),
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, aUnits, std::abs( m_start.x - m_end.x ) ),
|
||||||
MessageTextFromValue( aUnits, std::abs( m_start.y - m_end.y ) ) );
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, aUnits, std::abs( m_start.y - m_end.y ) ) );
|
||||||
|
|
||||||
case SHAPE_T::POLY:
|
case SHAPE_T::POLY:
|
||||||
return wxString::Format( _( "Polyline, %d points" ),
|
return wxString::Format( _( "Polyline, %d points" ),
|
||||||
|
|
|
@ -114,7 +114,7 @@ TEXT_SPIN_STYLE TEXT_SPIN_STYLE::MirrorY()
|
||||||
|
|
||||||
SCH_TEXT::SCH_TEXT( const VECTOR2I& pos, const wxString& text, KICAD_T aType ) :
|
SCH_TEXT::SCH_TEXT( const VECTOR2I& pos, const wxString& text, KICAD_T aType ) :
|
||||||
SCH_ITEM( nullptr, aType ),
|
SCH_ITEM( nullptr, aType ),
|
||||||
EDA_TEXT( Mils2iu( DEFAULT_SIZE_TEXT ), text )
|
EDA_TEXT( schIUScale, text )
|
||||||
{
|
{
|
||||||
m_layer = LAYER_NOTES;
|
m_layer = LAYER_NOTES;
|
||||||
|
|
||||||
|
@ -498,7 +498,7 @@ void SCH_TEXT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_IT
|
||||||
int style = IsBold() && IsItalic() ? 3 : IsBold() ? 2 : IsItalic() ? 1 : 0;
|
int style = IsBold() && IsItalic() ? 3 : IsBold() ? 2 : IsItalic() ? 1 : 0;
|
||||||
aList.emplace_back( _( "Style" ), textStyle[style] );
|
aList.emplace_back( _( "Style" ), textStyle[style] );
|
||||||
|
|
||||||
aList.emplace_back( _( "Text Size" ), MessageTextFromValue( aFrame->GetUserUnits(),
|
aList.emplace_back( _( "Text Size" ), EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, aFrame->GetUserUnits(),
|
||||||
GetTextWidth() ) );
|
GetTextWidth() ) );
|
||||||
|
|
||||||
switch( GetTextSpinStyle() )
|
switch( GetTextSpinStyle() )
|
||||||
|
|
|
@ -45,7 +45,7 @@ using KIGFX::SCH_RENDER_SETTINGS;
|
||||||
|
|
||||||
SCH_TEXTBOX::SCH_TEXTBOX( int aLineWidth, FILL_T aFillType, const wxString& text ) :
|
SCH_TEXTBOX::SCH_TEXTBOX( int aLineWidth, FILL_T aFillType, const wxString& text ) :
|
||||||
SCH_SHAPE( SHAPE_T::RECT, aLineWidth, aFillType, SCH_TEXTBOX_T ),
|
SCH_SHAPE( SHAPE_T::RECT, aLineWidth, aFillType, SCH_TEXTBOX_T ),
|
||||||
EDA_TEXT( Mils2iu( DEFAULT_SIZE_TEXT ), text )
|
EDA_TEXT( schIUScale, text )
|
||||||
{
|
{
|
||||||
m_layer = LAYER_NOTES;
|
m_layer = LAYER_NOTES;
|
||||||
|
|
||||||
|
@ -446,13 +446,13 @@ void SCH_TEXTBOX::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL
|
||||||
int style = IsBold() && IsItalic() ? 3 : IsBold() ? 2 : IsItalic() ? 1 : 0;
|
int style = IsBold() && IsItalic() ? 3 : IsBold() ? 2 : IsItalic() ? 1 : 0;
|
||||||
aList.emplace_back( _( "Style" ), textStyle[style] );
|
aList.emplace_back( _( "Style" ), textStyle[style] );
|
||||||
|
|
||||||
aList.emplace_back( _( "Text Size" ), MessageTextFromValue( units, GetTextWidth() ) );
|
aList.emplace_back( _( "Text Size" ), EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, units, GetTextWidth() ) );
|
||||||
|
|
||||||
wxString msg = MessageTextFromValue( units, std::abs( GetEnd().x - GetStart().x ) );
|
wxString msg = EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, units, std::abs( GetEnd().x - GetStart().x ) );
|
||||||
aList.emplace_back( _( "Box Width" ), msg );
|
aList.emplace_back( _( "Box Width" ), msg );
|
||||||
|
|
||||||
msg = MessageTextFromValue( units, std::abs( GetEnd().y - GetStart().y ) );
|
msg = EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, units, std::abs( GetEnd().y - GetStart().y ) );
|
||||||
aList.emplace_back( _( "Box Height" ), msg );
|
aList.emplace_back( _( "Box Height" ), msg );
|
||||||
|
|
||||||
m_stroke.GetMsgPanelInfo( units, aList );
|
m_stroke.GetMsgPanelInfo( schIUScale, units, aList );
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,12 +116,12 @@ void CheckLibSymbol( LIB_SYMBOL* aSymbol, std::vector<wxString>& aMessages,
|
||||||
" of converted." ),
|
" of converted." ),
|
||||||
next->GetNumber(),
|
next->GetNumber(),
|
||||||
nextName,
|
nextName,
|
||||||
MessageTextFromValue( aDisplayUnits, next->GetPosition().x ),
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, aDisplayUnits, next->GetPosition().x ),
|
||||||
MessageTextFromValue( aDisplayUnits, -next->GetPosition().y ),
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, aDisplayUnits, -next->GetPosition().y ),
|
||||||
pin->GetNumber(),
|
pin->GetNumber(),
|
||||||
pin->GetName(),
|
pin->GetName(),
|
||||||
MessageTextFromValue( aDisplayUnits, pin->GetPosition().x ),
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, aDisplayUnits, pin->GetPosition().x ),
|
||||||
MessageTextFromValue( aDisplayUnits, -pin->GetPosition().y ) );
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, aDisplayUnits, -pin->GetPosition().y ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -130,12 +130,12 @@ void CheckLibSymbol( LIB_SYMBOL* aSymbol, std::vector<wxString>& aMessages,
|
||||||
" in units %s and %s of converted." ),
|
" in units %s and %s of converted." ),
|
||||||
next->GetNumber(),
|
next->GetNumber(),
|
||||||
nextName,
|
nextName,
|
||||||
MessageTextFromValue( aDisplayUnits, next->GetPosition().x ),
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, aDisplayUnits, next->GetPosition().x ),
|
||||||
MessageTextFromValue( aDisplayUnits, -next->GetPosition().y ),
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, aDisplayUnits, -next->GetPosition().y ),
|
||||||
pin->GetNumber(),
|
pin->GetNumber(),
|
||||||
pinName,
|
pinName,
|
||||||
MessageTextFromValue( aDisplayUnits, pin->GetPosition().x ),
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, aDisplayUnits, pin->GetPosition().x ),
|
||||||
MessageTextFromValue( aDisplayUnits, -pin->GetPosition().y ),
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, aDisplayUnits, -pin->GetPosition().y ),
|
||||||
aSymbol->GetUnitReference( next->GetUnit() ),
|
aSymbol->GetUnitReference( next->GetUnit() ),
|
||||||
aSymbol->GetUnitReference( pin->GetUnit() ) );
|
aSymbol->GetUnitReference( pin->GetUnit() ) );
|
||||||
}
|
}
|
||||||
|
@ -148,12 +148,12 @@ void CheckLibSymbol( LIB_SYMBOL* aSymbol, std::vector<wxString>& aMessages,
|
||||||
" conflicts with pin %s%s at location <b>(%s, %s)</b>." ),
|
" conflicts with pin %s%s at location <b>(%s, %s)</b>." ),
|
||||||
next->GetNumber(),
|
next->GetNumber(),
|
||||||
nextName,
|
nextName,
|
||||||
MessageTextFromValue( aDisplayUnits, next->GetPosition().x ),
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, aDisplayUnits, next->GetPosition().x ),
|
||||||
MessageTextFromValue( aDisplayUnits, -next->GetPosition().y ),
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, aDisplayUnits, -next->GetPosition().y ),
|
||||||
pin->GetNumber(),
|
pin->GetNumber(),
|
||||||
pinName,
|
pinName,
|
||||||
MessageTextFromValue( aDisplayUnits, pin->GetPosition().x ),
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, aDisplayUnits, pin->GetPosition().x ),
|
||||||
MessageTextFromValue( aDisplayUnits, -pin->GetPosition().y ) );
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, aDisplayUnits, -pin->GetPosition().y ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -162,12 +162,12 @@ void CheckLibSymbol( LIB_SYMBOL* aSymbol, std::vector<wxString>& aMessages,
|
||||||
" in units %s and %s." ),
|
" in units %s and %s." ),
|
||||||
next->GetNumber(),
|
next->GetNumber(),
|
||||||
nextName,
|
nextName,
|
||||||
MessageTextFromValue( aDisplayUnits, next->GetPosition().x ),
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, aDisplayUnits, next->GetPosition().x ),
|
||||||
MessageTextFromValue( aDisplayUnits, -next->GetPosition().y ),
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, aDisplayUnits, -next->GetPosition().y ),
|
||||||
pin->GetNumber(),
|
pin->GetNumber(),
|
||||||
pinName,
|
pinName,
|
||||||
MessageTextFromValue( aDisplayUnits, pin->GetPosition().x ),
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, aDisplayUnits, pin->GetPosition().x ),
|
||||||
MessageTextFromValue( aDisplayUnits, -pin->GetPosition().y ),
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, aDisplayUnits, -pin->GetPosition().y ),
|
||||||
aSymbol->GetUnitReference( next->GetUnit() ),
|
aSymbol->GetUnitReference( next->GetUnit() ),
|
||||||
aSymbol->GetUnitReference( pin->GetUnit() ) );
|
aSymbol->GetUnitReference( pin->GetUnit() ) );
|
||||||
}
|
}
|
||||||
|
@ -242,8 +242,8 @@ void CheckLibSymbol( LIB_SYMBOL* aSymbol, std::vector<wxString>& aMessages,
|
||||||
" of converted." ),
|
" of converted." ),
|
||||||
pin->GetNumber(),
|
pin->GetNumber(),
|
||||||
pinName,
|
pinName,
|
||||||
MessageTextFromValue( aDisplayUnits, pin->GetPosition().x ),
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, aDisplayUnits, pin->GetPosition().x ),
|
||||||
MessageTextFromValue( aDisplayUnits, -pin->GetPosition().y ) );
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, aDisplayUnits, -pin->GetPosition().y ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -251,8 +251,8 @@ void CheckLibSymbol( LIB_SYMBOL* aSymbol, std::vector<wxString>& aMessages,
|
||||||
" in unit %c of converted." ),
|
" in unit %c of converted." ),
|
||||||
pin->GetNumber(),
|
pin->GetNumber(),
|
||||||
pinName,
|
pinName,
|
||||||
MessageTextFromValue( aDisplayUnits, pin->GetPosition().x ),
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, aDisplayUnits, pin->GetPosition().x ),
|
||||||
MessageTextFromValue( aDisplayUnits, -pin->GetPosition().y ),
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, aDisplayUnits, -pin->GetPosition().y ),
|
||||||
'A' + pin->GetUnit() - 1 );
|
'A' + pin->GetUnit() - 1 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -263,8 +263,8 @@ void CheckLibSymbol( LIB_SYMBOL* aSymbol, std::vector<wxString>& aMessages,
|
||||||
msg.Printf( _( "Info: <b>Hidden power pin %s</b> %s at location <b>(%s, %s)</b>." ),
|
msg.Printf( _( "Info: <b>Hidden power pin %s</b> %s at location <b>(%s, %s)</b>." ),
|
||||||
pin->GetNumber(),
|
pin->GetNumber(),
|
||||||
pinName,
|
pinName,
|
||||||
MessageTextFromValue( aDisplayUnits, pin->GetPosition().x ),
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, aDisplayUnits, pin->GetPosition().x ),
|
||||||
MessageTextFromValue( aDisplayUnits, -pin->GetPosition().y ) );
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, aDisplayUnits, -pin->GetPosition().y ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -272,8 +272,8 @@ void CheckLibSymbol( LIB_SYMBOL* aSymbol, std::vector<wxString>& aMessages,
|
||||||
" in unit %c." ),
|
" in unit %c." ),
|
||||||
pin->GetNumber(),
|
pin->GetNumber(),
|
||||||
pinName,
|
pinName,
|
||||||
MessageTextFromValue( aDisplayUnits, pin->GetPosition().x ),
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, aDisplayUnits, pin->GetPosition().x ),
|
||||||
MessageTextFromValue( aDisplayUnits, -pin->GetPosition().y ),
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, aDisplayUnits, -pin->GetPosition().y ),
|
||||||
'A' + pin->GetUnit() - 1 );
|
'A' + pin->GetUnit() - 1 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -296,8 +296,8 @@ void CheckLibSymbol( LIB_SYMBOL* aSymbol, std::vector<wxString>& aMessages,
|
||||||
" of converted." ),
|
" of converted." ),
|
||||||
pin->GetNumber(),
|
pin->GetNumber(),
|
||||||
pinName,
|
pinName,
|
||||||
MessageTextFromValue( aDisplayUnits, pin->GetPosition().x ),
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, aDisplayUnits, pin->GetPosition().x ),
|
||||||
MessageTextFromValue( aDisplayUnits, -pin->GetPosition().y ) );
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, aDisplayUnits, -pin->GetPosition().y ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -305,8 +305,8 @@ void CheckLibSymbol( LIB_SYMBOL* aSymbol, std::vector<wxString>& aMessages,
|
||||||
" in unit %c of converted." ),
|
" in unit %c of converted." ),
|
||||||
pin->GetNumber(),
|
pin->GetNumber(),
|
||||||
pinName,
|
pinName,
|
||||||
MessageTextFromValue( aDisplayUnits, pin->GetPosition().x ),
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, aDisplayUnits, pin->GetPosition().x ),
|
||||||
MessageTextFromValue( aDisplayUnits, -pin->GetPosition().y ),
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, aDisplayUnits, -pin->GetPosition().y ),
|
||||||
'A' + pin->GetUnit() - 1 );
|
'A' + pin->GetUnit() - 1 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -317,8 +317,8 @@ void CheckLibSymbol( LIB_SYMBOL* aSymbol, std::vector<wxString>& aMessages,
|
||||||
msg.Printf( _( "<b>Off grid pin %s</b> %s at location <b>(%s, %s)</b>." ),
|
msg.Printf( _( "<b>Off grid pin %s</b> %s at location <b>(%s, %s)</b>." ),
|
||||||
pin->GetNumber(),
|
pin->GetNumber(),
|
||||||
pinName,
|
pinName,
|
||||||
MessageTextFromValue( aDisplayUnits, pin->GetPosition().x ),
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, aDisplayUnits, pin->GetPosition().x ),
|
||||||
MessageTextFromValue( aDisplayUnits, -pin->GetPosition().y ) );
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, aDisplayUnits, -pin->GetPosition().y ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -326,8 +326,8 @@ void CheckLibSymbol( LIB_SYMBOL* aSymbol, std::vector<wxString>& aMessages,
|
||||||
" in unit %c." ),
|
" in unit %c." ),
|
||||||
pin->GetNumber(),
|
pin->GetNumber(),
|
||||||
pinName,
|
pinName,
|
||||||
MessageTextFromValue( aDisplayUnits, pin->GetPosition().x ),
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, aDisplayUnits, pin->GetPosition().x ),
|
||||||
MessageTextFromValue( aDisplayUnits, -pin->GetPosition().y ),
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( schIUScale, aDisplayUnits, -pin->GetPosition().y ),
|
||||||
'A' + pin->GetUnit() - 1 );
|
'A' + pin->GetUnit() - 1 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,6 @@ set( GERBVIEW_SRCS
|
||||||
)
|
)
|
||||||
|
|
||||||
set( GERBVIEW_EXTRA_SRCS
|
set( GERBVIEW_EXTRA_SRCS
|
||||||
${CMAKE_SOURCE_DIR}/common/base_units.cpp
|
|
||||||
${CMAKE_SOURCE_DIR}/common/widgets/layer_box_selector.cpp
|
${CMAKE_SOURCE_DIR}/common/widgets/layer_box_selector.cpp
|
||||||
${CMAKE_SOURCE_DIR}/common/lset.cpp
|
${CMAKE_SOURCE_DIR}/common/lset.cpp
|
||||||
)
|
)
|
||||||
|
|
|
@ -661,10 +661,10 @@ void GERBER_DRAW_ITEM::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_
|
||||||
aList.emplace_back( _( "Graphic Layer" ), msg );
|
aList.emplace_back( _( "Graphic Layer" ), msg );
|
||||||
|
|
||||||
// Display item position
|
// Display item position
|
||||||
auto xStart = To_User_Unit( aFrame->GetUserUnits(), m_Start.x );
|
auto xStart = EDA_UNIT_UTILS::UI::ToUserUnit( gerbIUScale, aFrame->GetUserUnits(), m_Start.x );
|
||||||
auto yStart = To_User_Unit( aFrame->GetUserUnits(), m_Start.y );
|
auto yStart = EDA_UNIT_UTILS::UI::ToUserUnit( gerbIUScale, aFrame->GetUserUnits(), m_Start.y );
|
||||||
auto xEnd = To_User_Unit( aFrame->GetUserUnits(), m_End.x );
|
auto xEnd = EDA_UNIT_UTILS::UI::ToUserUnit( gerbIUScale, aFrame->GetUserUnits(), m_End.x );
|
||||||
auto yEnd = To_User_Unit( aFrame->GetUserUnits(), m_End.y );
|
auto yEnd = EDA_UNIT_UTILS::UI::ToUserUnit( gerbIUScale, aFrame->GetUserUnits(), m_End.y );
|
||||||
|
|
||||||
if( m_Flashed )
|
if( m_Flashed )
|
||||||
{
|
{
|
||||||
|
|
|
@ -58,7 +58,8 @@
|
||||||
|
|
||||||
GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent )
|
GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent )
|
||||||
: EDA_DRAW_FRAME( aKiway, aParent, FRAME_GERBER, wxT( "GerbView" ), wxDefaultPosition,
|
: EDA_DRAW_FRAME( aKiway, aParent, FRAME_GERBER, wxT( "GerbView" ), wxDefaultPosition,
|
||||||
wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, GERBVIEW_FRAME_NAME ),
|
wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, GERBVIEW_FRAME_NAME,
|
||||||
|
gerbIUScale ),
|
||||||
m_TextInfo( nullptr ),
|
m_TextInfo( nullptr ),
|
||||||
m_zipFileHistory( DEFAULT_FILE_HISTORY_SIZE, ID_GERBVIEW_ZIP_FILE1,
|
m_zipFileHistory( DEFAULT_FILE_HISTORY_SIZE, ID_GERBVIEW_ZIP_FILE1,
|
||||||
ID_GERBVIEW_ZIP_FILE_LIST_CLEAR, _( "Clear Recent Zip Files" ) ),
|
ID_GERBVIEW_ZIP_FILE_LIST_CLEAR, _( "Clear Recent Zip Files" ) ),
|
||||||
|
@ -899,8 +900,10 @@ void GERBVIEW_FRAME::DisplayGridMsg()
|
||||||
wxString line;
|
wxString line;
|
||||||
|
|
||||||
line.Printf( wxT( "grid X %s Y %s" ),
|
line.Printf( wxT( "grid X %s Y %s" ),
|
||||||
MessageTextFromValue( m_userUnits, gridSize.x, false ),
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( GetIuScale(), m_userUnits, gridSize.x,
|
||||||
MessageTextFromValue( m_userUnits, gridSize.y, false ) );
|
false ),
|
||||||
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( GetIuScale(), m_userUnits, gridSize.y,
|
||||||
|
false ) );
|
||||||
|
|
||||||
SetStatusText( line, 4 );
|
SetStatusText( line, 4 );
|
||||||
SetStatusText( line, 4 );
|
SetStatusText( line, 4 );
|
||||||
|
@ -924,16 +927,18 @@ void GERBVIEW_FRAME::UpdateStatusBar()
|
||||||
double ro = hypot( v.x, v.y );
|
double ro = hypot( v.x, v.y );
|
||||||
|
|
||||||
line.Printf( wxT( "r %s theta %s" ),
|
line.Printf( wxT( "r %s theta %s" ),
|
||||||
MessageTextFromValue( GetUserUnits(), ro, false ),
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( GetIuScale(), GetUserUnits(), ro, false ),
|
||||||
MessageTextFromValue( EDA_UNITS::DEGREES, theta.AsDegrees(), false ) );
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( GetIuScale(), EDA_UNITS::DEGREES, theta.AsDegrees(), false ) );
|
||||||
|
|
||||||
SetStatusText( line, 3 );
|
SetStatusText( line, 3 );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Display absolute coordinates:
|
// Display absolute coordinates:
|
||||||
line.Printf( wxT( "X %s Y %s" ),
|
line.Printf( wxT( "X %s Y %s" ),
|
||||||
MessageTextFromValue( GetUserUnits(), cursorPos.x, false ),
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( GetIuScale(), GetUserUnits(),
|
||||||
MessageTextFromValue( GetUserUnits(), cursorPos.y, false ) );
|
cursorPos.x, false ),
|
||||||
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( GetIuScale(), GetUserUnits(),
|
||||||
|
cursorPos.y, false ) );
|
||||||
SetStatusText( line, 2 );
|
SetStatusText( line, 2 );
|
||||||
|
|
||||||
if( !GetShowPolarCoords() )
|
if( !GetShowPolarCoords() )
|
||||||
|
@ -943,9 +948,12 @@ void GERBVIEW_FRAME::UpdateStatusBar()
|
||||||
double dYpos = cursorPos.y - GetScreen()->m_LocalOrigin.y;
|
double dYpos = cursorPos.y - GetScreen()->m_LocalOrigin.y;
|
||||||
|
|
||||||
line.Printf( wxT( "dx %s dy %s dist %s" ),
|
line.Printf( wxT( "dx %s dy %s dist %s" ),
|
||||||
MessageTextFromValue( GetUserUnits(), dXpos, false ),
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( GetIuScale(), GetUserUnits(), dXpos,
|
||||||
MessageTextFromValue( GetUserUnits(), dYpos, false ),
|
false ),
|
||||||
MessageTextFromValue( GetUserUnits(), hypot( dXpos, dYpos ), false ) );
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( GetIuScale(), GetUserUnits(), dYpos,
|
||||||
|
false ),
|
||||||
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( GetIuScale(), GetUserUnits(),
|
||||||
|
hypot( dXpos, dYpos ), false ) );
|
||||||
SetStatusText( line, 3 );
|
SetStatusText( line, 3 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -205,7 +205,7 @@ int GERBVIEW_INSPECTION_TOOL::MeasureTool( const TOOL_EVENT& aEvent )
|
||||||
bool originSet = false;
|
bool originSet = false;
|
||||||
TWO_POINT_GEOMETRY_MANAGER twoPtMgr;
|
TWO_POINT_GEOMETRY_MANAGER twoPtMgr;
|
||||||
EDA_UNITS units = m_frame->GetUserUnits();
|
EDA_UNITS units = m_frame->GetUserUnits();
|
||||||
KIGFX::PREVIEW::RULER_ITEM ruler( twoPtMgr, units, false, false );
|
KIGFX::PREVIEW::RULER_ITEM ruler( twoPtMgr, gerbIUScale, units, false, false );
|
||||||
|
|
||||||
std::string tool = *aEvent.GetCommandStr();
|
std::string tool = *aEvent.GetCommandStr();
|
||||||
m_frame->PushTool( tool );
|
m_frame->PushTool( tool );
|
||||||
|
|
|
@ -48,117 +48,6 @@
|
||||||
#define INDETERMINATE_STATE _( "-- mixed values --" )
|
#define INDETERMINATE_STATE _( "-- mixed values --" )
|
||||||
#define INDETERMINATE_ACTION _( "-- leave unchanged --" )
|
#define INDETERMINATE_ACTION _( "-- leave unchanged --" )
|
||||||
|
|
||||||
/**
|
|
||||||
* Function To_User_Unit
|
|
||||||
* convert \a aValue in internal units to the appropriate user units defined by \a aUnit.
|
|
||||||
*
|
|
||||||
* @return The converted value, in double
|
|
||||||
* @param aUnit The units to convert \a aValue to.
|
|
||||||
* @param aValue The value in internal units to convert.
|
|
||||||
*/
|
|
||||||
double To_User_Unit( EDA_UNITS aUnit, double aValue );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function MessageTextFromValue
|
|
||||||
* is a helper to convert the \a double length \a aValue to a string in inches,
|
|
||||||
* millimeters, or unscaled units.
|
|
||||||
*
|
|
||||||
* Should be used only to display a coordinate in status, but not in dialogs,
|
|
||||||
* files, etc., because the mantissa of the number displayed has 4 digits max
|
|
||||||
* for readability. The actual internal value could need up to 8 digits to be
|
|
||||||
* printed.
|
|
||||||
*
|
|
||||||
* Use StringFromValue() instead where precision matters.
|
|
||||||
*
|
|
||||||
* @param aUnits The units to show the value in. The unit string is added to the
|
|
||||||
* message text.
|
|
||||||
* @param aValue The double value to convert.
|
|
||||||
* @param aAddUnitLabel If true, adds the unit label to the end of the string
|
|
||||||
* @param aType Type of the unit being used (e.g. distance, area, etc.)
|
|
||||||
* @return The converted string for display in user interface elements.
|
|
||||||
*/
|
|
||||||
wxString MessageTextFromValue( EDA_UNITS aUnits, double aValue, bool aAddUnitLabel = true,
|
|
||||||
EDA_DATA_TYPE aType = EDA_DATA_TYPE::DISTANCE );
|
|
||||||
|
|
||||||
wxString MessageTextFromValue( EDA_UNITS aUnits, int aValue, bool aAddUnitLabel = true,
|
|
||||||
EDA_DATA_TYPE aType = EDA_DATA_TYPE::DISTANCE );
|
|
||||||
|
|
||||||
wxString MessageTextFromValue( EDA_UNITS aUnits, long long int aValue, bool aAddUnitLabel = true,
|
|
||||||
EDA_DATA_TYPE aType = EDA_DATA_TYPE::DISTANCE );
|
|
||||||
|
|
||||||
wxString MessageTextFromValue( EDA_ANGLE aValue, bool aAddUnitLabel = true );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function StringFromValue
|
|
||||||
* returns the string from \a aValue according to units (inch, mm ...) for display,
|
|
||||||
* and the initial unit for value.
|
|
||||||
*
|
|
||||||
* For readability, the mantissa has 3 or more digits (max 8 digits),
|
|
||||||
* the trailing 0 are removed if the mantissa has more than 3 digits
|
|
||||||
* and some trailing 0
|
|
||||||
* This function should be used to display values in dialogs because a value
|
|
||||||
* entered in mm (for instance 2.0 mm) could need up to 8 digits mantissa
|
|
||||||
* if displayed in inch to avoid truncation or rounding made just by the printf function.
|
|
||||||
* otherwise the actual value is rounded when read from dialog and converted
|
|
||||||
* in internal units, and therefore modified.
|
|
||||||
*
|
|
||||||
* @param aUnit = display units (INCHES, MILLIMETRE ..)
|
|
||||||
* @param aValue = value in Internal_Unit
|
|
||||||
* @param aAddUnitSymbol = true to add symbol unit to the string value
|
|
||||||
* @return A wxString object containing value and optionally the symbol unit (like 2.000 mm)
|
|
||||||
*/
|
|
||||||
wxString StringFromValue( EDA_UNITS aUnit, double aValue, bool aAddUnitSymbol = false,
|
|
||||||
EDA_DATA_TYPE aType = EDA_DATA_TYPE::DISTANCE );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return in internal units the value "val" given in a real unit
|
|
||||||
* such as "in", "mm" or "deg"
|
|
||||||
*/
|
|
||||||
double From_User_Unit( EDA_UNITS aUnit, double aValue );
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function DoubleValueFromString
|
|
||||||
* converts \a aTextValue to a double
|
|
||||||
* @warning This utilizes the current locale and will break if decimal formats differ
|
|
||||||
*
|
|
||||||
* @param aUnits The units of \a aTextValue.
|
|
||||||
* @param aTextValue A reference to a wxString object containing the string to convert.
|
|
||||||
* @return A double representing that value in internal units
|
|
||||||
*/
|
|
||||||
double DoubleValueFromString( EDA_UNITS aUnits, const wxString& aTextValue,
|
|
||||||
EDA_DATA_TYPE aType = EDA_DATA_TYPE::DISTANCE );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function ValueFromString
|
|
||||||
* converts \a aTextValue in \a aUnits to internal units used by the application.
|
|
||||||
* @warning This utilizes the current locale and will break if decimal formats differ
|
|
||||||
*
|
|
||||||
* @param aUnits The units of \a aTextValue.
|
|
||||||
* @param aTextValue A reference to a wxString object containing the string to convert.
|
|
||||||
* @return The string from Value, according to units (inch, mm ...) for display,
|
|
||||||
*/
|
|
||||||
long long int ValueFromString( EDA_UNITS aUnits, const wxString& aTextValue,
|
|
||||||
EDA_DATA_TYPE aType = EDA_DATA_TYPE::DISTANCE );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function FormatInternalUnits
|
|
||||||
* converts \a aValue from internal units to a string appropriate for writing
|
|
||||||
* to file.
|
|
||||||
*
|
|
||||||
* @note Internal units for board items can be either deci-mils or nanometers depending
|
|
||||||
* on how KiCad is built.
|
|
||||||
*
|
|
||||||
* @param aValue A coordinate value to convert.
|
|
||||||
* @return A std::string object containing the converted value.
|
|
||||||
*/
|
|
||||||
std::string FormatInternalUnits( int aValue );
|
|
||||||
|
|
||||||
std::string FormatInternalUnits( const wxPoint& aPoint );
|
|
||||||
|
|
||||||
std::string FormatInternalUnits( const wxSize& aSize );
|
|
||||||
|
|
||||||
std::string FormatInternalUnits( const VECTOR2I& aPoint );
|
|
||||||
|
|
||||||
|
|
||||||
#endif // _BASE_UNITS_H_
|
#endif // _BASE_UNITS_H_
|
||||||
|
|
|
@ -71,6 +71,23 @@ constexpr double PCB_IU_PER_MM = 1e6; // Pcbnew IU is 1 nanometer.
|
||||||
constexpr double PL_IU_PER_MM = 1e3; // internal units in micron (should be enough)
|
constexpr double PL_IU_PER_MM = 1e3; // internal units in micron (should be enough)
|
||||||
constexpr double SCH_IU_PER_MM = 1e4; // Schematic internal units 1=100nm
|
constexpr double SCH_IU_PER_MM = 1e4; // Schematic internal units 1=100nm
|
||||||
|
|
||||||
|
|
||||||
|
struct EDA_IU_SCALE
|
||||||
|
{
|
||||||
|
const double IU_PER_MM;
|
||||||
|
const double IU_PER_MILS;
|
||||||
|
|
||||||
|
constexpr EDA_IU_SCALE( double aIUPerMM ) :
|
||||||
|
IU_PER_MM( aIUPerMM ), IU_PER_MILS( aIUPerMM * 0.0254 )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
constexpr EDA_IU_SCALE gerbIUScale = EDA_IU_SCALE( GERB_IU_PER_MM );
|
||||||
|
constexpr EDA_IU_SCALE pcbIUScale = EDA_IU_SCALE( PCB_IU_PER_MM );
|
||||||
|
constexpr EDA_IU_SCALE drawSheetIUScale = EDA_IU_SCALE( PL_IU_PER_MM );
|
||||||
|
constexpr EDA_IU_SCALE schIUScale = EDA_IU_SCALE( SCH_IU_PER_MM );
|
||||||
|
|
||||||
/// Scaling factor to convert mils to internal units.
|
/// Scaling factor to convert mils to internal units.
|
||||||
#if defined(PCBNEW) || defined(CVPCB)
|
#if defined(PCBNEW) || defined(CVPCB)
|
||||||
constexpr double IU_PER_MM = PCB_IU_PER_MM;
|
constexpr double IU_PER_MM = PCB_IU_PER_MM;
|
||||||
|
|
|
@ -306,7 +306,7 @@ public:
|
||||||
bool aItalic = false, bool aBold = false,
|
bool aItalic = false, bool aBold = false,
|
||||||
const KIGFX::COLOR4D& aColor = KIGFX::COLOR4D::UNSPECIFIED ) :
|
const KIGFX::COLOR4D& aColor = KIGFX::COLOR4D::UNSPECIFIED ) :
|
||||||
DS_DRAW_ITEM_BASE( aPeer, aIndex, WSG_TEXT_T),
|
DS_DRAW_ITEM_BASE( aPeer, aIndex, WSG_TEXT_T),
|
||||||
EDA_TEXT( 0, aText )
|
EDA_TEXT( drawSheetIUScale, aText )
|
||||||
{
|
{
|
||||||
SetTextPos( aPos );
|
SetTextPos( aPos );
|
||||||
SetTextSize( aSize );
|
SetTextSize( aSize );
|
||||||
|
|
|
@ -73,7 +73,7 @@ class EDA_DRAW_FRAME : public KIWAY_PLAYER
|
||||||
public:
|
public:
|
||||||
EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType, const wxString& aTitle,
|
EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType, const wxString& aTitle,
|
||||||
const wxPoint& aPos, const wxSize& aSize, long aStyle,
|
const wxPoint& aPos, const wxSize& aSize, long aStyle,
|
||||||
const wxString& aFrameName );
|
const wxString& aFrameName, const EDA_IU_SCALE& aIuScale );
|
||||||
|
|
||||||
~EDA_DRAW_FRAME();
|
~EDA_DRAW_FRAME();
|
||||||
|
|
||||||
|
@ -450,6 +450,8 @@ public:
|
||||||
*/
|
*/
|
||||||
void ShowChangedLanguage() override;
|
void ShowChangedLanguage() override;
|
||||||
|
|
||||||
|
const EDA_IU_SCALE& GetIuScale() const { return m_iuScale; }
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -523,6 +525,7 @@ protected:
|
||||||
private:
|
private:
|
||||||
BASE_SCREEN* m_currentScreen; ///< current used SCREEN
|
BASE_SCREEN* m_currentScreen; ///< current used SCREEN
|
||||||
EDA_DRAW_PANEL_GAL* m_canvas;
|
EDA_DRAW_PANEL_GAL* m_canvas;
|
||||||
|
const EDA_IU_SCALE& m_iuScale;
|
||||||
|
|
||||||
///< This the frame's interface to setting GAL display options.
|
///< This the frame's interface to setting GAL display options.
|
||||||
KIGFX::GAL_DISPLAY_OPTIONS m_galDisplayOptions;
|
KIGFX::GAL_DISPLAY_OPTIONS m_galDisplayOptions;
|
||||||
|
|
|
@ -71,7 +71,7 @@ using KIGFX::COLOR4D;
|
||||||
class EDA_TEXT
|
class EDA_TEXT
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
EDA_TEXT( int aDefaultSizeIu, const wxString& aText = wxEmptyString );
|
EDA_TEXT( const EDA_IU_SCALE& aIuScale, const wxString& aText = wxEmptyString );
|
||||||
|
|
||||||
EDA_TEXT( const EDA_TEXT& aText );
|
EDA_TEXT( const EDA_TEXT& aText );
|
||||||
|
|
||||||
|
@ -378,6 +378,8 @@ private:
|
||||||
wxString m_shown_text; // Cache of unescaped text for efficient access
|
wxString m_shown_text; // Cache of unescaped text for efficient access
|
||||||
bool m_shown_text_has_text_var_refs;
|
bool m_shown_text_has_text_var_refs;
|
||||||
|
|
||||||
|
std::reference_wrapper<const EDA_IU_SCALE> m_IuScale;
|
||||||
|
|
||||||
mutable wxString m_render_cache_text;
|
mutable wxString m_render_cache_text;
|
||||||
mutable EDA_ANGLE m_render_cache_angle;
|
mutable EDA_ANGLE m_render_cache_angle;
|
||||||
mutable VECTOR2I m_render_cache_offset;
|
mutable VECTOR2I m_render_cache_offset;
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
|
|
||||||
#include <wx/string.h>
|
#include <wx/string.h>
|
||||||
#include <geometry/eda_angle.h>
|
#include <geometry/eda_angle.h>
|
||||||
|
#include <convert_to_biu.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The type of unit.
|
* The type of unit.
|
||||||
|
@ -87,6 +88,133 @@ namespace EDA_UNIT_UTILS
|
||||||
* @return std::string object containing the converted angle.
|
* @return std::string object containing the converted angle.
|
||||||
*/
|
*/
|
||||||
std::string FormatAngle( const EDA_ANGLE& aAngle );
|
std::string FormatAngle( const EDA_ANGLE& aAngle );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts \a aValue from internal units to a string appropriate for writing
|
||||||
|
* to file.
|
||||||
|
*
|
||||||
|
* @note Internal units for board items can be either deci-mils or nanometers depending
|
||||||
|
* on how KiCad is built.
|
||||||
|
*
|
||||||
|
* @param aValue A coordinate value to convert.
|
||||||
|
* @return A std::string object containing the converted value.
|
||||||
|
*/
|
||||||
|
std::string FormatInternalUnits( const EDA_IU_SCALE& aIuScale, int aValue );
|
||||||
|
std::string FormatInternalUnits( const EDA_IU_SCALE& aIuScale, const wxPoint& aPoint );
|
||||||
|
std::string FormatInternalUnits( const EDA_IU_SCALE& aIuScale, const wxSize& aSize );
|
||||||
|
std::string FormatInternalUnits( const EDA_IU_SCALE& aIuScale, const VECTOR2I& aPoint );
|
||||||
|
|
||||||
|
constexpr inline int Mils2IU( const EDA_IU_SCALE& aIuScale, int mils )
|
||||||
|
{
|
||||||
|
double x = mils * aIuScale.IU_PER_MILS;
|
||||||
|
return int( x < 0 ? x - 0.5 : x + 0.5 );
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace UI
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Function To_User_Unit
|
||||||
|
* convert \a aValue in internal units to the appropriate user units defined by \a aUnit.
|
||||||
|
*
|
||||||
|
* @return The converted value, in double
|
||||||
|
* @param aUnit The units to convert \a aValue to.
|
||||||
|
* @param aValue The value in internal units to convert.
|
||||||
|
*/
|
||||||
|
double ToUserUnit( const EDA_IU_SCALE& aIuScale, EDA_UNITS aUnit, double aValue );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function StringFromValue
|
||||||
|
* returns the string from \a aValue according to units (inch, mm ...) for display,
|
||||||
|
* and the initial unit for value.
|
||||||
|
*
|
||||||
|
* For readability, the mantissa has 3 or more digits (max 8 digits),
|
||||||
|
* the trailing 0 are removed if the mantissa has more than 3 digits
|
||||||
|
* and some trailing 0
|
||||||
|
* This function should be used to display values in dialogs because a value
|
||||||
|
* entered in mm (for instance 2.0 mm) could need up to 8 digits mantissa
|
||||||
|
* if displayed in inch to avoid truncation or rounding made just by the printf function.
|
||||||
|
* otherwise the actual value is rounded when read from dialog and converted
|
||||||
|
* in internal units, and therefore modified.
|
||||||
|
*
|
||||||
|
* @param aUnit = display units (INCHES, MILLIMETRE ..)
|
||||||
|
* @param aValue = value in Internal_Unit
|
||||||
|
* @param aAddUnitSymbol = true to add symbol unit to the string value
|
||||||
|
* @return A wxString object containing value and optionally the symbol unit (like 2.000 mm)
|
||||||
|
*/
|
||||||
|
wxString StringFromValue( const EDA_IU_SCALE& aIuScale, EDA_UNITS aUnit, double aValue,
|
||||||
|
bool aAddUnitSymbol = false,
|
||||||
|
EDA_DATA_TYPE aType = EDA_DATA_TYPE::DISTANCE );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function MessageTextFromValue
|
||||||
|
* is a helper to convert the \a double length \a aValue to a string in inches,
|
||||||
|
* millimeters, or unscaled units.
|
||||||
|
*
|
||||||
|
* Should be used only to display a coordinate in status, but not in dialogs,
|
||||||
|
* files, etc., because the mantissa of the number displayed has 4 digits max
|
||||||
|
* for readability. The actual internal value could need up to 8 digits to be
|
||||||
|
* printed.
|
||||||
|
*
|
||||||
|
* Use StringFromValue() instead where precision matters.
|
||||||
|
*
|
||||||
|
* @param aUnits The units to show the value in. The unit string is added to the
|
||||||
|
* message text.
|
||||||
|
* @param aValue The double value to convert.
|
||||||
|
* @param aAddUnitLabel If true, adds the unit label to the end of the string
|
||||||
|
* @param aType Type of the unit being used (e.g. distance, area, etc.)
|
||||||
|
* @return The converted string for display in user interface elements.
|
||||||
|
*/
|
||||||
|
wxString MessageTextFromValue( const EDA_IU_SCALE& aIuScale, EDA_UNITS aUnits, double aValue, bool aAddUnitLabel = true,
|
||||||
|
EDA_DATA_TYPE aType = EDA_DATA_TYPE::DISTANCE );
|
||||||
|
|
||||||
|
wxString MessageTextFromValue( const EDA_IU_SCALE& aIuScale, EDA_UNITS aUnits, int aValue,
|
||||||
|
bool aAddUnitLabel = true,
|
||||||
|
EDA_DATA_TYPE aType = EDA_DATA_TYPE::DISTANCE );
|
||||||
|
|
||||||
|
wxString MessageTextFromValue( const EDA_IU_SCALE& aIuScale, EDA_UNITS aUnits, long long int aValue,
|
||||||
|
bool aAddUnitLabel = true,
|
||||||
|
EDA_DATA_TYPE aType = EDA_DATA_TYPE::DISTANCE );
|
||||||
|
|
||||||
|
wxString MessageTextFromValue( EDA_ANGLE aValue, bool aAddUnitLabel = true );
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return in internal units the value "val" given in a real unit
|
||||||
|
* such as "in", "mm" or "deg"
|
||||||
|
*/
|
||||||
|
double FromUserUnit( const EDA_IU_SCALE& aIuScale, EDA_UNITS aUnit, double aValue );
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function DoubleValueFromString
|
||||||
|
* converts \a aTextValue to a double
|
||||||
|
* @warning This utilizes the current locale and will break if decimal formats differ
|
||||||
|
*
|
||||||
|
* @param aUnits The units of \a aTextValue.
|
||||||
|
* @param aTextValue A reference to a wxString object containing the string to convert.
|
||||||
|
* @return A double representing that value in internal units
|
||||||
|
*/
|
||||||
|
double DoubleValueFromString( const EDA_IU_SCALE& aIuScale, EDA_UNITS aUnits,
|
||||||
|
const wxString& aTextValue,
|
||||||
|
EDA_DATA_TYPE aType = EDA_DATA_TYPE::DISTANCE );
|
||||||
|
|
||||||
|
double DoubleValueFromString( const wxString& aTextValue );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function ValueFromString
|
||||||
|
* converts \a aTextValue in \a aUnits to internal units used by the application.
|
||||||
|
* @warning This utilizes the current locale and will break if decimal formats differ
|
||||||
|
*
|
||||||
|
* @param aUnits The units of \a aTextValue.
|
||||||
|
* @param aTextValue A reference to a wxString object containing the string to convert.
|
||||||
|
* @return The string from Value, according to units (inch, mm ...) for display,
|
||||||
|
*/
|
||||||
|
long long int ValueFromString( const EDA_IU_SCALE& aIuScale, EDA_UNITS aUnits,
|
||||||
|
const wxString& aTextValue,
|
||||||
|
EDA_DATA_TYPE aType = EDA_DATA_TYPE::DISTANCE );
|
||||||
|
|
||||||
|
long long int ValueFromString( const wxString& aTextValue);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -38,7 +38,9 @@ namespace PREVIEW
|
||||||
class ARC_ASSISTANT : public EDA_ITEM
|
class ARC_ASSISTANT : public EDA_ITEM
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ARC_ASSISTANT( const ARC_GEOM_MANAGER& aManager, EDA_UNITS aUnits );
|
ARC_ASSISTANT( const ARC_GEOM_MANAGER& aManager,
|
||||||
|
const EDA_IU_SCALE& aIuScale,
|
||||||
|
EDA_UNITS aUnits );
|
||||||
|
|
||||||
const BOX2I ViewBBox() const override;
|
const BOX2I ViewBBox() const override;
|
||||||
|
|
||||||
|
@ -69,6 +71,7 @@ namespace PREVIEW
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const ARC_GEOM_MANAGER& m_constructMan;
|
const ARC_GEOM_MANAGER& m_constructMan;
|
||||||
|
const EDA_IU_SCALE& m_iuScale;
|
||||||
EDA_UNITS m_units;
|
EDA_UNITS m_units;
|
||||||
};
|
};
|
||||||
} // namespace PREVIEW
|
} // namespace PREVIEW
|
||||||
|
|
|
@ -54,7 +54,7 @@ double PreviewOverlayDeemphAlpha( bool aDeemph = true );
|
||||||
* Get a formatted string showing a dimension to a sane precision with an optional prefix and
|
* Get a formatted string showing a dimension to a sane precision with an optional prefix and
|
||||||
* unit suffix.
|
* unit suffix.
|
||||||
*/
|
*/
|
||||||
wxString DimensionLabel( const wxString& prefix, double aVal, EDA_UNITS aUnits,
|
wxString DimensionLabel( const wxString& prefix, double aVal, const EDA_IU_SCALE& aIuScale, EDA_UNITS aUnits,
|
||||||
bool aIncludeUnits = true );
|
bool aIncludeUnits = true );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -41,7 +41,7 @@ class TWO_POINT_GEOMETRY_MANAGER;
|
||||||
class RULER_ITEM : public EDA_ITEM
|
class RULER_ITEM : public EDA_ITEM
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RULER_ITEM( const TWO_POINT_GEOMETRY_MANAGER& m_geomMgr, EDA_UNITS userUnits, bool aFlipX,
|
RULER_ITEM( const TWO_POINT_GEOMETRY_MANAGER& m_geomMgr, const EDA_IU_SCALE& aIuScale, EDA_UNITS userUnits, bool aFlipX,
|
||||||
bool aFlipY );
|
bool aFlipY );
|
||||||
|
|
||||||
///< @copydoc EDA_ITEM::ViewBBox()
|
///< @copydoc EDA_ITEM::ViewBBox()
|
||||||
|
@ -85,6 +85,7 @@ public:
|
||||||
private:
|
private:
|
||||||
const TWO_POINT_GEOMETRY_MANAGER& m_geomMgr;
|
const TWO_POINT_GEOMETRY_MANAGER& m_geomMgr;
|
||||||
EDA_UNITS m_userUnits;
|
EDA_UNITS m_userUnits;
|
||||||
|
const EDA_IU_SCALE& m_iuScale;
|
||||||
bool m_flipX;
|
bool m_flipX;
|
||||||
bool m_flipY;
|
bool m_flipY;
|
||||||
};
|
};
|
||||||
|
|
|
@ -50,8 +50,8 @@ enum class GEOM_SHAPE
|
||||||
class TWO_POINT_ASSISTANT : public EDA_ITEM
|
class TWO_POINT_ASSISTANT : public EDA_ITEM
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TWO_POINT_ASSISTANT( const TWO_POINT_GEOMETRY_MANAGER& aManager, EDA_UNITS aUnits,
|
TWO_POINT_ASSISTANT( const TWO_POINT_GEOMETRY_MANAGER& aManager, const EDA_IU_SCALE& aIuScale,
|
||||||
GEOM_SHAPE aShape );
|
EDA_UNITS aUnits, GEOM_SHAPE aShape );
|
||||||
|
|
||||||
const BOX2I ViewBBox() const override;
|
const BOX2I ViewBBox() const override;
|
||||||
|
|
||||||
|
@ -88,6 +88,7 @@ private:
|
||||||
const TWO_POINT_GEOMETRY_MANAGER& m_constructMan;
|
const TWO_POINT_GEOMETRY_MANAGER& m_constructMan;
|
||||||
EDA_UNITS m_units;
|
EDA_UNITS m_units;
|
||||||
GEOM_SHAPE m_shape;
|
GEOM_SHAPE m_shape;
|
||||||
|
const EDA_IU_SCALE& m_iuScale;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace PREVIEW
|
} // namespace PREVIEW
|
||||||
|
|
|
@ -129,7 +129,7 @@ public:
|
||||||
*
|
*
|
||||||
* @return wxString - the simple multi-line report text.
|
* @return wxString - the simple multi-line report text.
|
||||||
*/
|
*/
|
||||||
virtual wxString ShowReport( EDA_UNITS aUnits, SEVERITY aSeverity,
|
virtual wxString ShowReport( const EDA_IU_SCALE& aIuScale, EDA_UNITS aUnits, SEVERITY aSeverity,
|
||||||
const std::map<KIID, EDA_ITEM*>& aItemMap ) const;
|
const std::map<KIID, EDA_ITEM*>& aItemMap ) const;
|
||||||
|
|
||||||
int GetErrorCode() const { return m_errorCode; }
|
int GetErrorCode() const { return m_errorCode; }
|
||||||
|
@ -163,7 +163,8 @@ public:
|
||||||
/**
|
/**
|
||||||
* Format a coordinate or position to text.
|
* Format a coordinate or position to text.
|
||||||
*/
|
*/
|
||||||
static wxString ShowCoord( EDA_UNITS aUnits, const VECTOR2I& aPos );
|
static wxString ShowCoord( const EDA_IU_SCALE& aIuScale, EDA_UNITS aUnits,
|
||||||
|
const VECTOR2I& aPos );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int m_errorCode; ///< The error code's numeric value
|
int m_errorCode; ///< The error code's numeric value
|
||||||
|
|
|
@ -110,9 +110,9 @@ public:
|
||||||
|| m_color != aOther.m_color;
|
|| m_color != aOther.m_color;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Format( OUTPUTFORMATTER* out, int nestLevel ) const;
|
void Format( OUTPUTFORMATTER* out, const EDA_IU_SCALE& aIuScale, int nestLevel ) const;
|
||||||
|
|
||||||
void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList,
|
void GetMsgPanelInfo( const EDA_IU_SCALE& aIuScale, EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList,
|
||||||
bool aIncludeStyle = true, bool aIncludeWidth = true );
|
bool aIncludeStyle = true, bool aIncludeWidth = true );
|
||||||
|
|
||||||
// Helper functions
|
// Helper functions
|
||||||
|
|
|
@ -53,10 +53,13 @@ public:
|
||||||
* Can be nullptr.
|
* Can be nullptr.
|
||||||
* @param aAllowEval indicates \a aTextInput's content should be eval'ed before storing
|
* @param aAllowEval indicates \a aTextInput's content should be eval'ed before storing
|
||||||
*/
|
*/
|
||||||
UNIT_BINDER( EDA_BASE_FRAME* aParent,
|
UNIT_BINDER( EDA_DRAW_FRAME* aParent,
|
||||||
wxStaticText* aLabel, wxWindow* aValueCtrl, wxStaticText* aUnitLabel,
|
wxStaticText* aLabel, wxWindow* aValueCtrl, wxStaticText* aUnitLabel,
|
||||||
bool aAllowEval = true );
|
bool aAllowEval = true );
|
||||||
|
|
||||||
|
UNIT_BINDER( EDA_BASE_FRAME* aParent, const EDA_IU_SCALE& aIUScale, wxStaticText* aLabel, wxWindow* aValueCtrl,
|
||||||
|
wxStaticText* aUnitLabel, bool aAllowEval = true );
|
||||||
|
|
||||||
~UNIT_BINDER() override;
|
~UNIT_BINDER() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -224,6 +227,7 @@ protected:
|
||||||
wxStaticText* m_unitLabel; ///< Can be nullptr
|
wxStaticText* m_unitLabel; ///< Can be nullptr
|
||||||
|
|
||||||
///< Currently used units.
|
///< Currently used units.
|
||||||
|
const EDA_IU_SCALE& m_iuScale;
|
||||||
EDA_UNITS m_units;
|
EDA_UNITS m_units;
|
||||||
bool m_negativeZero; ///< Indicates "-0" should be displayed for 0.
|
bool m_negativeZero; ///< Indicates "-0" should be displayed for 0.
|
||||||
EDA_DATA_TYPE m_dataType;
|
EDA_DATA_TYPE m_dataType;
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#ifndef WIDGETS_WIDGET_SAVE_RESTORE__H
|
#ifndef WIDGETS_WIDGET_SAVE_RESTORE__H
|
||||||
#define WIDGETS_WIDGET_SAVE_RESTORE__H
|
#define WIDGETS_WIDGET_SAVE_RESTORE__H
|
||||||
|
|
||||||
|
#include <eda_units.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
class wxCheckBox;
|
class wxCheckBox;
|
||||||
|
@ -40,7 +41,7 @@ class EDA_ANGLE;
|
||||||
class WIDGET_SAVE_RESTORE
|
class WIDGET_SAVE_RESTORE
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
WIDGET_SAVE_RESTORE( bool& aValidFlag ) :
|
WIDGET_SAVE_RESTORE( const EDA_IU_SCALE& aIuScale, bool& aValidFlag ) :
|
||||||
m_valid( aValidFlag )
|
m_valid( aValidFlag )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,6 @@ set( PL_EDITOR_SRCS
|
||||||
)
|
)
|
||||||
|
|
||||||
set( PL_EDITOR_EXTRA_SRCS
|
set( PL_EDITOR_EXTRA_SRCS
|
||||||
${CMAKE_SOURCE_DIR}/common/base_units.cpp
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if( WIN32 )
|
if( WIN32 )
|
||||||
|
|
|
@ -148,16 +148,24 @@ void PROPERTIES_FRAME::CopyPrmsFromGeneralToPanel()
|
||||||
DS_DATA_MODEL& model = DS_DATA_MODEL::GetTheInstance();
|
DS_DATA_MODEL& model = DS_DATA_MODEL::GetTheInstance();
|
||||||
|
|
||||||
// Set default parameters
|
// Set default parameters
|
||||||
m_defaultLineWidth.SetDoubleValue( From_User_Unit( units, model.m_DefaultLineWidth ) );
|
m_defaultLineWidth.SetDoubleValue(
|
||||||
|
EDA_UNIT_UTILS::UI::FromUserUnit( drawSheetIUScale,units, model.m_DefaultLineWidth ) );
|
||||||
|
|
||||||
m_defaultTextSizeX.SetDoubleValue( From_User_Unit( units, model.m_DefaultTextSize.x ) );
|
m_defaultTextSizeX.SetDoubleValue(
|
||||||
m_defaultTextSizeY.SetDoubleValue( From_User_Unit( units, model.m_DefaultTextSize.y ) );
|
EDA_UNIT_UTILS::UI::FromUserUnit( drawSheetIUScale,units, model.m_DefaultTextSize.x ) );
|
||||||
m_defaultTextThickness.SetDoubleValue( From_User_Unit( units, model.m_DefaultTextThickness ) );
|
m_defaultTextSizeY.SetDoubleValue(
|
||||||
|
EDA_UNIT_UTILS::UI::FromUserUnit( drawSheetIUScale,units, model.m_DefaultTextSize.y ) );
|
||||||
|
m_defaultTextThickness.SetDoubleValue( EDA_UNIT_UTILS::UI::FromUserUnit(
|
||||||
|
drawSheetIUScale,units, model.m_DefaultTextThickness ) );
|
||||||
|
|
||||||
m_textLeftMargin.SetDoubleValue( From_User_Unit( units, model.GetLeftMargin() ) );
|
m_textLeftMargin.SetDoubleValue(
|
||||||
m_textRightMargin.SetDoubleValue( From_User_Unit( units, model.GetRightMargin() ) );
|
EDA_UNIT_UTILS::UI::FromUserUnit( drawSheetIUScale,units, model.GetLeftMargin() ) );
|
||||||
m_textTopMargin.SetDoubleValue( From_User_Unit( units, model.GetTopMargin() ) );
|
m_textRightMargin.SetDoubleValue(
|
||||||
m_textBottomMargin.SetDoubleValue( From_User_Unit( units, model.GetBottomMargin() ) );
|
EDA_UNIT_UTILS::UI::FromUserUnit( drawSheetIUScale,units, model.GetRightMargin() ) );
|
||||||
|
m_textTopMargin.SetDoubleValue(
|
||||||
|
EDA_UNIT_UTILS::UI::FromUserUnit( drawSheetIUScale,units, model.GetTopMargin() ) );
|
||||||
|
m_textBottomMargin.SetDoubleValue(
|
||||||
|
EDA_UNIT_UTILS::UI::FromUserUnit( drawSheetIUScale,units, model.GetBottomMargin() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -167,17 +175,25 @@ bool PROPERTIES_FRAME::CopyPrmsFromPanelToGeneral()
|
||||||
DS_DATA_MODEL& model = DS_DATA_MODEL::GetTheInstance();
|
DS_DATA_MODEL& model = DS_DATA_MODEL::GetTheInstance();
|
||||||
|
|
||||||
// Import default parameters from widgets
|
// Import default parameters from widgets
|
||||||
model.m_DefaultLineWidth = To_User_Unit( units, m_defaultLineWidth.GetValue() );
|
model.m_DefaultLineWidth = EDA_UNIT_UTILS::UI::ToUserUnit( drawSheetIUScale, units,
|
||||||
|
m_defaultLineWidth.GetValue() );
|
||||||
|
|
||||||
model.m_DefaultTextSize.x = To_User_Unit( units, m_defaultTextSizeX.GetValue() );
|
model.m_DefaultTextSize.x = EDA_UNIT_UTILS::UI::ToUserUnit( drawSheetIUScale, units,
|
||||||
model.m_DefaultTextSize.y = To_User_Unit( units, m_defaultTextSizeY.GetValue() );
|
m_defaultTextSizeX.GetValue() );
|
||||||
model.m_DefaultTextThickness = To_User_Unit( units, m_defaultTextThickness.GetValue() );
|
model.m_DefaultTextSize.y = EDA_UNIT_UTILS::UI::ToUserUnit( drawSheetIUScale, units,
|
||||||
|
m_defaultTextSizeY.GetValue() );
|
||||||
|
model.m_DefaultTextThickness = EDA_UNIT_UTILS::UI::ToUserUnit( drawSheetIUScale, units,
|
||||||
|
m_defaultTextThickness.GetValue() );
|
||||||
|
|
||||||
// Get page margins values
|
// Get page margins values
|
||||||
model.SetRightMargin( To_User_Unit( units, m_textRightMargin.GetValue() ) );
|
model.SetRightMargin( EDA_UNIT_UTILS::UI::ToUserUnit( drawSheetIUScale, units,
|
||||||
model.SetBottomMargin( To_User_Unit( units, m_textBottomMargin.GetValue() ) );
|
m_textRightMargin.GetValue() ) );
|
||||||
model.SetLeftMargin( To_User_Unit( units, m_textLeftMargin.GetValue() ) );
|
model.SetBottomMargin( EDA_UNIT_UTILS::UI::ToUserUnit( drawSheetIUScale, units,
|
||||||
model.SetTopMargin( To_User_Unit( units, m_textTopMargin.GetValue() ) );
|
m_textBottomMargin.GetValue() ) );
|
||||||
|
model.SetLeftMargin( EDA_UNIT_UTILS::UI::ToUserUnit( drawSheetIUScale, units,
|
||||||
|
m_textLeftMargin.GetValue() ) );
|
||||||
|
model.SetTopMargin( EDA_UNIT_UTILS::UI::ToUserUnit( drawSheetIUScale, units,
|
||||||
|
m_textTopMargin.GetValue() ) );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -207,8 +223,8 @@ void PROPERTIES_FRAME::CopyPrmsFromItemToPanel( DS_DATA_ITEM* aItem )
|
||||||
}
|
}
|
||||||
|
|
||||||
// Position/ start point
|
// Position/ start point
|
||||||
m_textPosX.SetDoubleValue( From_User_Unit( units, aItem->m_Pos.m_Pos.x ) );
|
m_textPosX.SetDoubleValue( EDA_UNIT_UTILS::UI::FromUserUnit( drawSheetIUScale, units, aItem->m_Pos.m_Pos.x ) );
|
||||||
m_textPosY.SetDoubleValue( From_User_Unit( units, aItem->m_Pos.m_Pos.y ) );
|
m_textPosY.SetDoubleValue( EDA_UNIT_UTILS::UI::FromUserUnit( drawSheetIUScale, units, aItem->m_Pos.m_Pos.y ) );
|
||||||
|
|
||||||
switch( aItem->m_Pos.m_Anchor )
|
switch( aItem->m_Pos.m_Anchor )
|
||||||
{
|
{
|
||||||
|
@ -219,8 +235,8 @@ void PROPERTIES_FRAME::CopyPrmsFromItemToPanel( DS_DATA_ITEM* aItem )
|
||||||
}
|
}
|
||||||
|
|
||||||
// End point
|
// End point
|
||||||
m_textEndX.SetDoubleValue( From_User_Unit( units, aItem->m_End.m_Pos.x ) );
|
m_textEndX.SetDoubleValue( EDA_UNIT_UTILS::UI::FromUserUnit( drawSheetIUScale, units, aItem->m_End.m_Pos.x ) );
|
||||||
m_textEndY.SetDoubleValue( From_User_Unit( units, aItem->m_End.m_Pos.y ) );
|
m_textEndY.SetDoubleValue( EDA_UNIT_UTILS::UI::FromUserUnit( drawSheetIUScale, units, aItem->m_End.m_Pos.y ) );
|
||||||
|
|
||||||
switch( aItem->m_End.m_Anchor )
|
switch( aItem->m_End.m_Anchor )
|
||||||
{
|
{
|
||||||
|
@ -230,7 +246,7 @@ void PROPERTIES_FRAME::CopyPrmsFromItemToPanel( DS_DATA_ITEM* aItem )
|
||||||
case LT_CORNER: m_comboBoxCornerEnd->SetSelection( 1 ); break;
|
case LT_CORNER: m_comboBoxCornerEnd->SetSelection( 1 ); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_lineWidth.SetDoubleValue( From_User_Unit( units, aItem->m_LineWidth ) );
|
m_lineWidth.SetDoubleValue( EDA_UNIT_UTILS::UI::FromUserUnit( drawSheetIUScale, units, aItem->m_LineWidth ) );
|
||||||
|
|
||||||
// Now, set prms more specific to DS_DATA_ITEM types
|
// Now, set prms more specific to DS_DATA_ITEM types
|
||||||
// For a given type, disable widgets which are not relevant,
|
// For a given type, disable widgets which are not relevant,
|
||||||
|
@ -252,8 +268,8 @@ void PROPERTIES_FRAME::CopyPrmsFromItemToPanel( DS_DATA_ITEM* aItem )
|
||||||
m_textCtrlRotation->SetValue( msg );
|
m_textCtrlRotation->SetValue( msg );
|
||||||
|
|
||||||
// Constraints:
|
// Constraints:
|
||||||
m_constraintX.SetDoubleValue( From_User_Unit( units, item->m_BoundingBoxSize.x ) );
|
m_constraintX.SetDoubleValue( EDA_UNIT_UTILS::UI::FromUserUnit( drawSheetIUScale, units, item->m_BoundingBoxSize.x ) );
|
||||||
m_constraintY.SetDoubleValue( From_User_Unit( units, item->m_BoundingBoxSize.y ) );
|
m_constraintY.SetDoubleValue( EDA_UNIT_UTILS::UI::FromUserUnit( drawSheetIUScale, units, item->m_BoundingBoxSize.y ) );
|
||||||
|
|
||||||
// Font Options
|
// Font Options
|
||||||
m_fontCtrl->SetFontSelection( item->m_Font );
|
m_fontCtrl->SetFontSelection( item->m_Font );
|
||||||
|
@ -284,8 +300,8 @@ void PROPERTIES_FRAME::CopyPrmsFromItemToPanel( DS_DATA_ITEM* aItem )
|
||||||
}
|
}
|
||||||
|
|
||||||
// Text size
|
// Text size
|
||||||
m_textSizeX.SetDoubleValue( From_User_Unit( units, item->m_TextSize.x ) );
|
m_textSizeX.SetDoubleValue( EDA_UNIT_UTILS::UI::FromUserUnit( drawSheetIUScale, units, item->m_TextSize.x ) );
|
||||||
m_textSizeY.SetDoubleValue( From_User_Unit( units, item->m_TextSize.y ) );
|
m_textSizeY.SetDoubleValue( EDA_UNIT_UTILS::UI::FromUserUnit( drawSheetIUScale, units, item->m_TextSize.y ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( aItem->GetType() == DS_DATA_ITEM::DS_POLYPOLYGON )
|
if( aItem->GetType() == DS_DATA_ITEM::DS_POLYPOLYGON )
|
||||||
|
@ -338,8 +354,8 @@ void PROPERTIES_FRAME::CopyPrmsFromItemToPanel( DS_DATA_ITEM* aItem )
|
||||||
msg.Printf( wxT( "%d" ), aItem->m_RepeatCount );
|
msg.Printf( wxT( "%d" ), aItem->m_RepeatCount );
|
||||||
m_textCtrlRepeatCount->SetValue( msg );
|
m_textCtrlRepeatCount->SetValue( msg );
|
||||||
|
|
||||||
m_textStepX.SetDoubleValue( From_User_Unit( units, aItem->m_IncrementVector.x ) );
|
m_textStepX.SetDoubleValue( EDA_UNIT_UTILS::UI::FromUserUnit( drawSheetIUScale, units, aItem->m_IncrementVector.x ) );
|
||||||
m_textStepY.SetDoubleValue( From_User_Unit( units, aItem->m_IncrementVector.y ) );
|
m_textStepY.SetDoubleValue( EDA_UNIT_UTILS::UI::FromUserUnit( drawSheetIUScale, units, aItem->m_IncrementVector.y ) );
|
||||||
|
|
||||||
// The number of widgets was modified, so recalculate sizers
|
// The number of widgets was modified, so recalculate sizers
|
||||||
m_swItemProperties->Layout();
|
m_swItemProperties->Layout();
|
||||||
|
@ -445,11 +461,14 @@ bool PROPERTIES_FRAME::CopyPrmsFromPanelToItem( DS_DATA_ITEM* aItem )
|
||||||
}
|
}
|
||||||
|
|
||||||
// Import thickness
|
// Import thickness
|
||||||
aItem->m_LineWidth = To_User_Unit( units, m_lineWidth.GetValue() );
|
aItem->m_LineWidth =
|
||||||
|
EDA_UNIT_UTILS::UI::ToUserUnit( drawSheetIUScale, units, m_lineWidth.GetValue() );
|
||||||
|
|
||||||
// Import Start point
|
// Import Start point
|
||||||
aItem->m_Pos.m_Pos.x = To_User_Unit( units, m_textPosX.GetValue() );
|
aItem->m_Pos.m_Pos.x =
|
||||||
aItem->m_Pos.m_Pos.y = To_User_Unit( units, m_textPosY.GetValue() );
|
EDA_UNIT_UTILS::UI::ToUserUnit( drawSheetIUScale, units, m_textPosX.GetValue() );
|
||||||
|
aItem->m_Pos.m_Pos.y =
|
||||||
|
EDA_UNIT_UTILS::UI::ToUserUnit( drawSheetIUScale, units, m_textPosY.GetValue() );
|
||||||
|
|
||||||
switch( m_comboBoxCornerPos->GetSelection() )
|
switch( m_comboBoxCornerPos->GetSelection() )
|
||||||
{
|
{
|
||||||
|
@ -460,8 +479,10 @@ bool PROPERTIES_FRAME::CopyPrmsFromPanelToItem( DS_DATA_ITEM* aItem )
|
||||||
}
|
}
|
||||||
|
|
||||||
// Import End point
|
// Import End point
|
||||||
aItem->m_End.m_Pos.x = To_User_Unit( units, m_textEndX.GetValue() );
|
aItem->m_End.m_Pos.x =
|
||||||
aItem->m_End.m_Pos.y = To_User_Unit( units, m_textEndY.GetValue() );
|
EDA_UNIT_UTILS::UI::ToUserUnit( drawSheetIUScale, units, m_textEndX.GetValue() );
|
||||||
|
aItem->m_End.m_Pos.y =
|
||||||
|
EDA_UNIT_UTILS::UI::ToUserUnit( drawSheetIUScale, units, m_textEndY.GetValue() );
|
||||||
|
|
||||||
switch( m_comboBoxCornerEnd->GetSelection() )
|
switch( m_comboBoxCornerEnd->GetSelection() )
|
||||||
{
|
{
|
||||||
|
@ -477,8 +498,10 @@ bool PROPERTIES_FRAME::CopyPrmsFromPanelToItem( DS_DATA_ITEM* aItem )
|
||||||
msg.ToLong( &itmp );
|
msg.ToLong( &itmp );
|
||||||
aItem->m_RepeatCount = itmp;
|
aItem->m_RepeatCount = itmp;
|
||||||
|
|
||||||
aItem->m_IncrementVector.x = To_User_Unit( units, m_textStepX.GetValue() );
|
aItem->m_IncrementVector.x =
|
||||||
aItem->m_IncrementVector.y = To_User_Unit( units, m_textStepY.GetValue() );
|
EDA_UNIT_UTILS::UI::ToUserUnit( drawSheetIUScale, units, m_textStepX.GetValue() );
|
||||||
|
aItem->m_IncrementVector.y =
|
||||||
|
EDA_UNIT_UTILS::UI::ToUserUnit( drawSheetIUScale, units, m_textStepY.GetValue() );
|
||||||
|
|
||||||
if( aItem->GetType() == DS_DATA_ITEM::DS_TEXT )
|
if( aItem->GetType() == DS_DATA_ITEM::DS_TEXT )
|
||||||
{
|
{
|
||||||
|
@ -512,15 +535,19 @@ bool PROPERTIES_FRAME::CopyPrmsFromPanelToItem( DS_DATA_ITEM* aItem )
|
||||||
item->m_Font = m_fontCtrl->GetFontSelection( item->m_Bold, item->m_Italic );
|
item->m_Font = m_fontCtrl->GetFontSelection( item->m_Bold, item->m_Italic );
|
||||||
|
|
||||||
msg = m_textCtrlRotation->GetValue();
|
msg = m_textCtrlRotation->GetValue();
|
||||||
item->m_Orient = DoubleValueFromString( EDA_UNITS::UNSCALED, msg );
|
item->m_Orient = EDA_UNIT_UTILS::UI::DoubleValueFromString( drawSheetIUScale, EDA_UNITS::UNSCALED, msg );
|
||||||
|
|
||||||
// Import text size
|
// Import text size
|
||||||
item->m_TextSize.x = To_User_Unit( units, m_textSizeX.GetValue() );
|
item->m_TextSize.x =
|
||||||
item->m_TextSize.y = To_User_Unit( units, m_textSizeY.GetValue() );
|
EDA_UNIT_UTILS::UI::ToUserUnit( drawSheetIUScale, units, m_textSizeX.GetValue() );
|
||||||
|
item->m_TextSize.y =
|
||||||
|
EDA_UNIT_UTILS::UI::ToUserUnit( drawSheetIUScale, units, m_textSizeY.GetValue() );
|
||||||
|
|
||||||
// Import constraints:
|
// Import constraints:
|
||||||
item->m_BoundingBoxSize.x = To_User_Unit( units, m_constraintX.GetValue() );
|
item->m_BoundingBoxSize.x =
|
||||||
item->m_BoundingBoxSize.y = To_User_Unit( units, m_constraintY.GetValue() );
|
EDA_UNIT_UTILS::UI::ToUserUnit( drawSheetIUScale, units, m_constraintX.GetValue() );
|
||||||
|
item->m_BoundingBoxSize.y =
|
||||||
|
EDA_UNIT_UTILS::UI::ToUserUnit( drawSheetIUScale, units, m_constraintY.GetValue() );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( aItem->GetType() == DS_DATA_ITEM::DS_POLYPOLYGON )
|
if( aItem->GetType() == DS_DATA_ITEM::DS_POLYPOLYGON )
|
||||||
|
@ -528,7 +555,8 @@ bool PROPERTIES_FRAME::CopyPrmsFromPanelToItem( DS_DATA_ITEM* aItem )
|
||||||
DS_DATA_ITEM_POLYGONS* item = static_cast<DS_DATA_ITEM_POLYGONS*>( aItem );
|
DS_DATA_ITEM_POLYGONS* item = static_cast<DS_DATA_ITEM_POLYGONS*>( aItem );
|
||||||
|
|
||||||
msg = m_textCtrlRotation->GetValue();
|
msg = m_textCtrlRotation->GetValue();
|
||||||
item->m_Orient = EDA_ANGLE( DoubleValueFromString( EDA_UNITS::UNSCALED, msg ), DEGREES_T );
|
item->m_Orient = EDA_ANGLE(
|
||||||
|
EDA_UNIT_UTILS::UI::DoubleValueFromString( drawSheetIUScale,EDA_UNITS::UNSCALED, msg ), DEGREES_T );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( aItem->GetType() == DS_DATA_ITEM::DS_BITMAP )
|
if( aItem->GetType() == DS_DATA_ITEM::DS_BITMAP )
|
||||||
|
|
|
@ -82,7 +82,7 @@ END_EVENT_TABLE()
|
||||||
PL_EDITOR_FRAME::PL_EDITOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
PL_EDITOR_FRAME::PL_EDITOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||||
EDA_DRAW_FRAME( aKiway, aParent, FRAME_PL_EDITOR, wxT( "PlEditorFrame" ),
|
EDA_DRAW_FRAME( aKiway, aParent, FRAME_PL_EDITOR, wxT( "PlEditorFrame" ),
|
||||||
wxDefaultPosition, wxDefaultSize,
|
wxDefaultPosition, wxDefaultSize,
|
||||||
KICAD_DEFAULT_DRAWFRAME_STYLE, PL_EDITOR_FRAME_NAME ),
|
KICAD_DEFAULT_DRAWFRAME_STYLE, PL_EDITOR_FRAME_NAME, drawSheetIUScale ),
|
||||||
m_propertiesPagelayout( nullptr ),
|
m_propertiesPagelayout( nullptr ),
|
||||||
m_propertiesFrameWidth( 200 ),
|
m_propertiesFrameWidth( 200 ),
|
||||||
m_originSelectBox( nullptr ),
|
m_originSelectBox( nullptr ),
|
||||||
|
@ -672,7 +672,8 @@ void PL_EDITOR_FRAME::DisplayGridMsg()
|
||||||
default: gridformatter = "grid %f"; break;
|
default: gridformatter = "grid %f"; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
double grid = To_User_Unit( m_userUnits, GetCanvas()->GetGAL()->GetGridSize().x );
|
double grid = EDA_UNIT_UTILS::UI::ToUserUnit( drawSheetIUScale, m_userUnits,
|
||||||
|
GetCanvas()->GetGAL()->GetGridSize().x );
|
||||||
line.Printf( gridformatter, grid );
|
line.Printf( gridformatter, grid );
|
||||||
|
|
||||||
SetStatusText( line, 4 );
|
SetStatusText( line, 4 );
|
||||||
|
@ -718,8 +719,10 @@ void PL_EDITOR_FRAME::UpdateStatusBar()
|
||||||
// Display absolute coordinates:
|
// Display absolute coordinates:
|
||||||
VECTOR2D cursorPos = GetCanvas()->GetViewControls()->GetCursorPosition();
|
VECTOR2D cursorPos = GetCanvas()->GetViewControls()->GetCursorPosition();
|
||||||
VECTOR2D coord = cursorPos - originCoord;
|
VECTOR2D coord = cursorPos - originCoord;
|
||||||
double dXpos = To_User_Unit( GetUserUnits(), coord.x * Xsign );
|
double dXpos =
|
||||||
double dYpos = To_User_Unit( GetUserUnits(), coord.y * Ysign );
|
EDA_UNIT_UTILS::UI::ToUserUnit( drawSheetIUScale, GetUserUnits(), coord.x * Xsign );
|
||||||
|
double dYpos =
|
||||||
|
EDA_UNIT_UTILS::UI::ToUserUnit( drawSheetIUScale, GetUserUnits(), coord.y * Ysign );
|
||||||
|
|
||||||
wxString absformatter = wxT( "X %.4g Y %.4g" );
|
wxString absformatter = wxT( "X %.4g Y %.4g" );
|
||||||
wxString locformatter = wxT( "dx %.4g dy %.4g" );
|
wxString locformatter = wxT( "dx %.4g dy %.4g" );
|
||||||
|
@ -744,8 +747,8 @@ void PL_EDITOR_FRAME::UpdateStatusBar()
|
||||||
{
|
{
|
||||||
double dx = cursorPos.x - GetScreen()->m_LocalOrigin.x;
|
double dx = cursorPos.x - GetScreen()->m_LocalOrigin.x;
|
||||||
double dy = cursorPos.y - GetScreen()->m_LocalOrigin.y;
|
double dy = cursorPos.y - GetScreen()->m_LocalOrigin.y;
|
||||||
dXpos = To_User_Unit( GetUserUnits(), dx * Xsign );
|
dXpos = EDA_UNIT_UTILS::UI::ToUserUnit( drawSheetIUScale, GetUserUnits(), dx * Xsign );
|
||||||
dYpos = To_User_Unit( GetUserUnits(), dy * Ysign );
|
dYpos = EDA_UNIT_UTILS::UI::ToUserUnit( drawSheetIUScale, GetUserUnits(), dy * Ysign );
|
||||||
line.Printf( locformatter, dXpos, dYpos );
|
line.Printf( locformatter, dXpos, dYpos );
|
||||||
SetStatusText( line, 3 );
|
SetStatusText( line, 3 );
|
||||||
}
|
}
|
||||||
|
@ -938,10 +941,11 @@ void PL_EDITOR_FRAME::UpdateMsgPanelInfo()
|
||||||
VECTOR2D size = GetPageSettings().GetSizeIU( IU_PER_MILS );
|
VECTOR2D size = GetPageSettings().GetSizeIU( IU_PER_MILS );
|
||||||
|
|
||||||
std::vector<MSG_PANEL_ITEM> msgItems;
|
std::vector<MSG_PANEL_ITEM> msgItems;
|
||||||
msgItems.emplace_back( _( "Page Width" ), MessageTextFromValue( GetUserUnits(), size.x ) );
|
msgItems.emplace_back( _( "Page Width" ), EDA_UNIT_UTILS::UI::MessageTextFromValue(
|
||||||
|
GetIuScale(), GetUserUnits(), size.x ) );
|
||||||
|
|
||||||
msgItems.emplace_back(
|
msgItems.emplace_back( _( "Page Height" ), EDA_UNIT_UTILS::UI::MessageTextFromValue(
|
||||||
_( "Page Height" ), MessageTextFromValue( GetUserUnits(), size.y ) );
|
GetIuScale(), GetUserUnits(), size.y ) );
|
||||||
|
|
||||||
SetMsgPanel( msgItems );
|
SetMsgPanel( msgItems );
|
||||||
}
|
}
|
||||||
|
|
|
@ -383,7 +383,6 @@ set( PCBNEW_SRCS
|
||||||
|
|
||||||
# extra sources from common
|
# extra sources from common
|
||||||
set( PCBNEW_COMMON_SRCS
|
set( PCBNEW_COMMON_SRCS
|
||||||
${CMAKE_SOURCE_DIR}/common/base_units.cpp
|
|
||||||
)
|
)
|
||||||
|
|
||||||
set( PCBNEW_SCRIPTING_PYTHON_HELPERS
|
set( PCBNEW_SCRIPTING_PYTHON_HELPERS
|
||||||
|
|
|
@ -652,10 +652,10 @@ void BOARD_STACKUP::FormatBoardStackup( OUTPUTFORMATTER* aFormatter,
|
||||||
{
|
{
|
||||||
if( item->GetType() == BS_ITEM_TYPE_DIELECTRIC && item->IsThicknessLocked( idx ) )
|
if( item->GetType() == BS_ITEM_TYPE_DIELECTRIC && item->IsThicknessLocked( idx ) )
|
||||||
aFormatter->Print( 0, " (thickness %s locked)",
|
aFormatter->Print( 0, " (thickness %s locked)",
|
||||||
FormatInternalUnits( item->GetThickness( idx ) ).c_str() );
|
EDA_UNIT_UTILS::FormatInternalUnits( pcbIUScale, item->GetThickness( idx ) ).c_str() );
|
||||||
else
|
else
|
||||||
aFormatter->Print( 0, " (thickness %s)",
|
aFormatter->Print( 0, " (thickness %s)",
|
||||||
FormatInternalUnits( item->GetThickness( idx ) ).c_str() );
|
EDA_UNIT_UTILS::FormatInternalUnits( pcbIUScale, item->GetThickness( idx ) ).c_str() );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( item->HasMaterialValue( idx ) )
|
if( item->HasMaterialValue( idx ) )
|
||||||
|
|
|
@ -91,7 +91,7 @@ wxString BuildStackupReport( BOARD_STACKUP& aStackup, EDA_UNITS aUnits )
|
||||||
if( item->IsThicknessEditable() )
|
if( item->IsThicknessEditable() )
|
||||||
{
|
{
|
||||||
txt.Printf( wxT( " Thickness %s" ),
|
txt.Printf( wxT( " Thickness %s" ),
|
||||||
StringFromValue( aUnits, item->GetThickness( idx ), true ) );
|
EDA_UNIT_UTILS::UI::StringFromValue( pcbIUScale, aUnits, item->GetThickness( idx ), true ) );
|
||||||
report << txt;
|
report << txt;
|
||||||
|
|
||||||
if( item->GetType() == BS_ITEM_TYPE_DIELECTRIC && item->IsThicknessLocked( idx ) )
|
if( item->GetType() == BS_ITEM_TYPE_DIELECTRIC && item->IsThicknessLocked( idx ) )
|
||||||
|
|
|
@ -166,7 +166,7 @@ void PANEL_SETUP_BOARD_STACKUP::onAdjustDielectricThickness( wxCommandEvent& eve
|
||||||
wxTextCtrl* textCtrl = static_cast<wxTextCtrl*>( ui_item.m_ThicknessCtrl );
|
wxTextCtrl* textCtrl = static_cast<wxTextCtrl*>( ui_item.m_ThicknessCtrl );
|
||||||
wxString txt = textCtrl->GetValue();
|
wxString txt = textCtrl->GetValue();
|
||||||
|
|
||||||
int item_thickness = ValueFromString( m_frame->GetUserUnits(), txt );
|
int item_thickness = EDA_UNIT_UTILS::UI::ValueFromString( pcbIUScale, m_frame->GetUserUnits(), txt );
|
||||||
min_thickness += item_thickness;
|
min_thickness += item_thickness;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,7 +180,7 @@ void PANEL_SETUP_BOARD_STACKUP::onAdjustDielectricThickness( wxCommandEvent& eve
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
title.Printf( _( "Enter expected board thickness (min value %s):" ),
|
title.Printf( _( "Enter expected board thickness (min value %s):" ),
|
||||||
StringFromValue( m_frame->GetUserUnits(), min_thickness, true ) );
|
EDA_UNIT_UTILS::UI::StringFromValue( pcbIUScale, m_frame->GetUserUnits(), min_thickness, true ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxTextEntryDialog dlg( this, title, _( "Adjust Unlocked Dielectric Layers" ) );
|
wxTextEntryDialog dlg( this, title, _( "Adjust Unlocked Dielectric Layers" ) );
|
||||||
|
@ -190,12 +190,12 @@ void PANEL_SETUP_BOARD_STACKUP::onAdjustDielectricThickness( wxCommandEvent& eve
|
||||||
|
|
||||||
wxString result = dlg.GetValue();
|
wxString result = dlg.GetValue();
|
||||||
|
|
||||||
int iu_thickness = ValueFromString( m_frame->GetUserUnits(), result );
|
int iu_thickness = EDA_UNIT_UTILS::UI::ValueFromString( pcbIUScale, m_frame->GetUserUnits(), result );
|
||||||
|
|
||||||
if( iu_thickness <= min_thickness )
|
if( iu_thickness <= min_thickness )
|
||||||
{
|
{
|
||||||
wxMessageBox( wxString::Format( _("Value too small (min value %s)." ),
|
wxMessageBox( wxString::Format( _("Value too small (min value %s)." ),
|
||||||
StringFromValue( m_frame->GetUserUnits(), min_thickness, true ) ) );
|
EDA_UNIT_UTILS::UI::StringFromValue( pcbIUScale, m_frame->GetUserUnits(), min_thickness, true ) ) );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,7 +204,7 @@ void PANEL_SETUP_BOARD_STACKUP::onAdjustDielectricThickness( wxCommandEvent& eve
|
||||||
if( items_candidate.size() )
|
if( items_candidate.size() )
|
||||||
{
|
{
|
||||||
int thickness_layer = ( iu_thickness - min_thickness ) / items_candidate.size();
|
int thickness_layer = ( iu_thickness - min_thickness ) / items_candidate.size();
|
||||||
wxString txt = StringFromValue( m_frame->GetUserUnits(), thickness_layer, true );
|
wxString txt = EDA_UNIT_UTILS::UI::StringFromValue( pcbIUScale, m_frame->GetUserUnits(), thickness_layer, true );
|
||||||
|
|
||||||
for( BOARD_STACKUP_ROW_UI_ITEM* ui_item : items_candidate )
|
for( BOARD_STACKUP_ROW_UI_ITEM* ui_item : items_candidate )
|
||||||
{
|
{
|
||||||
|
@ -442,11 +442,11 @@ int PANEL_SETUP_BOARD_STACKUP::computeBoardThickness()
|
||||||
wxTextCtrl* textCtrl = static_cast<wxTextCtrl*>( ui_item.m_ThicknessCtrl );
|
wxTextCtrl* textCtrl = static_cast<wxTextCtrl*>( ui_item.m_ThicknessCtrl );
|
||||||
wxString txt = textCtrl->GetValue();
|
wxString txt = textCtrl->GetValue();
|
||||||
|
|
||||||
int item_thickness = ValueFromString( m_frame->GetUserUnits(), txt );
|
int item_thickness = EDA_UNIT_UTILS::UI::ValueFromString( pcbIUScale, m_frame->GetUserUnits(), txt );
|
||||||
thickness += item_thickness;
|
thickness += item_thickness;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString thicknessStr = StringFromValue( m_units, thickness, true );
|
wxString thicknessStr = EDA_UNIT_UTILS::UI::StringFromValue( pcbIUScale, m_units, thickness, true );
|
||||||
|
|
||||||
// The text in the event will translate to the value for the text control
|
// The text in the event will translate to the value for the text control
|
||||||
// and is only updated if it changed
|
// and is only updated if it changed
|
||||||
|
@ -517,7 +517,7 @@ void PANEL_SETUP_BOARD_STACKUP::synchronizeWithBoard( bool aFullSync )
|
||||||
wxTextCtrl* textCtrl = dynamic_cast<wxTextCtrl*>( ui_row_item.m_ThicknessCtrl );
|
wxTextCtrl* textCtrl = dynamic_cast<wxTextCtrl*>( ui_row_item.m_ThicknessCtrl );
|
||||||
|
|
||||||
if( textCtrl )
|
if( textCtrl )
|
||||||
textCtrl->ChangeValue( StringFromValue( m_units,
|
textCtrl->ChangeValue( EDA_UNIT_UTILS::UI::StringFromValue( pcbIUScale, m_units,
|
||||||
item->GetThickness( sub_item ), true ) );
|
item->GetThickness( sub_item ), true ) );
|
||||||
|
|
||||||
if( item->GetType() == BS_ITEM_TYPE_DIELECTRIC )
|
if( item->GetType() == BS_ITEM_TYPE_DIELECTRIC )
|
||||||
|
@ -763,7 +763,7 @@ BOARD_STACKUP_ROW_UI_ITEM PANEL_SETUP_BOARD_STACKUP::createRowData( int aRow,
|
||||||
{
|
{
|
||||||
wxTextCtrl* textCtrl = new wxTextCtrl( m_scGridWin, ID_ITEM_THICKNESS+row );
|
wxTextCtrl* textCtrl = new wxTextCtrl( m_scGridWin, ID_ITEM_THICKNESS+row );
|
||||||
textCtrl->SetMinSize( m_numericTextCtrlSize );
|
textCtrl->SetMinSize( m_numericTextCtrlSize );
|
||||||
textCtrl->ChangeValue( StringFromValue( m_units, item->GetThickness( aSublayerIdx ), true ) );
|
textCtrl->ChangeValue( EDA_UNIT_UTILS::UI::StringFromValue( pcbIUScale, m_units, item->GetThickness( aSublayerIdx ), true ) );
|
||||||
m_fgGridSizer->Add( textCtrl, 0, wxLEFT|wxRIGHT|wxALIGN_CENTER_VERTICAL, 2 );
|
m_fgGridSizer->Add( textCtrl, 0, wxLEFT|wxRIGHT|wxALIGN_CENTER_VERTICAL, 2 );
|
||||||
m_controlItemsList.push_back( textCtrl );
|
m_controlItemsList.push_back( textCtrl );
|
||||||
textCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED,
|
textCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED,
|
||||||
|
@ -1088,7 +1088,7 @@ bool PANEL_SETUP_BOARD_STACKUP::transferDataFromUIToStackup()
|
||||||
wxTextCtrl* textCtrl = static_cast<wxTextCtrl*>( ui_item.m_ThicknessCtrl );
|
wxTextCtrl* textCtrl = static_cast<wxTextCtrl*>( ui_item.m_ThicknessCtrl );
|
||||||
txt = textCtrl->GetValue();
|
txt = textCtrl->GetValue();
|
||||||
|
|
||||||
int new_thickness = ValueFromString( m_frame->GetUserUnits(), txt );
|
int new_thickness = EDA_UNIT_UTILS::UI::ValueFromString( pcbIUScale, m_frame->GetUserUnits(), txt );
|
||||||
item->SetThickness( new_thickness, sub_item );
|
item->SetThickness( new_thickness, sub_item );
|
||||||
|
|
||||||
if( new_thickness < 0 )
|
if( new_thickness < 0 )
|
||||||
|
@ -1409,7 +1409,7 @@ void PANEL_SETUP_BOARD_STACKUP::onThicknessChange( wxCommandEvent& event )
|
||||||
BOARD_STACKUP_ITEM* item = GetStackupItem( row );
|
BOARD_STACKUP_ITEM* item = GetStackupItem( row );
|
||||||
int idx = GetSublayerId( row );
|
int idx = GetSublayerId( row );
|
||||||
|
|
||||||
item->SetThickness( ValueFromString( m_frame->GetUserUnits(), value ), idx );
|
item->SetThickness( EDA_UNIT_UTILS::UI::ValueFromString( pcbIUScale, m_frame->GetUserUnits(), value ), idx );
|
||||||
|
|
||||||
computeBoardThickness();
|
computeBoardThickness();
|
||||||
}
|
}
|
||||||
|
|
|
@ -367,8 +367,8 @@ void DIALOG_BOARD_REANNOTATE::MakeSampleText( wxString& aMessage )
|
||||||
"rounded to a %s, %s grid." ),
|
"rounded to a %s, %s grid." ),
|
||||||
fpLocation ? _( "footprint location" )
|
fpLocation ? _( "footprint location" )
|
||||||
: _( "reference designator location" ),
|
: _( "reference designator location" ),
|
||||||
MessageTextFromValue( m_units, m_sortGridx ),
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, m_units, m_sortGridx ),
|
||||||
MessageTextFromValue( m_units, m_sortGridy ) );
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, m_units, m_sortGridy ) );
|
||||||
|
|
||||||
ShowReport( aMessage, RPT_SEVERITY_INFO );
|
ShowReport( aMessage, RPT_SEVERITY_INFO );
|
||||||
}
|
}
|
||||||
|
@ -397,15 +397,15 @@ void DIALOG_BOARD_REANNOTATE::GetParameters()
|
||||||
|
|
||||||
if( m_gridIndex >= ( int ) m_settings->m_Window.grid.sizes.size() )
|
if( m_gridIndex >= ( int ) m_settings->m_Window.grid.sizes.size() )
|
||||||
{
|
{
|
||||||
m_sortGridx = DoubleValueFromString( EDA_UNITS::MILS,
|
m_sortGridx = EDA_UNIT_UTILS::UI::DoubleValueFromString(
|
||||||
m_settings->m_Window.grid.user_grid_x );
|
pcbIUScale, EDA_UNITS::MILS, m_settings->m_Window.grid.user_grid_x );
|
||||||
m_sortGridy = DoubleValueFromString( EDA_UNITS::MILS,
|
m_sortGridy = EDA_UNIT_UTILS::UI::DoubleValueFromString(
|
||||||
m_settings->m_Window.grid.user_grid_y );
|
pcbIUScale, EDA_UNITS::MILS, m_settings->m_Window.grid.user_grid_y );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_sortGridx = DoubleValueFromString( EDA_UNITS::MILS,
|
m_sortGridx = EDA_UNIT_UTILS::UI::DoubleValueFromString(
|
||||||
m_settings->m_Window.grid.sizes[ m_gridIndex ] );
|
pcbIUScale, EDA_UNITS::MILS, m_settings->m_Window.grid.sizes[m_gridIndex] );
|
||||||
m_sortGridy = m_sortGridx;
|
m_sortGridy = m_sortGridx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -482,8 +482,8 @@ static bool ModuleCompare( const RefDesInfo& aA, const RefDesInfo& aB )
|
||||||
wxString DIALOG_BOARD_REANNOTATE::CoordTowxString( int aX, int aY )
|
wxString DIALOG_BOARD_REANNOTATE::CoordTowxString( int aX, int aY )
|
||||||
{
|
{
|
||||||
return wxString::Format( wxT( "%s, %s" ),
|
return wxString::Format( wxT( "%s, %s" ),
|
||||||
MessageTextFromValue( m_units, aX ),
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, m_units, aX ),
|
||||||
MessageTextFromValue( m_units, aY ) );
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, m_units, aY ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -436,13 +436,13 @@ void DIALOG_BOARD_STATISTICS::updateWidets()
|
||||||
if( m_hasOutline )
|
if( m_hasOutline )
|
||||||
{
|
{
|
||||||
m_gridBoard->SetCellValue( ROW_BOARD_WIDTH, COL_AMOUNT,
|
m_gridBoard->SetCellValue( ROW_BOARD_WIDTH, COL_AMOUNT,
|
||||||
MessageTextFromValue( GetUserUnits(),
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, GetUserUnits(),
|
||||||
m_boardWidth ) + wxS( " " ) );
|
m_boardWidth ) + wxS( " " ) );
|
||||||
m_gridBoard->SetCellValue( ROW_BOARD_HEIGHT, COL_AMOUNT,
|
m_gridBoard->SetCellValue( ROW_BOARD_HEIGHT, COL_AMOUNT,
|
||||||
MessageTextFromValue( GetUserUnits(),
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, GetUserUnits(),
|
||||||
m_boardHeight ) + wxS( " " ) );
|
m_boardHeight ) + wxS( " " ) );
|
||||||
m_gridBoard->SetCellValue( ROW_BOARD_AREA, COL_AMOUNT,
|
m_gridBoard->SetCellValue( ROW_BOARD_AREA, COL_AMOUNT,
|
||||||
MessageTextFromValue( GetUserUnits(), m_boardArea, true,
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, GetUserUnits(), m_boardArea, true,
|
||||||
EDA_DATA_TYPE::AREA ) );
|
EDA_DATA_TYPE::AREA ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -501,9 +501,9 @@ void DIALOG_BOARD_STATISTICS::updateDrillGrid()
|
||||||
currentRow, drillType_t::COL_COUNT, wxString::Format( wxT( "%i" ), type.qty ) );
|
currentRow, drillType_t::COL_COUNT, wxString::Format( wxT( "%i" ), type.qty ) );
|
||||||
m_gridDrills->SetCellValue( currentRow, drillType_t::COL_SHAPE, shapeStr );
|
m_gridDrills->SetCellValue( currentRow, drillType_t::COL_SHAPE, shapeStr );
|
||||||
m_gridDrills->SetCellValue( currentRow, drillType_t::COL_X_SIZE,
|
m_gridDrills->SetCellValue( currentRow, drillType_t::COL_X_SIZE,
|
||||||
MessageTextFromValue( GetUserUnits(), type.xSize ) );
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, GetUserUnits(), type.xSize ) );
|
||||||
m_gridDrills->SetCellValue( currentRow, drillType_t::COL_Y_SIZE,
|
m_gridDrills->SetCellValue( currentRow, drillType_t::COL_Y_SIZE,
|
||||||
MessageTextFromValue( GetUserUnits(), type.ySize ) );
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, GetUserUnits(), type.ySize ) );
|
||||||
m_gridDrills->SetCellValue(
|
m_gridDrills->SetCellValue(
|
||||||
currentRow, drillType_t::COL_PLATED, type.isPlated ? _( "PTH" ) : _( "NPTH" ) );
|
currentRow, drillType_t::COL_PLATED, type.isPlated ? _( "PTH" ) : _( "NPTH" ) );
|
||||||
m_gridDrills->SetCellValue(
|
m_gridDrills->SetCellValue(
|
||||||
|
@ -693,11 +693,11 @@ void DIALOG_BOARD_STATISTICS::saveReportClicked( wxCommandEvent& aEvent )
|
||||||
if( m_hasOutline )
|
if( m_hasOutline )
|
||||||
{
|
{
|
||||||
msg << wxS( "- " ) << _( "Width" ) << wxS( ": " ) <<
|
msg << wxS( "- " ) << _( "Width" ) << wxS( ": " ) <<
|
||||||
MessageTextFromValue( GetUserUnits(), m_boardWidth ) << wxT( "\n" );
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, GetUserUnits(), m_boardWidth ) << wxT( "\n" );
|
||||||
msg << wxS( "- " ) << _( "Height" ) << wxS( ": " ) <<
|
msg << wxS( "- " ) << _( "Height" ) << wxS( ": " ) <<
|
||||||
MessageTextFromValue( GetUserUnits(), m_boardHeight ) << wxT( "\n" );
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, GetUserUnits(), m_boardHeight ) << wxT( "\n" );
|
||||||
msg << wxS( "- " ) << _( "Area" ) + wxS( ": " ) <<
|
msg << wxS( "- " ) << _( "Area" ) + wxS( ": " ) <<
|
||||||
MessageTextFromValue( GetUserUnits(), m_boardArea, true, EDA_DATA_TYPE::AREA );
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, GetUserUnits(), m_boardArea, true, EDA_DATA_TYPE::AREA );
|
||||||
msg << wxT( "\n" );
|
msg << wxT( "\n" );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -503,10 +503,11 @@ void DIALOG_COPPER_ZONE::OnClose( wxCloseEvent& event )
|
||||||
|
|
||||||
bool DIALOG_COPPER_ZONE::AcceptOptions( bool aUseExportableSetupOnly )
|
bool DIALOG_COPPER_ZONE::AcceptOptions( bool aUseExportableSetupOnly )
|
||||||
{
|
{
|
||||||
if( !m_clearance.Validate( 0, Mils2iu( ZONE_CLEARANCE_MAX_VALUE_MIL ) ) )
|
if( !m_clearance.Validate( 0, EDA_UNIT_UTILS::Mils2IU( pcbIUScale, ZONE_CLEARANCE_MAX_VALUE_MIL ) ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if( !m_minWidth.Validate( Mils2iu( ZONE_THICKNESS_MIN_VALUE_MIL ), INT_MAX ) )
|
if( !m_minWidth.Validate( EDA_UNIT_UTILS::Mils2IU( pcbIUScale, ZONE_THICKNESS_MIN_VALUE_MIL ),
|
||||||
|
INT_MAX ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if( !m_cornerRadius.Validate( 0, INT_MAX ) )
|
if( !m_cornerRadius.Validate( 0, INT_MAX ) )
|
||||||
|
|
|
@ -161,7 +161,7 @@ DIALOG_CREATE_ARRAY::DIALOG_CREATE_ARRAY( PCB_BASE_FRAME* aParent,
|
||||||
m_vCentre( aParent, m_labelCentreY, m_entryCentreY, m_unitLabelCentreY ),
|
m_vCentre( aParent, m_labelCentreY, m_entryCentreY, m_unitLabelCentreY ),
|
||||||
m_circRadius( aParent, m_labelCircRadius, m_valueCircRadius, m_unitLabelCircRadius ),
|
m_circRadius( aParent, m_labelCircRadius, m_valueCircRadius, m_unitLabelCircRadius ),
|
||||||
m_circAngle( aParent, m_labelCircAngle, m_entryCircAngle, m_unitLabelCircAngle ),
|
m_circAngle( aParent, m_labelCircAngle, m_entryCircAngle, m_unitLabelCircAngle ),
|
||||||
m_cfg_persister( s_arrayOptions.m_OptionsSet )
|
m_cfg_persister( pcbIUScale, s_arrayOptions.m_OptionsSet )
|
||||||
{
|
{
|
||||||
// Configure display origin transforms
|
// Configure display origin transforms
|
||||||
m_hSpacing.SetCoordType( ORIGIN_TRANSFORMS::REL_X_COORD );
|
m_hSpacing.SetCoordType( ORIGIN_TRANSFORMS::REL_X_COORD );
|
||||||
|
@ -391,7 +391,7 @@ bool DIALOG_CREATE_ARRAY::TransferDataFromWindow()
|
||||||
{
|
{
|
||||||
auto newCirc = std::make_unique<ARRAY_CIRCULAR_OPTIONS>();
|
auto newCirc = std::make_unique<ARRAY_CIRCULAR_OPTIONS>();
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
double angle = DoubleValueFromString( EDA_UNITS::UNSCALED, m_entryCircAngle->GetValue() );
|
double angle = EDA_UNIT_UTILS::UI::DoubleValueFromString( m_entryCircAngle->GetValue() );
|
||||||
|
|
||||||
newCirc->m_centre.x = m_hCentre.GetValue();
|
newCirc->m_centre.x = m_hCentre.GetValue();
|
||||||
newCirc->m_centre.y = m_vCentre.GetValue();
|
newCirc->m_centre.y = m_vCentre.GetValue();
|
||||||
|
|
|
@ -1047,7 +1047,7 @@ bool DIALOG_DRC::writeReport( const wxString& aFullFileName )
|
||||||
if( severity == RPT_SEVERITY_EXCLUSION )
|
if( severity == RPT_SEVERITY_EXCLUSION )
|
||||||
severity = bds.GetSeverity( item->GetErrorCode() );
|
severity = bds.GetSeverity( item->GetErrorCode() );
|
||||||
|
|
||||||
fprintf( fp, "%s", TO_UTF8( item->ShowReport( units, severity, itemMap ) ) );
|
fprintf( fp, "%s", TO_UTF8( item->ShowReport( pcbIUScale, units, severity, itemMap ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
count = m_ratsnestProvider->GetCount();
|
count = m_ratsnestProvider->GetCount();
|
||||||
|
@ -1059,7 +1059,7 @@ bool DIALOG_DRC::writeReport( const wxString& aFullFileName )
|
||||||
const std::shared_ptr<RC_ITEM>& item = m_ratsnestProvider->GetItem( i );
|
const std::shared_ptr<RC_ITEM>& item = m_ratsnestProvider->GetItem( i );
|
||||||
SEVERITY severity = bds.GetSeverity( item->GetErrorCode() );
|
SEVERITY severity = bds.GetSeverity( item->GetErrorCode() );
|
||||||
|
|
||||||
fprintf( fp, "%s", TO_UTF8( item->ShowReport( units, severity, itemMap ) ) );
|
fprintf( fp, "%s", TO_UTF8( item->ShowReport( pcbIUScale, units, severity, itemMap ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
count = m_fpWarningsProvider->GetCount();
|
count = m_fpWarningsProvider->GetCount();
|
||||||
|
@ -1071,7 +1071,7 @@ bool DIALOG_DRC::writeReport( const wxString& aFullFileName )
|
||||||
const std::shared_ptr<RC_ITEM>& item = m_fpWarningsProvider->GetItem( i );
|
const std::shared_ptr<RC_ITEM>& item = m_fpWarningsProvider->GetItem( i );
|
||||||
SEVERITY severity = bds.GetSeverity( item->GetErrorCode() );
|
SEVERITY severity = bds.GetSeverity( item->GetErrorCode() );
|
||||||
|
|
||||||
fprintf( fp, "%s", TO_UTF8( item->ShowReport( units, severity, itemMap ) ) );
|
fprintf( fp, "%s", TO_UTF8( item->ShowReport( pcbIUScale, units, severity, itemMap ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -117,12 +117,12 @@ public:
|
||||||
|
|
||||||
double GetXRef()
|
double GetXRef()
|
||||||
{
|
{
|
||||||
return DoubleValueFromString( EDA_UNITS::UNSCALED, m_IDF_Xref->GetValue() );
|
return EDA_UNIT_UTILS::UI::DoubleValueFromString( m_IDF_Xref->GetValue() );
|
||||||
}
|
}
|
||||||
|
|
||||||
double GetYRef()
|
double GetYRef()
|
||||||
{
|
{
|
||||||
return DoubleValueFromString( EDA_UNITS::UNSCALED, m_IDF_Yref->GetValue() );
|
return EDA_UNIT_UTILS::UI::DoubleValueFromString( m_IDF_Yref->GetValue() );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GetAutoAdjustOffset()
|
bool GetAutoAdjustOffset()
|
||||||
|
|
|
@ -79,12 +79,12 @@ protected:
|
||||||
|
|
||||||
double GetXOrg() const
|
double GetXOrg() const
|
||||||
{
|
{
|
||||||
return DoubleValueFromString( EDA_UNITS::UNSCALED, m_STEP_Xorg->GetValue() );
|
return EDA_UNIT_UTILS::UI::DoubleValueFromString( m_STEP_Xorg->GetValue() );
|
||||||
}
|
}
|
||||||
|
|
||||||
double GetYOrg()
|
double GetYOrg()
|
||||||
{
|
{
|
||||||
return DoubleValueFromString( EDA_UNITS::UNSCALED, m_STEP_Yorg->GetValue() );
|
return EDA_UNIT_UTILS::UI::DoubleValueFromString( m_STEP_Yorg->GetValue() );
|
||||||
}
|
}
|
||||||
|
|
||||||
STEP_ORG_OPT GetOriginOption();
|
STEP_ORG_OPT GetOriginOption();
|
||||||
|
|
|
@ -139,12 +139,12 @@ public:
|
||||||
|
|
||||||
double GetXRef()
|
double GetXRef()
|
||||||
{
|
{
|
||||||
return DoubleValueFromString( EDA_UNITS::UNSCALED, m_VRML_Xref->GetValue() );
|
return EDA_UNIT_UTILS::UI::DoubleValueFromString( m_VRML_Xref->GetValue() );
|
||||||
}
|
}
|
||||||
|
|
||||||
double GetYRef()
|
double GetYRef()
|
||||||
{
|
{
|
||||||
return DoubleValueFromString( EDA_UNITS::UNSCALED, m_VRML_Yref->GetValue() );
|
return EDA_UNIT_UTILS::UI::DoubleValueFromString( m_VRML_Yref->GetValue() );
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetUnits()
|
int GetUnits()
|
||||||
|
|
|
@ -239,7 +239,7 @@ bool DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataToWindow()
|
||||||
m_LayerCtrl->SetLayerSelection( UNDEFINED_LAYER );
|
m_LayerCtrl->SetLayerSelection( UNDEFINED_LAYER );
|
||||||
|
|
||||||
#define SET_INT_VALUE( aRow, aCol, aValue ) \
|
#define SET_INT_VALUE( aRow, aCol, aValue ) \
|
||||||
m_grid->SetCellValue( aRow, aCol, StringFromValue( GetUserUnits(), aValue, true ) )
|
m_grid->SetCellValue( aRow, aCol, EDA_UNIT_UTILS::UI::StringFromValue( pcbIUScale, GetUserUnits(), aValue, true ) )
|
||||||
|
|
||||||
#define SET_BOOL_VALUE( aRow, aCol, aValue ) \
|
#define SET_BOOL_VALUE( aRow, aCol, aValue ) \
|
||||||
attr = new wxGridCellAttr; \
|
attr = new wxGridCellAttr; \
|
||||||
|
|
|
@ -236,7 +236,7 @@ void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::buildNetclassesGrid()
|
||||||
auto setNetclassValue =
|
auto setNetclassValue =
|
||||||
[this, units]( int aRow, int aCol, int aVal )
|
[this, units]( int aRow, int aCol, int aVal )
|
||||||
{
|
{
|
||||||
m_netclassGrid->SetCellValue( aRow, aCol, StringFromValue( units, aVal, true ) );
|
m_netclassGrid->SetCellValue( aRow, aCol, EDA_UNIT_UTILS::UI::StringFromValue( pcbIUScale, units, aVal, true ) );
|
||||||
};
|
};
|
||||||
|
|
||||||
auto buildRow =
|
auto buildRow =
|
||||||
|
|
|
@ -1295,7 +1295,7 @@ wxString DIALOG_NET_INSPECTOR::formatCount( unsigned int aValue ) const
|
||||||
|
|
||||||
wxString DIALOG_NET_INSPECTOR::formatLength( int64_t aValue ) const
|
wxString DIALOG_NET_INSPECTOR::formatLength( int64_t aValue ) const
|
||||||
{
|
{
|
||||||
return MessageTextFromValue( GetUserUnits(), static_cast<long long int>( aValue ) );
|
return EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, GetUserUnits(), static_cast<long long int>( aValue ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -319,10 +319,10 @@ bool DIALOG_PAD_PRIMITIVE_POLY_PROPS::TransferDataToWindow()
|
||||||
msg.Printf( _( "Corner %d" ), row+1 );
|
msg.Printf( _( "Corner %d" ), row+1 );
|
||||||
m_gridCornersList->SetRowLabelValue( row, msg );
|
m_gridCornersList->SetRowLabelValue( row, msg );
|
||||||
|
|
||||||
msg = StringFromValue( GetUserUnits(), m_currPoints[row].x, true );
|
msg = EDA_UNIT_UTILS::UI::StringFromValue( pcbIUScale, GetUserUnits(), m_currPoints[row].x, true );
|
||||||
m_gridCornersList->SetCellValue( row, 0, msg );
|
m_gridCornersList->SetCellValue( row, 0, msg );
|
||||||
|
|
||||||
msg = StringFromValue( GetUserUnits(), m_currPoints[row].y, true );
|
msg = EDA_UNIT_UTILS::UI::StringFromValue( pcbIUScale, GetUserUnits(), m_currPoints[row].y, true );
|
||||||
m_gridCornersList->SetCellValue( row, 1, msg );
|
m_gridCornersList->SetCellValue( row, 1, msg );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -563,9 +563,9 @@ void DIALOG_PAD_PRIMITIVE_POLY_PROPS::onCellChanging( wxGridEvent& event )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( col == 0 ) // Set the X value
|
if( col == 0 ) // Set the X value
|
||||||
m_currPoints[row].x = ValueFromString( GetUserUnits(), msg );
|
m_currPoints[row].x = EDA_UNIT_UTILS::UI::ValueFromString( pcbIUScale, GetUserUnits(), msg );
|
||||||
else // Set the Y value
|
else // Set the Y value
|
||||||
m_currPoints[row].y = ValueFromString( GetUserUnits(), msg );
|
m_currPoints[row].y = EDA_UNIT_UTILS::UI::ValueFromString( pcbIUScale, GetUserUnits(), msg );
|
||||||
|
|
||||||
Validate();
|
Validate();
|
||||||
|
|
||||||
|
@ -602,7 +602,7 @@ void DIALOG_PAD_PRIMITIVES_TRANSFORM::Transform( std::vector<std::shared_ptr<PCB
|
||||||
{
|
{
|
||||||
VECTOR2I move_vect( m_vectorX.GetValue(), m_vectorY.GetValue() );
|
VECTOR2I move_vect( m_vectorX.GetValue(), m_vectorY.GetValue() );
|
||||||
EDA_ANGLE rotation = m_rotation.GetAngleValue();
|
EDA_ANGLE rotation = m_rotation.GetAngleValue();
|
||||||
double scale = DoubleValueFromString( EDA_UNITS::UNSCALED, m_scaleCtrl->GetValue() );
|
double scale = EDA_UNIT_UTILS::UI::DoubleValueFromString( m_scaleCtrl->GetValue() );
|
||||||
|
|
||||||
// Avoid too small / too large scale, which could create issues:
|
// Avoid too small / too large scale, which could create issues:
|
||||||
if( scale < 0.01 )
|
if( scale < 0.01 )
|
||||||
|
|
|
@ -676,8 +676,8 @@ void DIALOG_PAD_PROPERTIES::initValues()
|
||||||
static wxString formatCoord( EDA_UNITS aUnits, VECTOR2I aCoord )
|
static wxString formatCoord( EDA_UNITS aUnits, VECTOR2I aCoord )
|
||||||
{
|
{
|
||||||
return wxString::Format( wxT( "(X:%s Y:%s)" ),
|
return wxString::Format( wxT( "(X:%s Y:%s)" ),
|
||||||
MessageTextFromValue( aUnits, aCoord.x ),
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, aUnits, aCoord.x ),
|
||||||
MessageTextFromValue( aUnits, aCoord.y ) );
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, aUnits, aCoord.y ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void DIALOG_PAD_PROPERTIES::displayPrimitivesList()
|
void DIALOG_PAD_PROPERTIES::displayPrimitivesList()
|
||||||
|
@ -699,7 +699,7 @@ void DIALOG_PAD_PROPERTIES::displayPrimitivesList()
|
||||||
for( wxString& s : bs_info )
|
for( wxString& s : bs_info )
|
||||||
s.Empty();
|
s.Empty();
|
||||||
|
|
||||||
bs_info[4] = _( "width" ) + wxS( " " )+ MessageTextFromValue( m_units,
|
bs_info[4] = _( "width" ) + wxS( " " )+ EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, m_units,
|
||||||
primitive->GetWidth() );
|
primitive->GetWidth() );
|
||||||
|
|
||||||
switch( primitive->GetShape() )
|
switch( primitive->GetShape() )
|
||||||
|
@ -730,7 +730,7 @@ void DIALOG_PAD_PROPERTIES::displayPrimitivesList()
|
||||||
bs_info[0] = _( "Circle" );
|
bs_info[0] = _( "Circle" );
|
||||||
|
|
||||||
bs_info[1] = _( "at" ) + wxS( " " ) + formatCoord( m_units, primitive->GetStart() );
|
bs_info[1] = _( "at" ) + wxS( " " ) + formatCoord( m_units, primitive->GetStart() );
|
||||||
bs_info[2] = _( "radius" ) + wxS( " " ) + MessageTextFromValue( m_units,
|
bs_info[2] = _( "radius" ) + wxS( " " ) + EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, m_units,
|
||||||
primitive->GetRadius() );
|
primitive->GetRadius() );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -237,8 +237,8 @@ void DIALOG_PLOT::init_Dialog()
|
||||||
m_XScaleAdjust = m_YScaleAdjust = 1.0;
|
m_XScaleAdjust = m_YScaleAdjust = 1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_fineAdjustXCtrl->SetValue( StringFromValue( EDA_UNITS::UNSCALED, m_XScaleAdjust ) );
|
m_fineAdjustXCtrl->SetValue( EDA_UNIT_UTILS::UI::StringFromValue( pcbIUScale, EDA_UNITS::UNSCALED, m_XScaleAdjust ) );
|
||||||
m_fineAdjustYCtrl->SetValue( StringFromValue( EDA_UNITS::UNSCALED, m_YScaleAdjust ) );
|
m_fineAdjustYCtrl->SetValue( EDA_UNIT_UTILS::UI::StringFromValue( pcbIUScale, EDA_UNITS::UNSCALED, m_YScaleAdjust ) );
|
||||||
|
|
||||||
// Test for a reasonable PS width correction value. Set to 0 if problem.
|
// Test for a reasonable PS width correction value. Set to 0 if problem.
|
||||||
if( m_PSWidthAdjust < m_widthAdjustMinValue || m_PSWidthAdjust > m_widthAdjustMaxValue )
|
if( m_PSWidthAdjust < m_widthAdjustMinValue || m_PSWidthAdjust > m_widthAdjustMaxValue )
|
||||||
|
@ -835,8 +835,8 @@ void DIALOG_PLOT::applyPlotSettings()
|
||||||
m_trackWidthCorrection.SetValue( m_PSWidthAdjust );
|
m_trackWidthCorrection.SetValue( m_PSWidthAdjust );
|
||||||
msg.Printf( _( "Width correction constrained. The width correction value must be in the"
|
msg.Printf( _( "Width correction constrained. The width correction value must be in the"
|
||||||
" range of [%s; %s] for the current design rules." ),
|
" range of [%s; %s] for the current design rules." ),
|
||||||
StringFromValue( GetUserUnits(), m_widthAdjustMinValue, true ),
|
EDA_UNIT_UTILS::UI::StringFromValue( pcbIUScale, GetUserUnits(), m_widthAdjustMinValue, true ),
|
||||||
StringFromValue( GetUserUnits(), m_widthAdjustMaxValue, true ) );
|
EDA_UNIT_UTILS::UI::StringFromValue( pcbIUScale, GetUserUnits(), m_widthAdjustMaxValue, true ) );
|
||||||
reporter.Report( msg, RPT_SEVERITY_WARNING );
|
reporter.Report( msg, RPT_SEVERITY_WARNING );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@ bool DIALOG_TARGET_PROPERTIES::TransferDataToWindow()
|
||||||
bool DIALOG_TARGET_PROPERTIES::TransferDataFromWindow()
|
bool DIALOG_TARGET_PROPERTIES::TransferDataFromWindow()
|
||||||
{
|
{
|
||||||
// Zero-size targets are hard to see/select.
|
// Zero-size targets are hard to see/select.
|
||||||
if( !m_Size.Validate( Mils2iu( 1 ), INT_MAX ) )
|
if( !m_Size.Validate( EDA_UNIT_UTILS::Mils2IU( pcbIUScale, 1 ), INT_MAX ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
BOARD_COMMIT commit( m_Parent );
|
BOARD_COMMIT commit( m_Parent );
|
||||||
|
|
|
@ -307,9 +307,9 @@ DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParen
|
||||||
for( unsigned ii = 1; ii < aParent->GetDesignSettings().m_ViasDimensionsList.size(); ii++ )
|
for( unsigned ii = 1; ii < aParent->GetDesignSettings().m_ViasDimensionsList.size(); ii++ )
|
||||||
{
|
{
|
||||||
VIA_DIMENSION* viaDimension = &aParent->GetDesignSettings().m_ViasDimensionsList[ii];
|
VIA_DIMENSION* viaDimension = &aParent->GetDesignSettings().m_ViasDimensionsList[ii];
|
||||||
wxString msg = StringFromValue( m_frame->GetUserUnits(), viaDimension->m_Diameter )
|
wxString msg = EDA_UNIT_UTILS::UI::StringFromValue( pcbIUScale, m_frame->GetUserUnits(), viaDimension->m_Diameter )
|
||||||
+ wxT( " / " )
|
+ wxT( " / " )
|
||||||
+ StringFromValue( m_frame->GetUserUnits(), viaDimension->m_Drill );
|
+ EDA_UNIT_UTILS::UI::StringFromValue( pcbIUScale, m_frame->GetUserUnits(), viaDimension->m_Drill );
|
||||||
m_DesignRuleViasCtrl->Append( msg, viaDimension );
|
m_DesignRuleViasCtrl->Append( msg, viaDimension );
|
||||||
|
|
||||||
if( viaSelection == wxNOT_FOUND
|
if( viaSelection == wxNOT_FOUND
|
||||||
|
@ -352,7 +352,7 @@ DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParen
|
||||||
for( unsigned ii = 1; ii < aParent->GetDesignSettings().m_TrackWidthList.size(); ii++ )
|
for( unsigned ii = 1; ii < aParent->GetDesignSettings().m_TrackWidthList.size(); ii++ )
|
||||||
{
|
{
|
||||||
int width = aParent->GetDesignSettings().m_TrackWidthList[ii];
|
int width = aParent->GetDesignSettings().m_TrackWidthList[ii];
|
||||||
wxString msg = StringFromValue( m_frame->GetUserUnits(), width );
|
wxString msg = EDA_UNIT_UTILS::UI::StringFromValue( pcbIUScale, m_frame->GetUserUnits(), width );
|
||||||
m_DesignRuleWidthsCtrl->Append( msg );
|
m_DesignRuleWidthsCtrl->Append( msg );
|
||||||
|
|
||||||
if( widthSelection == wxNOT_FOUND && m_trackWidth.GetValue() == width )
|
if( widthSelection == wxNOT_FOUND && m_trackWidth.GetValue() == width )
|
||||||
|
@ -407,9 +407,9 @@ void DIALOG_TRACK_VIA_PROPERTIES::onUnitsChanged( wxCommandEvent& aEvent )
|
||||||
for( unsigned ii = 1; ii < m_frame->GetDesignSettings().m_ViasDimensionsList.size(); ii++ )
|
for( unsigned ii = 1; ii < m_frame->GetDesignSettings().m_ViasDimensionsList.size(); ii++ )
|
||||||
{
|
{
|
||||||
VIA_DIMENSION* viaDimension = &m_frame->GetDesignSettings().m_ViasDimensionsList[ii];
|
VIA_DIMENSION* viaDimension = &m_frame->GetDesignSettings().m_ViasDimensionsList[ii];
|
||||||
wxString msg = StringFromValue( m_frame->GetUserUnits(), viaDimension->m_Diameter )
|
wxString msg = EDA_UNIT_UTILS::UI::StringFromValue( pcbIUScale, m_frame->GetUserUnits(), viaDimension->m_Diameter )
|
||||||
+ wxT( " / " )
|
+ wxT( " / " )
|
||||||
+ StringFromValue( m_frame->GetUserUnits(), viaDimension->m_Drill );
|
+ EDA_UNIT_UTILS::UI::StringFromValue( pcbIUScale, m_frame->GetUserUnits(), viaDimension->m_Drill );
|
||||||
m_DesignRuleViasCtrl->Append( msg, viaDimension );
|
m_DesignRuleViasCtrl->Append( msg, viaDimension );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -428,7 +428,7 @@ void DIALOG_TRACK_VIA_PROPERTIES::onUnitsChanged( wxCommandEvent& aEvent )
|
||||||
for( unsigned ii = 1; ii < m_frame->GetDesignSettings().m_TrackWidthList.size(); ii++ )
|
for( unsigned ii = 1; ii < m_frame->GetDesignSettings().m_TrackWidthList.size(); ii++ )
|
||||||
{
|
{
|
||||||
int width = m_frame->GetDesignSettings().m_TrackWidthList[ii];
|
int width = m_frame->GetDesignSettings().m_TrackWidthList[ii];
|
||||||
wxString msg = StringFromValue( m_frame->GetUserUnits(), width );
|
wxString msg = EDA_UNIT_UTILS::UI::StringFromValue( pcbIUScale, m_frame->GetUserUnits(), width );
|
||||||
m_DesignRuleWidthsCtrl->Append( msg );
|
m_DesignRuleWidthsCtrl->Append( msg );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ PANEL_EDIT_OPTIONS::PANEL_EDIT_OPTIONS( wxWindow* aParent, EDA_BASE_FRAME* aUnit
|
||||||
bool isFootprintEditor ) :
|
bool isFootprintEditor ) :
|
||||||
PANEL_EDIT_OPTIONS_BASE( aParent ),
|
PANEL_EDIT_OPTIONS_BASE( aParent ),
|
||||||
m_isFootprintEditor( isFootprintEditor ),
|
m_isFootprintEditor( isFootprintEditor ),
|
||||||
m_rotationAngle( aUnitsProvider, m_rotationAngleLabel, m_rotationAngleCtrl,
|
m_rotationAngle( aUnitsProvider, pcbIUScale, m_rotationAngleLabel, m_rotationAngleCtrl,
|
||||||
m_rotationAngleUnits )
|
m_rotationAngleUnits )
|
||||||
{
|
{
|
||||||
m_magneticPads->Show( m_isFootprintEditor );
|
m_magneticPads->Show( m_isFootprintEditor );
|
||||||
|
|
|
@ -220,7 +220,7 @@ void PANEL_FP_EDITOR_DEFAULTS::loadFPSettings( FOOTPRINT_EDITOR_SETTINGS* aCfg )
|
||||||
wxColour disabledColour = wxSystemSettings::GetColour( wxSYS_COLOUR_BACKGROUND );
|
wxColour disabledColour = wxSystemSettings::GetColour( wxSYS_COLOUR_BACKGROUND );
|
||||||
|
|
||||||
#define SET_MILS_CELL( row, col, val ) \
|
#define SET_MILS_CELL( row, col, val ) \
|
||||||
m_graphicsGrid->SetCellValue( row, col, StringFromValue( m_units, val, true ) )
|
m_graphicsGrid->SetCellValue( row, col, EDA_UNIT_UTILS::UI::StringFromValue( pcbIUScale, m_units, val, true ) )
|
||||||
|
|
||||||
#define DISABLE_CELL( row, col ) \
|
#define DISABLE_CELL( row, col ) \
|
||||||
m_graphicsGrid->SetReadOnly( row, col ); \
|
m_graphicsGrid->SetReadOnly( row, col ); \
|
||||||
|
@ -317,7 +317,7 @@ bool PANEL_FP_EDITOR_DEFAULTS::Show( bool aShow )
|
||||||
|
|
||||||
int PANEL_FP_EDITOR_DEFAULTS::getGridValue( int aRow, int aCol )
|
int PANEL_FP_EDITOR_DEFAULTS::getGridValue( int aRow, int aCol )
|
||||||
{
|
{
|
||||||
return ValueFromString( m_units, m_graphicsGrid->GetCellValue( aRow, aCol ) );
|
return EDA_UNIT_UTILS::UI::ValueFromString( pcbIUScale, m_units, m_graphicsGrid->GetCellValue( aRow, aCol ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ bool PANEL_SETUP_CONSTRAINTS::TransferDataToWindow()
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
msg.Printf( m_stCircleToPolyWarning->GetLabel(),
|
msg.Printf( m_stCircleToPolyWarning->GetLabel(),
|
||||||
StringFromValue( m_Frame->GetUserUnits(), ARC_HIGH_DEF, true ) );
|
EDA_UNIT_UTILS::UI::StringFromValue( pcbIUScale, m_Frame->GetUserUnits(), ARC_HIGH_DEF, true ) );
|
||||||
m_stCircleToPolyWarning->SetLabel( msg );
|
m_stCircleToPolyWarning->SetLabel( msg );
|
||||||
|
|
||||||
m_useHeightForLengthCalcs->SetValue( m_BrdSettings->m_UseHeightForLengthCalcs );
|
m_useHeightForLengthCalcs->SetValue( m_BrdSettings->m_UseHeightForLengthCalcs );
|
||||||
|
|
|
@ -41,10 +41,10 @@ bool PANEL_SETUP_FORMATTING::TransferDataToWindow()
|
||||||
{
|
{
|
||||||
const PCB_PLOT_PARAMS& settings = m_frame->GetBoard()->GetPlotOptions();
|
const PCB_PLOT_PARAMS& settings = m_frame->GetBoard()->GetPlotOptions();
|
||||||
|
|
||||||
m_dashLengthCtrl->SetValue( StringFromValue( EDA_UNITS::UNSCALED,
|
m_dashLengthCtrl->SetValue( EDA_UNIT_UTILS::UI::StringFromValue( pcbIUScale, EDA_UNITS::UNSCALED,
|
||||||
settings.GetDashedLineDashRatio() ) );
|
settings.GetDashedLineDashRatio() ) );
|
||||||
|
|
||||||
m_gapLengthCtrl->SetValue( StringFromValue( EDA_UNITS::UNSCALED,
|
m_gapLengthCtrl->SetValue( EDA_UNIT_UTILS::UI::StringFromValue( pcbIUScale, EDA_UNITS::UNSCALED,
|
||||||
settings.GetDashedLineGapRatio() ) );
|
settings.GetDashedLineGapRatio() ) );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -55,11 +55,9 @@ bool PANEL_SETUP_FORMATTING::TransferDataFromWindow()
|
||||||
{
|
{
|
||||||
PCB_PLOT_PARAMS settings = m_frame->GetBoard()->GetPlotOptions();
|
PCB_PLOT_PARAMS settings = m_frame->GetBoard()->GetPlotOptions();
|
||||||
|
|
||||||
settings.SetDashedLineDashRatio( DoubleValueFromString( EDA_UNITS::UNSCALED,
|
settings.SetDashedLineDashRatio( EDA_UNIT_UTILS::UI::DoubleValueFromString( m_dashLengthCtrl->GetValue() ) );
|
||||||
m_dashLengthCtrl->GetValue() ) );
|
|
||||||
|
|
||||||
settings.SetDashedLineGapRatio( DoubleValueFromString( EDA_UNITS::UNSCALED,
|
settings.SetDashedLineGapRatio( EDA_UNIT_UTILS::UI::DoubleValueFromString( m_gapLengthCtrl->GetValue() ) );
|
||||||
m_gapLengthCtrl->GetValue() ) );
|
|
||||||
|
|
||||||
m_frame->GetBoard()->SetPlotOptions( settings );
|
m_frame->GetBoard()->SetPlotOptions( settings );
|
||||||
|
|
||||||
|
@ -79,9 +77,9 @@ void PANEL_SETUP_FORMATTING::ImportSettingsFrom( BOARD* aBoard )
|
||||||
{
|
{
|
||||||
const PCB_PLOT_PARAMS& importedSettings = aBoard->GetPlotOptions();
|
const PCB_PLOT_PARAMS& importedSettings = aBoard->GetPlotOptions();
|
||||||
|
|
||||||
m_dashLengthCtrl->SetValue( StringFromValue( EDA_UNITS::UNSCALED,
|
m_dashLengthCtrl->SetValue( EDA_UNIT_UTILS::UI::StringFromValue( pcbIUScale, EDA_UNITS::UNSCALED,
|
||||||
importedSettings.GetDashedLineDashRatio() ) );
|
importedSettings.GetDashedLineDashRatio() ) );
|
||||||
|
|
||||||
m_gapLengthCtrl->SetValue( StringFromValue( EDA_UNITS::UNSCALED,
|
m_gapLengthCtrl->SetValue( EDA_UNIT_UTILS::UI::StringFromValue( pcbIUScale, EDA_UNITS::UNSCALED,
|
||||||
importedSettings.GetDashedLineGapRatio() ) );
|
importedSettings.GetDashedLineGapRatio() ) );
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,7 +126,7 @@ bool PANEL_SETUP_TEXT_AND_GRAPHICS::TransferDataToWindow()
|
||||||
wxColour disabledColour = wxSystemSettings::GetColour( wxSYS_COLOUR_BACKGROUND );
|
wxColour disabledColour = wxSystemSettings::GetColour( wxSYS_COLOUR_BACKGROUND );
|
||||||
|
|
||||||
#define SET_MILS_CELL( row, col, val ) \
|
#define SET_MILS_CELL( row, col, val ) \
|
||||||
m_grid->SetCellValue( row, col, StringFromValue( m_Frame->GetUserUnits(), val, true ) )
|
m_grid->SetCellValue( row, col, EDA_UNIT_UTILS::UI::StringFromValue( pcbIUScale, m_Frame->GetUserUnits(), val, true ) )
|
||||||
|
|
||||||
#define DISABLE_CELL( row, col ) \
|
#define DISABLE_CELL( row, col ) \
|
||||||
m_grid->SetReadOnly( row, col ); m_grid->SetCellBackgroundColour( row, col, disabledColour );
|
m_grid->SetReadOnly( row, col ); m_grid->SetCellBackgroundColour( row, col, disabledColour );
|
||||||
|
@ -198,7 +198,7 @@ bool PANEL_SETUP_TEXT_AND_GRAPHICS::TransferDataToWindow()
|
||||||
|
|
||||||
int PANEL_SETUP_TEXT_AND_GRAPHICS::getGridValue( int aRow, int aCol )
|
int PANEL_SETUP_TEXT_AND_GRAPHICS::getGridValue( int aRow, int aCol )
|
||||||
{
|
{
|
||||||
return ValueFromString( m_Frame->GetUserUnits(), m_grid->GetCellValue( aRow, aCol ) );
|
return EDA_UNIT_UTILS::UI::ValueFromString( pcbIUScale, m_Frame->GetUserUnits(), m_grid->GetCellValue( aRow, aCol ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -141,7 +141,7 @@ void PANEL_SETUP_TRACKS_AND_VIAS::OnSortTrackWidthsClick( wxCommandEvent& aEvent
|
||||||
msg = m_trackWidthsGrid->GetCellValue( row, TR_WIDTH_COL );
|
msg = m_trackWidthsGrid->GetCellValue( row, TR_WIDTH_COL );
|
||||||
|
|
||||||
if( !msg.IsEmpty() )
|
if( !msg.IsEmpty() )
|
||||||
trackWidths.push_back( ValueFromString( m_Frame->GetUserUnits(), msg ) );
|
trackWidths.push_back( EDA_UNIT_UTILS::UI::ValueFromString( pcbIUScale, m_Frame->GetUserUnits(), msg ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
std::sort( trackWidths.begin(), trackWidths.end() );
|
std::sort( trackWidths.begin(), trackWidths.end() );
|
||||||
|
@ -166,12 +166,12 @@ void PANEL_SETUP_TRACKS_AND_VIAS::OnSortViaSizesClick( wxCommandEvent& aEvent )
|
||||||
if( !msg.IsEmpty() )
|
if( !msg.IsEmpty() )
|
||||||
{
|
{
|
||||||
VIA_DIMENSION via_dim;
|
VIA_DIMENSION via_dim;
|
||||||
via_dim.m_Diameter = ValueFromString( m_Frame->GetUserUnits(), msg );
|
via_dim.m_Diameter = EDA_UNIT_UTILS::UI::ValueFromString( pcbIUScale, m_Frame->GetUserUnits(), msg );
|
||||||
|
|
||||||
msg = m_viaSizesGrid->GetCellValue( row, VIA_DRILL_COL );
|
msg = m_viaSizesGrid->GetCellValue( row, VIA_DRILL_COL );
|
||||||
|
|
||||||
if( !msg.IsEmpty() )
|
if( !msg.IsEmpty() )
|
||||||
via_dim.m_Drill = ValueFromString( m_Frame->GetUserUnits(), msg );
|
via_dim.m_Drill = EDA_UNIT_UTILS::UI::ValueFromString( pcbIUScale, m_Frame->GetUserUnits(), msg );
|
||||||
|
|
||||||
vias.push_back( via_dim );
|
vias.push_back( via_dim );
|
||||||
}
|
}
|
||||||
|
@ -199,15 +199,15 @@ void PANEL_SETUP_TRACKS_AND_VIAS::OnSortDiffPairsClick( wxCommandEvent& aEvent )
|
||||||
if( !msg.IsEmpty() )
|
if( !msg.IsEmpty() )
|
||||||
{
|
{
|
||||||
DIFF_PAIR_DIMENSION diffPair_dim;
|
DIFF_PAIR_DIMENSION diffPair_dim;
|
||||||
diffPair_dim.m_Width = ValueFromString( m_Frame->GetUserUnits(), msg );
|
diffPair_dim.m_Width = EDA_UNIT_UTILS::UI::ValueFromString( pcbIUScale, m_Frame->GetUserUnits(), msg );
|
||||||
|
|
||||||
msg = m_diffPairsGrid->GetCellValue( row, DP_GAP_COL );
|
msg = m_diffPairsGrid->GetCellValue( row, DP_GAP_COL );
|
||||||
diffPair_dim.m_Gap = ValueFromString( m_Frame->GetUserUnits(), msg );
|
diffPair_dim.m_Gap = EDA_UNIT_UTILS::UI::ValueFromString( pcbIUScale, m_Frame->GetUserUnits(), msg );
|
||||||
|
|
||||||
msg = m_diffPairsGrid->GetCellValue( row, DP_VIA_GAP_COL );
|
msg = m_diffPairsGrid->GetCellValue( row, DP_VIA_GAP_COL );
|
||||||
|
|
||||||
if( !msg.IsEmpty() )
|
if( !msg.IsEmpty() )
|
||||||
diffPair_dim.m_ViaGap = ValueFromString( m_Frame->GetUserUnits(), msg );
|
diffPair_dim.m_ViaGap = EDA_UNIT_UTILS::UI::ValueFromString( pcbIUScale, m_Frame->GetUserUnits(), msg );
|
||||||
|
|
||||||
diffPairs.push_back( diffPair_dim );
|
diffPairs.push_back( diffPair_dim );
|
||||||
}
|
}
|
||||||
|
@ -289,7 +289,7 @@ bool PANEL_SETUP_TRACKS_AND_VIAS::TransferDataFromWindow()
|
||||||
msg = m_trackWidthsGrid->GetCellValue( row, TR_WIDTH_COL );
|
msg = m_trackWidthsGrid->GetCellValue( row, TR_WIDTH_COL );
|
||||||
|
|
||||||
if( !msg.IsEmpty() )
|
if( !msg.IsEmpty() )
|
||||||
trackWidths.push_back( ValueFromString( m_Frame->GetUserUnits(), msg ) );
|
trackWidths.push_back( EDA_UNIT_UTILS::UI::ValueFromString( pcbIUScale, m_Frame->GetUserUnits(), msg ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
for( int row = 0; row < m_viaSizesGrid->GetNumberRows(); ++row )
|
for( int row = 0; row < m_viaSizesGrid->GetNumberRows(); ++row )
|
||||||
|
@ -299,12 +299,12 @@ bool PANEL_SETUP_TRACKS_AND_VIAS::TransferDataFromWindow()
|
||||||
if( !msg.IsEmpty() )
|
if( !msg.IsEmpty() )
|
||||||
{
|
{
|
||||||
VIA_DIMENSION via_dim;
|
VIA_DIMENSION via_dim;
|
||||||
via_dim.m_Diameter = ValueFromString( m_Frame->GetUserUnits(), msg );
|
via_dim.m_Diameter = EDA_UNIT_UTILS::UI::ValueFromString( pcbIUScale, m_Frame->GetUserUnits(), msg );
|
||||||
|
|
||||||
msg = m_viaSizesGrid->GetCellValue( row, VIA_DRILL_COL );
|
msg = m_viaSizesGrid->GetCellValue( row, VIA_DRILL_COL );
|
||||||
|
|
||||||
if( !msg.IsEmpty() )
|
if( !msg.IsEmpty() )
|
||||||
via_dim.m_Drill = ValueFromString( m_Frame->GetUserUnits(), msg );
|
via_dim.m_Drill = EDA_UNIT_UTILS::UI::ValueFromString( pcbIUScale, m_Frame->GetUserUnits(), msg );
|
||||||
|
|
||||||
vias.push_back( via_dim );
|
vias.push_back( via_dim );
|
||||||
}
|
}
|
||||||
|
@ -317,15 +317,15 @@ bool PANEL_SETUP_TRACKS_AND_VIAS::TransferDataFromWindow()
|
||||||
if( !msg.IsEmpty() )
|
if( !msg.IsEmpty() )
|
||||||
{
|
{
|
||||||
DIFF_PAIR_DIMENSION diffPair_dim;
|
DIFF_PAIR_DIMENSION diffPair_dim;
|
||||||
diffPair_dim.m_Width = ValueFromString( m_Frame->GetUserUnits(), msg );
|
diffPair_dim.m_Width = EDA_UNIT_UTILS::UI::ValueFromString( pcbIUScale, m_Frame->GetUserUnits(), msg );
|
||||||
|
|
||||||
msg = m_diffPairsGrid->GetCellValue( row, DP_GAP_COL );
|
msg = m_diffPairsGrid->GetCellValue( row, DP_GAP_COL );
|
||||||
diffPair_dim.m_Gap = ValueFromString( m_Frame->GetUserUnits(), msg );
|
diffPair_dim.m_Gap = EDA_UNIT_UTILS::UI::ValueFromString( pcbIUScale, m_Frame->GetUserUnits(), msg );
|
||||||
|
|
||||||
msg = m_diffPairsGrid->GetCellValue( row, DP_VIA_GAP_COL );
|
msg = m_diffPairsGrid->GetCellValue( row, DP_VIA_GAP_COL );
|
||||||
|
|
||||||
if( !msg.IsEmpty() )
|
if( !msg.IsEmpty() )
|
||||||
diffPair_dim.m_ViaGap = ValueFromString( m_Frame->GetUserUnits(), msg );
|
diffPair_dim.m_ViaGap = EDA_UNIT_UTILS::UI::ValueFromString( pcbIUScale, m_Frame->GetUserUnits(), msg );
|
||||||
|
|
||||||
diffPairs.push_back( diffPair_dim );
|
diffPairs.push_back( diffPair_dim );
|
||||||
}
|
}
|
||||||
|
@ -401,7 +401,7 @@ void PANEL_SETUP_TRACKS_AND_VIAS::AppendTrackWidth( const int aWidth )
|
||||||
|
|
||||||
m_trackWidthsGrid->AppendRows( 1 );
|
m_trackWidthsGrid->AppendRows( 1 );
|
||||||
|
|
||||||
wxString val = StringFromValue( m_Frame->GetUserUnits(), aWidth, true );
|
wxString val = EDA_UNIT_UTILS::UI::StringFromValue( pcbIUScale, m_Frame->GetUserUnits(), aWidth, true );
|
||||||
m_trackWidthsGrid->SetCellValue( i, TR_WIDTH_COL, val );
|
m_trackWidthsGrid->SetCellValue( i, TR_WIDTH_COL, val );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -412,12 +412,12 @@ void PANEL_SETUP_TRACKS_AND_VIAS::AppendViaSize( const int aSize, const int aDri
|
||||||
|
|
||||||
m_viaSizesGrid->AppendRows( 1 );
|
m_viaSizesGrid->AppendRows( 1 );
|
||||||
|
|
||||||
wxString val = StringFromValue( m_Frame->GetUserUnits(), aSize, true );
|
wxString val = EDA_UNIT_UTILS::UI::StringFromValue( pcbIUScale, m_Frame->GetUserUnits(), aSize, true );
|
||||||
m_viaSizesGrid->SetCellValue( i, VIA_SIZE_COL, val );
|
m_viaSizesGrid->SetCellValue( i, VIA_SIZE_COL, val );
|
||||||
|
|
||||||
if( aDrill > 0 )
|
if( aDrill > 0 )
|
||||||
{
|
{
|
||||||
val = StringFromValue( m_Frame->GetUserUnits(), aDrill, true );
|
val = EDA_UNIT_UTILS::UI::StringFromValue( pcbIUScale, m_Frame->GetUserUnits(), aDrill, true );
|
||||||
m_viaSizesGrid->SetCellValue( i, VIA_DRILL_COL, val );
|
m_viaSizesGrid->SetCellValue( i, VIA_DRILL_COL, val );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -430,18 +430,18 @@ void PANEL_SETUP_TRACKS_AND_VIAS::AppendDiffPairs( const int aWidth, const int a
|
||||||
|
|
||||||
m_diffPairsGrid->AppendRows( 1 );
|
m_diffPairsGrid->AppendRows( 1 );
|
||||||
|
|
||||||
wxString val = StringFromValue( m_Frame->GetUserUnits(), aWidth, true );
|
wxString val = EDA_UNIT_UTILS::UI::StringFromValue( pcbIUScale, m_Frame->GetUserUnits(), aWidth, true );
|
||||||
m_diffPairsGrid->SetCellValue( i, DP_WIDTH_COL, val );
|
m_diffPairsGrid->SetCellValue( i, DP_WIDTH_COL, val );
|
||||||
|
|
||||||
if( aGap > 0 )
|
if( aGap > 0 )
|
||||||
{
|
{
|
||||||
val = StringFromValue( m_Frame->GetUserUnits(), aGap, true );
|
val = EDA_UNIT_UTILS::UI::StringFromValue( pcbIUScale, m_Frame->GetUserUnits(), aGap, true );
|
||||||
m_diffPairsGrid->SetCellValue( i, DP_GAP_COL, val );
|
m_diffPairsGrid->SetCellValue( i, DP_GAP_COL, val );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( aViaGap > 0 )
|
if( aViaGap > 0 )
|
||||||
{
|
{
|
||||||
val = StringFromValue( m_Frame->GetUserUnits(), aViaGap, true );
|
val = EDA_UNIT_UTILS::UI::StringFromValue( pcbIUScale, m_Frame->GetUserUnits(), aViaGap, true );
|
||||||
m_diffPairsGrid->SetCellValue( i, DP_VIA_GAP_COL, val );
|
m_diffPairsGrid->SetCellValue( i, DP_VIA_GAP_COL, val );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -607,7 +607,7 @@ void DRC_ENGINE::RunTests( EDA_UNITS aUnits, bool aReportAllTrackErrors, bool aT
|
||||||
|
|
||||||
#define REPORT( s ) { if( aReporter ) { aReporter->Report( s ); } }
|
#define REPORT( s ) { if( aReporter ) { aReporter->Report( s ); } }
|
||||||
#define UNITS aReporter ? aReporter->GetUnits() : EDA_UNITS::MILLIMETRES
|
#define UNITS aReporter ? aReporter->GetUnits() : EDA_UNITS::MILLIMETRES
|
||||||
#define REPORT_VALUE( v ) MessageTextFromValue( UNITS, v )
|
#define REPORT_VALUE( v ) EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, UNITS, v )
|
||||||
|
|
||||||
DRC_CONSTRAINT DRC_ENGINE::EvalZoneConnection( const BOARD_ITEM* a, const BOARD_ITEM* b,
|
DRC_CONSTRAINT DRC_ENGINE::EvalZoneConnection( const BOARD_ITEM* a, const BOARD_ITEM* b,
|
||||||
PCB_LAYER_ID aLayer, REPORTER* aReporter )
|
PCB_LAYER_ID aLayer, REPORTER* aReporter )
|
||||||
|
@ -910,7 +910,7 @@ DRC_CONSTRAINT DRC_ENGINE::EvalRules( DRC_CONSTRAINT_T aConstraintType, const BO
|
||||||
case MIN_RESOLVED_SPOKES_CONSTRAINT:
|
case MIN_RESOLVED_SPOKES_CONSTRAINT:
|
||||||
REPORT( wxString::Format( _( "Checking %s min spoke count: %s." ),
|
REPORT( wxString::Format( _( "Checking %s min spoke count: %s." ),
|
||||||
EscapeHTML( c->constraint.GetName() ),
|
EscapeHTML( c->constraint.GetName() ),
|
||||||
MessageTextFromValue( EDA_UNITS::UNSCALED, c->constraint.m_Value.Min() ) ) )
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, EDA_UNITS::UNSCALED, c->constraint.m_Value.Min() ) ) )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ZONE_CONNECTION_CONSTRAINT:
|
case ZONE_CONNECTION_CONSTRAINT:
|
||||||
|
@ -938,8 +938,10 @@ DRC_CONSTRAINT DRC_ENGINE::EvalRules( DRC_CONSTRAINT_T aConstraintType, const BO
|
||||||
|
|
||||||
if( implicit )
|
if( implicit )
|
||||||
{
|
{
|
||||||
min = StringFromValue( UNITS, c->constraint.m_Value.Min(), true );
|
min = EDA_UNIT_UTILS::UI::StringFromValue(
|
||||||
opt = StringFromValue( UNITS, c->constraint.m_Value.Opt(), true );
|
pcbIUScale, UNITS, c->constraint.m_Value.Min(), true );
|
||||||
|
opt = EDA_UNIT_UTILS::UI::StringFromValue(
|
||||||
|
pcbIUScale, UNITS, c->constraint.m_Value.Opt(), true );
|
||||||
|
|
||||||
switch( c->constraint.m_Type )
|
switch( c->constraint.m_Type )
|
||||||
{
|
{
|
||||||
|
@ -1035,13 +1037,16 @@ DRC_CONSTRAINT DRC_ENGINE::EvalRules( DRC_CONSTRAINT_T aConstraintType, const BO
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( c->constraint.m_Value.HasMin() )
|
if( c->constraint.m_Value.HasMin() )
|
||||||
min = StringFromValue( UNITS, c->constraint.m_Value.Min(), true );
|
min = EDA_UNIT_UTILS::UI::StringFromValue(
|
||||||
|
pcbIUScale, UNITS, c->constraint.m_Value.Min(), true );
|
||||||
|
|
||||||
if( c->constraint.m_Value.HasOpt() )
|
if( c->constraint.m_Value.HasOpt() )
|
||||||
opt = StringFromValue( UNITS, c->constraint.m_Value.Opt(), true );
|
opt = EDA_UNIT_UTILS::UI::StringFromValue(
|
||||||
|
pcbIUScale, UNITS, c->constraint.m_Value.Opt(), true );
|
||||||
|
|
||||||
if( c->constraint.m_Value.HasMax() )
|
if( c->constraint.m_Value.HasMax() )
|
||||||
max = StringFromValue( UNITS, c->constraint.m_Value.Max(), true );
|
max = EDA_UNIT_UTILS::UI::StringFromValue(
|
||||||
|
pcbIUScale, UNITS, c->constraint.m_Value.Max(), true );
|
||||||
|
|
||||||
REPORT( wxString::Format( _( "Checking %s: min %s; opt %s; max %s." ),
|
REPORT( wxString::Format( _( "Checking %s: min %s; opt %s; max %s." ),
|
||||||
EscapeHTML( c->constraint.GetName() ),
|
EscapeHTML( c->constraint.GetName() ),
|
||||||
|
|
|
@ -247,16 +247,16 @@ bool DRC_TEST_PROVIDER_ANNULAR_WIDTH::Run()
|
||||||
{
|
{
|
||||||
msg.Printf( _( "(%s min annular width %s; actual %s)" ),
|
msg.Printf( _( "(%s min annular width %s; actual %s)" ),
|
||||||
constraint.GetName(),
|
constraint.GetName(),
|
||||||
MessageTextFromValue( userUnits(), v_min ),
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), v_min ),
|
||||||
MessageTextFromValue( userUnits(), annularWidth ) );
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), annularWidth ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( fail_max )
|
if( fail_max )
|
||||||
{
|
{
|
||||||
msg.Printf( _( "(%s max annular width %s; actual %s)" ),
|
msg.Printf( _( "(%s max annular width %s; actual %s)" ),
|
||||||
constraint.GetName(),
|
constraint.GetName(),
|
||||||
MessageTextFromValue( userUnits(), v_max ),
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), v_max ),
|
||||||
MessageTextFromValue( userUnits(), annularWidth ) );
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), annularWidth ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS( " " ) + msg );
|
drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS( " " ) + msg );
|
||||||
|
|
|
@ -757,8 +757,8 @@ bool DRC_TEST_PROVIDER_CONNECTION_WIDTH::Run()
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
msg.Printf( _( "Minimum connection width %s; actual %s" ),
|
msg.Printf( _( "Minimum connection width %s; actual %s" ),
|
||||||
MessageTextFromValue( userUnits(), aMinWidth ),
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), aMinWidth ),
|
||||||
MessageTextFromValue( userUnits(), dist ) );
|
EDA_UNIT_UTILS::UI::MessageTextFromValue( pcbIUScale, userUnits(), dist ) );
|
||||||
|
|
||||||
drce->SetErrorMessage( msg + wxS( " " ) + layerDesc( aLayer ) );
|
drce->SetErrorMessage( msg + wxS( " " ) + layerDesc( aLayer ) );
|
||||||
drce->SetViolatingRule( c.GetParentRule() );
|
drce->SetViolatingRule( c.GetParentRule() );
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue