From b703a9f89e4baafec1350894f384565827044548 Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Fri, 10 Jun 2016 16:12:14 +0000 Subject: [PATCH] tvplanit: Fix some translation-related layout issues in several forms. Add missing resourcestrings. Fix trask items being painted with task header font. git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4708 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/tvplanit/languages/vpsr.de.po | 22 +++++++++++--- components/tvplanit/languages/vpsr.po | 22 +++++++++++--- .../tvplanit/source/vpcontacteditdlg.pas | 20 ------------- components/tvplanit/source/vpevnteditdlg.lfm | 18 ++++++------ components/tvplanit/source/vpmisc.pas | 15 +++++++++- components/tvplanit/source/vpreseditdlg.lfm | 4 +-- components/tvplanit/source/vpreseditdlg.pas | 14 +++++++++ components/tvplanit/source/vpsr.inc | 29 ++++--------------- components/tvplanit/source/vptaskeditdlg.lfm | 12 ++++---- components/tvplanit/source/vptaskeditdlg.pas | 6 ++++ components/tvplanit/source/vptasklist.pas | 8 ++++- components/tvplanit/source/vpweekview.pas | 4 +++ 12 files changed, 104 insertions(+), 70 deletions(-) diff --git a/components/tvplanit/languages/vpsr.de.po b/components/tvplanit/languages/vpsr.de.po index 48bdd5985..1fc2a0309 100644 --- a/components/tvplanit/languages/vpsr.de.po +++ b/components/tvplanit/languages/vpsr.de.po @@ -249,10 +249,6 @@ msgstr "Firma" msgid "Company:" msgstr "Firma:" -#: vpsr.rscomplete -msgid "Task complete" -msgstr "Aufgabe fertiggestellt" - #: vpsr.rscompletedon msgid "Completed on" msgstr "Fertiggestellt am" @@ -427,6 +423,15 @@ msgstr "Ereignis" msgid "Print Preview" msgstr "Druckvorschau" +#: vpsr.rsdlgreseditcaption +msgid "Resource Edit" +msgstr "Ressource bearbeiten" + +#: vpsr.rsdlgreseditdescription +msgctxt "vpsr.rsdlgreseditdescription" +msgid "Description" +msgstr "Beschreibung" + #: vpsr.rsdlgtaskedit msgid "Task" msgstr "Aufgabe" @@ -851,6 +856,10 @@ msgstr "Termin-Wiederholung:" msgid "Reminder" msgstr "Erinnerung" +#: vpsr.rsresource +msgid "Resource" +msgstr "Ressource" + #: vpsr.rssaturday msgid "Saturday" msgstr "Samstag" @@ -900,6 +909,11 @@ msgstr "Sonntag" msgid "Wy" msgstr "Wy" +#: vpsr.rstaskcomplete +msgctxt "vpsr.rstaskcomplete" +msgid "Task complete" +msgstr "Aufgabe fertiggestellt" + #: vpsr.rstaskpopupadd msgid "Add Task..." msgstr "Aufgabe hinzufügen..." diff --git a/components/tvplanit/languages/vpsr.po b/components/tvplanit/languages/vpsr.po index 0228d8bd4..f2ef84262 100644 --- a/components/tvplanit/languages/vpsr.po +++ b/components/tvplanit/languages/vpsr.po @@ -239,10 +239,6 @@ msgstr "" msgid "Company:" msgstr "" -#: vpsr.rscomplete -msgid "Task complete" -msgstr "" - #: vpsr.rscompletedon msgid "Completed on" msgstr "" @@ -417,6 +413,15 @@ msgstr "" msgid "Print Preview" msgstr "" +#: vpsr.rsdlgreseditcaption +msgid "Resource Edit" +msgstr "" + +#: vpsr.rsdlgreseditdescription +msgctxt "vpsr.rsdlgreseditdescription" +msgid "Description" +msgstr "" + #: vpsr.rsdlgtaskedit msgid "Task" msgstr "" @@ -841,6 +846,10 @@ msgstr "" msgid "Reminder" msgstr "" +#: vpsr.rsresource +msgid "Resource" +msgstr "" + #: vpsr.rssaturday msgid "Saturday" msgstr "" @@ -890,6 +899,11 @@ msgstr "" msgid "Wy" msgstr "" +#: vpsr.rstaskcomplete +msgctxt "vpsr.rstaskcomplete" +msgid "Task complete" +msgstr "" + #: vpsr.rstaskpopupadd msgid "Add Task..." msgstr "" diff --git a/components/tvplanit/source/vpcontacteditdlg.pas b/components/tvplanit/source/vpcontacteditdlg.pas index aa3f753eb..2e8144b86 100644 --- a/components/tvplanit/source/vpcontacteditdlg.pas +++ b/components/tvplanit/source/vpcontacteditdlg.pas @@ -359,26 +359,6 @@ end; {=====} procedure TContactEditForm.ResizeControls; - - function GetLabelWidth (ALabel : TLabel) : Integer; - var - OldFont : TFont; - - begin - OldFont := TFont.Create; - try - OldFont.Assign (Canvas.Font); - try - Canvas.Font.Assign (ALabel.Font); - Result := Canvas.TextWidth (ALabel.Caption); - finally - Canvas.Font.Assign (OldFont); - end; - finally - OldFont.Free; - end; - end; - const ComboArrowWidth = 32; FieldVertSep = 25; diff --git a/components/tvplanit/source/vpevnteditdlg.lfm b/components/tvplanit/source/vpevnteditdlg.lfm index 4dda361c3..bf925d8cc 100644 --- a/components/tvplanit/source/vpevnteditdlg.lfm +++ b/components/tvplanit/source/vpevnteditdlg.lfm @@ -39,10 +39,10 @@ object DlgEventEdit: TDlgEventEdit ParentFont = False end object OKBtn: TButton - Left = 509 + Left = 528 Height = 25 Top = 8 - Width = 85 + Width = 75 Anchors = [akTop, akRight] Caption = '&OK' Default = True @@ -51,10 +51,10 @@ object DlgEventEdit: TDlgEventEdit TabStop = False end object CancelBtn: TButton - Left = 602 + Left = 608 Height = 25 Top = 8 - Width = 85 + Width = 75 Anchors = [akTop, akRight] Cancel = True Caption = '&Cancel' @@ -70,7 +70,7 @@ object DlgEventEdit: TDlgEventEdit Width = 679 Anchors = [akTop, akLeft, akRight] Caption = 'Appointment' - ClientHeight = 199 + ClientHeight = 198 ClientWidth = 675 TabOrder = 0 object DescriptionLbl: TLabel @@ -290,7 +290,7 @@ object DlgEventEdit: TDlgEventEdit end object StartTime: TComboBox Left = 231 - Height = 22 + Height = 23 Top = 104 Width = 93 ItemHeight = 15 @@ -300,7 +300,7 @@ object DlgEventEdit: TDlgEventEdit end object EndTime: TComboBox Left = 231 - Height = 22 + Height = 23 Top = 131 Width = 93 ItemHeight = 15 @@ -321,7 +321,7 @@ object DlgEventEdit: TDlgEventEdit end object RecurringType: TComboBox Left = 379 - Height = 22 + Height = 23 Top = 104 Width = 187 ItemHeight = 15 @@ -344,7 +344,7 @@ object DlgEventEdit: TDlgEventEdit end object AlarmAdvType: TComboBox Left = 231 - Height = 22 + Height = 23 Top = 167 Width = 93 ItemHeight = 15 diff --git a/components/tvplanit/source/vpmisc.pas b/components/tvplanit/source/vpmisc.pas index 5f825656b..062cdb80a 100644 --- a/components/tvplanit/source/vpmisc.pas +++ b/components/tvplanit/source/vpmisc.pas @@ -39,7 +39,7 @@ uses {$ELSE} Windows, Consts, {$ENDIF} - Buttons, Classes, Controls, ExtCtrls, Forms, Graphics, Messages, + Buttons, Classes, Controls, StdCtrls, ExtCtrls, Forms, Graphics, Messages, SysUtils, VpBase, VpData, VpConst; type @@ -127,6 +127,8 @@ function LineToStartTime(Line: Integer; Granularity: TVpGranularity): TDateTime; function GetLineDuration(Granularity: TVpGranularity): Double; +function GetLabelWidth(ALabel : TLabel) : Integer; + implementation uses @@ -576,4 +578,15 @@ begin end; {=====} +function GetLabelWidth(ALabel : TLabel) : Integer; +var + canvas: TControlCanvas; +begin + canvas := TControlCanvas.Create; + canvas.Control := ALabel; + Result := canvas.TextWidth(ALabel.Caption); + canvas.Free; +end; + + end. diff --git a/components/tvplanit/source/vpreseditdlg.lfm b/components/tvplanit/source/vpreseditdlg.lfm index 42538c153..19a38c60a 100644 --- a/components/tvplanit/source/vpreseditdlg.lfm +++ b/components/tvplanit/source/vpreseditdlg.lfm @@ -60,7 +60,7 @@ object ResEditForm: TResEditForm TabOrder = 0 object tabResource: TTabSheet Caption = 'Resource' - ClientHeight = 182 + ClientHeight = 181 ClientWidth = 392 object lblDescription: TLabel Left = 8 @@ -122,7 +122,7 @@ object ResEditForm: TResEditForm end object NotesMemo: TMemo Left = 8 - Height = 103 + Height = 102 Top = 67 Width = 374 Anchors = [akTop, akLeft, akRight, akBottom] diff --git a/components/tvplanit/source/vpreseditdlg.pas b/components/tvplanit/source/vpreseditdlg.pas index f903c67ad..b4c964efd 100644 --- a/components/tvplanit/source/vpreseditdlg.pas +++ b/components/tvplanit/source/vpreseditdlg.pas @@ -98,6 +98,9 @@ implementation {$R *.dfm} {$ENDIF} +uses + vpSR, vpMisc; + function ExecuteResourceDlg(Resource: TVpResource): Boolean; var EditForm: TResEditForm; @@ -196,6 +199,17 @@ procedure TResEditForm.PopulateSelf; begin DescriptionEdit.Text := Resource.Description; NotesMemo.Text := Resource.Notes; + + Caption := RSDlgResEditCaption; + tabResource.Caption := RSResource; + lblDescription.Caption := RSDlgResEditDescription; + lblNotes.Caption := RSNotes; + OKBtn.Caption := RSOKBtn; + CancelBtn.Caption := RSCancelBtn; + + DescriptionEdit.Left := lblDescription.Left + GetLabelWidth(lblDescription) + 8; + DescriptionEdit.Width := imgResources.Left - 16 - DescriptionEdit.Left; + end; {=====} diff --git a/components/tvplanit/source/vpsr.inc b/components/tvplanit/source/vpsr.inc index 1531e5082..05bf5e5d3 100644 --- a/components/tvplanit/source/vpsr.inc +++ b/components/tvplanit/source/vpsr.inc @@ -252,11 +252,16 @@ resourcestring RSDlgTaskEdit = 'Task'; RSDueDate = 'Due Date:'; RSDetails = 'Details:'; - RSComplete = 'Task complete'; + RSTaskComplete = 'Task complete'; RSDaysOverdue = ' Days overdue'; RSCreatedOn = 'Created on'; RSCompletedOn = 'Completed on'; + { Resource Edit Dialog Captions } + RSDlgResEditCaption = 'Resource Edit'; + RSDlgResEditDescription = 'Description'; + RSResource = 'Resource'; + { Reminder Dialog Captions} RSReminder = 'Reminder'; RSOverdue = 'OVERDUE!'; @@ -273,28 +278,6 @@ resourcestring RS1Day = '1 day'; RSXDays = '%d days'; RS1Week = '1 week'; - { - RS5Minutes = '5 Minutes'; - RS10Minutes = '10 Minutes'; - RS15Minutes = '15 Minutes'; - RS30Minutes = '30 Minutes'; - RS45Minutes = '45 Minutes'; - RS1Hour = '1 Hour'; - RS2Hours = '2 Hours'; - RS3Hours = '3 Hours'; - RS4Hours = '4 Hours'; - RS5Hours = '5 Hours'; - RS6Hours = '6 Hours'; - RS7Hours = '7 Hours'; - RS8Hours = '8 Hours'; - RS1Days = '1 Day'; - RS2Days = '2 Days'; - RS3Days = '3 Days'; - RS4Days = '4 Days'; - RS5Days = '5 Days'; - RS6Days = '6 Days'; - RS1Week = '1 Week'; - } { Calendar } RSCalendarPrevMonth = 'Previous Month'; diff --git a/components/tvplanit/source/vptaskeditdlg.lfm b/components/tvplanit/source/vptaskeditdlg.lfm index e279fc1b2..60f71f753 100644 --- a/components/tvplanit/source/vptaskeditdlg.lfm +++ b/components/tvplanit/source/vptaskeditdlg.lfm @@ -74,7 +74,7 @@ object TaskEditForm: TTaskEditForm TabOrder = 0 object tabTask: TTabSheet Caption = 'Task' - ClientHeight = 276 + ClientHeight = 275 ClientWidth = 539 object DueDateLbl: TLabel Left = 52 @@ -94,7 +94,7 @@ object TaskEditForm: TTaskEditForm ParentColor = False end object CompletedOnLbl: TLabel - Left = 313 + Left = 333 Height = 15 Top = 69 Width = 79 @@ -227,7 +227,7 @@ object TaskEditForm: TTaskEditForm Transparent = True end object imgCompleted: TImage - Left = 272 + Left = 290 Height = 32 Top = 38 Width = 32 @@ -269,16 +269,16 @@ object TaskEditForm: TTaskEditForm Text = 'DescriptionEdit' end object CompleteCB: TCheckBox - Left = 313 + Left = 333 Height = 19 - Top = 41 + Top = 43 Width = 72 Caption = 'Complete' TabOrder = 2 end object DetailsMemo: TMemo Left = 4 - Height = 147 + Height = 146 Top = 96 Width = 529 Anchors = [akTop, akLeft, akRight, akBottom] diff --git a/components/tvplanit/source/vptaskeditdlg.pas b/components/tvplanit/source/vptaskeditdlg.pas index 1df8a7c05..61ae5010f 100644 --- a/components/tvplanit/source/vptaskeditdlg.pas +++ b/components/tvplanit/source/vptaskeditdlg.pas @@ -105,6 +105,9 @@ type implementation +uses + VpMisc; + {$IFDEF LCL} {$R *.lfm} {$ELSE} @@ -132,6 +135,7 @@ end; procedure TTaskEditForm.PopulateSelf; begin ResourceNameLbl.Caption := Resource.Description; + CompleteCB.Caption := RSTaskComplete; DueDateLbl.Caption := RSDueDate; OKBtn.Caption := RSOKBtn; CancelBtn.Caption := RSCancelBtn; @@ -148,6 +152,8 @@ begin CompletedOnLbl.Visible := CompleteCB.Checked; CreatedOnLbl.Caption := RSCreatedOn + ' ' + FormatDateTime(ShortDateFormat, Task.CreatedOn); + + DueDateEdit.Left := DueDateLbl.Left + GetLabelWidth(DueDateLbl) + 8; end; {=====} diff --git a/components/tvplanit/source/vptasklist.pas b/components/tvplanit/source/vptasklist.pas index 6099e52bf..9f101d8a9 100644 --- a/components/tvplanit/source/vptasklist.pas +++ b/components/tvplanit/source/vptasklist.pas @@ -902,6 +902,7 @@ var end; end; + RenderCanvas.Font.Assign(Font); for I := StartLine to pred(tlAllTaskList.Count) do begin Task := tlAllTaskList[I]; if (LineRect.Top + Trunc(RowHeight * 0.5) <= RealBottom) then begin @@ -996,15 +997,19 @@ var HeadRect.Bottom := RealTop + RenderCanvas.TextHeight ('YyGg0') + TextMargin * 2; TPSFillRect (RenderCanvas, Angle, RenderIn, HeadRect); + { draw the header cell borders } if FDrawingStyle = dsFlat then begin { draw an outer and inner bevel } + + { wp: no bevel in flat style! HeadRect.Left := HeadRect.Left - 1; HeadRect.Top := HeadRect.Top - 1; DrawBevelRect (RenderCanvas, TPSRotateRectangle (Angle, RenderIn, HeadRect), BevelShadow, BevelShadow); + } end else if FDrawingStyle = ds3d then begin { draw a 3d bevel } HeadRect.Right := HeadRect.Right - 1; @@ -1034,7 +1039,8 @@ var finally Bmp.Free; end; - end; + end; + { draw the text } if ShowResourceName and (DataStore <> nil) diff --git a/components/tvplanit/source/vpweekview.pas b/components/tvplanit/source/vpweekview.pas index cf2c7d015..34d9900c5 100644 --- a/components/tvplanit/source/vpweekview.pas +++ b/components/tvplanit/source/vpweekview.pas @@ -1039,6 +1039,9 @@ var { draw the header cell and borders } if FDrawingStyle = dsFlat then begin { draw an outer and inner bevel } + HeadRect := Rect(RealLeft, RealTop, RealRight, RealTop + wvHeaderHeight + 2); + TPSFillRect(RenderCanvas, Angle, RenderIn, HeadRect); + { wp: above lines replace the next ones - no bevel in flat style! HeadRect.Left := RealLeft + 1; HeadRect.Top := RealTop + 1; HeadRect.Right := RealRight - 1; @@ -1047,6 +1050,7 @@ var DrawBevelRect (RenderCanvas, TPSRotateRectangle (Angle, RenderIn, HeadRect), BevelHighlightColor, BevelShadowColor); + } end else if FDrawingStyle = ds3d then begin { draw a 3d bevel } HeadRect.Left := RealLeft + 2;