📄 qiscope.pas
字号:
SetActivePageIndex(ControlPageControl, FEditorControlPageIndex);
ChannelVoltsPerDivSpinSelector.AssignItems(FPanelChannels.VoltageSelector);
ChannelPositionSpinSelector.AssignItems (FPanelChannels.PositionSelector);
ChannelCouplingSpinSelector.AssignItems (FPanelChannels.CouplingSelector);
TimeBaseSecPerDivSpinSelector.AssignItems (FPanelTimeBase.SecPerDivSelector);
TimeBasePositionSpinSelector.AssignItems (FPanelTimeBase.PositionSelector);
TimeBasePreCaptureSpinSelector.AssignItems (FPanelTimeBase.PreCaptureSelector);
TimeBasePostCaptureSpinSelector.AssignItems(FPanelTimeBase.PostCaptureSelector);
TriggerLevelSpinSelector.AssignItems(FPanelTrigger.LevelSelector);
TriggerSourceSpinSelector.AssignItems(FPanelTrigger.SourceSelector);
PageControl.ActivePage := ControlTabSheet;
SamplesPerSecondEdit.AsInteger := SamplesPerSecond;
UpdateFrameRateEdit.AsInteger := UpdateFrameRate;
AutoFrameRateCheckBox.AsBoolean := AutoFrameRate;
PrintOrientationRadioGroup.AsInteger := Ord(PrintOrientation);
PrintShowDialogCheckBox.AsBoolean := PrintShowDialog;
PrintMarginLeftEdit.AsFloat := PrintMarginLeft;
PrintMarginTopEdit.AsFloat := PrintMarginTop;
PrintMarginRightEdit.AsFloat := PrintMarginRight;
PrintMarginBottomEdit.AsFloat := PrintMarginBottom;
PrintDocumentNameEdit.AsString := PrintDocumentName;
DisplayGridColorPicker.Color := FDisplay.GridColor;
DisplayTextShowCheckBox.AsBoolean := FDisplay.TextShow;
DisplayHorzScrollShowCheckBox.AsBoolean := FDisplay.HorzScrollShow;
TimeBaseSecPerDivSpinSelector.Value := FPanelTimeBase.SecPerDiv;
TimeBasePositionSpinSelector.Value := FPanelTimeBase.Position;
TimeBasePreCaptureSpinSelector.Value := FPanelTimeBase.PreCapture;
TimeBasePostCaptureSpinSelector.Value := FPanelTimeBase.PostCapture;
TriggerLevelSpinSelector.Value := FPanelTrigger.Level;
TriggerSourceSpinSelector.Value := FPanelTrigger.SourceIndex;
TriggerPositiveSlopeCheckBox.AsBoolean := FPanelTrigger.PositiveSlope;
TriggerAutoCheckBox.AsBoolean := FPanelTrigger.Auto;
for x := 0 to ChannelCount - 1 do
begin
iChannelListBox.Items.AddObject('', Channel[x]);
end;
if iChannelListBox.Items.Count <> 0 then iChannelListBox.ItemIndex := 0;
UpdateAll;
ShowModal;
FEditorControlPageIndex := GetActivePageIndex(ControlPageControl);
end;
finally
FScopeEditor.Free;
end;
FScopeEditor := nil;
end;
//****************************************************************************************************************************************************
procedure TiScope.DefineProperties(Filer: TFiler);
begin
inherited;
Filer.DefineProperty('Channels', ReadFromStreamChannels, WriteToStreamChannels, ChannelCount <> 0);
Filer.DefineProperty('Display', ReadFromStreamDisplay, WriteToStreamDisplay, True);
Filer.DefineProperty('TimeBase', ReadFromStreamTimeBase, WriteToStreamTimeBase, True);
Filer.DefineProperty('Trigger', ReadFromStreamTrigger, WriteToStreamTrigger, True);
end;
//*************************************************************************************************************************************
procedure TiScope.ReadFromStreamChannels(Reader: TReader);
var
Item : TiScopeChannel;
begin
RemoveAllChannels;
if not Reader.EndOfList then RemoveAllChannels;
if TReaderAccess(Reader).ReadValue <> vaCollection then exit;
while not Reader.EndOfList do
begin
Item := Channel[AddChannel];
Reader.ReadListBegin;
while not Reader.EndOfList do TReaderAccess(Reader).ReadProperty(Item);
Reader.ReadListEnd;
end;
Reader.ReadListEnd;
end;
//*************************************************************************************************************************************
procedure TiScope.WriteToStreamChannels(Writer: TWriter);
var
x : Integer;
begin
TWriterAccess(Writer).WriteValue(vaCollection);
for x := 0 to ChannelCount - 1 do
begin
Writer.WriteListBegin;
WriterWriteProperties(Writer, Channel[x]);
Writer.WriteListEnd;
end;
Writer.WriteListEnd;
end;
//*************************************************************************************************************************************
procedure TiScope.ReadFromStreamTimeBase(Reader: TReader);
begin
if TReaderAccess(Reader).ReadValue <> vaCollection then exit;
while not Reader.EndOfList do
begin
Reader.ReadListBegin;
while not Reader.EndOfList do TReaderAccess(Reader).ReadProperty(FTimeBase);
Reader.ReadListEnd;
end;
Reader.ReadListEnd;
end;
//*************************************************************************************************************************************
procedure TiScope.WriteToStreamTimeBase(Writer: TWriter);
begin
TWriterAccess(Writer).WriteValue(vaCollection);
Writer.WriteListBegin;
WriterWriteProperties(Writer, FTimeBase);
Writer.WriteListEnd;
Writer.WriteListEnd;
end;
//*************************************************************************************************************************************
procedure TiScope.ReadFromStreamTrigger(Reader: TReader);
begin
if TReaderAccess(Reader).ReadValue <> vaCollection then exit;
while not Reader.EndOfList do
begin
Reader.ReadListBegin;
while not Reader.EndOfList do TReaderAccess(Reader).ReadProperty(FTrigger);
Reader.ReadListEnd;
end;
Reader.ReadListEnd;
end;
//*************************************************************************************************************************************
procedure TiScope.WriteToStreamTrigger(Writer: TWriter);
begin
TWriterAccess(Writer).WriteValue(vaCollection);
Writer.WriteListBegin;
WriterWriteProperties(Writer, FTrigger);
Writer.WriteListEnd;
Writer.WriteListEnd;
end;
//*************************************************************************************************************************************
procedure TiScope.ReadFromStreamDisplay(Reader: TReader);
begin
if TReaderAccess(Reader).ReadValue <> vaCollection then exit;
while not Reader.EndOfList do
begin
Reader.ReadListBegin;
while not Reader.EndOfList do TReaderAccess(Reader).ReadProperty(FDisplay);
Reader.ReadListEnd;
end;
Reader.ReadListEnd;
end;
//*************************************************************************************************************************************
procedure TiScope.WriteToStreamDisplay(Writer: TWriter);
begin
TWriterAccess(Writer).WriteValue(vaCollection);
Writer.WriteListBegin;
WriterWriteProperties(Writer, FDisplay);
Writer.WriteListEnd;
Writer.WriteListEnd;
end;
//*************************************************************************************************************************************
procedure TiScope.DataCursorCustomizeHintEvent(Index: Integer; var AText: String);
var
Value : Double;
begin
case FPlot.DataCursor[0].Style of
ipcsValueY,
ipcsDeltaY : begin
Value := FPlot.DataCursor[0].ValueY;
if (ABS(Value) < 1E+3 ) and (ABS(Value) >= 1E+2 ) then AText := FormatFloat('0', Value*1E0 ) + ' V'
else if (ABS(Value) < 1E+2 ) and (ABS(Value) >= 1E+1 ) then AText := FormatFloat('0.0', Value*1E0 ) + ' V'
else if (ABS(Value) < 1E+1 ) and (ABS(Value) >= 1E+0 ) then AText := FormatFloat('0.00', Value*1E0 ) + ' V'
else if (ABS(Value) < 1E-0 ) and (ABS(Value) >= 1E-1 ) then AText := FormatFloat('0', Value*1E3 ) + ' mV'
else if (ABS(Value) < 1E-1 ) and (ABS(Value) >= 1E-2 ) then AText := FormatFloat('0.0', Value*1E3 ) + ' mV'
else if (ABS(Value) < 1E-2 ) and (ABS(Value) >= 1E-3 ) then AText := FormatFloat('0.00', Value*1E3 ) + ' mV'
else if (ABS(Value) < 1E-3 ) and (ABS(Value) >= 1E-4 ) then AText := FormatFloat('0', Value*1E6 ) + ' 礦'
else if (ABS(Value) < 1E-4 ) and (ABS(Value) >= 1E-5 ) then AText := FormatFloat('0.0', Value*1E6 ) + ' 礦'
else if (ABS(Value) < 1E-5 ) and (ABS(Value) >= 1E-6 ) then AText := FormatFloat('0.00', Value*1E6 ) + ' 礦'
else if (ABS(Value) < 1E-6 ) and (ABS(Value) >= 1E-7 ) then AText := FormatFloat('0', Value*1E9 ) + ' nV'
else if (ABS(Value) < 1E-7 ) and (ABS(Value) >= 1E-8 ) then AText := FormatFloat('0.0', Value*1E9 ) + ' nV'
else if (ABS(Value) < 1E-8 ) and (ABS(Value) >= 1E-9 ) then AText := FormatFloat('0.00', Value*1E9 ) + ' nV'
else AText := AText + ' V';
end;
ipcsValueX,
ipcsDeltaX : begin
Value := FPlot.DataCursor[0].ValueX;
if (Value = 1E0 ) or (Value = 0 ) then AText := FormatFloat('0', Value ) + ' s'
else if (Value < 1E-0 ) and (Value >= 1E-1 ) then AText := FormatFloat('0', Value*1E3 ) + ' ms'
else if (Value < 1E-1 ) and (Value >= 1E-2 ) then AText := FormatFloat('0.0', Value*1E3 ) + ' ms'
else if (Value < 1E-2 ) and (Value >= 1E-3 ) then AText := FormatFloat('0.00', Value*1E3 ) + ' ms'
else if (Value < 1E-3 ) and (Value >= 1E-4 ) then AText := FormatFloat('0', Value*1E6 ) + ' 祍'
else if (Value < 1E-4 ) and (Value >= 1E-5 ) then AText := FormatFloat('0.0', Value*1E6 ) + ' 祍'
else if (Value < 1E-5 ) and (Value >= 1E-6 ) then AText := FormatFloat('0.00', Value*1E6 ) + ' 祍'
else if (Value < 1E-6 ) and (Value >= 1E-7 ) then AText := FormatFloat('0', Value*1E9 ) + ' ns'
else if (Value < 1E-7 ) and (Value >= 1E-8 ) then AText := FormatFloat('0.0', Value*1E9 ) + ' ns'
else if (Value < 1E-8 ) and (Value >= 1E-9 ) then AText := FormatFloat('0.00', Value*1E9 ) + ' ns'
else if (Value < 1E-9 ) and (Value >= 1E-10) then AText := FormatFloat('0', Value*1E12) + ' ps'
else if (Value < 1E-10) and (Value >= 1E-11) then AText := FormatFloat('0.0', Value*1E12) + ' ps'
else if (Value < 1E-11) and (Value >= 1E-12) then AText := FormatFloat('0.00', Value*1E12) + ' ps'
else AText := AText + ' s';
end;
ipcsInverseDeltaX : begin
Value := FPlot.DataCursor[0].ValueX;
if (Value >= 1E0 ) and (Value < 1E1 ) then AText := FormatFloat('0.00', Value ) + ' Hz'
else if (Value >= 1E1 ) and (Value < 1E2 ) then AText := FormatFloat('0.0', Value ) + ' Hz'
else if (Value >= 1E2 ) and (Value < 1E3 ) then AText := FormatFloat('0', Value ) + ' Hz'
else if (Value >= 1E3 ) and (Value < 1E4 ) then AText := FormatFloat('0.00', Value/1E3) + ' KHz'
else if (Value >= 1E4 ) and (Value < 1E5 ) then AText := FormatFloat('0.0', Value/1E3) + ' KHz'
else if (Value >= 1E5 ) and (Value < 1E6 ) then AText := FormatFloat('0', Value/1E3) + ' KHz'
else if (Value >= 1E6 ) and (Value < 1E7 ) then AText := FormatFloat('0.00', Value/1E6) + ' MHz'
else if (Value >= 1E7 ) and (Value < 1E8 ) then AText := FormatFloat('0.0', Value/1E6) + ' MHz'
else if (Value >= 1E8 ) and (Value < 1E9 ) then AText := FormatFloat('0', Value/1E6) + ' MHz'
else if (Value >= 1E9 ) and (Value < 1E10) then AText := FormatFloat('0.00', Value/1E9) + ' GHz'
else if (Value >= 1E10) and (Value < 1E11) then AText := FormatFloat('0.0', Value/1E9) + ' GHz'
else if (Value >= 1E11) and (Value < 1E12) then AText := FormatFloat('0', Value/1E9) + ' GHz';
end;
end;
end;
//*************************************************************************************************************************************
procedure TiScope.PrintDisplay;
begin
FPlot.PrintChart;
end;
//*************************************************************************************************************************************
procedure TiScope.LimitLine1PositionChangeEvent(Index: Integer; OldValue, NewValue: Double);
var
AScopeChannel : TiScopeChannel;
begin
if FPlot.Limit[Index].Line1Position > 150 then FPlot.Limit[Index].Line1Position := 150;
if FPlot.Limit[Index].Line1Position < -50 then FPlot.Limit[Index].Line1Position := -50;
AScopeChannel := FPanelChannels.GetScopeChannelFromLimitIndex(Index);
if Assigned(AScopeChannel) then TiScopeChannelAccess(AScopeChannel).RefLimitLineChange(FPlot.Limit[Index].Line1Position);
end;
//*************************************************************************************************************************************
function TiScope.GetTransferringActve: Boolean;
begin
Result := False;
if FPlot.PaintingActive then Result := True;
end;
//*************************************************************************************************************************************
procedure TiScope.AnnotationCoordinatesChangeEvent(Index: Integer);
begin
if FPlot.Annotation[Index] = FPanelTimeBase.ScrollAnnotation then
begin
FPanelTimeBase.ScrollAnnotation.Y := 3;
if FPanelTimeBase.ScrollAnnotation.X < -0.0 then FPanelTimeBase.ScrollAnnotation.X := -0.0;
if FPanelTimeBase.ScrollAnnotation.X > 1.0 then FPanelTimeBase.ScrollAnnotation.X := 1.0;
FPanelTimeBase.ScrollEvent;
end;
end;
//*************************************************************************************************************************************
procedure TiScope.ClickAnnotationEvent(Index: Integer);
var
AScopeChannel : TiScopeChannel;
begin
if not FPlot.DataCursor[0].Visible then Exit;
AScopeChannel := FPanelChannels.GetScopeChannelFromAnnotation(Index);
if Assigned(AScopeChannel) then
FPlot.DataCursor[0].ChannelName := TiScopeChannelAccess(AScopeChannel).Channel.Name;
end;
//*************************************************************************************************************************************
function TiScope.GetDataCursor: TiPlotDataCursor;
begin
Result := FPlot.DataCursor[0];
end;
//*************************************************************************************************************************************
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -