示例#1
0
 public ViewEditorAction(PhotoImageView view,
                         string name,
                         string label,
                         string tooltip,
                         string stock_id) : base(view, name, label, tooltip, stock_id)
 {
 }
示例#2
0
 public static void ReloadSettings()
 {
     GetXProfile();
     GetSettings();
     CreateStandartTransform();
     PhotoImageView.Reload();
 }
示例#3
0
 public TiltEditorAction(PhotoImageView view)
     : base(view,
            "TiltEdit",
            Catalog.GetString("Straighten"),
            Catalog.GetString("Adjust the angle of the image to straighten the horizon"),
            "f-spot-horizon")
 {
 }
示例#4
0
 public SoftFocusEditorAction(PhotoImageView view)
     : base(view,
            "SoftFocusEdit",
            Catalog.GetString("Soft Focus"),
            Catalog.GetString("Create a soft focus visual effect"),
            "f-spot-soft-focus")
 {
 }
示例#5
0
        public void HandlePhotoChanged(FSpot.PhotoImageView sender)
        {
            int item = image_view.Item.Index;

            photo_label.Text = String.Format(Catalog.GetString("Photo {0} of {1}"),
                                             item + 1, query.Count);

            photo_spin_button.Value = item + 1;
        }
示例#6
0
 public ViewAction(PhotoImageView view,
                   string name,
                   string label,
                   string tooltip,
                   string stock_id) : base(view.Item, name, label, tooltip, stock_id)
 {
     this.view       = view;
     view.Destroyed += HandleDestroyed;
 }
示例#7
0
        public Loupe(PhotoImageView view) : base("Loupe")
        {
            this.view = view;
            Decorated = false;

            Gtk.Window win = (Gtk.Window)view.Toplevel;

            win.GetPosition(out old_win_pos.X, out old_win_pos.Y);
            win.ConfigureEvent += HandleToplevelConfigure;

            TransientFor      = win;
            DestroyWithParent = true;

            BuildUI();
        }
示例#8
0
        private void HandlePhotoChanged(PhotoImageView view)
        {
            try {
                if (!view.Item.IsValid)
                {
                    throw new Exception("Invalid Image");
                }

                using (FSpot.ImageFile img = FSpot.ImageFile.Create(((Photo)view.Item.Current).DefaultVersionUri)) {
                    try {
                        image_profile = img.GetProfile();
                    } catch (System.Exception e) {
                        image_profile = null;
                        System.Console.WriteLine(e);
                    }

                    // FIXME fall back to rgb for now
                    if (image_profile == null)
                    {
                        image_profile = Cms.Profile.CreateStandardRgb();
                    }

                    AdjustedPixbuf = img.Load(256, 256);
                    ScaledPixbuf   = AdjustedPixbuf.Copy();
                }

                if (AdjustedPixbuf.HasAlpha)
                {
                    throw new Exception("Unsupported Alpha Channel");
                }

                control_vbox.Sensitive = true;
                ok_button.Sensitive    = true;

                RangeChanged(null, null);
            } catch (System.Exception) {
                control_vbox.Sensitive = false;
                ok_button.Sensitive    = false;
                AdjustedPixbuf         = null;
                ScaledPixbuf           = null;
                image_profile          = null;
            }
        }
		public TimeDialog (Db db, IBrowsableCollection collection) : base ("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;
			Dialog.ShowAll ();
			HandleCollectionChanged (collection);

			spacing_entry.Changed += HandleSpacingChanged;
			spacing_entry.Sensitive = ! difference_check.Active;
		      
			difference_check.Toggled += HandleActionToggled;
		}
示例#10
0
        public TimeDialog(Db db, IBrowsableCollection collection) : base("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;
            Dialog.ShowAll();
            HandleCollectionChanged(collection);

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

            difference_check.Toggled += HandleActionToggled;
        }
            // FIXME clicking the spinbutton too fast seems to switch the view to browse

            public FaceBox(Gtk.Box tb, PhotoImageView vw) : base()
            {
                m_list     = new ArrayList();
                face_store = Core.Database.Faces;
                View       = vw;
                tag_store  = FSpot.Core.Database.Tags;

                Gtk.Label lab = new Gtk.Label("Face det:");
                lab.Show();
                tb.PackStart(lab, false, true, 0);

                face_button = new ToolbarButton();
                face_button.Add(new Gtk.Image("f-spot-sepia", IconSize.Button));
                tb.PackStart(face_button, false, true, 0);

                face_button.Clicked += HandleFaceButtonClicked;

                tag_entry = new Gtk.Entry("test");
                tag_entry.Show();
                tag_entry.Sensitive = false;
                tb.PackStart(tag_entry, false, true, 0);

                m_newtag_button = new  ToolbarButton();
                m_newtag_button.Add(new Gtk.Image("f-spot-new-tag", IconSize.Button));
                m_newtag_button.Show();
                m_newtag_button.Sensitive = false;
                tb.PackStart(m_newtag_button, false, true, 0);

                m_newtag_button.Clicked += HandleNewTagButtonClicked;

                m_spin = new SpinButton(1, 1, 1);
                m_spin.Show();
                m_spin.Sensitive = false;
                tb.PackStart(m_spin, false, true, 0);

                m_spin.Changed += HandleSpinChanged;

                //m.spin.ValueChanged += jesli w bazie, to pokaz jego tag
                //this.Add(tag_widget);
            }
示例#12
0
 private void HandleDestroyed(object sender, EventArgs args)
 {
     view      = null;
     Sensitive = false;
 }
		public SoftFocusEditorAction (PhotoImageView view)
			: base (view,
				"SoftFocusEdit",
				Catalog.GetString ("Soft Focus"),
				Catalog.GetString ("Create a soft focus visual effect"),
				"f-spot-soft-focus")
		{
		}
		public TiltEditorAction (PhotoImageView view)
			: base (view, 
				"TiltEdit", 
				Catalog.GetString ("Straighten"),
				Catalog.GetString ("Adjust the angle of the image to straighten the horizon"),
				"f-spot-horizon")
		{
		}
 		public ViewEditorAction (PhotoImageView view,
					 string name,
					 string label,
					 string tooltip,
					 string stock_id) : base (view, name, label, tooltip, stock_id)
		{
		}
		private void HandleDestroyed (object sender, EventArgs args)
		{
			view = null;
			Sensitive = false;
		}
