Opened 5 years ago

Closed 2 years ago

#25 closed enhancement (fixed)

Right clicking a layer - show previous state instead of show all layers

Reported by: ilija.melentijevic Owned by: Thomas Bernard
Priority: minor Milestone: 2.5
Component: GrafX2 Version: 2.4
Keywords: Cc:

Description

Current behaviour:

-right click visible layer to SOLO it (hide all other layers)
-right click again to show all layers

Suggested behaviour:

-right click visible layer to SOLO it (hide all other layers) - same as before
-right click again to revert to state before the first click (that is, show layers that were on, instead of showing all)

No idea how tricky this is (I suspect it might involve saving the previous state) but I just noticed that it slows down working with layers, having to manually hide helper layers again every now and then

Change History (6)

comment:1 Changed 2 years ago by Thomas Bernard

Owner: changed from Adrien Destugues to Thomas Bernard
Status: newaccepted

I'm working on this

comment:3 Changed 2 years ago by yrizoud@…

Hi thanks for taking this task. From looking at code, I see one issue : Main and Spare page., these should have their own separate variables. I suggest you use globals called Main_layers_visible_previous and Spare_layers_visible_previous , and exchange them when swapping Main<->Spare (an existing function does it for all existing Main_* and Spare_*)

I can't remember if you need to limit the number of set bits to the (current) number of layers (after all, you may "save" when there are 6 layers, and try restore after you've deleted 2 of them). I see the existing 0xFFFFFFFF was working, but I really can't remember if it was a special case or if the system actually safely ignored the "useless" bits.

For your info, note that the actual available layers change according to many actions : add, merge, remove, load image, copy to spare (which is one of the only actions that modifies the spare instead of Main_...) undo/redo (Which can change many things at once)... We currently don't track the identity of layers over time and over all these changes, so, well, there is no way to ensure that the "right" layer comes back after save + swap|insert|delete + load. Don't worry about it.

comment:4 Changed 2 years ago by Thomas Bernard

yrizoud: have you tried the new code and noticed any issue ?

I can tell you Main_layers_visible are tested for existing layers, but any extra bit is just ignored !
Code is

if ((1<<layer) & Main_layers_visible)
Last edited 2 years ago by Thomas Bernard (previous) (diff)

comment:5 Changed 2 years ago by Thomas Bernard

yrizoud: my last commit addresses the issue you are pointing about Main and Spare page separate variables : https://gitlab.com/GrafX2/grafX2/commit/2928a16e415d070936dc220f803eb086afa70d59

comment:6 Changed 2 years ago by Thomas Bernard

Resolution: fixed
Status: acceptedclosed
Note: See TracTickets for help on using tickets.