Beispiel #1
0
        /// <inheritdoc />
        public override void Dispose()
        {
            _foldersSearchBox = null;
            _itemsSearchBox   = null;
            _itemsFilterBox   = null;

            base.Dispose();
        }
Beispiel #2
0
        /// <inheritdoc />
        public override void OnDestroy()
        {
            _foldersSearchBox = null;
            _itemsSearchBox   = null;
            _itemsFilterBox   = null;

            base.OnDestroy();
        }
Beispiel #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ContentWindow"/> class.
        /// </summary>
        /// <param name="editor">The editor.</param>
        public ContentWindow(Editor editor)
            : base(editor, true, ScrollBars.None)
        {
            Title = "Content";

            // Content database events
            editor.ContentDatabase.OnWorkspaceModified += () => _isWorkspaceDirty = true;
            editor.ContentDatabase.ItemRemoved         += ContentDatabaseOnItemRemoved;

            // Tool strip
            _toolStrip    = new ToolStrip();
            _importButton = (ToolStripButton)_toolStrip.AddButton(Editor.Icons.Import32, () => Editor.ContentImporting.ShowImportFileDialog(CurrentViewFolder)).LinkTooltip("Import content");
            _toolStrip.AddSeparator();
            _navigateBackwardButton = (ToolStripButton)_toolStrip.AddButton(Editor.Icons.ArrowLeft32, NavigateBackward).LinkTooltip("Navigate backward");
            _navigateForwardButton  = (ToolStripButton)_toolStrip.AddButton(Editor.Icons.ArrowRight32, NavigateForward).LinkTooltip("Navigate forward");
            _nnavigateUpButton      = (ToolStripButton)_toolStrip.AddButton(Editor.Icons.ArrowUp32, NavigateUp).LinkTooltip("Navigate up");
            _toolStrip.Parent       = this;

            // Navigation bar
            _navigationBar = new NavigationBar
            {
                Parent = this
            };

            // Split panel
            _split = new SplitPanel(Orientation.Horizontal, ScrollBars.Both, ScrollBars.Vertical)
            {
                DockStyle     = DockStyle.Fill,
                SplitterValue = 0.2f,
                Parent        = this
            };

            // Content structure tree searching query input box
            var headerPanel = new ContainerControl();

            headerPanel.DockStyle    = DockStyle.Top;
            headerPanel.IsScrollable = true;
            headerPanel.Parent       = _split.Panel1;
            //
            _foldersSearchBox               = new TextBox(false, 4, 4, headerPanel.Width - 8);
            _foldersSearchBox.AnchorStyle   = AnchorStyle.Upper;
            _foldersSearchBox.WatermarkText = "Search...";
            _foldersSearchBox.Parent        = headerPanel;
            _foldersSearchBox.TextChanged  += OnFoldersSearchBoxTextChanged;
            //
            headerPanel.Height = _foldersSearchBox.Bottom + 6;

            // Content structure tree
            _tree   = new Tree(false);
            _tree.Y = headerPanel.Bottom;
            _tree.SelectedChanged += OnTreeSelectionChanged;
            _tree.Parent           = _split.Panel1;

            // Content items searching query input box and filters selector
            var contentItemsSearchPanel = new ContainerControl();

            contentItemsSearchPanel.DockStyle    = DockStyle.Top;
            contentItemsSearchPanel.IsScrollable = true;
            contentItemsSearchPanel.Parent       = _split.Panel2;
            //
            const float filterBoxWidth = 56.0f;

            _itemsSearchBox               = new TextBox(false, filterBoxWidth + 8, 4, contentItemsSearchPanel.Width - 8 - filterBoxWidth);
            _itemsSearchBox.AnchorStyle   = AnchorStyle.Upper;
            _itemsSearchBox.WatermarkText = "Search...";
            _itemsSearchBox.Parent        = contentItemsSearchPanel;
            _itemsSearchBox.TextChanged  += UpdateItemsSearch;
            //
            contentItemsSearchPanel.Height = _itemsSearchBox.Bottom + 4;
            //
            _itemsFilterBox        = new SearchFilterComboBox(4, (contentItemsSearchPanel.Height - ComboBox.DefaultHeight) * 0.5f, filterBoxWidth);
            _itemsFilterBox.Parent = contentItemsSearchPanel;
            _itemsFilterBox.SelectedIndexChanged += e => UpdateItemsSearch();
            _itemsFilterBox.SupportMultiSelect    = true;
            for (int i = 0; i <= (int)ContentItemSearchFilter.Other; i++)
            {
                _itemsFilterBox.Items.Add(((ContentItemSearchFilter)i).ToString());
            }

            // Content View
            _view                 = new ContentView();
            _view.OnOpen         += Open;
            _view.OnNavigateBack += NavigateBackward;
            _view.OnRename       += Rename;
            _view.OnDelete       += Delete;
            _view.OnDuplicate    += Clone;
            _view.OnPaste        += Paste;
            _view.Parent          = _split.Panel2;
        }