To define a macro-construction, the user first builds once the whole construction sequence. Then he asks DrGeoII to record this sequence. To record a construction sequence, DrGeoII needs to know the initial items of the sequence and the resulting items (output items). Of course the output items must depend only on the input items; otherwise DrGeoII would not be able to deduce the construction.

Developer perspective

To implement it in DrGeoII, I first need to write some UI elements: a dialog wizard and pages to follow the definition process of a macro-construction and to play/execute a macro-construction.

Then the internal UI stuff necessary to build and play macro-construction fit nicely in the DrGeoII UI interaction system. This one relies on various patterns as Tool+state, Builder, Factory, Pool and Command. I just need additional Tools and Builders subclasses to both build and play a macro-construction.

User perspective

The use of a macro-construction is done in two phases: firstly its definition, secondly its use.

Building a macro-construction

This is a three phases process. From the DrGeo popup menu (click on the background), select macro-construction>build macro to open the wizard dialog:

macro-build1.png

Select input items

In the figure area select any object you want as input items. You can unselect an item by clicking again on it. The selected items are blinking: macro-build2.png

Select output items

In the figure area select any object you want as output items. You can unselect an item by clicking again on it. The selected items are blinking. The output items are the items you want the macro to construct for you. You cannot select an input item as an output item, and vis-versa: macro-build3.png

Give a name and description

Give a proper name and description to your macro-construction, then apply to get it instantiated. macro-build4.png

Executing a macro-construction

Playing a macro-construction is also done with a wizard dialog from the macro-construction>execute macro menu: macro-play1.png

Select a macro-construction, then input items in the figure. Only relevant item according to a macro-construction are selectable: macro-play2.png

Once all the input items are chosen, the macro-construction is automatically executed over these input items. The wizard dialog is also automatically closed, and user interactive mode is back to the select mode: macro-play3.png

The intermediate build items are hidden. You can reveal them from the style mode.

Conclusion

Macro is an interesting pedagogical tool. Teacher can prepare macro with complex construction, so student can concentrate on specific topic without spending time on construction. Of course constructing macro can also be a subject of study by itself to understand the dependency on the properties.

As for now the macro-construction are stored in a Singleton MacroFactory's pool. Therefore macro-construction can be shared from different DrGeo instances. I have not yet decided of any specific persistence system (XML based). Saving a DrGeo instance in project should however save the macro factory as well. I have not test it yet.