kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #39249
Re: [PATCH] Build fixes: bitmaps and polygon
On 1/31/2019 1:15 PM, Simon Richter wrote:
> Hi,
>
> On 31.01.19 18:11, Simon Richter wrote:
>
>>> I would prefer that we create a base units object and then derived
>>> application level units objects as needed. These objects would be
>>> small, compile quickly, and could be included in the common library so
>>> they are available everywhere. Using 1nm units for schematics doesn't
>>> make a lot of sense to me even if/when we do convert to 64 bit integers.
>
>> Hm, we could get most of that by making the unit conversion functions in
>> BASE_SCREEN abstract, which would already dynamically dispatch most of
>> the unit conversions.
>
> Okay, I've tried that, and the situation is not as good as I've expected
> — we have way too much code that doesn't have a SCREEN context and thus
> needs to pull the conversion factor out of the macro definition.
I'm not surprised. If the fix were easy, we would have fixed it a long
time ago.
>
> I think it would be more work to pass the a screen reference (or a unit
> conversion object, so we can work without a screen) to all of these
> places than it would be to define a common conversion factor for everyone.
I don't think passing a screen reference around to non-ui code is a good
idea. The way I see it is the application specific units would be
static (singleton?) and used to initialize a BASE_SCREEN object
BASE_UNITS member variable at run time. In other words when a SCH_UNITS
object would be instantiated and used to set the BASE_UNITS member for
SCH_SCREEN objects. This way the static SCH_UNITS object can be used
for non-ui code directly and the BASE_SCREEN object can use it to
perform coordinate conversions. This is just a thought but there may be
a more elegant way to do it. Honestly, it's been a long time since I
looked at the units code so I maybe off base here.
>
> Simon
>
>
> _______________________________________________
> 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
>
References