public RotateOperation(IBrowsableItem item, RotateDirection direction) { this.item = item; this.direction = direction; version_index = 0; done = false; }
public PrintOperation (IBrowsableItem [] selected_photos) : base () { this.selected_photos = selected_photos; CustomTabLabel = Catalog.GetString ("Image Settings"); NPages = selected_photos.Length; DefaultPageSetup = FSpot.Global.PageSetup; }
void HandleItemChanged(BrowsablePointer pointer, BrowsablePointerChangedArgs args) { //back_button.Sensitive = (Item.Index > 0 && collection.Count > 0); //forward_button.Sensitive = (Item.Index < collection.Count - 1); if (Item.IsValid) { IBrowsableItem item = Item.Current; name_label.Text = System.Uri.UnescapeDataString(item.Name); old_label.Text = item.Time.ToLocalTime().ToString(); int i = collection.Count > 0 ? Item.Index + 1: 0; // Note for translators: This indicates the current photo is photo {0} of {1} out of photos count_label.Text = System.String.Format(Catalog.GetString("{0} of {1}"), i, collection.Count); DateTime actual = item.Time; date_edit.Time = actual; gnome_dateedit_sucks = date_edit.Time - actual; } HandleTimeChanged(this, System.EventArgs.Empty); if (!tray.Selection.Contains(Item.Index)) { tray.Selection.Clear(); tray.Selection.Add(Item.Index); } photo_spin.Value = Item.Index + 1; }
public BrowsablePointerChangedEventArgs(IBrowsableItem previous_item, int previous_index, IBrowsableItemChanges changes) : base() { this.previous_item = previous_item; this.previous_index = previous_index; this.changes = changes; }
public RotateOperation (IBrowsableItem item, RotateDirection direction) { this.item = item; this.direction = direction; version_index = 0; done = false; }
public int IndexOf(IBrowsableItem photo) { if (photo == null || !(photo is Photo)) { return(-1); } return(store.IndexOf(temp_table, photo as Photo)); }
static public Gdk.Pixbuf Load(IBrowsableItem item) { using (ImageFile img = ImageFile.Create(item.DefaultVersionUri)) { Gdk.Pixbuf pixbuf = img.Load(); ValidateThumbnail(item, pixbuf); return(pixbuf); } }
static public Gdk.Pixbuf LoadAtMaxSize(IBrowsableItem item, int width, int height) { using (ImageFile img = ImageFile.Create(item.DefaultVersionUri)) { Gdk.Pixbuf pixbuf = img.Load(width, height); ValidateThumbnail(item.DefaultVersionUri, pixbuf); return(pixbuf); } }
static public Gdk.Pixbuf Load (IBrowsableItem item) { using (ImageFile img = ImageFile.Create (item.DefaultVersionUri)) { Gdk.Pixbuf pixbuf = img.Load (); ValidateThumbnail (item, pixbuf); return pixbuf; } }
static public Gdk.Pixbuf LoadAtMaxSize (IBrowsableItem item, int width, int height) { using (ImageFile img = ImageFile.Create (item.DefaultVersionUri)) { Gdk.Pixbuf pixbuf = img.Load (width, height); ValidateThumbnail (item.DefaultVersionUri, pixbuf); return pixbuf; } }
public BrowsablePointer(IBrowsableCollection collection, int index) { this.collection = collection; this.Index = index; item = Current; collection.Changed += HandleCollectionChanged; collection.ItemsChanged += HandleCollectionItemsChanged; }
public BrowsablePointer (IBrowsableCollection collection, int index) { this.collection = collection; this.Index = index; item = Current; collection.Changed += HandleCollectionChanged; collection.ItemsChanged += HandleCollectionItemsChanged; }
void HandleSetAsBackgroundCommand(object sender, EventArgs args) { IBrowsableItem current = image_view.Item.Current; if (current == null) { return; } Preferences.SetAsBackground(current.DefaultVersionUri.LocalPath); }
internal void HandleSelectionChanged(IBrowsableCollection collection) { if (collection != null && collection.Count == 1) { Photo = collection [0]; } else { Photo = null; } }
public BrowsablePointer(IBrowsableCollection collection, int index) { if (collection == null) throw new ArgumentNullException ("collection"); this.collection = collection; this.Index = index; item = Current; collection.Changed += HandleCollectionChanged; collection.ItemsChanged += HandleCollectionItemsChanged; }
private bool SlideShow() { IBrowsableItem [] items = new IBrowsableItem [collection.Count]; for (int i = 0; i < collection.Count; i++) { items [i] = collection [i]; } FSpot.FullSlide full = new FSpot.FullSlide(Window, items); full.Play(); this.Window.GdkWindow.Cursor = null; return(false); }
void HandleSetAsBackgroundCommand(object sender, EventArgs args) { #if !NOGCONF IBrowsableItem current = image_view.Item.Current; if (current == null) { return; } GnomeUtil.SetBackgroundImage(current.DefaultVersionUri.LocalPath); #endif }
private void UpdateStatusLabel() { IBrowsableItem item = image_view.Item.Current; System.Text.StringBuilder sb = new System.Text.StringBuilder(); if (filenames_item.Active && item != null) { sb.Append(System.IO.Path.GetFileName(item.DefaultVersionUri.LocalPath) + " - "); } sb.AppendFormat(Catalog.GetPluralString("{0} Photo", "{0} Photos", collection.Count), collection.Count); status_label.Text = sb.ToString(); }
public string Upload(IBrowsableItem photo, IFilter filter, bool is_public, bool is_family, bool is_friend) { if (token == null) { throw new Exception("Must Login First"); } // FIXME flickr needs rotation string error_verbose; using (FilterRequest request = new FilterRequest(photo.DefaultVersionUri)) { try { string tags = null; filter.Convert(request); string path = request.Current.LocalPath; if (ExportTags && photo.Tags != null) { StringBuilder taglist = new StringBuilder(); Tag [] t = photo.Tags; for (int i = 0; i < t.Length; i++) { if (i > 0) { taglist.Append(","); } taglist.Append(String.Format("\"{0}\"", t[i].Name)); } tags = taglist.ToString(); } try { string photoid = flickr.UploadPicture(path, photo.Name, photo.Description, tags, is_public, is_family, is_friend); return(photoid); } catch (FlickrNet.FlickrException ex) { Console.WriteLine("Problems uploading picture: " + ex.ToString()); error_verbose = ex.ToString(); } } catch (Exception e) { // FIXME we need to distinguish between file IO errors and xml errors here throw new System.Exception("Error while uploading", e); } } throw new System.Exception(error_verbose); }
private void SetIndex(int value, IBrowsableItemChanges changes) { BrowsablePointerChangedArgs args; args = new BrowsablePointerChangedArgs(Current, index, changes); index = value; item = Current; if (Changed != null) { Changed(this, args); } }
public void FindMissing() { int i; missing.Clear(); for (i = 0; i < source.Count; i++) { IBrowsableItem item = source [i]; string path = item.DefaultVersionUri.LocalPath; if (!File.Exists(path) || (new FileInfo(path).Length == 0)) { missing.Add(item); } } }
public static void SendUpdate(IBrowsableItem item) { Indexable indexable = new Indexable(item.DefaultVersionUri); indexable.Type = IndexableType.PropertyChange; Beagle.Property prop; // Clear the existing tags prop = Beagle.Property.NewKeyword("fspot:Tag", ""); prop.IsMutable = true; prop.IsPersistent = true; indexable.AddProperty(prop); prop = Beagle.Property.NewKeyword("image:Tag", ""); prop.IsMutable = true; prop.IsPersistent = true; indexable.AddProperty(prop); foreach (Tag t in item.Tags) { prop = Beagle.Property.NewKeyword("fspot:Tag", t.Name); prop.IsMutable = true; prop.IsPersistent = true; indexable.AddProperty(prop); prop = Beagle.Property.NewKeyword("image:Tag", t.Name); prop.IsMutable = true; prop.IsPersistent = true; indexable.AddProperty(prop); } prop = Beagle.Property.New("fspot:Description", item.Description); prop.IsMutable = true; prop.IsPersistent = true; indexable.AddProperty(prop); // Create a message to send to the daemon with this information. // The source tells it what index the existing "/home/joe/test.txt" document lives. IndexingServiceRequest req = new IndexingServiceRequest(); req.Keepalive = false; req.Source = "Files"; req.Add(indexable); req.SendAsync(); }
private void HandleThumbnailIconViewButtonPressEvent(object sender, Gtk.ButtonPressEventArgs args) { int old_item = current_item; current_item = thumbnail_iconview.CellAtPosition((int)args.Event.X, (int)args.Event.Y, false); if (current_item < 0 || current_item >= items.Length) { current_item = old_item; return; } captions [old_item] = caption_textview.Buffer.Text; string caption = captions [current_item]; if (caption == null) { captions [current_item] = caption = ""; } caption_textview.Buffer.Text = caption; tag_treeview.Model = new TagStore(account.Facebook, tags [current_item], friends); IBrowsableItem item = items [current_item]; string thumbnail_path = ThumbnailGenerator.ThumbnailPath(item.DefaultVersionUri); if (tag_image_eventbox.Children.Length > 0) { tag_image_eventbox.Remove(tag_image); tag_image.Destroy(); } using (ImageFile image = new ImageFile(thumbnail_path)) { Gdk.Pixbuf data = image.Load(); data = PixbufUtils.ScaleToMaxSize(data, 400, 400); tag_image_height = data.Height; tag_image_width = data.Width; tag_image = new Gtk.Image(data); tag_image_eventbox.Add(tag_image); tag_image_eventbox.ShowAll(); } }
public static void SendUpdate (IBrowsableItem item) { Indexable indexable = new Indexable (item.DefaultVersionUri); indexable.Type = IndexableType.PropertyChange; Beagle.Property prop; // Clear the existing tags prop = Beagle.Property.NewKeyword ("fspot:Tag", ""); prop.IsMutable = true; prop.IsPersistent = true; indexable.AddProperty (prop); prop = Beagle.Property.NewKeyword ("image:Tag", ""); prop.IsMutable = true; prop.IsPersistent = true; indexable.AddProperty (prop); foreach (Tag t in item.Tags) { prop = Beagle.Property.NewKeyword ("fspot:Tag", t.Name); prop.IsMutable = true; prop.IsPersistent = true; indexable.AddProperty (prop); prop = Beagle.Property.NewKeyword ("image:Tag", t.Name); prop.IsMutable = true; prop.IsPersistent = true; indexable.AddProperty (prop); } prop = Beagle.Property.New ("fspot:Description", item.Description); prop.IsMutable = true; prop.IsPersistent = true; indexable.AddProperty (prop); // Create a message to send to the daemon with this information. // The source tells it what index the existing "/home/joe/test.txt" document lives. IndexingServiceRequest req = new IndexingServiceRequest (); req.Keepalive = false; req.Source = "Files"; req.Add (indexable); req.SendAsync (); }
public FullSlide (Gtk.Window parent, IBrowsableItem [] items) : base ("Slideshow") { screenshot = PixbufUtils.LoadFromScreen (parent.GdkWindow); this.Destroyed += HandleDestroyed; this.TransientFor = parent; this.ButtonPressEvent += HandleSlideViewButtonPressEvent; this.KeyPressEvent += HandleSlideViewKeyPressEvent; this.AddEvents ((int) (EventMask.ButtonPressMask | EventMask.KeyPressMask | EventMask.PointerMotionMask)); slideview = new SlideView (screenshot, items); this.Add (slideview); this.Decorated = false; this.Fullscreen(); this.Realize (); busy = new Gdk.Cursor (Gdk.CursorType.Watch); this.GdkWindow.Cursor = busy; none = Empty (); hide = new Delay (2000, new GLib.IdleHandler (HideCursor)); }
private Pixbuf GetScaled(IBrowsableItem photo) { Pixbuf orig; try { orig = FSpot.PhotoLoader.LoadAtMaxSize(photo, Allocation.Width, Allocation.Height); } catch { orig = null; } if (orig == null) { return(null); } Pixbuf result = GetScaled(orig); if (orig != result) { orig.Dispose(); } return(result); }
public void Add (IBrowsableItem photo) { list.Add (photo); Reload (); }
public int IndexOf (IBrowsableItem item) { switch (win.view_mode) { case ModeType.PhotoView: return item == win.photo_view.Item.Current ? 0 : -1; case ModeType.IconView: return win.icon_view.Selection.IndexOf (item); } return -1; }
static public Gdk.Pixbuf ValidateThumbnail(IBrowsableItem item, Gdk.Pixbuf pixbuf) { return(ValidateThumbnail(item.DefaultVersionUri, pixbuf)); }
private void SetIndex(int value, IBrowsableItemChanges changes) { BrowsablePointerChangedEventArgs args = new BrowsablePointerChangedEventArgs (Current, index, changes); index = value; item = Current; if (Changed != null) Changed (this, args); }
private void Remove (IBrowsableItem item, bool notify) { if (item == null) return; int parent_index = (int) selected_cells [item]; selected_cells.Remove (item); if (notify) SignalChange (new int [] {parent_index}); }
public int IndexOf (IBrowsableItem item) { if (!this.Contains (item)) return -1; int parent_index = (int) selected_cells [item]; return System.Array.IndexOf (Ids, parent_index); }
public void Add (IBrowsableItem item) { if (this.Contains (item)) return; int index = parent.IndexOf (item); this.Add (index); }
public RotateMultiple(IBrowsableItem [] items, RotateDirection direction) { this.direction = direction; this.items = items; index = 0; }
public bool Execute(RotateDirection direction, IBrowsableItem [] items) { ProgressDialog progress_dialog = null; if (items.Length > 1) progress_dialog = new ProgressDialog (Catalog.GetString ("Rotating photos"), ProgressDialog.CancelButtonType.Stop, items.Length, parent_window); RotateMultiple op = new RotateMultiple (items, direction); int readonly_count = 0; bool done = false; int index = 0; while (!done) { if (progress_dialog != null && op.Index != -1 && index < items.Length) if (progress_dialog.Update (String.Format (Catalog.GetString ("Rotating photo \"{0}\""), op.Items [op.Index].Name))) break; try { done = !op.Step (); } catch (RotateException re) { if (!re.ReadOnly) RunGenericError (re, re.Path, re.Message); else readonly_count++; } catch (GLib.GException) { readonly_count++; } catch (DirectoryNotFoundException e) { RunGenericError (e, op.Items [op.Index].DefaultVersionUri.LocalPath, Catalog.GetString ("Directory not found")); } catch (FileNotFoundException e) { RunGenericError (e, op.Items [op.Index].DefaultVersionUri.LocalPath, Catalog.GetString ("File not found")); } catch (Exception e) { RunGenericError (e, op.Items [op.Index].DefaultVersionUri.LocalPath); } index ++; } if (progress_dialog != null) progress_dialog.Destroy (); if (readonly_count > 0) RunReadonlyError (readonly_count); return true; }
public bool Contains (IBrowsableItem item) { return IndexOf (item) >= 0; }
public int IndexOf(IBrowsableItem item) { return(list.IndexOf(item)); }
private bool SlideShow () { IBrowsableItem [] items = new IBrowsableItem [collection.Count]; for (int i = 0; i < collection.Count; i++) { items [i] = collection [i]; } FSpot.FullSlide full = new FSpot.FullSlide (Window, items); full.Play (); this.Window.GdkWindow.Cursor = null; return false; }
public PhotoList (IBrowsableItem [] photos) { list = new List<IBrowsableItem> (photos); }
public SlideView (Pixbuf background, IBrowsableItem [] photos) : base () { this.photos = photos; if (background != null) { this.Pixbuf = background; background.Dispose (); current_idx = -1; black = true; flip_interval = 1500; } SizeAllocated += new SizeAllocatedHandler (HandleSizeAllocate); Destroyed += new EventHandler (HandleDestroyed); }
private Pixbuf GetScaled (IBrowsableItem photo) { Pixbuf orig; try { orig = FSpot.PhotoLoader.LoadAtMaxSize (photo, Allocation.Width, Allocation.Height); } catch { orig = null; } if (orig == null) return null; Pixbuf result = GetScaled (orig); if (orig != result) orig.Dispose (); return result; }
private void Upload() { progress_item = new ProgressItem(); progress_item.Changed += HandleProgressChanged; fr.Connection.OnUploadProgress += HandleFlickrProgress; System.Collections.ArrayList ids = new System.Collections.ArrayList(); for (int index = 0; index < selection.Items.Length; index++) { try { IBrowsableItem photo = selection.Items [index]; progress_dialog.Message = System.String.Format( Catalog.GetString("Uploading picture \"{0}\""), photo.Name); progress_dialog.Fraction = photo_index / (double)selection.Count; photo_index++; progress_dialog.ProgressText = System.String.Format( Catalog.GetString("{0} of {1}"), photo_index, selection.Count); info = new FileInfo(photo.DefaultVersionUri.LocalPath); FilterSet stack = new Filters.FilterSet(); if (scale) { stack.Add(new ResizeFilter((uint)size)); } string id = fr.Upload(photo, stack, is_public, is_family, is_friend); ids.Add(id); if (Core.Database != null && photo is Photo) { Core.Database.Exports.Create((photo as Photo).Id, (photo as Photo).DefaultVersionId, ExportStore.FlickrExportType, auth.User.UserId + ":" + auth.User.Username + ":" + current_service.Name + ":" + id); } progress_dialog.Message = Catalog.GetString("Done Sending Photos"); progress_dialog.Fraction = 1.0; progress_dialog.ProgressText = Catalog.GetString("Upload Complete"); progress_dialog.ButtonLabel = Gtk.Stock.Ok; } catch (System.Exception e) { progress_dialog.Message = String.Format(Catalog.GetString("Error Uploading To {0}: {1}"), current_service.Name, e.Message); progress_dialog.ProgressText = Catalog.GetString("Error"); System.Console.WriteLine(e); if (progress_dialog.PerformRetrySkip()) { index--; } } } if (open && ids.Count != 0) { string view_url = string.Format("http://www.{0}/tools/uploader_edit.gne?ids", current_service.Name); bool first = true; foreach (string id in ids) { view_url = view_url + (first ? "=" : ",") + id; first = false; } GnomeUtil.UrlShow(progress_dialog, view_url); } }
public bool Contains (IBrowsableItem item) { return selected_cells.ContainsKey (item); }
public BrowsablePointerChangedArgs(IBrowsableItem previous_item, int previous_index, IBrowsableItemChanges changes) { this.previous_item = previous_item; this.previous_index = previous_index; this.changes = changes; }
public void Remove (IBrowsableItem item) { Remove (item, true); }
public int IndexOf (IBrowsableItem photo) { return System.Array.IndexOf (photos, photo); }
public bool Contains (IBrowsableItem item) { switch (win.view_mode) { case ModeType.PhotoView: return item == win.photo_view.Item.Current ? true : false; case ModeType.IconView: return win.icon_view.Selection.Contains (item); } return false; }
static public Gdk.Pixbuf ValidateThumbnail (IBrowsableItem item, Gdk.Pixbuf pixbuf) { return ValidateThumbnail (item.DefaultVersionUri, pixbuf); }
public EditExceptionDialog(Gtk.Window parent, Exception e, IBrowsableItem item) : this(parent, new EditException(item, e)) { }
public bool Contains (IBrowsableItem item) { return list.Contains (item); }
static public Gdk.Pixbuf Load(IBrowsableCollection collection, int index) { IBrowsableItem item = collection [index]; return(Load(item)); }
public bool Contains(IBrowsableItem item) { return(IndexOf(item) >= 0); }
private void Upload() { album.UploadProgress += HandleUploadProgress; sent_bytes = 0; approx_size = 0; System.Console.WriteLine("Starting Upload to Picasa"); FilterSet filters = new FilterSet(); filters.Add(new JpegFilter()); if (scale) { filters.Add(new ResizeFilter((uint)size)); } if (rotate) { filters.Add(new OrientationFilter()); } while (photo_index < items.Length) { try { IBrowsableItem item = items[photo_index]; FileInfo file_info; Console.WriteLine("uploading {0}", photo_index); progress_dialog.Message = String.Format(Catalog.GetString("Uploading picture \"{0}\" ({1} of {2})"), item.Name, photo_index + 1, items.Length); photo_index++; FilterRequest request = new FilterRequest(item.DefaultVersionUri); filters.Convert(request); file_info = new FileInfo(request.Current.LocalPath); if (approx_size == 0) //first image { approx_size = file_info.Length * items.Length; } else { approx_size = sent_bytes * items.Length / (photo_index - 1); } PicasaPicture picture = album.UploadPicture(request.Current.LocalPath, Path.ChangeExtension(item.Name, "jpg"), item.Description); if (Core.Database != null && item is Photo) { Core.Database.Exports.Create((item as Photo).Id, (item as Photo).DefaultVersionId, ExportStore.PicasaExportType, picture.Link); } sent_bytes += file_info.Length; request.Dispose(); //tagging if (item.Tags != null) { foreach (Tag tag in item.Tags) { picture.AddTag(tag.Name); } } } catch (System.Exception e) { progress_dialog.Message = String.Format(Catalog.GetString("Error Uploading To Gallery: {0}"), e.Message); progress_dialog.ProgressText = Catalog.GetString("Error"); System.Console.WriteLine(e); if (progress_dialog.PerformRetrySkip()) { photo_index--; } } } progress_dialog.Message = Catalog.GetString("Done Sending Photos"); progress_dialog.Fraction = 1.0; progress_dialog.ProgressText = Catalog.GetString("Upload Complete"); progress_dialog.ButtonLabel = Gtk.Stock.Ok; if (browser) { GnomeUtil.UrlShow(null, album.Link); } }
public void Add (IBrowsableItem [] items) { list.AddRange (items); Reload (); }
public EditException(IBrowsableItem item, Exception e) : base( String.Format(Catalog.GetString("Received exception \"{0}\". Unable to save photo {1}"), e.Message, item.Name), e) { this.item = item; }
private void Upload() { sent_bytes = 0; approx_size = 0; System.Uri album_uri = null; System.Console.WriteLine("Starting Upload to Smugmug, album {0} - {1}", album.Title, album.AlbumID); FilterSet filters = new FilterSet(); filters.Add(new JpegFilter()); if (scale) { filters.Add(new ResizeFilter((uint)size)); } if (rotate) { filters.Add(new OrientationFilter()); } while (photo_index < items.Length) { try { IBrowsableItem item = items[photo_index]; FileInfo file_info; Console.WriteLine("uploading {0}", photo_index); progress_dialog.Message = String.Format(Catalog.GetString("Uploading picture \"{0}\" ({1} of {2})"), item.Name, photo_index + 1, items.Length); progress_dialog.ProgressText = string.Empty; progress_dialog.Fraction = ((photo_index) / (double)items.Length); photo_index++; FilterRequest request = new FilterRequest(item.DefaultVersionUri); filters.Convert(request); file_info = new FileInfo(request.Current.LocalPath); if (approx_size == 0) //first image { approx_size = file_info.Length * items.Length; } else { approx_size = sent_bytes * items.Length / (photo_index - 1); } int image_id = account.SmugMug.Upload(request.Current.LocalPath, album.AlbumID); if (Core.Database != null) { Core.Database.Exports.Create((item as Photo).Id, (item as Photo).DefaultVersionId, ExportStore.SmugMugExportType, account.SmugMug.GetAlbumUrl(image_id).ToString()); } sent_bytes += file_info.Length; if (album_uri == null) { album_uri = account.SmugMug.GetAlbumUrl(image_id); } } catch (System.Exception e) { progress_dialog.Message = String.Format(Mono.Unix.Catalog.GetString("Error Uploading To Gallery: {0}"), e.Message); progress_dialog.ProgressText = Mono.Unix.Catalog.GetString("Error"); System.Console.WriteLine(e); if (progress_dialog.PerformRetrySkip()) { photo_index--; } } } progress_dialog.Message = Catalog.GetString("Done Sending Photos"); progress_dialog.Fraction = 1.0; progress_dialog.ProgressText = Mono.Unix.Catalog.GetString("Upload Complete"); progress_dialog.ButtonLabel = Gtk.Stock.Ok; if (browser && album_uri != null) { GnomeUtil.UrlShow(null, album_uri.ToString()); } }
public void Add(IBrowsableItem photo) { list.Add(photo); Reload(); }
public int IndexOf (IBrowsableItem item) { return list.IndexOf (item); }
public bool Contains(IBrowsableItem item) { return(list.Contains(item)); }
public int IndexOf(IBrowsableItem item) { return(System.Array.IndexOf(photos, item)); }