- Timestamp:
- Dec 7, 2009 10:30:36 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Common/DataSetHandling.ipf
r609 r610 36 36 SetVariable OldName_setvar,fsize=12,value=_STR:"",noedit=2 37 37 SetVariable NewName_setvar,title="New Name (max 25 characters)",pos={50,140},size={400,20} 38 SetVariable NewName_setvar,fsize=12,value=_STR:"",proc= setvarproc,live=138 SetVariable NewName_setvar,fsize=12,value=_STR:"",proc=DANameSetvarproc,live=1 39 39 40 40 End … … 126 126 /////////////////////// Data Arithmetic Panel ///////////////////////////////////////// 127 127 128 // 128 129 Function MakeDAPanel() 130 DoWindow/F DataArithmeticPanel 131 if(V_flag==0) 132 fMakeDAPanel() 133 else 134 DoWindow/F DAPlotPanel 135 endif 136 137 return(0) 138 End 139 140 Function fMakeDAPanel() 129 141 PauseUpdate; Silent 1 // building window... 130 142 DoWindow/K DataArithmeticPanel 131 NewPanel /W=(459,44,959,404)/N=DataArithmeticPanel/K= 1as "Data Set Arithmetic"143 NewPanel /W=(459,44,959,404)/N=DataArithmeticPanel/K=2 as "Data Set Arithmetic" 132 144 ModifyPanel fixedSize=1 133 145 … … 149 161 PopupMenu DS2_popup,fsize=12,fcolor=(0,0,65535),valueColor=(0,0,65535) 150 162 151 Button DAPlot_button,title="Plot",pos={1 75,85},size={150,20}163 Button DAPlot_button,title="Plot",pos={100,85},size={150,20} 152 164 Button DAPlot_button,proc=DAPlotButtonProc 165 Button DADone_button,title="Done",pos={360,85},size={60,20} 166 Button DADone_button,proc=DADoneButtonProc 167 Button DAHelp_button,title="?",pos={440,85},size={30,20} 168 Button DAHelp_button,proc=DAHelpButtonProc 153 169 154 170 … … 166 182 167 183 SetVariable DAResultName_sv,title="Result Name (max 25 characters)",pos={50,280},size={400,20} 168 SetVariable DAResultName_Sv,fsize=12,proc= setvarproc,live=1184 SetVariable DAResultName_Sv,fsize=12,proc=DANameSetvarproc,live=1 169 185 //Update the result name 170 186 ControlInfo/W=DataArithmeticPanel DS1_popup … … 209 225 210 226 Display/HOST=DAPlotPanel/N=DAPlot/W=(0,0,440,400) 227 Legend 211 228 ShowInfo 212 229 SetActiveSubWindow DAPlotPanel 213 230 Checkbox DAPlot_log_cb, title="Log I(q)", pos={20,410},value=0 214 231 Checkbox DAPlot_log_cb, proc=DALogLinIProc 215 216 232 217 233 End … … 269 285 ModifyGraph/W=DAPlotPanel#DAPlot rgb(NullSolvent_i)=(0,0,65535) 270 286 //Cursor/W=DAPlotPanel#DAPlot A, NullSolvent_i, leftx(iWave) 271 //Cursor/W=DAPlotPanel#DAPlot/A=0 B, NullSolvent_i, rightx(iWave) 272 Cursor/W=DAPlotPanel#DAPlot A, $(DS1Name+"_i"), leftx(iWaveDS1) 273 Cursor/W=DAPlotPanel#DAPlot/A=0 B, $(DS1Name+"_i"), rightx(iWaveDS1) 287 //Cursor/W=DAPlotPanel#DAPlot/A=0 B, NullSolvent_i, rightx(iWave) 288 if(strlen(CsrInfo(A,"DAPlotPanel#DAPlot")) == 0) //cursors not already on the graph 289 Cursor/W=DAPlotPanel#DAPlot A, $(DS1Name+"_i"), leftx(iWaveDS1) 290 Cursor/W=DAPlotPanel#DAPlot/A=0 B, $(DS1Name+"_i"), rightx(iWaveDS1) 291 endif 274 292 endif 275 293 break … … 517 535 endif 518 536 ControlInfo/W=$(ba.win) DAResultName_sv 519 Resultname = S_Value 537 Resultname = CleanupName(S_Value, 0 ) //clean up any bad characters, and put the cleaned string back 538 SetVariable DAResultName_sv,value=_STR:ResultName 539 520 540 ControlInfo/W=$(ba.win) DAScale_sv 521 541 Variable Scalefactor = V_Value … … 547 567 ba2.ctrlName = "DAPlot_button" 548 568 ba2.eventCode = 2 549 DAPlotButtonProc(ba2) 569 570 // I've commented this out - the cursors get reset to the ends since this removes all sets from the graph, and 571 // then replots them. What is the real purpose of this call? To clear the old result off before adding the 572 // new one? 573 // DAPlotButtonProc(ba2) 574 ba2.userData = ResultName 575 DAPlotRemoveResult(ba2) 576 577 550 578 AddDAPlot(3) 551 579 DoWindow/F DataArithmeticPanel … … 554 582 555 583 End 584 585 // remove what is not the 586 // 587 Function DAPlotRemoveResult(ba) : ButtonControl 588 STRUCT WMButtonAction &ba 589 590 String win = ba.win 591 String ResultName = ba.userData 592 String item="",traceList="" 593 Variable ii=0,num 594 595 switch (ba.eventCode) 596 case 2: //mouse up 597 //data set 1 598 ControlInfo/W=$(win) DS1_popup 599 String DS1 = S_Value 600 601 //Get folder for DS2 602 ControlInfo/W=$(win) DS2_popup 603 String DS2 = S_Value 604 605 // state of the checkbox 606 ControlInfo/W=$(win) DANoDS2_cb 607 if(V_flag) 608 DS2 = "NullSolvent" 609 endif 610 611 DoWindow DAPlotPanel 612 if (V_Flag == 0) 613 MakeDAPlotPanel() 614 else 615 DoWindow/HIDE=0/F DAPlotPanel 616 traceList = TraceNameList("DAPlotPanel#DAPlot",";",1) 617 num=ItemsInList(traceList) 618 ii=0 619 do 620 item = StringFromList(ii,traceList,";") 621 if (stringmatch(item,ResultName+"*")==1) //it it's the specific trace I've asked to remove 622 RemoveFromGraph/W=DAPlotPanel#DAPlot $item 623 elseif (stringmatch(item,DS1+"*")==0 && stringmatch(item,DS2+"*")==0) //if it's not set1 & not set2 624 RemoveFromGraph/W=DAPlotPanel#DAPlot $item 625 endif 626 627 ii+=1 628 while(ii<num) 629 endif 630 631 break 632 endswitch 633 634 return 0 635 End 636 556 637 557 638 Function DAPlotButtonProc(ba) : ButtonControl … … 596 677 End 597 678 679 Function DADoneButtonProc(ba) : ButtonControl 680 STRUCT WMButtonAction &ba 681 682 String win = ba.win 683 684 switch (ba.eventCode) 685 case 2: 686 DoWindow/K DAPlotPanel 687 DoWindow/K DataArithmeticPanel 688 break 689 endswitch 690 691 return 0 692 End 693 694 Function DAHelpButtonProc(ba) : ButtonControl 695 STRUCT WMButtonAction &ba 696 697 String win = ba.win 698 699 switch (ba.eventCode) 700 case 2: 701 // click code here 702 DisplayHelpTopic/Z/K=1 "1D Arithmetic" 703 if(V_flag !=0) 704 DoAlert 0,"The 1D Arithmetic Help file could not be found" 705 endif 706 break 707 endswitch 708 709 return 0 710 End 711 598 712 Function DALogLinIProc(cba) : CheckBoxControl 599 713 STRUCT WMCheckBoxAction &cba … … 733 847 734 848 735 Function SetVarProc(sva) : SetVariableControl849 Function DANameSetvarproc(sva) : SetVariableControl 736 850 STRUCT WMSetVariableAction &sva 737 851
Note: See TracChangeset
for help on using the changeset viewer.