IDE: Export Html, option to use background color. Part of issue #40088

This commit is contained in:
Martin 2023-06-13 11:43:20 +02:00
parent 60178cd372
commit b0e5787dce
4 changed files with 14 additions and 0 deletions

View File

@ -1406,6 +1406,7 @@ type
{$IFDEF WinIME}
FUseMinimumIme: Boolean;
{$ENDIF}
fExportHtmlWithBackground: Boolean;
// General options
fMultiLineTab: Boolean;
fTabPosition: TTabPosition;
@ -1423,6 +1424,7 @@ type
fMultiCaretDefaultMode: TSynPluginMultiCaretDefaultMode;
fMultiCaretDeleteSkipLineBreak: Boolean;
fMultiCaretDefaultColumnSelectMode: TSynPluginMultiCaretDefaultMode;
// Highlighter Pas
fPasExtendedKeywordsMode: Boolean;
fPasStringKeywordMode: TSynPasStringMode;
@ -1480,6 +1482,8 @@ type
{$IFDEF WinIME}
property UseMinimumIme: Boolean read FUseMinimumIme write FUseMinimumIme default False;
{$ENDIF}
property ExportHtmlWithBackground: Boolean
read fExportHtmlWithBackground write fExportHtmlWithBackground default False;
// Display
property ShowOverviewGutter: boolean
read fShowOverviewGutter write fShowOverviewGutter default True;
@ -4716,6 +4720,7 @@ begin
fMultiCaretDefaultMode := mcmMoveAllCarets;
fMultiCaretDefaultColumnSelectMode := mcmCancelOnCaretMove;
fMultiCaretDeleteSkipLineBreak := False;
fExportHtmlWithBackground := False;
// Display options
fShowOverviewGutter := True;
fTopInfoView := True;

View File

@ -124,6 +124,7 @@ begin
{$IFDEF WinIME}
Items.Add(dlgUseMinimumIme);
{$ENDIF}
Items.Add(dlgEditExportBackColor);
end;
EditorTrimSpaceTypeComboBox.Items.Add(dlgTrimSpaceTypeLeaveLine);
EditorTrimSpaceTypeComboBox.Items.Add(dlgTrimSpaceTypeEditLine);
@ -160,6 +161,7 @@ begin
{$IFDEF WinIME}
Checked[5] := UseMinimumIme;
{$ENDIF}
Checked[6] := ExportHtmlWithBackground;
with ScrollOnEditLeftOptions do begin
edLeftDist.Value := KeepBorderDistance;
@ -206,6 +208,7 @@ begin
{$IFDEF WinIME}
UseMinimumIme := EditorOptionsGroupBox.Checked[5];
{$ENDIF}
ExportHtmlWithBackground := EditorOptionsGroupBox.Checked[6];
with ScrollOnEditLeftOptions do begin
KeepBorderDistance := edLeftDist.Value;

View File

@ -1892,6 +1892,7 @@ resourcestring
dlgTrimSpaceTypePosOnly = 'Position Only';
dlgCopyPasteKeepFolds = 'Copy/Paste with fold info';
dlgUseMinimumIme = 'IME handled by System';
dlgEditExportBackColor = 'Use Background color in HTML export';
dlgUndoLimit = 'Undo limit';
dlgTabWidths = 'Tab widths';
dlgMarginGutter = 'Margin and gutter';

View File

@ -4895,6 +4895,11 @@ begin
Html.ExportAsText := True;
Html.Highlighter := FEditor.Highlighter;
Html.Title := PageName;
Html.Font.Assign(FEditor.Font);
Html.UseBackground := EditorOpts.ExportHtmlWithBackground;
if EditorOpts.ExportHtmlWithBackground then begin
Html.Color := FEditor.Color;
end;
Html.ExportAll(FEditor.Lines);
Html.SaveToFile(AFileName);
finally