Exemplo n.º 1
0
 private void HandleVersionIdChanged(PhotoVersionMenu menu)
 {
     if (VersionIdChanged != null)
     {
         VersionIdChanged(this, menu.VersionId);
     }
 }
Exemplo n.º 2
0
        private void UpdateSingle()
        {
            ImageInfo info;

            Photo photo = Photos[0];

            histogram_expander.Visible = true;
            UpdateHistogram();

            name_label.Visible    = true;
            name_value_label.Text = photo.Name != null?System.Uri.UnescapeDataString(photo.Name) : String.Empty;

            try {
                //using (new Timer ("building info")) {
                using (ImageFile img = ImageFile.Create(photo.DefaultVersionUri))
                {
                    info = new ImageInfo(img);
                }
                //}
            } catch (System.Exception e) {
                Log.Debug(e.StackTrace);
                info = new ImageInfo(null);
            }

            exposure_value_label.Text = info.ExposureInfo;
            if (exposure_value_label.Text.IndexOf(Environment.NewLine) != -1)
            {
                exposure_label.Markup = default_exposure_string + Environment.NewLine;
            }
            else
            {
                exposure_label.Markup = default_exposure_string;
            }
            exposure_label.Visible       = true;
            exposure_value_label.Visible = true;

            size_value_label.Text    = info.Dimensions;
            size_label.Visible       = true;
            size_value_label.Visible = true;

        #if USE_EXIF_DATE
            date_value_label.Text = info.Date;
        #else
            DateTime local_time = photo.Time.ToLocalTime();
            date_value_label.Text = String.Format("{0}{2}{1}",
                                                  local_time.ToShortDateString(),
                                                  local_time.ToShortTimeString(),
                                                  Environment.NewLine
                                                  );
        #endif


            version_label.Visible       = true;
            version_option_menu.Visible = true;
            PhotoVersionMenu menu = new PhotoVersionMenu(photo);
            menu.VersionIdChanged   += new PhotoVersionMenu.VersionIdChangedHandler(HandleVersionIdChanged);
            menu.WidthRequest        = version_option_menu.Allocation.Width;
            version_option_menu.Menu = menu;

            uint i = 0;
            foreach (uint version_id in photo.VersionIds)
            {
                if (version_id == photo.DefaultVersionId)
                {
                    // FIXME GTK# why not just .History = i ?
                    version_option_menu.SetHistory(i);
                    break;
                }
                i++;
            }
            if (show_tags)
            {
                tag_view.Current = photo;
            }
            rating_label.Visible = show_rating;
            rating_view.Visible  = show_rating;
            if (show_rating)
            {
                rating_view.Value = (int)photo.Rating;
            }

            Show();
        }
	//
	// Handle Main Menu 

	void UpdateMenus ()
	{
		int tags_selected = tag_selection_widget.Selection.CountSelectedRows ();
		bool tag_sensitive = tags_selected > 0;
		bool active_selection = selection.Count > 0;
		bool single_active = CurrentPhoto != null;
		
		if (!single_active) {
			version_menu_item.Sensitive = false;
			version_menu_item.Submenu = new Menu ();

			create_version_menu_item.Sensitive = false;
			delete_version_menu_item.Sensitive = false;
			rename_version_menu_item.Sensitive = false;

			sharpen.Sensitive = false;
			loupe_menu_item.Sensitive = false;
		} else {
			version_menu_item.Sensitive = true;
			create_version_menu_item.Sensitive = true;
			
			if (CurrentPhoto.DefaultVersionId == Photo.OriginalVersionId) {
				delete_version_menu_item.Sensitive = false;
				rename_version_menu_item.Sensitive = false;
			} else {
				delete_version_menu_item.Sensitive = true;
				rename_version_menu_item.Sensitive = true;
			}

			versions_submenu = new PhotoVersionMenu (CurrentPhoto);
			versions_submenu.VersionIdChanged += delegate (PhotoVersionMenu menu) { UpdateForVersionIdChange (menu.VersionId);};
			version_menu_item.Submenu = versions_submenu;

			sharpen.Sensitive = (view_mode == ModeType.IconView ? false : true);
			loupe_menu_item.Sensitive = (view_mode == ModeType.IconView ? false : true);
		}

		set_as_background.Sensitive = single_active;
		adjust_time.Sensitive = active_selection;

		attach_tag.Sensitive = active_selection;
		remove_tag.Sensitive = active_selection;

		rotate_left.Sensitive = active_selection;
		rotate_right.Sensitive = active_selection;
		update_thumbnail.Sensitive = active_selection;
		delete_from_drive.Sensitive = active_selection;
		
		send_mail.Sensitive = active_selection;
		print.Sensitive = active_selection;
		select_none.Sensitive = active_selection;
		copy_location.Sensitive = active_selection;
		remove_from_catalog.Sensitive = active_selection;
		
		clear_rating_filter.Sensitive = (query.RatingRange != null);

		clear_roll_filter.Sensitive = (query.RollSet != null);
		
		delete_selected_tag.Sensitive = tag_sensitive;
		edit_selected_tag.Sensitive = tag_sensitive;


		attach_tag_to_selection.Sensitive = tag_sensitive && active_selection;
		remove_tag_from_selection.Sensitive = tag_sensitive && active_selection;
	
		export.Sensitive = active_selection;

		try {
			tools.Visible = (tools.Submenu as Menu).Children.Length > 0;
		} catch {
			tools.Visible = false;
		}

		if (rl_button != null) {
			if (selection.Count == 0) {
				rl_button.Sensitive = false;
				rl_button.SetTooltip (ToolTips, Catalog.GetString (String.Empty), null);
			} else {
				rl_button.Sensitive = true;

				string msg = Catalog.GetPluralString ("Rotate selected photo left",
								      "Rotate selected photos left", selection.Count);
				rl_button.SetTooltip (ToolTips, String.Format (msg, selection.Count), null);
			}
		}
		
		if (rr_button != null) {
			if (selection.Count == 0) {
				rr_button.Sensitive = false;
				rr_button.SetTooltip (ToolTips, Catalog.GetString (String.Empty), null);
			} else {
				rr_button.Sensitive = true;

				string msg = Catalog.GetPluralString ("Rotate selected photo right",
								      "Rotate selected photos right", selection.Count);
				rr_button.SetTooltip (ToolTips, String.Format (msg, selection.Count), null);
			}
		}

		//if (last_tags_selected_count != tags_selected) {
		((Gtk.Label)find_add_tag.Child).TextWithMnemonic = String.Format (
			Catalog.GetPluralString ("Find _Selected Tag", "Find _Selected Tags", tags_selected), tags_selected
		);

		((Gtk.Label)find_add_tag_with.Child).TextWithMnemonic = String.Format (
			Catalog.GetPluralString ("Find Selected Tag _With", "Find Selected Tags _With", tags_selected), tags_selected
		);

		find_add_tag.Sensitive = tag_sensitive;
		find_add_tag_with.Sensitive = tag_sensitive && find_add_tag_with.Submenu != null;

		//last_tags_selected_count = tags_selected;
		//}
	}
Exemplo n.º 4
0
    public bool Update()
    {
        ImageInfo info;

        if (photo == null)
        {
            Clear();
            return(false);
        }

        name_label.Text = photo.Name != null ? photo.Name : String.Empty;
        try {
            //using (new Timer ("building info")) {
            using (ImageFile img = ImageFile.Create(photo.DefaultVersionUri))
            {
                info = new ImageInfo(img);
            }
            //}
        } catch (System.Exception e) {
            System.Console.WriteLine(e);
            info = new ImageInfo(null);
        }


        name_label.Sensitive     = true;
        exposure_info_label.Text = info.ExposureInfo;
        size_label.Text          = info.Dimensions;
#if USE_EXIF_DATE
        date_label.Text = info.Date;
#else
        date_label.Text = String.Format("{0}{2}{1}",
                                        photo.Time.ToLocalTime().ToShortDateString(),
                                        photo.Time.ToLocalTime().ToShortTimeString(),
                                        Environment.NewLine);
#endif


        Photo p = photo as Photo;
        if (p != null)
        {
            version_option_menu.Visible   = true;
            version_option_menu.Sensitive = true;
            PhotoVersionMenu menu = new PhotoVersionMenu(p);
            menu.VersionIdChanged   += new PhotoVersionMenu.VersionIdChangedHandler(HandleVersionIdChanged);
            menu.WidthRequest        = version_option_menu.Allocation.Width;
            version_option_menu.Menu = menu;

            uint i = 0;
            foreach (uint version_id in p.VersionIds)
            {
                if (version_id == p.DefaultVersionId)
                {
                    // FIXME GTK# why not just .History = i ?
                    version_option_menu.SetHistory(i);
                    break;
                }
                i++;
            }
        }
        else
        {
            version_option_menu.Visible   = false;
            version_option_menu.Sensitive = false;
            version_option_menu.Menu      = null;
        }


        return(false);
    }
Exemplo n.º 5
0
	//
	// Handle Main Menu 

	void UpdateMenus ()
	{
		int tags_selected = tag_selection_widget.Selection.CountSelectedRows ();
		bool tag_sensitive = tags_selected > 0;
		bool active_selection = selection.Count > 0;
		bool single_active = CurrentPhoto != null;
		
		if (!single_active) {
			version_menu_item.Sensitive = false;
			version_menu_item.Submenu = new Menu ();

			create_version_menu_item.Sensitive = false;
			delete_version_menu_item.Sensitive = false;
			rename_version_menu_item.Sensitive = false;

		} else {
			version_menu_item.Sensitive = true;
			create_version_menu_item.Sensitive = true;
			
			if (CurrentPhoto.DefaultVersionId == Photo.OriginalVersionId) {
				delete_version_menu_item.Sensitive = false;
				rename_version_menu_item.Sensitive = false;
			} else {
				delete_version_menu_item.Sensitive = true;
				rename_version_menu_item.Sensitive = true;
			}

			versions_submenu = new PhotoVersionMenu (CurrentPhoto);
			versions_submenu.VersionIdChanged += new PhotoVersionMenu.VersionIdChangedHandler (HandleVersionIdChanged);
			version_menu_item.Submenu = versions_submenu;
		}

		set_as_background.Sensitive = single_active;
		adjust_color.Sensitive = single_active;
		adjust_time.Sensitive = active_selection;

		attach_tag.Sensitive = active_selection;
		remove_tag.Sensitive = active_selection;

		rotate_left.Sensitive = active_selection;
		rotate_right.Sensitive = active_selection;
		update_thumbnail.Sensitive = active_selection;
		delete_from_drive.Sensitive = active_selection;
		
		send_mail.Sensitive = active_selection;
		print.Sensitive = active_selection;
		select_none.Sensitive = active_selection;
		copy_location.Sensitive = active_selection;
		exif_data.Sensitive = active_selection;
		sharpen.Sensitive = active_selection;
		remove_from_catalog.Sensitive = active_selection;
		
		last_roll.Sensitive = (db.Rolls.GetRolls (1).Length > 0);
		select_rolls.Sensitive = (db.Rolls.GetRolls (2).Length > 1);
		clear_roll_filter.Sensitive = (query.RollSet != null);
		
		delete_selected_tag.Sensitive = tag_sensitive;
		edit_selected_tag.Sensitive = tag_sensitive;


		attach_tag_to_selection.Sensitive = tag_sensitive && active_selection;
		remove_tag_from_selection.Sensitive = tag_sensitive && active_selection;
	
		try {
			export.Submenu = (Mono.Addins.AddinManager.GetExtensionNode ("/FSpot/Menus/Exports") as FSpot.Extensions.SubmenuNode).GetMenuItem ().Submenu;
		} catch {
			Console.WriteLine ("There's something wrong with some of the installed extensions. You can try removing the directory addin-db-000 from ~/.gnome2/f-spot/");
		}
		export.Sensitive = active_selection;

		try {
			tools.Submenu = (Mono.Addins.AddinManager.GetExtensionNode ("/FSpot/Menus/Tools") as FSpot.Extensions.SubmenuNode).GetMenuItem ().Submenu;
			tools.Visible = (tools.Submenu as Menu).Children.Length > 0;
		} catch {
			Console.WriteLine ("There's something wrong with some of the installed extensions. You can try removing the directory addin-db-000 from ~/.gnome2/f-spot/");
			tools.Visible = false;
		}

		if (rl_button != null) {
			if (selection.Count == 0) {
				rl_button.Sensitive = false;
				SetTip (rl_button, String.Empty);
			} else {
				rl_button.Sensitive = true;

				string msg = Catalog.GetPluralString ("Rotate selected photo left",
								      "Rotate selected photos left", selection.Count);
				SetTip (rl_button, String.Format (msg, selection.Count));
			}
		}
		
		if (rr_button != null) {
			if (selection.Count == 0) {
				rr_button.Sensitive = false;
				SetTip (rr_button, String.Empty);
			} else {
				rr_button.Sensitive = true;

				string msg = Catalog.GetPluralString ("Rotate selected photo right",
				    "Rotate selected photos right", selection.Count);
				SetTip (rr_button, String.Format (msg, selection.Count));
			}
		}

        //if (last_tags_selected_count != tags_selected) {
            ((Gtk.Label)find_add_tag.Child).Text = String.Format (
                Catalog.GetPluralString ("Find Selected Tag", "Find Selected Tags", tags_selected), tags_selected
            );

            ((Gtk.Label)find_add_tag_with.Child).Text = String.Format (
                Catalog.GetPluralString ("Find Selected Tag With", "Find Selected Tags With", tags_selected), tags_selected
            );

            find_add_tag.Sensitive = tag_sensitive;
            find_add_tag_with.Sensitive = tag_sensitive && find_add_tag_with.Submenu != null;

            //last_tags_selected_count = tags_selected;
        //}
	}
