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

[XaraXtreme-commits] Commit Complete



Commit by  : luke
Repository : xara
Revision   : 788
Date       : Fri Apr  7 11:05:16 BST 2006

Changed paths:
   M /Trunk/XaraLX/tools/texttool.cpp
   M /Trunk/XaraLX/wxOil/unicdman.cpp

Martin Wuerthners fixes for unicode character handling


Diff:
Index: Trunk/XaraLX/tools/texttool.cpp
===================================================================
--- Trunk/XaraLX/tools/texttool.cpp	(revision 787)
+++ Trunk/XaraLX/tools/texttool.cpp	(revision 788)
@@ -1064,14 +1064,17 @@
 				(pKeyPress->IsAlternative() && pKeyPress->IsConstrain()) ) // Ctrl & left alt down
 	 	{
 			WCHAR UnicodeValue = pKeyPress->GetUnicode();
+			TRACEUSER("wuerthne", _T("UnicodeValue from keypress event = %04x"), UnicodeValue);
 			if (HandleDeadKeys(pKeyPress, &UnicodeValue))
 				return TRUE;
 			else
 			{
 		 		if ( (UnicodeValue>=32) && ((UnicodeValue < CAMELOT_UNICODE_BASE) || (UnicodeValue > CAMELOT_UNICODE_LAST)))
 		 		{
+#ifndef EXCLUDE_FROM_XARALX
 					if ((UnicodeValue < 256) /*&& !TextManager::IsUnicodeCompleteOS()*/)
 						UnicodeValue = UnicodeManager::MultiByteToUnicode(UnicodeValue);
+#endif
 
 					// Display a blank cursor (thus hiding the pointer)
 					if (!IsBlankCursorUp)
@@ -1085,6 +1088,7 @@
 					OpTextFormat* pOp = new OpTextFormat();
 					if (pOp != NULL)
 					{
+						TRACEUSER("wuerthne", _T("inserting Unicode char %04x"), UnicodeValue);
 						pOp->DoInsertChar(UnicodeValue, OpTextFormat::INSERT);
 						UpdateAfterTyping = TRUE;
 						return TRUE;
Index: Trunk/XaraLX/wxOil/unicdman.cpp
===================================================================
--- Trunk/XaraLX/wxOil/unicdman.cpp	(revision 787)
+++ Trunk/XaraLX/wxOil/unicdman.cpp	(revision 788)
@@ -279,7 +279,9 @@
 		return 128;
 	}
 #else
-	mbrtowc( ReturnArray, MBArray, cch, NULL );
+	mbstate_t			state;
+	memset(&state, 0, sizeof(mbstate_t));
+	mbrtowc( ReturnArray, MBArray, cch, &state );
 	return ReturnArray[0];
 #endif
 }


Xara