Exemple #1
0
 private void AlterBackgroud(DrawEventArgs e)
 {
     if (e.Node == m_selectedNodeView && m_selectedNodeView != debugTreeView.SelectedNode)
     {
         e.BackgroundBrush = Brushes.Gold;
     }
 }
		void _nodeTextBox_DrawText(object sender, DrawEventArgs e)
		{
            if ((e.Node.Tag as MyNode).Text.StartsWith("Child"))
            {
                e.TextColor = Color.Red;
                e.Font = _childFont;
            }
		}
        protected override void OnDrawText(DrawEventArgs args)
        {
            base.OnDrawText(args);

            var node = args.Node.Tag as FileNode;
            if (node == null || node.Exists)
                return;

            args.TextColor = Color.Red;
        }
		protected override void OnDrawText(DrawEventArgs args)
		{
			TreeNode content = ((TreeViewVarNode)args.Node).Content;
			if (content is ExpressionNode && ((ExpressionNode)content).Error != null) {
				args.TextColor = Color.Red;
			} else if (((TreeViewVarNode)args.Node).TextChanged) {
				args.TextColor = Color.Blue;
			}
			base.OnDrawText(args);
		}
Exemple #5
0
        private static void AlterText(DrawEventArgs e)
        {
            if (e.Node.Tag is MyDebugNode)
            {
                IMyExecutable executable = (e.Node.Tag as MyDebugNode).Executable;
                if (executable is MyExecutionBlock)
                {
                    e.Font = new Font(e.Font, FontStyle.Bold);
                }

                if (!executable.Enabled)
                {
                    e.TextColor = SystemColors.GrayText;
                }
            }
        }
        public void If_test_status_is_Skipped_text_should_be_failed_color()
        {
            var skippedColor = Color.Khaki;
            var nodeTextBox = new TestTestNodeTextBox
            {
                SkippedColor = skippedColor
            };
            var treeNode = new TestTreeNode("id", "text")
            {
                TestStatus = TestStatus.Skipped
            };
            var eventArgs = new DrawEventArgs(new TreeNodeAdv(treeNode),
                nodeTextBox, new DrawContext(), "text");

            nodeTextBox.TestOnDrawText(eventArgs);

            Assert.AreEqual(skippedColor, eventArgs.TextColor);
        }
        public void If_test_status_is_Passed_text_should_be_passed_color()
        {
            var passedColor = Color.Firebrick;
            var nodeTextBox = new TestTestNodeTextBox
            {
                PassedColor = passedColor
            };
            var treeNode = new TestTreeNode("id", "text")
            {
                TestStatus = TestStatus.Passed
            };
            var eventArgs = new DrawEventArgs(new TreeNodeAdv(treeNode), 
                nodeTextBox, new DrawContext(), "text");

            nodeTextBox.TestOnDrawText(eventArgs);

            Assert.AreEqual(passedColor, eventArgs.TextColor);
        }
Exemple #8
0
        private void tree_DrawControl(object sender, Aga.Controls.Tree.NodeControls.DrawEventArgs e)
        {
            var item         = e.Node.Tag as BaseItem;
            var groupItem    = item as GroupItem;
            var regGroupItem = item as RegisterGroupItem;
            var registerItem = item as RegisterItem;
            var fieldItem    = item as FieldItem;
            var control      = e.Control as BindableControl;

            if (item == null || control == null)
            {
                return;
            }

            switch (control.DataPropertyName)
            {
            case "Bin":
                e.Text      = item.FormatBin();
                e.TextColor = (item.Changed) ? System.Drawing.Color.Red : System.Drawing.SystemColors.ControlText;
                break;

            case "Hex":
                e.Text      = item.FormatHex();
                e.TextColor = (item.Changed) ? System.Drawing.Color.Red : System.Drawing.SystemColors.ControlText;
                break;

            case "Reset":
                e.Text = item.FormatReset();
                break;

            case "Address":
                e.Text = item.FormatAddress();
                break;

            case "Description":
                if (fieldItem != null)
                {
                    e.Text = fieldItem.Interpretation();
                }
                break;
            }
        }
