📄 qiplotmastermanager.pas
字号:
{*******************************************************}
{ }
{ TiPlotMasterManager }
{ }
{ Copyright (c) 1997,2003 Iocomp Software }
{ }
{*******************************************************}
{$I iInclude.inc}
{$ifdef iCLX}unit QiPlotMasterManager;{$endif}
{$ifdef iVCL}unit iPlotMasterManager;{$endif}
interface
uses
{$I iIncludeUses.inc}
{$IFDEF iVCL} Menus, Printers, iTypes, iGPFunctions, iComponentEditorButtonPanel, iEditorBasicComponents,{$endif}
{$IFDEF iCLX}QMenus, QPrinters, QiTypes, QiGPFunctions, QiComponentEditorButtonPanel, QiEditorBasicComponents,{$endif}
{$ifdef iVCL} iPlotManagers, iPlotLayoutManager, iPlotObjects, iPlotChannelCustom, iPlotDataCursor, iPlotTranslation, iPlotAnnotation;{$endif}
{$ifdef iCLX}QiPlotManagers, QiPlotLayoutManager, QiPlotObjects, QiPlotChannelCustom, QiPlotDataCursor, QiPlotTranslation, QiPlotAnnotation;{$endif}
type
TWriterAccess = class(TWriter);
TReaderAccess = class(TReader);
//----------------------------------------------------------------------------
TiPlotMasterManager = class(TObject)
private
FOwner : TWinControl;
FUserCanEditObjects : Boolean;
FToolBarManager : TiPlotToolBarManager;
FLegendManager : TiPlotLegendManager;
FTableManager : TiPlotTableManager;
FXAxisManager : TiPlotXAxisManager;
FYAxisManager : TiPlotYAxisManager;
FChannelManager : TiPlotChannelManager;
FDataViewManager : TiPlotDataViewManager;
FDataCursorManager : TiPlotDataCursorManager;
FLimitManager : TiPlotLimitManager;
FLabelManager : TiPlotLabelManager;
FAnnotationManager : TiPlotAnnotationManager;
FTranslationManager : TiPlotTranslationManager;
FLayoutManager : TiPlotLayoutManager;
FPlotObjectManager : TiPlotObjectManager;
FOnInvalidateNow : TNotifyEvent;
FOnChange : TNotifyEvent;
FOnInsert : TNotifyEvent;
FOnRemove : TNotifyEvent;
FChannelClass : TiPlotChannelCustomClass;
FMainPageControlIndex : Integer;
FControlPageControlIndex : Integer;
FChannelPageControlIndex : Integer;
FXAxisPageControlIndex : Integer;
FXAxisLabelsPageControlIndex : Integer;
FYAxisPageControlIndex : Integer;
FYAxisLabelsPageControlIndex : Integer;
FDataCursorPageControlIndex : Integer;
FLimitPageControlIndex : Integer;
FLabelPageControlIndex : Integer;
FLegendPageControlIndex : Integer;
FTablePageControlIndex : Integer;
FDataViewPageControlIndex : Integer;
FDataViewGridLinesCustomPageControlIndex : Integer;
FEditorForm : TCustomForm;
FXYAxesReverse : Boolean;
procedure SetXYAxesReverse(const Value: Boolean);
protected
procedure SetChannelClass (const Value: TiPlotChannelCustomClass);
procedure SetUserCanEditObjects(const Value: Boolean);
procedure NotificationChange (Sender: TObject);
procedure NotificationInsert (Sender: TObject);
procedure NotificationRemove (Sender: TObject);
procedure NotificationRename (Sender: TObject);
procedure NotificationSetFocus (Sender: TObject);
procedure CreateEditor;
procedure DoTranslation(AForm: TCustomForm);
procedure EditorClose(Sender: TObject; var Action: TCloseAction);
procedure EditLayoutObject (Sender: TObject);
public
constructor Create(AOwner : TWinControl);
destructor Destroy; override;
procedure EditProperties;
procedure DeSelectAll;
procedure BasicPropertyChanged;
procedure ShowToolBars (Value : Boolean);
procedure ClearAllData;
function AddChannel : Integer;
function AddDataView : Integer;
function AddDataCursor : Integer;
function AddXAxis : Integer;
function AddYAxis : Integer;
function AddLegend : Integer;
function AddTable : Integer;
function AddToolBar : Integer;
function AddLimit : Integer;
function AddLabel : Integer;
function AddAnnotation : Integer;
function AddTranslation : Integer;
property ObjectManager : TiPlotObjectManager read FPlotObjectManager;
property ToolBarManager : TiPlotToolBarManager read FToolBarManager;
property LegendManager : TiPlotLegendManager read FLegendManager;
property TableManager : TiPlotTableManager read FTableManager;
property XAxisManager : TiPlotXAxisManager read FXAxisManager;
property YAxisManager : TiPlotYAxisManager read FYAxisManager;
property ChannelManager : TiPlotChannelManager read FChannelManager;
property DataViewManager : TiPlotDataViewManager read FDataViewManager;
property DataCursorManager : TiPlotDataCursorManager read FDataCursorManager;
property LimitManager : TiPlotLimitManager read FLimitManager;
property LabelManager : TiPlotLabelManager read FLabelManager;
property AnnotationManager : TiPlotAnnotationManager read FAnnotationManager;
property TranslationManager : TiPlotTranslationManager read FTranslationManager;
property LayoutManager : TiPlotLayoutManager read FLayoutManager;
property OnChange : TNotifyEvent read FOnChange write FOnChange;
property OnInsert : TNotifyEvent read FOnInsert write FOnInsert;
property OnInvalidateNow : TNotifyEvent read FOnInvalidateNow write FOnInvalidateNow;
property OnRemove : TNotifyEvent read FOnRemove write FOnRemove;
property UserCanEditObjects : Boolean read FUserCanEditObjects write SetUserCanEditObjects;
property ChannelClass : TiPlotChannelCustomClass read FChannelClass write SetChannelClass;
property XYAxesReverse : Boolean read FXYAxesReverse write SetXYAxesReverse;
property Owner : TWinControl read FOwner;
end;
implementation
uses
{$ifdef iVCL}iPlotAxis, iPlotLegend, iPlotTable, iPlotToolBar, iPlotDataView, iPlotLimit, iPlotLabel, iPlotEditor, iPlotComponent, iXYPlotChannel;{$endif}
{$ifdef iCLX}QiPlotAxis, QiPlotLegend, QiPlotTable, QiPlotToolBar, QiPlotDataView, QiPlotLimit, QiPlotLabel, QiPlotEditor, QiPlotComponent, QiXYPlotChannel;{$endif}
type
TiPlotToolBarAccess = class(TiPlotToolBar ) end;
TiPlotLayoutObjectAccess = class(TiPlotLayoutObject) end;
TiPlotObjectAccess = class(TiPlotObject ) end;
TiPlotDataViewAccess = class(TiPlotDataView ) end;
TiPlotDataCursorAccess = class(TiPlotDataCursor ) end;
TiPlotLegendAccess = class(TiPlotLegend ) end;
TiPlotTableAccess = class(TiPlotTable ) end;
TiTiPlotComponentAccess = class(TiPlotComponent ) end;
TiPlotXAxisAccess = class(TiPlotXAxis ) end;
TiPlotYAxisAccess = class(TiPlotYAxis ) end;
TControlAccess = class(TControl ) end;
TCustomFormAccess = class(TCustomForm ) end;
//*************************************************************************************************************************************
constructor TiPlotMasterManager.Create(AOwner : TWinControl);
begin
FOwner := AOwner;
TiPlotObjectManager.Create (FOwner, NotificationChange, NotificationInsert, NotificationRemove, NotificationRename);
TiPlotToolBarManager.Create (FOwner, NotificationChange, NotificationInsert, NotificationRemove, NotificationRename);
TiPlotLegendManager.Create (FOwner, NotificationChange, NotificationInsert, NotificationRemove, NotificationRename);
TiPlotTableManager.Create (FOwner, NotificationChange, NotificationInsert, NotificationRemove, NotificationRename);
TiPlotChannelManager.Create (FOwner, NotificationChange, NotificationInsert, NotificationRemove, NotificationRename);
TiPlotDataCursorManager.Create (FOwner, NotificationChange, NotificationInsert, NotificationRemove, NotificationRename);
TiPlotDataViewManager.Create (FOwner, NotificationChange, NotificationInsert, NotificationRemove, NotificationRename);
TiPlotXAxisManager.Create (FOwner, NotificationChange, NotificationInsert, NotificationRemove, NotificationRename);
TiPlotYAxisManager.Create (FOwner, NotificationChange, NotificationInsert, NotificationRemove, NotificationRename);
TiPlotLimitManager.Create (FOwner, NotificationChange, NotificationInsert, NotificationRemove, NotificationRename);
TiPlotLabelManager.Create (FOwner, NotificationChange, NotificationInsert, NotificationRemove, NotificationRename);
TiPlotAnnotationManager.Create (FOwner, NotificationChange, NotificationInsert, NotificationRemove, NotificationRename);
TiPlotLayoutManager.Create (FOwner, NotificationChange, NotificationInsert, NotificationRemove, NotificationRename);
TiPlotTranslationManager.Create( NotificationInsert, NotificationRemove);
FChannelManager.XAxisManager := FXAxisManager;
FChannelManager.YAxisManager := FYAxisManager;
FDataViewManager.XAxisManager := FXAxisManager;
FDataViewManager.YAxisManager := FYAxisManager;
FDataCursorManager.ChannelManager := FChannelManager;
FDataCursorManager.DataViewManager := FDataViewManager;
FLimitManager.XAxisManager := FXAxisManager;
FLimitManager.YAxisManager := FYAxisManager;
end;
//*************************************************************************************************************************************
destructor TiPlotMasterManager.Destroy;
begin
if FOwner is TiPlotComponent then
begin
if Assigned(FEditorForm) then
begin
FEditorForm.Free;
FEditorForm := nil;
end;
end;
if Assigned(FToolBarManager ) then FToolBarManager.Free;
if Assigned(FLegendManager ) then FLegendManager.Free;
if Assigned(FTableManager ) then FTableManager.Free;
if Assigned(FChannelManager ) then FChannelManager.Free;
if Assigned(FXAxisManager ) then FXAxisManager.Free;
if Assigned(FYAxisManager ) then FYAxisManager.Free;
if Assigned(FDataViewManager ) then FDataViewManager.Free;
if Assigned(FDataCursorManager ) then FDataCursorManager.Free;
if Assigned(FLimitManager ) then FLimitManager.Free;
if Assigned(FLabelManager ) then FLabelManager.Free;
if Assigned(FAnnotationManager ) then FAnnotationManager.Free;
if Assigned(FTranslationManager) then FTranslationManager.Free;
if Assigned(FPlotObjectManager ) then FPlotObjectManager.Free;
if Assigned(FLayoutManager) then FLayoutManager.Free;
inherited;
end;
//*************************************************************************************************************************************
procedure TiPlotMasterManager.SetUserCanEditObjects(const Value: Boolean);
var
x : Integer;
begin
FUserCanEditObjects := Value;
for x := 0 to FChannelManager.Count-1 do TiPlotObjectAccess(FChannelManager.Items[x] ).UserCanEdit := Value;
for x := 0 to FXAxisManager.Count-1 do TiPlotObjectAccess(FXAxisManager.Items[x] ).UserCanEdit := Value;
for x := 0 to FYAxisManager.Count-1 do TiPlotObjectAccess(FYAxisManager.Items[x] ).UserCanEdit := Value;
for x := 0 to FDataViewManager.Count-1 do TiPlotObjectAccess(FDataViewManager.Items[x] ).UserCanEdit := Value;
for x := 0 to FToolBarManager.Count-1 do TiPlotObjectAccess(FToolBarManager.Items[x] ).UserCanEdit := Value;
for x := 0 to FLegendManager.Count-1 do TiPlotObjectAccess(FLegendManager.Items[x] ).UserCanEdit := Value;
for x := 0 to FTableManager.Count-1 do TiPlotObjectAccess(FTableManager.Items[x] ).UserCanEdit := Value;
for x := 0 to FDataCursorManager.Count-1 do TiPlotObjectAccess(FDataCursorManager.Items[x]).UserCanEdit := Value;
for x := 0 to FLimitManager.Count-1 do TiPlotObjectAccess(FLimitManager.Items[x] ).UserCanEdit := Value;
for x := 0 to FLabelManager.Count-1 do TiPlotObjectAccess(FLabelManager.Items[x] ).UserCanEdit := Value;
for x := 0 to FAnnotationManager.Count-1 do TiPlotObjectAccess(FAnnotationManager.Items[x]).UserCanEdit := Value;
end;
//*************************************************************************************************************************************
procedure TiPlotMasterManager.SetXYAxesReverse(const Value: Boolean);
var
x : Integer;
begin
FXYAxesReverse := Value;
FLayoutManager.XYAxesReverse := Value;
for x := 0 to FChannelManager.Count-1 do TiPlotObjectAccess(FChannelManager.Items[x] ).XYAxesReversed := Value;
for x := 0 to FXAxisManager.Count-1 do TiPlotObjectAccess(FXAxisManager.Items[x] ).XYAxesReversed := Value;
for x := 0 to FYAxisManager.Count-1 do TiPlotObjectAccess(FYAxisManager.Items[x] ).XYAxesReversed := Value;
for x := 0 to FDataViewManager.Count-1 do TiPlotObjectAccess(FDataViewManager.Items[x] ).XYAxesReversed := Value;
for x := 0 to FToolBarManager.Count-1 do TiPlotObjectAccess(FToolBarManager.Items[x] ).XYAxesReversed := Value;
for x := 0 to FLegendManager.Count-1 do TiPlotObjectAccess(FLegendManager.Items[x] ).XYAxesReversed := Value;
for x := 0 to FTableManager.Count-1 do TiPlotObjectAccess(FTableManager.Items[x] ).XYAxesReversed := Value;
for x := 0 to FDataCursorManager.Count-1 do TiPlotObjectAccess(FDataCursorManager.Items[x]).XYAxesReversed := Value;
for x := 0 to FLimitManager.Count-1 do TiPlotObjectAccess(FLimitManager.Items[x] ).XYAxesReversed := Value;
for x := 0 to FLabelManager.Count-1 do TiPlotObjectAccess(FLabelManager.Items[x] ).XYAxesReversed := Value;
for x := 0 to FAnnotationManager.Count-1 do TiPlotObjectAccess(FAnnotationManager.Items[x]).XYAxesReversed := Value;
if Assigned(FOnInvalidateNow) then FOnInvalidateNow(Self);
end;
//*************************************************************************************************************************************
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -