tvplanit: Improved layout of Event editor in case of translation. Cosmetic format changes.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4731 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2016-06-12 18:11:04 +00:00
parent cdd2584be7
commit fc91764452
3 changed files with 128 additions and 129 deletions

View File

@ -18,17 +18,17 @@ object AlarmNotifyForm: TAlarmNotifyForm
Position = poDefault Position = poDefault
LCLVersion = '1.7' LCLVersion = '1.7'
object SnoozeCaption: TLabel object SnoozeCaption: TLabel
Left = 24 Left = 16
Height = 57 Height = 57
Top = 136 Top = 136
Width = 144 Width = 152
AutoSize = False AutoSize = False
Caption = 'SnoozeCaption' Caption = 'SnoozeCaption'
ParentColor = False ParentColor = False
WordWrap = True WordWrap = True
end end
object lSubject: TLabel object lSubject: TLabel
Left = 24 Left = 16
Height = 15 Height = 15
Top = 32 Top = 32
Width = 45 Width = 45
@ -38,7 +38,7 @@ object AlarmNotifyForm: TAlarmNotifyForm
ParentFont = False ParentFont = False
end end
object lTime: TLabel object lTime: TLabel
Left = 24 Left = 16
Height = 15 Height = 15
Top = 8 Top = 8
Width = 30 Width = 30
@ -107,20 +107,20 @@ object AlarmNotifyForm: TAlarmNotifyForm
TabOrder = 3 TabOrder = 3
end end
object Panel1: TPanel object Panel1: TPanel
Left = 24 Left = 16
Height = 72 Height = 72
Top = 56 Top = 56
Width = 371 Width = 379
BevelInner = bvRaised BevelInner = bvRaised
BevelOuter = bvLowered BevelOuter = bvLowered
ClientHeight = 72 ClientHeight = 72
ClientWidth = 371 ClientWidth = 379
TabOrder = 4 TabOrder = 4
object lNotes: TLabel object lNotes: TLabel
Left = 2 Left = 2
Height = 68 Height = 68
Top = 2 Top = 2
Width = 367 Width = 375
Align = alClient Align = alClient
AutoSize = False AutoSize = False
Caption = 'lNotes' Caption = 'lNotes'

View File