Exemple #9
0
        private void DetailNodeControl_DrawText(object sender, DrawEventArgs e)
        {
            if (e.TextColor != SystemColors.ControlText)
            {
                return;
            }

            TreeItemBase tib = ((TreeItemBase)e.Node.Tag);
            ChangeType change = tib.GetItemAt(_assemblyIndex).Change;

            if (ChangeTypeUtil.HasBreaking(change))
            {
                e.TextColor = Color.Red;
            }
            else if (change == ChangeType.Added)
            {
                e.TextColor = Color.Green;
            }
            else if (tib.GetItemAt(0).GetStrongestFilterStatus() < FilterStatus.DontCare)
            {
                e.TextColor = Color.LightGray;
            }
        }
        private void AssemblyGroupNodeControl_DrawText(object sender, DrawEventArgs e)
        {
            if (e.TextColor != SystemColors.ControlText)
            {
                return;
            }

            AssemblyGroup grp = ((AssemblyGroupTreeItem)e.Node.Tag).Group;

            e.TextColor = Color.Gray;

            if (grp.HasErrors)
            {
                e.TextColor = Color.LightGray;
            }
            else if (ChangeTypeUtil.HasBreaking(grp.Change))
            {
                e.TextColor = Color.Red;
            }
            else if (ChangeTypeUtil.HasNonBreaking(grp.Change))
            {
                e.TextColor = Color.Black;
            }
        }
Exemple #11
0
 private void nodeTextBox2_DrawText(object sender, DrawEventArgs e)
 {
     AlterText(e);
     AlterBackgroud(e);
 }
 void NameNodeTextBox_DrawText(object sender, DrawEventArgs e)
 {
     Color grayText = PluginBase.MainForm.GetThemeColor("DataTreeControl.GrayText", SystemColors.GrayText);
     Color hiliteText = PluginBase.MainForm.GetThemeColor("DataTreeControl.HighlightText", SystemColors.HighlightText);
     e.TextColor = PluginBase.MainForm.GetThemeColor("DataTreeControl.ForeColor", SystemColors.WindowText);
     if (e.Node.IsSelected && this.ContainsFocus) e.TextColor = hiliteText;
     try
     {
         if (e.Node.Tag is ErrorNode) e.TextColor = e.Node.IsSelected ? hiliteText : grayText;
     }
     catch (Exception) { }
 }
 void nodeTextBox_DrawText(object sender, DrawEventArgs e)
 {
     if (String.IsNullOrEmpty(((e.Node.Tag as Node).Tag as NavDetails).ContentSrc)
         || ((e.Node.Tag as Node).Tag as NavDetails).ContentSrc.StartsWith("#"))
     {
         e.TextColor = Color.Red;
     }
 }
 void ValueNodeTextBox_DrawText(object sender, DrawEventArgs e)
 {
     try
     {
         VariableNode variableNode = e.Node.Tag as VariableNode;
         if (variableNode != null)
         {
             FlashInterface flashInterface = PluginMain.debugManager.FlashInterface;
             if (variableNode.Variable != null && variableNode.Variable.hasValueChanged(flashInterface.Session)) 
             {
                 e.TextColor = Color.Red;
             }
         }
         else if (e.Node.Tag is ErrorNode)
         {
             e.TextColor = e.Node.IsSelected ? Color.White : Color.Gray;
         }
     }
     catch (NullReferenceException) {}
 }
		protected Font GetDrawingFont(TreeNodeAdv node, DrawContext context, string label)
		{
			Font font = context.Font;
			if (DrawTextMustBeFired(node))
			{
				DrawEventArgs args = new DrawEventArgs(node, this, context, label);
				args.Font = context.Font;
				OnDrawText(args);
				font = args.Font;
			}
			return font;
		}
		protected virtual void OnDrawText(DrawEventArgs args)
		{
			TreeViewAdv tree = args.Node.Tree;
			if (tree != null)
				tree.FireDrawControl(args);
			if (DrawText != null)
				DrawText(this, args);
		}
 void ValueNodeTextBox_DrawText(object sender, DrawEventArgs e)
 {
     Color grayText = PluginBase.MainForm.GetThemeColor("DataTreeControl.GrayText", SystemColors.GrayText);
     Color errorText = PluginBase.MainForm.GetThemeColor("DataTreeControl.ErrorText", Color.Red);
     Color hiliteText = PluginBase.MainForm.GetThemeColor("DataTreeControl.HighlightText", SystemColors.HighlightText);
     e.TextColor = PluginBase.MainForm.GetThemeColor("DataTreeControl.ForeColor", SystemColors.WindowText);
     if (e.Node.IsSelected && this.ContainsFocus) e.TextColor = hiliteText;
     try
     {
         VariableNode variableNode = e.Node.Tag as VariableNode;
         if (variableNode != null)
         {
             FlashInterface flashInterface = PluginMain.debugManager.FlashInterface;
             if (variableNode.Variable != null && variableNode.Variable.hasValueChanged(flashInterface.Session)) 
             {
                 e.TextColor = errorText;
             }
         }
         else if (e.Node.Tag is ErrorNode)
         {
             e.TextColor = e.Node.IsSelected ? hiliteText : grayText;
         }
     }
     catch (NullReferenceException) {}
 }
        public void If_test_status_is_Inconclusive_text_should_be_inconclusive_color()
        {
            var inconclusiveColor = Color.Magenta;
            var nodeTextBox = new TestTestNodeTextBox
            {
                InconclusiveColor = inconclusiveColor
            };
            var treeNode = new TestTreeNode("id", "text")
            {
                TestStatus = TestStatus.Inconclusive
            };
            var eventArgs = new DrawEventArgs(new TreeNodeAdv(treeNode),
                nodeTextBox, new DrawContext(), "text");

            nodeTextBox.TestOnDrawText(eventArgs);

            Assert.AreEqual(inconclusiveColor, eventArgs.TextColor);
        }
 public void TestOnDrawText(DrawEventArgs args)
 {
     base.OnDrawText(args);
 }
		protected virtual void OnDrawText(DrawEventArgs args)
		{
			if (DrawText != null)
				DrawText(this, args);
		}
        public void If_node_is_not_test_node_then_nothing_should_happen()
        {
            var color = Color.SandyBrown;
            var nodeTextBox = new TestTestNodeTextBox();
            var eventArgs = new DrawEventArgs(new TreeNodeAdv(new Node("text")), 
                nodeTextBox, new DrawContext(), "text")
            {
                TextColor = color
            };

            nodeTextBox.TestOnDrawText(eventArgs);

            Assert.AreEqual(color, eventArgs.TextColor);
        }
