Beispiel #1
0
        protected virtual void Dispose(bool disposing)
        {
            if (disposed)
            {
                return;
            }
            disposed = true;

            if (disposing)
            {
                Preferences.SettingChanged -= OnPreferencesChanged;
                // free managed resources
                if (rating != null)
                {
                    rating.Dispose();
                    rating = null;
                }
                if (description_entry != null)
                {
                    description_entry.Dispose();
                    description_entry = null;
                }
                if (tag_view != null)
                {
                    tag_view.Dispose();
                    tag_view = null;
                }
                if (photo_view_scrolled != null)
                {
                    photo_view_scrolled.Dispose();
                    photo_view_scrolled = null;
                }
                if (filmstrip != null)
                {
                    filmstrip.Dispose();
                    filmstrip = null;
                }
                if (inner_vbox != null)
                {
                    inner_vbox.Dispose();
                    inner_vbox = null;
                }
                if (inner_hbox != null)
                {
                    inner_hbox.Dispose();
                    inner_hbox = null;
                }
            }
            // free unmanaged resources
        }
Beispiel #2
0
        public FullScreenView(IBrowsableCollection collection) : base("Full Screen Mode")
        {
            Name = "FullscreenContainer";
            try {
                //scroll = new Gtk.ScrolledWindow (null, null);
                actions = new ActionGroup("joe");

                actions.Add(new ActionEntry [] {
                    new ActionEntry(HideToolbar, Stock.Close,
                                    Catalog.GetString("Hide"),
                                    null,
                                    Catalog.GetString("Hide Toolbar"),
                                    HideToolbarAction),
                    new ActionEntry(ExitFullScreen,
                                    "f-spot-view-restore",
                                    Catalog.GetString("Exit fullscreen"),
                                    null,
                                    null,
                                    ExitAction),
                    new ActionEntry(SlideShow,
                                    "f-spot-slideshow",
                                    Catalog.GetString("Slideshow"),
                                    null,
                                    Catalog.GetString("Start slideshow"),
                                    SlideShowAction),
                });

                actions.Add(new ToggleActionEntry [] {
                    new ToggleActionEntry(Info,
                                          Stock.Info,
                                          Catalog.GetString("Info"),
                                          null,
                                          Catalog.GetString("Image Information"),
                                          InfoAction,
                                          false)
                });

                new Fader(this, 1.0, 3);
                notebook            = new Notebook();
                notebook.ShowBorder = false;
                notebook.ShowTabs   = false;
                notebook.Show();

                scroll = new ScrolledView();
                view   = new PhotoImageView(collection);
                // FIXME this should be handled by the new style setting code
                view.ModifyBg(Gtk.StateType.Normal, this.Style.Black);
                view.PointerMode = ImageView.PointerModeType.Scroll;
                this.Add(notebook);
                view.Show();
                view.MotionNotifyEvent += HandleViewMotion;

                Action rotate_left = new RotateLeftAction(view.Item);
                actions.Add(rotate_left);

                Action rotate_right = new RotateRightAction(view.Item);
                actions.Add(rotate_right);

                scroll.ScrolledWindow.Add(view);
                HBox hhbox = new HBox();
                hhbox.PackEnd(GetButton(HideToolbar), false, true, 0);
                hhbox.PackEnd(GetButton(Info), false, true, 0);
                hhbox.PackStart(GetButton(ExitFullScreen, true), false, false, 0);
                hhbox.PackStart(Add(new PreviousPictureAction(view.Item)), false, false, 0);
                hhbox.PackStart(GetButton(SlideShow), false, true, 0);
                hhbox.PackStart(Add(new NextPictureAction(view.Item)), false, false, 0);
                //hhbox.PackStart (Add (new AutoColor (view.Item)), false, false, 0);

                display = new TextureDisplay(view.Item);
                display.AddEvents((int)(Gdk.EventMask.PointerMotionMask));
                display.ModifyBg(Gtk.StateType.Normal, this.Style.Black);
                display.MotionNotifyEvent += HandleViewMotion;
                Label effect = new Label(Catalog.GetString("Slide transition: "));
                hhbox.PackStart(effect, false, false, 5);
                hhbox.PackStart(display.GetCombo(), false, false, 0);
                display.Show();

                hhbox.PackStart(Add(new RotateLeftAction(view.Item)), false, false, 0);
                hhbox.PackStart(Add(new RotateRightAction(view.Item)), false, false, 0);
                hhbox.BorderWidth = 15;

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

                //display = new ImageDisplay (view.Item);

                notebook.AppendPage(scroll, null);
                notebook.AppendPage(display, null);

                hhbox.ShowAll();
                //scroll.ShowControls ();

                scroll.Show();
                this.Decorated = false;
                this.Fullscreen();
                this.ButtonPressEvent += HandleButtonPressEvent;

                view.Item.Changed += HandleItemChanged;
                view.GrabFocus();

                controls = new ControlOverlay(this);
                controls.Add(hhbox);
                controls.Dismiss();

                notebook.CurrentPage = 0;
            } catch (System.Exception e) {
                System.Console.WriteLine(e);
            }
        }
