// Copy ctor.
 public ColoringRule(ColoringRule source)
 {
     Name         = source.Name;
     Enabled      = source.Enabled;
     TextColor    = source.TextColor;
     BackColor    = source.BackColor;
     ContainsText = source.ContainsText;
     LacksText    = source.LacksText;
     MatchCase    = source.MatchCase;
     MatchType    = source.MatchType;
     Fields       = source.Fields;
 }
Exemple #2
0
        // Make a ListViewItem from a Row object.
        public ViewItem MakeItem(Row previousRow)
        {
            ColorPair itemColors = null;

            if (Settings.Default.ColoringEnabled)
            {
                switch (ColorUtil.RowColorDriver)
                {
                case ColorDriver.Custom:
                    ColoringRule rule = MatchColoringRule();
                    if (rule != null)
                    {
                        itemColors = new ColorPair(rule.BackColor, rule.TextColor);
                    }
                    break;

                case ColorDriver.TraceLevels:
                    itemColors = Rec.TLevel.RowColors;
                    break;

                case ColorDriver.ThreadIDs:
                    itemColors = Rec.Thread.RowColors;
                    break;

                case ColorDriver.Sessions:
                    itemColors = Rec.Session.RowColors;
                    break;

                case ColorDriver.ThreadNames:
                    itemColors = Rec.ThreadName.RowColors;
                    break;

                case ColorDriver.Loggers:
                    itemColors = Rec.Logger.RowColors;
                    break;

                case ColorDriver.Methods:
                    if (Rec.MethodName.RowColors != null)
                    {
                        itemColors = Rec.MethodName.RowColors;
                    }
                    else if (ColorRulesDialog.ColorCalledMethods)
                    {
                        Record caller = Rec.Caller;

                        while (caller != null)
                        {
                            if (caller.MethodName.RowColors != null)
                            {
                                itemColors = caller.MethodName.RowColors;
                                break;
                            }

                            caller = caller.Caller;
                        }
                    }

                    break;
                }
            }

            ViewItem item = new ViewItem(MakeSubItems(previousRow, itemColors), ImageIndex);

            item.UseItemStyleForSubItems = false;

            if (itemColors != null)
            {
                item.BColor = itemColors.BackColor;
                item.FColor = itemColors.ForeColor;
            }

            item.Row = this;
            item.Tag = this;

            return(item);
        }