Source code for MSQuant: frmFinneganSpectra.vb, MSQuant/msquant/src/GUI/forms/frmFinneganSpectra.vb.

Table of contents page.

Home page for MSQuant.

'****************************************************************************
'* Copyright (C) 2004 Peter Mortensen and Matthias Mann                     *
'* This file is part of MSQuant.                                            *
'*                                                                          *
'* MSQuant is distributed under the terms of                                *
'* the GNU General Public License. See src/COPYING.TXT or                   *
'* <http://www.gnu.org/licenses/gpl.txt> for details.                       *
'*                                                                          *
'* MSQuant is free software; you can redistribute it                        *
'* and/or modify it under the terms of the GNU                              *
'* General Public License as published by the Free                          *
'* Software Foundation; either version 2 of the                             *
'* License, or (at your option) any later version.                          *
'*                                                                          *
'* MSQuant is distributed in the hope that it will be                       *
'* useful, but WITHOUT ANY WARRANTY; without even the                       *
'* implied warranty of MERCHANTABILITY or FITNESS FOR                       *
'* A PARTICULAR PURPOSE.  See the GNU General Public                        *
'* License for more details.                                                *
'*                                                                          *
'* You should have received a copy of the GNU General                       *
'* Public License along with MSQuant; if not, write to                      *
'* the Free Software Foundation, Inc., 59 Temple                            *
'* Place, Suite 330, Boston, MA  02111-1307  USA                            *
'*                                                                          *
'* Purpose: Is responsible for showing Finnegan spectra on the screen.      *
'*          It encapsulates an instance of                                  *
'*          AxXCALIBURDISPLAYSLib.AxXSpecDisplay.                           *
'*                                                                          *
'****************************************************************************

'****************************************************************************
'*                               CEBI                                       *
'*                    Software Development Group                            *
'*                         Peter Mortensen                                  *
'*                E-mail: NUKESPAMMERSdrmortensen@get2netZZZZZZ.dk          *
'*                 WWW: http://www.cebi.sdu.dk/                             *
'*                                                                          *
'*  Program for post-processing of result from search in mass               *
'*    spectrometric data.                                                   *
'*                                                                          *
'*    FILENAME:   frmFinneganSpectra.vb                                     *
'*    TYPE:  VISUAL_BASIC                                                   *
'*                                                                          *
'* CREATED: PM 2002-04-01   Vrs 1.0.  Estimated..                           *
'* UPDATED: PM 2004-02-06   Embedding of Finnegan spectra.                  *
'*                                                                          *
'****************************************************************************

Option Strict On
Option Explicit On 

Imports System.Reflection 'For [Assembly], GetExecutingAssembly(), etc.

'Changed PM_MS3INTEGRATION 2004-05-14
Imports System.Text.RegularExpressions

Imports SDUPutility 'For SDUPlogger

Imports massSpectrometryBase 'For rawDataFileHandling
Imports utilityStatic 'For numbersClose

'Changed PM_REFERENCES 2004-07-20
Imports AxXCALIBURDISPLAYSLib '\Xcalibur\system\programs\XcaliburDisplays.dll


