home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 October / Chip_2001-10_cd1.bin / zkuste / delphi / kompon / d123456 / CHEMPLOT.ZIP / TPlot / Plotdefs.pas < prev    next >
Pascal/Delphi Source File  |  2001-07-30  |  22KB  |  717 lines

  1. unit Plotdefs;
  2.  
  3. {$I Plot.inc}
  4.  
  5. {-----------------------------------------------------------------------------
  6. The contents of this file are subject to the Q Public License
  7. ("QPL"); you may not use this file except in compliance
  8. with the QPL. You may obtain a copy of the QPL from 
  9. the file QPL.html in this distribution, derived from:
  10.  
  11. http://www.trolltech.com/products/download/freelicense/license.html
  12.  
  13. The QPL prohibits development of proprietary software. 
  14. There is a Professional Version of this software available for this. 
  15. Contact sales@chemware.hypermart.net for more information.
  16.  
  17. Software distributed under the QPL is distributed on an "AS IS" basis,
  18. WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the QPL for
  19. the specific language governing rights and limitations under the QPL.
  20.  
  21. The Original Code is: Menus.pas, released 16 october 2000.
  22.  
  23. The Initial Developer of the Original Code is Mat Ballard.
  24. Portions created by Mat Ballard are Copyright (C) 1999 Mat Ballard.
  25. Portions created by Microsoft are Copyright (C) 1998, 1999 Microsoft Corp.
  26. All Rights Reserved.
  27.  
  28. Contributor(s): Mat Ballard                 e-mail: mat.ballard@chemware.hypermart.net.
  29.  
  30. Last Modified: 04/16/2001
  31.  
  32. You may retrieve the latest version of this file from:
  33.  
  34.         http://Chemware.hypermart.net/
  35.  
  36. This work was created with the Project JEDI VCL guidelines:
  37.  
  38.         http://www.delphi-jedi.org/Jedi:VCLVCL
  39.  
  40. in mind.
  41.  
  42. Known Issues:
  43. -----------------------------------------------------------------------------}
  44.  
  45. {
  46. HOWTO add menu items:
  47.  
  48. Warning: this is a complex multistep process!
  49.  
  50. 1. Edit TPlot.wb1 and add the menu item(s) you want.
  51.    It is best to add them in their correct position near rows 209-269.
  52.    Add its hint similarly, in the rows below.
  53.    Make sure you update the indices correctly.
  54.  
  55. 2. Open Images32.res in the Image Editor.
  56.  
  57. 3. for i := MaxImageNo downto NewIndex do
  58.       ImageIndex := ImageIndex + NoNewMenuItems;
  59.  
  60. 4. create your new 16x16x256 bitmap(s), and rename them to NewIndex, ....
  61.  
  62. 5. Save Images32.Res.
  63.  
  64. 6. Open Plotxxx_xx.bpg, open Plotxxx_Rxx.dpk, and ...
  65.  
  66. 7. In Plotdefs.pas, insert your new mnuMyNewMenuItem(s).
  67.  
  68. 8. In PlotImageList.pas, redefine NO_IMAGES to the new value.
  69.  
  70. 9. In Plot.pas, create your new MyNewMenuClick method(s).
  71.  
  72. 10. In Plot.pas, go to the CreateOnClicks procedure of TCustomPlot.CreateMenus, and add:
  73.   FPlotPopUpMenu.Items[Ord(mnuXXX)].Items[Ord(mnuMyNewMenuItem)].OnClick := MyNewMenuClick;
  74.  
  75. 11. Similarly add the Caption and Hint.
  76.  
  77. 20. Change
  78.           TPlot.DetermineMenuVisibility,
  79.           TPlot.SetSeriesVisibility and
  80.           TPlot.SetSeriesEnabledness
  81.           TPopupOptions.Create
  82.   as required.
  83.  
  84. 21. If you are support languages than English, try to translate your new menu caption and hint.
  85.  
  86. 22. Export the neccessary resourcestrings from the spreadsheet to the TPlot/lang/eng.txt (and other) files.
  87. }
  88.  
  89. interface
  90.  
  91. uses
  92.   Classes, {SysUtils,}
  93. {$IFDEF WINDOWS}
  94.   Menus, Graphics, Wintypes
  95. {$ENDIF}
  96. {$IFDEF WIN32}
  97.   Menus, Graphics, Windows
  98. {$ENDIF}
  99. {$IFDEF LINUX}
  100.   Types,
  101.   QGraphics, QMenus
  102. {$ENDIF}
  103.   ;
  104.  
  105. {Misc and TPlot now only work for Compiler 3 up !}
  106. {$IFDEF COMPILER3_UP}
  107.   {$IFDEF WIN32}
  108. {http://www.freetranslation.com/:}
  109.     {$IFDEF LANG_ENGLISH}{$I lang\eng.txt}{$ENDIF}
  110.     {$IFDEF LANG_FRENCH}{$I lang\fre.txt}{$ENDIF}
  111.     {$IFDEF LANG_GERMAN}{$I lang\ger.txt}{$ENDIF}
  112.     {$IFDEF LANG_ITALIAN}{$I lang\ita.txt}{$ENDIF}
  113.     {$IFDEF LANG_NORWEGIAN}{$I lang\nor.txt}{$ENDIF}
  114.     {$IFDEF LANG_PORTUGUESE}{$I lang\por.txt}{$ENDIF}
  115.     {$IFDEF LANG_SPANISH}{$I lang\spa.txt}{$ENDIF}
  116. {Universal Translator by LanguageForce:}
  117.     {$IFDEF LANG_CZECH}{$I lang\cze.txt}{$ENDIF}
  118.     {$IFDEF LANG_DUTCH}{$I lang\dut.txt}{$ENDIF}
  119.     {$IFDEF LANG_DANISH}{$I lang\dan.txt}{$ENDIF}
  120.     {$IFDEF LANG_GREEK}{$I lang\gre.txt}{$ENDIF}
  121.     {$IFDEF LANG_HUNGARIAN}{$I lang\hun.txt}{$ENDIF}
  122.     {$IFDEF LANG_INDONESIAN}{$I lang\ind.txt}{$ENDIF}
  123.     {$IFDEF LANG_ROMANIAN}{$I lang\rom.txt}{$ENDIF}
  124.     {$IFDEF LANG_RUSSIAN}{$I lang\rus.txt}{$ENDIF}
  125.     {$IFDEF LANG_SLOVAK}{$I lang\slo.txt}{$ENDIF}
  126.     {$IFDEF LANG_SWEDISH}{$I lang\swe.txt}{$ENDIF}
  127.     {$IFDEF LANG_THAI}{$I lang\tha.txt}{$ENDIF}
  128.     {$IFDEF LANG_TURKISH}{$I lang\tur.txt}{$ENDIF}
  129.     {$IFDEF LANG_UKRAINIAN}{$I lang\ukr.txt}{$ENDIF}
  130.   {$ENDIF}
  131.   {$IFDEF LINUX}
  132. {http://www.freetranslation.com/:}
  133.     {$IFDEF LANG_ENGLISH}{$I lang/eng.txt}{$ENDIF}
  134.     {$IFDEF LANG_FRENCH}{$I lang/fre.txt}{$ENDIF}
  135.     {$IFDEF LANG_GERMAN}{$I lang/ger.txt}{$ENDIF}
  136.     {$IFDEF LANG_ITALIAN}{$I lang/ita.txt}{$ENDIF}
  137.     {$IFDEF LANG_NORWEGIAN}{$I lang/nor.txt}{$ENDIF}
  138.     {$IFDEF LANG_PORTUGUESE}{$I lang/por.txt}{$ENDIF}
  139.     {$IFDEF LANG_SPANISH}{$I lang/spa.txt}{$ENDIF}
  140. {Universal Translator by LanguageForce:}
  141.     {$IFDEF LANG_CZECH}{$I lang/cze.txt}{$ENDIF}
  142.     {$IFDEF LANG_DUTCH}{$I lang/dut.txt}{$ENDIF}
  143.     {$IFDEF LANG_DANISH}{$I lang/dan.txt}{$ENDIF}
  144.     {$IFDEF LANG_GREEK}{$I lang/gre.txt}{$ENDIF}
  145.     {$IFDEF LANG_HUNGARIAN}{$I lang/hun.txt}{$ENDIF}
  146.     {$IFDEF LANG_INDONESIAN}{$I lang/ind.txt}{$ENDIF}
  147.     {$IFDEF LANG_ROMANIAN}{$I lang/rom.txt}{$ENDIF}
  148.     {$IFDEF LANG_RUSSIAN}{$I lang/rus.txt}{$ENDIF}
  149.     {$IFDEF LANG_SLOVAK}{$I lang/slo.txt}{$ENDIF}
  150.     {$IFDEF LANG_SWEDISH}{$I lang/swe.txt}{$ENDIF}
  151.     {$IFDEF LANG_THAI}{$I lang/tha.txt}{$ENDIF}
  152.     {$IFDEF LANG_TURKISH}{$I lang/tur.txt}{$ENDIF}
  153.     {$IFDEF LANG_UKRAINIAN}{$I lang/ukr.txt}{$ENDIF}
  154.   {$ENDIF}
  155. {$ELSE}
  156.   Misc and TPlot now only work for Compiler 3 up !
  157. {$ENDIF}             
  158.  
  159. const
  160.   TPLOT_VERSION = 232;
  161.  
  162.   FILE_FORMAT_VERSION = 200;
  163.   MAX_FILE_VERSION = 200;
  164.  
  165.   TAG_BASE = 1000;
  166.   CAPTION_BASE = 3000;
  167.   HINT_BASE = 4000;
  168.  
  169.   TWO_PI = 2*PI;
  170.   PI_ON_TWO = PI/2;
  171.   THREE_PI_ON_TWO = 3*PI/2;
  172.  
  173. {$IFDEF MSWINDOWS}
  174.   SMALL_FONT_SIZE = 8;
  175.   MEDIUM_FONT_SIZE = 9;
  176.   LARGE_FONT_SIZE = 14;
  177. {$ENDIF}
  178. {$IFDEF LINUX}
  179.   SMALL_FONT_SIZE = 10;
  180.   MEDIUM_FONT_SIZE = 12;
  181.   LARGE_FONT_SIZE = 18;
  182. {$ENDIF}
  183.  
  184. {This roughly controls the number of unique colors in contour plots:}
  185.   COLOUR_GRANULARITY = 256;
  186. {Default: 256;
  187.  - larger values may give a slightly improved image;
  188.  - smaller values lead to false banding.}  
  189.  
  190. resourcestring
  191. {constructor:}
  192.   sArial = 'Arial';
  193.  
  194. type
  195. {type definitions for dynamic menu arrays:}
  196.   TMenuArray = array[0..127] of TMenuItem;
  197.   pMenuArray = ^TMenuArray;
  198.  
  199.   TDegrees = 0..359;
  200.  
  201.   TDirection = (drHorizontal, drVertical);
  202. {Screen objects are often Horizontal or Vertical.}
  203.  
  204.   TOrientation = (orRight, orLeft);
  205. {Other screen objects can be Left or Right aligned.}
  206.  
  207. {Different possible plot types: these determine how the series are interpreted,
  208.  and so how data are displayed on screen}
  209.   TPlotType = (
  210.     ptXY,
  211.     ptError,
  212.     ptMultiple,
  213.     ptBubble,
  214.     ptColumn,
  215.     ptStack,
  216.     ptNormStack,
  217.     ptPie,
  218.     ptPolar,
  219.     ptLineContour,
  220.     ptContour,
  221.     pt3DContour,
  222.     pt3DWire,
  223.     pt3DColumn);
  224. {ptXY          - a normal XY plot that everyone does in sigh school
  225.  
  226.  ptError       - every second (odd indexed) series is interpreted as the "error bar" of the
  227.                  previous (even indexed) series.
  228.                   
  229.  ptMultiple    - each "point" is composed of a multiple of points from
  230.                  the different series. This is a generalised extension of the previous
  231.                  ptError type. It is used for High-Low-Close, High-Low-Open-Close, etc
  232.                  plots. Eg:
  233.   high, low        high, average, low        high, low, open, close;
  234.      X                     X                           H
  235.      |                     |                           |
  236.      |                     |                           O
  237.      |                     O                           |
  238.      |                     |                           |
  239.      |                     |                           |
  240.      |                     |                           |
  241.      |                     |                           C
  242.      |                     |                           |
  243.      X                     X                           L
  244.                  See the Multiplicity property !
  245.  
  246.  ptColumn      - columns of data: the last X value is taken as Xn + (Xn - Xn-1),
  247.                  so the appearance is:
  248.                               (X1, Y1)----(X2, Y1)
  249.                               |                  |
  250.                               |                  (Xn, Yn)----(Xn+dX, Yn)
  251.            (X0, Y0)----(X1, Y0)                  |                     |
  252.            |                  |                  |                     |
  253.            |                  |                  |                     |
  254.            |                  |                  |                     |
  255.            |                  |                  |                     |
  256.            (X0, 0)---------(X1, 0)------------(X2, 0)---------(Xn+dX, 0)
  257.                 - when there are N (> 1) series, each gap is divided by (N+1):
  258.                               -------
  259.                               |     |
  260.                               |     |
  261.            -------            |     |
  262.            |     |------      |     |
  263.            |     |     |      |     |------
  264.            |     |     |      |     |     |
  265.            |     |     |      |     |     |
  266.            (X0, 0)---------(X1, 0)------------(X2, 0)
  267.  
  268.  ptStack       - a stacked column, with each series on to of each other
  269.  
  270.  ptNormStack   - like a stack, but normalized to 100%
  271.  
  272.  ptPie         - very boring pie graphs
  273.  
  274.  ptPolar       - (x, y) = (r*cos(theta), r*sin(theta))
  275.  
  276.  ptContour     - a two-dimensional plot where the color represents the Y value.
  277.  
  278.  pt3DContour   - a three-dimensional plot where the color represents the Y value.
  279.  
  280.  pt3DWire      - a three-dimensional plot in which each series in order as succesive slices through the surface
  281. }
  282.  
  283.   TScreenJob = (sjNone,
  284.                 sjDrag,
  285.                 sjRightDrag,
  286.                 sjHide,
  287.                 sjZoomIn,
  288.                 sjEditAxis,
  289.                 sjTouchNotePointer,
  290.                 sjMoveNotePointer,
  291.                 sjEditFont,
  292.                 sjEditPoint,
  293.                 sjEditSeries,
  294.                 sjFlashEdit,
  295.                 sjCopySeries,
  296.                 sjDisplace,
  297.                 sjCloneSeries,
  298.                 sjDeleteSeries,
  299.                 sjLinearize,
  300.                 sjZero,
  301.                 sjPosition,
  302.                 sjNearestPoint,
  303.                 sjAverage,
  304.                 sjContractSeries,
  305.                 sjContractAllSeries,
  306.                 sjSplineSeries,
  307.                 sjHighs,
  308.                 sjLows,
  309.                 sjMovingAverage,
  310.                 sjSmoothSeries,
  311.                 sjSortSeries,
  312.                 sjDifferentiate,
  313.                 sjIntegrate,
  314.                 sjIntegral,
  315.                 sjLineOfBestFit,
  316.                 sjDualLineBestFit1, sjDualLineBestFit2,
  317.                 sjSelection,
  318.                 sjDualSelection1, sjDualSelection2);
  319. {What particular operation is to be carried out ?}
  320. {}
  321. {Note that a 2-region line of best fit is a 2 stage operation.}
  322.  
  323.   TObjectType = (soNone,
  324.                  soTitle,
  325.                  soLegend,
  326.                  soResult,
  327.                  soXAxis, soXAxisTitle, soXAxisLabel,
  328.                  soYAxis, soYAxisTitle,soYAxisLabel,
  329.                  soZAxis, soZAxisTitle,soZAxisLabel,
  330.                  soLeftBorder, soTopBorder, soRightBorder, soBottomBorder,
  331.                  soSeries,
  332.                  soNote);
  333. {What object on the screen got clicked on ?}
  334. {}
  335. {Note that the soYAxis, soYAxisTitle, and soYAxisLabel are generic: several
  336.  sub-components can share this type.}
  337.  
  338.   TDisplayMode = (dmNormal, dmNone, dmRun, dmHistory);
  339. {What do we do when new data is added ?}
  340. {}
  341. {    dmNormal: Check (and adjust DisplayMode if neccessary) with the addition of every point.}
  342. {    dmNone: Nothing;}
  343. {    dmRun: Increase the Span of the X Axis by 100% to accomodate the new data,
  344.  and alter (increase) the scale of the Y Axis if needed.}
  345. {    dmHistory: Similar to dmRun, except that the X-Axis runs from (Min-Max)
  346.  through (x-Max) to 0.}
  347. {}
  348. {Note that with dmRun we can expect more data with increasing X values.
  349.  Rather than force a complete screen re-draw every time a data point is
  350.  added, we extend the X Axis by 100%.}
  351. {}
  352. {History mode, dmHistory, deserves a few more words. In this mode TCustomPlot
  353.  displays the data over the last History 's worth of points - older data is not
  354.  displayed. The result is a graph that shows the last few seconds or minutes of
  355.  data in great detail.}
  356.  
  357.   TContourDetail = (cdLow, cdMedium, cdHigh);
  358.  
  359.   TGridType = (gtNone, gtHorizontal, gtVertical, gtBoth);
  360.  
  361.   TSymbol = (syNone,
  362.     syCircle, sySquare,
  363.     syUpTriangle, syDownTriangle,
  364.     syPlus, syCross, syStar,
  365.     syDash, syVertDash, syLeftDash, syRightDash);
  366. {These are the different symbols that are used to represent the data points.}
  367.  
  368. {the actual menus:}
  369.   TMainMenus = (
  370.     mnuFile,
  371.     mnuEdit,
  372.     mnuView,
  373.     mnuCalc
  374. {$IFDEF FINANCE}
  375.     , mnuFinance
  376. {$ENDIF}
  377.     );
  378.   TMainOptions = set of TMainMenus;
  379.  
  380.   TFileMenus = (
  381.     mnuNew,
  382.     mnuOpen,
  383.     mnuOverlayDiv, {convention: Name the Divs after the following menuitem}
  384.     mnuOverlay,
  385.     mnuClearOverlays,
  386.     mnuSaveDiv,
  387.     mnuSave,
  388.     mnuSaveAs,
  389.     mnuSaveImage,
  390.     mnuPrintDiv,
  391.     mnuPrint);
  392.   TFileOptions = set of TFileMenus;
  393.  
  394.   TEditMenus = (
  395.     mnuCopy,
  396.     mnuCopyHTML,
  397.     mnuCopySeries,
  398.     mnuPaste,
  399.     mnuDisplaceDiv,
  400.     mnuDisplace,
  401.     mnuResetDisplacement,
  402.     mnuEditSeriesDiv,
  403.     mnuNewSeries,
  404.     mnuCloneSeries,
  405.     mnuEditPoint,
  406.     mnuEditData,
  407.     mnuEditSeries,
  408.     mnuDeleteSeries,
  409.     mnuLinearize,
  410.     mnuZero,
  411.     mnuAxisDiv,
  412.     mnuNewYAxis,
  413.     mnuEditAxis,
  414.     mnuDeleteY2Axis,
  415.     mnuEditFontDiv,
  416.     mnuNewNote,
  417.     mnuMoveNotePointer,
  418.     mnuDeleteNote,
  419.     mnuEditFont,
  420.     mnuPropertiesDiv,
  421.     mnuProperties); {19}
  422.   TEditOptions = set of TEditMenus;
  423.  
  424.   TViewMenus = (
  425.     mnuHide,
  426.     mnuShowAll,
  427.     mnuDisplayModeDiv,
  428.     mnuDisplayMode,
  429.     mnuLegend,
  430.     mnuZoomDiv,
  431.     mnuSetAsNormal,
  432.     mnuNormal,
  433.     mnuManualZoom,
  434.     mnuZoomIn,
  435.     mnuZoomOut);
  436.   TViewOptions = set of TViewMenus;
  437.  
  438.   TCalcMenus = (
  439.     mnuPosition,
  440.     mnuNearestPoint,
  441.     mnuCalcAverageDiv,
  442.     mnuCalcAverage,
  443.     mnuCompressSeries,
  444.     mnuCompressAllSeries,
  445.     mnuContractSeries,
  446.     mnuContractAllSeries,
  447.     mnuCubicSpline,
  448.     mnuHighs,
  449.     mnuMovingAverage,
  450.     mnuSmoothSeries,
  451.     mnuSortSeries,
  452.     mnuCalculusDiv,
  453.     mnuDifferentiate,
  454.     mnuIntegrate,
  455.     mnuIntegral,
  456.     mnuLineOfBestFitDiv,
  457.     mnuLineOfBestFit,
  458.     mnuTwoRegionLineOfBestFit
  459. {$IFDEF FUNCTIONS}
  460.     , mnuFunctionDiv,
  461.     mnuFunction
  462. {$ENDIF}
  463.     );
  464.   TCalcOptions = set of TCalcMenus;
  465.  
  466. {$IFDEF FINANCE}
  467. {These have been taken from:
  468.  http://www.stockcharts.com/education/What/IndicatorAnalysis/
  469. }
  470.   TFinanceMenus = (
  471.     mnuADL,
  472.     mnuAroon,
  473.     mnuADX,
  474.     mnuATR,
  475.     mnuBB,
  476.     mnuCCI,
  477.     mnuCMF,
  478.     mnuMACD,
  479.     mnuMA,
  480.     mnuPVO,
  481.     mnuPO,
  482.     mnuPR,
  483.     mnuPVB,
  484.     mnuRSI,
  485.     mnuStochOsc,
  486.     mnuStochRSI,
  487.     mnuTRIN,
  488.     mnuWilliams);
  489.   TFinanceOptions = set of TFinanceMenus;
  490. {$ENDIF}
  491.  
  492.   TSaveOption = (soAsText, soProperties);
  493.   TSaveOptions = set of TSaveOption;
  494.  
  495.   T3DPoint = Record
  496.     x: Integer;
  497.     y: Integer;
  498.     z: Integer;
  499.   end;
  500.   p3DPoint = ^T3DPoint;
  501.  
  502.   T3DZPoint = Record
  503.     x: Integer;
  504.     y: Integer;
  505.     Z: Single;
  506.   end;
  507.   p3DZPoint = ^T3DZPoint;
  508.  
  509.   T3DRealPoint = Record
  510.     X: Single;
  511.     Y: Single;
  512.     Z: Single;
  513.   end;
  514.   p3DRealPoint = ^T3DRealPoint;
  515.  
  516.   TPoints = array [0..600] of TPoint;
  517.   pTPoints = ^TPoints;
  518.  
  519.   TLimits = class(TPersistent)
  520.   private
  521.     FAxisIndex: Byte;
  522.     FPen: TPen;
  523.     FLower: Single;
  524.     FUpper: Single;
  525.     FVisible: Boolean;
  526.     FOnChange: TNotifyEvent;
  527.     procedure SetAxisIndex(Value: Byte);
  528.     procedure SetPen(Value: TPen);
  529.     procedure SetLower(Value: Single);
  530.     procedure SetUpper(Value: Single);
  531.     procedure SetVisible(Value: Boolean);
  532.   protected
  533.     procedure AssignTo(Dest: TPersistent); override;
  534.   public
  535.     Constructor Create; {$IFDEF DELPHI4_UP}reintroduce;{$ENDIF}
  536.     Destructor Destroy; override;
  537.   published
  538.     property AxisIndex: Byte read FAxisIndex write SetAxisIndex;
  539.     property Pen: TPen read FPen write SetPen;
  540.     property Lower: Single read FLower write SetLower;
  541.     property Upper: Single read FUpper write SetUpper;
  542.     property Visible: Boolean read FVisible write SetVisible;
  543.     property OnChange: TNotifyEvent read FOnChange write FOnChange;
  544.   end;
  545.  
  546.  
  547.   TPopupOptions = class(TPersistent)
  548.   private
  549.     FMenu: TMainOptions;
  550.     FFile: TFileOptions;
  551.     FEdit: TEditOptions;
  552.     FView: TViewOptions;
  553.     FCalc: TCalcOptions;
  554. {$IFDEF FINANCE}
  555.     FFinance: TFinanceOptions;
  556. {$ENDIF}
  557.   protected
  558.     procedure AssignTo(Dest: TPersistent); override;
  559. {TPopupOptions's implementation of the standard Assign(To) method.}
  560.   public
  561.     Constructor Create; {$IFDEF DELPHI4_UP}reintroduce;{$ENDIF}
  562. {D1 cannot publish sets with more than 16 members}
  563. {$IFNDEF DELPHI1}
  564.   published
  565. {$ENDIF}
  566.     property Menu: TMainOptions read FMenu write FMenu;
  567.     property File_: TFileOptions read FFile write FFile;
  568.     property Edit: TEditOptions read FEdit write FEdit;
  569.     property View: TViewOptions read FView write FView;
  570.     property Calc: TCalcOptions read FCalc write FCalc;
  571. {$IFDEF FINANCE}
  572.     property Finance: TFinanceOptions read FFinance write FFinance;
  573. {$ENDIF}
  574.   end;
  575.  
  576. implementation
  577.  
  578.  
  579. {------------------------------------------------------------------------------
  580.   Constructor: TPopupOptions.Create;
  581.   Description: standard constructor
  582.        Author: Mat Ballard
  583.  Date created: 10/15/1999
  584. Date modified: 10/15/2000 by Mat Ballard
  585.       Purpose: enables all menu options
  586.  Known Issues:
  587.  ------------------------------------------------------------------------------}
  588. Constructor TPopupOptions.Create;
  589. var
  590.   i: Integer;
  591. begin
  592.   FMenu := [];
  593.   FFile := [];
  594.   FEdit := [];
  595.   FView := [];
  596.   FCalc := [];
  597. {$IFDEF FINANCE}
  598.   FFinance := [];
  599. {$ENDIF}
  600.  
  601.   for i := 0 to Ord(High(TMainMenus)) do
  602.     Include(FMenu, TMainMenus(i));
  603.   for i := 0 to Ord(High(TFileMenus)) do
  604.     Include(FFile, TFileMenus(i));
  605.   for i := 0 to Ord(High(TEditMenus)) do
  606.     Include(FEdit, TEditMenus(i));
  607.   for i := 0 to Ord(High(TViewMenus)) do
  608.     Include(FView, TViewMenus(i));
  609.   for i := 0 to Ord(High(TCalcMenus)) do
  610.     Include(FCalc, TCalcMenus(i));
  611. {$IFDEF FINANCE}
  612.   for i := 0 to Ord(High(TFinanceMenus)) do
  613.     Include(FFinance, TFinanceMenus(i));
  614. {$ENDIF}
  615. end;
  616.  
  617. {------------------------------------------------------------------------------
  618.     Procedure: TPopupOptions.AssignTo;
  619.   Description: standard copier
  620.        Author: Mat Ballard
  621.  Date created: 04/20/2001
  622. Date modified: 04/20/2001 by Mat Ballard
  623.       Purpose: copies values from a source
  624.  Known Issues:
  625.  ------------------------------------------------------------------------------}
  626. procedure TPopupOptions.AssignTo(Dest: TPersistent);
  627. begin
  628.   TPopupOptions(Dest).Menu := FMenu;
  629.   TPopupOptions(Dest).File_ := FFile;
  630.   TPopupOptions(Dest).Edit := FEdit;
  631.   TPopupOptions(Dest).View := FView;
  632.   TPopupOptions(Dest).Calc := FCalc;
  633. {$IFDEF FINANCE}
  634.   TPopupOptions(Dest).Finance := FFinance;
  635. {$ENDIF}
  636. end;
  637.  
  638. {******************************************************************************}
  639. {------------------------------------------------------------------------------
  640.   Constructor: TLimits.Create;
  641.   Description: standard constructor
  642.        Author: Mat Ballard
  643.  Date created: 07/20/2001
  644. Date modified: 07/20/2001 by Mat Ballard
  645.       Purpose: sets default values
  646.  Known Issues:
  647.  ------------------------------------------------------------------------------}
  648. Constructor TLimits.Create;
  649. begin
  650.   FAxisIndex := 1;
  651.   FUpper := 7;
  652.   FLower := 3;
  653.   FPen := TPen.Create;
  654.   FPen.Color := clRed;
  655.   FPen.Style := psDot;
  656.   FOnChange := nil;
  657. end;
  658.  
  659. Destructor TLimits.Destroy;
  660. begin
  661.   FOnChange := nil;
  662.   FPen.Free;
  663.   inherited Destroy;
  664. end;
  665.  
  666. {------------------------------------------------------------------------------
  667.     Procedure: TLimits.AssignTo;
  668.   Description: standard copier
  669.        Author: Mat Ballard
  670.  Date created: 04/20/2001
  671. Date modified: 04/20/2001 by Mat Ballard
  672.       Purpose: copies values from a source
  673.  Known Issues:
  674.  ------------------------------------------------------------------------------}
  675. procedure TLimits.AssignTo(Dest: TPersistent);
  676. begin
  677.   TLimits(Dest).Upper := FUpper;
  678.   TLimits(Dest).Lower := FLower;
  679.   TLimits(Dest).Visible := FVisible;
  680. end;
  681.  
  682. procedure TLimits.SetUpper(Value: Single);
  683. begin
  684.   FUpper := Value;
  685.   if (FUpper < FLower) then
  686.     FLower := Value;
  687.   if Assigned(FOnChange) then OnChange(Self);
  688. end;
  689.  
  690. procedure TLimits.SetAxisIndex(Value: Byte);
  691. begin
  692.   FAxisIndex := Value;
  693.   if Assigned(FOnChange) then OnChange(Self);
  694. end;
  695.  
  696. procedure TLimits.SetPen(Value: TPen);
  697. begin
  698.   FPen := Value;
  699.   if Assigned(FOnChange) then OnChange(Self);
  700. end;
  701.  
  702. procedure TLimits.SetLower(Value: Single);
  703. begin
  704.   FLower := Value;
  705.   if (FLower > FUpper) then
  706.     FLower := Value;
  707.   if Assigned(FOnChange) then OnChange(Self);
  708. end;
  709.  
  710. procedure TLimits.SetVisible(Value: Boolean);
  711. begin
  712.   FVisible := Value;
  713.   if Assigned(FOnChange) then OnChange(Self);
  714. end;
  715.  
  716. end.
  717.