public void BrowsablePointer_IndexPointsToFirstItem()
 {
     var list = new BrowsableCollectionMock (photo1);
     var pointer = new BrowsablePointer (list, 0);
     Assert.AreEqual (0, pointer.Index);
     Assert.AreEqual (photo1, pointer.Current);
 }
Exemple #2
0
        public PhotoImageView(BrowsablePointer item) : base()
        {
            Preferences.SettingChanged += OnPreferencesChanged;

            this.item     = item;
            item.Changed += HandlePhotoItemChanged;
        }
Exemple #3
0
        public SlideShow(BrowsablePointer item, uint interval_ms, bool init) : base()
        {
            this.item      = item;
            DoubleBuffered = false;
            AppPaintable   = true;
            CanFocus       = true;
            item.Changed  += HandleItemChanged;

            foreach (TransitionNode transition in AddinManager.GetExtensionNodes("/FSpot/SlideShow"))
            {
                if (this.transition == null)
                {
                    this.transition = transition.Transition;
                }
                transitions.Add(transition.Transition);
            }

            flip      = new DelayedOperation(interval_ms, delegate { item.MoveNext(true); return(true); });
            animation = new DoubleAnimation(0, 1, new TimeSpan(0, 0, 2), HandleProgressChanged, GLib.Priority.Default);

            if (init)
            {
                HandleItemChanged(null, null);
            }
        }
 public void BrowsablePointer_IndexIsNullForEmptyCollection()
 {
     var list = new BrowsableCollectionMock ();
     var pointer = new BrowsablePointer (list, 0);
     Assert.AreEqual (0, pointer.Index);
     Assert.IsNull (pointer.Current);
 }
Exemple #5
0
        public void BrowsablePointer_IndexPointsToFirstItem()
        {
            var list    = new BrowsableCollectionMock(photo1);
            var pointer = new BrowsablePointer(list, 0);

            Assert.AreEqual(0, pointer.Index);
            Assert.AreEqual(photo1, pointer.Current);
        }
Exemple #6
0
        public void BrowsablePointer_IndexIsNullForEmptyCollection()
        {
            var list    = new BrowsableCollectionMock();
            var pointer = new BrowsablePointer(list, 0);

            Assert.AreEqual(0, pointer.Index);
            Assert.IsNull(pointer.Current);
        }
 public void BrowsablePointerTest_IndexIsOutOfBounds()
 {
     var list = new BrowsableCollectionMock (photo1);
     var pointer = new BrowsablePointer (list, 1);
     // should this be fixed?
     Assert.AreEqual (1, pointer.Index);
     Assert.IsNull (pointer.Current);
 }
Exemple #8
0
 public IBrowsableItemTests()
 {
     collection = new FSpot.UriCollection ();
     item = new BrowsablePointer (collection, 0);
     item.Changed += delegate {
         changed = true;
     };
 }
Exemple #9
0
        public PhotoImageView(BrowsablePointer item) : base()
        {
            Accelerometer.OrientationChanged += HandleOrientationChanged;
            Preferences.SettingChanged       += OnPreferencesChanged;

            this.item     = item;
            item.Changed += HandlePhotoItemChanged;
        }
Exemple #10
0
        public void BrowsablePointerTest_IndexIsOutOfBounds()
        {
            var list    = new BrowsableCollectionMock(photo1);
            var pointer = new BrowsablePointer(list, 1);

            // should this be fixed?
            Assert.AreEqual(1, pointer.Index);
            Assert.IsNull(pointer.Current);
        }
Exemple #11
0
        public void BrowsablePointer_PointsToSecond_WhenThirdIsDeleted()
        {
            var list    = new BrowsableCollectionMock(photo1, photo2, photo3);
            var pointer = new BrowsablePointer(list, 2);

            list.RemoveAt(2);
            Assert.AreEqual(1, pointer.Index);
            Assert.AreEqual(photo2, pointer.Current);
        }
Exemple #12
0
        public void BrowsablePointer_StillPointsToSecond_WhenFirstIsDeleted()
        {
            var list    = new BrowsableCollectionMock(photo1, photo2, photo3);
            var pointer = new BrowsablePointer(list, 1);

            list.RemoveAt(0);
            Assert.AreEqual(0, pointer.Index);
            Assert.AreEqual(photo2, pointer.Current);
        }
Exemple #13
0
        public PhotoImageView(BrowsablePointer item)
            : base()
        {
            Accelerometer.OrientationChanged += HandleOrientationChanged;
            Preferences.SettingChanged += OnPreferencesChanged;

            this.item = item;
            item.Changed += HandlePhotoItemChanged;
        }
