[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]

[XaraXtreme-commits] Commit Complete



Commit by  : luke
Repository : xara
Revision   : 807
Date       : Thu Apr 13 09:47:09 BST 2006

Changed paths:
   M /Trunk/XaraLX/Kernel/main3.cpp
   M /Trunk/XaraLX/wxOil/convert.cpp
   M /Trunk/XaraLX/wxOil/localenv.cpp

Number formats in edit controls are now tied to locale settings (so as long as LC_NUMERIC is setup the users can use their native format)


Diff:
Index: Trunk/XaraLX/Kernel/main3.cpp
===================================================================
--- Trunk/XaraLX/Kernel/main3.cpp	(revision 806)
+++ Trunk/XaraLX/Kernel/main3.cpp	(revision 807)
@@ -227,13 +227,13 @@
 			ClickModifiers::DeclarePrefs() &&
 			DocView::DeclarePreferences() &&	// Deals with DocViews preferences
 			Document::ReadPrefs() &&			// read in class Document's preferences
+			Convert::Init() &&					// Read number of decimal places, decimal point
+												// and thousands seperator characters from
+												// operating system .
 PORTNOTE("other","Removed more initialization")
 #ifndef EXCLUDE_FROM_XARALX
 			ColourDragInformation::Init() &&
 			BitmapDragInformation::Init() &&
-			Convert::Init() &&					// Read number of decimal places, decimal point
-												// and thousands seperator characters from
-												// operating system .
 			InitDiagnosticPrefs() &&			// Get the diagnostic preferences
 			
 			CCamView::ReadViewPrefs() &&
Index: Trunk/XaraLX/wxOil/localenv.cpp
===================================================================
--- Trunk/XaraLX/wxOil/localenv.cpp	(revision 806)
+++ Trunk/XaraLX/wxOil/localenv.cpp	(revision 807)
@@ -114,6 +114,17 @@
 UINT32 LocalEnvironment::XMouseDoubleClickMove;
 UINT32 LocalEnvironment::YMouseDoubleClickMove;
 
+PORTNOTE("other","Temporary ToUnicode, will be removed we Gerry checks in full impl.")
+static inline TCHAR ToUnicode( char ch )
+{
+#if 0 != wxUSE_UNICODE
+	TCHAR	tch;
+	mbtowc( &tch, &ch, 1 );
+	return tch;
+#else
+	return ch;
+#endif
+}
 
 /********************************************************************************************
 
@@ -135,7 +146,11 @@
 	TCHAR TS[8];
 
 PORTNOTE("other","Removed GetProfileString usage")
-#ifndef EXCLUDE_FROM_XARALX
+#if defined(__WXGTK__)
+	TRACEUSER( "luke", _T("iDigits = %d
"), *nl_langinfo( FRAC_DIGITS ) );
+	*DecimalPlaces = *nl_langinfo( FRAC_DIGITS );
+	return;
+#elif !defined(EXCLUDE_FROM_XARALX)
 	GetProfileString("intl", "iDigits", "2", TS, sizeof(TS));
 #else
 	TS[0]=_T('2');
@@ -168,7 +183,12 @@
 	TCHAR TS[8];
 
 PORTNOTE("other","Removed GetProfileString usage")
-#ifndef EXCLUDE_FROM_XARALX
+#if defined(__WXGTK__)
+	TS[0] = ToUnicode( *nl_langinfo( THOUSANDS_SEP ) );
+	TS[1] = 0;
+
+	TRACEUSER( "luke", _T("sThousand = %s
"), TS );
+#elif !defined(EXCLUDE_FROM_XARALX)
 	GetProfileString("intl", "sThousand", ",", TS, sizeof(TS));
 #else
 	TS[0]=_T(',');
@@ -197,7 +217,12 @@
 	TCHAR TS[8];
 
 PORTNOTE("other","Removed GetProfileString usage")
-#ifndef EXCLUDE_FROM_XARALX
+#if defined(__WXGTK__)
+	TS[0] = ToUnicode( *nl_langinfo( DECIMAL_POINT ) );
+	TS[1] = 0;
+
+	TRACEUSER( "luke", _T("sDecimal = %s
"), TS );
+#elif !defined(EXCLUDE_FROM_XARALX)
 	GetProfileString("intl", "sDecimal", ".", TS, sizeof(TS));
 #else
 	TS[0]=_T('.');
Index: Trunk/XaraLX/wxOil/convert.cpp
===================================================================
--- Trunk/XaraLX/wxOil/convert.cpp	(revision 806)
+++ Trunk/XaraLX/wxOil/convert.cpp	(revision 807)
@@ -120,7 +120,7 @@
 #include "units.h"
 #include "app.h"								// Camelot object
 //#include "peter.h"								// _R(IDS_MEMORYFORMAT_BYTE) ...
-//#include "localenv.h"							// for locale string settings
+#include "localenv.h"							// for locale string settings
 //#include "richard3.h"							// more naughty inline strings...
 
 
@@ -197,18 +197,15 @@
 
 BOOL Convert::GetCurrentNumberFormat()
 {
+	String_8	ThousandsSepStr( _T(",") ); 
+	String_8	DecimalPointStr( _T(".") ); 
+	NumDecimalPlaces = 2;
+
 	// Read from the operating system what the user has defined to be their decimal point
 	// character and thousands separator character.
-PORTNOTE("other","Removed LocalEnvironment usage")
-#ifndef EXCLUDE_FROM_XARALX
 	LocalEnvironment::GetThousandsSeparator(&ThousandsSepStr);
 	LocalEnvironment::GetDecimalPointChar(&DecimalPointStr);
 	LocalEnvironment::GetNumberOfDecimalPlaces(&NumDecimalPlaces);
-#else
-	String_8	ThousandsSepStr( _T(",") ); 
-	String_8	DecimalPointStr( _T(".") ); 
-	NumDecimalPlaces = 2;
-#endif
 	
 	// Set up the static char variables to reflect these
 	ThousandSep = ((TCHAR *) ThousandsSepStr)[0];


Xara