tvplanit: Some clean-up, some cosmetic changes

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4957 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz 2016-07-14 16:13:22 +00:00
parent bc4e7a1be7
commit f45723d6cf
6 changed files with 269 additions and 2390 deletions

View File

@ -274,34 +274,6 @@ object MainForm: TMainForm
ClientHeight = 504
ClientWidth = 772
TabVisible = False
object VpTaskList1: TVpTaskList
Left = 0
Height = 462
Top = 42
Width = 772
DataStore = VpBufDSDataStore1
ControlLink = VpControlLink1
Color = clWindow
Align = alClient
TabStop = True
TabOrder = 0
ReadOnly = False
DisplayOptions.CheckBGColor = clWindow
DisplayOptions.CheckColor = cl3DDkShadow
DisplayOptions.CheckStyle = csCheck
DisplayOptions.DueDateFormat = 'dd.MM.yyyy'
DisplayOptions.ShowCompletedTasks = False
DisplayOptions.ShowAll = True
DisplayOptions.ShowDueDate = True
DisplayOptions.OverdueColor = clRed
DisplayOptions.NormalColor = clBlack
DisplayOptions.CompletedColor = clGray
LineColor = clGray
MaxVisibleTasks = 250
TaskHeadAttributes.Color = clSilver
DrawingStyle = dsFlat
ShowResourceName = True
end
object Panel6: TPanel
Left = 0
Height = 42
@ -311,7 +283,7 @@ object MainForm: TMainForm
BevelOuter = bvNone
ClientHeight = 42
ClientWidth = 772
TabOrder = 1
TabOrder = 0
object RbAllTasks: TRadioButton
Left = 8
Height = 19
@ -333,6 +305,37 @@ object MainForm: TMainForm
TabOrder = 1
end
end
object VpTaskList1: TVpTaskList
Left = 0
Height = 462
Top = 42
Width = 772
DataStore = VpBufDSDataStore1
ControlLink = VpControlLink1
Color = clWindow
Font.Height = -12
ParentFont = False
Align = alClient
TabStop = True
TabOrder = 1
ReadOnly = False
DisplayOptions.CheckBGColor = clWindow
DisplayOptions.CheckColor = cl3DDkShadow
DisplayOptions.CheckStyle = csCheck
DisplayOptions.DueDateFormat = 'dd.MM.yyyy'
DisplayOptions.ShowCompletedTasks = False
DisplayOptions.ShowAll = False
DisplayOptions.ShowDueDate = True
DisplayOptions.OverdueColor = clRed
DisplayOptions.NormalColor = clBlack
DisplayOptions.CompletedColor = clGray
LineColor = clGray
MaxVisibleTasks = 250
TaskHeadAttributes.Color = clSilver
TaskHeadAttributes.Font.Height = -12
DrawingStyle = ds3d
ShowResourceName = True
end
end
object TabContacts: TTabSheet
Caption = 'Contacts'

View File

@ -190,8 +190,6 @@ object Form1: TForm1
DataStore = VpXmlDatastore1
ControlLink = VpControlLink1
Color = clWindow
Font.Height = -12
ParentFont = False
Align = alClient
TabStop = True
TabOrder = 2

View File

