├── package
├── Delphi7
│ └── .gitignore
├── Delphi2007
│ └── .gitignore
├── Delphi2009
│ └── .gitignore
├── QDSEquationsD7.dpk
├── QDSEquationsD2009.dpk
├── QDSEquationsD2007.dpk
├── qdsequationslaz.lpk
├── QDSEquationsD7.dof
├── QDSEquationsD2007.dproj
└── QDSEquationsD2009.dproj
├── docs
├── snapshot.PNG
├── EquationsModel.mpb
└── classes
├── resources
├── localize.rc
├── images
│ ├── 00.bmp
│ ├── 01.bmp
│ ├── 02.bmp
│ ├── 03.bmp
│ ├── 04.bmp
│ ├── 05.bmp
│ ├── 06.bmp
│ ├── 07.bmp
│ ├── 08.bmp
│ ├── 09.bmp
│ ├── 10.bmp
│ ├── 11.bmp
│ ├── 12.bmp
│ ├── 13.bmp
│ ├── 14.bmp
│ ├── 15.bmp
│ ├── 16.bmp
│ ├── 17.bmp
│ ├── 18.bmp
│ ├── 19.bmp
│ ├── bann.gif
│ ├── logoext.bmp
│ ├── TQDSEQUATION.BMP
│ ├── TSELECTEQUATION.BMP
│ └── TSELECTEQUATION32.bmp
├── QDSEquations.rc
├── cmpres.cmd
├── cmpres_windres.cmd
└── images.rc
├── .gitignore
├── demo
├── QDSEqDemo.dpr
├── QDSEqDemo.lpi
├── main.pas
├── main.dfm
├── QDSEqDemo2007.dproj
├── main.lfm
└── QDSEqDemo2009.dproj
├── release.cmd
├── README.md
└── source
├── UsefulUtils.pas
├── SelectEquation.pas
└── Equations.pas
/package/Delphi7/.gitignore:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/package/Delphi2007/.gitignore:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/package/Delphi2009/.gitignore:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/docs/snapshot.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karser/QDSEquations/HEAD/docs/snapshot.PNG
--------------------------------------------------------------------------------
/resources/localize.rc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karser/QDSEquations/HEAD/resources/localize.rc
--------------------------------------------------------------------------------
/docs/EquationsModel.mpb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karser/QDSEquations/HEAD/docs/EquationsModel.mpb
--------------------------------------------------------------------------------
/resources/images/00.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karser/QDSEquations/HEAD/resources/images/00.bmp
--------------------------------------------------------------------------------
/resources/images/01.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karser/QDSEquations/HEAD/resources/images/01.bmp
--------------------------------------------------------------------------------
/resources/images/02.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karser/QDSEquations/HEAD/resources/images/02.bmp
--------------------------------------------------------------------------------
/resources/images/03.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karser/QDSEquations/HEAD/resources/images/03.bmp
--------------------------------------------------------------------------------
/resources/images/04.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karser/QDSEquations/HEAD/resources/images/04.bmp
--------------------------------------------------------------------------------
/resources/images/05.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karser/QDSEquations/HEAD/resources/images/05.bmp
--------------------------------------------------------------------------------
/resources/images/06.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karser/QDSEquations/HEAD/resources/images/06.bmp
--------------------------------------------------------------------------------
/resources/images/07.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karser/QDSEquations/HEAD/resources/images/07.bmp
--------------------------------------------------------------------------------
/resources/images/08.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karser/QDSEquations/HEAD/resources/images/08.bmp
--------------------------------------------------------------------------------
/resources/images/09.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karser/QDSEquations/HEAD/resources/images/09.bmp
--------------------------------------------------------------------------------
/resources/images/10.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karser/QDSEquations/HEAD/resources/images/10.bmp
--------------------------------------------------------------------------------
/resources/images/11.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karser/QDSEquations/HEAD/resources/images/11.bmp
--------------------------------------------------------------------------------
/resources/images/12.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karser/QDSEquations/HEAD/resources/images/12.bmp
--------------------------------------------------------------------------------
/resources/images/13.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karser/QDSEquations/HEAD/resources/images/13.bmp
--------------------------------------------------------------------------------
/resources/images/14.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karser/QDSEquations/HEAD/resources/images/14.bmp
--------------------------------------------------------------------------------
/resources/images/15.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karser/QDSEquations/HEAD/resources/images/15.bmp
--------------------------------------------------------------------------------
/resources/images/16.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karser/QDSEquations/HEAD/resources/images/16.bmp
--------------------------------------------------------------------------------
/resources/images/17.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karser/QDSEquations/HEAD/resources/images/17.bmp
--------------------------------------------------------------------------------
/resources/images/18.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karser/QDSEquations/HEAD/resources/images/18.bmp
--------------------------------------------------------------------------------
/resources/images/19.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karser/QDSEquations/HEAD/resources/images/19.bmp
--------------------------------------------------------------------------------
/resources/images/bann.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karser/QDSEquations/HEAD/resources/images/bann.gif
--------------------------------------------------------------------------------
/resources/images/logoext.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karser/QDSEquations/HEAD/resources/images/logoext.bmp
--------------------------------------------------------------------------------
/resources/QDSEquations.rc:
--------------------------------------------------------------------------------
1 | TQDSEQUATION BITMAP images\TQDSEQUATION.BMP
2 | TSELECTEQUATION BITMAP images\TSELECTEQUATION.BMP
--------------------------------------------------------------------------------
/resources/images/TQDSEQUATION.BMP:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karser/QDSEquations/HEAD/resources/images/TQDSEQUATION.BMP
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.~bpl
2 | *.~ddp
3 | *.~dfm
4 | *.~dpr
5 | *.~pas
6 | *.bpl
7 | *.dcp
8 | *.dcr
9 | *.dcu
10 | *.exe
11 |
--------------------------------------------------------------------------------
/resources/images/TSELECTEQUATION.BMP:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karser/QDSEquations/HEAD/resources/images/TSELECTEQUATION.BMP
--------------------------------------------------------------------------------
/resources/images/TSELECTEQUATION32.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karser/QDSEquations/HEAD/resources/images/TSELECTEQUATION32.bmp
--------------------------------------------------------------------------------
/resources/cmpres.cmd:
--------------------------------------------------------------------------------
1 | brcc32 images.rc -fo images.res
2 | brcc32 localize.rc -fo localize.res
3 | brcc32 QDSEquations.rc -fo QDSEquations.dcr
4 | pause
--------------------------------------------------------------------------------
/resources/cmpres_windres.cmd:
--------------------------------------------------------------------------------
1 | windres -i images.rc -o images.res
2 | windres -i localize.rc -o localize.res
3 | windres -i QDSEquations.rc -o QDSEquations.dcr
4 | pause
5 |
--------------------------------------------------------------------------------
/demo/QDSEqDemo.dpr:
--------------------------------------------------------------------------------
1 | program QDSEqDemo;
2 |
3 | uses
4 | Forms,
5 | main in 'main.pas' {frmMain},
6 | UsefulUtils in 'UsefulUtils.pas';
7 |
8 | {$R *.res}
9 |
10 | begin
11 | Application.Initialize;
12 | Application.Title := 'QDS Eqations';
13 | Application.CreateForm(TfrmMain, frmMain);
14 | Application.Run;
15 | end.
16 |
--------------------------------------------------------------------------------
/resources/images.rc:
--------------------------------------------------------------------------------
1 | BT00 BITMAP images\00.bmp
2 | BT01 BITMAP images\01.bmp
3 | BT02 BITMAP images\02.bmp
4 | BT03 BITMAP images\03.bmp
5 | BT04 BITMAP images\04.bmp
6 | BT05 BITMAP images\05.bmp
7 | BT06 BITMAP images\06.bmp
8 | BT07 BITMAP images\07.bmp
9 | BT08 BITMAP images\08.bmp
10 | BT09 BITMAP images\09.bmp
11 | BT10 BITMAP images\10.bmp
12 | BT11 BITMAP images\11.bmp
13 | BT12 BITMAP images\12.bmp
14 | BT13 BITMAP images\13.bmp
15 | BT14 BITMAP images\14.bmp
16 | BT15 BITMAP images\15.bmp
17 | BT16 BITMAP images\16.bmp
18 | BT17 BITMAP images\17.bmp
19 | BT18 BITMAP images\18.bmp
20 | BT19 BITMAP images\19.bmp
--------------------------------------------------------------------------------
/release.cmd:
--------------------------------------------------------------------------------
1 | set package=".\package"
2 | set demo=".\demo"
3 | set release=".\release"
4 | set releasefile=".\QDSEqations.zip"
5 |
6 |
7 | set exerar="C:\Program Files\WinRAR\Rar.exe"
8 |
9 |
10 | IF EXIST %release% (
11 | DEL /Q %release%\*.*
12 | RMDIR /S /Q %release%
13 | )
14 |
15 | MKDIR %release%
16 | MKDIR %release%\demo
17 | MKDIR %release%\package
18 | MKDIR %release%\package\Delphi7
19 | MKDIR %release%\package\Delphi2007
20 | MKDIR %release%\package\Delphi2009
21 |
22 | COPY %demo% %release%\demo
23 |
24 | COPY %package%\Delphi7 %release%\package\Delphi7
25 | COPY %package%\Delphi2007 %release%\package\Delphi2007
26 | COPY %package%\Delphi2009 %release%\package\Delphi2009
27 |
28 | DEL /Q %releasefile%
29 |
30 | %exerar% a -ep1 -r %releasefile% %release%\
31 |
32 |
33 |
34 | pause
35 |
--------------------------------------------------------------------------------
/package/QDSEquationsD7.dpk:
--------------------------------------------------------------------------------
1 | package QDSEquationsD7;
2 |
3 | {$R *.res}
4 | {$R 'QDSEquations.dcr'}
5 | {$ALIGN 8}
6 | {$ASSERTIONS ON}
7 | {$BOOLEVAL OFF}
8 | {$DEBUGINFO ON}
9 | {$EXTENDEDSYNTAX ON}
10 | {$IMPORTEDDATA ON}
11 | {$IOCHECKS ON}
12 | {$LOCALSYMBOLS ON}
13 | {$LONGSTRINGS ON}
14 | {$OPENSTRINGS ON}
15 | {$OPTIMIZATION ON}
16 | {$OVERFLOWCHECKS OFF}
17 | {$RANGECHECKS OFF}
18 | {$REFERENCEINFO ON}
19 | {$SAFEDIVIDE OFF}
20 | {$STACKFRAMES OFF}
21 | {$TYPEDADDRESS OFF}
22 | {$VARSTRINGCHECKS ON}
23 | {$WRITEABLECONST OFF}
24 | {$MINENUMSIZE 1}
25 | {$IMAGEBASE $400000}
26 | {$DESCRIPTION 'QDS Equations'}
27 | {$IMPLICITBUILD OFF}
28 |
29 | requires
30 | rtl,
31 | vcl;
32 |
33 | contains
34 | Equations in '..\Source\Equations.pas',
35 | SelectEquation in '..\Source\SelectEquation.pas',
36 | UsefulUtils in '..\Source\UsefulUtils.pas';
37 |
38 | end.
39 |
--------------------------------------------------------------------------------
/package/QDSEquationsD2009.dpk:
--------------------------------------------------------------------------------
1 | package QDSEquationsD2009;
2 |
3 | {$R *.res}
4 | {$R 'QDSEquations.dcr'}
5 | {$ALIGN 8}
6 | {$ASSERTIONS ON}
7 | {$BOOLEVAL OFF}
8 | {$DEBUGINFO ON}
9 | {$EXTENDEDSYNTAX ON}
10 | {$IMPORTEDDATA ON}
11 | {$IOCHECKS ON}
12 | {$LOCALSYMBOLS ON}
13 | {$LONGSTRINGS ON}
14 | {$OPENSTRINGS ON}
15 | {$OPTIMIZATION ON}
16 | {$OVERFLOWCHECKS OFF}
17 | {$RANGECHECKS OFF}
18 | {$REFERENCEINFO ON}
19 | {$SAFEDIVIDE OFF}
20 | {$STACKFRAMES OFF}
21 | {$TYPEDADDRESS OFF}
22 | {$VARSTRINGCHECKS ON}
23 | {$WRITEABLECONST OFF}
24 | {$MINENUMSIZE 1}
25 | {$IMAGEBASE $400000}
26 | {$DESCRIPTION 'QDS Equations'}
27 | {$IMPLICITBUILD OFF}
28 |
29 | requires
30 | rtl,
31 | vcl;
32 |
33 | contains
34 | Equations in '..\Source\Equations.pas',
35 | SelectEquation in '..\Source\SelectEquation.pas',
36 | UsefulUtils in '..\Source\UsefulUtils.pas';
37 |
38 | end.
39 |
40 |
--------------------------------------------------------------------------------
/package/QDSEquationsD2007.dpk:
--------------------------------------------------------------------------------
1 | package QDSEquationsD2007;
2 |
3 | {$R *.res}
4 | {$R 'QDSEquations.dcr'}
5 | {$ALIGN 8}
6 | {$ASSERTIONS ON}
7 | {$BOOLEVAL OFF}
8 | {$DEBUGINFO OFF}
9 | {$EXTENDEDSYNTAX ON}
10 | {$IMPORTEDDATA ON}
11 | {$IOCHECKS ON}
12 | {$LOCALSYMBOLS OFF}
13 | {$LONGSTRINGS ON}
14 | {$OPENSTRINGS ON}
15 | {$OPTIMIZATION ON}
16 | {$OVERFLOWCHECKS OFF}
17 | {$RANGECHECKS OFF}
18 | {$REFERENCEINFO OFF}
19 | {$SAFEDIVIDE OFF}
20 | {$STACKFRAMES OFF}
21 | {$TYPEDADDRESS OFF}
22 | {$VARSTRINGCHECKS ON}
23 | {$WRITEABLECONST OFF}
24 | {$MINENUMSIZE 1}
25 | {$IMAGEBASE $400000}
26 | {$DESCRIPTION 'QDS Equations'}
27 | {$IMPLICITBUILD OFF}
28 | {$DEFINE RELEASE}
29 |
30 | requires
31 | rtl,
32 | vcl;
33 |
34 | contains
35 | Equations in '..\Source\Equations.pas',
36 | SelectEquation in '..\Source\SelectEquation.pas',
37 | UsefulUtils in '..\Source\UsefulUtils.pas';
38 |
39 | end.
40 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | QDSEquations
2 | ============
3 |
4 | Delphi component equation editor that allow you to enter and display math formulas of any complexity, from simple Greek symbols to matrixes and complex integral expressions.
5 | You can use the equation editor in your projects written in the Delphi environment, for example, in programs testing knowledge of different mathematics fields (mathematical analysis, discrete mathematics, probability theory and so on), physics and other.
6 |
7 | It’s quite easy to enter formulas in it:
8 | * simple symbols are entered similarly to entering data in a text field
9 | * special symbols and formula elements are entered with the help of an additional menu
10 |
11 | 
12 |
13 |
14 | ## How to compile resources
15 |
16 | - If you have Delphi installed (brcc32) just run `cmpres.cmd` in resources folder.
17 | - For Lazarus run `cmpres_windres.cmd`. In requires `windres` which can be obtained by [installing MinGW](https://sourceforge.net/projects/mingw-w64/) and selecting `mingw32-base`.
18 |
19 | Contributions Welcome!
20 |
--------------------------------------------------------------------------------
/package/qdsequationslaz.lpk:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/source/UsefulUtils.pas:
--------------------------------------------------------------------------------
1 | unit UsefulUtils;
2 |
3 | interface
4 |
5 | uses
6 | SysUtils, Windows;
7 |
8 | function GetCharFromVirtualKey(AKey: Word): string;
9 | function GetCharFromVirtualKey2(Key: Word): Char;
10 | function GetString(const Index: String) : String;
11 | function IntToStrZero(Value: Integer; Size: Integer): String;
12 |
13 |
14 | implementation
15 |
16 | function GetCharFromVirtualKey(AKey: Word): string;
17 | var
18 | KeyboardState: Windows.TKeyboardState; // keyboard state codes
19 | const
20 | MAPVK_VK_TO_VSC = 0; // parameter passed to MapVirtualKey
21 | begin
22 | Windows.GetKeyboardState(KeyboardState);
23 | SetLength(Result, 2); // max number of returned chars
24 | case Windows.ToAscii(
25 | AKey,
26 | Windows.MapVirtualKey(AKey, MAPVK_VK_TO_VSC),
27 | KeyboardState,
28 | @Result[1],
29 | 0
30 | ) of
31 | 0: Result := ''; // no translation available
32 | 1: SetLength(Result, 1); // single char returned
33 | 2: {Do nothing}; // two chars returned: leave Length(Result) = 2
34 | else Result := ''; // probably dead key
35 | end;
36 | end;
37 |
38 | function GetCharFromVirtualKey2(Key: Word): Char;
39 | var
40 | keyboardState: TKeyboardState;
41 | asciiResult: Integer;
42 | begin
43 | GetKeyboardState(keyboardState) ;
44 |
45 | asciiResult := ToAscii(Key, MapVirtualKey(Key, 0), keyboardState, @Result, 0) ;
46 | case asciiResult of
47 | 0: Result := #0;
48 | 1:;
49 | 2:;
50 | else
51 | Result := #0;
52 | end;
53 | end;
54 |
55 | function GetString(const Index: String) : String;
56 | var
57 | buffer : array[0..255] of Char;
58 | ls : integer;
59 | begin
60 | Result := '';
61 | ls := LoadString(hInstance, StrToInt(Index), buffer, sizeof(buffer));
62 | if ls <> 0 then Result := buffer;
63 | end;
64 |
65 | function IntToStrZero(Value: Integer; Size: Integer): String;
66 | begin
67 | Result:=IntToStr(Value);
68 | while Length(Result)
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
--------------------------------------------------------------------------------
/demo/main.pas:
--------------------------------------------------------------------------------
1 | unit main;
2 |
3 | {$IFDEF FPC}
4 | {$MODE Delphi}
5 | {$ENDIF}
6 |
7 | interface
8 |
9 | uses
10 | Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
11 | Dialogs, Equations, SelectEquation, StdCtrls, ToolWin, ComCtrls, ImgList,
12 | ExtCtrls, Spin, Grids, DBGrids;
13 |
14 | type
15 | TfrmMain = class(TForm)
16 | FontDialog1: TFontDialog;
17 | ColorDialog1: TColorDialog;
18 | Panel1: TPanel;
19 | Memo1: TMemo;
20 | Label1: TLabel;
21 | Label2: TLabel;
22 | ComboBox1: TComboBox;
23 | Button1: TButton;
24 | Button2: TButton;
25 | SelectEquation1: TSelectEquation;
26 | QDSEquation1: TQDSEquation;
27 | procedure FormCreate(Sender: TObject);
28 | procedure Button1Click(Sender: TObject);
29 | procedure Button2Click(Sender: TObject);
30 | procedure QDSEquation1Change(Sender: TObject);
31 | procedure Memo1Change(Sender: TObject);
32 | procedure ComboBox1Change(Sender: TObject);
33 | private
34 | { Private declarations }
35 | public
36 | { Public declarations }
37 | end;
38 |
39 | var
40 | frmMain: TfrmMain;
41 |
42 | QDSEquation1: TQDSEquation;
43 | SelectEquation1: TSelectEquation;
44 |
45 | implementation
46 |
47 | {$IFDEF FPC}
48 | {$R *.lfm}
49 | {$ELSE}
50 | {$R *.dfm}
51 | {$ENDIF}
52 |
53 | procedure TfrmMain.FormCreate(Sender: TObject);
54 | //var Canvas: TCanvas;
55 |
56 | begin
57 | QDSEquation1.Data:='EditArea(IntLimitBottomTopOne(EditArea(Simple(x)Simple(d)Simple(x))EditArea(Simple(0))EditArea(ExtSymbol(8734))))';
58 | ComboBox1Change(Self);
59 | Caption:=Format('%s v%s',[Caption,QDSEquation1.Version]);
60 | end;
61 |
62 | procedure TfrmMain.Button1Click(Sender: TObject);
63 | begin
64 | FontDialog1.Font.Assign(QDSEquation1.Font);
65 | if FontDialog1.Execute then QDSEquation1.Font.Assign(FontDialog1.Font);
66 | end;
67 |
68 | procedure TfrmMain.Button2Click(Sender: TObject);
69 | begin
70 | ColorDialog1.Color:=QDSEquation1.BkColor;
71 | if ColorDialog1.Execute then QDSEquation1.BkColor:=ColorDialog1.Color;
72 | end;
73 |
74 | procedure TfrmMain.QDSEquation1Change(Sender: TObject);
75 | begin
76 | Memo1.Text:=QDSEquation1.Data;
77 | end;
78 |
79 | procedure TfrmMain.Memo1Change(Sender: TObject);
80 | begin
81 | if QDSEquation1.Data<>Memo1.Text then
82 | QDSEquation1.Data:=Memo1.Text;
83 | end;
84 |
85 | procedure TfrmMain.ComboBox1Change(Sender: TObject);
86 | begin
87 | case ComboBox1.ItemIndex of
88 | 0: SelectEquation1.Language:=lRussian;
89 | 1: SelectEquation1.Language:=lDeutsche;
90 | 2: SelectEquation1.Language:=lEnglish;
91 | end;
92 | end;
93 |
94 | end.
95 |
96 |
97 |
--------------------------------------------------------------------------------
/demo/main.dfm:
--------------------------------------------------------------------------------
1 | object frmMain: TfrmMain
2 | Left = 200
3 | Top = 129
4 | Width = 1000
5 | Height = 476
6 | Caption = 'QDS Eqations'
7 | Color = clBtnFace
8 | Font.Charset = DEFAULT_CHARSET
9 | Font.Color = clWindowText
10 | Font.Height = -11
11 | Font.Name = 'MS Sans Serif'
12 | Font.Style = []
13 | OldCreateOrder = False
14 | OnCreate = FormCreate
15 | PixelsPerInch = 96
16 | TextHeight = 13
17 | object Panel1: TPanel
18 | Left = 0
19 | Top = 316
20 | Width = 984
21 | Height = 121
22 | Align = alBottom
23 | TabOrder = 0
24 | DesignSize = (
25 | 984
26 | 121)
27 | object Label1: TLabel
28 | Left = 8
29 | Top = 20
30 | Width = 23
31 | Height = 13
32 | Anchors = [akLeft, akBottom]
33 | Caption = 'Data'
34 | end
35 | object Label2: TLabel
36 | Left = 657
37 | Top = 1
38 | Width = 48
39 | Height = 13
40 | Anchors = [akRight, akBottom]
41 | Caption = 'Language'
42 | end
43 | object Memo1: TMemo
44 | Left = 1
45 | Top = 40
46 | Width = 982
47 | Height = 80
48 | Align = alBottom
49 | TabOrder = 0
50 | WantReturns = False
51 | OnChange = Memo1Change
52 | end
53 | object ComboBox1: TComboBox
54 | Left = 655
55 | Top = 14
56 | Width = 127
57 | Height = 24
58 | Style = csDropDownList
59 | Anchors = [akRight, akBottom]
60 | Font.Charset = DEFAULT_CHARSET
61 | Font.Color = clWindowText
62 | Font.Height = -16
63 | Font.Name = 'Courier'
64 | Font.Style = []
65 | ItemHeight = 16
66 | ItemIndex = 0
67 | ParentFont = False
68 | TabOrder = 1
69 | Text = 'Russian'
70 | OnChange = ComboBox1Change
71 | Items.Strings = (
72 | 'Russian'
73 | 'Deutsche'
74 | 'English')
75 | end
76 | object Button1: TButton
77 | Left = 802
78 | Top = 13
79 | Width = 75
80 | Height = 25
81 | Anchors = [akRight, akBottom]
82 | Caption = 'Font..'
83 | TabOrder = 2
84 | OnClick = Button1Click
85 | end
86 | object Button2: TButton
87 | Left = 901
88 | Top = 13
89 | Width = 75
90 | Height = 25
91 | Anchors = [akRight, akBottom]
92 | Caption = 'BkColor..'
93 | TabOrder = 3
94 | OnClick = Button2Click
95 | end
96 | end
97 | object SelectEquation1: TSelectEquation
98 | Left = 0
99 | Top = 0
100 | Width = 984
101 | Height = 121
102 | Align = alTop
103 | Equation = QDSEquation1
104 | Language = lRussian
105 | end
106 | object QDSEquation1: TQDSEquation
107 | Left = 0
108 | Top = 121
109 | Width = 984
110 | Height = 195
111 | Align = alClient
112 | BkColor = clWhite
113 | Data = 'EditArea()'
114 | Font.Charset = RUSSIAN_CHARSET
115 | Font.Color = clBlack
116 | Font.Height = -27
117 | Font.Name = 'Times New Roman'
118 | Font.Style = []
119 | OnChange = QDSEquation1Change
120 | end
121 | object FontDialog1: TFontDialog
122 | Font.Charset = DEFAULT_CHARSET
123 | Font.Color = clWindowText
124 | Font.Height = -11
125 | Font.Name = 'MS Sans Serif'
126 | Font.Style = []
127 | end
128 | object ColorDialog1: TColorDialog
129 | Left = 32
130 | end
131 | end
132 |
--------------------------------------------------------------------------------
/docs/classes:
--------------------------------------------------------------------------------
1 | TSelectEquation
2 | The component represents a menu and when choosing a formula element adds it in Equation: TQDSEquation.
3 |
4 | TQDSEquation.
5 | Component – equation editor. Includes the EditAreaList
6 |
7 | Properties
8 | ActiveEditArea: TEditArea
9 | Includes a link to an active TEditArea
10 | Data: String
11 | Includes an object tree in a text form. For example, the integral from 0 to infinity along xdx looks like:
12 | EditArea(IntLimitBottomTopOne(EditArea(Simple(x)Simple(d)Simple(x))EditArea(Simple(0))EditArea(ExtSymbol(8734))))
13 |
14 | Methods
15 | AddEditArea
16 | Adds EditArea to the position EditAreaIndex+1
17 | InsertEditArea
18 | Adds EditArea to the position EditAreaIndex
19 | DeleteEditArea
20 | Deletes EditArea with the Index
21 |
22 | TEditArea – Class-container that visually looks like a field for text insertion. It includes a cursor and a list of pointers to the exemplars of TEquation class descendants. The TEditArea class is the most functional, as it manages their coordinates and sizes depending on a specified font, and comprises the methods that allow adding any symbol and element in it. Any element is placed at the position pointed out in EquationIndex, i.e. current cursor position.
23 | Methods:
24 | AddEqSimple(Ch: Char); Add ANSI symbol. Ch is a symbol.
25 |
26 | AddEqExtSymbol(SymbolCode: Integer);
27 | Add Unicode symbol.
28 | SymbolCode is a symbol code.
29 |
30 | AddEqBrackets(kb: TKindBracket);
31 | Add element “Brackets”.
32 | kb is a brackets type.
33 |
34 | AddEqIndex(go: TGroupOptions);
35 | Add element “Index”
36 | go is indexes options.
37 |
38 | AddEqSumma(go: TGroupOptions);
39 | Add element “Sum”
40 | go is indexes options.
41 |
42 | AddEqIntegral(go: TGroupOptions; Size: Integer; Ring: Boolean);
43 | Add element “Integral”
44 | go is indexes options, Size[1..3] – is an integral order, Ring – to draw a circumference.
45 | AddEqMultiply(go: TGroupOptions);
46 | Add element “Product”
47 | go is indexes options.
48 |
49 | AddEqCoMult(go: TGroupOptions);
50 | Add element “Coproduct”
51 | go is indexes options.
52 |
53 | AddEqIntersection(go: TGroupOptions);
54 | Add element “Intersection”
55 | go is indexes options.
56 |
57 | AddEqJoin (go: TGroupOptions);
58 | Add element “Integrating”
59 | go is indexes options.
60 |
61 | AddEqVector(ka: TKindArrow; ae: TAlignEA);
62 | Add element “Vector”
63 | ka is arrow options, ae is a position of a text field.
64 |
65 | AddEqArrow(ka: TKindArrow; ae: TAlignEA);
66 | Add element “Arrow”
67 | ka is arrow options, ae is a position of a text field.
68 |
69 | AddEqMatrix(km: TKindMatrix; CountEA: Integer);
70 | Add element “Matrix”
71 | km is a matrix type, CountEA is quantity of elements
72 |
73 |
74 | Additional types and sets
75 |
76 | TKindBracket = (kbRound, kbSquare, kbFigure, kbCorner, kbModule, kbDModule)
77 | Brackets type.
78 | kbRound - Round
79 | kbSquare - Square
80 | kbFigure - Figure
81 | kbCorner - Corner
82 | kbModule - Modular
83 | kbDModule – Double module
84 |
85 | TGroupOptions = (goIndexTop, goIndexBottom, goLimitTop, goLimitBottom)
86 | Indexes options
87 | goIndexTop – Index at the top
88 | goIndexBottom – Index in the bottom
89 | goLimitTop – Limit at the top
90 | goLimitBottom – Limit in the bottom
91 |
92 | TKindArrow = set of (kaRight, kaLeft, kaDouble);
93 | Arrow options
94 | kaRight – Arrow to the left
95 | kaLeft – Arrow to the right
96 | kaDouble – Double arrow
97 |
98 | TAlignEA = (aeTop, aeBottom);
99 | Position of a text field
100 | aeTop – At the top
101 | aeBottom – In the bottom
102 |
103 | TKindMatrix = (kmHoriz, kmVert, kmSquare);
104 | Matrix type
105 | kmHoriz - Horizontal
106 | kmVert - Vertical
107 | kmSquare - Square
108 |
--------------------------------------------------------------------------------
/demo/QDSEqDemo2007.dproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | {49e1f505-bce9-4252-8c09-329a6b6c5239}
4 | QDSEqDemo.dpr
5 | Debug
6 | AnyCPU
7 | DCC32
8 | QDSEqDemo.exe
9 |
10 |
11 | 7.0
12 | False
13 | False
14 | 0
15 | RELEASE
16 |
17 |
18 | 7.0
19 | DEBUG
20 |
21 |
22 | Delphi.Personality
23 | VCLApplication
24 |
25 |
26 | False
27 | True
28 | False
29 |
30 |
31 | C:\Program Files\Borland\Delphi7\Bin\
32 |
33 |
34 | True
35 | False
36 | 0
37 | 5
38 | 0
39 | 0
40 | False
41 | False
42 | False
43 | False
44 | False
45 | 1049
46 | 1251
47 |
48 |
49 |
50 |
51 | 0.5.0.0
52 |
53 |
54 |
55 |
56 |
57 | 1.0.0.0
58 |
59 |
60 |
61 | QDSEqDemo.dpr
62 |
63 |
64 |
65 |
66 |
67 |
68 | MainSource
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
--------------------------------------------------------------------------------
/package/QDSEquationsD7.dof:
--------------------------------------------------------------------------------
1 | [FileVersion]
2 | Version=7.0
3 | [Compiler]
4 | A=8
5 | B=0
6 | C=1
7 | D=1
8 | E=0
9 | F=0
10 | G=1
11 | H=1
12 | I=1
13 | J=0
14 | K=0
15 | L=1
16 | M=0
17 | N=1
18 | O=1
19 | P=1
20 | Q=0
21 | R=0
22 | S=0
23 | T=0
24 | U=0
25 | V=1
26 | W=0
27 | X=1
28 | Y=1
29 | Z=1
30 | ShowHints=1
31 | ShowWarnings=1
32 | UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
33 | NamespacePrefix=
34 | SymbolDeprecated=1
35 | SymbolLibrary=1
36 | SymbolPlatform=1
37 | UnitLibrary=1
38 | UnitPlatform=1
39 | UnitDeprecated=1
40 | HResultCompat=1
41 | HidingMember=1
42 | HiddenVirtual=1
43 | Garbage=1
44 | BoundsError=1
45 | ZeroNilCompat=1
46 | StringConstTruncated=1
47 | ForLoopVarVarPar=1
48 | TypedConstVarPar=1
49 | AsgToTypedConst=1
50 | CaseLabelRange=1
51 | ForVariable=1
52 | ConstructingAbstract=1
53 | ComparisonFalse=1
54 | ComparisonTrue=1
55 | ComparingSignedUnsigned=1
56 | CombiningSignedUnsigned=1
57 | UnsupportedConstruct=1
58 | FileOpen=1
59 | FileOpenUnitSrc=1
60 | BadGlobalSymbol=1
61 | DuplicateConstructorDestructor=1
62 | InvalidDirective=1
63 | PackageNoLink=1
64 | PackageThreadVar=1
65 | ImplicitImport=1
66 | HPPEMITIgnored=1
67 | NoRetVal=1
68 | UseBeforeDef=1
69 | ForLoopVarUndef=1
70 | UnitNameMismatch=1
71 | NoCFGFileFound=1
72 | MessageDirective=1
73 | ImplicitVariants=1
74 | UnicodeToLocale=1
75 | LocaleToUnicode=1
76 | ImagebaseMultiple=1
77 | SuspiciousTypecast=1
78 | PrivatePropAccessor=1
79 | UnsafeType=0
80 | UnsafeCode=0
81 | UnsafeCast=0
82 | [Linker]
83 | MapFile=0
84 | OutputObjs=0
85 | ConsoleApp=1
86 | DebugInfo=0
87 | RemoteSymbols=0
88 | MinStackSize=16384
89 | MaxStackSize=1048576
90 | ImageBase=4194304
91 | ExeDescription=QDS Equations
92 | [Directories]
93 | OutputDir=
94 | UnitOutputDir=Delphi7\
95 | PackageDLLOutputDir=Delphi7\
96 | PackageDCPOutputDir=Delphi7\
97 | SearchPath=Delphi7\;D:\Prog_Lazarus\git\QDSEquations\source;D:\Prog_Lazarus\git\QDSEquations\resources
98 | Packages=vcl;rtl;vclx;indy;inet;xmlrtl;vclie;inetdbbde;inetdbxpress;dbrtl;dsnap;dsnapcon;vcldb;soaprtl;VclSmp;dbexpress;dbxcds;inetdb;bdertl;vcldbx;webdsnap;websnap;adortl;ibxpress;teeui;teedb;tee;dss;visualclx;visualdbclx;vclactnband;vclshlctrls;IntrawebDB_50_70;Intraweb_50_70;Rave50CLX;Rave50VCL;dclOfficeXP;CoolTrayIcon_D5;vclAbsDBd7;QDSEquationsD7
99 | Conditionals=
100 | DebugSourceDirs=
101 | UsePackages=0
102 | [Parameters]
103 | RunParams=
104 | HostApplication=
105 | Launcher=
106 | UseLauncher=0
107 | DebugCWD=
108 | [Language]
109 | ActiveLang=
110 | ProjectLang=
111 | RootDir=C:\Program Files\Borland\Delphi7\Bin\
112 | [Version Info]
113 | IncludeVerInfo=1
114 | AutoIncBuild=0
115 | MajorVer=1
116 | MinorVer=0
117 | Release=0
118 | Build=0
119 | Debug=0
120 | PreRelease=0
121 | Special=0
122 | Private=0
123 | DLL=0
124 | Locale=1049
125 | CodePage=1251
126 | [Version Info Keys]
127 | CompanyName=Qds
128 | FileDescription=Qds Equations
129 | FileVersion=1.0.0.0
130 | InternalName=Equations
131 | LegalCopyright=Qds
132 | LegalTrademarks=Qds
133 | OriginalFilename=QdsEquations
134 | ProductName=Qds Equations
135 | ProductVersion=1.0.0.0
136 | Comments=Qds Equations
137 | [HistoryLists\hlUnitAliases]
138 | Count=1
139 | Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
140 | [HistoryLists\hlSearchPath]
141 | Count=4
142 | Item0=Delphi7\;D:\Prog_Lazarus\git\QDSEquations\source;D:\Prog_Lazarus\git\QDSEquations\resources
143 | Item1=Delphi7\;D:\Prog_Lazarus\git\QDSEquations\source
144 | Item2=Delphi7\
145 | Item3=..\package\Delphi7\
146 | [HistoryLists\hlUnitOutputDirectory]
147 | Count=2
148 | Item0=Delphi7\
149 | Item1=..\package\Delphi7\
150 | [HistoryLists\hlBPLOutput]
151 | Count=2
152 | Item0=Delphi7\
153 | Item1=..\package\Delphi7\
154 | [HistoryLists\hlDCPOutput]
155 | Count=2
156 | Item0=Delphi7\
157 | Item1=..\package\Delphi7\
158 |
--------------------------------------------------------------------------------
/demo/main.lfm:
--------------------------------------------------------------------------------
1 | object frmMain: TfrmMain
2 | Left = 317
3 | Height = 437
4 | Top = 151
5 | Width = 874
6 | Caption = 'QDS Eqations'
7 | ClientHeight = 437
8 | ClientWidth = 874
9 | Color = clBtnFace
10 | Font.Color = clWindowText
11 | Font.Height = -11
12 | Font.Name = 'MS Sans Serif'
13 | OnCreate = FormCreate
14 | LCLVersion = '2.1.0.0'
15 | object Panel1: TPanel
16 | Left = 0
17 | Height = 121
18 | Top = 316
19 | Width = 874
20 | Align = alBottom
21 | ClientHeight = 121
22 | ClientWidth = 874
23 | Font.Color = clWindowText
24 | ParentFont = False
25 | TabOrder = 0
26 | object Label1: TLabel
27 | Left = 8
28 | Height = 15
29 | Top = 18
30 | Width = 24
31 | Anchors = [akLeft, akBottom]
32 | Caption = 'Data'
33 | ParentColor = False
34 | end
35 | object Label2: TLabel
36 | Left = 549
37 | Height = 15
38 | Top = -1
39 | Width = 52
40 | Anchors = [akRight, akBottom]
41 | Caption = 'Language'
42 | ParentColor = False
43 | end
44 | object Memo1: TMemo
45 | Left = 1
46 | Height = 80
47 | Top = 40
48 | Width = 872
49 | Align = alBottom
50 | OnChange = Memo1Change
51 | TabOrder = 0
52 | WantReturns = False
53 | end
54 | object ComboBox1: TComboBox
55 | Left = 545
56 | Height = 23
57 | Top = 15
58 | Width = 127
59 | Anchors = [akRight, akBottom]
60 | Font.Color = clWindowText
61 | ItemHeight = 15
62 | ItemIndex = 0
63 | Items.Strings = (
64 | 'Russian'
65 | 'Deutsche'
66 | 'English'
67 | )
68 | OnChange = ComboBox1Change
69 | ParentFont = False
70 | Style = csDropDownList
71 | TabOrder = 1
72 | Text = 'Russian'
73 | end
74 | object Button1: TButton
75 | Left = 692
76 | Height = 25
77 | Top = 13
78 | Width = 75
79 | Anchors = [akRight, akBottom]
80 | Caption = 'Font..'
81 | OnClick = Button1Click
82 | TabOrder = 2
83 | end
84 | object Button2: TButton
85 | Left = 791
86 | Height = 25
87 | Top = 13
88 | Width = 75
89 | Anchors = [akRight, akBottom]
90 | Caption = 'BkColor..'
91 | OnClick = Button2Click
92 | TabOrder = 3
93 | end
94 | end
95 | object SelectEquation1: TSelectEquation
96 | Left = 0
97 | Height = 121
98 | Top = 0
99 | Width = 874
100 | Align = alTop
101 | Equation = QDSEquation1
102 | Language = lRussian
103 | end
104 | object QDSEquation1: TQDSEquation
105 | Left = 0
106 | Height = 195
107 | Top = 121
108 | Width = 874
109 | Align = alClient
110 | BkColor = clWhite
111 | Data = 'EditArea()'
112 | Font.CharSet = ANSI_CHARSET
113 | Font.Color = clBlack
114 | OnChange = QDSEquation1Change
115 | end
116 | object FontDialog1: TFontDialog
117 | Font.Color = clWindowText
118 | Font.Height = -11
119 | Font.Name = 'MS Sans Serif'
120 | MinFontSize = 0
121 | MaxFontSize = 0
122 | Left = 712
123 | Top = 248
124 | end
125 | object ColorDialog1: TColorDialog
126 | Color = clBlack
127 | CustomColors.Strings = (
128 | 'ColorA=000000'
129 | 'ColorB=000080'
130 | 'ColorC=008000'
131 | 'ColorD=008080'
132 | 'ColorE=800000'
133 | 'ColorF=800080'
134 | 'ColorG=808000'
135 | 'ColorH=808080'
136 | 'ColorI=C0C0C0'
137 | 'ColorJ=0000FF'
138 | 'ColorK=00FF00'
139 | 'ColorL=00FFFF'
140 | 'ColorM=FF0000'
141 | 'ColorN=FF00FF'
142 | 'ColorO=FFFF00'
143 | 'ColorP=FFFFFF'
144 | 'ColorQ=C0DCC0'
145 | 'ColorR=F0CAA6'
146 | 'ColorS=F0FBFF'
147 | 'ColorT=A4A0A0'
148 | )
149 | Left = 808
150 | Top = 248
151 | end
152 | end
153 |
--------------------------------------------------------------------------------
/package/QDSEquationsD2007.dproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {1a3c4c68-a18c-42f3-826a-c209e87041cd}
5 | QDSEquationsD2007.dpk
6 | Release
7 | AnyCPU
8 | DCC32
9 | Delphi2007\QDSEquationsD2007.bpl
10 |
11 |
12 | 7.0
13 | False
14 | False
15 | 0
16 | Delphi2007\
17 | Delphi2007\
18 | Delphi2007\
19 | Delphi2007\
20 | Delphi2007\
21 | Delphi2007\
22 | Delphi2007\
23 | Delphi2007\
24 | Delphi2007\
25 | RELEASE
26 |
27 |
28 | 7.0
29 | Delphi2007\
30 | Delphi2007\
31 | Delphi2007\
32 | Delphi2007\
33 | Delphi2007\
34 | Delphi2007\
35 | Delphi2007\
36 | Delphi2007\
37 | Delphi2007\
38 |
39 |
40 | Delphi.Personality
41 | Package
42 |
43 | FalseTrueFalseQDS EquationsFalseFalseFalseC:\Program Files\Borland\Delphi7\Bin\TrueFalse1000FalseFalseFalseFalseFalse10491251QdsQds Equations1.0.0.0EquationsQdsQdsQdsEquationsQds Equations1.0.0.0Qds EquationsQDSEquationsD2007.dpk
44 |
45 |
46 |
47 |
48 | MainSource
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/demo/QDSEqDemo2009.dproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | {B2D7023A-4BC0-4AEB-9F9C-A0907E5E7B4C}
4 | QDSEqDemo.dpr
5 | Debug
6 | DCC32
7 | 12.0
8 |
9 |
10 | true
11 |
12 |
13 | true
14 | Base
15 | true
16 |
17 |
18 | true
19 | Base
20 | true
21 |
22 |
23 | QDSEqDemo.exe
24 | vcl;rtl;vclx;vclactnband;xmlrtl;dbrtl;vcldb;vcldbx;bdertl;dsnap;dsnapcon;TeeUI;TeeDB;Tee;adortl;vclib;ibxpress;IndyCore;IndySystem;IndyProtocols;inet;intrawebdb_100_120;Intraweb_100_120;VclSmp;vclie;websnap;webdsnap;inetdbbde;inetdbxpress;soaprtl;vclribbon;dbexpress;DbxCommonDriver;DataSnapIndy10ServerTransport;DataSnapProviderClient;DataSnapServer;DbxClientDriver;DBXInterBaseDriver;DBXMySQLDriver;dbxcds;DBXSybaseASEDriver;DBXSybaseASADriver;DBXOracleDriver;DBXMSSQLDriver;DBXInformixDriver;DBXDb2Driver;QDSEquationsD2009
25 | 00400000
26 | x86
27 |
28 |
29 | false
30 | RELEASE;$(DCC_Define)
31 | 0
32 | false
33 |
34 |
35 | DEBUG;$(DCC_Define)
36 |
37 |
38 |
39 | MainSource
40 |
41 |
42 |
43 |
44 |
45 |
46 | Base
47 |
48 |
49 | Cfg_2
50 | Base
51 |
52 |
53 | Cfg_1
54 | Base
55 |
56 |
57 |
58 |
59 | Delphi.Personality.12
60 | VCLApplication
61 |
62 |
63 |
64 | QDSEqDemo.dpr
65 |
66 |
67 | False
68 | True
69 | False
70 |
71 |
72 | True
73 | False
74 | 0
75 | 5
76 | 0
77 | 0
78 | False
79 | False
80 | False
81 | False
82 | False
83 | 1049
84 | 1251
85 |
86 |
87 |
88 |
89 | 0.5.0.0
90 |
91 |
92 |
93 |
94 |
95 | 1.0.0.0
96 |
97 |
98 |
99 |
100 | 12
101 |
102 |
103 |
--------------------------------------------------------------------------------
/package/QDSEquationsD2009.dproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | {F03092BA-4D87-446A-A9A3-241E158C9C1F}
4 | QDSEquationsD2009.dpk
5 | 12.0
6 | Debug
7 | DCC32
8 |
9 |
10 | true
11 |
12 |
13 | true
14 | Base
15 | true
16 |
17 |
18 | true
19 | Base
20 | true
21 |
22 |
23 | Delphi2009\;$(DCC_UnitSearchPath)
24 | QDS Equations
25 | Delphi2009\
26 | false
27 | Delphi2009\
28 | Delphi2009\
29 | Delphi2009\
30 | true
31 | 00400000
32 | 1
33 | true
34 | WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;$(DCC_UnitAlias)
35 | x86
36 | Delphi2009\QDSEquationsD2009.bpl
37 | false
38 | false
39 | true
40 | false
41 | false
42 | false
43 |
44 |
45 | Delphi2009\
46 | false
47 | RELEASE;$(DCC_Define)
48 | 0
49 | false
50 |
51 |
52 | DEBUG;$(DCC_Define)
53 |
54 |
55 |
56 | MainSource
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 | Base
67 |
68 |
69 | Cfg_2
70 | Base
71 |
72 |
73 | Cfg_1
74 | Base
75 |
76 |
77 |
78 |
79 | Delphi.Personality.12
80 | Package
81 |
82 |
83 |
84 | False
85 | True
86 | False
87 |
88 |
89 | True
90 | False
91 | 1
92 | 0
93 | 0
94 | 0
95 | False
96 | False
97 | False
98 | False
99 | False
100 | 1049
101 | 1251
102 |
103 |
104 | Qds
105 | Qds Equations
106 | 1.0.0.0
107 | Equations
108 | Qds
109 | Qds
110 | QdsEquations
111 | Qds Equations
112 | 1.0.0.0
113 | Qds Equations
114 |
115 |
116 | QDSEquationsD2009.dpk
117 |
118 |
119 |
120 | 12
121 |
122 |
123 |
--------------------------------------------------------------------------------
/source/SelectEquation.pas:
--------------------------------------------------------------------------------
1 | unit SelectEquation;
2 |
3 | {$IFDEF FPC}
4 | {$MODE Delphi}
5 | {$ENDIF}
6 |
7 | interface
8 |
9 | uses
10 | {$IFDEF FPC}
11 | LCLVersion,
12 | {$IFEND}
13 | SysUtils, Classes, Controls, ExtCtrls, ComCtrls, Contnrs, ImgList, Dialogs,
14 | Graphics, StdCtrls, Equations, UsefulUtils;
15 |
16 | type
17 | TLanguage = (lEnglish, lRussian, lDeutsche);
18 | TEqData = record
19 | Count: Integer;
20 | Height: Integer;
21 | Width: Integer;
22 | Visible: String;
23 | DescrList: array of String;
24 | end;
25 |
26 | TImageLists = class(TObjectList)
27 | private
28 | function GetItem(Index: Integer): TImageList;
29 | procedure SetItem(Index: Integer; AImageList: TImageList);
30 | public
31 | property Items[Index: Integer]: TImageList read GetItem write SetItem;
32 | end;
33 |
34 | TSelectEquation = class(TCustomPanel)
35 | private
36 | { Private declarations }
37 | FEqDataList: array of TEqData;
38 | FImageLists: TImageLists;
39 | FLabel: TLabel;
40 | FPageControl: TPageControl;
41 | FToolBar: TToolBar;
42 | FQDSEquation: TQDSEquation;
43 | FLanguage: TLanguage;
44 | procedure BtMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
45 | procedure BtPanelClick(Sender: TObject);
46 | procedure BtTabSheetClick(Sender: TObject);
47 | procedure CreateDescript;
48 | procedure CreateImageLists;
49 | procedure CreateLabel;
50 | procedure CreatePageControl;
51 | procedure CreateToolBar(AParent: TWinControl; Index: Integer);
52 | procedure SetQDSEquation(AQDSEquation: TQDSEquation);
53 | procedure SetLanguage(const Value: TLanguage);
54 | protected
55 | { Protected declarations }
56 | public
57 | { Public declarations }
58 | constructor Create(AOwner: TComponent); override;
59 | destructor Destroy; override;
60 | procedure CreateWnd; override;
61 | published
62 | { Published declarations }
63 | property Align;
64 | property Anchors;
65 | property AutoSize;
66 | property BevelInner;
67 | property BevelOuter;
68 | property BevelWidth;
69 | property Constraints;
70 | {$IFNDEF FPC}
71 | property Ctl3D;
72 | {$ENDIF}
73 | property Enabled;
74 | property Equation: TQDSEquation read FQDSEquation write SetQDSEquation;
75 | property Language: TLanguage read FLanguage write SetLanguage;
76 | property PopupMenu;
77 | property Visible;
78 | property OnClick;
79 | property OnDblClick;
80 | property OnEnter;
81 | property OnExit;
82 | property OnMouseDown;
83 | property OnMouseMove;
84 | property OnMouseUp;
85 | property OnResize;
86 | end;
87 |
88 | procedure Register;
89 |
90 | implementation
91 |
92 | {$IFDEF FPC}
93 | {$R ../resources/images.res}
94 | {$R ../resources/localize.res}
95 | {$ELSE}
96 | {$R images.res}
97 | {$R localize.res}
98 | {$ENDIF}
99 |
100 | procedure Register;
101 | begin
102 | RegisterComponents('QDS Equations', [TSelectEquation]);
103 | end;
104 |
105 | { TImageLists }
106 |
107 | function TImageLists.GetItem(Index: Integer): TImageList;
108 | begin
109 | Result := TImageList(inherited Items[Index]);
110 | end;
111 |
112 | procedure TImageLists.SetItem(Index: Integer; AImageList: TImageList);
113 | begin
114 | inherited Items[Index] := AImageList;
115 | end;
116 |
117 | { TSelectEquaion }
118 |
119 | procedure TSelectEquation.BtMouseMove(Sender: TObject; Shift: TShiftState; X,
120 | Y: Integer);
121 | var
122 | AToolButton: TToolButton;
123 | begin
124 | AToolButton:=(Sender as TToolButton);
125 | if AToolButton.Parent=FToolBar then begin
126 | AToolButton.Hint:={Format('0 %d %s',[AToolButton.Tag, }FEqDataList[0].DescrList[AToolButton.Tag]{])};
127 | end else begin
128 | AToolButton.Hint:={Format('%d %d %s',[AToolButton.Tag, AToolButton.ImageIndex, }FEqDataList[AToolButton.Tag].DescrList[AToolButton.ImageIndex]{])};
129 | end;
130 |
131 | FLabel.Caption:=AToolButton.Hint;
132 | end;
133 |
134 | procedure TSelectEquation.BtPanelClick(Sender: TObject);
135 | var
136 | AToolButton: TToolButton;
137 | begin
138 | FToolBar.Buttons[FPageControl.ActivePageIndex].Down:=False;
139 | AToolButton:=(Sender as TToolButton);
140 | FPageControl.ActivePageIndex := AToolButton.Tag;
141 | AToolButton.Down:=True;
142 | end;
143 |
144 | procedure TSelectEquation.BtTabSheetClick(Sender: TObject);
145 | var
146 | AToolButton: TToolButton;
147 | begin
148 | AToolButton:=(Sender as TToolButton);
149 | if Assigned(FQDSEquation) then begin
150 | case AToolButton.Tag of
151 | 1:
152 | case AToolButton.ImageIndex of
153 | 0: FQDSEquation.ActiveEditArea.AddEqExtSymbol(8804);
154 | 1: FQDSEquation.ActiveEditArea.AddEqExtSymbol(8805);
155 | 6: FQDSEquation.ActiveEditArea.AddEqExtSymbol(8800);
156 | 7: FQDSEquation.ActiveEditArea.AddEqExtSymbol(8801);
157 | 8: FQDSEquation.ActiveEditArea.AddEqExtSymbol(8776);
158 | end;
159 | 2:
160 | case AToolButton.ImageIndex of
161 | 2: FQDSEquation.ActiveEditArea.AddEqExtSymbol(160);
162 | 6: FQDSEquation.ActiveEditArea.AddEqExtSymbol(8230);
163 | end;
164 | 4:
165 | case AToolButton.ImageIndex of
166 | 0: FQDSEquation.ActiveEditArea.AddEqExtSymbol(177);
167 | 2: FQDSEquation.ActiveEditArea.AddEqExtSymbol(215);
168 | 3: FQDSEquation.ActiveEditArea.AddEqExtSymbol(247);
169 | 4: FQDSEquation.ActiveEditArea.AddEqExtSymbol(42);
170 | 5: FQDSEquation.ActiveEditArea.AddEqExtSymbol(8729);
171 | 6: FQDSEquation.ActiveEditArea.AddEqExtSymbol(9675);//9702
172 | 7: FQDSEquation.ActiveEditArea.AddEqExtSymbol(9679);
173 | 10: FQDSEquation.ActiveEditArea.AddEqExtSymbol(8249);
174 | 11: FQDSEquation.ActiveEditArea.AddEqExtSymbol(8250);
175 |
176 | end;
177 | 5:
178 | case AToolButton.ImageIndex of
179 | 0: FQDSEquation.ActiveEditArea.AddEqExtSymbol(8594);
180 | 1: FQDSEquation.ActiveEditArea.AddEqExtSymbol(8592);
181 | 2: FQDSEquation.ActiveEditArea.AddEqExtSymbol(8596);
182 | 3: FQDSEquation.ActiveEditArea.AddEqExtSymbol(8593);
183 | 4: FQDSEquation.ActiveEditArea.AddEqExtSymbol(8595);
184 | 5: FQDSEquation.ActiveEditArea.AddEqExtSymbol(8597);
185 | end;
186 | 6:
187 | case AToolButton.ImageIndex of
188 | 5: FQDSEquation.ActiveEditArea.AddEqExtSymbol(9488);
189 | end;
190 | 7:
191 | case AToolButton.ImageIndex of
192 | 3: FQDSEquation.ActiveEditArea.AddEqExtSymbol(8745);
193 | end;
194 |
195 | 8:
196 | case AToolButton.ImageIndex of
197 | 0: FQDSEquation.ActiveEditArea.AddEqExtSymbol(8706);
198 | 2: FQDSEquation.ActiveEditArea.AddEqExtSymbol(8734);
199 | 7: FQDSEquation.ActiveEditArea.AddEqExtSymbol(9524);
200 | 8: FQDSEquation.ActiveEditArea.AddEqExtSymbol(9674);
201 | 9: FQDSEquation.ActiveEditArea.AddEqExtSymbol(8467);
202 | 11: FQDSEquation.ActiveEditArea.AddEqExtSymbol(176);
203 | 12: FQDSEquation.ActiveEditArea.AddEqExtSymbol(295);
204 | 14: FQDSEquation.ActiveEditArea.AddEqExtSymbol(8747);
205 | 15: FQDSEquation.ActiveEditArea.AddEqExtSymbol(8721);//931
206 | 16: FQDSEquation.ActiveEditArea.AddEqExtSymbol(8719);
207 | end;
208 | 9:
209 | case AToolButton.ImageIndex of
210 | 0: FQDSEquation.ActiveEditArea.AddEqExtSymbol(945);
211 | 1: FQDSEquation.ActiveEditArea.AddEqExtSymbol(946);
212 | 2: FQDSEquation.ActiveEditArea.AddEqExtSymbol(967);
213 | 3: FQDSEquation.ActiveEditArea.AddEqExtSymbol(948);
214 | 4: FQDSEquation.ActiveEditArea.AddEqExtSymbol(949);
215 | 5: FQDSEquation.ActiveEditArea.AddEqExtSymbol(966);//
216 | 6: FQDSEquation.ActiveEditArea.AddEqExtSymbol(966);
217 | 7: FQDSEquation.ActiveEditArea.AddEqExtSymbol(947);
218 | 8: FQDSEquation.ActiveEditArea.AddEqExtSymbol(951);
219 | 9: FQDSEquation.ActiveEditArea.AddEqExtSymbol(953);
220 | 10: FQDSEquation.ActiveEditArea.AddEqExtSymbol(954);
221 | 11: FQDSEquation.ActiveEditArea.AddEqExtSymbol(955);
222 | 12: FQDSEquation.ActiveEditArea.AddEqExtSymbol(956);
223 | 13: FQDSEquation.ActiveEditArea.AddEqExtSymbol(957);
224 | 14: FQDSEquation.ActiveEditArea.AddEqExtSymbol(959);
225 | 15: FQDSEquation.ActiveEditArea.AddEqExtSymbol(960);
226 | 16: FQDSEquation.ActiveEditArea.AddEqExtSymbol(969);//
227 | 17: FQDSEquation.ActiveEditArea.AddEqExtSymbol(952);
228 | 18: FQDSEquation.ActiveEditArea.AddEqExtSymbol(952);//
229 | 19: FQDSEquation.ActiveEditArea.AddEqExtSymbol(961);
230 | 20: FQDSEquation.ActiveEditArea.AddEqExtSymbol(963);
231 | 21: FQDSEquation.ActiveEditArea.AddEqExtSymbol(962);
232 | 22: FQDSEquation.ActiveEditArea.AddEqExtSymbol(964);
233 | 23: FQDSEquation.ActiveEditArea.AddEqExtSymbol(965);
234 | 24: FQDSEquation.ActiveEditArea.AddEqExtSymbol(969);
235 | 25: FQDSEquation.ActiveEditArea.AddEqExtSymbol(958);
236 | 26: FQDSEquation.ActiveEditArea.AddEqExtSymbol(968);
237 | 27: FQDSEquation.ActiveEditArea.AddEqExtSymbol(950);
238 | end;
239 | 10:
240 | case AToolButton.ImageIndex of
241 | 0: FQDSEquation.ActiveEditArea.AddEqExtSymbol(913);
242 | 1: FQDSEquation.ActiveEditArea.AddEqExtSymbol(914);
243 | 2: FQDSEquation.ActiveEditArea.AddEqExtSymbol(935);
244 | 3: FQDSEquation.ActiveEditArea.AddEqExtSymbol(916);
245 | 4: FQDSEquation.ActiveEditArea.AddEqExtSymbol(917);
246 | 5: FQDSEquation.ActiveEditArea.AddEqExtSymbol(934);
247 | 6: FQDSEquation.ActiveEditArea.AddEqExtSymbol(915);
248 | 7: FQDSEquation.ActiveEditArea.AddEqExtSymbol(919);
249 | 8: FQDSEquation.ActiveEditArea.AddEqExtSymbol(921);
250 | 9: FQDSEquation.ActiveEditArea.AddEqExtSymbol(922);
251 | 10: FQDSEquation.ActiveEditArea.AddEqExtSymbol(923);
252 | 11: FQDSEquation.ActiveEditArea.AddEqExtSymbol(924);
253 | 12: FQDSEquation.ActiveEditArea.AddEqExtSymbol(925);
254 | 13: FQDSEquation.ActiveEditArea.AddEqExtSymbol(927);
255 | 14: FQDSEquation.ActiveEditArea.AddEqExtSymbol(928);
256 | 15: FQDSEquation.ActiveEditArea.AddEqExtSymbol(920);
257 | 16: FQDSEquation.ActiveEditArea.AddEqExtSymbol(929);
258 | 17: FQDSEquation.ActiveEditArea.AddEqExtSymbol(931);
259 | 18: FQDSEquation.ActiveEditArea.AddEqExtSymbol(932);
260 | 19: FQDSEquation.ActiveEditArea.AddEqExtSymbol(933);
261 | 20: FQDSEquation.ActiveEditArea.AddEqExtSymbol(937);
262 | 21: FQDSEquation.ActiveEditArea.AddEqExtSymbol(926);
263 | 22: FQDSEquation.ActiveEditArea.AddEqExtSymbol(936);
264 | 23: FQDSEquation.ActiveEditArea.AddEqExtSymbol(918);
265 | end;
266 | 11:
267 | case AToolButton.ImageIndex of
268 | 0: FQDSEquation.ActiveEditArea.AddEqBrackets(kbRound);
269 | 1: FQDSEquation.ActiveEditArea.AddEqBrackets(kbSquare);
270 | 2: FQDSEquation.ActiveEditArea.AddEqBrackets(kbFigure);
271 | 3: FQDSEquation.ActiveEditArea.AddEqBrackets(kbCorner);
272 | 4: FQDSEquation.ActiveEditArea.AddEqBrackets(kbModule);
273 | 5: FQDSEquation.ActiveEditArea.AddEqBrackets(kbDModule);
274 | end;
275 | 12:
276 | case AToolButton.ImageIndex of
277 | 0: FQDSEquation.ActiveEditArea.AddEqDivision;
278 | 5: FQDSEquation.ActiveEditArea.AddEqSquare;
279 |
280 | end;
281 | 13:
282 | case AToolButton.ImageIndex of
283 | 0: FQDSEquation.ActiveEditArea.AddEqIndex([goIndexTop]);
284 | 1: FQDSEquation.ActiveEditArea.AddEqIndex([goIndexBottom]);
285 | 2: FQDSEquation.ActiveEditArea.AddEqIndex([goIndexTop, goIndexBottom]);
286 | end;
287 | 14:
288 | case AToolButton.ImageIndex of
289 | 0: FQDSEquation.ActiveEditArea.AddEqSumma([]);
290 | 1: FQDSEquation.ActiveEditArea.AddEqSumma([goLimitBottom]);
291 | 2: FQDSEquation.ActiveEditArea.AddEqSumma([goLimitTop, goLimitBottom]);
292 | 3: FQDSEquation.ActiveEditArea.AddEqSumma([goIndexBottom]);
293 | 4: FQDSEquation.ActiveEditArea.AddEqSumma([goIndexTop, goIndexBottom]);
294 | end;
295 | 15:
296 | case AToolButton.ImageIndex of
297 | 0: FQDSEquation.ActiveEditArea.AddEqIntegral([], 1, False);
298 | 1: FQDSEquation.ActiveEditArea.AddEqIntegral([goLimitTop, goLimitBottom], 1, False);
299 | 2: FQDSEquation.ActiveEditArea.AddEqIntegral([goIndexTop, goIndexBottom], 1, False);
300 | 3: FQDSEquation.ActiveEditArea.AddEqIntegral([], 1, False);
301 | 4: FQDSEquation.ActiveEditArea.AddEqIntegral([goLimitBottom], 1, False);
302 | 5: FQDSEquation.ActiveEditArea.AddEqIntegral([goIndexBottom], 1, False);
303 | 6: FQDSEquation.ActiveEditArea.AddEqIntegral([], 2, False);
304 | 7: FQDSEquation.ActiveEditArea.AddEqIntegral([goLimitBottom], 2, False);
305 | 8: FQDSEquation.ActiveEditArea.AddEqIntegral([goIndexBottom], 2, False);
306 | 9: FQDSEquation.ActiveEditArea.AddEqIntegral([], 3, False);
307 | 10: FQDSEquation.ActiveEditArea.AddEqIntegral([goLimitBottom], 3, False);
308 | 11: FQDSEquation.ActiveEditArea.AddEqIntegral([goIndexBottom], 3, False);
309 | 12: FQDSEquation.ActiveEditArea.AddEqIntegral([], 1, True);
310 | 13: FQDSEquation.ActiveEditArea.AddEqIntegral([goLimitBottom], 1, True);
311 | 14: FQDSEquation.ActiveEditArea.AddEqIntegral([goIndexBottom], 1, True);
312 | 15: FQDSEquation.ActiveEditArea.AddEqIntegral([], 2, True);
313 | 16: FQDSEquation.ActiveEditArea.AddEqIntegral([goLimitBottom], 2, True);
314 | 17: FQDSEquation.ActiveEditArea.AddEqIntegral([goIndexBottom], 2, True);
315 | 18: FQDSEquation.ActiveEditArea.AddEqIntegral([], 3, True);
316 | 19: FQDSEquation.ActiveEditArea.AddEqIntegral([goLimitBottom], 3, True);
317 | 20: FQDSEquation.ActiveEditArea.AddEqIntegral([goIndexBottom], 3, True);
318 | end;
319 | 16:
320 | case AToolButton.ImageIndex of
321 | 0: FQDSEquation.ActiveEditArea.AddEqVector([], aeBottom);
322 | 1: FQDSEquation.ActiveEditArea.AddEqVector([kaDouble], aeBottom);
323 | 2: FQDSEquation.ActiveEditArea.AddEqVector([], aeTop);
324 | 3: FQDSEquation.ActiveEditArea.AddEqVector([kaDouble], aeTop);
325 | 4: FQDSEquation.ActiveEditArea.AddEqVector([kaRight], aeBottom);
326 | 5: FQDSEquation.ActiveEditArea.AddEqVector([kaLeft], aeBottom);
327 | 6: FQDSEquation.ActiveEditArea.AddEqVector([kaRight, kaLeft], aeBottom);
328 | 7: FQDSEquation.ActiveEditArea.AddEqVector([kaRight], aeTop);
329 | 8: FQDSEquation.ActiveEditArea.AddEqVector([kaLeft], aeTop);
330 | 9: FQDSEquation.ActiveEditArea.AddEqVector([kaRight, kaLeft], aeTop);
331 | end;
332 | 17:
333 | case AToolButton.ImageIndex of
334 | 0: FQDSEquation.ActiveEditArea.AddEqArrow([kaRight], aeTop);
335 | 1: FQDSEquation.ActiveEditArea.AddEqArrow([kaLeft], aeTop);
336 | 2: FQDSEquation.ActiveEditArea.AddEqArrow([kaLeft, kaRight], aeTop);
337 | 3: FQDSEquation.ActiveEditArea.AddEqArrow([kaRight], aeBottom);
338 | 4: FQDSEquation.ActiveEditArea.AddEqArrow([kaLeft], aeBottom);
339 | 5: FQDSEquation.ActiveEditArea.AddEqArrow([kaLeft, kaRight], aeBottom);
340 | end;
341 | 18:
342 | case AToolButton.ImageIndex of
343 | 0: FQDSEquation.ActiveEditArea.AddEqMultiply([]);
344 | 1: FQDSEquation.ActiveEditArea.AddEqMultiply([goLimitBottom]);
345 | 2: FQDSEquation.ActiveEditArea.AddEqMultiply([goLimitTop, goLimitBottom]);
346 | 3: FQDSEquation.ActiveEditArea.AddEqMultiply([goIndexBottom]);
347 | 4: FQDSEquation.ActiveEditArea.AddEqMultiply([goIndexTop, goIndexBottom]);
348 | 5: FQDSEquation.ActiveEditArea.AddEqCoMult([]);
349 | 6: FQDSEquation.ActiveEditArea.AddEqCoMult([goLimitBottom]);
350 | 7: FQDSEquation.ActiveEditArea.AddEqCoMult([goLimitTop, goLimitBottom]);
351 | 8: FQDSEquation.ActiveEditArea.AddEqCoMult([goIndexBottom]);
352 | 9: FQDSEquation.ActiveEditArea.AddEqCoMult([goIndexTop, goIndexBottom]);
353 | 10: FQDSEquation.ActiveEditArea.AddEqIntersection([]);
354 | 11: FQDSEquation.ActiveEditArea.AddEqIntersection([goLimitBottom]);
355 | 12: FQDSEquation.ActiveEditArea.AddEqIntersection([goLimitTop, goLimitBottom]);
356 | 13: FQDSEquation.ActiveEditArea.AddEqIntersection([goIndexBottom]);
357 | 14: FQDSEquation.ActiveEditArea.AddEqIntersection([goIndexTop, goIndexBottom]);
358 | 15: FQDSEquation.ActiveEditArea.AddEqJoin([]);
359 | 16: FQDSEquation.ActiveEditArea.AddEqJoin([goLimitBottom]);
360 | 17: FQDSEquation.ActiveEditArea.AddEqJoin([goLimitTop, goLimitBottom]);
361 | 18: FQDSEquation.ActiveEditArea.AddEqJoin([goIndexBottom]);
362 | 19: FQDSEquation.ActiveEditArea.AddEqJoin([goIndexTop, goIndexBottom]);
363 | end;
364 | 19: {(kmHoriz, kmVert, kmSquare)}
365 | case AToolButton.ImageIndex of
366 | 0: FQDSEquation.ActiveEditArea.AddEqMatrix(kmHoriz, 2);
367 | 1: FQDSEquation.ActiveEditArea.AddEqMatrix(kmVert, 2);
368 | 2: FQDSEquation.ActiveEditArea.AddEqMatrix(kmSquare, 4);
369 | 3: FQDSEquation.ActiveEditArea.AddEqMatrix(kmHoriz, 3);
370 | 4: FQDSEquation.ActiveEditArea.AddEqMatrix(kmVert, 3);
371 | 5: FQDSEquation.ActiveEditArea.AddEqMatrix(kmSquare, 9);
372 | 6: FQDSEquation.ActiveEditArea.AddEqMatrix(kmHoriz, 4);
373 | 7: FQDSEquation.ActiveEditArea.AddEqMatrix(kmVert, 4);
374 | 8: FQDSEquation.ActiveEditArea.AddEqMatrix(kmSquare, 16);
375 | end;
376 | end;
377 | if FQDSEquation.Enabled then FQDSEquation.SetFocus;
378 | end;
379 | end;
380 |
381 | procedure TSelectEquation.CreateDescript;
382 | var
383 | i, j, LangID: Integer;
384 | function EqData(Count, Height, Width: Integer; AVisible: String): TEqData;
385 | begin
386 | Result.Count:=Count;
387 | Result.Height:=Height;
388 | Result.Width:=Width;
389 | Result.Visible:=AVisible;
390 | end;
391 | begin
392 | SetLength(FEqDataList, 20);
393 | FEqDataList[ 0]:=EqData(19,20,40,'1101111111111111111');
394 | FEqDataList[ 1]:=EqData(11,10,10,'11000011100');
395 | FEqDataList[ 2]:=EqData(11,15,15,'00100010000');
396 | FEqDataList[ 3]:=EqData(20,15,15,'00000000000000000000');
397 | FEqDataList[ 4]:=EqData(12,10,10,'101111110011');
398 | FEqDataList[ 5]:=EqData(14,15,15,'11111100000000');
399 | FEqDataList[ 6]:=EqData( 8,10,10,'00000100');
400 | FEqDataList[ 7]:=EqData(12,10,10,'000100000000');
401 | FEqDataList[ 8]:=EqData(18,10,10,'101000011101101111');
402 | FEqDataList[ 9]:=EqData(28,15,15,'1111111111111111111111111111');
403 | FEqDataList[10]:=EqData(24,10,10,'111111111111111111111111');
404 | FEqDataList[11]:=EqData(30,20,20,'111111000000000000000000000000');
405 | FEqDataList[12]:=EqData( 9,20,20,'100001000'{'101011100'});
406 | FEqDataList[13]:=EqData(15,20,20,'111000000000000');
407 | FEqDataList[14]:=EqData( 5,20,20,'11111');
408 | FEqDataList[15]:=EqData(21,20,20,'111111111111111111111');
409 | FEqDataList[16]:=EqData(10,15,15,'1111111111');
410 | FEqDataList[17]:=EqData( 6,15,15,'111111');
411 | FEqDataList[18]:=EqData(20,20,20,'11111111111111111111');
412 | FEqDataList[19]:=EqData(12,20,20,'111111111000');
413 | LangID:=1;
414 | case FLanguage of
415 | lEnglish: LangID:=3;
416 | lRussian: LangID:=1;
417 | lDeutsche: LangID:=2;
418 | end;
419 |
420 | for i:=0 to Length(FEqDataList)-1 do begin
421 | SetLength(FEqDataList[i].DescrList, FEqDataList[i].Count);
422 | for j:=0 to Length(FEqDataList[i].DescrList)-1 do
423 | FEqDataList[i].DescrList[j]:=GetString(Format('%d%s%s',[LangID,IntToStrZero(i,2),IntToStrZero(j,2)]));
424 | end;
425 | end;
426 |
427 | procedure TSelectEquation.CreateImageLists;
428 | var
429 | i: Integer;
430 | {$IFDEF FPC}
431 | bmp: TBitmap;
432 | {$ENDIF}
433 | begin
434 | FImageLists:=TImageLists.Create;
435 | for i:=0 to Length(FEqDataList)-1 do begin
436 | FImageLists.Insert(i, TImageList.Create(Self));
437 | FImageLists.Items[i].Width:=FEqDataList[i].Width;
438 | FImageLists.Items[i].Height:=FEqDataList[i].Height;
439 | {$IFDEF FPC}
440 | bmp := TBitmap.Create;
441 | bmp.Transparent := true;
442 | bmp.TransparentColor := clWhite;
443 | bmp.LoadFromResourceName(HINSTANCE, 'BT'+IntToStrZero(i, 2));
444 | FImageLists.Items[i].AddSliced(bmp, FEqDataList[i].Count, 1);
445 | bmp.Free;
446 | {$ELSE}
447 | FImageLists.Items[i].GetResource(rtBitmap,'BT'+IntToStrZero(i, 2),FImageLists.Items[i].Width,[lrTransparent],clWhite);
448 | {$ENDIF}
449 | end;
450 | end;
451 |
452 | procedure TSelectEquation.CreateLabel;
453 | begin
454 | FLabel:=TLabel.Create(Self);
455 | FLabel.Parent:=Self;
456 | FLabel.Align:=alTop;
457 | FLabel.Caption:='';
458 | FLabel.WordWrap:=True;
459 | end;
460 |
461 | procedure TSelectEquation.CreatePageControl;
462 | var
463 | TabSheet: TTabSheet;
464 | i: Integer;
465 | begin
466 | FPageControl:=TPageControl.Create(Self);
467 | FPageControl.Parent:=Self;
468 | FPageControl.Align:=alClient;
469 | {$IFDEF FPC}
470 | {$IF LCL_FullVersion >= 2010000}
471 | FPageControl.Style:=tsButtons;
472 | {$IFEND}
473 | {$ENDIF}
474 | for i:=1 to Length(FEqDataList)-1 do begin
475 | TabSheet:=TTabSheet.Create(FPageControl);
476 | TabSheet.Parent:=FPageControl;
477 | TabSheet.PageControl:=FPageControl;
478 | FPageControl.Pages[i-1].TabVisible := False;
479 | CreateToolBar(TabSheet, i);
480 | end;
481 | FPageControl.ActivePageIndex:=0;
482 | end;
483 |
484 | procedure TSelectEquation.CreateToolBar(AParent: TWinControl; Index: Integer);
485 | var
486 | ToolButton: TToolButton;
487 | i: Integer;
488 | begin
489 | FToolBar:=TToolBar.Create(Self);
490 | FToolBar.Parent:=AParent;
491 | FToolBar.AutoSize:=True;
492 | FToolBar.Flat:=True;
493 | FToolBar.ButtonHeight:=FEqDataList[Index].Height + 8;
494 | FToolBar.ButtonWidth:=FEqDataList[Index].Width;
495 | FToolBar.Images:=FImageLists.Items[Index];
496 | for i:=FEqDataList[Index].Count-1 downto 0 do begin
497 | ToolButton:=TToolButton.Create(FToolBar);
498 | ToolButton.Parent:=FToolBar;
499 | ToolButton.Hint:=FEqDataList[Index].DescrList[i];
500 | ToolButton.ShowHint:=True;
501 | ToolButton.ImageIndex:=i;
502 | ToolButton.OnMouseMove:=BtMouseMove;
503 | if AParent is TSelectEquation then begin
504 | ToolButton.Tag:=i;
505 | ToolButton.Enabled:=FPageControl.PageCount>i;
506 | ToolButton.OnClick:=BtPanelClick;
507 | end;
508 | if AParent is TTabSheet then begin
509 | ToolButton.Tag:=Index;
510 | ToolButton.Enabled:=True;
511 | ToolButton.OnClick:=BtTabSheetClick;
512 | end;
513 | ToolButton.AutoSize:=True;
514 | ToolButton.Visible:=FEqDataList[Index].Visible[i+1]='1';
515 |
516 | end;
517 | end;
518 |
519 | constructor TSelectEquation.Create(AOwner: TComponent);
520 | begin
521 | inherited;
522 | FLanguage:=lRussian;
523 | CreateDescript;
524 | CreateImageLists;
525 | end;
526 |
527 | destructor TSelectEquation.Destroy;
528 | begin
529 | FLabel.Free;
530 | FPageControl.Free;
531 | FImageLists.Free;
532 | inherited;
533 | end;
534 |
535 |
536 | procedure TSelectEquation.SetQDSEquation(AQDSEquation: TQDSEquation);
537 | begin
538 | FQDSEquation:=AQDSEquation;
539 | end;
540 |
541 | procedure TSelectEquation.CreateWnd;
542 | begin
543 | inherited CreateWnd;
544 | CreatePageControl;
545 | CreateLabel;
546 | CreateToolBar(Self, 0);
547 | //AutoSize:=True;
548 | FToolBar.Buttons[0].Click;
549 | end;
550 |
551 |
552 | procedure TSelectEquation.SetLanguage(const Value: TLanguage);
553 | begin
554 | FLanguage := Value;
555 | CreateDescript;
556 | end;
557 |
558 | end.
559 |
--------------------------------------------------------------------------------
/source/Equations.pas:
--------------------------------------------------------------------------------
1 | //{$Define DEMO}
2 | unit Equations;
3 |
4 | {$IFDEF FPC}
5 | {$MODE Delphi}
6 | {$ENDIF}
7 |
8 | interface
9 |
10 | uses
11 | SysUtils, Windows, Messages, Classes, Graphics, Controls, ExtCtrls, Forms,
12 | Dialogs, Contnrs, UsefulUtils, Math;
13 |
14 | type
15 | TKindBracket=(kbRound, kbSquare, kbFigure, kbCorner, kbModule, kbDModule);
16 | TKindArrow = set of (kaRight, kaLeft, kaDouble);
17 | TAlignEA = (aeTop, aeBottom);
18 | TGroupOptions = set of (goLimitTop, goLimitBottom, goIndexTop, goIndexBottom);
19 | TKindMatrix = (kmHoriz, kmVert, kmSquare);
20 |
21 | TExpression = record
22 | ClassName: string;
23 | ExprData: string;
24 | end;
25 |
26 | TExprArray = array of TExpression;
27 | TEditArea = class;
28 | TEquation = class;
29 | TEditAreaList = class(TObjectList)
30 | private
31 | function GetItem(Index: Integer): TEditArea;
32 | procedure SetItem(Index: Integer; AValue: TEditArea);
33 | public
34 | property Items[Index: Integer]: TEditArea read GetItem write SetItem;
35 | end;
36 |
37 | TEquationList = class(TStringList)
38 | private
39 | function GetItem(Index: Integer): TEquation;
40 | procedure PutItem(Index: Integer; AValue: TEquation);
41 | public
42 | property Items[Index: Integer]: TEquation read GetItem write PutItem;
43 | end;
44 |
45 | TQDSGraphic = class(TCustomControl)
46 | private
47 | FBkColor: TColor;
48 | procedure SetBkColor(AValue: TColor); virtual;
49 | protected
50 | function GetExprData(const ExprData: String): TExprArray;
51 | procedure RefreshDimensions; virtual; abstract;
52 | property BkColor: TColor read FBkColor write SetBkColor;
53 | property Canvas;
54 | property Font;
55 | public
56 | constructor Create(AOwner: TComponent); override;
57 | end;
58 |
59 | TEquatStore = class(TQDSGraphic)
60 | private
61 | FEditAreaIndex: Integer;
62 | FEditAreaList: TEditAreaList;
63 | FLevel: Integer;
64 | FUpdateCount: Integer;
65 | Kp: Double;
66 | procedure SetEditAreaIndex(AValue: Integer);
67 | procedure SetEditAreaList(AValue: TEditAreaList);
68 | procedure SetUpdateState(Updating: Boolean); virtual; abstract;
69 | protected
70 | procedure EditAreaDown; dynamic;
71 | procedure EditAreaUp; dynamic;
72 | procedure RefreshEditArea(AEditAreaIndex: Integer = 0); dynamic;
73 | property EditAreaIndex: Integer read FEditAreaIndex write SetEditAreaIndex;
74 | property Level: Integer read FLevel write FLevel;
75 | property UpdateCount: Integer read FUpdateCount;
76 | public
77 | procedure BeginUpdate;
78 | procedure DeleteEditArea; dynamic;
79 | procedure EndUpdate;
80 | procedure InsertEditArea; dynamic;
81 | property EditAreaList: TEditAreaList read FEditAreaList write
82 | SetEditAreaList;
83 | end;
84 |
85 | TQDSEquation = class(TEquatStore)
86 | private
87 | FActiveEditArea: TEditArea;
88 | FOnChange: TNotifyEvent;
89 | FVersion: String;
90 | function GetData: string;
91 | procedure SetBkColor(AValue: TColor); override;
92 | procedure SetData(const AValue: string);
93 | procedure SetUpdateState(Updating: Boolean); override;
94 | procedure WMGetDlgCode(var Message: TWMGetDlgCode); message WM_GETDLGCODE;
95 | procedure WMLButtonDown(var Message: TWMLButtonDown); message
96 | WM_LBUTTONDOWN;
97 | protected
98 | function CalcHeight(AIndex: Integer): Integer;
99 | function CalcWidth: Integer;
100 | procedure Change; virtual;
101 | procedure EditAreaDown; override;
102 | procedure EditAreaUp; override;
103 | procedure FontChanged(Sender: TObject); dynamic;
104 | procedure KeyDown(var Key: Word; Shift: TShiftState); override;
105 | procedure RefreshEditArea(AEditAreaIndex: Integer = 0); override;
106 | procedure RefreshDimensions; override;
107 | public
108 | constructor Create(AOwner: TComponent); override;
109 | destructor Destroy; override;
110 | procedure AddEditArea;
111 | procedure DeleteEditArea; override;
112 | procedure InsertEditArea; override;
113 | procedure Paint; override;
114 | property ActiveEditArea: TEditArea read FActiveEditArea write
115 | FActiveEditArea;
116 | property Canvas;
117 | published
118 | property Align;
119 | property Anchors;
120 | property BkColor;
121 | property Data: String read GetData write SetData;
122 | property Enabled;
123 | property Font;
124 | property Version: String read FVersion;
125 | property OnChange: TNotifyEvent read FOnChange write FOnChange;
126 | end;
127 |
128 | TEACursor = class(TQDSGraphic)
129 | private
130 | FComVisible: Boolean;
131 | Timer: TTimer;
132 | function GetParent: TEditArea;
133 | procedure PutParent(AValue: TEditArea);
134 | procedure RefreshVisible;
135 | procedure SetComVisible(Value: Boolean);
136 | protected
137 | procedure Paint; override;
138 | procedure RefreshDimensions; override;
139 | procedure Time(Sender: TObject);
140 | public
141 | constructor Create(AOwner: TComponent); override;
142 | destructor Destroy; override;
143 | property ComVisible: Boolean read FComVisible write SetComVisible;
144 | property Parent: TEditArea read GetParent write PutParent;
145 | end;
146 |
147 | TEditArea = class(TQDSGraphic)
148 | private
149 | FActive: Boolean;
150 | FCursor: TEACursor;
151 | FEquationIndex: Integer;
152 | FEquationList: TEquationList;
153 | Index: Integer;
154 | MainArea: TQDSEquation;
155 | function GetData: string;
156 | function GetIsEmpty: Boolean;
157 | function GetParent: TEquatStore;
158 | procedure OnActive;
159 | procedure OnDeactive;
160 | procedure PutParent(AValue: TEquatStore);
161 | procedure RefreshCursor;
162 | procedure RefreshEquations;
163 | procedure RefreshRecurse;
164 | procedure SetActive(AValue: Boolean);
165 | procedure SetBkColor(AValue: TColor); override;
166 | procedure SetData(const AValue: string);
167 | procedure SetEquationIndex(AValue: Integer);
168 | procedure SetEquationList(AValue: TEquationList);
169 | procedure WMLButtonDown(var Message: TWMLButtonDown); message
170 | WM_LBUTTONDOWN;
171 | protected
172 |
173 | function CalcWidth(AIndex: Integer): Integer;
174 | procedure RefreshDimensions; override;
175 | public
176 | function CalcHeight: Integer;
177 | constructor Create(AOwner: TComponent); override;
178 | destructor Destroy; override;
179 | procedure AddEqBrackets(kb: TKindBracket);
180 | procedure AddEqExtSymbol(SymbolCode: Integer);
181 | procedure AddEqIndex(go: TGroupOptions);
182 | procedure AddEqIntegral(go: TGroupOptions; Size: Integer; Ring: Boolean);
183 | procedure AddEqSimple(Ch: Char);
184 | procedure AddEqVector(ka: TKindArrow; ae: TAlignEA);
185 | procedure AddEqSumma(go: TGroupOptions);
186 | procedure AddEqMultiply(go: TGroupOptions);
187 | procedure AddEqJoin(go: TGroupOptions);
188 | procedure AddEqIntersection(go: TGroupOptions);
189 | procedure AddEqCoMult(go: TGroupOptions);
190 | procedure AddEqArrow(ka: TKindArrow; ae: TAlignEA);
191 | procedure AddEqSquare;
192 | procedure AddEqDivision;
193 | procedure AddEqMatrix(km: TKindMatrix; CountEA: Integer);
194 | procedure DelEquation(AEquationIndex: Integer);
195 | procedure Paint; override;
196 | property Active: Boolean read FActive write SetActive;
197 | property Cursor: TEACursor read FCursor write FCursor;
198 | property Data: string read GetData write SetData;
199 | property EquationIndex: Integer read FEquationIndex write SetEquationIndex;
200 | property EquationList: TEquationList read FEquationList write
201 | SetEquationList;
202 | property IsEmpty: Boolean read GetIsEmpty;
203 | property Parent: TEquatStore read GetParent write PutParent;
204 | end;
205 |
206 | TEquation = class(TEquatStore)
207 | private
208 | Index: Integer;
209 | function GetData: string; virtual;
210 | function GetMidLine: Integer; virtual;
211 | function GetParent: TEditArea;
212 | procedure PutParent(AValue: TEditArea);
213 | procedure SetData(const AValue: string); virtual;
214 | procedure SetUpdateState(Updating: Boolean); override;
215 | procedure WMLButtonDown(var Message: TWMLButtonDown); message
216 | WM_LBUTTONDOWN;
217 | property Data: string read GetData write SetData;
218 | protected
219 | function CalcHeight: Integer; dynamic;
220 | function CalcWidth: Integer; dynamic;
221 | procedure SetCanvasFont;
222 | public
223 | constructor Create(AOwner: TComponent); override;
224 | procedure Paint; override;
225 | property MidLine: Integer read GetMidLine;
226 | property Parent: TEditArea read GetParent write PutParent;
227 | end;
228 |
229 | TEqSimple = class(TEquation)
230 | private
231 | function GetData: string; override;
232 | protected
233 | Ch: Char;
234 | function CalcHeight: Integer; override;
235 | function CalcWidth: Integer; override;
236 | procedure RefreshDimensions; override;
237 | public
238 | procedure Paint; override;
239 | end;
240 |
241 | TEqExtSymbol = class(TEquation)
242 | private
243 | function GetData: string; override;
244 | protected
245 | Symbol: WideChar;
246 | function CalcHeight: Integer; override;
247 | function CalcWidth: Integer; override;
248 | procedure RefreshDimensions; override;
249 | public
250 | procedure Paint; override;
251 | end;
252 |
253 | TEqParent = class(TEquation)
254 | private
255 | function GetData: string; override;
256 | procedure SetBkColor(AValue: TColor); override;
257 | procedure SetData(const AValue: string); override;
258 | public
259 | constructor Create(AOwner: TComponent); override;
260 | destructor Destroy; override;
261 | procedure InsertEditArea; override;
262 | end;
263 |
264 | TEqGroupOp = class(TEqParent)
265 | private
266 | FRing: Boolean;
267 | FSize: Integer;
268 | FSymbol: WideChar;
269 | FGroupOptions: TGroupOptions;
270 | FLimitTop, FLimitBottom, FIndexTop, FIndexBottom: TEditArea;
271 | function GetCommonHeight: Integer;
272 | function GetCommonWidth: Integer;
273 | function GetData: string; override;
274 | procedure SetData(const AValue: string); override;
275 | function GetMidLine: Integer; override;
276 | function GetSymbolHeight: Integer;
277 | function GetSymbolWidth: Integer;
278 | function GetTopMargin: Integer;
279 | procedure SetGroupOptions(Value: TGroupOptions);
280 | procedure SetRing(ARing: Boolean);
281 | procedure SetSize(ASize: Integer);
282 | procedure SetSymbol(Value: WideChar);
283 | protected
284 | function CalcHeight: Integer; override;
285 | function CalcSymbolHeight: Integer;
286 | function CalcSymbolWidth: Integer;
287 | function CalcWidth: Integer; override;
288 | procedure RefreshDimensions; override;
289 | procedure RefreshEA(AEditArea: TEditArea; AKp: Double);
290 | procedure RefreshEditArea(AEditAreaIndex: Integer = 0); override;
291 | public
292 | constructor Create(AOwner: TComponent); override;
293 | property GroupOptions: TGroupOptions read FGroupOptions write SetGroupOptions;
294 | procedure Paint; override;
295 | property Ring: Boolean read FRing write SetRing;
296 | property Size: Integer read FSize write SetSize;
297 | property Symbol: WideChar read FSymbol write SetSymbol;
298 | property SymbolHeight: Integer read GetSymbolHeight;
299 | property SymbolWidth: Integer read GetSymbolWidth;
300 | property TopMargin: Integer read GetTopMargin;
301 | end;
302 |
303 | TEqIntegral = class(TEqGroupOp)
304 | public
305 | constructor Create(AOwner: TComponent); override;
306 | end;
307 |
308 | TEqSumma = class(TEqGroupOp)
309 | public
310 | constructor Create(AOwner: TComponent); override;
311 | end;
312 |
313 | TEqMultiply = class(TEqGroupOp)
314 | public
315 | constructor Create(AOwner: TComponent); override;
316 | end;
317 |
318 | TEqIntersection = class(TEqGroupOp)
319 | public
320 | constructor Create(AOwner: TComponent); override;
321 | end;
322 |
323 | TEqJoin = class(TEqGroupOp)
324 | public
325 | constructor Create(AOwner: TComponent); override;
326 | end;
327 |
328 | TEqCoMult = class(TEqGroupOp)
329 | public
330 | constructor Create(AOwner: TComponent); override;
331 | end;
332 |
333 | TEqIndex = class(TEqParent)
334 | private
335 | FIndexTop, FIndexBottom: TEditArea;
336 | FGroupOptions: TGroupOptions;
337 | function GetData: String; override;
338 | procedure SetData(const AValue: String); override;
339 | procedure SetGroupOptions(const Value: TGroupOptions);
340 | protected
341 | function CalcHeight: Integer; override;
342 | function CalcWidth: Integer; override;
343 | procedure RefreshDimensions; override;
344 | procedure RefreshEA(AEditArea: TEditArea);
345 | procedure RefreshEditArea(AEditAreaIndex: Integer = 0); override;
346 | public
347 | constructor Create(AOwner: TComponent); override;
348 | procedure Paint; override;
349 | property GroupOptions: TGroupOptions read FGroupOptions write SetGroupOptions;
350 | end;
351 |
352 | TEqBrackets = class(TEqParent)
353 | private
354 | FLSymbol: WideChar;
355 | FRSymbol: WideChar;
356 | FKindBracket: TKindBracket;
357 | procedure SetKindBracket(AValue: TKindBracket);
358 | procedure SetLSymbol(Value: WideChar);
359 | procedure SetRSymbol(Value: WideChar);
360 | protected
361 | function CalcSymbolWidth: Integer;
362 | function CalcSymbolHeight: Integer;
363 | function CalcHeight: Integer; override;
364 | function CalcWidth: Integer; override;
365 | function GetCommonHeight: Integer;
366 | procedure RefreshDimensions; override;
367 | procedure RefreshEditArea(AEditAreaIndex: Integer = 0); override;
368 | property KindBracket: TKindBracket read FKindBracket write SetKindBracket;
369 | public
370 | constructor Create(AOwner: TComponent); override;
371 | procedure Paint; override;
372 | property LSymbol: WideChar read FLSymbol write SetLSymbol;
373 | property RSymbol: WideChar read FRSymbol write SetRSymbol;
374 | end;
375 |
376 | TEqArrow = class(TEqParent)
377 | private
378 | ArrowHeight, LineHeight: Integer;
379 | FAlignEA: TAlignEA;
380 | FKindArrow: TKindArrow;
381 |
382 | function GetMidLine: Integer; override;
383 | procedure SetKindArrow(Value: TKindArrow);
384 | procedure SetAlignEA(const Value: TAlignEA);
385 | protected
386 | function CalcHeight: Integer; override;
387 | function CalcWidth: Integer; override;
388 | procedure RefreshDimensions; override;
389 | procedure RefreshEditArea(AEditAreaIndex: Integer = 0); override;
390 | public
391 | constructor Create(AOwner: TComponent); override;
392 | procedure Paint; override;
393 | property AlignEA: TAlignEA read FAlignEA write SetAlignEA;
394 | property KindArrow: TKindArrow read FKindArrow write SetKindArrow;
395 | end;
396 |
397 | TEqSquare = class(TEqParent)
398 | private
399 | LineHeight: Integer;
400 | GalkaLeft: Integer;
401 | function GetMidLine: Integer; override;
402 | protected
403 | function CalcHeight: Integer; override;
404 | function CalcWidth: Integer; override;
405 | procedure RefreshDimensions; override;
406 | procedure RefreshEditArea(AEditAreaIndex: Integer = 0); override;
407 | public
408 | constructor Create(AOwner: TComponent); override;
409 | procedure Paint; override;
410 | end;
411 |
412 | TEqDivision = class(TEqParent)
413 | private
414 | ArrowHeight, LineHeight: Integer;
415 | function GetData: String; override;
416 | procedure SetData(const AValue: String); override;
417 | function GetMidLine: Integer; override;
418 | protected
419 | function CalcHeight: Integer; override;
420 | function CalcWidth: Integer; override;
421 | procedure RefreshDimensions; override;
422 | procedure RefreshEA(AEditArea: TEditArea);
423 | procedure RefreshEditArea(AEditAreaIndex: Integer = 0); override;
424 | public
425 | constructor Create(AOwner: TComponent); override;
426 | procedure Paint; override;
427 | end;
428 |
429 | TEqVector = class(TEqParent)
430 | private
431 | ArrowHeight, LineHeight: Integer;
432 | FAlignEA: TAlignEA;
433 | FKindArrow: TKindArrow;
434 |
435 | function GetMidLine: Integer; override;
436 | procedure SetKindArrow(Value: TKindArrow);
437 | procedure SetAlignEA(const Value: TAlignEA);
438 | protected
439 | function CalcHeight: Integer; override;
440 | function CalcWidth: Integer; override;
441 | procedure RefreshDimensions; override;
442 | procedure RefreshEditArea(AEditAreaIndex: Integer = 0); override;
443 | public
444 | constructor Create(AOwner: TComponent); override;
445 | procedure Paint; override;
446 | property AlignEA: TAlignEA read FAlignEA write SetAlignEA;
447 | property KindArrow: TKindArrow read FKindArrow write SetKindArrow;
448 | end;
449 |
450 | TEqMatrix = class(TEqParent)
451 | private
452 | FCountEA: Integer;
453 | FKindMatrix: TKindMatrix;
454 | procedure SetData(const AValue: String); override;
455 | function GetData: String; override;
456 | function GetDX: Integer;
457 | function GetDY: Integer;
458 | function GetColWidth(ACol: Integer): Integer;
459 | function GetRowHeight(ARow: Integer): Integer;
460 | function GetMidLine: Integer; override;
461 | procedure SetKindMatrix(const Value: TKindMatrix);
462 | procedure SetCountEA(const Value: Integer);
463 | protected
464 | function CalcHeight: Integer; override;
465 | function CalcWidth: Integer; override;
466 | procedure RefreshDimensions; override;
467 | procedure RefreshEA(AEditArea: TEditArea);
468 | procedure RefreshEditArea(AEditAreaIndex: Integer = 0); override;
469 | public
470 | constructor Create(AOwner: TComponent); override;
471 | procedure Paint; override;
472 | property CountEA: Integer read FCountEA write SetCountEA;
473 | property KindMatrix: TKindMatrix read FKindMatrix write SetKindMatrix;
474 | end;
475 | procedure Register;
476 |
477 |
478 | implementation
479 |
480 | uses Types;
481 |
482 |
483 | procedure Register;
484 | begin
485 | RegisterComponents('QDS Equations', [TQDSEquation]);
486 | end;
487 |
488 |
489 | {
490 | ******************************** TEquationList *********************************
491 | }
492 | function TEquationList.GetItem(Index: Integer): TEquation;
493 | begin
494 | Result := TEquation(inherited Objects[Index]);
495 | end;
496 |
497 | procedure TEquationList.PutItem(Index: Integer; AValue: TEquation);
498 | begin
499 | inherited Objects[Index] := AValue;
500 | end;
501 |
502 |
503 | {
504 | ******************************** TEditAreaList *********************************
505 | }
506 | function TEditAreaList.GetItem(Index: Integer): TEditArea;
507 | begin
508 | Result := TEditArea(inherited Items[Index]);
509 | end;
510 |
511 | procedure TEditAreaList.SetItem(Index: Integer; AValue: TEditArea);
512 | begin
513 | inherited Items[Index] := AValue;
514 | end;
515 |
516 | {
517 | ********************************* TQDSGraphic **********************************
518 | }
519 | constructor TQDSGraphic.Create(AOwner: TComponent);
520 | begin
521 | inherited;
522 | end;
523 |
524 | function TQDSGraphic.GetExprData(const ExprData: String): TExprArray;
525 | var
526 | i, ExprCount: Integer;
527 |
528 | function StandOnLetter: Boolean;
529 | begin
530 | while (not(AnsiChar(ExprData[i]) in ['a'..'z', 'A'..'Z']))and(i0 do begin
556 | Inc(i);
557 | Inc(BracketsCount, StandOnBracket);
558 | end;
559 | ExprEnd:=i;
560 | Result:=Trim(Copy(ExprData, ExprBegin, ExprEnd-ExprBegin));
561 | end;
562 |
563 | begin
564 | ExprCount:=0;
565 | SetLength(Result, ExprCount);
566 | i:=1;
567 | if Length(ExprData)>0 then while StandOnLetter do begin
568 | Inc(ExprCount);
569 | SetLength(Result, ExprCount);
570 | Result[ExprCount-1].ClassName:=GetNextClass;
571 | Result[ExprCount-1].ExprData:=GetNextExpr;
572 | end;
573 | end;
574 |
575 |
576 | procedure TQDSGraphic.SetBkColor(AValue: TColor);
577 | begin
578 | FBkColor := AValue;
579 | Repaint;
580 | end;
581 |
582 | {
583 | ********************************* TEquatStore **********************************
584 | }
585 | procedure TEquatStore.BeginUpdate;
586 | begin
587 | if FUpdateCount = 0 then SetUpdateState(True);
588 | Inc(FUpdateCount);
589 | end;
590 |
591 | procedure TEquatStore.DeleteEditArea;
592 | begin
593 | end;
594 |
595 | procedure TEquatStore.EditAreaDown;
596 | begin
597 | end;
598 |
599 | procedure TEquatStore.EditAreaUp;
600 | begin
601 | end;
602 |
603 | procedure TEquatStore.EndUpdate;
604 | begin
605 | Dec(FUpdateCount);
606 | if FUpdateCount = 0 then SetUpdateState(False);
607 | end;
608 |
609 | procedure TEquatStore.InsertEditArea;
610 | begin
611 | end;
612 |
613 | procedure TEquatStore.RefreshEditArea(AEditAreaIndex: Integer = 0);
614 | begin
615 | end;
616 |
617 | procedure TEquatStore.SetEditAreaIndex(AValue: Integer);
618 | begin
619 | if (AValue<>FEditAreaIndex)and(AValue>=0)and(AValueResult then
696 | Result:=FEditAreaList.Items[i].Width;
697 | end;
698 |
699 | procedure TQDSEquation.Change;
700 | begin
701 | inherited Changed;
702 | if Assigned(FOnChange) then FOnChange(Self);
703 | end;
704 |
705 | procedure TQDSEquation.DeleteEditArea;
706 | begin
707 | if FEditAreaList.Count>1 then FEditAreaList.Delete(FEditAreaIndex);
708 | if FEditAreaIndex>=FEditAreaList.Count then Dec(FEditAreaIndex);
709 | RefreshEditArea(FEditAreaIndex);
710 | FEditAreaList.Items[FEditAreaIndex].Active:=True;
711 | Change;
712 | end;
713 |
714 | procedure TQDSEquation.EditAreaDown;
715 | begin
716 | EditAreaIndex:=EditAreaIndex+1;
717 | FEditAreaList.Items[FEditAreaIndex].Active:=True;
718 | end;
719 |
720 | procedure TQDSEquation.EditAreaUp;
721 | begin
722 | EditAreaIndex:=EditAreaIndex-1;
723 | FEditAreaList.Items[FEditAreaIndex].Active:=True;
724 | end;
725 |
726 | procedure TQDSEquation.FontChanged(Sender: TObject);
727 | begin
728 | RefreshEditArea;
729 | end;
730 |
731 | function TQDSEquation.GetData: String;
732 | var
733 | i: Integer;
734 | begin
735 | Result:='';
736 | for i:=0 to FEditAreaList.Count-1 do begin
737 | Result:=Format('%sEditArea(%s)',[Result, FEditAreaList.Items[i].Data]);
738 | end;
739 | end;
740 |
741 | procedure TQDSEquation.InsertEditArea;
742 | begin
743 | FEditAreaList.Insert(FEditAreaIndex, TEditArea.Create(Self));
744 | FEditAreaList.Items[FEditAreaIndex].Parent:=Self;
745 | FEditAreaList.Items[FEditAreaIndex].MainArea:=Self;
746 | FEditAreaList.Items[FEditAreaIndex].Font:=Font;
747 | FEditAreaList.Items[FEditAreaIndex].Font.Size:=Round(Font.Size*Kp);
748 | FEditAreaList.Items[FEditAreaIndex].Index:=FEditAreaIndex;
749 | FEditAreaList.Items[FEditAreaIndex].RefreshDimensions;
750 | RefreshEditArea(FEditAreaIndex);
751 | FEditAreaList.Items[FEditAreaIndex].Active:=True;
752 | Change;
753 | end;
754 |
755 | procedure TQDSEquation.KeyDown(var Key: Word; Shift: TShiftState);
756 | begin
757 | if Assigned(ActiveEditArea) then case Key of
758 | VK_UP:
759 | ActiveEditArea.Parent.EditAreaUp;
760 | VK_DOWN:
761 | ActiveEditArea.Parent.EditAreaDown;
762 | VK_DELETE: begin
763 | if ActiveEditArea.IsEmpty then ActiveEditArea.Parent.DeleteEditArea else
764 | ActiveEditArea.DelEquation(ActiveEditArea.EquationIndex);
765 | end;
766 | VK_BACK: begin
767 | if ActiveEditArea.EquationIndex=0 then begin
768 | if EditAreaIndex>0 then begin
769 | EditAreaIndex:=EditAreaIndex-1;
770 | DeleteEditArea;
771 | end;
772 | end else if not ActiveEditArea.IsEmpty then begin
773 | ActiveEditArea.EquationIndex:=ActiveEditArea.EquationIndex-1;
774 | ActiveEditArea.DelEquation(ActiveEditArea.EquationIndex);
775 | end;
776 | end;
777 | VK_RETURN: begin
778 | if ActiveEditArea.EquationIndex=0 then InsertEditArea
779 | else AddEditArea;
780 | end;
781 | VK_HOME:
782 | ActiveEditArea.EquationIndex:=0;
783 | VK_END:
784 | ActiveEditArea.EquationIndex:=ActiveEditArea.EquationList.Count;
785 | VK_LEFT:
786 | ActiveEditArea.EquationIndex:=ActiveEditArea.EquationIndex-1;
787 | VK_RIGHT:
788 | ActiveEditArea.EquationIndex:=ActiveEditArea.EquationIndex+1;
789 |
790 | VK_NUMPAD0..VK_NUMPAD9, 48..90, 166..228, VK_MULTIPLY, VK_ADD,
791 | VK_SEPARATOR, VK_SUBTRACT, VK_DECIMAL, VK_DIVIDE: begin
792 | ActiveEditArea.AddEqSimple(GetCharFromVirtualKey(Key)[1]);
793 | ActiveEditArea.EquationIndex:=ActiveEditArea.EquationIndex+1;
794 | end;
795 | //else ShowMessage(IntToStr(Key));
796 | end;
797 | inherited KeyDown(Key, Shift);
798 | end;
799 |
800 | procedure TQDSEquation.Paint;
801 | {$IfDef DEMO}
802 | var
803 | demo: string;
804 | {$EndIf}
805 | begin
806 | Canvas.Pen.Style := psInsideFrame;
807 | Canvas.Pen.Color:=clBlack;
808 | Canvas.Brush.Style := bsClear;
809 | Canvas.Brush.Color := FBkColor;
810 | Canvas.Rectangle(0, 0, Width, Height);
811 |
812 | {$IfDef DEMO}
813 | demo:='DEMO VERSION, VISIT http://qdsequations.com';
814 | Canvas.TextOut(3,2,demo);
815 | Canvas.TextOut(3,Height-Canvas.TextHeight('demo')-2, demo);
816 | {$EndIf}
817 | end;
818 |
819 | procedure TQDSEquation.RefreshEditArea(AEditAreaIndex: Integer = 0);
820 | var
821 | i: Integer;
822 | begin
823 | for i:=AEditAreaIndex to FEditAreaList.Count-1 do begin
824 | FEditAreaList.Items[i].Left:=Font.Size div 2;
825 | FEditAreaList.Items[i].Top:=CalcHeight(i);
826 | FEditAreaList.Items[i].Font.Assign(Font);
827 | FEditAreaList.Items[i].Font.Size:=Round(Font.Size*Kp);
828 | FEditAreaList.Items[i].RefreshDimensions;
829 |
830 | FEditAreaList.Items[i].Index:=i;
831 | FEditAreaList.Items[i].BkColor:=BkColor;
832 | end;
833 | end;
834 |
835 | procedure TQDSEquation.RefreshDimensions;
836 | begin
837 | end;
838 |
839 | procedure TQDSEquation.SetBkColor(AValue: TColor);
840 | var
841 | i: Integer;
842 | begin
843 | FBkColor := AValue;
844 | for i:=0 to FEditAreaList.Count-1 do begin
845 | FEditAreaList.Items[i].BkColor:=FBkColor;
846 | end;
847 | Repaint;
848 | end;
849 |
850 | procedure TQDSEquation.SetData(const AValue: string);
851 | var
852 | i: Integer;
853 | ExprArray: TExprArray;
854 | begin
855 | FEditAreaList.Clear;
856 | FEditAreaIndex:=0;
857 | ExprArray:=GetExprData(AValue);
858 | for i:=0 to Length(ExprArray)-1 do begin
859 | if ExprArray[i].ClassName = 'EditArea' then begin
860 | if FEditAreaList.Count>0 then AddEditArea else InsertEditArea;
861 | FEditAreaList.Items[i].Data:=ExprArray[i].ExprData;
862 | //EditAreaIndex:=EditAreaIndex+1;
863 | end;
864 | end;
865 | end;
866 |
867 | procedure TQDSEquation.SetUpdateState(Updating: Boolean);
868 | begin
869 | if not Updating then Change;
870 | end;
871 |
872 | procedure TQDSEquation.WMGetDlgCode(var Message: TWMGetDlgCode);
873 | begin
874 | Message.Result:=DLGC_WANTARROWS;
875 | end;
876 |
877 | procedure TQDSEquation.WMLButtonDown(var Message: TWMLButtonDown);
878 | begin
879 | SetFocus;
880 | end;
881 |
882 | {
883 | ********************************** TEACursor ***********************************
884 | }
885 | constructor TEACursor.Create(AOwner: TComponent);
886 | begin
887 | inherited Create(AOwner);
888 | Timer:=TTimer.Create(Self);
889 | Timer.Interval:=500;
890 | Timer.OnTimer:=Time;
891 | end;
892 |
893 | destructor TEACursor.Destroy;
894 | begin
895 | Timer.Free;
896 | inherited Destroy;
897 | end;
898 |
899 | function TEACursor.GetParent: TEditArea;
900 | begin
901 | Result := TEditArea(inherited Parent);
902 | end;
903 |
904 | procedure TEACursor.Paint;
905 | begin
906 | Canvas.Pen.Style := psSolid;
907 | Canvas.Brush.Style := bsClear;
908 | Canvas.Brush.Color := clBlack;
909 | Canvas.Rectangle(0, 0, Width, Height);
910 | end;
911 |
912 | procedure TEACursor.PutParent(AValue: TEditArea);
913 | begin
914 | inherited Parent := AValue;
915 | end;
916 |
917 | procedure TEACursor.RefreshDimensions;
918 | begin
919 | Width:=2;
920 | Height:=Font.Size;
921 | RefreshVisible;
922 | end;
923 |
924 | procedure TEACursor.RefreshVisible;
925 | begin
926 | Visible:= not Visible and FComVisible and Parent.MainArea.Enabled;
927 | end;
928 |
929 | procedure TEACursor.SetComVisible(Value: Boolean);
930 | begin
931 | Timer.Enabled:=Value;
932 | FComVisible:=Value;
933 | RefreshVisible;
934 | end;
935 |
936 | procedure TEACursor.Time(Sender: TObject);
937 | begin
938 | RefreshVisible;
939 | end;
940 |
941 | {
942 | ********************************** TEditArea ***********************************
943 | }
944 | constructor TEditArea.Create(AOwner: TComponent);
945 | begin
946 | inherited Create(AOwner);
947 | FEquationList:=TEquationList.Create;
948 | FEquationIndex:=0;
949 | FBkColor:=clWhite;
950 |
951 | FCursor:=TEACursor.Create(Self);
952 | FCursor.Parent:=Self;
953 | end;
954 |
955 | destructor TEditArea.Destroy;
956 | begin
957 | FCursor.Free;
958 | FEquationList.Free;
959 | if Active then MainArea.ActiveEditArea:=nil;
960 | inherited Destroy;
961 | end;
962 |
963 | procedure TEditArea.AddEqBrackets(kb: TKindBracket);
964 | var TempStr: String;
965 | begin
966 | TempStr:='Brackets';
967 | case kb of
968 | kbRound: TempStr:=TempStr+'Round';
969 | kbSquare: TempStr:=TempStr+'Square';
970 | kbFigure: TempStr:=TempStr+'Figure';
971 | kbCorner: TempStr:=TempStr+'Corner';
972 | kbModule: TempStr:=TempStr+'Module';
973 | kbDModule: TempStr:=TempStr+'DModule';
974 | end;
975 | FEquationList.InsertObject(FEquationIndex, TempStr, TEqBrackets.Create(Self));
976 | (FEquationList.Items[FEquationIndex] as TEqBrackets).KindBracket:=kb;
977 | RefreshRecurse;
978 | MainArea.Change;
979 | end;
980 |
981 | procedure TEditArea.AddEqExtSymbol(SymbolCode: Integer);
982 | begin
983 | FEquationList.InsertObject(FEquationIndex, 'ExtSymbol', TEqExtSymbol.Create(Self));
984 | (FEquationList.Items[FEquationIndex] as TEqExtSymbol).Symbol:=WideChar(SymbolCode);
985 | RefreshRecurse;
986 | MainArea.Change;
987 | end;
988 |
989 | procedure TEditArea.AddEqIndex(go: TGroupOptions);
990 | var TempStr: String;
991 | begin
992 | TempStr:='Index';
993 | if goIndexTop in go then TempStr:=TempStr+'Top';
994 | if goIndexBottom in go then TempStr:=TempStr+'Bottom';
995 | FEquationList.InsertObject(FEquationIndex, TempStr, TEqIndex.Create(Self));
996 | (FEquationList.Items[FEquationIndex] as TEqIndex).GroupOptions:=go;
997 | RefreshRecurse;
998 | MainArea.Change;
999 | end;
1000 |
1001 | procedure TEditArea.AddEqIntegral(go: TGroupOptions; Size: Integer; Ring: Boolean);
1002 | var TempStr: String;
1003 | begin
1004 | TempStr:='Int';
1005 | if go=[goLimitBottom] then TempStr:=TempStr+'LimitBottom';
1006 | if go=[goIndexBottom] then TempStr:=TempStr+'IndexBottom';
1007 | if go=[goLimitBottom, goLimitTop] then TempStr:=TempStr+'LimitBottomTop';
1008 | if go=[goIndexBottom, goIndexTop] then TempStr:=TempStr+'IndexBottomTop';
1009 |
1010 | case Size of
1011 | 1: TempStr:=TempStr+'One';
1012 | 2: TempStr:=TempStr+'Two';
1013 | 3: TempStr:=TempStr+'Three';
1014 | end;
1015 |
1016 | if Ring then TempStr:=TempStr+'Ring';
1017 |
1018 | FEquationList.InsertObject(FEquationIndex, TempStr, TEqIntegral.Create(Self));
1019 |
1020 | (FEquationList.Items[FEquationIndex] as TEqIntegral).Ring:=Ring;
1021 | (FEquationList.Items[FEquationIndex] as TEqIntegral).Size:=Size;
1022 | (FEquationList.Items[FEquationIndex] as TEqIntegral).GroupOptions:=go;
1023 |
1024 | RefreshRecurse;
1025 | MainArea.Change;
1026 | end;
1027 |
1028 | procedure TEditArea.AddEqVector(ka: TKindArrow; ae: TAlignEA);
1029 | var TempStr: String;
1030 | begin
1031 | TempStr:='Vector';
1032 | if kaRight in ka then TempStr:=TempStr+'kaRight';
1033 | if kaLeft in ka then TempStr:=TempStr+'kaLeft';
1034 | if kaDouble in ka then TempStr:=TempStr+'kaDouble';
1035 | case ae of
1036 | aeTop: TempStr:=TempStr+'aeTop';
1037 | aeBottom: TempStr:=TempStr+'aeBottom';
1038 | end;
1039 | FEquationList.InsertObject(FEquationIndex, TempStr, TEqVector.Create(Self));
1040 | (FEquationList.Items[FEquationIndex] as TEqVector).AlignEA:=ae;
1041 | (FEquationList.Items[FEquationIndex] as TEqVector).KindArrow:=ka;
1042 | RefreshRecurse;
1043 | MainArea.Change;
1044 | end;
1045 |
1046 | procedure TEditArea.AddEqSimple(Ch: Char);
1047 | begin
1048 | FEquationList.InsertObject(FEquationIndex, 'Simple', TEqSimple.Create(Self));
1049 | (FEquationList.Items[FEquationIndex] as TEqSimple).Ch:=Ch;
1050 | RefreshRecurse;
1051 | MainArea.Change;
1052 | end;
1053 |
1054 | procedure TEditArea.AddEqSumma(go: TGroupOptions);
1055 | var TempStr: String;
1056 | begin
1057 | TempStr:='Sum';
1058 | if go=[goLimitBottom] then TempStr:=TempStr+'LimitBottom';
1059 | if go=[goIndexBottom] then TempStr:=TempStr+'IndexBottom';
1060 | if go=[goLimitBottom, goLimitTop] then TempStr:=TempStr+'LimitBottomTop';
1061 | if go=[goIndexBottom, goIndexTop] then TempStr:=TempStr+'IndexBottomTop';
1062 |
1063 |
1064 | FEquationList.InsertObject(FEquationIndex, TempStr, TEqSumma.Create(Self));
1065 | (FEquationList.Items[FEquationIndex] as TEqSumma).GroupOptions:=go;
1066 |
1067 | RefreshRecurse;
1068 | MainArea.Change;
1069 | end;
1070 |
1071 | procedure TEditArea.AddEqMultiply(go: TGroupOptions);
1072 | var TempStr: String;
1073 | begin
1074 | TempStr:='Multiply';
1075 | if go=[goLimitBottom] then TempStr:=TempStr+'LimitBottom';
1076 | if go=[goIndexBottom] then TempStr:=TempStr+'IndexBottom';
1077 | if go=[goLimitBottom, goLimitTop] then TempStr:=TempStr+'LimitBottomTop';
1078 | if go=[goIndexBottom, goIndexTop] then TempStr:=TempStr+'IndexBottomTop';
1079 |
1080 |
1081 | FEquationList.InsertObject(FEquationIndex, TempStr, TEqMultiply.Create(Self));
1082 | (FEquationList.Items[FEquationIndex] as TEqMultiply).GroupOptions:=go;
1083 |
1084 | RefreshRecurse;
1085 | MainArea.Change;
1086 | end;
1087 |
1088 | procedure TEditArea.AddEqIntersection(go: TGroupOptions);
1089 | var TempStr: String;
1090 | begin
1091 | TempStr:='Intersection';
1092 | if go=[goLimitBottom] then TempStr:=TempStr+'LimitBottom';
1093 | if go=[goIndexBottom] then TempStr:=TempStr+'IndexBottom';
1094 | if go=[goLimitBottom, goLimitTop] then TempStr:=TempStr+'LimitBottomTop';
1095 | if go=[goIndexBottom, goIndexTop] then TempStr:=TempStr+'IndexBottomTop';
1096 | FEquationList.InsertObject(FEquationIndex, TempStr, TEqIntersection.Create(Self));
1097 | (FEquationList.Items[FEquationIndex] as TEqIntersection).GroupOptions:=go;
1098 | RefreshRecurse;
1099 | MainArea.Change;
1100 | end;
1101 |
1102 | procedure TEditArea.AddEqJoin(go: TGroupOptions);
1103 | var TempStr: String;
1104 | begin
1105 | TempStr:='Join';
1106 | if go=[goLimitBottom] then TempStr:=TempStr+'LimitBottom';
1107 | if go=[goIndexBottom] then TempStr:=TempStr+'IndexBottom';
1108 | if go=[goLimitBottom, goLimitTop] then TempStr:=TempStr+'LimitBottomTop';
1109 | if go=[goIndexBottom, goIndexTop] then TempStr:=TempStr+'IndexBottomTop';
1110 | FEquationList.InsertObject(FEquationIndex, TempStr, TEqJoin.Create(Self));
1111 | (FEquationList.Items[FEquationIndex] as TEqJoin).GroupOptions:=go;
1112 | RefreshRecurse;
1113 | MainArea.Change;
1114 | end;
1115 |
1116 | procedure TEditArea.AddEqCoMult(go: TGroupOptions);
1117 | var TempStr: String;
1118 | begin
1119 | TempStr:='CoMult';
1120 | if go=[goLimitBottom] then TempStr:=TempStr+'LimitBottom';
1121 | if go=[goIndexBottom] then TempStr:=TempStr+'IndexBottom';
1122 | if go=[goLimitBottom, goLimitTop] then TempStr:=TempStr+'LimitBottomTop';
1123 | if go=[goIndexBottom, goIndexTop] then TempStr:=TempStr+'IndexBottomTop';
1124 | FEquationList.InsertObject(FEquationIndex, TempStr, TEqCoMult.Create(Self));
1125 | (FEquationList.Items[FEquationIndex] as TEqCoMult).GroupOptions:=go;
1126 | RefreshRecurse;
1127 | MainArea.Change;
1128 | end;
1129 |
1130 | procedure TEditArea.AddEqArrow(ka: TKindArrow; ae: TAlignEA);
1131 | var TempStr: String;
1132 | begin
1133 | TempStr:='Arrow';
1134 | if kaRight in ka then TempStr:=TempStr+'kaRight';
1135 | if kaLeft in ka then TempStr:=TempStr+'kaLeft';
1136 | case ae of
1137 | aeTop: TempStr:=TempStr+'aeTop';
1138 | aeBottom: TempStr:=TempStr+'aeBottom';
1139 | end;
1140 | FEquationList.InsertObject(FEquationIndex, TempStr, TEqArrow.Create(Self));
1141 | (FEquationList.Items[FEquationIndex] as TEqArrow).AlignEA:=ae;
1142 | (FEquationList.Items[FEquationIndex] as TEqArrow).KindArrow:=ka;
1143 |
1144 | RefreshRecurse;
1145 | MainArea.Change;
1146 | end;
1147 |
1148 | procedure TEditArea.AddEqSquare;
1149 | begin
1150 | FEquationList.InsertObject(FEquationIndex, 'Square', TEqSquare.Create(Self));
1151 | RefreshRecurse;
1152 | MainArea.Change;
1153 | end;
1154 |
1155 | procedure TEditArea.AddEqDivision;
1156 | begin
1157 | FEquationList.InsertObject(FEquationIndex, 'Division', TEqDivision.Create(Self));
1158 | RefreshRecurse;
1159 | MainArea.Change;
1160 | end;
1161 |
1162 | procedure TEditArea.AddEqMatrix(km: TKindMatrix; CountEA: Integer);
1163 | var TempStr: String;
1164 | begin
1165 | TempStr:='Matrix';
1166 | case km of
1167 | kmHoriz: TempStr:=TempStr+'kmHoriz';
1168 | kmVert: TempStr:=TempStr+'kmVert';
1169 | kmSquare: TempStr:=TempStr+'kmSquare';
1170 | end;
1171 |
1172 | FEquationList.InsertObject(FEquationIndex, TempStr, TEqMatrix.Create(Self));
1173 | (FEquationList.Items[FEquationIndex] as TEqMatrix).KindMatrix:=km;
1174 | (FEquationList.Items[FEquationIndex] as TEqMatrix).CountEA:=CountEA;
1175 | RefreshRecurse;
1176 | MainArea.Change;
1177 | end;
1178 |
1179 |
1180 | function TEditArea.CalcHeight: Integer;
1181 | var
1182 | i, SumHeight: Integer;
1183 | begin
1184 | Result:=FCursor.Height;
1185 | for i:=0 to EquationList.Count-1 do begin
1186 | SumHeight:=5+Round(EquationList.Items[i].CalcHeight+
1187 | Abs(EquationList.Items[i].CalcHeight/2-EquationList.Items[i].MidLine));
1188 | if Result=0)and(AEquationIndexSelf then
1236 | MainArea.ActiveEditArea.Active:=False;
1237 | MainArea.ActiveEditArea:=Self;
1238 | Parent.EditAreaIndex:=Index;
1239 | Repaint;
1240 | FCursor.ComVisible:=True;
1241 | end;
1242 |
1243 | procedure TEditArea.OnDeactive;
1244 | begin
1245 | Repaint;
1246 | FCursor.ComVisible:=False;
1247 | end;
1248 |
1249 | procedure TEditArea.Paint;
1250 | begin
1251 | if MainArea.Enabled and (FActive or GetIsEmpty) then begin
1252 | Canvas.Pen.Color := clBlack;
1253 | Canvas.Pen.Style := psDot;
1254 | end else begin
1255 | Canvas.Pen.Color := FBkColor;
1256 | Canvas.Pen.Style := psSolid;
1257 | end;
1258 | Canvas.Brush.Style := bsClear;
1259 | Canvas.Brush.Color := FBkColor;
1260 | Canvas.Rectangle(0, 0, Width, Height);
1261 | end;
1262 |
1263 | procedure TEditArea.PutParent(AValue: TEquatStore);
1264 | begin
1265 | inherited Parent := AValue;
1266 | end;
1267 |
1268 | procedure TEditArea.RefreshCursor;
1269 | begin
1270 | FCursor.Font:=Font;
1271 | FCursor.RefreshDimensions;
1272 | FCursor.Top:=Round((Height-FCursor.Height)/2);
1273 | FCursor.Left:=CalcWidth(FEquationIndex);
1274 | end;
1275 |
1276 | procedure TEditArea.RefreshDimensions;
1277 | begin
1278 | Height:=CalcHeight+2;
1279 | if IsEmpty then begin
1280 | Width:=Font.Size;
1281 | end else begin
1282 | Width:=CalcWidth(EquationList.Count)+Font.Size div 3;
1283 | RefreshEquations;
1284 | end;
1285 | RefreshCursor;
1286 | end;
1287 |
1288 | procedure TEditArea.RefreshEquations;
1289 | var
1290 | i: Integer;
1291 | begin
1292 | for i:=0 to FEquationList.Count-1 do begin
1293 | FEquationList.Items[i].Index:=i;
1294 | FEquationList.Items[i].Font:=Font;
1295 | FEquationList.Items[i].BkColor:=FBkColor;
1296 | FEquationList.Items[i].RefreshDimensions;
1297 | FEquationList.Items[i].Level:=Parent.Level+1;
1298 | FEquationList.Items[i].Left:=CalcWidth(i)+FCursor.Width;
1299 |
1300 | FEquationList.Items[i].Top:=Round(Height/2-FEquationList.Items[i].MidLine);
1301 | end;
1302 | end;
1303 |
1304 | procedure TEditArea.RefreshRecurse;
1305 | begin
1306 | Parent.RefreshEditArea(Index);
1307 | if Parent.ClassName<>'TQDSEquation' then begin
1308 | (Parent as TEquation).Parent.RefreshRecurse;
1309 | end;
1310 | end;
1311 |
1312 | procedure TEditArea.SetActive(AValue: Boolean);
1313 | begin
1314 | FActive := AValue;
1315 | if AValue then OnActive
1316 | else OnDeactive;
1317 | end;
1318 |
1319 | procedure TEditArea.SetBkColor(AValue: TColor);
1320 | var
1321 | i: Integer;
1322 | begin
1323 | FBkColor := AValue;
1324 | for i:=0 to FEquationList.Count-1 do begin
1325 | FEquationList.Items[i].BkColor:=FBkColor;
1326 | FEquationList.Items[i].RefreshDimensions;
1327 | end;
1328 | Repaint;
1329 | end;
1330 |
1331 | procedure TEditArea.SetData(const AValue: string);
1332 | var
1333 | i: Integer;
1334 | ExprArray: TExprArray;
1335 | begin
1336 | for i:=0 to FEquationList.Count-1 do FEquationList.Items[i].Free;
1337 | FEquationList.Clear;
1338 | FEquationIndex:=0;
1339 | ExprArray:=GetExprData(AValue);
1340 | for i:=0 to Length(ExprArray)-1 do begin
1341 | if ExprArray[i].ClassName = 'Simple' then begin
1342 | AddEqSimple(ExprArray[i].ExprData[1]);
1343 | EquationIndex:=EquationIndex+1;
1344 | end;
1345 | if ExprArray[i].ClassName = 'ExtSymbol' then begin
1346 | AddEqExtSymbol(StrToInt(ExprArray[i].ExprData));
1347 | EquationIndex:=EquationIndex+1;
1348 | end;
1349 | if ExprArray[i].ClassName = 'IndexTop' then begin
1350 | AddEqIndex([goIndexTop]);
1351 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1352 | EquationIndex:=EquationIndex+1;
1353 | end;
1354 | if ExprArray[i].ClassName = 'IndexBottom' then begin
1355 | AddEqIndex([goIndexBottom]);
1356 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1357 | EquationIndex:=EquationIndex+1;
1358 | end;
1359 | if ExprArray[i].ClassName = 'IndexTopBottom' then begin
1360 | AddEqIndex([goIndexTop, goIndexBottom]);
1361 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1362 | EquationIndex:=EquationIndex+1;
1363 | end;
1364 | if ExprArray[i].ClassName = 'BracketsRound' then begin
1365 | AddEqBrackets(kbRound);
1366 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1367 | EquationIndex:=EquationIndex+1;
1368 | end;
1369 | if ExprArray[i].ClassName = 'BracketsSquare' then begin
1370 | AddEqBrackets(kbSquare);
1371 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1372 | EquationIndex:=EquationIndex+1;
1373 | end;
1374 | if ExprArray[i].ClassName = 'BracketsFigure' then begin
1375 | AddEqBrackets(kbFigure);
1376 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1377 | EquationIndex:=EquationIndex+1;
1378 | end;
1379 | if ExprArray[i].ClassName = 'BracketsCorner' then begin
1380 | AddEqBrackets(kbCorner);
1381 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1382 | EquationIndex:=EquationIndex+1;
1383 | end;
1384 | if ExprArray[i].ClassName = 'BracketsModule' then begin
1385 | AddEqBrackets(kbModule);
1386 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1387 | EquationIndex:=EquationIndex+1;
1388 | end;
1389 | if ExprArray[i].ClassName = 'BracketsDModule' then begin
1390 | AddEqBrackets(kbDModule);
1391 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1392 | EquationIndex:=EquationIndex+1;
1393 | end;
1394 | if ExprArray[i].ClassName = 'IntOne' then begin
1395 | AddEqIntegral([], 1, False);
1396 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1397 | EquationIndex:=EquationIndex+1;
1398 | end;
1399 | if ExprArray[i].ClassName = 'IntLimitBottomTopOne' then begin
1400 | AddEqIntegral([goLimitTop, goLimitBottom], 1, False);
1401 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1402 | EquationIndex:=EquationIndex+1;
1403 | end;
1404 | if ExprArray[i].ClassName = 'IntIndexBottomTopOne' then begin
1405 | AddEqIntegral([goIndexTop, goIndexBottom], 1, False);
1406 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1407 | EquationIndex:=EquationIndex+1;
1408 | end;
1409 | if ExprArray[i].ClassName = 'IntLimitBottomOne' then begin
1410 | AddEqIntegral([goLimitBottom], 1, False);
1411 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1412 | EquationIndex:=EquationIndex+1;
1413 | end;
1414 | if ExprArray[i].ClassName = 'IntIndexBottomOne' then begin
1415 | AddEqIntegral([goIndexBottom], 1, False);
1416 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1417 | EquationIndex:=EquationIndex+1;
1418 | end;
1419 | if ExprArray[i].ClassName = 'IntTwo' then begin
1420 | AddEqIntegral([], 2, False);
1421 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1422 | EquationIndex:=EquationIndex+1;
1423 | end;
1424 | if ExprArray[i].ClassName = 'IntLimitBottomTwo' then begin
1425 | AddEqIntegral([goLimitBottom], 2, False);
1426 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1427 | EquationIndex:=EquationIndex+1;
1428 | end;
1429 | if ExprArray[i].ClassName = 'IntIndexBottomTwo' then begin
1430 | AddEqIntegral([goIndexBottom], 2, False);
1431 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1432 | EquationIndex:=EquationIndex+1;
1433 | end;
1434 | if ExprArray[i].ClassName = 'IntThree' then begin
1435 | AddEqIntegral([], 3, False);
1436 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1437 | EquationIndex:=EquationIndex+1;
1438 | end;
1439 | if ExprArray[i].ClassName = 'IntLimitBottomThree' then begin
1440 | AddEqIntegral([goLimitBottom], 3, False);
1441 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1442 | EquationIndex:=EquationIndex+1;
1443 | end;
1444 | if ExprArray[i].ClassName = 'IntIndexBottomThree' then begin
1445 | AddEqIntegral([goIndexBottom], 3, False);
1446 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1447 | EquationIndex:=EquationIndex+1;
1448 | end;
1449 | if ExprArray[i].ClassName = 'IntOneRing' then begin
1450 | AddEqIntegral([], 1, True);
1451 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1452 | EquationIndex:=EquationIndex+1;
1453 | end;
1454 | if ExprArray[i].ClassName = 'IntLimitBottomOneRing' then begin
1455 | AddEqIntegral([goLimitBottom], 1, True);
1456 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1457 | EquationIndex:=EquationIndex+1;
1458 | end;
1459 | if ExprArray[i].ClassName = 'IntIndexBottomOneRing' then begin
1460 | AddEqIntegral([goIndexBottom], 1, True);
1461 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1462 | EquationIndex:=EquationIndex+1;
1463 | end;
1464 | if ExprArray[i].ClassName = 'IntTwoRing' then begin
1465 | AddEqIntegral([], 2, True);
1466 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1467 | EquationIndex:=EquationIndex+1;
1468 | end;
1469 | if ExprArray[i].ClassName = 'IntLimitBottomTwoRing' then begin
1470 | AddEqIntegral([goLimitBottom], 2, True);
1471 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1472 | EquationIndex:=EquationIndex+1;
1473 | end;
1474 | if ExprArray[i].ClassName = 'IntIndexBottomTwoRing' then begin
1475 | AddEqIntegral([goIndexBottom], 2, True);
1476 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1477 | EquationIndex:=EquationIndex+1;
1478 | end;
1479 | if ExprArray[i].ClassName = 'IntThreeRing' then begin
1480 | AddEqIntegral([], 3, True);
1481 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1482 | EquationIndex:=EquationIndex+1;
1483 | end;
1484 | if ExprArray[i].ClassName = 'IntLimitBottomThreeRing' then begin
1485 | AddEqIntegral([goLimitBottom], 3, True);
1486 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1487 | EquationIndex:=EquationIndex+1;
1488 | end;
1489 | if ExprArray[i].ClassName = 'IntIndexBottomThreeRing' then begin
1490 | AddEqIntegral([goIndexBottom], 3, True);
1491 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1492 | EquationIndex:=EquationIndex+1;
1493 | end;
1494 | if ExprArray[i].ClassName = 'Sum' then begin
1495 | AddEqSumma([]);
1496 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1497 | EquationIndex:=EquationIndex+1;
1498 | end;
1499 | if ExprArray[i].ClassName = 'SumLimitBottom' then begin
1500 | AddEqSumma([goLimitBottom]);
1501 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1502 | EquationIndex:=EquationIndex+1;
1503 | end;
1504 | if ExprArray[i].ClassName = 'SumLimitBottomTop' then begin
1505 | AddEqSumma([goLimitTop, goLimitBottom]);
1506 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1507 | EquationIndex:=EquationIndex+1;
1508 | end;
1509 | if ExprArray[i].ClassName = 'SumIndexBottom' then begin
1510 | AddEqSumma([goIndexBottom]);
1511 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1512 | EquationIndex:=EquationIndex+1;
1513 | end;
1514 | if ExprArray[i].ClassName = 'SumIndexBottomTop' then begin
1515 | AddEqSumma([goIndexTop, goIndexBottom]);
1516 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1517 | EquationIndex:=EquationIndex+1;
1518 | end;
1519 | if ExprArray[i].ClassName = 'Multiply' then begin
1520 | AddEqMultiply([]);
1521 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1522 | EquationIndex:=EquationIndex+1;
1523 | end;
1524 | if ExprArray[i].ClassName = 'MultiplyLimitBottom' then begin
1525 | AddEqMultiply([goLimitBottom]);
1526 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1527 | EquationIndex:=EquationIndex+1;
1528 | end;
1529 | if ExprArray[i].ClassName = 'MultiplyLimitBottomTop' then begin
1530 | AddEqMultiply([goLimitTop, goLimitBottom]);
1531 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1532 | EquationIndex:=EquationIndex+1;
1533 | end;
1534 | if ExprArray[i].ClassName = 'MultiplyIndexBottom' then begin
1535 | AddEqMultiply([goIndexBottom]);
1536 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1537 | EquationIndex:=EquationIndex+1;
1538 | end;
1539 | if ExprArray[i].ClassName = 'MultiplyBottomTop' then begin
1540 | AddEqMultiply([goIndexTop, goIndexBottom]);
1541 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1542 | EquationIndex:=EquationIndex+1;
1543 | end;
1544 | if ExprArray[i].ClassName = 'CoMult' then begin
1545 | AddEqCoMult([]);
1546 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1547 | EquationIndex:=EquationIndex+1;
1548 | end;
1549 | if ExprArray[i].ClassName = 'CoMultLimitBottom' then begin
1550 | AddEqCoMult([goLimitBottom]);
1551 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1552 | EquationIndex:=EquationIndex+1;
1553 | end;
1554 | if ExprArray[i].ClassName = 'CoMultLimitBottomTop' then begin
1555 | AddEqCoMult([goLimitTop, goLimitBottom]);
1556 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1557 | EquationIndex:=EquationIndex+1;
1558 | end;
1559 | if ExprArray[i].ClassName = 'CoMultIndexBottom' then begin
1560 | AddEqCoMult([goIndexBottom]);
1561 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1562 | EquationIndex:=EquationIndex+1;
1563 | end;
1564 | if ExprArray[i].ClassName = 'CoMultBottomTop' then begin
1565 | AddEqCoMult([goIndexTop, goIndexBottom]);
1566 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1567 | EquationIndex:=EquationIndex+1;
1568 | end;
1569 | if ExprArray[i].ClassName = 'Intersection' then begin
1570 | AddEqIntersection([]);
1571 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1572 | EquationIndex:=EquationIndex+1;
1573 | end;
1574 | if ExprArray[i].ClassName = 'IntersectionLimitBottom' then begin
1575 | AddEqIntersection([goLimitBottom]);
1576 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1577 | EquationIndex:=EquationIndex+1;
1578 | end;
1579 | if ExprArray[i].ClassName = 'IntersectionLimitBottomTop' then begin
1580 | AddEqIntersection([goLimitTop, goLimitBottom]);
1581 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1582 | EquationIndex:=EquationIndex+1;
1583 | end;
1584 | if ExprArray[i].ClassName = 'IntersectionIndexBottom' then begin
1585 | AddEqIntersection([goIndexBottom]);
1586 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1587 | EquationIndex:=EquationIndex+1;
1588 | end;
1589 | if ExprArray[i].ClassName = 'IntersectionBottomTop' then begin
1590 | AddEqIntersection([goIndexTop, goIndexBottom]);
1591 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1592 | EquationIndex:=EquationIndex+1;
1593 | end;
1594 | if ExprArray[i].ClassName = 'Join' then begin
1595 | AddEqJoin([]);
1596 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1597 | EquationIndex:=EquationIndex+1;
1598 | end;
1599 | if ExprArray[i].ClassName = 'JoinLimitBottom' then begin
1600 | AddEqJoin([goLimitBottom]);
1601 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1602 | EquationIndex:=EquationIndex+1;
1603 | end;
1604 | if ExprArray[i].ClassName = 'JoinLimitBottomTop' then begin
1605 | AddEqJoin([goLimitTop, goLimitBottom]);
1606 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1607 | EquationIndex:=EquationIndex+1;
1608 | end;
1609 | if ExprArray[i].ClassName = 'JoinIndexBottom' then begin
1610 | AddEqJoin([goIndexBottom]);
1611 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1612 | EquationIndex:=EquationIndex+1;
1613 | end;
1614 | if ExprArray[i].ClassName = 'JoinBottomTop' then begin
1615 | AddEqJoin([goIndexTop, goIndexBottom]);
1616 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1617 | EquationIndex:=EquationIndex+1;
1618 | end;
1619 |
1620 | if ExprArray[i].ClassName = 'ArrowkaRightaeTop' then begin
1621 | AddEqArrow([kaRight], aeTop);
1622 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1623 | EquationIndex:=EquationIndex+1;
1624 | end;
1625 | if ExprArray[i].ClassName = 'ArrowkaLeftaeTop' then begin
1626 | AddEqArrow([kaLeft], aeTop);
1627 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1628 | EquationIndex:=EquationIndex+1;
1629 | end;
1630 | if ExprArray[i].ClassName = 'ArrowkaRightkaLeftaeTop' then begin
1631 | AddEqArrow([kaRight, kaLeft], aeTop);
1632 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1633 | EquationIndex:=EquationIndex+1;
1634 | end;
1635 | if ExprArray[i].ClassName = 'ArrowkaRightaeBottom' then begin
1636 | AddEqArrow([kaRight], aeBottom);
1637 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1638 | EquationIndex:=EquationIndex+1;
1639 | end;
1640 | if ExprArray[i].ClassName = 'ArrowkaLeftaeBottom' then begin
1641 | AddEqArrow([kaLeft], aeBottom);
1642 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1643 | EquationIndex:=EquationIndex+1;
1644 | end;
1645 | if ExprArray[i].ClassName = 'ArrowkaRightkaLeftaeBottom' then begin
1646 | AddEqArrow([kaRight, kaLeft], aeBottom);
1647 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1648 | EquationIndex:=EquationIndex+1;
1649 | end;
1650 | if ExprArray[i].ClassName = 'Square' then begin
1651 | AddEqSquare;
1652 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1653 | EquationIndex:=EquationIndex+1;
1654 | end;
1655 | if ExprArray[i].ClassName = 'Division' then begin
1656 | AddEqDivision;
1657 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1658 | EquationIndex:=EquationIndex+1;
1659 | end;
1660 | if ExprArray[i].ClassName = 'VectoraeBottom' then begin
1661 | AddEqVector([], aeBottom);
1662 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1663 | EquationIndex:=EquationIndex+1;
1664 | end;
1665 | if ExprArray[i].ClassName = 'VectorkaDoubleaeBottom' then begin
1666 | AddEqVector([kaDouble], aeBottom);
1667 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1668 | EquationIndex:=EquationIndex+1;
1669 | end;
1670 | if ExprArray[i].ClassName = 'VectoraeTop' then begin
1671 | AddEqVector([], aeTop);
1672 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1673 | EquationIndex:=EquationIndex+1;
1674 | end;
1675 | if ExprArray[i].ClassName = 'VectorkaDoubleaeTop' then begin
1676 | AddEqVector([kaDouble], aeTop);
1677 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1678 | EquationIndex:=EquationIndex+1;
1679 | end;
1680 | if ExprArray[i].ClassName = 'VectorkaRightaeBottom' then begin
1681 | AddEqVector([kaRight], aeBottom);
1682 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1683 | EquationIndex:=EquationIndex+1;
1684 | end;
1685 | if ExprArray[i].ClassName = 'VectorkaLeftaeBottom' then begin
1686 | AddEqVector([kaLeft], aeBottom);
1687 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1688 | EquationIndex:=EquationIndex+1;
1689 | end;
1690 | if ExprArray[i].ClassName = 'VectorkaRightkaLeftaeBottom' then begin
1691 | AddEqVector([kaRight, kaLeft], aeBottom);
1692 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1693 | EquationIndex:=EquationIndex+1;
1694 | end;
1695 | if ExprArray[i].ClassName = 'VectorkaRightaeTop' then begin
1696 | AddEqVector([kaRight], aeTop);
1697 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1698 | EquationIndex:=EquationIndex+1;
1699 | end;
1700 | if ExprArray[i].ClassName = 'VectorkaLeftaeTop' then begin
1701 | AddEqVector([kaLeft], aeTop);
1702 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1703 | EquationIndex:=EquationIndex+1;
1704 | end;
1705 | if ExprArray[i].ClassName = 'VectorkaRightkaLeftaeTop' then begin
1706 | AddEqVector([kaRight, kaLeft], aeTop);
1707 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1708 | EquationIndex:=EquationIndex+1;
1709 | end;
1710 | if ExprArray[i].ClassName = 'MatrixkmHoriz' then begin
1711 | AddEqMatrix(kmHoriz, 0);
1712 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1713 | EquationIndex:=EquationIndex+1;
1714 | end;
1715 | if ExprArray[i].ClassName = 'MatrixkmVert' then begin
1716 | AddEqMatrix(kmVert, 0);
1717 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1718 | EquationIndex:=EquationIndex+1;
1719 | end;
1720 | if ExprArray[i].ClassName = 'MatrixkmSquare' then begin
1721 | AddEqMatrix(kmSquare, 0);
1722 | FEquationList.Items[FEquationIndex].Data:=ExprArray[i].ExprData;
1723 | EquationIndex:=EquationIndex+1;
1724 | end;
1725 | end;
1726 | end;
1727 |
1728 | procedure TEditArea.SetEquationIndex(AValue: Integer);
1729 | begin
1730 | if (AValue>=0)and(AValue<=EquationList.Count) then FEquationIndex := AValue;
1731 | RefreshCursor;
1732 | end;
1733 |
1734 | procedure TEditArea.SetEquationList(AValue: TEquationList);
1735 | begin
1736 | FEquationList := AValue;
1737 | end;
1738 |
1739 | procedure TEditArea.WMLButtonDown(var Message: TWMLButtonDown);
1740 | begin
1741 | MainArea.SetFocus;
1742 | Active:=True;
1743 | end;
1744 |
1745 |
1746 | {
1747 | ********************************** TEquation ***********************************
1748 | }
1749 | constructor TEquation.Create(AOwner: TComponent);
1750 | begin
1751 | inherited Create(AOwner);
1752 | Parent:=AOwner as TEditArea;
1753 | Kp:=1;
1754 | end;
1755 |
1756 | function TEquation.CalcHeight: Integer;
1757 | begin
1758 | Result := 0;
1759 | end;
1760 |
1761 | function TEquation.CalcWidth: Integer;
1762 | begin
1763 | Result := 0;
1764 | end;
1765 |
1766 | function TEquation.GetData: string;
1767 | begin
1768 | end;
1769 |
1770 | function TEquation.GetMidLine: Integer;
1771 | begin
1772 | Result:=Height div 2;
1773 | end;
1774 |
1775 | function TEquation.GetParent: TEditArea;
1776 | begin
1777 | Result := TEditArea(inherited Parent);
1778 | end;
1779 |
1780 | procedure TEquation.Paint;
1781 | begin
1782 | end;
1783 |
1784 | procedure TEquation.PutParent(AValue: TEditArea);
1785 | begin
1786 | inherited Parent := AValue;
1787 | end;
1788 |
1789 | procedure TEquation.SetCanvasFont;
1790 | begin
1791 | Canvas.Pen.Style := psSolid;
1792 | Canvas.Pen.Color:=BkColor;
1793 | Canvas.Brush.Style := bsClear;
1794 | Canvas.Brush.Color:=BkColor;
1795 | Canvas.Font.Assign(Font);
1796 | end;
1797 |
1798 | procedure TEquation.SetData(const AValue: string);
1799 | begin
1800 | end;
1801 |
1802 | procedure TEquation.SetUpdateState(Updating: Boolean);
1803 | begin
1804 | if not Updating then RefreshEditArea;
1805 | end;
1806 |
1807 | procedure TEquation.WMLButtonDown(var Message: TWMLButtonDown);
1808 | begin
1809 | Parent.WMLButtonDown(Message);
1810 | end;
1811 |
1812 | {
1813 | ********************************** TEqSimple ***********************************
1814 | }
1815 | function TEqSimple.CalcHeight: Integer;
1816 | begin
1817 | SetCanvasFont;
1818 | Result:=Canvas.TextHeight(Ch);
1819 | end;
1820 |
1821 | function TEqSimple.CalcWidth: Integer;
1822 | begin
1823 | SetCanvasFont;
1824 | Result:=Canvas.TextWidth(Ch);
1825 | end;
1826 |
1827 | function TEqSimple.GetData: string;
1828 | begin
1829 | Result:=Ch;
1830 | end;
1831 |
1832 | procedure TEqSimple.Paint;
1833 | begin
1834 | Canvas.TextOut(0,0,Ch);
1835 | end;
1836 |
1837 | procedure TEqSimple.RefreshDimensions;
1838 | begin
1839 | Height:=CalcHeight;
1840 | Width:=CalcWidth;
1841 | end;
1842 |
1843 | {
1844 | ********************************* TEqExtSymbol *********************************
1845 | }
1846 | function TEqExtSymbol.CalcHeight: Integer;
1847 | var
1848 | Size: TSize;
1849 | begin
1850 | SetCanvasFont;
1851 | GetTextExtentPoint32W(Canvas.Handle,@Symbol,1,Size);
1852 | Result:=Size.CY
1853 | end;
1854 |
1855 | function TEqExtSymbol.CalcWidth: Integer;
1856 | var
1857 | Size: TSize;
1858 | begin
1859 | SetCanvasFont;
1860 | GetTextExtentPoint32W(Canvas.Handle,@Symbol,1,Size);
1861 | Result:=Size.CX;
1862 | end;
1863 |
1864 | function TEqExtSymbol.GetData: string;
1865 | begin
1866 | Result:=IntToStr(Integer(Symbol));
1867 | end;
1868 |
1869 | procedure TEqExtSymbol.Paint;
1870 | begin
1871 | TextOutW(Canvas.Handle,0,0,@Symbol,1)
1872 | end;
1873 |
1874 | procedure TEqExtSymbol.RefreshDimensions;
1875 | begin
1876 | Height:=CalcHeight;
1877 | Width:=CalcWidth;
1878 | end;
1879 |
1880 | {
1881 | ********************************** TEqParent ***********************************
1882 | }
1883 | constructor TEqParent.Create(AOwner: TComponent);
1884 | begin
1885 | inherited Create(AOwner);
1886 | FEditAreaList:=TEditAreaList.Create;
1887 | FEditAreaIndex:=0;
1888 | end;
1889 |
1890 | destructor TEqParent.Destroy;
1891 | begin
1892 | FEditAreaList.Free;
1893 | inherited;
1894 | end;
1895 |
1896 | function TEqParent.GetData: string;
1897 | begin
1898 | Result:=Format('EditArea(%s)',[EditAreaList.Items[0].Data]);
1899 | end;
1900 |
1901 | procedure TEqParent.InsertEditArea;
1902 | begin
1903 | FEditAreaList.Insert(FEditAreaIndex, TEditArea.Create(Self));
1904 | FEditAreaList.Items[FEditAreaIndex].Parent:=Self;
1905 | FEditAreaList.Items[FEditAreaIndex].MainArea:=Parent.MainArea;
1906 | FEditAreaList.Items[FEditAreaIndex].Font:=Font;
1907 | FEditAreaList.Items[FEditAreaIndex].Font.Size:=Round(Font.Size*Kp);
1908 | FEditAreaList.Items[FEditAreaIndex].BkColor:=Parent.BkColor;
1909 | FEditAreaList.Items[FEditAreaIndex].Index:=FEditAreaIndex;
1910 | FEditAreaList.Items[FEditAreaIndex].RefreshDimensions;
1911 | RefreshEditArea(FEditAreaIndex);
1912 | FEditAreaList.Items[FEditAreaIndex].Active:=True;
1913 | end;
1914 |
1915 | procedure TEqParent.SetBkColor(AValue: TColor);
1916 | var
1917 | i: Integer;
1918 | begin
1919 | FBkColor := AValue;
1920 | for i:=0 to FEditAreaList.Count-1 do begin
1921 | FEditAreaList.Items[i].BkColor:=FBkColor;
1922 | end;
1923 | Repaint;
1924 | end;
1925 |
1926 | procedure TEqParent.SetData(const AValue: string);
1927 | var
1928 | ExprArray: TExprArray;
1929 | begin
1930 | FEditAreaIndex:=0;
1931 | ExprArray:=GetExprData(AValue);
1932 | if Length(ExprArray)>0 then begin
1933 | if ExprArray[0].ClassName = 'EditArea' then begin
1934 | FEditAreaList.Items[0].Data:=ExprArray[0].ExprData;
1935 | end;
1936 | end;
1937 | end;
1938 |
1939 | {
1940 | ********************************** TEqGroupOp **********************************
1941 | }
1942 | function TEqGroupOp.CalcHeight: Integer;
1943 | begin
1944 | Result:=TopMargin+GetCommonHeight;
1945 | if goIndexBottom in FGroupOptions then Result:=Result+FIndexBottom.Height div 2;
1946 | if goLimitBottom in FGroupOptions then Result:=Result+FLimitBottom.Height;
1947 | end;
1948 |
1949 | function TEqGroupOp.CalcSymbolHeight: Integer;
1950 | var
1951 | Sz: TSize;
1952 | begin
1953 | SetCanvasFont;
1954 | GetTextExtentPoint32W(Canvas.Handle,@FSymbol,1,Sz);
1955 | Result:=Sz.cy;
1956 | end;
1957 |
1958 | function TEqGroupOp.CalcSymbolWidth: Integer;
1959 | var
1960 | Sz: TSize;
1961 | begin
1962 | SetCanvasFont;
1963 | GetTextExtentPoint32W(Canvas.Handle,@FSymbol,1,Sz);
1964 | Result:=Sz.cx*FSize+FSize;
1965 | end;
1966 |
1967 | function TEqGroupOp.CalcWidth: Integer;
1968 | begin
1969 | Result:=GetCommonWidth+FEditAreaList.Items[0].Width;
1970 | end;
1971 |
1972 | constructor TEqGroupOp.Create(AOwner: TComponent);
1973 | begin
1974 | inherited Create(AOwner);
1975 | Symbol:=WideChar(0);
1976 | FGroupOptions:=[];
1977 | FRing:=False;
1978 | FSize:=1;
1979 | FEditAreaIndex:=0;
1980 | InsertEditArea;
1981 | end;
1982 |
1983 | function TEqGroupOp.GetCommonHeight: Integer;
1984 | begin
1985 | Result:=Max(SymbolHeight,EditAreaList.Items[0].Height);
1986 | end;
1987 |
1988 | function TEqGroupOp.GetCommonWidth: Integer;
1989 | var EAWidth: Integer;
1990 | begin
1991 | Result:=SymbolWidth;
1992 | EAWidth:=0;
1993 | if (goLimitTop in FGroupOptions)or(goLimitBottom in FGroupOptions) then begin
1994 | if goLimitTop in FGroupOptions then EAWidth:=Max(EAWidth, FLimitTop.Width);
1995 | if goLimitBottom in FGroupOptions then EAWidth:=Max(EAWidth, FLimitBottom.Width);
1996 | Result:=Max(Result, EAWidth);
1997 | end;
1998 | if (goIndexTop in FGroupOptions)or(goIndexBottom in FGroupOptions) then begin
1999 | if goIndexTop in FGroupOptions then EAWidth:=Max(EAWidth, FIndexTop.Width);
2000 | if goIndexBottom in FGroupOptions then EAWidth:=Max(EAWidth, FIndexBottom.Width);
2001 | Result:=Result+EAWidth;
2002 | end;
2003 | end;
2004 |
2005 | function TEqGroupOp.GetMidLine: Integer;
2006 | begin
2007 | Result:=TopMargin+CalcSymbolHeight div 2;
2008 | end;
2009 |
2010 | function TEqGroupOp.GetTopMargin: Integer;
2011 | begin
2012 | Result:=0;
2013 | if goIndexTop in FGroupOptions then Result:=FIndexTop.Height div 2;
2014 | if goLimitTop in FGroupOptions then Result:=FLimitTop.Height;
2015 | end;
2016 |
2017 | function TEqGroupOp.GetSymbolHeight: Integer;
2018 | begin
2019 | Result:=CalcSymbolHeight;
2020 | end;
2021 |
2022 | function TEqGroupOp.GetSymbolWidth: Integer;
2023 | begin
2024 | Result:=CalcSymbolWidth;
2025 | end;
2026 |
2027 | procedure TEqGroupOp.Paint;
2028 | var
2029 | Sz: TSize;
2030 | SymbolLeft, SymbolTop: Integer;
2031 | procedure DrawSymbol;
2032 | var i: Integer;
2033 | begin
2034 | for i:=0 to FSize-1 do begin
2035 | TextOutW(Canvas.Handle,SymbolLeft+(Sz.cx+1)*i,SymbolTop,@Symbol,1);
2036 | end;
2037 | end;
2038 | procedure DrawRing();
2039 | var MLine: Integer;
2040 | begin
2041 | MLine:=SymbolTop+SymbolHeight div 2;
2042 | Canvas.Pen.Style:=psSolid;
2043 | Canvas.Pen.Width:=Font.Size div 15;
2044 | Canvas.Pen.Color:=Font.Color;
2045 | Canvas.Brush.Style:=bsClear;
2046 | Canvas.Ellipse(SymbolLeft,
2047 | MLine-Font.Size div 3,
2048 | SymbolLeft+Sz.cx*FSize+FSize,
2049 | MLine+Font.Size div 3);
2050 | end;
2051 | begin
2052 | SetCanvasFont;
2053 | GetTextExtentPoint32W(Canvas.Handle,@Symbol,1,Sz);
2054 | SymbolLeft:=0;
2055 | if (goLimitTop in FGroupOptions)or(goLimitBottom in FGroupOptions) then
2056 | SymbolLeft:=(GetCommonWidth-SymbolWidth) div 2;
2057 | if (goIndexTop in FGroupOptions)or(goIndexBottom in FGroupOptions) then
2058 | SymbolLeft:=0;
2059 | SymbolTop:=TopMargin+(GetCommonHeight-SymbolHeight) div 2;
2060 | Canvas.Rectangle(0, 0, Width, Height);
2061 | DrawSymbol;
2062 | if FRing then DrawRing;
2063 | end;
2064 |
2065 | procedure TEqGroupOp.RefreshDimensions;
2066 | begin
2067 | Height:=CalcHeight;
2068 | Width:=CalcWidth;
2069 | end;
2070 |
2071 | procedure TEqGroupOp.RefreshEA(AEditArea: TEditArea; AKp: Double);
2072 | begin
2073 | AEditArea.BkColor:=Parent.BkColor;
2074 | AEditArea.Font.Assign(Font);
2075 | AEditArea.Font.Size:=Round(Font.Size*Kp*AKp);
2076 | AEditArea.RefreshDimensions;
2077 | AEditArea.Index:=FEditAreaList.IndexOf(AEditArea);
2078 | end;
2079 |
2080 | procedure TEqGroupOp.RefreshEditArea(AEditAreaIndex: Integer = 0);
2081 | var
2082 | CommonHeight, CommonWidth: Integer;
2083 | begin
2084 | if FUpdateCount>0 then Exit;
2085 | if goLimitTop in FGroupOptions then RefreshEA(FLimitTop, 0.8);
2086 | if goLimitBottom in FGroupOptions then RefreshEA(FLimitBottom, 0.8);
2087 | if goIndexTop in FGroupOptions then RefreshEA(FIndexTop, 0.8);
2088 | if goIndexBottom in FGroupOptions then RefreshEA(FIndexBottom, 0.8);
2089 | CommonWidth:=GetCommonWidth;
2090 | RefreshEA(EditAreaList.Items[0], 1);
2091 | CommonHeight:=GetCommonHeight;
2092 | if goLimitTop in FGroupOptions then begin
2093 | FLimitTop.Top:=0;
2094 | FLimitTop.Left:=(CommonWidth-FLimitTop.Width) div 2;
2095 | end;
2096 | if goIndexTop in FGroupOptions then begin
2097 | FIndexTop.Top:=0;
2098 | FIndexTop.Left:=SymbolWidth;
2099 | end;
2100 | if goLimitBottom in FGroupOptions then begin
2101 | FLimitBottom.Top:=TopMargin+CommonHeight;
2102 | FLimitBottom.Left:=(CommonWidth-FLimitBottom.Width) div 2;
2103 | end;
2104 | if goIndexBottom in FGroupOptions then begin
2105 | FIndexBottom.Top:=TopMargin+CommonHeight-FIndexBottom.Height div 2;
2106 | FIndexBottom.Left:=SymbolWidth;
2107 | end;
2108 | EditAreaList.Items[0].Left:=CommonWidth;
2109 | EditAreaList.Items[0].Top:=TopMargin+(CommonHeight-EditAreaList.Items[0].Height) div 2;
2110 | Parent.RefreshEquations;
2111 | end;
2112 |
2113 | function TEqGroupOp.GetData: string;
2114 | begin
2115 | Result:=Format('EditArea(%s)',[EditAreaList.Items[0].Data]);
2116 | if goLimitBottom in FGroupOptions then Result:=Result+Format('EditArea(%s)',[FLimitBottom.Data]);
2117 | if goLimitTop in FGroupOptions then Result:=Result+Format('EditArea(%s)',[FLimitTop.Data]);
2118 | if goIndexBottom in FGroupOptions then Result:=Result+Format('EditArea(%s)',[FIndexBottom.Data]);
2119 | if goIndexTop in FGroupOptions then Result:=Result+Format('EditArea(%s)',[FIndexTop.Data]);
2120 | end;
2121 |
2122 | procedure TEqGroupOp.SetData(const AValue: String);
2123 | var
2124 | i: Integer;
2125 | ExprArray: TExprArray;
2126 | begin
2127 | ExprArray:=GetExprData(AValue);
2128 | for i:=0 to Length(ExprArray)-1 do begin
2129 | if ExprArray[i].ClassName = 'EditArea' then if i0 then Exit;
2274 | if goIndexTop in FGroupOptions then begin
2275 | RefreshEA(FIndexTop);
2276 | FIndexTop.Top:=0;
2277 | FIndexTop.Left:=0;
2278 | end;
2279 | if goIndexBottom in FGroupOptions then begin
2280 | RefreshEA(FIndexBottom);
2281 | FIndexBottom.Top:=Font.Size div 2;
2282 | if goIndexTop in FGroupOptions then FIndexBottom.Top:=FIndexBottom.Top+FIndexTop.Height;
2283 | FIndexBottom.Left:=0;
2284 | end;
2285 | Parent.RefreshEquations;
2286 | end;
2287 |
2288 | procedure TEqIndex.SetGroupOptions(const Value: TGroupOptions);
2289 | begin
2290 | FGroupOptions := Value;
2291 | BeginUpdate;
2292 | if goIndexTop in FGroupOptions then begin
2293 | InsertEditArea;
2294 | FIndexTop:=EditAreaList.Items[EditAreaIndex];
2295 | end;
2296 | if goIndexBottom in FGroupOptions then begin
2297 | InsertEditArea;
2298 | FIndexBottom:=EditAreaList.Items[EditAreaIndex];
2299 | end;
2300 | EndUpdate;
2301 | end;
2302 |
2303 | function TEqIndex.GetData: string;
2304 | begin
2305 | Result:='';
2306 | if goIndexBottom in FGroupOptions then Result:=Result+Format('EditArea(%s)',[FIndexBottom.Data]);
2307 | if goIndexTop in FGroupOptions then Result:=Result+Format('EditArea(%s)',[FIndexTop.Data]);
2308 | end;
2309 |
2310 | procedure TEqIndex.SetData(const AValue: String);
2311 | var
2312 | i: Integer;
2313 | ExprArray: TExprArray;
2314 | begin
2315 | ExprArray:=GetExprData(AValue);
2316 | for i:=0 to Length(ExprArray)-1 do begin
2317 | if ExprArray[i].ClassName = 'EditArea' then if i0 then Exit;
2666 | RefreshEA(FEditAreaList.Items[0]);
2667 | FEditAreaList.Items[0].Top:=0;
2668 | RefreshEA(FEditAreaList.Items[1]);
2669 | FEditAreaList.Items[1].Top:=FEditAreaList.Items[0].Height+ArrowHeight;
2670 |
2671 | Parent.RefreshEquations;
2672 | end;
2673 |
2674 | function TEqDivision.GetData: String;
2675 | begin
2676 | Result:=Format('EditArea(%s)',[EditAreaList.Items[0].Data])+Format('EditArea(%s)',[EditAreaList.Items[1].Data]);
2677 | end;
2678 |
2679 | procedure TEqDivision.SetData(const AValue: String);
2680 | var
2681 | i: Integer;
2682 | ExprArray: TExprArray;
2683 | begin
2684 | ExprArray:=GetExprData(AValue);
2685 | for i:=0 to Length(ExprArray)-1 do begin
2686 | if ExprArray[i].ClassName = 'EditArea' then if i0 then Exit;
2918 | dx:=GetDX; dy:=GetDY;
2919 | for i:=0 to FCountEA-1 do RefreshEA(FEditAreaList.Items[i]);
2920 | CommonHeight:=0;
2921 | for i:=0 to dy-1 do begin
2922 | RowHeight:=GetRowHeight(i);
2923 | for j:=0 to dx-1 do
2924 | FEditAreaList.Items[i*dx+j].Top:=CommonHeight+(RowHeight-FEditAreaList.Items[i*dx+j].Height) div 2;
2925 |
2926 | Inc(CommonHeight,RowHeight+10);
2927 | end;
2928 | CommonWidth:=0;
2929 | for j:=0 to dx-1 do begin
2930 | ColWidth:=GetColWidth(j);
2931 | for i:=0 to dy-1 do begin
2932 | FEditAreaList.Items[i*dx+j].Left:=CommonWidth+(ColWidth-FEditAreaList.Items[i*dx+j].Width) div 2;
2933 | end;
2934 | Inc(CommonWidth,ColWidth+10);
2935 | end;
2936 |
2937 | Parent.RefreshEquations;
2938 | end;
2939 |
2940 | procedure TEqMatrix.RefreshEA(AEditArea: TEditArea);
2941 | begin
2942 | AEditArea.BkColor:=Parent.BkColor;
2943 | AEditArea.Font.Assign(Font);
2944 | AEditArea.Font.Size:=Round(Font.Size*Kp);
2945 | AEditArea.RefreshDimensions;
2946 | AEditArea.Index:=FEditAreaList.IndexOf(AEditArea);
2947 | end;
2948 |
2949 | procedure TEqMatrix.SetKindMatrix(const Value: TKindMatrix);
2950 | begin
2951 | FKindMatrix := Value;
2952 | RefreshEditArea;
2953 | end;
2954 |
2955 | procedure TEqMatrix.SetCountEA(const Value: Integer);
2956 | begin
2957 | FCountEA:=EditAreaList.Count;
2958 | BeginUpdate;
2959 | while FCountEA < Value do begin
2960 | FEditAreaIndex:=FCountEA-1;
2961 | InsertEditArea;
2962 | Inc(FCountEA);
2963 | end;
2964 | EndUpdate;
2965 | end;
2966 |
2967 |
2968 | end.
2969 |
--------------------------------------------------------------------------------