Tuesday, December 30, 2008

Modules

Modules have interfaces (small pins on the edges) that can be used to connect one module to another. This connection merges the items (handles) that are connected. When the connection is deleted, then the handles are separated. In other words, the module connection performs the same function as grouping, but the interface is different -- that is all. Saving is a problem, because if the merged handles are saved, then the saved file will not have information about the original handles. So, before saving, the handles are separated, and after saving, the handles are merged again. When saving a model with modules, you will notice these commands being executed in the history window.

The ModuleTool uses a new class of connector called ModuleConnectionGraphicsItem. This connection always uses straight line and contains a merge-handle commmand inside. It does not have a handle. 

The ModuleTool also uses a new PatGraphicsItem called ModuleLinkerItem. This item always belongs on the edge of its parentModule; this adjustment is made in the paint method. It is always an alias, so it hides itself when the original item is not present.