'      (or browse to 'D:\Program Files\Xcalibur\system\programs\XcaliburDisplays.dll')
'      Open. OK.
'  2. Drag 'XSpecDisplay Class' to some form in order to have the
'     references 'AxXCALIBURDISPLAYSLib' and 'XCALIBURDISPLAYSLib'
'     added to References.
'  3. Delete the added control (the reference will stay)
'
'  Typical objects are:
'    XCALIBURDISPLAYSLib.XSpecPlot
'    AxXCALIBURDISPLAYSLib.AxXSpecDisplay
'    AxXCALIBURDISPLAYSLib._IXSpecDisplayEvents_MouseMoveEvent
'    AxXCALIBURDISPLAYSLib._IXSpecDisplayEvents_MouseUpEvent
'    XCALIBURDISPLAYSLib.XSpecPlottingStyles.XSpecPoint_To_Point
'    XCALIBURDISPLAYSLib.XSpecPlottingStyles.XSpecAutomatic
'
'  'Changed PM_XCALIBUR_RELOCATION_NOTES 2006-01-16
'  4. Note: may not compile if XCalibur was re-installed (to a new folder?).
'
'           Symptom when starting QualBrowser.exe:
'
'               1. "XDK (the Xcalibur development kit) is not installed on
'                   this computer. Please install the XDK from the
'                   Xcalibur CD. Without XDK you cannot run the
'                   quantitation package."
'
'               2. "Cannot find an isotope (*.lim) file. You will not be
'                   able to do elemental composition."
'
'               3. "Error - failed to connect to license server. License
'                   server may not be registered."
'
'           In that case register the DLLs at the new location, e.g.:
'
'             a. start Menu/Run/cmd
'             b. z:
'             c. cd Z:\Xcalibur_try3\system\programs
'             d. regsvr32 XcaliburDisplays.dll
'                regsvr32 XcaliburFiles.dll
'                regsvr32 XRawfile2.dll
'                regsvr32 COMCT232.OCX
'                regsvr32 COMCTL32.OCX
'                regsvr32 Comdlg32.ocx
'                regsvr32 TABCTL32.OCX
'                regsvr32 MSCOMCTL.OCX
'                regsvr32 MSFLXGRD.OCX
'                regsvr32 vcf132.ocx
'             e. Restart Visual Studio
'
'           This will fix the compile problem. But
'           sometimes the QualBrowser.exe problem persists.
'
'  What about [HKEY_LOCAL_MACHINE\SOFTWARE\Finnigan\Xcalibur\Global],
'  "Xcalibur Path" and
'  [HKEY_CURRENT_USER\SOFTWARE\Finnigan\Xcalibur\Global], "Isotope_limit_file" ?

Imports XCALIBURDISPLAYSLib 'See above (this reference is added
'    automatically), \Xcalibur\system\programs\XcaliburDisplays.dll

Imports XCALIBURFILESLib  '\Xcalibur\system\programs\XcaliburFiles.dll
'Requires adding reference to project:
'  menu Project/Add Reference/Browse,
'  select D:\Program Files\Xcalibur\system\programs\XcaliburFiles.dll.

'Typical objects:
'  XCALIBURFILESLib.XSpectrum


'****************************************************************************
'*    <placeholder for header>                                              *
'****************************************************************************
Public Class frmFinneganSpectra
    'Inherits System.Windows.Forms.Form
    Inherits frmSpectrumDisplay

    'Dim mRawFile As massSpectrometryBase.rawDataFileHandling

    Dim mSpecPlot As XSpecPlot

    'Dim mSignal As ArrayList 'Type is massSpectrometryBase.signalStructure.

    'Changed PM_REFACTOR 2005-03-05. Now moved up to base class.
    'Dim mRawDataFileHandling As rawDataFileHandling

    Dim mZoomInCursor As Cursor
    Dim mZoomOutCursor As Cursor

    Dim mToZoomIn As Boolean = True

    'Changed PM_USER_EXACT_ZOOM 2005-03-03
    'Private mUpdatedWithNewData As Boolean

    'Changed PM_REFACTOR 2005-03-04
    Private mPreviousZoom As massZoomStructure

    'Changed PM_USER_EXACT_ZOOM 2005-03-03
    Private mPreviousSpectrumNumber As Integer

    Friend WithEvents mAxXSpecDisplay_FINNEGANCOM As AxXSpecDisplay


