📄 iscopecomponenteditor.pas
字号:
iScopeChannel.Color := iScope.Channel[x].Color;
iScopeChannel.RefLineShow := iScope.Channel[x].RefLineShow;
iScopeChannel.TraceVisible := iScope.Channel[x].TraceVisible;
iScopeChannel.TraceLineWidth := iScope.Channel[x].TraceLineWidth;
iScopeChannel.ScalerMultiplier := iScope.Channel[x].ScalerMultiplier;
iScopeChannel.ScalerOffset := iScope.Channel[x].ScalerOffset;
end;
if iChannelListBox.Items.Count > FLastChannelIndex then iChannelListBox.ItemIndex := FLastChannelIndex;
UpdateChannelEdit;
end;
//****************************************************************************************************************************************************
procedure TiScopeComponentEditorForm.CopyPropertiesToComponent(Component: TWinControl);
var
iScope : TiScope;
x : Integer;
begin
iScope := Component as TiScope;
iScope.SamplesPerSecond := SamplesPerSecondEdit.AsInteger;
iScope.HideControlPanels := HideControlPanelsCheckBox.AsBoolean;
iScope.UpdateFrameRate := UpdateFrameRateEdit.AsInteger;
iScope.AutoFrameRate := AutoFrameRateCheckBox.AsBoolean;
iScope.PrintOrientation := TPrinterOrientation(PrintOrientationRadioGroup.AsInteger);
iScope.PrintShowDialog := PrintShowDialogCheckBox.AsBoolean;
iScope.PrintMarginLeft := PrintMarginLeftEdit.AsFloat;
iScope.PrintMarginTop := PrintMarginTopEdit.AsFloat;
iScope.PrintMarginRight := PrintMarginRightEdit.AsFloat;
iScope.PrintMarginBottom := PrintMarginBottomEdit.AsFloat;
iScope.PrintDocumentName := PrintDocumentNameEdit.AsString;
iScope.Display.TextShow := DisplayTextShowCheckBox.AsBoolean;
iScope.Display.HorzScrollShow := DisplayHorzScrollShowCheckBox.AsBoolean;
iScope.Display.GridColor := DisplayGridColorPicker.Color;
iScope.TimeBase.SecPerDiv := TimeBaseSecPerDivSpinSelector.Value;
iScope.TimeBase.Position := TimeBasePositionSpinSelector.Value;
iScope.TimeBase.PreCapture := TimeBasePreCaptureSpinSelector.Value;
iScope.TimeBase.PostCapture := TimeBasePostCaptureSpinSelector.Value;
iScope.Trigger.Level := TriggerLevelSpinSelector.Value;
iScope.Trigger.SourceIndex := TriggerSourceSpinSelector.ItemIndex;
iScope.Trigger.PositiveSlope := TriggerPositiveSlopeCheckBox.AsBoolean;
iScope.Trigger.Auto := TriggerAutoCheckBox.AsBoolean;
iScope.RemoveAllChannels;
for x := 0 to iChannelListBox.Items.Count-1 do
begin
iScope.AddChannel;
iScope.Channel[iScope.ChannelCount-1].VoltsPerDivision := (iChannelListBox.Items.Objects[x] as TiScopeChannel).VoltsPerDivision;
iScope.Channel[iScope.ChannelCount-1].Position := (iChannelListBox.Items.Objects[x] as TiScopeChannel).Position;
iScope.Channel[iScope.ChannelCount-1].Coupling := (iChannelListBox.Items.Objects[x] as TiScopeChannel).Coupling;
iScope.Channel[iScope.ChannelCount-1].TitleText := (iChannelListBox.Items.Objects[x] as TiScopeChannel).TitleText;
iScope.Channel[iScope.ChannelCount-1].Color := (iChannelListBox.Items.Objects[x] as TiScopeChannel).Color;
iScope.Channel[iScope.ChannelCount-1].RefLineShow := (iChannelListBox.Items.Objects[x] as TiScopeChannel).RefLineShow;
iScope.Channel[iScope.ChannelCount-1].TraceVisible := (iChannelListBox.Items.Objects[x] as TiScopeChannel).TraceVisible;
iScope.Channel[iScope.ChannelCount-1].TraceLineWidth := (iChannelListBox.Items.Objects[x] as TiScopeChannel).TraceLineWidth;
iScope.Channel[iScope.ChannelCount-1].ScalerMultiplier := (iChannelListBox.Items.Objects[x] as TiScopeChannel).ScalerMultiplier;
iScope.Channel[iScope.ChannelCount-1].ScalerOffset := (iChannelListBox.Items.Objects[x] as TiScopeChannel).ScalerOffset;
end;
FLastChannelIndex := iChannelListBox.ItemIndex;
end;
//****************************************************************************************************************************************************
procedure TiScopeComponentEditorForm.ClearAllChannels;
begin
while iChannelListBox.Items.Count <> 0 do
begin
iChannelListBox.Items.Objects[0].Free;
iChannelListBox.Items.Delete(0);
end;
end;
//****************************************************************************************************************************************************
procedure TiScopeComponentEditorForm.iChannelListBoxClick(Sender: TObject);
begin
UpdateChannelEdit;
end;
//****************************************************************************************************************************************************
procedure TiScopeComponentEditorForm.iChannelListBoxGetData(const Index: Integer; var DrawColorBox: Boolean; var AColor: TColor; var AText: String);
begin
AColor := (iChannelListBox.Items.Objects[Index] as TiScopeChannel).Color;
AText := (iChannelListBox.Items.Objects[Index] as TiScopeChannel).TitleText;
end;
//****************************************************************************************************************************************************
procedure TiScopeComponentEditorForm.UpdateChannelEdit;
var
Channel : TiScopeChannel;
begin
if iChannelListBox.ItemIndex = - 1 then DisableAllEditControlsStartingWith('Channel')
else
begin
EnableAllEditControlsStartingWith('Channel');
Channel := iChannelListBox.Items.Objects[iChannelListBox.ItemIndex] as TiScopeChannel;
ChannelTitleEdit.AsString := Channel.TitleText;
ChannelColorPicker.Color := Channel.Color;
ChannelRefLineShowCheckBox.AsBoolean := Channel.RefLineShow;
ChannelTraceVisibleCheckBox.AsBoolean := Channel.TraceVisible;
ChannelTraceLineWidthEdit.AsInteger := Channel.TraceLineWidth;
ChannelScalerMultiplierEdit.AsFloat := Channel.ScalerMultiplier;
ChannelScalerOffsetEdit.AsFloat := Channel.ScalerOffset;
ChannelVoltsPerDivSpinSelector.Value := Channel.VoltsPerDivision;
ChannelPositionSpinSelector.Value := Channel.Position;
ChannelCouplingSpinSelector.Value := ord(Channel.Coupling);
iChannelListBox.Invalidate;
end;
end;
//****************************************************************************************************************************************************
procedure TiScopeComponentEditorForm.ChannelChange(Sender: TObject);
var
Channel : TiScopeChannel;
begin
if iChannelListBox.ItemIndex = -1 then exit;
Channel := iChannelListBox.Items.Objects[iChannelListBox.ItemIndex] as TiScopeChannel;
Channel.TitleText := ChannelTitleEdit.AsString;
Channel.Color := ChannelColorPicker.Color;
Channel.RefLineShow := ChannelRefLineShowCheckBox.AsBoolean;
Channel.TraceVisible := ChannelTraceVisibleCheckBox.AsBoolean;
Channel.TraceLineWidth := ChannelTraceLineWidthEdit.AsInteger;
Channel.ScalerMultiplier := ChannelScalerMultiplierEdit.AsFloat;
Channel.ScalerOffset := ChannelScalerOffsetEdit.AsFloat;
Channel.VoltsPerDivision := ChannelVoltsPerDivSpinSelector.Value;
Channel.Position := ChannelPositionSpinSelector.Value;
Channel.Coupling := TiScopeChannelCoupling(Round(ChannelCouplingSpinSelector.Value));
UpdateChannelEdit;
end;
//****************************************************************************************************************************************************
procedure TiScopeComponentEditorForm.iChannelAddButtonClick(Sender: TObject);
var
iScopeChannel : TiScopeChannel;
begin
iScopeChannel := TiScopeChannel.Create;
iScopeChannel.TitleText := 'CH' + IntToStr(iChannelListBox.Items.Count+1);
iChannelListBox.Items.AddObject('', iScopeChannel);
iChannelListBox.SelectLast;
UpdateChannelEdit;
ReloadTriggerChannelList;
Modified := True;
end;
//****************************************************************************************************************************************************
procedure TiScopeComponentEditorForm.ChannelRemoveButtonClick(Sender: TObject);
begin
iChannelListBox.DeleteSelectedObject;
UpdateChannelEdit;
ReloadTriggerChannelList;
Modified := True;
end;
//****************************************************************************************************************************************************
procedure TiScopeComponentEditorForm.ReloadTriggerChannelList;
var
i : Integer;
OldName : String;
begin
if TriggerSourceSpinSelector.ItemIndex <> - 1 then
OldName := TriggerSourceSpinSelector.GetItemCaption(TriggerSourceSpinSelector.ItemIndex)
else
OldName := '';
TriggerSourceSpinSelector.RemoveAllItems;
for i := 0 to iChannelListBox.Items.Count -1 do
TriggerSourceSpinSelector.AddItem((iChannelListBox.Items.Objects[i] as TiScopeChannel).TitleText, i);
TriggerSourceSpinSelector.SetItemIndexByCaption(OldName);
end;
//****************************************************************************************************************************************************
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -