///// <summary> ///// These messages allow us to create a map of slides and md5 hashes. Unused. ///// </summary> ///// <param name="ism"></param> //internal void AddImageSheetMessage(UW.ClassroomPresenter.Network.Messages.Presentation.ImageSheetMessage ism) { // if ((ism.Parent != null) && (ism.Parent.Parent != null) && // (ism.Parent is CP3Msgs.SlideInformationMessage) && // (ism.Parent.Parent is CP3Msgs.DeckInformationMessage)) { // Debug.WriteLine("ImageSheetMessage: sheet=" + ism.TargetId.ToString() + ";slide=" + ism.Parent.TargetId.ToString() + // ";deck=" + ism.Parent.Parent.TargetId.ToString() + ";hash=" + ism.MD5.ToString()); // } //} /// <summary> /// Text annotation add or update operation. /// </summary> /// <param name="textSheetMessage"></param> /// <returns></returns> internal object AddTextSheet(UW.ClassroomPresenter.Network.Messages.Presentation.TextSheetMessage tsm) { if ((tsm.Parent == null) || !(tsm.Parent is CP3Msgs.SlideInformationMessage)) { warning += "Failed to locate slide for a text sheet. Ignoring Text Annotation. "; return(null); } Guid slideId = (Guid)tsm.Parent.TargetId; TableOfContents.TocEntry tocEntry = toc.LookupBySlideId(slideId); if (tocEntry == null) { warning += "Warning: Failed to find table of contents entry for a text annotation. Ignoring the annotation. "; return(null); } //WebViewer wants things scaled to 500x500 (this was a CP2 convention). Rectangle r = ((CP3Msgs.SheetMessage)tsm).Bounds; float fX = (float)r.X * 500F / getCurrentSlideWidth(); float fY = (float)r.Y * 500F / getCurrentSlideHeight(); Point scaledOrigin = new Point((int)Math.Round(fX), (int)Math.Round(fY)); Font scaledFont = new Font(tsm.font_.FontFamily, tsm.font_.Size * 500F / getCurrentSlideWidth(), tsm.font_.Style); int scaledWidth = r.Width * 500 / (int)getCurrentSlideWidth(); int scaledHeight = r.Height * 500 / (int)getCurrentSlideHeight(); RTTextAnnotation rtta = new RTTextAnnotation(scaledOrigin, scaledFont, tsm.color_, tsm.Text, (Guid)tsm.TargetId, tocEntry.DeckId, tocEntry.SlideIndex, scaledWidth, scaledHeight); return(rtta); }
private void ReceiveTextAnnotation(RTTextAnnotation rtta) { int slideIndex; slideIndex = slideMap.GetMapping(rtta.SlideIndex, rtta.DeckGuid); //Get the slide and overlay Slide s = SlideDeck.GetSlide(slideIndex); SlideOverlay so = SlideDeck.GetOverlay(slideIndex); lock (so.TextAnnotations) { //If the annotation is already on the slide, replace, otherwise add. if (so.TextAnnotations.ContainsKey(rtta.Guid)) { so.TextAnnotations[rtta.Guid] = new TextAnnotation(rtta.Guid, rtta.Text, rtta.Color, rtta.Font, rtta.Origin, rtta.Width, rtta.Height); } else { so.TextAnnotations.Add(rtta.Guid, new TextAnnotation(rtta.Guid, rtta.Text, rtta.Color, rtta.Font, rtta.Origin, rtta.Width, rtta.Height)); } } so.RefreshDynamicElements(); }
/// <summary> /// RTTextAnnotation is obsolete with CP 3.1 and later. /// </summary> /// <param name="rtta"></param> private void FilterRTTextAnnotation(RTTextAnnotation rtta) { Guid guid = rtta.Guid; //verify that this property is actually populated. BufferChunk data; lock (subQueue) { //if annotation with this guid is found in low priority queue, replace it, otherwise enqueue it. for (int i = 0; i < subQueue.Count; i++) { if ((((WorkItem)subQueue[i]).OpCode == PacketType.RTTextAnnotation) && (((WorkItem)subQueue[i]).Guid == guid)) { subQueue.RemoveAt(i); break; } } } data = new BufferChunk(Helpers.ObjectToByteArray(rtta)); WorkItem wi = new WorkItem(data, PacketType.RTTextAnnotation, guid); wi.DeckGuid = rtta.DeckGuid; wi.SlideIndex = rtta.SlideIndex; enqueueSub(wi); }