mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-09 21:56:00 +02:00
added lazplotpanel from Michael Van Canneyt
git-svn-id: trunk@17516 -
This commit is contained in:
parent
ff1eb35eb3
commit
4b98f56f55
25
.gitattributes
vendored
25
.gitattributes
vendored
@ -1029,6 +1029,30 @@ components/paradox/lazparadox.pas svneol=native#text/plain
|
|||||||
components/paradox/regparadox.lrs svneol=native#text/plain
|
components/paradox/regparadox.lrs svneol=native#text/plain
|
||||||
components/paradox/regparadox.pp svneol=native#text/plain
|
components/paradox/regparadox.pp svneol=native#text/plain
|
||||||
components/paradox/tparadox.png -text svneol=unset#image/png
|
components/paradox/tparadox.png -text svneol=unset#image/png
|
||||||
|
components/plotpanel/demo/event/frmmain.lfm svneol=native#text/plain
|
||||||
|
components/plotpanel/demo/event/frmmain.lrs svneol=native#text/plain
|
||||||
|
components/plotpanel/demo/event/frmmain.pp svneol=native#text/plain
|
||||||
|
components/plotpanel/demo/event/ploteventdemo.ico -text svneol=unset#image/ico
|
||||||
|
components/plotpanel/demo/event/ploteventdemo.lpi svneol=native#text/plain
|
||||||
|
components/plotpanel/demo/event/ploteventdemo.lpr svneol=native#text/plain
|
||||||
|
components/plotpanel/demo/event/ploteventdemo.rc svneol=native#text/plain
|
||||||
|
components/plotpanel/demo/expression/exprdemo.ico -text svneol=unset#image/ico
|
||||||
|
components/plotpanel/demo/expression/exprdemo.lpi svneol=native#text/plain
|
||||||
|
components/plotpanel/demo/expression/exprdemo.lpr svneol=native#text/plain
|
||||||
|
components/plotpanel/demo/expression/exprdemo.lrs svneol=native#text/plain
|
||||||
|
components/plotpanel/demo/expression/exprdemo.rc svneol=native#text/plain
|
||||||
|
components/plotpanel/demo/expression/frmmain.lfm svneol=native#text/plain
|
||||||
|
components/plotpanel/demo/expression/frmmain.lrs svneol=native#text/plain
|
||||||
|
components/plotpanel/demo/expression/frmmain.pp svneol=native#text/plain
|
||||||
|
components/plotpanel/exprplotpanel.pp svneol=native#text/plain
|
||||||
|
components/plotpanel/lazplotpanel.lpk svneol=native#text/plain
|
||||||
|
components/plotpanel/lazplotpanel.pas svneol=native#text/plain
|
||||||
|
components/plotpanel/plotpanel.pp svneol=native#text/plain
|
||||||
|
components/plotpanel/readme.txt svneol=native#text/plain
|
||||||
|
components/plotpanel/regplotpanel.lrs svneol=native#text/plain
|
||||||
|
components/plotpanel/regplotpanel.pp svneol=native#text/plain
|
||||||
|
components/plotpanel/tplotexpressionpanel.png -text svneol=unset#image/png
|
||||||
|
components/plotpanel/tplotfunctionpanel.png -text svneol=unset#image/png
|
||||||
components/prettyformat/languages/pfidesource.de.po svneol=native#text/plain
|
components/prettyformat/languages/pfidesource.de.po svneol=native#text/plain
|
||||||
components/prettyformat/languages/pfidesource.fr.po svneol=native#text/plain
|
components/prettyformat/languages/pfidesource.fr.po svneol=native#text/plain
|
||||||
components/prettyformat/languages/pfidesource.id.po svneol=native#text/plain
|
components/prettyformat/languages/pfidesource.id.po svneol=native#text/plain
|
||||||
@ -4077,6 +4101,7 @@ packager/globallinks/lazdbexport-0.lpl svneol=native#text/plain
|
|||||||
packager/globallinks/lazmouseandkeyinput-0.lpl svneol=native#text/plain
|
packager/globallinks/lazmouseandkeyinput-0.lpl svneol=native#text/plain
|
||||||
packager/globallinks/lazopenglcontext-0.lpl svneol=native#text/plain
|
packager/globallinks/lazopenglcontext-0.lpl svneol=native#text/plain
|
||||||
packager/globallinks/lazparadox-0.lpl svneol=native#text/plain
|
packager/globallinks/lazparadox-0.lpl svneol=native#text/plain
|
||||||
|
packager/globallinks/lazplotpanel.lpl svneol=native#text/plain
|
||||||
packager/globallinks/lazreport-0.9.5.lpl svneol=native#text/plain
|
packager/globallinks/lazreport-0.9.5.lpl svneol=native#text/plain
|
||||||
packager/globallinks/lazreportpdfexport-0.lpl svneol=native#text/plain
|
packager/globallinks/lazreportpdfexport-0.lpl svneol=native#text/plain
|
||||||
packager/globallinks/lazsvnpkg-0.lpl svneol=native#text/plain
|
packager/globallinks/lazsvnpkg-0.lpl svneol=native#text/plain
|
||||||
|
34
components/plotpanel/demo/event/frmmain.lfm
Normal file
34
components/plotpanel/demo/event/frmmain.lfm
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
object MainForm: TMainForm
|
||||||
|
Left = 401
|
||||||
|
Height = 300
|
||||||
|
Top = 309
|
||||||
|
Width = 400
|
||||||
|
HelpContext = 0
|
||||||
|
Align = alNone
|
||||||
|
AllowDropFiles = False
|
||||||
|
AutoScroll = True
|
||||||
|
AutoSize = False
|
||||||
|
BorderIcons = [biSystemMenu, biMinimize, biMaximize]
|
||||||
|
BorderStyle = bsSizeable
|
||||||
|
Caption = 'Event-driven plotting demo'
|
||||||
|
ChildSizing.LeftRightSpacing = 0
|
||||||
|
ChildSizing.TopBottomSpacing = 0
|
||||||
|
ChildSizing.HorizontalSpacing = 0
|
||||||
|
ChildSizing.VerticalSpacing = 0
|
||||||
|
ChildSizing.ControlsPerLine = 0
|
||||||
|
DockSite = False
|
||||||
|
DragKind = dkDrag
|
||||||
|
DragMode = dmManual
|
||||||
|
Enabled = True
|
||||||
|
Font.Height = 0
|
||||||
|
Font.Style = []
|
||||||
|
FormStyle = fsNormal
|
||||||
|
OnCreate = CreatePlotter
|
||||||
|
ParentBiDiMode = True
|
||||||
|
ParentFont = False
|
||||||
|
Position = poDesigned
|
||||||
|
ShowInTaskBar = stDefault
|
||||||
|
UseDockManager = False
|
||||||
|
LCLVersion = '0.9.27'
|
||||||
|
WindowState = wsNormal
|
||||||
|
end
|
16
components/plotpanel/demo/event/frmmain.lrs
Normal file
16
components/plotpanel/demo/event/frmmain.lrs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
{ This is an automatically generated lazarus resource file }
|
||||||
|
|
||||||
|
LazarusResources.Add('TMainForm','FORMDATA',[
|
||||||
|
'TPF0'#9'TMainForm'#8'MainForm'#4'Left'#3#145#1#6'Height'#3','#1#3'Top'#3'5'#1
|
||||||
|
+#5'Width'#3#144#1#11'HelpContext'#2#0#5'Align'#7#6'alNone'#14'AllowDropFiles'
|
||||||
|
+#8#10'AutoScroll'#9#8'AutoSize'#8#11'BorderIcons'#11#12'biSystemMenu'#10'biM'
|
||||||
|
+'inimize'#10'biMaximize'#0#11'BorderStyle'#7#10'bsSizeable'#7'Caption'#6#26
|
||||||
|
+'Event-driven plotting demo'#28'ChildSizing.LeftRightSpacing'#2#0#28'ChildSi'
|
||||||
|
+'zing.TopBottomSpacing'#2#0#29'ChildSizing.HorizontalSpacing'#2#0#27'ChildSi'
|
||||||
|
+'zing.VerticalSpacing'#2#0#27'ChildSizing.ControlsPerLine'#2#0#8'DockSite'#8
|
||||||
|
+#8'DragKind'#7#6'dkDrag'#8'DragMode'#7#8'dmManual'#7'Enabled'#9#11'Font.Heig'
|
||||||
|
+'ht'#2#0#10'Font.Style'#11#0#9'FormStyle'#7#8'fsNormal'#8'OnCreate'#7#13'Cre'
|
||||||
|
+'atePlotter'#14'ParentBiDiMode'#9#10'ParentFont'#8#8'Position'#7#10'poDesign'
|
||||||
|
+'ed'#13'ShowInTaskBar'#7#9'stDefault'#14'UseDockManager'#8#10'LCLVersion'#6#6
|
||||||
|
+'0.9.27'#11'WindowState'#7#8'wsNormal'#0#0
|
||||||
|
]);
|
50
components/plotpanel/demo/event/frmmain.pp
Normal file
50
components/plotpanel/demo/event/frmmain.pp
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
unit frmmain;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
|
||||||
|
plotpanel;
|
||||||
|
|
||||||
|
type
|
||||||
|
|
||||||
|
{ TMainForm }
|
||||||
|
|
||||||
|
TMainForm = class(TForm)
|
||||||
|
procedure CreatePlotter(Sender: TObject);
|
||||||
|
private
|
||||||
|
{ private declarations }
|
||||||
|
FPlot:TPlotFunctionPanel;
|
||||||
|
public
|
||||||
|
{ public declarations }
|
||||||
|
Procedure PlotResult(Const X : TPlotFloat; Out Y : TPlotFloat);
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
MainForm: TMainForm;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
{ TMainForm }
|
||||||
|
|
||||||
|
procedure TMainForm.CreatePlotter(Sender: TObject);
|
||||||
|
begin
|
||||||
|
FPlot:=TPlotFunctionPanel.Create(Self);
|
||||||
|
FPlot.parent:=Self;
|
||||||
|
FPlot.Align:=alClient;
|
||||||
|
Fplot.OnCalcPlot:=@PlotResult;
|
||||||
|
FPlot.Active:=True;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.PlotResult(const X: TPlotFloat; out Y: TPlotFloat);
|
||||||
|
begin
|
||||||
|
Y:=X*X/100;
|
||||||
|
end;
|
||||||
|
|
||||||
|
initialization
|
||||||
|
{$I frmmain.lrs}
|
||||||
|
|
||||||
|
end.
|
||||||
|
|
BIN
components/plotpanel/demo/event/ploteventdemo.ico
Normal file
BIN
components/plotpanel/demo/event/ploteventdemo.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
68
components/plotpanel/demo/event/ploteventdemo.lpi
Normal file
68
components/plotpanel/demo/event/ploteventdemo.lpi
Normal file
File diff suppressed because one or more lines are too long
20
components/plotpanel/demo/event/ploteventdemo.lpr
Normal file
20
components/plotpanel/demo/event/ploteventdemo.lpr
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
program Project1;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
uses
|
||||||
|
{$IFDEF UNIX}{$IFDEF UseCThreads}
|
||||||
|
cthreads,
|
||||||
|
{$ENDIF}{$ENDIF}
|
||||||
|
Interfaces, // this includes the LCL widgetset
|
||||||
|
Forms
|
||||||
|
{ you can add units after this }, frmmain, LResources, lazplotpanel;
|
||||||
|
|
||||||
|
{$IFDEF WINDOWS}{$R ploteventdemo.rc}{$ENDIF}
|
||||||
|
|
||||||
|
begin
|
||||||
|
Application.Initialize;
|
||||||
|
Application.CreateForm(TMainForm, MainForm);
|
||||||
|
Application.Run;
|
||||||
|
end.
|
||||||
|
|
1
components/plotpanel/demo/event/ploteventdemo.rc
Normal file
1
components/plotpanel/demo/event/ploteventdemo.rc
Normal file
@ -0,0 +1 @@
|
|||||||
|
MAINICON ICON "ploteventdemo.ico"
|
BIN
components/plotpanel/demo/expression/exprdemo.ico
Normal file
BIN
components/plotpanel/demo/expression/exprdemo.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 134 KiB |
75
components/plotpanel/demo/expression/exprdemo.lpi
Normal file
75
components/plotpanel/demo/expression/exprdemo.lpi
Normal file
File diff suppressed because one or more lines are too long
21
components/plotpanel/demo/expression/exprdemo.lpr
Normal file
21
components/plotpanel/demo/expression/exprdemo.lpr
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
program exprdemo;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
uses
|
||||||
|
{$IFDEF UNIX}{$IFDEF UseCThreads}
|
||||||
|
cthreads,
|
||||||
|
{$ENDIF}{$ENDIF}
|
||||||
|
Interfaces, // this includes the LCL widgetset
|
||||||
|
Forms
|
||||||
|
{ you can add units after this }, frmmain, LResources;
|
||||||
|
|
||||||
|
{$IFDEF WINDOWS}{$R exprdemo.rc}{$ENDIF}
|
||||||
|
|
||||||
|
begin
|
||||||
|
{$I exprdemo.lrs}
|
||||||
|
Application.Initialize;
|
||||||
|
Application.CreateForm(TMainForm, MainForm);
|
||||||
|
Application.Run;
|
||||||
|
end.
|
||||||
|
|
5222
components/plotpanel/demo/expression/exprdemo.lrs
Normal file
5222
components/plotpanel/demo/expression/exprdemo.lrs
Normal file
File diff suppressed because it is too large
Load Diff
1
components/plotpanel/demo/expression/exprdemo.rc
Normal file
1
components/plotpanel/demo/expression/exprdemo.rc
Normal file
@ -0,0 +1 @@
|
|||||||
|
MAINICON ICON "exprdemo.ico"
|
336
components/plotpanel/demo/expression/frmmain.lfm
Normal file
336
components/plotpanel/demo/expression/frmmain.lfm
Normal file
@ -0,0 +1,336 @@
|
|||||||
|
object MainForm: TMainForm
|
||||||
|
Left = 355
|
||||||
|
Height = 300
|
||||||
|
Top = 301
|
||||||
|
Width = 503
|
||||||
|
HelpContext = 0
|
||||||
|
Align = alNone
|
||||||
|
AllowDropFiles = False
|
||||||
|
AutoScroll = True
|
||||||
|
AutoSize = False
|
||||||
|
BorderIcons = [biSystemMenu, biMinimize, biMaximize]
|
||||||
|
BorderStyle = bsSizeable
|
||||||
|
Caption = 'Expression panel demo: quadratic function plot'
|
||||||
|
ChildSizing.LeftRightSpacing = 0
|
||||||
|
ChildSizing.TopBottomSpacing = 0
|
||||||
|
ChildSizing.HorizontalSpacing = 0
|
||||||
|
ChildSizing.VerticalSpacing = 0
|
||||||
|
ChildSizing.ControlsPerLine = 0
|
||||||
|
ClientHeight = 300
|
||||||
|
ClientWidth = 503
|
||||||
|
DockSite = False
|
||||||
|
DragKind = dkDrag
|
||||||
|
DragMode = dmManual
|
||||||
|
Enabled = True
|
||||||
|
Font.Height = 0
|
||||||
|
Font.Style = []
|
||||||
|
FormStyle = fsNormal
|
||||||
|
OnCreate = FormCreate
|
||||||
|
ParentBiDiMode = True
|
||||||
|
ParentFont = False
|
||||||
|
Position = poDesigned
|
||||||
|
ShowInTaskBar = stDefault
|
||||||
|
UseDockManager = False
|
||||||
|
LCLVersion = '0.9.27'
|
||||||
|
WindowState = wsNormal
|
||||||
|
object PParams: TPanel
|
||||||
|
Left = 0
|
||||||
|
Height = 32
|
||||||
|
Top = 0
|
||||||
|
Width = 503
|
||||||
|
HelpContext = 0
|
||||||
|
Align = alTop
|
||||||
|
Alignment = taCenter
|
||||||
|
AutoSize = False
|
||||||
|
BorderSpacing.Left = 0
|
||||||
|
BorderSpacing.Top = 0
|
||||||
|
BorderSpacing.Right = 0
|
||||||
|
BorderSpacing.Bottom = 0
|
||||||
|
BorderSpacing.Around = 0
|
||||||
|
BorderSpacing.CellAlignHorizontal = ccaFill
|
||||||
|
BorderSpacing.CellAlignVertical = ccaFill
|
||||||
|
BevelInner = bvNone
|
||||||
|
BevelOuter = bvLowered
|
||||||
|
BevelWidth = 1
|
||||||
|
BorderWidth = 0
|
||||||
|
BorderStyle = bsNone
|
||||||
|
ChildSizing.LeftRightSpacing = 0
|
||||||
|
ChildSizing.TopBottomSpacing = 0
|
||||||
|
ChildSizing.HorizontalSpacing = 0
|
||||||
|
ChildSizing.VerticalSpacing = 0
|
||||||
|
ChildSizing.ControlsPerLine = 0
|
||||||
|
ClientHeight = 32
|
||||||
|
ClientWidth = 503
|
||||||
|
DockSite = False
|
||||||
|
DragCursor = crDrag
|
||||||
|
DragKind = dkDrag
|
||||||
|
DragMode = dmManual
|
||||||
|
Enabled = True
|
||||||
|
FullRepaint = True
|
||||||
|
ParentColor = True
|
||||||
|
ParentFont = True
|
||||||
|
ParentShowHint = True
|
||||||
|
TabOrder = 0
|
||||||
|
TabStop = False
|
||||||
|
Visible = True
|
||||||
|
object LEA: TLabel
|
||||||
|
Left = 24
|
||||||
|
Height = 13
|
||||||
|
Top = 11
|
||||||
|
Width = 10
|
||||||
|
HelpContext = 0
|
||||||
|
Align = alNone
|
||||||
|
Alignment = taLeftJustify
|
||||||
|
AutoSize = True
|
||||||
|
BorderSpacing.Left = 0
|
||||||
|
BorderSpacing.Top = 0
|
||||||
|
BorderSpacing.Right = 0
|
||||||
|
BorderSpacing.Bottom = 0
|
||||||
|
BorderSpacing.Around = 0
|
||||||
|
BorderSpacing.CellAlignHorizontal = ccaFill
|
||||||
|
BorderSpacing.CellAlignVertical = ccaFill
|
||||||
|
Caption = 'A'
|
||||||
|
DragCursor = crDrag
|
||||||
|
DragMode = dmManual
|
||||||
|
Enabled = True
|
||||||
|
Layout = tlTop
|
||||||
|
ParentBidiMode = True
|
||||||
|
ParentColor = False
|
||||||
|
ParentFont = True
|
||||||
|
ParentShowHint = True
|
||||||
|
ShowAccelChar = True
|
||||||
|
Transparent = True
|
||||||
|
Visible = True
|
||||||
|
WordWrap = False
|
||||||
|
OptimalFill = False
|
||||||
|
end
|
||||||
|
object LEB: TLabel
|
||||||
|
Left = 128
|
||||||
|
Height = 13
|
||||||
|
Top = 8
|
||||||
|
Width = 8
|
||||||
|
HelpContext = 0
|
||||||
|
Align = alNone
|
||||||
|
Alignment = taLeftJustify
|
||||||
|
AutoSize = True
|
||||||
|
BorderSpacing.Left = 0
|
||||||
|
BorderSpacing.Top = 0
|
||||||
|
BorderSpacing.Right = 0
|
||||||
|
BorderSpacing.Bottom = 0
|
||||||
|
BorderSpacing.Around = 0
|
||||||
|
BorderSpacing.CellAlignHorizontal = ccaFill
|
||||||
|
BorderSpacing.CellAlignVertical = ccaFill
|
||||||
|
Caption = 'b'
|
||||||
|
DragCursor = crDrag
|
||||||
|
DragMode = dmManual
|
||||||
|
Enabled = True
|
||||||
|
Layout = tlTop
|
||||||
|
ParentBidiMode = True
|
||||||
|
ParentColor = False
|
||||||
|
ParentFont = True
|
||||||
|
ParentShowHint = True
|
||||||
|
ShowAccelChar = True
|
||||||
|
Transparent = True
|
||||||
|
Visible = True
|
||||||
|
WordWrap = False
|
||||||
|
OptimalFill = False
|
||||||
|
end
|
||||||
|
object LEC: TLabel
|
||||||
|
Left = 240
|
||||||
|
Height = 13
|
||||||
|
Top = 10
|
||||||
|
Width = 8
|
||||||
|
HelpContext = 0
|
||||||
|
Align = alNone
|
||||||
|
Alignment = taLeftJustify
|
||||||
|
AutoSize = True
|
||||||
|
BorderSpacing.Left = 0
|
||||||
|
BorderSpacing.Top = 0
|
||||||
|
BorderSpacing.Right = 0
|
||||||
|
BorderSpacing.Bottom = 0
|
||||||
|
BorderSpacing.Around = 0
|
||||||
|
BorderSpacing.CellAlignHorizontal = ccaFill
|
||||||
|
BorderSpacing.CellAlignVertical = ccaFill
|
||||||
|
Caption = 'c'
|
||||||
|
DragCursor = crDrag
|
||||||
|
DragMode = dmManual
|
||||||
|
Enabled = True
|
||||||
|
Layout = tlTop
|
||||||
|
ParentBidiMode = True
|
||||||
|
ParentColor = False
|
||||||
|
ParentFont = True
|
||||||
|
ParentShowHint = True
|
||||||
|
ShowAccelChar = True
|
||||||
|
Transparent = True
|
||||||
|
Visible = True
|
||||||
|
WordWrap = False
|
||||||
|
OptimalFill = False
|
||||||
|
end
|
||||||
|
object EA: TEdit
|
||||||
|
Left = 40
|
||||||
|
Height = 23
|
||||||
|
Top = 6
|
||||||
|
Width = 72
|
||||||
|
HelpContext = 0
|
||||||
|
Align = alNone
|
||||||
|
AutoSize = False
|
||||||
|
AutoSelect = False
|
||||||
|
BorderSpacing.Left = 0
|
||||||
|
BorderSpacing.Top = 0
|
||||||
|
BorderSpacing.Right = 0
|
||||||
|
BorderSpacing.Bottom = 0
|
||||||
|
BorderSpacing.Around = 0
|
||||||
|
BorderSpacing.CellAlignHorizontal = ccaFill
|
||||||
|
BorderSpacing.CellAlignVertical = ccaFill
|
||||||
|
CharCase = ecNormal
|
||||||
|
DragCursor = crDrag
|
||||||
|
DragMode = dmManual
|
||||||
|
EchoMode = emNormal
|
||||||
|
Enabled = True
|
||||||
|
MaxLength = -1
|
||||||
|
ParentBidiMode = True
|
||||||
|
ParentFont = True
|
||||||
|
ParentShowHint = True
|
||||||
|
PasswordChar = #0
|
||||||
|
ReadOnly = False
|
||||||
|
TabStop = True
|
||||||
|
TabOrder = 0
|
||||||
|
Text = '1'
|
||||||
|
Visible = True
|
||||||
|
end
|
||||||
|
object EB: TEdit
|
||||||
|
Left = 152
|
||||||
|
Height = 23
|
||||||
|
Top = 6
|
||||||
|
Width = 80
|
||||||
|
HelpContext = 0
|
||||||
|
Align = alNone
|
||||||
|
AutoSize = False
|
||||||
|
AutoSelect = False
|
||||||
|
BorderSpacing.Left = 0
|
||||||
|
BorderSpacing.Top = 0
|
||||||
|
BorderSpacing.Right = 0
|
||||||
|
BorderSpacing.Bottom = 0
|
||||||
|
BorderSpacing.Around = 0
|
||||||
|
BorderSpacing.CellAlignHorizontal = ccaFill
|
||||||
|
BorderSpacing.CellAlignVertical = ccaFill
|
||||||
|
CharCase = ecNormal
|
||||||
|
DragCursor = crDrag
|
||||||
|
DragMode = dmManual
|
||||||
|
EchoMode = emNormal
|
||||||
|
Enabled = True
|
||||||
|
MaxLength = -1
|
||||||
|
ParentBidiMode = True
|
||||||
|
ParentFont = True
|
||||||
|
ParentShowHint = True
|
||||||
|
PasswordChar = #0
|
||||||
|
ReadOnly = False
|
||||||
|
TabStop = True
|
||||||
|
TabOrder = 1
|
||||||
|
Text = '0'
|
||||||
|
Visible = True
|
||||||
|
end
|
||||||
|
object EC: TEdit
|
||||||
|
Left = 264
|
||||||
|
Height = 23
|
||||||
|
Top = 6
|
||||||
|
Width = 80
|
||||||
|
HelpContext = 0
|
||||||
|
Align = alNone
|
||||||
|
AutoSize = False
|
||||||
|
AutoSelect = False
|
||||||
|
BorderSpacing.Left = 0
|
||||||
|
BorderSpacing.Top = 0
|
||||||
|
BorderSpacing.Right = 0
|
||||||
|
BorderSpacing.Bottom = 0
|
||||||
|
BorderSpacing.Around = 0
|
||||||
|
BorderSpacing.CellAlignHorizontal = ccaFill
|
||||||
|
BorderSpacing.CellAlignVertical = ccaFill
|
||||||
|
CharCase = ecNormal
|
||||||
|
DragCursor = crDrag
|
||||||
|
DragMode = dmManual
|
||||||
|
EchoMode = emNormal
|
||||||
|
Enabled = True
|
||||||
|
MaxLength = -1
|
||||||
|
ParentBidiMode = True
|
||||||
|
ParentFont = True
|
||||||
|
ParentShowHint = True
|
||||||
|
PasswordChar = #0
|
||||||
|
ReadOnly = False
|
||||||
|
TabStop = True
|
||||||
|
TabOrder = 2
|
||||||
|
Text = '0'
|
||||||
|
Visible = True
|
||||||
|
end
|
||||||
|
object Button1: TButton
|
||||||
|
Left = 360
|
||||||
|
Height = 25
|
||||||
|
Top = 6
|
||||||
|
Width = 75
|
||||||
|
HelpContext = 0
|
||||||
|
Align = alNone
|
||||||
|
AutoSize = False
|
||||||
|
BorderSpacing.Left = 0
|
||||||
|
BorderSpacing.Top = 0
|
||||||
|
BorderSpacing.Right = 0
|
||||||
|
BorderSpacing.Bottom = 0
|
||||||
|
BorderSpacing.Around = 0
|
||||||
|
BorderSpacing.CellAlignHorizontal = ccaFill
|
||||||
|
BorderSpacing.CellAlignVertical = ccaFill
|
||||||
|
Cancel = False
|
||||||
|
Caption = '&Apply'
|
||||||
|
Default = False
|
||||||
|
DragCursor = crDrag
|
||||||
|
DragMode = dmManual
|
||||||
|
Enabled = True
|
||||||
|
ParentBidiMode = True
|
||||||
|
ModalResult = 0
|
||||||
|
OnClick = Button1Click
|
||||||
|
ParentFont = True
|
||||||
|
ParentShowHint = True
|
||||||
|
TabOrder = 3
|
||||||
|
TabStop = True
|
||||||
|
Visible = True
|
||||||
|
end
|
||||||
|
end
|
||||||
|
object Panel1: TPanel
|
||||||
|
Left = 0
|
||||||
|
Height = 268
|
||||||
|
Top = 32
|
||||||
|
Width = 503
|
||||||
|
HelpContext = 0
|
||||||
|
Align = alClient
|
||||||
|
Alignment = taCenter
|
||||||
|
AutoSize = False
|
||||||
|
BorderSpacing.Left = 0
|
||||||
|
BorderSpacing.Top = 0
|
||||||
|
BorderSpacing.Right = 0
|
||||||
|
BorderSpacing.Bottom = 0
|
||||||
|
BorderSpacing.Around = 0
|
||||||
|
BorderSpacing.CellAlignHorizontal = ccaFill
|
||||||
|
BorderSpacing.CellAlignVertical = ccaFill
|
||||||
|
BevelInner = bvNone
|
||||||
|
BevelOuter = bvLowered
|
||||||
|
BevelWidth = 1
|
||||||
|
BorderWidth = 0
|
||||||
|
BorderStyle = bsNone
|
||||||
|
Caption = 'Panel1'
|
||||||
|
ChildSizing.LeftRightSpacing = 0
|
||||||
|
ChildSizing.TopBottomSpacing = 0
|
||||||
|
ChildSizing.HorizontalSpacing = 0
|
||||||
|
ChildSizing.VerticalSpacing = 0
|
||||||
|
ChildSizing.ControlsPerLine = 0
|
||||||
|
DockSite = False
|
||||||
|
DragCursor = crDrag
|
||||||
|
DragKind = dkDrag
|
||||||
|
DragMode = dmManual
|
||||||
|
Enabled = True
|
||||||
|
FullRepaint = True
|
||||||
|
ParentColor = True
|
||||||
|
ParentFont = True
|
||||||
|
ParentShowHint = True
|
||||||
|
TabOrder = 1
|
||||||
|
TabStop = False
|
||||||
|
Visible = True
|
||||||
|
end
|
||||||
|
end
|
104
components/plotpanel/demo/expression/frmmain.lrs
Normal file
104
components/plotpanel/demo/expression/frmmain.lrs
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
{ This is an automatically generated lazarus resource file }
|
||||||
|
|
||||||
|
LazarusResources.Add('TMainForm','FORMDATA',[
|
||||||
|
'TPF0'#9'TMainForm'#8'MainForm'#4'Left'#3'c'#1#6'Height'#3','#1#3'Top'#3'-'#1
|
||||||
|
+#5'Width'#3#247#1#11'HelpContext'#2#0#5'Align'#7#6'alNone'#14'AllowDropFiles'
|
||||||
|
+#8#10'AutoScroll'#9#8'AutoSize'#8#11'BorderIcons'#11#12'biSystemMenu'#10'biM'
|
||||||
|
+'inimize'#10'biMaximize'#0#11'BorderStyle'#7#10'bsSizeable'#7'Caption'#6'.Ex'
|
||||||
|
+'pression panel demo: quadratic function plot'#28'ChildSizing.LeftRightSpaci'
|
||||||
|
+'ng'#2#0#28'ChildSizing.TopBottomSpacing'#2#0#29'ChildSizing.HorizontalSpaci'
|
||||||
|
+'ng'#2#0#27'ChildSizing.VerticalSpacing'#2#0#27'ChildSizing.ControlsPerLine'
|
||||||
|
+#2#0#12'ClientHeight'#3','#1#11'ClientWidth'#3#247#1#8'DockSite'#8#8'DragKin'
|
||||||
|
+'d'#7#6'dkDrag'#8'DragMode'#7#8'dmManual'#7'Enabled'#9#11'Font.Height'#2#0#10
|
||||||
|
+'Font.Style'#11#0#9'FormStyle'#7#8'fsNormal'#8'OnCreate'#7#10'FormCreate'#14
|
||||||
|
+'ParentBiDiMode'#9#10'ParentFont'#8#8'Position'#7#10'poDesigned'#13'ShowInTa'
|
||||||
|
+'skBar'#7#9'stDefault'#14'UseDockManager'#8#10'LCLVersion'#6#6'0.9.27'#11'Wi'
|
||||||
|
+'ndowState'#7#8'wsNormal'#0#6'TPanel'#7'PParams'#4'Left'#2#0#6'Height'#2' '#3
|
||||||
|
+'Top'#2#0#5'Width'#3#247#1#11'HelpContext'#2#0#5'Align'#7#5'alTop'#9'Alignme'
|
||||||
|
+'nt'#7#8'taCenter'#8'AutoSize'#8#18'BorderSpacing.Left'#2#0#17'BorderSpacing'
|
||||||
|
+'.Top'#2#0#19'BorderSpacing.Right'#2#0#20'BorderSpacing.Bottom'#2#0#20'Borde'
|
||||||
|
+'rSpacing.Around'#2#0'!BorderSpacing.CellAlignHorizontal'#7#7'ccaFill'#31'Bo'
|
||||||
|
+'rderSpacing.CellAlignVertical'#7#7'ccaFill'#10'BevelInner'#7#6'bvNone'#10'B'
|
||||||
|
+'evelOuter'#7#9'bvLowered'#10'BevelWidth'#2#1#11'BorderWidth'#2#0#11'BorderS'
|
||||||
|
+'tyle'#7#6'bsNone'#28'ChildSizing.LeftRightSpacing'#2#0#28'ChildSizing.TopBo'
|
||||||
|
+'ttomSpacing'#2#0#29'ChildSizing.HorizontalSpacing'#2#0#27'ChildSizing.Verti'
|
||||||
|
+'calSpacing'#2#0#27'ChildSizing.ControlsPerLine'#2#0#12'ClientHeight'#2' '#11
|
||||||
|
+'ClientWidth'#3#247#1#8'DockSite'#8#10'DragCursor'#7#6'crDrag'#8'DragKind'#7
|
||||||
|
+#6'dkDrag'#8'DragMode'#7#8'dmManual'#7'Enabled'#9#11'FullRepaint'#9#11'Paren'
|
||||||
|
+'tColor'#9#10'ParentFont'#9#14'ParentShowHint'#9#8'TabOrder'#2#0#7'TabStop'#8
|
||||||
|
+#7'Visible'#9#0#6'TLabel'#3'LEA'#4'Left'#2#24#6'Height'#2#13#3'Top'#2#11#5'W'
|
||||||
|
+'idth'#2#10#11'HelpContext'#2#0#5'Align'#7#6'alNone'#9'Alignment'#7#13'taLef'
|
||||||
|
+'tJustify'#8'AutoSize'#9#18'BorderSpacing.Left'#2#0#17'BorderSpacing.Top'#2#0
|
||||||
|
+#19'BorderSpacing.Right'#2#0#20'BorderSpacing.Bottom'#2#0#20'BorderSpacing.A'
|
||||||
|
+'round'#2#0'!BorderSpacing.CellAlignHorizontal'#7#7'ccaFill'#31'BorderSpacin'
|
||||||
|
+'g.CellAlignVertical'#7#7'ccaFill'#7'Caption'#6#1'A'#10'DragCursor'#7#6'crDr'
|
||||||
|
+'ag'#8'DragMode'#7#8'dmManual'#7'Enabled'#9#6'Layout'#7#5'tlTop'#14'ParentBi'
|
||||||
|
+'diMode'#9#11'ParentColor'#8#10'ParentFont'#9#14'ParentShowHint'#9#13'ShowAc'
|
||||||
|
+'celChar'#9#11'Transparent'#9#7'Visible'#9#8'WordWrap'#8#11'OptimalFill'#8#0
|
||||||
|
+#0#6'TLabel'#3'LEB'#4'Left'#3#128#0#6'Height'#2#13#3'Top'#2#8#5'Width'#2#8#11
|
||||||
|
+'HelpContext'#2#0#5'Align'#7#6'alNone'#9'Alignment'#7#13'taLeftJustify'#8'Au'
|
||||||
|
+'toSize'#9#18'BorderSpacing.Left'#2#0#17'BorderSpacing.Top'#2#0#19'BorderSpa'
|
||||||
|
+'cing.Right'#2#0#20'BorderSpacing.Bottom'#2#0#20'BorderSpacing.Around'#2#0'!'
|
||||||
|
+'BorderSpacing.CellAlignHorizontal'#7#7'ccaFill'#31'BorderSpacing.CellAlignV'
|
||||||
|
+'ertical'#7#7'ccaFill'#7'Caption'#6#1'b'#10'DragCursor'#7#6'crDrag'#8'DragMo'
|
||||||
|
+'de'#7#8'dmManual'#7'Enabled'#9#6'Layout'#7#5'tlTop'#14'ParentBidiMode'#9#11
|
||||||
|
+'ParentColor'#8#10'ParentFont'#9#14'ParentShowHint'#9#13'ShowAccelChar'#9#11
|
||||||
|
+'Transparent'#9#7'Visible'#9#8'WordWrap'#8#11'OptimalFill'#8#0#0#6'TLabel'#3
|
||||||
|
+'LEC'#4'Left'#3#240#0#6'Height'#2#13#3'Top'#2#10#5'Width'#2#8#11'HelpContext'
|
||||||
|
+#2#0#5'Align'#7#6'alNone'#9'Alignment'#7#13'taLeftJustify'#8'AutoSize'#9#18
|
||||||
|
+'BorderSpacing.Left'#2#0#17'BorderSpacing.Top'#2#0#19'BorderSpacing.Right'#2
|
||||||
|
+#0#20'BorderSpacing.Bottom'#2#0#20'BorderSpacing.Around'#2#0'!BorderSpacing.'
|
||||||
|
+'CellAlignHorizontal'#7#7'ccaFill'#31'BorderSpacing.CellAlignVertical'#7#7'c'
|
||||||
|
+'caFill'#7'Caption'#6#1'c'#10'DragCursor'#7#6'crDrag'#8'DragMode'#7#8'dmManu'
|
||||||
|
+'al'#7'Enabled'#9#6'Layout'#7#5'tlTop'#14'ParentBidiMode'#9#11'ParentColor'#8
|
||||||
|
+#10'ParentFont'#9#14'ParentShowHint'#9#13'ShowAccelChar'#9#11'Transparent'#9
|
||||||
|
+#7'Visible'#9#8'WordWrap'#8#11'OptimalFill'#8#0#0#5'TEdit'#2'EA'#4'Left'#2'('
|
||||||
|
+#6'Height'#2#23#3'Top'#2#6#5'Width'#2'H'#11'HelpContext'#2#0#5'Align'#7#6'al'
|
||||||
|
+'None'#8'AutoSize'#8#10'AutoSelect'#8#18'BorderSpacing.Left'#2#0#17'BorderSp'
|
||||||
|
+'acing.Top'#2#0#19'BorderSpacing.Right'#2#0#20'BorderSpacing.Bottom'#2#0#20
|
||||||
|
+'BorderSpacing.Around'#2#0'!BorderSpacing.CellAlignHorizontal'#7#7'ccaFill'
|
||||||
|
+#31'BorderSpacing.CellAlignVertical'#7#7'ccaFill'#8'CharCase'#7#8'ecNormal'
|
||||||
|
+#10'DragCursor'#7#6'crDrag'#8'DragMode'#7#8'dmManual'#8'EchoMode'#7#8'emNorm'
|
||||||
|
+'al'#7'Enabled'#9#9'MaxLength'#2#255#14'ParentBidiMode'#9#10'ParentFont'#9#14
|
||||||
|
+'ParentShowHint'#9#12'PasswordChar'#6#1#0#8'ReadOnly'#8#7'TabStop'#9#8'TabOr'
|
||||||
|
+'der'#2#0#4'Text'#6#1'1'#7'Visible'#9#0#0#5'TEdit'#2'EB'#4'Left'#3#152#0#6'H'
|
||||||
|
+'eight'#2#23#3'Top'#2#6#5'Width'#2'P'#11'HelpContext'#2#0#5'Align'#7#6'alNon'
|
||||||
|
+'e'#8'AutoSize'#8#10'AutoSelect'#8#18'BorderSpacing.Left'#2#0#17'BorderSpaci'
|
||||||
|
+'ng.Top'#2#0#19'BorderSpacing.Right'#2#0#20'BorderSpacing.Bottom'#2#0#20'Bor'
|
||||||
|
,'derSpacing.Around'#2#0'!BorderSpacing.CellAlignHorizontal'#7#7'ccaFill'#31
|
||||||
|
+'BorderSpacing.CellAlignVertical'#7#7'ccaFill'#8'CharCase'#7#8'ecNormal'#10
|
||||||
|
+'DragCursor'#7#6'crDrag'#8'DragMode'#7#8'dmManual'#8'EchoMode'#7#8'emNormal'
|
||||||
|
+#7'Enabled'#9#9'MaxLength'#2#255#14'ParentBidiMode'#9#10'ParentFont'#9#14'Pa'
|
||||||
|
+'rentShowHint'#9#12'PasswordChar'#6#1#0#8'ReadOnly'#8#7'TabStop'#9#8'TabOrde'
|
||||||
|
+'r'#2#1#4'Text'#6#1'0'#7'Visible'#9#0#0#5'TEdit'#2'EC'#4'Left'#3#8#1#6'Heigh'
|
||||||
|
+'t'#2#23#3'Top'#2#6#5'Width'#2'P'#11'HelpContext'#2#0#5'Align'#7#6'alNone'#8
|
||||||
|
+'AutoSize'#8#10'AutoSelect'#8#18'BorderSpacing.Left'#2#0#17'BorderSpacing.To'
|
||||||
|
+'p'#2#0#19'BorderSpacing.Right'#2#0#20'BorderSpacing.Bottom'#2#0#20'BorderSp'
|
||||||
|
+'acing.Around'#2#0'!BorderSpacing.CellAlignHorizontal'#7#7'ccaFill'#31'Borde'
|
||||||
|
+'rSpacing.CellAlignVertical'#7#7'ccaFill'#8'CharCase'#7#8'ecNormal'#10'DragC'
|
||||||
|
+'ursor'#7#6'crDrag'#8'DragMode'#7#8'dmManual'#8'EchoMode'#7#8'emNormal'#7'En'
|
||||||
|
+'abled'#9#9'MaxLength'#2#255#14'ParentBidiMode'#9#10'ParentFont'#9#14'Parent'
|
||||||
|
+'ShowHint'#9#12'PasswordChar'#6#1#0#8'ReadOnly'#8#7'TabStop'#9#8'TabOrder'#2
|
||||||
|
+#2#4'Text'#6#1'0'#7'Visible'#9#0#0#7'TButton'#7'Button1'#4'Left'#3'h'#1#6'He'
|
||||||
|
+'ight'#2#25#3'Top'#2#6#5'Width'#2'K'#11'HelpContext'#2#0#5'Align'#7#6'alNone'
|
||||||
|
+#8'AutoSize'#8#18'BorderSpacing.Left'#2#0#17'BorderSpacing.Top'#2#0#19'Borde'
|
||||||
|
+'rSpacing.Right'#2#0#20'BorderSpacing.Bottom'#2#0#20'BorderSpacing.Around'#2
|
||||||
|
+#0'!BorderSpacing.CellAlignHorizontal'#7#7'ccaFill'#31'BorderSpacing.CellAli'
|
||||||
|
+'gnVertical'#7#7'ccaFill'#6'Cancel'#8#7'Caption'#6#6'&Apply'#7'Default'#8#10
|
||||||
|
+'DragCursor'#7#6'crDrag'#8'DragMode'#7#8'dmManual'#7'Enabled'#9#14'ParentBid'
|
||||||
|
+'iMode'#9#11'ModalResult'#2#0#7'OnClick'#7#12'Button1Click'#10'ParentFont'#9
|
||||||
|
+#14'ParentShowHint'#9#8'TabOrder'#2#3#7'TabStop'#9#7'Visible'#9#0#0#0#6'TPan'
|
||||||
|
+'el'#6'Panel1'#4'Left'#2#0#6'Height'#3#12#1#3'Top'#2' '#5'Width'#3#247#1#11
|
||||||
|
+'HelpContext'#2#0#5'Align'#7#8'alClient'#9'Alignment'#7#8'taCenter'#8'AutoSi'
|
||||||
|
+'ze'#8#18'BorderSpacing.Left'#2#0#17'BorderSpacing.Top'#2#0#19'BorderSpacing'
|
||||||
|
+'.Right'#2#0#20'BorderSpacing.Bottom'#2#0#20'BorderSpacing.Around'#2#0'!Bord'
|
||||||
|
+'erSpacing.CellAlignHorizontal'#7#7'ccaFill'#31'BorderSpacing.CellAlignVerti'
|
||||||
|
+'cal'#7#7'ccaFill'#10'BevelInner'#7#6'bvNone'#10'BevelOuter'#7#9'bvLowered'
|
||||||
|
+#10'BevelWidth'#2#1#11'BorderWidth'#2#0#11'BorderStyle'#7#6'bsNone'#7'Captio'
|
||||||
|
+'n'#6#6'Panel1'#28'ChildSizing.LeftRightSpacing'#2#0#28'ChildSizing.TopBotto'
|
||||||
|
+'mSpacing'#2#0#29'ChildSizing.HorizontalSpacing'#2#0#27'ChildSizing.Vertical'
|
||||||
|
+'Spacing'#2#0#27'ChildSizing.ControlsPerLine'#2#0#8'DockSite'#8#10'DragCurso'
|
||||||
|
+'r'#7#6'crDrag'#8'DragKind'#7#6'dkDrag'#8'DragMode'#7#8'dmManual'#7'Enabled'
|
||||||
|
+#9#11'FullRepaint'#9#11'ParentColor'#9#10'ParentFont'#9#14'ParentShowHint'#9
|
||||||
|
+#8'TabOrder'#2#1#7'TabStop'#8#7'Visible'#9#0#0#0
|
||||||
|
]);
|
79
components/plotpanel/demo/expression/frmmain.pp
Normal file
79
components/plotpanel/demo/expression/frmmain.pp
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
unit frmmain;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
|
||||||
|
ExtCtrls, StdCtrls, fpexprpars,exprplotpanel;
|
||||||
|
|
||||||
|
type
|
||||||
|
|
||||||
|
{ TMainForm }
|
||||||
|
|
||||||
|
TMainForm = class(TForm)
|
||||||
|
Button1: TButton;
|
||||||
|
EA: TEdit;
|
||||||
|
EB: TEdit;
|
||||||
|
EC: TEdit;
|
||||||
|
LEA: TLabel;
|
||||||
|
LEC: TLabel;
|
||||||
|
LEB: TLabel;
|
||||||
|
Panel1: TPanel;
|
||||||
|
PParams: TPanel;
|
||||||
|
procedure Button1Click(Sender: TObject);
|
||||||
|
procedure FormCreate(Sender: TObject);
|
||||||
|
private
|
||||||
|
{ private declarations }
|
||||||
|
FPanel : TPlotExpressionPanel;
|
||||||
|
public
|
||||||
|
{ public declarations }
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
MainForm: TMainForm;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
{ TMainForm }
|
||||||
|
|
||||||
|
procedure TMainForm.FormCreate(Sender: TObject);
|
||||||
|
begin
|
||||||
|
FPanel:=TPlotExpressionPanel.Create(Self);
|
||||||
|
FPanel.Parent:=Panel1;
|
||||||
|
FPanel.Align:=alClient;
|
||||||
|
FPanel.Identifiers.AddFloatVariable('a',1.0);
|
||||||
|
FPanel.Identifiers.AddFloatVariable('b',0);
|
||||||
|
FPanel.Identifiers.AddFloatVariable('c',0);
|
||||||
|
FPanel.XAxis.Origin:=-30;
|
||||||
|
FPanel.XAxis.DrawZero:=True;
|
||||||
|
FPanel.YAxis.Caption.Alignment:=taCenter;
|
||||||
|
FPanel.YAxis.Origin:=-10;
|
||||||
|
FPanel.YAxis.DrawZero:=True;
|
||||||
|
FPanel.Expression:='a * (x * x) + b * x + c';
|
||||||
|
FPanel.Active:=True;
|
||||||
|
FPanel.Caption.Title:='Square function demo';
|
||||||
|
FPanel.Caption.Alignment:=taRightJustify;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.Button1Click(Sender: TObject);
|
||||||
|
|
||||||
|
Var
|
||||||
|
A,b,c : TExprFloat;
|
||||||
|
|
||||||
|
begin
|
||||||
|
A:=StrToFLoat(EA.Text);
|
||||||
|
b:=StrToFLoat(EB.Text);
|
||||||
|
C:=StrToFLoat(EC.Text);
|
||||||
|
FPanel.Identifiers.IdentifierByName('a').AsFloat:=A;
|
||||||
|
FPanel.Identifiers.IdentifierByName('b').AsFloat:=B;
|
||||||
|
FPanel.Identifiers.IdentifierByName('c').AsFloat:=C;
|
||||||
|
FPanel.Invalidate;
|
||||||
|
end;
|
||||||
|
|
||||||
|
initialization
|
||||||
|
{$I frmmain.lrs}
|
||||||
|
|
||||||
|
end.
|
||||||
|
|
173
components/plotpanel/exprplotpanel.pp
Normal file
173
components/plotpanel/exprplotpanel.pp
Normal file
@ -0,0 +1,173 @@
|
|||||||
|
{ Unit to plot an expression on a canvas
|
||||||
|
|
||||||
|
Copyright (C) 2008 Michael Van Canneyt michael@freepascal.org
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU Library General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or (at your
|
||||||
|
option) any later version with the following modification:
|
||||||
|
|
||||||
|
As a special exception, the copyright holders of this library give you
|
||||||
|
permission to link this library with independent modules to produce an
|
||||||
|
executable, regardless of the license terms of these independent modules,and
|
||||||
|
to copy and distribute the resulting executable under terms of your choice,
|
||||||
|
provided that you also meet, for each linked independent module, the terms
|
||||||
|
and conditions of the license of that module. An independent module is a
|
||||||
|
module which is not derived from or based on this library. If you modify
|
||||||
|
this library, you may extend this exception to your version of the library,
|
||||||
|
but you are not obligated to do so. If you do not wish to do so, delete this
|
||||||
|
exception statement from your version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public License
|
||||||
|
along with this library; if not, write to the Free Software Foundation,
|
||||||
|
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
}
|
||||||
|
|
||||||
|
unit exprplotpanel;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
Classes, SysUtils, plotpanel, fpexprpars;
|
||||||
|
|
||||||
|
Type
|
||||||
|
|
||||||
|
{ TExpressionControlPlotter }
|
||||||
|
|
||||||
|
TExpressionControlPlotter = Class(TCanvasPlotter)
|
||||||
|
private
|
||||||
|
FParser : TFPExpressionParser;
|
||||||
|
FX : TFPExprIdentifierDef;
|
||||||
|
function GetExpression: String;
|
||||||
|
function GetIdentifiers: TFPExprIdentifierDefs;
|
||||||
|
procedure SetExpression(const AValue: String);
|
||||||
|
procedure SetIdentifiers(const AValue: TFPExprIdentifierDefs);
|
||||||
|
Protected
|
||||||
|
Function CalcFunction(X : TPlotFloat) : TPlotFloat; override;
|
||||||
|
Property Parser : TFPExpressionParser Read FParser;
|
||||||
|
Public
|
||||||
|
Constructor Create(AOwner : TComponent); override;
|
||||||
|
Destructor Destroy; override;
|
||||||
|
Property Expression : String Read GetExpression Write SetExpression;
|
||||||
|
Property Identifiers : TFPExprIdentifierDefs Read GetIdentifiers Write SetIdentifiers;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TPlotFunctionPanel }
|
||||||
|
|
||||||
|
TPlotExpressionPanel = Class(TCustomPlotFunctionPanel)
|
||||||
|
private
|
||||||
|
function GetExpression: String;
|
||||||
|
function GetIdentifiers: TFPExprIdentifierDefs;
|
||||||
|
procedure SetExpression(const AValue: String);
|
||||||
|
procedure SetIdentifiers(const AValue: TFPExprIdentifierDefs);
|
||||||
|
Protected
|
||||||
|
Function CreatePlotter : TCanvasPlotter; override;
|
||||||
|
Published
|
||||||
|
Property Expression : String Read GetExpression Write SetExpression;
|
||||||
|
Property Identifiers : TFPExprIdentifierDefs Read GetIdentifiers Write SetIdentifiers;
|
||||||
|
Property Anchors;
|
||||||
|
Property Align;
|
||||||
|
Property XAxis;
|
||||||
|
Property YAxis;
|
||||||
|
Property Active;
|
||||||
|
Property PlotColor;
|
||||||
|
end;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
resourcestring
|
||||||
|
SErrInvalidResultType = 'Expression result type must be integer or float. Got %s"';
|
||||||
|
|
||||||
|
{ TExpressionControlPlotter }
|
||||||
|
|
||||||
|
function TExpressionControlPlotter.GetIdentifiers: TFPExprIdentifierDefs;
|
||||||
|
begin
|
||||||
|
Result:=FParser.Identifiers;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TExpressionControlPlotter.GetExpression: String;
|
||||||
|
begin
|
||||||
|
Result:=FParser.Expression;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TExpressionControlPlotter.SetExpression(const AValue: String);
|
||||||
|
begin
|
||||||
|
FParser.Expression:=AValue;
|
||||||
|
If Not (FParser.ResultType in [rtInteger,rtFLoat]) then
|
||||||
|
Raise EExprParser.CreateFmt(SErrInvalidResultType,[ResultTypeName(FParser.ResultType)]);
|
||||||
|
Changed;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TExpressionControlPlotter.SetIdentifiers(
|
||||||
|
const AValue: TFPExprIdentifierDefs);
|
||||||
|
begin
|
||||||
|
FParser.Identifiers.Assign(AValue);
|
||||||
|
// Reassign...
|
||||||
|
FX:=FParser.IdentifierByName('X');
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TExpressionControlPlotter.CalcFunction(X: TPlotFloat): TPlotFloat;
|
||||||
|
|
||||||
|
Var
|
||||||
|
E : TFPExpressionResult;
|
||||||
|
|
||||||
|
begin
|
||||||
|
FX.AsFloat:=X;
|
||||||
|
E:=FParser.Evaluate;
|
||||||
|
If E.ResultType=rtFloat then
|
||||||
|
result:=E.ResFloat
|
||||||
|
else If E.ResultType=rtInteger then
|
||||||
|
result:=E.ResInteger;
|
||||||
|
end;
|
||||||
|
|
||||||
|
constructor TExpressionControlPlotter.Create(AOwner: TComponent);
|
||||||
|
begin
|
||||||
|
inherited Create(AOwner);
|
||||||
|
FParser:=TFPExpressionParser.Create(Self);
|
||||||
|
FX:=FParser.Identifiers.AddFloatVariable('X',0.0);
|
||||||
|
end;
|
||||||
|
|
||||||
|
destructor TExpressionControlPlotter.Destroy;
|
||||||
|
begin
|
||||||
|
FX:=Nil;
|
||||||
|
FreeAndNil(FParser);
|
||||||
|
inherited Destroy;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TPlotExpressionPanel }
|
||||||
|
|
||||||
|
function TPlotExpressionPanel.GetExpression: String;
|
||||||
|
begin
|
||||||
|
Result:=TExpressionControlPlotter(Plotter).Expression;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TPlotExpressionPanel.GetIdentifiers: TFPExprIdentifierDefs;
|
||||||
|
begin
|
||||||
|
Result:=TExpressionControlPlotter(Plotter).Identifiers;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TPlotExpressionPanel.SetExpression(const AValue: String);
|
||||||
|
begin
|
||||||
|
TExpressionControlPlotter(Plotter).Expression:=AValue;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TPlotExpressionPanel.SetIdentifiers(const AValue: TFPExprIdentifierDefs
|
||||||
|
);
|
||||||
|
begin
|
||||||
|
TExpressionControlPlotter(Plotter).Identifiers:=AValue;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TPlotExpressionPanel.CreatePlotter: TCanvasPlotter;
|
||||||
|
begin
|
||||||
|
Result:=TExpressionControlPlotter.Create(Self);
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
||||||
|
|
56
components/plotpanel/lazplotpanel.lpk
Normal file
56
components/plotpanel/lazplotpanel.lpk
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<CONFIG>
|
||||||
|
<Package Version="3">
|
||||||
|
<Name Value="lazplotpanel"/>
|
||||||
|
<AddToProjectUsesSection Value="False"/>
|
||||||
|
<Author Value="Michael Van Canneyt"/>
|
||||||
|
<CompilerOptions>
|
||||||
|
<Version Value="8"/>
|
||||||
|
<SearchPaths>
|
||||||
|
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
|
||||||
|
</SearchPaths>
|
||||||
|
<Other>
|
||||||
|
<CompilerPath Value="$(CompPath)"/>
|
||||||
|
</Other>
|
||||||
|
</CompilerOptions>
|
||||||
|
<Description Value="2 components to plot a 2-D function y=f(x) in a grid.
|
||||||
|
The function result can be specified in an event
|
||||||
|
or in an expression
|
||||||
|
"/>
|
||||||
|
<License Value="Modified LGPL
|
||||||
|
"/>
|
||||||
|
<Version Release="1"/>
|
||||||
|
<Files Count="3">
|
||||||
|
<Item1>
|
||||||
|
<Filename Value="regplotpanel.pp"/>
|
||||||
|
<HasRegisterProc Value="True"/>
|
||||||
|
<UnitName Value="regplotpanel"/>
|
||||||
|
</Item1>
|
||||||
|
<Item2>
|
||||||
|
<Filename Value="exprplotpanel.pp"/>
|
||||||
|
<UnitName Value="exprplotpanel"/>
|
||||||
|
</Item2>
|
||||||
|
<Item3>
|
||||||
|
<Filename Value="plotpanel.pp"/>
|
||||||
|
<UnitName Value="plotpanel"/>
|
||||||
|
</Item3>
|
||||||
|
</Files>
|
||||||
|
<Type Value="RunAndDesignTime"/>
|
||||||
|
<RequiredPkgs Count="2">
|
||||||
|
<Item1>
|
||||||
|
<PackageName Value="LCL"/>
|
||||||
|
</Item1>
|
||||||
|
<Item2>
|
||||||
|
<PackageName Value="FCL"/>
|
||||||
|
<MinVersion Major="1" Valid="True"/>
|
||||||
|
</Item2>
|
||||||
|
</RequiredPkgs>
|
||||||
|
<UsageOptions>
|
||||||
|
<UnitPath Value="$(PkgOutDir)/"/>
|
||||||
|
</UsageOptions>
|
||||||
|
<PublishOptions>
|
||||||
|
<Version Value="2"/>
|
||||||
|
<IgnoreBinaries Value="False"/>
|
||||||
|
</PublishOptions>
|
||||||
|
</Package>
|
||||||
|
</CONFIG>
|
21
components/plotpanel/lazplotpanel.pas
Normal file
21
components/plotpanel/lazplotpanel.pas
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
{ This file was automatically created by Lazarus. do not edit!
|
||||||
|
This source is only used to compile and install the package.
|
||||||
|
}
|
||||||
|
|
||||||
|
unit lazplotpanel;
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
regplotpanel, exprplotpanel, plotpanel, LazarusPackageIntf;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
procedure Register;
|
||||||
|
begin
|
||||||
|
RegisterUnit('regplotpanel', @regplotpanel.Register);
|
||||||
|
end;
|
||||||
|
|
||||||
|
initialization
|
||||||
|
RegisterPackage('lazplotpanel', @Register);
|
||||||
|
end.
|
1187
components/plotpanel/plotpanel.pp
Normal file
1187
components/plotpanel/plotpanel.pp
Normal file
File diff suppressed because it is too large
Load Diff
45
components/plotpanel/readme.txt
Normal file
45
components/plotpanel/readme.txt
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
This package contains 2 components:
|
||||||
|
|
||||||
|
TPlotFunctionPanel
|
||||||
|
Plots a function y=F(x) on a grid.
|
||||||
|
The function result is calculated with an event "OnCalcPlot". This
|
||||||
|
function is called for each X for which an Y must be calculated.
|
||||||
|
|
||||||
|
TPlotExpressionPanel
|
||||||
|
Plots a function y=F(x) on a grid.
|
||||||
|
The function result is calculated from the expression "Expression"
|
||||||
|
The fpexprpars unit is used to calculate the expression. The
|
||||||
|
"Identifiers" property of the parsers is exposed so the variables
|
||||||
|
and function definitions can be manipulated
|
||||||
|
|
||||||
|
Both components have the following properties:
|
||||||
|
|
||||||
|
Active : If set to false, only the grid is drawn.
|
||||||
|
|
||||||
|
PlotColor : Color of the plotted line
|
||||||
|
|
||||||
|
Caption : Caption of the graph
|
||||||
|
|
||||||
|
|
||||||
|
XAxis, YAxis: These control the appearance of the X and Y axis.
|
||||||
|
They have both the following properties:
|
||||||
|
Color : Axis color
|
||||||
|
TickColor : Color of the tick marks on the axis.
|
||||||
|
Ticks : Number of tick marks or distance between tick marks on the
|
||||||
|
axis.
|
||||||
|
TickSize : Length of the tick mark.
|
||||||
|
TickMode : Ticks is number of ticks or distance (in pixels) between ticks.
|
||||||
|
TickFont : Font for the tick labels
|
||||||
|
Caption : Caption of the axis.
|
||||||
|
Drawzero : Should the 0 line be drawn extra ?
|
||||||
|
Origin : Starting point (in X or Y) of the axis.
|
||||||
|
Interval : Interval over which will be drawn. The axis covers the
|
||||||
|
X or Y interval [Origin,Origin+Interval]
|
||||||
|
|
||||||
|
LegendInterval : The interval (in ticks) at which a legend for the tick
|
||||||
|
mark should be printed.
|
||||||
|
LegendFormat : Controls the formatting of the legend at the tick marks.
|
||||||
|
This should be a valid float formatting specifier (used in FormatFloat);
|
||||||
|
GridInterval : The number of ticks at which a grid line must be drawn.
|
||||||
|
GridColor : Color of the grid line.
|
||||||
|
|
28
components/plotpanel/regplotpanel.lrs
Normal file
28
components/plotpanel/regplotpanel.lrs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
LazarusResources.Add('tplotfunctionpanel','PNG',[
|
||||||
|
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#24#0#0#0#24#8#6#0#0#0#224'w='#248#0
|
||||||
|
+#0#0#218'IDATH'#137#181#149'M'#14#131' '#16#133#31#141#7#145#133#199'h{'#162
|
||||||
|
+#174#225#8#174#245'B'#213#30#195'&'#210'4'#233'5'#166'+'#12#17#20#208#225#173
|
||||||
|
+#128#197#251#222#240'3'#8'"BI]'#138#186#3#168#236'@'#235#158#173#148#182'}'
|
||||||
|
+#136'eBD "('#213#17#135#148#234'h|'#14'd}'#171'5'#221#152#247#225#228#223#207
|
||||||
|
+#207'['#243#0'!I'#217'xk'#243'<%A'#147#0#169'f!'#5'oQ(1+'#128'S'#135#1'ub'
|
||||||
|
+#149#135#0#181'l`'#230'i'#129#236#193#178#1#214#28#192#2'1;'#151#224#244#25
|
||||||
|
+#236#153'G'#1#181'l'#146#247':'#27'`K_'#239'u,q2'#192#149#11#201#213#230'K^'
|
||||||
|
+''''#205'M'#30#5#228#190#230#173'v'#18#4#156#233'=Q@'#168#229#178#1#180#238
|
||||||
|
+'Y'#205#1'@'#184#159#254'k'#24#217#190#205#235#253'&<@'#9#21'o'#215''#154'9'
|
||||||
|
+#159#151'4H'#189';'#0#0#0#0'IEND'#174'B`'#130
|
||||||
|
]);
|
||||||
|
LazarusResources.Add('tplotexpressionpanel','PNG',[
|
||||||
|
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#24#0#0#0#24#8#6#0#0#0#224'w='#248#0
|
||||||
|
+#0#1#13'IDATH'#137#181#150'Q'#14#131' '#12#134#203#226'='#148#7#142#177#237
|
||||||
|
+'D{'#214'#'#236'Y/4'#221'1X'#2'f'#201#174#209#189#12#131'P*.'#248'''&'#210
|
||||||
|
+#164#255#215#150#128#10'D'#132'#u:'#212#29#0'*'#247#210'uC'#177'V'#238#247
|
||||||
|
+#155'X'#22#136#8#136#8'm'#219'c'#9#181'm'#143#211'cD'#231'['#133'tk_W'#254
|
||||||
|
+#158'?Q,'#2'P'#146'RE1ct'#22'4'#185#201#205#207#180#145#10#140#209#171''''
|
||||||
|
+#220#172#134'('#128#5'P'#21'7R-F'#214#232'U'#1#150#233#134#29#145'_Yh'#226' '
|
||||||
|
+#156'9'#0'3"k'#244'*'#217#239#192#173#253'NRJv'#16'&'#134'0'#183#222#234'$'#9
|
||||||
|
+#224'Z'#167#198#149#210#238#171'B'#206#252'Hv'#1#228#172'H'#195#220#24#11#144
|
||||||
|
+#179#2'Sk0'#181'^'#146#169#152#31#167#148'u'#146'C'#195'0'#150'2g'#1'a'#18'e'
|
||||||
|
+#194#25'o'#2#168#211#204')u7'#145#128#220#139',G'#17#128#186'r'#139#1#186'n('
|
||||||
|
+'j'#14#0' '#252#143#254's'#156#138'}6'#207#215#139#136#0'G'#232#240#191#138
|
||||||
|
+'/'#213#252#214#142#192'Z'#24#196#0#0#0#0'IEND'#174'B`'#130
|
||||||
|
]);
|
29
components/plotpanel/regplotpanel.pp
Normal file
29
components/plotpanel/regplotpanel.pp
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
unit regplotpanel;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
Classes, SysUtils,
|
||||||
|
plotpanel,
|
||||||
|
{$IFNDEF VER2_2}
|
||||||
|
exprplotpanel,
|
||||||
|
{$ENDIF VER2_2}
|
||||||
|
lresources;
|
||||||
|
|
||||||
|
Procedure Register;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
Procedure Register;
|
||||||
|
|
||||||
|
begin
|
||||||
|
Classes.RegisterComponents('Misc',[TPlotFunctionPanel
|
||||||
|
{$IFNDEF VER2_2},TPlotExpressionPanel{$ENDIF VER2_2}]);
|
||||||
|
end;
|
||||||
|
|
||||||
|
initialization
|
||||||
|
{$i regplotpanel.lrs}
|
||||||
|
end.
|
||||||
|
|
BIN
components/plotpanel/tplotexpressionpanel.png
Normal file
BIN
components/plotpanel/tplotexpressionpanel.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 326 B |
BIN
components/plotpanel/tplotfunctionpanel.png
Normal file
BIN
components/plotpanel/tplotfunctionpanel.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 275 B |
1
packager/globallinks/lazplotpanel.lpl
Normal file
1
packager/globallinks/lazplotpanel.lpl
Normal file
@ -0,0 +1 @@
|
|||||||
|
$(LazarusDir)/components/plotpanel/lazplotpanel.lpk
|
Loading…
Reference in New Issue
Block a user