// Set this up from the parse tree. public override void Initialise(MHParseNode p, MHEngine engine) { // Set to empty before we start (just in case). engine.GetGroupId().Copy(""); base.Initialise(p, engine); // Must be an external reference with an object number of zero. Logging.Assert(m_ObjectIdentifier.ObjectNo == 0 && m_ObjectIdentifier.GroupId.Size != 0); // Set the group id for the rest of the group to this. engine.GetGroupId().Copy(m_ObjectIdentifier.GroupId); // Some of the information is irrelevant. // MHParseNode pStdId = p.GetNamedArg(C_STANDARD_IDENTIFIER); // MHParseNode pStdVersion = p.GetNamedArg(C_STANDARD_VERSION); // MHParseNode pObjectInfo = p.GetNamedArg(C_OBJECT_INFORMATION); MHParseNode pOnStartUp = p.GetNamedArg(ASN1Codes.C_ON_START_UP); if (pOnStartUp != null) { m_StartUp.Initialise(pOnStartUp, engine); } MHParseNode pOnCloseDown = p.GetNamedArg(ASN1Codes.C_ON_CLOSE_DOWN); if (pOnCloseDown != null) { m_CloseDown.Initialise(pOnCloseDown, engine); } MHParseNode pOriginalGCPrio = p.GetNamedArg(ASN1Codes.C_ORIGINAL_GC_PRIORITY); if (pOriginalGCPrio != null) { m_nOrigGroupCachePriority = pOriginalGCPrio.GetArgN(0).GetIntValue(); } // Ignore the other stuff at the moment. MHParseNode pItems = p.GetNamedArg(ASN1Codes.C_ITEMS); if (pItems == null) { p.Failure("Missing :Items block"); } for (int i = 0; i < pItems.GetArgCount(); i++) { MHParseNode pItem = pItems.GetArgN(i); MHIngredient pIngredient = null; // Generate the particular kind of ingredient. switch (pItem.GetTagNo()) { case ASN1Codes.C_RESIDENT_PROGRAM: pIngredient = new MHResidentProgram(); break; // NOT UK case ASN1Codes.C_REMOTE_PROGRAM: pIngredient = new MHRemoteProgram(); break; // NOT UK case ASN1Codes.C_INTERCHANGED_PROGRAM: pIngredient = new MHInterChgProgram(); break; // NOT UK case ASN1Codes.C_PALETTE: pIngredient = new MHPalette(); break; // NOT UK case ASN1Codes.C_FONT: pIngredient = new MHFont(); break; // NOT UK case ASN1Codes.C_CURSOR_SHAPE: pIngredient = new MHCursorShape(); break; case ASN1Codes.C_BOOLEAN_VARIABLE: pIngredient = new MHBooleanVar(); break; case ASN1Codes.C_INTEGER_VARIABLE: pIngredient = new MHIntegerVar(); break; case ASN1Codes.C_OCTET_STRING_VARIABLE: pIngredient = new MHOctetStrVar(); break; case ASN1Codes.C_OBJECT_REF_VARIABLE: pIngredient = new MHObjectRefVar(); break; case ASN1Codes.C_CONTENT_REF_VARIABLE: pIngredient = new MHContentRefVar(); break; case ASN1Codes.C_LINK: pIngredient = new MHLink(); break; case ASN1Codes.C_STREAM: pIngredient = new MHStream(); break; case ASN1Codes.C_BITMAP: pIngredient = new MHBitmap(); break; case ASN1Codes.C_LINE_ART: pIngredient = new MHLineArt(); break; case ASN1Codes.C_DYNAMIC_LINE_ART: pIngredient = new MHDynamicLineArt(); break; case ASN1Codes.C_RECTANGLE: pIngredient = new MHRectangle(); break; // NOT UK case ASN1Codes.C_HOTSPOT: pIngredient = new MHHotSpot(); break; // NOT UK case ASN1Codes.C_SWITCH_BUTTON: pIngredient = new MHSwitchButton(); break; // NOT UK case ASN1Codes.C_PUSH_BUTTON: pIngredient = new MHPushButton(); break; case ASN1Codes.C_TEXT: pIngredient = new MHText(); break; case ASN1Codes.C_ENTRY_FIELD: pIngredient = new MHEntryField(); break; case ASN1Codes.C_HYPER_TEXT: pIngredient = new MHHyperText(); break; case ASN1Codes.C_SLIDER: pIngredient = new MHSlider(); break; case ASN1Codes.C_TOKEN_GROUP: pIngredient = new MHTokenGroup(); break; case ASN1Codes.C_LIST_GROUP: pIngredient = new MHListGroup(); break; default: // So we find out about these when debugging. Logging.Log(Logging.MHLogError, "'" + pItem.GetTagNo() + "' tag not in switch"); Logging.Assert(false); // Future proofing: ignore any ingredients that we don't know about. // Obviously these can only arise in the binary coding. break; } if (pIngredient != null) { // Initialise it from its argments. pIngredient.Initialise(pItem, engine); // Remember the highest numbered ingredient if (pIngredient.ObjectIdentifier.ObjectNo > m_nLastId) { m_nLastId = pIngredient.ObjectIdentifier.ObjectNo; } // Add it to the ingedients of this group. m_Items.Append(pIngredient); } } }