chemtext: Initial commit

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5958 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2017-06-25 15:56:27 +00:00
parent 146b28a4cc
commit 8094316fc5
12 changed files with 1157 additions and 0 deletions

View File

@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="10"/>
<PathDelim Value="\"/>
<General>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="project1"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
<Icon Value="0"/>
</General>
<BuildModes Count="1">
<Item1 Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
</local>
</RunParams>
<RequiredPackages Count="2">
<Item1>
<PackageName Value="laz_chemtext"/>
</Item1>
<Item2>
<PackageName Value="LCL"/>
</Item2>
</RequiredPackages>
<Units Count="2">
<Unit0>
<Filename Value="project1.lpr"/>
<IsPartOfProject Value="True"/>
</Unit0>
<Unit1>
<Filename Value="unit1.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="Unit1"/>
</Unit1>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="project1"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<OtherUnitFiles Value="..\source"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Linking>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

View File

@ -0,0 +1,21 @@
program project1;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, Unit1
{ you can add units after this };
{$R *.res}
begin
RequireDerivedFormResource := True;
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

View File

@ -0,0 +1,169 @@
object Form1: TForm1
Left = 280
Height = 418
Top = 130
Width = 435
Caption = 'Form1'
ClientHeight = 418
ClientWidth = 435
OnCreate = FormCreate
LCLVersion = '1.9.0.0'
object RadioGroup1: TRadioGroup
Left = 13
Height = 330
Top = 74
Width = 195
Anchors = [akTop, akLeft, akBottom]
AutoFill = True
Caption = 'Formula'
ChildSizing.LeftRightSpacing = 6
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
ChildSizing.EnlargeVertical = crsHomogenousChildResize
ChildSizing.ShrinkHorizontal = crsScaleChilds
ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1
ClientHeight = 310
ClientWidth = 191
ItemIndex = 0
Items.Strings = (
'H'
'H+'
'2H+'
'O--'
'H2O'
'C3H7OH'
'(CH3)3COH'
'2H+ + O--'
'H + Cl -> HCl'
'H + Cl --> HCl'
'2 H+ + O-- <-> H2O'
'2 H+ + O-- <--> H2O'
'H2O <- 2H + O'
'H2O <-- 2H + O'
)
OnClick = RadioGroup1Click
TabOrder = 0
end
object CbDefaultFontSize: TCheckBox
Left = 335
Height = 19
Top = 354
Width = 83
Caption = 'Default font'
Checked = True
OnChange = CbDefaultFontSizeChange
State = cbChecked
TabOrder = 1
end
object RadioGroup2: TRadioGroup
Left = 224
Height = 142
Top = 74
Width = 185
AutoFill = True
Caption = 'Arrow'
ChildSizing.LeftRightSpacing = 6
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
ChildSizing.EnlargeVertical = crsHomogenousChildResize
ChildSizing.ShrinkHorizontal = crsScaleChilds
ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1
ClientHeight = 122
ClientWidth = 181
ItemIndex = 0
Items.Strings = (
'ASCII single'
'ASCII double'
'UTF8 '
'UTF8 single'
'UTF8 double'
'UTF8 half'
)
OnClick = RadioGroup2Click
TabOrder = 2
end
object RadioGroup3: TRadioGroup
Left = 224
Height = 43
Top = 232
Width = 185
AutoFill = True
Caption = 'Alignment'
ChildSizing.LeftRightSpacing = 6
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
ChildSizing.EnlargeVertical = crsHomogenousChildResize
ChildSizing.ShrinkHorizontal = crsScaleChilds
ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 3
ClientHeight = 23
ClientWidth = 181
Columns = 3
ItemIndex = 0
Items.Strings = (
'left'
'center'
'right'
)
OnClick = RadioGroup3Click
TabOrder = 3
end
object CheckBox2: TCheckBox
Left = 335
Height = 19
Top = 330
Width = 65
Caption = 'Autosize'
OnChange = CheckBox2Change
TabOrder = 4
end
object RadioGroup4: TRadioGroup
Left = 224
Height = 88
Top = 298
Width = 97
AutoFill = True
Caption = 'Layout'
ChildSizing.LeftRightSpacing = 6
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
ChildSizing.EnlargeVertical = crsHomogenousChildResize
ChildSizing.ShrinkHorizontal = crsScaleChilds
ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1
ClientHeight = 68
ClientWidth = 93
ItemIndex = 0
Items.Strings = (
'tlTop'
'tlCenter'
'tlBottom'
)
OnClick = RadioGroup4Click
TabOrder = 5
end
object CheckBox3: TCheckBox
Left = 335
Height = 19
Top = 306
Width = 62
Caption = 'Enabled'
Checked = True
OnChange = CheckBox3Change
State = cbChecked
TabOrder = 6
end
object SpinEdit1: TSpinEdit
Left = 352
Height = 23
Top = 381
Width = 50
Alignment = taRightJustify
OnChange = SpinEdit1Change
TabOrder = 7
Value = 20
Visible = False
end
end

