apply UI fixes

* wrong arrow target of transaction
* wrong zomm factor calculation for zoom fit
* streams and waveforms not visible if at root level
This commit is contained in:
Eyck Jentzsch 2021-03-25 20:18:50 +00:00
parent caa37375c0
commit 78faab404c
9 changed files with 26 additions and 50 deletions

View File

@ -110,48 +110,23 @@ public class ArrowPainter implements IPainter {
protected void deriveGeom(Collection<ITxRelation> relations, List<LinkEntry> res, boolean useTarget) { protected void deriveGeom(Collection<ITxRelation> relations, List<LinkEntry> res, boolean useTarget) {
for (ITxRelation iTxRelation : relations) { for (ITxRelation iTxRelation : relations) {
ITx otherTx = useTarget ? iTxRelation.getTarget() : iTxRelation.getSource(); ITx otherTx = useTarget ? iTxRelation.getTarget() : iTxRelation.getSource();
Rectangle bb = createLinkEntry(otherTx, otherTx.getStream()); for(IWaveform iWaveform: new IWaveform[]{otherTx.getStream(), otherTx.getGenerator()}) {
if(bb!=null){ if (waveCanvas.wave2painterMap.containsKey(iWaveform)) {
res.add(new LinkEntry(bb, iTxRelation.getRelationType())); IWaveformPainter painter = waveCanvas.wave2painterMap.get(iWaveform);
return; if(painter!=null) {
} else { int height = waveCanvas.styleProvider.getTrackHeight();
for(IHierNode gen:otherTx.getStream().getChildNodes()) { Rectangle bb = new Rectangle(
if(gen instanceof IWaveform) { (int) (otherTx.getBeginTime() / scaleFactor),
bb = createLinkEntry(otherTx, (IWaveform) gen); waveCanvas.rulerHeight + painter.getVerticalOffset() + height * getConcurrencyIndex(otherTx),
if(bb!=null){ (int) ((otherTx.getEndTime() - otherTx.getBeginTime()) / scaleFactor),
res.add(new LinkEntry(bb, iTxRelation.getRelationType())); height);
return; res.add(new LinkEntry(bb, iTxRelation.getRelationType()));
}
} }
} }
} }
} }
} }
private Rectangle createLinkEntry(ITx otherTx, IWaveform iWaveform) {
if (waveCanvas.wave2painterMap.containsKey(iWaveform)) {
IWaveformPainter painter = waveCanvas.wave2painterMap.get(otherTx.getStream());
if(painter==null) {
for(IHierNode gen:otherTx.getStream().getChildNodes()) {
if(gen instanceof IWaveform) {
painter = waveCanvas.wave2painterMap.get(gen);
if(painter!=null)
break;
}
}
}
if(painter!=null) {
int height = waveCanvas.styleProvider.getTrackHeight();
return new Rectangle(
(int) (otherTx.getBeginTime() / scaleFactor),
waveCanvas.rulerHeight + painter.getVerticalOffset() + height * getConcurrencyIndex(otherTx),
(int) ((otherTx.getEndTime() - otherTx.getBeginTime()) / scaleFactor),
height);
}
}
return null;
}
@Override @Override
public void paintArea(Projection proj, Rectangle clientRect) { public void paintArea(Projection proj, Rectangle clientRect) {
yCtrlOffset = waveCanvas.styleProvider.getTrackHeight()/2; yCtrlOffset = waveCanvas.styleProvider.getTrackHeight()/2;

View File

@ -1035,15 +1035,20 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
boolean foundZoom=false; boolean foundZoom=false;
//try to find existing zoomlevel where scaleFactor*clientAreaWidth >= maxTime, if one is found set it as new zoomlevel //try to find existing zoomlevel where scaleFactor*clientAreaWidth >= maxTime, if one is found set it as new zoomlevel
for (int level=0; level<Constants.UNIT_MULTIPLIER.length*Constants.UNIT_STRING.length; level++){ int magnitude_factor=1;
long scaleFactor = (long) Math.pow(10, level/2d); for(int magnitude=0; magnitude<Constants.UNIT_STRING.length; magnitude++) {
if(level%2==1) scaleFactor*=3; for (int multiplier=0; multiplier<Constants.UNIT_MULTIPLIER.length; multiplier++){
if(scaleFactor*clientAreaWidth >= maxTime) { int level = magnitude*Constants.UNIT_MULTIPLIER.length+multiplier;
setZoomLevel(level); long scaleFactor = Constants.UNIT_MULTIPLIER[multiplier]*magnitude_factor;
foundZoom=true; if(scaleFactor*clientAreaWidth >= maxTime) {
break; setZoomLevel(level);
} foundZoom=true;
} break;
}
}
if(foundZoom) break;
magnitude_factor*=1000;
}
//if no zoom level is found, set biggest one available //if no zoom level is found, set biggest one available
if(!foundZoom) setZoomLevel(Constants.UNIT_MULTIPLIER.length*Constants.UNIT_STRING.length-1); if(!foundZoom) setZoomLevel(Constants.UNIT_MULTIPLIER.length*Constants.UNIT_STRING.length-1);

View File

@ -52,9 +52,7 @@ public class TxDbContentProvider implements ITreeContentProvider {
*/ */
@Override @Override
public Object[] getElements(Object inputElement) { public Object[] getElements(Object inputElement) {
if(tableEntries && inputElement instanceof IWaveformDb){ if(inputElement instanceof IHierNode){
return new Object[]{};
}else if(inputElement instanceof IHierNode){
// make a copy as the laoder might continue to add waveforms // make a copy as the laoder might continue to add waveforms
ArrayList<IHierNode> nodes = new ArrayList<>(((IHierNode)inputElement).getChildNodes()); ArrayList<IHierNode> nodes = new ArrayList<>(((IHierNode)inputElement).getChildNodes());
return nodes.stream().filter(n -> return nodes.stream().filter(n ->

View File

@ -1 +0,0 @@
2018/11/03-15:38:59.715484 139851522529088Delete type=3 #1