@@ -425,10 +425,27 @@ Function/S SB_GetSweepList(win)
425
425
WAVE /T map = SB_GetSweepBrowserMapFromGraph ( win)
426
426
427
427
numRows = GetNumberFromWaveNote ( map, NOTE_INDEX)
428
- for ( i = 0; i < numRows; i += 1 )
429
- sprintf str, "Sweep %d [%s.%s]" , str2num ( map[ i ][ % Sweep]) , ReplaceString ( ";" , GetBaseName ( map[ i ][ % FileName]) , "_" ) , GetFileSuffix ( map[ i ][ % FileName])
430
- list = AddListItem ( str, list, ";" , Inf )
431
- endfor
428
+
429
+ if ( ! numRows)
430
+ return ""
431
+ endif
432
+
433
+ Duplicate / FREE/ RMD= [ 0, numRows - 1 ][ FindDimlabel ( map, COLS, "FileName" )] map, filenames
434
+
435
+ WAVE /T uniqueEntries = GetUniqueEntries ( filenames)
436
+
437
+ // all sweeps are from the same experiment, use a less verbose list format
438
+ if ( DimSize ( uniqueEntries, ROWS) == 1 )
439
+ for ( i = 0; i < numRows; i += 1 )
440
+ sprintf str, "Sweep %d" , str2num ( map[ i ][ % Sweep])
441
+ list = AddListItem ( str, list, ";" , Inf )
442
+ endfor
443
+ else
444
+ for ( i = 0; i < numRows; i += 1 )
445
+ sprintf str, "Sweep %d [%s.%s]" , str2num ( map[ i ][ % Sweep]) , ReplaceString ( ";" , GetBaseName ( map[ i ][ % FileName]) , "_" ) , GetFileSuffix ( map[ i ][ % FileName])
446
+ list = AddListItem ( str, list, ";" , Inf )
447
+ endfor
448
+ endif
432
449
433
450
return list
434
451
End
@@ -517,16 +534,18 @@ Function SB_PopupMenuSelectSweep(pa) : PopupMenuControl
517
534
STRUCT WMPopupAction & pa
518
535
519
536
string win, scPanel
520
- variable newSweep
537
+ variable newSweep, newIndex
521
538
522
539
switch ( pa. eventCode)
523
540
case 2: // mouse up
524
541
win = pa. win
525
- newSweep = pa. popNum - 1
542
+ WAVE sweeps = SB_GetPlainSweepList ( win)
543
+ newIndex = pa. popNum - 1
544
+ newSweep = sweeps[ newIndex]
526
545
SetSetVariable ( win, "setvar_SweepControl_SweepNo" , newSweep)
527
546
528
547
if ( OVS_IsActive ( win))
529
- OVS_ChangeSweepSelectionState ( win, CHECKBOX_SELECTED, index= newSweep )
548
+ OVS_ChangeSweepSelectionState ( win, CHECKBOX_SELECTED, index= newIndex )
530
549
else
531
550
UpdateSweepPlot ( win)
532
551
endif
0 commit comments