コード例 #1
0
ファイル: PreviewPopup.cs プロジェクト: f-spot/f-spot-xplat
        public PreviewPopup(SelectionCollectionGridView view) : base(Gtk.WindowType.Toplevel)
        {
            var vbox = new Gtk.VBox();

            Add(vbox);
            AddEvents((int)(EventMask.PointerMotionMask |
                            EventMask.KeyReleaseMask |
                            EventMask.ButtonPressMask));

            Decorated       = false;
            SkipTaskbarHint = true;
            SkipPagerHint   = true;
            SetPosition(Gtk.WindowPosition.None);

            KeyReleaseEvent  += HandleKeyRelease;
            ButtonPressEvent += HandleButtonPress;
            Destroyed        += HandleDestroyed;

            this.view = view;
            view.MotionNotifyEvent += HandleIconViewMotion;
            view.KeyPressEvent     += HandleIconViewKeyPress;
            view.KeyReleaseEvent   += HandleKeyRelease;
            view.DestroyEvent      += HandleIconViewDestroy;

            BorderWidth = 6;

            hist = new Histogram {
                RedColorHint        = 127,
                GreenColorHint      = 127,
                BlueColorHint       = 127,
                BackgroundColorHint = 0xff
            };

            image = new Gtk.Image {
                CanFocus = false
            };


            label = new Gtk.Label(string.Empty)
            {
                CanFocus = false
            };
            label.ModifyFg(Gtk.StateType.Normal, new Gdk.Color(127, 127, 127));
            label.ModifyBg(Gtk.StateType.Normal, new Gdk.Color(0, 0, 0));

            ModifyFg(Gtk.StateType.Normal, new Gdk.Color(127, 127, 127));
            ModifyBg(Gtk.StateType.Normal, new Gdk.Color(0, 0, 0));

            vbox.PackStart(image, true, true, 0);
            vbox.PackStart(label, true, false, 0);
            vbox.ShowAll();
        }
コード例 #2
0
        public PreviewPopup(IconView view) : base(Gtk.WindowType.Toplevel)
        {
            Gtk.VBox vbox = new Gtk.VBox();
            this.Add(vbox);
            this.AddEvents((int)(Gdk.EventMask.PointerMotionMask |
                                 Gdk.EventMask.KeyReleaseMask |
                                 Gdk.EventMask.ButtonPressMask));

            this.Decorated       = false;
            this.SkipTaskbarHint = true;
            this.SkipPagerHint   = true;
            this.SetPosition(Gtk.WindowPosition.None);

            this.KeyReleaseEvent  += HandleKeyRelease;
            this.ButtonPressEvent += HandleButtonPress;
            this.Destroyed        += HandleDestroyed;

            this.view = view;
            view.MotionNotifyEvent += HandleIconViewMotion;
            view.KeyPressEvent     += HandleIconViewKeyPress;
            view.KeyReleaseEvent   += HandleKeyRelease;
            view.DestroyEvent      += HandleIconViewDestroy;

            this.BorderWidth = 6;

            hist           = new FSpot.Histogram();
            hist.Color [0] = 127;
            hist.Color [1] = 127;
            hist.Color [2] = 127;
            hist.Color [3] = 0xff;

            image          = new Gtk.Image();
            image.CanFocus = false;


            label          = new Gtk.Label(String.Empty);
            label.CanFocus = false;
            label.ModifyFg(Gtk.StateType.Normal, new Gdk.Color(127, 127, 127));
            label.ModifyBg(Gtk.StateType.Normal, new Gdk.Color(0, 0, 0));

            this.ModifyFg(Gtk.StateType.Normal, new Gdk.Color(127, 127, 127));
            this.ModifyBg(Gtk.StateType.Normal, new Gdk.Color(0, 0, 0));

            vbox.PackStart(image, true, true, 0);
            vbox.PackStart(label, true, false, 0);
            vbox.ShowAll();
        }