示例#17
0
        public SingleView(Uri [] uris)
        {
            string glade_name = "single_view";

            this.uri = uris [0];

            System.Console.WriteLine("uri = {0}", uri.ToString());

            xml = new Glade.XML(null, "f-spot.glade", glade_name, "f-spot");
            xml.Autoconnect(this);
            window = (Gtk.Window)xml.GetWidget(glade_name);

            LoadPreference(Preferences.VIEWER_WIDTH);
            LoadPreference(Preferences.VIEWER_MAXIMIZED);

            Gtk.Toolbar toolbar = new Gtk.Toolbar();
            toolbar_hbox.PackStart(toolbar);
            Widget rl_button = GtkUtil.MakeToolbarButton(toolbar, "f-spot-rotate-270", new System.EventHandler(HandleRotate270Command));

            SetTip(rl_button, Catalog.GetString("Rotate photo left"));
            Widget rr_button = GtkUtil.MakeToolbarButton(toolbar, "f-spot-rotate-90", new System.EventHandler(HandleRotate90Command));

            SetTip(rr_button, Catalog.GetString("Rotate photo right"));

            toolbar.AppendSpace();

            Widget fs_button = GtkUtil.MakeToolbarButton(toolbar, "f-spot-fullscreen", new System.EventHandler(HandleViewFullscreen));

            SetTip(fs_button, Catalog.GetString("View photos fullscreen"));
            Widget ss_button = GtkUtil.MakeToolbarButton(toolbar, "f-spot-slideshow", new System.EventHandler(HandleViewSlideshow));

            SetTip(ss_button, Catalog.GetString("View photos in a slideshow"));

            collection = new UriCollection(uris);

            TargetEntry [] dest_table = { new TargetEntry("text/uri-list", 0, 0),
                                          new TargetEntry("text/plain",    0, 1) };

            directory_view = new IconView(collection);
            directory_view.Selection.Changed += HandleSelectionChanged;
            directory_view.DragDataReceived  += HandleDragDataReceived;
            Gtk.Drag.DestSet(directory_view, DestDefaults.All, dest_table,
                             DragAction.Copy | DragAction.Move);
            directory_view.DisplayTags  = false;
            directory_view.DisplayDates = false;
            directory_scrolled.Add(directory_view);

            ThumbnailGenerator.Default.OnPixbufLoaded += delegate { directory_view.QueueDraw(); };

            image_view = new PhotoImageView(collection);
            FSpot.Global.ModifyColors(image_view);
            FSpot.Global.ModifyColors(image_scrolled);
            image_view.ZoomChanged      += HandleZoomChanged;
            image_view.Item.Changed     += HandleItemChanged;
            image_view.ButtonPressEvent += HandleImageViewButtonPressEvent;
            image_view.DragDataReceived += HandleDragDataReceived;
            Gtk.Drag.DestSet(image_view, DestDefaults.All, dest_table,
                             DragAction.Copy | DragAction.Move);
            image_scrolled.Add(image_view);

            Window.ShowAll();

            zoom_scale.ValueChanged += HandleZoomScaleValueChanged;

            LoadPreference(Preferences.VIEWER_SHOW_TOOLBAR);
            LoadPreference(Preferences.VIEWER_INTERPOLATION);
            LoadPreference(Preferences.VIEWER_TRANSPARENCY);
            LoadPreference(Preferences.VIEWER_TRANS_COLOR);

            ShowSidebar = collection.Count > 1;

            near_image.SetFromStock("f-spot-stock_near", Gtk.IconSize.SmallToolbar);
            far_image.SetFromStock("f-spot-stock_far", Gtk.IconSize.SmallToolbar);

            slide_delay = new FSpot.Delay(new GLib.IdleHandler(SlideShow));

            LoadPreference(Preferences.VIEWER_SHOW_FILENAMES);

            Preferences.SettingChanged += OnPreferencesChanged;
            window.DeleteEvent         += HandleDeleteEvent;

            collection.Changed += HandleCollectionChanged;
            UpdateStatusLabel();

            if (collection.Count > 0)
            {
                directory_view.Selection.Add(0);
            }

            export.Submenu = (Mono.Addins.AddinManager.GetExtensionNode("/FSpot/Menus/Exports") as FSpot.Extensions.SubmenuNode).GetMenuItem().Submenu;
            export.Submenu.ShowAll();
            export.Activated += HandleExportActivated;
        }
		public bool Execute (Tag t)
		{
			this.CreateDialog ("edit_icon_dialog");

			this.Dialog.Title = String.Format (Catalog.GetString ("Edit Icon for Tag {0}"), t.Name);

			PreviewPixbuf = t.Icon;

			query = new FSpot.PhotoQuery (db.Photos);
			
			if (db.Tags.Hidden != null)
				query.Terms = FSpot.OrTerm.FromTags (new Tag []{ t, db.Tags.Hidden });
			else 
				query.Terms = new FSpot.Literal (t);

			image_view = new FSpot.PhotoImageView (query);
			image_view.SelectionXyRatio = 1.0;
			image_view.SelectionChanged += HandleSelectionChanged;
			image_view.PhotoChanged += HandlePhotoChanged;

                        external_photo_chooser = new Gtk.FileChooserButton (Catalog.GetString ("Select Photo from file"),
                                                                 Gtk.FileChooserAction.Open);

			external_photo_chooser.Filter = new FileFilter();
			external_photo_chooser.Filter.AddPixbufFormats();
                        external_photo_chooser.LocalOnly = false;
                        external_photo_chooser_hbox.PackStart (external_photo_chooser);

    			Dialog.ShowAll ();
			external_photo_chooser.SelectionChanged += HandleExternalFileSelectionChanged;

			photo_scrolled_window.Add (image_view);

			if (query.Count > 0) {
				photo_spin_button.Wrap = true;
				photo_spin_button.Adjustment.Lower = 1.0;
				photo_spin_button.Adjustment.Upper = (double) query.Count;
				photo_spin_button.Adjustment.StepIncrement = 1.0;
				photo_spin_button.ValueChanged += HandleSpinButtonChanged;
				
				image_view.Item.Index = 0;
			} else {
				from_photo_label.Markup = String.Format (Catalog.GetString (
					"\n<b>From Photo</b>\n" +
					" You can use one of your library photos as an icon for this tag.\n" +
					" However, first you must have at least one photo associated\n" +
					" with this tag. Please tag a photo as '{0}' and return here\n" +
					" to use it as an icon."), t.Name); 
				photo_scrolled_window.Visible = false;
				photo_label.Visible = false;
				photo_spin_button.Visible = false;
			}			

			icon_store = new ListStore (typeof (string), typeof (Gdk.Pixbuf));

			icon_view = new Gtk.IconView (icon_store); 
			icon_view.PixbufColumn = 1;
			icon_view.SelectionMode = SelectionMode.Single;
			icon_view.SelectionChanged += HandleIconSelectionChanged;

			icon_scrolled_window.Add (icon_view);

			icon_view.Show();

			image_view.Show ();

			FSpot.Delay fill_delay = new FSpot.Delay (FillIconView);
			fill_delay.Start ();

			ResponseType response = (ResponseType) this.Dialog.Run ();
			bool success = false;

			if (response == ResponseType.Ok) {
				try {
					if (IconName != null) {
						t.ThemeIconName = IconName;
					} else {
						t.ThemeIconName = null;
						t.Icon = PreviewPixbuf_WithoutProfile;
					}
					//db.Tags.Commit (t);
					success = true;
				} catch (Exception ex) {
					// FIXME error dialog.
					Console.WriteLine ("error {0}", ex);
				}
			} else if (response == (ResponseType) (1)) {
				t.Icon = null;
				success = true;
			}
			
			this.Dialog.Destroy ();
			return success;
		}
