📄 teeeditcha.pas
字号:
{$IFDEF CLX}
TeeFixParentedForm(TheFormSeries);
{$ENDIF}
Show;
end;
TeeTranslateControl(TheFormSeries,[TheFormSeries.CBSeries]);
end;
TheFormSeries.SetCBSeries;
end;
procedure TChartEditForm.GridMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState;
X, Y: Integer);
begin
if (Button=mbRight) and (ssAlt in Shift) then
if (Chart.SeriesCount>0) and Chart[0].HasZValues then
with (Sender as TChartGrid) do
Grid3DMode:=not Grid3DMode;
end;
procedure TChartEditForm.SelectTreeNodeData(AObject: TObject);
var t: Integer;
begin
for t:=0 to Tree.Items.Count-1 do
if Tree.Items[t].Data=AObject then
begin
if Tree.Selected<>Tree.Items[t] then
Tree.Selected:=Tree.Items[t];
exit;
end;
end;
{$IFNDEF TEELITE}
type
TFormTeeToolsAccess=class(TFormTeeTools);
procedure TChartEditForm.CreateToolsForm;
var tmp : TFormTeeTools;
tmpTool : Integer;
begin
tmp:=TFormTeeTools.Create(Self);
tmp.Align:=alClient;
AddFormTo(tmp,TabTools,Chart);
TFormTeeToolsAccess(tmp).OnAdded:=AddedTool;
TFormTeeToolsAccess(tmp).OnDeleted:=DeletedTool;
if Assigned(TheTool) then
begin
tmpTool:=tmp.LBTools.Items.IndexOfObject(TheTool);
if tmpTool<>-1 then
begin
tmp.LBTools.ItemIndex:=tmpTool;
tmp.LBToolsClick(Self);
end;
TheTool:=nil;
end;
end;
{$ENDIF}
procedure TChartEditForm.MainPageChange(Sender: TObject);
Procedure SetTabPrint;
begin
if not Assigned(FPreview) then
begin
Screen.Cursor:=crHourGlass;
try
FPreview:=TChartPreview.Create(Self);
with FPreview do
begin
GBMargins.Visible:=False;
PanelMargins.Visible:=False;
HideCloseButton;
Align:=alClient;
end;
AddFormTo(FPreview,TabPrint,Chart);
finally
Screen.Cursor:=crDefault;
end;
end
else FPreview.TeePreviewPanel1.Invalidate; // 5.03
end;
Procedure SetTabTools;
begin
{$IFNDEF TEELITE}
if TabTools.ControlCount=0 then
CreateToolsForm
else // Refresh the tool form, if any...
TFormTeeTools(TabTools.Controls[0]).Reload;
{$ENDIF}
end;
Procedure SetTabExport;
var tmp : TTeeExportForm;
begin
if TabExport.ControlCount=0 then
begin
tmp:=TTeeExportForm.Create(Self);
AddFormTo(tmp,TabExport,Chart);
with tmp do
begin
Align:=alClient;
BClose.Visible:=False;
end;
end
else tmp:=TTeeExportForm(TabExport.Controls[0]);
with tmp do
begin
CBFileSize.Checked:=False;
if cetExportNative in TheHiddenTabs then
tmp.TabNative.TabVisible:=False;
EnableButtons;
end;
end;
Procedure SetTabData;
begin
with ChartGrid1 do
begin
Chart:=Self.Chart;
ShowColors:=(Chart.SeriesCount>0) and HasColors(Chart[0]);
RecalcDimensions;
SBGridCol.Down:=ShowColors;
SBGridText.Down:=ShowLabels;
SBGrid3D.Down:=Grid3DMode;
SBGrid3D.Enabled:=(Chart.SeriesCount>0) and Chart[0].HasZValues;
SBGridX.Down:=(Chart.SeriesCount>0) and HasNoMandatoryValues(Chart[0]);
{$IFNDEF TEEOCX}
if not Tree.Visible then
SetFocus;
{$ENDIF}
OnMouseDown:=GridMouseDown;
end;
end;
begin
{$IFDEF D5}
if HighLightTabs then MainPage.ActivePage.HighLighted:=True;
{$ENDIF}
if Tree.Visible then
SelectTreeNodeData(MainPage.ActivePage);
if MainPage.ActivePage=TabSeries then SetTabSeries
else
if MainPage.ActivePage=TabData then SetTabData
else
if MainPage.ActivePage=TabTools then SetTabTools
else
if MainPage.ActivePage=TabExport then SetTabExport
else
if MainPage.ActivePage=TabPrint then SetTabPrint
{$IFDEF CLX}
// Workaround for CLX ListBox MultiSelect + ItemIndex=-1 bug
else
if MainPage.ActivePage=TabChart then
begin
if (not LBSeries.Focused) and (LBSeries.CanFocus) then
begin
LBSeries.SetFocus;
LBSeriesRefreshButtons(LBSeries);
end;
end
{$ENDIF}
else BroadCastShowEditor(MainPage.ActivePage);
end;
{$IFNDEF CLX}
{$IFNDEF LCL}
procedure TChartEditForm.WMHelp(var Message: TWMHelp);
var Control : TWinControl;
begin
if biHelp in BorderIcons then
with Message.HelpInfo{$IFNDEF CLR}^{$ENDIF} do
begin
if iContextType = HELPINFO_WINDOW then
begin
Control := FindControl(hItemHandle);
while Assigned(Control) and (Control.HelpContext = 0) do
Control := Control.Parent;
if Assigned(Control) then
Application.HelpContext(Control.HelpContext);
end;
end
else inherited;
end;
{$ENDIF}
{$ENDIF}
procedure TChartEditForm.SetChart(Value:TCustomChart);
begin
TheChart:=Value;
if Assigned(TheChart) then TheChart.FreeNotification(Self);
LBSeries.Chart:=TheChart;
MainPage.Enabled:=Assigned(TheChart);
SubPage.Enabled:=Assigned(TheChart);
{$IFNDEF LINUX}
if Assigned(TheChart) and (RememberPosition or RememberSize) then
with TRegistry.Create do
try
if OpenKeyReadOnly(TeeMsg_EditorKey) then
begin
if RememberPosition then
if ValueExists('Left') then
begin
Self.Position:=poDesigned;
Self.Left:=Math.Max(0,ReadInteger('Left'));
Self.Top:=Math.Max(0,ReadInteger('Top'));
end;
if RememberSize then
begin
if ValueExists('Width') then
Self.Width:=Math.Max(100,ReadInteger('Width'));
if ValueExists('Height') then
Self.Height:=Math.Max(100,ReadInteger('Height'));
if ValueExists('TreeWidth') and Assigned(Tree) then
Self.Tree.Width:=Math.Max(10,ReadInteger('TreeWidth'));
end;
// 7.05
if Self.Left>Screen.Width then
Self.Left:=Screen.Width-Self.Width;
if Self.Top>Screen.Height then
Self.Top:=Screen.Height-Self.Height;
end;
finally
Free;
end;
{$ENDIF}
end;
procedure TChartEditForm.ReparentAxis;
begin
if TabAxis.ControlCount>0 then
with TFormTeeAxis(TabAxis.Controls[0]) do
PageAxis.Parent:=TFormTeeAxis(TabAxis.Controls[0]);
end;
procedure TChartEditForm.ReparentTitle;
begin
if TabTitle.ControlCount>0 then
with TFormTeeTitle(TabTitle.Controls[0]) do
PageControlTitle.Parent:=TFormTeeTitle(TabTitle.Controls[0]);
end;
procedure TChartEditForm.ReparentTools;
begin
{$IFNDEF TEELITE}
if TabTools.ControlCount>0 then
with TFormTeeTools(TabTools.Controls[0]) do
PanelToolEditor.Parent:=TFormTeeTools(TabTools.Controls[0]);
{$ENDIF}
end;
procedure TChartEditForm.ResetParentTab(PageControl:TPageControl);
var t : Integer;
begin
for t:=0 to PageControl.PageCount-1 do
PageControl.Pages[t].Parent:=PageControl;
ReparentAxis;
ReparentTitle;
ReparentTools;
SubPage.Parent:=TabChart;
end;
procedure TChartEditForm.FormCloseQuery(Sender: TObject;
var CanClose: Boolean);
begin
if Assigned(TheFormSeries) then
begin
TheFormSeries.FormCloseQuery(Sender,CanClose);
if CanClose then Close;
end;
end;
procedure TChartEditForm.TreeSelectSeries(Series: TChartSeries);
var tmpCanChange : Boolean;
begin
SubPage.Parent:=TabChart;
TabSeriesList.Parent:=SubPage;
TabSeriesList.TabVisible:=True;
tmpCanChange:=True;
if Assigned(TheFormSeries) then
TheFormSeries.PageSeriesChanging(TheFormSeries.PageSeries,tmpCanChange);
if tmpCanChange then
begin
TabSeries.Parent:=TreePanel;
TabSeries.Align:=alClient;
{$IFDEF D10} // Workaround a bug in FT1
LBSeries.Handle; // Force HandleAllocated
{$ENDIF}
LBSeries.SelectedSeries:=Series;
SetTabSeries;
TabSeries.Show;
if Assigned(TheFormSeries) then
TheFormSeries.PageSeriesChange(TheFormSeries.PageSeries);
end;
end;
Function TChartEditForm.TreeNodeCurrentSeries:TTreeNode;
var t : Integer;
begin
result:=nil;
if Assigned(TreeNodeSeries) then
for t:=0 to TreeNodeSeries.Count-1 do
if TreeNodeSeries.{$IFDEF LCL}Items{$ELSE}Item{$ENDIF}[t].Data=LBSeries.SelectedSeries then
begin
result:=TreeNodeSeries.{$IFDEF LCL}Items{$ELSE}Item{$ENDIF}[t];
break;
end;
end;
procedure TChartEditForm.LBSeriesEditSeries(Sender: TChartListBox;
Index: Integer);
begin
if LBSeries.ItemIndex<>-1 then
if Tree.Visible and (TreeNodeCurrentSeries<>nil) then
TreeNodeCurrentSeries.Selected:=True
else
begin
MainPage.ActivePage:=TabSeries;
{$IFNDEF CLX}
SetTabSeries;
{$ENDIF}
end;
end;
procedure TChartEditForm.LBSeriesOtherItemsChange(Sender: TObject);
begin
if Assigned(TheFormSeries) then
begin
if not Assigned(TabSeries.Parent) then
TabSeries.Parent:=MainPage;
TheFormSeries.CBSeries.ItemIndex:=LBSeries.ItemIndex;
end;
end;
procedure TChartEditForm.LBSeriesRefreshButtons(Sender: TObject);
var tmp : Boolean;
tmpInherited : Boolean;
tmpSeries : TChartSeries;
begin
tmp:=(Chart.SeriesCount>0) {$IFNDEF TEEOCX} and LBSeries.CanFocus {$ENDIF} and (LBSeries.ItemIndex<>-1);
if tmp then tmpSeries:=Chart.Series[LBSeries.ItemIndex]
else tmpSeries:=nil;
tmpInherited:=tmp and (csAncestor in tmpSeries.ComponentState);
BAddSeries.Enabled:=(ceAdd in EditorOptions);
BDeleteSeries.Enabled:= tmp and
(not tmpInherited) and
(ceDelete in EditorOptions)
and
(not (tssIsTemplate in tmpSeries.Style)) and
(not (tssDenyDelete in tmpSeries.Style)) ;
BRenameSeries.Enabled:=tmp and (LBSeries.SelCount<2) and (ceTitle in EditorOptions);
BChangeTypeSeries.Enabled:= tmp and
(not tmpInherited) and
(ceChange in EditorOptions)
and
(not (tssDenyChangeType in tmpSeries.Style));
if (not BChangeTypeSeries.Enabled) and LBSeries.ShowSeriesIcon and
LBSeries.EnableChangeType then
LBSeries.EnableChangeType:=False; // 7.0 #1217
BCloneSeries.Enabled:= tmp and
(LBSeries.SelCount<2) and
(ceClone in EditorOptions)
and
(not (tssIsTemplate in tmpSeries.Style)) and
(not (tssDenyClone in tmpSeries.Style));
if tmp and (LBSeries.SelCount<=1) then
begin
BMoveDown.Enabled:=LBSeries.ItemIndex<LBSeries.Items.Count-1;
BMoveUp.Enabled:=LBSeries.ItemIndex>0;
end
else
begin
BMoveDown.Enabled:=False;
BMoveUp.Enabled:=False;
end;
LBSeries.EnableDragSeries:=ceOrderSeries in EditorOptions; // 7.06
BMoveDown.Visible:=LBSeries.EnableDragSeries;
BMoveUp.Visible:=BMoveDown.Visible;
if Tree.Visible and Assigned(TreeNodeSeries) then
if LBSeries.CanFocus and (TreeNodeSeries.Count<>LBSeries.Items.Count) then
AddSeriesNodes;
end;
procedure TChartEditForm.BChangeTypeSeriesClick(Sender: TObject);
begin
LBSeries.ChangeTypeSeries(Self);
if Assigned(TheFormSeries) then InternalSetupFormSeries;
end;
procedure TChartEditForm.LabelWWWClick(Sender: TObject);
begin
GotoURL(Handle,LabelWWW.Caption);
end;
procedure TChartEditForm.ButtonHelpClick(Sender: TObject);
begin
{$IFNDEF CLX}
Application.HelpCommand(HELP_CONTEXT, HelpContext);
{$ENDIF}
end;
procedure TChartEditForm.MainPageChanging(Sender: TObject;
var AllowChange: Boolean);
begin
if Assigned(TheFormSeries) then
TheFormSeries.PageSeriesChanging(Self,AllowChange)
else
AllowChange:=True;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -