public AsyncPixbufLoader ()
		{
			delay = new Delay (0, new GLib.IdleHandler (AsyncRead));
			ap = new System.EventHandler (HandleAreaPrepared);
			au = new Gdk.AreaUpdatedHandler (HandleAreaUpdated);
			ev = new System.EventHandler (HandleClosed);
		}
 public ImportCommand(Gtk.Window mw)
 {
     main_window    = mw;
     step           = new FSpot.Delay(new GLib.IdleHandler(Step));
     idle_start     = new FSpot.Delay(new IdleHandler(Start));
     loading_string = Catalog.GetString("Loading {0} of {1}");
 }
예제 #3
0
		public void HandleExposeEvent (object sender, ExposeEventArgs args)
		{
			if (fade_delay == null) {
				fade_delay = new Delay (50, new GLib.IdleHandler (Update));
					start = DateTime.Now;
					fade_delay.Start ();
			}
		}
예제 #4
0
 public ImageDisplay(BrowsablePointer item)
 {
     this.item = item;
     CanFocus = true;
     current = new ImageInfo (item.Current.DefaultVersionUri);
     if (item.Collection.Count > item.Index + 1) {
         next = new ImageInfo (item.Collection [item.Index + 1].DefaultVersionUri);
     }
     delay = new Delay (30, new GLib.IdleHandler (DrawFrame));
 }
예제 #5
0
        public GroupSelector()
            : base()
        {
            SetFlag (WidgetFlags.NoWindow);

            background = Rectangle.Zero;
            glass = new Glass (this);
            min_limit = new Limit (this, Limit.LimitType.Min);
            max_limit = new Limit (this, Limit.LimitType.Max);

            left = new Gtk.Button ();
            //left.Add (new Gtk.Image (Gtk.Stock.GoBack, Gtk.IconSize.Button));
            left.Add (new Gtk.Arrow (Gtk.ArrowType.Left, Gtk.ShadowType.None));
            left.Relief = Gtk.ReliefStyle.None;
            //left.Clicked += HandleScrollLeft;
            left.Pressed += HandleLeftPressed;
            left.ButtonReleaseEvent += HandleScrollReleaseEvent;
            left_delay = new Delay (50, new GLib.IdleHandler (HandleScrollLeft));

            right = new Gtk.Button ();
            //right.Add (new Gtk.Image (Gtk.Stock.GoForward, Gtk.IconSize.Button));
            right.Add (new Gtk.Arrow (Gtk.ArrowType.Right, Gtk.ShadowType.None));
            right.Relief = Gtk.ReliefStyle.None;
            right.Pressed += HandleRightPressed;
            right.ButtonReleaseEvent += HandleScrollReleaseEvent;
            right_delay = new Delay (50, new GLib.IdleHandler (HandleScrollRight));
            //right.Clicked += HandleScrollRight;

            this.Put (left, 0, 0);
            this.Put (right, 100, 0);
            left.Show ();
            right.Show ();

            CanFocus = true;

            Mode = RangeType.Min;
            UpdateButtons ();
        }
예제 #6
0
        public ControlOverlay(Gtk.Widget host)
            : base(WindowType.Popup)
        {
            this.host = host;
            Decorated = false;
            DestroyWithParent = true;
            Name = "FullscreenContainer";
            AllowGrow = true;
            //AllowShrink = true;
            KeepAbove = true;

            host_toplevel = (Gtk.Window) host.Toplevel;

            TransientFor = host_toplevel;

            host_toplevel.ConfigureEvent += HandleHostConfigure;
            host_toplevel.SizeAllocated += HandleHostSizeAllocated;

            AddEvents ((int) (Gdk.EventMask.PointerMotionMask));
            hide = new Delay (2000, HideControls);
            fade = new Delay (40, FadeToTarget);
            dismiss = new Delay (2000, delegate { /* do nothing */ return false; });
        }
예제 #7
0
		protected virtual void BuildUI ()
		{
			SetFancyStyle (this);
			
			TransientFor = (Gtk.Window) view.Toplevel;
			SkipPagerHint = true;
			SkipTaskbarHint = true;
			
			//view.MotionNotifyEvent += HandleImageViewMotion;
			view.Item.Changed += HandleItemChanged;
			view.ZoomChanged += HandleViewZoomChanged;

			SetSamplePoint (Gdk.Point.Zero);

			AddEvents ((int) (Gdk.EventMask.PointerMotionMask
					  | Gdk.EventMask.ButtonPressMask
					  | Gdk.EventMask.ButtonReleaseMask));

			ButtonPressEvent += HandleButtonPressEvent;
			ButtonReleaseEvent += HandleButtonReleaseEvent;
			MotionNotifyEvent += HandleMotionNotifyEvent;

			KeyPressEvent += HandleKeyPressEvent;

			drag = new Delay (20, new GLib.IdleHandler (DragUpdate));
		}
		private void AttachInterface ()
		{
			view.PhotoChanged += HandlePhotoChanged;
			hist = new FSpot.Histogram ();
#if USE_THREAD
			expose_timeout = new FSpot.Delay (new GLib.IdleHandler (this.QueueDraw));
#endif
			this.Dialog.Destroyed += HandleDestroyed;

#if true
			Gdk.Color c = this.Dialog.Style.Backgrounds [(int)Gtk.StateType.Active];
			hist.Color [0] = (byte) (c.Red / 0xff);
			hist.Color [1] = (byte) (c.Green / 0xff);
			hist.Color [2] = (byte) (c.Blue / 0xff);
			hist.Color [3] = 0xff;
#endif

			histogram_image.Pixbuf = hist.GeneratePixbuf ();

			exposure_spinbutton.Adjustment = exposure_scale.Adjustment;
			temp_spinbutton.Adjustment = temp_scale.Adjustment;
			temptint_spinbutton.Adjustment = temptint_scale.Adjustment;
			brightness_spinbutton.Adjustment = brightness_scale.Adjustment;
			contrast_spinbutton.Adjustment = contrast_scale.Adjustment;
			hue_spinbutton.Adjustment = hue_scale.Adjustment;
			sat_spinbutton.Adjustment = sat_scale.Adjustment;
			
			temp_spinbutton.Adjustment.ChangeValue ();
			temptint_spinbutton.Adjustment.ChangeValue ();
			brightness_spinbutton.Adjustment.ChangeValue ();
			contrast_spinbutton.Adjustment.ChangeValue ();
			hue_spinbutton.Adjustment.ChangeValue ();
			sat_spinbutton.Adjustment.ChangeValue ();
			hue_spinbutton.Adjustment.ChangeValue ();
			sat_spinbutton.Adjustment.ChangeValue ();
			
			exposure_scale.ValueChanged += RangeChanged;
			temp_scale.ValueChanged += RangeChanged;
			temptint_scale.ValueChanged += RangeChanged;
			brightness_scale.ValueChanged += RangeChanged;
			contrast_scale.ValueChanged += RangeChanged;
			hue_scale.ValueChanged += RangeChanged;
			sat_scale.ValueChanged += RangeChanged;

			HandlePhotoChanged (view);
		}
예제 #9
0
 public Manipulator(GroupSelector selector)
 {
     this.selector = selector;
     timer = new Delay (50, new GLib.IdleHandler (DragTimeout));
 }
예제 #10
0
        public FullScreenView(IBrowsableCollection collection, Gtk.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 ActionEntry [] {
                    new ActionEntry (HideToolbar, Stock.Close,
                             Catalog.GetString ("Hide"),
                             null,
                             Catalog.GetString ("Hide Toolbar"),
                             HideToolbarAction)});

                actions.Add (new ToggleActionEntry [] {
                    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 Fader (this, 1.0, 3);
                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);
                this.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, this.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 ();
                this.Decorated = false;
                this.Fullscreen ();
                this.ButtonPressEvent += HandleButtonPressEvent;

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

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

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

                notebook.CurrentPage = 0;
            } catch (System.Exception e) {
                Log.Exception (e);
            }
        }
