{ Форма для отображения спектра } {--------------------------------------------------------------------------- The control program for mass-spectrometer MI1201-AGM (c) Copyright Aleksandrov O.E., 2001 Molecular Physics department, USTU, Ekaterinsburg, K-2, 620002, RUSSIA phone 75-47-15 E-mail: aleks@dpt.ustu.ru Программа управления масс-спектрометром МИ1201-АГМ (c) Собственность Александрова О.Е., 2001 620002, Екатеринбург, К-2, УГТУ, Кафедра молекулярной физики тел. 75-47-15 E-mail: aleks@dpt.ustu.ru ----------------------------------------------------------------------------} unit MCAD_MI1201_FormSpectrum; interface uses Windows, Dialogs, ExtDlgs, ExtCtrls, Classes, ActnList, Menus, Buttons, ComCtrls, StdCtrls, Forms, TeEngine, Series, Controls, TeeProcs, Chart, Messages, SysUtils, Graphics, Registry, Printers, MCAD_MI1201_Chart, xDialogs, xExtDlgs, MCAD_MI1201_FormDataPrint, MCAD_MI1201_MassScaleSimpleCalibration, MCAD_MI1201_FormDataSaveToFile, MCAD_MI1201_StatisticInfo, MCAD_MI1201_XForm, MiscFunc, MCAD_MI1201_Thread0, MCAD_MI1201_Thread, MCAD_MI1201_Thread_Types; type tSignals=array[tSeries] of tPointSeries; tFlag=(fMassDrag, fMassDragStarted, fTraceActive, fPointNumberProcessingInProgress, fPointProcessingInProgress{, fMassProcessingInProgress}); tFlags=set of tFlag; TFormSpectrum = class(TXForm) Chart: TChart; SplitterLeft: TSplitter; SplitterBottom: TSplitter; GroupBoxScrollKeyControl: TGroupBox; HotKeyDownFast: THotKey; HotKeyDown: THotKey; HotKeyUp: THotKey; HotKeyUpFast: THotKey; ButtonDownFast: TButton; ButtonDown: TButton; ButtonUp: TButton; ButtonUpFast: TButton; PaneBottomTop: TPanel; GroupBoxScroll: TGroupBox; SpeedButtonScrollStop: TSpeedButton; SpeedButtonScrollPause: TSpeedButton; SpeedButtonScrollLeft: TSpeedButton; SpeedButtonScrollRight: TSpeedButton; SpeedButtonScrollJumpToLowBound: TSpeedButton; SpeedButtonScrollJumpToUpBound: TSpeedButton; CheckBoxScrollKeyLockAssignment: TCheckBox; EditScrollKeyStepMultiplicator: TEdit; LabelScrollKeyStepMultiplicator: TLabel; UpDownScrollKeyStepMultiplicator: TUpDown; MainMenu: TMainMenu; MenuFile: TMenuItem; MenuEdit: TMenuItem; EditCopyEMFToClipboard: TMenuItem; ActionListMain: TActionList; ActionMassDownFast: TAction; ActionMassDown: TAction; ActionMassUp: TAction; ActionMassUpFast: TAction; MenuProperties: TMenuItem; MenuY: TMenuItem; MenuX: TMenuItem; MenuItemYAuto: TMenuItem; MenuItemYAutoMax: TMenuItem; MenuItemYAutoMin: TMenuItem; MenuItemYMinMax: TMenuItem; MenuItemYMax: TMenuItem; MenuItemYMin: TMenuItem; ActionYAuto: TAction; ActionYAutoMax: TAction; XAuto: TMenuItem; XAutoMax: TMenuItem; XAutoMin: TMenuItem; XMinMax: TMenuItem; XMax: TMenuItem; XMin: TMenuItem; MenuItemY0011: TMenuItem; MenuItemY01: TMenuItem; MenuItemY1: TMenuItem; MenuItemY10: TMenuItem; MenuItemYLogarithmic: TMenuItem; ActionYAutoMin: TAction; ActionYMinMax: TAction; ActionYMin: TAction; ActionYMax: TAction; ActionDataClearAllAsk: TAction; ActionY10: TAction; ActionY1: TAction; ActionY01: TAction; ActionY001: TAction; YSep1: TMenuItem; ActionYLogarithmic: TAction; ParametersKeys: TMenuItem; ActionXAuto: TAction; ActionXAutoMax: TAction; ActionXAutoMin: TAction; ActionXMinMax: TAction; ActionXMin: TAction; ActionXMax: TAction; ActionDataClearAll: TAction; ActionDataSaveToFileAsk: TAction; miDataSaveToTextFile: TMenuItem; ActionYRAuto: TAction; ActionYRAutoMax: TAction; ActionYRAutoMin: TAction; ActionYRMin: TAction; ActionYRMax: TAction; ActionYRMinMax: TAction; ActionYRLogarithmic: TAction; ActionXGridSwitch: TAction; XSep1: TMenuItem; MenuItemXGrid: TMenuItem; ActionYGridSwitch: TAction; ActionYRGridSwitch: TAction; MenuYR: TMenuItem; MenuItemYRLogarithmic: TMenuItem; YRSep1: TMenuItem; Y3: TMenuItem; Y4: TMenuItem; Y5: TMenuItem; Y6: TMenuItem; Y7: TMenuItem; Y8: TMenuItem; MenuItemYRGrid: TMenuItem; ActionYRUseRightAxis: TAction; MenuView: TMenuItem; MenuItemRightAxisON: TMenuItem; ActionYMinAsk: TAction; ActionYMaxAsk: TAction; ActionShowLegend: TAction; MenuItemShowLegend: TMenuItem; MenuItemYGrid: TMenuItem; ActionYR1: TAction; ActionYR10: TAction; ActionYR100: TAction; ActionYR1000: TAction; ActionYR3000: TAction; Y011: TMenuItem; Y01001: TMenuItem; Y0101: TMenuItem; Y010001: TMenuItem; Y030001: TMenuItem; ActionShowSeriesEditor: TAction; N5: TMenuItem; SplitterRight: TSplitter; TimerMassChange: TTimer; MenuItemShowNumberFormatsEditor: TMenuItem; ActionShowNumbersFormatEditor: TAction; CheckBoxAccumulation: TCheckBox; PanelBottom: TScrollBox; PanelBottomTopLeft: TPanel; PanelBottomTopLeft1: TPanel; EditXMin: TComboBox; ButtonXSetAutomatic: TButton; PanelBottomTopRight: TPanel; EditXMax: TComboBox; ButtonClearAll: TButton; ActionScrollStop: TAction; ActionScrollPause: TAction; ActionScrollLeft: TAction; ActionScrollRight: TAction; ActionScrollLowLimit: TAction; ActionScrollUpLimit: TAction; CheckBoxUseRanges: TCheckBox; PanelRangesList: TPanel; ButtonXSetUser: TButton; ComboBoxRanges: TComboBox; ActionXRange: TAction; ActionCopyToClipboardMetafile: TAction; SavePictureDialog: TSavePictureDialog; ActionSaveToMetaFileEnh: TAction; ActionSaveToMetaFile: TAction; ActionSaveToMetaFileAsk: TAction; miPictureSaveToFile: TMenuItem; ActionYGrid: TAction; ActionYRGrid: TAction; ActionXGrid: TAction; ActionShowActionEditor: TAction; ActionJumpToMass: TAction; ActionXGridAsk: TAction; MenuItemXGridIncr: TMenuItem; ActionYGridAsk: TAction; ActionYRGridAsk: TAction; MenuItemYGridIncr: TMenuItem; MenuItemYRGridIncr: TMenuItem; ActionXMinAsk: TAction; ActionXMaxAsk: TAction; XSep0: TMenuItem; MenuItemXMaxEdit: TMenuItem; MenuItemXMinEdit: TMenuItem; YSep0: TMenuItem; MenuItemYMaxEdit: TMenuItem; MenuItemYMinEdit: TMenuItem; ActionYRMaxAsk: TAction; ActionYRMinAsk: TAction; YRSep0: TMenuItem; MenuItemYRMaxEdit: TMenuItem; MenuItemYRMinEdit: TMenuItem; PanelScrollBottom: TPanel; PanelScrollBottomLeft: TPanel; PanelScrollBottomRight: TPanel; PanelScrollBottomLeftTop: TPanel; PanelScrollBottomLeftBottom: TPanel; PanelScrollBottomLeftBottomRight: TPanel; PanelScrollBottomLeftBottomLeft: TPanel; PanelScrollBottomLeftTopLeft: TPanel; PanelScrollBottomLeftTopRight: TPanel; LabelMassJumpTo: TLabel; EditMassJumpTo: TComboBox; ButtonJumpToMass: TButton; LabelCounterCurrentTitle: TLabel; LabelCounterCurrent: TLabel; LabelPointsNumberTitle: TLabel; LabelPointsNumber: TLabel; LabelMassCurrentTitle: TLabel; LabelMassCurrent: TLabel; LabelMassStepMinTitle: TLabel; LabelMassStepMin: TLabel; ActionPrintDlg: TAction; PrinterSetupDialog: TPrinterSetupDialog; ActionPrinterSetupDlg: TAction; fs1: TMenuItem; miPrintSetupDlg: TMenuItem; ActionSeriesShowHide: TAction; ActionSeries0_ShowHide: TAction; ActionSeries1_ShowHide: TAction; ActionSeries2_ShowHide: TAction; ActionSeries3_ShowHide: TAction; ActionSeries4_ShowHide: TAction; ActionSeries5_ShowHide: TAction; ActionSeries6_ShowHide: TAction; ActionSeriesMarker0_ShowHide: TAction; ActionSeriesMarker1_ShowHide: TAction; ActionSeriesMarker2_ShowHide: TAction; ActionSeriesMarker3_ShowHide: TAction; ActionSeriesMarker4_ShowHide: TAction; ActionSeriesMarker5_ShowHide: TAction; ActionSeriesMarker6_ShowHide: TAction; MenuItem1: TMenuItem; MenuItem2: TMenuItem; MenuItem3: TMenuItem; MenuItem4: TMenuItem; MenuItem5: TMenuItem; MenuItemVEU: TMenuItem; MenuItemCounter: TMenuItem; ActionSeriesMarkerShowHide: TAction; MenuItemMarker1: TMenuItem; MenuItemMarker2: TMenuItem; MenuItemMarker3: TMenuItem; MenuItemMarker4: TMenuItem; MenuItemMarker5: TMenuItem; MenuItemMarkerVeu: TMenuItem; MenuItemMarkerCounter: TMenuItem; ActionSaveToFileAsk: TAction; ActionRestoreFromFileAsk: TAction; miDataSaveToFile: TMenuItem; miDataReadFromFile: TMenuItem; FileSep0: TMenuItem; SaveDialogData: TSaveDialog; EditClear: TMenuItem; N13: TMenuItem; VS1: TMenuItem; VS2: TMenuItem; StatusBarMass: TStatusBar; ActionShowStatisticInfo: TAction; MenuPeakCentering: TMenuItem; ActionStatisticInfoClear: TAction; N1: TMenuItem; LabelXIncr: TLabel; CheckBoxXGridSwitch: TCheckBox; EditXIncr: TComboBox; SeriesMassIndicator: TLineSeries; PanelTrace: TPanel; EditN: TEdit; EditY: TEdit; EditX: TEdit; LabelN: TLabel; ButtonTraceCancel: TButton; LabelY: TLabel; LabelX: TLabel; ActionTraceCancel: TAction; ActionTraceStart: TAction; VS3: TMenuItem; N2: TMenuItem; ActionTraceLeft: TAction; ActionTraceRight: TAction; ButtonTraceLeft: TButton; ButtonTraceRight: TButton; ActionTraceShowMarker: TAction; ActionTraceShowPanel: TAction; ActionTrace: TAction; EditXY: TEdit; LabelTraceCaption: TLabel; LabelTraceHelp: TLabel; CheckBoxTraceMarker: TCheckBox; ActionAbout: TAction; N3: TMenuItem; N4: TMenuItem; XSep2: TMenuItem; XJumpToMass: TMenuItem; ActionJumpToMassAsk: TAction; EditJumpToMass: TMenuItem; ActionMassStepAsk: TAction; XMassStep: TMenuItem; ActionMassStepMulAsk: TAction; ActionXRangeAsk: TAction; N6: TMenuItem; N7: TMenuItem; EditSep0: TMenuItem; EditMStep: TMenuItem; EditMSMul: TMenuItem; ActionSEMOn: TAction; N8: TMenuItem; EditSEMOn: TMenuItem; ActionSEMVoltageAsk: TAction; ActionSEMVoltage: TAction; N9: TMenuItem; EditSep2: TMenuItem; ActionIntTimeAsk: TAction; ActionIntTime: TAction; ActionMainChannelAsk: TAction; ActionMainChannel: TAction; EditTime: TMenuItem; EditSep3: TMenuItem; EditMainChnl: TMenuItem; PanelTraceKeys: TPanel; HotKeyTraceLeft: THotKey; HotKeyTraceRight: THotKey; ButtonTraceKeys: TButton; CheckBoxTraceLock: TCheckBox; ActionTraceKeysShowHide: TAction; ActionTraceKeysSwitch: TAction; ActionPeakCentering: TAction; ActionPeakCentering1: TMenuItem; PanelStep: TPanel; LabelMassStepX: TLabel; EditMassStep: TEdit; LabelStepMul: TLabel; EditStepMul: TEdit; UpDownStepMul: TUpDown; PanelBts: TPanel; N10: TMenuItem; ActionFormMethodsShow: TAction; ActionFormMethodsShow1: TMenuItem; ActionMassCalibrationSimple: TAction; N12: TMenuItem; MenuItemMassCalibrationSimple: TMenuItem; ActionPeakCenterFind: TAction; N11: TMenuItem; aWindowFollowsMass: TAction; XSep3: TMenuItem; N14: TMenuItem; ActionShowHint: TAction; VS4: TMenuItem; N15: TMenuItem; ActionPrintDlgEx: TAction; miPrintDlg: TMenuItem; ActionPrintEx: TAction; miPrint: TMenuItem; pRight: TPanel; PanelRight: TScrollBox; PanelRightTop: TPanel; CheckBoxYRLog: TCheckBox; EditYRMax: TComboBox; ButtonYRMinMax: TButton; ButtonYRAuto: TButton; ButtonYRSet1000: TButton; ButtonYRSet100: TButton; ButtonYRSet10: TButton; ButtonYRSet1: TButton; ButtonYRSet3000: TButton; PanelRightTopBottom: TGroupBox; LabelYRIncr: TLabel; CheckBoxYRGrid: TCheckBox; EditYRIncr: TComboBox; PanelRightBottom: TPanel; PanelYRMin: TPanel; EditYRMin: TComboBox; pLeft: TPanel; OpenDialogData: TOpenDialog; PanelLeft: TScrollBox; PanelLeftBottom: TPanel; GroupBoxShownSeries: TGroupBox; CheckBoxS1: TCheckBox; CheckBoxS2: TCheckBox; CheckBoxS3: TCheckBox; CheckBoxS4: TCheckBox; CheckBoxS5: TCheckBox; CheckBoxVEU: TCheckBox; CheckBoxCounter: TCheckBox; CheckBoxS1Mark: TCheckBox; CheckBoxS2Mark: TCheckBox; CheckBoxS3Mark: TCheckBox; CheckBoxS4Mark: TCheckBox; CheckBoxS5Mark: TCheckBox; CheckBoxVEUMark: TCheckBox; CheckBoxCounterMark: TCheckBox; CheckBoxUseRightAxis: TCheckBox; GroupBoxMainChannel: TGroupBox; ComboBoxMainChannel: TComboBox; PanelLeftTop: TPanel; CheckBoxYLog: TCheckBox; EditYMax: TComboBox; ButtonYSetUser: TButton; ButtonYSetAutomatic: TButton; ButtonYSetUser10: TButton; ButtonYSetUser1: TButton; ButtonYSetUser0_1: TButton; ButtonYSetUser0_01: TButton; PanelDriverState: TPanel; GroupBoxSEM: TGroupBox; EditSEM: TEdit; CheckBoxSEM: TCheckBox; GroupBoxIntegrationTime: TGroupBox; EditIntegrationTime: TEdit; GroupBoxValve: TGroupBox; LabelValve: TLabel; LabelValveAutoClose: TLabel; GroupBoxState: TGroupBox; LabelState: TLabel; PanelYGrid: TGroupBox; LabelYInc: TLabel; CheckBoxYGrid: TCheckBox; EditYIncr: TComboBox; PanelLeftBottomBottom: TPanel; EditYMin: TComboBox; PeakCenterMenuItem: TMenuItem; ActionPeakCentripetal: TAction; procedure FormCreate(Sender: TObject); procedure FormDestroy(Sender: TObject); procedure EditYMaxKeyPress(Sender: TObject; var Key: Char); procedure EditYMinKeyPress(Sender: TObject; var Key: Char); procedure EditXMinKeyPress(Sender: TObject; var Key: Char); procedure EditXMaxKeyPress(Sender: TObject; var Key: Char); procedure EditIntegrationTimeKeyPress(Sender: TObject; var Key: Char); procedure EditIntegrationTimeExit(Sender: TObject); procedure EditMassStepKeyPress(Sender: TObject; var Key: Char); procedure EditMassStepExit(Sender: TObject); procedure EditStepMulKeyPress(Sender: TObject; var Key: Char); procedure EditStepMulExit(Sender: TObject); procedure ChartZoom(Sender: TObject); procedure ChartUndoZoom(Sender: TObject); procedure EditSEMExit(Sender: TObject); procedure EditSEMKeyPress(Sender: TObject; var Key: Char); procedure ButtonDownClick(Sender: TObject); procedure ButtonUpClick(Sender: TObject); procedure ButtonDownFastClick(Sender: TObject); procedure ButtonUpFastClick(Sender: TObject); procedure HotKeyDownFastExit(Sender: TObject); procedure HotKeyDownExit(Sender: TObject); procedure HotKeyUpExit(Sender: TObject); procedure HotKeyUpFastExit(Sender: TObject); procedure CheckBoxScrollKeyLockAssignmentClick(Sender: TObject); procedure EditScrollKeyStepMultiplicatorExit(Sender: TObject); procedure EditScrollKeyStepMultiplicatorChange(Sender: TObject); procedure EditMassJumpToKeyPress(Sender: TObject; var Key: Char); procedure UpDownStepMulChanging(Sender: TObject; var AllowChange: Boolean); procedure FormKeyPress(Sender: TObject; var Key: Char); procedure SeriesMassIndicatorClick(Sender: TChartSeries; ValueIndex: Integer; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); procedure ChartClick(Sender: TObject); procedure ChartClickAxis(Sender: TCustomChart; Axis: TChartAxis; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); procedure ChartResize(Sender: TObject); procedure HotKeyDownFastEnter(Sender: TObject); procedure HotKeyDownEnter(Sender: TObject); procedure HotKeyUpEnter(Sender: TObject); procedure HotKeyUpFastEnter(Sender: TObject); procedure ActionYAutoExecute(Sender: TObject); procedure ActionYAutoMaxExecute(Sender: TObject); procedure ActionYAutoMinExecute(Sender: TObject); procedure ActionYMinMaxExecute(Sender: TObject); procedure ActionDataClearAllAskExecute(Sender: TObject); procedure ActionY10Execute(Sender: TObject); procedure ActionY1Execute(Sender: TObject); procedure ActionY01Execute(Sender: TObject); procedure ActionY001Execute(Sender: TObject); procedure ActionYMinExecute(Sender: TObject); procedure ActionYMaxExecute(Sender: TObject); procedure ActionYLogarithmicExecute(Sender: TObject); procedure ActionXAutoExecute(Sender: TObject); procedure ActionXAutoMinExecute(Sender: TObject); procedure ActionXAutoMaxExecute(Sender: TObject); procedure ActionXMinMaxExecute(Sender: TObject); procedure ActionXMinExecute(Sender: TObject); procedure ActionXMaxExecute(Sender: TObject); procedure ActionDataClearAllExecute(Sender: TObject); procedure ActionDataSaveToFileAskExecute(Sender: TObject); procedure ActionYRAutoExecute(Sender: TObject); procedure ActionYRAutoMaxExecute(Sender: TObject); procedure ActionYRAutoMinExecute(Sender: TObject); procedure ActionYRMinExecute(Sender: TObject); procedure ActionYRMaxExecute(Sender: TObject); procedure EditYRMinKeyPress(Sender: TObject; var Key: Char); procedure EditYRMaxKeyPress(Sender: TObject; var Key: Char); procedure ActionYRLogarithmicExecute(Sender: TObject); procedure ActionXGridSwitchExecute(Sender: TObject); procedure ActionYRGridSwitchExecute(Sender: TObject); procedure ActionYGridSwitchExecute(Sender: TObject); procedure ActionYRUseRightAxisExecute(Sender: TObject); procedure ActionYMinAskExecute(Sender: TObject); procedure ActionYMaxAskExecute(Sender: TObject); procedure ActionShowLegendExecute(Sender: TObject); procedure ActionYR1Execute(Sender: TObject); procedure ActionYR10Execute(Sender: TObject); procedure ActionYR100Execute(Sender: TObject); procedure ActionYR1000Execute(Sender: TObject); procedure ActionYR3000Execute(Sender: TObject); procedure ActionShowSeriesEditorExecute(Sender: TObject); procedure TimerMassChangeTimer(Sender: TObject); procedure EditYIncrKeyPress(Sender: TObject; var Key: Char); procedure EditYRIncrKeyPress(Sender: TObject; var Key: Char); procedure EditXIncrKeyPress(Sender: TObject; var Key: Char); procedure ActionShowNumbersFormatEditorExecute(Sender: TObject); procedure CheckBoxAccumulationClick(Sender: TObject); procedure ActionScrollStopExecute(Sender: TObject); procedure ActionScrollPauseExecute(Sender: TObject); procedure ActionScrollLeftExecute(Sender: TObject); procedure ActionScrollRightExecute(Sender: TObject); procedure ActionScrollLowLimitExecute(Sender: TObject); procedure ActionScrollUpLimitExecute(Sender: TObject); procedure CheckBoxUseRangesClick(Sender: TObject); procedure ActionXRangeExecute(Sender: TObject); procedure ActionCopyToClipboardMetafileExecute(Sender: TObject); procedure ActionSaveToMetaFileEnhExecute(Sender: TObject); procedure ActionSaveToMetaFileExecute(Sender: TObject); procedure ActionSaveToMetaFileAskExecute(Sender: TObject); procedure ActionYGridExecute(Sender: TObject); procedure ActionYRGridExecute(Sender: TObject); procedure ActionXGridExecute(Sender: TObject); procedure ActionShowActionEditorExecute(Sender: TObject); procedure ActionJumpToMassExecute(Sender: TObject); procedure ActionXGridAskExecute(Sender: TObject); procedure ActionYGridAskExecute(Sender: TObject); procedure ActionYRGridAskExecute(Sender: TObject); procedure ActionXMinAskExecute(Sender: TObject); procedure ActionYMinEditExecute(Sender: TObject); procedure ActionYMaxEditExecute(Sender: TObject); procedure ActionXMaxAskExecute(Sender: TObject); procedure ActionYRMaxAskExecute(Sender: TObject); procedure ActionYRMinAskExecute(Sender: TObject); procedure ActionPrintDlgExecute(Sender: TObject); procedure ActionPrinterSetupDlgExecute(Sender: TObject); procedure ActionSeriesShowHideExecute(Sender: TObject); procedure ActionSeries0_ShowHideExecute(Sender: TObject); procedure ActionSeries1_ShowHideExecute(Sender: TObject); procedure ActionSeries2_ShowHideExecute(Sender: TObject); procedure ActionSeries3_ShowHideExecute(Sender: TObject); procedure ActionSeries4_ShowHideExecute(Sender: TObject); procedure ActionSeries5_ShowHideExecute(Sender: TObject); procedure ActionSeries6_ShowHideExecute(Sender: TObject); procedure ActionSeriesMarkerShowHideExecute(Sender: TObject); procedure ActionSeriesMarker0_ShowHideExecute(Sender: TObject); procedure ActionSeriesMarker1_ShowHideExecute(Sender: TObject); procedure ActionSeriesMarker2_ShowHideExecute(Sender: TObject); procedure ActionSeriesMarker3_ShowHideExecute(Sender: TObject); procedure ActionSeriesMarker4_ShowHideExecute(Sender: TObject); procedure ActionSeriesMarker5_ShowHideExecute(Sender: TObject); procedure ActionSeriesMarker6_ShowHideExecute(Sender: TObject); procedure ActionSaveToFileAskExecute(Sender: TObject); procedure ActionRestoreFromFileAskExecute(Sender: TObject); procedure ActionShowStatisticInfoExecute(Sender: TObject); procedure LabelStateClick(Sender: TObject); procedure FormShow(Sender: TObject); procedure ActionStatisticInfoClearExecute(Sender: TObject); procedure ActionTraceCancelExecute(Sender: TObject); procedure ActionTraceStartExecute(Sender: TObject); procedure ActionTraceLeftExecute(Sender: TObject); procedure ActionTraceRightExecute(Sender: TObject); procedure PanelTraceMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); procedure PanelTraceMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); procedure PanelTraceMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); procedure ActionTraceShowMarkerExecute(Sender: TObject); procedure ActionTraceShowPanelExecute(Sender: TObject); procedure ActionTraceExecute(Sender: TObject); procedure HotKeyTraceLeftEnter(Sender: TObject); procedure HotKeyTraceLeftExit(Sender: TObject); procedure HotKeyTraceRightEnter(Sender: TObject); procedure HotKeyTraceRightExit(Sender: TObject); procedure CheckBoxTraceLockClick(Sender: TObject); procedure ActionYRSetByClickExecute(Sender: TObject); procedure EditTraceDblClick(Sender: TObject); procedure CheckBoxTraceMarkerClick(Sender: TObject); procedure ChartMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); procedure ActionJumpToMassAskExecute(Sender: TObject); procedure ActionMassStepAskExecute(Sender: TObject); procedure ActionMassStepMulAskExecute(Sender: TObject); procedure ActionXRangeAskExecute(Sender: TObject); procedure ActionSEMOnExecute(Sender: TObject); procedure ActionSEMVoltageAskExecute(Sender: TObject); procedure ActionSEMVoltageExecute(Sender: TObject); procedure ActionIntTimeExecute(Sender: TObject); procedure ActionMainChannelAskExecute(Sender: TObject); procedure ActionMainChannelExecute(Sender: TObject); procedure ActionIntTimeAskExecute(Sender: TObject); procedure ActionAboutExecute(Sender: TObject); procedure ActionTraceKeysSwitchExecute(Sender: TObject); procedure ActionTraceKeysShowHideExecute(Sender: TObject); procedure ActionPeakCenteringExecute(Sender: TObject); procedure ChartScroll(Sender: TObject); procedure ActionMassCalibrationSimpleExecute(Sender: TObject); procedure ActionPeakCenterFindExecute(Sender: TObject); procedure aWindowFollowsMassExecute(Sender: TObject); procedure ActionShowHintExecute(Sender: TObject); procedure MEnter(Sender: TObject); procedure MExit(Sender: TObject); procedure ActionPrintDlgExExecute(Sender: TObject); procedure ActionPrintExExecute(Sender: TObject); procedure ActionPeakCentripetalExecute(Sender: TObject); private { Private declarations } prSignals:tSignals; SignalsMarkers:tSeriesSet; prFlags:tFlags; DataSaveToFileDialog:TDataSaveToFileDialog; DataPrintDialog:TDataPrintDialog; prSeriesActive:tSeriesSet; prTraceMarker:tPointSeries; prTraceSeries:tCustomSeries; prTraceIndex:integer; prTaceDragStartPoint:tPoint; prMassFromBottomAxiesRightClickNotificator:tMassNotifyEvent; prMassFromBottomAxiesRightClickTarget:tWinControl; procedure WMActivate(var Message: TWMActivate); message WM_ACTIVATE; procedure NotifyHandler(Sender:TObject; Event:tMI1201_Thread_Event); override; procedure ProcessError; procedure ProcessSetOn; procedure ProcessSetOff; procedure ProcessPointsNumber; procedure ProcessIntegrationTime; procedure ProcessMassStep; function ProcessMassEx(m:double):boolean; // возвращает TRUE, если масса в отображаемом диапазоне procedure ProcessMass; procedure DoWindowFollowsMass; procedure ProcessMassLimit; procedure ProcessNewPoint; procedure ProcessMassIndicatorMinMax; procedure ProcessMassIndicatorPointHeight; procedure ProcessStepMultiplicator; procedure ProcessStart; procedure ProcessSEM; procedure ProcessSeries; procedure ProcessSeriesMarkers; procedure ProcessHotKeys; procedure ProcessMassSpDestroyFast; procedure ProcessMassSpDestroy; procedure ProcessMassAboutChange; procedure ProcessMassAboutChangeEnd; procedure ProcessSwitchesChanged; procedure ProcessValveAutoCloseTime; procedure ProcessValve; procedure ProcessMainChannel; procedure ProcessStatisticTime; procedure ProcessFileWriteFail; procedure ProcessRanges; procedure ProcessLeftAxis; procedure FillInChannels; procedure SeriesAdd; procedure SeriesMarkersCreate; procedure SeriesRemove; function SeriesActive:tSeriesSet; procedure SeriesAssignActive(ss:tSeriesSet); procedure SetAxis(AAxis:tChartAxis; Min,Max:double); function ScrollKeyStepMultiplicator:integer; procedure MassSetNew(AMass:double); procedure MassDragStart; procedure MassDragApply; procedure MassDragCancel; procedure ChartMouseMoveMassDrag(Sender: TObject; Shift: TShiftState; X, Y: Integer); procedure SaveActionsToRegistry; procedure ReadActionsFromRegistry; procedure RegistryWriteChart; procedure RegistryWriteChartAxis(const SubKey:string; AAxis:tChartAxis); procedure RegistryReadChart; procedure RegistryProcessChart; procedure RegistryReadChartAxis(const SubKey:string; AAxis:tChartAxis); procedure RegistryReadComboBox(AComboBox:tComboBox); function MaxSet(AAxis:tChartAxis; const AText:string):boolean; function MinSet(AAxis:tChartAxis; const AText:string):boolean; procedure TraceApply(X,Y:double; N:integer); procedure ChartClickTrace(Sender: TObject); procedure AxisSetByClickEx(AAxis:tChartAxis; AEdit:tObject; Pos:integer); procedure AxisSetByClick(AAxis:tChartAxis; AEdit:tObject); procedure DateAdd; procedure DateRem; procedure MassSpectrometerSet(const MassSpectr:tMsThread); override; procedure MassFromBottomAxiesRightClickNotificatorSet(ANotifyProc:tMassNotifyEvent); procedure MassFromBottomAxiesRightClickNotify(AMass:double); function MassFromBottomAxiesRightClick(Sender:TObject; Reason:tMassNotifyReason; Mass:double):tMassNotifyAnsver; function MassIndicatorGet:double; procedure MassIndicatorSet(AMass:double); function CalculatePrintRect(aPrinter:tPrinter; var aRect:tRect; aMarging:tMargins):boolean; procedure Print(Sender: TObject); function PrintDlgOK:boolean; procedure DefaultActionMassUpDownAssign; public { Public declarations } constructor Create(AOwner:tComponent); override; constructor CreateX(AOwner:tComponent; const MassSpectr:tMsThread); property MassSpectrometer:tMsThread read prMassSpectrometer write MassSpectrometerSet default NIL; property Signals:tSignals read prSignals; property Tracer:tPointSeries read prTraceMarker; property MassFromBottomAxiesRightClickNotificator:tMassNotifyEvent read prMassFromBottomAxiesRightClickNotificator write MassFromBottomAxiesRightClickNotificatorSet; property MassIndicator:double read MassIndicatorGet write MassIndicatorSet; end; var FormSpectrum: TFormSpectrum; implementation USES MCAD_MI1201_PeakControl, MCAD_MI1201_FormABOUT, c_Mi1201, MITypes, xSystem, MCAD_MI1201_Range, MCAD_MI1201_Registry, MCAD_MI1201_ActionListEditor, MCAD_MI1201_TChartSeries, MCAD_MI1201_FileOutput, MCAD_MI1201_SeriesEditor, MCAD_MI1201_FormNumbersFormat, MCAD_MI1201_FormMethods, MCAD_MI1201_FormPeakCentering, MCAD_MI1201_FormPeakCentripetal; {$R *.DFM} {procedure TChart.DoRepaint; begin Inherited Repaint; end; procedure TChart.Repaint; begin if Assigned(FormSpectrum) then FormSpectrum.TimerChartRepaint.Enabled:=TRUE; end;} procedure TFormSpectrum.SeriesMarkersCreate; var s:tSeries; OldIC:cardinal; begin OldIC:=TeeDefaultCapacity; TeeDefaultCapacity:=1; for s:=sPNC1 to sIonCounter do begin if not Assigned(prSignals[s]) then try prSignals[s]:=tPointSeries.Create(Self); prSignals[s].Name:='M_'+cMSSeriesNames[s]; prSignals[s].AddXY(0,0); prSignals[s].ShowInLegend:=FALSE; prSignals[s].Marks.Style:=smsValue; prSignals[s].Marks.Visible:=TRUE; prSignals[s].ValueFormat:=prSignals[s].ValueFormat+' '+cMSSeriesMeasureUnit[s]; except end; end; TeeDefaultCapacity:=OldIC; end; procedure TFormSpectrum.SeriesAdd; var s:tSeries; mss:tLineSeries; begin if Assigned(MassSpectrometer) then begin SeriesMarkersCreate; try for s:=sPNC1 to sIonCounter do begin Chart.RemoveSeries(prSignals[s]); end; except end; for s:=sPNC1 to sIonCounter do begin mss:=MassSpectrometer.DataSeries[s]; if Assigned(mss) then begin try Chart.AddSeries(mss); except end; if Assigned(prSignals[s]) then begin prSignals[s].SeriesColor:=mss.SeriesColor; end; end else begin if Assigned(prSignals[s]) then try prSignals[s].Active:=FALSE; except end; end; end; try for s:=sPNC1 to sIonCounter do begin Chart.AddSeries(prSignals[s]); end; except end; end; end; procedure TFormSpectrum.SeriesRemove; begin if Assigned(MassSpectrometer) then begin try MassSpectrometer.DataSeriesOff(Chart); except end; end; end; procedure TFormSpectrum.MassSpectrometerSet(const MassSpectr:tMsThread); begin if MassSpectr=MassSpectrometer then Exit; SeriesRemove; Inherited; if Assigned(MassSpectrometer) then begin SeriesAdd; Synchronize(ProcessSetOn); end; end; constructor TFormSpectrum.Create; begin Inherited Create(AOwner); prNotifyData.NotifyMask:=[ evMassChanged, evPointsNumberChanged, evClearError,evError, evSetError, evIntegrationTimeChanged, evStart,evStop,evResume, evSetON,evSetOFF, evStepMultiplicatorChanged, evMassStepChanged, evMassAboutChangeForLargeValue, evMassAboutChangeForLargeValueEnd, evMassCalibrationChanged, evDevice, evSwitchesChanged, evNewPoint, evValveOneSecondTimerTick, evSourceChanged, evSourceAutoCloseTimeChanged, evMainChannelChanged, evMassLimit, evFileWriteFail, evRangeListChanged ]; FillInChannels; SeriesMassIndicator.AddX(0); SeriesMassIndicator.AddX(0); SeriesMassIndicator.Cursor:=crTeeHand; end; constructor TFormSpectrum.CreateX(AOwner:tComponent; const MassSpectr:tMsThread); begin Create(AOwner); MassSpectrometerSet(MassSpectr); end; procedure TFormSpectrum.NotifyHandler(Sender:TObject; Event:tMI1201_Thread_Event); begin if not Assigned(MassSpectrometer) or (Sender<>MassSpectrometer) then Exit; try case Event.EventID of evTerminate, evDestroy: begin prMsSpDestroyed:=TRUE; ProcessMassSpDestroyFast; end; evMassChanged: begin Synchronize(ProcessMass); end; evNewPoint: begin if not (fPointProcessingInProgress in prFlags) then begin Include(prFlags,fPointProcessingInProgress); Synchronize(ProcessNewPoint); end; end; evPointsNumberChanged: begin if not (fPointNumberProcessingInProgress in prFlags) then begin Include(prFlags,fPointNumberProcessingInProgress); Synchronize(ProcessPointsNumber); end; end; evMassCalibrationChanged: begin Chart.Repaint; end; evMassLimit: begin Synchronize(ProcessMassLimit); end; evMassAboutChangeForLargeValue: begin Synchronize(ProcessMassAboutChange); end; evMassAboutChangeForLargeValueEnd: begin TimerMassChange.Enabled:=FALSE; Synchronize(ProcessMassAboutChangeEnd); end; evValveOneSecondTimerTick: begin Synchronize(ProcessValveAutoCloseTime); end; evSourceChanged,evSourceAutoCloseTimeChanged: begin Synchronize(ProcessValve); end; evIntegrationTimeChanged: begin Synchronize(ProcessIntegrationTime); end; evStart,evStop,evResume:begin Synchronize(ProcessStart); end; evMassStepChanged: begin Synchronize(ProcessMassStep); end; evStepMultiplicatorChanged: begin Synchronize(ProcessStepMultiplicator); end; evDevice:begin case tDevice(Event.ParameterB) of SEM_Voltage: Synchronize(ProcessSEM); else; end; end; evSwitchesChanged: begin Synchronize(ProcessSwitchesChanged); end; evSetON:begin Synchronize(ProcessSetON); end; evSetOFF: begin Synchronize(ProcessSetOFF); end; evMainChannelChanged: begin Synchronize(ProcessMainChannel); end; evClearError,evError,evSetError: begin Synchronize(ProcessError); end; evFileWriteFail: begin Synchronize(ProcessFileWriteFail); end; evRangeListChanged: begin Synchronize(ProcessRanges); end; else begin end; end; except end; end; resourcestring cAuto='Авто'; procedure ComboBoxSet(AComboBox:tComboBox); begin if (AComboBox.Items.Count=0) then AComboBox.Items.Add(cAuto) else if AComboBox.Items[0]<>cAuto then AComboBox.Items.Insert(0,cAuto); end; procedure TFormSpectrum.RegistryReadComboBox(AComboBox:tComboBox); begin try RegistryReadComboBox0(AComboBox); ComboBoxSet(AComboBox); except end; end; procedure TFormSpectrum.RegistryProcessChart; begin ActionShowLegend.Checked:=Chart.Legend.Visible; ActionYGridSwitch.Checked:=Chart.LeftAxis.Grid.Visible; ActionYRGridSwitch.Checked:=Chart.RightAxis.Grid.Visible; ActionXGridSwitch.Checked:=Chart.BottomAxis.Grid.Visible; ActionYLogarithmic.Checked:=Chart.LeftAxis.Logarithmic; ActionYRLogarithmic.Checked:=Chart.RightAxis.Logarithmic; Chart.BottomAxis.Logarithmic:=FALSE; end; procedure TFormSpectrum.RegistryReadChart; var key:string; begin key:=prRegistry.CurrentPath; if prRegistry.OpenKeyReadOnly(Chart.Name) then try RegistryReadComboBox(EditXMax); RegistryReadComboBox(EditXMin); RegistryReadComboBox(EditYMax); RegistryReadComboBox(EditYMin); RegistryReadComboBox(EditYRMax); RegistryReadComboBox(EditYRMin); RegistryReadComboBox(EditYIncr); RegistryReadComboBox(EditYRIncr); RegistryReadComboBox(EditXIncr); RegistryReadComboBox0(EditMassJumpTo); try Chart.Legend.Visible:=prRegistry.ReadBool('Legend.Visible'); except end; RegistryReadChartAxis('LeftAxis',Chart.LeftAxis); RegistryReadChartAxis('RightAxis',Chart.RightAxis); RegistryReadChartAxis('BottomAxis',Chart.BottomAxis); except end; prRegistry.OpenKey('\'+key,FALSE); end; procedure TFormSpectrum.RegistryReadChartAxis(const SubKey:string; AAxis:tChartAxis); var key:string; max,min:double; xs:string; begin key:=prRegistry.CurrentPath; if prRegistry.OpenKeyReadOnly(SubKey) then try try AAxis.Automatic:=prRegistry.ReadBool('Auto'); except end; try AAxis.AutomaticMinimum:=prRegistry.ReadBool('AutoMin'); except end; try AAxis.AutomaticMaximum:=prRegistry.ReadBool('AutoMax'); except end; try max:=prRegistry.ReadFloat('Maximum'); except max:=AAxis.Maximum; end; try min:=prRegistry.ReadFloat('Minimum'); except min:=AAxis.Minimum; end; SetAxis(AAxis, Min,Max); try AAxis.Grid.Visible:=prRegistry.ReadBool('Grid.Visible'); except end; try AAxis.Logarithmic:=prRegistry.ReadBool('Logarithmic'); except end; try AAxis.Increment:=prRegistry.ReadFloat('Increment'); except end; try xs:=prRegistry.ReadString('AxisValuesFormat'); if xs<>'' then AAxis.AxisValuesFormat:=xs; except end; finally prRegistry.OpenKey('\'+key,FALSE); end; end; function AddVF(const s:string):string; begin Result:=s+'.ValueFormat'; end; function AddFN(const s:string):string; begin Result:=s+'.FileName'; end; procedure TFormSpectrum.FormCreate(Sender: TObject); var s:tSeries; xs:string; begin SeriesMarkersCreate; try RegistryReadForm; except end; DefaultActionMassUpDownAssign; if RegistryOpenForRead then begin try WindowState:=tWindowState(prRegistry.ReadInteger('WindowState')); except end; Height:=prRegistry.ReadIntegerDef('Height',Height); Width:=prRegistry.ReadIntegerDef('Width',Width); try prRegistry.ReadBinaryData(GroupBoxShownSeries.Name,prSeriesActive,SizeOf(SeriesActive)); prSeriesActive:=prSeriesActive*[Low(tSeries)..High(tSeries)] except prSeriesActive:=[Low(tSeries)..High(tSeries)] end; try RegistryReadChart; except end; CheckBoxScrollKeyLockAssignment.Checked:=prRegistry.ReadBoolDef(CheckBoxScrollKeyLockAssignment.Name,CheckBoxScrollKeyLockAssignment.Checked); try UpDownScrollKeyStepMultiplicator.Position:=prRegistry.ReadInteger(UpDownScrollKeyStepMultiplicator.Name); except end; try Byte(SignalsMarkers):=prRegistry.ReadInteger(CheckBoxS1Mark.Name); except SignalsMarkers:=[sPNC1..sIonCounter]; end; try EditMassJumpTo.Text:=prRegistry.ReadString(EditMassJumpTo.Name); except end; try SavePictureDialog.FileName:=prRegistry.ReadString(AddFN(SavePictureDialog.Name)); except end; try SaveDialogData.FileName:=prRegistry.ReadString(AddFN(SaveDialogData.Name)); except end; try OpenDialogData.FileName:=prRegistry.ReadString(AddFN(OpenDialogData.Name)); except end; try ActionYRUseRightAxis.Checked:=prRegistry.ReadBool('UseRightAxisForCounter'); except end; try aWindowFollowsMass.Checked:=prRegistry.ReadBool(aWindowFollowsMass.Name); except end; for s:=Low(s) to High(s) do begin if Assigned(prSignals[s]) then try if Assigned(prSignals[s]) then begin xs:=AddVF(cMSSeriesNames[s]); if prRegistry.ValueExists(xs) then prSignals[s].ValueFormat:=prRegistry.ReadString(xs); end; except end; end; try xs:=AddVF(SeriesMassIndicator.Name); if prRegistry.ValueExists(xs) then SeriesMassIndicator.ValueFormat:=prRegistry.ReadString(xs); except end; try ActionTraceKeysShowHide.Checked:=prRegistry.ReadBool(ActionTraceKeysShowHide.Name); except end; ReadActionsFromRegistry; prRegistry.CloseKey; end; ComboBoxSet(EditXMax); ComboBoxSet(EditXMin); ComboBoxSet(EditYMax); ComboBoxSet(EditYMin); ComboBoxSet(EditYRMax); ComboBoxSet(EditYRMin); ComboBoxSet(EditYIncr); ComboBoxSet(EditYRIncr); ComboBoxSet(EditXIncr); ActionYRUseRightAxis.Checked:=not ActionYRUseRightAxis.Checked; ActionYRUseRightAxis.Execute; ActionShowHint.Checked:=ShowHint; Application.ShowHint:=ShowHint; RegistryProcessChart; SeriesAssignActive(prSeriesActive); ProcessSeriesMarkers; ProcessMassIndicatorPointHeight; ProcessHotKeys; ProcessSetON; end; function TFormSpectrum.SeriesActive:tSeriesSet; var s:tSeries; mss:tLineSeries; begin If Assigned(prMassSpectrometer) then begin Result:=[]; for s:=sPNC1 to sIonCounter do begin mss:=MassSpectrometer.DataSeries[s]; if Assigned(mss) then begin if (mss.ParentChart=Chart) and mss.Active then Include(Result,s); end; end; end else begin Result:=prSeriesActive; end; end; procedure TFormSpectrum.SeriesAssignActive(ss:tSeriesSet); begin CheckBoxS1.Checked:=sPNC1 in ss; CheckBoxS2.Checked:=sPNC2 in ss; CheckBoxS3.Checked:=sPNC3 in ss; CheckBoxS4.Checked:=sPNC4 in ss; CheckBoxS5.Checked:=sPNC5 in ss; CheckBoxVEU.Checked:=sPNC_SEM in ss; CheckBoxCounter.Checked:=sIonCounter in ss; ProcessSeries; end; procedure TFormSpectrum.RegistryWriteChart; var key:string; begin key:=prRegistry.CurrentPath; if prRegistry.OpenKey(Chart.Name,TRUE) then try RegistryWriteComboBox(EditXMax); RegistryWriteComboBox(EditXMin); RegistryWriteComboBox(EditYMax); RegistryWriteComboBox(EditYMin); RegistryWriteComboBox(EditYRMax); RegistryWriteComboBox(EditYRMin); RegistryWriteComboBox(EditYIncr); RegistryWriteComboBox(EditYRIncr); RegistryWriteComboBox(EditXIncr); RegistryWriteComboBox(EditMassJumpTo); try prRegistry.WriteBool('Legend.Visible',Chart.Legend.Visible); except end; RegistryWriteChartAxis('LeftAxis',Chart.LeftAxis); RegistryWriteChartAxis('RightAxis',Chart.RightAxis); RegistryWriteChartAxis('BottomAxis',Chart.BottomAxis); finally prRegistry.OpenKey('\'+key,FALSE); end; end; procedure TFormSpectrum.RegistryWriteChartAxis(const SubKey:string; AAxis:tChartAxis); var key:string; begin key:=prRegistry.CurrentPath; if prRegistry.OpenKey(SubKey,TRUE) then try try prRegistry.WriteBool('Logarithmic',AAxis.Logarithmic); except end; try prRegistry.WriteBool('Auto',AAxis.Automatic); except end; try prRegistry.WriteBool('AutoMin',AAxis.AutomaticMinimum); except end; try prRegistry.WriteBool('AutoMax',AAxis.AutomaticMaximum); except end; try prRegistry.WriteFloat('Minimum',AAxis.Minimum); except end; try prRegistry.WriteFloat('Maximum',AAxis.Maximum); except end; try prRegistry.WriteFloat('Increment',AAxis.Increment); except end; try prRegistry.WriteString('AxisValuesFormat',AAxis.AxisValuesFormat); except end; try prRegistry.WriteBool('Grid.Visible',AAxis.Grid.Visible); except end; finally prRegistry.OpenKey('\'+key,FALSE); end; end; procedure TFormSpectrum.FormDestroy(Sender: TObject); var s:tSeries; begin MassSpectrometerNIL; try if Assigned(FormSeriesEditor) then FormSeriesEditor.AFormSpectrum:=NIL; if Assigned(FormNumbersFormat) then FormNumbersFormat.Form:=NIL; except end; try RegistryWriteForm; except end; try if RegistryOpenForWrite then begin try prRegistry.WriteInteger('WindowState',Ord(WindowState)); except end; try prRegistry.WriteInteger('Height',Height); except end; try prRegistry.WriteInteger('Width',Width); except end; try prRegistry.WriteBinaryData(GroupBoxShownSeries.Name,prSeriesActive,SizeOf(SeriesActive)); except end; try RegistryWriteChart; except end; try prRegistry.WriteBool(CheckBoxScrollKeyLockAssignment.Name,CheckBoxScrollKeyLockAssignment.Checked); except end; try prRegistry.WriteInteger(UpDownScrollKeyStepMultiplicator.Name,UpDownScrollKeyStepMultiplicator.Position); except end; try prRegistry.WriteInteger(CheckBoxS1Mark.Name,Byte(SignalsMarkers)); except end; try prRegistry.WriteString(EditMassJumpTo.Name,EditMassJumpTo.Text); except end; try prRegistry.WriteBool('UseRightAxisForCounter',ActionYRUseRightAxis.Checked); except end; for s:=Low(s) to High(s) do begin if Assigned(prSignals[s]) then try prRegistry.WriteString(AddVF(cMSSeriesNames[s]),prSignals[s].ValueFormat); except end; end; try prRegistry.WriteString(AddVF(SeriesMassIndicator.Name),SeriesMassIndicator.ValueFormat); except end; try if Assigned(prTraceMarker) then begin prRegistry.WriteString(AddVF(prTraceMarker.Name),prTraceMarker.ValueFormat); prRegistry.WriteBool(prTraceMarker.Name+'.Marks.Visible',prTraceMarker.Marks.Visible); end; except end; try prRegistry.WriteString(AddFN(SavePictureDialog.Name),SavePictureDialog.FileName); except end; try prRegistry.WriteString(AddFN(SaveDialogData.Name),SaveDialogData.FileName); except end; try prRegistry.WriteString(AddFN(OpenDialogData.Name),OpenDialogData.FileName); except end; try prRegistry.WriteBool(ActionTraceKeysShowHide.Name, ActionTraceKeysShowHide.Checked); except end; try prRegistry.WriteBool(aWindowFollowsMass.Name,aWindowFollowsMass.Checked); except end; SaveActionsToRegistry; prRegistry.CloseKey; end; finally // prRegistry.Free; end; if Self=FormSpectrum then FormSpectrum:=NIL; end; procedure TFormSpectrum.ProcessError; var sw:tMSSwitches; const cWorkSwitches=[sfBPGI, sfCVF_Beam, sf10kV, sfCVF_InputEMU]; begin LabelState.Color:=GroupBoxState.Color; LabelState.Font.Color:=GroupBoxState.Font.Color; If Assigned(MassSpectrometer) then begin if MassSpectrometer.IsON then begin if MassSpectrometer.IsError then begin LabelState.Caption:='ОШИБКА'; LabelState.Color:=clRed; LabelState.Font.Color:=clYellow; end else begin sw:=MassSpectrometer.Switches; if sw*cWorkSwitches=cWorkSwitches then begin LabelState.Caption:='ВКЛЮЧЕН'; end else begin LabelState.Color:=clYellow; LabelState.Font.Color:=clBlue; LabelState.Caption:='ВКЛ.(частично)'; end; end; end else begin LabelState.Caption:='ВЫКЛЮЧЕН'; end; end else begin LabelState.Caption:='?'; end; end; (*procedure TFormSpectrum.ProcessYAxis; begin CheckBoxYLog.Checked:=Chart.LeftAxis.Logarithmic; MenuItemYLog.Checked:=Chart.LeftAxis.Logarithmic; end;*) (*procedure TFormSpectrum.ProcessYRAxis; begin CheckBoxYRLog.Checked:=Chart.RightAxis.Logarithmic; // MenuItemYLog.Checked:=Chart.RightAxis.Logarithmic; end;*) procedure TFormSpectrum.EditYMaxKeyPress(Sender: TObject; var Key: Char); begin case Key of #13: begin ActionYMax.Execute; end; #27: EditYMax.Text:=FloatToStr(Chart.LeftAxis.Maximum); end; end; procedure TFormSpectrum.EditYMinKeyPress(Sender: TObject; var Key: Char); begin case Key of #13: begin ActionYMin.Execute; end; #27: EditYMin.Text:=FloatToStr(Chart.LeftAxis.Minimum); end; end; procedure TFormSpectrum.EditXMinKeyPress(Sender: TObject; var Key: Char); begin case Key of #13: begin ActionXMin.Execute; end; #27: EditXMin.Text:=FloatToStr(Chart.BottomAxis.Minimum); end; end; (*procedure TFormSpectrum.ProcessXAxis; begin end;*) procedure TFormSpectrum.EditXMaxKeyPress(Sender: TObject; var Key: Char); begin case Key of #13: begin ActionXMax.Execute; end; #27: EditXMax.Text:=FloatToStr(Chart.BottomAxis.Maximum); end; end; function TFormSpectrum.ProcessMassEx(m:tMass):boolean; var NewMass:boolean; min,max,mc:tMass; begin Result:=FALSE; mc:=MassIndicator; NewMass:=m<>mc; if NewMass then begin LabelMassCurrent.Caption:=FloatToStrF(m,ffGeneral,7,3); LabelMassStepMin.Caption:=FloatToStrF(MassSpectrometer.MassStepLast,ffGeneral,5,3); LabelCounterCurrent.Caption:=IntToStr(MassSpectrometer.Counter); end; if not (fMassDrag in prFlags) then begin if NewMass then begin min:=Chart.BottomAxis.Minimum; max:=Chart.BottomAxis.Maximum; Result:=((min<=m) and (m<=max)) or ((min<=mc) and (mc<=max)); MassIndicator:=m; end; if Chart.LeftAxis.Minimum<>SeriesMassIndicator.YValues[0] then SeriesMassIndicator.YValues[0]:=Chart.LeftAxis.Minimum; if Chart.LeftAxis.Maximum<>SeriesMassIndicator.YValues[1] then SeriesMassIndicator.YValues[1]:=Chart.LeftAxis.Maximum; end; end; procedure TFormSpectrum.ProcessMass; begin if not Assigned(MassSpectrometer) then Exit; if NotVisible then Exit; if ProcessMassEx(MassSpectrometer.Mass) then begin Chart.Repaint; end else begin if aWindowFollowsMass.Checked then begin DoWindowFollowsMass; end; end; end; (*procedure TFormSpectrum.ProcessMassCalibrationChanged; begin ProcessMass; ProcessNewPoint; Chart.Repaint; end; *) procedure TFormSpectrum.ProcessMassIndicatorPointHeight; var vs:integer; begin vs:=Abs(Chart.ChartRect.Top-Chart.ChartRect.Bottom); if vs<4 then vs:=4; SeriesMassIndicator.Pointer.VertSize:=vs; end; procedure TFormSpectrum.ProcessMassIndicatorMinMax; var b:boolean; mi,ma:double; begin ProcessMassIndicatorPointHeight; if Chart.LeftAxis.Automatic then begin b:=SeriesMassIndicator.Active; SeriesMassIndicator.Active:=False; Chart.LeftAxis.CalcMinMax (Mi,Ma); SeriesMassIndicator.YValue[0]:=Mi; SeriesMassIndicator.YValue[1]:=Ma; SeriesMassIndicator.Active:=b; end else if Chart.LeftAxis.AutomaticMaximum then begin b:=SeriesMassIndicator.Active; SeriesMassIndicator.Active:=False; Chart.LeftAxis.CalcMinMax (Mi,Ma); SeriesMassIndicator.YValue[0]:=Chart.LeftAxis.Minimum; SeriesMassIndicator.YValue[1]:=Ma; SeriesMassIndicator.Active:=b; end else if Chart.LeftAxis.AutomaticMinimum then begin b:=SeriesMassIndicator.Active; SeriesMassIndicator.Active:=False; Chart.LeftAxis.CalcMinMax (Mi,Ma); SeriesMassIndicator.YValue[0]:=Mi; SeriesMassIndicator.YValue[1]:=Chart.LeftAxis.Maximum; SeriesMassIndicator.Active:=b; end else begin SeriesMassIndicator.YValue[0]:=Chart.LeftAxis.Minimum; SeriesMassIndicator.YValue[1]:=Chart.LeftAxis.Maximum; end; end; procedure TFormSpectrum.ProcessPointsNumber; begin Exclude(prFlags,fPointNumberProcessingInProgress); if not Assigned(MassSpectrometer) then Exit; LabelPointsNumber.Caption:=IntToStr(MassSpectrometer.DataPointsCount); If Assigned(FormStatisticInfo) then begin FormStatisticInfo.LabelPointsNumber.Caption:=LabelPointsNumber.Caption; end; end; procedure TFormSpectrum.EditIntegrationTimeKeyPress(Sender: TObject; var Key: Char); begin if not Assigned(MassSpectrometer) then Exit; case Key of #13: begin ActionIntTimeExecute(Sender); end; #27: ProcessIntegrationTime; end; end; procedure TFormSpectrum.ProcessIntegrationTime; begin if not Assigned(MassSpectrometer) then Exit; try EditIntegrationTime.Text:=IntToStr(MassSpectrometer.IntegrationTime); except EditIntegrationTime.Text:='?'; end; end; procedure TFormSpectrum.EditIntegrationTimeExit(Sender: TObject); begin ProcessIntegrationTime; end; procedure TFormSpectrum.EditMassStepKeyPress(Sender: TObject; var Key: Char); begin if not Assigned(MassSpectrometer) then Exit; case Key of #13: begin try MassSpectrometer.MassStep:=StrToFloat_MSG(TEdit(Sender).Text); except ProcessMassStep; end; end; #27:ProcessMassStep; else; end; end; procedure TFormSpectrum.ProcessMassStep; begin if not Assigned(MassSpectrometer) then Exit; EditMassStep.Text:=FloatToStr(MassSpectrometer.MassStep); ProcessStepMultiplicator; ProcessStart; end; procedure TFormSpectrum.EditMassStepExit(Sender: TObject); begin ProcessMassStep; end; procedure TFormSpectrum.EditStepMulKeyPress(Sender: TObject; var Key: Char); begin if not Assigned(MassSpectrometer) then Exit; case Key of #13: begin try MassSpectrometer.StepMultiplicator:=StrToInt_MSG(EditStepMul.Text); except ProcessMassStep; end; end; #27: ProcessStepMultiplicator; else; end; end; procedure TFormSpectrum.ProcessStepMultiplicator; begin if not Assigned(MassSpectrometer) then Exit; EditStepMul.Text:=IntToStr(MassSpectrometer.StepMultiplicator); UpDownStepMul.Enabled:=FALSE; UpDownStepMul.Position:=MassSpectrometer.StepMultiplicator; UpDownStepMul.Enabled:=TRUE; ProcessStart; end; procedure TFormSpectrum.EditStepMulExit(Sender: TObject); begin ProcessStepMultiplicator; end; procedure TFormSpectrum.ProcessStart; procedure ProcessStep; begin case MassSpectrometer.ScrollDirection of sdNoScroll: SpeedButtonScrollPause.Down:=TRUE; sdUp: SpeedButtonScrollRight.Down:=TRUE; sdDown: SpeedButtonScrollLeft.Down:=TRUE; else SpeedButtonScrollStop.Down:=TRUE; end; end; begin if not Assigned(MassSpectrometer) then Exit; case MassSpectrometer.MeasureState of msErrorStopped: begin SpeedButtonScrollStop.Down:=TRUE; end; msNotAvailableStopped: begin SpeedButtonScrollStop.Down:=TRUE; end; msStopped: begin SpeedButtonScrollStop.Down:=TRUE; end; msPaused: begin SpeedButtonScrollPause.Down:=TRUE; end; msScroll: begin ProcessStep; end; { msRepeatedlyWithDataReplace: begin ProcessStep; end; msRepeatedlyWithDataAccumulation: begin ProcessStep; end;} else begin ProcessStep; end; end; Chart.Repaint; end; procedure TFormSpectrum.ChartZoom(Sender: TObject); begin ProcessMassIndicatorMinMax; end; procedure TFormSpectrum.ChartUndoZoom(Sender: TObject); begin ProcessMassIndicatorMinMax; end; procedure TFormSpectrum.EditSEMExit(Sender: TObject); begin ProcessSEM; end; procedure TFormSpectrum.EditSEMKeyPress(Sender: TObject; var Key: Char); begin if not Assigned(prMassSpectrometer) then Exit; case Key of #13: begin ActionSEMVoltageExecute(Sender); end; #27: begin ProcessSEM; end; else; end; end; procedure TFormSpectrum.ProcessSEM; begin if not Assigned(MassSpectrometer) then Exit; try EditSEM.Text:=IntToStr(prMassSpectrometer.Device[SEM_Voltage]); except end; end; procedure TFormSpectrum.FillInChannels; begin ActionSeries0_ShowHide.Tag:=Ord(sPNC1); ActionSeries1_ShowHide.Tag:=Ord(sPNC2); ActionSeries2_ShowHide.Tag:=Ord(sPNC3); ActionSeries3_ShowHide.Tag:=Ord(sPNC4); ActionSeries4_ShowHide.Tag:=Ord(sPNC5); ActionSeries5_ShowHide.Tag:=Ord(sPNC_SEM); ActionSeries6_ShowHide.Tag:=Ord(sIonCounter); ActionSeriesMarker0_ShowHide.Tag:=Ord(sPNC1); ActionSeriesMarker1_ShowHide.Tag:=Ord(sPNC2); ActionSeriesMarker2_ShowHide.Tag:=Ord(sPNC3); ActionSeriesMarker3_ShowHide.Tag:=Ord(sPNC4); ActionSeriesMarker4_ShowHide.Tag:=Ord(sPNC5); ActionSeriesMarker5_ShowHide.Tag:=Ord(sPNC_SEM); ActionSeriesMarker6_ShowHide.Tag:=Ord(sIonCounter); end; procedure TFormSpectrum.ProcessSeries; begin prSeriesActive:=SeriesActive; ActionSeries0_ShowHide.Checked:=sPNC1 in prSeriesActive; ActionSeries1_ShowHide.Checked:=sPNC2 in prSeriesActive; ActionSeries2_ShowHide.Checked:=sPNC3 in prSeriesActive; ActionSeries3_ShowHide.Checked:=sPNC4 in prSeriesActive; ActionSeries4_ShowHide.Checked:=sPNC5 in prSeriesActive; ActionSeries5_ShowHide.Checked:=sPNC_SEM in prSeriesActive; ActionSeries6_ShowHide.Checked:=sIonCounter in prSeriesActive; ProcessLeftAxis; end; procedure TFormSpectrum.ProcessSetOn; begin ProcessMass; ProcessPointsNumber; ProcessIntegrationTime; ProcessMassStep; ProcessStepMultiplicator; ProcessStart; ProcessSEM; ProcessSeries; ProcessSwitchesChanged; ProcessValve; ProcessMainChannel; ProcessRanges; ProcessNewPoint; ProcessError; end; procedure TFormSpectrum.ProcessSetOff; begin ProcessSetOn; end; procedure TFormSpectrum.ButtonDownClick(Sender: TObject); begin if not Assigned(MassSpectrometer) then Exit; MassSpectrometer.Pause; MassSpectrometer.MassX:=MassSpectrometer.Mass-Abs(MassSpectrometer.MassStepAbsoluteMin); (* MassSpectrometer.MassX:=MassSpectrometer.Mass-ButtonDown.Tag*Abs(MassSpectrometer.MassStepAbsoluteMin); ButtonUp.Tag:=1; if ButtonDown.Tag<(ScrollKeyStepMultiplicator div 10) then begin ButtonDown.Tag:=ButtonDown.Tag+1; end;*) end; procedure TFormSpectrum.ButtonUpClick(Sender: TObject); begin if not Assigned(MassSpectrometer) then Exit; MassSpectrometer.Pause; MassSpectrometer.MassX:=MassSpectrometer.Mass+Abs(MassSpectrometer.MassStepAbsoluteMin); (* MassSpectrometer.MassX:=MassSpectrometer.Mass+ButtonUp.Tag*Abs(MassSpectrometer.MassStepAbsoluteMin); ButtonDown.Tag:=1; if ButtonUp.Tag<(ScrollKeyStepMultiplicator div 10) then begin ButtonUp.Tag:=ButtonUp.Tag+1; end;*) end; procedure TFormSpectrum.ButtonDownFastClick(Sender: TObject); begin if not Assigned(MassSpectrometer) then Exit; MassSpectrometer.Pause; MassSpectrometer.MassX:=MassSpectrometer.Mass-ScrollKeyStepMultiplicator*Abs(MassSpectrometer.MassStepAbsoluteMin); end; procedure TFormSpectrum.ButtonUpFastClick(Sender: TObject); begin if not Assigned(MassSpectrometer) then Exit; MassSpectrometer.Pause; MassSpectrometer.MassX:=MassSpectrometer.Mass+ScrollKeyStepMultiplicator*Abs(MassSpectrometer.MassStepAbsoluteMin); end; (*function HotKeyModifiersToShiftState(THKModifiers:THKModifiers):TShiftState; begin Result:=[]; if hkShift in THKModifiers then Include(Result,ssShift); if hkAlt in THKModifiers then Include(Result,ssAlt); if hkCtrl in THKModifiers then Include(Result,ssCtrl); end; *) procedure TFormSpectrum.HotKeyDownFastEnter(Sender: TObject); begin ActionMassDownFast.ShortCut:=0; end; procedure TFormSpectrum.HotKeyDownEnter(Sender: TObject); begin ActionMassDown.ShortCut:=0; end; procedure TFormSpectrum.HotKeyUpEnter(Sender: TObject); begin ActionMassUp.ShortCut:=0; end; procedure TFormSpectrum.HotKeyUpFastEnter(Sender: TObject); begin ActionMassUpFast.ShortCut:=0; end; procedure TFormSpectrum.HotKeyDownExit(Sender: TObject); begin // HotKeyDown.HotKey; // ProcessMessages; ActionMassDown.ShortCut:=HotKeyDown.HotKey; end; procedure TFormSpectrum.HotKeyUpExit(Sender: TObject); begin // HotKeyUp.HotKey; // ProcessMessages; ActionMassUp.ShortCut:=HotKeyUp.HotKey; end; procedure TFormSpectrum.HotKeyDownFastExit(Sender: TObject); begin // HotKeyDownFast.HotKey; // ProcessMessages; ActionMassDownFast.ShortCut:=HotKeyDownFast.HotKey; end; procedure TFormSpectrum.HotKeyUpFastExit(Sender: TObject); begin // HotKeyUpFast.HotKey; // ProcessMessages; ActionMassUpFast.ShortCut:=HotKeyUpFast.HotKey; end; procedure TFormSpectrum.ProcessHotKeys; begin HotKeyDownFast.HotKey:=ActionMassDownFast.ShortCut; HotKeyDown.HotKey:=ActionMassDown.ShortCut; HotKeyUp.HotKey:=ActionMassUp.ShortCut; HotKeyUpFast.HotKey:=ActionMassUpFast.ShortCut; HotKeyTraceLeft.HotKey:=ActionTraceLeft.ShortCut; HotKeyTraceRight.HotKey:=ActionTraceRight.ShortCut; end; procedure TFormSpectrum.CheckBoxScrollKeyLockAssignmentClick(Sender: TObject); var en:boolean; begin en:=not CheckBoxScrollKeyLockAssignment.Checked; HotKeyDownFast.Enabled:=en; HotKeyDown.Enabled:=en; HotKeyUpFast.Enabled:=en; HotKeyUp.Enabled:=en; end; procedure TFormSpectrum.EditScrollKeyStepMultiplicatorExit( Sender: TObject); begin EditScrollKeyStepMultiplicator.Text:=IntToStr(UpDownScrollKeyStepMultiplicator.Position); end; function TFormSpectrum.ScrollKeyStepMultiplicator:integer; begin Result:=UpDownScrollKeyStepMultiplicator.Position; if Result=0 then Result:=100; end; procedure TFormSpectrum.EditScrollKeyStepMultiplicatorChange( Sender: TObject); begin if ActiveControl<>EditScrollKeyStepMultiplicator then Exit; try UpDownScrollKeyStepMultiplicator.Position:=StrToInt_MSG(EditScrollKeyStepMultiplicator.Text); except end; end; procedure TFormSpectrum.ProcessNewPoint; var s:tSeries; ser:tPointSeries; Repaint:boolean; begin Exclude(prFlags,fPointProcessingInProgress); if (not Assigned(MassSpectrometer)) then Exit; if Assigned(FormStatisticInfo) then ProcessStatisticTime; if NotVisible then Exit; if (SignalsMarkers<>[]) then begin Repaint:=FALSE; for s:=sPNC1 to sIonCounter do if (s in SignalsMarkers) then begin ser:=prSignals[s]; if Assigned(ser) and ser.Active then begin if (ser.XValues[0]<>MassSpectrometer.Signals.Mass) then begin Repaint:=TRUE; ser.XValues[0]:=MassSpectrometer.Signals.Mass; end; if (ser.YValues[0]<>MassSpectrometer.Signals.Signals[cChannels[s]]) then begin Repaint:=TRUE; ser.YValues[0]:=MassSpectrometer.Signals.Signals[cChannels[s]]; end; end; end; (* if not (fMassDrag in prFlags) then begin m:=MassSpectrometer.Mass; if m<>SeriesMassIndicator.XValues[0] then begin SeriesMassIndicator.XValues[0]:=m; SeriesMassIndicator.XValues[1]:=m; end; end;*) // ProcessMassEx(MassSpectrometer.Mass); if Repaint then Chart.Repaint; end; end; procedure TFormSpectrum.ProcessSeriesMarkers; var s:tSeries; sr:tPointSeries; begin if not Assigned(MassSpectrometer) then Exit; for s:=Low(s) to High(s) do begin sr:=prSignals[s]; if Assigned(sr) then begin sr.Active:=s in SignalsMarkers; end; end; ActionSeriesMarker0_ShowHide.Checked:=sPNC1 in SignalsMarkers; ActionSeriesMarker1_ShowHide.Checked:=sPNC2 in SignalsMarkers; ActionSeriesMarker2_ShowHide.Checked:=sPNC3 in SignalsMarkers; ActionSeriesMarker3_ShowHide.Checked:=sPNC4 in SignalsMarkers; ActionSeriesMarker4_ShowHide.Checked:=sPNC5 in SignalsMarkers; ActionSeriesMarker5_ShowHide.Checked:=sPNC_SEM in SignalsMarkers; ActionSeriesMarker6_ShowHide.Checked:=sIonCounter in SignalsMarkers; end; procedure TFormSpectrum.EditMassJumpToKeyPress(Sender: TObject; var Key: Char); begin case Key of #13: ActionJumpToMassExecute(Sender); end; end; procedure TFormSpectrum.UpDownStepMulChanging(Sender: TObject; var AllowChange: Boolean); begin if not Assigned(MassSpectrometer) then Exit; if not UpDownStepMul.Enabled then Exit; try MassSpectrometer.StepMultiplicator:=UpDownStepMul.Position; except end; end; procedure TFormSpectrum.ProcessMassSpDestroyFast; begin if Assigned(FormSeriesEditor) then FormSeriesEditor.AFormSpectrum:=NIL; prMassSpectrometer:=NIL; // Synchronize(ProcessMassSpDestroy); end; procedure TFormSpectrum.ProcessMassSpDestroy; begin // SeriesRemove; end; procedure TFormSpectrum.FormKeyPress(Sender: TObject; var Key: Char); begin case Key of #27: begin MassDragCancel; ActionTraceCancel.Execute; end; #13,' ': begin MassDragApply; end; end; end; procedure TFormSpectrum.MassDragApply; begin if fMassDrag in prFlags then begin MassSetNew(MassIndicator); MassDragCancel; end; end; procedure TFormSpectrum.MassDragCancel; begin if fMassDrag in prFlags then begin SeriesMassIndicator.Cursor:=crTeeHand; Chart.OnMouseMove:=ChartMouseMove; Exclude(prFlags,fMassDrag); ProcessMass; ProcessMessages; end; end; procedure TFormSpectrum.MassSetNew(AMass:double); begin if not MsON_WithMsg then Exit; try MassSpectrometer.MassX:=AMass; except end; end; procedure TFormSpectrum.SeriesMassIndicatorClick(Sender: TChartSeries; ValueIndex: Integer; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin if (fMassDrag in prFlags) then Exit; if Button=mbLeft then begin MassDragStart; end else begin MassDragCancel; end; end; procedure TFormSpectrum.MassDragStart; begin if not (fMassDrag in prFlags) then begin ActionTraceCancel.Execute; SeriesMassIndicator.Cursor:=crHandPoint; Include(prFlags,fMassDrag); Include(prFlags,fMassDragStarted); Chart.OnMouseMove:=ChartMouseMoveMassDrag; ProcessMessages; end; end; procedure TFormSpectrum.ChartClick(Sender: TObject); begin if not (fMassDragStarted in prFlags) then MassDragApply else Exclude(prFlags,fMassDragStarted); end; procedure TFormSpectrum.ChartMouseMoveMassDrag(Sender: TObject; Shift: TShiftState; X, Y: Integer); var m:double; begin if not Active then Exit; if PtInRect( Chart.ChartRect, Point(X-Chart.Width3D,Y+Chart.Height3D)) then begin m:=Chart.BottomAxis.CalcPosPoint(X); SeriesMassIndicator.XValue[0]:=m; SeriesMassIndicator.XValue[1]:=m; end; end; procedure TFormSpectrum.ChartClickAxis(Sender: TCustomChart; Axis: TChartAxis; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin case Button of mbLeft: begin if Axis=Chart.BottomAxis then begin MassDragCancel; MassSetNew(Chart.BottomAxis.CalcPosPoint(X)); end else if Axis=Chart.LeftAxis then begin AxisSetByClick(Chart.LeftAxis, EditYMin); end else if Axis=Chart.RightAxis then begin AxisSetByClick(Chart.RightAxis, EditYRMin); end; end; mbRight: begin if Axis=Chart.BottomAxis then begin if Assigned(MassFromBottomAxiesRightClickNotificator) then begin MassFromBottomAxiesRightClickNotify(Chart.BottomAxis.CalcPosPoint(X)); { end else begin AxisSetByClickEx(Chart.BottomAxis, EditXMin, X);} end; end; end; end; end; procedure TFormSpectrum.ProcessMassAboutChange; begin if NotVisible then Exit; TimerMassChange.Enabled:=TRUE; StatusBarMass.Font.Style:=StatusBarMass.Font.Style-[fsBold]; StatusBarMass.SimpleText:='переход на другую массу...'; end; procedure TFormSpectrum.ProcessMassAboutChangeEnd; begin ProcessMass; StatusBarMass.SimpleText:=''; end; procedure TFormSpectrum.ChartResize(Sender: TObject); begin ProcessMassIndicatorPointHeight; end; procedure TFormSpectrum.ProcessSwitchesChanged; var sws:tMSSwitches; begin if Assigned(MassSpectrometer) then begin sws:=MassSpectrometer.Switches; ActionSEMOn.Checked :=sfSEM in sws; CheckBoxAccumulation.Checked := mstAccumulation in sws; CheckBoxUseRanges.Checked := mstUseRanges in sws; ProcessError; end; end; procedure TFormSpectrum.ProcessValveAutoCloseTime; begin if Assigned(MassSpectrometer) and MassSpectrometer.IsON then begin if MassSpectrometer.ValveAutoCloseEnabled then begin LabelValveAutoClose.Caption:='Авто '+IntToStr((MassSpectrometer.ValveAutoCloseTimeLeft+500) div 1000)+' c'; end else if (MassSpectrometer.Valve<>sCloseAll) then begin LabelValveAutoClose.Caption:='Ручн.'; end else begin LabelValveAutoClose.Caption:=''; end; end else begin LabelValveAutoClose.Caption:='?'; end; end; procedure TFormSpectrum.ProcessValve; begin if Assigned(MassSpectrometer) then begin LabelValve.Caption:=cSourceNames[MassSpectrometer.Valve]; end else begin LabelValve.Caption:='?' end; ProcessValveAutoCloseTime; end; procedure TFormSpectrum.ProcessMainChannel; begin if Assigned(MassSpectrometer) then begin ComboBoxMainChannel.ItemIndex:=Ord(MassSpectrometer.MainChannel); end else begin ComboBoxMainChannel.ItemIndex:=-1; end; end; procedure TFormSpectrum.ProcessMassLimit; begin if Assigned(MassSpectrometer) then begin if MassSpectrometer.MassLimit then begin StatusBarMass.Font.Style:=StatusBarMass.Font.Style+[fsBold]; if MassSpectrometer.MassLimitLow then StatusBarMass.SimpleText:='Нижний предел' else StatusBarMass.SimpleText:='Верхний предел'; end else begin StatusBarMass.SimpleText:=''; end; end; end; procedure TFormSpectrum.SaveActionsToRegistry; var i:integer; a:TContainedAction; key:string; begin key:=prRegistry.CurrentPath; try if RegistryOpenForWriteSubKey(ActionListMain.Name) then begin for i:=0 to Pred(ActionListMain.ActionCount) do begin a:=ActionListMain.Actions[i]; try if (a as TCustomAction).ShortCut=0 then prRegistry.DeleteValue(a.Name) else prRegistry.WriteInteger(a.Name,(a as TCustomAction).ShortCut); except end; end; end; finally prRegistry.OpenKey('\'+key,FALSE); end; end; procedure TFormSpectrum.DefaultActionMassUpDownAssign; begin ActionMassDownFast.ShortCut:=ShortCut(VK_LEFT,[ssCtrl,ssAlt]); ActionMassDown.ShortCut:=ShortCut(VK_RIGHT,[ssAlt]); ActionMassUp.ShortCut:=ShortCut(VK_RIGHT,[ssAlt]); ActionMassUpFast.ShortCut:=ShortCut(VK_RIGHT,[ssCtrl,ssAlt]); end; procedure TFormSpectrum.ReadActionsFromRegistry; var i:integer; a:TContainedAction; key:string; begin key:=prRegistry.CurrentPath; try if RegistryOpenForReadSubKey(ActionListMain.Name) then begin for i:=0 to Pred(ActionListMain.ActionCount) do begin a:=ActionListMain.Actions[i]; if prRegistry.ValueExists(a.Name) then try (a as TCustomAction).ShortCut:=prRegistry.ReadInteger(a.Name); except end; end; end else begin DefaultActionMassUpDownAssign; end; finally prRegistry.OpenKey('\'+key,FALSE); end; end; procedure TFormSpectrum.ActionYAutoExecute(Sender: TObject); begin if fTraceActive in prFlags then begin if Assigned(prTraceMarker) then prTraceMarker.Active:=FALSE; Chart.LeftAxis.Automatic:=TRUE; Repaint; Chart.LeftAxis.Automatic:=FALSE; if Assigned(prTraceMarker) then prTraceMarker.Active:=TRUE; end else begin Chart.LeftAxis.Automatic:=TRUE; end; ProcessMassIndicatorMinMax; end; procedure TFormSpectrum.ActionYAutoMaxExecute(Sender: TObject); begin if fTraceActive in prFlags then begin if Assigned(prTraceMarker) then prTraceMarker.Active:=FALSE; Chart.LeftAxis.AutomaticMaximum:=TRUE; Repaint; Chart.LeftAxis.AutomaticMaximum:=FALSE; if Assigned(prTraceMarker) then prTraceMarker.Active:=TRUE; end else begin Chart.LeftAxis.AutomaticMaximum:=TRUE; end; ProcessMassIndicatorMinMax; end; procedure TFormSpectrum.ActionYAutoMinExecute(Sender: TObject); begin if fTraceActive in prFlags then begin if Assigned(prTraceMarker) then prTraceMarker.Active:=FALSE; Chart.LeftAxis.AutomaticMinimum:=TRUE; Repaint; Chart.LeftAxis.AutomaticMinimum:=FALSE; if Assigned(prTraceMarker) then prTraceMarker.Active:=TRUE; end else begin Chart.LeftAxis.AutomaticMinimum:=TRUE; end; ProcessMassIndicatorMinMax; end; procedure TFormSpectrum.ActionYMinMaxExecute(Sender: TObject); begin ActionYMin.Execute; ActionYMax.Execute; end; procedure TFormSpectrum.ActionDataClearAllAskExecute(Sender: TObject); begin ActionTraceCancel.Execute; Inherited ClearAll; end; procedure TFormSpectrum.SetAxis(AAxis:tChartAxis; Min,Max:double); var m:double; begin AAxis.Automatic:=FALSE; if Max0) or not AAxis.Logarithmic then begin AAxis.AutomaticMinimum:=FALSE; if (AAxis.Maximum'' then begin try x:=StrToFloat_MSG(AText); Result:=MinVSet(AAxis,x); except end; end; end; procedure TFormSpectrum.ActionYMinExecute(Sender: TObject); begin if (EditYMin.ItemIndex=0) or (EditYMin.Text=cAuto) then begin ActionYAutoMin.Execute; end else if MinSet(Chart.LeftAxis, EditYMin.Text) then begin AddTextToStringsList1(EditYMin); ProcessMassIndicatorMinMax; end; end; function MaxVSet(AAxis:tChartAxis; x:double):boolean; begin try if (x>0) or not AAxis.Logarithmic then begin if (AAxis.Minimum>x) then begin AAxis.AutomaticMinimum:=FALSE; AAxis.Minimum:=x; end; AAxis.AutomaticMaximum:=FALSE; AAxis.Maximum:=x; end; Result:=TRUE; except Result:=FALSE; end; end; function TFormSpectrum.MaxSet(AAxis:tChartAxis; const AText:string):boolean; var x:double; begin Result:=FALSE; if AText<>'' then begin try x:=StrToFloat_MSG(AText); Result:=MaxVSet(AAxis,x); except end; end; end; procedure TFormSpectrum.ActionYMaxExecute(Sender: TObject); begin if (EditYMax.ItemIndex=0) or (EditYMax.Text=cAuto) then begin ActionYAutoMax.Execute; end else if MaxSet(Chart.LeftAxis, EditYMax.Text) then begin AddTextToStringsList1(EditYMax); ProcessMassIndicatorMinMax; end; end; procedure YLogarithmicSet(AAxis:tChartAxis; State:boolean); var AMax,AMin:boolean; begin if State=AAxis.Logarithmic then Exit; if (not AAxis.Logarithmic) then begin AMax:=AAxis.AutomaticMaximum; AMin:=AAxis.AutomaticMinimum; AAxis.AutomaticMinimum:=FALSE; AAxis.AutomaticMaximum:=FALSE; if AAxis.Minimum<0 then begin AAxis.Minimum:=AAxis.Maximum; end; if AAxis.Maximum<=0 then begin AAxis.Maximum:=1; if AAxis.Minimum<0 then begin AAxis.Minimum:=0; end; end; AAxis.Logarithmic:=TRUE; AAxis.AutomaticMaximum:=AMax; AAxis.AutomaticMinimum:=AMin; end else begin AAxis.Logarithmic:=FALSE; end; end; procedure TFormSpectrum.ActionYLogarithmicExecute(Sender: TObject); begin ActionYLogarithmic.Enabled:=FALSE; try YLogarithmicSet(Chart.LeftAxis, not Chart.LeftAxis.Logarithmic); ActionYLogarithmic.Checked:=Chart.LeftAxis.Logarithmic; finally ActionYLogarithmic.Enabled:=TRUE; end; end; procedure TFormSpectrum.ActionXAutoExecute(Sender: TObject); begin if fTraceActive in prFlags then begin if Assigned(prTraceMarker) then prTraceMarker.Active:=FALSE; Chart.BottomAxis.Automatic:=TRUE; Repaint; Chart.BottomAxis.Automatic:=FALSE; if Assigned(prTraceMarker) then prTraceMarker.Active:=TRUE; end else begin Chart.BottomAxis.Automatic:=TRUE; end; end; procedure TFormSpectrum.ActionXAutoMinExecute(Sender: TObject); begin if fTraceActive in prFlags then begin if Assigned(prTraceMarker) then prTraceMarker.Active:=FALSE; Chart.BottomAxis.AutomaticMinimum:=TRUE; Repaint; Chart.BottomAxis.AutomaticMinimum:=FALSE; if Assigned(prTraceMarker) then prTraceMarker.Active:=TRUE; end else begin Chart.BottomAxis.AutomaticMinimum:=TRUE; end; end; procedure TFormSpectrum.ActionXAutoMaxExecute(Sender: TObject); begin if fTraceActive in prFlags then begin if Assigned(prTraceMarker) then prTraceMarker.Active:=FALSE; Chart.BottomAxis.AutomaticMaximum:=TRUE; Repaint; Chart.BottomAxis.AutomaticMaximum:=FALSE; if Assigned(prTraceMarker) then prTraceMarker.Active:=TRUE; end else begin Chart.BottomAxis.AutomaticMaximum:=TRUE; end; end; procedure TFormSpectrum.ActionXMinMaxExecute(Sender: TObject); begin ActionXMin.Execute; ActionXMax.Execute; end; procedure TFormSpectrum.ActionXMinExecute(Sender: TObject); begin if (EditXMin.ItemIndex=0) or (EditXMin.Text=cAuto) then begin ActionXAutoMin.Execute; end else if MinSet(Chart.BottomAxis, EditXMin.Text) then begin if EditXMin.Tag=0 then AddTextToStringsList1(EditXMin); end; EditXMin.Tag:=0; end; procedure TFormSpectrum.ActionXMaxExecute(Sender: TObject); begin if (EditXMax.ItemIndex=0) or (EditXMax.Text=cAuto) then begin ActionXAutoMax.Execute; end else if MaxSet(Chart.BottomAxis, EditXMax.Text) then begin if EditXMax.Tag=0 then AddTextToStringsList1(EditXMax); end; EditXMax.Tag:=0; end; procedure TFormSpectrum.ProcessStatisticTime; begin If not Assigned(FormStatisticInfo) then Exit; if (not FormStatisticInfo.Visible) or (FormStatisticInfo.WindowState=wsMinimized) then Exit; with FormStatisticInfo do begin if MassSpectrometer.PointTimeData.Number>0 then begin LabelN.Caption:=IntToStr(MassSpectrometer.PointTimeData.Number); LabelLastT.Caption:=IntToStr(MassSpectrometer.PointTimeData.LastTime); LabelMinT.Caption:=IntToStr(MassSpectrometer.PointTimeData.MinTime); LabelMaxT.Caption:=IntToStr(MassSpectrometer.PointTimeData.MaxTime); LabelAverageT.Caption:=IntToStr(Round(MassSpectrometer.PointTimeData.FullTime/MassSpectrometer.PointTimeData.Number)); end else begin LabelN.Caption:='?'; LabelLastT.Caption:='?'; LabelMinT.Caption:='?'; LabelMaxT.Caption:='?'; LabelAverageT.Caption:='?'; end; if MassSpectrometer.CycleTimeData.Number>0 then begin LabelCN.Caption:=IntToStr(MassSpectrometer.CycleTimeData.Number); LabelCLastT.Caption:=IntToStr(MassSpectrometer.CycleTimeData.LastTime); LabelCMinT.Caption:=IntToStr(MassSpectrometer.CycleTimeData.MinTime); LabelCMaxT.Caption:=IntToStr(MassSpectrometer.CycleTimeData.MaxTime); LabelCAverageT.Caption:=IntToStr(Round(MassSpectrometer.CycleTimeData.FullTime/MassSpectrometer.CycleTimeData.Number)); end else begin LabelCN.Caption:='?'; LabelCLastT.Caption:='?'; LabelCMinT.Caption:='?'; LabelCMaxT.Caption:='?'; LabelCAverageT.Caption:='?'; end; if MassSpectrometer.IdleTimeData.Number>0 then begin LabelIN.Caption:=IntToStr(MassSpectrometer.IdleTimeData.Number); LabelILastT.Caption:=IntToStr(MassSpectrometer.IdleTimeData.LastTime); LabelIMinT.Caption:=IntToStr(MassSpectrometer.IdleTimeData.MinTime); LabelIMaxT.Caption:=IntToStr(MassSpectrometer.IdleTimeData.MaxTime); LabelIAverageT.Caption:=IntToStr(Round(MassSpectrometer.IdleTimeData.FullTime/MassSpectrometer.IdleTimeData.Number)); end else begin LabelIN.Caption:='?'; LabelILastT.Caption:='?'; LabelIMinT.Caption:='?'; LabelIMaxT.Caption:='?'; LabelIAverageT.Caption:='?'; end; end; end; procedure TFormSpectrum.ActionDataClearAllExecute(Sender: TObject); begin if not Assigned(MassSpectrometer) then Exit; MassSpectrometer.Clear; end; procedure TFormSpectrum.ActionDataSaveToFileAskExecute(Sender: TObject); resourcestring rcText1='Файл "'; rcText2='" уже существует.'+ #13'____________'+ #13#13'Перезаписать?'; begin if not Assigned(MassSpectrometer) then Exit; if not Assigned(DataSaveToFileDialog) then begin try DataSaveToFileDialog:=TDataSaveToFileDialog.Create(Self); // заполнение диалога DataSaveToFileDialog.FileFormat:=MassSpectrometer.FileFormat; DataSaveToFileDialog.FileName:=MassSpectrometer.FileFormat.FileName; DataSaveToFileDialog.Filter := 'Текст (*.txt)|*.TXT|Все (*.*)|*.*'; DataSaveToFileDialog.FileFormat.Flags:=DataSaveToFileDialog.FileFormat.Flags-[msdffOverride]; except end; end; if Assigned(DataSaveToFileDialog) then begin // показ диалога if DataSaveToFileDialog.Execute then begin MassSpectrometer.FileFormat:=DataSaveToFileDialog.FileFormat; MassSpectrometer.FileFormat.FileName:=DataSaveToFileDialog.FileName; if FileExists(DataSaveToFileDialog.FileName) then begin if IDYES=MessageBox(rcText1+DataSaveToFileDialog.FileName+rcText2, DataSaveToFileDialog.Title, MB_YESNO+MB_ICONWARNING) then begin MassSpectrometer.FileFormat.Flags:=MassSpectrometer.FileFormat.Flags+[msdffOverride]; end else begin Exit; end; end; MassSpectrometer.FileWriteX; end; end; end; procedure TFormSpectrum.ProcessFileWriteFail; resourcestring rcText1='ОШИБКА при выводе данных в файл "'; rcText2='".'; begin MessageBox(rcText1+MassSpectrometer.FileFormat.FileName+rcText2, DataSaveToFileDialog.Title, MB_OK+MB_ICONERROR); end; procedure TFormSpectrum.ActionYRAutoExecute(Sender: TObject); begin if fTraceActive in prFlags then begin if Assigned(prTraceMarker) then prTraceMarker.Active:=FALSE; Chart.RightAxis.Automatic:=TRUE; Repaint; Chart.RightAxis.Automatic:=FALSE; if Assigned(prTraceMarker) then prTraceMarker.Active:=TRUE; end else begin Chart.RightAxis.Automatic:=TRUE; end; // ProcessMassIndicatorMinMax; end; procedure TFormSpectrum.ActionYRAutoMaxExecute(Sender: TObject); begin if fTraceActive in prFlags then begin if Assigned(prTraceMarker) then prTraceMarker.Active:=FALSE; Chart.RightAxis.AutomaticMaximum:=TRUE; Repaint; Chart.RightAxis.AutomaticMaximum:=FALSE; if Assigned(prTraceMarker) then prTraceMarker.Active:=TRUE; end else begin Chart.RightAxis.AutomaticMaximum:=TRUE; end; // ProcessMassIndicatorMinMax; end; procedure TFormSpectrum.ActionYRAutoMinExecute(Sender: TObject); begin if fTraceActive in prFlags then begin if Assigned(prTraceMarker) then prTraceMarker.Active:=FALSE; Chart.RightAxis.AutomaticMinimum:=TRUE; Repaint; Chart.RightAxis.AutomaticMinimum:=FALSE; if Assigned(prTraceMarker) then prTraceMarker.Active:=TRUE; end else begin Chart.RightAxis.AutomaticMinimum:=TRUE; end; // ProcessMassIndicatorMinMax; end; procedure TFormSpectrum.ActionYRMinExecute(Sender: TObject); begin if (EditYRMin.ItemIndex=0) or (EditYRMin.Text=cAuto) then begin ActionYRAutoMin.Execute; end else if MinSet(Chart.RightAxis, EditYRMin.Text) then begin AddTextToStringsList1(EditYRMin); end; end; procedure TFormSpectrum.ActionYRMaxExecute(Sender: TObject); begin if (EditYRMax.ItemIndex=0) or (EditYRMax.Text=cAuto) then begin ActionYRAutoMax.Execute; end else if MaxSet(Chart.RightAxis, EditYRMax.Text) then begin AddTextToStringsList1(EditYRMax); end; end; procedure TFormSpectrum.EditYRMinKeyPress(Sender: TObject; var Key: Char); begin case Key of #13: begin ActionYRMin.Execute; end; #27: begin EditYRMin.Text:=FloatToStr(Chart.RightAxis.Minimum) end; end; end; procedure TFormSpectrum.EditYRMaxKeyPress(Sender: TObject; var Key: Char); begin case Key of #13: begin ActionYRMax.Execute; end; #27: EditYRMax.Text:=FloatToStr(Chart.RightAxis.Maximum); end; end; procedure TFormSpectrum.ActionYRLogarithmicExecute(Sender: TObject); begin ActionYRLogarithmic.Enabled:=FALSE; try YLogarithmicSet(Chart.RightAxis, not Chart.RightAxis.Logarithmic); ActionYRLogarithmic.Checked:=Chart.RightAxis.Logarithmic; finally ActionYRLogarithmic.Enabled:=TRUE; end; end; procedure TFormSpectrum.ActionXGridSwitchExecute(Sender: TObject); begin Chart.BottomAxis.Grid.Visible:=not Chart.BottomAxis.Grid.Visible; ActionXGridSwitch.Checked:=Chart.BottomAxis.Grid.Visible; end; procedure TFormSpectrum.ActionYRGridSwitchExecute(Sender: TObject); begin Chart.RightAxis.Grid.Visible:=not Chart.RightAxis.Grid.Visible; ActionYRGridSwitch.Checked:=Chart.RightAxis.Grid.Visible; end; procedure TFormSpectrum.ActionYGridSwitchExecute(Sender: TObject); begin Chart.LeftAxis.Grid.Visible:=not Chart.LeftAxis.Grid.Visible; ActionYGridSwitch.Checked:=Chart.LeftAxis.Grid.Visible; end; procedure TFormSpectrum.ActionYRUseRightAxisExecute(Sender: TObject); var ms:tMSSeries; begin ActionTraceCancel.Execute; ActionYRUseRightAxis.Checked:=not ActionYRUseRightAxis.Checked; if ActionYRUseRightAxis.Checked then begin pRight.Visible:=TRUE; SplitterRight.Visible:=TRUE; Chart.RightAxis.Visible:=TRUE; MenuYR.Visible:=TRUE; prSignals[sIonCounter].VertAxis:=aRightAxis; end else begin prSignals[sIonCounter].VertAxis:=aLeftAxis; Chart.RightAxis.Visible:=FALSE; MenuYR.Visible:=False; pRight.Visible:=FALSE; SplitterRight.Visible:=FALSE; end; if not Assigned(MassSpectrometer) then Exit; ms:=MassSpectrometer.DataSeries[sIonCounter]; if Assigned(ms) and (ms.ParentChart=Chart) then begin if ActionYRUseRightAxis.Checked then begin ms.VertAxis:=aRightAxis; end else begin ms.VertAxis:=aLeftAxis; end; end; ProcessLeftAxis; end; procedure TFormSpectrum.ActionYMinAskExecute(Sender: TObject); begin ActiveControl:=EditYMin; end; procedure TFormSpectrum.ActionYMaxAskExecute(Sender: TObject); begin ActiveControl:=EditYMax; end; procedure TFormSpectrum.ActionShowLegendExecute(Sender: TObject); begin ActionShowLegend.Checked:= not ActionShowLegend.Checked; Chart.Legend.Visible:=ActionShowLegend.Checked; end; procedure TFormSpectrum.ActionYR1Execute(Sender: TObject); begin SetAxis(Chart.RightAxis,0,1); end; procedure TFormSpectrum.ActionYR10Execute(Sender: TObject); begin SetAxis(Chart.RightAxis,0,10); end; procedure TFormSpectrum.ActionYR100Execute(Sender: TObject); begin SetAxis(Chart.RightAxis,0,100); end; procedure TFormSpectrum.ActionYR1000Execute(Sender: TObject); begin SetAxis(Chart.RightAxis,0,1000); end; procedure TFormSpectrum.ActionYR3000Execute(Sender: TObject); begin SetAxis(Chart.RightAxis,0,3000); end; procedure TFormSpectrum.ActionShowSeriesEditorExecute(Sender: TObject); begin if not Assigned(MassSpectrometer) then Exit; if not Assigned(FormSeriesEditor) then begin try FormSeriesEditor:=TFormSeriesEditor.Create(Self); except end; end; if Assigned(FormSeriesEditor) then begin FormSeriesEditor.AFormSpectrum:=Self; FormSeriesEditor.Show; end; end; procedure TFormSpectrum.TimerMassChangeTimer(Sender: TObject); begin if not Assigned(MassSpectrometer) then Exit; ProcessMass; end; procedure TFormSpectrum.EditYIncrKeyPress(Sender: TObject; var Key: Char); begin case Key of #13: begin ActionYGrid.Execute; end; #27: begin EditYIncr.Text:=FloatToStr(Chart.LeftAxis.Increment); end; end; end; procedure TFormSpectrum.EditYRIncrKeyPress(Sender: TObject; var Key: Char); begin case Key of #13: begin ActionYRGrid.Execute; end; #27: begin EditYRIncr.Text:=FloatToStr(Chart.RightAxis.Increment); end; end; end; procedure TFormSpectrum.EditXIncrKeyPress(Sender: TObject; var Key: Char); begin case Key of #13: begin ActionXGrid.Execute; end; #27: begin EditXIncr.Text:=FloatToStr(Chart.BottomAxis.Increment); end; end; end; procedure TFormSpectrum.ActionShowNumbersFormatEditorExecute( Sender: TObject); begin if not Assigned(FormNumbersFormat) then begin try FormNumbersFormat:=TFormNumbersFormat.Create(Self); except end; end; if Assigned(FormNumbersFormat) then begin FormNumbersFormat.Form:=Self; FormNumbersFormat.Show; end; end; procedure TFormSpectrum.CheckBoxAccumulationClick(Sender: TObject); begin if Assigned(MassSpectrometer) then begin if (Sender as TCheckBox).Checked then MassSpectrometer.SwitchON(mstAccumulation) else MassSpectrometer.SwitchOFF(mstAccumulation); end; end; procedure TFormSpectrum.ActionScrollStopExecute(Sender: TObject); begin if not MsON_WithMSG then Exit; case MassSpectrometer.MeasureState of msUnknown:; msStopped: MassSpectrometer.Resume; else MassSpectrometer.Stop; end; end; procedure TFormSpectrum.ActionScrollPauseExecute(Sender: TObject); begin if not MsON_WithMSG then Exit; MassSpectrometer.Pause; end; procedure TFormSpectrum.ActionScrollLeftExecute(Sender: TObject); begin if not MsON_WithMSG then Exit; case MassSpectrometer.MeasureState of msUnknown,msErrorStopped:; msStopped: begin if MassSpectrometer.StepMultiplicator=0 then MassSpectrometer.StepMultiplicator:=-1 else MassSpectrometer.StepMultiplicator:=-Abs(MassSpectrometer.StepMultiplicator); MassSpectrometer.Resume; end; else begin if MassSpectrometer.StepMultiplicator=0 then MassSpectrometer.StepMultiplicator:=-1 else if MassSpectrometer.StepMultiplicator>0 then MassSpectrometer.StepMultiplicator:=-MassSpectrometer.StepMultiplicator else MassSpectrometer.StepMultiplicator:=2*MassSpectrometer.StepMultiplicator; end; end; end; procedure TFormSpectrum.ActionScrollRightExecute(Sender: TObject); begin if not MsON_WithMSG then Exit; case MassSpectrometer.MeasureState of msUnknown,msErrorStopped:; msStopped,msSuspended: begin if MassSpectrometer.StepMultiplicator=0 then MassSpectrometer.StepMultiplicator:=1 else MassSpectrometer.StepMultiplicator:=ABS(MassSpectrometer.StepMultiplicator); MassSpectrometer.Resume; end; else begin if MassSpectrometer.StepMultiplicator=0 then MassSpectrometer.StepMultiplicator:=1 else if MassSpectrometer.StepMultiplicator<0 then MassSpectrometer.StepMultiplicator:=-MassSpectrometer.StepMultiplicator else MassSpectrometer.StepMultiplicator:=2*MassSpectrometer.StepMultiplicator; end; end; end; procedure TFormSpectrum.ActionScrollLowLimitExecute(Sender: TObject); begin if not MsON_WithMSG then Exit; MassSpectrometer.Pause; MassSpectrometer.MassX:=0; end; procedure TFormSpectrum.ActionScrollUpLimitExecute(Sender: TObject); begin if not MsON_WithMSG then Exit; MassSpectrometer.Pause; MassSpectrometer.MassX:=MassSpectrometer.Counter2Mass(Pred(High(tCounter))); end; procedure TFormSpectrum.CheckBoxUseRangesClick(Sender: TObject); begin if Assigned(MassSpectrometer) then begin if (Sender as TCheckBox).Checked then MassSpectrometer.SwitchON(mstUseRanges) else MassSpectrometer.SwitchOFF(mstUseRanges); end; EditMassStep.Enabled:=not CheckBoxUseRanges.Checked; EditIntegrationTime.Enabled:=not CheckBoxUseRanges.Checked; CheckBoxAccumulation.Enabled:=not CheckBoxUseRanges.Checked; end; procedure TFormSpectrum.ProcessRanges; var i:integer; s:string; r:tRange; begin ComboBoxRanges.Clear; if Assigned(MassSpectrometer) then begin ComboBoxRanges.Enabled:=TRUE; try ComboBoxRanges.Items.Add('Диапазон...'); for i:=0 to Pred(MassSpectrometer.Ranges.Count) do begin r:=MassSpectrometer.Ranges[i]; s:=r.RangeMassCaption(i); ComboBoxRanges.Items.Add(s); end; ComboBoxRanges.ItemIndex:=0; except ComboBoxRanges.Clear; end; end else begin ComboBoxRanges.Enabled:=FALSE; end; end; procedure TFormSpectrum.ActionXRangeExecute(Sender: TObject); var r:tRange; i:integer; begin if Assigned(MassSpectrometer) then begin i:=Pred(ComboBoxRanges.ItemIndex); if (i>=0) and (i'') then begin try Chart.SaveToMetaFileEnh(SavePictureDialog.FileName); except end; end; end; procedure TFormSpectrum.ActionSaveToMetaFileExecute(Sender: TObject); begin if (SavePictureDialog.FileName<>'') then begin try Chart.SaveToMetaFile(SavePictureDialog.FileName); except end; end; end; procedure TFormSpectrum.ActionSaveToMetaFileAskExecute(Sender: TObject); begin if SavePictureDialog.Execute then begin if UpperCase(ExtractFileExt(SavePictureDialog.FileName))='.WMF' then ActionSaveToMetaFile.Execute else ActionSaveToMetaFileEnh.Execute; end; end; procedure TFormSpectrum.ActionYGridExecute(Sender: TObject); begin if (EditYIncr.ItemIndex=0) or (EditYIncr.Text=cAuto) then begin Chart.LeftAxis.Increment:=0; end else try Chart.LeftAxis.Increment:=StrToFloat_MSG(EditYIncr.Text); AddTextToStringsList1(EditYIncr); except end; end; procedure TFormSpectrum.ActionYRGridExecute(Sender: TObject); begin if (EditYRIncr.ItemIndex=0) or (EditYRIncr.Text=cAuto) then begin Chart.RightAxis.Increment:=0; end else try Chart.RightAxis.Increment:=StrToFloat_MSG(EditYRIncr.Text); AddTextToStringsList1(EditYRIncr); except end; end; procedure TFormSpectrum.ActionXGridExecute(Sender: TObject); begin if (EditXIncr.ItemIndex=0) or (EditXIncr.Text=cAuto) then begin Chart.BottomAxis.Increment:=0; end else try Chart.BottomAxis.Increment:=StrToFloat_MSG(EditXIncr.Text); AddTextToStringsList1(EditXIncr); except end; end; procedure TFormSpectrum.ActionShowActionEditorExecute(Sender: TObject); begin if not Assigned(FormActionListEdit) then begin try FormActionListEdit:=TFormActionListEdit.Create(Self); except end; end; if Assigned(FormActionListEdit) then begin FormActionListEdit.ActionList:=ActionListMain; FormActionListEdit.Show; end; end; procedure TFormSpectrum.ActionJumpToMassExecute(Sender: TObject); begin if not MsON_WithMSG then Exit; if Length(EditMassJumpTo.Text)>0 then begin try MassSetNew(StrToFloat_MSG(EditMassJumpTo.Text)); AddTextToStringsList0(EditMassJumpTo); except end; end; end; procedure TFormSpectrum.ActionXGridAskExecute(Sender: TObject); begin ActiveControl:=EditXIncr; end; procedure TFormSpectrum.ActionYGridAskExecute(Sender: TObject); begin ActiveControl:=EditYIncr; end; procedure TFormSpectrum.ActionYRGridAskExecute(Sender: TObject); begin if EditYRIncr.Visible then ActiveControl:=EditYRIncr; end; procedure TFormSpectrum.ActionXMinAskExecute(Sender: TObject); begin ActiveControl:=EditXMin; end; procedure TFormSpectrum.ActionXMaxAskExecute(Sender: TObject); begin ActiveControl:=EditXMax; end; procedure TFormSpectrum.ActionYMinEditExecute(Sender: TObject); begin ActiveControl:=EditYMin; end; procedure TFormSpectrum.ActionYMaxEditExecute(Sender: TObject); begin ActiveControl:=EditYMax; end; procedure TFormSpectrum.ActionYRMaxAskExecute(Sender: TObject); begin if EditYRMax.Visible then ActiveControl:=EditYRMax; end; procedure TFormSpectrum.ActionYRMinAskExecute(Sender: TObject); begin if EditYRMin.Visible then ActiveControl:=EditYRMin; end; procedure TFormSpectrum.ActionPrintDlgExecute(Sender: TObject); begin ActionPrintDlgExExecute(Sender); end; procedure TFormSpectrum.ActionPrinterSetupDlgExecute(Sender: TObject); begin PrinterSetupDialog.Execute; end; procedure TFormSpectrum.ActionSeriesShowHideExecute(Sender: TObject); var i:integer; s:tSeries; sr:tMSSeries; SenderIsAction:boolean; begin if not Assigned(MassSpectrometer) then Exit; SenderIsAction:=Sender.InheritsFrom(tAction); if SenderIsAction then i:=tAction(Sender).Tag else i:=ActionSeriesShowHide.Tag; if not (i in [Ord(sPNC1)..Ord(sPNC5),Ord(sPNC_SEM),Ord(sIonCounter)]) then Exit; s:=tSeries(i); sr:=MassSpectrometer.DataSeries[s]; if Assigned(sr) then begin if sr.ParentChart=Chart then begin if not sr.Active then begin Include(prSeriesActive,s); sr.Active:=TRUE; end else begin Exclude(prSeriesActive,s); sr.Active:=FALSE; end; end; if SenderIsAction then begin tAction(Sender).Checked:=sr.Active; tAction(Sender).Enabled:=TRUE; end; ProcessLeftAxis; end else begin if SenderIsAction then tAction(Sender).Enabled:=FALSE; end; end; procedure TFormSpectrum.ProcessLeftAxis; begin Chart.LeftAxis.Visible:= (prSeriesActive=[]) or not ((prSeriesActive=[sIonCounter]) and ActionYRUseRightAxis.Checked); end; procedure TFormSpectrum.ActionSeries0_ShowHideExecute(Sender: TObject); begin ActionSeriesShowHideExecute(ActionSeries0_ShowHide); end; procedure TFormSpectrum.ActionSeries1_ShowHideExecute(Sender: TObject); begin ActionSeriesShowHideExecute(ActionSeries1_ShowHide); end; procedure TFormSpectrum.ActionSeries2_ShowHideExecute(Sender: TObject); begin ActionSeriesShowHideExecute(ActionSeries2_ShowHide); end; procedure TFormSpectrum.ActionSeries3_ShowHideExecute(Sender: TObject); begin ActionSeriesShowHideExecute(ActionSeries3_ShowHide); end; procedure TFormSpectrum.ActionSeries4_ShowHideExecute(Sender: TObject); begin ActionSeriesShowHideExecute(ActionSeries4_ShowHide); end; procedure TFormSpectrum.ActionSeries5_ShowHideExecute(Sender: TObject); begin ActionSeriesShowHideExecute(ActionSeries5_ShowHide); end; procedure TFormSpectrum.ActionSeries6_ShowHideExecute(Sender: TObject); begin ActionSeriesShowHideExecute(ActionSeries6_ShowHide); end; procedure TFormSpectrum.ActionSeriesMarkerShowHideExecute(Sender: TObject); var i:integer; s:tSeries; sr:tPointSeries; SenderIsAction:boolean; begin if not Assigned(MassSpectrometer) then Exit; SenderIsAction:=Sender.InheritsFrom(tAction); if SenderIsAction then i:=tAction(Sender).Tag else i:=ActionSeriesShowHide.Tag; if not (i in [Ord(sPNC1)..Ord(sPNC5),Ord(sPNC_SEM),Ord(sIonCounter)]) then Exit; s:=tSeries(i); sr:=prSignals[s]; if Assigned(sr) then begin sr.Active:=not sr.Active; if sr.Active then Include(SignalsMarkers,s) else Exclude(SignalsMarkers,s); if SenderIsAction then tAction(Sender).Checked:=sr.Active; end; end; procedure TFormSpectrum.ActionSeriesMarker0_ShowHideExecute(Sender: TObject); begin ActionSeriesMarkerShowHideExecute(ActionSeriesMarker0_ShowHide); end; procedure TFormSpectrum.ActionSeriesMarker1_ShowHideExecute(Sender: TObject); begin ActionSeriesMarkerShowHideExecute(ActionSeriesMarker1_ShowHide); end; procedure TFormSpectrum.ActionSeriesMarker2_ShowHideExecute(Sender: TObject); begin ActionSeriesMarkerShowHideExecute(ActionSeriesMarker2_ShowHide); end; procedure TFormSpectrum.ActionSeriesMarker3_ShowHideExecute(Sender: TObject); begin ActionSeriesMarkerShowHideExecute(ActionSeriesMarker3_ShowHide); end; procedure TFormSpectrum.ActionSeriesMarker4_ShowHideExecute(Sender: TObject); begin ActionSeriesMarkerShowHideExecute(ActionSeriesMarker4_ShowHide); end; procedure TFormSpectrum.ActionSeriesMarker5_ShowHideExecute(Sender: TObject); begin ActionSeriesMarkerShowHideExecute(ActionSeriesMarker5_ShowHide); end; procedure TFormSpectrum.ActionSeriesMarker6_ShowHideExecute(Sender: TObject); begin ActionSeriesMarkerShowHideExecute(ActionSeriesMarker6_ShowHide); end; procedure TFormSpectrum.ActionSaveToFileAskExecute(Sender: TObject); begin if not Assigned(MassSpectrometer) then Exit; if SaveDialogData.Execute then begin try MassSpectrometer.DataSeriesWriteDataToFileX(SaveDialogData.FileName); except end; end; end; procedure TFormSpectrum.ActionRestoreFromFileAskExecute(Sender: TObject); // var OldFormStyle:tFormStyle; begin if not Assigned(MassSpectrometer) then Exit; { OldFormStyle:=FormStyle; try FormStyle:=fsStayOnTop; except end;} if OpenDialogData.Execute then begin try MassSpectrometer.DataSeriesReadDataFromFileX(OpenDialogData.FileName); except end; end; { FormStyle:=OldFormStyle;} end; procedure TFormSpectrum.ActionShowStatisticInfoExecute(Sender: TObject); begin If not Assigned(FormStatisticInfo) then begin try FormStatisticInfo:=TFormStatisticInfo.Create(Self); except end; end; If Assigned(FormStatisticInfo) then begin try if Assigned(MassSpectrometer) then MassSpectrometer.SwitchON(mstCalculateStatisticalData); ProcessPointsNumber; FormStatisticInfo.Show; except end; end; end; procedure TFormSpectrum.LabelStateClick(Sender: TObject); begin if not Assigned(MassSpectrometer) then Exit; MessageBox(SwitchesToStr(MassSpectrometer.Switches,cEOL),'Состояние переключателей',MB_OK+MB_ICONINFORMATION); end; procedure TFormSpectrum.FormShow(Sender: TObject); begin ProcessMass; ProcessNewPoint; end; procedure TFormSpectrum.ActionStatisticInfoClearExecute(Sender: TObject); begin if not Assigned(MassSpectrometer) then Exit; try MassSpectrometer.StatisticDataClear; except end; end; procedure TFormSpectrum.ActionTraceExecute(Sender: TObject); begin ActionTrace.Checked:=not ActionTrace.Checked; if ActionTrace.Checked then ActionTraceStartExecute(Sender) else ActionTraceCancelExecute(Sender); end; procedure TFormSpectrum.ActionTraceCancelExecute(Sender: TObject); var s:tSeries; ms:tCustomSeries; begin Exclude(prFlags,fTraceActive); Chart.OnMouseMove:=ChartMouseMove; prTraceSeries:=NIL; prTraceIndex:=0; Chart.OnClick:=ChartClick; PanelTrace.Visible:=FALSE; if Assigned(prTraceMarker) then begin prTraceMarker.Active:=FALSE; prTraceMarker.ParentChart:=NIL; end; ActionTraceLeft.Enabled:=FALSE; ActionTraceRight.Enabled:=FALSE; ActionTraceCancel.Enabled:=FALSE; ActionTraceShowMarker.Enabled:=FALSE; ActionTraceShowPanel.Enabled:=FALSE; ActionTrace.Checked:=FALSE; if Assigned(MassSpectrometer) then begin try for s:=Low(s) to High(s) do begin ms:=MassSpectrometer.DataSeries[s]; if Assigned(ms) and (ms.ParentChart=Chart) then begin ms.Cursor:=crDefault; end; end; except end; end; end; function Distance(p1,p2:tPoint):int64; begin Dec(p1.X,p2.X); Dec(p1.Y,p2.Y); Result:=p1.X*p1.X+p1.Y*p1.Y; end; procedure TFormSpectrum.TraceApply(X,Y:double; N:integer); var xs:string; begin if not Assigned(prTraceMarker) then begin try prTraceMarker:=tPointSeries.Create(Self); prTraceMarker.AllowSinglePoint:=TRUE; prTraceMarker.AddXY(0,0); prTraceMarker.Pointer.Style:=psCross; prTraceMarker.Pointer.Pen.Color:=clGray; prTraceMarker.Pointer.Pen.Style:=psDot; prTraceMarker.Pointer.Pen.Width:=0; prTraceMarker.Pointer.Visible:=TRUE; prTraceMarker.Marks.BackColor:=clWhite; prTraceMarker.Marks.Visible:=TRUE; prTraceMarker.Marks.Font.Size:=12; prTraceMarker.Marks.Font.Color:=clBlue; prTraceMarker.Name:='Tracer'; if RegistryOpenForRead then try xs:=AddVF(prTraceMarker.Name); if prRegistry.ValueExists(xs) then prTraceMarker.ValueFormat:=prRegistry.ReadString(xs); prTraceMarker.Marks.Visible:=prRegistry.ReadBool(prTraceMarker.Name+'.Marks.Visible'); prRegistry.CloseKey; except end; CheckBoxTraceMarker.Checked:=prTraceMarker.Marks.Visible; except end; end; if Assigned(prTraceMarker) then begin prTraceMarker.ParentChart:=Chart; prTraceMarker.XValues[0]:=X; prTraceMarker.YValues[0]:=Y; prTraceMarker.Pointer.VertSize:=Chart.Height*2; prTraceMarker.Pointer.HorizSize:=Chart.Width*2; prTraceMarker.Active:=TRUE; end; EditN.Text:=IntToStr(N); EditX.Text:=FloatToStr(X); EditY.Text:=FloatToStr(Y); EditXY.Text:=EditX.Text+ListSeparator+' '+EditY.Text; Chart.Repaint; end; procedure TFormSpectrum.ChartClickTrace(Sender: TObject); var s:tCustomSeries; i:tSeries; j,ValueIndex:integer; cp,pp,FoundP:tPoint; FoundS:tCustomSeries; Dist,Dist1:int64; begin if (fTraceActive in prFlags) and Assigned(MassSpectrometer) then begin cp:=Chart.GetCursorPos; FoundS:=NIL; ValueIndex:=0; Dist:=High(Dist); for i:=Low(i) to High(i) do begin s:=MassSpectrometer.DataSeries[i]; if Assigned(s) then begin if s.Active and (s.ParentChart=Chart) then begin j:=s.GetCursorValueIndex; if j>=0 then begin pp.X:=s.CalcXPos(j); pp.Y:=s.CalcYPos(j); if Assigned(FoundS) then begin Dist1:=Distance(cp,pp); if Dist>Dist1 then begin Dist:=Dist1; FoundS:=s; ValueIndex:=j; FoundP:=pp; end; end else begin FoundS:=s; ValueIndex:=j; FoundP:=pp; Dist:=Distance(cp,pp); end; end; end; end; end; if Assigned(FoundS) then begin TraceApply(FoundS.XValue[ValueIndex], FoundS.YValue[ValueIndex],ValueIndex); prTraceMarker.VertAxis:=FoundS.VertAxis; prTraceMarker.HorizAxis:=FoundS.HorizAxis; prTraceSeries:=FoundS; prTraceIndex:=ValueIndex; end; end else begin ActionTraceCancelExecute(Sender); end; end; procedure TFormSpectrum.ActionTraceShowPanelExecute(Sender: TObject); begin if not PtInRect(Rect(0,0,Chart.Width,Chart.Height), Point((PanelTrace.Top+(PanelTrace.Height div 2)), (PanelTrace.Left+(PanelTrace.Width div 2)) ) ) then begin PanelTrace.Top:=0; PanelTrace.Left:=0; end; end; procedure TFormSpectrum.ActionTraceStartExecute(Sender: TObject); var s:tSeries; ms:tCustomSeries; begin MassDragCancel; ActionTraceKeysShowHideExecute(Sender); Include(prFlags,fTraceActive); Chart.LeftAxis.Automatic:=FALSE; Chart.BottomAxis.Automatic:=FALSE; Chart.RightAxis.Automatic:=FALSE; Chart.OnClick:=ChartClickTrace; ChartClickTrace(Sender); ActionTraceShowPanelExecute(Sender); PanelTrace.Visible:=TRUE; ActionTraceLeft.Enabled:=TRUE; ActionTraceRight.Enabled:=TRUE; ActionTraceCancel.Enabled:=TRUE; ActionTraceShowMarker.Enabled:=TRUE; ActionTraceShowPanel.Enabled:=TRUE; ActionTrace.Checked:=TRUE; if Assigned(MassSpectrometer) then begin try for s:=Low(s) to High(s) do begin ms:=MassSpectrometer.DataSeries[s]; if Assigned(ms) and (ms.ParentChart=Chart) then begin ms.Cursor:=crHandPoint; end; end; except end; end; end; procedure TFormSpectrum.ActionTraceShowMarkerExecute(Sender: TObject); begin if not (fTraceActive in prFlags) then Exit; if not Assigned(MassSpectrometer) then Exit; if not Assigned(prTraceSeries) then Exit; if (prTraceIndex>0) and (prTraceIndex0 then begin Dec(prTraceIndex); ActionTraceShowMarkerExecute(Sender); end; end; procedure TFormSpectrum.ActionTraceRightExecute(Sender: TObject); begin if not (fTraceActive in prFlags) then Exit; if not Assigned(MassSpectrometer) then Exit; if not Assigned(prTraceSeries) then Exit; if prTraceIndex0 then Caption:=Copy(Caption,1,Pred(i)); end; end; procedure TFormSpectrum.ActionTraceKeysShowHideExecute(Sender: TObject); begin PanelTraceKeys.Visible:=ActionTraceKeysShowHide.Checked; if ActionTraceKeysShowHide.Checked then begin PanelTrace.Height:=PanelTrace.Tag; ButtonTraceKeys.Caption:='<<<'; end else begin PanelTrace.Height:=PanelTraceKeys.Top; ButtonTraceKeys.Caption:='>>>'; end; end; procedure TFormSpectrum.ActionTraceKeysSwitchExecute(Sender: TObject); begin ActionTraceKeysShowHide.Checked:=not ActionTraceKeysShowHide.Checked; ActionTraceKeysShowHideExecute(Sender); end; procedure TFormSpectrum.ActionPeakCenteringExecute(Sender: TObject); begin // FormSpectrum := Self; MCAD_MI1201_PeakControl.Execute(Sender); end; procedure TFormSpectrum.ChartScroll(Sender: TObject); begin ProcessMassIndicatorMinMax; end; procedure TFormSpectrum.WMActivate(var Message: TWMActivate); begin if Message.Active=WA_INACTIVE then begin Chart.DelayMultiplicator:=5; end else begin Chart.DelayMultiplicator:=0; end; Inherited; end; procedure TFormSpectrum.ActionMassCalibrationSimpleExecute(Sender: TObject); begin if not Assigned(FormMassScaleSimpleCalibration) then begin try FormMassScaleSimpleCalibration:=TFormMassScaleSimpleCalibration.Create(Self); FormMassScaleSimpleCalibration.MassSpectrometer:=MassSpectrometer; except end; end; if Assigned(FormMassScaleSimpleCalibration) then begin try FormMassScaleSimpleCalibration.Show; except end; end; end; procedure TFormSpectrum.ActionPeakCenterFindExecute(Sender: TObject); begin if not Assigned(FormPeakCenterFind) then begin try FormPeakCenterFind:=TFormPeakCenterFind.Create(Self); FormPeakCenterFind.MassSpectrometer:=MassSpectrometer; except end; end; if Assigned(FormPeakCenterFind) then begin try FormPeakCenterFind.Show; except end; end; end; procedure TFormSpectrum.ActionPeakCentripetalExecute(Sender: TObject); begin if not Assigned(FormPeakCentripetal)then begin try FormPeakCentripetal:=TFormPeakCentripetal.Create(Self); FormPeakCentripetal.MassSpectrometer:=MassSpectrometer; except end; end else try FormPeakCentripetal.Show; except end; end; procedure TFormSpectrum.aWindowFollowsMassExecute(Sender: TObject); begin if Sender.InheritsFrom(tCheckBox) then aWindowFollowsMass.Checked:=(Sender as tCheckBox).Checked else aWindowFollowsMass.Checked:=not aWindowFollowsMass.Checked; end; function TFormSpectrum.MassIndicatorGet:double; begin Result:=SeriesMassIndicator.XValues[0]; end; procedure TFormSpectrum.MassIndicatorSet(AMass:double); begin SeriesMassIndicator.XValues[0]:=AMass; SeriesMassIndicator.XValues[1]:=AMass; end; procedure TFormSpectrum.DoWindowFollowsMass; var m,min,max,dm:tMass; begin if not aWindowFollowsMass.Checked then Exit; m:=MassIndicator; min:=Chart.BottomAxis.Minimum; max:=Chart.BottomAxis.Maximum; if (mmax) then begin dm:=(max-min)/2; Chart.BottomAxis.Minimum:=Chart.BottomAxis.Minimum+dm; Chart.BottomAxis.Maximum:=Chart.BottomAxis.Maximum+dm; end; end; procedure TFormSpectrum.ActionShowHintExecute(Sender: TObject); begin ActionShowHint.Checked:=not ActionShowHint.Checked; ShowHint:=ActionShowHint.Checked; Application.ShowHint:=ShowHint; end; procedure TFormSpectrum.MassFromBottomAxiesRightClickNotificatorSet(ANotifyProc:tMassNotifyEvent); var OldNP:tMassNotifyEvent; begin OldNP:=prMassFromBottomAxiesRightClickNotificator; if @OldNP=@ANotifyProc then Exit; if Assigned(OldNP) then try if OldNP(Self,nrDetach,0)=naDoNotDetach then Exit; except end; prMassFromBottomAxiesRightClickNotificator:=ANotifyProc; if Assigned(ANotifyProc) then try if ANotifyProc(Self,nrAttach,0)=naCancel then begin prMassFromBottomAxiesRightClickNotificator:=Nil; end; except end; end; procedure TFormSpectrum.MassFromBottomAxiesRightClickNotify(AMass:double); var OldNP:tMassNotifyEvent; begin OldNP:=prMassFromBottomAxiesRightClickNotificator; if Assigned(OldNP) then try case OldNP(Self,nrMass,AMass) of naCancel:begin MassFromBottomAxiesRightClickNotificator:=NIL; end; else; end; except if OldNP(Self,nrDetachOnExcept,0)=naOK then begin MassFromBottomAxiesRightClickNotificator:=NIL; end; end; end; function TFormSpectrum.MassFromBottomAxiesRightClick(Sender:TObject; Reason:tMassNotifyReason; Mass:double):tMassNotifyAnsver; var s:string; begin if not Assigned(prMassFromBottomAxiesRightClickTarget) then begin Result:=naCancel; end else begin case Reason of nrMass: begin Result:=naOK; if prMassFromBottomAxiesRightClickTarget.InheritsFrom(tCustomComboBox) then begin s:=FloatToStrF(Mass,ffFixed,7,3); if s<>tComboBox(prMassFromBottomAxiesRightClickTarget).Text then begin tComboBox(prMassFromBottomAxiesRightClickTarget).Text:=s; prMassFromBottomAxiesRightClickTarget.SetFocus; end else begin if Assigned(tComboBox(prMassFromBottomAxiesRightClickTarget).OnDblClick) then begin tComboBox(prMassFromBottomAxiesRightClickTarget).Tag:=1; tComboBox(prMassFromBottomAxiesRightClickTarget).OnDblClick(tComboBox(prMassFromBottomAxiesRightClickTarget)); end; end; end else begin Result:=naCancel; prMassFromBottomAxiesRightClickTarget:=NIL; end; end; nrAttach: Result:=naOK; nrDetach: begin Result:=naOK; prMassFromBottomAxiesRightClickTarget:=NIL; end; else begin Result:=naCancel; prMassFromBottomAxiesRightClickTarget:=NIL; end; end; end; end; procedure TFormSpectrum.MEnter(Sender: TObject); begin try prMassFromBottomAxiesRightClickTarget:=Sender as tComboBox; MassFromBottomAxiesRightClickNotificator:=MassFromBottomAxiesRightClick; except MExit(Sender); end; end; procedure TFormSpectrum.MExit(Sender: TObject); var ne:tMassNotifyEvent; begin try prMassFromBottomAxiesRightClickTarget:=NIL; ne:=MassFromBottomAxiesRightClick; if (@MassFromBottomAxiesRightClickNotificator=@ne) then MassFromBottomAxiesRightClickNotificator:=NIL; except end; end; // Вычисление области печати с учетом полей для принтера aPrinter function TFormSpectrum.CalculatePrintRect(aPrinter:tPrinter; var aRect:tRect; aMarging:tMargins):boolean; var ResolutionV,ResolutionH:integer; begin // Достаем данные о разрешающей способности принтера ResolutionV:=GetDeviceCaps(aPrinter.Handle,LOGPIXELSX); ResolutionH:=GetDeviceCaps(aPrinter.Handle,LOGPIXELSY); try // Пытаемся вычислить область печати aRect:=Rect(Round(ResolutionH*CM2IN(aMarging.Left)), Round(ResolutionV*CM2IN(aMarging.Top)), Pred(aPrinter.PageWidth)-Round(ResolutionH*CM2IN(aMarging.Right)), Pred(aPrinter.PageHeight)-Round(ResolutionV*CM2IN(aMarging.Bottom)) ); // Проверяем на допустимость область печати Result:=(aRect.Left'') then begin Chart.Title.Text.Add(DataPrintDialog.Comment); Chart.Title.Visible:=TRUE; end; // Если состояние СОВМЕСТИМОСТЬ ПРИНТЕРА переносим в свойства Chart if (pfONCompatibility in DataPrintDialog.PrintFlags) then Chart.PrinterCompatibility:=pcON else if (pfAutoCompatibility in DataPrintDialog.PrintFlags) then Chart.PrinterCompatibility:=pcAuto else Chart.PrinterCompatibility:=pcOFF; // Переносим в свойства Chart ОПЦИИ СОВМЕСТИМОСТИ ПРИНТЕРА, они не действуют в режиме // PrinterCompatibility=pcOFF Chart.PrinterCompatibilityOptions:=DataPrintDialog.PrinterCompatOptions; // Печатаем Chart Chart.PrintRectEx(PrintRect); // Восстанавливаем заголовок Chart Chart.Title.Visible:=TitleVis; Chart.Title.Text.Text:=s; end else begin MessageBox(rsInvalidMargins, rsTitle, MB_OK+MB_ICONERROR); end; end; end; procedure TFormSpectrum.ActionPrintExExecute(Sender: TObject); begin Print(Sender); end; procedure TFormSpectrum.ActionPrintDlgExExecute(Sender: TObject); begin if PrintDlgOK then begin if DataPrintDialog.Execute then begin Print(Sender); end; end; end; END.