Exemple #1
0
 void HandleExposeEvent(object sender, ExposeEventArgs args)
 {
     if (!up_to_date)
     {
         update_delay.Start();
     }
 }
Exemple #2
0
 public void VBoxPackEnd(Widget w)
 {
     if (widgets == null)
     {
         widgets = new List <Widget> ();
     }
     lock (syncHandle) {
         widgets.Add(w);
         delay.Start();
     }
 }
Exemple #3
0
 private void UpdateHistogram()
 {
     if (histogram_expander.Expanded)
     {
         histogram_delay.Start();
     }
 }
Exemple #4
0
        public bool HideControls()
        {
            int x, y;

            Gdk.ModifierType type;

            if (!auto_hide)
            {
                return(false);
            }

            if (IsRealized)
            {
                GdkWindow.GetPointer(out x, out y, out type);
                if (Allocation.Contains(x, y))
                {
                    hide.Start();
                    return(true);
                }
            }

            hide.Stop();
            Visibility = VisibilityType.None;
            return(false);
        }
Exemple #5
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      = DisplayState.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();
        }
Exemple #6
0
        public bool HideControls(bool force)
        {
            int x, y;

            Gdk.ModifierType type;

            if (!force && IsRealized)
            {
                ControlBox.GdkWindow.GetPointer(out x, out y, out type);
                if (x < ControlBox.Allocation.Width && y < ControlBox.Allocation.Height)
                {
                    hide.Start();
                    return(true);
                }
            }

            hide.Stop();
            ControlBox.Hide();
            return(false);
        }
Exemple #7
0
        private void HandleMotionNotifyEvent(object sender, MotionNotifyEventArgs args)
        {
            pos.X = (int)args.Event.XRoot - start.X;
            pos.Y = (int)args.Event.YRoot - start.Y;

            root_pos.X = (int)args.Event.XRoot;
            root_pos.Y = (int)args.Event.YRoot;

            if (dragging)
            {
                drag.Start();
            }
        }
Exemple #8
0
        bool FadeToTarget(double target)
        {
            //Log.Debug ("FadeToTarget {0}", target);
            Realize();
            this.target = target;
            fade.Start();

            if (target > 0.0)
            {
                hide.Restart();
            }

            return(false);
        }
Exemple #9
0
        void HandleDescriptionChanged(object sender, EventArgs args)
        {
            if (!Item.IsValid)
            {
                return;
            }

            ((Photo)Item.Current).Description = description_entry.Text;

            if (commit_delay.IsPending)
            {
                if (changed_photo == Item.Index)
                {
                    commit_delay.Stop();
                }
                else
                {
                    CommitPendingChanges();
                }
            }

            changed_photo = Item.Index;
            commit_delay.Start();
        }
Exemple #10
0
        // Context switching

        private void HandleContextChanged(object sender, EventArgs args)
        {
            bool infobox_visible = ContextSwitchStrategy.InfoBoxVisible(Context);

            info_expander.Expanded = infobox_visible;

            bool histogram_visible = ContextSwitchStrategy.HistogramVisible(Context);

            histogram_expander.Expanded = histogram_visible;

            if (infobox_visible)
            {
                update_delay.Start();
            }
        }
Exemple #11
0
        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();
        }
Exemple #12
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 && 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 PhotoQuery(db.Photos);

            if (db.Tags.Hidden != null)
            {
                query.Terms = OrTerm.FromTags(new [] { t });
            }
            else
            {
                query.Terms = new 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();
        }
Exemple #13
0
 private void HandleRightPressed(object sender, System.EventArgs ars)
 {
     HandleScrollRight();
     right_delay.Start();
 }
Exemple #14
0
 private void HandleLeftPressed(object sender, System.EventArgs ars)
 {
     HandleScrollLeft();
     left_delay.Start();
 }
Exemple #15
0
 public void Start()
 {
     running = true;
     flip.Start();
 }
Exemple #16
0
        public FullScreenView(IBrowsableCollection collection, 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[] {
                    new ActionEntry(HideToolbar, Stock.Close,
                                    Catalog.GetString("Hide"),
                                    null,
                                    Catalog.GetString("Hide toolbar"),
                                    HideToolbarAction)
                });

                actions.Add(new[] {
                    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);
                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, 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();
                Decorated = false;
                Fullscreen();
                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 (Exception e) {
                Log.Exception(e);
            }
        }
Exemple #17
0
 public void Dismiss()
 {
     Visibility = VisibilityType.None;
     dismiss.Start();
 }