import org.eclipse.swt.events.KeyEvent;\r
import org.eclipse.swt.events.KeyListener;\r
import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;\r
+import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardManager;\r
+import org.tizen.dynamicanalyzer.widgets.scale.DAScale;\r
\r
public class TimeLineChartKeyListener extends KeyAdapter implements KeyListener{\r
private DAChartBoard chartboard;\r
+ private DAChartBoardManager boardMannager;\r
+ private DAScale scale;\r
\r
public TimeLineChartKeyListener(DAChartBoard chartboard) {\r
this.chartboard = chartboard;\r
+ this.boardMannager = chartboard.getBoardManager();\r
+ this.scale = chartboard.getScale();\r
}\r
\r
@Override\r
public void keyPressed(KeyEvent e) {\r
// TODO Auto-generated method stub\r
- if(e.keyCode == 'w'){\r
- chartboard.getScale().changeScale(true);\r
+ int zoom_val = scale.getSelection();\r
+ double chartDiv = 3;\r
+ \r
+ // If zoom index(0~4)changed, changeScroll Time Interval changed too.\r
+ double changeScroll = (120 / Math.pow(2, zoom_val));\r
+ double visibleStart = boardMannager.getVisibleStartTime(); \r
+ \r
+ switch(e.keyCode){\r
+ case 'w' :{ // Zoom-in\r
+ scale.changeScale(true);\r
+ zoom_val = scale.getSelection();\r
+ boardMannager.scaleChanged(zoom_val);\r
+ break;\r
+ }\r
+ case 's' :{ // Zoom-out\r
+ scale.changeScale(false);\r
+ zoom_val = scale.getSelection();\r
+ boardMannager.scaleChanged(zoom_val);\r
+ break;\r
+ }\r
+ case 'a' :{ // Left Horizontal Scroll\r
+ boardMannager.startTimeChanged(visibleStart-(changeScroll/chartDiv));\r
+ break;\r
+ }\r
+ case 'd' :{ // Right Horizontal Scroll\r
+ boardMannager.startTimeChanged(visibleStart+(changeScroll/chartDiv));\r
+ break;\r
+ }\r
+ case 'q' :{ // Horizontal Scroll Back to Start Time\r
+ boardMannager.startTimeChanged(boardMannager.getTotalStartTime());\r
+ break;\r
+ }\r
+ case 'e' :{ // Horizontal Scroll to End Time\r
+ boardMannager.startTimeChanged(boardMannager.getTotalEndTime());\r
+ break;\r
+ }\r
+ default :{\r
+ break;\r
+ }\r
}\r
- if(e.keyCode == 's'){\r
- chartboard.getScale().changeScale(false);\r
- }\r
- /// apply ScaleChange to Graph 0215\r
- chartboard.getBoardManager().scaleChanged(chartboard.getScale().getSelection());\r
}\r
\r
@Override\r