Bug #569


enabling/diabling menus and toolbars in MorphoFrame

Added by Matt Jones almost 22 years ago. Updated almost 22 years ago.

morpho - general
Target version:
Start date:
Due date:
% Done:


Estimated time:


In the current architecture, each MorphoFrame's menus and toolbars are created
by the UIController. However, the context of each window whould determine which
of those menus and toolbars are enabled. When a window is switched to the
foreground, its context would be used to set the enabled state for its menus and

Here are the types of Actions we need to support:
1) Those that are always enabled regardless of context
2) Those that are enabled depending on the current window context
3) Those that are enabled depending on application state outside of the current

Are there other possible cases?

We also may find that groups of actions are always enabled/disabled as a set,
and so we may want to make it easy to do that. For example, When a column is
selected in a data table, several menu items should be enabled in the Data menu,
including "Insert column before", Insert column after, Edit column metadata,
sort by column, etc.

Actions #1

Updated by Matt Jones almost 22 years ago

New menu system based on the propagation of StateCHangeEvents has been designed
and implemented. Menus are now created using the GUIAction class, and all
information about the placement of the action in menus and toolbars in encoded
directly in the GUIAction instance. UIController is used to synchronize the
addition of GUIActions to the various MorphoFrame objects, and the MorphoFrame
dynamically updates its menus and toolbars whenever a new action is added.

The StateChangeMonitor and StateChangeListener structure is much more general
than just menus and toolbars, so it can be used for other application compnents
that need to use the Observer & Monitor patterns.

Some minor cleanup items remain to finish off this functionality:
1) Finish converting menus
2) decide on application states and make sure the events are propagated
3) tell GUIActions what states to respond to
4) modify GUIAction to allow flag for whether they are sensitive to all
state changes of a type or only those that originate in the parent frame

Actions #2

Updated by Matt Jones almost 22 years ago

DONE. Menus now converted to use new system. Marking enhancement as FIXED.

Actions #3

Updated by Redmine Admin over 11 years ago

Original Bugzilla ID was 569


Also available in: Atom PDF