@ -105,21 +105,19 @@ object DlgEventEdit: TDlgEventEdit
end end
object StartTimeLbl: TLabel object StartTimeLbl: TLabel
Left = 33 Left = 33
Height = 13 Height = 15
Top = 108 Top = 108
Width = 59 Width = 54
Alignment = taRightJustify Alignment = taRightJustify
AutoSize = False
Caption = 'Start time:' Caption = 'Start time:'
ParentColor = False ParentColor = False
end end
object EndTimeLbl: TLabel object EndTimeLbl: TLabel
Left = 35 Left = 35
Height = 13 Height = 15
Top = 135 Top = 135
Width = 57 Width = 50
Alignment = taRightJustify Alignment = taRightJustify
AutoSize = False
Caption = 'End time:' Caption = 'End time:'
ParentColor = False ParentColor = False
end end
@ -154,10 +152,9 @@ object DlgEventEdit: TDlgEventEdit
end end
object RecurringLbl: TLabel object RecurringLbl: TLabel
Left = 395 Left = 395
Height = 13 Height = 15
Top = 87 Top = 85
Width = 187 Width = 136
AutoSize = False
Caption = 'Appointment Recurrence:' Caption = 'Appointment Recurrence:'
ParentColor = False ParentColor = False
end end
@ -168,11 +165,10 @@ object DlgEventEdit: TDlgEventEdit
Width = 2 Width = 2
end end
object IntervalLbl: TLabel object IntervalLbl: TLabel
Left = 589 Left = 583
Height = 13 Height = 15
Top = 87 Top = 85
Width = 92 Width = 77
AutoSize = False
Caption = 'Interval (days):' Caption = 'Interval (days):'
ParentColor = False ParentColor = False
end end
@ -209,7 +205,7 @@ object DlgEventEdit: TDlgEventEdit
} }
end end
object SpeedButton1: TSpeedButton object SpeedButton1: TSpeedButton
Left = 329 Left = 312
Height = 22 Height = 22
Top = 167 Top = 167
Width = 23 Width = 23
@ -261,12 +257,11 @@ object DlgEventEdit: TDlgEventEdit
} }
end end
object RecurrenceEndsLbl: TLabel object RecurrenceEndsLbl: TLabel
Left = 368 Left = 424
Height = 13 Height = 15
Top = 135 Top = 135
Width = 88 Width = 28
Alignment = taRightJustify Alignment = taRightJustify
AutoSize = False
Caption = 'Until:' Caption = 'Until:'
ParentColor = False ParentColor = False
end end
@ -274,7 +269,7 @@ object DlgEventEdit: TDlgEventEdit
Left = 86 Left = 86
Height = 23 Height = 23
Top = 11 Top = 11
Width = 580 Width = 578
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
TabOrder = 0 TabOrder = 0
Text = 'DescriptionEdit' Text = 'DescriptionEdit'
@ -292,7 +287,7 @@ object DlgEventEdit: TDlgEventEdit
Left = 484 Left = 484
Height = 21 Height = 21
Top = 40 Top = 40
Width = 182 Width = 180
ItemHeight = 15 ItemHeight = 15
OnDrawItem = CategoryDrawItem OnDrawItem = CategoryDrawItem
ReadOnly = True ReadOnly = True
@ -310,7 +305,7 @@ object DlgEventEdit: TDlgEventEdit
TabOrder = 6 TabOrder = 6
end end
object IntervalUpDown: TUpDown object IntervalUpDown: TUpDown
Left = 652 Left = 648
Height = 23 Height = 23
Top = 104 Top = 104
Width = 16 Width = 16
@ -326,7 +321,7 @@ object DlgEventEdit: TDlgEventEdit
Left = 231 Left = 231
Height = 23 Height = 23
Top = 167 Top = 167
Width = 93 Width = 77
ItemHeight = 15 ItemHeight = 15
Style = csDropDownList Style = csDropDownList
TabOrder = 13 TabOrder = 13
@ -354,7 +349,7 @@ object DlgEventEdit: TDlgEventEdit
TabOrder = 3 TabOrder = 3
end end
object edtUnusedPlaceholder: TEdit object edtUnusedPlaceholder: TEdit
Left = 587 Left = 583
Height = 23 Height = 23
Top = 104 Top = 104
Width = 65 Width = 65

View File

