CalLite: Remove unnecessary comments (old commented code). Avoid calling "Draw" outside a paint method (hint by HowardPC).

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5343 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2016-11-12 09:25:22 +00:00
parent 479d7fbea9
commit cf244f31f5

View File

@ -56,7 +56,6 @@ const
DefMinHeight = 120; DefMinHeight = 120;
DefMinWidth = 120; DefMinWidth = 120;
DefaultDisplayText = 'Today is,"mmm"","" dd yyyy",Holidays during,There are no holidays set for'; DefaultDisplayText = 'Today is,"mmm"","" dd yyyy",Holidays during,There are no holidays set for';
// DefaultDisplayText = 'Today is|mmm dd", " yyyy|Holidays during|There are no holidays set for';
DefTStyle: TTextStyle = (Alignment : taCenter; Layout : tlCenter; DefTStyle: TTextStyle = (Alignment : taCenter; Layout : tlCenter;
SingleLine : False; Clipping : True; SingleLine : False; Clipping : True;
ExpandTabs : False; ShowPrefix : False; ExpandTabs : False; ShowPrefix : False;
@ -64,7 +63,6 @@ const
SystemFont : False; RightToLeft: False; SystemFont : False; RightToLeft: False;
EndEllipsis: False); EndEllipsis: False);
//Ariel Rodriguez 12/09/2013
EnglishDays = 'Sun,Mon,Tue,Wed,Thu,Fri,Sat'; EnglishDays = 'Sun,Mon,Tue,Wed,Thu,Fri,Sat';
EnglishMonths = 'January,February,March,April,May,June,July,August,September,October,November,December'; EnglishMonths = 'January,February,March,April,May,June,July,August,September,October,November,December';
@ -83,23 +81,6 @@ const
SpanishDays = 'Dom,Lun,Mar,Mie,Jue,Vie,Sab'; SpanishDays = 'Dom,Lun,Mar,Mie,Jue,Vie,Sab';
SpanishMonths = 'Enero,Febrero,Marzo,Abril,Mayo,Junio,Julio,Agosto,Septiembre,Octubre,Noviembre,Diciembre'; SpanishMonths = 'Enero,Febrero,Marzo,Abril,Mayo,Junio,Julio,Agosto,Septiembre,Octubre,Noviembre,Diciembre';
SpanishTexts = 'Hoy es,dd/mm/yyyy,Dias de fiestas,No hay dias feriados establecidos para'; SpanishTexts = 'Hoy es,dd/mm/yyyy,Dias de fiestas,No hay dias feriados establecidos para';
{
EnglishDays = 'Sun|Mon|Tue|Wed|Thu|Fri|Sat';
EnglishMonths = 'January|February|March|April|May|June|July|August|September|October|November|December';
HebrewDays = 'א|ב|ג|ד|ה|ו|ש';
HebrewMonths = ('ינואר|פברואר|מרץ|אפריל|מאי|יוני| יולי|אוגוסט|ספטמבר|אוקטובר|נובמב|דצמבר');
HebrewTexts = 'היום הוא|yyyy-mm-dd|במהלך החגים| אין חגים מוגדרים עבור';
FrenchDays = 'dim|lun|mar|mer|jeu|ven|sm';
FrenchMonths = 'janvier|février|mars|avril|mai|juin|juillet|août|septembre|octobre|novembre|décembre';
FrenchTexts = 'Est aujourd''hui|dd/mm/yyyy|vacances pendant|Il n''y a pas de jours fériés fixés pour';
GermanMonths = 'Januar|Februar|März|April|Mai|Juni|Juli|August|September|Oktober|November|Dezember';
GermanDays = 'So|Mo|Di|Mi|Do|Fr|Sa';
GermamTexts = 'Heute ist|dd/mm/yyyy|Urlaub während|Es sind keine Feiertage vorhanden im';
SpanishDays = 'Dom<Lun|Mar|Mie|Jue|Vie|Sab';
SpanishMonths = 'Enero|Febrero|Marzo|Abril|Mayo|Junio|Julio|Agosto|Septiembre|Octubre|Noviembre|Diciembre';
SpanishTexts = 'Hoy es|dd/mm/yyyy|Dias de fiestas|No hay dias feriados establecidos para';
}
//Ariel Rodriguez 12/09/2013
type type
TCalendarLite = class; TCalendarLite = class;
@ -146,6 +127,7 @@ type
TLanguage = (lgEnglish, lgFrench, lgGerman, lgHebrew, lgSpanish); //Ariel Rodriguez 12/09/2013 TLanguage = (lgEnglish, lgFrench, lgGerman, lgHebrew, lgSpanish); //Ariel Rodriguez 12/09/2013
{ TCalDateList } { TCalDateList }
TCalDateList = class TCalDateList = class
@ -169,6 +151,7 @@ type
property Values[AIndex: Integer]: TDate read GetDate write SetDate; default; property Values[AIndex: Integer]: TDate read GetDate write SetDate; default;
end; end;
{ TCalDrawer } { TCalDrawer }
TCalDrawer = class TCalDrawer = class
@ -185,7 +168,6 @@ type
FThisYear: word; FThisYear: word;
FTStyle: TTextStyle; FTStyle: TTextStyle;
procedure CalcSettings; procedure CalcSettings;
// procedure ChangeDateTo(ACell: TSize; AddToSel: Boolean = false);
procedure DrawArrow(ARect: TRect; AHead: TArrowhead; ADirec: TArrowDirection); procedure DrawArrow(ARect: TRect; AHead: TArrowhead; ADirec: TArrowDirection);
procedure DrawDayCells; procedure DrawDayCells;
procedure DrawDayLabels; procedure DrawDayLabels;
@ -263,7 +245,7 @@ type
FSavedHint: String; FSavedHint: String;
FMultiSelect: Boolean; FMultiSelect: Boolean;
FSelDates: TCalDateList; FSelDates: TCalDateList;
FLanguage: TLanguage; //Ariel Rodriguez 12/09/2013 FLanguage: TLanguage;
function GetDayNames: String; function GetDayNames: String;
function GetDisplayText(aTextIndex: TDisplayText): String; function GetDisplayText(aTextIndex: TDisplayText): String;
function GetDisplayTexts: String; function GetDisplayTexts: String;
@ -283,7 +265,7 @@ type
procedure SetStartingDayOfWeek(AValue: TDayOfWeek); procedure SetStartingDayOfWeek(AValue: TDayOfWeek);
procedure SetWeekendDays(AValue: TDaysOfWeek); procedure SetWeekendDays(AValue: TDaysOfWeek);
procedure YearMenuItemClicked(Sender: TObject); procedure YearMenuItemClicked(Sender: TObject);
procedure SetLanguage(AValue: TLanguage); //Ariel Rodriguez 12/09/2013 procedure SetLanguage(AValue: TLanguage);
protected protected
procedure ChangeDateTo(ADate: TDate; ASelMode: TCalSelMode); procedure ChangeDateTo(ADate: TDate; ASelMode: TCalSelMode);
@ -372,7 +354,7 @@ type
property WeekendDays: TDaysOfWeek read FWeekendDays property WeekendDays: TDaysOfWeek read FWeekendDays
write SetWeekendDays default [dowSunday]; write SetWeekendDays default [dowSunday];
property Languages: TLanguage read FLanguage property Languages: TLanguage read FLanguage
write SetLanguage default lgEnglish; //Ariel Rodriguez 12/09/2013 write SetLanguage default lgEnglish;
// new event properties // new event properties
property OnDateChange: TNotifyEvent read FOnDateChange write FOnDateChange; property OnDateChange: TNotifyEvent read FOnDateChange write FOnDateChange;
@ -388,7 +370,8 @@ procedure ClearHolidays(var AHolidays: THolidays);
procedure AddHoliday(ADay: Integer; var AHolidays: THolidays); procedure AddHoliday(ADay: Integer; var AHolidays: THolidays);
function IsHoliday(ADay: Integer; AHolidays: THolidays): Boolean; function IsHoliday(ADay: Integer; AHolidays: THolidays): Boolean;
procedure Register; //Ariel Rodriguez 12/09/2013 procedure Register;
implementation implementation
@ -641,22 +624,6 @@ begin
if (LastRow = TodayRow) then if (LastRow = TodayRow) then
FRowPositions[TodayRow] := FRowPositions[LastDateRow] + borderv + ch + rem; FRowPositions[TodayRow] := FRowPositions[LastDateRow] + borderv + ch + rem;
end; end;
{
procedure TCalDrawer.ChangeDateTo(ACell: TSize; AddToSel: Boolean = false);
var
diff: integer;
newDate: TDateTime;
//d, m, y: word;
begin
diff := ACell.cx + LastCol * (ACell.cy - 2);
newDate := FStartDate + diff - 1;
FOwner.FDate := newDate;
FOwner.DateChange;
FCanvas.Brush.Color := FOwner.Colors.BackgroundColor;
FCanvas.FillRect(FBoundsRect);
Draw;
//DecodeDate(newDate, y, m, d);
end; }
procedure TCalDrawer.Draw; procedure TCalDrawer.Draw;
begin begin
@ -1308,7 +1275,7 @@ begin
FWeekendDays := [dowSunday, dowSaturday]; FWeekendDays := [dowSunday, dowSaturday];
FOptions := [coShowTodayFrame, coBoldHolidays, coShowWeekend, coShowHolidays, FOptions := [coShowTodayFrame, coBoldHolidays, coShowWeekend, coShowHolidays,
coShowTodayRow]; coShowTodayRow];
SetLanguage(lgEnglish); //Ariel Rodriguez 12/09/2013 SetLanguage(lgEnglish);
FPrevMouseDate := 0; FPrevMouseDate := 0;
Date := SysUtils.Date; Date := SysUtils.Date;
end; end;
@ -1378,8 +1345,8 @@ begin
with FCalDrawer do begin with FCalDrawer do begin
FCanvas.Brush.Color := Colors.BackgroundColor; FCanvas.Brush.Color := Colors.BackgroundColor;
FCanvas.FillRect(FBoundsRect); FCanvas.FillRect(FBoundsRect);
Draw;
end; end;
Invalidate;
end; end;
procedure TCalendarLite.DateChange; procedure TCalendarLite.DateChange;
@ -1718,10 +1685,10 @@ begin
Invalidate; Invalidate;
end; end;
//Ariel Rodriguez 12/09/2013
procedure TCalendarLite.SetLanguage(AValue : TLanguage); procedure TCalendarLite.SetLanguage(AValue : TLanguage);
begin begin
// if FLanguage = AValue then Exit; // Don't check for "FLanguage = AValue" because otherwise the code would not
// execute after being called from the constructor.
FLanguage := AValue; FLanguage := AValue;
case FLanguage of case FLanguage of
@ -1760,7 +1727,6 @@ begin
Invalidate; Invalidate;
end; end;
//Ariel Rodriguez 12/09/2013
procedure TCalendarLite.SetMonthNames(const AValue: String); procedure TCalendarLite.SetMonthNames(const AValue: String);
begin begin
FMonthNames.CommaText := AValue; FMonthNames.CommaText := AValue;
@ -1841,12 +1807,11 @@ begin
end; end;
//Ariel Rodriguez 12/09/2013
procedure Register; procedure Register;
begin begin
{$I calendarlite_icon.lrs} {$I calendarlite_icon.lrs}
RegisterComponents('Misc', [TCalendarLite]); RegisterComponents('Misc', [TCalendarLite]);
end; end;
//Ariel Rodriguez 12/09/2013
end. end.