Ejemplo n.º 1
0
 // Return the value, looking up any indirect ref.
 public int GetValue(MHEngine engine)
 {
     if (m_fIsDirect)
     {
         return(m_nDirect);
     }
     else
     {
         MHUnion result = new MHUnion();
         MHRoot  pBase  = engine.FindObject(m_Indirect);
         pBase.GetVariableValue(result, engine);
         // From my reading of the MHEG documents implicit conversion is only
         // performed when assigning variables.  Nevertheless the Channel 4
         // Teletext assumes that implicit conversion takes place here as well.
         if (result.Type == MHUnion.U_String)
         {
             // Implicit conversion of string to integer.
             return(Convert.ToInt32(result.String.ToString()));
         }
         else
         {
             result.CheckType(MHUnion.U_Int);
             return(result.Int);
         }
     }
 }
Ejemplo n.º 2
0
        public MHRoot FindObject(MHObjectRef oRef, bool failOnNotFound)
        {
            // It should match either the application or the scene.
            MHGroup pSearch = null;
            MHGroup pScene  = CurrentScene();
            MHGroup pApp    = CurrentApp();

            if (pScene != null && GetPathName(pScene.ObjectIdentifier.GroupId) == GetPathName(oRef.GroupId))
            {
                pSearch = pScene;
            }
            else if (pApp != null && GetPathName(pApp.ObjectIdentifier.GroupId) == GetPathName(oRef.GroupId))
            {
                pSearch = pApp;
            }
            if (pSearch != null)
            {
                MHRoot pItem = pSearch.FindByObjectNo(oRef.ObjectNo);
                if (pItem != null)
                {
                    return(pItem);
                }
            }
            if (failOnNotFound)
            {
                // I've seen at least one case where MHEG code has quite deliberately referred to
                // an object that may or may not exist at a particular time.
                // Another case was a call to CallActionSlot with an object reference variable
                // that had been initialised to zero.
                Logging.Log(Logging.MHLogWarning, "Reference " + oRef.ObjectNo + " not found");
                throw new MHEGException("FindObject failed");
            }
            return(null); // If we don't generate an error.
        }
Ejemplo n.º 3
0
 // Return the value, looking up any indirect ref.
 public void GetValue(MHOctetString str, MHEngine engine)
 {
     if (m_fIsDirect)
     {
         str.Copy(m_Direct);
     }
     else
     {
         MHUnion result = new MHUnion();
         MHRoot  pBase  = engine.FindObject(m_Indirect);
         pBase.GetVariableValue(result, engine);
         // From my reading of the MHEG documents implicit conversion is only
         // performed when assigning variables.  Nevertheless the Channel 4
         // Teletext assumes that implicit conversion takes place here as well.
         if (result.Type == MHUnion.U_Int)
         {
             // Implicit conversion of string to integer.
             MHOctetString s = new MHOctetString("" + result.Int);
             str.Copy(s);
         }
         else
         {
             result.CheckType(MHUnion.U_String);
             str.Copy(result.String);
         }
     }
 }
Ejemplo n.º 4
0
        public void PutBefore(MHRoot p, MHRoot pRef)
        {
            int nPos = CurrentApp().FindOnStack(p);

            if (nPos == -1)
            {
                return;                    // If it's not there do nothing
            }
            MHVisible pVis = (MHVisible)p; // Can now safely cast it.
            int       nRef = CurrentApp().FindOnStack(pRef);

            if (nRef == -1)
            {
                return;             // If the reference visible isn't there do nothing.
            }
            CurrentApp().DisplayStack.RemoveAt(nPos);
            if (nRef >= nPos)
            {
                nRef--;               // The position of the reference may have shifted
            }
            CurrentApp().DisplayStack.InsertAt(pVis, nRef + 1);
            // Redraw the area occupied by the moved item.  We might be able to reduce
            // the area to be redrawn by looking at the way it is affected by other items
            // in the stack.  We could also see whether it's currently active.
            Redraw(pVis.GetVisibleArea()); // Request a redraw
        }
