Пример #1
0
        protected MainWindow(Gtk.Builder builder, IntPtr handle) : base(handle)
        {
            builder.Autoconnect(this);

            this.Icon = new Gdk.Pixbuf(null, "Booru.Resources.Pixbufs.icon.png");

            DeleteEvent += OnDeleteEvent;

            this.MainNotebook.AppendPage(MainTab.Create(), BigTabLabel.Create("Start"));
            this.MainNotebook.AppendPage(ImagesTab.Create(), BigTabLabel.Create("Images"));
            this.MainNotebook.AppendPage(VoteTab.Create(), BigTabLabel.Create("Vote"));
            this.MainNotebook.AppendPage(TagListTab.Create(), BigTabLabel.Create("Tags"));
            this.MainNotebook.AppendPage(ImportTab.Create(), BigTabLabel.Create("Import"));
            this.MainNotebook.AppendPage(ConfigTab.Create(), BigTabLabel.Create("Settings"));

            // when a search is to be executed, select images tab
            BooruApp.BooruApplication.EventCenter.ImageSearchRequested += (arg) => {
                this.MainNotebook.CurrentPage = 1;
            };

            this.KeyPressEvent += (o, args) => {
                if (args.Event.Key == Gdk.Key.F5)
                {
                    this.ToggleFullscreen();
                }
            };

            BooruApp.BooruApplication.EventCenter.Fullscreen(this.IsFullscreen);
        }
Пример #2
0
        void Build()
        {
            global::Stetic.BinContainer.Attach(this);
            var builder = new Gtk.Builder(null, "ServerListWidget.ui", null);

            builder.Autoconnect(this);
            var box = (Gtk.Widget)builder.GetObject("ServerListBox");

            Add(box);
        }
Пример #3
0
        private SplashScreen(Gtk.Builder builder) : base(builder.GetObject("SplashScreen").Handle)
        {
            builder.Autoconnect(this);

            DeleteEvent += Window_DeleteEvent;

            _alienEngineSplash.Pixbuf = new Gdk.Pixbuf(typeof(Program).Assembly, "Windows.Resources.Images.AlienEngineSplash");

            ShowAll();
        }
Пример #4
0
        private OutputWidget(Gtk.Builder builder, IntPtr handle) : base(handle)
        {
            this._builder = builder;
            builder.Autoconnect(this);

            _output.Buffer         = new Gtk.TextBuffer(new Gtk.TextTagTable());
            _output.SizeAllocated += (o, args) =>
            {
                this.Vadjustment.Value = this.Vadjustment.Upper - this.Vadjustment.PageSize;
            };
        }
Пример #5
0
        public PreferencesDialog(Gtk.Window parent, Gtk.Builder builder, IntPtr handle) :
            base(handle)
        {
            Trace.Call(parent, builder, handle);

            if (parent == null)
            {
                throw new ArgumentNullException("parent");
            }
            if (builder == null)
            {
                throw new ArgumentNullException("builder");
            }
            if (handle == IntPtr.Zero)
            {
                throw new ArgumentException("handle", "handle must not be zero.");
            }

            Parent       = parent;
            TransientFor = parent;
            Builder      = builder;
            Builder.Autoconnect(this);
            f_CategoryNotebook.ShowTabs     = false;
            f_ConnectionToggleButton.Active = true;
            // not implemented
            f_InternalSettingsToolbar.NoShowAll = true;
            f_InternalSettingsToolbar.Visible   = false;

            // Filters
            FilterListWidget = new FilterListWidget(parent, Frontend.UserConfig);
            // REMOTING CALL
            FilterListWidget.InitProtocols(Frontend.Session.GetSupportedProtocols());
            FilterListWidget.Load();
            f_FilterListBox.Add(FilterListWidget);

            // Servers
            ServerListView = new ServerListView(parent);
            ServerListView.Load();
            f_ServerListBox.Add(ServerListView);

            Init();
            ReadFromConfig();

            ShowAll();
        }
Пример #6
0
 protected LoadableWidget(Gtk.Builder builder, IntPtr handle) : base(handle)
 {
     builder.Autoconnect(this);
 }
Пример #7
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);
            });
        }