示例#19
0
        public SingleView(Uri[] uris)
        {
            uri = uris[0];
            Log.Debug("uri: " + uri);

            var builder = new GtkBeans.Builder("single_view.ui");

            builder.Autoconnect(this);

            LoadPreference(Preferences.VIEWER_WIDTH);
            LoadPreference(Preferences.VIEWER_MAXIMIZED);

            var toolbar = new Gtk.Toolbar();

            toolbar_hbox.PackStart(toolbar);

            rl_button             = GtkUtil.ToolButtonFromTheme("object-rotate-left", Strings.RotateLeft, true);
            rl_button.Clicked    += HandleRotate270Command;
            rl_button.TooltipText = Strings.RotatePhotoLeft;
            toolbar.Insert(rl_button, -1);

            rr_button             = GtkUtil.ToolButtonFromTheme("object-rotate-right", Strings.RotateRight, true);
            rr_button.Clicked    += HandleRotate90Command;
            rr_button.TooltipText = Strings.RotatePhotoRight;
            toolbar.Insert(rr_button, -1);

            toolbar.Insert(new SeparatorToolItem(), -1);

            ToolButton fs_button = GtkUtil.ToolButtonFromTheme("view-fullscreen", Strings.Fullscreen, true);

            fs_button.Clicked    += HandleViewFullscreen;
            fs_button.TooltipText = Strings.ViewPhotosFullscreen;
            toolbar.Insert(fs_button, -1);

            ToolButton ss_button = GtkUtil.ToolButtonFromTheme("media-playback-start", Strings.Slideshow, true);

            ss_button.Clicked    += HandleViewSlideshow;
            ss_button.TooltipText = Strings.ViewPhotosInASlideshow;
            toolbar.Insert(ss_button, -1);

            collection = new UriCollection(uris);

            var targetList = new TargetList();

            //targetList.AddTextTargets (DragDropTargets.TargetType.PlainText);
            //targetList.AddUriTargets (DragDropTargets.TargetType.UriList);

            //directory_view = new SelectionCollectionGridView (collection);
            directory_view.Selection.Changed += HandleSelectionChanged;
            directory_view.DragDataReceived  += HandleDragDataReceived;
            Gtk.Drag.DestSet(directory_view, DestDefaults.All, (TargetEntry[])targetList,
                             DragAction.Copy | DragAction.Move);
            directory_view.DisplayTags    = false;
            directory_view.DisplayDates   = false;
            directory_view.DisplayRatings = false;

            directory_scrolled = new ScrolledWindow();
            directory_scrolled.Add(directory_view);

            sidebar = new Sidebar();

            info_vbox.Add(sidebar);
            sidebar.AppendPage(directory_scrolled, Strings.Folder, "gtk-directory");

            AddinManager.AddExtensionNodeHandler("/FSpot/Sidebar", OnSidebarExtensionChanged);

            sidebar.Context = ViewContext.Single;

            sidebar.CloseRequested += HandleHideSidePane;
            sidebar.Show();

            App.Instance.Container.Resolve <IThumbnailLoader> ().OnPixbufLoaded += delegate { directory_view.QueueDraw(); };

            imageView = new PhotoImageView(collection);
            GtkUtil.ModifyColors(imageView);
            GtkUtil.ModifyColors(image_scrolled);
            imageView.ZoomChanged      += HandleZoomChanged;
            imageView.Item.Changed     += HandleItemChanged;
            imageView.ButtonPressEvent += HandleImageViewButtonPressEvent;
            imageView.DragDataReceived += HandleDragDataReceived;
            Gtk.Drag.DestSet(imageView, DestDefaults.All, (TargetEntry[])targetList,
                             DragAction.Copy | DragAction.Move);
            image_scrolled.Add(imageView);

            Window.ShowAll();

            zoom_scale.ValueChanged += HandleZoomScaleValueChanged;

            LoadPreference(Preferences.VIEWER_SHOW_TOOLBAR);
            LoadPreference(Preferences.VIEWER_INTERPOLATION);
            LoadPreference(Preferences.VIEWER_TRANSPARENCY);
            LoadPreference(Preferences.VIEWER_TRANS_COLOR);

            ShowSidebar = collection.Count > 1;

            LoadPreference(Preferences.VIEWER_SHOW_FILENAMES);

            Preferences.SettingChanged += OnPreferencesChanged;
            Window.DeleteEvent         += HandleDeleteEvent;

            collection.Changed += HandleCollectionChanged;

            // wrap the methods to fit to the delegate
            imageView.Item.Changed += delegate(object sender, BrowsablePointerChangedEventArgs old) {
                if (!(sender is BrowsablePointer pointer))
                {
                    return;
                }
                IPhoto[] item = { pointer.Current };
                sidebar.HandleSelectionChanged(new ObservableCollection <IPhoto>(item));
            };

            imageView.Item.Collection.CollectionChanged += sidebar.HandleCollectionItemsChanged;

            UpdateStatusLabel();

            if (collection.Count > 0)
            {
                directory_view.Selection.Add(0);
            }

            export.Submenu = (AddinManager.GetExtensionNode("/FSpot/Menus/Exports") as SubmenuNode).GetMenuItem(this).Submenu;
            export.Submenu.ShowAll();
            export.Activated += HandleExportActivated;
        }
示例#20
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;
        }
