From 2a0dd1c5936d411f35adbee94e769cd96ab242b0 Mon Sep 17 00:00:00 2001 From: "ggh1933.go" Date: Wed, 16 Mar 2016 17:57:17 +0900 Subject: [PATCH] [SRADA-211]Horizontal Scroll Key short-cut 1. Changing from if to switch on TimeLineChartKeyListener 2. Adding 'a' and 'd' for Horizontal Scrolling 3. Adding 'q' and 'e' move start or end on timeline 4. double changeScroll = (120 / Math.pow(2, zoom_val)) - Fomula for Visible timeLine's width, Depending on changing of zoom_index # patch 1 : After change scale, update changed zoomIndex to zoom_val. Change-Id: Ie3d4d2119d422c386d4b00bf6e5e3654231d6701 --- .../ui/common/TimeLineChartKeyListener.java | 52 +++++++++++++++++++--- 1 file changed, 45 insertions(+), 7 deletions(-) diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/common/TimeLineChartKeyListener.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/common/TimeLineChartKeyListener.java index 1374b87..4ca6cb2 100755 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/common/TimeLineChartKeyListener.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/common/TimeLineChartKeyListener.java @@ -4,25 +4,63 @@ import org.eclipse.swt.events.KeyAdapter; import org.eclipse.swt.events.KeyEvent; import org.eclipse.swt.events.KeyListener; import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard; +import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardManager; +import org.tizen.dynamicanalyzer.widgets.scale.DAScale; public class TimeLineChartKeyListener extends KeyAdapter implements KeyListener{ private DAChartBoard chartboard; + private DAChartBoardManager boardMannager; + private DAScale scale; public TimeLineChartKeyListener(DAChartBoard chartboard) { this.chartboard = chartboard; + this.boardMannager = chartboard.getBoardManager(); + this.scale = chartboard.getScale(); } @Override public void keyPressed(KeyEvent e) { // TODO Auto-generated method stub - if(e.keyCode == 'w'){ - chartboard.getScale().changeScale(true); + int zoom_val = scale.getSelection(); + double chartDiv = 3; + + // If zoom index(0~4)changed, changeScroll Time Interval changed too. + double changeScroll = (120 / Math.pow(2, zoom_val)); + double visibleStart = boardMannager.getVisibleStartTime(); + + switch(e.keyCode){ + case 'w' :{ // Zoom-in + scale.changeScale(true); + zoom_val = scale.getSelection(); + boardMannager.scaleChanged(zoom_val); + break; + } + case 's' :{ // Zoom-out + scale.changeScale(false); + zoom_val = scale.getSelection(); + boardMannager.scaleChanged(zoom_val); + break; + } + case 'a' :{ // Left Horizontal Scroll + boardMannager.startTimeChanged(visibleStart-(changeScroll/chartDiv)); + break; + } + case 'd' :{ // Right Horizontal Scroll + boardMannager.startTimeChanged(visibleStart+(changeScroll/chartDiv)); + break; + } + case 'q' :{ // Horizontal Scroll Back to Start Time + boardMannager.startTimeChanged(boardMannager.getTotalStartTime()); + break; + } + case 'e' :{ // Horizontal Scroll to End Time + boardMannager.startTimeChanged(boardMannager.getTotalEndTime()); + break; + } + default :{ + break; + } } - if(e.keyCode == 's'){ - chartboard.getScale().changeScale(false); - } - /// apply ScaleChange to Graph 0215 - chartboard.getBoardManager().scaleChanged(chartboard.getScale().getSelection()); } @Override -- 2.7.4