Пример #1
0
        void handleChange(WorkingDocument workingDoc)
        {
            var drawable = _designerDrawables[workingDoc.Document];

            foreach (var child in this)
            {
                if (child != drawable)
                {
                    child.Hide();
                }
            }

            drawable.ClearTransforms();
            drawable.Show();
        }
Пример #2
0
        public void CloseDocument(WorkingDocument workingDoc)
        {
            if (!_designerDrawables.TryGetValue(workingDoc.Document, out var drawable))
            {
                throw new KeyNotFoundException($"Document '{workingDoc}' is not open.");
            }

            _tabControl.RemoveItem(workingDoc);

            drawable
            .FadeOut(duration: 200)
            .Expire();

            _designerDrawables.Remove(workingDoc.Document);
        }
Пример #3
0
            public DocumentTabItem(WorkingDocument value) : base(value)
            {
                Add(_syncIndicator = new DrawableSyncIndicator
                {
                    Anchor = Anchor.CentreLeft,
                    Origin = Anchor.CentreLeft,
                    Size   = new Vector2(10),
                    Margin = new MarginPadding
                    {
                        Left = 6
                    },
                    SaveAction = value.Save
                });

                _lastWriteTime = value.Document.LastWriteTime.GetBoundCopy();
                _lastWriteTime.BindValueChanged(handleWrite, runOnceImmediately: true);

                _content = value.Content.GetBoundCopy();
                _content.BindValueChanged(handleChange);
            }
Пример #4
0
        void load(WorkingDocument doc)
        {
            InternalChildren = new Drawable[]
            {
                new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = Color4.Black
                },
                _content = new Container
                {
                    AutoSizeAxes = Axes.Both,
                    Masking      = true,
                    Anchor       = Anchor.Centre,
                    Origin       = Anchor.Centre
                },
                _errorDisplay = new ParserErrorDisplay
                {
                    RelativeSizeAxes = Axes.Both,
                    Height           = 0.8f,
                    Anchor           = Anchor.BottomLeft,
                    Origin           = Anchor.BottomLeft
                },
                _statusText = new SpriteText
                {
                    Anchor   = Anchor.BottomRight,
                    Origin   = Anchor.BottomRight,
                    TextSize = 18,
                    Font     = "Inconsolata",
                    Shadow   = true,
                    Text     = "Waiting..."
                }
            };

            _error = _errorDisplay.Current.GetBoundCopy();

            _documentContent = doc.Content.GetBoundCopy();
            _documentContent.BindValueChanged(handleChange, true);
        }
Пример #5
0
 public DrawableDesigner(WorkingDocument doc)
 {
     WorkingDocument = doc;
 }