You've already forked lazarus-ccr
tvplanit: Add "Don't ask again" checkbox to VpPrtFmt editor save prompt by using a TTaskDialog. Update resource strings and translations.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8540 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -74,14 +74,15 @@ var
|
||||
frmPrtFmtEd : TVpPrtFmtEditor;
|
||||
|
||||
{$IFDEF VERSION6}
|
||||
procedure EditPrtFmts(Designer : TIDesigner; Link : TVpControlLink);
|
||||
procedure EditPrtFmts(Designer: TIDesigner; Link: TVpControlLink);
|
||||
{$ELSE}
|
||||
procedure EditPrtFmts(Designer : TIFormDesigner; Link : TVpControlLink);
|
||||
procedure EditPrtFmts(Designer: TIFormDesigner; Link: TVpControlLink);
|
||||
{$ENDIF}
|
||||
begin
|
||||
frmPrtFmtEd := TVpPrtFmtEditor.Create(Application);
|
||||
frmPrtFmtEd.Designer := Designer;
|
||||
frmPrtFmtEd.ControlLink := Link;
|
||||
frmPrtFmtEd.ShowSavePrompt := false;
|
||||
frmPrtFmtEd.Execute;
|
||||
if Assigned(Designer) then
|
||||
Designer.Modified;
|
||||
|
@ -363,14 +363,19 @@ resourcestring
|
||||
RSTestDialog = 'Test dialog...';
|
||||
|
||||
{ Print format list }
|
||||
RSSaveFormatChangesToFile = 'Save format to file?';
|
||||
RSSaveFormatChangesToFilename = 'Save format to "%s"?';
|
||||
RSSaveFormatChangesToFile = 'Save print template to file?';
|
||||
RSSaveFormatChangesToFilename = 'Save print template to "%s"?';
|
||||
RSPrintFormatAlreadyExists = 'A print template named %s already exists.'#13#10'Please use a different name.';
|
||||
RSElementAlreadyExists = 'An element named %s already exists.'#13#10'Please use a different name.';
|
||||
RSConfirmation = 'Confirmation';
|
||||
RSSavePrintFormat = 'Save print template';
|
||||
RSDoNotAskAgain = 'Do not ask again.';
|
||||
|
||||
{ Print Format Editor }
|
||||
RSEditPrintFormat = 'Edit Print Formats...';
|
||||
RSPrintFormatDesigner = 'Print format designer';
|
||||
RSFormatLbl = 'Format:';
|
||||
RSFormats = 'Formats:';
|
||||
RSEditPrintFormat = 'Edit Print Templates...';
|
||||
RSPrintFormatDesigner = 'Print template designer';
|
||||
RSFormatLbl = 'Template:';
|
||||
RSFormats = 'Templates:';
|
||||
RSElements = 'Elements:';
|
||||
RSNewBtn = 'New';
|
||||
RSEditBtn = 'Edit';
|
||||
@ -379,14 +384,14 @@ resourcestring
|
||||
RSNewFileBtn = 'New file';
|
||||
RSLoadFileBtn = 'Load file...';
|
||||
RSSaveFileBtn = 'Save file...';
|
||||
RSNoPrintFormatName = 'Please supply a format name';
|
||||
RSNoPrintFormatName = 'Please supply a template name';
|
||||
RSNoDayIncrement = 'Day increment unit not specified.';
|
||||
RSPleaseEnterFloat = 'Please enter a valid floating point value.';
|
||||
|
||||
RSReportSetup = 'Report setup';
|
||||
|
||||
{ Print Format Item Editor }
|
||||
RSEditFormatCaption = 'Edit format';
|
||||
RSEditFormatCaption = 'Edit template';
|
||||
RSNameLbl = 'Name:';
|
||||
RSDayIncLbl = 'Day increment:';
|
||||
RSDayIncUnits = 'Day increment units';
|
||||
@ -439,14 +444,14 @@ resourcestring
|
||||
RSColorLbl = 'Color:';
|
||||
|
||||
{ Automatic resource adding/selection}
|
||||
RSAddNewResource = 'No resources have been defined. Would you ' +
|
||||
'like to add one now?';
|
||||
RSSelectResource = 'No resource has been selected. Would you ' +
|
||||
'like to select one now?';
|
||||
RSAddNewResource = 'No resources have been defined. ' +
|
||||
'Would you like to add one now?';
|
||||
RSSelectResource = 'No resource has been selected. ' +
|
||||
'Would you like to select one now?';
|
||||
|
||||
{ AboutBox }
|
||||
RSBrowserError = 'Unable to start web browser. Make sure you have ' +
|
||||
'it properly setup on your system.';
|
||||
RSBrowserError = 'Unable to start web browser. Make sure that it is ' +
|
||||
'propertly set up on your system.';
|
||||
|
||||
{ Ini storage }
|
||||
RSIniFileStructure = 'Incorrect structure of ini file.';
|
||||
|
@ -555,9 +555,7 @@ end;
|
||||
|
||||
destructor TVpContactGrid.Destroy;
|
||||
begin
|
||||
if (HandleAllocated) and (Assigned (DataStore)) and
|
||||
(not (csDesigning in ComponentState))
|
||||
then
|
||||
if HandleAllocated and Assigned(DataStore) and (not (csDesigning in ComponentState)) then
|
||||
DataStore.DeregisterWatcher(Handle);
|
||||
|
||||
cgClickTimer.Free;
|
||||
|
@ -109,6 +109,7 @@ type
|
||||
LastX, LastY: Integer;
|
||||
DragItem: Integer;
|
||||
FDrawingStyle: TVpDrawingStyle;
|
||||
FShowSavePrompt: Boolean;
|
||||
procedure PositionControls;
|
||||
procedure SetCaptions;
|
||||
procedure SetDrawingStyle(const v: TVpDrawingStyle);
|
||||
@ -137,6 +138,7 @@ type
|
||||
function Execute: Boolean;
|
||||
property ControlLink: TVpControlLink read FControlLink write SetControlLink;
|
||||
property DrawingStyle: TVpDrawingStyle read FDrawingStyle write SetDrawingStyle;
|
||||
property ShowSavePrompt: Boolean read FShowSavePrompt write FShowSavePrompt;
|
||||
|
||||
published
|
||||
property FormatFileName : string read FFormatFileName write SetFormatFileName;
|
||||
@ -167,6 +169,7 @@ begin
|
||||
OpenDialog.InitialDir := ExtractFilePath(Application.ExeName);
|
||||
SaveDialog.InitialDir := ExtractFilePath(Application.ExeName);
|
||||
IsDirty := False;
|
||||
FShowSavePrompt := true;
|
||||
FormatFileName := UnnamedFile;
|
||||
|
||||
EnableFormatButtons(False);
|
||||
@ -374,12 +377,26 @@ end;
|
||||
function TfrmPrnFormat.DirtyPrompt: Integer;
|
||||
var
|
||||
msg: String;
|
||||
taskDlg: TTaskDialog;
|
||||
begin
|
||||
if FormatFileName = '' then
|
||||
msg := RSSaveFormatChangesToFile
|
||||
else
|
||||
msg := Format(RSSaveFormatChangesToFilename, [FormatFileName]);
|
||||
Result := MessageDlg(msg, mtConfirmation, [mbYes, mbNo, mbCancel], 0);
|
||||
|
||||
taskDlg := TTaskDialog.Create(self);
|
||||
taskDlg.Text := msg;
|
||||
taskDlg.Caption := RSConfirmation;
|
||||
taskDlg.MainIcon := tdiQuestion;
|
||||
taskDlg.Title := RSSavePrintFormat;
|
||||
taskDlg.CommonButtons := [tcbYes, tcbNo, tcbCancel];
|
||||
taskDlg.VerificationText := RSDoNotAskAgain;
|
||||
taskDlg.Execute;
|
||||
FShowSavePrompt := not (tfVerificationFlagChecked in taskDlg.Flags);
|
||||
Result := taskDlg.ModalResult;
|
||||
taskDlg.Free;
|
||||
|
||||
//Result := MessageDlg(msg, mtConfirmation, [mbYes, mbNo, mbCancel], 0);
|
||||
end;
|
||||
|
||||
procedure TfrmPrnFormat.DoEditElement;
|
||||
@ -451,9 +468,9 @@ begin
|
||||
Cancelled := not frmEditElement.Execute(E);
|
||||
|
||||
if not Cancelled then begin
|
||||
if lbElements.Items.IndexOf(E.ElementName) > -1 then begin
|
||||
ShowMessage('An Element named ' + E.ElementName + ' already exists.' +
|
||||
#13#10 + 'Please use another name.');
|
||||
if lbElements.Items.IndexOf(E.ElementName) > -1 then
|
||||
begin
|
||||
MessageDlg(SysUtils.Format(RSElementAlreadyExists, [E.ElementName]), mtError, [mbOK], 0);
|
||||
// Dump empty element
|
||||
Format.Elements.Items[E.Index].Free;
|
||||
Unique := False;
|
||||
@ -468,7 +485,7 @@ begin
|
||||
end else
|
||||
// Dump empty element
|
||||
Format.Elements.Items[E.Index].Free;
|
||||
// ...until element name is Unique or operation is cancelled
|
||||
// ...until element name is unique or operation is cancelled
|
||||
until Unique or Cancelled;
|
||||
|
||||
EnableElementButtons(true);
|
||||
@ -512,8 +529,7 @@ begin
|
||||
|
||||
if not Cancelled then begin
|
||||
if lbFormats.Items.IndexOf(AFormat.FormatName) > -1 then begin
|
||||
ShowMessage('A format named ' + AFormat.FormatName + ' already exists.' +
|
||||
#13#10 + 'Please use another name.');
|
||||
MessageDlg(Format(RSPrintFormatAlreadyExists, [AFormat.FormatName]), mtError, [mbOK], 0);
|
||||
// Dump empty format
|
||||
Prn.PrintFormats.Items[AFormat.Index].Free;
|
||||
Unique := False;
|
||||
@ -547,7 +563,8 @@ begin
|
||||
SaveDialog.FileName := FormatFileName
|
||||
else
|
||||
SaveDialog.FileName := 'Unnamed.xml';
|
||||
if SaveDialog.Execute then begin
|
||||
if SaveDialog.Execute then
|
||||
begin
|
||||
FormatFileName := SaveDialog.FileName;
|
||||
ControlLink.Printer.SaveToFile(FormatFileName);
|
||||
IsDirty := False;
|
||||
@ -582,7 +599,7 @@ procedure TfrmPrnFormat.FormCloseQuery(Sender: TObject;
|
||||
var CanClose: Boolean);
|
||||
begin
|
||||
CanClose := True;
|
||||
if IsDirty then begin
|
||||
if IsDirty and FShowSavePrompt then begin
|
||||
case DirtyPrompt of
|
||||
mrYes: DoSave;
|
||||
mrNo: ;
|
||||
@ -799,7 +816,6 @@ begin
|
||||
Idx := Prn.Find(lbFormats.Items[lbFormats.ItemIndex]);
|
||||
if Idx > - 1 then
|
||||
Prn.CurFormat := Idx;
|
||||
{Prn.CurFormat := lbFormats.ItemIndex; }
|
||||
end;
|
||||
Prn.NotifyLinked;
|
||||
EnableMoveButtons;
|
||||
|
@ -2042,6 +2042,8 @@ begin
|
||||
|
||||
FLastTask := StartTask;
|
||||
FLastContact := StartContact;
|
||||
|
||||
// Render the page on the given canvas
|
||||
PaintToCanvasRect(ACanvas, ARect, ADate);
|
||||
|
||||
// Set the return arguments. They will be needed for printing the next page.
|
||||
|
@ -47,6 +47,7 @@ type
|
||||
private
|
||||
FControlLink: TVpControlLink;
|
||||
FDrawingStyle: TVpDrawingStyle;
|
||||
FShowSavePrompt: Boolean;
|
||||
FWindowState: TWindowState;
|
||||
protected
|
||||
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
|
||||
@ -58,6 +59,7 @@ type
|
||||
published
|
||||
property ControlLink : TVpControlLink read FControlLink write SetControlLink;
|
||||
property DrawingStyle: TVpDrawingStyle read FDrawingStyle write FDrawingStyle default ds3d;
|
||||
property ShowSavePrompt: Boolean read FShowSavePrompt write FShowSavePrompt default true;
|
||||
property WindowState : TWindowState read FWindowState write FWindowState default wsNormal;
|
||||
|
||||
property Options;
|
||||
@ -77,6 +79,7 @@ begin
|
||||
inherited Create(AOwner);
|
||||
FControlLink := SearchControlLink (Owner);
|
||||
FDrawingStyle := ds3d;
|
||||
FShowSavePrompt := true;
|
||||
|
||||
FPlacement.Height := 480;
|
||||
FPlacement.Width := 640;
|
||||
@ -93,7 +96,9 @@ begin
|
||||
PrtFmtDlg.WindowState := WindowState;
|
||||
PrtFmtDlg.ControlLink := ControlLink;
|
||||
PrtFmtDlg.DrawingStyle := FDrawingStyle;
|
||||
PrtFmtDlg.ShowSavePrompt := FShowSavePrompt;
|
||||
Result := PrtFmtDlg.Execute;
|
||||
if Result then FShowSavePrompt := PrtFmtDlg.ShowSavePrompt;
|
||||
finally
|
||||
PrtFmtDlg.Free;
|
||||
end;
|
||||
|
Reference in New Issue
Block a user