adds blank entry for waveform viewer
This commit is contained in:
@ -0,0 +1,21 @@
|
||||
package com.minres.scviewer.database.ui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.minres.scviewer.database.BlankWaveform;
|
||||
|
||||
public class TrackEntryGroup extends TrackEntry {
|
||||
|
||||
public List<TrackEntry> waveforms = new ArrayList<>();
|
||||
|
||||
public Boolean is_open = true;
|
||||
|
||||
public TrackEntryGroup(TrackEntry[] waveform, IWaveformStyleProvider styleProvider) {
|
||||
super(new BlankWaveform(), styleProvider);
|
||||
for (TrackEntry iWaveform : waveform) {
|
||||
waveforms.add(iWaveform);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -16,5 +16,5 @@ public enum WaveformColors {
|
||||
TX_BG, TX_BG_HIGHLITE, TX_BORDER,
|
||||
SIGNAL0, SIGNAL1, SIGNALZ, SIGNALX, SIGNALU, SIGNAL_TEXT, SIGNAL_REAL, SIGNAL_NAN,
|
||||
CURSOR, CURSOR_DRAG, CURSOR_TEXT,
|
||||
MARKER, MARKER_TEXT, REL_ARROW, REL_ARROW_HIGHLITE
|
||||
MARKER, MARKER_TEXT, REL_ARROW, REL_ARROW_HIGHLITE, BLANK
|
||||
}
|
@ -49,6 +49,7 @@ public class DefaultWaveformStyleProvider implements IWaveformStyleProvider {
|
||||
colors[WaveformColors.MARKER_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
|
||||
colors[WaveformColors.REL_ARROW.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_MAGENTA);
|
||||
colors[WaveformColors.REL_ARROW_HIGHLITE.ordinal()] = SWTResourceManager.getColor(255, 128, 255);
|
||||
colors[WaveformColors.BLANK.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_RED);
|
||||
}
|
||||
/**
|
||||
* needs redraw() afterwards
|
||||
|
@ -0,0 +1,45 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* MINRES Technologies GmbH - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package com.minres.scviewer.database.ui.swt.internal;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.graphics.Rectangle;
|
||||
|
||||
import com.minres.scviewer.database.ui.TrackEntry;
|
||||
import com.minres.scviewer.database.ui.WaveformColors;
|
||||
|
||||
public class BlankPainter extends TrackPainter {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private final WaveformCanvas waveCanvas;
|
||||
|
||||
public BlankPainter(WaveformCanvas txDisplay, boolean even, TrackEntry trackEntry) {
|
||||
super(trackEntry, even);
|
||||
this.waveCanvas = txDisplay;
|
||||
}
|
||||
|
||||
public void paintArea(Projection proj, Rectangle area) {
|
||||
if (trackEntry.selected)
|
||||
proj.setBackground(this.waveCanvas.styleProvider.getColor(WaveformColors.TRACK_BG_HIGHLITE));
|
||||
else
|
||||
proj.setBackground(this.waveCanvas.styleProvider.getColor(even ? WaveformColors.TRACK_BG_EVEN : WaveformColors.TRACK_BG_ODD));
|
||||
proj.setFillRule(SWT.FILL_EVEN_ODD);
|
||||
proj.fillRectangle(area);
|
||||
int trackHeight=trackEntry.height;
|
||||
int txBase=trackHeight*2/5;
|
||||
int txHeight=trackHeight/5;
|
||||
Rectangle bb = new Rectangle(area.x, area.y+txBase, area.width, txHeight);
|
||||
proj.setBackground(this.waveCanvas.styleProvider.getColor(WaveformColors.BLANK));
|
||||
proj.fillRectangle(bb);
|
||||
|
||||
}
|
||||
}
|
@ -47,7 +47,6 @@ import org.eclipse.swt.dnd.Transfer;
|
||||
import org.eclipse.swt.events.ControlAdapter;
|
||||
import org.eclipse.swt.events.ControlEvent;
|
||||
import org.eclipse.swt.events.DisposeListener;
|
||||
import org.eclipse.swt.events.MouseAdapter;
|
||||
import org.eclipse.swt.events.MouseEvent;
|
||||
import org.eclipse.swt.events.MouseListener;
|
||||
import org.eclipse.swt.events.PaintEvent;
|
||||
@ -91,6 +90,7 @@ import com.minres.scviewer.database.ui.IWaveformStyleProvider;
|
||||
import com.minres.scviewer.database.ui.IWaveformView;
|
||||
import com.minres.scviewer.database.ui.IWaveformZoom;
|
||||
import com.minres.scviewer.database.ui.TrackEntry;
|
||||
import com.minres.scviewer.database.ui.TrackEntryGroup;
|
||||
import com.minres.scviewer.database.ui.swt.internal.slider.ZoomBar;
|
||||
|
||||
public class WaveformView implements IWaveformView {
|
||||
@ -137,7 +137,7 @@ public class WaveformView implements IWaveformView {
|
||||
|
||||
protected TrackEntry lastClickedEntry;
|
||||
|
||||
protected MouseListener nameValueMouseListener = new MouseAdapter() {
|
||||
protected MouseListener nameValueMouseListener = new MouseListener() {
|
||||
|
||||
@Override
|
||||
public void mouseDown(MouseEvent e) {
|
||||
@ -173,6 +173,10 @@ public class WaveformView implements IWaveformView {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseDoubleClick(MouseEvent e) {
|
||||
}
|
||||
};
|
||||
|
||||
class WaveformMouseListener implements PaintListener, Listener {
|
||||
@ -551,29 +555,30 @@ public class WaveformView implements IWaveformView {
|
||||
public void update() {
|
||||
tracksVerticalHeight = 0;
|
||||
int nameMaxWidth = 0;
|
||||
IWaveformPainter painter = null;
|
||||
trackVerticalOffset.clear();
|
||||
waveformCanvas.clearAllWaveformPainter(false);
|
||||
boolean even = true;
|
||||
TextLayout tl = new TextLayout(waveformCanvas.getDisplay());
|
||||
tl.setFont(styleProvider.getNameFont());
|
||||
for (TrackEntry streamEntry : streams) {
|
||||
streamEntry.height = styleProvider.getTrackHeight();
|
||||
streamEntry.vOffset = tracksVerticalHeight;
|
||||
if (streamEntry.waveform.getType() == WaveformType.TRANSACTION) {
|
||||
streamEntry.currentValue = "";
|
||||
streamEntry.height *= streamEntry.waveform.getRowCount();
|
||||
painter = new StreamPainter(waveformCanvas, even, streamEntry);
|
||||
} else if (streamEntry.waveform.getType() == WaveformType.SIGNAL) {
|
||||
streamEntry.currentValue = "---";
|
||||
painter = new SignalPainter(waveformCanvas, even, streamEntry);
|
||||
if(streamEntry instanceof TrackEntryGroup && ((TrackEntryGroup)streamEntry).is_open) {
|
||||
TrackEntryGroup streamEntryGroup = (TrackEntryGroup)streamEntry;
|
||||
for (TrackEntry trackEntry : streamEntryGroup.waveforms) {
|
||||
addPainter(even, trackEntry);
|
||||
trackVerticalOffset.put(tracksVerticalHeight, trackEntry);
|
||||
tl.setText(trackEntry.waveform.getFullName());
|
||||
nameMaxWidth = Math.max(nameMaxWidth, tl.getBounds().width);
|
||||
tracksVerticalHeight += trackEntry.height;
|
||||
even = !even;
|
||||
}
|
||||
} else {
|
||||
addPainter(even, streamEntry);
|
||||
trackVerticalOffset.put(tracksVerticalHeight, streamEntry);
|
||||
tl.setText(streamEntry.waveform.getFullName());
|
||||
nameMaxWidth = Math.max(nameMaxWidth, tl.getBounds().width);
|
||||
tracksVerticalHeight += streamEntry.height;
|
||||
even = !even;
|
||||
}
|
||||
waveformCanvas.addWaveformPainter(painter, false);
|
||||
trackVerticalOffset.put(tracksVerticalHeight, streamEntry);
|
||||
tl.setText(streamEntry.waveform.getFullName());
|
||||
nameMaxWidth = Math.max(nameMaxWidth, tl.getBounds().width);
|
||||
tracksVerticalHeight += streamEntry.height;
|
||||
even = !even;
|
||||
}
|
||||
waveformCanvas.syncSb();
|
||||
nameList.setSize(nameMaxWidth + 15, tracksVerticalHeight);
|
||||
@ -588,6 +593,23 @@ public class WaveformView implements IWaveformView {
|
||||
tl.dispose();
|
||||
}
|
||||
|
||||
private void addPainter(boolean even, TrackEntry streamEntry) {
|
||||
streamEntry.height = styleProvider.getTrackHeight();
|
||||
streamEntry.vOffset = tracksVerticalHeight;
|
||||
if (streamEntry.waveform.getType() == WaveformType.TRANSACTION) {
|
||||
streamEntry.currentValue = "";
|
||||
streamEntry.height *= streamEntry.waveform.getRowCount();
|
||||
IWaveformPainter painter = new StreamPainter(waveformCanvas, even, streamEntry);
|
||||
waveformCanvas.addWaveformPainter(painter, false);
|
||||
} else if (streamEntry.waveform.getType() == WaveformType.SIGNAL) {
|
||||
streamEntry.currentValue = "---";
|
||||
waveformCanvas.addWaveformPainter(new SignalPainter(waveformCanvas, even, streamEntry), false);
|
||||
} else if (streamEntry.waveform.getType() == WaveformType.BLANK) {
|
||||
streamEntry.currentValue = "";
|
||||
waveformCanvas.addWaveformPainter(new BlankPainter(waveformCanvas, even, streamEntry), false);
|
||||
}
|
||||
}
|
||||
|
||||
private int calculateValueWidth() {
|
||||
TextLayout tl = new TextLayout(waveformCanvas.getDisplay());
|
||||
tl.setFont(styleProvider.getNameFontHighlite());
|
||||
|
Reference in New Issue
Block a user