public EditImageWindow(Picture iimg)
 {
     InitializeComponent();
     Picture = iimg.DeepCopyWithObjectId() as Picture;
     foreach (ComAction action in iimg.Actions)
         Picture.Actions.Add(action);
     RefreshActions();
     ImgHolder.Source = iimg.Source;
 }
 private void btnAddImage2_Click(object sender, RoutedEventArgs e)
 {
     Picture lastPic = Pic2;
     Pic2 = Picture.NewPicture();
     if (Pic2 != null)
     {
         preview.RemoveIObject(lastPic);
         ObjectPositionOnSlide.ApplyRightPictureModifications(Pic2, preview);
         preview.AddIObject(Pic2);
         btnAddTextBlock.IsDefault = true;
         _pic2Added = true;
     }
     else Pic2 = lastPic;
     CheckIfAllComponentsAdded();
 }
 private void btnAddImage1_Click(object sender, RoutedEventArgs e)
 {
     Picture lastPic = Pic1;
     Pic1 = Picture.NewPicture();
     if (Pic1 != null)
     {
         preview.RemoveIObject(lastPic);
         ObjectPositionOnSlide.ApplyLeftPictureModifications(Pic1, preview);
         preview.AddIObject(Pic1);
         btnAddImage2.IsDefault = true;
         _pic1Added = true;
     }
     else Pic1 = lastPic;
     CheckIfAllComponentsAdded();
 }
Esempio n. 4
0
        private Grid CreateDropForPicture(Picture pic)
        {
            var childElement = pic.DeepCopy() as Picture;
            childElement.RemoveObjectHandlers();
            Height = Viewbox.Height = Viewbox.MaxHeight = childElement.Height;
            Width = Viewbox.Width = Viewbox.MaxWidth = childElement.Width;

            Viewbox.Child = childElement;
            var tb = new TextBlock
                {
                    Text = "Droppable container",
                    HorizontalAlignment = HorizontalAlignment.Center,
                    VerticalAlignment = VerticalAlignment.Top,
                    FontSize = 15,
                };

            var grid = new Grid();
            grid.Children.Add(Viewbox);
            grid.Children.Add(tb);

            return grid;
        }
Esempio n. 5
0
        private void LoadObjects()
        {
            var objects = entities[OBJECTS];
            var maxObjId = 0;
            foreach (var obj in objects)
            {
                IObject newObject = null;
                var attributes = ConvertXmlAttributes(obj.Attributes());

                switch (obj.Name.ToString())
                {
                    case "image":
                        newObject = new Picture();
                        break;
                    case "video":
                        newObject = new Video(false);
                        break;
                    case "sound":
                        newObject = new Sound(false);
                        break;
                    case "text":
                        newObject = new Text();
                        break;
                    case "flash":
                        newObject = new FlashAnimation();
                        break;
                    case "area":
                        newObject = new Area();
                        break;
                    case "dropContainer":
                        newObject = new DropContainer();
                        break;
                }

                if (newObject == null) return;
                newObject.Load(attributes);
                if (newObject.ObjectId > maxObjId) maxObjId = newObject.ObjectId;
                Practice.GetInstance().GetSlideById(newObject.SlideId).AddObject(newObject);
            }   
            Practice.SetObjectIdCounter(maxObjId + 1);
        }
Esempio n. 6
0
        public IObject DeepCopy()
        {
            var newImg = new Picture
                {
                    ObjectPath = ObjectPath,
                    ObjectName = Utilities.GiveUniqueName(ObjectPath),
                    Source = Source,
                    Height = Height,
                    Width = Width,
                    Visible = Visible
                };
            if (!newImg.Visible)
                newImg.Opacity = 0.3;

            return newImg;
        }
Esempio n. 7
0
        public static Picture NewPicture()
        {
            var dlg = new OpenFileDialog
                {
                    FileName = "",
                    DefaultExt = ".jpg",
                    Filter = "Picture Files|*.jpg;*.jpeg;*.png;*.gif;*.tif,;*.bmp;*.thm;*.yuv"
                };
            bool? result = dlg.ShowDialog();
            if (result != true) return null;

            var mainWin = DesignerMainWindow.GetInstance();
            Point currentMousePosition = mainWin.GetCurrentMousePosition();
            int currentSlideNr = mainWin.GetCurrentSlideNr();

            string filename = dlg.FileName;
            ImageSource imgSrc = OpenPicture(filename);
            var pic = new Picture();

            pic.Height = imgSrc.Height;
            pic.Width = imgSrc.Width;

            InkCanvas.SetTop(pic, currentMousePosition.Y);
            InkCanvas.SetLeft(pic, currentMousePosition.X);
            Panel.SetZIndex(pic, Practice.GetInstance().GetSlideByPosition(mainWin.GetCurrentSlideNr()).SlideObjects.Count);

            pic.Source = imgSrc;
            pic.ObjectPath = @filename;
            pic.ObjectName = Utilities.GiveUniqueName(filename);
            
            return pic;
        }