This commit is contained in:
Eyck Jentzsch 2020-03-24 06:43:10 +00:00
parent f6e2224651
commit 8a66734279
2 changed files with 30 additions and 8 deletions

View File

@ -4,6 +4,7 @@ import org.eclipse.swt.SWT;
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.layout.FillLayout; import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.layout.RowLayout; import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Display;
@ -74,11 +75,15 @@ class ToolTipHandler {
if (tip != null && !tip.isDisposed ()) tip.dispose (); if (tip != null && !tip.isDisposed ()) tip.dispose ();
tip = new Shell (parentShell, SWT.ON_TOP | SWT.NO_FOCUS | SWT.TOOL); tip = new Shell (parentShell, SWT.ON_TOP | SWT.NO_FOCUS | SWT.TOOL);
tip.setBackground (display.getSystemColor (SWT.COLOR_INFO_BACKGROUND)); tip.setBackground (display.getSystemColor (SWT.COLOR_INFO_BACKGROUND));
RowLayout layout=new RowLayout(SWT.VERTICAL); GridLayout layout = new GridLayout(1, true);
layout.fill=true; layout.verticalSpacing=0;
layout.horizontalSpacing=0;
layout.marginWidth = 0;
layout.marginHeight = 0;
tip.setLayout(layout); tip.setLayout(layout);
boolean visible = provider.createContent(tip, pt); boolean visible = provider.createContent(tip, pt);
tip.pack(); tip.pack();
tip.setSize(tip.computeSize(SWT.DEFAULT, SWT.DEFAULT));
setHoverLocation(tip, tipPosition); setHoverLocation(tip, tipPosition);
tip.setVisible (visible); tip.setVisible (visible);
if(visible) if(visible)

View File

@ -75,6 +75,7 @@ import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Point; import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Event;
@ -403,18 +404,26 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
final Font font = new Font(Display.getCurrent(), "Terminal", 10, SWT.NORMAL); final Font font = new Font(Display.getCurrent(), "Terminal", 10, SWT.NORMAL);
final Label label = new Label(parent, SWT.NONE); final Label label = new Label(parent, SWT.NONE);
label.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND)); // label.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND));
label.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND)); // label.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
label.setText(tx.toString()); label.setText(tx.toString());
label.setFont(font); label.setFont(font);
GridData labelGridData = new GridData();
labelGridData.horizontalAlignment = GridData.FILL;
labelGridData.grabExcessHorizontalSpace = true;
label.setLayoutData(labelGridData);
final Table table = new Table(parent, SWT.NONE); final Table table = new Table(parent, SWT.NONE);
table.setHeaderVisible(true); table.setHeaderVisible(true);
table.setLinesVisible(true); table.setLinesVisible(true);
table.setFont(font); table.setFont(font);
table.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND)); // table.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND));
table.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND)); // table.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
table.setRedraw(false); table.setRedraw(false);
GridData tableGridData = new GridData();
tableGridData.horizontalAlignment = GridData.FILL;
tableGridData.grabExcessHorizontalSpace = true;
table.setLayoutData(tableGridData);
final TableColumn nameCol = new TableColumn(table, SWT.LEFT); final TableColumn nameCol = new TableColumn(table, SWT.LEFT);
nameCol.setText("Attribute"); nameCol.setText("Attribute");
@ -432,8 +441,12 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
item.setText(0, iTxAttribute.getName()); item.setText(0, iTxAttribute.getName());
item.setText(1, value); item.setText(1, value);
} }
TableItem item = new TableItem(table, SWT.NONE);
item.setText(0, "");
item.setText(1, "");
nameCol.pack(); nameCol.pack();
valueCol.pack(); valueCol.pack();
table.pack();
table.setRedraw(true); table.setRedraw(true);
parent.addPaintListener(new PaintListener() { parent.addPaintListener(new PaintListener() {
@ -453,10 +466,14 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
final Font font = new Font(Display.getCurrent(), "Terminal", 10, SWT.NORMAL); final Font font = new Font(Display.getCurrent(), "Terminal", 10, SWT.NORMAL);
final Label label = new Label(parent, SWT.NONE); final Label label = new Label(parent, SWT.NONE);
label.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND)); //label.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND));
label.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND)); //label.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
label.setText(te.waveform.getFullName()); label.setText(te.waveform.getFullName());
label.setFont(font); label.setFont(font);
GridData labelGridData = new GridData();
labelGridData.horizontalAlignment = GridData.FILL;
labelGridData.grabExcessHorizontalSpace = true;
label.setLayoutData(labelGridData);
return true; return true;
} }
return false; return false;