Esempio n. 1
0
        ImageVoteWidget(Gtk.Builder builder, IntPtr handle) : base(builder, handle)
        {
            this.ImageWidget = new ImageViewWidget();
            this.ImageViewBox.PackStart(this.ImageWidget, true, true, 0);

            this.ImageWidget.Controls = PlayerControlWidget.Create();
            this.ImageViewBox.PackEnd(this.ImageWidget.Controls, false, true, 0);

            // enable mouse scrolling
            this.ImageWidget.Events      |= Gdk.EventMask.ScrollMask;
            this.ImageWidget.ScrollEvent += (o, args) => {
                this.ImageWidget.AdvanceSubImage(args.Event.Direction == Gdk.ScrollDirection.Down);
            };

            // enable context menu
            this.ImageWidget.Events             |= Gdk.EventMask.ButtonReleaseMask | Gdk.EventMask.ButtonPressMask;
            this.ImageWidget.ButtonReleaseEvent += (o, args) => {
                if (args.Event.Button == 3)
                {
                    this.ImagePopupMenu.Popup();
                }
            };

            this.Overlay          = new TagsOverlay(this.ImageWidget);
            this.Overlay.IsActive = false;
        }
Esempio n. 2
0
        protected ExtractWindow(Builder builder, IntPtr handle, Database db) : base(handle)
        {
            builder.Autoconnect(this);

            this.db = db;

            this.imageView = new ImageViewWidget();
            this.ImageViewBox.PackStart(this.imageView, true, true, 2);

            this.imageView.Events      |= Gdk.EventMask.ScrollMask;
            this.imageView.ScrollEvent += (o, args) => {
                TreePath     path;
                CellRenderer renderer;
                this.ImageThumbView.GetCursor(out path, out renderer);

                TreeIter iter;
                this.store.GetIter(out iter, path);

                if (args.Event.Direction == Gdk.ScrollDirection.Down)
                {
                    if (!this.store.IterNext(ref iter))
                    {
                        this.store.GetIterFirst(out iter);
                    }
                    path = this.store.GetPath(iter);
                }
                else
                {
                    this.store.IterPrevious(ref iter);
                    path = this.store.GetPath(iter);
                }

                this.ImageThumbView.SetCursor(path, null, false);
                this.ImageThumbView.SelectPath(path);
            };

            this.store = new ListStore(typeof(string), typeof(Gdk.Pixbuf), typeof(BooruImage), typeof(float));

            //store.SetSortColumnId(3, SortType.Descending);

            this.ImageThumbView.Model         = store;
            this.ImageThumbView.TooltipColumn = 0;
            //this.ImageThumbView.TextColumn = 0;
            this.ImageThumbView.PixbufColumn = 1;
        }
Esempio n. 3
0
        protected EditTagsWindow(Builder builder, IntPtr handle, BooruImage image) : base(handle)
        {
            builder.Autoconnect(this);

            var           db   = image.db;
            List <string> tags = db.GetAllTags();

            tags.Sort();

            if (completion == null)
            {
                var completionStore = new Gtk.ListStore(typeof(string));
                foreach (var tag in tags)
                {
                    completionStore.AppendValues(tag);
                    completionStore.AppendValues("-" + tag);
                }

                completion                  = new Gtk.EntryCompletion();
                completion.Model            = completionStore;
                completion.TextColumn       = 0;
                completion.MinimumKeyLength = 3;
            }

            TagEntry.Completion = completion;

            this.image            = image;
            this.imageView        = new ImageViewWidget();
            this.imageView.Drawn += (System.Object o, Gtk.DrawnArgs args) => {
                BooruImageWidget.ImageViewTagsOverlay(args.Cr, this.image, this.imageView);
            };
            this.ImageViewBox.PackStart(this.imageView, true, true, 2);
            this.imageView.Anim = image.Anim;

            this.Maximize();
        }
Esempio n. 4
0
        bool UpdateFade(ImageViewWidget imageViewWidget)
        {
            this.currentFadeOpacity = imageViewWidget.Alpha;

            return(this.currentFadeOpacity > 0.0);
        }
