示例#1
0
        public override void Initialise(MHParseNode p, MHEngine engine)
        {
            base.Initialise(p, engine);
            m_nComponentTag = p.GetNamedArg(ASN1Codes.C_COMPONENT_TAG).GetArgN(0).GetIntValue();
            MHParseNode pTerm = p.GetNamedArg(ASN1Codes.C_TERMINATION);

            if (pTerm != null)
            {
                m_Termination = pTerm.GetEnumValue();
            }
        }
示例#2
0
        public override void Initialise(MHParseNode p, MHEngine engine)
        {
            base.Initialise(p, engine);
            m_nComponentTag = p.GetNamedArg(ASN1Codes.C_COMPONENT_TAG).GetArgN(0).GetIntValue();
            MHParseNode pOrigVol = p.GetNamedArg(ASN1Codes.C_ORIGINAL_VOLUME);

            if (pOrigVol != null)
            {
                m_nOriginalVol = pOrigVol.GetIntValue();
            }
        }
示例#3
0
        // Set this up from the parse tree.
        public override void Initialise(MHParseNode p, MHEngine engine)
        {
            base.Initialise(p, engine);
            Logging.Assert(m_ObjectIdentifier.ObjectNo > 0);
            MHParseNode pIA = p.GetNamedArg(ASN1Codes.C_INITIALLY_ACTIVE);

            if (pIA != null)
            {
                m_fInitiallyActive = pIA.GetArgN(0).GetBoolValue();
            }

            MHParseNode pCHook = p.GetNamedArg(ASN1Codes.C_CONTENT_HOOK);

            if (pCHook != null)
            {
                m_nContentHook = pCHook.GetArgN(0).GetIntValue();
            }

            MHParseNode pOrigContent = p.GetNamedArg(ASN1Codes.C_ORIGINAL_CONTENT);

            if (pOrigContent != null)
            {
                MHParseNode pArg = pOrigContent.GetArgN(0);
                // Either a string - included content.
                if (pArg.NodeType == 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(ASN1Codes.C_CONTENT_SIZE);
                    if (pContentSize != null)
                    {
                        m_nOrigContentSize = pContentSize.GetArgN(0).GetIntValue();
                    }
                    MHParseNode pCCPrio = pArg.GetNamedArg(ASN1Codes.C_CONTENT_CACHE_PRIORITY);
                    if (pCCPrio != null)
                    {
                        m_nOrigCCPrio = pCCPrio.GetArgN(0).GetIntValue();
                    }
                }
            }

            MHParseNode pShared = p.GetNamedArg(ASN1Codes.C_SHARED);

            if (pShared != null)
            {
                m_fShared = pShared.GetArgN(0).GetBoolValue();
            }
        }
