You've already forked lazarus-ccr
callight: Use copy of FormatSettings in calendar.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6773 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="10"/>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
@ -20,9 +20,10 @@
|
||||
<Version Value="2"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<local>
|
||||
<FormatVersion Value="1"/>
|
||||
</local>
|
||||
<FormatVersion Value="2"/>
|
||||
<Modes Count="1">
|
||||
<Mode0 Name="default"/>
|
||||
</Modes>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="2">
|
||||
<Item1>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="10"/>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
@ -19,13 +19,12 @@
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
|
||||
<ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<local>
|
||||
<FormatVersion Value="1"/>
|
||||
</local>
|
||||
<FormatVersion Value="2"/>
|
||||
<Modes Count="1">
|
||||
<Mode0 Name="default"/>
|
||||
</Modes>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="2">
|
||||
<Item1>
|
||||
|
@ -12,29 +12,28 @@ object Form1: TForm1
|
||||
LCLVersion = '2.1.0.0'
|
||||
object PSettings: TPanel
|
||||
Left = 0
|
||||
Height = 432
|
||||
Height = 448
|
||||
Top = 0
|
||||
Width = 753
|
||||
Align = alTop
|
||||
ClientHeight = 432
|
||||
ClientHeight = 448
|
||||
ClientWidth = 753
|
||||
TabOrder = 0
|
||||
object cgOptions: TCheckGroup
|
||||
Left = 24
|
||||
Height = 384
|
||||
Height = 392
|
||||
Top = 40
|
||||
Width = 160
|
||||
AutoFill = True
|
||||
Caption = 'Set calendar Options'
|
||||
ChildSizing.LeftRightSpacing = 6
|
||||
ChildSizing.TopBottomSpacing = 6
|
||||
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
|
||||
ChildSizing.EnlargeVertical = crsHomogenousChildResize
|
||||
ChildSizing.ShrinkHorizontal = crsScaleChilds
|
||||
ChildSizing.ShrinkVertical = crsScaleChilds
|
||||
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||
ChildSizing.ControlsPerLine = 1
|
||||
ClientHeight = 364
|
||||
ClientHeight = 372
|
||||
ClientWidth = 156
|
||||
Items.Strings = (
|
||||
'coBoldDayNames'
|
||||
@ -117,20 +116,19 @@ object Form1: TForm1
|
||||
end
|
||||
object rgLanguage: TRadioGroup
|
||||
Left = 200
|
||||
Height = 208
|
||||
Height = 216
|
||||
Top = 216
|
||||
Width = 160
|
||||
AutoFill = True
|
||||
Caption = 'Language to use'
|
||||
ChildSizing.LeftRightSpacing = 6
|
||||
ChildSizing.TopBottomSpacing = 6
|
||||
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
|
||||
ChildSizing.EnlargeVertical = crsHomogenousChildResize
|
||||
ChildSizing.ShrinkHorizontal = crsScaleChilds
|
||||
ChildSizing.ShrinkVertical = crsScaleChilds
|
||||
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||
ChildSizing.ControlsPerLine = 1
|
||||
ClientHeight = 188
|
||||
ClientHeight = 196
|
||||
ClientWidth = 156
|
||||
ItemIndex = 0
|
||||
Items.Strings = (
|
||||
@ -155,7 +153,6 @@ object Form1: TForm1
|
||||
AutoFill = True
|
||||
Caption = 'Starting day of the week'
|
||||
ChildSizing.LeftRightSpacing = 6
|
||||
ChildSizing.TopBottomSpacing = 6
|
||||
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
|
||||
ChildSizing.EnlargeVertical = crsHomogenousChildResize
|
||||
ChildSizing.ShrinkHorizontal = crsScaleChilds
|
||||
@ -178,11 +175,11 @@ object Form1: TForm1
|
||||
end
|
||||
object GroupBox1: TGroupBox
|
||||
Left = 376
|
||||
Height = 384
|
||||
Height = 392
|
||||
Top = 40
|
||||
Width = 160
|
||||
Caption = 'Colors'
|
||||
ClientHeight = 364
|
||||
ClientHeight = 372
|
||||
ClientWidth = 156
|
||||
TabOrder = 6
|
||||
object CbArrowBorder: TColorButton
|
||||
@ -491,7 +488,7 @@ object Form1: TForm1
|
||||
end
|
||||
object SelDateListbox: TListBox
|
||||
Left = 560
|
||||
Height = 144
|
||||
Height = 152
|
||||
Top = 280
|
||||
Width = 168
|
||||
Columns = 2
|
||||
|
@ -245,9 +245,7 @@ type
|
||||
FCalDrawer: TCalDrawer;
|
||||
FColors: TCalColors;
|
||||
FDate: TDateTime;
|
||||
FDayNames: TStringList;
|
||||
FDisplayTexts: TStringList;
|
||||
FMonthNames: TStringList;
|
||||
FOnDateChange: TNotifyEvent;
|
||||
FOnMonthChange: TNotifyEvent;
|
||||
FOnGetDayText: TCalGetDayTextEvent;
|
||||
@ -269,6 +267,7 @@ type
|
||||
FClickButton: TMouseButton;
|
||||
FLanguage: TLanguage;
|
||||
FDblClickTimer: TTimer;
|
||||
FFormatSettings: TFormatSettings;
|
||||
function GetDayNames: String;
|
||||
function GetDisplayText(aTextIndex: TDisplayText): String;
|
||||
function GetDisplayTexts: String;
|
||||
@ -932,7 +931,7 @@ begin
|
||||
s:= FOwner.GetDisplayText(dtToday);
|
||||
if (coShowTodayName in FOwner.Options) then
|
||||
s := Format('%s %s',[s, FOwner.GetDayName(TDayOfWeek(DayOfWeek(Date())))]);
|
||||
AppendStr(s, ' ' + FormatDateTime(FOwner.GetDisplayText(dtTodayFormat), Date()));
|
||||
AppendStr(s, ' ' + FormatDateTime(FOwner.GetDisplayText(dtTodayFormat), Date(), FOwner.FFormatSettings));
|
||||
w1 := FCanvas.TextWidth('aaa');
|
||||
w2 := FCanvas.TextWidth(' ');
|
||||
w3 := FCanvas.TextWidth(s);
|
||||
@ -1287,6 +1286,7 @@ end;
|
||||
constructor TCalendarLite.Create(anOwner: TComponent);
|
||||
begin
|
||||
inherited Create(anOwner);
|
||||
FFormatSettings := DefaultFormatSettings;
|
||||
FSelDates := TCalDateList.Create;
|
||||
FColors := TCalColors.Create(self);
|
||||
Color := clWhite;
|
||||
@ -1297,8 +1297,6 @@ begin
|
||||
Constraints.MinWidth := ScaleY(DefMinWidth, DESIGNTIME_PPI);
|
||||
Canvas.Brush.Style := bsSolid;
|
||||
TabStop := true;
|
||||
FDayNames := TStringList.Create;
|
||||
FMonthNames := TStringList.Create;
|
||||
FDisplayTexts := TStringList.Create;
|
||||
FDisplayTexts.StrictDelimiter := True;
|
||||
FDisplayTexts.Delimiter := ',';
|
||||
@ -1321,8 +1319,6 @@ end;
|
||||
destructor TCalendarLite.Destroy;
|
||||
begin
|
||||
FreeAndNil(FSelDates);
|
||||
FreeAndNil(FDayNames);
|
||||
FreeAndNil(FMonthNames);
|
||||
FreeAndNil(FDisplayTexts);
|
||||
FreeAndNil(FColors);
|
||||
SetLength(FCalDrawer.FRowPositions, 0);
|
||||
@ -1448,14 +1444,22 @@ end;
|
||||
|
||||
function TCalendarLite.GetDayName(ADayOfWeek: TDayOfWeek): String;
|
||||
begin
|
||||
Result := SysToUTF8(DefaultFormatSettings.ShortDayNames[integer(ADayOfWeek)]);
|
||||
if Pred(integer(ADayOfWeek)) < FDayNames.Count then
|
||||
Result := FDayNames[Pred(integer(ADayOfWeek))];
|
||||
Result := FFormatSettings.ShortDayNames[integer(ADayOfWeek)];
|
||||
end;
|
||||
|
||||
function TCalendarLite.GetDayNames: String;
|
||||
var
|
||||
L: TStrings;
|
||||
i: Integer;
|
||||
begin
|
||||
Result := FDayNames.CommaText;
|
||||
L := TStringList.Create;
|
||||
try
|
||||
for i:= 1 to 7 do
|
||||
L.Add(FFormatSettings.ShortDayNames[i]);
|
||||
Result := L.CommaText;
|
||||
finally
|
||||
L.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TCalendarLite.GetDisplayText(aTextIndex: TDisplayText): String;
|
||||
@ -1470,14 +1474,22 @@ end;
|
||||
|
||||
function TCalendarLite.GetMonthName(AMonth: Integer): String;
|
||||
begin
|
||||
Result := SysToUTF8(DefaultFormatSettings.LongMonthNames[AMonth]);
|
||||
if pred(AMonth) < FMonthnames.Count then
|
||||
Result := FMonthNames[pred(AMonth)];
|
||||
Result := FFormatSettings.LongMonthNames[AMonth];
|
||||
end;
|
||||
|
||||
function TCalendarLite.GetMonthNames: String;
|
||||
var
|
||||
L: TStrings;
|
||||
i: Integer;
|
||||
begin
|
||||
Result := FMonthNames.CommaText;
|
||||
L := TStringList.Create;
|
||||
try
|
||||
for i:=1 to 12 do
|
||||
L.Add(FFormatSettings.ShortMonthNames[i]);
|
||||
Result := L.CommaText;
|
||||
finally
|
||||
L.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCalendarLite.HolidayMenuItemClicked(Sender: TObject);
|
||||
@ -1766,9 +1778,19 @@ begin
|
||||
end;
|
||||
|
||||
procedure TCalendarLite.SetDayNames(const AValue: String);
|
||||
var
|
||||
i: Integer;
|
||||
L: TStrings;
|
||||
begin
|
||||
FDayNames.CommaText := AValue;
|
||||
Invalidate;
|
||||
L := TStringList.Create;
|
||||
try
|
||||
L.CommaText := AValue;
|
||||
for i := 1 to 7 do
|
||||
FFormatSettings.ShortDayNames[i] := L[i-1];
|
||||
Invalidate;
|
||||
finally
|
||||
L.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCalendarLite.SetDefaultDisplayTexts;
|
||||
@ -1849,9 +1871,19 @@ begin
|
||||
end;
|
||||
|
||||
procedure TCalendarLite.SetMonthNames(const AValue: String);
|
||||
var
|
||||
i: Integer;
|
||||
L: TStrings;
|
||||
begin
|
||||
FMonthNames.CommaText := AValue;
|
||||
Invalidate;
|
||||
L := TStringList.Create;
|
||||
try
|
||||
L.CommaText := AValue;
|
||||
for i:= 1 to 12 do
|
||||
FFormatSettings.ShortMonthNames[i] := L[i-1];
|
||||
Invalidate;
|
||||
finally
|
||||
L.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCalendarLite.SetMultiSelect(AValue: Boolean);
|
||||
@ -1910,7 +1942,7 @@ end;
|
||||
|
||||
procedure TCalendarLite.ShowHintWindow(APoint: TPoint; ADate: TDate);
|
||||
var
|
||||
txt: String;
|
||||
txt: String = '';
|
||||
y, m, d: Word;
|
||||
begin
|
||||
if Assigned(FOnHint) then begin
|
||||
|
Reference in New Issue
Block a user