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