root/gaphor/tags/gaphor-0.3.0/doc/ui-design.txt

Revision 173, 2.8 kB (checked in by arjanmol, 6 years ago)

*** empty log message ***

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 Gaphor UI design
2 ~~~~~~~~~~~~~~~~
3
4 Gaphor has quite a complex UI design. This is basically due to the fact that
5 Gaphor is very flexible and extensible.
6
7 Some advantages of the BonoboUI library are used to ease UI maintenance.
8 Gaphor uses (for example) BonoboUIEngine to ease creation of menu items.
9
10 For a start two windows will be created: a main window and a diagram edit
11 window. The main window will have the name 'gaphor' and the diagram
12 windows will have names like 'gaphor.diagram1'. where the number is increasing
13 every time a new diagram window is created.
14
15 Now we can distinguish 4 different places where menus appear:
16   1. In the main menu. As argument the main window is provided.
17   2. Popup in the main menu. Provided are the MainWindow and the model element
18      under the cursor (from the UML package).
19
20   3. The menubar in the diagram window. (with the DiagramWindow object as arg.)
21   4. Popup in the diagram view. (DiagramWindow object and CanvasItem/DiagramItem
22      are provided (or a list of canvas items)).
23  
24 Menu items and their accompanied actions should tell Gaphor where they should
25 be displayed.
26
27 We'll name the contexts:
28      context:           arguments:
29   1. main.menu          window (gaphor.ui.MainWindow)
30   2. main.popup         window (gaphor.ui.MainWindow),
31                         element (gaphor.UML.Element)
32   3. diagram.menu       window (gaphor.ui.DiagramWindow)
33   4. diagram.popup      window (gaphor.ui.DiagramWindow),
34                         item (gaphor.diagram.DiagramItem, focused item),
35                         item_list (list of selected DiagramItems)
36   etc.
37
38 A command should tell in it's info which context should be provided.
39
40 Inside Bonobo
41 ~~~~~~~~~~~~~
42 From a Bonobo point of view, the smallest thing in Gaphor will be the command.
43 A command is a piece of code that is executed. The command has some meta-info.
44 Things like a name, a label, a place in the menu structure etc.
45
46 Basically everything that is executed from a menu is implemented as a Command,
47 even the File->New operation.
48
49 For many items (such as File->New) there is a pre-defined place in the menu
50 structure. These menu items are defined in the gaphor-ui.xml file. Commands
51 are added dynamically. Commands should register themselves using a unique
52 name and a label or something.
53
54   Something about Bonobo's structure
55   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
56 It's all about the BonoboWindow. The BonoboWindow has features for advanced
57 menu handling and some other things.
58 The menu's are created using a XML file. the XML file contains 4 sections:
59   1. command, abstraction of menu items, make for easy adjustments
60   2. menu, the menu structure containing submenu's, menuitem's and placeholder's
61   3. popup menu, see 2
62   4. toolbar
63
64 The commands will be registered in a CommandRegistry. The command registry is
65 capable of creating the xml that is needed for commands, as well as the
66 Command instances that will be used to execute the actual commands.
67
Note: See TracBrowser for help on using the browser.