tvplanit: Extend context menus by option to select an arbitrary date.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8343 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2022-07-11 22:59:40 +00:00
parent c93f5d5226
commit 6570c023c5
15 changed files with 168 additions and 8 deletions

View File

@ -306,6 +306,10 @@ msgstr "Benutzerdefiniert 3"
msgid "Custom 4"
msgstr "Benutzerdefiniert 4"
#: vpsr.rscustomdate
msgid "Custom date..."
msgstr "Beliebiges Datum..."
#: vpsr.rsdaily
msgid "Daily"
msgstr "Täglich"
@ -1117,6 +1121,10 @@ msgstr "Format speichern als \"%s\"?"
msgid "Select A Sound"
msgstr "Einen Klang auswählen"
#: vpsr.rsselectcustomdate
msgid "Select custom date"
msgstr "Datum auswählen"
#: vpsr.rsselectresource
msgid "No resource has been selected. Would you like to select one now?"
msgstr "Keine Ressource ist auswählt worden. Möchten Sie jetzt eine auswählen?"

View File

@ -305,6 +305,10 @@ msgstr "Custom 3"
msgid "Custom 4"
msgstr "Custom 4"
#: vpsr.rscustomdate
msgid "Custom date..."
msgstr "Custom date..."
#: vpsr.rsdaily
msgid "Daily"
msgstr "Daily"
@ -1103,6 +1107,10 @@ msgstr "Save format to \"%s\"?"
msgid "Select A Sound"
msgstr "Select A Sound"
#: vpsr.rsselectcustomdate
msgid "Select custom date"
msgstr "Select custom date"
#: vpsr.rsselectresource
msgid "No resource has been selected. Would you like to select one now?"
msgstr "No resource has been selected. Would you like to select one now?"

View File

@ -296,6 +296,10 @@ msgstr ""
msgid "Custom 4"
msgstr ""
#: vpsr.rscustomdate
msgid "Custom date..."
msgstr ""
#: vpsr.rsdaily
msgid "Daily"
msgstr "Päivittäin"
@ -1108,6 +1112,10 @@ msgstr ""
msgid "Select A Sound"
msgstr ""
#: vpsr.rsselectcustomdate
msgid "Select custom date"
msgstr ""
#: vpsr.rsselectresource
msgid "No resource has been selected. Would you like to select one now?"
msgstr ""

View File

@ -312,6 +312,10 @@ msgstr "Personnalisé 3"
msgid "Custom 4"
msgstr "Personnalisé 4"
#: vpsr.rscustomdate
msgid "Custom date..."
msgstr ""
#: vpsr.rsdaily
msgid "Daily"
msgstr "Quotidien"
@ -1123,6 +1127,10 @@ msgstr ""
msgid "Select A Sound"
msgstr "Choissisez un son"
#: vpsr.rsselectcustomdate
msgid "Select custom date"
msgstr ""
#: vpsr.rsselectresource
msgid "No resource has been selected. Would you like to select one now?"
msgstr "Aucune resource selectionnez. Voulez-vous séléctionnez une resource maintenant?"

View File

@ -306,6 +306,10 @@ msgstr "Aangepast 3"
msgid "Custom 4"
msgstr "Aangepast 4"
#: vpsr.rscustomdate
msgid "Custom date..."
msgstr ""
#: vpsr.rsdaily
msgid "Daily"
msgstr "Dagelijks"
@ -1117,6 +1121,10 @@ msgstr ""
msgid "Select A Sound"
msgstr "Kies een geluid"
#: vpsr.rsselectcustomdate
msgid "Select custom date"
msgstr ""
#: vpsr.rsselectresource
msgid "No resource has been selected. Would you like to select one now?"
msgstr "Er is geen hulpmiddel gekozen. Wilt u er nu een kiezen?"

View File

@ -306,6 +306,10 @@ msgstr "Własny 3"
msgid "Custom 4"
msgstr "Własny 4"
#: vpsr.rscustomdate
msgid "Custom date..."
msgstr ""
#: vpsr.rsdaily
msgid "Daily"
msgstr "Dzienny"
@ -1116,6 +1120,10 @@ msgstr "Zapisać format do \"%s\"?"
msgid "Select A Sound"
msgstr "Wybierz dźwięk"
#: vpsr.rsselectcustomdate
msgid "Select custom date"
msgstr ""
#: vpsr.rsselectresource
msgid "No resource has been selected. Would you like to select one now?"
msgstr "Nie wybrano zasobów. Możesz jakiś wybrać?"

View File

