Пример #1
0
void MHOctetStrVar::Initialise(MHParseNode *p, MHEngine *engine)
{
    MHVariable::Initialise(p, engine);
    // Original value should be a string.
    MHParseNode *pInitial = p->GetNamedArg(C_ORIGINAL_VALUE);
    if (pInitial) pInitial->GetArgN(0)->GetStringValue(m_OriginalValue);
}
Пример #2
0
void MHIntegerVar::Initialise(MHParseNode *p, MHEngine *engine)
{
    MHVariable::Initialise(p, engine);
    // Original value should be an int.
    MHParseNode *pInitial = p->GetNamedArg(C_ORIGINAL_VALUE);
    if (pInitial) m_nOriginalValue = pInitial->GetArgN(0)->GetIntValue();
}
Пример #3
0
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();
    }
}
Пример #4
0
void MHBooleanVar::Initialise(MHParseNode *p, MHEngine *engine)
{
    MHVariable::Initialise(p, engine);
    // Original value should be a bool.
    MHParseNode *pInitial = p->GetNamedArg(C_ORIGINAL_VALUE);
    if (pInitial) m_fOriginalValue = pInitial->GetArgN(0)->GetBoolValue();
}
Пример #5
0
void MHInteractible::Initialise(MHParseNode *p, MHEngine *engine)
{
    // Engine Resp - optional
    MHParseNode *pEngineResp = p->GetNamedArg(C_ENGINE_RESP);

    if (pEngineResp)
    {
        m_fEngineResp = pEngineResp->GetArgN(0)->GetBoolValue();
    }

    // Highlight colour.
    MHParseNode *phlCol = p->GetNamedArg(C_HIGHLIGHT_REF_COLOUR);

    if (phlCol)
    {
        m_highlightRefColour.Initialise(phlCol->GetArgN(0), engine);
    }
    else
    {
        engine->GetDefaultHighlightRefColour(m_highlightRefColour);
    }

    m_fHighlightStatus = false;
    m_fInteractionStatus = false;
}
Пример #6
0
void MHAudio::Initialise(MHParseNode *p, MHEngine *engine)
{
    MHPresentable::Initialise(p, engine);
    MHParseNode *pComponentTagNode =  p->GetNamedArg(C_COMPONENT_TAG);
    if (pComponentTagNode) m_nComponentTag = pComponentTagNode->GetArgN(0)->GetIntValue();
    MHParseNode *pOrigVol = p->GetNamedArg(C_ORIGINAL_VOLUME);
    if (pOrigVol) m_nOriginalVol = pOrigVol->GetIntValue();
}
Пример #7
0
void MHVideo::Initialise(MHParseNode *p, MHEngine *engine)
{
    MHVisible::Initialise(p, engine);
    MHParseNode *pComponentTagNode = p->GetNamedArg(C_COMPONENT_TAG);
    if (pComponentTagNode) m_nComponentTag = pComponentTagNode->GetArgN(0)->GetIntValue();
    MHParseNode *pTerm = p->GetNamedArg(C_TERMINATION);
    if (pTerm) m_Termination = (enum Termination)pTerm->GetEnumValue();
}
Пример #8
0
void MHContentRefVar::Initialise(MHParseNode *p, MHEngine *engine)
{
    MHVariable::Initialise(p, engine);
    // Original value should be a content reference.
    MHParseNode *pInitial = p->GetNamedArg(C_ORIGINAL_VALUE);
    // and this should be a ContentRef node.
    MHParseNode *pArg = pInitial->GetNamedArg(C_CONTENT_REFERENCE);
    m_OriginalValue.Initialise(pArg->GetArgN(0), engine);
}
Пример #9
0
// Convert the parse tree for an application or scene into an object node.
MHGroup *MHEngine::ParseProgram(QByteArray &text)
{
    if (text.size() == 0)
    {
        return NULL;
    }

    // Look at the first byte to decide whether this is text or binary.  Binary
    // files will begin with 0xA0 or 0xA1, text files with white space, comment ('/')
    // or curly bracket.
    // This is only there for testing: all downloaded objects will be in ASN1
    unsigned char ch = text[0];
    MHParseBase *parser = NULL;
    MHParseNode *pTree = NULL;
    MHGroup *pRes = NULL;

    if (ch >= 128)
    {
        parser = new MHParseBinary(text);
    }
    else
    {
        parser = new MHParseText(text);
    }

    try
    {
        // Parse the binary or text.
        pTree = parser->Parse();

        switch (pTree->GetTagNo())   // The parse node should be a tagged item.
        {
            case C_APPLICATION:
                pRes = new MHApplication;
                break;
            case C_SCENE:
                pRes = new MHScene;
                break;
            default:
                pTree->Failure("Expected Application or Scene"); // throws exception.
        }

        pRes->Initialise(pTree, this); // Convert the parse tree.
        delete(pTree);
        delete(parser);
    }
    catch (...)
    {
        delete(parser);
        delete(pTree);
        delete(pRes);
        throw;
    }

    return pRes;
}
Пример #10
0
void MHSetColour::Initialise(MHParseNode *p, MHEngine *engine)
{
    MHElemAction::Initialise(p, engine);
    if (p->GetArgCount() > 1) {
        MHParseNode *pIndexed = p->GetNamedArg(C_NEW_COLOUR_INDEX);
        MHParseNode *pAbsolute = p->GetNamedArg(C_NEW_ABSOLUTE_COLOUR);
        if (pIndexed) { m_ColourType = CT_Indexed; m_Indexed.Initialise(pIndexed->GetArgN(0), engine); }
        else if (pAbsolute) { m_ColourType = CT_Absolute; m_Absolute.Initialise(pAbsolute->GetArgN(0), engine); }
    }
}
Пример #11
0
void MHBitmap::Initialise(MHParseNode *p, MHEngine *engine)
{
    MHVisible::Initialise(p, engine);
    // Tiling - optional
    MHParseNode *pTiling = p->GetNamedArg(C_TILING);
    if (pTiling) m_fTiling = pTiling->GetArgN(0)->GetBoolValue();
    // Transparency - optional
    MHParseNode *pTransparency = p->GetNamedArg(C_ORIGINAL_TRANSPARENCY);
    if (pTransparency) m_nOrigTransparency = pTransparency->GetArgN(0)->GetIntValue();
    m_pContent = engine->GetContext()->CreateBitmap(m_fTiling);
}
Пример #12
0
void MHObjectRefVar::Initialise(MHParseNode *p, MHEngine *engine)
{
    MHVariable::Initialise(p, engine);
    // Original value should be an object reference.
    MHParseNode *pInitial = p->GetNamedArg(C_ORIGINAL_VALUE);
    // and this should be a ObjRef node.
    if (pInitial) {
        MHParseNode *pArg = pInitial->GetNamedArg(C_OBJECT_REFERENCE);
        if (pArg) m_OriginalValue.Initialise(pArg->GetArgN(0), engine);
    }
}
Пример #13
0
void MHPersistent::Initialise(MHParseNode *p, MHEngine *engine)
{
    MHElemAction::Initialise(p, engine); // Target
    m_Succeeded.Initialise(p->GetArgN(1), engine);
    MHParseNode *pVarSeq = p->GetArgN(2);
    for (int i = 0; i < pVarSeq->GetSeqCount(); i++) {
        MHObjectRef *pVar = new MHObjectRef;
        m_Variables.Append(pVar);
        pVar->Initialise(pVarSeq->GetSeqN(i), engine);
    }
    m_FileName.Initialise(p->GetArgN(3), engine);
}
Пример #14
0
void MHSetTimer::Initialise(MHParseNode *p, MHEngine *engine)
{
    MHElemAction::Initialise(p, engine);
    m_TimerId.Initialise(p->GetArgN(1), engine); // The timer id
    if (p->GetArgCount() > 2) {
        MHParseNode *pNewTimer = p->GetArgN(2);
        m_TimerValue.Initialise(pNewTimer->GetSeqN(0), engine);
        if (pNewTimer->GetSeqCount() > 1) {
            m_TimerType = ST_TimerAbsolute; // May be absolute - depends on the value.
            m_AbsFlag.Initialise(pNewTimer->GetSeqN(1), engine);
        }
        else m_TimerType = ST_TimerRelative;
    }
}
Пример #15
0
// Actions.
void MHCall::Initialise(MHParseNode *p, MHEngine *engine)
{
    MHElemAction::Initialise(p, engine); // Target
    m_Succeeded.Initialise(p->GetArgN(1), engine); // Call/fork succeeded flag
    // Arguments.
    MHParseNode *args = p->GetArgN(2);

    for (int i = 0; i < args->GetSeqCount(); i++)
    {
        MHParameter *pParm = new MHParameter;
        m_Parameters.Append(pParm);
        pParm->Initialise(args->GetSeqN(i), engine);
    }
}
Пример #16
0
// An object reference is either an integer or a pair of a group id and an integer.
void MHObjectRef::Initialise(MHParseNode *p, MHEngine *engine)
{
    if (p->m_nNodeType == MHParseNode::PNInt) {
        m_nObjectNo = p->GetIntValue();
        // Set the group id to the id of this group.
        m_GroupId.Copy(engine->GetGroupId());
    }
    else if (p->m_nNodeType == MHParseNode::PNSeq) {
        MHParseNode *pFirst = p->GetSeqN(0);
        MHOctetString groupId;
        pFirst->GetStringValue(m_GroupId);
        m_nObjectNo = p->GetSeqN(1)->GetIntValue();
    }
    else p->Failure("ObjectRef: Argument is not int or sequence");
}
Пример #17
0
void MHTransitionTo::Initialise(MHParseNode *p, MHEngine *engine)
{
    MHElemAction::Initialise(p, engine); // Target
    // The next one may be present but NULL in binary.
    if (p->GetArgCount() > 1) {
        MHParseNode *pCtag = p->GetArgN(1);
        if (pCtag->m_nNodeType == MHParseNode::PNInt) {
            m_fIsTagged = TRUE;
            m_nConnectionTag = pCtag->GetIntValue();
        }
    }
    if (p->GetArgCount() > 2) {
        MHParseNode *pTrEff = p->GetArgN(2);
        m_nTransitionEffect = pTrEff->GetIntValue();
    }
}
Пример #18
0
void MHVisible::Initialise(MHParseNode *p, MHEngine *engine)
{
    MHPresentable::Initialise(p, engine);
    // Original box size - two integer arguments.
    MHParseNode *pOriginalBox = p->GetNamedArg(C_ORIGINAL_BOX_SIZE);

    if (! pOriginalBox)
    {
        p->Failure("OriginalBoxSize missing");
    }
    else
    {
        m_nOriginalBoxWidth = pOriginalBox->GetArgN(0)->GetIntValue();
        m_nOriginalBoxHeight = pOriginalBox->GetArgN(1)->GetIntValue();
    }

    // Original position - two integer arguments.  Optional
    MHParseNode *pOriginalPos = p->GetNamedArg(C_ORIGINAL_POSITION);

    if (pOriginalPos)
    {
        m_nOriginalPosX = pOriginalPos->GetArgN(0)->GetIntValue();
        m_nOriginalPosY = pOriginalPos->GetArgN(1)->GetIntValue();
    }

    // OriginalPalette ref - optional.
    MHParseNode *pOriginalPaletteRef = p->GetNamedArg(C_ORIGINAL_PALETTE_REF);

    if (pOriginalPaletteRef)
    {
        m_OriginalPaletteRef.Initialise(pOriginalPaletteRef->GetArgN(0), engine);
    }
}
Пример #19
0
void MHLineArt::Initialise(MHParseNode *p, MHEngine *engine)
{
    MHVisible::Initialise(p, engine);
    // Bordered bounding box - optional
    MHParseNode *pBBBox = p->GetNamedArg(C_BORDERED_BOUNDING_BOX);

    if (pBBBox)
    {
        m_fBorderedBBox = pBBBox->GetArgN(0)->GetBoolValue();
    }

    // Original line width
    MHParseNode *pOlw = p->GetNamedArg(C_ORIGINAL_LINE_WIDTH);

    if (pOlw)
    {
        m_nOriginalLineWidth = pOlw->GetArgN(0)->GetIntValue();
    }

    // Original line style.  This is an integer not an enum.
    MHParseNode *pOls = p->GetNamedArg(C_ORIGINAL_LINE_STYLE);

    if (pOls)
    {
        m_OriginalLineStyle = pOls->GetArgN(0)->GetIntValue();
    }

    // Line colour.
    MHParseNode *pOrlc = p->GetNamedArg(C_ORIGINAL_REF_LINE_COLOUR);

    if (pOrlc)
    {
        m_OrigLineColour.Initialise(pOrlc->GetArgN(0), engine);
    }

    // Fill colour
    MHParseNode *pOrfc = p->GetNamedArg(C_ORIGINAL_REF_FILL_COLOUR);

    if (pOrfc)
    {
        m_OrigFillColour.Initialise(pOrfc->GetArgN(0), engine);
    }
}
Пример #20
0
void MHProgram::Initialise(MHParseNode *p, MHEngine *engine)
{
    MHIngredient::Initialise(p, engine);
    MHParseNode *pCmdNode = p->GetNamedArg(C_NAME);

    if (pCmdNode)
    {
        pCmdNode->GetArgN(0)->GetStringValue(m_Name);    // Program name
    }

    MHParseNode *pAvail = p->GetNamedArg(C_INITIALLY_AVAILABLE);

    if (pAvail)
    {
        m_fInitiallyAvailable = pAvail->GetArgN(0)->GetBoolValue();
    }

    // The MHEG Standard says that InitiallyAvailable is mandatory and should be false.
    // That doesn't seem to be the case in some MHEG programs so we force it here.
    m_fInitiallyActive = false;
}
Пример #21
0
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);
            }
        }
    }
}
Пример #22
0
void MHTokenGroupItem::Initialise(MHParseNode *p, MHEngine *engine)
{
    // A pair consisting of an object reference and an optional action slot sequence.
    m_Object.Initialise(p->GetSeqN(0), engine);

    if (p->GetSeqCount() > 1)
    {
        MHParseNode *pSlots = p->GetSeqN(1);

        for (int i = 0; i < pSlots->GetSeqCount(); i++)
        {
            MHParseNode *pAct = pSlots->GetSeqN(i);
            MHActionSequence *pActions = new MHActionSequence;
            m_ActionSlots.Append(pActions);

            // The action slot entry may be NULL.
            if (pAct->m_nNodeType != MHParseNode::PNNull)
            {
                pActions->Initialise(pAct, engine);
            }
        }
    }
}
Пример #23
0
void MHScene::Initialise(MHParseNode *p, MHEngine *engine)
{
    MHGroup::Initialise(p, engine);
    // Event register.
    MHParseNode *pInputEventReg = p->GetNamedArg(C_INPUT_EVENT_REGISTER);

    if (pInputEventReg)
    {
        m_nEventReg = pInputEventReg->GetArgN(0)->GetIntValue();
    }

    // Co-ordinate system
    MHParseNode *pSceneCoords = p->GetNamedArg(C_SCENE_COORDINATE_SYSTEM);

    if (pSceneCoords)
    {
        m_nSceneCoordX = pSceneCoords->GetArgN(0)->GetIntValue();
        m_nSceneCoordY = pSceneCoords->GetArgN(1)->GetIntValue();
    }

    // Aspect ratio
    MHParseNode *pAspectRatio = p->GetNamedArg(C_ASPECT_RATIO);

    if (pAspectRatio)
    {
        // Is the binary encoded as a sequence or a pair of arguments?
        m_nAspectRatioW = pAspectRatio->GetArgN(0)->GetIntValue();
        m_nAspectRatioH = pAspectRatio->GetArgN(1)->GetIntValue();
    }

    // Moving cursor
    MHParseNode *pMovingCursor = p->GetNamedArg(C_MOVING_CURSOR);

    if (pMovingCursor)
    {
        pMovingCursor->GetArgN(0)->GetBoolValue();
    }

    // Next scene sequence: this is just a hint and isn't implemented
}
Пример #24
0
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();
}
Пример #25
0
void MHSlider::Initialise(MHParseNode *p, MHEngine *engine)
{
    MHVisible::Initialise(p, engine);
    MHInteractible::Initialise(p, engine);
    //
    MHParseNode *pOrientation = p->GetNamedArg(C_ORIENTATION);

    if (pOrientation)
    {
        m_orientation = (enum SliderOrientation)pOrientation->GetArgN(0)->GetEnumValue();
    }

    // This is not optional.

    MHParseNode *pMin = p->GetNamedArg(C_MIN_VALUE);

    if (pMin)
    {
        orig_min_value = pMin->GetArgN(0)->GetIntValue();
    }
    else
    {
        orig_min_value = 1;
    }

    MHParseNode *pMax = p->GetNamedArg(C_MAX_VALUE);

    if (pMax)
    {
        orig_max_value = pMax->GetArgN(0)->GetIntValue();
    }
    else
    {
        orig_max_value = orig_min_value - 1;    // Unset
    }

    MHParseNode *pInit = p->GetNamedArg(C_INITIAL_VALUE);

    if (pInit)
    {
        initial_value = pInit->GetArgN(0)->GetIntValue();
    }
    else
    {
        initial_value = orig_min_value;    // Default is min_value
    }

    MHParseNode *pPortion = p->GetNamedArg(C_INITIAL_PORTION);

    if (pPortion)
    {
        initial_portion = pPortion->GetArgN(0)->GetIntValue();
    }
    else
    {
        initial_portion = orig_min_value - 1;    // Unset
    }

    MHParseNode *pStep = p->GetNamedArg(C_STEP_SIZE);

    if (pStep)
    {
        orig_step_size = pStep->GetArgN(0)->GetIntValue();
    }
    else
    {
        orig_step_size = 1;    // Unset
    }

    MHParseNode *pStyle = p->GetNamedArg(C_SLIDER_STYLE);

    if (pStyle)
    {
        m_style = (enum SliderStyle)pStyle->GetArgN(0)->GetEnumValue();
    }
    else
    {
        m_style = SliderNormal;
    }

    MHParseNode *pslCol = p->GetNamedArg(C_SLIDER_REF_COLOUR);

    if (pslCol)
    {
        m_sliderRefColour.Initialise(pslCol->GetArgN(0), engine);
    }
    else
    {
        engine->GetDefaultSliderRefColour(m_sliderRefColour);
    }
}
Пример #26
0
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;
        }
    }
}
Пример #27
0
void MHApplication::Initialise(MHParseNode *p, MHEngine *engine)
{
    MHGroup::Initialise(p, engine);
    // OnSpawnCloseDown
    MHParseNode *pOnSpawn = p->GetNamedArg(C_ON_SPAWN_CLOSE_DOWN);

    if (pOnSpawn)
    {
        m_OnSpawnCloseDown.Initialise(pOnSpawn, engine);
    }

    // OnRestart
    MHParseNode *pOnRestart = p->GetNamedArg(C_ON_RESTART);

    if (pOnRestart)
    {
        m_OnRestart.Initialise(pOnRestart, engine);
    }

    // Default attributes.  These are encoded in a group in binary.
    MHParseNode *pDefattrs = p->GetNamedArg(C_DEFAULT_ATTRIBUTES);

    // but in the text form they're encoded in the Application block.
    if (pDefattrs == NULL)
    {
        pDefattrs = p;
    }

    MHParseNode *pCharSet = pDefattrs->GetNamedArg(C_CHARACTER_SET);

    if (pCharSet)
    {
        m_nCharSet = pCharSet->GetArgN(0)->GetIntValue();
    }

    // Colours
    MHParseNode *pBGColour = pDefattrs->GetNamedArg(C_BACKGROUND_COLOUR);

    if (pBGColour)
    {
        m_BGColour.Initialise(pBGColour->GetArgN(0), engine);
    }

    MHParseNode *pTextColour = pDefattrs->GetNamedArg(C_TEXT_COLOUR);

    if (pTextColour)
    {
        m_TextColour.Initialise(pTextColour->GetArgN(0), engine);
    }

    MHParseNode *pButtonRefColour = pDefattrs->GetNamedArg(C_BUTTON_REF_COLOUR);

    if (pButtonRefColour)
    {
        m_ButtonRefColour.Initialise(pButtonRefColour->GetArgN(0), engine);
    }

    MHParseNode *pHighlightRefColour = pDefattrs->GetNamedArg(C_HIGHLIGHT_REF_COLOUR);

    if (pHighlightRefColour)
    {
        m_HighlightRefColour.Initialise(pHighlightRefColour->GetArgN(0), engine);
    }

    MHParseNode *pSliderRefColour = pDefattrs->GetNamedArg(C_SLIDER_REF_COLOUR);

    if (pSliderRefColour)
    {
        m_SliderRefColour.Initialise(pSliderRefColour->GetArgN(0), engine);
    }

    // Content hooks
    MHParseNode *pTextCHook = pDefattrs->GetNamedArg(C_TEXT_CONTENT_HOOK);

    if (pTextCHook)
    {
        m_nTextCHook = pTextCHook->GetArgN(0)->GetIntValue();
    }

    MHParseNode *pIPCHook = pDefattrs->GetNamedArg(C_IP_CONTENT_HOOK);

    if (pIPCHook)
    {
        m_nIPCHook = pIPCHook->GetArgN(0)->GetIntValue();
    }

    MHParseNode *pStrCHook = pDefattrs->GetNamedArg(C_STREAM_CONTENT_HOOK);

    if (pStrCHook)
    {
        m_nStrCHook = pStrCHook->GetArgN(0)->GetIntValue();
    }

    MHParseNode *pBitmapCHook = pDefattrs->GetNamedArg(C_BITMAP_CONTENT_HOOK);

    if (pBitmapCHook)
    {
        m_nBitmapCHook = pBitmapCHook->GetArgN(0)->GetIntValue();
    }

    MHParseNode *pLineArtCHook = pDefattrs->GetNamedArg(C_LINE_ART_CONTENT_HOOK);

    if (pLineArtCHook)
    {
        m_nLineArtCHook = pLineArtCHook->GetArgN(0)->GetIntValue();
    }

    // Font.  This is a little tricky.  There are two attributes both called Font.
    // In the binary notation the font here is encoded as 42 whereas the text form
    // finds the first occurrence of :Font in the table and returns 13.
    MHParseNode *pFont = pDefattrs->GetNamedArg(C_FONT2);

    if (pFont == NULL)
    {
        pFont = pDefattrs->GetNamedArg(C_FONT);
    }

    if (pFont)
    {
        m_Font.Initialise(pFont->GetArgN(0), engine);
    }

    // Font attributes.
    MHParseNode *pFontAttrs = pDefattrs->GetNamedArg(C_FONT_ATTRIBUTES);

    if (pFontAttrs)
    {
        pFontAttrs->GetArgN(0)->GetStringValue(m_FontAttrs);
    }
}
Пример #28
0
// Process the action set and create the action values.
void MHActionSequence::Initialise(MHParseNode *p, MHEngine *engine)
{
    // Depending on the caller we may have a tagged argument list or a sequence.
    for (int i = 0; i < p->GetArgCount(); i++)
    {
        MHParseNode *pElemAction = p->GetArgN(i);
        MHElemAction *pAction;

        switch (pElemAction->GetTagNo())
        {
            case C_ACTIVATE:
                pAction = new MHActivate(":Activate", true);
                break;
            case C_ADD:
                pAction = new MHAdd;
                break;
            case C_ADD_ITEM:
                pAction = new MHAddItem;
                break;
            case C_APPEND:
                pAction = new MHAppend;
                break;
            case C_BRING_TO_FRONT:
                pAction = new MHBringToFront;
                break;
            case C_CALL:
                pAction = new MHCall(":Call", false);
                break;
            case C_CALL_ACTION_SLOT:
                pAction = new MHCallActionSlot;
                break;
            case C_CLEAR:
                pAction = new MHClear;
                break;
            case C_CLONE:
                pAction = new MHClone;
                break;
            case C_CLOSE_CONNECTION:
                pAction = new MHUnimplementedAction(pElemAction->GetTagNo());
                break; // ??
            case C_DEACTIVATE:
                pAction = new MHActivate(":Deactivate", false);
                break;
            case C_DEL_ITEM:
                pAction = new MHDelItem;
                break;
            case C_DESELECT:
                pAction = new MHUnimplementedAction(pElemAction->GetTagNo());
                break; // Button
            case C_DESELECT_ITEM:
                pAction = new MHDeselectItem;
                break;
            case C_DIVIDE:
                pAction = new MHDivide;
                break;
            case C_DRAW_ARC:
                pAction = new MHDrawArcSector(":DrawArc", false);
                break;
            case C_DRAW_LINE:
                pAction = new MHDrawLine;
                break;
            case C_DRAW_OVAL:
                pAction = new MHDrawOval;
                break;
            case C_DRAW_POLYGON:
                pAction = new MHDrawPoly(":DrawPolygon", true);
                break;
            case C_DRAW_POLYLINE:
                pAction = new MHDrawPoly(":DrawPolyline", false);
                break;
            case C_DRAW_RECTANGLE:
                pAction = new MHDrawRectangle;
                break;
            case C_DRAW_SECTOR:
                pAction = new MHDrawArcSector(":DrawSector", true);
                break;
            case C_FORK:
                pAction = new MHCall(":Fork", true);
                break;
            case C_GET_AVAILABILITY_STATUS:
                pAction = new MHGetAvailabilityStatus;
                break;
            case C_GET_BOX_SIZE:
                pAction = new MHGetBoxSize;
                break;
            case C_GET_CELL_ITEM:
                pAction = new MHGetCellItem;
                break;
            case C_GET_CURSOR_POSITION:
                pAction = new MHUnimplementedAction(pElemAction->GetTagNo());
                break; // ?
            case C_GET_ENGINE_SUPPORT:
                pAction = new MHGetEngineSupport;
                break;
            case C_GET_ENTRY_POINT:
                pAction = new MHUnimplementedAction(pElemAction->GetTagNo());
                break; // EntryField
            case C_GET_FILL_COLOUR:
                pAction = new MHGetFillColour;
                break;
            case C_GET_FIRST_ITEM:
                pAction = new MHGetFirstItem;
                break;
            case C_GET_HIGHLIGHT_STATUS:
                pAction = new MHGetHighlightStatus;
                break;
            case C_GET_INTERACTION_STATUS:
                pAction = new MHGetInteractionStatus;
                break;
            case C_GET_ITEM_STATUS:
                pAction = new MHGetItemStatus;
                break;
            case C_GET_LABEL:
                pAction = new MHUnimplementedAction(pElemAction->GetTagNo());
                break;// PushButton
            case C_GET_LAST_ANCHOR_FIRED:
                pAction = new MHUnimplementedAction(pElemAction->GetTagNo());
                break;// HyperText
            case C_GET_LINE_COLOUR:
                pAction = new MHGetLineColour;
                break;
            case C_GET_LINE_STYLE:
                pAction = new MHGetLineStyle;
                break;
            case C_GET_LINE_WIDTH:
                pAction = new MHGetLineWidth;
                break;
            case C_GET_LIST_ITEM:
                pAction = new MHGetListItem;
                break;
            case C_GET_LIST_SIZE:
                pAction = new MHGetListSize;
                break;
            case C_GET_OVERWRITE_MODE:
                pAction = new MHUnimplementedAction(pElemAction->GetTagNo());
                break;// ?
            case C_GET_PORTION:
                pAction = new MHGetPortion;
                break;
            case C_GET_POSITION:
                pAction = new MHGetPosition;
                break;
            case C_GET_RUNNING_STATUS:
                pAction = new MHGetRunningStatus;
                break;
            case C_GET_SELECTION_STATUS:
                pAction = new MHUnimplementedAction(pElemAction->GetTagNo());
                break;// ?
            case C_GET_SLIDER_VALUE:
                pAction = new MHGetSliderValue;
                break;
            case C_GET_TEXT_CONTENT:
                pAction = new MHUnimplementedAction(pElemAction->GetTagNo());
                break;// Text
            case C_GET_TEXT_DATA:
                pAction = new MHGetTextData;
                break;
            case C_GET_TOKEN_POSITION:
                pAction = new MHGetTokenPosition;
                break;
            case C_GET_VOLUME:
                pAction = new MHUnimplementedAction(pElemAction->GetTagNo());
                break; // ?
            case C_LAUNCH:
                pAction = new MHLaunch;
                break;
            case C_LOCK_SCREEN:
                pAction = new MHLockScreen;
                break;
            case C_MODULO:
                pAction = new MHModulo;
                break;
            case C_MOVE:
                pAction = new MHMove;
                break;
            case C_MOVE_TO:
                pAction = new MHMoveTo;
                break;
            case C_MULTIPLY:
                pAction = new MHMultiply;
                break;
            case C_OPEN_CONNECTION:
                pAction = new MHUnimplementedAction(pElemAction->GetTagNo());
                break; // ?
            case C_PRELOAD:
                pAction = new MHPreload;
                break;
            case C_PUT_BEFORE:
                pAction = new MHPutBefore;
                break;
            case C_PUT_BEHIND:
                pAction = new MHPutBehind;
                break;
            case C_QUIT:
                pAction = new MHQuit;
                break;
            case C_READ_PERSISTENT:
                pAction = new MHPersistent(":ReadPersistent", true);
                break;
            case C_RUN:
                pAction = new MHRun;
                break;
            case C_SCALE_BITMAP:
                pAction = new MHScaleBitmap;
                break;
            case C_SCALE_VIDEO:
                pAction = new MHScaleVideo;
                break;
            case C_SCROLL_ITEMS:
                pAction = new MHScrollItems;
                break;
            case C_SELECT:
                pAction = new MHUnimplementedAction(pElemAction->GetTagNo());
                break; // Button
            case C_SELECT_ITEM:
                pAction = new MHSelectItem;
                break;
            case C_SEND_EVENT:
                pAction = new MHSendEvent;
                break;
            case C_SEND_TO_BACK:
                pAction = new MHSendToBack;
                break;
            case C_SET_BOX_SIZE:
                pAction = new MHSetBoxSize;
                break;
            case C_SET_CACHE_PRIORITY:
                pAction = new MHUnimplementedAction(pElemAction->GetTagNo());
                break; // ?
            case C_SET_COUNTER_END_POSITION:
                pAction = new MHUnimplementedAction(pElemAction->GetTagNo());
                break; // Stream
            case C_SET_COUNTER_POSITION:
                pAction = new MHSetCounterPosition;
                break; // Stream
            case C_SET_COUNTER_TRIGGER:
                pAction = new MHUnimplementedAction(pElemAction->GetTagNo());
                break; // Stream
            case C_SET_CURSOR_POSITION:
                pAction = new MHUnimplementedAction(pElemAction->GetTagNo());
                break; // ?
            case C_SET_CURSOR_SHAPE:
                pAction = new MHUnimplementedAction(pElemAction->GetTagNo());
                break; // ?
            case C_SET_DATA:
                pAction = new MHSetData;
                break;
            case C_SET_ENTRY_POINT:
                pAction = new MHUnimplementedAction(pElemAction->GetTagNo());
                break; // EntryField
            case C_SET_FILL_COLOUR:
                pAction = new MHSetFillColour;
                break;
            case C_SET_FIRST_ITEM:
                pAction = new MHSetFirstItem;
                break;
            case C_SET_FONT_REF:
                pAction = new MHUnimplementedAction(pElemAction->GetTagNo());
                break; // Text
            case C_SET_HIGHLIGHT_STATUS:
                pAction = new MHSetHighlightStatus;
                break;
            case C_SET_INTERACTION_STATUS:
                pAction = new MHSetInteractionStatus;
                break;
            case C_SET_LABEL:
                pAction = new MHUnimplementedAction(pElemAction->GetTagNo());
                break; // PushButton
            case C_SET_LINE_COLOUR:
                pAction = new MHSetLineColour;
                break;
            case C_SET_LINE_STYLE:
                pAction = new MHSetLineStyle;
                break;
            case C_SET_LINE_WIDTH:
                pAction = new MHSetLineWidth;
                break;
            case C_SET_OVERWRITE_MODE:
                pAction = new MHUnimplementedAction(pElemAction->GetTagNo());
                break; // EntryField
            case C_SET_PALETTE_REF:
                pAction = new MHUnimplementedAction(pElemAction->GetTagNo());
                break; // Visible
            case C_SET_PORTION:
                pAction = new MHSetPortion;
                break;
            case C_SET_POSITION:
                pAction = new MHSetPosition;
                break;
            case C_SET_SLIDER_VALUE:
                pAction = new MHSetSliderValue;
                break;
            case C_SET_SPEED:
                pAction = new MHSetSpeed;
                break; // ?
            case C_SET_TIMER:
                pAction = new MHSetTimer;
                break;
            case C_SET_TRANSPARENCY:
                pAction = new MHSetTransparency;
                break;
            case C_SET_VARIABLE:
                pAction = new MHSetVariable;
                break;
            case C_SET_VOLUME:
                pAction = new MHUnimplementedAction(pElemAction->GetTagNo());
                break; // ?
            case C_SPAWN:
                pAction = new MHSpawn;
                break;
            case C_STEP:
                pAction = new MHStep;
                break;
            case C_STOP:
                pAction = new MHStop;
                break;
            case C_STORE_PERSISTENT:
                pAction = new MHPersistent(":StorePersistent", false);
                break;
            case C_SUBTRACT:
                pAction = new MHSubtract;
                break;
            case C_TEST_VARIABLE:
                pAction = new MHTestVariable;
                break;
            case C_TOGGLE:
                pAction = new MHUnimplementedAction(pElemAction->GetTagNo());
                break; // Button
            case C_TOGGLE_ITEM:
                pAction = new MHToggleItem;
                break;
            case C_TRANSITION_TO:
                pAction = new MHTransitionTo;
                break;
            case C_UNLOAD:
                pAction = new MHUnload;
                break;
            case C_UNLOCK_SCREEN:
                pAction = new MHUnlockScreen;
                break;
                // UK MHEG added actions.
            case C_SET_BACKGROUND_COLOUR:
                pAction = new MHSetBackgroundColour;
                break;
            case C_SET_CELL_POSITION:
                pAction = new MHUnimplementedAction(pElemAction->GetTagNo());
                break; // ?
            case C_SET_INPUT_REGISTER:
                pAction = new MHSetInputRegister;
                break;
            case C_SET_TEXT_COLOUR:
                pAction = new MHSetTextColour;
                break;
            case C_SET_FONT_ATTRIBUTES:
                pAction = new MHSetFontAttributes;
                break;
            case C_SET_VIDEO_DECODE_OFFSET:
                pAction = new MHSetVideoDecodeOffset;
                break;
            case C_GET_VIDEO_DECODE_OFFSET:
                pAction = new MHGetVideoDecodeOffset;
                break;
            case C_GET_FOCUS_POSITION:
                pAction = new MHUnimplementedAction(pElemAction->GetTagNo());
                break; // HyperText
            case C_SET_FOCUS_POSITION:
                pAction = new MHUnimplementedAction(pElemAction->GetTagNo());
                break; // HyperText
            case C_SET_BITMAP_DECODE_OFFSET:
                pAction = new MHSetBitmapDecodeOffset;
                break;
            case C_GET_BITMAP_DECODE_OFFSET:
                pAction = new MHGetBitmapDecodeOffset;
                break;
            case C_SET_SLIDER_PARAMETERS:
                pAction = new MHSetSliderParameters;
                break;

            // Added in ETSI ES 202 184 V2.1.1 (2010-01)
            case C_GET_COUNTER_POSITION: // Stream position
                pAction = new MHGetCounterPosition;
                break;
            case C_GET_COUNTER_MAX_POSITION: // Stream total size
                pAction = new MHGetCounterMaxPosition;
                break;

            default:
                MHLOG(MHLogWarning, QString("WARN Unknown action %1").arg(pElemAction->GetTagNo()));
                // Future proofing: ignore any actions that we don't know about.
                // Obviously these can only arise in the binary coding.
                pAction = NULL;
        }

        if (pAction)
        {
            Append(pAction); // Add to the sequence.
            pAction->Initialise(pElemAction, engine);
        }
    }
}
Пример #29
0
void MHIngredient::Initialise(MHParseNode *p, MHEngine *engine)
{
    MHRoot::Initialise(p, engine);
    MHParseNode *pIA = p->GetNamedArg(C_INITIALLY_ACTIVE);

    if (pIA)
    {
        m_fInitiallyActive = pIA->GetArgN(0)->GetBoolValue();
    }

    MHParseNode *pCHook = p->GetNamedArg(C_CONTENT_HOOK);

    if (pCHook)
    {
        m_nContentHook = pCHook->GetArgN(0)->GetIntValue();
    }

    MHParseNode *pOrigContent = p->GetNamedArg(C_ORIGINAL_CONTENT);

    if (pOrigContent)
    {
        MHParseNode *pArg = pOrigContent->GetArgN(0);

        // Either a string - included content.
        if (pArg->m_nNodeType == MHParseNode::PNString)
        {
            m_ContentType = IN_IncludedContent;
            pArg->GetStringValue(m_OrigIncludedContent);
        }
        else   // or a sequence - referenced content.
        {
            // In the text version this is tagged with :ContentRef
            m_ContentType = IN_ReferencedContent;
            m_OrigContentRef.Initialise(pArg->GetArgN(0), engine);
            MHParseNode *pContentSize = pArg->GetNamedArg(C_CONTENT_SIZE);

            if (pContentSize)
            {
                m_nOrigContentSize = pContentSize->GetArgN(0)->GetIntValue();
            }

            MHParseNode *pCCPrio = pArg->GetNamedArg(C_CONTENT_CACHE_PRIORITY);

            if (pCCPrio)
            {
                m_nOrigCCPrio = pCCPrio->GetArgN(0)->GetIntValue();
            }
        }
    }

    MHParseNode *pShared = p->GetNamedArg(C_SHARED);

    if (pShared)
    {
        m_fShared = pShared->GetArgN(0)->GetBoolValue();
    }
}
Пример #30
0
void MHText::Initialise(MHParseNode *p, MHEngine *engine)
{
    MHVisible::Initialise(p, engine);
    // Font and attributes.
    MHParseNode *pFontBody = p->GetNamedArg(C_ORIGINAL_FONT);

    if (pFontBody)
    {
        m_OrigFont.Initialise(pFontBody->GetArgN(0), engine);
    }

    MHParseNode *pFontAttrs = p->GetNamedArg(C_FONT_ATTRIBUTES);

    if (pFontAttrs)
    {
        pFontAttrs->GetArgN(0)->GetStringValue(m_OriginalFontAttrs);
    }

    // Colours
    MHParseNode *pTextColour = p->GetNamedArg(C_TEXT_COLOUR);

    if (pTextColour)
    {
        m_OriginalTextColour.Initialise(pTextColour->GetArgN(0), engine);
    }

    MHParseNode *pBGColour = p->GetNamedArg(C_BACKGROUND_COLOUR);

    if (pBGColour)
    {
        m_OriginalBgColour.Initialise(pBGColour->GetArgN(0), engine);
    }

    // Character set
    MHParseNode *pChset = p->GetNamedArg(C_CHARACTER_SET);

    if (pChset)
    {
        m_nCharSet = pChset->GetArgN(0)->GetIntValue();
    }

    // Justification
    MHParseNode *pHJust = p->GetNamedArg(C_HORIZONTAL_JUSTIFICATION);

    if (pHJust)
    {
        m_HorizJ = (enum Justification)pHJust->GetArgN(0)->GetEnumValue();
    }

    MHParseNode *pVJust = p->GetNamedArg(C_VERTICAL_JUSTIFICATION);

    if (pVJust)
    {
        m_VertJ = (enum Justification)pVJust->GetArgN(0)->GetEnumValue();
    }

    // Line orientation
    MHParseNode *pLineO = p->GetNamedArg(C_LINE_ORIENTATION);

    if (pLineO)
    {
        m_LineOrientation = (enum LineOrientation)pLineO->GetArgN(0)->GetEnumValue();
    }

    // Start corner
    MHParseNode *pStartC = p->GetNamedArg(C_START_CORNER);

    if (pStartC)
    {
        m_StartCorner = (enum StartCorner)pStartC->GetArgN(0)->GetEnumValue();
    }

    // Text wrapping
    MHParseNode *pTextWrap = p->GetNamedArg(C_TEXT_WRAPPING);

    if (pTextWrap)
    {
        m_fTextWrap = pTextWrap->GetArgN(0)->GetBoolValue();
    }

    m_pDisplay = engine->GetContext()->CreateText();
    m_fNeedsRedraw = true;
}