Exemple #14
0
 public InfoItem(BrowsablePointer item)
 {
     this.item = item;
     item.Changed += HandleItemChanged;
     HandleItemChanged (item, null);
     VersionChanged += HandleVersionChanged;
     ShowTags = true;
     ShowRating = true;
     Context = ViewContext.FullScreen;
 }
 public ImageDisplay(BrowsablePointer item)
 {
     this.item = item;
     CanFocus  = true;
     current   = new ImageInfo(item.Current.DefaultVersionUri);
     if (item.Collection.Count > item.Index + 1)
     {
         next = new ImageInfo(item.Collection [item.Index + 1].DefaultVersionUri);
     }
     delay = new Delay(30, new GLib.IdleHandler(DrawFrame));
 }
        public ItemAction(BrowsablePointer pointer,
				   string name,
				   string label,
				   string tooltip,
				   string icon_name)
            : base(name, label)
        {
            Tooltip = tooltip;
            IconName = icon_name;
            item = pointer;
            item.Changed += ItemChanged;
        }
        private void HandleApply(object sender, EventArgs args)
        {
            BrowsablePointer item   = view.Item;
            EditTarget       target = new EditTarget(item);

            try {
                using (ImageFile img = ImageFile.Create(item.Current.DefaultVersionUri)) {
                    Cairo.Format format = view.CompletePixbuf().HasAlpha ? Cairo.Format.Argb32 : Cairo.Format.Rgb24;

                    MemorySurface dest = new MemorySurface(format,
                                                           info.Bounds.Width,
                                                           info.Bounds.Height);

                    Context ctx = new Context(dest);
                    effect.OnExpose(ctx, info.Bounds);
                    ((IDisposable)ctx).Dispose();

                    string tmp = ImageFile.TempPath(item.Current.DefaultVersionUri.LocalPath);
                    using (Gdk.Pixbuf output = Widgets.CairoUtils.CreatePixbuf(dest)) {
                        using (System.IO.Stream stream = System.IO.File.OpenWrite(tmp)) {
                            img.Save(output, stream);
                        }
                    }

                    dest.Destroy();

                    // FIXME Not this again. I need to imlplement a real version of the transfer
                    // function that shows progress in the main window and allows for all the
                    // goodies we'll need.
                    Gnome.Vfs.Result result = Gnome.Vfs.Result.Ok;
                    result = Gnome.Vfs.Xfer.XferUri(new Gnome.Vfs.Uri(UriList.PathToFileUri(tmp).ToString()),
                                                    new Gnome.Vfs.Uri(target.Uri.ToString()),
                                                    Gnome.Vfs.XferOptions.Default,
                                                    Gnome.Vfs.XferErrorMode.Abort,
                                                    Gnome.Vfs.XferOverwriteMode.Replace,
                                                    delegate {
                        System.Console.Write(".");
                        return(1);
                    });

                    target.Commit();
                }
            } catch (System.Exception e) {
                System.Console.WriteLine(e);
                target.Delete();
                Dialog d = new EditExceptionDialog((Gtk.Window)view.Toplevel, e, view.Item.Current);
                d.Show();
                d.Run();
                d.Destroy();
            }
            Destroy();
        }
Exemple #18
0
        public Filmstrip(BrowsablePointer selection, bool squaredThumbs)
        {
            CanFocus                                = true;
            this.selection                          = selection;
            this.selection.Changed                 += HandlePointerChanged;
            this.selection.Collection.Changed      += HandleCollectionChanged;
            this.selection.Collection.ItemsChanged += HandleCollectionItemsChanged;
            SquaredThumbs                           = squaredThumbs;
            thumb_cache                             = new DisposableCache <SafeUri, Pixbuf> (30);
            ThumbnailLoader.Default.OnPixbufLoaded += HandlePixbufLoaded;

            animation = new DoubleAnimation(0, 0, TimeSpan.FromSeconds(1.5), SetPositionCore, new CubicEase(EasingMode.EaseOut));
        }
Exemple #19
0
        public Filmstrip(BrowsablePointer selection, bool squaredThumbs)
        {
            CanFocus                = true;
            this.selection          = selection;
            this.selection.Changed += HandlePointerChanged;
            // FIXME, ObservableCollection
            //this.selection.Collection.Changed += HandleCollectionChanged;
            //this.selection.Collection.ItemsChanged += HandleCollectionItemsChanged;
            SquaredThumbs = squaredThumbs;
            thumb_cache   = new DisposableCache <Uri, Pixbuf> (30);
            App.Instance.Container.Resolve <IThumbnailLoader> ().OnPixbufLoaded += HandlePixbufLoaded;

            animation = new DoubleAnimation(0, 0, TimeSpan.FromSeconds(1.5), SetPositionCore, new CubicEase(EasingMode.EaseOut));
        }