예제 #11
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);
        }
예제 #12
0
파일: InfoBox.cs 프로젝트: iainlane/f-spot
        // Constructor.
        public InfoBox()
            : base(false, 0)
        {
            ContextSwitchStrategy = new MRUInfoBoxContextSwitchStrategy ();
            ContextChanged += HandleContextChanged;

            SetupWidgets ();

            update_delay = new Delay (Update);
            update_delay.Start ();

            histogram_delay = new Delay (DelayedUpdateHistogram);

            BorderWidth = 2;
            Hide ();
        }
예제 #13
0
		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));
		}
예제 #14
0
	//
	// Constructor
	//
	public MainWindow (Db db)
	{
		this.db = db;

		if (Toplevel == null)
			Toplevel = this;

		Glade.XML gui = new Glade.XML (null, "f-spot.glade", "main_window", null);
		gui.Autoconnect (this);

		LoadPreference (Preferences.MAIN_WINDOW_WIDTH);
		LoadPreference (Preferences.MAIN_WINDOW_X);
		LoadPreference (Preferences.MAIN_WINDOW_MAXIMIZED);
		main_window.ShowAll ();

		LoadPreference (Preferences.SIDEBAR_POSITION);
		LoadPreference (Preferences.METADATA_EMBED_IN_IMAGE);
		
		slide_delay = new FSpot.Delay (new GLib.IdleHandler (SlideShow));
		
		toolbar = new Gtk.Toolbar ();
		toolbar_vbox.PackStart (toolbar);
	
		Widget import_button = GtkUtil.MakeToolbarButton (toolbar, "gtk-add", Catalog.GetString ("Import"), new System.EventHandler (HandleImportCommand));
		SetTip (import_button, Catalog.GetString ("Import photos"));
		toolbar.AppendSpace ();

		rl_button = GtkUtil.MakeToolbarButton (toolbar, "f-spot-rotate-270", new System.EventHandler (HandleRotate270Command));
		rr_button = GtkUtil.MakeToolbarButton (toolbar, "f-spot-rotate-90", new System.EventHandler (HandleRotate90Command));
		toolbar.AppendSpace ();
		
		// FIXME putting these two toggle buttons in a radio group would prevent
		// the two toggle sounds from being emitted every time you switch modes
		browse_button = GtkUtil.MakeToolbarToggleButton (toolbar, "f-spot-browse", 
								 new System.EventHandler (HandleToggleViewBrowse)) as ToggleButton;
		SetTip (browse_button, Catalog.GetString ("Browse many photos simultaneously"));
		edit_button = GtkUtil.MakeToolbarToggleButton (toolbar, "f-spot-edit-image", 
							       new System.EventHandler (HandleToggleViewPhoto)) as ToggleButton;
		SetTip (edit_button, Catalog.GetString ("View and edit a photo"));

		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"));

		tag_selection_widget = new TagSelectionWidget (db.Tags);
		tag_selection_scrolled.Add (tag_selection_widget);
		
		tag_selection_widget.Selection.Changed += HandleTagSelectionChanged;
		tag_selection_widget.DragDataGet += HandleTagSelectionDragDataGet;
		tag_selection_widget.DragDrop += HandleTagSelectionDragDrop;
		tag_selection_widget.DragBegin += HandleTagSelectionDragBegin;
		tag_selection_widget.KeyPressEvent += HandleTagSelectionKeyPress;
		Gtk.Drag.SourceSet (tag_selection_widget, Gdk.ModifierType.Button1Mask | Gdk.ModifierType.Button3Mask,
				    tag_target_table, DragAction.Copy | DragAction.Move);

		tag_selection_widget.DragDataReceived += HandleTagSelectionDragDataReceived;
		tag_selection_widget.DragMotion += HandleTagSelectionDragMotion;
		Gtk.Drag.DestSet (tag_selection_widget, DestDefaults.All, tag_dest_target_table, 
				  DragAction.Copy | DragAction.Move ); 

		tag_selection_widget.ButtonPressEvent += HandleTagSelectionButtonPressEvent;
		tag_selection_widget.PopupMenu += HandleTagSelectionPopupMenu;
		tag_selection_widget.RowActivated += HandleTagSelectionRowActivated;
		
		LoadPreference (Preferences.TAG_ICON_SIZE);

		info_box = new InfoBox ();
		info_box.VersionIdChanged += HandleInfoBoxVersionIdChange;
		left_vbox.PackStart (info_box, false, true, 0);
		
		try {
			query = new FSpot.PhotoQuery (db.Photos);
		} catch (System.Exception e) {
			//FIXME assume any exception here is due to a corrupt db and handle that.
			RestoreDb (e);
			query = new FSpot.PhotoQuery (db.Photos);
		}

		UpdateStatusLabel ();
		query.Changed += HandleQueryChanged;

		db.Photos.ItemsChanged += HandleDbItemsChanged;
		db.Tags.ItemsChanged += HandleTagsChanged;
		db.Tags.ItemsAdded += HandleTagsChanged;
		db.Tags.ItemsRemoved += HandleTagsChanged;
#if SHOW_CALENDAR
		FSpot.SimpleCalendar cal = new FSpot.SimpleCalendar (query);
		cal.DaySelected += HandleCalendarDaySelected;
		left_vbox.PackStart (cal, false, true, 0);
#endif

		group_selector = new FSpot.GroupSelector ();
		group_selector.Adaptor = new FSpot.TimeAdaptor (query);

		group_selector.ShowAll ();
		
		if (zoom_scale != null) {
			zoom_scale.ValueChanged += HandleZoomScaleValueChanged;
		}

		view_vbox.PackStart (group_selector, false, false, 0);
		view_vbox.ReorderChild (group_selector, 0);

		find_bar = new FindBar (query, tag_selection_widget.Model);
		//find_bar = new FindBar (query, db.Tags);
		view_vbox.PackStart (find_bar, false, false, 0);
		main_window.KeyPressEvent += HandleKeyPressEvent;
		
		query_widget = new FSpot.QueryWidget (query, db, tag_selection_widget);
		query_widget.Logic.Changed += HandleQueryLogicChanged;
		view_vbox.PackStart (query_widget, false, false, 0);
		view_vbox.ReorderChild (query_widget, 1);

		icon_view = new QueryView (query);
		icon_view.ZoomChanged += HandleZoomChanged;
		LoadPreference (Preferences.ZOOM);
		LoadPreference (Preferences.SHOW_TAGS);
		LoadPreference (Preferences.SHOW_DATES);
		icon_view_scrolled.Add (icon_view);
		icon_view.DoubleClicked += HandleDoubleClicked;
		icon_view.Vadjustment.ValueChanged += HandleIconViewScroll;
		icon_view.GrabFocus ();

		new FSpot.PreviewPopup (icon_view);

		Gtk.Drag.SourceSet (icon_view, Gdk.ModifierType.Button1Mask | Gdk.ModifierType.Button3Mask,
				    icon_source_target_table, DragAction.Copy | DragAction.Move);
		
		icon_view.DragBegin += HandleIconViewDragBegin;
		icon_view.DragDataGet += HandleIconViewDragDataGet;

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

		PhotoTagMenu pmenu = new PhotoTagMenu ();
		pmenu.TagSelected += HandleRemoveTagMenuSelected;
		remove_tag.Submenu = pmenu;
		
		Gtk.Drag.DestSet (icon_view, DestDefaults.All, icon_dest_target_table, 
				  DragAction.Copy | DragAction.Move); 

		//		icon_view.DragLeave += new DragLeaveHandler (HandleIconViewDragLeave);
		icon_view.DragMotion += HandleIconViewDragMotion;
		icon_view.DragDrop += HandleIconViewDragDrop;
		icon_view.DragDataReceived += HandleIconViewDragDataReceived;
		icon_view.KeyPressEvent += HandleIconViewKeyPressEvent;

		photo_view = new PhotoView (query);
		photo_box.Add (photo_view);

		photo_view.ButtonPressEvent += HandlePhotoViewButtonPressEvent;
		photo_view.KeyPressEvent += HandlePhotoViewKeyPressEvent;
		photo_view.UpdateStarted += HandlePhotoViewUpdateStarted;
		photo_view.UpdateFinished += HandlePhotoViewUpdateFinished;

		photo_view.View.ZoomChanged += HandleZoomChanged;

		// Tag typing: focus the tag entry if the user starts typing a tag
		icon_view.KeyPressEvent += HandlePossibleTagTyping;
		photo_view.KeyPressEvent += HandlePossibleTagTyping;
		tag_entry = new TagEntry (db.Tags);
		tag_entry.KeyPressEvent += HandleTagEntryKeyPressEvent;
		tag_entry.TagsAttached += HandleTagEntryTagsAttached;
		tag_entry.TagsRemoved += HandleTagEntryRemoveTags;
		tag_entry.Activated += HandleTagEntryActivate;
		tag_entry_container.Add (tag_entry);

		Gtk.Drag.DestSet (photo_view, DestDefaults.All, tag_target_table, 
				  DragAction.Copy | DragAction.Move); 

		photo_view.DragMotion += HandlePhotoViewDragMotion;
		photo_view.DragDrop += HandlePhotoViewDragDrop;
		photo_view.DragDataReceived += HandlePhotoViewDragDataReceived;

		view_notebook.SwitchPage += HandleViewNotebookSwitchPage;
		group_selector.Adaptor.GlassSet += HandleAdaptorGlassSet;
		group_selector.Adaptor.Changed += HandleAdaptorChanged;
		LoadPreference (Preferences.GROUP_ADAPTOR);
		LoadPreference (Preferences.GROUP_ADAPTOR_ORDER_ASC);

		this.selection = new MainSelection (this);
		this.selection.Changed += HandleSelectionChanged;
		this.selection.ItemsChanged += HandleSelectionItemsChanged;

		UpdateMenus ();

		main_window.ShowAll ();

		tagbar.Hide ();
		find_bar.Hide ();

		UpdateFindByTagMenu ();

		LoadPreference (Preferences.SHOW_TOOLBAR);
		LoadPreference (Preferences.SHOW_SIDEBAR);
		LoadPreference (Preferences.SHOW_TIMELINE);
		
		Preferences.SettingChanged += OnPreferencesChanged;

		main_window.DeleteEvent += HandleDeleteEvent;
		
		query_widget.HandleChanged (query);
		query_widget.Hide ();

		// When the icon_view is loaded, set it's initial scroll position
		icon_view.SizeAllocated += HandleIconViewReady;

		export.Activated += HandleExportActivated;
		UpdateToolbar ();

		Banshee.Kernel.Scheduler.Resume ();
	}
		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 ImportCommand (Gtk.Window mw)
	{
		main_window = mw;
		step = new FSpot.Delay (new GLib.IdleHandler (Step));
		idle_start = new FSpot.Delay (new IdleHandler (Start));
		loading_string = Catalog.GetString ("Loading {0} of {1}");
	}
예제 #17
0
		public Animator (TimeSpan duration, TimeSpan interval, EventHandler tick)
		{
			this.duration = duration;
			this.tick = tick;
			delay = new Delay ((uint)interval.TotalMilliseconds, HandleTimeout);
		}