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

  1. unit DBPlot_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: DBPlot_reg.pas, released 12 March 2001.
  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/02/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 TDBPlot component.
  45.  
  46.  
  47. Known Issues:
  48. -----------------------------------------------------------------------------}
  49.  
  50. {$I Plot.inc}
  51.  
  52. interface
  53.  
  54. uses
  55.   Classes,
  56. {Borland removed the source to property editors and other IDE goodies in Kylix and D6 up:}  
  57. {$IFDEF COMPILER6_UP}
  58.   DesignEditors, DesignIntf,
  59. {NB: the property editors need DesignEditors and DesignIntf,
  60.  and to avoid rude messages about "DesignConst" (which does not exist),
  61.  you have to add "designide.dcp" to the requires section of this package.}
  62. {$ELSE}
  63.   DsgnIntf,
  64. {$ENDIF}
  65.   DBPlot, Plot,
  66.  
  67. {$IFDEF COMPILER35_UP}
  68.   Plottoolbar,
  69.   Plotimagelist,
  70. {$ENDIF}
  71.   Plotmenu;
  72.  
  73. type
  74.   TDBPlotComponentEditor = class(TComponentEditor)
  75.   public
  76.     function GetVerb(Index: Integer): String; override;
  77.     function GetVerbCount: Integer; override;
  78.     procedure ExecuteVerb(Index: Integer); override;
  79.     procedure Edit; override;
  80.   end;
  81.  
  82. procedure Register;
  83.  
  84. implementation
  85.  
  86. {$IFDEF WINDOWS}
  87. {$R DBPlot16.dcr}
  88. {$ENDIF}
  89. {$IFDEF WIN32}
  90. {$R DBPlot32.dcr}
  91. {$ENDIF}
  92. {$IFDEF LINUX}
  93. {$R DBPlot32.dcr}
  94. {$ENDIF}
  95.  
  96. type
  97.   TAboutProperty = class(TPropertyEditor)
  98.   public
  99.     procedure Edit; override;
  100.     function GetAttributes: TPropertyAttributes; override;
  101.     function GetValue:string; override;
  102.   end;
  103.  
  104.   TAxesProperty = class(TPropertyEditor)
  105.   public
  106.     procedure Edit; override;
  107.     function GetAttributes: TPropertyAttributes; override;
  108.     function GetValue:string; override;
  109.   end;
  110.  
  111.   TDataProperty = class(TPropertyEditor)
  112.   public
  113.     procedure Edit; override;
  114.     function GetAttributes: TPropertyAttributes; override;
  115.     function GetValue:string; override;
  116.   end;
  117.  
  118.   TSeriesProperty = class(TPropertyEditor)
  119.   public
  120.     procedure Edit; override;
  121.     function GetAttributes: TPropertyAttributes; override;
  122.     function GetValue:string; override;
  123.   end;
  124.  
  125. procedure Register;
  126. begin
  127.   RegisterComponents('Data Controls', [TDBPlot]);
  128.  
  129. {register the "About" property editor}
  130.   RegisterPropertyEditor(TypeInfo(String), TDBPlot, 'About', TAboutProperty);
  131. {register the "Data" property editor}
  132.   RegisterPropertyEditor(TypeInfo(String), TDBPlot, 'DataProperties', TDataProperty);
  133. {register the "Series" property editor}
  134.   RegisterPropertyEditor(TypeInfo(String), TDBPlot, 'SeriesProperties', TSeriesProperty);
  135. {register the "Axes" property editor}
  136.   RegisterPropertyEditor(TypeInfo(String), TDBPlot, 'AxesProperties', TAxesProperty);
  137. {register the component editor for menus:}
  138.   RegisterComponentEditor(TDBPlot, TDBPlotComponentEditor);
  139.   {$IFDEF COMPILER35_UP}
  140.   {RegisterPropertyEditor(TypeInfo(String), TPlotToolBar, 'Arrangement', TToolBarProperty);}
  141.   {$ENDIF}
  142. end;
  143.  
  144. {TDBPlotComponentEditor methods:-------------------------------------------------}
  145. function TDBPlotComponentEditor.GetVerb(Index: Integer): String;
  146. begin
  147.   case Index of
  148.     0: Result := '&About TPlot...';
  149.     1: Result := 'A&xes...';
  150.     2: Result := '&Copy';
  151.     3: Result := '&Data...';
  152.     4: Result := '&Properties...';
  153.     5: Result := '&Series...';
  154.   end;
  155. end;
  156.  
  157. function TDBPlotComponentEditor.GetVerbCount: Integer;
  158. begin
  159.   Result := 6;
  160. end;
  161.  
  162. procedure TDBPlotComponentEditor.ExecuteVerb(Index: Integer);
  163. begin
  164.   case Index of
  165.     0: (Component as TPlot).ShowAbout;
  166.     1: (Component as TPlot).ShowAxes;
  167.     2: (Component as TPlot).CopyClick(nil);
  168.     3: (Component as TPlot).ShowData;
  169.     4: (Component as TPlot).ShowProperties;
  170.     5: (Component as TPlot).ShowSeries;
  171.   end;
  172. end;
  173.  
  174. procedure TDBPlotComponentEditor.Edit;
  175. begin
  176.   (Component as TPlot).ShowProperties;
  177. end;
  178. {end TDBPlotComponentEditor methods:---------------------------------------------}
  179.  
  180. {About bits and pieces:------------------------------------------------------}
  181. procedure TAboutProperty.Edit;
  182. {call the "About" dialog window when clicking on ... in the Object Inspector}
  183. begin
  184.   TPlot(GetComponent(0)).ShowAbout;
  185. end;
  186.  
  187. function TAboutProperty.GetAttributes: TPropertyAttributes;
  188. {set up to display a string in the Object Inspector}
  189. begin
  190.   GetAttributes := [paDialog, paReadOnly];
  191. end;
  192.  
  193. function TAboutProperty.GetValue: String;
  194. {set string to appear in the Object Inspector}
  195. begin
  196.   GetValue := '(About...)';
  197. end;
  198.  
  199. {End About bits and pieces:--------------------------------------------------}
  200.  
  201. {Data bits and pieces:------------------------------------------------------}
  202. procedure TDataProperty.Edit;
  203. {call the "Data" dialog window when clicking on ... in the Object Inspector}
  204. begin
  205.   TPlot(GetComponent(0)).ShowData;
  206. end;
  207.  
  208. function TDataProperty.GetAttributes: TPropertyAttributes;
  209. {set up to display a string in the Object Inspector}
  210. begin
  211.   GetAttributes := [paDialog, paReadOnly];
  212. end;
  213.  
  214. function TDataProperty.GetValue: String;
  215. {set string to appear in the Object Inspector}
  216. begin
  217.   GetValue := '(Data...)';
  218. end;
  219.  
  220. {End Data bits and pieces:--------------------------------------------------}
  221.  
  222. {Series bits and pieces:------------------------------------------------------}
  223. procedure TSeriesProperty.Edit;
  224. {call the "Series" dialog window when clicking on ... in the Object Inspector}
  225. begin
  226.   TPlot(GetComponent(0)).ShowSeries;
  227. end;
  228.  
  229. function TSeriesProperty.GetAttributes: TPropertyAttributes;
  230. {set up to display a string in the Object Inspector}
  231. begin
  232.   GetAttributes := [paDialog, paReadOnly];
  233. end;
  234.  
  235. function TSeriesProperty.GetValue: String;
  236. {set string to appear in the Object Inspector}
  237. begin
  238.   GetValue := '(Series...)';
  239. end;
  240.  
  241. {End Series bits and pieces:--------------------------------------------------}
  242.  
  243. {$IFDEF COMPILER35_UP}
  244. {Toolbar bits and pieces:------------------------------------------------------}
  245. {procedure TToolbarProperty.Edit;
  246. begin
  247.   TPlotToolBar(GetComponent(0)).ShowArrangement;
  248. end;
  249.  
  250. function TToolbarProperty.GetAttributes: TPropertyAttributes;
  251. begin
  252.   GetAttributes := [paDialog, paReadOnly];
  253. end;
  254.  
  255. function TToolbarProperty.GetValue: String;
  256. begin
  257.   GetValue := '(Arrangement...)';
  258. end;}
  259. {End Toolbar bits and pieces:--------------------------------------------------}
  260. {$ENDIF}
  261.  
  262. {Axes bits and pieces:------------------------------------------------------}
  263. procedure TAxesProperty.Edit;
  264. {call the "Axes" dialog window when clicking on ... in the Object Inspector}
  265. begin
  266.   TPlot(GetComponent(0)).ShowAxes;
  267. end;
  268.  
  269. function TAxesProperty.GetAttributes: TPropertyAttributes;
  270. {set up to display a string in the Object Inspector}
  271. begin
  272.   GetAttributes := [paDialog, paReadOnly];
  273. end;
  274.  
  275. function TAxesProperty.GetValue: String;
  276. {set string to appear in the Object Inspector}
  277. begin
  278.   GetValue := '(Axes...)';
  279. end;
  280. {End Axes bits and pieces:--------------------------------------------------}
  281.  
  282. end.
  283.