home *** CD-ROM | disk | FTP | other *** search
/ Delphi 5 for Professionals / DELPHI5.iso / AddOns / Components / TEECHART / Delphi1_And_Delphi2 / QuickReport / QRTEEREG.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1998-10-24  |  3.4 KB  |  136 lines

  1. {**********************************************}
  2. {  TeeChart 4.0 --> QuickReports 2.0 or 3.0    }
  3. {                                              }
  4. {  Component Registration Unit.                }
  5. {                                              }
  6. {  Copyright (c) 1996-98 by David Berneda      }
  7. {  All Rights Reserved                         }
  8. {**********************************************}
  9.  
  10. {$I teedefs.inc}
  11. unit QRTeeReg;
  12.  
  13. interface
  14.  
  15. procedure Register;
  16.  
  17. implementation
  18.  
  19. Uses Classes,DBChart,TeeConst,QRTee,SysUtils,DsgnIntf,TeeAbout,
  20.      TeePrevi,TeEngine,
  21.      {$IFDEF D1}
  22.      IEdit16,
  23.      {$ELSE}
  24.      IEdiGene,
  25.      {$ENDIF}
  26.      EditChar
  27.      {$IFNDEF NOUSE_BDE}
  28.      {$IFNDEF D1}
  29.      ,DBEditCh
  30.      {$ENDIF}
  31.      {$ENDIF}
  32.      ;
  33.  
  34. {$IFDEF D1}
  35. {$R TEEQR.R16}
  36. {$ELSE}
  37. {$R TEEQR.RES}
  38. {$ENDIF}
  39.  
  40. type
  41.   TQRChartCompEditor=class(TComponentEditor)
  42.   public
  43.     procedure ExecuteVerb( Index : Integer ); override;
  44.     procedure Edit; override;
  45.     function GetVerbCount : Integer; override;
  46.     function GetVerb( Index : Integer ) : string; override;
  47.   end;
  48.  
  49.   TQRChartProperty=class(TClassProperty)
  50.   public
  51.     procedure Edit; override;
  52.     function GetValue: string; override;
  53.     function GetAttributes : TPropertyAttributes; override;
  54.   end;
  55.  
  56. { QRChart Editor }
  57. procedure TQRChartCompEditor.ExecuteVerb( Index : Integer );
  58. Var AChart:TQRDBChart;
  59. begin
  60.   AChart:=TQRChart(Component).Chart;
  61.   Case Index of
  62.     3: TeeShowAboutBox({$IFDEF TEETRIAL}True{$ELSE}False{$ENDIF});
  63.     4: Edit;
  64.     5: ChartPreview(nil,AChart);
  65.     6: ChartExport(nil,AChart);
  66.   else
  67.     inherited ExecuteVerb(Index);
  68.   end;
  69. {  ChartExecuteVerb( Index,TQRChart(Component).Chart ); }
  70. end;
  71.  
  72. procedure TQRChartCompEditor.Edit;
  73. Var AChart:TQRDBChart;
  74.     Part:TChartClickedPart;
  75. begin
  76.   AChart:=TQRChart(Component).Chart;
  77.   With AChart do CalcClickedPart(GetCursorPos,Part);
  78.   EditChartPart(nil,AChart,Part);
  79. {  EditChartDesign(TQRChart(Component).Chart); }
  80.   Designer.Modified;
  81. end;
  82.  
  83. function TQRChartCompEditor.GetVerbCount : Integer;
  84. begin
  85.   Result := 7;
  86. end;
  87.  
  88. function TQRChartCompEditor.GetVerb( Index : Integer ) : string;
  89. begin
  90.   result:='';
  91.   Case Index of
  92.     0: result:=TeeMsg_Version;
  93.     1: result:=TeeMsg_Copyright;
  94.     2: result:='-';  { <--- do not change or translate... }
  95.     3: result:=TeeMsg_About;
  96.     4: result:=TeeMsg_EditChart;
  97.     5: result:=TeeMsg_PrintPreview;
  98.     6: result:=TeeMsg_ExportChart;
  99.   end;
  100. end;
  101.  
  102. { QRChart property Editor }
  103. procedure TQRChartProperty.Edit;
  104. Var AChart:TDBChart;
  105.     Part:TChartClickedPart;
  106. begin
  107.   AChart:=TDBChart(GetOrdValue);
  108.   With AChart do CalcClickedPart(GetCursorPos,Part);
  109.   EditChartPart(nil,AChart,Part);
  110. {  EditChartDesign(TDBChart(GetOrdValue)); }
  111.   Designer.Modified;
  112. end;
  113.  
  114. function TQRChartProperty.GetAttributes: TPropertyAttributes;
  115. begin
  116.   Result := [paDialog];
  117. end;
  118.  
  119. function TQRChartProperty.GetValue: string;
  120. begin
  121.   FmtStr(Result, '(%s)', [GetPropType^.Name]);
  122. end;
  123.  
  124. procedure Register;
  125. begin
  126.   RegisterNoIcon([TQRDBChart]);
  127.   RegisterComponents( tcQReport,[TQRChart] );
  128.   RegisterComponentEditor(TQRChart,TQRChartCompEditor);
  129.   RegisterPropertyEditor( TypeInfo(TQRDBChart),TQRChart,'Chart',TQRChartProperty); { <-- do not translate }
  130.   {$IFDEF D3}
  131.   RegisterNonActiveX([TQRDBChart,TQRChart] , axrIncludeDescendants );
  132.   {$ENDIF}
  133. end;
  134.  
  135. end.
  136.