コード例 #3
0
ファイル: PreviewPopup.cs プロジェクト: iainlane/f-spot
        public PreviewPopup(IconView view)
            : base(Gtk.WindowType.Toplevel)
        {
            Gtk.VBox vbox = new Gtk.VBox ();
            this.Add (vbox);
            this.AddEvents ((int) (Gdk.EventMask.PointerMotionMask |
                           Gdk.EventMask.KeyReleaseMask |
                           Gdk.EventMask.ButtonPressMask));

            this.Decorated = false;
            this.SkipTaskbarHint = true;
            this.SkipPagerHint = true;
            this.SetPosition (Gtk.WindowPosition.None);

            this.KeyReleaseEvent += HandleKeyRelease;
            this.ButtonPressEvent += HandleButtonPress;
            this.Destroyed += HandleDestroyed;

            this.view = view;
            view.MotionNotifyEvent += HandleIconViewMotion;
            view.KeyPressEvent += HandleIconViewKeyPress;
            view.KeyReleaseEvent += HandleKeyRelease;
            view.DestroyEvent += HandleIconViewDestroy;

            this.BorderWidth = 6;

            hist = new FSpot.Histogram ();
            hist.RedColorHint = 127;
            hist.GreenColorHint = 127;
            hist.BlueColorHint = 127;
            hist.BackgroundColorHint = 0xff;

            image = new Gtk.Image ();
            image.CanFocus = false;

            label = new Gtk.Label (String.Empty);
            label.CanFocus = false;
            label.ModifyFg (Gtk.StateType.Normal, new Gdk.Color (127, 127, 127));
            label.ModifyBg (Gtk.StateType.Normal, new Gdk.Color (0, 0, 0));

            this.ModifyFg (Gtk.StateType.Normal, new Gdk.Color (127, 127, 127));
            this.ModifyBg (Gtk.StateType.Normal, new Gdk.Color (0, 0, 0));

            vbox.PackStart (image, true, true, 0);
            vbox.PackStart (label, true, false, 0);
            vbox.ShowAll ();
        }
コード例 #4
0
        //FIXME move all this in a standalone class
        void HandleSlideshow(string tagname)
        {
            Tag tag;
            FSpot.Widgets.SlideShow slideshow = null;

            if (!String.IsNullOrEmpty (tagname))
                tag = Database.Tags.GetTagByName (tagname);
            else
                tag = Database.Tags.GetTagById (Preferences.Get<int> (Preferences.SCREENSAVER_TAG));

            IPhoto[] photos;
            if (tag != null)
                photos = Database.Photos.Query (new Tag[] {tag});
            else if (Preferences.Get<int> (Preferences.SCREENSAVER_TAG) == 0)
                photos = Database.Photos.Query (new Tag [] {});
            else
                photos = new IPhoto [0];

            // Minimum delay 1 second; default is 4s
            var delay = Math.Max (1.0, Preferences.Get<double> (Preferences.SCREENSAVER_DELAY));

            var window = new XScreenSaverSlide ();
            window.ModifyFg (Gtk.StateType.Normal, new Gdk.Color (127, 127, 127));
            window.ModifyBg (Gtk.StateType.Normal, new Gdk.Color (0, 0, 0));

            if (photos.Length > 0) {
                Array.Sort (photos, new IPhotoComparer.RandomSort ());
                slideshow = new FSpot.Widgets.SlideShow (new BrowsablePointer (new PhotoList (photos), 0), (uint)(delay * 1000), true);
                slideshow.Transition = new FSpot.Transitions.DissolveTransition ();
                window.Add (slideshow);
            } else {
                Gtk.HBox outer = new Gtk.HBox ();
                Gtk.HBox hbox = new Gtk.HBox ();
                Gtk.VBox vbox = new Gtk.VBox ();

                outer.PackStart (new Gtk.Label (String.Empty));
                outer.PackStart (vbox, false, false, 0);
                vbox.PackStart (new Gtk.Label (String.Empty));
                vbox.PackStart (hbox, false, false, 0);
                hbox.PackStart (new Gtk.Image (Gtk.Stock.DialogWarning, Gtk.IconSize.Dialog),
                        false, false, 0);
                outer.PackStart (new Gtk.Label (String.Empty));

                string msg;
                string long_msg;

                if (tag != null) {
                    msg = String.Format (Catalog.GetString ("No photos matching {0} found"), tag.Name);
                    long_msg = String.Format (Catalog.GetString ("The tag \"{0}\" is not applied to any photos. Try adding\n" +
                                             "the tag to some photos or selecting a different tag in the\n" +
                                             "F-Spot preference dialog."), tag.Name);
                } else {
                    msg = Catalog.GetString ("Search returned no results");
                    long_msg = Catalog.GetString ("The tag F-Spot is looking for does not exist. Try\n" +
                                      "selecting a different tag in the F-Spot preference\n" +
                                      "dialog.");
                }

                Gtk.Label label = new Gtk.Label (msg);
                hbox.PackStart (label, false, false, 0);

                Gtk.Label long_label = new Gtk.Label (long_msg);
                long_label.Markup  = String.Format ("<small>{0}</small>", long_msg);

                vbox.PackStart (long_label, false, false, 0);
                vbox.PackStart (new Gtk.Label (String.Empty));

                window.Add (outer);
                label.ModifyFg (Gtk.StateType.Normal, new Gdk.Color (127, 127, 127));
                label.ModifyBg (Gtk.StateType.Normal, new Gdk.Color (0, 0, 0));
                long_label.ModifyFg (Gtk.StateType.Normal, new Gdk.Color (127, 127, 127));
                long_label.ModifyBg (Gtk.StateType.Normal, new Gdk.Color (0, 0, 0));
            }
            window.ShowAll ();

            Register (window);
            GLib.Idle.Add (delegate {
                if (slideshow != null)
                    slideshow.Start ();
                return false;
            });
        }
