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

  1. unit Plot_Reg;
  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: Plot_reg.pas, released 12 September 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: 03/15/2001
  31. Current Version: 2.00
  32.  
  33. You may retrieve the latest version of this file from:
  34.  
  35.         http://Chemware.hypermart.net/
  36.  
  37. This work was created with the Project JEDI VCL guidelines:
  38.  
  39.         http://www.delphi-jedi.org/Jedi:VCLVCL
  40.  
  41. in mind. 
  42.  
  43. Purpose:
  44. Registration unit for the TPlot component.
  45.  
  46.  
  47. Known Issues:
  48.         - Property editors are stuffed under Kylix.
  49. -----------------------------------------------------------------------------}
  50.  
  51. {$I Plot.inc}
  52.  
  53. interface
  54.  
  55. uses
  56.   Classes,
  57. {Borland removed the source to property editors and other IDE goodies in Kylix and D6 up:}  
  58. {$IFDEF COMPILER6_UP}
  59.   DesignEditors, DesignIntf,
  60. {PLEASE NOTE: the property editors need DesignEditors and DesignIntf,
  61.  and to avoid rude messages about "DesignConst" (which does not exist),
  62.  you have to add "designide.dcp" to the requires section of this package.
  63.                   ^^^^^^^^^^^^^
  64.  Solution courtesy of Amy Khai Luong <akluong@sandia.gov>
  65.  }
  66. {$ELSE}
  67.   {$IFNDEF BCB5}
  68.   DsgnIntf,
  69.   {$ENDIF}
  70. {$ENDIF}
  71.   Plot,
  72.  
  73. {$IFDEF COMPILER35_UP}
  74.   Plottoolbar,
  75.   Plotimagelist,
  76. {$ENDIF}
  77.   Plotmenu;
  78.  
  79. {$IFNDEF BCB5}
  80. type
  81.   TPlotComponentEditor = class(TComponentEditor)
  82.   public
  83.     function GetVerb(Index: Integer): String; override;
  84.     function GetVerbCount: Integer; override;
  85.     procedure ExecuteVerb(Index: Integer); override;
  86.     procedure Edit; override;
  87.   end;
  88. {$ENDIF}
  89.  
  90. procedure Register;
  91.  
  92. implementation
  93.  
  94. {$IFDEF WINDOWS}
  95. {$R Plot16.dcr}
  96. {$ENDIF}
  97. {$IFDEF WIN32}
  98. {$R Plot32.dcr}
  99. {$ENDIF}
  100. {$IFDEF LINUX}
  101. {$R Plot32.dcr}
  102. {$ENDIF}
  103.  
  104. {$IFNDEF BCB5}
  105. type
  106.   TAboutProperty = class(TPropertyEditor)
  107.   public
  108.     procedure Edit; override;
  109.     function GetAttributes: TPropertyAttributes; override;
  110.     function GetValue:string; override;
  111.   end;
  112.  
  113.   TAxesProperty = class(TPropertyEditor)
  114.   public
  115.     procedure Edit; override;
  116.     function GetAttributes: TPropertyAttributes; override;
  117.     function GetValue:string; override;
  118.   end;
  119.  
  120.   TDataProperty = class(TPropertyEditor)
  121.   public
  122.     procedure Edit; override;
  123.     function GetAttributes: TPropertyAttributes; override;
  124.     function GetValue:string; override;
  125.   end;
  126.  
  127.   TProperties = class(TPropertyEditor)
  128.   public
  129.     procedure Edit; override;
  130.     function GetAttributes: TPropertyAttributes; override;
  131.     function GetValue:string; override;
  132.   end;
  133.  
  134.   TSeriesProperty = class(TPropertyEditor)
  135.   public
  136.     procedure Edit; override;
  137.     function GetAttributes: TPropertyAttributes; override;
  138.     function GetValue:string; override;
  139.   end;
  140. {$ENDIF}
  141.  
  142. procedure Register;
  143. begin
  144.   RegisterComponents('Samples', [TPlot]);
  145.   RegisterComponents('Samples', [TPlotMenu]);
  146. {$IFDEF COMPILER35_UP}
  147.   RegisterComponents('Samples', [TPlotToolBar]);
  148.   RegisterComponents('Samples', [TPlotImageList]);
  149. {$ENDIF}
  150.  
  151. {$IFNDEF BCB5}
  152. {register the "About" property editor}
  153.   RegisterPropertyEditor(TypeInfo(String), TPlot, 'About', TAboutProperty);
  154. {register the "Data" property editor}
  155.   RegisterPropertyEditor(TypeInfo(String), TPlot, 'DataProperties', TDataProperty);
  156. {register the "Properties" property editor}
  157.   RegisterPropertyEditor(TypeInfo(String), TPlot, 'Properties', TProperties);
  158. {register the "Series" property editor}
  159.   RegisterPropertyEditor(TypeInfo(String), TPlot, 'SeriesProperties', TSeriesProperty);
  160. {register the "Axes" property editor}
  161.   RegisterPropertyEditor(TypeInfo(String), TPlot, 'AxesProperties', TAxesProperty);
  162. {register the component editor for menus:}
  163.   RegisterComponentEditor(TPlot, TPlotComponentEditor);
  164. {$ENDIF}
  165. end;
  166.  
  167.  
  168. {$IFNDEF BCB5}
  169. {TPlotComponentEditor methods:-------------------------------------------------}
  170. function TPlotComponentEditor.GetVerb(Index: Integer): String;
  171. begin
  172.   case Index of
  173.     0: Result := '&About TPlot...';
  174.     1: Result := 'A&xes...';
  175.     2: Result := '&Copy';
  176.     3: Result := '&Data...';
  177.     4: Result := '&Properties...';
  178.     5: Result := '&Series...';
  179.   end;
  180. end;
  181.  
  182. function TPlotComponentEditor.GetVerbCount: Integer;
  183. begin
  184.   Result := 6;
  185. end;
  186.  
  187. procedure TPlotComponentEditor.ExecuteVerb(Index: Integer);
  188. begin
  189.   case Index of
  190.     0: (Component as TPlot).ShowAbout;
  191.     1: (Component as TPlot).ShowAxes;
  192.     2: (Component as TPlot).CopyClick(nil);
  193.     3: (Component as TPlot).ShowData;
  194.     4: (Component as TPlot).ShowProperties;
  195.     5: (Component as TPlot).ShowSeries;
  196.   end;
  197. end;
  198.  
  199. procedure TPlotComponentEditor.Edit;
  200. begin
  201.   (Component as TPlot).ShowProperties;
  202. end;
  203. {end TPlotComponentEditor methods:---------------------------------------------}
  204.  
  205. {About bits and pieces:------------------------------------------------------}
  206. procedure TAboutProperty.Edit;
  207. {call the "About" dialog window when clicking on ... in the Object Inspector}
  208. begin
  209.   TPlot(GetComponent(0)).ShowAbout;
  210. end;
  211.  
  212. function TAboutProperty.GetAttributes: TPropertyAttributes;
  213. {set up to display a string in the Object Inspector}
  214. begin
  215.   GetAttributes := [paDialog, paReadOnly];
  216. end;
  217.  
  218. function TAboutProperty.GetValue: String;
  219. {set string to appear in the Object Inspector}
  220. begin
  221.   GetValue := '(About...)';
  222. end;
  223.  
  224. {End About bits and pieces:--------------------------------------------------}
  225.  
  226. {Data bits and pieces:------------------------------------------------------}
  227. procedure TDataProperty.Edit;
  228. {call the "Data" dialog window when clicking on ... in the Object Inspector}
  229. begin
  230.   TPlot(GetComponent(0)).ShowData;
  231. end;
  232.  
  233. function TDataProperty.GetAttributes: TPropertyAttributes;
  234. {set up to display a string in the Object Inspector}
  235. begin
  236.   GetAttributes := [paDialog, paReadOnly];
  237. end;
  238.  
  239. function TDataProperty.GetValue: String;
  240. {set string to appear in the Object Inspector}
  241. begin
  242.   GetValue := '(Data...)';
  243. end;
  244.  
  245. {End Data bits and pieces:--------------------------------------------------}
  246.  
  247. {Properties bits and pieces:------------------------------------------------------}
  248. procedure TProperties.Edit;
  249. {call the "Properties" dialog window when clicking on ... in the Object Inspector}
  250. begin
  251.   TPlot(GetComponent(0)).ShowProperties;
  252. end;
  253.  
  254. function TProperties.GetAttributes: TPropertyAttributes;
  255. {set up to display a string in the Object Inspector}
  256. begin
  257.   GetAttributes := [paDialog, paReadOnly];
  258. end;
  259.  
  260. function TProperties.GetValue: String;
  261. {set string to appear in the Object Inspector}
  262. begin
  263.   GetValue := '(Properties...)';
  264. end;
  265.  
  266. {End Properties bits and pieces:--------------------------------------------------}
  267.  
  268. {Series bits and pieces:------------------------------------------------------}
  269. procedure TSeriesProperty.Edit;
  270. {call the "Series" dialog window when clicking on ... in the Object Inspector}
  271. begin
  272.   TPlot(GetComponent(0)).ShowSeries;
  273. end;
  274.  
  275. function TSeriesProperty.GetAttributes: TPropertyAttributes;
  276. {set up to display a string in the Object Inspector}
  277. begin
  278.   GetAttributes := [paDialog, paReadOnly];
  279. end;
  280.  
  281. function TSeriesProperty.GetValue: String;
  282. {set string to appear in the Object Inspector}
  283. begin
  284.   GetValue := '(Series...)';
  285. end;
  286.  
  287. {End Series bits and pieces:--------------------------------------------------}
  288.  
  289. {$IFDEF COMPILER35_UP}
  290. {Toolbar bits and pieces:------------------------------------------------------}
  291. {procedure TToolbarProperty.Edit;
  292. begin
  293.   TPlotToolBar(GetComponent(0)).ShowArrangement;
  294. end;
  295.  
  296. function TToolbarProperty.GetAttributes: TPropertyAttributes;
  297. begin
  298.   GetAttributes := [paDialog, paReadOnly];
  299. end;
  300.  
  301. function TToolbarProperty.GetValue: String;
  302. begin
  303.   GetValue := '(Arrangement...)';
  304. end;}
  305. {End Toolbar bits and pieces:--------------------------------------------------}
  306. {$ENDIF}
  307.  
  308. {Axes bits and pieces:------------------------------------------------------}
  309. procedure TAxesProperty.Edit;
  310. {call the "Axes" dialog window when clicking on ... in the Object Inspector}
  311. begin
  312.   TPlot(GetComponent(0)).ShowAxes;
  313. end;
  314.  
  315. function TAxesProperty.GetAttributes: TPropertyAttributes;
  316. {set up to display a string in the Object Inspector}
  317. begin
  318.   GetAttributes := [paDialog, paReadOnly];
  319. end;
  320.  
  321. function TAxesProperty.GetValue: String;
  322. {set string to appear in the Object Inspector}
  323. begin
  324.   GetValue := '(Axes...)';
  325. end;
  326. {End Axes bits and pieces:--------------------------------------------------}
  327.  
  328. {$ENDIF}
  329. end.
  330.