Skip to content

Commit a8da07d

Browse files
committed
Remove unnecessary params from TSaveSourceDlg events
The OnHiliteQuery and OnEncodingQuery both had parameters that were not being used, so they were removed. USaveSourceMgr was modified re these changes.
1 parent 300739c commit a8da07d

File tree

2 files changed

+8
-17
lines changed

2 files changed

+8
-17
lines changed

Src/USaveSourceDlg.pas

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,17 @@ interface
2727
/// <summary>Type of handler for events triggered by TSaveSourceDlg to check
2828
/// if a file type supports syntax highlighting.</summary>
2929
/// <param name="Sender">TObject [in] Object triggering event.</param>
30-
/// <param name="Ext">string [in] Extension that defines type of file being
31-
/// queried.</param>
3230
/// <param name="CanHilite">Boolean [in/out] Set to true if file type
3331
/// supports syntax highlighting.</param>
34-
THiliteQuery = procedure(Sender: TObject; const Ext: string;
35-
var CanHilite: Boolean) of object;
32+
THiliteQuery = procedure(Sender: TObject; var CanHilite: Boolean) of object;
3633

3734
type
3835
/// <summary>Type of handler for event triggered by TSaveSourceDlg to get
3936
/// list of encodings supported for a file type.</summary>
4037
/// <param name="Sender">TObject [in] Object triggering event.</param>
41-
/// <param name="FilterIdx">string [in] Filter index that specifies the type
42-
/// of file being queried.</param>
4338
/// <param name="Encodings">TSourceFileEncodings [in/out] Assigned an array
4439
/// of records that specify supported encodings.</param>
45-
TEncodingQuery = procedure(Sender: TObject; const FilterIdx: Integer;
40+
TEncodingQuery = procedure(Sender: TObject;
4641
var Encodings: TSourceFileEncodings) of object;
4742

4843
type
@@ -475,7 +470,7 @@ procedure TSaveSourceDlg.DoTypeChange;
475470
// Update enabled state of syntax highlighter checkbox
476471
CanHilite := False;
477472
if Assigned(fOnHiliteQuery) then
478-
fOnHiliteQuery(Self, SelectedExt, CanHilite);
473+
fOnHiliteQuery(Self, CanHilite);
479474
fChkSyntaxHilite.Enabled := CanHilite;
480475

481476
// Store selected type
@@ -485,7 +480,7 @@ procedure TSaveSourceDlg.DoTypeChange;
485480
// handle OnEncodingQuery)
486481
SetLength(Encodings, 0);
487482
if Assigned(fOnEncodingQuery) then
488-
fOnEncodingQuery(Self, FilterIndex, Encodings);
483+
fOnEncodingQuery(Self, Encodings);
489484
if Length(Encodings) = 0 then
490485
Encodings := TSourceFileEncodings.Create(
491486
TSourceFileEncoding.Create(etSysDefault, sANSIEncoding)

Src/USaveSourceMgr.pas

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,16 @@ TSaveSourceMgr = class abstract(TNoPublicConstructObject)
4040
/// extension.</summary>
4141
/// <param name="Sender">TObject [in] Reference to object that triggered
4242
/// event.</param>
43-
/// <param name="Ext">string [in] Name of extension to check.</param>
4443
/// <param name="CanHilite">Boolean [in/out] Set to True if highlighting
4544
/// supported for extension or False if not.</param>
46-
procedure HiliteQueryHandler(Sender: TObject; const Ext: string;
47-
var CanHilite: Boolean);
45+
procedure HiliteQueryHandler(Sender: TObject; var CanHilite: Boolean);
4846
/// <summary>Handles custom save dialog box's OnEncodingQuery event.
4947
/// Provides array of encodings supported for a file extension.</summary>
5048
/// <param name="Sender">TObject [in] Reference to object that triggered
5149
/// event.</param>
52-
/// <param name="FilterIdx">string [in] Index of file type withing dialog's
53-
/// filter string to check.</param>
5450
/// <param name="Encodings">TSourceFileEncodings [in/out] Receives array of
5551
/// supported encodings.</param>
56-
procedure EncodingQueryHandler(Sender: TObject; const FilterIdx: Integer;
52+
procedure EncodingQueryHandler(Sender: TObject;
5753
var Encodings: TSourceFileEncodings);
5854
/// <summary>Handles custom save dialog's OnPreview event. Displays source
5955
/// code appropriately formatted in preview dialog box.</summary>
@@ -206,7 +202,7 @@ procedure TSaveSourceMgr.DoExecute;
206202
end;
207203

208204
procedure TSaveSourceMgr.EncodingQueryHandler(Sender: TObject;
209-
const FilterIdx: Integer; var Encodings: TSourceFileEncodings);
205+
var Encodings: TSourceFileEncodings);
210206
var
211207
FileType: TSourceFileType; // type of file that has given extension
212208
begin
@@ -238,7 +234,7 @@ function TSaveSourceMgr.GenerateOutput(const FileType: TSourceFileType):
238234
end;
239235
end;
240236

241-
procedure TSaveSourceMgr.HiliteQueryHandler(Sender: TObject; const Ext: string;
237+
procedure TSaveSourceMgr.HiliteQueryHandler(Sender: TObject;
242238
var CanHilite: Boolean);
243239
begin
244240
CanHilite := IsHilitingSupported(FileTypeFromFilterIdx);

0 commit comments

Comments
 (0)