Index: branches/GP.Grammar.Editor/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/SymbolicExpressionGrammarEditorView.cs
===================================================================
--- branches/GP.Grammar.Editor/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/SymbolicExpressionGrammarEditorView.cs	(revision 6387)
+++ branches/GP.Grammar.Editor/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/SymbolicExpressionGrammarEditorView.cs	(revision 6403)
@@ -159,4 +159,5 @@
       var tree = new SymbolicExpressionTree(new SymbolicExpressionTreeNode(symbol));
 
+      allowedChildSymbolsControl.SuspendRepaint = true;
       if (Content.GetMaximumSubtreeCount(symbol) > 0) {
         for (int i = 0; i < Content.GetMaximumSubtreeCount(symbol); i++) {
@@ -169,4 +170,33 @@
       }
       allowedChildSymbolsControl.Tree = tree;
+
+      foreach (var subtreeNode in tree.Root.Subtrees) {
+        foreach (var allowedChildNode in subtreeNode.Subtrees) {
+          var visualLine = allowedChildSymbolsControl.GetVisualSymbolicExpressionTreeNodeConnection(subtreeNode, allowedChildNode);
+          visualLine.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
+        }
+      }
+
+      for (int i = Content.GetMinimumSubtreeCount(symbol); i < Content.GetMaximumSubtreeCount(symbol); i++) {
+        var subtreeNode = tree.Root.GetSubtree(i);
+        var visualTreeNode = allowedChildSymbolsControl.GetVisualSymbolicExpressionTreeNode(subtreeNode);
+        visualTreeNode.TextColor = Color.Gray;
+        visualTreeNode.LineColor = Color.LightGray;
+
+        var visualLine = allowedChildSymbolsControl.GetVisualSymbolicExpressionTreeNodeConnection(tree.Root, subtreeNode);
+        visualLine.LineColor = Color.LightGray;
+
+        foreach (var allowedChildNode in subtreeNode.Subtrees) {
+          visualTreeNode = allowedChildSymbolsControl.GetVisualSymbolicExpressionTreeNode(allowedChildNode);
+          visualTreeNode.TextColor = Color.Gray;
+          visualTreeNode.LineColor = Color.LightGray;
+
+          visualLine = allowedChildSymbolsControl.GetVisualSymbolicExpressionTreeNodeConnection(subtreeNode, allowedChildNode);
+          visualLine.LineColor = Color.LightGray;
+        }
+      }
+
+      allowedChildSymbolsControl.SuspendRepaint = false;
+      allowedChildSymbolsControl.Repaint();
       UpdateSelectedSymbolicExpressionTreeNodes();
     }
@@ -216,5 +246,5 @@
       var symbol = data as ISymbol;
       var symbols = data as IEnumerable<ISymbol>;
-      if (symbol != null && !(symbol is IReadOnlySymbol) && !Content.ContainsSymbol(symbol)) validDragOperation = true;
+      if (symbol != null && !(symbol is IReadOnlySymbol) && Content.ContainsSymbol(symbol)) validDragOperation = true;
       else if (symbols != null && symbols.All(s => !(symbol is IReadOnlySymbol) && Content.ContainsSymbol(s))) validDragOperation = true;
     }
@@ -263,13 +293,65 @@
       foreach (var node in allowedChildSymbolsControl.Tree.IterateNodesPrefix()) {
         var visualNode = allowedChildSymbolsControl.GetVisualSymbolicExpressionTreeNode(node);
-        if (!selectedSymbolicExpressionTreeNodes.Contains(node)) {
-          visualNode.FillColor = Color.White;
-          visualNode.LineColor = Color.Black;
-        } else {
-          visualNode.FillColor = Color.WhiteSmoke;
-          visualNode.LineColor = Color.DarkOrange;
-        }
+        if (!selectedSymbolicExpressionTreeNodes.Contains(node)) visualNode.FillColor = Color.White;
+        else visualNode.FillColor = Color.LightSteelBlue;
+
       }
       allowedChildSymbolsControl.Repaint();