コード例 #5
0
        //FIXME move all this in a standalone class
        void HandleSlideshow(string tagname)
        {
            Tag tag;

            FSpot.Widgets.SlideShow slideshow = null;

            if (!string.IsNullOrEmpty(tagname))
            {
                tag = Database.Tags.GetTagByName(tagname);
            }
            else
            {
                tag = Database.Tags.GetTagById(Preferences.Get <int> (Preferences.SCREENSAVER_TAG));
            }

            IPhoto[] photos;
            if (tag != null)
            {
                photos = ObsoletePhotoQueries.Query(new Tag[] { tag });
            }
            else if (Preferences.Get <int> (Preferences.SCREENSAVER_TAG) == 0)
            {
                photos = ObsoletePhotoQueries.Query(new Tag [] {});
            }
            else
            {
                photos = new IPhoto [0];
            }

            // Minimum delay 1 second; default is 4s
            var delay = Math.Max(1.0, Preferences.Get <double> (Preferences.SCREENSAVER_DELAY));

            var window = new XScreenSaverSlide();

            window.ModifyFg(Gtk.StateType.Normal, new Gdk.Color(127, 127, 127));
            window.ModifyBg(Gtk.StateType.Normal, new Gdk.Color(0, 0, 0));

            if (photos.Length > 0)
            {
                Array.Sort(photos, new IPhotoComparer.RandomSort());
                slideshow = new FSpot.Widgets.SlideShow(new BrowsablePointer(new PhotoList(photos), 0), (uint)(delay * 1000), true);
                window.Add(slideshow);
            }
            else
            {
                Gtk.HBox outer = new Gtk.HBox();
                Gtk.HBox hbox  = new Gtk.HBox();
                Gtk.VBox vbox  = new Gtk.VBox();

                outer.PackStart(new Gtk.Label(string.Empty));
                outer.PackStart(vbox, false, false, 0);
                vbox.PackStart(new Gtk.Label(string.Empty));
                vbox.PackStart(hbox, false, false, 0);
                hbox.PackStart(new Gtk.Image(Gtk.Stock.DialogWarning, Gtk.IconSize.Dialog),
                               false, false, 0);
                outer.PackStart(new Gtk.Label(string.Empty));

                string msg;
                string long_msg;

                if (tag != null)
                {
                    msg      = string.Format(Catalog.GetString("No photos matching {0} found"), tag.Name);
                    long_msg = string.Format(Catalog.GetString("The tag \"{0}\" is not applied to any photos. Try adding\n" +
                                                               "the tag to some photos or selecting a different tag in the\n" +
                                                               "F-Spot preference dialog."), tag.Name);
                }
                else
                {
                    msg      = Catalog.GetString("Search returned no results");
                    long_msg = Catalog.GetString("The tag F-Spot is looking for does not exist. Try\n" +
                                                 "selecting a different tag in the F-Spot preference\n" +
                                                 "dialog.");
                }

                Gtk.Label label = new Gtk.Label(msg);
                hbox.PackStart(label, false, false, 0);

                Gtk.Label long_label = new Gtk.Label(long_msg);
                long_label.Markup = string.Format("<small>{0}</small>", long_msg);

                vbox.PackStart(long_label, false, false, 0);
                vbox.PackStart(new Gtk.Label(string.Empty));

                window.Add(outer);
                label.ModifyFg(Gtk.StateType.Normal, new Gdk.Color(127, 127, 127));
                label.ModifyBg(Gtk.StateType.Normal, new Gdk.Color(0, 0, 0));
                long_label.ModifyFg(Gtk.StateType.Normal, new Gdk.Color(127, 127, 127));
                long_label.ModifyBg(Gtk.StateType.Normal, new Gdk.Color(0, 0, 0));
            }
            window.ShowAll();

            Register(window);
            GLib.Idle.Add(delegate {
                if (slideshow != null)
                {
                    slideshow.Start();
                }
                return(false);
            });
        }
