[josm-dev] Layer specific history

Holger Mappt holgerosm at gmx.net
Fri Jan 1 17:28:40 UTC 2016


I'm in favor of a way that allows to undo layer specific actions.  But 
to have a separate history stack per layer doesn't work well.  Example: 
An OSM data layer, a GPX layer, and a geotagged image
layer are open.  The data layer is active and the images are correlated
to the GPX track.  That action goes into the geo image layer history 
because
that's where the images are.  But an "undo" would not undo the image-GPX 
correlation but the last data layer action because the data layer is 
active.  This might be confusing.

How about a combination of 1) and 2): The history is a linear list of 
actions.  Each action is associated with a layer.  All actions that 
belong to a layer form a virtual history stack.  Each action in the 
history list is either active or undone.  If an action is undone the 
according undone flag is set.  The default is to show/use the linear 
history like it is done now.  With a toggle button it can be switched to 
the (virtual) history of the current layer.  Only the actions of the 
active layer are considered now (history stack display and undo/redo). 
The border between active and undone actions is based on the undone 
flag.  Back to the full linear history: Undone actions that are in the 
active section and active actions in the undone section are grayed out 
to indicate that undo/redo will do nothing with such an action.  Grayed 
out actions are not skipped during undo/redo to keep the history linear. 
  If a grayed out undone action is undone with the linear history the 
color changes back to normal if there is no earlier undone action of the 
same layer because it can be redone now.  Same for the redo direction. 
Actions can be color coded to visualize the layer they belong to.  Each 
layer gets a unique color assigned.  Actions from different layers could 
be displayed like commits in branches are displayed in revision control 
system GUIs.  That will help to understand why grayed out actions cannot 
be undone/redone.

Many ifs and whens, but I think it could work.

Holger


On 2015-12-30 at 19:05 +0100 Vincent Privat wrote:
> I think 2) is the best solution. It remains simple for most users who
> work on a single modifiable layer at a time, but provides a nice
> flexibility for those who work on several layers.
> 3) is too complex. The less dialogs we have the best it is.
>
>
> 2015-12-29 17:16 GMT+01:00 Holger Mappt:
>     What is the recommended way to add a command history with undo/redo
>     functionality to a layer that is not an OSM data layer?  In this
>     case the GeoImageLayer.
>
>     I can imagine three options:
>     1) One linear history stack for all actions with one interface.
>     This is what is usually done in other software.  The interface is
>     the undo/redo in the edit menu and the main toolbar and the command
>     stack toggle dialog.
>
>     2) One history stack per layer with one interface.  Similar to 1),
>     but undo/redo applies only to the active layer.  This decouples the
>     actions done in different layers.  It requires that actions done in
>     one layer do not depend on actions in another layer.  "Layer" can
>     either be a single layer or one layer type.
>
>     To be useful the history needs a concept of "connected actions" and
>     the possibility to undo unconnected actions independently.  Example:
>     The key "opening_hours" is added to a POI node, then the key "name"
>     of an other PI node is changed.  To undo the opening_hours the name
>     change has to undone too with the current implementation.  But the
>     two POI nodes are not connected, it should be possible to undo
>     either change.



More information about the josm-dev mailing list