void MHListGroup::Initialise(MHParseNode *p, MHEngine *engine) { MHTokenGroup::Initialise(p, engine); MHParseNode *pPositions = p->GetNamedArg(C_POSITIONS); if (pPositions) { for (int i = 0; i < pPositions->GetArgCount(); i++) { MHParseNode *pPos = pPositions->GetArgN(i); QPoint pos(pPos->GetSeqN(0)->GetIntValue(), pPos->GetSeqN(1)->GetIntValue()); m_Positions.Append(pos); } } MHParseNode *pWrap = p->GetNamedArg(C_WRAP_AROUND); if (pWrap) { m_fWrapAround = pWrap->GetArgN(0)->GetBoolValue(); } MHParseNode *pMultiple = p->GetNamedArg(C_WRAP_AROUND); if (pMultiple) { m_fMultipleSelection = pMultiple->GetArgN(0)->GetBoolValue(); } }
void MHStream::Initialise(MHParseNode *p, MHEngine *engine) { MHPresentable::Initialise(p, engine); MHParseNode *pMultiplex = p->GetNamedArg(C_MULTIPLEX); if (pMultiplex) { for (int i = 0; i < pMultiplex->GetArgCount(); i++) { MHParseNode *pItem = pMultiplex->GetArgN(i); if (pItem->GetTagNo() == C_AUDIO) { MHAudio *pAudio = new MHAudio; m_Multiplex.Append(pAudio); pAudio->Initialise(pItem, engine); } else if (pItem->GetTagNo() == C_VIDEO) { MHVideo *pVideo = new MHVideo; m_Multiplex.Append(pVideo); pVideo->Initialise(pItem, engine); } else if (pItem->GetTagNo() == C_RTGRAPHICS) { MHRTGraphics *pRtGraph = new MHRTGraphics; m_Multiplex.Append(pRtGraph); pRtGraph->Initialise(pItem, engine); } // Ignore unknown items } } MHParseNode *pStorage = p->GetNamedArg(C_STORAGE); if (pStorage) m_nStorage = (enum Storage) pStorage->GetArgN(0)->GetEnumValue(); MHParseNode *pLooping = p->GetNamedArg(C_LOOPING); if (pLooping) m_nLooping = pLooping->GetArgN(0)->GetIntValue(); }
void MHTokenGroup::Initialise(MHParseNode *p, MHEngine *engine) { MHPresentable::Initialise(p, engine); MHParseNode *pMovements = p->GetNamedArg(C_MOVEMENT_TABLE); if (pMovements) { for (int i = 0; i < pMovements->GetArgCount(); i++) { MHMovement *pMove = new MHMovement; m_MovementTable.Append(pMove); pMove->Initialise(pMovements->GetArgN(i), engine); } } MHParseNode *pTokenGrp = p->GetNamedArg(C_TOKEN_GROUP_ITEMS); if (pTokenGrp) { for (int i = 0; i < pTokenGrp->GetArgCount(); i++) { MHTokenGroupItem *pToken = new MHTokenGroupItem; m_TokenGrpItems.Append(pToken); pToken->Initialise(pTokenGrp->GetArgN(i), engine); } } MHParseNode *pNoToken = p->GetNamedArg(C_NO_TOKEN_ACTION_SLOTS); if (pNoToken) { for (int i = 0; i < pNoToken->GetArgCount(); i++) { MHParseNode *pAct = pNoToken->GetArgN(i); MHActionSequence *pActions = new MHActionSequence; m_NoTokenActionSlots.Append(pActions); // The action slot entry may be NULL. if (pAct->m_nNodeType != MHParseNode::PNNull) { pActions->Initialise(pAct, engine); } } } }
void MHGroup::Initialise(MHParseNode *p, MHEngine *engine) { engine->GetGroupId().Copy(""); // Set to empty before we start (just in case). MHRoot::Initialise(p, engine); // Must be an external reference with an object number of zero. if (m_ObjectReference.m_nObjectNo != 0 || m_ObjectReference.m_GroupId.Size() == 0) { MHERROR("Object reference for a group object must be zero and external"); } // Set the group id for the rest of the group to this. engine->GetGroupId().Copy(m_ObjectReference.m_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(C_ON_START_UP); if (pOnStartUp) { m_StartUp.Initialise(pOnStartUp, engine); } MHParseNode *pOnCloseDown = p->GetNamedArg(C_ON_CLOSE_DOWN); if (pOnCloseDown) { m_CloseDown.Initialise(pOnCloseDown, engine); } MHParseNode *pOriginalGCPrio = p->GetNamedArg(C_ORIGINAL_GC_PRIORITY); if (pOriginalGCPrio) { m_nOrigGCPriority = pOriginalGCPrio->GetArgN(0)->GetIntValue(); } // Ignore the other stuff at the moment. MHParseNode *pItems = p->GetNamedArg(C_ITEMS); if (pItems == NULL) { p->Failure("Missing :Items block"); return; } for (int i = 0; i < pItems->GetArgCount(); i++) { MHParseNode *pItem = pItems->GetArgN(i); MHIngredient *pIngredient = NULL; try { // Generate the particular kind of ingredient. switch (pItem->GetTagNo()) { case C_RESIDENT_PROGRAM: pIngredient = new MHResidentProgram; break; case C_REMOTE_PROGRAM: pIngredient = new MHRemoteProgram; break; case C_INTERCHANGED_PROGRAM: pIngredient = new MHInterChgProgram; break; case C_PALETTE: pIngredient = new MHPalette; break; case C_FONT: pIngredient = new MHFont; break; case C_CURSOR_SHAPE: pIngredient = new MHCursorShape; break; case C_BOOLEAN_VARIABLE: pIngredient = new MHBooleanVar; break; case C_INTEGER_VARIABLE: pIngredient = new MHIntegerVar; break; case C_OCTET_STRING_VARIABLE: pIngredient = new MHOctetStrVar; break; case C_OBJECT_REF_VARIABLE: pIngredient = new MHObjectRefVar; break; case C_CONTENT_REF_VARIABLE: pIngredient = new MHContentRefVar; break; case C_LINK: pIngredient = new MHLink; break; case C_STREAM: pIngredient = new MHStream; break; case C_BITMAP: pIngredient = new MHBitmap; break; case C_LINE_ART: pIngredient = new MHLineArt; break; case C_DYNAMIC_LINE_ART: pIngredient = new MHDynamicLineArt; break; case C_RECTANGLE: pIngredient = new MHRectangle; break; case C_HOTSPOT: pIngredient = new MHHotSpot; break; case C_SWITCH_BUTTON: pIngredient = new MHSwitchButton; break; case C_PUSH_BUTTON: pIngredient = new MHPushButton; break; case C_TEXT: pIngredient = new MHText; break; case C_ENTRY_FIELD: pIngredient = new MHEntryField; break; case C_HYPER_TEXT: pIngredient = new MHHyperText; break; case C_SLIDER: pIngredient = new MHSlider; break; case C_TOKEN_GROUP: pIngredient = new MHTokenGroup; break; case C_LIST_GROUP: pIngredient = new MHListGroup; break; default: MHLOG(MHLogWarning, QString("Unknown ingredient %1").arg(pItem->GetTagNo())); // Future proofing: ignore any ingredients that we don't know about. // Obviously these can only arise in the binary coding. } if (pIngredient) { // Initialise it from its argments. pIngredient->Initialise(pItem, engine); // Remember the highest numbered ingredient if (pIngredient->m_ObjectReference.m_nObjectNo > m_nLastId) { m_nLastId = pIngredient->m_ObjectReference.m_nObjectNo; } // Add it to the ingedients of this group. m_Items.Append(pIngredient); } } catch (...) { delete(pIngredient); throw; } } }