示例#21
0
		public Tilt (PhotoImageView view) : base (view)
		{
		}
		public SingleView (Uri [] uris) 
		{
			string glade_name = "single_view";
			this.uri = uris [0];
			
			System.Console.WriteLine ("uri = {0}", uri.ToString ());

			xml = new Glade.XML (null, "f-spot.glade", glade_name, "f-spot");
			xml.Autoconnect (this);
			window = (Gtk.Window) xml.GetWidget (glade_name);
		
			LoadPreference (Preferences.VIEWER_WIDTH);
			LoadPreference (Preferences.VIEWER_MAXIMIZED);

			Gtk.Toolbar toolbar = new Gtk.Toolbar ();
			toolbar_hbox.PackStart (toolbar);
			Widget rl_button = GtkUtil.MakeToolbarButton (toolbar, "f-spot-rotate-270", new System.EventHandler (HandleRotate270Command));
			SetTip (rl_button, Catalog.GetString ("Rotate photo left"));
			Widget rr_button = GtkUtil.MakeToolbarButton (toolbar, "f-spot-rotate-90", new System.EventHandler (HandleRotate90Command));
			SetTip (rr_button, Catalog.GetString ("Rotate photo right"));

			toolbar.AppendSpace ();

			Widget fs_button = GtkUtil.MakeToolbarButton (toolbar, "f-spot-fullscreen", new System.EventHandler (HandleViewFullscreen));
			SetTip (fs_button, Catalog.GetString ("View photos fullscreen"));
			Widget ss_button = GtkUtil.MakeToolbarButton (toolbar, "f-spot-slideshow", new System.EventHandler (HandleViewSlideshow));
			SetTip (ss_button, Catalog.GetString ("View photos in a slideshow"));

			collection = new UriCollection (uris);

			TargetEntry [] dest_table = {   new TargetEntry ("text/uri-list", 0, 0),
							new TargetEntry ("text/plain", 0, 1)};
			
			directory_view = new IconView (collection);
			directory_view.Selection.Changed += HandleSelectionChanged;
			directory_view.DragDataReceived += HandleDragDataReceived;
			Gtk.Drag.DestSet (directory_view, DestDefaults.All, dest_table, 
					DragAction.Copy | DragAction.Move); 
			directory_view.DisplayTags = false;
			directory_view.DisplayDates = false;
			directory_scrolled.Add (directory_view);

			ThumbnailGenerator.Default.OnPixbufLoaded += delegate { directory_view.QueueDraw (); };

			image_view = new PhotoImageView (collection);
			FSpot.Global.ModifyColors (image_view);
			FSpot.Global.ModifyColors (image_scrolled);
			image_view.ZoomChanged += HandleZoomChanged;
			image_view.Item.Changed += HandleItemChanged;
			image_view.ButtonPressEvent += HandleImageViewButtonPressEvent;
			image_view.DragDataReceived += HandleDragDataReceived;
			Gtk.Drag.DestSet (image_view, DestDefaults.All, dest_table,
					DragAction.Copy | DragAction.Move); 
			image_scrolled.Add (image_view);
			
			Window.ShowAll ();

			zoom_scale.ValueChanged += HandleZoomScaleValueChanged;
		
			LoadPreference (Preferences.VIEWER_SHOW_TOOLBAR);
 			LoadPreference (Preferences.VIEWER_INTERPOLATION);
			LoadPreference (Preferences.VIEWER_TRANSPARENCY);
			LoadPreference (Preferences.VIEWER_TRANS_COLOR);

			ShowSidebar = collection.Count > 1;

			near_image.SetFromStock ("f-spot-stock_near", Gtk.IconSize.SmallToolbar);
			far_image.SetFromStock ("f-spot-stock_far", Gtk.IconSize.SmallToolbar);

			slide_delay = new FSpot.Delay (new GLib.IdleHandler (SlideShow));

			LoadPreference (Preferences.VIEWER_SHOW_FILENAMES);

			Preferences.SettingChanged += OnPreferencesChanged;
			window.DeleteEvent += HandleDeleteEvent;
			
			collection.Changed += HandleCollectionChanged;
			UpdateStatusLabel ();
			
			if (collection.Count > 0)
				directory_view.Selection.Add (0);

			export.Submenu = (Mono.Addins.AddinManager.GetExtensionNode ("/FSpot/Menus/Exports") as FSpot.Extensions.SubmenuNode).GetMenuItem ().Submenu;
			export.Submenu.ShowAll ();
			export.Activated += HandleExportActivated ;
		}
示例#23
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);
            }
        }
示例#24
0
 public Sharpener(PhotoImageView view) : base(view)
 {
 }
示例#25
0
        public SingleView(Uri [] uris)
        {
            string glade_name = "single_view";

            this.uri = uris [0];

            System.Console.WriteLine("uri = {0}", uri.ToString());

            xml = new Glade.XML(null, "f-spot.glade", glade_name, "f-spot");
            xml.Autoconnect(this);
            window = (Gtk.Window)xml.GetWidget(glade_name);

            LoadPreference(Preferences.VIEWER_WIDTH);
            LoadPreference(Preferences.VIEWER_MAXIMIZED);

            Gtk.Toolbar toolbar = new Gtk.Toolbar();
            toolbar_hbox.PackStart(toolbar);

            ToolButton rl_button = GtkUtil.ToolButtonFromTheme("object-rotate-left", Catalog.GetString("Rotate Left"), true);

            rl_button.Clicked += HandleRotate270Command;
            rl_button.SetTooltip(toolTips, Catalog.GetString("Rotate photo left"), null);
            toolbar.Insert(rl_button, -1);

            ToolButton rr_button = GtkUtil.ToolButtonFromTheme("object-rotate-right", Catalog.GetString("Rotate Right"), true);

            rr_button.Clicked += HandleRotate90Command;
            rr_button.SetTooltip(toolTips, Catalog.GetString("Rotate photo right"), null);
            toolbar.Insert(rr_button, -1);

            toolbar.Insert(new SeparatorToolItem(), -1);

            ToolButton fs_button = GtkUtil.ToolButtonFromTheme("view-fullscreen", Catalog.GetString("Fullscreen"), true);

            fs_button.Clicked += HandleViewFullscreen;
            fs_button.SetTooltip(toolTips, Catalog.GetString("View photos fullscreen"), null);
            toolbar.Insert(fs_button, -1);

            ToolButton ss_button = GtkUtil.ToolButtonFromTheme("media-playback-start", Catalog.GetString("Slideshow"), true);

            ss_button.Clicked += HandleViewSlideshow;
            ss_button.SetTooltip(toolTips, Catalog.GetString("View photos in a slideshow"), null);
            toolbar.Insert(ss_button, -1);

            collection = new UriCollection(uris);

            TargetEntry [] dest_table = { new TargetEntry("text/uri-list", 0, 0),
                                          new TargetEntry("text/plain",    0, 1) };

            directory_view = new FSpot.Widgets.IconView(collection);
            directory_view.Selection.Changed += HandleSelectionChanged;
            directory_view.DragDataReceived  += HandleDragDataReceived;
            Gtk.Drag.DestSet(directory_view, DestDefaults.All, dest_table,
                             DragAction.Copy | DragAction.Move);
            directory_view.DisplayTags    = false;
            directory_view.DisplayDates   = false;
            directory_view.DisplayRatings = false;

            directory_scrolled = new ScrolledWindow();
            directory_scrolled.Add(directory_view);

            sidebar = new Sidebar();

            info_vbox.Add(sidebar);
            sidebar.AppendPage(directory_scrolled, Catalog.GetString("Folder"), "gtk-directory");

            AddinManager.AddExtensionNodeHandler("/FSpot/Sidebar", OnSidebarExtensionChanged);

            sidebar.Context = ViewContext.Single;

            sidebar.CloseRequested += HandleHideSidePane;
            sidebar.Show();

            ThumbnailGenerator.Default.OnPixbufLoaded += delegate { directory_view.QueueDraw(); };

            image_view = new PhotoImageView(collection);
            GtkUtil.ModifyColors(image_view);
            GtkUtil.ModifyColors(image_scrolled);
            image_view.ZoomChanged      += HandleZoomChanged;
            image_view.Item.Changed     += HandleItemChanged;
            image_view.ButtonPressEvent += HandleImageViewButtonPressEvent;
            image_view.DragDataReceived += HandleDragDataReceived;
            Gtk.Drag.DestSet(image_view, DestDefaults.All, dest_table,
                             DragAction.Copy | DragAction.Move);
            image_scrolled.Add(image_view);

            Window.ShowAll();

            zoom_scale.ValueChanged += HandleZoomScaleValueChanged;

            LoadPreference(Preferences.VIEWER_SHOW_TOOLBAR);
            LoadPreference(Preferences.VIEWER_INTERPOLATION);
            LoadPreference(Preferences.VIEWER_TRANSPARENCY);
            LoadPreference(Preferences.VIEWER_TRANS_COLOR);

            ShowSidebar = collection.Count > 1;

            LoadPreference(Preferences.VIEWER_SHOW_FILENAMES);

            Preferences.SettingChanged += OnPreferencesChanged;
            window.DeleteEvent         += HandleDeleteEvent;

            collection.Changed += HandleCollectionChanged;

            // wrap the methods to fit to the delegate
            image_view.Item.Changed += delegate(BrowsablePointer pointer, BrowsablePointerChangedArgs old) {
                IBrowsableItem [] item       = { pointer.Current };
                PhotoArray        item_array = new PhotoArray(item);
                sidebar.HandleSelectionChanged(item_array);
            };

            image_view.Item.Collection.ItemsChanged += sidebar.HandleSelectionItemsChanged;

            UpdateStatusLabel();

            if (collection.Count > 0)
            {
                directory_view.Selection.Add(0);
            }

            export.Submenu = (Mono.Addins.AddinManager.GetExtensionNode("/FSpot/Menus/Exports") as FSpot.Extensions.SubmenuNode).GetMenuItem(this).Submenu;
            export.Submenu.ShowAll();
            export.Activated += HandleExportActivated;
        }
示例#26
0
        public FullScreenView(IBrowsableCollection collection, Window parent) : base("Full Screen Mode")
        {
            //going fullscreen on the same screen the parent window
            Gdk.Screen screen  = Screen;
            int        monitor = screen.GetMonitorAtWindow(parent.GdkWindow);

            Gdk.Rectangle bounds = screen.GetMonitorGeometry(monitor);
            Move(bounds.X, bounds.Y);

            string style = "style \"test\" {\n" +
                           "GtkToolbar::shadow_type = GTK_SHADOW_NONE\n" +
                           "}\n" +
                           "class \"GtkToolbar\" style \"test\"";

            Gtk.Rc.ParseString(style);

            Name = "FullscreenContainer";
            try {
                //scroll = new Gtk.ScrolledWindow (null, null);
                actions = new ActionGroup("joe");

                actions.Add(new[] {
                    new ActionEntry(HideToolbar, Stock.Close,
                                    Catalog.GetString("Hide"),
                                    null,
                                    Catalog.GetString("Hide toolbar"),
                                    HideToolbarAction)
                });

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

                Gtk.Action exit_full_screen = new Gtk.Action(ExitFullScreen,
                                                             Catalog.GetString("Exit fullscreen"),
                                                             null,
                                                             null);
                exit_full_screen.IconName   = "view-restore";
                exit_full_screen.Activated += ExitAction;
                actions.Add(exit_full_screen);

                Gtk.Action slide_show = new Gtk.Action(SlideShow,
                                                       Catalog.GetString("Slideshow"),
                                                       Catalog.GetString("Start slideshow"),
                                                       null);
                slide_show.IconName   = "media-playback-start";
                slide_show.Activated += SlideShowAction;
                actions.Add(slide_show);

                new WindowOpacityFader(this, 1.0, 600);
                notebook            = new Notebook();
                notebook.ShowBorder = false;
                notebook.ShowTabs   = false;
                notebook.Show();

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

                scroll.ScrolledWindow.Add(view);

                Toolbar tbar = new Toolbar();
                tbar.ToolbarStyle = Gtk.ToolbarStyle.BothHoriz;

                tbar.ShowArrow   = false;
                tbar.BorderWidth = 15;

                ToolItem t_item = (actions [ExitFullScreen]).CreateToolItem() as ToolItem;
                t_item.IsImportant = true;
                tbar.Insert(t_item, -1);

                Gtk.Action action = new PreviousPictureAction(view.Item);
                actions.Add(action);
                tbar.Insert(action.CreateToolItem() as ToolItem, -1);

                play_pause_button = (actions [SlideShow]).CreateToolItem() as ToolButton;
                tbar.Insert(play_pause_button, -1);

                action = new NextPictureAction(view.Item);
                actions.Add(action);
                tbar.Insert(action.CreateToolItem() as ToolItem, -1);

                t_item       = new ToolItem();
                t_item.Child = new Label(Catalog.GetString("Slide transition:"));
                tbar.Insert(t_item, -1);

                display = new SlideShow(view.Item);
                display.AddEvents((int)(Gdk.EventMask.PointerMotionMask));
                display.ModifyBg(Gtk.StateType.Normal, Style.Black);
                display.MotionNotifyEvent += HandleViewMotion;
                display.Show();

                t_item = new ToolItem();
                ComboBox combo = ComboBox.NewText();
                foreach (var transition in display.Transitions)
                {
                    combo.AppendText(transition.Name);
                }
                combo.Active   = 0;
                combo.Changed += HandleTransitionChanged;
                t_item.Child   = combo;
                tbar.Insert(t_item, -1);

                action = new RotateLeftAction(view.Item);
                actions.Add(action);
                tbar.Insert(action.CreateToolItem() as ToolItem, -1);

                action = new RotateRightAction(view.Item);
                actions.Add(action);
                tbar.Insert(action.CreateToolItem() as ToolItem, -1);

                info_button = (ToggleToolButton)((actions [Info]).CreateToolItem() as ToolItem);
                tbar.Insert(info_button, -1);

                tbar.Insert((actions [HideToolbar]).CreateToolItem() as ToolItem, -1);

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

                tbar.ShowAll();

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

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

                hide_cursor_delay = new DelayedOperation(3000, new GLib.IdleHandler(HideCursor));
                hide_cursor_delay.Start();

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

                notebook.CurrentPage = 0;
            } catch (Exception e) {
                Log.Exception(e);
            }
        }
 		public ViewAction (PhotoImageView view,
				   string name,
				   string label,
				   string tooltip,
				   string stock_id) : base (view.Item, name, label, tooltip, stock_id)
		{
			this.view = view;
			view.Destroyed += HandleDestroyed;
		}
