Greetings,

I'm currently working on implementing a windows menu but I'd like some
feedback before continuing. There's a WIP patch and screenshot attached
to the ticket [1].

>From what I can tell, there are four kinds of windows used in JOSM:
* modal dialogs, they are not covered here because they block access
  to the menu anyway
* additional windows that my be opened anytime and could probably work
  as a stand alone application (I only found the changeset manager to
  fall into this category)
* toggle dialogs (the ones on the right hand side)
* windows that can't be opened from this menu because they depend on
  something (e.g. relation editors, the help window)

The current iteration displays the three latter groups and allows toggle
dialogs to be toggled there. The changeset manager can be toggled, too,
but that's just because I didn't change its previous implementation.
Windows in the last group are only focused/repositioned when clicking
the menu item.

Questions I have so far:
* correct approach? Missed any cases?
* what other non-model windows fall into the last category?

Toggle dialogs are present in the menu at all times, even when they
cannot be shown because no layer is loaded. The reason is that these
menu entries should be able to be added to the toolbar as well.
Therefore they need to be added to the menu before creating the toolbar.
As it works and doesn't throw any errors, I didn't bother disabling them
when no map is present.

More important though: to achieve this I create the map frame once on
start and never destroy it. Is there any disadvantage I missed? I know
about the bug where the view in the download diag is reset to 0.0, 0.0
and that code depending on notifyMapFrameChanged will have to be
adjusted and simply assume the map frame is there.

Still need to figure out a way to make toolbar buttons actually
toggle-able and to prevent windows from the last group to appear in the
toolbar-prefs if toolbar.updateUI is called after they have been opened.

The patch contains some utility functions that allow menus to be split
into groups using a separator and items only need to state the group
they belong to. Showing/removing (un)necessary separators is the handled
by the menu. Will likely put this into a different patch, this system
might be easier for plugins to put an item into the correct position.

--Stefan

[1] http://josm.openstreetmap.de/ticket/59#trac-change-10

_______________________________________________
josm-dev mailing list
josm-dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/josm-dev

Reply via email to