Ejemplo n.º 5
0
        public void EventTriggered(MHRoot pSource, int ev, MHUnion evData)
        {
            Logging.Log(Logging.MHLogLinks, "Event - " + MHLink.EventTypeToString(ev) + " from " + pSource.ObjectIdentifier.Printable());

            switch (ev)
            {
            case MHRoot.EventFirstItemPresented:
            case MHRoot.EventHeadItems:
            case MHRoot.EventHighlightOff:
            case MHRoot.EventHighlightOn:
            case MHRoot.EventIsAvailable:
            case MHRoot.EventIsDeleted:
            case MHRoot.EventIsDeselected:
            case MHRoot.EventIsRunning:
            case MHRoot.EventIsSelected:
            case MHRoot.EventIsStopped:
            case MHRoot.EventItemDeselected:
            case MHRoot.EventItemSelected:
            case MHRoot.EventLastItemPresented:
            case MHRoot.EventTailItems:
            case MHRoot.EventTestEvent:
            case MHRoot.EventTokenMovedFrom:
            case MHRoot.EventTokenMovedTo:
                // Synchronous events.  Fire any links that are waiting.
                // The UK MHEG describes this as the preferred interpretation.  We are checking the link
                // at the time we generate the event rather than queuing the synchronous events until
                // this elementary action is complete.  That matters if we are processing an elementary action
                // which will activate or deactivate links.
                CheckLinks(pSource.ObjectIdentifier, ev, evData);
                break;

            case MHRoot.EventAnchorFired:
            case MHRoot.EventAsyncStopped:
            case MHRoot.EventContentAvailable:
            case MHRoot.EventCounterTrigger:
            case MHRoot.EventCursorEnter:
            case MHRoot.EventCursorLeave:
            case MHRoot.EventEngineEvent:
            case MHRoot.EventEntryFieldFull:
            case MHRoot.EventInteractionCompleted:
            case MHRoot.EventStreamEvent:
            case MHRoot.EventStreamPlaying:
            case MHRoot.EventStreamStopped:
            case MHRoot.EventTimerFired:
            case MHRoot.EventUserInput:
            case MHRoot.EventFocusMoved:         // UK MHEG.  Generated by HyperText class
            case MHRoot.EventSliderValueChanged: // UK MHEG.  Generated by Slider class
            {
                // Asynchronous events.  Add to the event queue.
                MHAsynchEvent pEvent = new MHAsynchEvent();
                pEvent.EventSource = pSource;
                pEvent.EventType   = ev;
                pEvent.EventData   = evData;
                m_EventQueue.Add(pEvent);
            } break;
            }
        }
Ejemplo n.º 6
0
        public void SendToBack(MHRoot p)
        {
            int nPos = CurrentApp().FindOnStack(p);

            if (nPos == -1)
            {
                return;                                  // If it's not there do nothing
            }
            MHVisible pVis = (MHVisible)p;               // Can now safely cast it.

            CurrentApp().DisplayStack.RemoveAt(nPos);    // Remove it from its present posn
            CurrentApp().DisplayStack.InsertAt(pVis, 0); // Put it on the bottom.
            Redraw(pVis.GetVisibleArea());               // Request a redraw
        }
Ejemplo n.º 7
0
        // Functions to alter the Z-order.
        public void BringToFront(MHRoot p)
        {
            int nPos = CurrentApp().FindOnStack(p);

            if (nPos == -1)
            {
                return;                                        // If it's not there do nothing
            }
            MHVisible pVis = (MHVisible)p;                     // Can now safely cast it.

            CurrentApp().DisplayStack.RemoveAt(nPos);          // Remove it from its present posn
            CurrentApp().DisplayStack.Append((MHVisible)pVis); // Push it on the top.
            Redraw(pVis.GetVisibleArea());                     // Request a redraw
        }
Ejemplo n.º 8
0
 // Return the value, looking up any indirect ref.
 public void GetValue(MHContentRef reference, MHEngine engine)
 {
     if (m_fIsDirect)
     {
         reference.Copy(m_Direct);
     }
     else
     {
         MHUnion result = new MHUnion();
         MHRoot  pBase  = engine.FindObject(m_Indirect);
         pBase.GetVariableValue(result, engine);
         result.CheckType(MHUnion.U_ContentRef);
         reference.Copy(result.ContentRef);
     }
 }