示例#28
0
        public bool Execute(Tag t)
        {
            this.CreateDialog("edit_icon_dialog");

            this.Dialog.Title = String.Format(Catalog.GetString("Edit Icon for Tag {0}"), t.Name);

            preview_image.Pixbuf = t.Icon;

            query = new FSpot.PhotoQuery(db.Photos);

            if (db.Tags.Hidden != null)
            {
                query.Terms = FSpot.Query.OrTerm.FromTags(new Tag [] { t, db.Tags.Hidden });
            }
            else
            {
                query.Terms = new FSpot.Query.Literal(t);
            }

            image_view = new FSpot.PhotoImageView(query);
            image_view.SelectionXyRatio  = 1.0;
            image_view.SelectionChanged += HandleSelectionChanged;
            image_view.PhotoChanged     += HandlePhotoChanged;

            photo_scrolled_window.Add(image_view);

            if (query.Photos.Length > 0)
            {
                photo_spin_button.Wrap                     = true;
                photo_spin_button.Adjustment.Lower         = 1.0;
                photo_spin_button.Adjustment.Upper         = (double)query.Photos.Length;
                photo_spin_button.Adjustment.StepIncrement = 1.0;
                photo_spin_button.ValueChanged            += HandleSpinButtonChanged;

                image_view.Item.Index = 0;
            }
            else
            {
                photo_spin_button.Sensitive = false;
                photo_spin_button.Value     = 0.0;
            }


            // FIXME this path choosing method is completely wrong/broken/evil it needs to be
            // based on real data but I want to get this release out.
            string theme_dir = System.IO.Path.Combine(FSpot.Defines.GNOME_ICON_THEME_PREFIX,
                                                      "share/icons/gnome/48x48/emblems");

            if (System.IO.Directory.Exists(theme_dir))
            {
                icon_view = new IconView(new FSpot.DirectoryCollection(theme_dir));
            }
            else if (System.IO.Directory.Exists("/opt/gnome/share/icons/gnome/48x48/emblems"))
            {
                icon_view = new IconView(new FSpot.DirectoryCollection("/opt/gnome/share/icons/gnome/48x48/emblems"));
            }
            else if (System.IO.Directory.Exists("/usr/share/icons/gnome/48x48/emblems"))
            {
                icon_view = new IconView(new FSpot.DirectoryCollection("/usr/share/icons/gnome/48x48/emblems"));
            }
            else             // This will just load an empty collection if the directory doesn't exist.
            {
                icon_view = new IconView(new FSpot.DirectoryCollection("/usr/local/share/icons/gnome/48x48/emblems"));
            }

            icon_scrolled_window.Add(icon_view);
            icon_view.ThumbnailWidth     = 32;
            icon_view.DisplayTags        = false;
            icon_view.DisplayDates       = false;
            icon_view.Selection.Changed += HandleIconViewSelectionChanged;
            icon_view.Show();

            image_view.Show();

            ResponseType response = (ResponseType)this.Dialog.Run();
            bool         success  = false;

            if (response == ResponseType.Ok)
            {
                try {
                    t.Icon = preview_image.Pixbuf;
                    //db.Tags.Commit (t);
                    success = true;
                } catch (Exception ex) {
                    // FIXME error dialog.
                    Console.WriteLine("error {0}", ex);
                }
            }

            this.Dialog.Destroy();
            return(success);
        }
		public bool Execute (Tag t)
		{
			this.CreateDialog ("edit_icon_dialog");

			this.Dialog.Title = String.Format (Catalog.GetString ("Edit Icon for Tag {0}"), t.Name);

			preview_image.Pixbuf = t.Icon;

			query = new FSpot.PhotoQuery (db.Photos);
			
			if (db.Tags.Hidden != null)
				query.Terms = FSpot.Query.OrTerm.FromTags (new Tag []{ t, db.Tags.Hidden });
			else 
				query.Terms = new FSpot.Query.Literal (t);

			image_view = new FSpot.PhotoImageView (query);
			image_view.SelectionXyRatio = 1.0;
			image_view.SelectionChanged += HandleSelectionChanged;
			image_view.PhotoChanged += HandlePhotoChanged;

			photo_scrolled_window.Add (image_view);

			if (query.Photos.Length > 0) {
				photo_spin_button.Wrap = true;
				photo_spin_button.Adjustment.Lower = 1.0;
				photo_spin_button.Adjustment.Upper = (double)query.Photos.Length;
				photo_spin_button.Adjustment.StepIncrement = 1.0;
				photo_spin_button.ValueChanged += HandleSpinButtonChanged;
				
				image_view.Item.Index = 0;
			} else {
				photo_spin_button.Sensitive = false;
				photo_spin_button.Value = 0.0;
			}			
			
			
			// FIXME this path choosing method is completely wrong/broken/evil it needs to be
			// based on real data but I want to get this release out.
			string theme_dir = System.IO.Path.Combine (FSpot.Defines.GNOME_ICON_THEME_PREFIX,
								   "share/icons/gnome/48x48/emblems");
			if (System.IO.Directory.Exists (theme_dir))
				icon_view = new IconView (new FSpot.DirectoryCollection (theme_dir));
			else if (System.IO.Directory.Exists ("/opt/gnome/share/icons/gnome/48x48/emblems"))
				icon_view = new IconView (new FSpot.DirectoryCollection ("/opt/gnome/share/icons/gnome/48x48/emblems"));
			else if (System.IO.Directory.Exists ("/usr/share/icons/gnome/48x48/emblems"))
				icon_view = new IconView (new FSpot.DirectoryCollection ("/usr/share/icons/gnome/48x48/emblems"));
			else // This will just load an empty collection if the directory doesn't exist.
				icon_view = new IconView (new FSpot.DirectoryCollection ("/usr/local/share/icons/gnome/48x48/emblems"));

			icon_scrolled_window.Add (icon_view);
			icon_view.ThumbnailWidth = 32;
			icon_view.DisplayTags = false;
			icon_view.DisplayDates = false;
			icon_view.Selection.Changed += HandleIconViewSelectionChanged;
			icon_view.Show();

			image_view.Show ();

			ResponseType response = (ResponseType) this.Dialog.Run ();
			bool success = false;

			if (response == ResponseType.Ok) {
				try {
					t.Icon = preview_image.Pixbuf;
					//db.Tags.Commit (t);
					success = true;
				} catch (Exception ex) {
					// FIXME error dialog.
					Console.WriteLine ("error {0}", ex);
				}
			}
			
			this.Dialog.Destroy ();
			return success;
		}
