예제 #1
0
        public EditTagIconDialog(Db db, Tag t, Gtk.Window parent_window)
            : base("EditTagIconDialog.ui", "edit_tag_icon_dialog")
        {
            TransientFor = parent_window;
            Title = String.Format (Catalog.GetString ("Edit Icon for Tag {0}"), t.Name);

            preview_pixbuf = t.Icon;
            Cms.Profile screen_profile;
            if (preview_pixbuf != null && FSpot.ColorManagement.Profiles.TryGetValue (Preferences.Get<string> (Preferences.COLOR_MANAGEMENT_DISPLAY_PROFILE), out screen_profile)) {
                preview_image.Pixbuf = preview_pixbuf.Copy ();
                ColorManagement.ApplyProfile (preview_image.Pixbuf, screen_profile);
            } else
                preview_image.Pixbuf = preview_pixbuf;

            query = new FSpot.PhotoQuery (db.Photos);

            if (db.Tags.Hidden != null)
                query.Terms = FSpot.OrTerm.FromTags (new Tag [] {t});
            else
                query.Terms = new FSpot.Literal (t);

            image_view = new PhotoImageView (query) {CropHelpers = false};
            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);
            external_photo_chooser.Show ();
            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 ();

            DelayedOperation fill_delay = new DelayedOperation (FillIconView);
            fill_delay.Start ();
        }
예제 #2
0
        public MetadataDisplayWidget()
        {
            main_vbox = new VBox ();
            main_vbox.Spacing = 6;

            metadata_message = new Label (String.Empty);
            metadata_message.UseMarkup = true;
            metadata_message.LineWrap = true;
            metadata_vbox = new VBox ();
            metadata_vbox.Spacing = 6;

            main_vbox.PackStart (metadata_vbox, false, false, 0);
            AddWithViewport (metadata_message);
            ((Viewport)Child).ShadowType = ShadowType.None;
            BorderWidth = 3;

            display = State.message;
            ExposeEvent += HandleExposeEvent;

            open_list = new List<string> ();

            // Create Expander and TreeView for
            // extended metadata
            var tree_view = new TreeView ();
            tree_view.HeadersVisible = false;
            tree_view.RulesHint = true;

            var col = new TreeViewColumn ();
            col.Sizing = TreeViewColumnSizing.Autosize;
            CellRenderer colr = new CellRendererText ();
            col.PackStart (colr, false);

            col.AddAttribute (colr, "markup", 0);

            tree_view.AppendColumn (col);

            extended_metadata = new ListStore (typeof(string));
            tree_view.Model = extended_metadata;

            var expander = new Expander (String.Format ("<span weight=\"bold\"><small>{0}</small></span>", Catalog.GetString ("Extended Metadata")));
            expander.UseMarkup = true;
            expander.Add (tree_view);
            expander.Expanded = true;

            main_vbox.PackStart (expander, false, false, 6);
            expander.ShowAll ();

            update_delay = new DelayedOperation (Update);
            update_delay.Start ();
        }
예제 #3
0
        // Constructor.
        public InfoBox()
            : base(false, 0)
        {
            ContextSwitchStrategy = new MRUInfoBoxContextSwitchStrategy ();
            ContextChanged += HandleContextChanged;

            SetupWidgets ();

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

            histogram_delay = new DelayedOperation (DelayedUpdateHistogram);

            BorderWidth = 2;
            Hide ();
        }
        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 WindowOpacityFader (this, 1.0, 600);
                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 DelayedOperation (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);
            }
        }