Commit 7a5386a1 authored by jean-pierre charras's avatar jean-pierre charras
Browse files

Minor fixes and cleanup

parent 4343eb5b
Loading
Loading
Loading
Loading
+26 −15
Original line number Diff line number Diff line
@@ -124,6 +124,31 @@ wxString LengthDoubleToString( double aValue, bool aConvertToMils )
    return text;
}

/* Remove trailing 0 from a string containing a converted float number.
 * the trailing 0 are removed if the mantissa has more
 * than aTrailingZeroAllowed digits and some trailing 0
 */
void StripTrailingZeros( wxString& aStringValue, unsigned aTrailingZeroAllowed )
{
    struct lconv * lc = localeconv();
    char sep = lc->decimal_point[0];
    unsigned sep_pos = aStringValue.Find( sep );

    if( sep_pos > 0 )
    {
        // We want to keep at least aTrailingZeroAllowed digits after the separator
        unsigned min_len = sep_pos + aTrailingZeroAllowed + 1;

        while( aStringValue.Len() > min_len )
        {
            if( aStringValue.Last() == '0' )
                aStringValue.RemoveLast();
            else
                break;
        }
    }
}


/* Convert a value to a string using double notation.
 * For readability, the mantissa has 3 or more digits (max 8 digits),
@@ -153,21 +178,7 @@ wxString ReturnStringFromValue( EDA_UNITS_T aUnit, int aValue, bool aAddUnitSymb

    // Strip trailing zeros. However, keep at least 3 digits in mantissa
    // For readability
    struct lconv * lc = localeconv();
    char sep = lc->decimal_point[0];
    unsigned sep_pos = stringValue.Find( sep );

    if( sep_pos > 0 )
    {
        // We want to keep at least 3 digits after the separator
        unsigned min_len = sep_pos + 4;

        while( stringValue.Len() > min_len )
            if( stringValue.Last() == '0' )
                stringValue.RemoveLast();
            else
                break;
    }
    StripTrailingZeros( stringValue, 3 );
#endif

    if( aAddUnitSymbol )
+2 −2
Original line number Diff line number Diff line
@@ -7,9 +7,9 @@

#ifndef KICAD_BUILD_VERSION
#if defined KICAD_GOST
#   define KICAD_BUILD_VERSION "(2013-feb-21 GOST)"
#   define KICAD_BUILD_VERSION "(2013-feb-26 GOST)"
#else
#   define KICAD_BUILD_VERSION "(2013-feb-21)"
#   define KICAD_BUILD_VERSION "(2013-feb-26)"
#endif
#endif

+0 −17
Original line number Diff line number Diff line
@@ -304,23 +304,6 @@ bool WildCompareString( const wxString& pattern, const wxString& string_to_tst,
}


char* to_point( char* Text )
{
    char* line = Text;

    if( Text == NULL )
        return NULL;

    for( ; *Text != 0; Text++ )
    {
        if( *Text == ',' )
            *Text = '.';
    }

    return line;
}


int RefDesStringCompare( const wxString& strFWord, const wxString& strSWord )
{
    // The different sections of the first string
+0 −1
Original line number Diff line number Diff line
@@ -32,7 +32,6 @@
#include <class_drawpanel.h>
#include <class_sch_screen.h>
#include <wxEeschemaStruct.h>
#include <dcsvg.h>
#include <base_units.h>
#include <libeditframe.h>
#include <sch_sheet_path.h>
+8 −1
Original line number Diff line number Diff line
@@ -290,7 +290,14 @@ void LIB_EDIT_FRAME::StartMoveDrawSymbol( wxDC* DC )
    SetCursor( wxCURSOR_HAND );

    TempCopyComponent();

    // For fields only, move the anchor point of the field
    // to the cursor position to allow user to see the text justification
    if( m_drawItem->Type() == LIB_FIELD_T )
        m_drawItem->BeginEdit( IS_MOVED, m_drawItem->GetPosition() );
    else
        m_drawItem->BeginEdit( IS_MOVED, GetScreen()->GetCrossHairPosition( true ) );

    m_canvas->SetMouseCapture( RedrawWhileMovingCursor, AbortSymbolTraceOn );
    m_canvas->CallMouseCapture( DC, wxDefaultPosition, true );
}
Loading