Gaphor UI design
~~~~~~~~~~~~~~~~

Gaphor has quite a complex UI design. This is basically due to the fact that
Gaphor is very flexible and extensible.

Some advantages of the BonoboUI library are used to ease UI maintenance.
Gaphor uses (for example) BonoboUIEngine to ease creation of menu items.

For a start two windows will be created: a main window and a diagram edit
window. The main window will have the name 'gaphor' and the diagram
windows will have names like 'gaphor.diagram1'. where the number is increasing
every time a new diagram window is created.

Now we can distinguish 4 different places where menus appear:
  1. In the main menu. As argument the main window is provided.
  2. Popup in the main menu. Provided are the MainWindow and the model element
     under the cursor (from the UML package).

  3. The menubar in the diagram window. (with the DiagramWindow object as arg.)
  4. Popup in the diagram view. (DiagramWindow object and CanvasItem/DiagramItem
     are provided (or a list of canvas items)).
  
Menu items and their accompanied actions should tell Gaphor where they should
be displayed.

We'll name the contexts:
     context:		arguments:
  1. main.menu		window (gaphor.ui.MainWindow)
  2. main.popup		window (gaphor.ui.MainWindow),
  			element (gaphor.UML.Element)
  3. diagram.menu	window (gaphor.ui.DiagramWindow)
  4. diagram.popup	window (gaphor.ui.DiagramWindow),
  			item (gaphor.diagram.DiagramItem, focused item),
			item_list (list of selected DiagramItems)
  etc.

A command should tell in it's info which context should be provided.

Inside Bonobo
~~~~~~~~~~~~~
From a Bonobo point of view, the smallest thing in Gaphor will be the command.
A command is a piece of code that is executed. The command has some meta-info.
Things like a name, a label, a place in the menu structure etc.

Basically everything that is executed from a menu is implemented as a Command,
even the File->New operation.

For many items (such as File->New) there is a pre-defined place in the menu
structure. These menu items are defined in the gaphor-ui.xml file. Commands
are added dynamically. Commands should register themselves using a unique
name and a label or something.

  Something about Bonobo's structure
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
It's all about the BonoboWindow. The BonoboWindow has features for advanced
menu handling and some other things.
The menu's are created using a XML file. the XML file contains 4 sections:
  1. command, abstraction of menu items, make for easy adjustments
  2. menu, the menu structure containing submenu's, menuitem's and placeholder's
  3. popup menu, see 2
  4. toolbar

The commands will be registered in a CommandRegistry. The command registry is
capable of creating the xml that is needed for commands, as well as the
Command instances that will be used to execute the actual commands.

