tpipro, fix AV in preview

git-svn-id: trunk@23681 -
This commit is contained in:
jesus 2010-02-11 05:43:34 +00:00
parent ffbae73a6b
commit 71c075cfa6
8 changed files with 30 additions and 77 deletions

1
.gitattributes vendored
View File

@ -3133,7 +3133,6 @@ examples/turbopower_ipro/defaultimage.lrs svneol=native#text/pascal
examples/turbopower_ipro/defaultimage.xpm -text svneol=native#image/x-pixmap examples/turbopower_ipro/defaultimage.xpm -text svneol=native#image/x-pixmap
examples/turbopower_ipro/index.html svneol=native#text/html examples/turbopower_ipro/index.html svneol=native#text/html
examples/turbopower_ipro/mainunit.lfm svneol=native#text/plain examples/turbopower_ipro/mainunit.lfm svneol=native#text/plain
examples/turbopower_ipro/mainunit.lrs svneol=native#text/pascal
examples/turbopower_ipro/mainunit.pas svneol=native#text/pascal examples/turbopower_ipro/mainunit.pas svneol=native#text/pascal
examples/turbopower_ipro/readme.txt svneol=native#text/plain examples/turbopower_ipro/readme.txt svneol=native#text/plain
examples/turbopower_ipro/simplepage2.html svneol=native#text/html examples/turbopower_ipro/simplepage2.html svneol=native#text/html

View File

@ -118,7 +118,6 @@ const
procedure TIpHTMLPreview.FormShow(Sender: TObject); procedure TIpHTMLPreview.FormShow(Sender: TObject);
begin begin
Zoom := 100; Zoom := 100;
ResizeCanvas;
RenderPage(CurPage); RenderPage(CurPage);
end; end;
@ -260,6 +259,7 @@ end;
procedure TIpHTMLPreview.FormCreate(Sender: TObject); procedure TIpHTMLPreview.FormCreate(Sender: TObject);
begin begin
ZoomCombo.ItemIndex := 4; ZoomCombo.ItemIndex := 4;
FZoom := 100;
Scratch := TBitmap.Create; Scratch := TBitmap.Create;
Scratch.Width := SCRATCH_WIDTH; Scratch.Width := SCRATCH_WIDTH;
Scratch.Height := SCRATCH_HEIGHT; Scratch.Height := SCRATCH_HEIGHT;
@ -335,7 +335,8 @@ end;
procedure TIpHTMLPreview.FormResize(Sender: TObject); procedure TIpHTMLPreview.FormResize(Sender: TObject);
begin begin
SetZoom(Zoom); {force recalc of preview sizes} if OwnerPanel<>nil then
SetZoom(Zoom); {force recalc of preview sizes}
end; end;
end. end.

View File

@ -10,8 +10,9 @@ object MainForm: TMainForm
ClientHeight = 327 ClientHeight = 327
ClientWidth = 569 ClientWidth = 569
OnCreate = MainFormCreate OnCreate = MainFormCreate
LCLVersion = '0.9.25' LCLVersion = '0.9.29'
object IpHtmlPanel1: TIpHtmlPanel object IpHtmlPanel1: TIpHtmlPanel
Left = 0
Height = 285 Height = 285
Top = 42 Top = 42
Width = 569 Width = 569
@ -19,14 +20,18 @@ object MainForm: TMainForm
FixedTypeface = 'Courier New' FixedTypeface = 'Courier New'
DefaultTypeFace = 'default' DefaultTypeFace = 'default'
DefaultFontSize = 12 DefaultFontSize = 12
FlagErrors = False
PrintSettings.MarginLeft = 0.5 PrintSettings.MarginLeft = 0.5
PrintSettings.MarginTop = 0.5 PrintSettings.MarginTop = 0.5
PrintSettings.MarginRight = 0.5 PrintSettings.MarginRight = 0.5
PrintSettings.MarginBottom = 0.5 PrintSettings.MarginBottom = 0.5
TabOrder = 1
OnHotClick = IpHtmlPanel1HotClick OnHotClick = IpHtmlPanel1HotClick
end end
object Panel1: TPanel object Panel1: TPanel
Left = 0
Height = 42 Height = 42
Top = 0
Width = 569 Width = 569
Align = alTop Align = alTop
ClientHeight = 42 ClientHeight = 42
@ -43,7 +48,7 @@ object MainForm: TMainForm
TabOrder = 0 TabOrder = 0
end end
object Button1: TButton object Button1: TButton
Left = 183 Left = 192
Height = 25 Height = 25
Top = 8 Top = 8
Width = 75 Width = 75
@ -56,7 +61,7 @@ object MainForm: TMainForm
object OpenDialog1: TOpenDialog object OpenDialog1: TOpenDialog
Filter = 'Web Pages|*.html;*.htm' Filter = 'Web Pages|*.html;*.htm'
FilterIndex = 0 FilterIndex = 0
left = 26 left = 24
top = 93 top = 120
end end
end end

