Commit 777076c8 authored by charras's avatar charras
Browse files

minor changes. See changelog

parent 6bb111cb
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -53,7 +53,7 @@ int Struct3D_Master:: ReadData()
    }
    }


    // Switch the locale to standard C (needed to print floating point numbers like 1.3)
    // Switch the locale to standard C (needed to print floating point numbers like 1.3)
    setlocale( LC_NUMERIC, "C" );
    SetLocaleTo_C_standard( );
    while( GetLine( file, line, &LineNum, 512 ) )
    while( GetLine( file, line, &LineNum, 512 ) )
    {
    {
        text = strtok( line, " \t\n\r" );
        text = strtok( line, " \t\n\r" );
@@ -75,7 +75,7 @@ int Struct3D_Master:: ReadData()
    }
    }


    fclose( file );
    fclose( file );
    setlocale( LC_NUMERIC, "" );      // revert to the current  locale
    SetLocaleTo_Default( );      // revert to the current  locale
    return 0;
    return 0;
}
}


+10 −0
Original line number Original line Diff line number Diff line
@@ -5,6 +5,16 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
Please add newer entries at the top, list the date and your name with
email address.
email address.


2008-June-06 UPDATE   Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+all:
    minor changes
    added void SetLocaleTo_C_standard(void) and void SetLocaleTo_Default(void)
    This is wrapper to the C setlocale( LC_NUMERIC, "C" )
    and setlocale( LC_NUMERIC, "" )function,
    but could make more easier an optional use of locale in kicad in floating point notations


2008-May-30 UPDATE   Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
2008-May-30 UPDATE   Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
================================================================================
+pcbnew
+pcbnew
+38 −5
Original line number Original line Diff line number Diff line
@@ -25,6 +25,39 @@ wxString GetBuildVersion()
}
}




/********************************/
void SetLocaleTo_C_standard(void)
/********************************/
/** function SetLocaleTo_C_standard
because kicad is internationalized, switch internatization to "C" standard
i.e. uses the . (dot) as separator in print/read float numbers
(some contries (France, Germany ..) use , (comma) as separator)
This function must be called before read or write ascii files using float numbers in data
the SetLocaleTo_C_standard function must be called after reading or writing the file

This is wrapper to the C setlocale( LC_NUMERIC, "C" ) function,
but could make more easier an optional use of locale in kicad
*/
{
    setlocale( LC_NUMERIC, "C" );    // Switch the locale to standard C
}

/********************************/
void SetLocaleTo_Default(void)
/********************************/
/** function SetLocaleTo_Default
because kicad is internationalized, switch internatization to default
to use the default separator in print/read float numbers
(. (dot) but some contries (France, Germany ..) use , (comma) as separator)
This function must be called after a call to SetLocaleTo_C_standard

This is wrapper to the C setlocale( LC_NUMERIC, "" ) function,
but could make more easier an optional use of locale in kicad
*/
{
    setlocale( LC_NUMERIC, "" );      // revert to the current locale
}

/*********************************************************************************************/
/*********************************************************************************************/
Ki_PageDescr::Ki_PageDescr( const wxSize& size, const wxPoint& offset, const wxString& name )
Ki_PageDescr::Ki_PageDescr( const wxSize& size, const wxPoint& offset, const wxString& name )
/*********************************************************************************************/
/*********************************************************************************************/
@@ -285,8 +318,8 @@ wxString ReturnPcbLayerName( int layer_number, bool omitSpacePadding )
/**************************************************************/
/**************************************************************/


/* Return the name of the layer number "layer_number".
/* Return the name of the layer number "layer_number".
 *  if "is_filefame" == TRUE, the name can be used for a file name
 *  if omitSpacePadding == TRUE, the name can be used for a file name
 *  (not internatinalized, no space)
 *  (no spaces, replaced by _)
 */
 */
{
{
    const unsigned LAYER_LIMIT = 29;
    const unsigned LAYER_LIMIT = 29;
@@ -302,7 +335,7 @@ wxString ReturnPcbLayerName( int layer_number, bool omitSpacePadding )
        _( "Adhes Cop" ), _( "Adhes Cmp" ), _( "SoldP Cop" ), _( "SoldP Cmp" ),
        _( "Adhes Cop" ), _( "Adhes Cmp" ), _( "SoldP Cop" ), _( "SoldP Cmp" ),
        _( "SilkS Cop" ), _( "SilkS Cmp" ), _( "Mask Cop " ), _( "Mask Cmp " ),
        _( "SilkS Cop" ), _( "SilkS Cmp" ), _( "Mask Cop " ), _( "Mask Cmp " ),
        _( "Drawings " ), _( "Comments " ), _( "Eco1     " ), _( "Eco2     " ),
        _( "Drawings " ), _( "Comments " ), _( "Eco1     " ), _( "Eco2     " ),
        _( "Edges Pcb" ), _( "BAD INDEX" ),
        _( "Edges Pcb" ), _( "BAD INDEX" )
    };
    };


    if( (unsigned) layer_number > LAYER_LIMIT )
    if( (unsigned) layer_number > LAYER_LIMIT )
@@ -445,9 +478,9 @@ int GetTimeStamp()
}
}




/*************************************************/
/**************************************************************/
const wxString& valeur_param( int valeur, wxString& buf_texte )
const wxString& valeur_param( int valeur, wxString& buf_texte )
/*************************************************/
/**************************************************************/


/* Retourne pour affichage la valeur d'un parametre, selon type d'unites choisies
/* Retourne pour affichage la valeur d'un parametre, selon type d'unites choisies
 *  entree : valeur en mils , buffer de texte
 *  entree : valeur en mils , buffer de texte
+2 −0
Original line number Original line Diff line number Diff line
@@ -264,6 +264,8 @@ void WinEDA_App::InitEDA_Appl( const wxString& name )
    {
    {
    }
    }
    
    
    SetLocaleTo_Default( );     // Set locale option for separator used in float numbers

#ifdef KICAD_PYTHON
#ifdef KICAD_PYTHON
    PyHandler::GetInstance()->SetAppName( name );
    PyHandler::GetInstance()->SetAppName( name );
#endif
#endif
+2 −2
Original line number Original line Diff line number Diff line
@@ -81,9 +81,9 @@ MODULE * Module = NULL;
			{
			{
				Module = new MODULE(m_Pcb);
				Module = new MODULE(m_Pcb);
				// Switch the locale to standard C (needed to print floating point numbers like 1.3)
				// Switch the locale to standard C (needed to print floating point numbers like 1.3)
				setlocale(LC_NUMERIC, "C");
				SetLocaleTo_C_standard( );
				Module->ReadDescr(lib_module, &LineNum);
				Module->ReadDescr(lib_module, &LineNum);
				setlocale(LC_NUMERIC, "");      // revert to the current  locale
				SetLocaleTo_Default( );      // revert to the current  locale
				Module->SetPosition(wxPoint(0,0) );
				Module->SetPosition(wxPoint(0,0) );
				fclose(lib_module);
				fclose(lib_module);
				return(Module) ;
				return(Module) ;
Loading