📄 teechartreg.pas
字号:
{$IFDEF CLR}
if Assigned(tmpForm) then
tmpDesigner:=tmpForm.GetRootDesigner;
{$ENDIF}
if Assigned(tmpForm) and Assigned(tmpForm.{$IFDEF CLX}DesignerHook{$ELSE}Designer{$ENDIF}) then
With TDesignSources.Create do
try
FProc:=AProc;
FItems:=AItems;
FAddCurrent:=AddCurrent;
{$IFDEF CLR}
FFormDesigner:=tmpForm.Designer as TTeeDesigner;
{$ELSE}
{$IFDEF D6DESIGNER}
tmpForm.{$IFDEF CLX}DesignerHook{$ELSE}Designer{$ENDIF}.QueryInterface(IDesigner,FFormDesigner);
{$ELSE}
{$IFDEF LCL}
FFormDesigner:=nil; // LCL Pending.
{$ELSE}
FFormDesigner:=tmpForm.Designer as TTeeDesigner;
{$ENDIF}
{$ENDIF}
{$ENDIF}
{$IFNDEF LCL}
{$IFDEF TEEDBREG}
FFormDesigner.GetComponentNames(GetTypeData(TDataSource.ClassInfo),AddDataSource);
FFormDesigner.GetComponentNames(GetTypeData(TDataSet.ClassInfo),AddDataSource);
{$ENDIF}
FFormDesigner.GetComponentNames(GetTypeData(TChartSeries.ClassInfo),AddDataSource);
FFormDesigner.GetComponentNames(GetTypeData(TTeeSeriesSource.ClassInfo),AddDataSource);
{$ENDIF}
finally
Free;
end;
end;
{$ENDIF}
{ TTeeClassProperty }
{$IFDEF LCL}
function TTeeClassProperty.Designer:TTeeClassProperty;
begin
result:=Self;
end;
{$ENDIF}
function TTeeClassProperty.GetObject:{$IFDEF CLR}TObject{$ELSE}Integer{$ENDIF};
begin
result:={$IFDEF CLR}GetObjValue{$ELSE}GetOrdValue{$ENDIF};
end;
function TTeeClassProperty.GetValue: string;
begin
{$IFDEF CLR}
result:='('+GetPropType.ToString+')'; // Do not localize
{$ELSE}
FmtStr(Result, '(%s)', [GetPropType^.Name]); // Do not localize
{$ENDIF}
end;
{ Chart Editor }
procedure EditChartDesign(AChart:TCustomChart);
var Part : TChartClickedPart;
begin
With AChart do CalcClickedPart(GetCursorPos,Part);
EditChartPart(nil,AChart,Part);
end;
{ EditSeriesProc }
procedure EditSeriesProc(ASeries:TChartSeries; ADesigner:TTeeDesigner);
begin
EditSeries(nil,ASeries);
if Assigned(ADesigner) then
ADesigner.Modified{$IFDEF LCL}(ASeries){$ENDIF}; { 5.01 }
end;
{$IFDEF TEEEDITORS}
{ TImageFilteredEditor }
procedure TImageFilteredEditor.Edit;
var tmp : TImageFiltered;
begin
tmp:=TImageFiltered(Component);
if Assigned(tmp.Picture) then
if ShowFiltersEditor(nil,tmp.Picture.Graphic, tmp.Filters) then
begin
tmp.Repaint;
Designer.Modified;
end;
end;
procedure TImageFilteredEditor.ExecuteVerb( Index : Integer );
begin
if Index=0 then Edit
else inherited;
end;
function TImageFilteredEditor.GetVerbCount : Integer;
begin
result:=inherited GetVerbCount+1;
end;
function TImageFilteredEditor.GetVerb( Index : Integer ) : string;
begin
if Index=0 then result:=TeeMsg_MenuFilters
else result:=inherited GetVerb(Index);
end;
{ TChartCompEditor }
Function TChartCompEditor.Chart:TCustomChart;
begin
result:=TCustomChart(Component);
end;
procedure TChartCompEditor.Edit;
begin
EditChartDesign(Chart);
Designer.Modified;
end;
procedure TChartCompEditor.ExecuteVerb( Index : Integer );
begin
Case Index of
0..3: TeeShowAboutBox;
4: Edit;
5: ChartPreview(nil,Chart);
6: TeeExport(Application,Chart);
else
begin
case Index of
{$IFDEF TEESHOWCUSTOMAXES}
7: ShowCollectionEditor(Designer,Chart,Chart.CustomAxes,'CustomAxes'); // Do not localize
{$IFDEF CLX}
8: if Assigned(TeeDesignOptionsHook) then TeeDesignOptionsHook;
{$ELSE}
{$IFDEF BCB}
8: if Assigned(TeeDesignOptionsHook) then TeeDesignOptionsHook;
{$ELSE}
8: if Assigned(TeeChartEditorHook) then
TeeChartEditorHook(Designer,Chart.SeriesList,EditSeriesProc)
else
if Assigned(TeeDesignOptionsHook) then TeeDesignOptionsHook;
9: if Assigned(TeeDesignOptionsHook) then TeeDesignOptionsHook;
{$ENDIF}
{$ENDIF}
{$ELSE}
{$IFDEF CLX}
7: if Assigned(TeeDesignOptionsHook) then TeeDesignOptionsHook;
{$ELSE}
{$IFDEF BCB}
7: if Assigned(TeeDesignOptionsHook) then TeeDesignOptionsHook;
{$ELSE}
7: if Assigned(TeeChartEditorHook) then
{$IFNDEF LCL} // LCL Pending.
TeeChartEditorHook(Designer,Chart.SeriesList,EditSeriesProc)
{$ENDIF}
else
if Assigned(TeeDesignOptionsHook) then TeeDesignOptionsHook;
8: if Assigned(TeeDesignOptionsHook) then TeeDesignOptionsHook;
{$ENDIF}
{$ENDIF}
{$ENDIF}
else inherited;
end;
end;
end;
end;
function TChartCompEditor.GetVerbCount : Integer;
begin
Result:=inherited GetVerbCount+{$IFDEF TEESHOWCUSTOMAXES}8{$ELSE}7{$ENDIF};
if Assigned(TeeChartEditorHook) then Inc(result);
if Assigned(TeeDesignOptionsHook) then Inc(result);
end;
function TChartCompEditor.GetVerb( Index : Integer ) : string;
begin
result:='';
Case Index of
0: begin
result:=TeeMsg_Version;
if TeeIsTrial then result:=result+' TRIAL'; // Do not localize
end;
1: result:=TeeMsg_Copyright;
2: result:={$IFDEF D5}cLineCaption{$ELSE}'-'{$ENDIF}; // Do not localize
3: result:=TeeMsg_About;
4: result:=TeeMsg_EditChart;
5: result:=TeeMsg_PrintPreview;
6: result:=TeeMsg_ExportChart;
else
begin
case Index of
{$IFDEF TEESHOWCUSTOMAXES}
7: result:=TeeMsg_CustomAxes;
{$IFDEF BCB}
8: result:=TeeMsg_Options;
{$ELSE}
8: if Assigned(TeeChartEditorHook) then result:=TeeMsg_SeriesList
else result:=TeeMsg_Options;
9: result:=TeeMsg_Options;
{$ENDIF}
{$ELSE}
{$IFDEF CLX}
7: result:=TeeMsg_Options;
{$ELSE}
{$IFDEF BCB}
7: result:=TeeMsg_Options;
{$ELSE}
7: if Assigned(TeeChartEditorHook) then result:=TeeMsg_SeriesList
else result:=TeeMsg_Options;
8: result:=TeeMsg_Options;
{$ENDIF}
{$ENDIF}
{$ENDIF}
end;
end;
end;
end;
procedure TChartSeriesEditor.Edit;
begin
{$IFNDEF CLX}
{$IFNDEF LCL} // LCL Pending.
EditSeriesProc(TChartSeries(Component),Designer);
{$ENDIF}
{$ENDIF}
end;
procedure TChartSeriesEditor.ExecuteVerb( Index : Integer );
begin
if Index=0 then Edit else inherited;
end;
function TChartSeriesEditor.GetVerbCount : Integer;
begin
result:=inherited GetVerbCount+1;
end;
function TChartSeriesEditor.GetVerb( Index : Integer ) : string;
begin
if Index=0 then result:=TeeMsg_Edit
else result:=inherited GetVerb(Index);
end;
{ Generic Chart Class Editor (for chart sub-components) }
{ TChartClassProperty }
function TChartClassProperty.GetAttributes: TPropertyAttributes;
begin
Result := [paSubProperties,paDialog];
end;
procedure TChartClassProperty.InternalEditPage( AChart:TCustomChart;
APage:Integer);
begin
EditChartPage(nil,AChart,APage);
Designer.Modified;
end;
{ Chart Legend Editor }
procedure TChartLegendProperty.Edit;
begin
EditChartLegend(nil,TCustomChart(TChartLegend(GetObject).ParentChart));
Designer.Modified;
end;
{ Axis Chart Editor }
procedure TChartAxisProperty.Edit;
begin
EditChartAxis(nil,TChartAxis(GetObject));
Designer.Modified;
end;
{ Series list Editor (used by Chart1.SeriesList and TSeriesGroup.Series properties) }
function TCustomSeriesListProperty.GetAttributes: TPropertyAttributes;
begin
Result := [paDialog];
end;
procedure TCustomSeriesListProperty.Edit;
var AList : TCustomSeriesList;
t : Integer;
AGroup : TSeriesGroup;
begin
AList:=TCustomSeriesList(GetObject);
if Assigned(TeeChartEditorHook) then
begin
{$IFNDEF LCL} // LCL Pending.
AGroup:=nil;
with AList.Owner.SeriesGroups do
for t:=0 to Count-1 do
if Items[t].Series=AList then
begin
AGroup:=Items[t];
break;
end;
TeeChartEditorHook(Designer,AList,EditSeriesProc,AGroup)
{$ENDIF}
end
else
begin
EditChart(nil,AList.Owner as TCustomChart);
Designer.Modified;
end;
end;
{ Chart Tools Editor }
procedure TChartToolsProperty.Edit;
var AChart : TCustomChart;
begin
AChart:=TCustomChart(TChartTools(GetObject).Owner);
if AChart.Tools.Count>0 then
EditChartTool(nil,AChart.Tools[0])
else
EditChart(nil,AChart);
Designer.Modified;
end;
function TChartToolsProperty.GetAttributes : TPropertyAttributes;
begin
Result := [paDialog];
end;
{ Chart Axis Title Editor }
function TChartAxisTitleProperty.GetAttributes: TPropertyAttributes;
begin
Result := [paSubProperties];
end;
{ Chart Title Editor }
procedure TChartTitleProperty.Edit;
begin
EditChartTitle(nil,TChartTitle(GetObject));
Designer.Modified;
end;
{ Chart Wall Editor }
procedure TChartWallProperty.Edit;
begin
EditChartWall(nil,TChartWall(GetObject));
Designer.Modified;
end;
{ Series Pointer Editor }
procedure TSeriesPointerProperty.Edit;
var tmp : TSeriesPointer;
begin
tmp:=TSeriesPointer(GetObject);
{$IFNDEF CLX}
if tmp.ParentSeries is TCustomSeries then
{$IFNDEF LCL} // LCL Pending.
EditSeriesProc(tmp.ParentSeries,Designer)
{$ENDIF}
else
{$ENDIF}
if EditSeriesPointer(nil,tmp) then // 7.05
Designer.Modified;
end;
{ ChartPen Editor }
procedure TChartPenProperty.Edit;
begin
if EditChartPen(nil,TChartPen(GetObject)) then
Designer.Modified;
end;
{ ChartBrush Editor }
procedure TChartBrushProperty.Edit;
begin
if EditChartBrush(nil,TChartBrush(GetObject)) then
Designer.Modified;
end;
procedure TChartPageProperty.Edit;
begin
InternalEditPage(TCustomChart(TChartPage(GetObject).Parent),teeEditPagingPage);
end;
{ Chart Series Marks Editor }
procedure TSeriesMarksProperty.Edit;
var ASeriesMarks : TSeriesMarks;
begin
ASeriesMarks:=TSeriesMarks(GetObject);
if Assigned(ASeriesMarks) then
With ASeriesMarks do
if Assigned(ParentSeries) then
begin
EditSeriesMarks(nil,ParentSeries);
Designer.Modified;
end;
end;
{ Gradient Editor }
procedure TChartGradientProperty.Edit;
begin
if EditTeeGradient(nil,TCustomTeeGradient(GetObject)) then
Designer.Modified;
end;
{ TTeeShadowProperty }
procedure TTeeShadowProperty.Edit;
begin
if EditTeeShadow(nil,TTeeShadow(GetObject)) then
Designer.Modified;
end;
{ Bar Series Gradient Editor }
procedure TBarSeriesGradientProperty.Edit;
begin
EditTeeGradient(nil,TBarSeriesGradient(GetObject),True,True);
end;
{ TSeriesDataSource Property }
type
TSeriesDataSourceProperty = class(TComponentProperty)
private
FAddDataSetProc:TGetStrProc;
procedure AddDataSource(Const S:String);
{$IFDEF LCL}
function Designer:TTeeDesigner;
{$ENDIF}
public
procedure GetValues(Proc: TGetStrProc); override;
end;
procedure TSeriesDataSourceProperty.AddDataSource(Const S:String);
Var tmpSeries : TChartSeries;
tmpComp : TComponent;
begin
if S<>'' then
begin
tmpComp:=Designer.GetComponent(S);
if Assigned(tmpComp) then
begin
tmpSeries:=TChartSeries(GetComponent(0));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -