private Point RenderSubtree(PBTTaskTreeControl ttc, int x, int y, float scale) { // add offset if (ttc.Parent is GLGroupLayout) { x += ttc.Parent.X; y += ttc.Parent.Y; } x += ttc.X; y += ttc.Y; // draw box var tc = ttc.TaskControl; Rectangle border = new Rectangle( (int)((x + tc.X) * scale), (int)((y + tc.Y) * scale), (int)(tc.Width * scale), (int)(tc.Height * scale)); Rectangle content = new Rectangle(border.X + 1, border.Y + 1, border.Width - 2, border.Height - 2); var borderColor = tc.Skin.BorderColor; var contentColor = tc.Skin.BackgroundColor; GLDraw.FillRect(ref border, ref borderColor); GLDraw.FillRect(ref content, ref contentColor); //GLDraw.Text((GLFontText)typeof(GLLabel).GetField("textProcessed", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(tc.title), ref content, ref textColor); Point bottom = new Point(border.X, border.Y + border.Height); float dx = border.Width / (float)(ttc.Subtrees.Count + 1); // draw subtrees for (int i = 0; i < ttc.Subtrees.Count; i++) { bottom.X = border.X + (int)(dx + i * dx); lines.Add(new Tuple <Point, Point>(bottom, RenderSubtree(ttc.Subtrees[i], x, y, scale))); } return(new Point((int)(border.X + border.Width / 2.0), border.Y)); }
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(); }
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))); } }