+    }
+
+    private RectangleF increaseMinimumSubtreeCountRectangle;
+    private RectangleF decreaseMinimumSubtreeCountRectangle;
+    private RectangleF increaseMaximumSubtreeCountRectangle;
+    private RectangleF decreaseMaximumSubtreeCountRectangle;
+    private void allowedChildSymbolsControl_Paint(object sender, PaintEventArgs e) {
+      increaseMinimumSubtreeCountRectangle = RectangleF.Empty;
+      decreaseMinimumSubtreeCountRectangle = RectangleF.Empty;
+      increaseMaximumSubtreeCountRectangle = RectangleF.Empty;
+      decreaseMaximumSubtreeCountRectangle = RectangleF.Empty;
+
+      if (Content == null) return;
+      if (allowedChildSymbolsControl.Tree == null) return;
+
+      var rootNode = allowedChildSymbolsControl.Tree.Root;
+      var visualRootNode = allowedChildSymbolsControl.GetVisualSymbolicExpressionTreeNode(rootNode);
+      var graphics = e.Graphics;
+
+      if (rootNode.Symbol is IReadOnlySymbol) return;
+      if (rootNode.Symbol.MinimumArity == rootNode.Symbol.MaximumArity) return;
+
+      using (Pen pen = new Pen(Color.Black)) {
+        using (Font font = new Font("Times New Roman", 8)) {
+          var stringFormat = new StringFormat();
+          stringFormat.Alignment = StringAlignment.Center;
+          stringFormat.LineAlignment = StringAlignment.Center;
+          int spacing = 5;
+          int size = (visualRootNode.Height - spacing * 3) / 2;
+
+          increaseMinimumSubtreeCountRectangle = new RectangleF(visualRootNode.X - spacing - size, visualRootNode.Y + spacing, size, size);
+          decreaseMinimumSubtreeCountRectangle = new RectangleF(visualRootNode.X - spacing - size, visualRootNode.Y + size + 2 * spacing, size, size);
+          increaseMaximumSubtreeCountRectangle = new RectangleF(visualRootNode.X + visualRootNode.Width + spacing, visualRootNode.Y + spacing, size, size);
+          decreaseMaximumSubtreeCountRectangle = new RectangleF(visualRootNode.X + visualRootNode.Width + spacing, visualRootNode.Y + size + 2 * spacing, size, size);
+
+          pen.Color = Content.GetMaximumSubtreeCount(rootNode.Symbol) == Content.GetMinimumSubtreeCount(rootNode.Symbol) ? Color.LightGray : Color.Black;
+          graphics.DrawString("+", font, pen.Brush, increaseMinimumSubtreeCountRectangle, stringFormat);
+          graphics.DrawRectangle(pen, Rectangle.Round(increaseMinimumSubtreeCountRectangle));
+          if (pen.Color == Color.LightGray) increaseMinimumSubtreeCountRectangle = RectangleF.Empty;
+
+          pen.Color = Content.GetMinimumSubtreeCount(rootNode.Symbol) == rootNode.Symbol.MinimumArity ? Color.LightGray : Color.Black;
+          graphics.DrawString("-", font, pen.Brush, decreaseMinimumSubtreeCountRectangle, stringFormat);
+          graphics.DrawRectangle(pen, Rectangle.Round(decreaseMinimumSubtreeCountRectangle));
+          if (pen.Color == Color.LightGray) decreaseMinimumSubtreeCountRectangle = RectangleF.Empty;
+
+          pen.Color = Content.GetMaximumSubtreeCount(rootNode.Symbol) == rootNode.Symbol.MaximumArity ? Color.LightGray : Color.Black;
+          graphics.DrawRectangle(pen, Rectangle.Round(increaseMaximumSubtreeCountRectangle));
+          graphics.DrawString("+", font, pen.Brush, increaseMaximumSubtreeCountRectangle, stringFormat);
+          if (pen.Color == Color.LightGray) increaseMaximumSubtreeCountRectangle = RectangleF.Empty;
+
+          pen.Color = Content.GetMaximumSubtreeCount(rootNode.Symbol) == Content.GetMinimumSubtreeCount(rootNode.Symbol) ? Color.LightGray : Color.Black;
+          graphics.DrawRectangle(pen, Rectangle.Round(decreaseMaximumSubtreeCountRectangle));
+          graphics.DrawString("-", font, pen.Brush, decreaseMaximumSubtreeCountRectangle, stringFormat);
+          if (pen.Color == Color.LightGray) decreaseMaximumSubtreeCountRectangle = RectangleF.Empty;
+        }
+      }
     }
 
@@ -297,4 +379,5 @@
             groupSymbol = selectedNode.Tag as GroupSymbol;
             if (groupSymbol != null && Content.ContainsSymbol(groupSymbol)) break;
+            selectedNode = selectedNode.Parent;
           }
 
@@ -345,4 +428,30 @@
     }
     #endregion
+
+    private void allowedChildSymbolsControl_MouseDown(object sender, MouseEventArgs e) {
+      if (Content == null) return;
+      if (allowedChildSymbolsControl.Tree == null) return;
+
+      var pointF = new PointF(e.X, e.Y);
+      var rootSymbol = allowedChildSymbolsControl.Tree.Root.Symbol;
+      int minimumSubtreeCount = Content.GetMinimumSubtreeCount(rootSymbol);
+      int maximumSubtreecount = Content.GetMaximumSubtreeCount(rootSymbol);
+
+      bool changed = true;
+      DeregisterContentEvents();
+      if (increaseMinimumSubtreeCountRectangle.Contains(pointF))
+        Content.SetSubtreeCount(rootSymbol, minimumSubtreeCount + 1, maximumSubtreecount);
+      else if (decreaseMinimumSubtreeCountRectangle.Contains(pointF))
+        Content.SetSubtreeCount(rootSymbol, minimumSubtreeCount - 1, maximumSubtreecount);
+      else if (increaseMaximumSubtreeCountRectangle.Contains(pointF))
+        Content.SetSubtreeCount(rootSymbol, minimumSubtreeCount, maximumSubtreecount + 1);
+      else if (decreaseMaximumSubtreeCountRectangle.Contains(pointF))
+        Content.SetSubtreeCount(rootSymbol, minimumSubtreeCount, maximumSubtreecount - 1);
+      else
+        changed = false;
+
+      if (changed) BuildAllowedChildSymbolsTree(rootSymbol);
+      RegisterContentEvents();
+    }
   }
 