@ -295,6 +295,10 @@ msgstr ""
msgid "Custom 4"
msgstr ""
#: vpsr.rscustomdate
msgid "Custom date..."
msgstr ""
#: vpsr.rsdaily
msgid "Daily"
msgstr ""
@ -1093,6 +1097,10 @@ msgstr ""
msgid "Select A Sound"
msgstr ""
#: vpsr.rsselectcustomdate
msgid "Select custom date"
msgstr ""
#: vpsr.rsselectresource
msgid "No resource has been selected. Would you like to select one now?"
msgstr ""

View File

@ -306,6 +306,10 @@ msgstr "Вручную 3"
msgid "Custom 4"
msgstr "Вручную 4"
#: vpsr.rscustomdate
msgid "Custom date..."
msgstr ""
#: vpsr.rsdaily
msgid "Daily"
msgstr "Ежедневное"
@ -1117,6 +1121,10 @@ msgstr ""
msgid "Select A Sound"
msgstr "Выберите звук"
#: vpsr.rsselectcustomdate
msgid "Select custom date"
msgstr ""
#: vpsr.rsselectresource
msgid "No resource has been selected. Would you like to select one now?"
msgstr ""

View File

@ -153,6 +153,8 @@ resourcestring
RSPrevWeek = 'Previous week';
RSPrevMonth = 'Previous month';
RSPrevYear = 'Previous year';
RSCustomDate = 'Custom date...';
RSSelectCustomDate = 'Select custom date';
RSAllDay = 'All day';

View File

@ -380,6 +380,7 @@ type
procedure PopupPrevMonth(Sender: TObject);
procedure PopupNextYear(Sender: TObject);
procedure PopupPrevYear(Sender: TObject);
procedure PopupCustomDate(Sender: TObject);
procedure PopupPickResourceGroupEvent(Sender: TObject);
procedure PopupDropdownEvent(Sender: TObject);
procedure InitializeDefaultPopup;
@ -1281,6 +1282,18 @@ begin
NewSubItem.Tag := 0;
NewItem.Add(NewSubItem);
end;
NewSubItem := TMenuItem.Create(Self); // ---
NewSubItem.Caption := '-';
NewItem.Add(NewSubItem);
if RSCustomDate <> '' then begin // Prev year
NewSubItem := TMenuItem.Create(Self);
NewSubItem.Caption := RSCustomDate;
NewSubItem.OnClick := PopupCustomDate;
NewSubItem.Tag := 0;
NewItem.Add(NewSubItem);
end;
end;
if (Datastore <> nil) and (Datastore.Resource <> nil) then
@ -1477,7 +1490,15 @@ begin
DecodeDate(Date, Y, M, D);
Date := EncodeDate(Y - 1, M, 1);
end;
{=====}
procedure TVpDayView.PopupCustomDate(Sender: TObject);
var
d: TDate;
begin
d := Date;
if DateDialog(RSSelectCustomDate, d) then
Date := d;
end;
procedure TVpDayView.PopupPickResourceGroupEvent(Sender: TObject);
begin

View File

@ -11,6 +11,7 @@ object DlgEventEdit: TDlgEventEdit
OnCreate = FormCreate
OnShow = FormShow
Position = poScreenCenter
LCLVersion = '2.3.0.0'
object ButtonPanel: TPanel
Left = 0
Height = 37
@ -605,7 +606,7 @@ object DlgEventEdit: TDlgEventEdit
AnchorSideLeft.Control = CustomInterval
AnchorSideLeft.Side = asrBottom
AnchorSideRight.Side = asrBottom
Left = 679
Left = 676
Height = 23
Top = 101
Width = 12
@ -734,7 +735,7 @@ object DlgEventEdit: TDlgEventEdit
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = StartDate
AnchorSideRight.Side = asrBottom
Left = 230
Left = 217
Height = 23
Top = 178
Width = 12

View File

@ -580,9 +580,8 @@ begin
IntervalLbl.Caption := RSIntervalLbl;
rbRepeatUntil.Caption := RSRecurrenceEndsLbl;
rbRepeatForever.Caption := RSRecurrenceForever;
CBAllDay.Caption := RSAllDayEvent;
cbAllDay.Caption := RSAllDayEvent;
end;
{=====}
procedure TDlgEventEdit.AlarmAdvanceChange(Sender: TObject);
var

View File

