src/Tools/Graphview/tree_panel.scala
changeset 59397 fc909f7e7ce5
parent 59396 a2f4252c5489
child 59400 d833cba5cce5
equal deleted inserted replaced
59396:a2f4252c5489 59397:fc909f7e7ce5
    17 
    17 
    18 import scala.util.matching.Regex
    18 import scala.util.matching.Regex
    19 import scala.swing.{Component, ScrollPane, BorderPanel, Label, TextField, Button, CheckBox, Action}
    19 import scala.swing.{Component, ScrollPane, BorderPanel, Label, TextField, Button, CheckBox, Action}
    20 
    20 
    21 
    21 
    22 class Tree_Panel(val visualizer: Visualizer, repaint_all: () => Unit) extends BorderPanel
    22 class Tree_Panel(val visualizer: Visualizer, graph_panel: Graph_Panel) extends BorderPanel
    23 {
    23 {
    24   /* main actions */
    24   /* main actions */
    25 
    25 
    26   private def selection_action()
    26   private def selection_action()
    27   {
    27   {
    39               }
    39               }
    40             case _ =>
    40             case _ =>
    41           }
    41           }
    42         }
    42         }
    43       }
    43       }
    44       repaint_all()
    44       graph_panel.repaint()
    45     }
    45     }
    46   }
    46   }
    47 
    47 
    48   private def point_action(path: TreePath)
    48   private def point_action(path: TreePath)
    49   {
    49   {
    55               case node: Graph_Display.Node => Some(node)
    55               case node: Graph_Display.Node => Some(node)
    56               case _ => None
    56               case _ => None
    57             }
    57             }
    58           case _ => None
    58           case _ => None
    59         }
    59         }
    60       action_node match {
    60       action_node.foreach(graph_panel.scroll_to_node(_))
    61         case Some(node) =>
       
    62           val info = visualizer.layout.get_node(node)
       
    63           tree_pane.peer.scrollRectToVisible(
       
    64             new Rectangle(
       
    65               (info.x - info.width2).toInt, (info.y - info.height2).toInt,
       
    66               info.width.toInt, info.height.toInt))
       
    67         case None =>
       
    68       }
       
    69       visualizer.current_node = action_node
    61       visualizer.current_node = action_node
    70       repaint_all()
    62       graph_panel.repaint()
    71     }
    63     }
    72   }
    64   }
    73 
    65 
    74 
    66 
    75   /* tree */
    67   /* tree */