Repository navigation
Add groups of layers, with Group, Ungroup and drag and drop - #710
Conversation
A group gathers layers that follow one another in the stack. It is an element, like a layer: a name, an eye, a solo, a lock and an opacity, declared as settings. Its state adds to that of each of its layers: a layer is shown when its eye and that of its group are open, a group in solo puts its layers in solo, a locked group locks the shapes of its layers, and the opacity of a layer is multiplied by that of its group. MappingManager keeps the top level of the stack: layers in no group, and groups with their layers. A layer put in a group moves next to its other layers. A layer of a group moves among its layers only; a layer in no group moves over a whole group. Groups do not contain groups. Project files get a "groups" array at the top and a "group_id" in each layer of a group, both written only when there is a group, so that a project without groups keeps its bytes. A group without layers is kept, placed by its "depth": the number of layers above it. Links reach the settings of a group with the element "group". The list of layers does not show the groups yet: it follows their order.
OSC sets the name, eye, solo, lock and opacity of a group, by id or by a name pattern (/mapmap/group/visible), or any of its settings by path (/mapmap/group/<id>/<path>). /mapmap/layer/group puts a layer in a group, or takes it out with 0. MCP lists, creates and deletes groups (list_groups, create_group, delete_group, with or without their layers); set_property and list_settings take the kind "group"; list_layers gives the group of each layer, and get_state the number of groups.
/mapmap/layer/depth, the path form /mapmap/layer/<id>/depth and the MCP tool set_property changed the number of a layer but left it at its place in the stack, and the next move put the numbers back. Written once the layer is in a project, the depth now moves the layer to that row, from 0 at the top; past the bottom, to the bottom. A layer of a group stays in its group, as with move_layer. Read from a project file, the depth is only kept, so that the file keeps its bytes.
Quitting pauses playback, and pausing redrew the icon of every source through updateSourceItem(), which marks the project modified. So MapMap asked to save the project at every quit, even right after a save or with nothing changed. Playing and pausing are not saved in the project: their icons are now redrawn by showSourceItem(), which does not mark it. Editing a layer in the list (its name, eye, solo or lock) counted on that side effect to mark the project modified; it now does so itself. Fixes #605.
Each group is a row with its layers under it. Its eye, solo and lock
act on the group, even folded, and can be linked to a key or a pad
while learning. Selecting a group shows its page, with its opacity.
A folded group shows how many layers it holds, as "Trees (3)", and
keeps its fold in the project file ("collapsed"). Selecting a layer
of a folded group, as when a project opens, keeps the group folded.
Group (Ctrl+G) puts the layers selected in the list in a new group, named after them: "Truck 1" and "Truck 2" make "Truck". Ungroup (Ctrl+Shift+G) takes them out, and New Group adds a group without layers. Several layers are selected with Shift or Ctrl. Dropped onto a group, which the list frames, a layer goes into it; dropped between two rows, beside them. A group is dragged too, between the rows of the top level. The cross of a group, or Delete, deletes it with its layers, after asking. Each of these is one step to undo: the places of the stack before and after are kept.
In English the command and the page of a group are both "Group"; in other languages a verb and a noun. The tooltip of Ungroup says what happens to the group.
The other languages keep these texts untranslated: no speaker has read them yet.
|
Tried on Ubuntu 26.04 (Qt 6.10.2, Wayland) with the Ubuntu archive of commit 5559e7e, built by https://github.com/mapmapteam/mapmap/actions/runs/47451485623. Crash: right-click on a group
MapMap closes at once. The kernel log gives a segfault at address 0 in It happened twice in a row, at the same address.
Read from the code, not confirmed with a debugger: The menu needs a case for a group row, or at least to return when no layer is found. A test that asks for the menu on a group row would catch it. The rest of the demo has not been tried yet: only its first step, which works. |
|
The crash of a right-click on a group is fixed in a214858. The menu of the list of layers now opens on the row of a group, with the actions of a layer greyed and Delete, Ungroup and New Group kept. "Change Layer Source" is greyed too: chosen on a group, it crashed in the same way ( Right-click on the eye of the group "Arbre" of
Checked on Ubuntu 26.04 with a script of clicks on a display nobody sees ( Not checked: macOS and Windows. Nothing in the cause depends on the system. |

Summary
groups, andgroup_idon each layer: seedocs/project-format.md). A project without groups is written byte for byte as before./mapmap/group/...), and puts a layer in a group or takes it out (/mapmap/layer/group). MCP lists, creates and deletes groups (list_groups,create_group,delete_group). Seedocs/informations/osc.md.Also in this pull request:
/mapmap/layer/depth,/mapmap/layer/<id>/depthandset_propertyondepth, which changed the number of a layer but left it at its place in the stack. The layer now moves to that row.Translations: French and English only. The other eight languages keep the new texts untranslated: no speaker has read them.
Demo
Tests