View File

@ -1,24 +0,0 @@
{ Das ist eine automatisch erzeugte Lazarus-Ressourcendatei }
LazarusResources.Add('TMainForm','FORMDATA',[
'TPF0'#9'TMainForm'#8'MainForm'#4'Left'#3';'#1#6'Height'#3'G'#1#3'Top'#3#177#0
+#5'Width'#3'9'#2#18'HorzScrollBar.Page'#3'8'#2#18'VertScrollBar.Page'#3'F'#1
+#13'ActiveControl'#7#19'OpenHTMLFileButton1'#7'Caption'#6'0Example for turbo'
+'power internet pro HTML control'#12'ClientHeight'#3'G'#1#11'ClientWidth'#3
+'9'#2#8'OnCreate'#7#14'MainFormCreate'#10'LCLVersion'#6#6'0.9.25'#0#12'TIpHt'
+'mlPanel'#12'IpHtmlPanel1'#6'Height'#3#29#1#3'Top'#2'*'#5'Width'#3'9'#2#5'Al'
+'ign'#7#8'alClient'#13'FixedTypeface'#6#11'Courier New'#15'DefaultTypeFace'#6
+#7'default'#15'DefaultFontSize'#2#12#24'PrintSettings.MarginLeft'#5#0#0#0#0#0
+#0#0#128#254'?'#23'PrintSettings.MarginTop'#5#0#0#0#0#0#0#0#128#254'?'#25'Pr'
+'intSettings.MarginRight'#5#0#0#0#0#0#0#0#128#254'?'#26'PrintSettings.Margin'
+'Bottom'#5#0#0#0#0#0#0#0#128#254'?'#10'OnHotClick'#7#20'IpHtmlPanel1HotClick'
+#0#0#6'TPanel'#6'Panel1'#6'Height'#2'*'#5'Width'#3'9'#2#5'Align'#7#5'alTop'
+#12'ClientHeight'#2'*'#11'ClientWidth'#3'9'#2#8'TabOrder'#2#0#0#7'TButton'#19
+'OpenHTMLFileButton1'#4'Left'#2#16#6'Height'#2#26#3'Top'#2#8#5'Width'#3#152#0
+#25'BorderSpacing.InnerBorder'#2#4#7'Caption'#6#14'Open HTML File'#7'OnClick'
+#7#23'OpenHTMLFileButtonClick'#8'TabOrder'#2#0#0#0#7'TButton'#7'Button1'#4'L'
+'eft'#3#183#0#6'Height'#2#25#3'Top'#2#8#5'Width'#2'K'#25'BorderSpacing.Inner'
+'Border'#2#4#7'Caption'#6#7'Preview'#7'OnClick'#7#12'Button1Click'#8'TabOrde'
+'r'#2#1#0#0#0#11'TOpenDialog'#11'OpenDialog1'#6'Filter'#6#22'Web Pages|*.htm'
+'l;*.htm'#11'FilterIndex'#2#0#4'left'#2#26#3'top'#2']'#0#0#0
]);

View File

@ -2,7 +2,7 @@ unit MainUnit;
{$mode objfpc}{$H+} {$mode objfpc}{$H+}
{.$define UsePreview} {$define UsePreview}
interface interface
@ -44,6 +44,8 @@ var
implementation implementation
{$R *.lfm}
{ TMainForm } { TMainForm }
procedure TMainForm.MainFormCreate(Sender: TObject); procedure TMainForm.MainFormCreate(Sender: TObject);
@ -128,7 +130,6 @@ begin
end; end;
initialization initialization
{$I mainunit.lrs}
{$I defaultimage.lrs} {$I defaultimage.lrs}
end. end.