Exemple #22
0
        protected virtual void CreateBrushes(TreeNodeAdv node, DrawContext context, string text,
                                             out Brush backgroundBrush, out Color textColor, out Font font,
                                             ref string label)
        {
            textColor = SystemColors.ControlText;
            backgroundBrush = null;
            font = context.Font;

            var n = (Node) node.Tag;
            if (n.ForeColorSet)
                textColor = n.ForeColor;
            if (n.BoldSet && n.Bold)
                font = new Font(font, FontStyle.Bold);


            switch (context.DrawSelection)
            {
                case DrawSelectionMode.Inactive:
                case DrawSelectionMode.Active:
                    if (!n.IsCategoryNode)
                    {
                        textColor = SystemColors.HighlightText;
                        backgroundBrush = SystemBrushes.Highlight;
                    }
                    break;
                case DrawSelectionMode.FullRowSelect:
                    if (!n.IsCategoryNode) textColor = SystemColors.HighlightText;
                    break;
                default:
                    if (n.Brush != null)
                        backgroundBrush = n.Brush;
                    break;
            }
            if (!context.Enabled)
                textColor = SystemColors.GrayText;

            if (DrawTextMustBeFired(node))
            {
                var args = new DrawEventArgs(node, this, context, text);
                args.Text = label;
                args.TextColor = textColor;
                args.BackgroundBrush = backgroundBrush;
                args.Font = font;

                OnDrawText(args);

                textColor = args.TextColor;
                backgroundBrush = args.BackgroundBrush;
                font = args.Font;
                label = args.Text;
            }

            //font = new Font(context.Font.Name, context.Font.Size + 5.0F, context.Font.Style, context.Font.Unit);
            //context.Font = font;
        }
        private void _nodeTextBox_DrawText(object sender, DrawEventArgs e)
        {
            // Grey out ids that are present that no longer have an item.
            FavouritesNode node = (e.Node.Tag as FavouritesNode);
            if (node == null) return;

            if (!node.IsFolder && node.Item == null)
            {
                e.TextColor = Color.Gray;
            }
        }
 void ValueNodeTextBox_DrawText(object sender, DrawEventArgs e)
 {
     try
     {
         DataNode node = e.Node.Tag as DataNode;
         FlashInterface flashInterface = PluginMain.debugManager.FlashInterface;
         if (node.Variable != null && node.Variable.hasValueChanged(flashInterface.Session))
         {
             e.TextColor = Color.Red;
         }
     }
     catch (NullReferenceException) { }
 }
