Changeset 961


Ignore:
Timestamp:
Jun 8, 2020 3:48:27 PM (2 years ago)
Author:
ilavsky
Message:

Convert WAXS tool to MultiSampleSelection? Listbox widget.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/User Procedures/Irena/IR3_WAXSDiffraction.ipf

    r957 r961  
    11#pragma rtGlobals=3             // Use modern global access method and strict wave access.
    2 #pragma version=1.14
     2#pragma version=1.16
    33#include <Multi-peak fitting 2.0>
    44
    55//local configurations
    66Strconstant  WAXSPDF4Location= "WAXS_PDFCards"
    7 constant IR3WversionNumber = 1.15       //Diffraction panel version number
     7constant IR3WversionNumber = 1.16       //Diffraction panel version number
    88
    99//*************************************************************************\
     
    1313//*************************************************************************/
    1414
     15//1.16 change to use MultiSampleSelection Listbox tools and not custom code.
    1516//1.15 add "Distance correction" value which enables one to shift sticks to correct for poor calibration of distacne.
    1617//1.14 add button to open AMS www so users can search for cards easily.
     
    6263                DoWindow/F IR3W_WAXSPanel
    6364        else
    64                 Execute("IR3W_WAXSPanel()")
     65                IR3W_WAXSPanelFunction()
    6566                IR1_UpdatePanelVersionNumber("IR3W_WAXSPanel", IR3WversionNumber,1)
    6667        endif
     
    7475//************************************************************************************************************
    7576//************************************************************************************************************
    76 Proc IR3W_WAXSPanel()
     77Function IR3W_WAXSPanelFunction()
    7778        PauseUpdate             // building window...
    7879        NewPanel /K=1 /W=(2.25,43.25,550,800) as "Powder Diffraction/WAXS Fits"
     
    8485        string EUserLookup=""
    8586        IR2C_AddDataControls("Irena:WAXS","IR3W_WAXSPanel","DSM_Int;M_DSM_Int;SMR_Int;M_SMR_Int;","AllCurrentlyAllowedTypes",UserDataTypes,UserNameString,XUserLookup,EUserLookup, 0,1, DoNotAddControls=1)
    86         TitleBox DataSelection title="\Zr140Data selection",pos={60,34},frame=0,fstyle=1, fixedSize=1,size={350,20}
    87         Checkbox UseIndra2Data, pos={10,50},size={76,14},title="USAXS", proc=IR3W_WAXSCheckProc, variable=root:Packages:Irena:WAXS:UseIndra2Data
    88         checkbox UseQRSData, pos={120,50}, title="QRS(QIS)", size={76,14},proc=IR3W_WAXSCheckProc, variable=root:Packages:Irena:WAXS:UseQRSdata
    89         if(root:Packages:Irena:WAXS:UseQRSdata+root:Packages:Irena:WAXS:UseIndra2Data!=1)
    90                 root:Packages:Irena:WAXS:UseIndra2Data=0
    91                 root:Packages:Irena:WAXS:UseQRSdata = 1
    92         endif
    93         PopupMenu StartFolderSelection,pos={10,70},size={180,15},proc=IR3W_PopMenuProc,title="Start fldr"
    94         PopupMenu StartFolderSelection,mode=1,popvalue=root:Packages:Irena:WAXS:DataStartFolder,value= #"\"root:;\"+IR3C_GenStringOfFolders2(root:Packages:Irena:WAXS:UseIndra2Data, root:Packages:Irena:WAXS:UseQRSdata, 2,1)"
    95         SetVariable FolderNameMatchString,pos={10,95},size={210,15}, proc=IR3W_SetVarProc,title="Folder Match (RegEx)"
    96         Setvariable FolderNameMatchString,fSize=10,fStyle=2, variable=root:Packages:Irena:WAXS:DataMatchString
    97         PopupMenu SortFolders,pos={10,115},size={180,20},fStyle=2,proc=IR3W_PopMenuProc,title="Sort Folders"
    98         PopupMenu SortFolders,mode=1,popvalue=root:Packages:Irena:WAXS:FolderSortString,value= root:Packages:Irena:WAXS:FolderSortStringAll
    99 
     87        NVAR UseQRSdata=root:Packages:Irena:WAXS:UseQRSdata
     88        NVAR UseIndra2Data=root:Packages:Irena:WAXS:UseIndra2Data
     89        NVAR UseResults=root:Packages:Irena:WAXS:UseResults
     90        UseResults = 0
     91        UseIndra2Data = 0
     92        UseQRSdata = 1
     93        IR3C_MultiAppendControls("Irena:WAXS","IR3W_WAXSPanel", "IR3W_WAXSDoubleClickAction","",0,1)
     94        //TitleBox DataSelection title="\Zr140Data selection",pos={60,34},frame=0,fstyle=1, fixedSize=1,size={350,20}
     95        TitleBox DataSelection title="",pos={60,34},frame=0,fstyle=1, fixedSize=1,size={350,20}
     96        //Checkbox UseIndra2Data, disable=1
     97        Checkbox UseResults, disable=1
     98        Checkbox DisplayUncertainties, disable=1
    10099        ListBox DataFolderSelection,pos={4,135},size={250,480}, mode=10, special={0,0,1 }               //this will scale the width of column, users may need to slide right using slider at the bottom.
    101         ListBox DataFolderSelection,listWave=root:Packages:Irena:WAXS:ListOfAvailableData
    102         ListBox DataFolderSelection,selWave=root:Packages:Irena:WAXS:SelectionOfAvailableData
    103         ListBox DataFolderSelection,proc=IR3W_WAXSListBoxProc
     100//      checkbox UseQRSData, pos={120,50}, title="QRS(QIS)", size={76,14},proc=IR3W_WAXSCheckProc, variable=root:Packages:Irena:WAXS:UseQRSdata
     101//      if(root:Packages:Irena:WAXS:UseQRSdata+root:Packages:Irena:WAXS:UseIndra2Data!=1)
     102//              root:Packages:Irena:WAXS:UseIndra2Data=0
     103//              root:Packages:Irena:WAXS:UseQRSdata = 1
     104//      endif
     105//      PopupMenu StartFolderSelection,pos={10,70},size={180,15},proc=IR3W_PopMenuProc,title="Start fldr"
     106//      PopupMenu StartFolderSelection,mode=1,popvalue=root:Packages:Irena:WAXS:DataStartFolder,value= #"\"root:;\"+IR3C_GenStringOfFolders2(root:Packages:Irena:WAXS:UseIndra2Data, root:Packages:Irena:WAXS:UseQRSdata, 2,1)"
     107//      SetVariable FolderNameMatchString,pos={10,95},size={210,15}, proc=IR3W_SetVarProc,title="Folder Match (RegEx)"
     108//      Setvariable FolderNameMatchString,fSize=10,fStyle=2, variable=root:Packages:Irena:WAXS:DataMatchString
     109//      PopupMenu SortFolders,pos={10,115},size={180,20},fStyle=2,proc=IR3W_PopMenuProc,title="Sort Folders"
     110//      PopupMenu SortFolders,mode=1,popvalue=root:Packages:Irena:WAXS:FolderSortString,value= root:Packages:Irena:WAXS:FolderSortStringAll
     111//
     112//      ListBox DataFolderSelection,pos={4,135},size={250,480}, mode=10, special={0,0,1 }               //this will scale the width of column, users may need to slide right using slider at the bottom.
     113//      ListBox DataFolderSelection,listWave=root:Packages:Irena:WAXS:ListOfAvailableData
     114//      ListBox DataFolderSelection,selWave=root:Packages:Irena:WAXS:SelectionOfAvailableData
     115//      ListBox DataFolderSelection,proc=IR3W_WAXSListBoxProc
    104116        SetVariable Energy,pos={4,625},size={200,15}, proc=IR3W_SetVarProc,title="X-ray E [keV] ="
    105117        Setvariable Energy, variable=root:Packages:Irena:WAXS:Energy, limits={0.1,100,0}
     
    127139        DrawText 10,20,"Background if needed for fitting"
    128140        //fix case when neither is selected and default to qrs
    129         root:Packages:Irena:WAXSBackground:DataFolderName =""
     141        SVAR DataFolderName = root:Packages:Irena:WAXSBackground:DataFolderName
     142        DataFolderName = ""
    130143        //note, this sets up the dependence for same type of data for background and fit data, seems logical.
    131         root:Packages:Irena:WAXSBackground:UseIndra2Data := root:Packages:Irena:WAXS:UseIndra2Data
    132         root:Packages:Irena:WAXSBackground:UseQRSdata  := root:Packages:Irena:WAXS:UseQRSdata
     144        NVAR UseIndra2DataB = root:Packages:Irena:WAXSBackground:UseIndra2Data
     145        SetFormula UseIndra2DataB,  "root:Packages:Irena:WAXS:UseIndra2Data"
     146        NVAR UseQRSdataB = root:Packages:Irena:WAXSBackground:UseQRSdata 
     147        SetFormula UseQRSdataB, "root:Packages:Irena:WAXS:UseQRSdata"
    133148        // done...
    134149        Checkbox UseIndra2Data, pos={100,5}, disable=1
     
    138153        popupMenu SelectDataFolder, pos={10,20}, proc=IR3W_BackgroundPopMenuProc
    139154        setVariable FolderMatchStr, pos={10,40}
    140         checkbox DisplayDataBackground, pos={140,40}, title="Display in Graph?", size={76,14},proc=IR3W_WAXSCheckProc, variable=root:Packages:Irena:WAXS:DisplayDataBackground
    141        
     155        checkbox DisplayDataBackground, pos={120,40}, title="Display in Graph?", size={76,14},proc=IR3W_WAXSCheckProc, variable=root:Packages:Irena:WAXS:DisplayDataBackground
     156        PopupMenu QvecDataName pos={3,59}
     157        PopupMenu IntensityDataName pos={3,78}
     158        SetVariable WaveMatchStr pos={230,40}
    142159        //setVariable WaveMatchStr, pos={150,120}       
    143160        SetActiveSubwindow ##
     
    152169        TitleBox Info1,fSize=12,frame=0,fStyle=1,anchor= MC,fixedSize=1
    153170        PopupMenu MPFInitializeFromSetMenu,pos={285.00,180.00},size={235.00,23.00},bodyWidth=190,title="Initialize:"
    154         PopupMenu MPFInitializeFromSetMenu,mode=1,value= #"IR3W_InitMPF2FromMenuString()", popvalue=root:Packages:Irena:WAXS:MPF2InitFolder, proc=IR3W_PopMenuProc
     171        SVAR MPF2InitFolder = root:Packages:Irena:WAXS:MPF2InitFolder
     172        PopupMenu MPFInitializeFromSetMenu,mode=1,value= #"IR3W_InitMPF2FromMenuString()", popvalue=MPF2InitFolder, proc=IR3W_PopMenuProc
    155173        Button MultiPeakFittingStart,pos={300.00,210.00},size={200.00,20.00},proc=IR3W_WAXSButtonProc,title="Start MultiPeak Fitting 2.0"
    156174        Button MultiPeakFittingStart,help={"Open and configure MultiPeak 2.0 fitting."}
     
    943961//**************************************************************************************
    944962//**************************************************************************************
    945 
    946 Function IR3W_WAXSListBoxProc(lba) : ListBoxControl
    947         STRUCT WMListboxAction &lba
    948 
    949         Variable row = lba.row
    950         WAVE/T/Z listWave = lba.listWave
    951         WAVE/Z selWave = lba.selWave
    952         string FoldernameStr
    953         Variable isData1or2
    954         switch( lba.eventCode )
    955                 case -1: // control being killed
    956                         break
    957                 case 1: // mouse down
    958                         break
    959                 case 3: // double click
    960                         DoWindow IR3W_WAXSMainGraph
    961                         if(V_Flag==1)
    962                                 DoWIndow/F IR3W_WAXSMainGraph
    963                         endif
    964                         IN2G_PrintDebugStatement(IrenaDebugLevel, 5,"")
    965                         FoldernameStr=listWave[row]
    966                         IR3W_CopyAndAppendData(FoldernameStr)
    967                         break
    968                 case 4: // cell selection
    969                 case 5: // cell selection plus shift key
    970                         break
    971                 case 6: // begin edit
    972                         break
    973                 case 7: // finish edit
    974                         break
    975                 case 13: // checkbox clicked (Igor 6.2 or later)
    976                         break
    977         endswitch
    978 
    979         return 0
    980 End
     963//**************************************************************************************
     964Function IR3W_WAXSDoubleClickAction(FoldernameStr)
     965                string FoldernameStr
     966                IN2G_PrintDebugStatement(IrenaDebugLevel, 5,"")
     967                DoWindow IR3W_WAXSMainGraph
     968                if(V_Flag==1)
     969                        DoWIndow/F IR3W_WAXSMainGraph
     970                endif
     971                IR3W_CopyAndAppendData(FoldernameStr)
     972
     973end
     974//**********************************************************************************************************
     975//
     976//Function IR3W_WAXSListBoxProc(lba) : ListBoxControl
     977//      STRUCT WMListboxAction &lba
     978//
     979//      Variable row = lba.row
     980//      WAVE/T/Z listWave = lba.listWave
     981//      WAVE/Z selWave = lba.selWave
     982//      string FoldernameStr
     983//      Variable isData1or2
     984//      switch( lba.eventCode )
     985//              case -1: // control being killed
     986//                      break
     987//              case 1: // mouse down
     988//                      break
     989//              case 3: // double click
     990//                      DoWindow IR3W_WAXSMainGraph
     991//                      if(V_Flag==1)
     992//                              DoWIndow/F IR3W_WAXSMainGraph
     993//                      endif
     994//                      IN2G_PrintDebugStatement(IrenaDebugLevel, 5,"")
     995//                      FoldernameStr=listWave[row]
     996//                      IR3W_CopyAndAppendData(FoldernameStr)
     997//                      break
     998//              case 4: // cell selection
     999//              case 5: // cell selection plus shift key
     1000//                      break
     1001//              case 6: // begin edit
     1002//                      break
     1003//              case 7: // finish edit
     1004//                      break
     1005//              case 13: // checkbox clicked (Igor 6.2 or later)
     1006//                      break
     1007//      endswitch
     1008//
     1009//      return 0
     1010//End
    9811011//**************************************************************************************
    9821012//**************************************************************************************
     
    12931323        if(DisplayBackg)       
    12941324                if(WaveExists(BackgroundIntWave)&&WaveExists(Background2ThetaWave))
    1295                         CheckDisplayed /W=IR3W_WAXSMainGraph BackgroundIntWave
    1296                         if(!V_Flag)
    1297                                 AppendToGraph/W=IR3W_WAXSMainGraph BackgroundIntWave vs Background2ThetaWave
    1298                                 ModifyGraph lstyle(BackgroundIntWave)=7,rgb(BackgroundIntWave)=(0,0,0)
     1325                        DoWIndow IR3W_WAXSMainGraph
     1326                        if(V_Flag)
     1327                                CheckDisplayed /W=IR3W_WAXSMainGraph BackgroundIntWave
     1328                                if(!V_Flag)
     1329                                        AppendToGraph/W=IR3W_WAXSMainGraph BackgroundIntWave vs Background2ThetaWave
     1330                                        ModifyGraph lstyle(BackgroundIntWave)=7,rgb(BackgroundIntWave)=(0,0,0)
     1331                                endif
    12991332                        endif
    13001333                endif
Note: See TracChangeset for help on using the changeset viewer.