What is best practice for formatting TextArea wildcard strings in MVP model?
I'm no MVP expert, so would like to get the opinion of those who are.
I have a slider on a screen that controls the displayed value of a parameter in a TextArea widget above the slider. The slider position is converted to a floating point value and also scaled to be useful to my backend processing. For example, if I have a parameter that increments by 0.05, a value that I want to display as 5.05 would be presented as an integer scaled by 20 from the slider (e.g. 101), and then divided by 20 to produce the formatted string for the wildcard of the TextArea.
Currently in my View's SetupScreen(), I have:
ch2Amp = presenter->getCh2Amp();
Unicode::snprintfFloat(textArea_ch2ampvalBuffer, 20, "%#.2f", ((float)ch2Amp / 20.0));I also have a method called when the slider changes value:
void ScreenCH2AdjustView::AmpSliderChanged(int value)
{
presenter->saveCh2Amp(value);
Unicode::snprintfFloat(textAreaParamAmpBuffer, 20, "%#.2f", ((float)value / 20.0));
textAreaParamAmp.invalidate();
}So the slider value is saved in the model, but is scaled for display. My question is which is best form for adherence to the MVP model?
A) Perform all scaling and text formatting in the View.
B) Scale the value in the Presenter, but still create and display the formatted wildcard in the View.
C) Provide a pointer to the wildcard buffer to the Presenter, and perform all scaling and formatting of the wildcard buffer in the Presenter.
D) Something else (please suggest).
Thanks in advance for the advice.