/usr/lib/lazarus/0.9.30.4/ideintf/idedialogs.pas is in lazarus-src-0.9.30.4 0.9.30.4-6.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | { Copyright (C) 2004
*****************************************************************************
* *
* See the file COPYING.modifiedLGPL.txt, included in this distribution, *
* for details about the copyright. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* *
*****************************************************************************
Author: Mattias Gaertner
Abstract:
Common IDE dialogs.
}
unit IDEDialogs;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Controls, Dialogs;
type
TIDESelectDirectory = function(const Title, InitialDir: string): string of object;
TInitIDEFileDialog = procedure(AFileDialog: TFileDialog) of object;
TStoreIDEFileDialog = procedure(AFileDialog: TFileDialog) of object;
TIDEMessageDialog = function(const aCaption, aMsg: string;
DlgType: TMsgDlgType; Buttons: TMsgDlgButtons;
const HelpKeyword: string = ''): Integer of object;
TIDEQuestionDialog = function(const aCaption, aMsg: string;
DlgType: TMsgDlgType; Buttons: array of const;
const HelpKeyword: string = ''): Integer of object;
function LazSelectDirectory(const Title: string; const InitialDir: string = ''
): string;
var
LazIDESelectDirectory: TIDESelectDirectory = nil;// set by the IDE
InitIDEFileDialog: TInitIDEFileDialog = nil;
StoreIDEFileDialog: TStoreIDEFileDialog = nil ;
IDEMessageDialog: TIDEMessageDialog = nil;
IDEQuestionDialog: TIDEQuestionDialog = nil;
function IDEMessageDialogAb(const aCaption, aMsg: string;
DlgType: TMsgDlgType; Buttons: TMsgDlgButtons;
ShowAbort: boolean; const HelpKeyword: string = ''): Integer;
function IDEQuestionDialogAb(const aCaption, aMsg: string;
DlgType: TMsgDlgType; Buttons: array of const;
HideAbort: boolean; const HelpKeyword: string = ''): Integer;
type
{ TIgnoreIDEQuestionItem }
TIgnoreQuestionDuration = (
iiidIDERestart,
iiid24H,
iiidForever
);
TIgnoreQuestionDurations = set of TIgnoreQuestionDuration;
TIgnoreIDEQuestionItem = class
private
FIdentifier: string;
public
Date: TDateTime;
Flag: string;
Duration: TIgnoreQuestionDuration;
constructor Create(const TheIdentifier: string);
property Identifier: string read FIdentifier;
end;
{ TIgnoreIDEQuestionList }
TIgnoreIDEQuestionList = class
public
function Add(const Identifier: string;
const Duration: TIgnoreQuestionDuration;
const Flag: string = ''): TIgnoreIDEQuestionItem; virtual; abstract;
procedure Delete(const Identifier: string); virtual; abstract;
function Find(const Identifier: string): TIgnoreIDEQuestionItem; virtual; abstract;
end;
var
IgnoreQuestions: TIgnoreIDEQuestionList = nil;
implementation
function LazSelectDirectory(const Title: string; const InitialDir: string
): string;
begin
Result:=LazIDESelectDirectory(Title,InitialDir);
end;
function IDEMessageDialogAb(const aCaption, aMsg: string; DlgType: TMsgDlgType;
Buttons: TMsgDlgButtons; ShowAbort: boolean; const HelpKeyword: string
): Integer;
begin
if ShowAbort then begin
// add an abort button for 'Cancel all'
// and replace a Cancel with Ignore
Buttons:=Buttons+[mbAbort];
if mbCancel in Buttons then
Buttons:=Buttons-[mbCancel]+[mbIgnore];
end;
Result:=IDEMessageDialog(aCaption,aMsg,DlgType,Buttons,HelpKeyword);
end;
function IDEQuestionDialogAb(const aCaption, aMsg: string;
DlgType: TMsgDlgType; Buttons: array of const;
HideAbort: boolean; const HelpKeyword: string): Integer;
var
NewButtons: array of TVarRec;
i: Integer;
j: Integer;
begin
SetLength(NewButtons,High(Buttons)-Low(Buttons)+1);
i:=low(Buttons);
j:=0;
while i<=High(Buttons) do begin
if HideAbort
and (Buttons[i].VType=vtInteger)
and (Buttons[i].VInteger=mrAbort) then begin
// skip abort button
inc(i);
// and skip abort caption
if Buttons[i].VType<>vtInteger then
inc(i);
end else begin
NewButtons[j]:=Buttons[i];
inc(i);
inc(j);
end;
end;
SetLength(NewButtons,j);
Result:=IDEQuestionDialog(aCaption,aMsg,DlgType,NewButtons,HelpKeyword);
end;
{ TIgnoreIDEQuestionItem }
constructor TIgnoreIDEQuestionItem.Create(const TheIdentifier: string);
begin
fIdentifier:=TheIdentifier;
end;
end.
|