예제 #1
0
 void load()
 {
     Child = new HalvedContainer(
         Direction.Horizontal,
         _browser = new WorkspaceBrowser
     {
         RelativeSizeAxes = Axes.X,
         Width            = 0.2f,
         OpenDocument     = d => _designer.SelectDocument(d)
     },
         _designer = new DesignerWindow()
         )
     {
         RelativeSizeAxes = Axes.Both
     };
 }
예제 #2
0
        void load()
        {
            // Working document for all components of this designer
            _dependencies.Cache(WorkingDocument);

            if (WorkingDocument.Document.Type == DocumentType.Unknown)
            {
                InternalChild = new SpriteText
                {
                    Anchor   = Anchor.Centre,
                    Origin   = Anchor.Centre,
                    Text     = $"osu!design does not support editing of file type '{WorkingDocument.Document.File.Extension}'.",
                    TextSize = 18,
                    Font     = "Inconsolata"
                };
                return;
            }

            Drawable editorContainer = new Container
            {
                Children = new Drawable[]
                {
                    new Box
                    {
                        RelativeSizeAxes = Axes.Both,
                        Colour           = DesignerColours.Editor
                    },
                    _editor = new DrawableEditor
                    {
                        RelativeSizeAxes = Axes.Both
                    }
                }
            };

            switch (WorkingDocument.Document.Type)
            {
            case DocumentType.osuML:
                editorContainer = new HalvedContainer(
                    Direction.Vertical,
                    _preview = new PreviewContainer
                {
                    RelativeSizeAxes = Axes.Y,
                    Height           = 0.4f
                },
                    editorContainer
                    );

                _editor.SyntaxHighlighter.Value = new XMLSyntaxHighlighter();
                break;

            case DocumentType.XML:
                _editor.SyntaxHighlighter.Value = new XMLSyntaxHighlighter();
                break;

            case DocumentType.CSharp:
                _editor.SyntaxHighlighter.Value = new CSharpSyntaxHighlighter();
                break;
            }

            editorContainer.RelativeSizeAxes = Axes.Both;
            InternalChild = editorContainer;

            _editor.Current.BindTo(WorkingDocument.Content);
        }