[Title] modify the way of zoom in/out
authorsanghyunnim.lee <sanghyunnim.lee@samsung.com>
Thu, 18 Oct 2012 12:50:24 +0000 (21:50 +0900)
committersanghyunnim.lee <sanghyunnim.lee@samsung.com>
Thu, 18 Oct 2012 12:50:24 +0000 (21:50 +0900)
[Type]
[Module]
[Priority]
[CQ#]
[Redmine#]7017
[Problem]
[Cause]
[Solution]
[TestCase]

org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/common/TempConstants.java [deleted file]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/common/TimeTickComposite.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/common/TimelineComposite.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/common/TimelineConstants.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/common/TimelineGlobalVariable.java [new file with mode: 0644]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/common/TimelineMaster.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/common/TimelineRangeSelector.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/common/TimelineTick.java

diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/common/TempConstants.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/common/TempConstants.java
deleted file mode 100644 (file)
index bb2616d..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- *  Dynamic Analyzer
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: 
- * Sanghyun Lee <sanghyunnim.lee@samsung.com>
- * Juyoung Kim <j0.kim@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * 
- * Contributors:
- * - S-Core Co., Ltd
- * 
- */
-
-package org.tizen.dynamicanalyzer.ui.timeline.common;
-
-import java.awt.Color;
-
-
-public class TempConstants {
-       public static final int NOT_INITED = -1;
-       public static final int DEFAULT_SCALE = 0;
-       public static final int MAX_SCALE = 2;
-       public static final int MIN_SELECTION_HALF_WIDTH_PX = 1;
-       
-       public static int currentScaleValue = DEFAULT_SCALE;
-       public static int oriScaleValue = DEFAULT_SCALE;
-       
-       public static final int oneTickPx = 5;
-       public static int timetickWidthPx = NOT_INITED;
-       
-       public static int startPx = 0;
-       public static int endPx = NOT_INITED;
-       
-       public static int originalEndPx = NOT_INITED;
-       public static int chartRunningSec = NOT_INITED;
-       
-       public static boolean scaleChanged = false;
-       public static boolean allowRedrawTimeTickCanvas = true;
-       
-       public enum EnumScaleSec {
-               SCALE_0(10), SCALE_1(5), SCALE_2(1);
-               private int scaleSec;
-               private EnumScaleSec(int scaleValue) {
-                       this.scaleSec = scaleValue;
-               }
-               
-               public int getScaleSec() {
-                       return scaleSec;
-               }
-       }
-       
-       public static final double WIFI_SET_VALUE = 0.97;
-       public static final double BT_SET_VALUE = 0.92;
-       public static final double GPS_SET_VALUE = 0.87;
-       public static final double DNET_SET_VALUE = 0.82;
-       public static final double CALL_SET_VALUE = 0.77;
-       public static final double CLEAR_VALUE = Double.NaN;
-       
-       public static final int JFREE_MIN_SIZE = 300;
-       
-       public static boolean isSnapshotChartDisposed = false;
-
-       public static final String LIFECYCLE_API_NAME_CREATE = "usercallback_app_create"; //$NON-NLS-1$
-       public static final String LIFECYCLE_API_NAME_TERMINATE = "usercallback_app_terminate"; //$NON-NLS-1$
-       public static final String LIFECYCLE_API_NAME_PAUSE = "usercallback_app_pause"; //$NON-NLS-1$
-       public static final String LIFECYCLE_API_NAME_RESUME = "usercallback_app_resume"; //$NON-NLS-1$
-       public static final String LIFECYCLE_API_NAME_SERVICE = "usercallback_app_service"; //$NON-NLS-1$
-       
-       public static final int LIFECYCLE_CREATE = 0;
-       public static final int LIFECYCLE_TERMINATE = 1;
-       public static final int LIFECYCLE_PAUSE = 2;
-       public static final int LIFECYCLE_RESUME = 3;
-       public static final int LIFECYCLE_SERVICE = 4;
-       
-       public static final Color LIFECYCLE_COLOR_CREATE = new Color(48, 69, 50);
-       public static final Color LIFECYCLE_COLOR_TERMINATE = new Color(57, 48, 76);
-       public static final Color LIFECYCLE_COLOR_PAUSE = new Color(86, 56, 57);
-       public static final Color LIFECYCLE_COLOR_RESUME = new Color(47, 64, 77);
-       public static final Color LIFECYCLE_COLOR_SERVICE = new Color(66, 67, 68);
-       
-       public static long TOTAL_MEMORY = 90;
-       public static boolean SUPPORT_WIFI = false;
-       public static boolean SUPPORT_BLUETOOTH = false;
-       public static boolean SUPPORT_GPS = false;
-       
-       public static double chartRangeRatio = 0.85;
-}
index d84ebfe..ab47fe3 100644 (file)
@@ -82,8 +82,7 @@ public class TimeTickComposite extends Composite {
                graphComposite.setLayoutData(graphCompLayoutData);
                graphComposite.setBackground(ColorResources.WHITE);
 
-               timeTickCanvas = new Canvas(graphComposite, SWT.DOUBLE_BUFFERED
-                               | SWT.TRANSPARENT);
+               timeTickCanvas = new Canvas(graphComposite, SWT.DOUBLE_BUFFERED | SWT.TRANSPARENT);
 
                timelineMaster.setTimeTickCanvas(timeTickCanvas);
                timeTickCanvas.setLayoutData(layoutData);
@@ -91,11 +90,11 @@ public class TimeTickComposite extends Composite {
                        @Override
                        public void paintControl(PaintEvent e) {
                                gc = e.gc;
-                               int x, y, w, h;
+                               final int x, y, w, h;
                                Rectangle timeTickRect = timeTickCanvas.getClientArea();
                                x = timeTickRect.x;
                                y = timeTickRect.y;
-                               TimelineGlobalVriable.timetickWidthPx = w = timeTickRect.width;
+                               TimelineGlobalVariable.timetickWidthPx = w = timeTickRect.width;
                                h = timeTickRect.height;
 
                                gc.setBackground(ColorResources.TABLE_HEADER_BG);
@@ -104,8 +103,7 @@ public class TimeTickComposite extends Composite {
                                gc.fillRectangle(x, y, w, h);
                                gc.setFont(FontResources.TIMELINE_TICK_FONT);
 
-                               int timeStringWidthPx = (gc.getCharWidth('0') * 4
-                                               + gc.getCharWidth(':') + 1);
+                               int timeStringWidthPx = (gc.getCharWidth('0') * 4 + gc.getCharWidth(':') + 1);
                                int halfStringWidth = (int) Math.round(timeStringWidthPx / 2.0);
 
                                gc.drawLine(x, y + h - 1, x + w, y + h - 1);
@@ -122,101 +120,87 @@ public class TimeTickComposite extends Composite {
                                }
 
                                int oneTickPx = TimelineConstants.ONE_TICK_PIXEL;
-                               int scaleSec = TimelineGlobalVriable.EnumScaleSec.values()[TimelineGlobalVriable.currentScaleValue]
-                                               .getScaleSec();
-
-                               int originalScaleSec = TimelineGlobalVriable.EnumScaleSec.values()[TimelineGlobalVriable.oriScaleValue]
-                                               .getScaleSec();
-                               int chartRunningPx = timelineMaster
-                                               .getPxBySec(TimelineGlobalVriable.chartRunningSec);
-
-                               TimelineGlobalVriable.oriScaleValue = TimelineGlobalVriable.currentScaleValue;
-                               TimelineGlobalVriable.originalEndPx = (int) Math
-                                               .round((double) TimelineGlobalVriable.originalEndPx
-                                                               * originalScaleSec / scaleSec);
-                               if (TimelineGlobalVriable.scaleChanged) {
-                                       TimelineGlobalVriable.scaleChanged = false;
-                                       int tempEndPx = (int) Math
-                                                       .round((double) TimelineGlobalVriable.endPx
-                                                                       * originalScaleSec / scaleSec);
-                                       tempEndPx = tempEndPx < TimelineGlobalVriable.originalEndPx ? tempEndPx
-                                                       : TimelineGlobalVriable.originalEndPx;
-                                       TimelineGlobalVriable.startPx = tempEndPx - w;
-                                       if (TimelineGlobalVriable.startPx < 0) {
-                                               TimelineGlobalVriable.startPx = 0;
+                               int currentScaleSec = TimelineGlobalVariable.EnumScaleSec.values()[TimelineGlobalVariable.currentScaleValue].getScaleSec();
+
+                               int originalScaleSec = TimelineGlobalVariable.EnumScaleSec.values()[TimelineGlobalVariable.oriScaleValue].getScaleSec();
+                               int chartRunningPx = timelineMaster.getPxBySec(TimelineGlobalVariable.chartRunningSec);
+
+                               TimelineGlobalVariable.oriScaleValue = TimelineGlobalVariable.currentScaleValue;
+                               TimelineGlobalVariable.originalEndPx = (int) Math.round((double) TimelineGlobalVariable.originalEndPx * originalScaleSec / currentScaleSec);
+
+                               if (TimelineGlobalVariable.scaleChanged) {
+                                       TimelineGlobalVariable.scaleChanged = false;
+                                       timelineMaster.setRangeScrollBarStuckState(false);
+                                       
+                                       int tempMidPx = (int) Math.round((double) (TimelineGlobalVariable.endPx + TimelineGlobalVariable.startPx ) / 2 * originalScaleSec / currentScaleSec);
+                                       TimelineGlobalVariable.startPx = tempMidPx - w / 2;
+                                       if (TimelineGlobalVariable.startPx < 0) {
+                                               TimelineGlobalVariable.startPx = 0;
                                        }
                                } else {
-                                       TimelineGlobalVriable.startPx = (int) Math
-                                                       .round((double) TimelineGlobalVriable.startPx
-                                                                       * originalScaleSec / scaleSec);
+                                       TimelineGlobalVariable.startPx = (int) Math.round((double) TimelineGlobalVariable.startPx * originalScaleSec / currentScaleSec);
                                }
-
-                               if (timelineMaster.isRangeScrollBarStuck()) {
-                                       if (chartRunningPx > TimelineGlobalVriable.endPx) {
-                                               TimelineGlobalVriable.startPx = chartRunningPx - w;
-                                       }
+                               
+                               if (TimelineGlobalVariable.originalEndPx == TimelineConstants.NOT_INITED) {
+                                       TimelineGlobalVariable.originalEndPx = w;
+                                       timelineMaster.setRangeScrollBarMax(w);
+                                       timelineMaster.setRangeScrollBarSelection(0);
+                                       timelineMaster.setRangeScrollBarThumb(w);
                                }
-
-                               int tempQuotient = TimelineGlobalVriable.startPx / (10 * oneTickPx);
-                               int tempRemainder = TimelineGlobalVriable.startPx % (10 * oneTickPx);
-                               int tickOrder = tempRemainder / oneTickPx
-                                               + (tempRemainder % oneTickPx == 0 ? 0 : 1);
-                               int posXPx = oneTickPx
-                                               - (tempRemainder % oneTickPx == 0 ? oneTickPx
-                                                               : tempRemainder % oneTickPx);
-
-                               long tickLabelValue = scaleSec * tempQuotient
-                                               + (tempRemainder == 0 ? 0 : scaleSec);
-                               tickLabelValue -= scaleSec;
+                               
+                               TimelineGlobalVariable.endPx = TimelineGlobalVariable.startPx + w;
+                               int maxPx = chartRunningPx > TimelineGlobalVariable.originalEndPx ? chartRunningPx : TimelineGlobalVariable.originalEndPx;
+                               if(TimelineGlobalVariable.endPx > maxPx) {
+                                       TimelineGlobalVariable.endPx = maxPx;
+                                       TimelineGlobalVariable.startPx = maxPx - w;
+                                       timelineMaster.setRangeScrollBarStuckState(true);
+                               }
+                               
+                               if (timelineMaster.isRangeScrollBarStuck() && chartRunningPx > TimelineGlobalVariable.endPx) {
+                                       TimelineGlobalVariable.startPx = chartRunningPx - w;
+                               }
+                               
+                               int tempQuotient = TimelineGlobalVariable.startPx / (10 * oneTickPx);
+                               int tempRemainder = TimelineGlobalVariable.startPx % (10 * oneTickPx);
+                               int tickOrder = tempRemainder / oneTickPx + (tempRemainder % oneTickPx == 0 ? 0 : 1);
+                               int posXPx = oneTickPx - (tempRemainder % oneTickPx == 0 ? oneTickPx : tempRemainder % oneTickPx);
+
+                               long tickLabelValue = currentScaleSec * tempQuotient + (tempRemainder == 0 ? 0 : currentScaleSec);
+                               tickLabelValue -= currentScaleSec;
                                while (posXPx < w) {
                                        tickOrder = tickOrder % 10;
                                        int tickLineHeight = 2;
                                        if (tickOrder == 0) {
                                                tickLineHeight = 6;
-                                               tickLabelValue += scaleSec;
+                                               tickLabelValue += currentScaleSec;
                                                gc.setForeground(ColorResources.TABLE_HEADER_FONT_COLOR);
-                                               gc.drawText(timeFormat(tickLabelValue * MS * US),
-                                                               (int) Math.round(posXPx) - halfStringWidth + 1,
-                                                               1);
+                                               gc.drawText(timeFormat(tickLabelValue * MS * US), (int) Math.round(posXPx) - halfStringWidth + 1, 1);
                                        } else if (tickOrder == 5) {
                                                tickLineHeight = 4;
                                        }
                                        gc.setForeground(ColorResources.TABLE_LINE);
-                                       gc.drawLine((int) Math.round(posXPx), y + h
-                                                       - (1 + tickLineHeight), (int) Math.round(posXPx), y
-                                                       + h - 1);
+                                       gc.drawLine((int) Math.round(posXPx), y + h - (1 + tickLineHeight), (int) Math.round(posXPx), y + h - 1);
 
                                        posXPx += oneTickPx;
                                        tickOrder = tickOrder + 1;
                                }
-                               TimelineGlobalVriable.endPx = TimelineGlobalVriable.startPx + w;
-
-                               if (TimelineGlobalVriable.originalEndPx == TimelineConstants.NOT_INITED) {
-                                       TimelineGlobalVriable.originalEndPx = w;
-                                       timelineMaster.setRangeScrollBarMax(w);
-                                       timelineMaster.setRangeScrollBarSelection(0);
-                                       timelineMaster.setRangeScrollBarThumb(w);
-                               }
-
-                               int maxPx = chartRunningPx > TimelineGlobalVriable.originalEndPx ? chartRunningPx
-                                               : TimelineGlobalVriable.originalEndPx;
+                               
                                timelineMaster.setRangeScrollBarMax(maxPx);
-                               timelineMaster.setRangeScrollBarSelection(TimelineGlobalVriable.startPx);
+                               timelineMaster.setRangeScrollBarSelection(TimelineGlobalVariable.startPx);
                                timelineMaster.setRangeScrollBarThumb(w);
-                               if (maxPx == TimelineGlobalVriable.startPx + w) {
+                               if (maxPx == TimelineGlobalVariable.startPx + w) {
                                        timelineMaster.setRangeScrollBarStuckState(true);
                                }
 
-                               TimelineChartManager.getInstance().setAllChartDoaminAxisRange(
-                                               TimelineGlobalVriable.startPx * scaleSec / oneTickPx / 10.0,
-                                               TimelineGlobalVriable.endPx * scaleSec / oneTickPx / 10.0);
-                               TimelineGlobalVriable.allowRedrawTimeTickCanvas = true;
+                               TimelineChartManager.getInstance().setAllChartDoaminAxisRange(TimelineGlobalVariable.startPx * currentScaleSec / oneTickPx / 10.0,
+                                               TimelineGlobalVariable.endPx * currentScaleSec / oneTickPx / 10.0);
+                               TimelineGlobalVariable.allowRedrawTimeTickCanvas = true;
                        }
                });
        }
 
        public void clear() {
-               TimelineGlobalVriable.startPx = 0;
+               TimelineGlobalVariable.startPx = 0;
                timeTickCanvas.redraw();
        }
 
@@ -235,8 +219,7 @@ public class TimeTickComposite extends Composite {
                        nextTime = minTime % MIN;
                }
 
-               format = digitMapping(frontTime) + AnalyzerConstants.COLON
-                               + digitMapping(nextTime);
+               format = digitMapping(frontTime) + AnalyzerConstants.COLON + digitMapping(nextTime);
                return format;
        }
 
index ac8f621..1572487 100755 (executable)
@@ -99,7 +99,7 @@ public class TimelineComposite extends DAView {
 
                timelineItemManager.updateActiveItem(runTimeMs);
 
-               TimelineGlobalVriable.chartRunningSec = (int) (runTimeMs / TimelineConstants.KILO);
+               TimelineGlobalVariable.chartRunningSec = (int) (runTimeMs / TimelineConstants.KILO);
                TimelineMaster.getInstance().redrawTimeTickCanvas();
        }
 
@@ -239,9 +239,9 @@ public class TimelineComposite extends DAView {
                }
                int middlePx = timelineMaster.getPxBySec(middleTime);
 
-               TimelineGlobalVriable.startPx = middlePx - TimelineGlobalVriable.timetickWidthPx / 2;
-               if (TimelineGlobalVriable.startPx < 0) {
-                       TimelineGlobalVriable.startPx = 0;
+               TimelineGlobalVariable.startPx = middlePx - TimelineGlobalVariable.timetickWidthPx / 2;
+               if (TimelineGlobalVariable.startPx < 0) {
+                       TimelineGlobalVariable.startPx = 0;
                }
 
                timelineMaster.redrawTimeTickCanvas();
@@ -279,7 +279,6 @@ public class TimelineComposite extends DAView {
        @Override
        public void clear() {
                chartManager.clear();
-               timelineRangeSelector.clear();
                timelineTick.clear();
                SnapshotData.getInstance().clear();
                CustomLogParser.clear();
index f4ed4f7..2b0a780 100644 (file)
@@ -27,8 +27,6 @@
 package org.tizen.dynamicanalyzer.ui.timeline.common;
 
 public class TimelineConstants {
-       public static final long CHART_RANGE_DEFAULT = 120000;// 12
-
        /* timeline Item type */
        public static final int NOT_DEFAULT_CHART = -100;
        public static final int CHART_TYPE_CPU =  -101;
diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/common/TimelineGlobalVariable.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/common/TimelineGlobalVariable.java
new file mode 100644 (file)
index 0000000..0d597f4
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ *  Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * Sanghyun Lee <sanghyunnim.lee@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+
+package org.tizen.dynamicanalyzer.ui.timeline.common;
+
+
+
+public class TimelineGlobalVariable {
+       public static int currentScaleValue = 0;
+       public static int oriScaleValue = 0;
+       
+       public static int timetickWidthPx = TimelineConstants.NOT_INITED;
+       
+       public static int startPx = 0;
+       public static int endPx = TimelineConstants.NOT_INITED;
+       
+       public static int originalEndPx = TimelineConstants.NOT_INITED;
+       public static int chartRunningSec = TimelineConstants.NOT_INITED;
+       
+       public static boolean scaleChanged = false;
+       public static boolean allowRedrawTimeTickCanvas = true;
+       
+       public enum EnumScaleSec {
+               SCALE_0(10), SCALE_1(5), SCALE_2(1);
+               private int scaleSec;
+               private EnumScaleSec(int scaleValue) {
+                       this.scaleSec = scaleValue;
+               }
+               
+               public int getScaleSec() {
+                       return scaleSec;
+               }
+       }
+       
+       public static long TOTAL_MEMORY = 90;
+       public static boolean SUPPORT_WIFI = false;
+       public static boolean SUPPORT_BLUETOOTH = false;
+       public static boolean SUPPORT_GPS = false;
+}
index d263130..7de7e4a 100644 (file)
@@ -69,7 +69,11 @@ public class TimelineMaster {
         if (thumb != -1) {
             rangeScrollBar.setThumb(thumb);
             rangeScrollBar.setPageIncrement(thumb);
-            rangeScrollBar.setIncrement(thumb / 5);
+            if(thumb < 5) {
+               rangeScrollBar.setIncrement(1);
+            } else {
+               rangeScrollBar.setIncrement(thumb / 5);
+            }
         }
     }
 
@@ -83,27 +87,27 @@ public class TimelineMaster {
 
     public int getPxBySec(double sec) {
         int scaleSec =
-                TimelineGlobalVriable.EnumScaleSec.values()[TimelineGlobalVriable.currentScaleValue].getScaleSec();
+                TimelineGlobalVariable.EnumScaleSec.values()[TimelineGlobalVariable.currentScaleValue].getScaleSec();
         return (int) Math.round(sec * TimelineConstants.ONE_TICK_PIXEL * 10.0 / scaleSec);
     }
 
     public double getSecByPx(int px) {
         int scaleSec =
-                TimelineGlobalVriable.EnumScaleSec.values()[TimelineGlobalVriable.currentScaleValue].getScaleSec();
+                TimelineGlobalVariable.EnumScaleSec.values()[TimelineGlobalVariable.currentScaleValue].getScaleSec();
         return px * scaleSec / 10.0 / TimelineConstants.ONE_TICK_PIXEL;
     }
 
     public void initAppInfo(String[] datas) {
         setTotalMemory(Integer.parseInt(datas[AnalyzerConstants.APP_INFO_SYSTEM_MEMORY_SIZE]));
-        TimelineGlobalVriable.SUPPORT_WIFI =
+        TimelineGlobalVariable.SUPPORT_WIFI =
                 datas[AnalyzerConstants.APP_INFO_WIFI_SUPPORT].equals("1") ? true : false; //$NON-NLS-1$
-        TimelineGlobalVriable.SUPPORT_BLUETOOTH =
+        TimelineGlobalVariable.SUPPORT_BLUETOOTH =
                 datas[AnalyzerConstants.APP_INFO_BLUETOOTH_SUPPORT].equals("1") ? true : false; //$NON-NLS-1$
-        TimelineGlobalVriable.SUPPORT_GPS =
+        TimelineGlobalVariable.SUPPORT_GPS =
                 datas[AnalyzerConstants.APP_INFO_GPS_SUPPORT].equals("1") ? true : false; //$NON-NLS-1$
     }
 
     private void setTotalMemory(final int totalMemory) {
-        TimelineGlobalVriable.TOTAL_MEMORY = totalMemory;
+        TimelineGlobalVariable.TOTAL_MEMORY = totalMemory;
     }
 }
\ No newline at end of file
index 17b2620..652a599 100755 (executable)
@@ -38,7 +38,6 @@ import org.eclipse.swt.graphics.Rectangle;
 import org.eclipse.swt.layout.FillLayout;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Canvas;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Event;
 import org.eclipse.swt.widgets.Label;
@@ -51,46 +50,14 @@ import org.tizen.dynamicanalyzer.widgets.scale.DAScale;
 import org.tizen.dynamicanalyzer.widgets.scale.DAScaleSelectionListener;
 
 public class TimelineRangeSelector {
-       private final int RANGE_SCALE_LEVEL_3 = 120;
        private final int MAX_SCALE = 2;
 
        private Composite scaleAndRangeComp;
        private Composite rangeScaleComp;
        private Composite rangeSelectorComp;
-       private Canvas rangeCanvas;
        private DAScale rangeScale;
        private ScrollBar rangeScrollBar;
 
-       private final int MARGIN_HORIZONTAL = 0;
-
-       private double chartRunningSec;
-       private double rangeScaleSec;
-
-       private boolean isEndSticky = false;
-       private boolean isTotalRange = false;
-
-       RangeRectInfo rangeRectInfo;
-
-       class RangeRectInfo {
-               public Rectangle rangeRect;
-               public int startSec;
-               public int endSec;
-               public int preStartSec;
-
-               /* pixel */
-               public int firstStartXP;
-               public int downXP;
-
-               public Rectangle selectorRect;
-               protected int downLeftMarginP;
-       }
-
-       public TimelineRangeSelector() {
-               rangeRectInfo = new RangeRectInfo();
-               chartRunningSec = (double) (TimelineConstants.CHART_RANGE_DEFAULT / TimelineConstants.KILO);
-               isEndSticky = true;
-       }
-
        public Composite createScaleAndRangeComp(Composite baseComp) {
                scaleAndRangeComp = new Composite(baseComp, SWT.NONE);
                scaleAndRangeComp.setBackground(ColorResources.VIEW_BG_COLOR);
@@ -151,40 +118,6 @@ public class TimelineRangeSelector {
                return scaleAndRangeComp;
        }
 
-       public void updateRuntime(long runTime) {
-               if (0 >= runTime) {
-                       return;
-               }
-               double runningTime = (double) (runTime / TimelineConstants.KILO);
-
-               if (chartRunningSec >= runningTime) {
-                       return;
-               }
-
-               chartRunningSec = runningTime;
-
-               resetRangeRectSec();
-
-               // if (isEndSticky) {
-               // setRangeSelection(rangeRectInfo.startSec, rangeScaleSec.intValue());
-               // }
-       }
-
-       public void clear() {
-               /* Init value */
-               rangeRectInfo = null;
-               rangeRectInfo = new RangeRectInfo();
-               chartRunningSec = (double) (TimelineConstants.CHART_RANGE_DEFAULT / TimelineConstants.KILO);
-               isEndSticky = true;
-
-               /* Scale init */
-               resetRangeRectSec();
-               rangeScrollBar.setThumb(120);
-               rangeScrollBar.setPageIncrement(60);
-               rangeScrollBar.setIncrement(12);
-               rangeScrollBar.setSelection(0);
-       }
-
        private Composite createRangeScaleComp(Composite selectorComp, int style) {
                Composite rangeScaleComp = new Composite(selectorComp, SWT.None);
                rangeScaleComp.setLayout(new FillLayout());
@@ -201,31 +134,24 @@ public class TimelineRangeSelector {
 
                        @Override
                        public void widgetSelected() {
-                               if (!TimelineGlobalVriable.allowRedrawTimeTickCanvas) {
+                               if (!TimelineGlobalVariable.allowRedrawTimeTickCanvas) {
                                        return;
                                }
-                               int oriScaleValue = TimelineGlobalVriable.currentScaleValue;
-                               TimelineGlobalVriable.currentScaleValue = rangeScale.getSelection();
-                               if (oriScaleValue == TimelineGlobalVriable.currentScaleValue) {
+                               int oriScaleValue = TimelineGlobalVariable.currentScaleValue;
+                               TimelineGlobalVariable.currentScaleValue = rangeScale.getSelection();
+                               if (oriScaleValue == TimelineGlobalVariable.currentScaleValue) {
                                        return;
                                }
-                               TimelineGlobalVriable.oriScaleValue = oriScaleValue;
-                               TimelineGlobalVriable.scaleChanged = true;
-                               isTotalRange = (TimelineGlobalVriable.currentScaleValue == MAX_SCALE ? true
-                                               : false);
-                               TimelineGlobalVriable.allowRedrawTimeTickCanvas = false;
+                               TimelineGlobalVariable.oriScaleValue = oriScaleValue;
+                               TimelineGlobalVariable.scaleChanged = true;
+                               TimelineGlobalVariable.allowRedrawTimeTickCanvas = false;
                                TimelineMaster.getInstance().redrawTimeTickCanvas();
                        }
                });
-               initRangeMagScale();
-
+               
                return rangeScaleComp;
        }
 
-       private void initRangeMagScale() {
-               rangeScaleSec = RANGE_SCALE_LEVEL_3;
-       }
-
        private Composite createRangeComp(Composite parent) {
                ScrolledComposite rangeSelectorComp = new ScrolledComposite(parent, SWT.H_SCROLL);
                rangeSelectorComp.setAlwaysShowScrollBars(true);
@@ -237,7 +163,7 @@ public class TimelineRangeSelector {
                rangeScrollBar.addSelectionListener(new SelectionListener() {
                        @Override
                        public void widgetSelected(SelectionEvent e) {
-                               if (TimelineGlobalVriable.startPx == rangeScrollBar.getSelection()) {
+                               if (TimelineGlobalVariable.startPx == rangeScrollBar.getSelection()) {
                                        return;
                                }
 
@@ -248,7 +174,7 @@ public class TimelineRangeSelector {
                                        TimelineMaster.getInstance()
                                                        .setRangeScrollBarStuckState(false);
                                }
-                               TimelineGlobalVriable.startPx = rangeScrollBar.getSelection();
+                               TimelineGlobalVariable.startPx = rangeScrollBar.getSelection();
                                TimelineMaster.getInstance().redrawTimeTickCanvas();
                        }
 
@@ -260,69 +186,6 @@ public class TimelineRangeSelector {
                return rangeSelectorComp;
        }
 
-       private void setRangeRect(double startTime) {
-               /* Calculate start X */
-               Rectangle rangeCanvasRect = rangeCanvas.getBounds();
-               int rangeCanvasRectWidth = rangeCanvasRect.width - MARGIN_HORIZONTAL
-                               - MARGIN_HORIZONTAL;
-
-               double pixPerSec = rangeCanvasRectWidth / chartRunningSec;
-               double startX = pixPerSec * startTime + MARGIN_HORIZONTAL;
-
-               /* Calculate rectWidth */
-               double rangeScaleRatio = rangeScaleSec / chartRunningSec;
-               double rangeRectWidth = rangeCanvasRectWidth * rangeScaleRatio;
-
-               Rectangle rect = new Rectangle((int)startX, 0,
-                               (int)rangeRectWidth, rangeCanvasRect.height);
-
-               rangeRectInfo.rangeRect = null;
-               rangeRectInfo.rangeRect = rect;
-
-               if (rangeRectInfo.endSec == chartRunningSec) {
-                       isEndSticky = true;
-               }
-
-               redrawRangeSelector(rangeCanvas);
-       }
-
-       private void setRangeRectTotal() {
-               /* Get Time */
-               double endTime = chartRunningSec;
-               double startTime = 0.0;
-               rangeRectInfo.endSec = (int)endTime;
-               rangeRectInfo.startSec = (int)startTime;
-
-               rangeScaleSec = chartRunningSec;
-
-               setRangeRect(startTime);
-       }
-
-       private void resetRangeRectSec() {
-               if (null == rangeCanvas) {
-                       return;
-               }
-
-               if (isTotalRange) {
-                       setRangeRectTotal();
-                       return;
-               }
-
-               /* Get Time */
-               double endTime;
-               double startTime;
-
-               if (isEndSticky) {
-                       endTime = chartRunningSec;
-                       rangeRectInfo.endSec = (int)endTime;
-                       startTime = endTime - rangeScaleSec;
-                       rangeRectInfo.startSec = (int)startTime;
-                       setRangeRect(startTime);
-               } else {
-                       setRangeRect((double) rangeRectInfo.startSec);
-               }
-       }
-
        /*
         * draw background gradient
         */
@@ -345,11 +208,4 @@ public class TimelineRangeSelector {
 
                composite.setBackgroundImage(newImage);
        }
-
-       private void redrawRangeSelector(Canvas canvas) {
-               if (null == canvas) {
-                       return;
-               }
-               canvas.redraw();
-       }
 }
index f1cf2eb..0396237 100644 (file)
@@ -28,7 +28,6 @@ package org.tizen.dynamicanalyzer.ui.timeline.common;
 
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Composite;
@@ -51,24 +50,6 @@ public class TimelineTick {
        private DACustomButton addItems;
        private DACustomButton minimizeItems;
 
-       private Double chartRunningSec;// 60;
-
-       RangeRectInfo rangeRectInfo;
-
-       class RangeRectInfo {
-               public Rectangle rangeRect;
-               public int startSec;
-               public int endSec;
-               public int preStartSec;
-
-               /* pixel */
-               public int firstStartXP;
-               public int downXP;
-
-               public Rectangle selectorRect;
-               protected int downLeftMarginP;
-       }
-
        private DACustomButtonClickEventListener addItemListButtonListener = new DACustomButtonClickEventListener() {
 
                @Override
@@ -94,11 +75,6 @@ public class TimelineTick {
                }
        };
 
-       public TimelineTick() {
-               rangeRectInfo = new RangeRectInfo();
-               chartRunningSec = (double) (TimelineConstants.CHART_RANGE_DEFAULT / TimelineConstants.KILO);
-       }
-
        public Composite createTimetickAndMenuComp(Composite baseComp) {
                timeAndMenuComp = new Composite(baseComp, SWT.NONE);
                timeAndMenuComp.setBackground(ColorResources.VIEW_BG_COLOR);
@@ -159,16 +135,13 @@ public class TimelineTick {
                                ColorResources.DEFAULT_FONT_COLOR);
                addItems.setFont(FontResources.ADDITEM_BUTTON_FONT);
 
-               // Label addItems = new Label(addItemComp, SWT.NONE);
                GridData gDataAddBtn = new GridData();
                gDataAddBtn.horizontalAlignment = GridData.FILL;
                gDataAddBtn.grabExcessHorizontalSpace = true;
                gDataAddBtn.verticalAlignment = GridData.FILL;
                gDataAddBtn.grabExcessVerticalSpace = true;
                addItems.setLayoutData(gDataAddBtn);
-               // addItems.setImage(ImageResources.ADD_ITEMS_BAR);
                addItems.addClickListener(addItemListButtonListener);
-               // addItems.addMouseListener(addItemListListener);
 
                minimizeItems = new DACustomButton(addItemComp,
                                ImageResources.TIMLINE_SIZE_MIN_NORMAL,
@@ -184,19 +157,6 @@ public class TimelineTick {
                return addItemComp;
        }
 
-       public void updateRuntime(long runTime) {
-               if (0 >= runTime) {
-                       return;
-               }
-               double runningTime = (double) (runTime / TimelineConstants.KILO);
-
-               if (chartRunningSec >= runningTime) {
-                       return;
-               }
-
-               chartRunningSec = runningTime;
-       }
-
        public void clear() {
                timeTickComp.clear();
        }