discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SMDoubleSlider usability on GNUstep


From: Fred Kiefer
Subject: Re: SMDoubleSlider usability on GNUstep
Date: Mon, 12 Mar 2018 00:29:51 +0100


> Am 23.02.2018 um 13:32 schrieb Yavor Doganov <yavor@gnu.org>:
> 
> В Tue, 20 Feb 2018 23:13:21 +0200, Yavor Doganov написа:
> 
>> I turned NSCell's -setObjectValue: to a private method and changed all
>> -set*Value: methods to use it.  My test program doesn't crash now and I
>> can see the two knobs.  Movement is awkward (no sliding effect) and if I
>> click on the first knob the second one disappears.
> 
> I reverted this change as it is causing the awkwardness, among other
> problems.  Instead, I disabled SMDoubleSliderCell's -setObjectValue:
> so that NSCell's method is always used.  It seems to be working
> properly except:
> 
> 1. When the high knob is not set to a particular value with
> -set*HiValue: it is not displayed initially.  However, if I click on
> the right side of the bar both knobs become visible.
> 
> 2. Possibly related with the above issue, if I click on the low knob,
> the high knob disappears.  It is visible where it should be during
> NSCell -trackMouse:inRect:ofView:untilMouseUp: but as soon as the
> mouse is up it disappears again.  When tracking the high knob both
> knobs are visible as expected.
> 
> I believe these are GNUstep bugs or at least there is a difference in
> the behavior compared to Cocoa (assuming the code works as expected on
> Cocoa).
> 
>> Is it a problem that SMDoubleSliderCell overrides both -drawKnob: and
>> -drawKnob?
> 
> I tried merging them into -drawKnob: only, no difference in the
> behavior except that the high knob is not visible when the low knob is
> being moved with the mouse.
> 
> 3. When the low knob is moved at the beginning of the bar, it becomes
> locked and can no longer be moved with the mouse.  This seems to be
> caused by this code in SMDoubleSliderCell's -startTrackingAt:inView:
> 
>    if ( [ self trackingLoKnob ] && NSEqualRects( loKnobRect,
>                [ self knobRectFlipped:[ controlView isFlipped ] ] ) )
>        [ self setTrackingLoKnob:( _sm_loValue > [ self minValue ] ) ];
> 
> When _sm_loValue is 0 or lower than minValue (in cases when minValue
> is set explicitly to a positive value), the boolean expression is
> false and only the high knob can be tracked; the low knob remains
> blocked indefinitely.  I replaced > with >= and it solves the problem,
> although it has the same effect as disabling this check entirely.  It
> seems bogus to me, the two knobs cannot overlap.

I committed a change to NSSliderCell that should fix all of the above issues as 
well as the original problem. This is done by directly using the value in many 
of the slider cell methods instead of accessing it via the method.  This brings 
our implementation of that class closer to the Apple version. But in my opinion 
this also reduces the software quality for that class. Please have a look at 
the change yourself to confirm this. We now copy the same code over and over 
again.

In another mail you asked me to implement some additional changes that David 
suggested in his original mails. I won’t do this, not just because the analysis 
of these mails was wrong, but also because this would even further reduce our 
code quality. Having similar behaviour to the Apple implementation is very 
important to me but we need a better argument than that to make our code worse.

Cheers,
Fred


reply via email to

[Prev in Thread] Current Thread [Next in Thread]