@ -316,18 +316,17 @@ type
procedure CMEnter(var Msg: {$IFDEF DELPHI}TMessage{$ELSE}TLMessage{$ENDIF}); message CM_ENTER;
procedure CMExit(var Msg: {$IFDEF DELPHI}TMessage{$ELSE}TLMessage{$ENDIF}); message CM_EXIT;
public
constructor Create (AOwner : TComponent); override;
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
function GetLastPrintLine : Integer;
function GetControlType : TVpItemType; virtual; abstract;
procedure RenderToCanvas (RenderCanvas: TCanvas; RenderIn: TRect;
function GetLastPrintLine: Integer;
function GetControlType: TVpItemType; virtual; abstract;
procedure RenderToCanvas(RenderCanvas: TCanvas; RenderIn: TRect;
Angle: TVpRotationAngle; Scale: Extended; RenderDate: TDateTime;
StartLine: Integer; StopLine: Integer; UseGran: TVpGranularity;
StartLine, StopLine: Integer; UseGran: TVpGranularity;
DisplayOnly: Boolean); virtual; abstract;
procedure LinkHandler(Sender: TComponent;
NotificationType: TVpNotificationType; const Value: Variant);
virtual; abstract;
property ReadOnly : Boolean read FReadOnly write FReadOnly;
procedure LinkHandler(Sender: TComponent; NotificationType: TVpNotificationType;
const Value: Variant); virtual; abstract;
property ReadOnly: Boolean read FReadOnly write FReadOnly;
published
property PopupMenu;
property DataStore: TVpCustomDataStore read FDataStore write SetDataStore;
@ -1227,6 +1226,7 @@ begin
Inc(I);
end;
end;
FPrinter := TVpPrinter.Create (Self);
FLocalization := TVpLocalization.Create;
end;

View File

@ -761,7 +761,7 @@ begin
if csLoading in ComponentState then
Exit;
calRecalcSize (False);
calRecalcSize(False);
Invalidate;
end;
{=====}
@ -1448,372 +1448,6 @@ begin
painter.Free;
end;
end;
(*
var
R, C: Integer;
I: Integer;
SatCol: Integer;
SunCol: Integer;
DOW: TVpDayType;
Y, M, D: Word;
lBadDate: Boolean;
lDate: TDateTime;
RealWidth: Integer;
RealHeight: Integer;
RealLeft: Integer;
RealRight: Integer;
RealTop: Integer;
RealBottom: Integer;
BevelHighlight: TColor;
BevelShadow: TColor;
InactiveDayColor: TColor;
MonthYearColor: TColor;
DayNameColor: TColor;
LineColor: TColor;
EventDayColor: TColor;
DayColor: TColor;
RealColor: TColor;
WeekendColor: TColor;
procedure SetMeasurements;
begin
RealWidth := TPSViewportWidth (Angle, RenderIn);
RealHeight := TPSViewportHeight (Angle, RenderIn);
RealLeft := TPSViewportLeft (Angle, RenderIn);
RealRight := TPSViewportRight (Angle, RenderIn);
RealTop := TPSViewportTop (Angle, RenderIn);
RealBottom := TPSViewportBottom (Angle, RenderIn);
if RenderDate = 0 then
RenderDate := FDate;
end;
procedure DrawDate;
var
R: TRect;
S: string;
begin
if FDateFormat = dfLong then
if cdoShowYear in FOptions then
S := FormatDateTime('mmmm yyyy', RenderDate)
else
S := FormatDateTime('mmmm', RenderDate)
else
if cdoShowYear in FOptions then
S := FormatDateTime('mmm yyyy', RenderDate)
else
S := FormatDateTime('mmm', RenderDate);
{$IF FPC_FULLVERSION < 30000}
S := SysToUTF8(S);
{$ENDIF}
R := Rect (clRowCol[0, 1].Left + RealLeft,
clRowCol[0, 1].Top + RealTop,
clRowCol[0, 1].Right + RealLeft,
clRowCol[0, 1].Bottom + RealTop);
R.Right := clRowCol[0, 6].Left + RealLeft;
{switch to short date format if string won't fit}
if FDateFormat = dfLong then
if RenderCanvas.TextWidth(S) > R.Right-R.Left then
{$IF FPC_FULLVERSION >= 30000}
S := FormatDateTime('mmm yyyy', RenderDate);
{$ELSE}
S := SysToUTF8(FormatDateTime('mmm yyyy', RenderDate));
{$ENDIF}
RenderCanvas.Font.Color := MonthYearColor;
if Assigned(FOnDrawDate) then
FOnDrawDate(Self, RenderDate, R)
else
TPSCenteredTextOut(RenderCanvas, Angle, RenderIn, R, S);
end;
procedure DrawDayNames;
var
I: Integer;
S: string;
DrawRect: TRect;
begin
{draw the day name column labels}
RenderCanvas.Font.Color := DayNameColor;
I := 0;
DOW := FWeekStarts;
repeat
{record columns for weekends}
if DOW = dtSaturday then
SatCol := I;
if DOW = dtSunday then
SunCol := I;
{get the day name}
if cdoShortNames in Options then begin
if FDayNameWidth < 1 then
S := ShortDayNames[Ord(DOW)+1]
else
S := Copy(ShortDayNames[Ord(DOW)+1], 1, FDayNameWidth)
end else begin
if FDayNameWidth < 1 then
S := LongDayNames[Ord(DOW)+1]
else
S := Copy(LongDayNames[Ord(DOW)+1], 1, FDayNameWidth)
end;
{$IF FPC_FULLVERSION < 30000}
S := SysToUTF8(S);
{$ENDIF}
{draw the day name above each column}
DrawRect := Rect(clRowCol[1, I].Left + RealLeft,
clRowCol[1, I].Top + RealTop,
clRowCol[1, I].Right + RealLeft,
clRowCol[1, I].Bottom + RealTop);
TPSCenteredTextOut(RenderCanvas, Angle, RenderIn, DrawRect, S);
Inc(I);
if DOW < High(DOW) then
Inc(DOW)
else
DOW := Low(DOW);
until DOW = WeekStarts;
end;
procedure DrawLine;
begin
// if (not Ctl3D) then begin
RenderCanvas.Pen.Color := LineColor;
TPSMoveTo (RenderCanvas, Angle, RenderIn,
RealLeft, clRowCol[1,0].Bottom-3 + RealTop);
TPSLineTo (RenderCanvas, Angle, RenderIn,
RealRight, clRowCol[1,0].Bottom-3 + RealTop);
{ end else if Ctl3D then begin
RenderCanvas.Pen.Color := BevelHighlight;
TPSMoveTo (RenderCanvas, Angle, RenderIn,
RealLeft, clRowCol[1,0].Bottom-3 + RealTop);
TPSLineTo (RenderCanvas, Angle, RenderIn,
RealRight, clRowCol[1,0].Bottom-3 + RealTop);
RenderCanvas.Pen.Color := BevelShadow;
TPSMoveTo (RenderCanvas, Angle, RenderIn,
RealLeft, clRowCol[1,0].Bottom-2 + RealTop);
TPSLineTo (RenderCanvas, Angle, RenderIn,
RealRight, clRowCol[1,0].Bottom-2 + RealTop);
end; }
end;
procedure DrawDay(R, C, I: Integer; Grayed: Boolean);
var
Cl: TColor;
OldIdx: Integer;
NewIdx: Integer;
S: string[10];
DrawRect: TRect;
TH: Integer;
begin
{avoid painting day number under buttons}
if cdoShowRevert in FOptions then
if (R = 8) and (C >= 3) then
Exit;
if cdoShowToday in FOptions then
if (R = 8) and (C >= 5) then
Exit;
{convert to a string and draw it centered in its rectangle}
S := IntToStr(clCalendar[I]);
if Grayed then
RenderCanvas.Font.Color := InactiveDayColor;
if not Grayed or (cdoShowInactive in FOptions) then begin
NewIdx := ((R-2) * 7) + Succ(C);
OldIdx := clFirst + Pred(clDay);
if Assigned(FOnGetHighlight) then begin
Cl := RenderCanvas.Font.Color;
FOnGetHighlight(Self, RenderDate+(NewIdx-OldIdx), Cl);
RenderCanvas.Font.Color := Cl;
end;
if Assigned(FOnDrawItem) then
FOnDrawItem(Self, RenderDate+(NewIdx-OldIdx), clRowCol[R,C])
else if clRowCol[R, C].Top <> 0 then begin
DrawRect := Rect (clRowCol[R, C].Left + RealLeft,
clRowCol[R, C].Top + RealTop,
clRowCol[R, C].Right + RealLeft,
clRowCol[R, C].Bottom + RealTop);
TH := RenderCanvas.TextHeight (S);
if TH < DrawRect.Bottom - DrawRect.Top then
DrawRect.Top := DrawRect.Top +
((DrawRect.Bottom - DrawRect.Top) - TH) div 2;
TPSCenteredTextOut(RenderCanvas, Angle, RenderIn, DrawRect, S);
end;
end;
end;
procedure DrawFocusBox;
var
R: TRect;
S: string[10];
begin
S := IntToStr(clDay);
{ set highlight color and font style for days with events }
RenderCanvas.Font.Style := RenderCanvas.Font.Style - [fsBold];
lBadDate := false;
if (DataStore <> nil) and (DataStore.Resource <> nil) then begin
DecodeDate(RenderDate, Y, M, D);
try
{$IFDEF VERSION6}
if not TryEncodeDate (Y, M, clDay, lDate) then
lBadDate := true;
{$ELSE}
lDate := EncodeDate(Y, M, clDay);
{$ENDIF}
except
lBadDate := true;
end;
if (not lBadDate) and (DataStore.Resource.Schedule.EventCountByDay(lDate) > 0)
then begin
RenderCanvas.Font.Style := RenderCanvas.Font.Style + [fsBold, fsUnderline];
RenderCanvas.Font.Color := EventDayColor;
end else
RenderCanvas.Font.Style := RenderCanvas.Font.Style - [fsBold, fsUnderline];
end;
R := calGetCurrentRectangle;
R.Left := R.Left + RealLeft;
R.Top := R.Top + RealTop;
R.Right := R.Right + RealLeft;
R.Bottom := R.Bottom + RealTop;
R := TPSRotateRectangle (Angle, RenderIn, R);
if not DisplayOnly then begin
{$IFNDEF LCL}
if Focused then
DrawButtonFace (RenderCanvas, R, 1, bsNew, True, True, False)
else
DrawButtonFace (RenderCanvas, R, 1, bsNew, True, False, False);
{$ENDIF}
R := calGetCurrentRectangle;
R.Left := R.Left + RealLeft;
R.Top := R.Top + RealTop;
R.Right := R.Right + RealLeft;
R.Bottom := R.Bottom + RealTop;
TPSCenteredTextOut (RenderCanvas, Angle, RenderIn, R, S);
end;
end;
var
Row: TRowArray;
Col: TColArray;
begin
if DisplayOnly then begin
BevelHighlight := clBlack;
BevelShadow := clBlack;
InactiveDayColor := clSilver;
MonthYearColor := clBlack;
DayNameColor := clBlack;
LineColor := clBlack;
EventDayColor := clBlack;
DayColor := clBlack;
RealColor := clWhite;
WeekendColor := $5f5f5f;
end else begin
BevelHighlight := clBtnHighlight;
BevelShadow := clBtnShadow;
InactiveDayColor := FColors.InactiveDays;
MonthYearColor := FColors.MonthAndYear;
DayNameColor := FColors.DayNames;
LineColor := Font.Color;
EventDayColor := FColors.EventDays;
DayColor := FColors.Days;
RealColor := Color;
WeekendColor := FColors.WeekEnd;
end;
calRebuildCalArray (RenderDate);
RenderCanvas.Pen.Style := psSolid;
RenderCanvas.Pen.Width := 1;
RenderCanvas.Pen.Mode := pmCopy;
RenderCanvas.Brush.Style := bsSolid;
RenderCanvas.Lock;
try
SetMeasurements;
RenderCanvas.Font.Assign (Font);
if (RealRight - RealLeft <> FLastRenderX) or
(RealBottom - RealTop <> FLastRenderY)
then begin
FLastRenderX := RealRight - RealLeft;
FLastRenderY := RealBottom - RealTop;
CalculateSizes (RenderCanvas, Angle, RenderIn, Row, Col, DisplayOnly);
end;
RenderCanvas.Brush.Color := RealColor;
RenderCanvas.FillRect(RenderIn);
{draw the month and year at the top of the calendar}
DrawDate;
{draw the days of the week}
DrawDayNames;
{draw line under day names}
DrawLine;
{draw each day}
I := 1;
for R := 2 to 8 do
for C := 0 to 6 do begin
if ((C = SatCol) and (cdoHighlightSat in Options)) or
((C = SunCol) and (cdoHighlightSun in Options))
then
RenderCanvas.Font.Color := WeekendColor
else
RenderCanvas.Font.Color := DayColor;
{ set highlight color and font style for days with events }
RenderCanvas.Font.Style := RenderCanvas.Font.Style - [fsBold];
lBadDate := false;
if (DataStore <> nil) and (DataStore.Resource <> nil) then begin
DecodeDate(RenderDate, Y, M, D);
try begin
{$IFDEF VERSION6}
if not TryEncodeDate (Y, M, clCalendar[I], lDate) then
lBadDate := True;
{$ELSE}
if clCalendar[I] > DaysInMonth(Y, M) then
lDate := EncodeDate(Y, M, DaysInMonth(Y, M))
else
lDate := EncodeDate(Y, M, clCalendar[I]);
{$ENDIF}
end;
except
lBadDate := true;
end;
if (not lBadDate) and (DataStore.Resource.Schedule.EventCountByDay(lDate) > 0)
then begin
RenderCanvas.Font.Style := RenderCanvas.Font.Style + [fsBold, fsUnderline];
RenderCanvas.Font.Color := EventDayColor;
end else
RenderCanvas.Font.Style := RenderCanvas.Font.Style - [fsBold, fsUnderline];
end;
DrawDay(R, C, I, (I < clFirst) or (I > clLast));
Inc(I);
end;
RenderCanvas.Font.Color := DayColor;
if not Assigned(FOnDrawItem) then
if not (cdoHideActive in FOptions) then
DrawFocusBox;
finally
RenderCanvas.Unlock;
end;
end;
{=====}
*)
procedure TVpCustomCalendar.SetBorderStyle(Value: TBorderStyle);
begin

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff