Example #1
0
        ///////////////////////////////////////////////////////////////////////////////
        // Eventhandler                                                              //
        ///////////////////////////////////////////////////////////////////////////////
        #region EVENTS

        ///////////////////////////////////////////////////////////////////////////////
        // Eventhandler for UI, Menu, Buttons, Toolbars etc.                         //
        ///////////////////////////////////////////////////////////////////////////////
        #region WINDOWSEVENTHANDLER
        #endregion //WINDOWSEVENTHANDLER

        ///////////////////////////////////////////////////////////////////////////////
        // Eventhandler for Custom Defined Events                                    //
        ///////////////////////////////////////////////////////////////////////////////
        #region CUSTOMEVENTHANDLER
        #endregion //CUSTOMEVENTHANDLER

        #endregion //EVENTS

        ///////////////////////////////////////////////////////////////////////////////
        // Methods and Eventhandling for Background tasks                            //
        ///////////////////////////////////////////////////////////////////////////////
        #region BACKGROUNDWORKER
        #endregion //BACKGROUNDWORKER

        ///////////////////////////////////////////////////////////////////////////////
        // Methods for doing main class job                                          //
        ///////////////////////////////////////////////////////////////////////////////
        #region METHODS

        /// <summary>
        /// This method updates the given element with the new resources path
        /// </summary>
        /// <param name="newResourcesPath">The new resource path</param>
        /// <param name="element">The <see cref="VGElement"/> to update.</param>
        private static void UpdateElement(string newResourcesPath, VGElement element)
        {
            // check all element for sounds
            if (element.Sound == null)
            {
                element.Sound = new AudioFile();
            }

            if (element.Sound.Filename != null)
            {
                if (element.Sound.Filename.Contains(@"\"))
                {
                    element.Sound.Filename = System.IO.Path.GetFileName(element.Sound.Filename);
                }

                element.Sound.Filepath = newResourcesPath;
            }

            // check file based elements
            if (element is VGScrollImage)
            {
                var scrollImage = (VGScrollImage)element;
                if (scrollImage.Filepath != newResourcesPath)
                {
                    scrollImage.Filename = System.IO.Path.GetFileName(scrollImage.Filename);
                    scrollImage.Filepath = newResourcesPath;
                    scrollImage.Canvas   = Document.ActiveDocument.PresentationSize;
                }

                scrollImage.CreateInternalImage();
            }
            else if (element is VGImage)
            {
                VGImage image = (VGImage)element;
                if (image.Filepath != newResourcesPath)
                {
                    image.Filename = System.IO.Path.GetFileName(image.Filename);
                    image.Filepath = newResourcesPath;
                    image.Canvas   = Document.ActiveDocument.PresentationSize;
                    image.CreateInternalImage();
                }
            }
            else if (element is VGFlash)
            {
                VGFlash flash = (VGFlash)element;
                if (flash.Filepath != newResourcesPath)
                {
                    flash.Filename = System.IO.Path.GetFileName(flash.Filename);
                    flash.Filepath = newResourcesPath;
                }
            }
        }
Example #2
0
        /// <summary>
        /// This method moves the ActiveX flash stimuli from the VGStimuli collection
        /// to the ActiveXStimuli collection. (Update from version 2.5 -> 2.6)
        /// </summary>
        private void MoveFlashStimuli()
        {
            foreach (Slide slide in this.experimentSettings.SlideShow.Slides)
            {
                foreach (VGElement element in slide.VGStimuli)
                {
                    if (element is VGFlash)
                    {
                        VGFlash clone = (VGFlash)element.Clone();
                        clone.StyleGroup = VGStyleGroup.ACTIVEX;
                        slide.ActiveXStimuli.Add(clone);
                    }
                }

                slide.VGStimuli.RemoveAll(slide.ActiveXStimuli);
            }
        }
Example #3
0
        /// <summary>
        /// This method creates a new thumb for this slide.
        /// </summary>
        private void RecreateThumb()
        {
            Bitmap newThumb = new Bitmap(SlideDesignThumbSize.Width, SlideDesignThumbSize.Height);

            using (Graphics g = Graphics.FromImage(newThumb))
            {
                float factorX = (float)newThumb.Width / this.PresentationSize.Width;
                float factorY = (float)newThumb.Height / this.PresentationSize.Height;
                if (factorX != 0 && factorY != 0)
                {
                    g.ScaleTransform(factorX, factorY);
                }

                this.Draw(g);

                foreach (VGElement element in this.ActiveXStimuli)
                {
                    if (element is VGFlash)
                    {
                        VGFlash flash = element as VGFlash;
                        if (File.Exists(flash.FullFilename))
                        {
                            Image flashThumb = CreateFlashThumb(flash.FullFilename, flash.Size.ToSize());
                            g.DrawImage(flashThumb, flash.Location);
                        }
                    }
                    else if (element is VGBrowser)
                    {
                        VGBrowser browser      = element as VGBrowser;
                        Image     browserThumb = CreateBrowserThumb(browser.BrowserURL, this.PresentationSize);
                        g.DrawImage(browserThumb, Point.Empty);
                    }
                }
            }

            newThumb.Tag = this.Name;

            this.thumb = newThumb;
        }
Example #4
0
        /// <summary>
        /// This method loads the given slide content into the background of the
        /// <see cref="Picture"/>. If applicable any flash objects are
        /// initialized
        /// </summary>
        /// <param name="slide">The new <see cref="Slide"/> to be displayed in the
        /// background of the <see cref="Picture"/>.</param>
        /// <param name="activeXMode">The <see cref="ActiveXMode"/> that should
        /// be used to display slide and activeX controls. Use this
        /// to display them on top or in the background.</param>
        protected void LoadSlide(Slide slide, ActiveXMode activeXMode)
        {
            // This releases the resources of the used slide
            // including explicit disposing of flash objects
            this.Picture.ResetBackground();

            if (slide == null)
            {
                return;
            }

            // Set presentation size
            slide.PresentationSize = Document.ActiveDocument.PresentationSize;

            if (slide.StimulusSize != Size.Empty)
            {
                this.Picture.StimulusSize = slide.StimulusSize;
            }
            else
            {
                this.Picture.StimulusSize = slide.PresentationSize;
            }

            this.Picture.PresentationSize = slide.PresentationSize;

            Slide slideCopy = (Slide)slide.Clone();

            switch (activeXMode)
            {
            case ActiveXMode.Off:
                // set Pictures new background slide
                this.Picture.BgSlide = slideCopy;
                break;

            default:
            case ActiveXMode.BehindPicture:
                // set Pictures new background slide
                this.Picture.BgSlide = slideCopy;

                foreach (VGElement element in slideCopy.ActiveXStimuli)
                {
                    if (element is VGFlash)
                    {
                        VGFlash flash = element as VGFlash;
                        flash.InitializeOnControl(this.Picture.Parent, false, this.Picture.StimulusToScreen);
                    }
                    else if (element is VGBrowser)
                    {
                        // Don´t show browser control, use screenshot of whole website instead.
                        // VGBrowser browser = element as VGBrowser;
                        // browser.InitializeOnControl(this.Picture.Parent, false);
                    }
                }

                break;

            case ActiveXMode.OnTop:
                // set Pictures new background slide
                this.Picture.BgSlide = slideCopy;

                foreach (VGElement element in slideCopy.ActiveXStimuli)
                {
                    if (element is VGFlash)
                    {
                        VGFlash flash = element as VGFlash;
                        flash.InitializeOnControl(this.Picture, false, this.Picture.StimulusToScreen);
                    }
                    else if (element is VGBrowser)
                    {
                        VGBrowser browser = element as VGBrowser;
                        browser.InitializeOnControl(this.Picture, false);
                    }
                }

                break;

            case ActiveXMode.Video:
                // Don´t use Slide
                this.Picture.BgSlide = null;
                break;
            }

            // Set autozoom, because websites could have changed in size
            this.AutoZoomPicture();

            // Redraw picture
            this.Picture.Invalidate();
        }