View File

@ -1,38 +1,7 @@
This directory contains a program to test package This directory contains a program to test package
TurboPower Internet Professional, in order to run TurboPower Internet Professional.
this test follow this steps:
1. Install package turbopoweripro.lpk This test require the component turbopoweripro.lpk
located in directory $LazarusDir/components/turbopower_ipro. located in directory $LazarusDir/components/turbopower_ipro.
2. [OPTIONAL RECOMMENDED] To add jpeg picture format support,
Install package JpegForLazarus.lpk
located in directory $LazarusDir/components/jpeg.
3. [OPTIONAL] To add print preview support to project sample
install package Printer4Lazarus.lpk
located in directory $LazarusDir/components/printers
4. Open test project tpiproexample.lpi
5. [OPTIONAL] if step 2 is done then do:
5a. Add JpegForLazarus package requeriment to the sample
[menu]->Project->Project Inspector->Add->New Requirement
and then select "JPEGForLazarus" from the Package name list.
5b. Enable this feature by editing compiler define at top of main
unit from {.$define UseJPEG} to {$define UseJPEG}.
6. [OPTIONAL] if step 2 is done then do:
6a. Add Printer4Lazarus package requeriment to the sample
[menu]->Project->Project Inspector->Add->New Requirement
and then select "Printer4Lazarus" from the Package name list.
6b. Enable this feature by editing compiler define at top of main
unit from {.$define UsePreview} to {$define UsePreview}.
7. Run

View File

@ -1,15 +1,14 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<CONFIG> <CONFIG>
<ProjectOptions> <ProjectOptions>
<PathDelim Value="/"/> <Version Value="7"/>
<Version Value="6"/>
<General> <General>
<Flags> <Flags>
<SaveClosedFiles Value="False"/> <SaveClosedFiles Value="False"/>
<LRSInOutputDirectory Value="False"/>
</Flags> </Flags>
<SessionStorage Value="InIDEConfig"/> <SessionStorage Value="InIDEConfig"/>
<MainUnit Value="0"/> <MainUnit Value="0"/>
<IconPath Value="./"/>
<TargetFileExt Value=""/> <TargetFileExt Value=""/>
<Title Value="tpiproexample"/> <Title Value="tpiproexample"/>
</General> </General>
@ -25,15 +24,18 @@
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/> <LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
</local> </local>
</RunParams> </RunParams>
<RequiredPackages Count="2"> <RequiredPackages Count="3">
<Item1> <Item1>
<PackageName Value="TurboPowerIPro"/> <PackageName Value="Printer4Lazarus"/>
<MinVersion Major="1" Valid="True"/>
</Item1> </Item1>
<Item2> <Item2>
<PackageName Value="LCL"/> <PackageName Value="TurboPowerIPro"/>
<MinVersion Major="1" Valid="True"/> <MinVersion Major="1" Valid="True"/>
</Item2> </Item2>
<Item3>
<PackageName Value="LCL"/>
<MinVersion Major="1" Valid="True"/>
</Item3>
</RequiredPackages> </RequiredPackages>
<Units Count="3"> <Units Count="3">
<Unit0> <Unit0>
@ -43,9 +45,9 @@
</Unit0> </Unit0>
<Unit1> <Unit1>
<Filename Value="mainunit.pas"/> <Filename Value="mainunit.pas"/>
<ComponentName Value="MainForm"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<ResourceFilename Value="mainunit.lrs"/> <ComponentName Value="MainForm"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="MainUnit"/> <UnitName Value="MainUnit"/>
</Unit1> </Unit1>
<Unit2> <Unit2>

View File

@ -5,7 +5,7 @@ program TPIProExample;
uses uses
//MemCheck, //MemCheck,
Interfaces, Interfaces,
Forms, MainUnit; Forms, printer4lazarus, MainUnit;
begin begin
Application.Initialize; Application.Initialize;