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:
wp_xxyyzz
2016-06-18 21:03:53 +00:00
parent a089da3b74
commit 1e89c2e60f
8 changed files with 673 additions and 702 deletions

View File

@ -159,6 +159,10 @@ msgctxt "vpsr.rscalendartoday"
msgid "Today"
msgstr "Heute"
#: vpsr.rscalendarweekabbr
msgid "CW"
msgstr "KW"
#: vpsr.rscancelbtn
msgid "Cancel"
msgstr "Abbrechen"

View File

@ -149,6 +149,10 @@ msgctxt "vpsr.rscalendartoday"
msgid "Today"
msgstr ""
#: vpsr.rscalendarweekabbr
msgid "CW"
msgstr ""
#: vpsr.rscancelbtn
msgid "Cancel"
msgstr ""

View File

@ -113,10 +113,10 @@ type
procedure DisplayCurrentCountry;
procedure ResizeControls;
public
Resource : TVpResource;
Contact : TVpContact;
ReturnCode : TVpEditorReturnCode;
ControlLink : TVpControlLink;
Resource: TVpResource;
Contact: TVpContact;
ReturnCode: TVpEditorReturnCode;
ControlLink: TVpControlLink;
procedure PopulateSelf;
procedure DePopulateSelf;
procedure ArrangeControls;
@ -124,9 +124,9 @@ type
TVpContactEditDialog = class(TVpBaseDialog)
protected {private}
ceEditDlg : TContactEditForm;
ceContact : TVpContact;
ceResource : TVpResource;
ceEditDlg: TContactEditForm;
ceContact: TVpContact;
ceResource: TVpResource;
public
function Execute(Contact: TVpContact): Boolean; reintroduce;
function AddNewContact: Boolean;
@ -150,7 +150,7 @@ uses
{== Utility functions ===================================}
function Max(const a, b : Integer) : Integer;
function Max(const a, b: Integer): Integer;
begin
if a >= b then
Result := a
@ -254,9 +254,9 @@ end;
procedure TContactEditForm.PopulateSelf;
var
CurCountry : Integer;
i : TVpPhoneType;
j : TVpCategoryType;
CurCountry: Integer;
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;
@ -346,7 +346,7 @@ begin
cboxState.Visible := False;
end
else begin
ControlLink.Localization.CountriesToTStrings (cboxCountry.Items);
ControlLink.Localization.CountriesToTStrings(cboxCountry.Items);
CountryLbl.FocusControl := cboxCountry;
cboxCountry.Visible := True;
edtCountry.Visible := False;
@ -372,14 +372,13 @@ type
TLabelArray = array[0..9] of TLabel;
var
Labels : TLabelArray;
LargestLabel : Integer;
WidestField : Integer;
i : Integer;
j : Integer;
OldFont : TFont;
FieldTop : Integer;
delta : Integer;
Labels: TLabelArray;
LargestLabel: Integer;
WidestField: Integer;
i, j: Integer;
OldFont: TFont;
FieldTop: Integer;
delta: Integer;
begin
{ Note: The resizing algorithm is dependent upon the labels having their
@ -414,20 +413,21 @@ begin
Canvas.Font.Assign (cboxCountry.Font);
try
for j := 0 to cboxCountry.Items.Count - 1 do begin
i := Canvas.TextWidth (cboxCountry.Items[j]);
i := Canvas.TextWidth(cboxCountry.Items[j]);
if i > WidestField then
WidestField := i;
end;
WidestField := WidestField + ComboArrowWidth;
cboxCountry.Width := WidestField;
finally
Canvas.Font.Assign (OldFont);
Canvas.Font.Assign(OldFont);
end;
finally
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;
@ -438,23 +438,24 @@ begin
OldFont := TFont.Create;
try
OldFont.Assign(Canvas.Font);
Canvas.Font.Assign (cboxCountry.Font);
Canvas.Font.Assign(cboxCountry.Font);
try
for j := 0 to cboxState.Items.Count - 1 do begin
i := Canvas.TextWidth (cboxState.Items[j]);
i := Canvas.TextWidth(cboxState.Items[j]);
if i > WidestField then
WidestField := i;
end;
WidestField := WidestField + ComboArrowWidth;
cboxState.Width := WidestField;
finally
Canvas.Font.Assign (OldFont);
Canvas.Font.Assign(OldFont);
end;
finally
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,14 +503,13 @@ end;
procedure TContactEditForm.DisplayCurrentCountry;
var
Idx : Integer;
begin
if not Assigned (ControlLink) then
if not Assigned(ControlLink) then
Exit;
Idx := ControlLink.Localization.CountryNameToIndex (cboxCountry.Text);
Idx := ControlLink.Localization.CountryNameToIndex(cboxCountry.Text);
if Idx > -1 then begin
ControlLink.Localization.StatesToTStrings (Idx, cboxState.Items);
ControlLink.Localization.StatesToTStrings(Idx, cboxState.Items);
if ControlLink.Localization.Countries.Items[Idx].Address1Visible then begin
AddrLbl.Visible := True;

View File

@ -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;

View File

@ -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

View File

@ -123,6 +123,7 @@ resourcestring
RSMinutes = 'Minutes';
RSHours = 'Hours';
RSDays = 'Days';
RSCalendarWeekAbbr = 'CW'; // Abbreviation of "calendar week"
{WARNINGS}
RSPermanent = 'This operation cannot be undone!';

View File

@ -90,10 +90,10 @@ type
TVpTaskEditDialog = class(TVpBaseDialog)
protected {private}
teEditDlg : TTaskEditForm;
teTask : TVpTask;
teEditDlg: TTaskEditForm;
teTask: TVpTask;
public
constructor Create(AOwner : TComponent); override;
constructor Create(AOwner: TComponent); override;
function Execute(Task: TVpTask): Boolean; reintroduce;
function AddNewTask: Boolean;
published
@ -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);

File diff suppressed because it is too large Load Diff