@ -51,6 +51,7 @@ type
TVpRightAlignedEdit = class(TEdit) TVpRightAlignedEdit = class(TEdit)
public public
constructor Create(AOwner: TComponent); override;
procedure CreateParams(var Params : TCreateParams); override; procedure CreateParams(var Params : TCreateParams); override;
end; end;
@ -145,18 +146,16 @@ type
TVpEventEditDialog = class(TVpBaseDialog) TVpEventEditDialog = class(TVpBaseDialog)
protected {private} protected {private}
ceEditDlg : TDlgEventEdit; ceEditDlg: TDlgEventEdit;
FTimeFormat : TVpTimeFormat; FTimeFormat: TVpTimeFormat;
ceEvent : TVpEvent; ceEvent: TVpEvent;
public public
constructor Create(AOwner : TComponent); override; constructor Create(AOwner : TComponent); override;
function Execute(Event: TVpEvent; function Execute(Event: TVpEvent; TimeFormat: TVpTimeFormat = tf12Hour): Boolean; reintroduce;
TimeFormat: TVpTimeFormat = tf12Hour): Boolean; reintroduce;
function AddNewEvent(StartTime, EndTime: TDateTime): Boolean; function AddNewEvent(StartTime, EndTime: TDateTime): Boolean;
published published
{properties} {properties}
property TimeFormat: TVpTimeFormat property TimeFormat: TVpTimeFormat read FTimeFormat write FTimeFormat default tf12Hour;
read FTimeFormat write FTimeFormat default tf12Hour;
property DataStore; property DataStore;
property Options; property Options;
property Placement; property Placement;
@ -165,7 +164,7 @@ type
implementation implementation
uses uses
VpSR, VpWavDlg; VpSR, VpMisc, VpWavDlg;
{$IFDEF LCL} {$IFDEF LCL}
{$R *.lfm} {$R *.lfm}
@ -175,6 +174,14 @@ uses
{ TVpRightAlignedEdit } { TVpRightAlignedEdit }
constructor TVpRightAlignedEdit.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
{$IFDEF LCL}
Alignment := taRightJustify;
{$ENDIF}
end;
procedure TVpRightAlignedEdit.CreateParams(var Params: TCreateParams); procedure TVpRightAlignedEdit.CreateParams(var Params: TCreateParams);
begin begin
inherited; inherited;
@ -188,6 +195,8 @@ end;
{ TDlgEventEdit } { TDlgEventEdit }
procedure TDlgEventEdit.FormCreate(Sender: TObject); procedure TDlgEventEdit.FormCreate(Sender: TObject);
const
DELTA = 8;
begin begin
{$IFDEF LCL} {$IFDEF LCL}
StartTime := TTimeEdit.Create(self); StartTime := TTimeEdit.Create(self);
@ -228,6 +237,13 @@ begin
TabOrder := edtUnusedPlaceholder.TabOrder; TabOrder := edtUnusedPlaceholder.TabOrder;
end; end;
IntervalUpDown.Associate := FCustomInterval; IntervalUpDown.Associate := FCustomInterval;
DescriptionLbl.Left := DescriptionEdit.Left - GetLabelWidth(DescriptionLbl) - DELTA;
LocationLbl.Left := LocationEdit.Left - GetLabelWidth(LocationLbl) - DELTA;
CategoryLbl.Left := Category.Left - GetLabelWidth(CategoryLbl) - DELTA;
StartTimeLbl.Left := StartDate.Left - GetLabelWidth(StartTimeLbl) - DELTA;
EndTimeLbl.Left := EndDate.Left - GetLabelWidth(EndTimeLbl) - DELTA;
RecurrenceEndsLbl.Left := RepeatUntil.Left - GetLabelWidth(RecurrenceEndsLbl) - DELTA;
end; end;
{=====} {=====}
@ -248,45 +264,45 @@ begin
Color := clBlack; Color := clBlack;
case Index of case Index of
0: begin 0: begin
Color := CatColorMap.Category0.Color; Color := CatColorMap.Category0.Color;
Name := CatColorMap.Category0.Description; Name := CatColorMap.Category0.Description;
end; end;
1: begin 1: begin
Color := CatColorMap.Category1.Color; Color := CatColorMap.Category1.Color;
Name := CatColorMap.Category1.Description; Name := CatColorMap.Category1.Description;
end; end;
2: begin 2: begin
Color := CatColorMap.Category2.Color; Color := CatColorMap.Category2.Color;
Name := CatColorMap.Category2.Description; Name := CatColorMap.Category2.Description;
end; end;
3: begin 3: begin
Color := CatColorMap.Category3.Color; Color := CatColorMap.Category3.Color;
Name := CatColorMap.Category3.Description; Name := CatColorMap.Category3.Description;
end; end;
4: begin 4: begin
Color := CatColorMap.Category4.Color; Color := CatColorMap.Category4.Color;
Name := CatColorMap.Category4.Description; Name := CatColorMap.Category4.Description;
end; end;
5: begin 5: begin
Color := CatColorMap.Category5.Color; Color := CatColorMap.Category5.Color;
Name := CatColorMap.Category5.Description; Name := CatColorMap.Category5.Description;
end; end;
6: begin 6: begin
Color := CatColorMap.Category6.Color; Color := CatColorMap.Category6.Color;
Name := CatColorMap.Category6.Description; Name := CatColorMap.Category6.Description;
end; end;
7: begin 7: begin
Color := CatColorMap.Category7.Color; Color := CatColorMap.Category7.Color;
Name := CatColorMap.Category7.Description; Name := CatColorMap.Category7.Description;
end; end;
8: begin 8: begin
Color := CatColorMap.Category8.Color; Color := CatColorMap.Category8.Color;
Name := CatColorMap.Category8.Description; Name := CatColorMap.Category8.Description;
end; end;
9: begin 9: begin
Color := CatColorMap.Category9.Color; Color := CatColorMap.Category9.Color;
Name := CatColorMap.Category9.Description; Name := CatColorMap.Category9.Description;
end; end;
end; {Case} end; {Case}
SaveColor := Category.Canvas.Brush.Color; SaveColor := Category.Canvas.Brush.Color;
@ -418,11 +434,9 @@ begin
{ follow the start time by 30 minutes } { follow the start time by 30 minutes }
if ST > StrToTime(EndTime.Text) then begin if ST > StrToTime(EndTime.Text) then begin
if TimeFormat = tf24Hour then if TimeFormat = tf24Hour then
EndTime.Text := FormatDateTime ('h:mm', EndTime.Text := FormatDateTime('h:mm', ST + 30 / MinutesInDay)
ST + (30/MinutesInDay))
else else
EndTime.Text := FormatDateTime ('hh:mm AM/PM', EndTime.Text := FormatDateTime('hh:mm AM/PM', ST + 30 / MinutesInDay);
ST + (30/MinutesInDay));
end; end;
end; end;
@ -430,9 +444,9 @@ end;
procedure TDlgEventEdit.EndTimeChange(Sender: TObject); procedure TDlgEventEdit.EndTimeChange(Sender: TObject);
function IsMidnight (ATime : TDateTime) : Boolean; function IsMidnight(ATime: TDateTime) : Boolean;
begin begin
Result := ATime = Trunc (ATime); Result := ATime = Trunc(ATime);
end; end;
var var
@ -441,12 +455,11 @@ var
begin begin
{ Verify the value is valid } { Verify the value is valid }
try try
ET := StrToTime (EndTime.Text); ET := StrToTime(EndTime.Text);
if (IsMidnight (ET)) and (not IsMidnight (FLastEndTime)) then if (IsMidnight(ET)) and (not IsMidnight(FLastEndTime)) then
EndDate.Date := EndDate.Date + 1 EndDate.Date := EndDate.Date + 1
else if (not IsMidnight (ET)) and (IsMidnight (FLastEndTime)) then else if (not IsMidnight(ET)) and (IsMidnight(FLastEndTime)) then
EndDate.Date := EndDate.Date - 1; EndDate.Date := EndDate.Date - 1;
FLastEndTime := ET; FLastEndTime := ET;
except except
EndTime.Color := clRed; EndTime.Color := clRed;
@ -459,22 +472,22 @@ begin
{ precede the end time by 30 minutes } { precede the end time by 30 minutes }
if ET < StrToTime(StartTime.Text) then begin if ET < StrToTime(StartTime.Text) then begin
if TimeFormat = tf24Hour then if TimeFormat = tf24Hour then
StartTime.Text := FormatDateTime ('h:mm', StartTime.Text := FormatDateTime('h:mm', ET - 30 / MinutesInDay)
ET - (30/MinutesInDay))
else else
StartTime.Text := FormatDateTime ('h:mm AM/PM', StartTime.Text := FormatDateTime('h:mm AM/PM', ET - 30 / MinutesInDay);
ET - (30/MinutesInDay));
end; end;
end; end;
{=====} {=====}
procedure TDlgEventEdit.PopLists; procedure TDlgEventEdit.PopLists;
{$IFDEF DELPHI}
var var
StringList: TStringList; StringList: TStringList;
I, Hour, Minute: Integer; I, Hour, Minute: Integer;
MinStr, AMPMStr: string; MinStr, AMPMStr: string;
{$ENDIF}
begin begin
{$IFDEF DELPHI} {$IFDEF DELPHI} // No longer needed for Lazarus using a TTimeEdit now.
{ Time Lists } { Time Lists }
StringList := TStringList.Create; StringList := TStringList.Create;
try try
@ -606,9 +619,7 @@ end;
procedure TDlgEventEdit.RecurringTypeChange(Sender: TObject); procedure TDlgEventEdit.RecurringTypeChange(Sender: TObject);
begin begin
if (RecurringType.ItemIndex > 0) if (RecurringType.ItemIndex > 0) and (RepeatUntil.Date <= StartDate.Date) then
and (RepeatUntil.Date <= StartDate.Date)
then
RepeatUntil.Date := StartDate.Date + 365; RepeatUntil.Date := StartDate.Date + 365;
RecurrenceEndsLbl.Enabled := (RecurringType.ItemIndex > 0); RecurrenceEndsLbl.Enabled := (RecurringType.ItemIndex > 0);
@ -658,7 +669,7 @@ end;
{ TVpEventEditDialog } { TVpEventEditDialog }
constructor TVpEventEditDialog.Create(AOwner : TComponent); constructor TVpEventEditDialog.Create(AOwner: TComponent);
begin begin
inherited Create(AOwner); inherited Create(AOwner);
FPlacement.Position := mpCenterTop; FPlacement.Position := mpCenterTop;
@ -712,50 +723,43 @@ end;
procedure TDlgEventEdit.StartTimeExit(Sender: TObject); procedure TDlgEventEdit.StartTimeExit(Sender: TObject);
var var
ST : TDateTime; ST : TDateTime;
begin begin
{ Verify the value is valid } { Verify the value is valid }
try try
ST := StartDate.Date + ST := StartDate.Date + StrToTime(StartTime.Text);
StrToTime (StartTime.Text); except
except StartTime.Color := clRed;
StartTime.Color := clRed; StartTime.SetFocus;
StartTime.SetFocus; Exit;
Exit;
end; end;
StartTime.Color := clWindow; StartTime.Color := clWindow;
{ if the end time is less than the start time then change the end } { If the end time is less than the start time then change the end }
{ time to follow the start time by 30 minutes } { time to follow the start time by 30 minutes }
if ST > EndDate.Date + if ST > EndDate.Date + StrToTime (EndTime.Text) then
StrToTime (EndTime.Text) then begin EndTime.Text := FormatDateTime('hh:mm', ST + 30 / MinutesInDay);
EndTime.Text := FormatDateTime('hh:mm',ST + (30/MinutesInDay));
end;
end; end;
procedure TDlgEventEdit.EndTimeExit(Sender: TObject); procedure TDlgEventEdit.EndTimeExit(Sender: TObject);
var var
ET : TDateTime; ET: TDateTime;
begin begin
{ Verify the value is valid } { Verify the value is valid }
try try
ET := EndDate.Date + StrToTime (EndTime.Text); ET := EndDate.Date + StrToTime(EndTime.Text);
except except
EndTime.Color := clRed; EndTime.Color := clRed;
EndTime.SetFocus; EndTime.SetFocus;
Exit; Exit;
end; end;
EndTime.Color := clWindow; EndTime.Color := clWindow;
{ if the end time is less than the start time then change the } { If the end time is less than the start time then change the }
{ start time to precede the end time by 30 minutes } { start time to precede the end time by 30 minutes }
if ET < StartDate.Date + if ET < StartDate.Date + StrToTime (StartTime.Text) then
StrToTime (StartTime.Text) then begin StartTime.Text := FormatDateTime('hh:mm', ET - 30 / MinutesInDay);
StartTime.Text := FormatDateTime('hh:mm',ET- (30/MinutesInDay));
end;
end; end;
end. end.