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" msgid "Custom 4"
msgstr "Benutzerdefiniert 4" msgstr "Benutzerdefiniert 4"
#: vpsr.rscustomdate
msgid "Custom date..."
msgstr "Beliebiges Datum..."
#: vpsr.rsdaily #: vpsr.rsdaily
msgid "Daily" msgid "Daily"
msgstr "Täglich" msgstr "Täglich"
@ -1117,6 +1121,10 @@ msgstr "Format speichern als \"%s\"?"
msgid "Select A Sound" msgid "Select A Sound"
msgstr "Einen Klang auswählen" msgstr "Einen Klang auswählen"
#: vpsr.rsselectcustomdate
msgid "Select custom date"
msgstr "Datum auswählen"
#: vpsr.rsselectresource #: vpsr.rsselectresource
msgid "No resource has been selected. Would you like to select one now?" 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?" 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" msgid "Custom 4"
msgstr "Custom 4" msgstr "Custom 4"
#: vpsr.rscustomdate
msgid "Custom date..."
msgstr "Custom date..."
#: vpsr.rsdaily #: vpsr.rsdaily
msgid "Daily" msgid "Daily"
msgstr "Daily" msgstr "Daily"
@ -1103,6 +1107,10 @@ msgstr "Save format to \"%s\"?"
msgid "Select A Sound" msgid "Select A Sound"
msgstr "Select A Sound" msgstr "Select A Sound"
#: vpsr.rsselectcustomdate
msgid "Select custom date"
msgstr "Select custom date"
#: vpsr.rsselectresource #: vpsr.rsselectresource
msgid "No resource has been selected. Would you like to select one now?" 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?" msgstr "No resource has been selected. Would you like to select one now?"

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -380,6 +380,7 @@ type
procedure PopupPrevMonth(Sender: TObject); procedure PopupPrevMonth(Sender: TObject);
procedure PopupNextYear(Sender: TObject); procedure PopupNextYear(Sender: TObject);
procedure PopupPrevYear(Sender: TObject); procedure PopupPrevYear(Sender: TObject);
procedure PopupCustomDate(Sender: TObject);
procedure PopupPickResourceGroupEvent(Sender: TObject); procedure PopupPickResourceGroupEvent(Sender: TObject);
procedure PopupDropdownEvent(Sender: TObject); procedure PopupDropdownEvent(Sender: TObject);
procedure InitializeDefaultPopup; procedure InitializeDefaultPopup;
@ -1281,6 +1282,18 @@ begin
NewSubItem.Tag := 0; NewSubItem.Tag := 0;
NewItem.Add(NewSubItem); NewItem.Add(NewSubItem);
end; 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; end;
if (Datastore <> nil) and (Datastore.Resource <> nil) then if (Datastore <> nil) and (Datastore.Resource <> nil) then
@ -1477,7 +1490,15 @@ begin
DecodeDate(Date, Y, M, D); DecodeDate(Date, Y, M, D);
Date := EncodeDate(Y - 1, M, 1); Date := EncodeDate(Y - 1, M, 1);
end; 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); procedure TVpDayView.PopupPickResourceGroupEvent(Sender: TObject);
begin begin

View File

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

View File

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

View File