Ejemplo n.º 9
0
 // Return the value, looking up any indirect ref.
 public bool GetValue(MHEngine engine)
 {
     if (m_fIsDirect)
     {
         return(m_fDirect);
     }
     else
     {
         MHUnion result = new MHUnion();
         MHRoot  pBase  = engine.FindObject(m_Indirect);
         pBase.GetVariableValue(result, engine);
         result.CheckType(MHUnion.U_Bool);
         return(result.Bool);
     }
 }
Ejemplo n.º 10
0
        public void PutBehind(MHRoot p, MHRoot pRef)
        {
            int nPos = CurrentApp().FindOnStack(p);

            if (nPos == -1)
            {
                return;             // If it's not there do nothing
            }
            int nRef = CurrentApp().FindOnStack(pRef);

            if (nRef == -1)
            {
                return;                    // If the reference visible isn't there do nothing.
            }
            MHVisible pVis = (MHVisible)p; // Can now safely cast it.

            CurrentApp().DisplayStack.RemoveAt(nPos);
            if (nRef >= nPos)
            {
                nRef--;                                                // The position of the reference may have shifted
            }
            CurrentApp().DisplayStack.InsertAt((MHVisible)pVis, nRef); // Shift the reference and anything above up.
            Redraw(pVis.GetVisibleArea());                             // Request a redraw
        }
Ejemplo n.º 11
0
 public virtual void GetBoxSize(MHRoot pWidthDest, MHRoot HeightDest)
 {
     InvalidAction("GetBoxSize");
 }
Ejemplo n.º 12
0
 public virtual void PutBefore(MHRoot pRef, MHEngine engine)
 {
     InvalidAction("PutBefore");
 }
Ejemplo n.º 13
0
 public virtual void GetListSize(MHRoot pResult, MHEngine engine)
 {
     InvalidAction("GetListSize");
 }
Ejemplo n.º 14
0
 public virtual void GetPosition(MHRoot pXPosN, MHRoot pYPosN)
 {
     InvalidAction("GetPosition");
 }
Ejemplo n.º 15
0
 public virtual void DelItem(MHRoot pItem, MHEngine engine)
 {
     InvalidAction("GetCellItem");
 }
Ejemplo n.º 16
0
 public virtual void GetFirstItem(MHRoot pResult, MHEngine engine)
 {
     InvalidAction("GetFirstItem");
 }
Ejemplo n.º 17
0
 // Actions on ListGroups
 public virtual void AddItem(int nIndex, MHRoot pItem, MHEngine engine)
 {
     InvalidAction("GetCellItem");
 }
Ejemplo n.º 18
0
 // Called when an event is triggered.  Either queues the event or finds a link that matches.
 public void EventTriggered(MHRoot pSource, int eventType)
 {
     EventTriggered(pSource, eventType, new MHUnion());
 }
Ejemplo n.º 19
0
 public virtual void GetFillColour(MHRoot pResult)
 {
     InvalidAction("GetFillColour");
 }
Ejemplo n.º 20
0
 public virtual void GetLineWidth(MHRoot pResult)
 {
     InvalidAction("GetLineWidth");
 }
Ejemplo n.º 21
0
 public virtual void PutBehind(MHRoot pRef, MHEngine engine)
 {
     InvalidAction("PutBehind");
 }
Ejemplo n.º 22
0
 public virtual void GetBitmapDecodeOffset(MHRoot pXOffset, MHRoot pYOffset)
 {
     InvalidAction("GetBitmapDecodeOffset");
 }
Ejemplo n.º 23
0
 // This isn't an MHEG action as such but is used as part of the implementation of "Clone"
 public virtual void MakeClone(MHRoot target, MHRoot reference, MHEngine engine)
 {
     InvalidAction("MakeClone");
 }
Ejemplo n.º 24
0
 public virtual void GetLineStyle(MHRoot pResult)
 {
     InvalidAction("GetLineStyle");
 }
Ejemplo n.º 25
0
 // Actions on Text objects
 public virtual void GetTextData(MHRoot pDestination, MHEngine engine)
 {
     InvalidAction("GetTextData");
 }
Ejemplo n.º 26
0
 public virtual void GetVideoDecodeOffset(MHRoot pXOffset, MHRoot pYOffset, MHEngine engine)
 {
     InvalidAction("GetVideoDecodeOffset");
 }
Ejemplo n.º 27
0
 public virtual void GetTokenPosition(MHRoot pResult, MHEngine engine)
 {
     InvalidAction("GetTokenPosition");
 }