mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-07 23:25:34 +00:00
Switch to scoped enums
This commit is contained in:
parent
6b9f2ac91a
commit
11ff16be4e
3d-viewer/3d_cache/dialogs
bitmap2component
common
base_screen.cppbase_struct.cppbase_units.cppdialog_shim.cppeda_draw_frame.cppeda_size_ctrl.cpp
libeval
marker_base.cpppage_layout
plotters
preview_items
tool
widgets
cvpcb
eeschema
connection_graph.cppdialog_erc_listbox.h
dialogs
dialog_annotate.cppdialog_lib_edit_pin_table.cpppanel_eeschema_display_options.cpppanel_eeschema_settings.cpppanel_libedit_settings.cpp
drc_erc_item.cppeeschema_config.cpperc.cpperc.hfields_grid_table.hlib_arc.cpplib_arc.hlib_bezier.cpplib_bezier.hlib_circle.cpplib_circle.hlib_field.cpplib_field.hlib_item.cpplib_item.hlib_pin.cpplib_pin.hlib_polyline.cpplib_polyline.hlib_rectangle.cpplib_rectangle.hlib_text.cpplib_text.hlibedit
menubar.cppsch_base_frame.cppsch_bitmap.cppsch_bitmap.hsch_bus_entry.cppsch_bus_entry.hsch_component.cppsch_component.hsch_connection.cppsch_field.cppsch_field.hsch_junction.hsch_line.cppsch_line.hsch_marker.cppsch_marker.hsch_no_connect.hsch_pin.cppsch_pin.hsch_sheet.cppsch_sheet.hsch_sheet_pin.cppsch_text.cppsch_text.htoolbars_sch_editor.cppgerbview
dialogs
gerber_draw_item.cppgerber_draw_item.hgerber_file_image.cppgerbview_draw_panel_gal.cppgerbview_draw_panel_gal.hgerbview_frame.cppmenubar.cpptoolbars_gerber.cppinclude
base_screen.hbase_struct.hbase_units.hclass_draw_panel_gal.hcommon.hdialog_helpers.hdialog_shim.hdrc_item.heda_base_frame.h
libeval
marker_base.hplotter.hpreview_items
widgets
ws_draw_item.hpagelayout_editor
pcbnew
board_stackup_manager
class_board.cppclass_board.hclass_dimension.cppclass_dimension.hclass_drawsegment.cppclass_drawsegment.hclass_edge_mod.cppclass_edge_mod.hclass_marker_pcb.cppclass_marker_pcb.hclass_module.cppclass_module.hclass_pad.cppclass_pad.hclass_pcb_target.cppclass_pcb_target.hclass_pcb_text.cppclass_pcb_text.hclass_text_mod.cppclass_text_mod.hclass_track.cppclass_track.hclass_zone.cppclass_zone.hconvert_drawsegment_list_to_polygon.cppdialogs
dialog_board_statistics.cppdialog_copper_zones.cppdialog_create_array.cppdialog_drc.cppdialog_drclistbox.hdialog_export_idf.cppdialog_export_step.cppdialog_export_vrml.cppdialog_graphic_item_properties.cppdialog_keepout_area_properties.cppdialog_move_exact.cppdialog_non_copper_zones_properties.cppdialog_pad_basicshapes_properties.cppdialog_pad_properties.cppdialog_plot.cppdialog_pns_length_tuning_settings.cppdialog_position_relative.cppdialog_set_grid.cppdialog_text_properties.cpppanel_modedit_settings.cpppanel_pcbnew_settings.cpppanel_setup_netclasses.cpp
drc
drc_item.cppeagle_plugin.cppexporters
footprint_edit_frame.cppimport_gfx
kicad_plugin.cpplegacy_plugin.cppmenubar_footprint_editor.cppmenubar_pcb_editor.cppnetinfo.hnetinfo_item.cpppcad2kicadpcb_plugin
pcb_base_frame.cpppcb_draw_panel_gal.cpppcb_draw_panel_gal.hpcb_edit_frame.cpppcb_parser.cpppcb_plot_params.cpprouter
pns_dp_meander_placer.cpppns_dp_meander_placer.hpns_kicad_iface.cpppns_meander_placer.cpppns_meander_placer.hpns_meander_placer_base.hpns_meander_skew_placer.cpppns_meander_skew_placer.hrouter_tool.cpp
text_mod_grid_table.cpptext_mod_grid_table.htoolbars_footprint_editor.cpptoolbars_pcb_editor.cpptools
tracks_cleaner.cpptracks_cleaner.hzone_filler.cppzone_filler.hzone_settings.cppzone_settings.hqa
@ -131,7 +131,7 @@ void PANEL_PREV_3D::loadCommonSettings()
|
||||
*/
|
||||
static double rotationFromString( const wxString& aValue )
|
||||
{
|
||||
double rotation = DoubleValueFromString( DEGREES, aValue ) / 10.0;
|
||||
double rotation = DoubleValueFromString( EDA_UNITS::DEGREES, aValue ) / 10.0;
|
||||
|
||||
if( rotation > MAX_ROTATION )
|
||||
{
|
||||
@ -156,14 +156,14 @@ wxString PANEL_PREV_3D::formatScaleValue( double aValue )
|
||||
|
||||
wxString PANEL_PREV_3D::formatRotationValue( double aValue )
|
||||
{
|
||||
return wxString::Format( "%.2f %s", aValue, GetAbbreviatedUnitsLabel( DEGREES ) );
|
||||
return wxString::Format( "%.2f %s", aValue, GetAbbreviatedUnitsLabel( EDA_UNITS::DEGREES ) );
|
||||
}
|
||||
|
||||
|
||||
wxString PANEL_PREV_3D::formatOffsetValue( double aValue )
|
||||
{
|
||||
// Convert from internal units (mm) to user units
|
||||
if( m_userUnits == INCHES )
|
||||
if( m_userUnits == EDA_UNITS::INCHES )
|
||||
aValue /= 25.4f;
|
||||
|
||||
return wxString::Format( "%.4f %s", aValue, GetAbbreviatedUnitsLabel( m_userUnits ) );
|
||||
@ -218,9 +218,9 @@ void PANEL_PREV_3D::updateOrientation( wxCommandEvent &event )
|
||||
// Write settings back to the parent
|
||||
MODULE_3D_SETTINGS* modelInfo = &m_parentModelList->at( (unsigned) m_selected );
|
||||
|
||||
modelInfo->m_Scale.x = DoubleValueFromString( UNSCALED_UNITS, xscale->GetValue() );
|
||||
modelInfo->m_Scale.y = DoubleValueFromString( UNSCALED_UNITS, yscale->GetValue() );
|
||||
modelInfo->m_Scale.z = DoubleValueFromString( UNSCALED_UNITS, zscale->GetValue() );
|
||||
modelInfo->m_Scale.x = DoubleValueFromString( EDA_UNITS::UNSCALED, xscale->GetValue() );
|
||||
modelInfo->m_Scale.y = DoubleValueFromString( EDA_UNITS::UNSCALED, yscale->GetValue() );
|
||||
modelInfo->m_Scale.z = DoubleValueFromString( EDA_UNITS::UNSCALED, zscale->GetValue() );
|
||||
|
||||
modelInfo->m_Rotation.x = rotationFromString( xrot->GetValue() );
|
||||
modelInfo->m_Rotation.y = rotationFromString( yrot->GetValue() );
|
||||
@ -247,7 +247,7 @@ void PANEL_PREV_3D::doIncrementScale( wxSpinEvent& event, double aSign )
|
||||
else if( spinCtrl == m_spinZscale )
|
||||
textCtrl = zscale;
|
||||
|
||||
double curr_value = DoubleValueFromString( UNSCALED_UNITS, textCtrl->GetValue() );
|
||||
double curr_value = DoubleValueFromString( EDA_UNITS::UNSCALED, textCtrl->GetValue() );
|
||||
|
||||
curr_value += ( SCALE_INCREMENT * aSign );
|
||||
curr_value = std::max( 1/MAX_SCALE, curr_value );
|
||||
@ -267,7 +267,7 @@ void PANEL_PREV_3D::doIncrementRotation( wxSpinEvent& aEvent, double aSign )
|
||||
else if( spinCtrl == m_spinZrot )
|
||||
textCtrl = zrot;
|
||||
|
||||
double curr_value = DoubleValueFromString( DEGREES, textCtrl->GetValue() ) / 10.0;
|
||||
double curr_value = DoubleValueFromString( EDA_UNITS::DEGREES, textCtrl->GetValue() ) / 10.0;
|
||||
|
||||
curr_value += ( ROTATION_INCREMENT * aSign );
|
||||
curr_value = std::max( -MAX_ROTATION, curr_value );
|
||||
@ -290,7 +290,7 @@ void PANEL_PREV_3D::doIncrementOffset( wxSpinEvent& event, double aSign )
|
||||
|
||||
double step = OFFSET_INCREMENT_MM;
|
||||
|
||||
if( m_userUnits == INCHES )
|
||||
if( m_userUnits == EDA_UNITS::INCHES )
|
||||
step = OFFSET_INCREMENT_MIL/1000.0;
|
||||
|
||||
double curr_value = DoubleValueFromString( m_userUnits, textCtrl->GetValue() ) / IU_PER_MM;
|
||||
@ -315,7 +315,7 @@ void PANEL_PREV_3D::onMouseWheelScale( wxMouseEvent& event )
|
||||
if( event.GetWheelRotation() >= 0 )
|
||||
step = -step;
|
||||
|
||||
double curr_value = DoubleValueFromString( UNSCALED_UNITS, textCtrl->GetValue() );
|
||||
double curr_value = DoubleValueFromString( EDA_UNITS::UNSCALED, textCtrl->GetValue() );
|
||||
|
||||
curr_value += step;
|
||||
curr_value = std::max( 1/MAX_SCALE, curr_value );
|
||||
@ -337,7 +337,7 @@ void PANEL_PREV_3D::onMouseWheelRot( wxMouseEvent& event )
|
||||
if( event.GetWheelRotation() >= 0 )
|
||||
step = -step;
|
||||
|
||||
double curr_value = DoubleValueFromString( DEGREES, textCtrl->GetValue() ) / 10.0;
|
||||
double curr_value = DoubleValueFromString( EDA_UNITS::DEGREES, textCtrl->GetValue() ) / 10.0;
|
||||
|
||||
curr_value += step;
|
||||
curr_value = std::max( -MAX_ROTATION, curr_value );
|
||||
@ -356,7 +356,7 @@ void PANEL_PREV_3D::onMouseWheelOffset( wxMouseEvent& event )
|
||||
if( event.ShiftDown( ) )
|
||||
step = OFFSET_INCREMENT_MM_FINE;
|
||||
|
||||
if( m_userUnits == INCHES )
|
||||
if( m_userUnits == EDA_UNITS::INCHES )
|
||||
{
|
||||
step = OFFSET_INCREMENT_MIL/1000.0;
|
||||
if( event.ShiftDown( ) )
|
||||
|
@ -87,7 +87,7 @@ private:
|
||||
std::vector<MODULE_3D_SETTINGS>* m_parentModelList;
|
||||
int m_selected; /// Index into m_parentInfoList
|
||||
|
||||
EDA_UNITS_T m_userUnits;
|
||||
EDA_UNITS m_userUnits;
|
||||
|
||||
// Methods of the class
|
||||
private:
|
||||
|
@ -61,18 +61,18 @@ IMAGE_SIZE::IMAGE_SIZE()
|
||||
m_outputSize = 0.0;
|
||||
m_originalDPI = DEFAULT_DPI;
|
||||
m_originalSizePixels = 0;
|
||||
m_unit = MILLIMETRES;
|
||||
m_unit = EDA_UNITS::MILLIMETRES;
|
||||
}
|
||||
|
||||
|
||||
void IMAGE_SIZE::SetOutputSizeFromInitialImageSize()
|
||||
{
|
||||
// Set the m_outputSize value from the m_originalSizePixels and the selected unit
|
||||
if( m_unit == MILLIMETRES )
|
||||
if( m_unit == EDA_UNITS::MILLIMETRES )
|
||||
{
|
||||
m_outputSize = (double)GetOriginalSizePixels() / m_originalDPI * 25.4;
|
||||
}
|
||||
else if( m_unit == INCHES )
|
||||
else if( m_unit == EDA_UNITS::INCHES )
|
||||
{
|
||||
m_outputSize = (double)GetOriginalSizePixels() / m_originalDPI;
|
||||
}
|
||||
@ -88,11 +88,11 @@ int IMAGE_SIZE::GetOutputDPI()
|
||||
{
|
||||
int outputDPI;
|
||||
|
||||
if( m_unit == MILLIMETRES )
|
||||
if( m_unit == EDA_UNITS::MILLIMETRES )
|
||||
{
|
||||
outputDPI = GetOriginalSizePixels() / ( m_outputSize / 25.4 );
|
||||
}
|
||||
else if( m_unit == INCHES )
|
||||
else if( m_unit == EDA_UNITS::INCHES )
|
||||
{
|
||||
outputDPI = GetOriginalSizePixels() / m_outputSize;
|
||||
}
|
||||
@ -105,7 +105,7 @@ int IMAGE_SIZE::GetOutputDPI()
|
||||
}
|
||||
|
||||
|
||||
void IMAGE_SIZE::SetUnit( EDA_UNITS_T aUnit )
|
||||
void IMAGE_SIZE::SetUnit( EDA_UNITS aUnit )
|
||||
{
|
||||
// Set the unit used for m_outputSize, and convert the old m_outputSize value
|
||||
// to the value in new unit
|
||||
@ -115,11 +115,11 @@ void IMAGE_SIZE::SetUnit( EDA_UNITS_T aUnit )
|
||||
// Convert m_outputSize to mm:
|
||||
double size_mm;
|
||||
|
||||
if( m_unit == MILLIMETRES )
|
||||
if( m_unit == EDA_UNITS::MILLIMETRES )
|
||||
{
|
||||
size_mm = m_outputSize;
|
||||
}
|
||||
else if( m_unit == INCHES )
|
||||
else if( m_unit == EDA_UNITS::INCHES )
|
||||
{
|
||||
size_mm = m_outputSize * 25.4;
|
||||
}
|
||||
@ -134,11 +134,11 @@ void IMAGE_SIZE::SetUnit( EDA_UNITS_T aUnit )
|
||||
}
|
||||
|
||||
// Convert m_outputSize to new value:
|
||||
if( aUnit == MILLIMETRES )
|
||||
if( aUnit == EDA_UNITS::MILLIMETRES )
|
||||
{
|
||||
m_outputSize = size_mm;
|
||||
}
|
||||
else if( aUnit == INCHES )
|
||||
else if( aUnit == EDA_UNITS::INCHES )
|
||||
{
|
||||
m_outputSize = size_mm / 25.4;
|
||||
}
|
||||
@ -471,11 +471,11 @@ wxString BM2CMP_FRAME::FormatOutputSize( double aSize )
|
||||
{
|
||||
wxString text;
|
||||
|
||||
if( getUnitFromSelection() == MILLIMETRES )
|
||||
if( getUnitFromSelection() == EDA_UNITS::MILLIMETRES )
|
||||
{
|
||||
text.Printf( "%.1f", aSize );
|
||||
}
|
||||
else if( getUnitFromSelection() == INCHES )
|
||||
else if( getUnitFromSelection() == EDA_UNITS::INCHES )
|
||||
{
|
||||
text.Printf( "%.2f", aSize );
|
||||
}
|
||||
@ -506,23 +506,23 @@ void BM2CMP_FRAME::updateImageInfo()
|
||||
}
|
||||
|
||||
|
||||
EDA_UNITS_T BM2CMP_FRAME::getUnitFromSelection()
|
||||
EDA_UNITS BM2CMP_FRAME::getUnitFromSelection()
|
||||
{
|
||||
// return the EDA_UNITS_T from the m_PixelUnit choice
|
||||
// return the EDA_UNITS from the m_PixelUnit choice
|
||||
switch( m_PixelUnit->GetSelection() )
|
||||
{
|
||||
case 1:
|
||||
return INCHES;
|
||||
return EDA_UNITS::INCHES;
|
||||
|
||||
case 2:
|
||||
return UNSCALED_UNITS;
|
||||
return EDA_UNITS::UNSCALED;
|
||||
|
||||
case 0:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return MILLIMETRES;
|
||||
return EDA_UNITS::MILLIMETRES;
|
||||
}
|
||||
|
||||
|
||||
@ -536,7 +536,7 @@ void BM2CMP_FRAME::OnSizeChangeX( wxCommandEvent& event )
|
||||
{
|
||||
double calculatedY = new_size / m_AspectRatio;
|
||||
|
||||
if( getUnitFromSelection() == UNSCALED_UNITS )
|
||||
if( getUnitFromSelection() == EDA_UNITS::UNSCALED )
|
||||
{
|
||||
// for units in DPI, keeping aspect ratio cannot use m_AspectRatioLocked.
|
||||
// just rescale the other dpi
|
||||
@ -565,7 +565,7 @@ void BM2CMP_FRAME::OnSizeChangeY( wxCommandEvent& event )
|
||||
{
|
||||
double calculatedX = new_size * m_AspectRatio;
|
||||
|
||||
if( getUnitFromSelection() == UNSCALED_UNITS )
|
||||
if( getUnitFromSelection() == EDA_UNITS::UNSCALED )
|
||||
{
|
||||
// for units in DPI, keeping aspect ratio cannot use m_AspectRatioLocked.
|
||||
// just rescale the other dpi
|
||||
|
@ -26,8 +26,8 @@
|
||||
#include "bitmap2component.h"
|
||||
|
||||
#include "bitmap2cmp_gui_base.h"
|
||||
#include <common.h> // for EDA_UNITS
|
||||
#include <potracelib.h>
|
||||
#include <common.h> // for EDA_UNITS_T
|
||||
|
||||
|
||||
class IMAGE_SIZE
|
||||
@ -37,7 +37,7 @@ public:
|
||||
|
||||
// Set the unit used for m_outputSize, and convert the old m_outputSize value
|
||||
// to the value in new unit
|
||||
void SetUnit( EDA_UNITS_T aUnit );
|
||||
void SetUnit( EDA_UNITS aUnit );
|
||||
|
||||
// Accessors:
|
||||
void SetOriginalDPI( int aDPI )
|
||||
@ -55,7 +55,7 @@ public:
|
||||
return m_outputSize;
|
||||
}
|
||||
|
||||
void SetOutputSize( double aSize, EDA_UNITS_T aUnit )
|
||||
void SetOutputSize( double aSize, EDA_UNITS aUnit )
|
||||
{
|
||||
m_unit = aUnit;
|
||||
m_outputSize = aSize;
|
||||
@ -75,8 +75,8 @@ public:
|
||||
int GetOutputDPI();
|
||||
|
||||
private:
|
||||
EDA_UNITS_T m_unit; // The units for m_outputSize (mm, inch, dpi)
|
||||
double m_outputSize; // The size in m_unit of the output image, depending on
|
||||
EDA_UNITS m_unit; // The units for m_outputSize (mm, inch, dpi)
|
||||
double m_outputSize; // The size in m_unit of the output image, depending on
|
||||
// the user settings. Set to the initial image size
|
||||
int m_originalDPI; // The image DPI if specified in file, or 0 if unknown
|
||||
int m_originalSizePixels; // The original image size read from file, in pixels
|
||||
@ -101,8 +101,8 @@ private:
|
||||
void OnExportToFile( wxCommandEvent& event ) override;
|
||||
void OnExportToClipboard( wxCommandEvent& event ) override;
|
||||
|
||||
///> @return the EDA_UNITS_T from the m_PixelUnit choice
|
||||
EDA_UNITS_T getUnitFromSelection();
|
||||
///> @return the EDA_UNITS from the m_PixelUnit choice
|
||||
EDA_UNITS getUnitFromSelection();
|
||||
|
||||
// return a string giving the output size, according to the selected unit
|
||||
wxString FormatOutputSize( double aSize );
|
||||
|
@ -112,8 +112,8 @@ int BASE_SCREEN::BuildGridsChoiceList( wxArrayString& aGridsList, bool aMmFirst)
|
||||
for( size_t i = 0; i < GetGridCount(); i++ )
|
||||
{
|
||||
const GRID_TYPE& grid = m_grids[i];
|
||||
double gridValueMils = To_User_Unit( INCHES, grid.m_Size.x ) * 1000;
|
||||
double gridValue_mm = To_User_Unit( MILLIMETRES, grid.m_Size.x );
|
||||
double gridValueMils = To_User_Unit( EDA_UNITS::INCHES, grid.m_Size.x ) * 1000;
|
||||
double gridValue_mm = To_User_Unit( EDA_UNITS::MILLIMETRES, grid.m_Size.x );
|
||||
|
||||
if( grid.m_CmdId == ID_POPUP_GRID_USER )
|
||||
{
|
||||
@ -220,7 +220,7 @@ void BASE_SCREEN::AddGrid( const GRID_TYPE& aGrid )
|
||||
}
|
||||
|
||||
|
||||
void BASE_SCREEN::AddGrid( const wxRealPoint& size, EDA_UNITS_T aUnit, int id )
|
||||
void BASE_SCREEN::AddGrid( const wxRealPoint& size, EDA_UNITS aUnit, int id )
|
||||
{
|
||||
wxRealPoint new_size;
|
||||
GRID_TYPE new_grid;
|
||||
|
@ -144,7 +144,7 @@ SEARCH_RESULT EDA_ITEM::Visit( INSPECTOR inspector, void* testData, const KICAD_
|
||||
}
|
||||
|
||||
|
||||
wxString EDA_ITEM::GetSelectMenuText( EDA_UNITS_T aUnits ) const
|
||||
wxString EDA_ITEM::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||
{
|
||||
wxFAIL_MSG( wxT( "GetSelectMenuText() was not overridden for schematic item type " ) +
|
||||
GetClass() );
|
||||
|
@ -90,20 +90,20 @@ std::string Double2Str( double aValue )
|
||||
}
|
||||
|
||||
|
||||
double To_User_Unit( EDA_UNITS_T aUnit, double aValue, bool aUseMils )
|
||||
double To_User_Unit( EDA_UNITS aUnit, double aValue, bool aUseMils )
|
||||
{
|
||||
switch( aUnit )
|
||||
{
|
||||
case MILLIMETRES:
|
||||
case EDA_UNITS::MILLIMETRES:
|
||||
return IU_TO_MM( aValue );
|
||||
|
||||
case INCHES:
|
||||
case EDA_UNITS::INCHES:
|
||||
if( aUseMils )
|
||||
return IU_TO_MILS( aValue );
|
||||
else
|
||||
return IU_TO_IN( aValue );
|
||||
|
||||
case DEGREES:
|
||||
case EDA_UNITS::DEGREES:
|
||||
return aValue / 10.0f;
|
||||
|
||||
default:
|
||||
@ -122,27 +122,27 @@ double To_User_Unit( EDA_UNITS_T aUnit, double aValue, bool aUseMils )
|
||||
*/
|
||||
|
||||
// A lower-precision (for readability) version of StringFromValue()
|
||||
wxString MessageTextFromValue( EDA_UNITS_T aUnits, int aValue, bool aUseMils )
|
||||
wxString MessageTextFromValue( EDA_UNITS aUnits, int aValue, bool aUseMils )
|
||||
{
|
||||
return MessageTextFromValue( aUnits, double( aValue ), aUseMils );
|
||||
}
|
||||
|
||||
|
||||
// A lower-precision (for readability) version of StringFromValue()
|
||||
wxString MessageTextFromValue( EDA_UNITS_T aUnits, long long int aValue, bool aUseMils )
|
||||
wxString MessageTextFromValue( EDA_UNITS aUnits, long long int aValue, bool aUseMils )
|
||||
{
|
||||
return MessageTextFromValue( aUnits, double( aValue ), aUseMils );
|
||||
}
|
||||
|
||||
|
||||
// A lower-precision (for readability) version of StringFromValue()
|
||||
wxString MessageTextFromValue( EDA_UNITS_T aUnits, double aValue, bool aUseMils )
|
||||
wxString MessageTextFromValue( EDA_UNITS aUnits, double aValue, bool aUseMils )
|
||||
{
|
||||
wxString text;
|
||||
const wxChar* format;
|
||||
double value = To_User_Unit( aUnits, aValue, aUseMils );
|
||||
|
||||
if( aUnits == INCHES )
|
||||
if( aUnits == EDA_UNITS::INCHES )
|
||||
{
|
||||
if( aUseMils )
|
||||
{
|
||||
@ -214,7 +214,7 @@ void StripTrailingZeros( wxString& aStringValue, unsigned aTrailingZeroAllowed )
|
||||
* otherwise the actual value is rounded when read from dialog and converted
|
||||
* in internal units, and therefore modified.
|
||||
*/
|
||||
wxString StringFromValue( EDA_UNITS_T aUnits, double aValue, bool aAddUnitSymbol, bool aUseMils )
|
||||
wxString StringFromValue( EDA_UNITS aUnits, double aValue, bool aAddUnitSymbol, bool aUseMils )
|
||||
{
|
||||
double value_to_print = To_User_Unit( aUnits, aValue, aUseMils );
|
||||
|
||||
@ -244,7 +244,7 @@ wxString StringFromValue( EDA_UNITS_T aUnits, double aValue, bool aAddUnitSymbol
|
||||
}
|
||||
else
|
||||
{
|
||||
if( aUnits == INCHES && aUseMils )
|
||||
if( aUnits == EDA_UNITS::INCHES && aUseMils )
|
||||
len = sprintf( buf, "%.7g", value_to_print );
|
||||
else
|
||||
len = sprintf( buf, "%.10g", value_to_print );
|
||||
@ -258,26 +258,26 @@ wxString StringFromValue( EDA_UNITS_T aUnits, double aValue, bool aAddUnitSymbol
|
||||
{
|
||||
switch( aUnits )
|
||||
{
|
||||
case INCHES:
|
||||
case EDA_UNITS::INCHES:
|
||||
if( aUseMils )
|
||||
stringValue += wxT( " mils" );
|
||||
else
|
||||
stringValue += wxT( " in" );
|
||||
break;
|
||||
|
||||
case MILLIMETRES:
|
||||
case EDA_UNITS::MILLIMETRES:
|
||||
stringValue += wxT( " mm" );
|
||||
break;
|
||||
|
||||
case DEGREES:
|
||||
case EDA_UNITS::DEGREES:
|
||||
stringValue += wxT( " deg" );
|
||||
break;
|
||||
|
||||
case PERCENT:
|
||||
case EDA_UNITS::PERCENT:
|
||||
stringValue += wxT( "%" );
|
||||
break;
|
||||
|
||||
case UNSCALED_UNITS:
|
||||
case EDA_UNITS::UNSCALED:
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -286,32 +286,32 @@ wxString StringFromValue( EDA_UNITS_T aUnits, double aValue, bool aAddUnitSymbol
|
||||
}
|
||||
|
||||
|
||||
double From_User_Unit( EDA_UNITS_T aUnits, double aValue, bool aUseMils )
|
||||
double From_User_Unit( EDA_UNITS aUnits, double aValue, bool aUseMils )
|
||||
{
|
||||
switch( aUnits )
|
||||
{
|
||||
case MILLIMETRES:
|
||||
case EDA_UNITS::MILLIMETRES:
|
||||
return MM_TO_IU( aValue );
|
||||
|
||||
case INCHES:
|
||||
case EDA_UNITS::INCHES:
|
||||
if( aUseMils )
|
||||
return MILS_TO_IU( aValue );
|
||||
else
|
||||
return IN_TO_IU( aValue );
|
||||
|
||||
case DEGREES:
|
||||
case EDA_UNITS::DEGREES:
|
||||
// Convert to "decidegrees"
|
||||
return aValue * 10;
|
||||
|
||||
default:
|
||||
case UNSCALED_UNITS:
|
||||
case PERCENT:
|
||||
case EDA_UNITS::UNSCALED:
|
||||
case EDA_UNITS::PERCENT:
|
||||
return aValue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
double DoubleValueFromString( EDA_UNITS_T aUnits, const wxString& aTextValue, bool aUseMils )
|
||||
double DoubleValueFromString( EDA_UNITS aUnits, const wxString& aTextValue, bool aUseMils )
|
||||
{
|
||||
double value;
|
||||
double dtmp = 0;
|
||||
@ -348,30 +348,30 @@ double DoubleValueFromString( EDA_UNITS_T aUnits, const wxString& aTextValue, bo
|
||||
// Check the optional unit designator (2 ch significant)
|
||||
wxString unit( buf.Mid( brk_point ).Strip( wxString::leading ).Left( 2 ).Lower() );
|
||||
|
||||
if( aUnits == INCHES || aUnits == MILLIMETRES )
|
||||
if( aUnits == EDA_UNITS::INCHES || aUnits == EDA_UNITS::MILLIMETRES )
|
||||
{
|
||||
if( unit == wxT( "in" ) || unit == wxT( "\"" ) )
|
||||
{
|
||||
aUnits = INCHES;
|
||||
aUnits = EDA_UNITS::INCHES;
|
||||
aUseMils = false;
|
||||
}
|
||||
else if( unit == wxT( "mm" ) )
|
||||
{
|
||||
aUnits = MILLIMETRES;
|
||||
aUnits = EDA_UNITS::MILLIMETRES;
|
||||
}
|
||||
else if( unit == wxT( "mi" ) || unit == wxT( "th" ) ) // "mils" or "thou"
|
||||
{
|
||||
aUnits = INCHES;
|
||||
aUnits = EDA_UNITS::INCHES;
|
||||
aUseMils = true;
|
||||
}
|
||||
else if( unit == "oz" ) // 1 oz = 1.37 mils
|
||||
{
|
||||
aUnits = INCHES;
|
||||
aUnits = EDA_UNITS::INCHES;
|
||||
aUseMils = true;
|
||||
dtmp *= 1.37;
|
||||
}
|
||||
}
|
||||
else if( aUnits == DEGREES )
|
||||
else if( aUnits == EDA_UNITS::DEGREES )
|
||||
{
|
||||
if( unit == wxT( "ra" ) ) // Radians
|
||||
{
|
||||
@ -385,7 +385,7 @@ double DoubleValueFromString( EDA_UNITS_T aUnits, const wxString& aTextValue, bo
|
||||
}
|
||||
|
||||
|
||||
void FetchUnitsFromString( const wxString& aTextValue, EDA_UNITS_T& aUnits, bool& aUseMils )
|
||||
void FetchUnitsFromString( const wxString& aTextValue, EDA_UNITS& aUnits, bool& aUseMils )
|
||||
{
|
||||
wxString buf( aTextValue.Strip( wxString::both ) );
|
||||
unsigned brk_point = 0;
|
||||
@ -405,26 +405,26 @@ void FetchUnitsFromString( const wxString& aTextValue, EDA_UNITS_T& aUnits, bool
|
||||
|
||||
if( unit == wxT( "in" ) || unit == wxT( "\"" ) )
|
||||
{
|
||||
aUnits = INCHES;
|
||||
aUnits = EDA_UNITS::INCHES;
|
||||
aUseMils = false;
|
||||
}
|
||||
else if( unit == wxT( "mm" ) )
|
||||
{
|
||||
aUnits = MILLIMETRES;
|
||||
aUnits = EDA_UNITS::MILLIMETRES;
|
||||
}
|
||||
else if( unit == wxT( "mi" ) || unit == wxT( "th" ) ) // "mils" or "thou"
|
||||
{
|
||||
aUnits = INCHES;
|
||||
aUnits = EDA_UNITS::INCHES;
|
||||
aUseMils = true;
|
||||
}
|
||||
else if( unit == wxT( "de" ) || unit == wxT( "ra" ) ) // "deg" or "rad"
|
||||
{
|
||||
aUnits = DEGREES;
|
||||
aUnits = EDA_UNITS::DEGREES;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
long long int ValueFromString( EDA_UNITS_T aUnits, const wxString& aTextValue, bool aUseMils )
|
||||
long long int ValueFromString( EDA_UNITS aUnits, const wxString& aTextValue, bool aUseMils )
|
||||
{
|
||||
double value = DoubleValueFromString( aUnits, aTextValue, aUseMils );
|
||||
return KiROUND<double, long long int>( value );
|
||||
@ -447,26 +447,26 @@ wxString AngleToStringDegrees( double aAngle )
|
||||
}
|
||||
|
||||
|
||||
wxString GetAbbreviatedUnitsLabel( EDA_UNITS_T aUnit, bool aUseMils )
|
||||
wxString GetAbbreviatedUnitsLabel( EDA_UNITS aUnit, bool aUseMils )
|
||||
{
|
||||
switch( aUnit )
|
||||
{
|
||||
case INCHES:
|
||||
case EDA_UNITS::INCHES:
|
||||
if( aUseMils )
|
||||
return _( "mils" );
|
||||
else
|
||||
return _( "in" );
|
||||
|
||||
case MILLIMETRES:
|
||||
case EDA_UNITS::MILLIMETRES:
|
||||
return _( "mm" );
|
||||
|
||||
case PERCENT:
|
||||
case EDA_UNITS::PERCENT:
|
||||
return _( "%" );
|
||||
|
||||
case UNSCALED_UNITS:
|
||||
case EDA_UNITS::UNSCALED:
|
||||
return wxEmptyString;
|
||||
|
||||
case DEGREES:
|
||||
case EDA_UNITS::DEGREES:
|
||||
return _( "deg" );
|
||||
|
||||
default:
|
||||
|
@ -66,16 +66,15 @@ END_EVENT_TABLE()
|
||||
|
||||
|
||||
DIALOG_SHIM::DIALOG_SHIM( wxWindow* aParent, wxWindowID id, const wxString& title,
|
||||
const wxPoint& pos, const wxSize& size, long style,
|
||||
const wxString& name ) :
|
||||
wxDialog( aParent, id, title, pos, size, style, name ),
|
||||
KIWAY_HOLDER( nullptr, KIWAY_HOLDER::DIALOG ),
|
||||
m_units( MILLIMETRES ),
|
||||
m_firstPaintEvent( true ),
|
||||
m_initialFocusTarget( nullptr ),
|
||||
m_qmodal_loop( nullptr ),
|
||||
m_qmodal_showing( false ),
|
||||
m_qmodal_parent_disabler( nullptr )
|
||||
const wxPoint& pos, const wxSize& size, long style, const wxString& name )
|
||||
: wxDialog( aParent, id, title, pos, size, style, name ),
|
||||
KIWAY_HOLDER( nullptr, KIWAY_HOLDER::DIALOG ),
|
||||
m_units( EDA_UNITS::MILLIMETRES ),
|
||||
m_firstPaintEvent( true ),
|
||||
m_initialFocusTarget( nullptr ),
|
||||
m_qmodal_loop( nullptr ),
|
||||
m_qmodal_showing( false ),
|
||||
m_qmodal_parent_disabler( nullptr )
|
||||
{
|
||||
KIWAY_HOLDER* kiwayHolder = nullptr;
|
||||
|
||||
|
@ -111,7 +111,7 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
|
||||
// BLACK for Pcbnew, BLACK or WHITE for eeschema
|
||||
m_MsgFrameHeight = EDA_MSG_PANEL::GetRequiredHeight();
|
||||
m_zoomLevelCoeff = 1.0;
|
||||
m_userUnits = MILLIMETRES;
|
||||
m_userUnits = EDA_UNITS::MILLIMETRES;
|
||||
m_PolarCoords = false;
|
||||
m_findReplaceData = new wxFindReplaceData( wxFR_DOWN );
|
||||
|
||||
@ -389,11 +389,11 @@ void EDA_DRAW_FRAME::DisplayGridMsg()
|
||||
|
||||
switch( m_userUnits )
|
||||
{
|
||||
case INCHES:
|
||||
case EDA_UNITS::INCHES:
|
||||
gridformatter = "grid %.3f";
|
||||
break;
|
||||
|
||||
case MILLIMETRES:
|
||||
case EDA_UNITS::MILLIMETRES:
|
||||
gridformatter = "grid %.4f";
|
||||
break;
|
||||
|
||||
@ -416,8 +416,12 @@ void EDA_DRAW_FRAME::DisplayUnitsMsg()
|
||||
|
||||
switch( m_userUnits )
|
||||
{
|
||||
case INCHES: msg = _( "Inches" ); break;
|
||||
case MILLIMETRES: msg = _( "mm" ); break;
|
||||
case EDA_UNITS::INCHES:
|
||||
msg = _( "Inches" );
|
||||
break;
|
||||
case EDA_UNITS::MILLIMETRES:
|
||||
msg = _( "mm" );
|
||||
break;
|
||||
default: msg = _( "Units" ); break;
|
||||
}
|
||||
|
||||
@ -461,12 +465,12 @@ void EDA_DRAW_FRAME::LoadSettings( wxConfigBase* aCfg )
|
||||
wxConfigBase* cmnCfg = Pgm().CommonSettings();
|
||||
|
||||
// Read units used in dialogs and toolbars
|
||||
EDA_UNITS_T unitsTmp;
|
||||
EDA_UNITS unitsTmp;
|
||||
|
||||
if( aCfg->Read( baseCfgName + UserUnitsEntryKeyword, (int*) &unitsTmp ) )
|
||||
SetUserUnits( unitsTmp );
|
||||
else
|
||||
SetUserUnits( MILLIMETRES );
|
||||
SetUserUnits( EDA_UNITS::MILLIMETRES );
|
||||
|
||||
// Read show/hide grid entry
|
||||
bool btmp;
|
||||
|
@ -32,7 +32,7 @@
|
||||
/* Class to display and edit a coordinated INCHES or MM */
|
||||
/********************************************************/
|
||||
EDA_POSITION_CTRL::EDA_POSITION_CTRL( wxWindow* parent, const wxString& title, const wxPoint& aPos,
|
||||
EDA_UNITS_T user_unit, wxBoxSizer* BoxSizer )
|
||||
EDA_UNITS user_unit, wxBoxSizer* BoxSizer )
|
||||
{
|
||||
m_UserUnit = user_unit;
|
||||
|
||||
@ -88,8 +88,8 @@ void EDA_POSITION_CTRL::SetValue( int x_value, int y_value )
|
||||
/* EDA_SIZE_CTRL */
|
||||
/*******************/
|
||||
EDA_SIZE_CTRL::EDA_SIZE_CTRL( wxWindow* parent, const wxString& title, const wxSize& aSize,
|
||||
EDA_UNITS_T aUnit, wxBoxSizer* aBoxSizer ) :
|
||||
EDA_POSITION_CTRL( parent, title, wxPoint( aSize.x, aSize.y ), aUnit, aBoxSizer )
|
||||
EDA_UNITS aUnit, wxBoxSizer* aBoxSizer )
|
||||
: EDA_POSITION_CTRL( parent, title, wxPoint( aSize.x, aSize.y ), aUnit, aBoxSizer )
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ namespace numEval
|
||||
} /* namespace numEval */
|
||||
|
||||
|
||||
NUMERIC_EVALUATOR::NUMERIC_EVALUATOR( EDA_UNITS_T aUnits, bool aUseMils )
|
||||
NUMERIC_EVALUATOR::NUMERIC_EVALUATOR( EDA_UNITS aUnits, bool aUseMils )
|
||||
{
|
||||
struct lconv* lc = localeconv();
|
||||
m_localeDecimalSeparator = *lc->decimal_point;
|
||||
@ -55,13 +55,14 @@ NUMERIC_EVALUATOR::NUMERIC_EVALUATOR( EDA_UNITS_T aUnits, bool aUseMils )
|
||||
|
||||
switch( aUnits )
|
||||
{
|
||||
case INCHES:
|
||||
case EDA_UNITS::INCHES:
|
||||
if( aUseMils )
|
||||
m_defaultUnits = Unit::Mil;
|
||||
else
|
||||
m_defaultUnits = Unit::Inch;
|
||||
break;
|
||||
case MILLIMETRES:m_defaultUnits = Unit::Metric;
|
||||
case EDA_UNITS::MILLIMETRES:
|
||||
m_defaultUnits = Unit::Metric;
|
||||
break;
|
||||
default:m_defaultUnits = Unit::Metric;
|
||||
break;
|
||||
|
@ -103,9 +103,9 @@ MARKER_BASE::MARKER_BASE( int aScalingFactor )
|
||||
}
|
||||
|
||||
|
||||
MARKER_BASE::MARKER_BASE( EDA_UNITS_T aUnits, int aErrorCode, const wxPoint& aMarkerPos,
|
||||
EDA_ITEM* aItem, const wxPoint& aPos,
|
||||
EDA_ITEM* bItem, const wxPoint& bPos, int aScalingFactor )
|
||||
MARKER_BASE::MARKER_BASE( EDA_UNITS aUnits, int aErrorCode, const wxPoint& aMarkerPos,
|
||||
EDA_ITEM* aItem, const wxPoint& aPos, EDA_ITEM* bItem, const wxPoint& bPos,
|
||||
int aScalingFactor )
|
||||
{
|
||||
m_ScalingFactor = aScalingFactor;
|
||||
init();
|
||||
@ -140,9 +140,8 @@ MARKER_BASE::~MARKER_BASE()
|
||||
}
|
||||
|
||||
|
||||
void MARKER_BASE::SetData( EDA_UNITS_T aUnits, int aErrorCode, const wxPoint& aMarkerPos,
|
||||
EDA_ITEM* aItem, const wxPoint& aPos,
|
||||
EDA_ITEM* bItem, const wxPoint& bPos )
|
||||
void MARKER_BASE::SetData( EDA_UNITS aUnits, int aErrorCode, const wxPoint& aMarkerPos,
|
||||
EDA_ITEM* aItem, const wxPoint& aPos, EDA_ITEM* bItem, const wxPoint& bPos )
|
||||
{
|
||||
m_Pos = aMarkerPos;
|
||||
m_drc.SetData( aUnits, aErrorCode, aItem, aPos, bItem, bPos );
|
||||
|
@ -95,7 +95,7 @@ bool WS_DRAW_ITEM_BASE::HitTest( const EDA_RECT& aRect, bool aContained, int aAc
|
||||
}
|
||||
|
||||
|
||||
void WS_DRAW_ITEM_BASE::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList )
|
||||
void WS_DRAW_ITEM_BASE::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList )
|
||||
{
|
||||
wxString msg;
|
||||
WS_DATA_ITEM* dataItem = GetPeer();
|
||||
@ -137,10 +137,10 @@ void WS_DRAW_ITEM_BASE::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aL
|
||||
|
||||
aList.push_back( MSG_PANEL_ITEM( _( "First Page Option" ), msg, BROWN ) );
|
||||
|
||||
msg = MessageTextFromValue( UNSCALED_UNITS, dataItem->m_RepeatCount );
|
||||
msg = MessageTextFromValue( EDA_UNITS::UNSCALED, dataItem->m_RepeatCount );
|
||||
aList.push_back( MSG_PANEL_ITEM( _( "Repeat Count" ), msg, BLUE ) );
|
||||
|
||||
msg = MessageTextFromValue( UNSCALED_UNITS, dataItem->m_IncrementLabel );
|
||||
msg = MessageTextFromValue( EDA_UNITS::UNSCALED, dataItem->m_IncrementLabel );
|
||||
aList.push_back( MSG_PANEL_ITEM( _( "Repeat Label Increment" ), msg, DARKGRAY ) );
|
||||
|
||||
msg.Printf( wxT( "(%s, %s)" ),
|
||||
@ -179,7 +179,7 @@ bool WS_DRAW_ITEM_TEXT::HitTest( const EDA_RECT& aRect, bool aContains, int aAcc
|
||||
}
|
||||
|
||||
|
||||
wxString WS_DRAW_ITEM_TEXT::GetSelectMenuText( EDA_UNITS_T aUnits ) const
|
||||
wxString WS_DRAW_ITEM_TEXT::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||
{
|
||||
return wxString::Format( _( "Text %s at (%s, %s)" ),
|
||||
GetShownText(),
|
||||
@ -279,7 +279,7 @@ bool WS_DRAW_ITEM_POLYPOLYGONS::HitTest( const EDA_RECT& aRect, bool aContained,
|
||||
}
|
||||
|
||||
|
||||
wxString WS_DRAW_ITEM_POLYPOLYGONS::GetSelectMenuText( EDA_UNITS_T aUnits ) const
|
||||
wxString WS_DRAW_ITEM_POLYPOLYGONS::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||
{
|
||||
return wxString::Format( _( "Imported shape at (%s, %s)" ),
|
||||
MessageTextFromValue( aUnits, GetPosition().x ),
|
||||
@ -336,7 +336,7 @@ bool WS_DRAW_ITEM_RECT::HitTest( const wxPoint& aPosition, int aAccuracy ) const
|
||||
}
|
||||
|
||||
|
||||
wxString WS_DRAW_ITEM_RECT::GetSelectMenuText( EDA_UNITS_T aUnits ) const
|
||||
wxString WS_DRAW_ITEM_RECT::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||
{
|
||||
return wxString::Format( _( "Rectangle from (%s, %s) to (%s, %s)" ),
|
||||
MessageTextFromValue( aUnits, GetStart().x ),
|
||||
@ -367,7 +367,7 @@ bool WS_DRAW_ITEM_LINE::HitTest( const wxPoint& aPosition, int aAccuracy ) const
|
||||
}
|
||||
|
||||
|
||||
wxString WS_DRAW_ITEM_LINE::GetSelectMenuText( EDA_UNITS_T aUnits ) const
|
||||
wxString WS_DRAW_ITEM_LINE::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||
{
|
||||
return wxString::Format( _( "Line from (%s, %s) to (%s, %s)" ),
|
||||
MessageTextFromValue( aUnits, GetStart().x ),
|
||||
@ -420,7 +420,7 @@ bool WS_DRAW_ITEM_BITMAP::HitTest( const EDA_RECT& aRect, bool aContains, int aA
|
||||
}
|
||||
|
||||
|
||||
wxString WS_DRAW_ITEM_BITMAP::GetSelectMenuText( EDA_UNITS_T aUnits ) const
|
||||
wxString WS_DRAW_ITEM_BITMAP::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||
{
|
||||
return wxString::Format( _( "Image at (%s, %s)" ),
|
||||
MessageTextFromValue( aUnits, GetPosition().x ),
|
||||
@ -428,7 +428,7 @@ wxString WS_DRAW_ITEM_BITMAP::GetSelectMenuText( EDA_UNITS_T aUnits ) const
|
||||
}
|
||||
|
||||
|
||||
wxString WS_DRAW_ITEM_PAGE::GetSelectMenuText( EDA_UNITS_T aUnits ) const
|
||||
wxString WS_DRAW_ITEM_PAGE::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||
{
|
||||
wxString txt( "Page limits" );
|
||||
return txt;
|
||||
|
@ -128,12 +128,12 @@ void DXF_PLOTTER::SetUnits( DXF_UNITS aUnit )
|
||||
|
||||
switch( aUnit )
|
||||
{
|
||||
case DXF_UNIT_MILLIMETERS:
|
||||
case DXF_UNITS::MILLIMETERS:
|
||||
m_unitScalingFactor = 0.00254;
|
||||
m_measurementDirective = 1;
|
||||
break;
|
||||
|
||||
case DXF_UNIT_INCHES:
|
||||
case DXF_UNITS::INCHES:
|
||||
default:
|
||||
m_unitScalingFactor = 0.0001;
|
||||
m_measurementDirective = 0;
|
||||
|
@ -34,10 +34,8 @@
|
||||
|
||||
using namespace KIGFX::PREVIEW;
|
||||
|
||||
ARC_ASSISTANT::ARC_ASSISTANT( const ARC_GEOM_MANAGER& aManager, EDA_UNITS_T aUnits ) :
|
||||
EDA_ITEM( NOT_USED ),
|
||||
m_constructMan( aManager ),
|
||||
m_units( aUnits )
|
||||
ARC_ASSISTANT::ARC_ASSISTANT( const ARC_GEOM_MANAGER& aManager, EDA_UNITS aUnits )
|
||||
: EDA_ITEM( NOT_USED ), m_constructMan( aManager ), m_units( aUnits )
|
||||
{
|
||||
}
|
||||
|
||||
@ -131,7 +129,8 @@ void ARC_ASSISTANT::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
|
||||
double degs = getNormDeciDegFromRad( initAngle );
|
||||
|
||||
cursorStrings.push_back( DimensionLabel( "r", m_constructMan.GetRadius(), m_units ) );
|
||||
cursorStrings.push_back( DimensionLabel( wxString::FromUTF8( "θ" ), degs, DEGREES ) );
|
||||
cursorStrings.push_back(
|
||||
DimensionLabel( wxString::FromUTF8( "θ" ), degs, EDA_UNITS::DEGREES ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -148,8 +147,10 @@ void ARC_ASSISTANT::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
|
||||
// draw dimmed extender line to cursor
|
||||
preview_ctx.DrawLineWithAngleHighlight( origin, m_constructMan.GetLastPoint(), true );
|
||||
|
||||
cursorStrings.push_back( DimensionLabel( wxString::FromUTF8( "Δθ" ), subtendedDeg, DEGREES ) );
|
||||
cursorStrings.push_back( DimensionLabel( wxString::FromUTF8( "θ" ), endAngleDeg, DEGREES ) );
|
||||
cursorStrings.push_back(
|
||||
DimensionLabel( wxString::FromUTF8( "Δθ" ), subtendedDeg, EDA_UNITS::DEGREES ) );
|
||||
cursorStrings.push_back(
|
||||
DimensionLabel( wxString::FromUTF8( "θ" ), endAngleDeg, EDA_UNITS::DEGREES ) );
|
||||
}
|
||||
|
||||
// place the text next to cursor, on opposite side from radius
|
||||
|
@ -29,7 +29,7 @@ double KIGFX::PREVIEW::PreviewOverlayDeemphAlpha( bool aDeemph )
|
||||
}
|
||||
|
||||
|
||||
static wxString formatPreviewDimension( double aVal, EDA_UNITS_T aUnits )
|
||||
static wxString formatPreviewDimension( double aVal, EDA_UNITS aUnits )
|
||||
{
|
||||
int precision = 4;
|
||||
|
||||
@ -37,23 +37,23 @@ static wxString formatPreviewDimension( double aVal, EDA_UNITS_T aUnits )
|
||||
// be accurate down to the nanometre
|
||||
switch( aUnits )
|
||||
{
|
||||
case MILLIMETRES:
|
||||
case EDA_UNITS::MILLIMETRES:
|
||||
precision = 3; // 1um
|
||||
break;
|
||||
|
||||
case INCHES:
|
||||
case EDA_UNITS::INCHES:
|
||||
precision = 4; // 0.1mil
|
||||
break;
|
||||
|
||||
case DEGREES:
|
||||
case EDA_UNITS::DEGREES:
|
||||
precision = 1; // 0.1deg
|
||||
break;
|
||||
|
||||
case PERCENT:
|
||||
case EDA_UNITS::PERCENT:
|
||||
precision = 1; // 0.1%
|
||||
break;
|
||||
|
||||
case UNSCALED_UNITS:
|
||||
case EDA_UNITS::UNSCALED:
|
||||
break;
|
||||
}
|
||||
|
||||
@ -70,8 +70,7 @@ static wxString formatPreviewDimension( double aVal, EDA_UNITS_T aUnits )
|
||||
}
|
||||
|
||||
|
||||
wxString KIGFX::PREVIEW::DimensionLabel( const wxString& prefix,
|
||||
double aVal, EDA_UNITS_T aUnits )
|
||||
wxString KIGFX::PREVIEW::DimensionLabel( const wxString& prefix, double aVal, EDA_UNITS aUnits )
|
||||
{
|
||||
wxString str;
|
||||
|
||||
|
@ -39,8 +39,8 @@ static const double midTickLengthFactor = 1.5;
|
||||
static const double majorTickLengthFactor = 2.5;
|
||||
|
||||
|
||||
static void drawCursorStrings( KIGFX::VIEW* aView, const VECTOR2D& aCursor,
|
||||
const VECTOR2D& aRulerVec, EDA_UNITS_T aUnits )
|
||||
static void drawCursorStrings(
|
||||
KIGFX::VIEW* aView, const VECTOR2D& aCursor, const VECTOR2D& aRulerVec, EDA_UNITS aUnits )
|
||||
{
|
||||
// draw the cursor labels
|
||||
std::vector<wxString> cursorStrings;
|
||||
@ -51,7 +51,8 @@ static void drawCursorStrings( KIGFX::VIEW* aView, const VECTOR2D& aCursor,
|
||||
cursorStrings.push_back( DimensionLabel( "r", aRulerVec.EuclideanNorm(), aUnits ) );
|
||||
|
||||
double degs = RAD2DECIDEG( -aRulerVec.Angle() );
|
||||
cursorStrings.push_back( DimensionLabel( wxString::FromUTF8( "θ" ), degs, DEGREES ) );
|
||||
cursorStrings.push_back(
|
||||
DimensionLabel( wxString::FromUTF8( "θ" ), degs, EDA_UNITS::DEGREES ) );
|
||||
|
||||
auto temp = aRulerVec;
|
||||
DrawTextNextToCursor( aView, aCursor, -temp, cursorStrings );
|
||||
@ -70,7 +71,7 @@ struct TICK_FORMAT
|
||||
};
|
||||
|
||||
|
||||
static TICK_FORMAT getTickFormatForScale( double aScale, double& aTickSpace, EDA_UNITS_T aUnits )
|
||||
static TICK_FORMAT getTickFormatForScale( double aScale, double& aTickSpace, EDA_UNITS aUnits )
|
||||
{
|
||||
// simple 1/2/5 scales per decade
|
||||
static std::vector<TICK_FORMAT> tickFormats =
|
||||
@ -84,7 +85,7 @@ static TICK_FORMAT getTickFormatForScale( double aScale, double& aTickSpace, EDA
|
||||
aTickSpace = 1;
|
||||
|
||||
// convert to a round (mod-10) number of mils
|
||||
if( aUnits == INCHES )
|
||||
if( aUnits == EDA_UNITS::INCHES )
|
||||
{
|
||||
aTickSpace *= 2.54;
|
||||
}
|
||||
@ -115,8 +116,8 @@ static TICK_FORMAT getTickFormatForScale( double aScale, double& aTickSpace, EDA
|
||||
* @param aLine line vector
|
||||
* @param aMinorTickLen length of minor ticks in IU
|
||||
*/
|
||||
void drawTicksAlongLine( KIGFX::VIEW *aView, const VECTOR2D& aOrigin,
|
||||
const VECTOR2D& aLine, double aMinorTickLen, EDA_UNITS_T aUnits )
|
||||
void drawTicksAlongLine( KIGFX::VIEW* aView, const VECTOR2D& aOrigin, const VECTOR2D& aLine,
|
||||
double aMinorTickLen, EDA_UNITS aUnits )
|
||||
{
|
||||
VECTOR2D tickLine = aLine.Rotate( -M_PI_2 );
|
||||
auto gal = aView->GetGAL();
|
||||
@ -198,11 +199,12 @@ void drawBacksideTicks( KIGFX::GAL& aGal, const VECTOR2D& aOrigin,
|
||||
}
|
||||
|
||||
|
||||
RULER_ITEM::RULER_ITEM( const TWO_POINT_GEOMETRY_MANAGER& aGeomMgr, EDA_UNITS_T userUnits ):
|
||||
EDA_ITEM( NOT_USED ), // Never added to anything - just a preview
|
||||
m_geomMgr( aGeomMgr ),
|
||||
m_userUnits( userUnits )
|
||||
{}
|
||||
RULER_ITEM::RULER_ITEM( const TWO_POINT_GEOMETRY_MANAGER& aGeomMgr, EDA_UNITS userUnits )
|
||||
: EDA_ITEM( NOT_USED ), // Never added to anything - just a preview
|
||||
m_geomMgr( aGeomMgr ),
|
||||
m_userUnits( userUnits )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
const BOX2I RULER_ITEM::ViewBBox() const
|
||||
|
@ -447,21 +447,23 @@ int COMMON_TOOLS::GridProperties( const TOOL_EVENT& aEvent )
|
||||
|
||||
int COMMON_TOOLS::MetricUnits( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
m_frame->ChangeUserUnits( MILLIMETRES );
|
||||
m_frame->ChangeUserUnits( EDA_UNITS::MILLIMETRES );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int COMMON_TOOLS::ImperialUnits( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
m_frame->ChangeUserUnits( INCHES );
|
||||
m_frame->ChangeUserUnits( EDA_UNITS::INCHES );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int COMMON_TOOLS::ToggleUnits( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
m_frame->ChangeUserUnits( m_frame->GetUserUnits() == INCHES ? MILLIMETRES : INCHES );
|
||||
m_frame->ChangeUserUnits( m_frame->GetUserUnits() == EDA_UNITS::INCHES ?
|
||||
EDA_UNITS::MILLIMETRES :
|
||||
EDA_UNITS::INCHES );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ GRID_MENU::GRID_MENU( EDA_DRAW_FRAME* aParent ) :
|
||||
SetIcon( grid_select_xpm );
|
||||
|
||||
wxArrayString gridsList;
|
||||
screen->BuildGridsChoiceList( gridsList, m_parent->GetUserUnits() != INCHES );
|
||||
screen->BuildGridsChoiceList( gridsList, m_parent->GetUserUnits() != EDA_UNITS::INCHES );
|
||||
|
||||
for( unsigned int i = 0; i < gridsList.GetCount(); ++i )
|
||||
{
|
||||
@ -69,7 +69,7 @@ void GRID_MENU::update()
|
||||
int currentId = screen->GetGridCmdId();
|
||||
wxArrayString gridsList;
|
||||
|
||||
screen->BuildGridsChoiceList( gridsList, m_parent->GetUserUnits() != INCHES );
|
||||
screen->BuildGridsChoiceList( gridsList, m_parent->GetUserUnits() != EDA_UNITS::INCHES );
|
||||
|
||||
for( unsigned int i = 0; i < GetMenuItemCount(); ++i )
|
||||
{
|
||||
|
@ -24,18 +24,16 @@
|
||||
|
||||
#include <widgets/text_ctrl_eval.h>
|
||||
|
||||
TEXT_CTRL_EVAL::TEXT_CTRL_EVAL( wxWindow* aParent, wxWindowID aId, const
|
||||
wxString& aValue, const wxPoint& aPos, const wxSize& aSize, long aStyle,
|
||||
const wxValidator& aValidator, const wxString& aName )
|
||||
: wxTextCtrl( aParent, aId, aValue, aPos, aSize, aStyle | wxTE_PROCESS_ENTER, aValidator, aName ),
|
||||
m_eval( UNSCALED_UNITS )
|
||||
TEXT_CTRL_EVAL::TEXT_CTRL_EVAL( wxWindow* aParent, wxWindowID aId, const wxString& aValue,
|
||||
const wxPoint& aPos, const wxSize& aSize, long aStyle, const wxValidator& aValidator,
|
||||
const wxString& aName )
|
||||
: wxTextCtrl( aParent, aId, aValue, aPos, aSize, aStyle | wxTE_PROCESS_ENTER, aValidator,
|
||||
aName ),
|
||||
m_eval( EDA_UNITS::UNSCALED )
|
||||
{
|
||||
Connect( wxEVT_SET_FOCUS,
|
||||
wxFocusEventHandler( TEXT_CTRL_EVAL::onTextFocusGet ), NULL, this );
|
||||
Connect( wxEVT_KILL_FOCUS,
|
||||
wxFocusEventHandler( TEXT_CTRL_EVAL::onTextFocusLost ), NULL, this );
|
||||
Connect( wxEVT_TEXT_ENTER,
|
||||
wxCommandEventHandler( TEXT_CTRL_EVAL::onTextEnter ), NULL, this );
|
||||
Connect( wxEVT_SET_FOCUS, wxFocusEventHandler( TEXT_CTRL_EVAL::onTextFocusGet ), NULL, this );
|
||||
Connect( wxEVT_KILL_FOCUS, wxFocusEventHandler( TEXT_CTRL_EVAL::onTextFocusLost ), NULL, this );
|
||||
Connect( wxEVT_TEXT_ENTER, wxCommandEventHandler( TEXT_CTRL_EVAL::onTextEnter ), NULL, this );
|
||||
}
|
||||
|
||||
|
||||
|
@ -65,7 +65,7 @@ UNIT_BINDER::UNIT_BINDER( EDA_DRAW_FRAME* aParent,
|
||||
}
|
||||
|
||||
|
||||
void UNIT_BINDER::SetUnits( EDA_UNITS_T aUnits, bool aUseMils )
|
||||
void UNIT_BINDER::SetUnits( EDA_UNITS aUnits, bool aUseMils )
|
||||
{
|
||||
m_units = aUnits;
|
||||
m_useMils = aUseMils;
|
||||
|
@ -435,8 +435,8 @@ void DISPLAY_FOOTPRINTS_FRAME::SyncToolbars()
|
||||
m_optionsToolBar->Toggle( ACTIONS::toggleGrid, IsGridVisible() );
|
||||
m_optionsToolBar->Toggle( ACTIONS::selectionTool, IsCurrentTool( ACTIONS::selectionTool ) );
|
||||
m_optionsToolBar->Toggle( ACTIONS::measureTool, IsCurrentTool( ACTIONS::measureTool ) );
|
||||
m_optionsToolBar->Toggle( ACTIONS::metricUnits, GetUserUnits() != INCHES );
|
||||
m_optionsToolBar->Toggle( ACTIONS::imperialUnits, GetUserUnits() == INCHES );
|
||||
m_optionsToolBar->Toggle( ACTIONS::metricUnits, GetUserUnits() != EDA_UNITS::INCHES );
|
||||
m_optionsToolBar->Toggle( ACTIONS::imperialUnits, GetUserUnits() == EDA_UNITS::INCHES );
|
||||
m_optionsToolBar->Refresh();
|
||||
}
|
||||
|
||||
|
@ -821,7 +821,7 @@ void CONNECTION_GRAPH::buildConnectionGraph()
|
||||
}
|
||||
default:
|
||||
wxLogTrace( "CONN", "Driver type unsupported: %s",
|
||||
driver->GetSelectMenuText( MILLIMETRES ) );
|
||||
driver->GetSelectMenuText( EDA_UNITS::MILLIMETRES ) );
|
||||
break;
|
||||
}
|
||||
|
||||
@ -893,7 +893,7 @@ void CONNECTION_GRAPH::buildConnectionGraph()
|
||||
}
|
||||
default:
|
||||
wxLogTrace( "CONN", "Unexpected strong driver %s",
|
||||
driver->GetSelectMenuText( MILLIMETRES ) );
|
||||
driver->GetSelectMenuText( EDA_UNITS::MILLIMETRES ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ public:
|
||||
* Function DisplayList();
|
||||
* Build the Html marker list and show it
|
||||
*/
|
||||
void DisplayList( EDA_UNITS_T aUnits )
|
||||
void DisplayList( EDA_UNITS aUnits )
|
||||
{
|
||||
wxString htmlpage;
|
||||
wxColour bgcolor = wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW );
|
||||
|
@ -311,7 +311,7 @@ int DIALOG_ANNOTATE::GetAnnotateAlgo()
|
||||
|
||||
int DIALOG_ANNOTATE::GetStartNumber()
|
||||
{
|
||||
return ValueFromString( EDA_UNITS_T::UNSCALED_UNITS, m_textNumberAfter->GetValue() );
|
||||
return ValueFromString( EDA_UNITS::UNSCALED, m_textNumberAfter->GetValue() );
|
||||
}
|
||||
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user