Skip to content

Commit 300739c

Browse files
committed
Add EnableCommentStyles to TSaveSourceDlg
This property disables the comment style selection combo, and associated controls when False. The default is True.
1 parent c574ce2 commit 300739c

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Src/USaveSourceDlg.pas

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ TSaveSourceDlg = class(TSaveDialogEx)
9393
fSelectedFilterIdx: Integer;
9494
/// <summary>Stores type of selected encoding.</summary>
9595
fSelectedEncoding: TEncodingType;
96+
/// <summary>Value of <c>EnableCommentStyles</c> property.</summary>
97+
fEnableCommentStyles: Boolean;
98+
9699
/// <summary>Handles click on Help button.</summary>
97100
/// <remarks>Calls help with required keyword.</remarks>
98101
procedure HelpClickHandler(Sender: TObject);
@@ -201,6 +204,10 @@ TSaveSourceDlg = class(TSaveDialogEx)
201204
/// encodings supported for the file type.</summary>
202205
property OnEncodingQuery: TEncodingQuery
203206
read fOnEncodingQuery write fOnEncodingQuery;
207+
/// <summary>Determines whether the comment styles combo and associated
208+
/// controls are enabled, and so can be changed, or are disabled.</summary>
209+
property EnableCommentStyles: Boolean
210+
read fEnableCommentStyles write fEnableCommentStyles default True;
204211
/// <summary>Re-implementation of inherited property to overcome apparent
205212
/// bug where property forgets selected filter when dialog box is closed.
206213
/// </summary>
@@ -317,6 +324,9 @@ constructor TSaveSourceDlg.Create(AOwner: TComponent);
317324
// set dialog options
318325
Options := [ofPathMustExist, ofEnableIncludeNotify];
319326

327+
// enable comment style selection
328+
fEnableCommentStyles := True;
329+
320330
// inhibit default help processing: we provide own help button and handling
321331
WantDefaultHelpSupport := False;
322332
end;
@@ -579,6 +589,9 @@ procedure TSaveSourceDlg.UpdateCommentStyle;
579589
if TCommentStyle(fCmbCommentStyle.Items.Objects[Idx]) = fCommentStyle then
580590
fCmbCommentStyle.ItemIndex := Idx;
581591
end;
592+
fCmbCommentStyle.Enabled := fEnableCommentStyles;
593+
fLblCommentStyle.Enabled := fEnableCommentStyles;
594+
fChkTruncateComment.Enabled := fEnableCommentStyles;
582595
end;
583596

584597
procedure TSaveSourceDlg.UpdateCommentTruncation;

0 commit comments

Comments
 (0)