Open shakenov-chinga opened 5 years ago
Hi @shakenov-chinga,
Made just a quick draft of focused layer feature. Please, take a look at video first. This is my development board I was doing as a hobby smiley
Wow, this is awesome! Both, the focused layer feature and your development board :smiley:
I couldn't find any connection between BGI-item classes and BoardEditor class, so store focused graphics layer variable in Board class, and whenever focused layer changes I emit attributesChanged signal, which is leads to BGI-items' paint function. This is where I decide how draw the items.
Yeah that's a bit ugly, but I also did something similar some time ago, see #67 ;) So generally I'm not against this "hack" until there is a nice solution for #67. But maybe you could at least move the "focused layer" attribute from Board
to BoardLayerStack
, as it's actually only related to the layer stack. And maybe you could emit the GraphicsLayer
's signal attributesChanged()
instead of the signal from the board? That way it should only trigger the repaint of affected graphics layers, not from the whole board. But I'm not 100% sure if that will really work, it's just a quick idea...
For now, unfocused layers color (gray in a background) is stored as a static constant variable in GraphicsLayer class.
Hmm could this color may be determined dynamically, for example by changing the saturation of the normal layer color by a specific value? Or should we give every layer a third color variant for their "disabled" state? Currently layers already have "normal" and "highlighted" colors, so it would somehow make sense to also add a "disabled" color or so...
I weren't able to detect where polygon and text paint functions are implemented.
libs/librepcb/common/graphics/
I'm looking forward for a pull request to test it by myself :)
Hi,
@ubruhin, I weren't able to find any connection between PrimitivePathGraphicsItem
and Board
. It can be hard-coded, passing Board
instance via constructor, but all of my inner self is refusing to do so :smiley:.
I think it would be very wise to fix architecture issues before adding new features. Should I finish this feature any way possible, or maybe I can look what I can do to help with architecture fixes. I realize that it will take a lot of time and there are things in higher priority, but I think it will require just function/class/variable rearrangements, and code inside functions will not change in most cases. And maybe I am wrong :smile:.
Best regards!
Hi, everybody! Made just a quick draft of focused layer feature. Please, take a look at video first. This is my development board I was doing as a hobby :smiley: Mainly, this feature was intended to see if blind/buried via is on editing layer. You can't see it on the video, but via will be drawn gray, if it is not on editing layer. Of course, there are a lot of cases that weren't taken into account.
There are, also, a lot of things that was difficult to do elegant way, so I implemented them straightforward ugly way:
BoardEditor
class, so store focused graphics layer variable inBoard
class, and whenever focused layer changes I emitattributesChanged
signal, which is leads to BGI-items'paint
function. This is where I decide how draw the items.GraphicsLayer
class.Now, if this feature is fit in this project, I ask your help to understand how layer focusing should work:
I hope you like it. Best regards! :smile: