Exemple #1
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;
        }
Exemple #2
0
        public SingleView(Uri [] uris)
        {
            string glade_name = "single_view";
            this.uri = uris [0];

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

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

            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 = {
                FSpot.DragDropTargets.UriListEntry,
                FSpot.DragDropTargets.PlainTextEntry
            };

            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 (object sender, BrowsablePointerChangedEventArgs old) {
                    BrowsablePointer pointer = sender as BrowsablePointer;
                    if (pointer == null)
                        return;
                    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 ;
        }