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