View File

@ -0,0 +1,124 @@
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
ExtCtrls, Spin, ChemText;
type
{ TForm1 }
TForm1 = class(TForm)
CbDefaultFontSize: TCheckBox;
CheckBox2: TCheckBox;
CheckBox3: TCheckBox;
RadioGroup1: TRadioGroup;
RadioGroup2: TRadioGroup;
RadioGroup3: TRadioGroup;
RadioGroup4: TRadioGroup;
SpinEdit1: TSpinEdit;
procedure CbDefaultFontSizeChange(Sender: TObject);
procedure CheckBox2Change(Sender: TObject);
procedure CheckBox3Change(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure RadioGroup1Click(Sender: TObject);
procedure RadioGroup2Click(Sender: TObject);
procedure RadioGroup3Click(Sender: TObject);
procedure RadioGroup4Click(Sender: TObject);
procedure SpinEdit1Change(Sender: TObject);
private
ChemLabel: TChemLabel;
public
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.CbDefaultFontSizeChange(Sender: TObject);
begin
if CbDefaultFontSize.Checked then
Chemlabel.Font.Size := 0
else
ChemLabel.Font.Size := SpinEdit1.Value;
SpinEdit1.Visible := not CbDefaultFontSize.Checked;
end;
procedure TForm1.CheckBox2Change(Sender: TObject);
begin
ChemLabel.AutoSize := Checkbox2.Checked;
if not ChemLabel.AutoSize then begin
ChemLabel.Width := Width - 2*ChemLabel.Left;
ChemLabel.Height := Radiogroup1.Top - 8 - 8;
end;
end;
procedure TForm1.CheckBox3Change(Sender: TObject);
begin
ChemLabel.Enabled := Checkbox3.Checked;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
ChemLabel := TChemLabel.Create(self);
ChemLabel.Parent := self;
ChemLabel.Left := 8;
ChemLabel.Top := 8;
ChemLabel.AutoSize := false;
Chemlabel.Height := 50;
ChemLabel.Width := ClientWidth - 2*Chemlabel.Left;
// ChemLabel.Anchors := [akLeft, akRight, akTop];
ChemLabel.Color := clWindow;
RadioGroup1Click(nil);
RadioGroup2Click(nil);
end;
procedure TForm1.RadioGroup1Click(Sender: TObject);
begin
Chemlabel.Caption := RadioGroup1.Items[Radiogroup1.ItemIndex];
end;
procedure TForm1.RadioGroup2Click(Sender: TObject);
begin
ChemLabel.Arrow := TChemArrow(RadioGroup2.ItemIndex);
end;
procedure TForm1.RadioGroup3Click(Sender: TObject);
begin
case Radiogroup3.ItemIndex of
0: ChemLabel.Alignment := taLeftJustify;
1: ChemLabel.Alignment := taCenter;
2: Chemlabel.Alignment := taRightJustify;
end;
end;
procedure TForm1.RadioGroup4Click(Sender: TObject);
begin
case Radiogroup4.ItemIndex of
0: ChemLabel.Layout := tlTop;
1: Chemlabel.Layout := tlCenter;
2: Chemlabel.Layout := tlBottom;
end;
end;
procedure TForm1.SpinEdit1Change(Sender: TObject);
begin
if not CbDefaultFontSize.Checked then
Chemlabel.Font.Size := SpinEdit1.Value;
ChemLabel.Invalidate;
end;
end.