Exemplo n.º 6
0
	void HandleVersionIdChanged (PhotoVersionMenu menu)
	{
		UpdateForVersionIdChange (menu.VersionId);
	}
Exemplo n.º 7
0
	private void HandleVersionIdChanged (PhotoVersionMenu menu)
	{
		if (VersionIdChanged != null)
			VersionIdChanged (this, menu.VersionId);
	}
Exemplo n.º 8
0
	public bool Update ()
	{
		ImageInfo info;

		if (photo == null) {
			Clear ();
			return false;
		}
		
		name_label.Text = photo.Name != null ? photo.Name : String.Empty;
		try {
			//using (new Timer ("building info")) {
				using (ImageFile img = ImageFile.Create (photo.DefaultVersionUri))
				{
					info = new ImageInfo (img);
				}
				//}
		} catch (System.Exception e) {
			System.Console.WriteLine (e);
			info = new ImageInfo (null);			
		}


		name_label.Sensitive = true;
		exposure_info_label.Text = info.ExposureInfo;
		size_label.Text = info.Dimensions;
#if USE_EXIF_DATE
		date_label.Text = info.Date;
#else
		date_label.Text = String.Format ("{0}{2}{1}",
						 photo.Time.ToLocalTime ().ToShortDateString (),
						 photo.Time.ToLocalTime ().ToShortTimeString (),
						 Environment.NewLine);
#endif
		

		Photo p = photo as Photo;
		if (p != null) {
			version_option_menu.Visible = true;
			version_option_menu.Sensitive = true;
			PhotoVersionMenu menu = new PhotoVersionMenu (p);
			menu.VersionIdChanged += new PhotoVersionMenu.VersionIdChangedHandler (HandleVersionIdChanged);
			menu.WidthRequest = version_option_menu.Allocation.Width;
			version_option_menu.Menu = menu;
			
			uint i = 0;
			foreach (uint version_id in p.VersionIds) {
				if (version_id == p.DefaultVersionId) {
					// FIXME GTK# why not just .History = i ?
					version_option_menu.SetHistory (i);
					break;
				}
				i++;
			}
		} else {
			version_option_menu.Visible = false;
			version_option_menu.Sensitive = false;
			version_option_menu.Menu = null;
		}


		return false;
	}
Exemplo n.º 9
0
		private void UpdateSingle () 
		{
			ImageInfo info;

			Photo photo = Photos[0];

			histogram_expander.Visible = true;
			UpdateHistogram ();

			name_label.Visible = true;
			name_value_label.Text = photo.Name != null ? System.Uri.UnescapeDataString(photo.Name) : String.Empty;
			try {
				//using (new Timer ("building info")) {
					using (ImageFile img = ImageFile.Create (photo.DefaultVersionUri))
					{
						info = new ImageInfo (img);
					}
					//}
			} catch (System.Exception e) {
				Log.Debug (e.StackTrace);
				info = new ImageInfo (null);			
			}

			exposure_value_label.Text = info.ExposureInfo;
			if (exposure_value_label.Text.IndexOf (Environment.NewLine) != -1)
				exposure_label.Markup = default_exposure_string + Environment.NewLine;
			else
				exposure_label.Markup = default_exposure_string;
			exposure_label.Visible = true;
			exposure_value_label.Visible = true;
	
			size_value_label.Text = info.Dimensions;
			size_label.Visible = true;
			size_value_label.Visible = true;

	#if USE_EXIF_DATE
			date_value_label.Text = info.Date;
	#else
			DateTime local_time = photo.Time.ToLocalTime ();
			date_value_label.Text = String.Format ("{0}{2}{1}",
				local_time.ToShortDateString (),
				local_time.ToShortTimeString (),
				Environment.NewLine
			);
	#endif
			
	
			version_label.Visible = true;
			version_option_menu.Visible = true;
			PhotoVersionMenu menu = new PhotoVersionMenu (photo);
			menu.VersionIdChanged += new PhotoVersionMenu.VersionIdChangedHandler (HandleVersionIdChanged);
			menu.WidthRequest = version_option_menu.Allocation.Width;
			version_option_menu.Menu = menu;
			
			uint i = 0;
			foreach (uint version_id in photo.VersionIds) {
				if (version_id == photo.DefaultVersionId) {
					// FIXME GTK# why not just .History = i ?
					version_option_menu.SetHistory (i);
					break;
				}
				i++;
			}
			if (show_tags)
				tag_view.Current = photo;
			rating_label.Visible = show_rating;
			rating_view.Visible = show_rating;
			if (show_rating) {
				rating_view.Value = (int) photo.Rating;
			}
	
			Show ();
		}