diff --git a/com.minres.scviewer.database.swt/src/com/minres/scviewer/database/swt/TxDisplay.java b/com.minres.scviewer.database.swt/src/com/minres/scviewer/database/swt/TxDisplay.java index 19aa5fa..202c9e3 100644 --- a/com.minres.scviewer.database.swt/src/com/minres/scviewer/database/swt/TxDisplay.java +++ b/com.minres.scviewer.database.swt/src/com/minres/scviewer/database/swt/TxDisplay.java @@ -93,7 +93,9 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider { private PropertyChangeSupport pcs; - public static final String CURSOR_PROPERTY = "cursor time"; + public static final String CURSOR_PROPERTY = "cursor_time"; + + public static final String MARKER_PROPERTY = "marker_time"; private static final String SELECTION = "selection"; @@ -117,6 +119,8 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider { Vector cursorPainters; + int selectedMarker = 0; + private Composite trackPane; private int trackVerticalHeight; @@ -171,37 +175,8 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider { public void mouseUp(MouseEvent e) { if (e.button == 1) { if(Math.abs(e.x-start.x)<3 && Math.abs(e.y-start.y)<3){ - long time= waveformList.getTimeForOffset(e.x); - long scaling=5*waveformList.getScaleFactor(); - for(Object o:waveformList.getClicked(start)){ - Entry floorEntry=null, ceilEntry=null; - if(o instanceof ISignal){ - NavigableMap map = ((ISignal)o).getEvents(); - floorEntry = map.floorEntry(time); - ceilEntry = map.ceilingEntry(time); - } else if (o instanceof ITxStream){ - NavigableMap map = ((ITxStream)o).getEvents(); - floorEntry = map.floorEntry(time); - ceilEntry = map.ceilingEntry(time); - } else if(o instanceof ITx){ - NavigableMap map = ((ITx)o).getStream().getEvents(); - floorEntry = map.floorEntry(time); - ceilEntry = map.ceilingEntry(time); - } - if(floorEntry!=null && time-floorEntry.getKey()>scaling) - floorEntry=null; - if(ceilEntry!=null && ceilEntry.getKey()-time>scaling) - ceilEntry=null; - if(ceilEntry==null && floorEntry!=null){ - time=floorEntry.getKey(); - }else if(ceilEntry!=null && floorEntry==null){ - time=ceilEntry.getKey(); - }else if(ceilEntry!=null && floorEntry!=null){ - time=time-floorEntry.getKey() floorEntry=null, ceilEntry=null; + if(o instanceof ISignal){ + NavigableMap map = ((ISignal)o).getEvents(); + floorEntry = map.floorEntry(time); + ceilEntry = map.ceilingEntry(time); + } else if (o instanceof ITxStream){ + NavigableMap map = ((ITxStream)o).getEvents(); + floorEntry = map.floorEntry(time); + ceilEntry = map.ceilingEntry(time); + } else if(o instanceof ITx){ + NavigableMap map = ((ITx)o).getStream().getEvents(); + floorEntry = map.floorEntry(time); + ceilEntry = map.ceilingEntry(time); + } + if(floorEntry!=null && time-floorEntry.getKey()>scaling) + floorEntry=null; + if(ceilEntry!=null && ceilEntry.getKey()-time>scaling) + ceilEntry=null; + if(ceilEntry==null && floorEntry!=null){ + time=floorEntry.getKey(); + }else if(ceilEntry!=null && floorEntry==null){ + time=ceilEntry.getKey(); + }else if(ceilEntry!=null && floorEntry!=null){ + time=time-floorEntry.getKey()index+1){ + final Long oldVal= cursorPainters.get(1+index).getTime(); + cursorPainters.get(1+index).setTime(time); + pcs.firePropertyChange(MARKER_PROPERTY, oldVal, time); + } + } + public long getCursorTime(){ return cursorPainters.get(0).getTime(); } + public long getActMarkerTime(){ + return getMarkerTime(selectedMarker); + } + + public long getMarkerTime(int index){ + return cursorPainters.get(index+1).getTime(); + } + private void createStreamDragSource(final Canvas canvas) { Transfer[] types = new Transfer[] { LocalSelectionTransfer.getTransfer() }; DragSource dragSource = new DragSource(canvas, DND.DROP_MOVE); @@ -837,13 +874,6 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider { Object target = trackVerticalOffset.floorEntry(dropPoint.y).getValue(); if(source instanceof IWaveform && target instanceof IWaveform){ IWaveform srcWave=(IWaveform) source; - // int srcIdx=streams.indexOf(source); - // int tgtIdx=streams.indexOf(target); - // if(srcIdx clicked = waveformList.getClicked(new Point(event.x, event.y)); + for(Object o:clicked){ if(o instanceof CursorPainter){ LocalSelectionTransfer.getTransfer().setSelection(new StructuredSelection(o)); ((CursorPainter)o).setDragging(true); @@ -907,8 +939,9 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider { ISelection sel = LocalSelectionTransfer.getTransfer().getSelection(); if(sel!=null && sel instanceof IStructuredSelection && ((IStructuredSelection)sel).getFirstElement() instanceof CursorPainter){ - ((CursorPainter)((IStructuredSelection)sel).getFirstElement()).setDragging(false); - updateWaveform(canvas, event); + CursorPainter painter = (CursorPainter)((IStructuredSelection)sel).getFirstElement(); + painter.setDragging(false); + updateWaveform(canvas, event, painter); } } } @@ -924,13 +957,21 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider { ISelection sel = LocalSelectionTransfer.getTransfer().getSelection(); if(sel!=null && sel instanceof IStructuredSelection && ((IStructuredSelection)sel).getFirstElement() instanceof CursorPainter){ - updateWaveform(canvas, event); + updateWaveform(canvas, event, (CursorPainter) ((IStructuredSelection)sel).getFirstElement()); } } - protected void updateWaveform(final Canvas canvas, DropTargetEvent event) { + protected void updateWaveform(final Canvas canvas, DropTargetEvent event, CursorPainter painter) { Point dropPoint = canvas.toControl(event.x, event.y); - setCursorTime(waveformList.getTimeForOffset(dropPoint.x)); + long time = waveformList.getTimeForOffset(dropPoint.x); + final Long oldVal= painter.getTime(); + painter.setTime(time); + if(painter.id<0){ + pcs.firePropertyChange(CURSOR_PROPERTY, oldVal, time); + }else{ + pcs.firePropertyChange(MARKER_PROPERTY, oldVal, time); + pcs.firePropertyChange(MARKER_PROPERTY+painter.id, oldVal, time); + } canvas.getDisplay().asyncExec(new Runnable() { @Override public void run() { @@ -973,9 +1014,20 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider { return this.pcs.hasListeners(propertyName); } - public String getScaledTime(Long time) { + public String getScaledTime(long time) { StringBuilder sb = new StringBuilder(); - return sb.append(time/waveformList.getScaleFactor()).append(waveformList.getUnitStr()).toString(); + Double dTime=new Double(time); + return sb.append(dTime/waveformList.getScaleFactorPow10()).append(waveformList.getUnitStr()).toString(); } + public String[] getZoomLevels(){ + String[] res = new String[WaveformCanvas.unitMultiplier.length*WaveformCanvas.unitString.length]; + int index=0; + for(String unit:WaveformCanvas.unitString){ + for(int factor:WaveformCanvas.unitMultiplier){ + res[index++]= new Integer(factor).toString()+unit; + } + } + return res; + } } diff --git a/com.minres.scviewer.database.swt/src/com/minres/scviewer/database/swt/internal/CursorPainter.java b/com.minres.scviewer.database.swt/src/com/minres/scviewer/database/swt/internal/CursorPainter.java index f911068..0ecc169 100644 --- a/com.minres.scviewer.database.swt/src/com/minres/scviewer/database/swt/internal/CursorPainter.java +++ b/com.minres.scviewer.database.swt/src/com/minres/scviewer/database/swt/internal/CursorPainter.java @@ -10,27 +10,31 @@ *******************************************************************************/ package com.minres.scviewer.database.swt.internal; +import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.GC; import org.eclipse.swt.graphics.Rectangle; public class CursorPainter implements IPainter { - + /** * */ private final WaveformCanvas waveCanvas; + private long time; private boolean isDragging; - private boolean drawTime; + + public final int id; + /** * @param i * @param txDisplay */ - public CursorPainter(WaveformCanvas txDisplay, long time) { + public CursorPainter(WaveformCanvas txDisplay, long time, int id) { this.waveCanvas = txDisplay; this.time=time; - drawTime=true; + this.id=id; } public long getTime() { @@ -42,29 +46,30 @@ public class CursorPainter implements IPainter { } public boolean isDragging() { - return isDragging; - } - - public void setDragging(boolean isDragging) { - this.isDragging = isDragging; - } - - public void paintArea(GC gc, Rectangle area) { - if(this.waveCanvas.streams.size()>0){ - long scaleFactor=waveCanvas.getScaleFactor(); - int x = (int) (time/scaleFactor); - if(x>=area.x && x<=(area.x+area.width)){ - gc.setForeground( - waveCanvas.colors[isDragging? - WaveformCanvas.Colors.CURSOR_DRAG.ordinal(): - WaveformCanvas.Colors.CURSOR.ordinal()]); - gc.drawLine(x, area.y, x, area.y+area.height); - if(drawTime){ - gc.setBackground(waveCanvas.colors[WaveformCanvas.Colors.CURSOR.ordinal()]); - gc.setForeground(waveCanvas.colors[WaveformCanvas.Colors.CURSOR_TEXT.ordinal()]); - gc.drawText(Double.toString(x*waveCanvas.getUnitMultiplier())+waveCanvas.getUnitStr(), x+1, area.y); - } - } - } + return isDragging; } + + public void setDragging(boolean isDragging) { + this.isDragging = isDragging; + } + + public void paintArea(GC gc, Rectangle area) { + if(this.waveCanvas.streams.size()>0){ + long scaleFactor=waveCanvas.getScaleFactor(); + int x = (int) (time/scaleFactor); + int top = id<0?area.y:area.y+15; + Color drawColor=waveCanvas.colors[id<0?WaveformCanvas.Colors.CURSOR.ordinal():WaveformCanvas.Colors.MARKER.ordinal()]; + Color dragColor = waveCanvas.colors[WaveformCanvas.Colors.CURSOR_DRAG.ordinal()]; + Color textColor=waveCanvas.colors[id<0?WaveformCanvas.Colors.CURSOR_TEXT.ordinal():WaveformCanvas.Colors.MARKER_TEXT.ordinal()]; + if(x>=area.x && x<=(area.x+area.width)){ + gc.setForeground(isDragging?dragColor:drawColor); + gc.drawLine(x, top, x, area.y+area.height); + gc.setBackground(drawColor); + gc.setForeground(textColor); + Double dTime=new Double(time); + gc.drawText((dTime/waveCanvas.getScaleFactorPow10())+waveCanvas.getUnitStr(), x+1, top); + } + } + } + } \ No newline at end of file diff --git a/com.minres.scviewer.database.swt/src/com/minres/scviewer/database/swt/internal/RulerPainter.java b/com.minres.scviewer.database.swt/src/com/minres/scviewer/database/swt/internal/RulerPainter.java index af7fb72..2be9829 100644 --- a/com.minres.scviewer.database.swt/src/com/minres/scviewer/database/swt/internal/RulerPainter.java +++ b/com.minres.scviewer.database.swt/src/com/minres/scviewer/database/swt/internal/RulerPainter.java @@ -35,11 +35,16 @@ public class RulerPainter implements IPainter { String unit=waveCanvas.getUnitStr(); int unitMultiplier=waveCanvas.getUnitMultiplier(); long scaleFactor=waveCanvas.getScaleFactor(); + long zoomLevel = waveCanvas.getZoomLevel(); long start=area.x*scaleFactor; long end=start+area.width*scaleFactor; long rulerTickMinor = rulerTickMinorC*scaleFactor; long rulerTickMajor = rulerTickMajorC*scaleFactor; + if(zoomLevel%3==1){ + rulerTickMinor/=3; + rulerTickMajor/=3; + } int minorTickY = waveCanvas.rulerHeight-5; int majorTickY = waveCanvas.rulerHeight-15; int textY=waveCanvas.rulerHeight-20; diff --git a/com.minres.scviewer.database.swt/src/com/minres/scviewer/database/swt/internal/WaveformCanvas.java b/com.minres.scviewer.database.swt/src/com/minres/scviewer/database/swt/internal/WaveformCanvas.java index e5fed1f..810543d 100644 --- a/com.minres.scviewer.database.swt/src/com/minres/scviewer/database/swt/internal/WaveformCanvas.java +++ b/com.minres.scviewer.database.swt/src/com/minres/scviewer/database/swt/internal/WaveformCanvas.java @@ -47,17 +47,18 @@ public class WaveformCanvas extends Canvas { TRACK_BG_EVEN, TRACK_BG_ODD, TRACK_BG_HIGHLITE, TX_BG, TX_BG_HIGHLITE, TX_BORDER, SIGNAL0, SIGNAL1, SIGNALZ, SIGNALX, SIGNAL_TEXT, - CURSOR, CURSOR_DRAG, CURSOR_TEXT + CURSOR, CURSOR_DRAG, CURSOR_TEXT, + MARKER, MARKER_TEXT } Color[] colors = new Color[Colors.values().length]; private int trackHeight = 50; - private long scaleFactor = 1000000L; + private long scaleFactor = 1000000L; // 1ns String unit="ns"; - private int level = 6; - private final static String[] unitString={"fs", "ps", "ns", "µs", "ms", "s"}; - private final static int[] unitMultiplier={1, 10, 100}; + private int level = 12; + public final static String[] unitString={"fs", "ps", "ns", "µs", "ms"};//, "s"}; + public final static int[] unitMultiplier={1, 3, 10, 30, 100, 300}; private long maxTime; protected Point origin; /* original size */ protected Transform transform; @@ -127,6 +128,8 @@ public class WaveformCanvas extends Canvas { colors[Colors.CURSOR.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED); colors[Colors.CURSOR_DRAG.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GRAY); colors[Colors.CURSOR_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE); + colors[Colors.MARKER.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GRAY); + colors[Colors.MARKER_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE); } } @@ -180,23 +183,36 @@ public class WaveformCanvas extends Canvas { public int getZoomLevel() { return level; } + + public int getMaxZoomLevel(){ + return unitMultiplier.length*unitString.length-1; + } public void setZoomLevel(int level) { - this.level = level; - this.scaleFactor = (long) Math.pow(10, level); - syncScrollBars(); + if(level - - - - - + - - - - diff --git a/com.minres.scviewer.e4.application/build.properties b/com.minres.scviewer.e4.application/build.properties index d93eaca..25fb672 100644 --- a/com.minres.scviewer.e4.application/build.properties +++ b/com.minres.scviewer.e4.application/build.properties @@ -6,5 +6,6 @@ bin.includes = META-INF/,\ Application.e4xmi,\ icons/,\ css/default.css,\ - OSGI-INF/l10n/bundle.properties + OSGI-INF/l10n/bundle.properties,\ + OSGI-INF/ source.. = src/ diff --git a/com.minres.scviewer.e4.application/icons/wave.png b/com.minres.scviewer.e4.application/icons/wave.png new file mode 100644 index 0000000..1ad8f18 Binary files /dev/null and b/com.minres.scviewer.e4.application/icons/wave.png differ diff --git a/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/internal/StatusBarControl.java b/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/internal/StatusBarControl.java index 38fde61..b85caf7 100644 --- a/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/internal/StatusBarControl.java +++ b/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/internal/StatusBarControl.java @@ -35,8 +35,6 @@ import org.osgi.service.prefs.PreferencesService; public class StatusBarControl { public static final String STATUS_UPDATE="StatusUpdate"; - public static final String ZOOM_LEVEL="ZoomLevelUpdate"; - public static final String CURSOR_TIME="CursorPosUpdate"; @Inject EModelService modelService; diff --git a/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/internal/WaveStatusBarControl.java b/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/internal/WaveStatusBarControl.java index 0f1e1d4..0e65bc2 100644 --- a/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/internal/WaveStatusBarControl.java +++ b/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/internal/WaveStatusBarControl.java @@ -29,9 +29,10 @@ import org.eclipse.swt.widgets.Composite; public class WaveStatusBarControl extends StatusBarControl { - public static final String STATUS_UPDATE="StatusUpdate"; public static final String ZOOM_LEVEL="ZoomLevelUpdate"; public static final String CURSOR_TIME="CursorPosUpdate"; + public static final String MARKER_TIME="MarkerPosUpdate"; + public static final String MARKER_DIFF="MarlerDiffUpdate"; @Inject EModelService modelService; @@ -74,14 +75,18 @@ public class WaveStatusBarControl extends StatusBarControl { } - TextContributionItem zoomContribution, cursorContribution; + TextContributionItem cursorContribution, markerContribution, markerDiffContribution, zoomContribution; @Inject public WaveStatusBarControl(UISynchronize sync) { super(sync); - zoomContribution = new TextContributionItem("Z:", 150); - cursorContribution = new TextContributionItem("C:", 120); - manager.prependToGroup(StatusLineManager.BEGIN_GROUP,cursorContribution); + cursorContribution = new TextContributionItem("C:", 80); + markerContribution = new TextContributionItem("M:", 80); + markerDiffContribution = new TextContributionItem("C-M:", 80); + zoomContribution = new TextContributionItem("Z:", 80); + manager.appendToGroup(StatusLineManager.BEGIN_GROUP,cursorContribution); + manager.appendToGroup(StatusLineManager.BEGIN_GROUP,markerContribution); + manager.appendToGroup(StatusLineManager.BEGIN_GROUP,markerDiffContribution); manager.appendToGroup(StatusLineManager.BEGIN_GROUP, zoomContribution); } @@ -112,4 +117,14 @@ public class WaveStatusBarControl extends StatusBarControl { cursorContribution.setText(text); } + @Inject @Optional + public void getMarkerEvent(@UIEventTopic(MARKER_TIME) String text) { + markerContribution.setText(text); + } + + @Inject @Optional + public void getDiffEvent(@UIEventTopic(MARKER_DIFF) String text) { + markerDiffContribution.setText(text); + } + } \ No newline at end of file diff --git a/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/DesignBrowser.java b/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/DesignBrowser.java index 27826df..137b970 100644 --- a/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/DesignBrowser.java +++ b/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/DesignBrowser.java @@ -41,17 +41,17 @@ public class DesignBrowser implements ISelectionChangedListener { @Inject ESelectionService selectionService; - private TreeViewer contentOutlineViewer; + private TreeViewer treeViewer; private PropertyChangeListener l = new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { if("CHILDS".equals(evt.getPropertyName())){ - contentOutlineViewer.getTree().getDisplay().asyncExec(new Runnable() { + treeViewer.getTree().getDisplay().asyncExec(new Runnable() { @Override public void run() { - contentOutlineViewer.refresh(); + treeViewer.refresh(); } }); } @@ -62,18 +62,19 @@ public class DesignBrowser implements ISelectionChangedListener { @PostConstruct public void createComposite(Composite parent) { parent.setLayout(new GridLayout(1, false)); - contentOutlineViewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); - contentOutlineViewer.addSelectionChangedListener(this); - contentOutlineViewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH)); - contentOutlineViewer.setContentProvider(new TxDbContentProvider()); - contentOutlineViewer.setLabelProvider(new TxDbLabelProvider()); - contentOutlineViewer.setUseHashlookup(true); + treeViewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); + treeViewer.addSelectionChangedListener(this); + treeViewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH)); + treeViewer.setContentProvider(new TxDbContentProvider()); + treeViewer.setLabelProvider(new TxDbLabelProvider()); + treeViewer.setUseHashlookup(true); + treeViewer.setAutoExpandLevel(2); } @Focus public void setFocus() { - contentOutlineViewer.getTree().setFocus(); - selectionService.setSelection(contentOutlineViewer.getSelection()); + treeViewer.getTree().setFocus(); + selectionService.setSelection(treeViewer.getSelection()); } @Override @@ -85,10 +86,10 @@ public class DesignBrowser implements ISelectionChangedListener { @Inject @Optional public void getStatusEvent(@UIEventTopic(WaveformViewerPart.ACTIVE_WAVEFORMVIEW) WaveformViewerPart waveformViewerPart) { IWaveformDb database = waveformViewerPart.getDatabase(); - Object input = contentOutlineViewer.getInput(); + Object input = treeViewer.getInput(); if(input!=null && input instanceof List) ((List)input).get(0).removePropertyChangeListener(l); - contentOutlineViewer.setInput(database.isLoaded()?Arrays.asList(new IWaveformDb[]{database}):null); + treeViewer.setInput(database.isLoaded()?Arrays.asList(new IWaveformDb[]{database}):null); // Set up the tree viewer database.addPropertyChangeListener(l); } diff --git a/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/TransactionDetails.java b/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/TransactionDetails.java index 2351c34..a6e89c3 100644 --- a/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/TransactionDetails.java +++ b/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/TransactionDetails.java @@ -378,7 +378,7 @@ public class TransactionDetails { res.add(new Object[]{ rel.getRelationType(), rel.getSource().getGenerator().getName(), - txToString(rel.getSource())}); + rel.getSource()}); } return res.toArray(); } else if(propertyHolder.type == Type.OUT_REL){ @@ -387,7 +387,7 @@ public class TransactionDetails { res.add(new Object[]{ rel.getRelationType(), rel.getTarget().getGenerator().getName(), - txToString(rel.getTarget())}); + rel.getTarget()}); } return res.toArray(); } @@ -447,6 +447,8 @@ public class TransactionDetails { }else if(element instanceof Object[]){ Object[] elements = (Object[]) element; return new StyledString(elements[field].toString()); + } else if(element instanceof ITx){ + return new StyledString(txToString((ITx) element)); }else return new StyledString(""); } diff --git a/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/WaveformViewerPart.java b/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/WaveformViewerPart.java index a821e0d..d529b36 100644 --- a/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/WaveformViewerPart.java +++ b/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/WaveformViewerPart.java @@ -54,7 +54,7 @@ import com.minres.scviewer.database.IWaveformDbFactory; import com.minres.scviewer.database.IWaveformEvent; import com.minres.scviewer.database.swt.GotoDirection; import com.minres.scviewer.database.swt.TxDisplay; -import com.minres.scviewer.e4.application.internal.StatusBarControl; +import com.minres.scviewer.e4.application.internal.WaveStatusBarControl; public class WaveformViewerPart { @@ -64,12 +64,7 @@ public class WaveformViewerPart { protected static final String DATABASE_FILE = "DATABASE_FILE"; protected static final String SHOWN_WAVEFORM = "SHOWN_WAVEFORM"; - private final static String[] zoomLevel={ - "1fs", "10fs", "100fs", - "1ps", "10ps", "100ps", - "1ns", "10ns", "100ns", - "1µs", "10µs", "10µs", - "1ms", "10ms", "100ms", "1s"}; + private String[] zoomLevel; public static final String ID = "com.minres.scviewer.ui.TxEditorPart"; //$NON-NLS-1$ @@ -115,10 +110,21 @@ public class WaveformViewerPart { @Override public void propertyChange(PropertyChangeEvent evt) { Long time = (Long) evt.getNewValue(); - eventBroker.post(StatusBarControl.CURSOR_TIME, ""+ time/1000000+"ns"); + eventBroker.post(WaveStatusBarControl.CURSOR_TIME, txDisplay.getScaledTime(time)); + long marker=txDisplay.getActMarkerTime(); + eventBroker.post(WaveStatusBarControl.MARKER_DIFF, txDisplay.getScaledTime(time-marker)); } }); + txDisplay.addPropertyChangeListener(TxDisplay.MARKER_PROPERTY, new PropertyChangeListener() { + @Override + public void propertyChange(PropertyChangeEvent evt) { + Long time = (Long) evt.getNewValue(); + eventBroker.post(WaveStatusBarControl.MARKER_TIME, txDisplay.getScaledTime(time)); + long cursor=txDisplay.getCursorTime(); + eventBroker.post(WaveStatusBarControl.MARKER_DIFF, txDisplay.getScaledTime(cursor-time)); + } + }); txDisplay.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { @@ -126,6 +132,7 @@ public class WaveformViewerPart { selectionService.setSelection(event.getSelection()); } }); + zoomLevel=txDisplay.getZoomLevels(); filesToLoad=new ArrayList(); persistedState = part.getPersistedState(); Integer files = persistedState.containsKey(DATABASE_FILE+"S")?Integer.parseInt(persistedState.get(DATABASE_FILE+"S")):0; @@ -134,7 +141,7 @@ public class WaveformViewerPart { } if(filesToLoad.size()>0) loadDatabase(); - eventBroker.post(StatusBarControl.ZOOM_LEVEL, zoomLevel[txDisplay.getZoomLevel()]); + eventBroker.post(WaveStatusBarControl.ZOOM_LEVEL, zoomLevel[txDisplay.getZoomLevel()]); menuService.registerContextMenu(txDisplay.getNameControl(), "com.minres.scviewer.e4.application.popupmenu.namecontext"); menuService.registerContextMenu(txDisplay.getValueControl(), "com.minres.scviewer.e4.application.popupmenu.namecontext"); menuService.registerContextMenu(txDisplay.getWaveformControl(), "com.minres.scviewer.e4.application.popupmenu.wavecontext"); @@ -248,8 +255,12 @@ public class WaveformViewerPart { private void updateAll() { eventBroker.post(ACTIVE_WAVEFORMVIEW, this); - eventBroker.post(StatusBarControl.ZOOM_LEVEL, zoomLevel[txDisplay.getZoomLevel()]); - eventBroker.post(StatusBarControl.CURSOR_TIME, Long.toString(txDisplay.getCursorTime()/1000000)+"ns"); + eventBroker.post(WaveStatusBarControl.ZOOM_LEVEL, zoomLevel[txDisplay.getZoomLevel()]); + long cursor=txDisplay.getCursorTime(); + long marker=txDisplay.getActMarkerTime(); + eventBroker.post(WaveStatusBarControl.CURSOR_TIME, txDisplay.getScaledTime(cursor)); + eventBroker.post(WaveStatusBarControl.MARKER_TIME, txDisplay.getScaledTime(marker)); + eventBroker.post(WaveStatusBarControl.MARKER_DIFF, txDisplay.getScaledTime(cursor-marker)); } @Inject @Optional @@ -356,13 +367,11 @@ public class WaveformViewerPart { if(level<0) level=0; if(level>zoomLevel.length-1) level=zoomLevel.length-1; txDisplay.setZoomLevel(level); - eventBroker.post(StatusBarControl.ZOOM_LEVEL, zoomLevel[txDisplay.getZoomLevel()]); - } + updateAll(); } public void setZoomFit() { txDisplay.setZoomLevel(6); - eventBroker.post(StatusBarControl.ZOOM_LEVEL, zoomLevel[txDisplay.getZoomLevel()]); - } + updateAll(); } public int getZoomLevel() { return txDisplay.getZoomLevel(); diff --git a/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/provider/TxDbLabelProvider.java b/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/provider/TxDbLabelProvider.java index a4a6eb9..3011853 100644 --- a/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/provider/TxDbLabelProvider.java +++ b/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/provider/TxDbLabelProvider.java @@ -20,6 +20,7 @@ import org.eclipse.wb.swt.ResourceManager; import com.minres.scviewer.database.IHierNode; import com.minres.scviewer.database.ISignal; +import com.minres.scviewer.database.ISignalChangeMulti; import com.minres.scviewer.database.ITxStream; import com.minres.scviewer.database.IWaveformDb; @@ -27,10 +28,7 @@ public class TxDbLabelProvider implements ILabelProvider { private List listeners = new ArrayList(); - private Image database; - private Image stream; - private Image signal; - private Image folder; + private Image database, stream, signal, folder, wave; public TxDbLabelProvider() { @@ -39,6 +37,7 @@ public class TxDbLabelProvider implements ILabelProvider { stream=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/stream.png"); folder=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/folder.png"); signal=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/signal.png"); + wave=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/wave.png"); } @Override @@ -52,6 +51,7 @@ public class TxDbLabelProvider implements ILabelProvider { if(stream!=null) stream.dispose(); if(folder!=null) folder.dispose(); if(signal!=null) signal.dispose(); + if(wave!=null) wave.dispose(); } @Override @@ -71,7 +71,11 @@ public class TxDbLabelProvider implements ILabelProvider { }else if(element instanceof ITxStream){ return stream; }else if(element instanceof ISignal){ - return signal; + Object o = ((ISignal)element).getEvents().firstEntry().getValue(); + if(o instanceof ISignalChangeMulti) + return wave; + else + return signal; }else if(element instanceof IHierNode){ return folder; } else diff --git a/com.minres.scviewer.e4.product/icons/SCViewer.icns b/com.minres.scviewer.e4.product/icons/SCViewer.icns index 132c23d..6b4aa03 100644 Binary files a/com.minres.scviewer.e4.product/icons/SCViewer.icns and b/com.minres.scviewer.e4.product/icons/SCViewer.icns differ diff --git a/com.minres.scviewer.e4.product/scviewer.product b/com.minres.scviewer.e4.product/scviewer.product index a67f7bb..af56310 100644 --- a/com.minres.scviewer.e4.product/scviewer.product +++ b/com.minres.scviewer.e4.product/scviewer.product @@ -15,13 +15,11 @@ - -