The counterparts to the methods "use" and "remove" are
The exit-method may be used to remove objects that were added by the init-method. There is no need to remove items that were given to the project by "add-item" or "add-item-for-opt", but the Surface project for example adds in its init-method display methods to the display method layer provided by project Time_Object
and it removes them from the layer in its exit-method:PROJECT *project_surface_init() { PROJECT *self; METHLAYER *layer; self = (PROJECT *)START_METHOD(G_INSTANCE); ASSURE(self, "", END_METHOD(NULL)); if(layer = (METHLAYER *)GRAPE(Time_Object, "get-display-layer")()) { GRAPE(layer, "add-button")("domain-disp", "domain"); GRAPE(layer, "add-button")("gauss-disp", "gauss"); GRAPE(layer, "add-button")("conjugate-disp", "conjugate"); GRAPE(layer, "add-button")("associate-disp", "associate"); } END_METHOD(self); }
PROJECT *project_surface_exit() { PROJECT *self; METHLAYER *layer; self = (PROJECT *)START_METHOD(G_INSTANCE); ASSURE(self, "", END_METHOD(NULL)); if(layer = (METHLAYER *)GRAPE(Time_Object, "get-display-layer")()) { GRAPE(layer, "remove-button")("domain-disp", "domain"); GRAPE(layer, "remove-button")("gauss-disp", "gauss"); GRAPE(layer, "remove-button")("conjugate-disp", "conjugate"); GRAPE(layer, "remove-button")("associate-disp", "associate"); } END_METHOD(self); }
You can see what happens: start a GRAPE program and add the project Time_Object. Then go to the option menu and open the layer by clicking on the button ``geometry displays'', go back to the main menu and add project Explicit. Now the new buttons should have appeared, they disappear again when you delete the project Explicit.
Copyright © by the Sonderforschungsbereich 256 at the Institut für Angewandte Mathematik, Universität Bonn.