Skip to content

Commit

Permalink
Merge branch 'HtmlDemoLaz-fixes' of https://github.com/michaelvanham/…
Browse files Browse the repository at this point in the history
…HtmlViewer.git into HtmlViewer-11.5
  • Loading branch information
BerndGabriel committed Jun 30, 2015
2 parents c6712e5 + 4f67a3f commit 5cf9ffe
Show file tree
Hide file tree
Showing 6 changed files with 182 additions and 28 deletions.
83 changes: 83 additions & 0 deletions Demos/Main Demos/HtmlDemoLaz.lpi
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="9"/>
<PathDelim Value="\"/>
<General>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
</General>
<i18n>
<EnableI18N LFM="False"/>
</i18n>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1">
<Item1 Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
</local>
</RunParams>
<RequiredPackages Count="2">
<Item1>
<PackageName Value="FrameViewer09"/>
</Item1>
<Item2>
<PackageName Value="LCL"/>
</Item2>
</RequiredPackages>
<Units Count="2">
<Unit0>
<Filename Value="HtmlDemoLaz.lpr"/>
<IsPartOfProject Value="True"/>
</Unit0>
<Unit1>
<Filename Value="demounit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="DemoUnit"/>
</Unit1>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="bin\$(TargetCPU)-$(TargetOS)\HtmlDemoLaz"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Linking>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>
42 changes: 20 additions & 22 deletions Demos/Main Demos/demounit.lfm
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ object Form1: TForm1
OnCreate = FormCreate
OnDestroy = FormDestroy
OnShow = FormShow
LCLVersion = '0.9.30.2'
LCLVersion = '1.4.0.4'
object Panel1: TPanel
Left = 0
Height = 18
Expand Down Expand Up @@ -113,11 +113,7 @@ object Form1: TForm1
Height = 362
Top = 1
Width = 611
TabStop = True
TabOrder = 0
Align = alClient
BorderStyle = htFocused
CharSet = DEFAULT_CHARSET
DefBackground = clWindow
DefFontColor = clWindowText
DefFontName = 'Times New Roman'
Expand All @@ -131,7 +127,6 @@ object Form1: TForm1
PrintMarginRight = 2
PrintMarginTop = 2
PrintScale = 1
OnMouseMove = ViewerMouseMove
OnFormSubmit = SubmitEvent
OnHistoryChange = HistoryChange
OnHotSpotClick = HotSpotClick
Expand All @@ -146,18 +141,21 @@ object Form1: TForm1
OnRightClick = RightClick
OnScript = ViewerScript
OnSoundRequest = SoundRequest
Align = alClient
TabOrder = 0
OnMouseMove = ViewerMouseMove
end
end
object OpenDialog: TOpenDialog
DefaultExt = '.htm'
Filter = 'html files|*.htm;*.html|all files|*.*'
Options = [ofHideReadOnly, ofPathMustExist, ofFileMustExist]
left = 329
top = 2
left = 224
top = 56
end
object MainMenu: TMainMenu
left = 352
top = 75
left = 48
top = 56
object File1: TMenuItem
Caption = '&File'
object Open: TMenuItem
Expand Down Expand Up @@ -240,12 +238,12 @@ object Form1: TForm1
object FindDialog: TFindDialog
Options = [frDown, frHideWholeWord, frDisableWholeWord]
OnFind = FindDialogFind
left = 249
top = 65535
left = 312
top = 56
end
object PopupMenu: TPopupMenu
left = 400
top = 1
left = 136
top = 56
object Viewimage: TMenuItem
Caption = '&View image'
OnClick = ViewimageClick
Expand All @@ -265,21 +263,21 @@ object Form1: TForm1
object MetaTimer: TTimer
Enabled = False
OnTimer = MetaTimerTimer
left = 242
top = 75
left = 224
top = 136
end
object Timer1: TTimer
Interval = 200
OnTimer = Timer1Timer
left = 291
top = 71
left = 312
top = 136
end
object PrintDialog: TPrintDialog
left = 160
top = 83
left = 136
top = 136
end
object PrinterSetupDialog: TPrinterSetupDialog
left = 56
top = 83
left = 48
top = 136
end
end
6 changes: 6 additions & 0 deletions Demos/Main Demos/demounit.pas
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,10 @@ procedure TForm1.OpenFileClick(Sender: TObject);
begin
if Viewer.CurrentFile <> '' then
OpenDialog.InitialDir := ExtractFilePath(Viewer.CurrentFile);
OpenDialog.Filter := 'HTML Files (*.htm,*.html)|*.htm;*.html'+
'|Text Files (*.txt)|*.txt'+
'|All Files (*.*)|*.*';
OpenDialog.FilterIndex:=1;
if OpenDialog.Execute then
begin
Update;
Expand Down Expand Up @@ -597,6 +601,7 @@ procedure TForm1.OpenTextFileClick(Sender: TObject);
OpenDialog.Filter := 'HTML Files (*.htm,*.html)|*.htm;*.html'+
'|Text Files (*.txt)|*.txt'+
'|All Files (*.*)|*.*';
OpenDialog.FilterIndex:=2;
if OpenDialog.Execute then
begin
ReloadButton.Enabled := False;
Expand All @@ -617,6 +622,7 @@ procedure TForm1.OpenImageFileClick(Sender: TObject);
OpenDialog.Filter := 'Graphics Files (*.bmp,*.gif,*.jpg,*.jpeg,*.png)|'+
'*.bmp;*.jpg;*.jpeg;*.gif;*.png|'+
'All Files (*.*)|*.*';
OpenDialog.FilterIndex := 1;
if OpenDialog.Execute then
begin
ReloadButton.Enabled := False;
Expand Down
67 changes: 63 additions & 4 deletions package/FrameViewer09.lpk
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?xml version="1.0"?>
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<Package Version="4">
<PathDelim Value="\"/>
<Name Value="FrameViewer09"/>
<Type Value="RunAndDesignTime"/>
<AddToProjectUsesSection Value="True"/>
<CompilerOptions>
<Version Value="11"/>
Expand Down Expand Up @@ -38,11 +39,10 @@
<CompilerMessages>
<IgnoredMessages idx5024="True"/>
</CompilerMessages>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
<Version Major="11"/>
<Files Count="23">
<Files Count="38">
<Item1>
<Filename Value="..\source\DitherUnit.pas"/>
<UnitName Value="DitherUnit"/>
Expand Down Expand Up @@ -136,8 +136,67 @@
<Filename Value="..\source\HtmlSymb.pas"/>
<UnitName Value="HtmlSymb"/>
</Item23>
<Item24>
<Filename Value="..\source\BegaHtmlPrintPreviewForm.pas"/>
<UnitName Value="BegaHtmlPrintPreviewForm"/>
</Item24>
<Item25>
<Filename Value="..\source\BegaMetaFilePrinter.pas"/>
<UnitName Value="BegaMetaFilePrinter"/>
</Item25>
<Item26>
<Filename Value="..\source\BegaPreview.pas"/>
<UnitName Value="BegaPreview"/>
</Item26>
<Item27>
<Filename Value="..\source\BegaPreviewForm.pas"/>
<UnitName Value="BegaPreviewForm"/>
</Item27>
<Item28>
<Filename Value="..\source\BegaPreviewPanel.pas"/>
<UnitName Value="BegaPreviewPanel"/>
</Item28>
<Item29>
<Filename Value="..\source\BegaScrollBox.pas"/>
<UnitName Value="BegaScrollBox"/>
</Item29>
<Item30>
<Filename Value="..\source\BegaZoom.pas"/>
<UnitName Value="BegaZoom"/>
</Item30>
<Item31>
<Filename Value="..\source\GDIPL2A.pas"/>
<UnitName Value="GDIPL2A"/>
</Item31>
<Item32>
<Filename Value="..\source\HtmlCaches.pas"/>
<UnitName Value="HtmlCaches"/>
</Item32>
<Item33>
<Filename Value="..\source\HtmlFonts.pas"/>
<UnitName Value="HtmlFonts"/>
</Item33>
<Item34>
<Filename Value="..\source\HtmlImages.pas"/>
<UnitName Value="HtmlImages"/>
</Item34>
<Item35>
<Filename Value="..\source\MetaFilePrinter.pas"/>
<UnitName Value="MetaFilePrinter"/>
</Item35>
<Item36>
<Filename Value="..\source\StyleTypes.pas"/>
<UnitName Value="StyleTypes"/>
</Item36>
<Item37>
<Filename Value="..\source\vwPrint.pas"/>
<UnitName Value="vwPrint"/>
</Item37>
<Item38>
<Filename Value="..\source\widestringslcl.pas"/>
<UnitName Value="WideStringsLcl"/>
</Item38>
</Files>
<Type Value="RunAndDesignTime"/>
<RequiredPkgs Count="3">
<Item1>
<PackageName Value="printer4lazarus"/>
Expand Down
5 changes: 4 additions & 1 deletion package/FrameViewer09.pas
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ interface
DitherUnit, FramBrwz, FrameViewerReg, FramView, HtmlBuffer, HtmlGif1,
HTMLGif2, HtmlGlobals, HtmlMisc, Htmlsbs1, HTMLSubs, HTMLUn2, HtmlView,
ReadHTML, StylePars, StyleUn, URLSubs, msimg32, AlphaBlendUn, HSLUtils,
BuffConv, BuffConvArrays, HtmlSymb, LazarusPackageIntf;
BuffConv, BuffConvArrays, HtmlSymb, BegaHtmlPrintPreviewForm,
BegaMetaFilePrinter, BegaPreview, BegaPreviewForm, BegaPreviewPanel,
BegaScrollBox, BegaZoom, GDIPL2A, HtmlCaches, HtmlFonts, HtmlImages,
MetaFilePrinter, StyleTypes, vwPrint, WideStringsLcl, LazarusPackageIntf;

implementation

Expand Down
7 changes: 6 additions & 1 deletion source/htmlview.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1078,6 +1078,9 @@ procedure THtmlViewer.LoadFromFile(const FileName: ThtString; DocType: ThtmlFile
begin
if IsProcessing then
Exit;
// in lazarus 1.4.0 with fpc 2.6.4
// htmlviewer will not draw properly if focused
RemoveFocus(false);
if Filename <> '' then
begin
OldFile := FCurrentFile;
Expand Down Expand Up @@ -1173,7 +1176,9 @@ procedure THtmlViewer.LoadDocument(Document: TBuffer; const DocName: ThtString;
begin
if IsProcessing then
Exit;

// in lazarus 1.4.0 with fpc 2.6.4
// htmlviewer will not draw properly if focused
RemoveFocus(false);
SplitDest(DocName, Name, Dest);
case DocType of
ImgType:
Expand Down

0 comments on commit 5cf9ffe

Please sign in to comment.