Ejemplo n.º 1
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);
            }
        }
Ejemplo n.º 2
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;
        }
Ejemplo n.º 3
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);
            }
        }