Пример #1
0
        public void Refresh()
        {
            // GUI assert here is to catch Bug 434065 - Exception while going to the editor
            DispatchService.AssertGuiThread();

            if (toolboxService.Initializing)
            {
                toolboxWidget.CustomMessage = GettextCatalog.GetString("Initializing...");
                return;
            }

            toolboxWidget.CustomMessage = null;

            categories.Clear();
            AddItems(toolboxService.GetCurrentToolboxItems());

            Drag.SourceUnset(toolboxWidget);
            toolboxWidget.ClearCategories();
            foreach (Category category in categories.Values)
            {
                category.IsExpanded = true;
                toolboxWidget.AddCategory(category);
            }
            toolboxWidget.QueueResize();
            Gtk.TargetEntry[] targetTable = toolboxService.GetCurrentDragTargetTable();
            if (targetTable != null)
            {
                Drag.SourceSet(toolboxWidget, Gdk.ModifierType.Button1Mask, targetTable, Gdk.DragAction.Copy | Gdk.DragAction.Move);
            }
            compactModeToggleButton.Visible = toolboxWidget.CanIconizeToolboxCategories;
        }
Пример #2
0
        public void Refresh()
        {
            // GUI assert here is to catch Bug 434065 - Exception while going to the editor
            Runtime.AssertMainThread();

            if (toolboxService.Initializing)
            {
                SetCustomMessage(GettextCatalog.GetString("Initializing..."));
                return;
            }

            ConfigureToolbar();

            SetCustomMessage(null);

            toolboxWidget.ClearImageCache();

            categories.Clear();

            AddItems(toolboxService.GetCurrentToolboxItems());

            DragSourceUnset?.Invoke(this, EventArgs.Empty);

            Gtk.TargetEntry [] targetTable = toolboxService.GetCurrentDragTargetTable();
            if (targetTable != null)
            {
                DragSourceSet?.Invoke(this, targetTable);
            }

            Refilter(true);

            compactModeToggleButton.Hidden = !toolboxWidget.CanIconizeToolboxCategories;
            compactModeToggleButton.InvalidateIntrinsicContentSize();
            keyViewLoopDelegate.RecalculeNextResponderChain();

            if (categories.Count == 0)
            {
                SetCustomMessage(GettextCatalog.GetString("There are no tools available for the current document."));
            }
        }
Пример #3
0
        public void Refresh()
        {
            // GUI assert here is to catch Bug 434065 - Exception while going to the editor
            Runtime.AssertMainThread();

            if (toolboxService.Initializing)
            {
                toolboxWidget.CustomMessage = GettextCatalog.GetString("Initializing...");
                return;
            }

            ConfigureToolbar();

            toolboxWidget.CustomMessage = null;

            categories.Clear();
            AddItems(toolboxService.GetCurrentToolboxItems());

            Drag.SourceUnset(toolboxWidget);
            toolboxWidget.ClearCategories();

            var cats = categories.Values.ToList();

            cats.Sort((a, b) => a.Priority != b.Priority ? a.Priority.CompareTo(b.Priority) : a.Text.CompareTo(b.Text));
            cats.Reverse();
            foreach (Category category in cats)
            {
                category.IsExpanded = true;
                toolboxWidget.AddCategory(category);
            }
            toolboxWidget.QueueResize();
            Gtk.TargetEntry[] targetTable = toolboxService.GetCurrentDragTargetTable();
            if (targetTable != null)
            {
                Drag.SourceSet(toolboxWidget, Gdk.ModifierType.Button1Mask, targetTable, Gdk.DragAction.Copy | Gdk.DragAction.Move);
            }
            compactModeToggleButton.Visible = toolboxWidget.CanIconizeToolboxCategories;
            refilter();
        }