Exemple #20
0
        public BrowseablePointerGridView(BrowsablePointer pointer)
            : base(pointer.Collection)
        {
            Pointer = pointer;

            Pointer.Changed += (obj, args) => {
                InvalidateCell(args.PreviousIndex);
                InvalidateCell(Pointer.Index);
            };

            AddEvents((int)EventMask.KeyPressMask
                      | (int)EventMask.ButtonPressMask);

            CanFocus = true;
        }
        public AdjustTimeDialog(Db db, IBrowsableCollection collection) : base("AdjustTimeDialog.ui", "time_dialog")
        {
            this.db         = db;
            this.collection = collection;

            view = new PhotoImageView(collection);
            view_scrolled.Add(view);
            item          = view.Item;
            item.Changed += HandleItemChanged;
            item.MoveFirst();

            tray = new BrowseablePointerGridView(view.Item)
            {
                MaxColumns     = 1,
                DisplayRatings = false,
                DisplayTags    = false,
                DisplayDates   = true
            };
            tray_scrolled.Add(tray);

            //forward_button.Clicked += HandleForwardClicked;
            //back_button.Clicked += HandleBackClicked;
            ok_button.Clicked     += HandleOkClicked;
            cancel_button.Clicked += HandleCancelClicked;

            photo_spin.ValueChanged += HandleSpinChanged;
            photo_spin.SetIncrements(1.0, 1.0);
            photo_spin.Adjustment.StepIncrement = 1.0;
            photo_spin.Wrap = true;

            date_edit.TimeChanged += HandleTimeChanged;
            date_edit.DateChanged += HandleTimeChanged;
            Gtk.Entry entry = (Gtk.Entry)date_edit.Children [0];
            entry.Changed        += HandleTimeChanged;
            entry                 = (Gtk.Entry)date_edit.Children [2];
            entry.Changed        += HandleTimeChanged;
            offset_entry.Changed += HandleOffsetChanged;
            ShowAll();
            HandleCollectionChanged(collection);

            spacing_entry.Changed  += HandleSpacingChanged;
            spacing_entry.Sensitive = !difference_check.Active;

            difference_check.Toggled += HandleActionToggled;
        }
        public NextPictureAction(BrowsablePointer p)
            : base(p,
				"NextPicture",
				Catalog.GetString ("Next"),
				Catalog.GetString ("Next picture"),
				"gtk-go-forward-ltr")
        {
        }
 public void BrowsablePointer_StillPointsToSecond_WhenFirstIsDeleted()
 {
     var list = new BrowsableCollectionMock (photo1, photo2, photo3);
     var pointer = new BrowsablePointer (list, 1);
     list.RemoveAt (0);
     Assert.AreEqual (0, pointer.Index);
     Assert.AreEqual (photo2, pointer.Current);
 }
Exemple #24
0
        public PhotoView(IBrowsableCollection query)
        {
            Query = query;

            commit_delay = new DelayedOperation (1000, new GLib.IdleHandler (CommitPendingChanges));
            Destroyed += HandleDestroy;

            Name = "ImageContainer";
            Box vbox = new VBox (false, 6);
            Add (vbox);

            background = new EventBox ();
            Frame frame = new Frame ();
            background.Add (frame);

            frame.ShadowType = ShadowType.In;
            vbox.PackStart (background, true, true, 0);

            inner_vbox = new VBox (false , 2);
            inner_hbox = new HBox (false , 2);

            frame.Add (inner_hbox);

            BrowsablePointer bp = new BrowsablePointer (query, -1);
            View = new PhotoImageView (bp);

            filmstrip = new Filmstrip (bp);
            filmstrip.ThumbOffset = 1;
            filmstrip.Spacing = 4;
            filmstrip.ThumbSize = 75;
            PlaceFilmstrip ((Orientation) Preferences.Get <int> (Preferences.FILMSTRIP_ORIENTATION), true);

            View.PhotoChanged += HandlePhotoChanged;

            photo_view_scrolled = new ScrolledWindow (null, null);

            photo_view_scrolled.SetPolicy (PolicyType.Automatic, PolicyType.Automatic);
            photo_view_scrolled.ShadowType = ShadowType.None;
            photo_view_scrolled.Add (View);
            photo_view_scrolled.Child.ButtonPressEvent += HandleButtonPressEvent;
            View.AddEvents ((int) EventMask.KeyPressMask);
            inner_vbox.PackStart (photo_view_scrolled, true, true, 0);
            inner_hbox.PackStart (inner_vbox, true, true, 0);

            HBox lower_hbox = new HBox (false, 2);
            //inner_hbox.BorderWidth = 6;

            tag_view = new TagView ();
            lower_hbox.PackStart (tag_view, false, true, 0);

            Label comment = new Label (Catalog.GetString ("Description:"));
            lower_hbox.PackStart (comment, false, false, 0);
            description_entry = new Entry ();
            lower_hbox.PackStart (description_entry, true, true, 0);
            description_entry.Changed += HandleDescriptionChanged;

            rating = new RatingEntry {
                HasFrame = false,
                AlwaysShowEmptyStars = true
            };
            lower_hbox.PackStart (rating, false, false, 0);
            rating.Changed += HandleRatingChanged;

            SetColors ();

            inner_vbox.PackStart (lower_hbox, false, true, 0);

            vbox.ShowAll ();

            Realized += (o, e) => SetColors();
            Preferences.SettingChanged += OnPreferencesChanged;
        }
