You've already forked lazarus-ccr
tvplanit: Lots of cosmetic changes
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4771 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -159,6 +159,10 @@ msgctxt "vpsr.rscalendartoday"
|
||||
msgid "Today"
|
||||
msgstr "Heute"
|
||||
|
||||
#: vpsr.rscalendarweekabbr
|
||||
msgid "CW"
|
||||
msgstr "KW"
|
||||
|
||||
#: vpsr.rscancelbtn
|
||||
msgid "Cancel"
|
||||
msgstr "Abbrechen"
|
||||
|
@ -149,6 +149,10 @@ msgctxt "vpsr.rscalendartoday"
|
||||
msgid "Today"
|
||||
msgstr ""
|
||||
|
||||
#: vpsr.rscalendarweekabbr
|
||||
msgid "CW"
|
||||
msgstr ""
|
||||
|
||||
#: vpsr.rscancelbtn
|
||||
msgid "Cancel"
|
||||
msgstr ""
|
||||
|
@ -255,8 +255,8 @@ end;
|
||||
procedure TContactEditForm.PopulateSelf;
|
||||
var
|
||||
CurCountry: Integer;
|
||||
i : TVpPhoneType;
|
||||
j : TVpCategoryType;
|
||||
pt: TVpPhoneType;
|
||||
ct: TVpCategoryType;
|
||||
|
||||
begin
|
||||
NameEdit.Text := AssembleName(Contact);
|
||||
@ -296,12 +296,12 @@ begin
|
||||
cboxState.Text := Contact.State;
|
||||
|
||||
|
||||
for i := Low (TVpPhoneType) to High (TVpPhoneType) do begin
|
||||
cboxPhoneLbl1.Items.Add (PhoneLabel (i));
|
||||
cboxPhoneLbl2.Items.Add (PhoneLabel (i));
|
||||
cboxPhoneLbl3.Items.Add (PhoneLabel (i));
|
||||
cboxPhoneLbl4.Items.Add (PhoneLabel (i));
|
||||
cboxPhoneLbl5.Items.Add (PhoneLabel (i));
|
||||
for pt := Low (TVpPhoneType) to High (TVpPhoneType) do begin
|
||||
cboxPhoneLbl1.Items.Add(PhoneLabel(pt));
|
||||
cboxPhoneLbl2.Items.Add(PhoneLabel(pt));
|
||||
cboxPhoneLbl3.Items.Add(PhoneLabel(pt));
|
||||
cboxPhoneLbl4.Items.Add(PhoneLabel(pt));
|
||||
cboxPhoneLbl5.Items.Add(PhoneLabel(pt));
|
||||
end;
|
||||
cboxPhoneLbl1.ItemIndex := Contact.PhoneType1;
|
||||
cboxPhoneLbl2.ItemIndex := Contact.PhoneType2;
|
||||
@ -309,8 +309,8 @@ begin
|
||||
cboxPhoneLbl4.ItemIndex := Contact.PhoneType4;
|
||||
cboxPhoneLbl5.ItemIndex := Contact.PhoneType5;
|
||||
|
||||
for j := Low (TVpCategoryType) to High (TVpCategoryType) do
|
||||
cboxCategory.Items.Add (CategoryLabel (j));
|
||||
for ct := Low (TVpCategoryType) to High (TVpCategoryType) do
|
||||
cboxCategory.Items.Add(CategoryLabel(ct));
|
||||
cboxCategory.ItemIndex := Contact.Category;
|
||||
|
||||
DisplayCurrentCountry;
|
||||
@ -375,8 +375,7 @@ var
|
||||
Labels: TLabelArray;
|
||||
LargestLabel: Integer;
|
||||
WidestField: Integer;
|
||||
i : Integer;
|
||||
j : Integer;
|
||||
i, j: Integer;
|
||||
OldFont: TFont;
|
||||
FieldTop: Integer;
|
||||
delta: Integer;
|
||||
@ -427,7 +426,8 @@ begin
|
||||
OldFont.Free;
|
||||
end;
|
||||
if (cboxCountry.Left + cboxCountry.Width + FormRightBorder > MinFormWidth) and
|
||||
(not cboxState.Visible) then
|
||||
(not cboxState.Visible)
|
||||
then
|
||||
Width := cboxCountry.Left + cboxCountry.Width + FormRightBorder
|
||||
else
|
||||
Width := MinFormWidth;
|
||||
@ -454,7 +454,8 @@ begin
|
||||
OldFont.Free;
|
||||
end;
|
||||
if (cboxState.Left + cboxState.Width + FormRightBorder > MinFormWidth) and
|
||||
(not cboxCountry.Visible) then
|
||||
(not cboxCountry.Visible)
|
||||
then
|
||||
Width := cboxState.Left + cboxState.Width + FormRightBorder
|
||||
else
|
||||
Width := MinFormWidth;
|
||||
@ -502,7 +503,6 @@ end;
|
||||
procedure TContactEditForm.DisplayCurrentCountry;
|
||||
var
|
||||
Idx : Integer;
|
||||
|
||||
begin
|
||||
if not Assigned(ControlLink) then
|
||||
Exit;
|
||||
|
@ -1085,7 +1085,8 @@ begin
|
||||
with ContactsTable do begin
|
||||
SetFilterCriteria(ContactsTable, False,
|
||||
ResourceTable.FieldByName('ResourceID').AsInteger,
|
||||
0, 0);
|
||||
0, 0
|
||||
);
|
||||
First;
|
||||
while not EOF do begin
|
||||
Contact := Resource.Contacts.AddContact(GetNextID(ContactsTableName));
|
||||
@ -1147,7 +1148,8 @@ begin
|
||||
with TasksTable do begin
|
||||
SetFilterCriteria(TasksTable, False,
|
||||
ResourceTable.FieldByName('ResourceID').AsInteger,
|
||||
0, 0);
|
||||
0, 0
|
||||
);
|
||||
First;
|
||||
while not EOF do begin
|
||||
Task := Resource.Tasks.AddTask(GetNextID(TasksTableName));
|
||||
@ -1187,8 +1189,7 @@ begin
|
||||
if (Resource <> nil) and Resource.ContactsDirty then begin
|
||||
{ Dump this resource's dirty contacts to the DB }
|
||||
if ResourceTable.Locate('ResourceID', Resource.ResourceID, []) then begin
|
||||
SetFilterCriteria(ContactsTable, False, Resource.ResourceID,
|
||||
0, 0);
|
||||
SetFilterCriteria(ContactsTable, False, Resource.ResourceID, 0, 0);
|
||||
|
||||
for I := pred(Resource.Contacts.Count) downto 0 do begin
|
||||
Contact := Resource.Contacts.GetContact(I);
|
||||
@ -1296,8 +1297,7 @@ begin
|
||||
{ Dump this resource's dirty events to the DB }
|
||||
if ResourceTable.Locate('ResourceID', Resource.ResourceID, [])
|
||||
then begin
|
||||
SetFilterCriteria(EventsTable, False, Resource.ResourceID,
|
||||
0, 0);
|
||||
SetFilterCriteria(EventsTable, False, Resource.ResourceID, 0, 0);
|
||||
|
||||
for J := pred(Resource.Schedule.EventCount) downto 0 do begin
|
||||
Event := Resource.Schedule.GetEvent(J);
|
||||
@ -1388,8 +1388,7 @@ begin
|
||||
{ Dump this resource's dirty contacts to the DB }
|
||||
if ResourceTable.Locate('ResourceID', Resource.ResourceID, [])
|
||||
then begin
|
||||
SetFilterCriteria(TasksTable, False, Resource.ResourceID,
|
||||
0, 0);
|
||||
SetFilterCriteria(TasksTable, False, Resource.ResourceID, 0, 0);
|
||||
|
||||
for I := pred(Resource.Tasks.Count) downto 0 do begin
|
||||
Task := Resource.Tasks.GetTask(I);
|
||||
@ -1406,8 +1405,7 @@ begin
|
||||
if Task.Changed then begin
|
||||
if TasksTable.Locate('RecordID', Task.RecordID, [])
|
||||
then
|
||||
{ this event already exists in the database so }
|
||||
{ update it }
|
||||
{ this event already exists in the database so update it }
|
||||
TasksTable.Edit
|
||||
else
|
||||
{ this record doesn't exist in the database, so }
|
||||
@ -1603,8 +1601,7 @@ begin
|
||||
SetFilterCriteria(ContactsTable, False, Resource.ResourceID, 0, 0);
|
||||
First;
|
||||
while not EOF do begin
|
||||
Contact := Resource.Contacts.AddContact(
|
||||
FieldByName('RecordID').AsInteger);
|
||||
Contact := Resource.Contacts.AddContact(FieldByName('RecordID').AsInteger);
|
||||
Contact.Loading := true;
|
||||
// Contact.RecordID := FieldByName('RecordID').AsInteger;
|
||||
Contact.FirstName := FieldByName('FirstName').AsString;
|
||||
@ -1668,9 +1665,7 @@ begin
|
||||
|
||||
{ Load this resource's events into memory }
|
||||
with EventsTable do begin
|
||||
SetFilterCriteria(EventsTable, True, Resource.ResourceID,
|
||||
TimeRange.StartTime,
|
||||
TimeRange.EndTime);
|
||||
SetFilterCriteria(EventsTable, True, Resource.ResourceID, TimeRange.StartTime, TimeRange.EndTime);
|
||||
First;
|
||||
|
||||
while not EventsTable.EOF do
|
||||
@ -1678,7 +1673,8 @@ begin
|
||||
Event := Resource.Schedule.AddEvent(
|
||||
FieldByName('RecordID').AsInteger,
|
||||
FieldByName('StartTime').AsDateTime,
|
||||
FieldByName('EndTime').AsDateTime);
|
||||
FieldByName('EndTime').AsDateTime
|
||||
);
|
||||
if Event <> nil then begin
|
||||
Event.Loading := true; {prevents the events changed flag from being set}
|
||||
// Event.RecordID := FieldByName('RecordID').AsInteger;
|
||||
@ -1729,8 +1725,7 @@ begin
|
||||
SetFilterCriteria(TasksTable, False, Resource.ResourceID, 0, 0);
|
||||
First;
|
||||
while not EOF do begin
|
||||
Task := Resource.Tasks.AddTask(
|
||||
FieldByName('RecordID').AsInteger);
|
||||
Task := Resource.Tasks.AddTask(FieldByName('RecordID').AsInteger);
|
||||
Task.Loading := true;
|
||||
// Task.RecordID := FieldByName('RecordID').AsInteger;
|
||||
Task.Complete := FieldByName('Complete').AsBoolean;
|
||||
|
@ -116,6 +116,7 @@ type
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure StartTimeExit(Sender: TObject);
|
||||
procedure EndTimeExit(Sender: TObject);
|
||||
|
||||
private { Private declarations }
|
||||
{$IFDEF LCL}
|
||||
StartTime: TTimeEdit;
|
||||
@ -132,8 +133,10 @@ type
|
||||
procedure PopLists;
|
||||
procedure LoadCaptions;
|
||||
procedure DoPlaySound(Sender: TObject; const AWavFile: String; AMode: TVpPlaySoundMode);
|
||||
|
||||
protected
|
||||
property Datastore: TVpCustomDatastore read FDatastore write FDatastore;
|
||||
|
||||
public { Public declarations }
|
||||
Event: TVpEvent;
|
||||
CatColorMap: TVpCategoryColorMap;
|
||||
@ -461,7 +464,6 @@ procedure TDlgEventEdit.EndTimeChange(Sender: TObject);
|
||||
|
||||
var
|
||||
ET: TDateTime;
|
||||
|
||||
begin
|
||||
{ Verify the value is valid }
|
||||
try
|
||||
@ -643,7 +645,6 @@ begin
|
||||
if Visible then
|
||||
FCustomInterval.SetFocus;
|
||||
end;
|
||||
|
||||
end;
|
||||
{=====}
|
||||
|
||||
@ -746,7 +747,9 @@ begin
|
||||
Result := false;
|
||||
if DataStore <> nil then begin
|
||||
ceEvent := DataStore.Resource.Schedule.AddEvent(
|
||||
DataStore.GetNextID(EventsTableName), StartTime, EndTime);
|
||||
DataStore.GetNextID(EventsTableName),
|
||||
StartTime, EndTime
|
||||
);
|
||||
if ceEvent <> nil then begin
|
||||
Result := Execute(ceEvent);
|
||||
if (not Result) or (ceEvent = nil) then
|
||||
|
@ -123,6 +123,7 @@ resourcestring
|
||||
RSMinutes = 'Minutes';
|
||||
RSHours = 'Hours';
|
||||
RSDays = 'Days';
|
||||
RSCalendarWeekAbbr = 'CW'; // Abbreviation of "calendar week"
|
||||
|
||||
{WARNINGS}
|
||||
RSPermanent = 'This operation cannot be undone!';
|
||||
|
@ -145,13 +145,11 @@ begin
|
||||
DetailsMemo.Text := Task.Details;
|
||||
CompleteCB.Checked := Task.Complete;
|
||||
if Task.CompletedOn <> 0 then
|
||||
CompletedOnLbl.Caption := RSCompletedOn + ' ' +
|
||||
FormatDateTime(ShortDateFormat, Task.CompletedOn)
|
||||
CompletedOnLbl.Caption := RSCompletedOn + ' ' + FormatDateTime(ShortDateFormat, Task.CompletedOn)
|
||||
else
|
||||
CompletedOnLbl.Visible := False;
|
||||
CompletedOnLbl.Visible := CompleteCB.Checked;
|
||||
CreatedOnLbl.Caption := RSCreatedOn + ' ' +
|
||||
FormatDateTime(ShortDateFormat, Task.CreatedOn);
|
||||
CreatedOnLbl.Caption := RSCreatedOn + ' ' + FormatDateTime(ShortDateFormat, Task.CreatedOn);
|
||||
|
||||
DueDateEdit.Left := DueDateLbl.Left + GetLabelWidth(DueDateLbl) + 8;
|
||||
end;
|
||||
@ -198,8 +196,8 @@ var
|
||||
begin
|
||||
Result := false;
|
||||
teTask := Task;
|
||||
if (teTask <> nil) and (DataStore <> nil) and
|
||||
(DataStore.Resource <> nil) then begin
|
||||
if (teTask <> nil) and (DataStore <> nil) and (DataStore.Resource <> nil) then
|
||||
begin
|
||||
Application.CreateForm(TTaskEditForm, TaskEditForm);
|
||||
try
|
||||
DoFormPlacement(TaskEditForm);
|
||||
|
@ -211,6 +211,7 @@ type
|
||||
//TODO: Bug 0020755 braks this in GTK2...
|
||||
procedure WMRButtonDown(var Msg : TLMRButtonDown); message LM_RBUTTONDOWN;
|
||||
{$ENDIF}
|
||||
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
@ -218,77 +219,44 @@ type
|
||||
procedure DeleteActiveEvent(Verify: Boolean);
|
||||
procedure Invalidate; override;
|
||||
procedure LinkHandler(Sender: TComponent;
|
||||
NotificationType: TVpNotificationType;
|
||||
const Value: Variant); override;
|
||||
NotificationType: TVpNotificationType; const Value: Variant); override;
|
||||
function GetControlType: TVpItemType; override;
|
||||
procedure EditSelectedEvent;
|
||||
procedure PaintToCanvas (ACanvas : TCanvas;
|
||||
ARect : TRect;
|
||||
Angle : TVpRotationAngle;
|
||||
ADate : TDateTime);
|
||||
procedure RenderToCanvas (RenderCanvas : TCanvas;
|
||||
RenderIn : TRect;
|
||||
Angle : TVpRotationAngle;
|
||||
Scale : Extended;
|
||||
RenderDate : TDateTime;
|
||||
StartLine : Integer;
|
||||
StopLine : Integer;
|
||||
UseGran : TVpGranularity;
|
||||
procedure PaintToCanvas(ACanvas: TCanvas; ARect: TRect;
|
||||
Angle: TVpRotationAngle; ADate: TDateTime);
|
||||
procedure RenderToCanvas(RenderCanvas: TCanvas; RenderIn: TRect;
|
||||
Angle: TVpRotationAngle; Scale: Extended; RenderDate: TDateTime;
|
||||
StartLine: Integer; StopLine: Integer; UseGran: TVpGranularity;
|
||||
DisplayOnly: Boolean); override;
|
||||
property ActiveEvent: TVpEvent read FaActiveEvent write SetActiveEvent;
|
||||
property Date: TDateTime read FActiveDate write SetActiveDate;
|
||||
property VisibleLines: Integer read FVisibleLines;
|
||||
|
||||
published
|
||||
property AllDayEventAttributes: TVpAllDayEventAttributes
|
||||
read FAllDayEventAttr write FAllDayEventAttr;
|
||||
property Color: TColor read FColor write SetColor;
|
||||
property DateLabelFormat: string read FDateLabelFormat write SetDateLabelFormat;
|
||||
property DayHeadAttributes: TVpDayHeadAttr read FDayHeadAttributes write FDayHeadAttributes;
|
||||
property DrawingStyle: TVpDrawingStyle read FDrawingStyle write SetDrawingStyle stored True;
|
||||
property EventFont: TFont read FEventFont write SetEventFont;
|
||||
property HeadAttributes: TVpWvHeadAttributes read FHeadAttr write FHeadAttr;
|
||||
property LineColor: TColor read FLineColor write SetLineColor;
|
||||
property TimeFormat: TVpTimeFormat read FTimeFormat write SetTimeFormat;
|
||||
property ShowEventTime: Boolean read FShowEventTime write SetShowEventTime;
|
||||
property WeekStartsOn: TVpDayType read FWeekStartsOn write SetWeekStartsOn;
|
||||
|
||||
{inherited properties}
|
||||
property Align;
|
||||
property Anchors;
|
||||
property TabStop;
|
||||
property TabOrder;
|
||||
|
||||
property Color: TColor
|
||||
read FColor write SetColor;
|
||||
|
||||
property DateLabelFormat: string
|
||||
read FDateLabelFormat write SetDateLabelFormat;
|
||||
|
||||
property DayHeadAttributes: TVpDayHeadAttr
|
||||
read FDayHeadAttributes write FDayHeadAttributes;
|
||||
|
||||
property DrawingStyle: TVpDrawingStyle
|
||||
read FDrawingStyle write SetDrawingStyle stored True;
|
||||
|
||||
property EventFont: TFont
|
||||
read FEventFont write SetEventFont;
|
||||
|
||||
property HeadAttributes: TVpWvHeadAttributes
|
||||
read FHeadAttr write FHeadAttr;
|
||||
|
||||
property LineColor: TColor
|
||||
read FLineColor write SetLineColor;
|
||||
|
||||
property TimeFormat: TVpTimeFormat
|
||||
read FTimeFormat write SetTimeFormat;
|
||||
|
||||
property ShowEventTime: Boolean
|
||||
read FShowEventTime write SetShowEventTime;
|
||||
|
||||
property WeekStartsOn: TVpDayType
|
||||
read FWeekStartsOn write SetWeekStartsOn;
|
||||
|
||||
{events}
|
||||
property AfterEdit : TVpAfterEditEvent
|
||||
read FAfterEdit write FAfterEdit;
|
||||
|
||||
property BeforeEdit: TVpBeforeEditEvent
|
||||
read FBeforeEdit write FBeforeEdit;
|
||||
|
||||
property OnAddEvent: TVpOnAddNewEvent
|
||||
read FOnAddEvent write FOnAddEvent;
|
||||
|
||||
property OnOwnerEditEvent: TVpEditEvent
|
||||
read FOwnerEditEvent write FOwnerEditEvent;
|
||||
property AfterEdit : TVpAfterEditEvent read FAfterEdit write FAfterEdit;
|
||||
property BeforeEdit: TVpBeforeEditEvent read FBeforeEdit write FBeforeEdit;
|
||||
property OnAddEvent: TVpOnAddNewEvent read FOnAddEvent write FOnAddEvent;
|
||||
property OnOwnerEditEvent: TVpEditEvent read FOwnerEditEvent write FOwnerEditEvent;
|
||||
|
||||
end;
|
||||
|
||||
@ -325,22 +293,26 @@ begin
|
||||
Grid := TVpWeekView(Owner);
|
||||
|
||||
case Key of
|
||||
VK_RETURN: begin
|
||||
VK_RETURN:
|
||||
begin
|
||||
Key := 0;
|
||||
Grid.EndEdit(Self);
|
||||
end;
|
||||
|
||||
VK_UP: begin
|
||||
VK_UP:
|
||||
begin
|
||||
Key := 0;
|
||||
Grid.EndEdit(Self);
|
||||
end;
|
||||
|
||||
VK_DOWN: begin
|
||||
VK_DOWN:
|
||||
begin
|
||||
Key := 0;
|
||||
Grid.EndEdit(Self);
|
||||
end;
|
||||
|
||||
VK_ESCAPE: begin
|
||||
VK_ESCAPE:
|
||||
begin
|
||||
Key := 0;
|
||||
Grid.EndEdit(self);
|
||||
end;
|
||||
@ -455,7 +427,7 @@ begin
|
||||
FColumnWidth := 200;
|
||||
|
||||
{ set up fonts and colors }
|
||||
FDayHeadAttributes.Font.Name := 'Tahoma';
|
||||
// FDayHeadAttributes.Font.Name := 'Tahoma';
|
||||
FDayHeadAttributes.Font.Size := 10;
|
||||
FDayHeadAttributes.Font.Style := [];
|
||||
FDayHeadAttributes.Color := clBtnFace;
|
||||
@ -515,9 +487,7 @@ begin
|
||||
wvInLinkHandler := true;
|
||||
try
|
||||
case NotificationType of
|
||||
neDateChange: begin
|
||||
Date := Value;
|
||||
end;
|
||||
neDateChange : Date := Value;
|
||||
neDataStoreChange : Invalidate;
|
||||
neInvalidate : Invalidate;
|
||||
end;
|
||||
@ -558,7 +528,8 @@ end;
|
||||
|
||||
procedure TVpWeekView.Paint;
|
||||
begin
|
||||
RenderToCanvas (Canvas, // Paint Canvas
|
||||
RenderToCanvas(
|
||||
Canvas, // Paint Canvas
|
||||
Rect (0, 0, Width, Height), // Paint Rectangle
|
||||
ra0,
|
||||
1, // Scale
|
||||
@ -566,27 +537,21 @@ begin
|
||||
-1, // Start At
|
||||
-1, // End At
|
||||
gr30Min,
|
||||
False); // Display Only
|
||||
end;
|
||||
{=====}
|
||||
procedure TVpWeekView.PaintToCanvas (ACanvas : TCanvas;
|
||||
ARect : TRect;
|
||||
Angle : TVpRotationAngle;
|
||||
ADate : TDateTime);
|
||||
begin
|
||||
RenderToCanvas (ACanvas, ARect, Angle, 1, ADate,
|
||||
-1, -1, gr30Min, True);
|
||||
False // Display Only
|
||||
);
|
||||
end;
|
||||
{=====}
|
||||
|
||||
procedure TVpWeekView.RenderToCanvas (RenderCanvas : TCanvas;
|
||||
RenderIn : TRect;
|
||||
Angle : TVpRotationAngle;
|
||||
Scale : Extended;
|
||||
RenderDate : TDateTime;
|
||||
StartLine : Integer;
|
||||
StopLine : Integer;
|
||||
UseGran : TVpGranularity;
|
||||
procedure TVpWeekView.PaintToCanvas(ACanvas: TCanvas; ARect: TRect;
|
||||
Angle: TVpRotationAngle; ADate: TDateTime);
|
||||
begin
|
||||
RenderToCanvas(ACanvas, ARect, Angle, 1, ADate, -1, -1, gr30Min, True);
|
||||
end;
|
||||
{=====}
|
||||
|
||||
procedure TVpWeekView.RenderToCanvas(RenderCanvas: TCanvas; RenderIn: TRect;
|
||||
Angle: TVpRotationAngle; Scale: Extended; RenderDate: TDateTime;
|
||||
StartLine: Integer; StopLine: Integer; UseGran: TVpGranularity;
|
||||
DisplayOnly: Boolean);
|
||||
var
|
||||
HeadRect: TRect;
|
||||
@ -618,8 +583,7 @@ var
|
||||
ADEventBackgroundColor: TColor;
|
||||
ADEventBorderColor: TColor;
|
||||
|
||||
function DrawAllDayEvents ( ADate : TDateTime;
|
||||
DayRect : TRect;
|
||||
function DrawAllDayEvents(ADate: TDateTime; DayRect: TRect;
|
||||
var EAIndex: Integer): Boolean;
|
||||
var
|
||||
ADEventsList: TList;
|
||||
@ -632,7 +596,6 @@ var
|
||||
Skip: Boolean;
|
||||
ADTextHeight: Integer;
|
||||
EventStr: string;
|
||||
|
||||
begin
|
||||
Result := False;
|
||||
{ initialize the All Day Events area... }
|
||||
@ -680,16 +643,14 @@ var
|
||||
RenderCanvas.Font.Assign(AllDayEventAttributes.Font);
|
||||
|
||||
{ Measure the AllDayEvent TextHeight }
|
||||
ADTextHeight := RenderCanvas.TextHeight(VpProductName) +
|
||||
TextMargin + TextMargin div 2;
|
||||
ADTextHeight := RenderCanvas.TextHeight(VpProductName) + TextMargin + TextMargin div 2;
|
||||
|
||||
{ Build the AllDayEvent rect based on the value of MaxADEvents }
|
||||
if AdEventsRect.Top + (MaxADEvents * ADTextHeight) +
|
||||
TextMargin * 2 > DayRect.Bottom then
|
||||
if AdEventsRect.Top + (MaxADEvents * ADTextHeight) + TextMargin * 2 > DayRect.Bottom
|
||||
then
|
||||
ADeventsrect.Bottom := DayRect.Bottom
|
||||
else
|
||||
ADEventsRect.Bottom := AdEventsRect.Top +
|
||||
(MaxADEvents * ADTextHeight) + TextMargin * 2;
|
||||
ADEventsRect.Bottom := AdEventsRect.Top + (MaxADEvents * ADTextHeight) + TextMargin * 2;
|
||||
|
||||
{ Clear the AllDayEvents area }
|
||||
TpsFillRect(RenderCanvas, Angle, RenderIn, ADEventsRect);
|
||||
@ -697,26 +658,21 @@ var
|
||||
StartsBeforeRange := false;
|
||||
{ Cycle through the all day events and draw them appropriately }
|
||||
for I := 0 to pred(ADEventsList.Count) do begin
|
||||
|
||||
Event := ADEventsList[I];
|
||||
|
||||
{ set the top of the event's rect }
|
||||
AdEventRect.Top := ADEventsRect.Top + TextMargin +
|
||||
(I * ADTextHeight);
|
||||
AdEventRect.Top := ADEventsRect.Top + TextMargin + I * ADTextHeight;
|
||||
|
||||
if ADEventsRect.Top + TextMargin + ((I + 1) * ADTextHeight) -
|
||||
TextMargin > DayRect.Bottom then begin
|
||||
if ADEventsRect.Top + TextMargin + ((I + 1) * ADTextHeight) - TextMargin > DayRect.Bottom
|
||||
then begin
|
||||
RenderCanvas.Brush.Color := DotDotDotColor;
|
||||
{ draw dot dot dot }
|
||||
TPSFillRect(RenderCanvas, Angle, RenderIn,
|
||||
Rect (DayRect.Right - 20, DayRect.Bottom - 7,
|
||||
DayRect.Right - 17, DayRect.Bottom - 4));
|
||||
Rect(DayRect.Right - 20, DayRect.Bottom - 7, DayRect.Right - 17, DayRect.Bottom - 4));
|
||||
TPSFillRect(RenderCanvas, Angle, RenderIn,
|
||||
Rect (DayRect.Right - 13, DayRect.Bottom - 7,
|
||||
DayRect.Right - 10, DayRect.Bottom - 4));
|
||||
Rect(DayRect.Right - 13, DayRect.Bottom - 7, DayRect.Right - 10, DayRect.Bottom - 4));
|
||||
TPSFillRect(RenderCanvas, Angle, RenderIn,
|
||||
Rect (DayRect.Right - 6, DayRect.Bottom - 7,
|
||||
DayRect.Right - 3, DayRect.Bottom - 4));
|
||||
Rect(DayRect.Right - 6, DayRect.Bottom - 7, DayRect.Right - 3, DayRect.Bottom - 4));
|
||||
break;
|
||||
end;
|
||||
|
||||
@ -741,16 +697,20 @@ var
|
||||
ADEventRect.Left + TextMargin,
|
||||
ADEventRect.Top + TextMargin div 2,
|
||||
ADEventRect.Right - TextMargin,
|
||||
ADEventRect.Top + ADTextHeight + TextMargin div 2);
|
||||
ADEventRect.Top + ADTextHeight + TextMargin div 2
|
||||
);
|
||||
TPSTextOut(RenderCanvas,Angle, RenderIn,
|
||||
AdEventRect.Left + TextMargin * 2 + TextMargin div 2,
|
||||
AdEventRect.Top + TextMargin,
|
||||
EventStr);
|
||||
EventStr
|
||||
);
|
||||
Result := True;
|
||||
wvEventArray[EAIndex].Rec := Rect (ADEventRect.Left + TextMargin,
|
||||
wvEventArray[EAIndex].Rec := Rect(
|
||||
ADEventRect.Left + TextMargin,
|
||||
ADEventRect.Top + TextMargin,
|
||||
ADEventRect.Right - TextMargin,
|
||||
ADEventRect.Bottom);
|
||||
ADEventRect.Bottom
|
||||
);
|
||||
wvEventArray[EAIndex].Event := Event;
|
||||
Inc(EAIndex);
|
||||
end; { for I := 0 to pred(ADEventsList.Count) do ... }
|
||||
@ -794,13 +754,14 @@ var
|
||||
{ build the first dayrect }
|
||||
DayRectHeight := (RealBottom - RealTop - wvHeaderHeight) div 3;
|
||||
if DrawingStyle = ds3D then
|
||||
DayRect.TopLeft := Point (RealLeft + 1,
|
||||
RealTop + wvHeaderHeight + 3)
|
||||
DayRect.TopLeft := Point(RealLeft + 1, RealTop + wvHeaderHeight + 3)
|
||||
else
|
||||
DayRect.TopLeft := Point (RealLeft + 1,
|
||||
RealTop + wvHeaderHeight + 2);
|
||||
DayRect.BottomRight := Point ((RealLeft + (RealRight - RealLeft) div 2) + 1,
|
||||
RealTop + wvHeaderHeight + DayRectHeight);
|
||||
DayRect.TopLeft := Point(RealLeft + 1, RealTop + wvHeaderHeight + 2);
|
||||
DayRect.BottomRight := Point(
|
||||
RealLeft + (RealRight - RealLeft) div 2 + 1,
|
||||
RealTop + wvHeaderHeight + DayRectHeight
|
||||
);
|
||||
|
||||
{ draw the day frames }
|
||||
for I := 0 to 6 do begin
|
||||
{ draw day head}
|
||||
@ -817,38 +778,31 @@ var
|
||||
DayStr := SysToUTF8(FormatDateTime(FDayHeadAttributes.DateFormat, StartDate + I));
|
||||
{$ENDIF}
|
||||
SL := RenderCanvas.TextWidth(DayStr);
|
||||
if SL > TextRect.Right - TextRect.Left then begin
|
||||
DayStr := GetDisplayString(RenderCanvas, DayStr, 0, TextRect.Right -
|
||||
TextRect.Left - TextMargin);
|
||||
end;
|
||||
if SL > TextRect.Right - TextRect.Left then
|
||||
DayStr := GetDisplayString(RenderCanvas, DayStr, 0, TextRect.Right - TextRect.Left - TextMargin);
|
||||
SL := RenderCanvas.TextWidth(DayStr);
|
||||
TextRect.Left := TextRect.Right - SL - TextMargin;
|
||||
TPSTextOut(RenderCanvas, Angle, RenderIn,
|
||||
TextRect.Left, TextRect.Top + TextMargin - 1, DayStr);
|
||||
TextRect.Left, TextRect.Top + TextMargin - 1, DayStr
|
||||
);
|
||||
|
||||
if (DataStore <> nil) and (DataStore.Resource <> nil)
|
||||
and (DataStore.Resource.Schedule.EventCountByDay(StartDate + I) > 0)
|
||||
and (DayRect.Bottom - DayRect.Top >= (TextMargin * 2) + wvDayHeadHeight) then
|
||||
begin
|
||||
if (DataStore <> nil) and (DataStore.Resource <> nil) and
|
||||
(DataStore.Resource.Schedule.EventCountByDay(StartDate + I) > 0) and
|
||||
(DayRect.Bottom - DayRect.Top >= (TextMargin * 2) + wvDayHeadHeight)
|
||||
then begin
|
||||
{ events exist for this day }
|
||||
EventList := TList.Create;
|
||||
try
|
||||
{ populate the eventlist with events for this day }
|
||||
DataStore.Resource.Schedule.EventsByDate(StartDate + I, EventList);
|
||||
{ initialize TextRect for this day }
|
||||
TextRect.TopLeft := Point (DayRect.Left,
|
||||
DayRect.Top + wvDayHeadHeight);
|
||||
TextRect.BottomRight := Point (DayRect.Right,
|
||||
TextRect.Top + wvRowHeight);
|
||||
TextRect.TopLeft := Point(DayRect.Left, DayRect.Top + wvDayHeadHeight);
|
||||
TextRect.BottomRight := Point(DayRect.Right, TextRect.Top + wvRowHeight);
|
||||
|
||||
{ Handle All Day Events }
|
||||
if DrawAllDayEvents (StartDate + I,
|
||||
Rect (TextRect.Left,
|
||||
TextRect.Top,
|
||||
TextRect.Right,
|
||||
DayRect.Bottom),
|
||||
EAIndex) then begin
|
||||
TextRect.Bottom := TextRect.Bottom + (ADEventsRect.Bottom - TextRect.Top);
|
||||
if DrawAllDayEvents (StartDate + I, Rect(TextRect.Left, TextRect.Top, TextRect.Right, DayRect.Bottom), EAIndex)
|
||||
then begin
|
||||
TextRect.Bottom := TextRect.Bottom + ADEventsRect.Bottom - TextRect.Top;
|
||||
TextRect.Top := ADEventsRect.Bottom;
|
||||
end;
|
||||
|
||||
@ -866,14 +820,14 @@ var
|
||||
RenderCanvas.Brush.Color := DotDotDotColor;
|
||||
{ draw dot dot dot }
|
||||
TPSFillRect(RenderCanvas, Angle, RenderIn,
|
||||
Rect (DayRect.Right - 20, DayRect.Bottom - 7,
|
||||
DayRect.Right - 17, DayRect.Bottom - 4));
|
||||
Rect(DayRect.Right - 20, DayRect.Bottom - 7, DayRect.Right - 17, DayRect.Bottom - 4)
|
||||
);
|
||||
TPSFillRect(RenderCanvas, Angle, RenderIn,
|
||||
Rect (DayRect.Right - 13, DayRect.Bottom - 7,
|
||||
DayRect.Right - 10, DayRect.Bottom - 4));
|
||||
Rect(DayRect.Right - 13, DayRect.Bottom - 7, DayRect.Right - 10, DayRect.Bottom - 4)
|
||||
);
|
||||
TPSFillRect(RenderCanvas, Angle, RenderIn,
|
||||
Rect (DayRect.Right - 6, DayRect.Bottom - 7,
|
||||
DayRect.Right - 3, DayRect.Bottom - 4));
|
||||
Rect(DayRect.Right - 6, DayRect.Bottom - 7, DayRect.Right - 3, DayRect.Bottom - 4)
|
||||
);
|
||||
break;
|
||||
end;
|
||||
|
||||
@ -888,11 +842,11 @@ var
|
||||
if ShowEventTime then
|
||||
begin
|
||||
if TimeFormat = tf24Hour then
|
||||
DayStr := FormatDateTime('hh:nn',TodayStartTime)
|
||||
+ ' - ' + FormatDateTime('hh:nn',TodayEndTime) + ': '
|
||||
DayStr := FormatDateTime('hh:nn',TodayStartTime) + ' - ' +
|
||||
FormatDateTime('hh:nn',TodayEndTime) + ': '
|
||||
else
|
||||
DayStr := FormatDateTime('hh:nn AM/PM',TVpEvent(EventList.List^[j]).StartTime)
|
||||
+ ' - ' + FormatDateTime('hh:nn AM/PM',TVpEvent(EventList.List^[j]).EndTime) + ': ';
|
||||
DayStr := FormatDateTime('hh:nn AM/PM',TVpEvent(EventList.List^[j]).StartTime) + ' - ' +
|
||||
FormatDateTime('hh:nn AM/PM',TVpEvent(EventList.List^[j]).EndTime) + ': ';
|
||||
end;
|
||||
if DayStr = '' then
|
||||
DayStr := TVpEvent(EventList.List^[j]).Description
|
||||
@ -906,15 +860,13 @@ var
|
||||
|
||||
StrLn := RenderCanvas.TextWidth(DayStr);
|
||||
if (StrLn > TextRect.Right - TextRect.Left - TextMargin) then
|
||||
begin
|
||||
DayStr := GetDisplayString(RenderCanvas, DayStr, 0, TextRect.Right -
|
||||
TextRect.Left - (TextMargin * 2));
|
||||
end;
|
||||
DayStr := GetDisplayString(RenderCanvas, DayStr, 0, TextRect.Right - TextRect.Left - (TextMargin * 2));
|
||||
|
||||
{ write the event text }
|
||||
TPSTextOut(RenderCanvas, Angle, RenderIn,
|
||||
TextRect.Left + TextMargin,
|
||||
TextRect.Top + (TextMargin div 2), DayStr);
|
||||
TextRect.Left + TextMargin, TextRect.Top + (TextMargin div 2),
|
||||
DayStr
|
||||
);
|
||||
|
||||
{ update the EventArray }
|
||||
wvEventArray[EAIndex].Rec := TextRect;
|
||||
@ -931,14 +883,14 @@ var
|
||||
|
||||
{ Draw focus rect if this is the current day }
|
||||
|
||||
if (not DisplayOnly) and
|
||||
(StartDate + I = Trunc (FActiveDate)) and
|
||||
(Focused) then
|
||||
TPSDrawFocusRect (RenderCanvas, Angle, RenderIn,
|
||||
Rect (DayRect.Left + 2,
|
||||
if (not DisplayOnly) and (StartDate + I = Trunc (FActiveDate)) and Focused
|
||||
then
|
||||
TPSDrawFocusRect(RenderCanvas, Angle, RenderIn, Rect(
|
||||
DayRect.Left + 2,
|
||||
DayRect.Top + wvDayHeadHeight + 2,
|
||||
DayRect.Right - 2,
|
||||
DayRect.Bottom - 2));
|
||||
DayRect.Bottom - 2
|
||||
));
|
||||
|
||||
{ update WeekdayArray }
|
||||
wvWeekdayArray[I].Rec := DayRect;
|
||||
@ -947,16 +899,24 @@ var
|
||||
if (I = 2) then begin
|
||||
{ move the dayrect to the top of the next column }
|
||||
if DrawingStyle = ds3D then begin
|
||||
DayRect.TopLeft := Point (RealLeft + (RealRight - RealLeft) div 2,
|
||||
RealTop + wvHeaderHeight + 3);
|
||||
DayRect.BottomRight := Point (RealRight - 2,
|
||||
RealTop + wvHeaderHeight + DayRectHeight);
|
||||
DayRect.TopLeft := Point(
|
||||
RealLeft + (RealRight - RealLeft) div 2,
|
||||
RealTop + wvHeaderHeight + 3
|
||||
);
|
||||
DayRect.BottomRight := Point(
|
||||
RealRight - 2,
|
||||
RealTop + wvHeaderHeight + DayRectHeight
|
||||
);
|
||||
end
|
||||
else begin
|
||||
DayRect.TopLeft := Point (RealLeft + (RealRight - RealLeft) div 2,
|
||||
RealTop + wvHeaderHeight + 2);
|
||||
DayRect.BottomRight := Point (RealRight - 1,
|
||||
RealTop + wvHeaderHeight + DayRectHeight);
|
||||
DayRect.TopLeft := Point(
|
||||
RealLeft + (RealRight - RealLeft) div 2,
|
||||
RealTop + wvHeaderHeight + 2
|
||||
);
|
||||
DayRect.BottomRight := Point(
|
||||
RealRight - 1,
|
||||
RealTop + wvHeaderHeight + DayRectHeight
|
||||
);
|
||||
end;
|
||||
end
|
||||
|
||||
@ -976,15 +936,13 @@ var
|
||||
{ Draw the center vertical line }
|
||||
RenderCanvas.Pen.Color := RealLineColor;
|
||||
TPSMoveTo(RenderCanvas, Angle, RenderIn,
|
||||
RealLeft + (RealRight - RealLeft) div 2,
|
||||
RealTop + wvHeaderHeight + 2);
|
||||
RealLeft + (RealRight - RealLeft) div 2, RealTop + wvHeaderHeight + 2
|
||||
);
|
||||
TPSLineTo(RenderCanvas, Angle, RenderIn,
|
||||
RealLeft + (RealRight - RealLeft) div 2,
|
||||
RealBottom - 1);
|
||||
RealLeft + (RealRight - RealLeft) div 2, RealBottom - 1
|
||||
);
|
||||
|
||||
if (DataStore = nil)
|
||||
or (DataStore.Resource = nil)
|
||||
or (DataStore.Resource.Tasks.Count = 0)
|
||||
if (DataStore = nil) or (DataStore.Resource = nil) or (DataStore.Resource.Tasks.Count = 0)
|
||||
then Exit;
|
||||
end;
|
||||
{-}
|
||||
@ -1013,9 +971,9 @@ var
|
||||
RenderCanvas.Font.Assign(FDayHeadAttributes.Font);
|
||||
wvDayHeadHeight := RenderCanvas.TextHeight(VpProductName) + TextMargin + 2 ;
|
||||
RenderCanvas.Font.Assign(FEventFont);
|
||||
wvRowHeight := RenderCanvas.TextHeight(VpProductName) + (TextMargin div 2);
|
||||
wvRowHeight := RenderCanvas.TextHeight(VpProductName) + TextMargin div 2;
|
||||
RenderCanvas.Font.Assign(TFont(FHeadAttr.Font));
|
||||
wvHeaderHeight := RenderCanvas.TextHeight(VpProductName) + (TextMargin * 2);
|
||||
wvHeaderHeight := RenderCanvas.TextHeight(VpProductName) + TextMargin * 2;
|
||||
end;
|
||||
{-}
|
||||
|
||||
@ -1024,6 +982,7 @@ var
|
||||
HeadTextRect: TRect;
|
||||
HeadStr: string;
|
||||
HeadStrLen : Integer;
|
||||
|
||||
function GetWeekOfYear(Datum: TDateTime): byte;
|
||||
var
|
||||
AYear, dummy:word;
|
||||
@ -1033,6 +992,7 @@ var
|
||||
First := EncodeDate(AYear, 1, 1);
|
||||
Result := (trunc(Datum-First-3+(DayOfWeek(First)+1) mod 7) div 7) + 1;
|
||||
end;
|
||||
|
||||
begin
|
||||
RenderCanvas.Brush.Color := RealHeadAttrColor;
|
||||
RenderCanvas.Font.Assign(TFont(FHeadAttr.Font));
|
||||
@ -1058,9 +1018,9 @@ var
|
||||
HeadRect.Right := RealRight - 3;
|
||||
HeadRect.Bottom := RealTop + wvHeaderHeight;
|
||||
TPSFillRect(RenderCanvas, Angle, RenderIn, HeadRect);
|
||||
DrawBevelRect (RenderCanvas,
|
||||
TPSRotateRectangle (Angle, RenderIn, HeadRect),
|
||||
BevelHighlightColor, BevelDarkShadow);
|
||||
DrawBevelRect(RenderCanvas, TPSRotateRectangle(Angle, RenderIn, HeadRect),
|
||||
BevelHighlightColor, BevelDarkShadow
|
||||
);
|
||||
end else begin
|
||||
HeadRect.Left := RealLeft + 1;
|
||||
HeadRect.Top := RealTop + 1;
|
||||
@ -1069,19 +1029,25 @@ var
|
||||
end;
|
||||
|
||||
{ build header caption }
|
||||
HeadStr := HeadStr + RSWeekof + ' ' + FormatDateTime(DateLabelFormat, StartDate)+' (KW'+IntToStr(GetWeekOfYear(StartDate))+')';
|
||||
HeadStr := HeadStr + Format('%s %s (%s %d)', [
|
||||
RSWeekOf, FormatDateTime(DateLabelFormat, StartDate), RSCalendarWeekAbbr, GetWeekOfYear(StartDate)
|
||||
]);
|
||||
// HeadStr := HeadStr + RSWeekof + ' ' + FormatDateTime(DateLabelFormat, StartDate)+' (KW'+IntToStr(GetWeekOfYear(StartDate))+')';
|
||||
{ draw the text }
|
||||
if (DisplayOnly) and
|
||||
(RenderCanvas.TextWidth (HeadStr) >= RenderIn.Right - RenderIn.Left) then
|
||||
HeadTextRect.TopLeft:= Point (RealLeft + TextMargin * 2,
|
||||
HeadRect.Top)
|
||||
else if DisplayOnly then
|
||||
HeadTextRect.TopLeft := Point (RealLeft + (RealRight - RealLeft -
|
||||
RenderCanvas.TextWidth (HeadStr)) div 2,
|
||||
HeadRect.Top)
|
||||
if DisplayOnly and (RenderCanvas.TextWidth(HeadStr) >= RenderIn.Right - RenderIn.Left)
|
||||
then
|
||||
HeadTextRect.TopLeft:= Point(RealLeft + TextMargin * 2, HeadRect.Top)
|
||||
else
|
||||
HeadTextRect.TopLeft := Point (RealLeft + Trunc(wvHeaderHeight * 0.8) * 2 + TextMargin * 2,
|
||||
HeadRect.Top);
|
||||
if DisplayOnly then
|
||||
HeadTextRect.TopLeft := Point(
|
||||
RealLeft + (RealRight - RealLeft - RenderCanvas.TextWidth(HeadStr)) div 2,
|
||||
HeadRect.Top
|
||||
)
|
||||
else
|
||||
HeadTextRect.TopLeft := Point(
|
||||
RealLeft + Trunc(wvHeaderHeight * 0.8) * 2 + TextMargin * 2,
|
||||
HeadRect.Top
|
||||
);
|
||||
HeadTextRect.BottomRight := HeadRect.BottomRight;
|
||||
{ Fix Header String }
|
||||
HeadStrLen := RenderCanvas.TextWidth(HeadStr);
|
||||
@ -1095,8 +1061,11 @@ var
|
||||
wvSpinButtons.Width := wvSpinButtons.Height * 2;
|
||||
wvSpinButtons.Left := TextMargin;
|
||||
wvSpinButtons.Top := (wvHeaderHeight - wvSpinButtons.Height) div 2 + 2;
|
||||
TPSTextOut (RenderCanvas, Angle, RenderIn, HeadTextRect.Left + TextMargin,
|
||||
HeadTextRect.Top + TextMargin, HeadStr);
|
||||
TPSTextOut(RenderCanvas, Angle, RenderIn,
|
||||
HeadTextRect.Left + TextMargin,
|
||||
HeadTextRect.Top + TextMargin,
|
||||
HeadStr
|
||||
);
|
||||
end;
|
||||
{-}
|
||||
|
||||
@ -1105,34 +1074,32 @@ var
|
||||
if FDrawingStyle = dsFlat then begin
|
||||
{ draw an outer and inner bevel }
|
||||
DrawBevelRect(RenderCanvas,
|
||||
TPSRotateRectangle (Angle, RenderIn,
|
||||
Rect (RealLeft, RealTop,
|
||||
RealRight - 1, RealBottom - 1)),
|
||||
TPSRotateRectangle(Angle, RenderIn, Rect(RealLeft, RealTop, RealRight - 1, RealBottom - 1)),
|
||||
BevelShadowColor,
|
||||
BevelHighlightColor);
|
||||
BevelHighlightColor
|
||||
);
|
||||
DrawBevelRect(RenderCanvas,
|
||||
TPSRotateRectangle (Angle, RenderIn,
|
||||
Rect (RealLeft + 1, RealTop + 1,
|
||||
RealRight - 2, RealBottom - 2)),
|
||||
TPSRotateRectangle(Angle, RenderIn, Rect(RealLeft + 1, RealTop + 1, RealRight - 2, RealBottom - 2)),
|
||||
BevelShadowColor,
|
||||
BevelHighlightColor);
|
||||
end else if FDrawingStyle = ds3d then begin
|
||||
BevelHighlightColor
|
||||
);
|
||||
end else
|
||||
if FDrawingStyle = ds3d then begin
|
||||
{ draw a 3d bevel }
|
||||
DrawBevelRect(RenderCanvas,
|
||||
TPSRotateRectangle (Angle, RenderIn,
|
||||
Rect (RealLeft, RealTop,
|
||||
RealRight - 1, RealBottom - 1)),
|
||||
TPSRotateRectangle(Angle, RenderIn, Rect(RealLeft, RealTop, RealRight - 1, RealBottom - 1)),
|
||||
BevelShadowColor,
|
||||
BevelShadowColor);
|
||||
BevelShadowColor
|
||||
);
|
||||
DrawBevelRect(RenderCanvas,
|
||||
TPSRotateRectangle (Angle, RenderIn,
|
||||
Rect (RealLeft + 1, RealTop + 1,
|
||||
RealRight - 2, RealBottom - 2)),
|
||||
TPSRotateRectangle(Angle, RenderIn, Rect (RealLeft + 1, RealTop + 1, RealRight - 2, RealBottom - 2)),
|
||||
BevelDarkShadow,
|
||||
BevelButtonFace);
|
||||
BevelButtonFace
|
||||
);
|
||||
end;
|
||||
end;
|
||||
{-}
|
||||
|
||||
begin
|
||||
|
||||
if DisplayOnly then begin
|
||||
@ -1172,8 +1139,7 @@ begin
|
||||
RenderCanvas.Pen.Mode := pmCopy;
|
||||
RenderCanvas.Brush.Style := bsSolid;
|
||||
|
||||
Rgn := CreateRectRgn (RenderIn.Left, RenderIn.Top,
|
||||
RenderIn.Right, RenderIn.Bottom);
|
||||
Rgn := CreateRectRgn(RenderIn.Left, RenderIn.Top, RenderIn.Right, RenderIn.Bottom);
|
||||
try
|
||||
SelectClipRgn(RenderCanvas.Handle, Rgn);
|
||||
|
||||
@ -1192,9 +1158,8 @@ begin
|
||||
{ draw the borders }
|
||||
DrawBorders;
|
||||
|
||||
{ reinstate canvas settings}
|
||||
|
||||
finally
|
||||
{ reinstate canvas settings}
|
||||
SelectClipRgn(RenderCanvas.Handle, 0);
|
||||
DeleteObject(Rgn);
|
||||
end;
|
||||
@ -1226,9 +1191,8 @@ begin
|
||||
Str := '"' + ActiveEvent.Description + '"';
|
||||
|
||||
if Verify then
|
||||
DoIt := (MessageDlg(RSDelete + ' ' + Str + ' ' + RSFromSchedule
|
||||
+ #13#10#10 + RSPermanent, mtconfirmation,
|
||||
[mbYes, mbNo], 0) = mrYes);
|
||||
DoIt := (MessageDlg(RSDelete + ' ' + Str + ' ' + RSFromSchedule + #13#10#10 + RSPermanent,
|
||||
mtConfirmation, [mbYes, mbNo], 0) = mrYes);
|
||||
|
||||
if DoIt then begin
|
||||
ActiveEvent.Deleted := true;
|
||||
@ -1240,7 +1204,6 @@ begin
|
||||
end;
|
||||
{=====}
|
||||
|
||||
|
||||
procedure TVpWeekView.wvSpinButtonClick(Sender: TObject; Button: TUDBtnType);
|
||||
begin
|
||||
if Button = btNext then
|
||||
@ -1366,7 +1329,7 @@ begin
|
||||
with Params do
|
||||
begin
|
||||
Style := Style or WS_TABSTOP;
|
||||
{$IFNDEF LCL}
|
||||
{$IFDEF DELPHI}
|
||||
WindowClass.style := CS_DBLCLKS;
|
||||
{$ENDIF}
|
||||
end;
|
||||
@ -1443,7 +1406,10 @@ begin
|
||||
StartTime := trunc(Date) + 1 / 2; { default to 12:00 noon }
|
||||
EndTime := StartTime + (30 / MinutesInDay); { StartTime + 30 minutes }
|
||||
ActiveEvent := DataStore.Resource.Schedule.AddEvent(
|
||||
DataStore.GetNextID('Events'), StartTime, EndTime);
|
||||
DataStore.GetNextID('Events'),
|
||||
StartTime,
|
||||
EndTime
|
||||
);
|
||||
{ edit this new event }
|
||||
wvSpawnEventEditDialog(True);
|
||||
end;
|
||||
@ -1483,7 +1449,6 @@ procedure TVpWeekView.InitializeDefaultPopup;
|
||||
var
|
||||
NewItem: TMenuItem;
|
||||
NewSubItem: TMenuItem;
|
||||
|
||||
begin
|
||||
if RSWeekPopupAdd <> '' then begin
|
||||
NewItem := TMenuItem.Create (Self);
|
||||
@ -1588,10 +1553,15 @@ begin
|
||||
Exit;
|
||||
if not Assigned(DataStore.Resource) then
|
||||
Exit;
|
||||
|
||||
StartTime := trunc(Date) + 1 / 2; { default to 12:00 noon }
|
||||
EndTime := StartTime + (30 / MinutesInDay); { StartTime + 30 minutes }
|
||||
ActiveEvent := DataStore.Resource.Schedule.AddEvent(
|
||||
DataStore.GetNextID ('Events'), StartTime, EndTime);
|
||||
DataStore.GetNextID('Events'),
|
||||
StartTime,
|
||||
EndTime
|
||||
);
|
||||
|
||||
{ edit this new event }
|
||||
wvSpawnEventEditDialog(True);
|
||||
end;
|
||||
@ -1644,7 +1614,6 @@ end;
|
||||
procedure TVpWeekView.PopupNextMonth(Sender: TObject);
|
||||
var
|
||||
M, D, Y: Word;
|
||||
|
||||
begin
|
||||
DecodeDate(Date, Y, M, D);
|
||||
if M = 12 then begin
|
||||
@ -1679,7 +1648,6 @@ end;
|
||||
procedure TVpWeekView.PopupNextYear(Sender: TObject);
|
||||
var
|
||||
M, D, Y: Word;
|
||||
|
||||
begin
|
||||
DecodeDate(Date, Y, M, D);
|
||||
Date := EncodeDate(Y + 1, M, 1);
|
||||
@ -1689,7 +1657,6 @@ end;
|
||||
procedure TVpWeekView.PopupPrevYear(Sender: TObject);
|
||||
var
|
||||
M, D, Y : Word;
|
||||
|
||||
begin
|
||||
DecodeDate(Date, Y, M, D);
|
||||
Date := EncodeDate(Y - 1, M, 1);
|
||||
@ -1746,17 +1713,17 @@ procedure TVpWeekView.wvSetDateByCoord(Point: TPoint);
|
||||
var
|
||||
I: Integer;
|
||||
begin
|
||||
for I := 0 to pred(Length(wvWeekdayArray)) do begin
|
||||
if (Point.X >= wvWeekdayArray[I].Rec.Left)
|
||||
and (Point.X <= wvWeekdayArray[I].Rec.Right)
|
||||
and (Point.Y >= wvWeekdayArray[I].Rec.Top)
|
||||
and (Point.Y <= wvWeekdayArray[I].Rec.Bottom) then begin
|
||||
for I := 0 to pred(Length(wvWeekdayArray)) do
|
||||
if (Point.X >= wvWeekdayArray[I].Rec.Left) and
|
||||
(Point.X <= wvWeekdayArray[I].Rec.Right) and
|
||||
(Point.Y >= wvWeekdayArray[I].Rec.Top) and
|
||||
(Point.Y <= wvWeekdayArray[I].Rec.Bottom)
|
||||
then begin
|
||||
Date := wvWeekdayArray[I].Day;
|
||||
Invalidate;
|
||||
Exit;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
{=====}
|
||||
|
||||
function TVpWeekView.EventAtCoord(Pt: TPoint): Boolean;
|
||||
@ -1776,10 +1743,11 @@ begin
|
||||
Exit;
|
||||
end;
|
||||
|
||||
if (Pt.X > wvEventArray[I].Rec.Left)
|
||||
and (Pt.X < wvEventArray[I].Rec.Right)
|
||||
and (Pt.Y > wvEventArray[I].Rec.Top)
|
||||
and (Pt.Y < wvEventArray[I].Rec.Bottom) then begin
|
||||
if (Pt.X > wvEventArray[I].Rec.Left) and
|
||||
(Pt.X < wvEventArray[I].Rec.Right) and
|
||||
(Pt.Y > wvEventArray[I].Rec.Top) and
|
||||
(Pt.Y < wvEventArray[I].Rec.Bottom)
|
||||
then begin
|
||||
{ point falls inside this event's rectangle }
|
||||
wvHotPoint := Pt;
|
||||
ActiveEvent := TVpEvent(wvEventArray[I].Event);
|
||||
@ -1787,7 +1755,6 @@ begin
|
||||
result := true;
|
||||
Exit;
|
||||
end
|
||||
|
||||
else begin
|
||||
{ point is not within the boundaries of this event's rectangle. }
|
||||
ActiveEvent := nil;
|
||||
@ -1828,10 +1795,12 @@ begin
|
||||
wvInPlaceEditor.Parent := self;
|
||||
wvInPlaceEditor.OnExit := EndEdit;
|
||||
end;
|
||||
wvInPlaceEditor.SetBounds(wvActiveEventRec.Left + TextMargin,
|
||||
wvInPlaceEditor.SetBounds(
|
||||
wvActiveEventRec.Left + TextMargin,
|
||||
wvActiveEventRec.Top,
|
||||
wvActiveEventRec.Right - (TextMargin*2),
|
||||
wvActiveEventRec.Bottom- (TextMargin*2));
|
||||
wvActiveEventRec.Right - TextMargin * 2,
|
||||
wvActiveEventRec.Bottom - TextMargin * 2
|
||||
);
|
||||
wvInplaceEditor.Show;
|
||||
wvInPlaceEditor.Text := ActiveEvent.Description;
|
||||
Invalidate;
|
||||
@ -1844,7 +1813,6 @@ end;
|
||||
procedure TVpWeekView.KeyDown(var Key: Word; Shift: TShiftState);
|
||||
var
|
||||
PopupPoint : TPoint;
|
||||
|
||||
begin
|
||||
case Key of
|
||||
VK_DELETE : DeleteActiveEvent(true);
|
||||
@ -1919,16 +1887,14 @@ begin
|
||||
Windows.SetFocus(GetNextDlgTabItem(GetParent(Handle), Handle, True));
|
||||
{$ENDIF}
|
||||
VK_F10:
|
||||
if (ssShift in Shift) and not (Assigned (PopupMenu)) then begin
|
||||
if (ssShift in Shift) and not Assigned(PopupMenu) then begin
|
||||
PopupPoint := GetClientOrigin;
|
||||
FDefaultPopup.Popup (PopupPoint.x + 10,
|
||||
PopupPoint.y + 10);
|
||||
FDefaultPopup.Popup(PopupPoint.x + 10, PopupPoint.y + 10);
|
||||
end;
|
||||
VK_APPS:
|
||||
if not Assigned (PopupMenu) then begin
|
||||
PopupPoint := GetClientOrigin;
|
||||
FDefaultPopup.Popup (PopupPoint.x + 10,
|
||||
PopupPoint.y + 10);
|
||||
FDefaultPopup.Popup(PopupPoint.x + 10, PopupPoint.y + 10);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
Reference in New Issue
Block a user