示例#1
0
        internal FSpotUploadProgress(
				Picture [] pictures,
				ThreadProgressDialog progress_dialog)
            : base(pictures)
        {
            this.progress_dialog = progress_dialog;
        }
示例#2
0
    public static Pixbuf Blur(Pixbuf src, int radius, ThreadProgressDialog dialog)
    {
        ImageSurface sourceSurface = Hyena.Gui.PixbufImageSurface.Create (src);
        ImageSurface destinationSurface = new ImageSurface (Cairo.Format.Rgb24, src.Width, src.Height);

        // If we do it as a bunch of single lines (rectangles of one pixel) then we can give the progress
        // here instead of going deeper to provide the feedback
        for (int i=0; i < src.Height; i++) {
            GaussianBlurEffect.RenderBlurEffect (sourceSurface, destinationSurface, new[] { new Gdk.Rectangle (0, i, src.Width, 1) }, radius);

            if (dialog != null) {
                // This only half of the entire process
                double fraction = ((double)i / (double)(src.Height - 1)) * 0.75;
                dialog.Fraction = fraction;
            }
        }

        return destinationSurface.ToPixbuf ();
    }
示例#3
0
        public void Run(IBrowsableCollection selection)
        {
            this.selection = selection;
            dialog = new CDExportDialog (selection, dest);

            if (dialog.Run () != (int)ResponseType.Ok) {
                dialog.Destroy ();
                return;
            }

            clean = dialog.RemovePreviousPhotos;

            command_thread = new System.Threading.Thread (new System.Threading.ThreadStart (Transfer));
            command_thread.Name = Catalog.GetString ("Transferring Pictures");

            progress_dialog = new ThreadProgressDialog (command_thread, selection.Count);
            progress_dialog.Start ();

            dialog.Destroy ();
        }
示例#4
0
        private void HandleResponse(object sender,
		                             Gtk.ResponseArgs args)
        {
            main_dialog.Destroy ();

            if (Gtk.ResponseType.Ok != args.ResponseId) {
                Log.Information ("Tabblo export was canceled.");
                return;
            }

            model.Serialize ();

            Log.Information ("Starting Tabblo export");

            Thread upload_thread =
                    new Thread (new ThreadStart (Upload));
            progress_dialog = new ThreadProgressDialog (
                    upload_thread, model.Photos.Length);
            progress_dialog.Start ();
        }
示例#5
0
        private void HandleResponse(object sender, Gtk.ResponseArgs args)
        {
            if (args.ResponseId != Gtk.ResponseType.Ok) {
                export_dialog.Destroy ();
                return;
            }

            if (scale_check != null) {
                scale = scale_check.Active;
                size = size_spin.ValueAsInt;
            } else
                scale = false;

            browser = browser_check.Active;
            meta = meta_check.Active;

            if (account != null) {
                //System.Console.WriteLine ("history = {0}", album_optionmenu.History);
                album = account.Gallery.Albums [Math.Max (0, album_optionmenu.Active)];
                photo_index = 0;

                export_dialog.Destroy ();

                command_thread = new System.Threading.Thread (new System.Threading.ThreadStart (this.Upload));
                command_thread.Name = Catalog.GetString ("Uploading Pictures");

                progress_dialog = new ThreadProgressDialog (command_thread, items.Length);
                progress_dialog.Start ();

                // Save these settings for next time
                Preferences.Set (SCALE_KEY, scale);
                Preferences.Set (SIZE_KEY, size);
                Preferences.Set (BROWSER_KEY, browser);
                Preferences.Set (META_KEY, meta);
            }
        }
示例#6
0
	unsafe public static Pixbuf UnsharpMask (Pixbuf src,
                                             double radius,
                                             double amount,
                                             double threshold,
                                             ThreadProgressDialog progressDialog)
	{
		// Make sure the pixbuf has an alpha channel before we try to blur it
		src = src.AddAlpha (false, 0, 0, 0);

		Pixbuf result = Blur (src, (int)radius, progressDialog);

		int sourceRowstride = src.Rowstride;
		int sourceHeight = src.Height;
		int sourceChannels = src.NChannels;
		int sourceWidth = src.Width;

		int resultRowstride = result.Rowstride;
		int resultWidth = result.Width;
		int resultChannels = result.NChannels;

		byte[] srcRow = new byte[sourceRowstride];
		byte[] destRow = new byte[resultRowstride];

		byte* sourcePixels = (byte*)src.Pixels;
		byte* resultPixels = (byte*)result.Pixels;

		for (int row=0; row < sourceHeight; row++) {
			Pixbuf_GetRow (sourcePixels, row, sourceRowstride, sourceWidth, sourceChannels, srcRow);
			Pixbuf_GetRow (resultPixels, row, resultRowstride, resultWidth, resultChannels, destRow);

			int diff;
			for (int i=0; i < sourceWidth*sourceChannels; i++) {
				diff = srcRow [i] - destRow [i];
				if (Math.Abs (2 * diff) < threshold)
					diff = 0;

				int val = (int)(srcRow [i] + amount * diff);

				if (val > 255)
					val = 255;
				else if (val < 0)
					val = 0;

				destRow [i] = (byte)val;
			}

			Pixbuf_SetRow (resultPixels, destRow, row, resultRowstride, resultWidth, resultChannels);

			// This is the other half of the progress so start and halfway
			if (progressDialog != null)
				progressDialog.Fraction = ((double)row / ((double) sourceHeight - 1) ) * 0.25 + 0.75;
		}

		return result;
	}
