GNOME Bugzilla – Bug 59105
Cannot move objects to new layers
Last modified: 2009-01-20 23:24:00 UTC
The only way that I have found to move an object from one layer to another is to cut the object, change to the destination layer, and paste the object. Unfortunately, the position of and connections to the object are lost. It should be possible to move one or more objects to a different layer, without changing anything else. One interface I would suggest is via the property dialog of the object. I envision a general "graphical" page that allows layer, line type, and other generic properties to be changed. A separate command for operating on multiple objects may also be required.
This makes sense, but is a bit tough to implement. Hmmm. An idea would be a PROP_TYPE_LAYER property ; problem is, an object does not know what layer it's in or even the concept of a diagram. Random thoughts on how to bail out of this: <semi-kludge> * have a "gpointer temp_diagram_extra_data" in Object * before editing the properties, the right Expert in app/ sets obj->diagram_extra_data to point to a structure which holds the list of layers and the layer this object is in (or NULL if we edit a group of objects on several layer, if such thing is possible). * PROP_TYPE_LAYER's implementation knows how to display the current layer in a sensible way, and how to modify the structure pointed to by obj->diagram_extra_data. * after editing the properties, obj->temp_diagram_extra_data is inspected for changes, and if that happened, the object is changed from layer. * finally, obj->diagram_extra_data is reset to NULL. * the object *never* touches or never cares about obj->temp_diagram_extra_data, except through StdProp. Exception for perhaps for UrShapes if they gain momentum. Classic objects must die and will lack the "layer" control. * PROP_TYPE_LAYER is only used through PROP_STD_LAYER and PROP_STD_OFS_LAYER (actually, built into OBJECT_COMMON_PROPERTIES and _OFFSETS). PROP_STD_LAYER is of course PROP_FLAG_DONT_SAVE|PROP_FLAG_NO_DEFAULT (the latter is new, but necessary for props you don't want to set as defaults but want to merge between live objects. I'll commit that detail right now). </semi-kludge> Actually, there is no need to actually define PROP_TYPE_LAYER ; let's just use the "layer" string, so that people don't get tempted to put other "nifty layer" controls. James, what do you think of this ?
Lars' recent changes (committed or about to be committed) add a link to the layer to each object, and a link from each layer to its diagram. This should enable the implementation of this feature request without my overboard PROP_* kludges.
Mass reassign of bugs to dia-maint@bugzilla.gnome.org.
Note that you can select everything connected to an object with Select->Transitive. Thus, moving a cluster of objects without losing their connection points is possible.
Just letting you know that the reporter's mail is bouncing.
What is the status of this feature request? I'm using dia 0.94 and I find that I often need to move objects between layers. To do this with the current version I have to cut and paste, reposition, and then reconnect the moved objects. The problem with repositioning could have been avoided if there were a "clone" command which preserved positions. The connection problem is worse. Note that the problem is not the transfer of internal connections within the moved group of objects. It is the connections between the moved objects and other objects in the original layer that have to be reconnected by hand. This can be quite a lot of work for large diagrams.
0.95 was released some month ago, 0.96 - whenever it is ready - will have the following feature 2006-07-16 Hans Breuer <hans@breuer.org> * app/cut_n_paste.[hc] : maintain a generation counter to count how many times the stored object list is used * app/commands.c : use the generation for paste placement. The first one after cut is not moved at all: a nice way to move objects between layers without changing their lateral position. Also sprinkled some diagram_update_extents()
Great, that takes care of one of the problems. But isn't it still necessary to reconnect all connections from the moved group to other objects? Should I open a new bug for that problem?
I dont understand. If the objects moved are connected before the cut they still will be connected after the paste. What more do you expect?
Sorry if I'm confusing this issue. Let me describe it like this. Start with object1 and object2 and a connection between them, all in layer1. I want to move object2 to layer2 without losing the connection to object1 which remains in layer1. Maybe I'm missing something but in 0.95 the objects have to be reconnected by hand. If the connection is included when cutting and pasting, it will be connected to object2 but not object1. If the connection is not included when cutting and pasting, it will be connected to object1 but not object2. Will these connections be preserved between layers in 0.96? Maybe that's not what is wanted when pasting in other situations?
Fredrik, your explanation makes sense, and it did not make it into 0.96. The beginnings of the functionality is there in app/commands.c (move_objects_up_layer and move_objects_down_layer), but some more work on undo is needed for it to work.
*** Bug 395405 has been marked as a duplicate of this bug. ***
will be part of 0.97: 2009-01-20 Hans Breuer <hans@breuer.org> * app/undo.[ch] app/commands.[ch] app/menus.c app/diagram.c data/*-ui. : implement "Objects/Move to layer above/below" (maintaining connections between layers). Fixes bug #59105. * samples/undo-check.dia a diagram to play with the above