← Back to team overview

kicad-developers team mailing list archive

Re: Static variables in module editor

 

On 06/10/2014 10:26 AM, Lorenzo Marcantonio wrote:
On Tue, Jun 10, 2014 at 10:18:57AM +0200, Maciej Sumiński wrote:
Hi,

I have found a few static variables in the module editor code that I would
like to remove, but I need to know your opinion. The variables are used to
keep the last edited module between editor invocations.

Ah these. I stumbled in them, too... the 'default' thing in pcbnew often
works only the first time, until you confirm something; after that, it
becomes the new default. Example, text size: default text size is saved
in the ini file from the settings and it's used the first time you add
text. However when you edit the text side of an object, *that* becomes
the new default until you restart pcbnew or edit another object. So it's
"default until I have another value picked as default". Curious but it
actually works well.

I see the point of keeping last settings, but should the footprint become a new default too? It is much more than e.g. text size, which is common for many instances.

If we want to preserve such behaviour, I will need to add a few more static
variables (for sure VIEW, maybe VIEW_CONTROLS and some stuff related to the
Tool Framework). I would rather avoid such solution.

For the OO purists statics are Evil. YMMV. For the current behaviour
I think they are the best solution.

Given that we want to preserve the behaviour - I do not see any other sensible solution at the moment.

Regards,
Orson


Follow ups

References