@ -152,6 +152,8 @@ function SameTimeOrLater(t1, t2: TTime): Boolean;
function DateInRange(ADate, StartDate, EndDate: TDateTime; IncludeLimits: Boolean): Boolean; function DateInRange(ADate, StartDate, EndDate: TDateTime; IncludeLimits: Boolean): Boolean;
function TimeInRange(ATime, StartTime, EndTime: 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 GetTimeFormat: TVpTimeFormat;
function GetTimeFormatStr(ATimeFormat: TVpTimeFormat): String; function GetTimeFormatStr(ATimeFormat: TVpTimeFormat): String;
function HourToAMPM(Hour: TVpHours): string; function HourToAMPM(Hour: TVpHours): string;
@ -203,7 +205,7 @@ implementation
uses uses
Math, Math,
{$IFDEF LCL} {$IFDEF LCL}
DateUtils, StrUtils, DateUtils, StrUtils, EditBtn, ButtonPanel,
{$ENDIF} {$ENDIF}
VpSR, VpBaseDS; VpSR, VpBaseDS;
@ -836,11 +838,39 @@ begin
Result := (DayOfWeek(ADate) in [1, 7]); Result := (DayOfWeek(ADate) in [1, 7]);
end; 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; function LineToStartTime(Line: Integer; Granularity: TVpGranularity): TDateTime;
begin begin
Result := frac(Line * GranularityMinutes[Granularity] / MinutesInDay); Result := frac(Line * GranularityMinutes[Granularity] / MinutesInDay);
end; end;
{=====}
function GetLineDuration(Granularity: TVpGranularity): Double; function GetLineDuration(Granularity: TVpGranularity): Double;
begin begin

View File

@ -275,6 +275,7 @@ type
procedure PopupPrevMonth(Sender: TObject); procedure PopupPrevMonth(Sender: TObject);
procedure PopupNextYear(Sender: TObject); procedure PopupNextYear(Sender: TObject);
procedure PopupPrevYear(Sender: TObject); procedure PopupPrevYear(Sender: TObject);
procedure PopupCustomDate(Sender: TObject);
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
@ -1257,6 +1258,18 @@ begin
NewItem.OnClick := PopupPrevYear; NewItem.OnClick := PopupPrevYear;
FDefaultPopup.Items.Add(NewItem); FDefaultPopup.Items.Add(NewItem);
end; 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; end;
procedure TVpMonthView.PopupDropDownEvent(Sender: TObject); procedure TVpMonthView.PopupDropDownEvent(Sender: TObject);
@ -1298,7 +1311,15 @@ begin
DecodeDate(Date, Y, M, D); DecodeDate(Date, Y, M, D);
Date := EncodeDate(Y - 1, M, 1); Date := EncodeDate(Y - 1, M, 1);
end; 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} { - renamed from EditEventAtCoord and re-written}
function TVpMonthView.SelectEventAtCoord(Point: TPoint): Boolean; function TVpMonthView.SelectEventAtCoord(Point: TPoint): Boolean;

View File

@ -204,6 +204,7 @@ type
procedure PopupPrevMonth(Sender: TObject); procedure PopupPrevMonth(Sender: TObject);
procedure PopupNextYear(Sender: TObject); procedure PopupNextYear(Sender: TObject);
procedure PopupPrevYear(Sender: TObject); procedure PopupPrevYear(Sender: TObject);
procedure PopupCustomDate(Sender: TObject);
procedure PopupPickResourceGroupEvent(Sender: TObject); procedure PopupPickResourceGroupEvent(Sender: TObject);
procedure PopupDropdownEvent(Sender: TObject); procedure PopupDropdownEvent(Sender: TObject);
procedure InitializeDefaultPopup; procedure InitializeDefaultPopup;
@ -1222,6 +1223,18 @@ begin
NewSubItem.Tag := 0; NewSubItem.Tag := 0;
NewItem.Add(NewSubItem); NewItem.Add(NewSubItem);
end; 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; end;
if (Datastore <> nil) and (Datastore.Resource <> nil) then if (Datastore <> nil) and (Datastore.Resource <> nil) then
@ -1400,6 +1413,15 @@ begin
Date := EncodeDate(Y - 1, M, 1); Date := EncodeDate(Y - 1, M, 1);
end; 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); procedure TVpWeekView.PopupPickResourceGroupEvent(Sender: TObject);
begin begin
Datastore.Resource.Group := TVpResourceGroup(TMenuItem(Sender).Tag); Datastore.Resource.Group := TVpResourceGroup(TMenuItem(Sender).Tag);