Exemple #1
0
        /// <summary>
        /// Function to initialize the content editor.
        /// </summary>
        /// <returns>
        /// A control to place in the primary interface window.
        /// </returns>
        protected override ContentPanel OnInitialize()
        {
            _panel = new GorgonFontContentPanel(this, GetRawInput());

            _swap = Graphics.Output.CreateSwapChain("FontEditor.SwapChain", new GorgonSwapChainSettings
            {
                Window = _panel.panelTextures,
                Format = BufferFormat.R8G8B8A8_UIntNormal
            });

            Renderer = Graphics.Output.Create2DRenderer(_swap);

            _textDisplay = Graphics.Output.CreateSwapChain("FontEditor.TextDisplay", new GorgonSwapChainSettings
            {
                Window = _panel.panelText,
                Format = BufferFormat.R8G8B8A8_UIntNormal
            });

            // If the font needs to be created, do so now.
            if (_createFont)
            {
                Font      = Graphics.Fonts.CreateFont(Name, _settings);
                _settings = Font.Settings.Clone();
            }

            _panel.CreateResources();
            CurrentState = DrawState.DrawFontTextures;

            return(_panel);
        }
Exemple #2
0
        /// <summary>
        /// Releases unmanaged and - optionally - managed resources.
        /// </summary>
        /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
        protected override void Dispose(bool disposing)
        {
            if (!_disposed)
            {
                if (disposing)
                {
                    // Save our settings.
                    GorgonFontEditorPlugIn.Settings.Save();

                    if (_badGlyphTexture != null)
                    {
                        _badGlyphTexture.Dispose();
                    }

                    // Remove any externally linked dependencies.
                    EditorFile = null;

                    if (Font != null)
                    {
                        Font.Dispose();
                    }

                    if (Renderer != null)
                    {
                        Renderer.Dispose();
                    }

                    if (_textDisplay != null)
                    {
                        _textDisplay.Dispose();
                    }

                    if (_swap != null)
                    {
                        _swap.Dispose();
                    }
                }

                _swap        = null;
                Renderer     = null;
                Font         = null;
                _panel       = null;
                _textDisplay = null;
                _disposed    = true;
            }

            base.Dispose(disposing);
        }