#Region " Windows Form Designer generated code "


    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    Friend WithEvents ToolTip1 As System.Windows.Forms.ToolTip
    Friend WithEvents AxXSpecDisplay1 As AxXSpecDisplay
    Friend WithEvents btnTest1 As System.Windows.Forms.Button
    Friend WithEvents chkLines As System.Windows.Forms.CheckBox
    Friend WithEvents lblMaxValue As System.Windows.Forms.Label
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.components = New System.ComponentModel.Container
        Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmFinneganSpectra))
        Me.ToolTip1 = New System.Windows.Forms.ToolTip(Me.components)
        Me.btnTest1 = New System.Windows.Forms.Button
        Me.chkLines = New System.Windows.Forms.CheckBox
        Me.lblMaxValue = New System.Windows.Forms.Label
        '
        'btnTest1
        '
        Me.btnTest1.Enabled = False
        Me.btnTest1.Location = New System.Drawing.Point(592, 320)
        Me.btnTest1.Name = "btnTest1"
        Me.btnTest1.Size = New System.Drawing.Size(56, 24)
        Me.btnTest1.TabIndex = 2
        Me.btnTest1.Text = "Test1"
        '
        'chkLines
        '
        Me.chkLines.Location = New System.Drawing.Point(16, 336)
        Me.chkLines.Name = "chkLines"
        Me.chkLines.Size = New System.Drawing.Size(56, 24)
        Me.chkLines.TabIndex = 3
        Me.chkLines.Text = "Lines"
        '
        'lblMaxValue
        '
        Me.lblMaxValue.Font = New System.Drawing.Font("Lucida Console", 18.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.lblMaxValue.ForeColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(0, Byte), CType(0, Byte))
        Me.lblMaxValue.Location = New System.Drawing.Point(164, 8)
        Me.lblMaxValue.Name = "lblMaxValue"
        Me.lblMaxValue.Size = New System.Drawing.Size(344, 23)
        Me.lblMaxValue.TabIndex = 4
        Me.lblMaxValue.Text = "<>"
        Me.lblMaxValue.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
        '
        'frmFinneganSpectra
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(672, 381)
        Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
        Me.Name = "frmFinneganSpectra"
        Me.Text = "frmFinneganSpectra"

    End Sub
#End Region


    '****************************************************************************
    '*    <placeholder for header>                                              *
    '*    Note: aExternalDisplay can be Nothing. Then the internal one is used. *
    '****************************************************************************
    Public Sub New( _
      ByRef aRawFile As massSpectrometryBase.rawDataFileHandling, _
      ByRef aExternalDisplay As AxXSpecDisplay, _
      ByRef anInRawDataFileHandling As rawDataFileHandling, _
      ByRef anInOutMarker As SDUPspectrumMarking)

        MyBase.New(anInRawDataFileHandling, anInOutMarker)

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Changed PM_REFACTOR 2004-02-05
        If aExternalDisplay Is Nothing Then
            mAxXSpecDisplay_FINNEGANCOM = AxXSpecDisplay1
        Else
            mAxXSpecDisplay_FINNEGANCOM = aExternalDisplay
        End If

        'Add any initialization after the InitializeComponent() call

        'mRawFile = aRawFile

        mAxXSpecDisplay_FINNEGANCOM.MassDPs = 5
        Dim o1 As Object = mAxXSpecDisplay_FINNEGANCOM.Add(0)
        mSpecPlot = _
          DirectCast(o1, XSpecPlot)

        If True Then
            'Changed PM_CURSOR_EMBED 2003-10-31.
            'Notes:
            '  1. "Mascot_Parser" comes
            '     from() 'RootNamespace' in the Properties for the
            '     sub-project (NOT the Solution).
            '     Note: after removing the root name space the
            '           prefix "Mascot_Parser." is no longer needed and
            '           does not work either.
            '  2. For icon files/Property: "Build Action" is set
            '     to "Embedded Resource" (not the default "Content").
            'mZoomInCursor = New Cursor("ZoomIn.cur")
            'mZoomOutCursor = New Cursor("ZoomOut.cur")

            Dim assem As [Assembly] = [Assembly].GetExecutingAssembly()

            'mZoomInCursor = _
            '  New Cursor(assem.GetManifestResourceStream("Mascot_Parser.ZoomIn.cur"))
            'mZoomOutCursor = _
            '  New Cursor(assem.GetManifestResourceStream("Mascot_Parser.ZoomOut.cur"))
            mZoomInCursor = _
              New Cursor(assem.GetManifestResourceStream("ZoomIn.cur"))
            mZoomOutCursor = _
              New Cursor(assem.GetManifestResourceStream("ZoomOut.cur"))
        End If

        'Changed PM_USER_EXACT_ZOOM 2005-03-03
        '        mUpdatedWithNewData = False

        'Changed PM_USER_EXACT_ZOOM 2005-03-03
        mPreviousSpectrumNumber = -1
        mPreviousZoom.startMass = -10.0
        mPreviousZoom.endMass = -20.0
    End Sub 'New


    '****************************************************************************
    '*    <placeholder for header>                                              *
    '****************************************************************************
    Public Overrides Function getCOMlogger() _
      As SDUPlogger

        Trace.Assert(False, "Stop!", "PIL ASSERT. Internal/development assert for stopping execution......")
        Return Nothing
    End Function 'getCOMlogger




    '****************************************************************************
    '*    <placeholder for header>                                              *
    '****************************************************************************
    Private Sub btnTest1_Click( _
      ByVal sender As System.Object, ByVal e As System.EventArgs) _
      Handles btnTest1.Click

        mAxXSpecDisplay_FINNEGANCOM.NoDataText = _
          "No fuel left for the ..."
        Dim activepl_1 As Integer = mAxXSpecDisplay_FINNEGANCOM.ActivePlot
        Dim t2 As Type = mAxXSpecDisplay_FINNEGANCOM.GetType
        Dim t2Str As String = t2.ToString
        Dim o1 As Object = mAxXSpecDisplay_FINNEGANCOM.Add(0)
        Dim x1 As XSpecPlot = _
          DirectCast(o1, XSpecPlot)
        Dim spectrum As XSpectrum = New XSpectrum
        Dim asdas(9, 3) As Double
        asdas(0, 0) = 135.09090909361839
        asdas(0, 1) = 135.18181818723679
        asdas(0, 2) = 135.27272728085518
        asdas(0, 3) = 135.36363637447357
        asdas(1, 0) = 0.70823770761489868
        asdas(1, 1) = 0.097037635743618011
        asdas(1, 2) = 0.6082377076148987
        asdas(1, 3) = 0.50823770761489873
        spectrum.Data = asdas
        x1.Spectrum = spectrum
        Dim t1 As Type = o1.GetType
        Dim t1Str As String = t1.ToString
        Dim gu As System.Guid = t1.GUID
        Dim tName As String = o1.GetType.Name
        Dim activepl_2 As Integer = mAxXSpecDisplay_FINNEGANCOM.ActivePlot
        Dim t As Type = Type.GetTypeFromProgID("SAPI.SpVoice")
        Dim peter2 As Integer = 2
    End Sub 'btnTest1_Click


    '****************************************************************************
    '*    <placeholder for header>                                              *
    '****************************************************************************
    Public Overrides Sub updateData()

        'Changed PM_XCALIBUR20SR1_DETECTION 2007-01-09
        'Special handling of this error that happens if XCalibur 2.0 SR1 (or
        'later) is not installed:
        '
        '  "Error: System.InvalidCastException: Unable to 
        '  cast COM object of type 
        '  'XCALIBURFILESLib.XSpectrumClass' to interface 
        '  type 'XCALIBURFILESLib.IXSpectrum4'. This 
        '  operation failed because the QueryInterface on the 
        '  COM component for the interface with IID '{ 
        '  F78595B4-4B12- 9EB8-DC0240E1A1B3}' failed due to 
        '  the following error: No such interface supported 
        '  (Exception from HRESULT: 0x80004002 
        '  (E_NOINTERFACE))"
        '
        'Cover entire function as it is currently unknown 
        'exactly where it happens.
        Try
            'Note: currently we get new data whenever the zoom
            '      state changes. This is not strictly necessary as we
            '      usually start at the highest zoom and could thus
            '      save those data and select a subset of them
            '      depending on the zoom.

            Trace.Assert(Not mRawDataFileHandling Is Nothing, _
              "PIL ASSERT. anInRawDataFileHandling Is Nothing !.")

            'Changed PM_USER_EXACT_ZOOM 2005-03-03
            Dim spectrumNum As Integer = _
              mRawDataFileHandling.currentSpectrumNumber()
            Dim doUpdate As Boolean = True
            If spectrumNum = mPreviousSpectrumNumber AndAlso _
              numbersClose( _
                mZoom.startMass, mPreviousZoom.startMass, _
                0.0000000001) AndAlso _
              numbersClose( _
                mZoom.endMass, mPreviousZoom.endMass, _
                0.0000000001) Then

                doUpdate = False
            End If
            mPreviousSpectrumNumber = spectrumNum
            mPreviousZoom = mZoom

            'Changed PM_USER_EXACT_ZOOM 2005-03-03
            'mUpdatedWithNewData = True

            If doUpdate Then
                'Changed PM_REFACTOR 2005-03-05
                'Now in constructor, in base class.
                'mRawDataFileHandling = anInRawDataFileHandling

                'Changed PM_REFACTOR 2006-10-12
                ''Changed PM_XY_EXPORT 2005-01-11
                'Dim someSignal As ArrayList = Nothing 'Keep compiler happy.
                Dim someSignal As _
                  Generic.List(Of massSpectrometryBase.signalStructure) = _
                    Nothing 'Keep compiler happy.

                Me.getSignalInZoomRange(someSignal)

                'Note: finding the 2 indexes might be more efficient by
                '      doing two binary searches in the array.

                'mSignal = someSignal 'We need to save it because we will have to zoom later.

                Dim len As Integer = someSignal.Count
                Dim lastIndex As Integer = len - 1

                'Changed PM_FINNEGAN_DISPLAY_ASSERT_BUG 2004-05-10. Otherwise it will for
                '  when there are 2 datapoints and they are overlapping with the
                '  display mass range.
                'Dim startIndex As Integer = 0
                Const NODATAPOINTS_MARKER As Integer = -1
                Dim startIndex As Integer = NODATAPOINTS_MARKER

                Dim endIndex As Integer = 0

                Dim j As Integer
                For j = 0 To lastIndex
                    Dim curSignalPoint As massSpectrometryBase.signalStructure = _
                      someSignal(j)
                    Dim x As Double = curSignalPoint.Xsig

                    'Changed PM_MORE_FINNEGAN_DISPLAY_TROUBLE 2004-06-01
                    '  Now correct if the display range is so narrow that there
                    '  are no data points in it.
                    'Changed PM_ZOOMSCAN_TROUBLE 2004-01-21. Logic changed to correctly
                    'handle overlapping of spectrum mass range and display mass range.
                    Dim belowUpperBound As Boolean = x <= mZoom.endMass
                    If x >= mZoom.startMass AndAlso belowUpperBound Then
                        'Changed PM_MORE_FINNEGAN_DISPLAY_TROUBLE 2004-06-01.
                        'Check of mEndMass above is necessary as the display range may be so that
                        'there are no data points in it.

                        If startIndex = NODATAPOINTS_MARKER Then 'We only need to do this once as x values
                            '  are always increasing.
                            startIndex = j
                        End If

                        If belowUpperBound Then
                            'In mass range for display
                            endIndex = j 'We have to update everytime because we do not know
                            '  where the last in-range data point is.
                        Else
                            'To the right of the asked for mass window for display. Bail out!
                            Dim peter9 As Integer = 9
                            Exit For
                        End If
                    End If
                    If Not belowUpperBound Then
                        Exit For
                    End If
                Next j

                'Changed PM_MORE_FINNEGAN_DISPLAY_TROUBLE 2004-06-01
                If startIndex = NODATAPOINTS_MARKER Then
                    endIndex = startIndex - 1 'To get correct length and zero
                    '  iterations in the loop below.
                Else
                    'Changed PM_ZOOMSCAN_TROUBLE 2004-01-21
                    Trace.Assert(endIndex >= startIndex, _
                      "PIL ASSERT. endIndex >= startIndex, in updateData()/frmFinneganSpectra.vb.")
                End If

                Dim pointsInRange As Integer = endIndex - startIndex + 1

                Dim len2 As Integer = pointsInRange + 2 '2: extra points at
                '  beginning and end to fix mass range.
                Dim lastIndex2 As Integer = len2 - 1

                Dim dataArray(9, lastIndex2) As Double
                dataArray(0, 0) = mZoom.startMass
                dataArray(1, 0) = 0.000000001
                dataArray(0, lastIndex2) = mZoom.endMass
                dataArray(1, lastIndex2) = 0.000000001

                Dim maxSignal As Double = -1000000000.0
                If startIndex <> NODATAPOINTS_MARKER Then
                    Dim index2 As Integer = 1 '1 because we have inserted zero point at mStartMass
                    For j = startIndex To endIndex
                        Dim curSignalPoint As massSpectrometryBase.signalStructure = _
                          someSignal(j)
                        Dim curY As Double = curSignalPoint.Ysig
                        If curY > maxSignal Then
                            maxSignal = curY
                        End If
                        dataArray(0, index2) = curSignalPoint.Xsig
                        dataArray(1, index2) = curY
                        index2 += 1
                    Next j
                Else
                    Dim peter111 As Integer = 111
                End If

                'Why do we create a new one for every update????
                Dim spectrum As XSpectrum = New XSpectrum

                'Changed PM_FINNEGAN_SPECTRUMLABEL_TRYOUT 2004-02-05
                If True Then
                    'FixScale
                    '    Description: Gets or sets the value which enables fixed
                    '      Y-axis intensity scaling for all spectrum plots. When
                    '      this property is set to True, the MaxScaleIntensity
                    '      property is used to set the Y-axis scaling of each
                    '      spectrum plot.
                    '
                    '    Parameters: Get: None
                    'Set: Boolean

                    Dim hObj As Object = spectrum.Header
                End If
                mSpecPlot.Text = "asdasdkljal sdjalskd jalksd"

                spectrum.Data = dataArray
                mSpecPlot.Spectrum = spectrum

                lblMaxValue.Text = "Maximum: " & maxSignal.ToString("0.0")

                mAxXSpecDisplay_FINNEGANCOM.Refresh()
            Else
                Dim peter9 As Integer = 9
            End If

        Catch exceptionObject As Exception
            'For catching: "Unable to cast COM object ... IXSpectrum4'."

            Dim extraStr As String = ""
            If Not exceptionObject.InnerException Is Nothing Then
                extraStr = exceptionObject.InnerException.Message()
            End If

            Dim exceptionInfoStr As String = _
              exceptionObject.ToString() & exceptionObject.Message() & extraStr

            'COM interface IXSpectrum4 was introduced with XCalibur 2.0 SR1.
            If exceptionInfoStr.IndexOf("IXSpectrum4") > 0 Then
                Dim msgStr As String = _
                  AppConstants.LONG_APP & _
                  " could not continue. " & _
                  "Possible reasons: 1. This version of " & _
                  AppConstants.LONG_APP & " requires XCalibur 2.0 SR1 (or later) to be installed. " & _
                  "Please note that neither XCalibur 2.0 SUR1 nor XCalibur 2.0 SUR2 " & _
                  "work (""SUR"" is not the same as ""SR""). " & _
                  "2. The XDK option must also have been selected " & _
                  "during the installation of XCalibur, " & _
                  "including when applying upgrades, e.g. from SR1 to SR2."
                MsgBox(msgStr)
            End If

            'Default. Keep it? Yes, there could be other kind of errors.
            AppCommon2.displayStandardExceptionInfo( _
              exceptionObject, _
              "Could display spectrum data.")
            Exit Sub
        End Try
    End Sub 'updateData


    '****************************************************************************
    '*    <placeholder for header>                                              *
    '****************************************************************************
    Protected Overrides Sub derivedClearDisplay()

        Dim dataArray(9, 1) As Double
        dataArray(0, 0) = mZoom.startMass
        dataArray(1, 0) = 0.000000001
        dataArray(0, 1) = mZoom.endMass
        dataArray(1, 1) = 0.000000001

        Dim spectrum As XSpectrum = New XSpectrum
        spectrum.Data = dataArray
        mSpecPlot.Spectrum = spectrum
        mAxXSpecDisplay_FINNEGANCOM.Refresh()
    End Sub 'derivedClearDisplay


    '****************************************************************************
    '*    <placeholder for header>                                              *
    '****************************************************************************
    Public Overrides Sub setSpectrumTitle(ByVal aTitle As String)
        Me.Text = aTitle 'Should set window title

        'Changed PM_MS3INTEGRATION 2004-05-12
        mAxXSpecDisplay_FINNEGANCOM.Text = aTitle
    End Sub 'setSpectrumTitle


    '****************************************************************************
    '*    <placeholder for header>                                              *
    '****************************************************************************
    Public Overrides Function getTitle() _
    As String

        'Logical, but not as refactored. What should it be?
        'Dim toReturn As String = _
        '  mAxXSpecDisplay_FINNEGANCOM.Text

        Dim toReturn As String = "Some title..."

        Return toReturn
    End Function 'getTitle


    '****************************************************************************
    '*    E V E N T S ,    B E G I N                                            *
    '****************************************************************************


    '****************************************************************************
    '*    <placeholder for header>                                              *
    '****************************************************************************
    Private Sub frmFinneganSpectra_KeyDown( _
      ByVal aSender As Object, _
      ByVal anEvent As System.Windows.Forms.KeyEventArgs) _
      Handles MyBase.KeyDown

        Me.zoomCursorSet(Control.ModifierKeys = Keys.Control)
    End Sub 'frmFinneganSpectra_KeyDown


    '****************************************************************************
    '*    <placeholder for header>                                              *
    '****************************************************************************
    Private Sub zoomCursorSet(ByVal aZoomOut As Boolean)
        If aZoomOut Then
            'Changed PM_VS2005 2006-06-14. Fully qual.
            Windows.Forms.Cursor.Current = mZoomOutCursor

            mToZoomIn = False
        Else
            'Changed PM_VS2005 2006-06-14. Fully qual.
            Windows.Forms.Cursor.Current = mZoomInCursor

            mToZoomIn = True
        End If
    End Sub 'zoomCursorSet


    '****************************************************************************
    '*    <placeholder for header>                                              *
    '****************************************************************************
    Private Sub XSpecDisplay_FINNEGANCOM_MouseMoveEvent( _
      ByVal sender As System.Object, _
      ByVal anEvent As _IXSpecDisplayEvents_MouseMoveEvent) _
      Handles mAxXSpecDisplay_FINNEGANCOM.MouseMoveEvent

        If Not mStartingUp Then
            Me.zoomCursorSet(Control.ModifierKeys = Keys.Control)

            If False Then
                'mAxXSpecDisplay_FINNEGANCOM.Cursor=
                mAxXSpecDisplay_FINNEGANCOM.Cursor = mZoomInCursor
                'mAxXSpecDisplay_FINNEGANCOM.Refresh()

                'Changed PM_VS2005 2006-06-14. Fully qual.
                Windows.Forms.Cursor.Current = mZoomInCursor

                'mZoomInCursor
                'mZoomOutCursor
            End If
        End If
    End Sub 'XSpecDisplay_FINNEGANCOM_MouseMoveEvent


    '****************************************************************************
    '*    <placeholder for header>                                              *
    '****************************************************************************
    Private Sub XSpecDisplay_FINNEGANCOM_MouseUpEvent( _
      ByVal sender As Object, _
      ByVal anEvent As _IXSpecDisplayEvents_MouseUpEvent) _
      Handles mAxXSpecDisplay_FINNEGANCOM.MouseUpEvent

        Dim displayMassWindow As Double = mZoom.endMass - mZoom.startMass

        Dim r As System.Drawing.Size = mAxXSpecDisplay_FINNEGANCOM.Size
        Dim specXsize As Double = r.Width
        Dim hitXmass As Double = _
          anEvent.x / specXsize * displayMassWindow + mZoom.startMass

        Dim newDisplayMassWindow As Double

        If mToZoomIn Then
            newDisplayMassWindow = 0.5 * displayMassWindow
        Else
            newDisplayMassWindow = 2.0 * displayMassWindow
        End If

        Dim halfnewInterval As Double = 0.5 * newDisplayMassWindow
        Dim newStartMass As Double = hitXmass - halfnewInterval
        Dim newEndMass As Double = hitXmass + halfnewInterval

        'Changed PM_ZOOM_QUANTWINDOW_BROKEN 2005-07-13
        Trace.Assert( _
          mInititalStartMass > 5.0, _
          "PIL ASSERT. mInititalStartMass is not initialised: " & _
          mInititalStartMass)
        Trace.Assert( _
          mInititalEndMass > 5.0, _
          "PIL ASSERT. mInititalEndMass is not initialised: " & _
          mInititalEndMass)

        If newStartMass < mInititalStartMass Then
            newStartMass = mInititalStartMass
        End If
        If newEndMass > mInititalEndMass Then
            newEndMass = mInititalEndMass
        End If

        mZoom.startMass = newStartMass
        mZoom.endMass = newEndMass

        'Changed PM_REFACTOR 2005-03-03
        'Me.updateData(mRawDataFileHandling)
        ''Changed PM_ZOOM_MARKERS 2004-06-17
        'updateMarkersPosition(mParentForm)
        '
        'Me.newZoom()
        'Me.updateMarkersPosition(mParentForm)
        Me.setZoomRange2(mZoom)
    End Sub 'XSpecDisplay_FINNEGANCOM_MouseUpEvent


    '****************************************************************************
    '*    <placeholder for header>                                              *
    '****************************************************************************
    Private Sub chkLines_CheckedChanged( _
      ByVal aSender As System.Object, ByVal aEvent As System.EventArgs) _
      Handles chkLines.CheckedChanged

        Dim useLines As Boolean = chkLines.Checked
        If useLines Then
            mAxXSpecDisplay_FINNEGANCOM.Plotting = _
              XSpecPlottingStyles.XSpecPoint_To_Point
        Else
            mAxXSpecDisplay_FINNEGANCOM.Plotting = _
              XSpecPlottingStyles.XSpecAutomatic
        End If
        mAxXSpecDisplay_FINNEGANCOM.Refresh()

    End Sub 'chkLines_CheckedChanged


    'Changed PM_XY_EXPORT 2005-01-11
    '****************************************************************************
    '*    <placeholder for header>                                              *
    '****************************************************************************
    Protected Overrides Sub spectrumControlLocAndSize( _
     ByRef anOutXLoc As Integer, ByRef anOutYLoc As Integer, _
     ByRef anOutXSize As Integer, ByRef anOutYSize As Integer)

        anOutXLoc = mAxXSpecDisplay_FINNEGANCOM.Location.X
        anOutYLoc = mAxXSpecDisplay_FINNEGANCOM.Location.Y
        Dim specSize As System.Drawing.Size = mAxXSpecDisplay_FINNEGANCOM.Size
        anOutXSize = specSize.Width
        anOutYSize = specSize.Height
    End Sub 'spectrumControlLocAndSize


    '****************************************************************************
    '*    <placeholder for header>                                              *
    '****************************************************************************
    Protected Overrides Sub newZoom()

        'Changed PM_REFACTOR 2005-03-03
        ''Ignore it. Assume that we will get data later and at that time we will
        ''  use the zoom

        'Changed PM_USER_EXACT_ZOOM 2005-03-03
        If True And Not mRawDataFileHandling Is Nothing Then
            Me.updateData()
            'updateMarkersPosition(mParentForm)  moved up in baseclass
        End If
    End Sub 'newZoom


    '****************************************************************************
    '*    <placeholder for header>                                              *
    '****************************************************************************
    Public Overrides Sub refresh2()

        mAxXSpecDisplay_FINNEGANCOM.Refresh() 'Necessary?
    End Sub 'refresh2


    'Changed PM_ANALYST_MARKERS 2005-02-10
    '****************************************************************************
    '*    <placeholder for header>                                              *
    '****************************************************************************
    Public Overrides Function yOffsetForMarkers() As Integer
        Return 41
    End Function 'yOffsetForMarkers


    'Changed PM_ANALYST_MARKERS 2005-02-10
    '****************************************************************************
    '*    <placeholder for header>                                              *
    '****************************************************************************
    Public Overrides Function xOffsetForMarkers() As Integer
        Return 42
    End Function 'yOffsetForMarkers


    'Changed PM_ANALYST_MARKERS 2005-02-10
    '****************************************************************************
    '*    <placeholder for header>                                              *
    '****************************************************************************
    Public Overrides Function xOffsetFromRightEdge() As Integer
        Return 18
    End Function 'yOffsetForMarkers


End Class 'frmFinneganSpectra



    

    

Generated by script codePublish.pl at 2009-01-05T15:20:59.