Merge branch 'develop' of https://git.minres.com/VP/SCViewer.git into
develop Conflicts: com.minres.scviewer.database.test/inputs/simple_system.vcd com.minres.scviewer.database.test/src/com/minres/scviewer/database/test/DatabaseServicesTest.java com.minres.scviewer.database.text/.settings/org.eclipse.jdt.groovy.core.prefs com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/swt/internal/SignalPainter.java com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/swt/internal/WaveformCanvas.java com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/swt/internal/WaveformViewer.java com.minres.scviewer.database.ui/src/com/minres/scviewer/database/ui/WaveformColors.java com.minres.scviewer.database.vcd/src/com/minres/scviewer/database/vcd/VCDDbLoader.java com.minres.scviewer.database.vcd/src/com/minres/scviewer/database/vcd/VCDFileParser.java com.minres.scviewer.e4.application/plugin.xml com.minres.scviewer.e4.product/scviewer.product com.minres.scviewer.target/neon.target com.minres.scviewer.target/photon.target com.minres.scviewer.ui/.settings/org.eclipse.jdt.groovy.core.prefs
This commit is contained in:
@ -17,6 +17,7 @@ import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
@ -55,8 +56,11 @@ import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.jface.viewers.SelectionChangedEvent;
|
||||
import org.eclipse.swt.graphics.Point;
|
||||
import org.eclipse.swt.graphics.RGB;
|
||||
import org.eclipse.swt.graphics.Rectangle;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
|
||||
import com.minres.scviewer.database.ITx;
|
||||
@ -79,6 +83,7 @@ import com.minres.scviewer.e4.application.internal.util.IFileChangeListener;
|
||||
import com.minres.scviewer.e4.application.internal.util.IModificationChecker;
|
||||
import com.minres.scviewer.e4.application.preferences.DefaultValuesInitializer;
|
||||
import com.minres.scviewer.e4.application.preferences.PreferenceConstants;
|
||||
//import com.minres.scviewer.database.swt.internal.WaveformCanvas;
|
||||
|
||||
/**
|
||||
* The Class WaveformViewerPart.
|
||||
@ -727,6 +732,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||
* @param level the new zoom level
|
||||
*/
|
||||
public void setZoomLevel(Integer level) {
|
||||
//System.out.println("setZoomLevel() - ZoomLevel: " + level);
|
||||
if (level < 0)
|
||||
level = 0;
|
||||
if (level > zoomLevel.length - 1)
|
||||
@ -735,11 +741,43 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||
updateAll();
|
||||
}
|
||||
|
||||
//FIXME: need to use unitString and unitMultiplier from class WaveformCanvas which is located in >com.minres.scviewer.database.swt.internal.
|
||||
//Trying to import com.minres.scviewer.database.swt.internal.WaveformCanvas results in the error:
|
||||
//'Access restriction: The type 'WaveformCanvas' is not API (restriction on required project 'com.minres.scviewer.database.ui.swt')'.
|
||||
public final static String[] unitString={"fs", "ps", "ns", "<EFBFBD>s", "ms"};//, "s"};
|
||||
public final static int[] unitMultiplier={1, 3, 10, 30, 100, 300};
|
||||
|
||||
/**
|
||||
* Sets the zoom fit.
|
||||
*/
|
||||
public void setZoomFit() {
|
||||
waveformPane.setZoomLevel(6);
|
||||
|
||||
//actual max time of signal
|
||||
long maxTime = waveformPane.getMaxTime();
|
||||
|
||||
//get area actually capable of displaying data, i.e. area of the receiver which is capable of displaying data
|
||||
Rectangle clientArea = myParent.getClientArea();
|
||||
long clientAreaWidth = clientArea.width;
|
||||
|
||||
//System.out.println("ZoomLevel[] Array (Length " + zoomLevel.length + "): " + Arrays.toString(zoomLevel));
|
||||
//System.out.println("ClientArea myParent: " + myParent.getClientArea());
|
||||
//System.out.println("MaxTime: " + maxTime);
|
||||
//System.out.println("clientAreaWidth: " + clientAreaWidth);
|
||||
|
||||
boolean foundZoom=false;
|
||||
//try to find existing zoomlevel where scaleFactor*clientAreaWidth >= maxTime, if one is found set it as new zoomlevel
|
||||
for (int level=0; level<unitMultiplier.length*unitString.length; level++){
|
||||
long scaleFactor = (long) Math.pow(10, level/2);
|
||||
if(level%2==1) scaleFactor*=3;
|
||||
if(scaleFactor*clientAreaWidth >= maxTime) {
|
||||
setZoomLevel(level);
|
||||
foundZoom=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//if no zoom level is found, set biggest one available
|
||||
if(!foundZoom) setZoomLevel(unitMultiplier.length*unitString.length-1);
|
||||
|
||||
updateAll();
|
||||
}
|
||||
|
||||
|
@ -41,11 +41,13 @@ public class DefaultValuesInitializer extends AbstractPreferenceInitializer {
|
||||
colors[WaveformColors.TX_BG.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GREEN);
|
||||
colors[WaveformColors.TX_BG_HIGHLITE.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GREEN);
|
||||
colors[WaveformColors.TX_BORDER.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
|
||||
colors[WaveformColors.SIGNAL0.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GREEN);
|
||||
colors[WaveformColors.SIGNAL1.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GREEN);
|
||||
colors[WaveformColors.SIGNAL0.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GREEN);
|
||||
colors[WaveformColors.SIGNAL1.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GREEN);
|
||||
colors[WaveformColors.SIGNALZ.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_YELLOW);
|
||||
colors[WaveformColors.SIGNALX.ordinal()] = SWTResourceManager.getColor(255, 51, 51);
|
||||
colors[WaveformColors.SIGNALU.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_YELLOW);
|
||||
colors[WaveformColors.SIGNAL_REAL.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_YELLOW);
|
||||
colors[WaveformColors.SIGNAL_NAN.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
|
||||
colors[WaveformColors.SIGNAL_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
|
||||
colors[WaveformColors.CURSOR.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
|
||||
colors[WaveformColors.CURSOR_DRAG.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GRAY);
|
||||
|
@ -20,7 +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.ISignalChangeBitVector;
|
||||
import com.minres.scviewer.database.ITxStream;
|
||||
import com.minres.scviewer.database.IWaveformDb;
|
||||
import com.minres.scviewer.e4.application.parts.LoadingWaveformDb;
|
||||
@ -101,7 +101,7 @@ public class TxDbLabelProvider implements ILabelProvider {
|
||||
return stream;
|
||||
}else if(element instanceof ISignal<?>){
|
||||
Object o = ((ISignal<?>)element).getEvents().firstEntry().getValue();
|
||||
if(o instanceof ISignalChangeMulti)
|
||||
if(o instanceof ISignalChangeBitVector)
|
||||
return wave;
|
||||
else
|
||||
return signal;
|
||||
|
Reference in New Issue
Block a user