Exemple #25
0
		internal void FireDrawControl(DrawEventArgs args)
		{
			OnDrawControl(args);
		}
 private void nodeTextBoxText_DrawText(object sender, DrawEventArgs e)
 {
     Node node = e.Node.Tag as Node;
       if (node != null) {
     Color color;
     if (node.IsVisible) {
       SensorNode sensorNode = node as SensorNode;
       if (plotMenuItem.Checked && sensorNode != null &&
     sensorPlotColors.TryGetValue(sensorNode.Sensor, out color))
     e.TextColor = color;
     } else {
       e.TextColor = Color.DarkGray;
     }
       }
 }
Exemple #27
0
		protected virtual void OnDrawControl(DrawEventArgs args)
		{
			if (DrawControl != null)
				DrawControl(this, args);
		}
		private void CreateBrushes(TreeNodeAdv node, DrawContext context, string text, out Brush backgroundBrush, out Color textColor, out Font font, ref string label)
		{
			textColor = SystemColors.ControlText;
			backgroundBrush = null;
			font = context.Font;
			if (context.DrawSelection == DrawSelectionMode.Active)
			{
				textColor = SystemColors.HighlightText;
                backgroundBrush = SystemBrushes.Highlight;
			}
			else if (context.DrawSelection == DrawSelectionMode.Inactive)
			{
				textColor = SystemColors.ControlText;
                backgroundBrush = SystemBrushes.InactiveBorder;
			}
			else if (context.DrawSelection == DrawSelectionMode.FullRowSelect)
				textColor = SystemColors.ControlText;

			if (!context.Enabled)
				textColor = SystemColors.GrayText;

			if (DrawTextMustBeFired(node))
			{
				DrawEventArgs args = new DrawEventArgs(node, this, context, text);
				args.Text = label;
				args.TextColor = textColor;
				args.BackgroundBrush = backgroundBrush;
				args.Font = font;

				OnDrawText(args);

				textColor = args.TextColor;
				backgroundBrush = args.BackgroundBrush;
				font = args.Font;
				label = args.Text;
			}
		}
        void NameNodeTextBox_DrawText(object sender, DrawEventArgs e)
        {
            try
            {
                if (e.Node.NextNode == null && e.Node.Level == 1 && !addingNewExpression) e.Font = new Font(e.Font, FontStyle.Italic);
                else if (e.Node.Tag is ErrorNode) e.TextColor = e.Node.IsSelected ? Color.White : Color.Gray;

            }
            catch (Exception) { }
        }
		void ValueNodeTextBox_DrawText(object sender, DrawEventArgs e)
		{
            try
            {
                DataNode node = e.Node.Tag as DataNode;
                if (node.Variable != null && node.Variable.hasValueChanged())
                {
                    e.TextColor = Color.Red;
                }
            }
            catch (NullReferenceException) { }
		}
Exemple #31
0
 private void nodeTextBoxText_DrawText(object sender, DrawEventArgs e)
 {
     Node node = e.Node.Tag as Node;
     if (node != null)
     {
         if (node.IsVisible)
         {
             e.TextColor = Color.Black;
         }
         else
         {
             e.TextColor = Color.DarkGray;
         }
     }
 }