@@ -151,6 +151,8 @@ destructor TSaveInfoMgr.Destroy;
151
151
end ;
152
152
153
153
procedure TSaveInfoMgr.DoExecute ;
154
+ resourcestring
155
+ sDlgCaption = ' Save Snippet Information for %s' ;
154
156
var
155
157
Encoding: TEncoding; // encoding to use for output file
156
158
FileContent: string; // output file content before encoding
@@ -164,6 +166,9 @@ procedure TSaveInfoMgr.DoExecute;
164
166
1
165
167
);
166
168
fSaveDlg.FileName := fSourceFileInfo.DefaultFileName;
169
+ fSaveDlg.Title := Format(sDlgCaption, [
170
+ (fView as ISnippetView).Snippet.DisplayName]
171
+ );
167
172
// Display dialog box and save file if user OKs
168
173
if fSaveDlg.Execute then
169
174
begin
@@ -268,20 +273,13 @@ constructor TSaveInfoMgr.InternalCreate(AView: IView);
268
273
const
269
274
DlgHelpKeyword = ' SnippetInfoFileDlg' ;
270
275
resourcestring
271
- sDefFileName = ' SnippetInfo' ;
272
- sDlgCaption = ' Save Snippet Information' ;
273
- // descriptions of supported encodings
274
- sASCIIEncoding = ' ASCII' ;
275
- sANSIDefaultEncoding = ' ANSI (Default)' ;
276
- sUTF8Encoding = ' UTF-8' ;
277
- sUTF16LEEncoding = ' Unicode (Little Endian)' ;
278
- sUTF16BEEncoding = ' Unicode (Big Endian)' ;
279
276
// descriptions of supported file filter strings
280
277
sRTFDesc = ' Rich text file' ;
281
278
sTextDesc = ' Plain text file' ;
282
279
sHTML5Desc = ' HTML 5 file' ;
283
280
sXHTMLDesc = ' XHTML file' ;
284
281
sMarkdownDesc = ' Markdown file' ;
282
+
285
283
begin
286
284
inherited InternalCreate;
287
285
fView := AView;
@@ -290,50 +288,34 @@ constructor TSaveInfoMgr.InternalCreate(AView: IView);
290
288
fSourceFileInfo.FileTypeInfo[sfRTF] := TSourceFileTypeInfo.Create(
291
289
' .rtf' ,
292
290
sRTFDesc,
293
- [
294
- TSourceFileEncoding.Create(etASCII, sASCIIEncoding)
295
- ]
291
+ [etASCII]
296
292
);
297
293
fSourceFileInfo.FileTypeInfo[sfText] := TSourceFileTypeInfo.Create(
298
294
' .txt' ,
299
295
sTextDesc,
300
- [
301
- TSourceFileEncoding.Create(etUTF8, sUTF8Encoding),
302
- TSourceFileEncoding.Create(etUTF16LE, sUTF16LEEncoding),
303
- TSourceFileEncoding.Create(etUTF16BE, sUTF16BEEncoding),
304
- TSourceFileEncoding.Create(etSysDefault, sANSIDefaultEncoding)
305
- ]
296
+ [etUTF8, etUTF16LE, etUTF16BE, etSysDefault]
306
297
);
307
298
fSourceFileInfo.FileTypeInfo[sfHTML5] := TSourceFileTypeInfo.Create(
308
299
' .html' ,
309
300
sHTML5Desc,
310
- [
311
- TSourceFileEncoding.Create(etUTF8, sUTF8Encoding)
312
- ]
301
+ [etUTF8]
313
302
);
314
- fSourceFileInfo.DefaultFileName := sDefFileName;
315
303
fSourceFileInfo.FileTypeInfo[sfXHTML] := TSourceFileTypeInfo.Create(
316
304
' .html' ,
317
305
sXHTMLDesc,
318
- [
319
- TSourceFileEncoding.Create(etUTF8, sUTF8Encoding)
320
- ]
306
+ [etUTF8]
321
307
);
322
- fSourceFileInfo.DefaultFileName := sDefFileName;
323
308
fSourceFileInfo.FileTypeInfo[sfMarkdown] := TSourceFileTypeInfo.Create(
324
309
' .md' ,
325
310
sMarkdownDesc,
326
- [
327
- TSourceFileEncoding.Create(etUTF8, sUTF8Encoding),
328
- TSourceFileEncoding.Create(etUTF16LE, sUTF16LEEncoding),
329
- TSourceFileEncoding.Create(etUTF16BE, sUTF16BEEncoding),
330
- TSourceFileEncoding.Create(etSysDefault, sANSIDefaultEncoding)
331
- ]
311
+ [etUTF8, etUTF16LE, etUTF16BE, etSysDefault]
332
312
);
333
- fSourceFileInfo.DefaultFileName := sDefFileName;
313
+
314
+ // set default file name without converting to valid Pascal identifier
315
+ fSourceFileInfo.RequirePascalDefFileName := False;
316
+ fSourceFileInfo.DefaultFileName := fView.Description;
334
317
335
318
fSaveDlg := TSaveSourceDlg.Create(nil );
336
- fSaveDlg.Title := sDlgCaption;
337
319
fSaveDlg.HelpKeyword := DlgHelpKeyword;
338
320
fSaveDlg.CommentStyle := TCommentStyle.csNone;
339
321
fSaveDlg.EnableCommentStyles := False;
0 commit comments