コード例 #6
0
ファイル: App.cs プロジェクト: f-spot/f-spot-xplat
        //FIXME move all this in a standalone class
        void HandleSlideshow(string tagname)
        {
            Tag tag;

            Widgets.SlideShow slideshow = null;

            if (!string.IsNullOrEmpty(tagname))
            {
                tag = Database.Tags.GetTagByName(tagname);
            }
            else
            {
                tag = Database.Tags.GetTagById(Preferences.Get <int> (Preferences.SCREENSAVER_TAG));
            }

            IPhoto[] photos;
            if (tag != null)
            {
                photos = ObsoletePhotoQueries.Query(new Tag[] { tag });
            }
            else if (Preferences.Get <int> (Preferences.SCREENSAVER_TAG) == 0)
            {
                photos = ObsoletePhotoQueries.Query(new Tag[] { });
            }
            else
            {
                photos = new IPhoto[0];
            }

            // Minimum delay 1 second; default is 4s
            var delay = Math.Max(1.0, Preferences.Get <double> (Preferences.SCREENSAVER_DELAY));

            var window = new XScreenSaverSlide();

            window.ModifyFg(Gtk.StateType.Normal, new Gdk.Color(127, 127, 127));
            window.ModifyBg(Gtk.StateType.Normal, new Gdk.Color(0, 0, 0));

            if (photos.Length > 0)
            {
                Array.Sort(photos, new IPhotoComparer.RandomSort());
                slideshow = new Widgets.SlideShow(new BrowsablePointer(new PhotoList(photos), 0), (uint)(delay * 1000), true);
                window.Add(slideshow);
            }
            else
            {
                var outer = new Gtk.HBox();
                var hbox  = new Gtk.HBox();
                var vbox  = new Gtk.VBox();

                outer.PackStart(new Gtk.Label(string.Empty));
                outer.PackStart(vbox, false, false, 0);
                vbox.PackStart(new Gtk.Label(string.Empty));
                vbox.PackStart(hbox, false, false, 0);
                hbox.PackStart(new Gtk.Image(Gtk.Stock.DialogWarning, Gtk.IconSize.Dialog),
                               false, false, 0);
                outer.PackStart(new Gtk.Label(string.Empty));

                string msg;
                string long_msg;

                if (tag != null)
                {
                    msg      = Strings.NoPhotosMatchingXFound(tag.Name);
                    long_msg = Strings.TheTagXIsNotAppliedToAnyPhotosLongMsg(tag.Name);
                }
                else
                {
                    msg      = Strings.SearchReturnedNoResults;
                    long_msg = Strings.TheTagFSpotIsLookingForDoesNotExistTryLongMsg;
                }

                var label = new Gtk.Label(msg);
                hbox.PackStart(label, false, false, 0);

                var long_label = new Gtk.Label(long_msg)
                {
                    Markup = $"<small>{long_msg}</small>"
                };

                vbox.PackStart(long_label, false, false, 0);
                vbox.PackStart(new Gtk.Label(string.Empty));

                window.Add(outer);
                label.ModifyFg(Gtk.StateType.Normal, new Gdk.Color(127, 127, 127));
                label.ModifyBg(Gtk.StateType.Normal, new Gdk.Color(0, 0, 0));
                long_label.ModifyFg(Gtk.StateType.Normal, new Gdk.Color(127, 127, 127));
                long_label.ModifyBg(Gtk.StateType.Normal, new Gdk.Color(0, 0, 0));
            }
            window.ShowAll();

            Register(window);
            GLib.Idle.Add(delegate {
                if (slideshow != null)
                {
                    slideshow.Start();
                }
                return(false);
            });
        }