fix arrow painter if stream is moved
This commit is contained in:
parent
dd6a8669b1
commit
9a9b25622c
|
@ -49,7 +49,7 @@ public class ArrowPainter implements IPainter {
|
||||||
|
|
||||||
long scaleFactor;
|
long scaleFactor;
|
||||||
|
|
||||||
boolean deferredUpdate;
|
boolean deferUpdate;
|
||||||
|
|
||||||
public ArrowPainter(WaveformCanvas waveCanvas, RelationType relationType) {
|
public ArrowPainter(WaveformCanvas waveCanvas, RelationType relationType) {
|
||||||
this.waveCanvas = waveCanvas;
|
this.waveCanvas = waveCanvas;
|
||||||
|
@ -80,12 +80,14 @@ public class ArrowPainter implements IPainter {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void calculateGeometries() {
|
protected void calculateGeometries() {
|
||||||
deferredUpdate = false;
|
deferUpdate = false;
|
||||||
|
iRect.clear();
|
||||||
|
oRect.clear();
|
||||||
ITxStream<?> stream = tx.getStream();
|
ITxStream<?> stream = tx.getStream();
|
||||||
IWaveformPainter painter = waveCanvas.wave2painterMap.get(stream);
|
IWaveformPainter painter = waveCanvas.wave2painterMap.get(stream);
|
||||||
if (painter == null) { // stream has been added but painter not yet
|
if (painter == null) { // stream has been added but painter not yet
|
||||||
// created
|
// created
|
||||||
deferredUpdate = true;
|
deferUpdate = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int laneHeight = painter.getHeight() / stream.getMaxConcurrency();
|
int laneHeight = painter.getHeight() / stream.getMaxConcurrency();
|
||||||
|
@ -117,11 +119,12 @@ public class ArrowPainter implements IPainter {
|
||||||
Color fgColor = waveCanvas.colors[WaveformColors.REL_ARROW.ordinal()];
|
Color fgColor = waveCanvas.colors[WaveformColors.REL_ARROW.ordinal()];
|
||||||
Color highliteColor = waveCanvas.colors[WaveformColors.REL_ARROW_HIGHLITE.ordinal()];
|
Color highliteColor = waveCanvas.colors[WaveformColors.REL_ARROW_HIGHLITE.ordinal()];
|
||||||
|
|
||||||
if (deferredUpdate || (tx != null && waveCanvas.getScaleFactor() != scaleFactor)) {
|
if(tx==null) return;
|
||||||
|
if (!deferUpdate) {
|
||||||
scaleFactor = waveCanvas.getScaleFactor();
|
scaleFactor = waveCanvas.getScaleFactor();
|
||||||
calculateGeometries();
|
calculateGeometries();
|
||||||
}
|
}
|
||||||
if(txRectangle == null) return;
|
if(deferUpdate) return;
|
||||||
int correctionValue = (int)(selectionOffset);
|
int correctionValue = (int)(selectionOffset);
|
||||||
Rectangle correctedTargetRectangle = new Rectangle(txRectangle.x+correctionValue, txRectangle.y, txRectangle.width, txRectangle.height);
|
Rectangle correctedTargetRectangle = new Rectangle(txRectangle.x+correctionValue, txRectangle.y, txRectangle.width, txRectangle.height);
|
||||||
for (LinkEntry entry : iRect) {
|
for (LinkEntry entry : iRect) {
|
||||||
|
|
|
@ -395,7 +395,7 @@ public class TransactionDetails {
|
||||||
if( part == null || ! (part.getObject() instanceof WaveformViewer ) )
|
if( part == null || ! (part.getObject() instanceof WaveformViewer ) )
|
||||||
return;
|
return;
|
||||||
if(treeViewer!=null && selection!=null && !treeViewer.getTree().isDisposed()){
|
if(treeViewer!=null && selection!=null && !treeViewer.getTree().isDisposed()){
|
||||||
if( selection instanceof IStructuredSelection) {
|
if( selection instanceof IStructuredSelection && !selection.isEmpty()) {
|
||||||
setInput(((IStructuredSelection)selection).getFirstElement());
|
setInput(((IStructuredSelection)selection).getFirstElement());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1004,15 +1004,16 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
waveformPane.getStreamList().addAll(streams);
|
waveformPane.getStreamList().addAll(streams);
|
||||||
} else {
|
} else {
|
||||||
Object first = selection.getFirstElement();
|
Object first = selection.getFirstElement();
|
||||||
IWaveform stream = (first instanceof ITx) ? ((ITx) first).getStream() : (IWaveform) first;
|
if(first instanceof ITx) {
|
||||||
TrackEntry trackEntry = waveformPane.getEntryForStream(stream);
|
IWaveform stream = (first instanceof ITx) ? ((ITx) first).getStream() : (IWaveform) first;
|
||||||
if (insert) {
|
TrackEntry trackEntry = waveformPane.getEntryForStream(stream);
|
||||||
int index = waveformPane.getStreamList().indexOf(trackEntry);
|
if (insert) {
|
||||||
waveformPane.getStreamList().addAll(index, streams);
|
int index = waveformPane.getStreamList().indexOf(trackEntry);
|
||||||
} else {
|
waveformPane.getStreamList().addAll(index, streams);
|
||||||
waveformPane.getStreamList().addAll(streams);
|
} else {
|
||||||
|
waveformPane.getStreamList().addAll(streams);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
setFocus();
|
setFocus();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue