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
This commit is contained in:
macpgmr
2012-08-29 01:08:10 +00:00
parent 73e98925b3
commit 5413d54eb4
2 changed files with 18 additions and 1 deletions

View File

@ -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;

View File

@ -3,6 +3,9 @@ program Project1;
uses
{$IFDEF LCL}
Interfaces,
{$IFDEF UNIX}
clocale,
{$ENDIF}
{$ENDIF}
Forms,
Unit1 in 'Unit1.pas' {Form1};