@ -152,6 +152,8 @@ function SameTimeOrLater(t1, t2: TTime): Boolean;
function DateInRange(ADate, StartDate, EndDate: TDateTime; IncludeLimits: Boolean): Boolean;
function TimeInRange(ATime, StartTime, EndTime: TDateTime; IncludeLimits: Boolean): Boolean;
function DateDialog(ACaption: String; var ADate: TDate): Boolean;
function GetTimeFormat: TVpTimeFormat;
function GetTimeFormatStr(ATimeFormat: TVpTimeFormat): String;
function HourToAMPM(Hour: TVpHours): string;
@ -203,7 +205,7 @@ implementation
uses
Math,
{$IFDEF LCL}
DateUtils, StrUtils,
DateUtils, StrUtils, EditBtn, ButtonPanel,
{$ENDIF}
VpSR, VpBaseDS;
@ -836,11 +838,39 @@ begin
Result := (DayOfWeek(ADate) in [1, 7]);
end;
// Displays a date dialog
function DateDialog(ACaption: String; var ADate: TDate): Boolean;
var
F: TForm;
ed: TDateEdit;
bp: TButtonPanel;
begin
F := TForm.CreateNew(nil);
try
F.Position := poMainFormCenter;
F.Caption := ACaption;
F.BorderStyle := bsDialog;
ed := TDateEdit.Create(F);
ed.Align := alClient;
ed.BorderSpacing.Around := 8;
ed.Parent := F;
ed.Date := ADate;
bp := TButtonPanel.Create(F);
bp.ShowButtons := [pbOK, pbCancel];
bp.Parent := F;
F.AutoSize := true;
Result := F.ShowModal = mrOK;
if Result then
ADate := ed.Date;
finally
F.Free;
end;
end;
function LineToStartTime(Line: Integer; Granularity: TVpGranularity): TDateTime;
begin
Result := frac(Line * GranularityMinutes[Granularity] / MinutesInDay);
end;
{=====}
function GetLineDuration(Granularity: TVpGranularity): Double;
begin

View File

@ -275,6 +275,7 @@ type
procedure PopupPrevMonth(Sender: TObject);
procedure PopupNextYear(Sender: TObject);
procedure PopupPrevYear(Sender: TObject);
procedure PopupCustomDate(Sender: TObject);
public
constructor Create(AOwner: TComponent); override;
@ -1257,6 +1258,18 @@ begin
NewItem.OnClick := PopupPrevYear;
FDefaultPopup.Items.Add(NewItem);
end;
NewItem := TMenuItem.Create(Self);
NewItem.Caption := '-';
FDefaultPopup.Items.Add(NewItem);
if RSCustomDate <> '' then begin
NewItem := TMenuItem.Create(Self);
NewItem.Caption := RSCustomDate;
NewItem.OnClick := PopupCustomDate;
NewItem.Tag := 0;
FDefaultPopup.Items.Add(NewItem);
end;
end;
procedure TVpMonthView.PopupDropDownEvent(Sender: TObject);
@ -1298,7 +1311,15 @@ begin
DecodeDate(Date, Y, M, D);
Date := EncodeDate(Y - 1, M, 1);
end;
{=====}
procedure TVpMonthView.PopupCustomDate(Sender: TObject);
var
d: TDate;
begin
d := Date;
if DateDialog(RSSelectCustomDate, d) then
Date := d;
end;
{ - renamed from EditEventAtCoord and re-written}
function TVpMonthView.SelectEventAtCoord(Point: TPoint): Boolean;

View File

@ -204,6 +204,7 @@ type
procedure PopupPrevMonth(Sender: TObject);
procedure PopupNextYear(Sender: TObject);
procedure PopupPrevYear(Sender: TObject);
procedure PopupCustomDate(Sender: TObject);
procedure PopupPickResourceGroupEvent(Sender: TObject);
procedure PopupDropdownEvent(Sender: TObject);
procedure InitializeDefaultPopup;
@ -1222,6 +1223,18 @@ begin
NewSubItem.Tag := 0;
NewItem.Add(NewSubItem);
end;
NewSubItem := TMenuItem.Create(Self); // ---
NewSubItem.Caption := '-';
NewItem.Add(NewSubItem);
if RSCustomDate <> '' then begin // Custom date
NewSubItem := TMenuItem.Create(Self);
NewSubItem.Caption := RSCustomDate;
NewSubItem.OnClick := PopupCustomDate;
NewSubItem.Tag := 0;
NewItem.Add(NewSubItem);
end;
end;
if (Datastore <> nil) and (Datastore.Resource <> nil) then
@ -1400,6 +1413,15 @@ begin
Date := EncodeDate(Y - 1, M, 1);
end;
procedure TVpWeekView.PopupCustomDate(Sender: TObject);
var
d: TDate;
begin
d := Date;
if DateDialog(RSSelectCustomDate, d) then
Date := d;
end;
procedure TVpWeekView.PopupPickResourceGroupEvent(Sender: TObject);
begin
Datastore.Resource.Group := TVpResourceGroup(TMenuItem(Sender).Tag);