Exemplo n.º 1
0
 internal void UpdatePBT()
 {
     TreeContainer.Clear();
     if (RootTask != null)
     {
         TreeContainer.Add(new PBTTaskTreeControl(glGui, this, null, RootTask));
     }
     else
     {
         TreeContainer.Add(new PBTTaskBrowserForm(glGui, this, task => { RootTask = task; UpdatePBT(); }, true, false));
     }
 }
Exemplo n.º 2
0
        internal void ShowPBT(string name)
        {
            string path = Path.Combine(pbtSearchPath, name + ".pbt");

            RootTask = Data.PBT.Deserialize(path, TaskTypes);

            UpdatePBT();

            currentPBTName = name;
            Parent.Text    = "PBT Editor - " + currentPBTName;
            reload.Enabled = true;
            save.Enabled   = true;
        }
Exemplo n.º 3
0
        private void InsertAbove(Data.Task task)
        {
            var parentTaskTreeControl = TaskTreeControl.ParentTaskTreeControl;

            if (parentTaskTreeControl != null)
            {
                int position = parentTaskTreeControl.Subtrees.IndexOf(TaskTreeControl);
                parentTaskTreeControl.TaskControl.Task.Subtasks[position] = task;
            }
            else
            {
                Editor.RootTask = task;
            }
            task.Subtasks.Add(Task);
            Editor.UpdatePBT();
        }
Exemplo n.º 4
0
        public PBTDescriptionForm(GLGui gui, GLLabel descriptionLabel, Data.Task task)
            : base(gui)
        {
            this.task             = task;
            this.descriptionLabel = descriptionLabel;

            Title   = task.TaskType.Name + " Description";
            SizeMin = Size = new Size(200, 100);

            var descriptionBackup = task.Description;

            var text = Add(new GLTextBox(gui)
            {
                Text      = task.Description ?? "",
                Location  = new Point(4, 4),
                AutoSize  = false,
                Multiline = true,
                WordWrap  = true,
                Size      = new Size(InnerWidth - 8, InnerHeight - 27),
                Anchor    = GLAnchorStyles.All
            });

            text.Changed += (s, e) => descriptionLabel.Text = task.Description = text.Text;

            var ok = Add(new GLButton(gui)
            {
                Text     = "OK",
                Location = new Point(4, InnerHeight - 18),
                Anchor   = GLAnchorStyles.Bottom | GLAnchorStyles.Left
            });

            ok.Click += (s, e) => { if (text.Text == "")
                                    {
                                        task.Description = null;
                                    }
                                    Parent.Remove(this); };

            var abort = Add(new GLButton(gui)
            {
                Text     = "Abort",
                Location = new Point(InnerWidth - 79, InnerHeight - 19),
                Anchor   = GLAnchorStyles.Bottom | GLAnchorStyles.Right
            });

            abort.Click += (s, e) => { descriptionLabel.Text = (task.Description = descriptionBackup) ?? ""; Parent.Remove(this); };
        }
Exemplo n.º 5
0
        public PBTTaskControl(GLGui gui, PBTEditorControl editor, PBTTaskTreeControl taskTreeControl, Data.Task task)
            : base(gui)
        {
            Editor          = editor;
            TaskTreeControl = taskTreeControl;
            Task            = task;

            AutoSize      = true;
            FlowDirection = GLFlowDirection.TopDown;
            var skin = Skin;

            skin.Border          = new GLPadding(1);
            skin.BorderColor     = Color.FromArgb(32, 32, 32);
            skin.BackgroundColor = Color.FromArgb(48, 48, 48);
            Skin = skin;

            LoadCommon();

            AddContextMenu();
            AddContent();
        }
Exemplo n.º 6
0
 private void InsertBelow(int position, Data.Task task)
 {
     Task.Subtasks.Insert(position, task);
     Editor.UpdatePBT();
 }
Exemplo n.º 7
0
        public PBTTaskTreeControl(GLGui gui, PBTEditorControl editor, PBTTaskTreeControl parentTaskTreeControl, Data.Task task)
            : base(gui)
        {
            Editor = editor;
            ParentTaskTreeControl = parentTaskTreeControl;
            Render           += OnRender;
            HandleMouseEvents = false;
            AutoSize          = true;
            TaskControl       = Add(new PBTTaskControl(gui, editor, this, task));

            horizontalFlow = Add(new GLGroupLayout(gui)
            {
                AutoSize          = true,
                HandleMouseEvents = false,
                Location          = new Point(0, TaskControl.Height + VSpace)
            });

            foreach (var subtask in task.Subtasks)
            {
                Subtrees.Add(horizontalFlow.Add(new PBTTaskTreeControl(gui, editor, this, subtask)));
            }
        }