示例#7
0
        public void Run(IBrowsableCollection selection)
        {
            dialog = new FacebookExportDialog (selection);

            if (selection.Items.Length > max_photos_per_album) {
                HigMessageDialog mbox = new HigMessageDialog (dialog,
                        Gtk.DialogFlags.DestroyWithParent | Gtk.DialogFlags.Modal, Gtk.MessageType.Error,
                        Gtk.ButtonsType.Ok, Catalog.GetString ("Too many images to export"),
                        String.Format (Catalog.GetString ("Facebook only permits {0} photographs per album.  Please refine your selection and try again."), max_photos_per_album));
                mbox.Run ();
                mbox.Destroy ();
                return;
            }

            if (dialog.Run () != (int)ResponseType.Ok) {
                dialog.Destroy ();
                return;
            }

            if (dialog.CreateAlbum) {
                string name = dialog.AlbumName;
                if (String.IsNullOrEmpty (name)) {
                    HigMessageDialog mbox = new HigMessageDialog (dialog, Gtk.DialogFlags.DestroyWithParent | Gtk.DialogFlags.Modal,
                            Gtk.MessageType.Error, Gtk.ButtonsType.Ok, Catalog.GetString ("Album must have a name"),
                            Catalog.GetString ("Please name your album or choose an existing album."));
                    mbox.Run ();
                    mbox.Destroy ();
                    return;
                }

                string description = dialog.AlbumDescription;
                string location = dialog.AlbumLocation;

                try {
                    album = dialog.Account.Facebook.CreateAlbum (name, description, location);
                }
                catch (FacebookException fe) {
                    HigMessageDialog mbox = new HigMessageDialog (dialog, Gtk.DialogFlags.DestroyWithParent | Gtk.DialogFlags.Modal,
                            Gtk.MessageType.Error, Gtk.ButtonsType.Ok, Catalog.GetString ("Creating a new album failed"),
                            String.Format (Catalog.GetString ("An error occurred creating a new album.\n\n{0}"), fe.Message));
                    mbox.Run ();
                    mbox.Destroy ();
                    return;
                }
            } else {
                album = dialog.ActiveAlbum;
            }

            if (dialog.Account != null) {
                dialog.Hide ();

                command_thread = new System.Threading.Thread (new System.Threading.ThreadStart (Upload));
                command_thread.Name = Mono.Unix.Catalog.GetString ("Uploading Pictures");

                progress_dialog = new ThreadProgressDialog (command_thread, selection.Items.Length);
                progress_dialog.Start ();
            }

            dialog.Destroy ();
        }
示例#8
0
        void HandleResponse(object sender, Gtk.ResponseArgs args)
        {
            if (args.ResponseId != Gtk.ResponseType.Ok) {
                if (command_thread != null && command_thread.IsAlive)
                    command_thread.Abort ();

                Dialog.Destroy ();
                return;
            }

            if (fr.CheckLogin() == null) {
                do_export_flickr.Sensitive = false;
                var md =
                    new HigMessageDialog (Dialog,
                                  Gtk.DialogFlags.Modal |
                                  Gtk.DialogFlags.DestroyWithParent,
                                  Gtk.MessageType.Error, Gtk.ButtonsType.Ok,
                                  Catalog.GetString ("Unable to log on."),
                                  string.Format (Catalog.GetString ("F-Spot was unable to log on to {0}.  Make sure you have given the authentication using {0} web browser interface."),
                                         current_service.Name));
                md.Run ();
                md.Destroy ();
                return;
            }

            fr.ExportTags = tag_check.Active;
            fr.ExportTagHierarchy = hierarchy_check.Active;
            fr.ExportIgnoreTopLevel = ignore_top_level_check.Active;
            open = open_check.Active;
            scale = scale_check.Active;
            is_public = public_radio.Active;
            is_family = family_check.Active;
            is_friend = friend_check.Active;
            if (scale)
                size = size_spin.ValueAsInt;

            command_thread = new Thread (new ThreadStart (Upload));
            command_thread.Name = Catalog.GetString ("Uploading Pictures");

            Dialog.Destroy ();
            progress_dialog = new ThreadProgressDialog (command_thread, selection.Count);
            progress_dialog.Start ();

            // Save these settings for next time
            Preferences.Set (SCALE_KEY, scale);
            Preferences.Set (SIZE_KEY, size);
            Preferences.Set (BROWSER_KEY, open);
            Preferences.Set (TAGS_KEY, tag_check.Active);
            Preferences.Set (PUBLIC_KEY, public_radio.Active);
            Preferences.Set (FAMILY_KEY, family_check.Active);
            Preferences.Set (FRIENDS_KEY, friend_check.Active);
            Preferences.Set (TAG_HIERARCHY_KEY, hierarchy_check.Active);
            Preferences.Set (IGNORE_TOP_LEVEL_KEY, ignore_top_level_check.Active);
            Preferences.Set (current_service.PreferencePath, fr.Token);
        }
示例#9
0
        private void HandleOkClicked(object sender, EventArgs args)
        {
            this.Hide ();
            dialog.Hide ();

            System.Threading.Thread command_thread = new System.Threading.Thread (new System.Threading.ThreadStart (doSharpening));
            command_thread.Name = "Sharpening";

            progressDialog = new ThreadProgressDialog (command_thread, 1);
            progressDialog.Start ();
        }
示例#10
0
文件: Phomo.cs 项目: petergtz/phomo
		void on_dialog_response (object obj, ResponseArgs args) {
			if (args.ResponseId == ResponseType.Ok) {
				config = save_controls();
				System.Threading.Thread command_thread = new System.Threading.Thread (createMosaics);
				command_thread.Name = Catalog.GetString ("Creating Photomosaic");
				progress_dialog = new FSpot.UI.Dialog.ThreadProgressDialog (command_thread, 1);
				progress_dialog.Response += HandleProgressAbort;
				progress_dialog.Start ();
			}
			dialog.Destroy ();
		}