示例#30
0
		protected override void SetView (PhotoImageView view)
		{
			base.SetView (view);
			effect = new Widgets.Tilt (info);
		}
示例#31
0
        public bool Execute(Tag t)
        {
            this.CreateDialog("edit_icon_dialog");

            this.Dialog.Title = String.Format(Catalog.GetString("Edit Icon for Tag {0}"), t.Name);

            PreviewPixbuf = t.Icon;

            query = new FSpot.PhotoQuery(db.Photos);

            if (db.Tags.Hidden != null)
            {
                query.Terms = FSpot.OrTerm.FromTags(new Tag [] { t, db.Tags.Hidden });
            }
            else
            {
                query.Terms = new FSpot.Literal(t);
            }

            image_view = new FSpot.PhotoImageView(query);
            image_view.SelectionXyRatio  = 1.0;
            image_view.SelectionChanged += HandleSelectionChanged;
            image_view.PhotoChanged     += HandlePhotoChanged;

            external_photo_chooser = new Gtk.FileChooserButton(Catalog.GetString("Select Photo from file"),
                                                               Gtk.FileChooserAction.Open);

            external_photo_chooser.Filter = new FileFilter();
            external_photo_chooser.Filter.AddPixbufFormats();
            external_photo_chooser.LocalOnly = false;
            external_photo_chooser_hbox.PackStart(external_photo_chooser);

            Dialog.ShowAll();
            external_photo_chooser.SelectionChanged += HandleExternalFileSelectionChanged;

            photo_scrolled_window.Add(image_view);

            if (query.Count > 0)
            {
                photo_spin_button.Wrap                     = true;
                photo_spin_button.Adjustment.Lower         = 1.0;
                photo_spin_button.Adjustment.Upper         = (double)query.Count;
                photo_spin_button.Adjustment.StepIncrement = 1.0;
                photo_spin_button.ValueChanged            += HandleSpinButtonChanged;

                image_view.Item.Index = 0;
            }
            else
            {
                from_photo_label.Markup = String.Format(Catalog.GetString(
                                                            "\n<b>From Photo</b>\n" +
                                                            " You can use one of your library photos as an icon for this tag.\n" +
                                                            " However, first you must have at least one photo associated\n" +
                                                            " with this tag. Please tag a photo as '{0}' and return here\n" +
                                                            " to use it as an icon."), t.Name);
                photo_scrolled_window.Visible = false;
                photo_label.Visible           = false;
                photo_spin_button.Visible     = false;
            }

            icon_store = new ListStore(typeof(string), typeof(Gdk.Pixbuf));

            icon_view = new Gtk.IconView(icon_store);
            icon_view.PixbufColumn      = 1;
            icon_view.SelectionMode     = SelectionMode.Single;
            icon_view.SelectionChanged += HandleIconSelectionChanged;

            icon_scrolled_window.Add(icon_view);

            icon_view.Show();

            image_view.Show();

            FSpot.Delay fill_delay = new FSpot.Delay(FillIconView);
            fill_delay.Start();

            ResponseType response = (ResponseType)this.Dialog.Run();
            bool         success  = false;

            if (response == ResponseType.Ok)
            {
                try {
                    if (IconName != null)
                    {
                        t.ThemeIconName = IconName;
                    }
                    else
                    {
                        t.ThemeIconName = null;
                        t.Icon          = PreviewPixbuf_WithoutProfile;
                    }
                    //db.Tags.Commit (t);
                    success = true;
                } catch (Exception ex) {
                    // FIXME error dialog.
                    Console.WriteLine("error {0}", ex);
                }
            }
            else if (response == (ResponseType)(1))
            {
                t.Icon  = null;
                success = true;
            }

            this.Dialog.Destroy();
            return(success);
        }
	public int ImportFromFile (PhotoStore store, string path)
	{
		this.store = store;
		this.CreateDialog ("import_dialog");
		
		this.Dialog.TransientFor = main_window;
		this.Dialog.WindowPosition = Gtk.WindowPosition.CenterOnParent;
		this.Dialog.Response += HandleDialogResponse;

	        AllowFinish = false;
		
		this.Dialog.DefaultResponse = ResponseType.Ok;
		
		//import_folder_entry.Activated += HandleEntryActivate;
		recurse_check.Toggled += HandleRecurseToggled;
		copy_check.Toggled += HandleRecurseToggled;

		menu = new SourceMenu (this);
		source_option_menu.Menu = menu;

		collection = new FSpot.PhotoList (new Photo [0]);
		tray = new FSpot.ScalingIconView (collection);
		tray.Selection.Changed += HandleTraySelectionChanged;
		icon_scrolled.SetSizeRequest (200, 200);
		icon_scrolled.Add (tray);
		//icon_scrolled.Visible = false;
		tray.DisplayTags = false;
		tray.Show ();

		photo_view = new FSpot.PhotoImageView (collection);
		photo_scrolled.Add (photo_view);
		photo_scrolled.SetSizeRequest (200, 200);
		photo_view.Show ();

		//FSpot.Global.ModifyColors (frame_eventbox);
		FSpot.Global.ModifyColors (photo_scrolled);
		FSpot.Global.ModifyColors (photo_view);

		photo_view.Pixbuf = PixbufUtils.LoadFromAssembly ("f-spot-48.png");
		photo_view.Fit = true;
			
		tag_entry = new FSpot.Widgets.TagEntry (MainWindow.Toplevel.Database.Tags, false);
		tag_entry.UpdateFromTagNames (new string []{});
		tagentry_box.Add (tag_entry);

		tag_entry.Show ();

		this.Dialog.Show ();
		//source_option_menu.Changed += HandleSourceChanged;
		if (path != null) {
			SetImportPath (path);
			int i = menu.FindItemPosition (path);

			if (i > 0) {
				source_option_menu.SetHistory ((uint)i);
			} else if (Directory.Exists (path)) {
				SourceItem path_item = new SourceItem (new VfsSource (path));
				menu.Prepend (path_item);
				path_item.ShowAll ();
				SetImportPath (path);
				source_option_menu.SetHistory (0);
			} 
			idle_start.Start ();
		}
						
		ResponseType response = (ResponseType) this.Dialog.Run ();
		
		while (response == ResponseType.Ok) {
			try {
				if (Directory.Exists (this.ImportPath))
					break;
			} catch (System.Exception e){
				System.Console.WriteLine (e);
				break;
			}

			HigMessageDialog md = new HigMessageDialog (this.Dialog,
			        DialogFlags.DestroyWithParent,
				MessageType.Error,
				ButtonsType.Ok,
				Catalog.GetString ("Directory does not exist."),
				String.Format (Catalog.GetString ("The directory you selected \"{0}\" does not exist.  " + 
								  "Please choose a different directory"), this.ImportPath));

			md.Run ();
			md.Destroy ();

			response = (Gtk.ResponseType) this.Dialog.Run ();
		}

		if (response == ResponseType.Ok) {
			this.UpdateTagStore (tag_entry.GetTypedTagNames ());
			this.Finish ();

			if (tags_selected != null && tags_selected.Count > 0) {
				for (int i = 0; i < collection.Count; i++) {
					Photo p = collection [i] as Photo;
					
					if (p == null)
						continue;
					
					p.AddTag ((Tag [])tags_selected.ToArray(typeof(Tag)));
					store.Commit (p);
				}
			}

			this.Dialog.Destroy ();
			return collection.Count;
		} else {
			this.Cancel ();
			//this.Dialog.Destroy();
			return 0;
		}
	}
    public int ImportFromFile(PhotoStore store, string path)
    {
        this.store = store;
        this.CreateDialog("import_dialog");

        this.Dialog.TransientFor   = main_window;
        this.Dialog.WindowPosition = Gtk.WindowPosition.CenterOnParent;
        this.Dialog.Response      += HandleDialogResponse;

        AllowFinish = false;

        this.Dialog.DefaultResponse = ResponseType.Ok;

        //import_folder_entry.Activated += HandleEntryActivate;
        recurse_check.Toggled += HandleRecurseToggled;
        copy_check.Toggled    += HandleRecurseToggled;

        menu = new SourceMenu(this);
        source_option_menu.Menu = menu;

        collection              = new FSpot.PhotoList(new Photo [0]);
        tray                    = new FSpot.ScalingIconView(collection);
        tray.Selection.Changed += HandleTraySelectionChanged;
        icon_scrolled.SetSizeRequest(200, 200);
        icon_scrolled.Add(tray);
        //icon_scrolled.Visible = false;
        tray.DisplayTags = false;
        tray.Show();

        photo_view = new FSpot.PhotoImageView(collection);
        photo_scrolled.Add(photo_view);
        photo_scrolled.SetSizeRequest(200, 200);
        photo_view.Show();

        //FSpot.Global.ModifyColors (frame_eventbox);
        FSpot.Global.ModifyColors(photo_scrolled);
        FSpot.Global.ModifyColors(photo_view);

        photo_view.Pixbuf = PixbufUtils.LoadFromAssembly("f-spot-48.png");
        photo_view.Fit    = true;

        tag_entry = new FSpot.Widgets.TagEntry(MainWindow.Toplevel.Database.Tags, false);
        tag_entry.UpdateFromTagNames(new string [] {});
        tagentry_box.Add(tag_entry);

        tag_entry.Show();

        this.Dialog.Show();
        //source_option_menu.Changed += HandleSourceChanged;
        if (path != null)
        {
            SetImportPath(path);
            int i = menu.FindItemPosition(path);

            if (i > 0)
            {
                source_option_menu.SetHistory((uint)i);
            }
            else if (Directory.Exists(path))
            {
                SourceItem path_item = new SourceItem(new VfsSource(path));
                menu.Prepend(path_item);
                path_item.ShowAll();
                SetImportPath(path);
                source_option_menu.SetHistory(0);
            }
            idle_start.Start();
        }

        ResponseType response = (ResponseType)this.Dialog.Run();

        while (response == ResponseType.Ok)
        {
            try {
                if (Directory.Exists(this.ImportPath))
                {
                    break;
                }
            } catch (System.Exception e) {
                System.Console.WriteLine(e);
                break;
            }

            HigMessageDialog md = new HigMessageDialog(this.Dialog,
                                                       DialogFlags.DestroyWithParent,
                                                       MessageType.Error,
                                                       ButtonsType.Ok,
                                                       Catalog.GetString("Directory does not exist."),
                                                       String.Format(Catalog.GetString("The directory you selected \"{0}\" does not exist.  " +
                                                                                       "Please choose a different directory"), this.ImportPath));

            md.Run();
            md.Destroy();

            response = (Gtk.ResponseType) this.Dialog.Run();
        }

        if (response == ResponseType.Ok)
        {
            this.UpdateTagStore(tag_entry.GetTypedTagNames());
            this.Finish();

            if (tags_selected != null && tags_selected.Count > 0)
            {
                for (int i = 0; i < collection.Count; i++)
                {
                    Photo p = collection [i] as Photo;

                    if (p == null)
                    {
                        continue;
                    }

                    p.AddTag((Tag [])tags_selected.ToArray(typeof(Tag)));
                    store.Commit(p);
                }
            }

            this.Dialog.Destroy();
            return(collection.Count);
        }
        else
        {
            this.Cancel();
            //this.Dialog.Destroy();
            return(0);
        }
    }