Fixed display issues
This commit is contained in:
parent
cb77a5da33
commit
b8126f36dc
|
@ -114,11 +114,11 @@ public class Track extends Composite implements IWaveformWidget, MouseListener {
|
|||
gc.setForeground(lineColor);
|
||||
gc.setFillRule(SWT.FILL_EVEN_ODD);
|
||||
gc.setBackground(trackBgColor);
|
||||
gc.setLineWidth(1);
|
||||
gc.setLineWidth(3);
|
||||
gc.setLineStyle(SWT.LINE_SOLID);
|
||||
gc.fillRectangle(new Rectangle(e.x, e.y, e.width, e.height));
|
||||
for(int offset=e.y+trackHeight/2; offset<e.height; offset+=trackHeight)
|
||||
gc.drawLine(e.x, offset, e.x+e.width, offset);
|
||||
for(int offset=trackHeight/2; offset<e.height; offset+=trackHeight)
|
||||
gc.drawLine(0, e.y+offset, e.x+e.width, e.y+offset);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ public class Transaction extends Composite {
|
|||
public static Color txBgColor;
|
||||
public static Color highliteLineColor;
|
||||
public static Color txHighliteBgColor;
|
||||
public static Color trackBgColor;
|
||||
private int length;
|
||||
private boolean highlighted=false;
|
||||
|
||||
|
@ -39,8 +40,10 @@ public class Transaction extends Composite {
|
|||
TxEditorPlugin plugin=TxEditorPlugin.getDefault();
|
||||
lineColor=plugin.getColor(TxEditorPlugin.lineColor);
|
||||
txBgColor=plugin.getColor(TxEditorPlugin.txBgColor);
|
||||
trackBgColor=plugin.getColor(TxEditorPlugin.trackBgDarkColor);
|
||||
highliteLineColor=plugin.getColor(TxEditorPlugin.highliteLineColor);
|
||||
txHighliteBgColor=plugin.getColor(TxEditorPlugin.txHighliteBgColor);
|
||||
setBackground(trackBgColor);
|
||||
}
|
||||
|
||||
protected void widgetDisposed(DisposeEvent e) {
|
||||
|
@ -48,18 +51,20 @@ public class Transaction extends Composite {
|
|||
|
||||
void paintControl(PaintEvent e) {
|
||||
GC gc = e.gc;
|
||||
gc.setBackground(trackBgColor);
|
||||
gc.fillRectangle(new Rectangle(0, 0, length, height));
|
||||
gc.setForeground(highlighted?highliteLineColor:lineColor);
|
||||
gc.setFillRule(SWT.FILL_EVEN_ODD);
|
||||
gc.setBackground(highlighted?txHighliteBgColor:txBgColor);
|
||||
gc.setLineWidth(1);
|
||||
gc.setLineStyle(SWT.LINE_SOLID);
|
||||
Rectangle bb = new Rectangle(0, height/5, length-1, 3*height/5);
|
||||
if(bb.width<8){
|
||||
if(bb.width<10){
|
||||
gc.fillRectangle(bb);
|
||||
gc.drawRectangle(bb);
|
||||
} else {
|
||||
gc.fillRoundRectangle(bb.x, bb.y, bb.width, bb.height, 4, 4);
|
||||
gc.drawRoundRectangle(bb.x, bb.y, bb.width, bb.height, 4, 4);
|
||||
gc.fillRoundRectangle(bb.x, bb.y, bb.width, bb.height, 5, 5);
|
||||
gc.drawRoundRectangle(bb.x, bb.y, bb.width, bb.height, 5, 5);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@ import org.eclipse.swt.events.SelectionAdapter;
|
|||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.graphics.Point;
|
||||
import org.eclipse.swt.graphics.Rectangle;
|
||||
import org.eclipse.swt.internal.ole.win32.CONTROLINFO;
|
||||
import org.eclipse.swt.layout.FillLayout;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
|
@ -102,7 +103,7 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider, Mo
|
|||
});
|
||||
|
||||
nameListScrolled = new ScrolledComposite(namePane, SWT.H_SCROLL | SWT.V_SCROLL);
|
||||
nameListScrolled.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, true, 1, 1));
|
||||
nameListScrolled.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
|
||||
nameListScrolled.setExpandHorizontal(true);
|
||||
nameListScrolled.setExpandVertical(true);
|
||||
nameList = new Composite(nameListScrolled, SWT.NONE);
|
||||
|
@ -118,7 +119,7 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider, Mo
|
|||
}
|
||||
});
|
||||
valueListScrolled = new ScrolledComposite(valuePane, SWT.H_SCROLL | SWT.V_SCROLL);
|
||||
valueListScrolled.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, true, 1, 1));
|
||||
valueListScrolled.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
|
||||
valueListScrolled.setExpandHorizontal(true);
|
||||
valueListScrolled.setExpandVertical(true);
|
||||
valueList = new Composite(valueListScrolled, SWT.NONE);
|
||||
|
@ -151,20 +152,15 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider, Mo
|
|||
trackListScrolled.setOrigin(trackListScrolled.getOrigin().x, y);
|
||||
}
|
||||
});
|
||||
trackListScrolled.getVerticalBar().addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
int y = ((ScrollBar) e.widget).getSelection();
|
||||
trackListScrolled.getContent().addControlListener(new ControlAdapter() {
|
||||
@Override
|
||||
public void controlMoved(ControlEvent e) {
|
||||
ruler.setStartPoint(trackListScrolled.getHorizontalBar().getSelection());
|
||||
int y = trackListScrolled.getVerticalBar().getSelection();
|
||||
nameListScrolled.setOrigin(nameListScrolled.getOrigin().x, y);
|
||||
valueListScrolled.setOrigin(valueListScrolled.getOrigin().x, y);
|
||||
}
|
||||
});
|
||||
trackListScrolled.getHorizontalBar().addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
int x = ((ScrollBar) e.widget).getSelection();
|
||||
ruler.setStartPoint(x);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
topSash.setWeights(new int[] {30, 70});
|
||||
leftSash.setWeights(new int[] {75, 25});
|
||||
|
||||
|
@ -247,6 +243,7 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider, Mo
|
|||
track.setData("VALUEWIDGET", trackValue);
|
||||
trackMap.put(stream, track);
|
||||
} else if(wave instanceof ISignal<?>){
|
||||
@SuppressWarnings("unchecked")
|
||||
ISignal<ISignalChange> isignal = (ISignal<ISignalChange>) wave;
|
||||
SignalWidget signal = new SignalWidget(trackList, SWT.NONE);
|
||||
signal.setTransactions(isignal);
|
||||
|
@ -277,11 +274,8 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider, Mo
|
|||
|
||||
protected void recalculateValueBounds() {
|
||||
if(streams.size()>0){
|
||||
Rectangle bounds = valueListScrolled.getParent().getBounds();
|
||||
Point size = valueList.computeSize(SWT.DEFAULT, SWT.DEFAULT);
|
||||
// System.out.println("Value calc: "+bounds+" / "+size);
|
||||
int corr = (int) (2.35*valueListScrolled.getHorizontalBar().getSize().y);
|
||||
valueListScrolled.setMinSize(Math.max(bounds.width, size.x), Math.max(bounds.height-corr, size.y));
|
||||
valueListScrolled.setMinSize(size);
|
||||
valueListScrolled.setAlwaysShowScrollBars(true);
|
||||
valueListScrolled.getVerticalBar().setVisible(false);
|
||||
}
|
||||
|
@ -289,11 +283,8 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider, Mo
|
|||
|
||||
protected void recalculateNameBounds() {
|
||||
if(streams.size()>0){
|
||||
Rectangle bounds = nameListScrolled.getParent().getBounds();
|
||||
Point size = nameList.computeSize(SWT.DEFAULT, SWT.DEFAULT);
|
||||
// System.out.println("Name calc: "+bounds+" / "+size);
|
||||
int corr = (int) (2.35*valueListScrolled.getHorizontalBar().getSize().y);
|
||||
nameListScrolled.setMinSize(Math.max(bounds.width, size.x), Math.max(bounds.height-corr, size.y));
|
||||
nameListScrolled.setMinSize(size);
|
||||
nameListScrolled.setAlwaysShowScrollBars(true);
|
||||
nameListScrolled.getVerticalBar().setVisible(false);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue