kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #34323
Re: A fix for our TEXT_CTRL_EVAL class.
Le 25/02/2018 à 15:03, Jeff Young a écrit :
> Cool. Thanks for the confirmation, Michael.
>
> BTW, JP, could you let me know if you’re going to make this change. I’ve been doing some work in
> the NumericEvaluator to support the new units architecture and the hungarian notation is starting to
> hurt my brain, so I’d like to reformat it (for 6.0, of course, but the fewer merge conflicts the
> better).
>
> Cheers,
> Jeff.
I do not want to modify myself the code associated to TEXT_CTRL_EVAL, because do not really know
this code.
This is the reason my fix does not really change the current code.
I'll leave these changes to guys who know the NumericEvaluator code.
>
>
>> On 25 Feb 2018, at 12:40, Michael Geselbracht <mgeselbracht3@xxxxxxxxx
>> <mailto:mgeselbracht3@xxxxxxxxx>> wrote:
>>
>> The original idea was to have one evaluator object per dialog so that several text entries could
>> access a common set of variables.
>> Now that there is one evaluator object per entry field I think there is no reason to retain the
>> (single) input text in clear().
>> If there is ever to be support for variables the class could be extended to support a shared
>> object with a map of variables. This could be useful in the footprint editor.
>>
>>
>>
>> On 25.02.2018 12:37, Jeff Young wrote:
>>> Hmmm, pObj isn’t stored. Since we use an instance of NumericEvaluator for each control, we don’t
>>> actually need the storage to be a map (there’s only ever one key in it). For now, probably
>>> easiest to just do:
>>>
>>> NumericEvaluator::clear(constvoid*pObj)
>>> {
>>> free(clToken.token);
>>> clToken.token=nullptr;
>>> clToken.input=nullptr;
>>> bClError=true;
>>> +
>>> +if(bClTextInputStorage)
>>> +clObjMap.clear();
>>> }
>>>
>>>
>>>> On 25 Feb 2018, at 11:26, Jeff Young <jeff@xxxxxxxxx <mailto:jeff@xxxxxxxxx>> wrote:
>>>>
>>>> Hi JP,
>>>>
>>>> Rather than calling evaluate() in the new TEXT_CTRL_EVAL::SetValue(), I’d call clear(), and add
>>>> these two lines to NumericEvaluator::clear():
>>>>
>>>> void
>>>> NumericEvaluator::clear()
>>>> {
>>>> free(clToken.token);
>>>> clToken.token=nullptr;
>>>> clToken.input=nullptr;
>>>> bClError=true;
>>>> +
>>>> +if(bClTextInputStorage)
>>>> +clObjMap[pObj]=nullptr;
>>>> }
>>>> That will zero out the stored text.
>>>>
>>>> Cheers,
>>>> Jeff.
>>>>
>>>>
>>>>
>>>>> On 25 Feb 2018, at 10:17, jp charras <jp.charras@xxxxxxxxxx <mailto:jp.charras@xxxxxxxxxx>> wrote:
>>>>>
>>>>> Hi Orson,
>>>>>
>>>>> Could you have a look into this small patch.
>>>>> I am not sure I used the better way to fix an issue.
>>>>>
>>>>> It fixes an issue when using SetValue() to change the value shown by this widget.
>>>>>
>>>>> The issue was due to the fact TEXT_CTRL_EVAL stores internally the last entered value in a buffer.
>>>>> So when calling SetValue() after a value was already entered, and if we try to modify
>>>>> the displayed value by calling SetValue(), as soon as the widget has the focus, the previous value
>>>>> replaces the new value.
>>>>>
>>>>> This is easy to see in Move Exactly dialog:
>>>>> - enter a value
>>>>> - reset the value by the Reset button
>>>>> - move the cursor to the corresponding text control widgets and click on it to give it the focus.
>>>>>
>>>>> --
>>>>> Jean-Pierre CHARRAS
>>>>> <fix_text_ctrl_eval_SetValue.patch>_______________________________________________
>>>>> Mailing list: https://launchpad.net/~kicad-developers <https://launchpad.net/%7Ekicad-developers>
>>>>> Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
>>>>> Unsubscribe : https://launchpad.net/~kicad-developers <https://launchpad.net/%7Ekicad-developers>
>>>>> More help : https://help.launchpad.net/ListHelp
>>>>
>>>> _______________________________________________
>>>> Mailing list: https://launchpad.net/~kicad-developers <https://launchpad.net/%7Ekicad-developers>
>>>> Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
>>>> Unsubscribe : https://launchpad.net/~kicad-developers <https://launchpad.net/%7Ekicad-developers>
>>>> More help : https://help.launchpad.net/ListHelp
>>>
>>>
>>>
>>> _______________________________________________
>>> Mailing list: https://launchpad.net/~kicad-developers
>>> Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx
>>> Unsubscribe : https://launchpad.net/~kicad-developers
>>> More help : https://help.launchpad.net/ListHelp
>>
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~kicad-developers <https://launchpad.net/%7Ekicad-developers>
>> Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
>> Unsubscribe : https://launchpad.net/~kicad-developers <https://launchpad.net/%7Ekicad-developers>
>> More help : https://help.launchpad.net/ListHelp
>
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help : https://help.launchpad.net/ListHelp
>
--
Jean-Pierre CHARRAS
Follow ups
References