[MPlayer-dev-eng] [PATCH] GUI: Implement a true rotary potmeter

Ingo Brückl ib at wupperonline.de
Mon Apr 7 10:55:59 CEST 2014


Hans-Dieter Kosch wrote on Mon, 07 Apr 2014 03:27:22 +0200:

> gui/app/gui.h:
> I wouldn't bother this header with math, defining M_2PI. Just use
> '(2*M_PI)' in place, the compiler folds it into a single constant anyway.

Thanks, changed.

> gui/skin/skin.c:
> The syntax using "'" appears somewhat strange to me.

Yeah, I don't like it much either, but...

> I see that you have chosen it for consistent parsing. Another solution
> could be to count the number of "," ahead. As the parsing checks for
> rpotmeter at that point anyway, we could check if there are 4 more ",".

...I didn't want the rpotmeter to have more parameters than the other ones.
(Well, it actually has to have and has more parameters, but I wanted to
somehow hide it.)

My first idea was to use the semicolon as delimeter, but it's already used
for comments.

So, do you have any idea how to nicely slip the four extra parameters?

> The special case 'x0 == x1 && y0 == y1' to determine if 'zeropoint' and
> 'stop' are the same seems not needed. There are more cases where this
> happens: x0 == 0 and x1 == 0 and y0 and y1 are in the same quadrant or vice
> versa.

Oops, you're right.

> So, simply calculate 'stop' and apply it.

Well, I did so at first, but I got a difference of something like 9E-17
after calculation for two same points. (Must have been late in the night when
I simply chose the current solution, but I should have investigated.)

> gui/ui/main.c and gui/ui/playbar.c:
> 'wsRLMouseButton' must regard the stop gap like 'wsMoveMouse' does,
> otherwise the potmeter's position may jump away after dragging and
> releasing (see my original patch).

You're right again.

> That's a code redundancy I mentioned earlier. Your new file
> 'gui/util/misc.c' could eventually be a place to outsource and in turn
> include such common code.

I'm planning to add ui/common.c or ui/ui.c for such ui specific code later.

> The stop gap doesn't work reliably for me. Seems to be dependent on speed
> of mouse movement, i.e. dependent on the actually captured positions.

At which speed do you encounter problems?

Large gaps like the one in the plastic skin may be more reliable than small
ones like the one in the standard skin.

Ingo


More information about the MPlayer-dev-eng mailing list