Esempio n. 5
0
        ImagesResultWidget(Gtk.Builder builder, IntPtr handle) : base(builder, handle)
        {
            builder.Autoconnect(this);

            BooruApp.BooruApplication.EventCenter.WillQuit          += Abort;
            BooruApp.BooruApplication.EventCenter.FullscreenToggled += this.ToggleFullscreen;

            this.PlayImage         = new Gtk.Image(Resources.LoadResourcePixbufAnimation(Resources.ID_PIXBUFS_BUTTON_PLAY));
            this.StopImage         = new Gtk.Image(Resources.LoadResourcePixbufAnimation(Resources.ID_PIXBUFS_BUTTON_STOP));
            this.TagImage          = new Gtk.Image(Resources.LoadResourcePixbufAnimation(Resources.ID_PIXBUFS_BUTTON_TAG));
            this.ShuffleImage      = new Gtk.Image(Resources.LoadResourcePixbufAnimation(Resources.ID_PIXBUFS_BUTTON_SHUFFLE));
            this.MarkImage         = new Gtk.Image(Resources.LoadResourcePixbufAnimation(Resources.ID_PIXBUFS_BUTTON_MARK));
            this.UnmarkImage       = new Gtk.Image(Resources.LoadResourcePixbufAnimation(Resources.ID_PIXBUFS_BUTTON_UNMARK));
            this.DeleteImage       = new Gtk.Image(Resources.LoadResourcePixbufAnimation(Resources.ID_PIXBUFS_BUTTON_DELETE));
            this.ViewExternalImage = new Gtk.Image(Resources.LoadResourcePixbufAnimation(Resources.ID_PIXBUFS_BUTTON_VIEW_EXTERNAL));
            this.ExportImage       = new Gtk.Image(Resources.LoadResourcePixbufAnimation(Resources.ID_PIXBUFS_BUTTON_EXPORT));
            this.AbortImage        = new Gtk.Image(Resources.LoadResourcePixbufAnimation(Resources.ID_PIXBUFS_BUTTON_ABORT));

            this.ButtonSlideshow.Image    = this.PlayImage;
            this.ShowTagsButton.Image     = this.TagImage;
            this.ShuffleButton.Image      = this.ShuffleImage;
            this.MarkButton.Image         = this.MarkImage;
            this.DeleteButton.Image       = this.DeleteImage;
            this.OpenExternalButton.Image = this.ViewExternalImage;
            this.ExportButton.Image       = this.ExportImage;
            this.StopButton.Image         = this.AbortImage;

            this.Removed += (o, args) => {
                this.Abort();
            };


            // TODO: add custom tag input widget

            /*
             * var tagbox = new TagBoxWidget ();
             * ImageViewBox.PackEnd (tagbox, false, false, 0);
             * tagbox.Show ();
             */

            // add image view
            this.imageView = new ImageViewWidget();
            this.ImageViewBox.PackStart(this.imageView, true, true, 0);

            this.imageView.Controls = PlayerControlWidget.Create();
            this.ImageViewBox.PackEnd(this.imageView.Controls, false, true, 0);

            // enable mouse scrolling
            this.imageView.Events      |= Gdk.EventMask.ScrollMask;
            this.imageView.ScrollEvent += (o, args) => {
                if (args.Event.Direction == Gdk.ScrollDirection.Down)
                {
                    this.Advance(true);
                }
                else if (args.Event.Direction == Gdk.ScrollDirection.Up)
                {
                    this.Advance(false);
                }
            };

            // add overlay for tag display
            this.tagsOverlay = new TagsOverlay(this.imageView);

            // setup tag entry autocompletion
            var completion = new Gtk.EntryCompletion();

            completion.Model            = BooruApp.BooruApplication.Database.TagEntryCompletionStore;
            completion.TextColumn       = 0;
            completion.MinimumKeyLength = 3;
            this.TagsEntry.Completion   = completion;

            // set up thumb list view
            this.store = new ThumbStore();
            this.ImageThumbView.PixbufColumn  = ThumbStore.THUMB_STORE_COLUMN_THUMBNAIL;
            this.ImageThumbView.TooltipColumn = ThumbStore.THUMB_STORE_COLUMN_TOOLTIP;
            this.ImageThumbView.TextColumn    = ThumbStore.THUMB_STORE_COLUMN_INDEX;
            this.ImageThumbView.ItemWidth     = 64;

            this.ImageThumbView.Model = this.store;

            this.ImageThumbView.Model.RowInserted += on_ImageThumbView_Model_RowInserted;
            this.ImageThumbView.Model.RowChanged  += on_ImageThumbView_Model_RowChanged;

            this.ImageThumbView.Events        |= Gdk.EventMask.KeyPressMask;
            this.ImageThumbView.KeyPressEvent += on_ImageThumbView_KeyPress;

            this.StopButton.Sensitive   = true;
            this.Spinner.Active         = true;
            this.ExportButton.Sensitive = false;
            this.MarkButton.Sensitive   = false;
            this.DeleteButton.Sensitive = false;

            //var box = (Gtk.Box)this.StopButton.Parent.Parent;
            //this.tagsBox = new TagsEntryWidget ();
            //box.PackEnd (this.tagsBox, false, true, 0);
            //this.tagsBox.Show ();

            this.idle = GLib.Timeout.Add(100, () => {
                if (this.imageView.Image != this.ActiveImage)
                {
                    // get newly selected image
                    this.imageView.Image = this.ActiveImage;

                    // this.tagsBox.SetTags (image.Tags);

                    // clear tags entry to not confuse user
                    this.TagsEntry.Text = "";
                    this.UpdateButtons();
                }
                return(true);
            });
        }