diff --git a/components/chemtext/demo/runtime/project1.lpi b/components/chemtext/demo/runtime/project1.lpi index e1627a4a0..48bfc1299 100644 --- a/components/chemtext/demo/runtime/project1.lpi +++ b/components/chemtext/demo/runtime/project1.lpi @@ -57,6 +57,9 @@ + + + diff --git a/components/chemtext/readme.txt b/components/chemtext/readme.txt new file mode 100644 index 000000000..08cf09497 --- /dev/null +++ b/components/chemtext/readme.txt @@ -0,0 +1,29 @@ +-------------------------------------------------------------------------------- +CHEMTEXT +-------------------------------------------------------------------------------- + +This library is intended to display chemical formulas and equations with +automatically placed subscripts and superscripts. + +The procedure ChemTextOut draws the chemical text onto any canvas object +(useful for writing event handlers for user drawn lists and grids). +This procedure is used by the component TChemLabel to display chemical formulas +on the forms. + +The formulas are written in a straightforward way. The "2" in H2O is automatically +subscripted, and the + in H+ is automatically displayed as superscript. Note +that multiple-charge ions must repeat the charge sign, i.e. the double-negatively +charged oxygon ion must be written as O--, not as O2-. + +For chemical reactions, arrows can be entered as -->, <-- or <-->. The property +Arrow of the TChemLabel determines whether this simple is to be replaced by +a nice UTF8 character. + +The code is based on "chemtxt" written by Patrick Spanel +(Patrik.Spanel@jh-inst.cas.cz). It was adapted to Lazarus and extended by +Werner Pamler. + +The code does not work under Delphi any more. + +License: +LGPL with linking exception (the same license used by Lazarus). diff --git a/components/chemtext/source/chemtext.pas b/components/chemtext/source/chemtext.pas index 8b38a5ba8..c065bb6be 100644 --- a/components/chemtext/source/chemtext.pas +++ b/components/chemtext/source/chemtext.pas @@ -95,14 +95,12 @@ type { The following rotuines can be used in an event handler, for example in OnDrawDataCell of DBGrid: - procedure TForm1.DBGrid1DrawDataCell(Sender: TObject; - const Rect: TRect; Field: TField; State: - TGridDrawState); - begin - if Assigned(Field) then - ChemTextOut((Sender as TDBGrid).Canvas, Rect, Rect.Left, - Rect.Top, Field.DisplayText); - end; + procedure TForm1.DBGrid1DrawDataCell(Sender: TObject; const Rect: TRect; + Field: TField; State: TGridDrawState); + begin + if Assigned(Field) then + ChemTextOut((Sender as TDBGrid).Canvas, Rect.Left, Rect.Top, Field.DisplayText); + end; } function ChemTextOut(ACanvas: TCanvas; X, Y: integer;