Ignore:
Timestamp:
Apr 7, 2010 11:00:01 AM (12 years ago)
Author:
srkline
Message:

Made the preference panel fancier, with a tab control. this makes it much easier to add more things in the future. Added two more SANS items to turn off some detector corrections. good for testing, but maybe a bit dangerous.

removed the SANSPreferences procedure file from the general includes list for reduction. kept it in the very old versions of the includes (510 and older) for backwards comaptibility. new experiments start with 520 or higher.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sans/Dev/trunk/NCNR_User_Procedures/Common/Packages/PlotManager/PlotUtilsMacro_v40.ipf

    r665 r668  
    12021202        DoWindow/F Pref_Panel 
    12031203        if(V_flag==0) 
    1204                 Init_Pref() 
     1204                Initialize_Preferences() 
    12051205                Pref_Panel() 
    12061206        Endif 
     
    12081208End 
    12091209 
    1210 Proc init_pref() 
     1210Proc Initialize_Preferences() 
    12111211        // create the globals here if they are not already present 
    12121212         
     
    12321232        Variable/G root:Packages:NIST:gNPhiSteps=val 
    12331233         
     1234        // flags to turn detector corrections on/off for testing (you should leave these ON) 
     1235        val = NumVarOrDefault("root:Packages:NIST:gDoDetectorEffCorr", 1 ) 
     1236        Variable/G root:Packages:NIST:gDoDetectorEffCorr = 1 
     1237         
     1238        val = NumVarOrDefault("root:Packages:NIST:gDoTransmissionCorr", 1 ) 
     1239        Variable/G root:Packages:NIST:gDoTransmissionCorr = 1 
     1240         
     1241         
    12341242        /// items for SANS Analysis 
    12351243         
     
    12851293End 
    12861294 
    1287 // draws the panel 
    1288 // each checkbox should actively change a global value 
    12891295Proc Pref_Panel() 
    12901296        PauseUpdate; Silent 1           // building window... 
    1291         NewPanel /W=(607,158,958,580)/K=2 as "SANS Preference Panel" 
     1297        NewPanel /W=(646,208,1070,468)/K=2 as "NCNR Preference Panel" 
    12921298        DoWindow/C pref_panel 
    12931299        ModifyPanel cbRGB=(49694,61514,27679) 
    12941300        SetDrawLayer UserBack 
    1295         DrawText 34,288,"nothing to set" 
    1296         DrawText 34,370,"nothing to set" 
    1297         CheckBox check0,pos={21,99},size={171,14},proc=LogScalePrefCheck,title="Use Log scaling for 2D data display" 
    1298         CheckBox check0,help={"Checking this will display 2D SANS data with a logarithmic color scale of neutron counts. If not checked, the color mapping will be linear."} 
    1299         CheckBox check0,value= root:Packages:NIST:gLogScalingAsDefault 
    1300         CheckBox check1,pos={21,119},size={163,14},proc=DRKProtocolPref,title="Allow DRK correction in protocols" 
    1301         CheckBox check1,help={"Checking this will allow DRK correction to be used in reduction protocols. You will need to re-draw the protocol panel for this change to be visible."} 
    1302         CheckBox check1,value= root:Packages:NIST:gAllowDRK 
    1303         CheckBox check2,pos={21,139},size={137,14},proc=UnityTransPref,title="Check for Transmission = 1" 
    1304         CheckBox check2,help={"Checking this will check for SAM or EMP Trans = 1 during data correction"} 
    1305         CheckBox check2,value= root:Packages:NIST:gDoTransCheck 
    1306         Button button0,pos={282,379},size={50,20},proc=PrefDoneButtonProc,title="Done" 
    1307         SetVariable setvar0,pos={21,169},size={200,15},title="Averaging Bin Width (pixels)" 
    1308         SetVariable setvar0,limits={1,100,1},value= root:Packages:NIST:gBinWidth 
    1309         SetVariable setvar1,pos={21,194},size={200,15},title="# Phi Steps (annular avg)" 
    1310         SetVariable setvar1,limits={1,360,1},value= root:Packages:NIST:gNPhiSteps 
    1311         CheckBox check3,pos={21,34},size={124,14},proc=XMLWritePref,title="Use canSAS XML Output" 
    1312         CheckBox check3,help={"Checking this will set the default output format to be canSAS XML rather than NIST 6 column"} 
    1313         CheckBox check3,value= root:Packages:NIST:gXML_Write 
    1314         GroupBox group0,pos={9,6},size={230,54},title="Global Preferences",fSize=12 
    1315         GroupBox group0_1,pos={9,74},size={230,149},title="SANS Reduction",fSize=12 
    1316         GroupBox group0_2,pos={9,238},size={230,68},title="USANS Reduction",fSize=12 
    1317         GroupBox group0_3,pos={9,319},size={230,68},title="Analysis",fSize=12 
    1318          
    1319         //keep these hidden for now so that nobody can accidentally change them from 
    1320         //the default values set in Initialize.ipf (128x128) 
    1321 //      SetVariable setvar2,pos={10,125},size={200,15},title="Detector Pixels (X)" 
    1322 //      SetVariable setvar2,limits={1,2000,1},value= root:Packages:NIST:gNPixelsX 
    1323 //      SetVariable setvar3,pos={10,145},size={200,15},title="Detector Pixels (Y)" 
    1324 //      SetVariable setvar3,limits={1,2000,1},value= root:Packages:NIST:gNPixelsY 
    1325  
    1326 End 
     1301        ModifyPanel fixedSize=1 
     1302////// 
     1303//on main portion of panel, always visible 
     1304        Button PrefPanelButtA,pos={354,12},size={50,20},proc=PrefDoneButtonProc,title="Done" 
     1305 
     1306        TabControl PrefTab,pos={7,49},size={410,202},tabLabel(0)="General",proc=PrefTabProc 
     1307        TabControl PrefTab,tabLabel(1)="SANS",tabLabel(2)="USANS",tabLabel(3)="Analysis" 
     1308        TabControl PrefTab,value=0 
     1309        TabControl PrefTab labelBack=(49694,61514,27679) 
     1310         
     1311//on tab(0) - General - initially visible 
     1312        CheckBox PrefChec_0a,pos={21,96},size={124,14},proc=XMLWritePref,title="Use canSAS XML Output" 
     1313        CheckBox PrefChec_0a,help={"Checking this will set the default output format to be canSAS XML rather than NIST 6 column"} 
     1314        CheckBox PrefChec_0a,value= root:Packages:NIST:gXML_Write 
     1315 
     1316//on tab(1) - SANS 
     1317        CheckBox PrefChec_1a,pos={21,100},size={171,14},proc=LogScalePrefCheck,title="Use Log scaling for 2D data display" 
     1318        CheckBox PrefChec_1a,help={"Checking this will display 2D SANS data with a logarithmic color scale of neutron counts. If not checked, the color mapping will be linear."} 
     1319        CheckBox PrefChec_1a,value= root:Packages:NIST:gLogScalingAsDefault 
     1320        CheckBox PrefChec_1b,pos={21,120},size={163,14},proc=DRKProtocolPref,title="Allow DRK correction in protocols" 
     1321        CheckBox PrefChec_1b,help={"Checking this will allow DRK correction to be used in reduction protocols. You will need to re-draw the protocol panel for this change to be visible."} 
     1322        CheckBox PrefChec_1b,value= root:Packages:NIST:gAllowDRK 
     1323        CheckBox PrefChec_1c,pos={21,140},size={137,14},proc=UnityTransPref,title="Check for Transmission = 1" 
     1324        CheckBox PrefChec_1c,help={"Checking this will check for SAM or EMP Trans = 1 during data correction"} 
     1325        CheckBox PrefChec_1c,value= root:Packages:NIST:gDoTransCheck 
     1326        SetVariable PrefSetV_1d,pos={21,170},size={200,15},title="Averaging Bin Width (pixels)" 
     1327        SetVariable PrefSetV_1d,limits={1,100,1},value= root:Packages:NIST:gBinWidth 
     1328        SetVariable PrefSetV_1e,pos={21,195},size={200,15},title="# Phi Steps (annular avg)" 
     1329        SetVariable PrefSetV_1e,limits={1,360,1},value= root:Packages:NIST:gNPhiSteps 
     1330        CheckBox PrefChec_1f title="Do Transmssion Correction?",size={140,14},value=1 
     1331        CheckBox PrefChec_1f pos={255,100},help={"TURN OFF ONLY FOR DEBUGGING. This corrects the data for angle dependent transmssion."} 
     1332        CheckBox PrefChec_1g title="Do Efficiency Correction?",size={140,14} 
     1333        CheckBox PrefChec_1g value=1,pos={255,120},help={"TURN OFF ONLY FOR DEBUGGING. This corrects the data for angle dependent detector efficiency."} 
     1334 
     1335 
     1336        CheckBox PrefChec_1a,disable=1 
     1337        CheckBox PrefChec_1b,disable=1 
     1338        CheckBox PrefChec_1c,disable=1 
     1339        SetVariable PrefSetV_1d,disable=1 
     1340        SetVariable PrefSetV_1e,disable=1 
     1341        CheckBox PrefChec_1f,disable=1 
     1342        CheckBox PrefChec_1g,disable=1 
     1343 
     1344//on tab(2) - USANS 
     1345        GroupBox PrefGrou_2a pos={21,100},size={1,1},title="nothing to set",fSize=12 
     1346 
     1347        GroupBox PrefGrou_2a,disable=1 
     1348 
     1349 
     1350//on tab(3) - Analysis 
     1351        GroupBox PrefGrou_3a pos={21,100},size={1,1},title="nothing to set",fSize=12 
     1352         
     1353        GroupBox PrefGrou_3a,disable=1 
     1354 
     1355EndMacro 
     1356 
     1357// function to control the drawing of controls in the TabControl on the main panel 
     1358// Naming scheme for the controls MUST be strictly adhered to... else controls will  
     1359// appear in odd places... 
     1360// all controls are named PrefCtrl_NA where N is the tab number and A is the letter denoting 
     1361// the controls position on that particular tab. 
     1362// in this way, they will always be drawn correctly.. 
     1363// 
     1364Function PrefTabProc(name,tab) 
     1365        String name 
     1366        Variable tab 
     1367         
     1368//      Print "name,number",name,tab 
     1369        String ctrlList = ControlNameList("",";"),item="",nameStr="" 
     1370        Variable num = ItemsinList(ctrlList,";"),ii,onTab 
     1371        for(ii=0;ii<num;ii+=1) 
     1372                //items all start w/"PrefCtrl_" 
     1373                item=StringFromList(ii, ctrlList ,";") 
     1374                nameStr=item[0,10] 
     1375                strswitch(item[0,7])     
     1376                        case "PrefChec":                 
     1377                                onTab = str2num(item[9]) 
     1378                                CheckBox $item,disable=(tab!=onTab) 
     1379                                break                                           // exit from switch 
     1380                        case "PrefSetV":                 
     1381                                onTab = str2num(item[9]) 
     1382                                SetVariable $item,disable=(tab!=onTab) 
     1383                                break 
     1384                        case "PrefGrou":                 
     1385                                onTab = str2num(item[9]) 
     1386                                GroupBox $item,disable=(tab!=onTab) 
     1387                                break 
     1388                        default: 
     1389                                        //do nothing for no match 
     1390                endswitch 
     1391         
     1392        endfor  
     1393End 
     1394 
Note: See TracChangeset for help on using the changeset viewer.