SDRPlusPlus icon indicating copy to clipboard operation
SDRPlusPlus copied to clipboard

Move exponential zoom logic to WaterFall::setZoom

Open ericek111 opened this issue 2 years ago • 4 comments

WaterFall::setZoom is declared in waterfall.h, but wasn't implemented.

I'm doing this in preparation of another PR.

ericek111 avatar Apr 16 '22 18:04 ericek111

It's not the waterfall's job to handle the zoom controls, hence why it was never implemented.

I'd rather delete the declaration instead

AlexandreRouma avatar Apr 16 '22 21:04 AlexandreRouma

I thought about that, but where else to put it? Is this more acceptable?

I want to implement scrolling with Ctrl+mwheel, as requested in #608, but I don't wanna duplicate the zoom algorithm.

EDIT: But then I'd be moving code better suited for the Waterfall class into main_window.cpp... I think that just going with the original commit is the lesser evil. It's 10 lines of code and only touches the waterfall, nothing else. EDIT2: Yes, having it in the waterfall class is 100 % more convenient. It's a small helper function directly related to the waterfall.

ericek111 avatar Apr 16 '22 22:04 ericek111

You're forgetting that the zoom slider is supposed to update when the zoom is changed. That's why the zoom code is not part of the waterfall. By the way, I'm not currently accepting feature pull requests since I don't have the time to validate the code. Moreover quite a bit of the code is currently changing for the android UI compatibility.

AlexandreRouma avatar Apr 16 '22 23:04 AlexandreRouma

I know, I realized. Forgive me for the abomination I have brought into this world. Check out the code now.

This is the most convenient (for future development) way that came to mind. And it's not terrible. Or maybe it is. I don't know... I'm keeping it in my fork, it works fine. Some way to decouple the logic between WaterFall and MainWindow should be found.

ericek111 avatar Apr 16 '22 23:04 ericek111

setZoom still isn't implemented: https://github.com/AlexandreRouma/SDRPlusPlus/blob/50a77a7e608d59cdf1633f223b6900c8e51da351/core/src/gui/widgets/waterfall.h#L147

ericek111 avatar Mar 11 '23 14:03 ericek111