Beispiel #3
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;
        }
        public PhotoView(IBrowsableCollection query)
            : base()
        {
            this.query = query;

            description_delay = new FSpot.Delay(1000, new GLib.IdleHandler(CommitPendingChanges));
            this.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);

            Box inner_vbox = new VBox(false, 2);

            frame.Add(inner_vbox);

            photo_view = new FSpot.PhotoImageView(query);
            photo_view.PhotoChanged     += HandlePhotoChanged;
            photo_view.SelectionChanged += HandleSelectionChanged;

            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(photo_view);
            photo_view_scrolled.ButtonPressEvent += HandleButtonPressEvent;
            photo_view.AddEvents((int)EventMask.KeyPressMask);
            inner_vbox.PackStart(photo_view_scrolled, true, true, 0);

            HBox inner_hbox = new HBox(false, 2);

            //inner_hbox.BorderWidth = 6;

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

            Label comment = new Label(Catalog.GetString("Comment:"));

            inner_hbox.PackStart(comment, false, false, 0);
            description_entry = new Entry();
            inner_hbox.PackStart(description_entry, true, true, 0);
            description_entry.Changed += HandleDescriptionChanged;

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

            Box toolbar_hbox = new HBox(false, 6);

            vbox.PackStart(toolbar_hbox, false, true, 0);

            toolbar_hbox.PackStart(CreateConstraintsOptionMenu(), false, false, 0);

            crop_button = new ToolbarButton();
            crop_button.Add(new Gtk.Image("f-spot-crop", IconSize.Button));
            toolbar_hbox.PackStart(crop_button, false, true, 0);

            crop_button.Clicked += new EventHandler(HandleCropButtonClicked);

            redeye_button = new ToolbarButton();
            redeye_button.Add(new Gtk.Image("f-spot-red-eye", IconSize.Button));
            toolbar_hbox.PackStart(redeye_button, false, true, 0);

            redeye_button.Clicked += new EventHandler(HandleRedEyeButtonClicked);

            color_button = new ToolbarButton();
            color_button.Add(new Gtk.Image("f-spot-adjust-colors", IconSize.Button));
            toolbar_hbox.PackStart(color_button, false, true, 0);

            color_button.Clicked += new EventHandler(HandleColorButtonClicked);

            desaturate_button = new ToolbarButton();
            desaturate_button.Add(new Gtk.Image("f-spot-desaturate", IconSize.Button));
            toolbar_hbox.PackStart(desaturate_button, false, true, 0);
            desaturate_button.Clicked += HandleDesaturateButtonClicked;

            sepia_button = new ToolbarButton();
            sepia_button.Add(new Gtk.Image("f-spot-sepia", IconSize.Button));
            toolbar_hbox.PackStart(sepia_button, false, true, 0);
            sepia_button.Clicked += HandleSepiaButtonClicked;

            ItemAction straighten = new TiltEditorAction(photo_view);

            toolbar_hbox.PackStart(straighten.GetToolButton(false), false, true, 0);

            ItemAction softfocus = new SoftFocusEditorAction(photo_view);

            toolbar_hbox.PackStart(softfocus.GetToolButton(false), false, true, 0);

            ItemAction autocolor = new AutoColor(photo_view.Item);

            toolbar_hbox.PackStart(autocolor.GetToolButton(false), false, true, 0);

            /* Face detection ! */

            face_widget = new FaceBox(toolbar_hbox, photo_view);

            vbox.PackStart(face_widget, false, true, 0);
            /* Spacer Label */
            toolbar_hbox.PackStart(new Label(String.Empty), true, true, 0);

            count_label = new Label(String.Empty);
            toolbar_hbox.PackStart(count_label, false, true, 0);

            display_previous_button = new ToolbarButton();
            Gtk.Image display_previous_image = new Gtk.Image(Stock.GoBack, IconSize.Button);
            display_previous_button.Add(display_previous_image);
            display_previous_button.Clicked += new EventHandler(HandleDisplayPreviousButtonClicked);
            toolbar_hbox.PackStart(display_previous_button, false, true, 0);

            display_next_button = new ToolbarButton();
            Gtk.Image display_next_image = new Gtk.Image(Stock.GoForward, IconSize.Button);
            display_next_button.Add(display_next_image);
            display_next_button.Clicked += new EventHandler(HandleDisplayNextButtonClicked);
            toolbar_hbox.PackStart(display_next_button, false, true, 0);

            tips.Enable();


            UpdateButtonSensitivity();

            vbox.ShowAll();
            tips.SetTip(color_button, Catalog.GetString("Adjust the photo colors"), String.Empty);
            tips.SetTip(constraints_option_menu, Catalog.GetString("Constrain the aspect ratio of the selection"), String.Empty);
            tips.SetTip(display_next_button, Catalog.GetString("Next photo"), String.Empty);
            tips.SetTip(display_previous_button, Catalog.GetString("Previous photo"), String.Empty);
            tips.SetTip(desaturate_button, Catalog.GetString("Convert the photo to black and white"), String.Empty);
            tips.SetTip(sepia_button, Catalog.GetString("Convert the photo to sepia tones"), String.Empty);

            Realized += delegate(object o, EventArgs e) { SetColors(); };
        }