Skip to content

Commit 15530ea

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 312c541 commit 15530ea

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
@@ -2423,7 +2423,8 @@ static Function PSX_FitAcceptAverage(string win, DFREF averageDFR, WAVE eventOns
24232423

24242424
specialEventPanel = PSX_GetSpecialPanel(win)
24252425

2426-
UpdateInfoButtonHelp(specialEventPanel, "button_fit_results", PSX_AVERAGE_FIT_RESULT_DEFAULT_HELP)
2426+
Make/T/FREE help = {PSX_AVERAGE_FIT_RESULT_DEFAULT_HELP}
2427+
UpdateInfoButtonHelp(specialEventPanel, "button_fit_results", help)
24272428

24282429
if(!GetCheckBoxState(specialEventPanel, "checkbox_average_events_fit"))
24292430
FastOp acceptedAverageFit = (NaN)
@@ -2551,8 +2552,7 @@ static Function PSX_FitAcceptAverage(string win, DFREF averageDFR, WAVE eventOns
25512552

25522553
Concatenate/NP/FREE {InputAvg, InputRise, InputDecay}, input
25532554

2554-
str = FormatTextWaveForLegend(input)
2555-
UpdateInfoButtonHelp(specialEventPanel, "button_fit_results", str)
2555+
UpdateInfoButtonHelp(specialEventPanel, "button_fit_results", input)
25562556

25572557
browser = SFH_GetBrowserForFormulaGraph(win)
25582558
PSX_StoreIntoResultsWave(browser, SFH_RESULT_TYPE_PSX_MISC, input, "accepted average fit results")
@@ -4331,9 +4331,8 @@ static Function PSX_AddLegend(string win, WAVE/WAVE results)
43314331

43324332
JSON_Release(jsonID)
43334333

4334-
str = FormatTextWaveForLegend(input)
43354334
mainWindow = GetMainWindow(win)
4336-
UpdateInfoButtonHelp(mainWindow, "button_psx_info", str)
4335+
UpdateInfoButtonHelp(mainWindow, "button_psx_info", input)
43374336
End
43384337

43394338
/// @brief Return the event, wave and combo index
@@ -5945,7 +5944,8 @@ Function PSX_PlotStartupSettings()
59455944

59465945
for(ctrl : infoButtons)
59475946
if(ControlExists(subwin, ctrl))
5948-
UpdateInfoButtonHelp(subwin, ctrl, NONE)
5947+
Make/T/FREE help = {NONE}
5948+
UpdateInfoButtonHelp(subwin, ctrl, help)
59495949
endif
59505950
endfor
59515951
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, "\n", colSep = ";")
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)