unit MCAD_MI1201_FormPeakCentering; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, MCAD_MI1201_XForm, MCAD_MI1201_Thread_Types, MCAD_MI1201_Thread2, MCAD_MI1201_Thread, StdCtrls, Buttons, ExtCtrls, Grids, ActnList; const cCurMass='текущая масса'; type TFormPeakCenterFind = class(TXForm) gbM: TGroupBox; pM: TPanel; cbM: TComboBox; bbM: TBitBtn; gbM0: TGroupBox; sgPars: TStringGrid; pStatusBar: TPanel; pOnTop: TPanel; cbStayOnTop: TCheckBox; CheckBoxDoNotShiftData: TCheckBox; cbM0: TComboBox; bbM0: TBitBtn; alPeakCenter: TActionList; ActionPeakCenter: TAction; procedure FormCreate(Sender: TObject); procedure FormDestroy(Sender: TObject); procedure cbStayOnTopClick(Sender: TObject); procedure ActionPeakCenterExecute(Sender: TObject); private { Private declarations } procedure NotifyHandler(Sender:TObject; Event:tMI1201_Thread_Event); override; procedure MassSpectrometerSet(const MassSpectr:tMsThread); override; procedure ProcessMassSpDestroyFast; procedure ProcessAll; public { Public declarations } constructor Create(AOwner:TComponent); override; end; var FormPeakCenterFind: TFormPeakCenterFind; implementation {$R *.DFM} constructor TFormPeakCenterFind.Create; begin Inherited Create(AOwner); prNotifyData.NotifyMask:=[evDestroy, evPeakCenter, evDestroy,evTerminate, evMainChannelChanged ]; end; procedure TFormPeakCenterFind.ProcessAll; begin end; procedure TFormPeakCenterFind.FormCreate(Sender: TObject); begin RegistryReadForm; if RegistryOpenForRead then begin RegistryReadComboBox0(cbM); if cbM.Items[0]<>cCurMass then cbM.Items.Insert(0,cCurMass); RegistryReadComboBox0(cbM0); try cbStayOnTop.Checked:=prRegistry.ReadBool(cbStayOnTop.Name); cbStayOnTopClick(Self); except end; prRegistry.CloseKey; end; ProcessAll; end; procedure TFormPeakCenterFind.FormDestroy(Sender: TObject); begin MassSpectrometerNIL; if Self=FormPeakCenterFind then begin FormPeakCenterFind:=NIL; end; RegistryWriteForm; if RegistryOpenForWrite then begin RegistryWriteComboBox(cbM); RegistryWriteComboBox(cbM0); try prRegistry.WriteBool(cbStayOnTop.Name,cbStayOnTop.Checked); except end; prRegistry.CloseKey; end; end; procedure TFormPeakCenterFind.MassSpectrometerSet(const MassSpectr:tMsThread); begin Inherited; ProcessAll; end; procedure TFormPeakCenterFind.NotifyHandler(Sender:TObject; Event:tMI1201_Thread_Event); begin if not Assigned(MassSpectrometer) or (Sender<>MassSpectrometer) then Exit; try case Event.EventID of evDestroy,evTerminate: begin prMsSpDestroyed:=TRUE; ProcessMassSpDestroyFast; end; evCalibration: begin end; evMainChannelChanged: begin // Synchronize(ProcessMainChannel); end; end; except end; end; procedure TFormPeakCenterFind.ProcessMassSpDestroyFast; begin MassSpectrometerNIL; end; procedure TFormPeakCenterFind.cbStayOnTopClick(Sender: TObject); begin if cbStayOnTop.Checked then FormStyle:=fsStayOnTop else FormStyle:=fsNormal; end; procedure TFormPeakCenterFind.ActionPeakCenterExecute(Sender: TObject); begin if Assigned(MassSpectrometer) then begin try if cbM.Items.IndexOf(cbM.Text)=0 then MassSpectrometer.PeakCenterX(MassSpectrometer.Mass) else MassSpectrometer.PeakCenterX(StrToFloat_MSG(cbM.Text)); AddTextToStringsListIfNotExistAndMoveUp1(cbM); except end; end; end; end.