refactor class names

This commit is contained in:
Eyck Jentzsch 2020-07-11 19:36:28 +02:00
parent 55a14edc9d
commit b38b268fcb
7 changed files with 50 additions and 32 deletions

View File

@ -12,15 +12,15 @@ package com.minres.scviewer.database.swt;
import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Composite;
import com.minres.scviewer.database.swt.internal.WaveformViewer; import com.minres.scviewer.database.swt.internal.WaveformView;
import com.minres.scviewer.database.ui.IWaveformViewer; import com.minres.scviewer.database.ui.IWaveformView;
import com.minres.scviewer.database.ui.IWaveformViewerFactory; import com.minres.scviewer.database.ui.IWaveformViewFactory;
public class WaveformViewerFactory implements IWaveformViewerFactory { public class WaveformViewFactory implements IWaveformViewFactory {
@Override @Override
public IWaveformViewer createPanel(Composite parent) { public IWaveformView createPanel(Composite parent) {
return new WaveformViewer(parent); return new WaveformView(parent);
} }
} }

View File

@ -25,6 +25,7 @@ import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.GC; import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
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;
@ -40,7 +41,7 @@ import com.minres.scviewer.database.ITx;
import com.minres.scviewer.database.IWaveform; import com.minres.scviewer.database.IWaveform;
import com.minres.scviewer.database.RelationType; import com.minres.scviewer.database.RelationType;
import com.minres.scviewer.database.swt.Constants; import com.minres.scviewer.database.swt.Constants;
import com.minres.scviewer.database.ui.IWaveformViewer; import com.minres.scviewer.database.ui.IWaveformView;
import com.minres.scviewer.database.ui.TrackEntry; import com.minres.scviewer.database.ui.TrackEntry;
import com.minres.scviewer.database.ui.WaveformColors; import com.minres.scviewer.database.ui.WaveformColors;
@ -48,6 +49,8 @@ public class WaveformCanvas extends Canvas {
Color[] colors = new Color[WaveformColors.values().length]; Color[] colors = new Color[WaveformColors.values().length];
private boolean doubleBuffering = true;
private int trackHeight = 50; private int trackHeight = 50;
private long scaleFactor = 1000000L; // 1ns private long scaleFactor = 1000000L; // 1ns
@ -110,7 +113,7 @@ public class WaveformCanvas extends Canvas {
painterList.add(trackAreaPainter); painterList.add(trackAreaPainter);
rulerPainter=new RulerPainter(this); rulerPainter=new RulerPainter(this);
painterList.add(rulerPainter); painterList.add(rulerPainter);
arrowPainter=new ArrowPainter(this, IWaveformViewer.NEXT_PREV_IN_STREAM); arrowPainter=new ArrowPainter(this, IWaveformView.NEXT_PREV_IN_STREAM);
painterList.add(arrowPainter); painterList.add(arrowPainter);
CursorPainter cp = new CursorPainter(this, scaleFactor * 10, cursorPainters.size()-1); CursorPainter cp = new CursorPainter(this, scaleFactor * 10, cursorPainters.size()-1);
painterList.add(cp); painterList.add(cp);
@ -398,7 +401,18 @@ public class WaveformCanvas extends Canvas {
/* Paint function */ /* Paint function */
private void paint(GC gc) { private void paint(GC gc) {
Rectangle clientRect = getClientArea(); /* Canvas' painting area */ Rectangle clientRect = getClientArea(); /* Canvas' painting area */
Projection p = new Projection(gc); GC thisGc = gc;
Image d_backingImg = null;
if(doubleBuffering) {
Point p = getSize();
d_backingImg = new Image(getDisplay(), p.x, p.y);
thisGc = new GC(d_backingImg);
thisGc.setBackground(gc.getBackground());
thisGc.setForeground(gc.getForeground());
thisGc.setFont(gc.getFont());
}
Projection p = new Projection(thisGc);
p.setTranslation(origin); p.setTranslation(origin);
if (painterList.size() > 0 ) { if (painterList.size() > 0 ) {
for (IPainter painter : painterList) for (IPainter painter : painterList)
@ -407,6 +421,11 @@ public class WaveformCanvas extends Canvas {
gc.fillRectangle(clientRect); gc.fillRectangle(clientRect);
initScrollBars(); initScrollBars();
} }
if(doubleBuffering) {
gc.drawImage(d_backingImg, 0, 0);
d_backingImg.dispose();
thisGc.dispose();
}
} }
public List<Object> getElementsAt(Point point) { public List<Object> getElementsAt(Point point) {

View File

@ -89,11 +89,11 @@ import com.minres.scviewer.database.RelationType;
import com.minres.scviewer.database.swt.Constants; import com.minres.scviewer.database.swt.Constants;
import com.minres.scviewer.database.ui.GotoDirection; import com.minres.scviewer.database.ui.GotoDirection;
import com.minres.scviewer.database.ui.ICursor; import com.minres.scviewer.database.ui.ICursor;
import com.minres.scviewer.database.ui.IWaveformViewer; import com.minres.scviewer.database.ui.IWaveformView;
import com.minres.scviewer.database.ui.TrackEntry; import com.minres.scviewer.database.ui.TrackEntry;
import com.minres.scviewer.database.ui.WaveformColors; import com.minres.scviewer.database.ui.WaveformColors;
public class WaveformViewer implements IWaveformViewer { public class WaveformView implements IWaveformView {
private ListenerList<ISelectionChangedListener> selectionChangedListeners = new ListenerList<ISelectionChangedListener>(); private ListenerList<ISelectionChangedListener> selectionChangedListeners = new ListenerList<ISelectionChangedListener>();
@ -185,8 +185,7 @@ public class WaveformViewer implements IWaveformViewer {
gc.setAlpha(128); gc.setAlpha(128);
int minX = Math.min(start.x, end.x); int minX = Math.min(start.x, end.x);
int width = Math.max(start.x, end.x) - minX; int width = Math.max(start.x, end.x) - minX;
Point origin = waveformCanvas.getOrigin(); int y_top = waveformCanvas.getRulerHeight();
int y_top = waveformCanvas.getRulerHeight()- origin.y;
int y_bottom = waveformCanvas.getSize().y; int y_bottom = waveformCanvas.getSize().y;
gc.fillRectangle(minX, y_top, width,y_bottom); gc.fillRectangle(minX, y_top, width,y_bottom);
} }
@ -288,7 +287,7 @@ public class WaveformViewer implements IWaveformViewer {
}; };
protected WaveformMouseListener waveformMouseListener = new WaveformMouseListener(); protected WaveformMouseListener waveformMouseListener = new WaveformMouseListener();
public WaveformViewer(Composite parent) { public WaveformView(Composite parent) {
pcs=new PropertyChangeSupport(this); pcs=new PropertyChangeSupport(this);
trackVerticalOffset = new TreeMap<Integer, TrackEntry>(); trackVerticalOffset = new TreeMap<Integer, TrackEntry>();
@ -755,7 +754,7 @@ public class WaveformViewer implements IWaveformViewer {
@Override @Override
public void moveSelection(GotoDirection direction, RelationType relationType) { public void moveSelection(GotoDirection direction, RelationType relationType) {
if (currentWaveformSelection!=null && currentWaveformSelection.isStream() && currentTxSelection!=null) { if (currentWaveformSelection!=null && currentWaveformSelection.isStream() && currentTxSelection!=null) {
if(relationType.equals(IWaveformViewer.NEXT_PREV_IN_STREAM)){ if(relationType.equals(IWaveformView.NEXT_PREV_IN_STREAM)){
ITxStream<? extends ITxEvent> stream = currentWaveformSelection.getStream(); ITxStream<? extends ITxEvent> stream = currentWaveformSelection.getStream();
ITx transaction = null; ITx transaction = null;
if (direction == GotoDirection.NEXT) { if (direction == GotoDirection.NEXT) {

View File

@ -25,7 +25,7 @@ import org.eclipse.swt.widgets.Control;
import com.minres.scviewer.database.IWaveform; import com.minres.scviewer.database.IWaveform;
import com.minres.scviewer.database.RelationType; import com.minres.scviewer.database.RelationType;
public interface IWaveformViewer extends PropertyChangeListener, ISelectionProvider{ public interface IWaveformView extends PropertyChangeListener, ISelectionProvider{
String CURSOR_PROPERTY = "cursor_time"; String CURSOR_PROPERTY = "cursor_time";

View File

@ -12,6 +12,6 @@ package com.minres.scviewer.database.ui;
import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Composite;
public interface IWaveformViewerFactory { public interface IWaveformViewFactory {
public IWaveformViewer createPanel(Composite parent); public IWaveformView createPanel(Composite parent);
} }

View File

@ -93,10 +93,10 @@ import com.minres.scviewer.database.RelationType;
import com.minres.scviewer.database.swt.Constants; import com.minres.scviewer.database.swt.Constants;
import com.minres.scviewer.database.swt.ToolTipContentProvider; import com.minres.scviewer.database.swt.ToolTipContentProvider;
import com.minres.scviewer.database.swt.ToolTipHelpTextProvider; import com.minres.scviewer.database.swt.ToolTipHelpTextProvider;
import com.minres.scviewer.database.swt.WaveformViewerFactory; import com.minres.scviewer.database.swt.WaveformViewFactory;
import com.minres.scviewer.database.ui.GotoDirection; import com.minres.scviewer.database.ui.GotoDirection;
import com.minres.scviewer.database.ui.ICursor; import com.minres.scviewer.database.ui.ICursor;
import com.minres.scviewer.database.ui.IWaveformViewer; import com.minres.scviewer.database.ui.IWaveformView;
import com.minres.scviewer.database.ui.TrackEntry; import com.minres.scviewer.database.ui.TrackEntry;
import com.minres.scviewer.database.ui.TrackEntry.ValueDisplay; import com.minres.scviewer.database.ui.TrackEntry.ValueDisplay;
import com.minres.scviewer.database.ui.TrackEntry.WaveDisplay; import com.minres.scviewer.database.ui.TrackEntry.WaveDisplay;
@ -164,10 +164,10 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
private static int disposeListenerNumber = 0; private static int disposeListenerNumber = 0;
/** The factory. */ /** The factory. */
WaveformViewerFactory factory = new WaveformViewerFactory(); WaveformViewFactory factory = new WaveformViewFactory();
/** The waveform pane. */ /** The waveform pane. */
private IWaveformViewer waveformPane; private IWaveformView waveformPane;
/** get UISynchronize injected as field */ /** get UISynchronize injected as field */
@Inject UISynchronize sync; @Inject UISynchronize sync;
@ -217,7 +217,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
private Object detailsSettings; private Object detailsSettings;
/** The navigation relation type. */ /** The navigation relation type. */
private RelationType navigationRelationType=IWaveformViewer.NEXT_PREV_IN_STREAM ; private RelationType navigationRelationType=IWaveformView.NEXT_PREV_IN_STREAM ;
/** The file monitor. */ /** The file monitor. */
FileMonitor fileMonitor = new FileMonitor(); FileMonitor fileMonitor = new FileMonitor();
@ -262,7 +262,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
//set selection to empty selection when opening a new waveformPane //set selection to empty selection when opening a new waveformPane
selectionService.setSelection(new StructuredSelection()); selectionService.setSelection(new StructuredSelection());
waveformPane.addPropertyChangeListener(IWaveformViewer.CURSOR_PROPERTY, new PropertyChangeListener() { waveformPane.addPropertyChangeListener(IWaveformView.CURSOR_PROPERTY, new PropertyChangeListener() {
@Override @Override
public void propertyChange(PropertyChangeEvent evt) { public void propertyChange(PropertyChangeEvent evt) {
Long time = (Long) evt.getNewValue(); Long time = (Long) evt.getNewValue();
@ -272,7 +272,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
} }
}); });
waveformPane.addPropertyChangeListener(IWaveformViewer.MARKER_PROPERTY, new PropertyChangeListener() { waveformPane.addPropertyChangeListener(IWaveformView.MARKER_PROPERTY, new PropertyChangeListener() {
@Override @Override
public void propertyChange(PropertyChangeEvent evt) { public void propertyChange(PropertyChangeEvent evt) {
Long time = (Long) evt.getNewValue(); Long time = (Long) evt.getNewValue();
@ -1215,7 +1215,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
*/ */
public List<RelationType> getAllRelationTypes() { public List<RelationType> getAllRelationTypes() {
List<RelationType> res =new ArrayList<>(); List<RelationType> res =new ArrayList<>();
res.add(IWaveformViewer.NEXT_PREV_IN_STREAM); res.add(IWaveformView.NEXT_PREV_IN_STREAM);
res.addAll(database.getAllRelationTypes()); res.addAll(database.getAllRelationTypes());
return res; return res;
} }
@ -1227,7 +1227,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
*/ */
public List<RelationType> getSelectionRelationTypes() { public List<RelationType> getSelectionRelationTypes() {
List<RelationType> res =new ArrayList<>(); List<RelationType> res =new ArrayList<>();
res.add(IWaveformViewer.NEXT_PREV_IN_STREAM); res.add(IWaveformView.NEXT_PREV_IN_STREAM);
ISelection selection = waveformPane.getSelection(); ISelection selection = waveformPane.getSelection();
if(selection instanceof IStructuredSelection && !selection.isEmpty()){ if(selection instanceof IStructuredSelection && !selection.isEmpty()){
IStructuredSelection sel=(IStructuredSelection) selection; IStructuredSelection sel=(IStructuredSelection) selection;

View File

@ -48,9 +48,9 @@ import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
import com.minres.scviewer.database.IWaveform; import com.minres.scviewer.database.IWaveform;
import com.minres.scviewer.database.IWaveformDb; import com.minres.scviewer.database.IWaveformDb;
import com.minres.scviewer.database.IWaveformDbFactory; import com.minres.scviewer.database.IWaveformDbFactory;
import com.minres.scviewer.database.swt.WaveformViewerFactory; import com.minres.scviewer.database.swt.WaveformViewFactory;
import com.minres.scviewer.database.ui.GotoDirection; import com.minres.scviewer.database.ui.GotoDirection;
import com.minres.scviewer.database.ui.IWaveformViewer; import com.minres.scviewer.database.ui.IWaveformView;
import com.minres.scviewer.database.ui.TrackEntry; import com.minres.scviewer.database.ui.TrackEntry;
import com.minres.scviewer.ui.views.TxOutlinePage; import com.minres.scviewer.ui.views.TxOutlinePage;
@ -78,7 +78,7 @@ public class TxEditorPart extends EditorPart implements ITabbedPropertySheetPage
public static final String WAVE_ACTION_ID = "com.minres.scviewer.ui.action.AddToWave"; public static final String WAVE_ACTION_ID = "com.minres.scviewer.ui.action.AddToWave";
private IWaveformViewer txDisplay; private IWaveformView txDisplay;
/** This is the root of the editor's model. */ /** This is the root of the editor's model. */
private IWaveformDb database; private IWaveformDb database;
@ -112,10 +112,10 @@ public class TxEditorPart extends EditorPart implements ITabbedPropertySheetPage
} }
} }
}); });
WaveformViewerFactory factory = new WaveformViewerFactory(); WaveformViewFactory factory = new WaveformViewFactory();
txDisplay = factory.createPanel(parent); txDisplay = factory.createPanel(parent);
txDisplay.setMaxTime(0); txDisplay.setMaxTime(0);
txDisplay.addPropertyChangeListener(IWaveformViewer.CURSOR_PROPERTY, new PropertyChangeListener() { txDisplay.addPropertyChangeListener(IWaveformView.CURSOR_PROPERTY, new PropertyChangeListener() {
@Override @Override
public void propertyChange(PropertyChangeEvent evt) { public void propertyChange(PropertyChangeEvent evt) {
Long time = (Long) evt.getNewValue(); Long time = (Long) evt.getNewValue();