示例#4
0
        public override void Initialise(MHParseNode p, MHEngine engine)
        {
            base.Initialise(p, engine);
            p.GetNamedArg(ASN1Codes.C_NAME).GetArgN(0).GetStringValue(m_Name); // Program name
            MHParseNode pAvail = p.GetNamedArg(ASN1Codes.C_INITIALLY_AVAILABLE);

            if (pAvail != null)
            {
                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;
        }
示例#5
0
        public override void Initialise(MHParseNode p, MHEngine engine)
        {
            base.Initialise(p, engine);
            // Original value should be an int.
            MHParseNode pInitial = p.GetNamedArg(ASN1Codes.C_ORIGINAL_VALUE);

            m_nOriginalValue = pInitial.GetArgN(0).GetIntValue();
        }
示例#6
0
        public override void Initialise(MHParseNode p, MHEngine engine)
        {
            base.Initialise(p, engine);
            // Original value should be an Content reference.
            MHParseNode pInitial = p.GetNamedArg(ASN1Codes.C_ORIGINAL_VALUE);
            // and this should be a ObjRef node.
            MHParseNode pArg = pInitial.GetNamedArg(ASN1Codes.C_CONTENT_REFERENCE);

            m_OriginalValue.Initialise(pArg.GetArgN(0), engine);
        }
示例#7
0
 public override void Initialise(MHParseNode p, MHEngine engine)
 {
     base.Initialise(p, engine);
     if (p.GetArgCount() > 1)
     {
         MHParseNode pIndexed  = p.GetNamedArg(ASN1Codes.C_NEW_COLOUR_INDEX);
         MHParseNode pAbsolute = p.GetNamedArg(ASN1Codes.C_NEW_ABSOLUTE_COLOUR);
         if (pIndexed != null)
         {
             m_ColourType = CT_Indexed;
             m_Indexed.Initialise(pIndexed.GetArgN(0), engine);
         }
         else if (pAbsolute != null)
         {
             m_ColourType = CT_Absolute;
             m_Absolute.Initialise(pAbsolute.GetArgN(0), engine);
         }
     }
 }
示例#8
0
        public override void Initialise(MHParseNode p, MHEngine engine)
        {
            base.Initialise(p, engine);
            // Tiling - optional
            MHParseNode pTiling = p.GetNamedArg(ASN1Codes.C_TILING);

            if (pTiling != null)
            {
                m_fTiling = pTiling.GetArgN(0).GetBoolValue();
            }
            // Transparency - optional
            MHParseNode pTransparency = p.GetNamedArg(ASN1Codes.C_ORIGINAL_TRANSPARENCY);

            if (pTransparency != null)
            {
                m_nOrigTransparency = pTransparency.GetArgN(0).GetIntValue();
            }
            m_pContent = engine.GetContext().CreateBitmap(m_fTiling);
        }
示例#9
0
        public override void Initialise(MHParseNode p, MHEngine engine)
        {
            base.Initialise(p, engine);
            MHParseNode pMovements = p.GetNamedArg(ASN1Codes.C_MOVEMENT_TABLE);

            if (pMovements != null)
            {
                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(ASN1Codes.C_TOKEN_GROUP_ITEMS);

            if (pTokenGrp != null)
            {
                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(ASN1Codes.C_NO_TOKEN_ACTION_SLOTS);

            if (pNoToken != null)
            {
                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.NodeType != MHParseNode.PNNull)
                    {
                        pActions.Initialise(pAct, engine);
                    }
                }
            }
        }
示例#10
0
        public override void Initialise(MHParseNode p, MHEngine engine)
        {
            base.Initialise(p, engine);
            MHParseNode pMultiplex = p.GetNamedArg(ASN1Codes.C_MULTIPLEX);

            for (int i = 0; i < pMultiplex.GetArgCount(); i++)
            {
                MHParseNode pItem = pMultiplex.GetArgN(i);
                if (pItem.GetTagNo() == ASN1Codes.C_AUDIO)
                {
                    MHAudio pAudio = new MHAudio();
                    m_Multiplex.Append(pAudio);
                    pAudio.Initialise(pItem, engine);
                }
                else if (pItem.GetTagNo() == ASN1Codes.C_VIDEO)
                {
                    MHVideo pVideo = new MHVideo();
                    m_Multiplex.Append(pVideo);
                    pVideo.Initialise(pItem, engine);
                }
                else if (pItem.GetTagNo() == ASN1Codes.C_RTGRAPHICS)
                {
                    MHRTGraphics pRtGraph = new MHRTGraphics();
                    m_Multiplex.Append(pRtGraph);
                    pRtGraph.Initialise(pItem, engine);
                }
                // Ignore unknown items
            }
            MHParseNode pStorage = p.GetNamedArg(ASN1Codes.C_STORAGE);

            if (pStorage != null)
            {
                m_nStorage = pStorage.GetArgN(0).GetEnumValue();
            }
            MHParseNode pLooping = p.GetNamedArg(ASN1Codes.C_LOOPING);

            if (pLooping != null)
            {
                m_nLooping = pLooping.GetArgN(0).GetIntValue();
            }
        }
示例#11
0
        public override void Initialise(MHParseNode p, MHEngine engine)
        {
            base.Initialise(p, engine);
            // Original box size - two integer arguments.
            MHParseNode pOriginalBox = p.GetNamedArg(ASN1Codes.C_ORIGINAL_BOX_SIZE);
            if (pOriginalBox == null) p.Failure("OriginalBoxSize missing");
            m_nOriginalBoxWidth = pOriginalBox.GetArgN(0).GetIntValue();
            m_nOriginalBoxHeight = pOriginalBox.GetArgN(1).GetIntValue();

            // Original position - two integer arguments.  Optional
            MHParseNode pOriginalPos = p.GetNamedArg(ASN1Codes.C_ORIGINAL_POSITION);
            if (pOriginalPos != null) 
            {
                m_nOriginalPosX = pOriginalPos.GetArgN(0).GetIntValue();
                m_nOriginalPosY = pOriginalPos.GetArgN(1).GetIntValue();
            }

            // OriginalPalette ref - optional. 
            MHParseNode pOriginalPaletteRef = p.GetNamedArg(ASN1Codes.C_ORIGINAL_PALETTE_REF);
            if (pOriginalPaletteRef != null) m_OriginalPaletteRef.Initialise(pOriginalPaletteRef.GetArgN(0), engine);
        }
示例#12
0
        public override void Initialise(MHParseNode p, MHEngine engine)
        {
            base.Initialise(p, engine);
            // Bordered bounding box - optional
            MHParseNode pBBBox = p.GetNamedArg(ASN1Codes.C_BORDERED_BOUNDING_BOX);

            if (pBBBox != null)
            {
                m_fBorderedBBox = pBBBox.GetArgN(0).GetBoolValue();
            }
            // Original line width
            MHParseNode pOlw = p.GetNamedArg(ASN1Codes.C_ORIGINAL_LINE_WIDTH);

            if (pOlw != null)
            {
                m_nOriginalLineWidth = pOlw.GetArgN(0).GetIntValue();
            }
            // Original line style.  This is an integer not an enum.
            MHParseNode pOls = p.GetNamedArg(ASN1Codes.C_ORIGINAL_LINE_STYLE);

            if (pOls != null)
            {
                m_OriginalLineStyle = pOls.GetArgN(0).GetIntValue();
            }
            // Line colour.
            MHParseNode pOrlc = p.GetNamedArg(ASN1Codes.C_ORIGINAL_REF_LINE_COLOUR);

            if (pOrlc != null)
            {
                m_OrigLineColour.Initialise(pOrlc.GetArgN(0), engine);
            }
            // Fill colour
            MHParseNode pOrfc = p.GetNamedArg(ASN1Codes.C_ORIGINAL_REF_FILL_COLOUR);

            if (pOrfc != null)
            {
                m_OrigFillColour.Initialise(pOrfc.GetArgN(0), engine);
            }
        }
示例#13
0
        // Set this up from the parse tree.
        public override void Initialise(MHParseNode p, MHEngine engine)
        {
            base.Initialise(p, engine);
            // Event register.
            MHParseNode pInputEventReg = p.GetNamedArg(ASN1Codes.C_INPUT_EVENT_REGISTER);

            m_nEventReg = pInputEventReg.GetArgN(0).GetIntValue();
            // Co-ordinate system
            MHParseNode pSceneCoords = p.GetNamedArg(ASN1Codes.C_SCENE_COORDINATE_SYSTEM);

            m_nSceneCoordX = pSceneCoords.GetArgN(0).GetIntValue();
            m_nSceneCoordY = pSceneCoords.GetArgN(1).GetIntValue();
            // Aspect ratio
            MHParseNode pAspectRatio = p.GetNamedArg(ASN1Codes.C_ASPECT_RATIO);

            if (pAspectRatio != null)
            {
                // 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(ASN1Codes.C_MOVING_CURSOR);

            if (pMovingCursor != null)
            {
                pMovingCursor.GetArgN(0).GetBoolValue();
            }
            // Next scene sequence.
            MHParseNode pNextScenes = p.GetNamedArg(ASN1Codes.C_NEXT_SCENES);

            if (pNextScenes != null)
            {
                // TODO:
                Logging.Assert(false);
            }
        }
示例#14
0
        public override void Initialise(MHParseNode p, MHEngine engine)
        {
            base.Initialise(p, engine);
            MHParseNode pPositions = p.GetNamedArg(ASN1Codes.C_POSITIONS);

            for (int i = 0; i < pPositions.GetArgCount(); i++)
            {
                MHParseNode pPos = pPositions.GetArgN(i);
                Point       pos  = new Point(pPos.GetSeqN(0).GetIntValue(), pPos.GetSeqN(1).GetIntValue());
                m_Positions.Append(pos);
            }
            MHParseNode pWrap = p.GetNamedArg(ASN1Codes.C_WRAP_AROUND);

            if (pWrap != null)
            {
                m_fWrapAround = pWrap.GetArgN(0).GetBoolValue();
            }
            MHParseNode pMultiple = p.GetNamedArg(ASN1Codes.C_MULTIPLE_SELECTION);

            if (pMultiple != null)
            {
                m_fMultipleSelection = pMultiple.GetArgN(0).GetBoolValue();
            }
        }
示例#15
0
        // 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);
                }
            }
        }
