📄 teeedigene.pas
字号:
procedure TFormTeeGeneral.BZoomColorClick(Sender: TObject);
begin
EditChartBrush(Self,TheChart.Zoom.Brush);
end;
procedure TFormTeeGeneral.EMinPixChange(Sender: TObject);
begin
if Showing then
TheChart.Zoom.MinimumPixels:=UDMinPix.Position
end;
procedure TFormTeeGeneral.CBDirChange(Sender: TObject);
begin
TheChart.Zoom.Direction:=TTeeZoomDirection(CBDir.ItemIndex);
end;
procedure TFormTeeGeneral.CBZoomMouseChange(Sender: TObject);
begin
TheChart.Zoom.MouseButton:=TMouseButton(CBZoomMouse.ItemIndex)
end;
procedure TFormTeeGeneral.CBScrollMouseChange(Sender: TObject);
begin
TheChart.ScrollMouseButton:=TMouseButton(CBScrollMouse.ItemIndex)
end;
procedure TFormTeeGeneral.FormCreate(Sender: TObject);
begin
Align:=alClient;
PageControl1.ActivePage:=TabSheet1;
{$IFNDEF D6}
TabFont.TabVisible:=False;
{$ENDIF}
{$IFDEF D6}
{$IFNDEF CLX}
{$IFNDEF LCL}
LBFonts.BevelInner:=bvNone;
LBFonts.BevelOuter:=bvNone;
{$ENDIF}
{$ENDIF}
{$ENDIF}
end;
procedure TFormTeeGeneral.ChangeCursor(ACursor:TCursor);
begin
with TheChart do
begin
Cursor:=ACursor;
OriginalCursor:=Cursor;
TeePreviewCursor(Cursor,ImageCursor.Picture);
end;
end;
procedure TFormTeeGeneral.CBCursorChange(Sender: TObject);
begin
ChangeCursor(TeeSetCursor(TheChart.Cursor,CBCursor.CurrentItem));
end;
procedure TFormTeeGeneral.CBUpLeftClick(Sender: TObject);
begin
TheChart.Zoom.UpLeftZooms:=CBUpLeft.Checked;
end;
function TFormTeeGeneral.SelectedFont(Index:Integer):TTeeFont;
begin
result:=TTeeFont(LBFonts.Items.Objects[Index]);
end;
procedure TFormTeeGeneral.ResetIFont;
begin
if Assigned(IFont) then
begin
IFont.OnChange:=OldChange;
IFont:=nil;
end;
FreeAndNil(IBackup);
end;
procedure TFormTeeGeneral.LBFontsClick(Sender: TObject);
begin
ResetIFont;
if LBFonts.ItemIndex<>-1 then
begin
IFont:=SelectedFont(LBFonts.ItemIndex);
IBackup:=TTeeFont.Create(nil);
IBackup.Assign(IFont);
if not Assigned(IFontEditor) then
begin
IFontEditor:=TTeeFontEditor.Create(nil);
IFontEditor.Align:=alClient;
AddFormTo(IFontEditor,PanelFont);
end;
IFontEditor.RefreshControls(IFont);
OldChange:=IFont.OnChange;
IFont.OnChange:=ChangedFont;
end;
end;
procedure TFormTeeGeneral.ChangedFont(Sender: TObject);
var t : Integer;
tmp : TTeeFont;
begin
if Assigned(IFont) then
if Showing then
begin
for t:=0 to LBFonts.Items.Count-1 do
if LBFonts.Selected[t] then
begin
tmp:=SelectedFont(t);
if tmp<>IFont then
begin
if IFont.Name<>IBackup.Name then
tmp.Name:=IFont.Name;
if IFont.Size<>IBackup.Size then
tmp.Size:=IFont.Size;
if IFont.Style<>IBackup.Style then
tmp.Style:=IFont.Style;
if IFont.Color<>IBackup.Color then
tmp.Color:=IFont.Color;
if IFont.InterCharSize<>IBackup.InterCharSize then
tmp.InterCharSize:=IFont.InterCharSize;
if IFont.Shadow.HorizSize<>IBackup.Shadow.HorizSize then
tmp.Shadow.HorizSize:=IFont.Shadow.HorizSize;
if IFont.Shadow.VertSize<>IBackup.Shadow.VertSize then
tmp.Shadow.VertSize:=IFont.Shadow.VertSize;
if IFont.Shadow.Color<>IBackup.Shadow.Color then
tmp.Shadow.Color:=IFont.Shadow.Color;
if IFont.Shadow.Visible<>IBackup.Shadow.Visible then
tmp.Shadow.Visible:=IFont.Shadow.Visible;
if IFont.Shadow.Transparency<>IBackup.Shadow.Transparency then
tmp.Shadow.Transparency:=IFont.Shadow.Transparency;
if IFont.Shadow.Smooth<>IBackup.Shadow.Smooth then
tmp.Shadow.Smooth:=IFont.Shadow.Smooth;
if IFont.Gradient.Visible<>IBackup.Gradient.Visible then
tmp.Gradient.Visible:=IFont.Gradient.Visible;
//tmp.Assign(IFont); // everything?
end;
end;
IBackup.Assign(IFont);
if Assigned(OldChange) then
OldChange(IFont);
end
else
ResetIFont;
end;
procedure TFormTeeGeneral.FormDestroy(Sender: TObject);
begin
ResetIFont;
end;
{ TChartPageNavigator }
procedure TChartPageNavigator.BtnClick(Index: TTeeNavigateBtn);
var tmp : TChartPage;
begin
tmp:=Chart.Pages;
if Assigned(tmp) then
with tmp do
case Index of
nbPrior : PreviousPage;
nbNext : NextPage;
nbFirst : Current:=1;
nbLast : Current:=Count;
end;
EnableButtons;
inherited;
end;
procedure TChartPageNavigator.SetPanel(const Value: TCustomTeePanel);
begin
if Value is TCustomAxisPanel then inherited
else inherited SetPanel(nil);
end;
procedure TChartPageNavigator.EnableButtons;
var tmp : TChartPage;
begin
inherited;
if Assigned(Chart) then
begin
tmp:=Chart.Pages;
if Assigned(tmp) then
begin
Buttons[nbFirst].Enabled:=tmp.Current>1;
Buttons[nbPrior].Enabled:=Buttons[nbFirst].Enabled;
Buttons[nbNext].Enabled:=tmp.Current<tmp.Count;
Buttons[nbLast].Enabled:=Buttons[nbNext].Enabled;
end;
end;
end;
procedure TChartPageNavigator.DoTeeEvent(Event: TTeeEvent);
begin
if (Event is TChartChangePage) or
( (Event is TTeeSeriesEvent) and
(TTeeSeriesEvent(Event).Event=seDataChanged)
) then
EnableButtons;
end;
function TChartPageNavigator.GetChart: TCustomChart;
begin
result:=TCustomChart(Panel);
end;
procedure TChartPageNavigator.SetChart(const Value: TCustomChart);
begin
Panel:=Value;
end;
Function TChartPageNavigator.PageCount:Integer;
begin
result:=Chart.NumPages;
end;
procedure TChartPageNavigator.Print;
begin
{$IFNDEF LCL} // Pending Lazarus TPrintDialog
if PageCount>1 then
With TPrintDialog.Create(Self) do
try
{$IFNDEF CLX}
Options:=[poPageNums];
PrintRange:=prPageNums;
{$ENDIF}
FromPage:=1;
MinPage:=FromPage;
ToPage:=Chart.NumPages;
MaxPage:=ToPage;
if Execute then Chart.PrintPages(FromPage,ToPage);
finally
Free;
end
else Chart.PrintPages(1,1);
{$ENDIF}
end;
procedure TFormTeeGeneral.FormDeactivate(Sender: TObject);
begin
ResetIFont;
end;
{$IFDEF CLX}
{$DEFINE SELECTALLFONTS}
{$ELSE}
{$IFNDEF D6}
{$DEFINE SELECTALLFONTS}
{$ENDIF}
{$ENDIF}
procedure TFormTeeGeneral.LBFontsKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
{$IFDEF SELECTALLFONTS}
var t : Integer;
{$ENDIF}
begin
if ssCtrl in Shift then
if Key=Ord('A') then
{$IFDEF SELECTALLFONTS}
with LBFonts do
for t:=0 to Items.Count-1 do
Selected[t]:=True;
{$ELSE}
LBFonts.SelectAll;
{$ENDIF}
end;
procedure TFormTeeGeneral.PageControl1Change(Sender: TObject);
begin
if PageControl1.ActivePage=TabFont then
LBFonts.SetFocus;
end;
procedure TFormTeeGeneral.BLoadClick(Sender: TObject);
{$IFNDEF CLX}
function CursorIndexOk:TCursor;
var tmp : {$IFDEF CLX}QCursorH{$ELSE}HCursor{$ENDIF};
begin
tmp:=LoadCursor(0, IDC_ARROW);
result:=TCursor(crTeeHand+1);
while Screen.Cursors[result]<>tmp do
Inc(result);
end;
var tmp : TCursor;
s : String;
{$IFNDEF CLR}
St : TeeString256;
{$ENDIF}
{$ENDIF}
begin
{$IFNDEF CLX}
if OpenDialog1.Execute then
begin
tmp:=CursorIndexOk;
s:=OpenDialog1.FileName;
Screen.Cursors[tmp]:=LoadCursorFromFile({$IFNDEF CLR}StrPCopy(St,s){$ELSE}s{$ENDIF});
ChangeCursor(tmp);
end;
{$ENDIF}
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -