home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 September / Chip_2001-09_cd1.bin / zkuste / delphi / kolekce / d12345 / CHEMPLOT.ZIP / TPlot / Plot_Reg.pas < prev    next >
Pascal/Delphi Source File  |  2001-05-02  |  9KB  |  308 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. {$IFDEF WINDOWS}
  58.   DsgnIntf, 
  59. {$ENDIF}
  60. {$IFDEF WIN32}
  61.   DsgnIntf, comctrls,
  62. {$ENDIF}
  63. {$IFDEF LINUX}
  64.   {Designide, DesignEditors, DesignIntf,}QComCtrls,
  65. {$ENDIF}
  66.   Plot,
  67.  
  68. {$IFDEF COMPILER35_UP}
  69.   Plottoolbar,
  70.   Plotimagelist,
  71. {$ENDIF}
  72.   Plotmenu;
  73.  
  74. {$IFDEF MSWINDOWS}
  75. type
  76.   TPlotComponentEditor = class(TComponentEditor)
  77.   public
  78.     function GetVerb(Index: Integer): String; override;
  79.     function GetVerbCount: Integer; override;
  80.     procedure ExecuteVerb(Index: Integer); override;
  81.     procedure Edit; override;
  82.   end;
  83. {$ENDIF}
  84.  
  85. procedure Register;
  86.  
  87. implementation
  88.  
  89. {$IFDEF WINDOWS}
  90. {$R Plot16.dcr}
  91. {$ENDIF}
  92. {$IFDEF WIN32}
  93. {$R Plot32.dcr}
  94. {$ENDIF}
  95. {$IFDEF LINUX}
  96. {$R Plot32.dcr}
  97. {$ENDIF}
  98.  
  99. {$IFDEF MSWINDOWS}
  100. type
  101.   TAboutProperty = class(TPropertyEditor)
  102.   public
  103.     procedure Edit; override;
  104.     function GetAttributes: TPropertyAttributes; override;
  105.     function GetValue:string; override;
  106.   end;
  107.  
  108.   TAxesProperty = class(TPropertyEditor)
  109.   public
  110.     procedure Edit; override;
  111.     function GetAttributes: TPropertyAttributes; override;
  112.     function GetValue:string; override;
  113.   end;
  114.  
  115.   TDataProperty = class(TPropertyEditor)
  116.   public
  117.     procedure Edit; override;
  118.     function GetAttributes: TPropertyAttributes; override;
  119.     function GetValue:string; override;
  120.   end;
  121.  
  122.   TSeriesProperty = class(TPropertyEditor)
  123.   public
  124.     procedure Edit; override;
  125.     function GetAttributes: TPropertyAttributes; override;
  126.     function GetValue:string; override;
  127.   end;
  128.  
  129.   {$IFDEF COMPILER35_UP}
  130.   {TToolBarProperty = class(TPropertyEditor)
  131.   public
  132.     procedure Edit; override;
  133.     function GetAttributes: TPropertyAttributes; override;
  134.     function GetValue:string; override;
  135.   end;}
  136.   {$ENDIF}
  137. {$ENDIF}
  138.  
  139. procedure Register;
  140. begin
  141.   RegisterComponents('Samples', [TPlot]);
  142.   RegisterComponents('Samples', [TPlotMenu]);
  143. {$IFDEF COMPILER35_UP}
  144.   RegisterComponents('Samples', [TPlotToolBar]);
  145.   RegisterComponents('Samples', [TPlotImageList]);
  146.   //RegisterComponents('Samples', [TPlotActionList]); - not quiet yet
  147. {$ENDIF}
  148.  
  149. {$IFDEF MSWINDOWS}
  150. {register the "About" property editor}
  151.   RegisterPropertyEditor(TypeInfo(String), TPlot, 'About', TAboutProperty);
  152. {register the "Data" property editor}
  153.   RegisterPropertyEditor(TypeInfo(String), TPlot, 'DataProperties', TDataProperty);
  154. {register the "Series" property editor}
  155.   RegisterPropertyEditor(TypeInfo(String), TPlot, 'SeriesProperties', TSeriesProperty);
  156. {register the "Axes" property editor}
  157.   RegisterPropertyEditor(TypeInfo(String), TPlot, 'AxesProperties', TAxesProperty);
  158. {register the component editor for menus:}
  159.   RegisterComponentEditor(TPlot, TPlotComponentEditor);
  160.   {$IFDEF COMPILER35_UP}
  161.   {RegisterPropertyEditor(TypeInfo(String), TPlotToolBar, 'Arrangement', TToolBarProperty);}
  162.   {$ENDIF}
  163. {$ENDIF}
  164. end;
  165.  
  166. {$IFDEF MSWINDOWS}
  167. {TPlotComponentEditor methods:-------------------------------------------------}
  168. function TPlotComponentEditor.GetVerb(Index: Integer): String;
  169. begin
  170.   case Index of
  171.     0: Result := '&About TPlot...';
  172.     1: Result := 'A&xes...';
  173.     2: Result := '&Copy';
  174.     3: Result := '&Data...';
  175.     4: Result := '&Properties...';
  176.     5: Result := '&Series...';
  177.   end;
  178. end;
  179.  
  180. function TPlotComponentEditor.GetVerbCount: Integer;
  181. begin
  182.   Result := 6;
  183. end;
  184.  
  185. procedure TPlotComponentEditor.ExecuteVerb(Index: Integer);
  186. begin
  187.   case Index of
  188.     0: (Component as TPlot).ShowAbout;
  189.     1: (Component as TPlot).ShowAxes;
  190.     2: (Component as TPlot).CopyClick(nil);
  191.     3: (Component as TPlot).ShowData;
  192.     4: (Component as TPlot).ShowProperties;
  193.     5: (Component as TPlot).ShowSeries;
  194.   end;
  195. end;
  196.  
  197. procedure TPlotComponentEditor.Edit;
  198. begin
  199.   (Component as TPlot).ShowProperties;
  200. end;
  201. {end TPlotComponentEditor methods:---------------------------------------------}
  202. {$ENDIF}
  203.  
  204. {$IFDEF MSWINDOWS}
  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. {Series bits and pieces:------------------------------------------------------}
  248. procedure TSeriesProperty.Edit;
  249. {call the "Series" dialog window when clicking on ... in the Object Inspector}
  250. begin
  251.   TPlot(GetComponent(0)).ShowSeries;
  252. end;
  253.  
  254. function TSeriesProperty.GetAttributes: TPropertyAttributes;
  255. {set up to display a string in the Object Inspector}
  256. begin
  257.   GetAttributes := [paDialog, paReadOnly];
  258. end;
  259.  
  260. function TSeriesProperty.GetValue: String;
  261. {set string to appear in the Object Inspector}
  262. begin
  263.   GetValue := '(Series...)';
  264. end;
  265.  
  266. {End Series bits and pieces:--------------------------------------------------}
  267.  
  268. {$IFDEF COMPILER35_UP}
  269. {Toolbar bits and pieces:------------------------------------------------------}
  270. {procedure TToolbarProperty.Edit;
  271. begin
  272.   TPlotToolBar(GetComponent(0)).ShowArrangement;
  273. end;
  274.  
  275. function TToolbarProperty.GetAttributes: TPropertyAttributes;
  276. begin
  277.   GetAttributes := [paDialog, paReadOnly];
  278. end;
  279.  
  280. function TToolbarProperty.GetValue: String;
  281. begin
  282.   GetValue := '(Arrangement...)';
  283. end;}
  284. {End Toolbar bits and pieces:--------------------------------------------------}
  285. {$ENDIF}
  286.  
  287. {Axes bits and pieces:------------------------------------------------------}
  288. procedure TAxesProperty.Edit;
  289. {call the "Axes" dialog window when clicking on ... in the Object Inspector}
  290. begin
  291.   TPlot(GetComponent(0)).ShowAxes;
  292. end;
  293.  
  294. function TAxesProperty.GetAttributes: TPropertyAttributes;
  295. {set up to display a string in the Object Inspector}
  296. begin
  297.   GetAttributes := [paDialog, paReadOnly];
  298. end;
  299.  
  300. function TAxesProperty.GetValue: String;
  301. {set string to appear in the Object Inspector}
  302. begin
  303.   GetValue := '(Axes...)';
  304. end;
  305. {End Axes bits and pieces:--------------------------------------------------}
  306. {$ENDIF}
  307. end.
  308.