@@ -54,7 +54,8 @@ Function SF_PutFormulasToClipboard()
5454
5555 string table, txt, jsonTxt, formula
5656
57- table = GetCurrentWindow ()
57+ table = ROStr ( GetSweepFormulaLastRightClickedDisplayWindow ())
58+ ASSERT ( ! IsEmpty ( table) , "Expected window name" )
5859
5960 jsonTxt = GetUserData ( table, "" , SF_UDATA_TABLEFORMULAS)
6061 if ( ! IsEmpty ( jsonTxt))
@@ -619,7 +620,7 @@ static Function/S SF_NewSweepFormulaBaseWindow(string templateName, string graph
619620 NewPanel / N=$ win/ K=1/ W= ( 150, 400, 1000, 700 )
620621 elseif ( winType == WINTYPE_TABLE)
621622 Edit / N=$ win/ K=1/ W= ( 150, 400, 1000, 700 )
622- SF_AddTableExtras ( S_name)
623+ SF_AddTableExtrasSub ( S_name)
623624 else
624625 FATAL_ERROR ( "Unsupported window type" )
625626 endif
@@ -631,11 +632,16 @@ static Function/S SF_NewSweepFormulaBaseWindow(string templateName, string graph
631632 return win
632633End
633634
634- static Function SF_AddTableExtras ( string win)
635+ static Function SF_AddTableExtrasSub ( string win)
635636
636637 SetWindow $ win, tooltipHook ( sfTableTooltip) = SF_TableTooltipHook
637638End
638639
640+ static Function SF_AddTableExtrasMain ( string win)
641+
642+ SetWindow $ win, hook ( sfTableGetWindowName) = SF_TableWindowHook
643+ End
644+
639645static Function [WAVE/T plotGraphs, WAVE/WAVE infos] SF_PreparePlotter ( string winNameTemplate, string graph, variable winDisplayMode, variable numGraphs)
640646
641647 variable i , guidePos, restoreCursorInfo
@@ -677,12 +683,15 @@ static Function [WAVE/T plotGraphs, WAVE/WAVE infos] SF_PreparePlotter(string wi
677683 win = winNameTemplate + num2istr ( i )
678684 plotGraphs[ i ][ % GRAPH] = SF_NewSweepFormulaBaseWindow ( win, graph, winType = WINTYPE_GRAPH)
679685 win = winNameTemplateTable + num2istr ( i )
680- plotGraphs[ i ][ % TABLE] = SF_NewSweepFormulaBaseWindow ( win, graph, winType = WINTYPE_TABLE)
686+ winTable = SF_NewSweepFormulaBaseWindow ( win, graph, winType = WINTYPE_TABLE)
687+ SF_AddTableExtrasMain ( winTable)
688+ plotGraphs[ i ][ % TABLE] = winTable
681689 endfor
682690 elseif ( winDisplayMode == SF_DM_SUBWINDOWS)
683691
684692 win = SF_NewSweepFormulaBaseWindow ( winNameTemplate, graph)
685693 winTable = SF_NewSweepFormulaBaseWindow ( winNameTemplateTable, graph)
694+ SF_AddTableExtrasMain ( winTable)
686695
687696 // now we have an open panel without any subwindows
688697
@@ -710,7 +719,7 @@ static Function [WAVE/T plotGraphs, WAVE/WAVE infos] SF_PreparePlotter(string wi
710719 Display / HOST=$ win/ FG= ( customLeft, $ guideName1, customRight, $ guideName2 ) / N=$ ( "Graph" + num2str ( i ))
711720 plotGraphs[ i ][ % GRAPH] = win + "#" + S_name
712721 Edit / HOST=$ winTable/ FG= ( customLeft, $ guideName1, customRight, $ guideName2 ) / N=$ ( "Table" + num2str ( i ))
713- SF_AddTableExtras ( winTable + "#" + S_name)
722+ SF_AddTableExtrasSub ( winTable + "#" + S_name)
714723 plotGraphs[ i ][ % TABLE] = winTable + "#" + S_name
715724 endfor
716725 endif
@@ -2502,3 +2511,19 @@ Function SF_TableTooltipHook(STRUCT WMTooltipHookStruct &s)
25022511
25032512 return hookResult
25042513End
2514+
2515+ Function SF_TableWindowHook ( STRUCT WMWinHookStruct &s)
2516+
2517+ switch ( s. eventCode)
2518+ case EVENT_WINDOW_HOOK_MOUSEDOWN:
2519+ if ( s. eventMod & WINDOW_HOOK_EMOD_RIGHTCLICK)
2520+ SVAR win = $ GetSweepFormulaLastRightClickedDisplayWindow ()
2521+ win = s. winName
2522+ endif
2523+ break
2524+ default :
2525+ break
2526+ endswitch
2527+
2528+ return 0
2529+ End
0 commit comments