From 5413d54eb47383fdcb86050fde4fe33e2328c62a Mon Sep 17 00:00:00 2001 From: macpgmr Date: Wed, 29 Aug 2012 01:08:10 +0000 Subject: [PATCH] Fix for non-ASCII chars in calendar month names. git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2500 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/orpheus/ovccal.pas | 16 +++++++++++++++- .../orpheus/tests/TestCalendar/project1.dpr | 3 +++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/components/orpheus/ovccal.pas b/components/orpheus/ovccal.pas index 87ea06020..4f928abd1 100644 --- a/components/orpheus/ovccal.pas +++ b/components/orpheus/ovccal.pas @@ -41,7 +41,7 @@ unit ovccal; interface uses - {$IFNDEF LCL} Windows, Messages, {$ELSE} LclIntf, LMessages, LclType, MyMisc, {$ENDIF} + {$IFNDEF LCL} Windows, Messages, {$ELSE} LclIntf, LMessages, LclType, MyMisc, FileUtil,{$ENDIF} Buttons, Classes, Controls, Forms, Graphics, Menus, SysUtils, OvcBase, OvcConst, OvcData, OvcIntl, OvcMisc, OvcDate; @@ -1449,6 +1449,10 @@ var if Canvas.TextWidth(S) > R.Right-R.Left then S := FormatDateTime('mmm yyyy', FDate); +{$IFDEF LCL} + S := SysToUTF8(S); //DrawText expects UTF8 with most widgetsets +{$ENDIF} + Canvas.Font.Color := FColors.MonthAndYear; if Assigned(FOnDrawDate) then FOnDrawDate(Self, FDate, R) @@ -1475,6 +1479,10 @@ var {get the day name} S := Copy(ShortDayNames[Ord(DOW)+1], 1, FDayNameWidth); +{$IFDEF LCL} + S := SysToUTF8(S); +{$ENDIF} + {draw the day name above each column} DrawText(Canvas.Handle, @S[1], Length(S), clRowCol[1,I], DT_SINGLELINE or DT_CENTER or DT_VCENTER); @@ -1533,6 +1541,9 @@ var FOnGetHighlight(Self, FDate+(NewIdx-OldIdx), Cl); Canvas.Font.Color := Cl; end; +{$IFDEF LCL} + S := SysToUTF8(S); +{$ENDIF} if Assigned(FOnDrawItem) then FOnDrawItem(Self, FDate+(NewIdx-OldIdx), clRowCol[R,C]) else @@ -1555,6 +1566,9 @@ var R := DrawButtonFace(Canvas, calGetCurrentRectangle, 1, BS, True, True, False) else R := DrawButtonFace(Canvas, calGetCurrentRectangle, 1, BS, True, False, False); +{$IFDEF LCL} + S := SysToUTF8(S); +{$ENDIF} DrawText(Canvas.Handle, @S[1], Length(S), R, DT_CENTER or DT_VCENTER or DT_SINGLELINE); end; diff --git a/components/orpheus/tests/TestCalendar/project1.dpr b/components/orpheus/tests/TestCalendar/project1.dpr index 8a2e82e5d..57ac782f9 100644 --- a/components/orpheus/tests/TestCalendar/project1.dpr +++ b/components/orpheus/tests/TestCalendar/project1.dpr @@ -3,6 +3,9 @@ program Project1; uses {$IFDEF LCL} Interfaces, + {$IFDEF UNIX} + clocale, + {$ENDIF} {$ENDIF} Forms, Unit1 in 'Unit1.pas' {Form1};