Exemple #25
0
 public SlideShow(BrowsablePointer item) : this(item, 6000, false)
 {
 }
 public void BrowsablePointer_PointsToSecond_WhenThirdIsDeleted()
 {
     var list = new BrowsableCollectionMock (photo1, photo2, photo3);
     var pointer = new BrowsablePointer (list, 2);
     list.RemoveAt (2);
     Assert.AreEqual (1, pointer.Index);
     Assert.AreEqual (photo2, pointer.Current);
 }
        public PreviousPictureAction(BrowsablePointer p)
            : base(p,
				"PreviousPicture",
				Catalog.GetString ("Previous"),
				Catalog.GetString ("Previous picture"),
				"gtk-go-back-ltr")
        {
        }
Exemple #28
0
 public InfoOverlay(Widget w, BrowsablePointer item)
     : base(w)
 {
     XAlign = 1.0;
     YAlign = 0.1;
     DefaultWidth = 250;
     box = new InfoItem (item);
     box.BorderWidth = 15;
     Add (box);
     box.ShowAll ();
     Visibility = VisibilityType.Partial;
     KeepAbove = true;
     //WindowPosition = WindowPosition.Mouse;
     AutoHide = false;
 }
 void HandlePointerChanged(BrowsablePointer pointer, BrowsablePointerChangedArgs old)
 {
     Position = ActiveItem;
 }
		void HandlePointerChanged (BrowsablePointer pointer, BrowsablePointerChangedArgs old)
		{
			Position = ActiveItem;
		}
        public RotateAction(BrowsablePointer pointer,
				     RotateDirection direction,
				     string name,
				     string label,
				     string tooltip,
				     string stock_id)
            : base(pointer, name, label, tooltip, stock_id)
        {
            this.direction = direction;
        }
        public RotateLeftAction(BrowsablePointer p)
            : base(p,
				RotateDirection.Counterclockwise,
				"RotateItemLeft",
				Catalog.GetString ("Rotate Left"),
				Catalog.GetString ("Rotate picture left"),
				"object-rotate-left")
        {
        }
        public RotateRightAction(BrowsablePointer p)
            : base(p,
				RotateDirection.Clockwise,
				"RotateItemRight",
				Catalog.GetString ("Rotate Right"),
				Catalog.GetString ("Rotate picture right"),
				"object-rotate-right")
        {
        }
Exemple #34
0
        public AdjustTimeDialog(Db db, IBrowsableCollection collection)
            : base("AdjustTimeDialog.ui", "time_dialog")
        {
            this.db = db;
            this.collection = collection;

            tray = new TrayView (collection);
            tray_scrolled.Add (tray);
            tray.Selection.Changed += HandleSelectionChanged;

            view = new PhotoImageView (collection);
            view_scrolled.Add (view);
            Item = view.Item;
            Item.Changed += HandleItemChanged;
            Item.MoveFirst ();

            //forward_button.Clicked += HandleForwardClicked;
            //back_button.Clicked += HandleBackClicked;
            ok_button.Clicked += HandleOkClicked;
            cancel_button.Clicked += HandleCancelClicked;

            photo_spin.ValueChanged += HandleSpinChanged;
            photo_spin.SetIncrements (1.0, 1.0);
            photo_spin.Adjustment.StepIncrement = 1.0;
            photo_spin.Wrap = true;

            date_edit.TimeChanged += HandleTimeChanged;
            date_edit.DateChanged += HandleTimeChanged;
            Gtk.Entry entry = (Gtk.Entry) date_edit.Children [0];
            entry.Changed += HandleTimeChanged;
            entry = (Gtk.Entry) date_edit.Children [2];
            entry.Changed += HandleTimeChanged;
            offset_entry.Changed += HandleOffsetChanged;
            ShowAll ();
            HandleCollectionChanged (collection);

            spacing_entry.Changed += HandleSpacingChanged;
            spacing_entry.Sensitive = ! difference_check.Active;

            difference_check.Toggled += HandleActionToggled;
        }
Exemple #35
0
 public Filmstrip(BrowsablePointer selection) : this(selection, true)
 {
 }