示例#16
0
        public override void Initialise(MHParseNode p, MHEngine engine)
        {
            base.Initialise(p, engine);
            // OnSpawnCloseDown
            MHParseNode pOnSpawn = p.GetNamedArg(ASN1Codes.C_ON_SPAWN_CLOSE_DOWN);

            if (pOnSpawn != null)
            {
                m_OnSpawnCloseDown.Initialise(pOnSpawn, engine);
            }
            // OnRestart
            MHParseNode pOnRestart = p.GetNamedArg(ASN1Codes.C_ON_RESTART);

            if (pOnRestart != null)
            {
                m_OnRestart.Initialise(pOnRestart, engine);
            }
            // Default attributes.  These are encoded in a group in binary.
            MHParseNode pDefattrs = p.GetNamedArg(ASN1Codes.C_DEFAULT_ATTRIBUTES);

            // but in the text form they're encoded in the Application block.
            if (pDefattrs == null)
            {
                pDefattrs = p;
            }
            MHParseNode pCharSet = pDefattrs.GetNamedArg(ASN1Codes.C_CHARACTER_SET);

            if (pCharSet != null)
            {
                m_nCharSet = pCharSet.GetArgN(0).GetIntValue();
            }
            // Colours
            MHParseNode pBGColour = pDefattrs.GetNamedArg(ASN1Codes.C_BACKGROUND_COLOUR);

            if (pBGColour != null)
            {
                m_BGColour.Initialise(pBGColour.GetArgN(0), engine);
            }
            MHParseNode pTextColour = pDefattrs.GetNamedArg(ASN1Codes.C_TEXT_COLOUR);

            if (pTextColour != null)
            {
                m_TextColour.Initialise(pTextColour.GetArgN(0), engine);
            }
            MHParseNode pButtonRefColour = pDefattrs.GetNamedArg(ASN1Codes.C_BUTTON_REF_COLOUR);

            if (pButtonRefColour != null)
            {
                m_ButtonRefColour.Initialise(pButtonRefColour.GetArgN(0), engine);
            }
            MHParseNode pHighlightRefColour = pDefattrs.GetNamedArg(ASN1Codes.C_HIGHLIGHT_REF_COLOUR);

            if (pHighlightRefColour != null)
            {
                m_HighlightRefColour.Initialise(pHighlightRefColour.GetArgN(0), engine);
            }
            MHParseNode pSliderRefColour = pDefattrs.GetNamedArg(ASN1Codes.C_SLIDER_REF_COLOUR);

            if (pSliderRefColour != null)
            {
                m_SliderRefColour.Initialise(pSliderRefColour.GetArgN(0), engine);
            }
            // Content hooks
            MHParseNode pTextCHook = pDefattrs.GetNamedArg(ASN1Codes.C_TEXT_CONTENT_HOOK);

            if (pTextCHook != null)
            {
                m_nTextCHook = pTextCHook.GetArgN(0).GetIntValue();
            }
            MHParseNode pIPCHook = pDefattrs.GetNamedArg(ASN1Codes.C_IP_CONTENT_HOOK);

            if (pIPCHook != null)
            {
                m_nIPCHook = pIPCHook.GetArgN(0).GetIntValue();
            }
            MHParseNode pStrCHook = pDefattrs.GetNamedArg(ASN1Codes.C_STREAM_CONTENT_HOOK);

            if (pStrCHook != null)
            {
                m_nStrCHook = pStrCHook.GetArgN(0).GetIntValue();
            }
            MHParseNode pBitmapCHook = pDefattrs.GetNamedArg(ASN1Codes.C_BITMAP_CONTENT_HOOK);

            if (pBitmapCHook != null)
            {
                m_nBitmapCHook = pBitmapCHook.GetArgN(0).GetIntValue();
            }
            MHParseNode pLineArtCHook = pDefattrs.GetNamedArg(ASN1Codes.C_LINE_ART_CONTENT_HOOK);

            if (pLineArtCHook != null)
            {
                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(ASN1Codes.C_FONT2);

            if (pFont == null)
            {
                pFont = pDefattrs.GetNamedArg(ASN1Codes.C_FONT);
            }
            if (pFont != null)
            {
                m_Font.Initialise(pFont.GetArgN(0), engine);
            }
            // Font attributes.
            MHParseNode pFontAttrs = pDefattrs.GetNamedArg(ASN1Codes.C_FONT_ATTRIBUTES);

            if (pFontAttrs != null)
            {
                pFontAttrs.GetArgN(0).GetStringValue(m_FontAttrs);
            }
        }
示例#17
0
        // Set this up from the parse tree.
        public override void Initialise(MHParseNode p, MHEngine engine)
        {
            base.Initialise(p, engine);
            // The link condition is encoded differently in the binary and text representations.
            MHParseNode pLinkCond = p.GetNamedArg(ASN1Codes.C_LINK_CONDITION);

            if (pLinkCond != null)
            {                                                           // Only in binary.
                m_EventSource.Initialise(pLinkCond.GetArgN(0), engine); // Event source
                m_nEventType = pLinkCond.GetArgN(1).GetEnumValue();     // Event type
                // The event data is optional and type-dependent.
                if (pLinkCond.GetArgCount() >= 3)
                {
                    MHParseNode pEventData = pLinkCond.GetArgN(2);
                    switch (pEventData.NodeType)
                    {
                    case MHParseNode.PNBool: m_EventData.Bool = pEventData.GetBoolValue(); m_EventData.Type = MHUnion.U_Bool; break;

                    case MHParseNode.PNInt: m_EventData.Int = pEventData.GetIntValue(); m_EventData.Type = MHUnion.U_Int; break;

                    case MHParseNode.PNString: pEventData.GetStringValue(m_EventData.String); m_EventData.Type = MHUnion.U_String; break;

                    default: pEventData.Failure("Unknown type of event data"); break;
                    }
                }
            }
            else
            {                                                                       // Only in text.
                MHParseNode pEventSource = p.GetNamedArg(ASN1Codes.P_EVENT_SOURCE); // Event source
                if (pEventSource == null)
                {
                    p.Failure("Missing :EventSource");
                }
                m_EventSource.Initialise(pEventSource.GetArgN(0), engine);
                MHParseNode pEventType = p.GetNamedArg(ASN1Codes.P_EVENT_TYPE); // Event type
                if (pEventType == null)
                {
                    p.Failure("Missing :EventType");
                }
                m_nEventType = pEventType.GetArgN(0).GetEnumValue();
                MHParseNode pEventData = p.GetNamedArg(ASN1Codes.P_EVENT_DATA); // Event data - optional
                if (pEventData != null)
                {
                    MHParseNode pEventDataArg = pEventData.GetArgN(0);
                    switch (pEventDataArg.NodeType)
                    {
                    case MHParseNode.PNBool: m_EventData.Bool = pEventDataArg.GetBoolValue(); m_EventData.Type = MHUnion.U_Bool; break;

                    case MHParseNode.PNInt: m_EventData.Int = pEventDataArg.GetIntValue(); m_EventData.Type = MHUnion.U_Int; break;

                    case MHParseNode.PNString: pEventDataArg.GetStringValue(m_EventData.String); m_EventData.Type = MHUnion.U_String; break;

                    default: pEventDataArg.Failure("Unknown type of event data"); break;
                    }
                }
            }

            MHParseNode pLinkEffect = p.GetNamedArg(ASN1Codes.C_LINK_EFFECT);

            m_LinkEffect.Initialise(pLinkEffect, engine);
        }
示例#18
0
        public override void Initialise(MHParseNode p, MHEngine engine)
        {
            base.Initialise(p, engine);
            // Font and attributes.
            MHParseNode pFontBody = p.GetNamedArg(ASN1Codes.C_ORIGINAL_FONT);

            if (pFontBody != null)
            {
                m_OrigFont.Initialise(pFontBody.GetArgN(0), engine);
            }
            MHParseNode pFontAttrs = p.GetNamedArg(ASN1Codes.C_FONT_ATTRIBUTES);

            if (pFontAttrs != null)
            {
                pFontAttrs.GetArgN(0).GetStringValue(m_OriginalFontAttrs);
            }
            // Colours
            MHParseNode pTextColour = p.GetNamedArg(ASN1Codes.C_TEXT_COLOUR);

            if (pTextColour != null)
            {
                m_OriginalTextColour.Initialise(pTextColour.GetArgN(0), engine);
            }
            MHParseNode pBGColour = p.GetNamedArg(ASN1Codes.C_BACKGROUND_COLOUR);

            if (pBGColour != null)
            {
                m_OriginalBgColour.Initialise(pBGColour.GetArgN(0), engine);
            }
            // Character set
            MHParseNode pChset = p.GetNamedArg(ASN1Codes.C_CHARACTER_SET);

            if (pChset != null)
            {
                m_nCharSet = pChset.GetArgN(0).GetIntValue();
            }
            // Justification
            MHParseNode pHJust = p.GetNamedArg(ASN1Codes.C_HORIZONTAL_JUSTIFICATION);

            if (pHJust != null)
            {
                m_HorizJ = pHJust.GetArgN(0).GetEnumValue();
            }
            MHParseNode pVJust = p.GetNamedArg(ASN1Codes.C_VERTICAL_JUSTIFICATION);

            if (pVJust != null)
            {
                m_VertJ = pVJust.GetArgN(0).GetEnumValue();
            }
            // Line orientation
            MHParseNode pLineO = p.GetNamedArg(ASN1Codes.C_LINE_ORIENTATION);

            if (pLineO != null)
            {
                m_LineOrientation = pLineO.GetArgN(0).GetEnumValue();
            }
            // Start corner
            MHParseNode pStartC = p.GetNamedArg(ASN1Codes.C_START_CORNER);

            if (pStartC != null)
            {
                m_StartCorner = pStartC.GetArgN(0).GetEnumValue();
            }
            // Text wrapping
            MHParseNode pTextWrap = p.GetNamedArg(ASN1Codes.C_TEXT_WRAPPING);

            if (pTextWrap != null)
            {
                m_fTextWrap = pTextWrap.GetArgN(0).GetBoolValue();
            }

            m_pDisplay    = engine.GetContext().CreateText();
            m_NeedsRedraw = true;
        }