You've already forked lazarus-ccr
richmemo: adding zoom sample
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3828 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
63
components/richmemo/samples/zoom/mainform.lfm
Normal file
63
components/richmemo/samples/zoom/mainform.lfm
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
object Form1: TForm1
|
||||||
|
Left = 457
|
||||||
|
Height = 338
|
||||||
|
Top = 213
|
||||||
|
Width = 615
|
||||||
|
Caption = 'Paragraph Demo'
|
||||||
|
ClientHeight = 338
|
||||||
|
ClientWidth = 615
|
||||||
|
OnCreate = FormCreate
|
||||||
|
LCLVersion = '1.2.4.0'
|
||||||
|
object Button1: TButton
|
||||||
|
Left = 532
|
||||||
|
Height = 25
|
||||||
|
Top = 16
|
||||||
|
Width = 75
|
||||||
|
Anchors = [akTop, akRight]
|
||||||
|
Caption = 'Load RTF'
|
||||||
|
OnClick = Button1Click
|
||||||
|
TabOrder = 1
|
||||||
|
end
|
||||||
|
object RichMemo1: TRichMemo
|
||||||
|
Left = 8
|
||||||
|
Height = 272
|
||||||
|
Top = 56
|
||||||
|
Width = 599
|
||||||
|
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||||
|
HideSelection = False
|
||||||
|
Lines.Strings = (
|
||||||
|
'Adjust selection in the combobox above'
|
||||||
|
)
|
||||||
|
OnClick = RichMemo1Click
|
||||||
|
OnKeyDown = RichMemo1KeyDown
|
||||||
|
ScrollBars = ssAutoBoth
|
||||||
|
TabOrder = 0
|
||||||
|
end
|
||||||
|
object ComboBox1: TComboBox
|
||||||
|
Left = 8
|
||||||
|
Height = 23
|
||||||
|
Top = 18
|
||||||
|
Width = 100
|
||||||
|
ItemHeight = 15
|
||||||
|
ItemIndex = 3
|
||||||
|
Items.Strings = (
|
||||||
|
'25%'
|
||||||
|
'50%'
|
||||||
|
'75%'
|
||||||
|
'100%'
|
||||||
|
'125%'
|
||||||
|
'150%'
|
||||||
|
'200%'
|
||||||
|
'300%'
|
||||||
|
'500%'
|
||||||
|
)
|
||||||
|
OnChange = ComboBox1Change
|
||||||
|
Style = csDropDownList
|
||||||
|
TabOrder = 2
|
||||||
|
Text = '100%'
|
||||||
|
end
|
||||||
|
object OpenDialog1: TOpenDialog
|
||||||
|
left = 488
|
||||||
|
top = 16
|
||||||
|
end
|
||||||
|
end
|
75
components/richmemo/samples/zoom/mainform.pas
Normal file
75
components/richmemo/samples/zoom/mainform.pas
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
unit mainform;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
|
||||||
|
Buttons, ComCtrls, Spin, RichMemo, RichMemoUtils;
|
||||||
|
|
||||||
|
type
|
||||||
|
|
||||||
|
{ TForm1 }
|
||||||
|
|
||||||
|
TForm1 = class(TForm)
|
||||||
|
Button1: TButton;
|
||||||
|
ComboBox1: TComboBox;
|
||||||
|
OpenDialog1: TOpenDialog;
|
||||||
|
RichMemo1: TRichMemo;
|
||||||
|
procedure Button1Click(Sender: TObject);
|
||||||
|
procedure ComboBox1Change(Sender: TObject);
|
||||||
|
procedure FormCreate(Sender: TObject);
|
||||||
|
procedure RichMemo1Click(Sender: TObject);
|
||||||
|
procedure RichMemo1KeyDown(Sender: TObject; var Key: Word;
|
||||||
|
Shift: TShiftState);
|
||||||
|
private
|
||||||
|
{ private declarations }
|
||||||
|
public
|
||||||
|
{ public declarations }
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
Form1: TForm1;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
{$R *.lfm}
|
||||||
|
|
||||||
|
{ TForm1 }
|
||||||
|
|
||||||
|
procedure TForm1.Button1Click(Sender: TObject);
|
||||||
|
begin
|
||||||
|
if OpenDialog1.Execute then begin
|
||||||
|
LoadRTFFile( RichMemo1, OpenDialog1.FileName );
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TForm1.ComboBox1Change(Sender: TObject);
|
||||||
|
var
|
||||||
|
t : string;
|
||||||
|
prc : Integer;
|
||||||
|
begin
|
||||||
|
t:=StringReplace(ComboBox1.Text, '%', '', [rfReplaceAll]);
|
||||||
|
prc := StrToIntDef( t , 100);
|
||||||
|
RichMemo1.ZoomFactor:=prc/100;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TForm1.FormCreate(Sender: TObject);
|
||||||
|
begin
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TForm1.RichMemo1Click(Sender: TObject);
|
||||||
|
begin
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TForm1.RichMemo1KeyDown(Sender: TObject; var Key: Word;
|
||||||
|
Shift: TShiftState);
|
||||||
|
begin
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
||||||
|
|
81
components/richmemo/samples/zoom/testzoom.lpi
Normal file
81
components/richmemo/samples/zoom/testzoom.lpi
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<CONFIG>
|
||||||
|
<ProjectOptions>
|
||||||
|
<Version Value="9"/>
|
||||||
|
<PathDelim Value="\"/>
|
||||||
|
<General>
|
||||||
|
<SessionStorage Value="InProjectDir"/>
|
||||||
|
<MainUnit Value="0"/>
|
||||||
|
<Title Value="testzoom"/>
|
||||||
|
<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"/>
|
||||||
|
<LaunchingApplication PathPlusParams="\usr\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/>
|
||||||
|
</local>
|
||||||
|
</RunParams>
|
||||||
|
<RequiredPackages Count="2">
|
||||||
|
<Item1>
|
||||||
|
<PackageName Value="richmemopackage"/>
|
||||||
|
</Item1>
|
||||||
|
<Item2>
|
||||||
|
<PackageName Value="LCL"/>
|
||||||
|
</Item2>
|
||||||
|
</RequiredPackages>
|
||||||
|
<Units Count="2">
|
||||||
|
<Unit0>
|
||||||
|
<Filename Value="testzoom.lpr"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
</Unit0>
|
||||||
|
<Unit1>
|
||||||
|
<Filename Value="mainform.pas"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
<ComponentName Value="Form1"/>
|
||||||
|
<HasResources Value="True"/>
|
||||||
|
<ResourceBaseClass Value="Form"/>
|
||||||
|
<UnitName Value="mainform"/>
|
||||||
|
</Unit1>
|
||||||
|
</Units>
|
||||||
|
</ProjectOptions>
|
||||||
|
<CompilerOptions>
|
||||||
|
<Version Value="11"/>
|
||||||
|
<PathDelim Value="\"/>
|
||||||
|
<Target>
|
||||||
|
<Filename Value="testzoom"/>
|
||||||
|
</Target>
|
||||||
|
<SearchPaths>
|
||||||
|
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||||
|
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||||
|
</SearchPaths>
|
||||||
|
<Other>
|
||||||
|
<CompilerPath Value="$(CompPath)"/>
|
||||||
|
</Other>
|
||||||
|
</CompilerOptions>
|
||||||
|
<Debugging>
|
||||||
|
<Exceptions Count="3">
|
||||||
|
<Item1>
|
||||||
|
<Name Value="EAbort"/>
|
||||||
|
</Item1>
|
||||||
|
<Item2>
|
||||||
|
<Name Value="ECodetoolError"/>
|
||||||
|
</Item2>
|
||||||
|
<Item3>
|
||||||
|
<Name Value="EFOpenError"/>
|
||||||
|
</Item3>
|
||||||
|
</Exceptions>
|
||||||
|
</Debugging>
|
||||||
|
</CONFIG>
|
20
components/richmemo/samples/zoom/testzoom.lpr
Normal file
20
components/richmemo/samples/zoom/testzoom.lpr
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
program testzoom;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
uses
|
||||||
|
{$IFDEF UNIX}{$IFDEF UseCThreads}
|
||||||
|
cthreads,
|
||||||
|
{$ENDIF}{$ENDIF}
|
||||||
|
Interfaces, // this includes the LCL widgetset
|
||||||
|
Forms, mainform, richmemopackage;
|
||||||
|
|
||||||
|
{$R *.res}
|
||||||
|
|
||||||
|
begin
|
||||||
|
RequireDerivedFormResource := True;
|
||||||
|
Application.Initialize;
|
||||||
|
Application.CreateForm(TForm1, Form1);
|
||||||
|
Application.Run;
|
||||||
|
end.
|
||||||
|
|
Reference in New Issue
Block a user