Skip to content

Commit c8f672a

Browse files
committed
UpdateInfoButtonHelp: Set machine-readable text for C&P
By accepting the text wave to be pretty printed we can let the visualized data and the data copied to the clipboard differ so that the latter can be more easily C&P'ed into tab calculations like Excel/Calc.
1 parent 92cd2d7 commit c8f672a

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

Packages/MIES/MIES_SweepFormula_PSX.ipf

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2308,7 +2308,8 @@ static Function PSX_FitAcceptAverage(string win, DFREF averageDFR, WAVE eventSto
23082308

23092309
specialEventPanel = PSX_GetSpecialPanel(win)
23102310

2311-
UpdateInfoButtonHelp(specialEventPanel, "button_fit_results", PSX_AVERAGE_FIT_RESULT_DEFAULT_HELP)
2311+
Make/T/FREE help = {PSX_AVERAGE_FIT_RESULT_DEFAULT_HELP}
2312+
UpdateInfoButtonHelp(specialEventPanel, "button_fit_results", help)
23122313

23132314
if(!GetCheckBoxState(specialEventPanel, "checkbox_average_events_fit"))
23142315
FastOp acceptedAverageFit = (NaN)
@@ -2370,8 +2371,7 @@ static Function PSX_FitAcceptAverage(string win, DFREF averageDFR, WAVE eventSto
23702371
input[7][0, 1] = {{"State source"}, {PSX_GetStateTypeFromSpecialPanel(win)}}
23712372
input[8][0, 1] = {{"Current combo"}, {ToTrueFalse(PSX_GetrestrictEventsToCurrentCombo(win))}}
23722373

2373-
str = FormatTextWaveForLegend(input)
2374-
UpdateInfoButtonHelp(specialEventPanel, "button_fit_results", str)
2374+
UpdateInfoButtonHelp(specialEventPanel, "button_fit_results", input)
23752375

23762376
browser = SFH_GetBrowserForFormulaGraph(win)
23772377
PSX_StoreIntoResultsWave(browser, SFH_RESULT_TYPE_PSX_MISC, input, "accepted average fit results")
@@ -4051,9 +4051,8 @@ static Function PSX_AddLegend(string win, WAVE/WAVE results)
40514051

40524052
JSON_Release(jsonID)
40534053

4054-
str = FormatTextWaveForLegend(input)
40554054
mainWindow = GetMainWindow(win)
4056-
UpdateInfoButtonHelp(mainWindow, "button_psx_info", str)
4055+
UpdateInfoButtonHelp(mainWindow, "button_psx_info", input)
40574056
End
40584057

40594058
/// @brief Return the event, wave and combo index
@@ -5624,7 +5623,8 @@ Function PSX_PlotStartupSettings()
56245623

56255624
for(ctrl : infoButtons)
56265625
if(ControlExists(subwin, ctrl))
5627-
UpdateInfoButtonHelp(subwin, ctrl, NONE)
5626+
Make/T/FREE help = {NONE}
5627+
UpdateInfoButtonHelp(subwin, ctrl, help)
56285628
endif
56295629
endfor
56305630
endfor

Packages/MIES/MIES_Utilities_GUI.ipf

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -387,11 +387,15 @@ Function IsValidTraceDisplayMode(variable traceDisplayCode)
387387
End
388388

389389
/// @brief Update the help and user data of a button used as info/copy button
390-
Function UpdateInfoButtonHelp(string win, string ctrl, string content)
390+
Function UpdateInfoButtonHelp(string win, string ctrl, WAVE info)
391391

392-
string htmlStr = "<pre>" + content + "</pre>"
392+
string gui, calc, htmlStr
393393

394-
Button $ctrl, win=$win, help={htmlStr}, userdata=content
394+
calc = TextWaveToList(info, "\r\n", colSep = "\t")
395+
gui = FormatTextWaveForLegend(info)
396+
htmlStr = "<pre>" + gui + "</pre>"
397+
398+
Button $ctrl, win=$win, help={htmlStr}, userdata=calc
395399
End
396400

397401
/// @brief Custom graph marquee

0 commit comments

Comments
 (0)