refactor plugin structures
This commit is contained in:
@ -0,0 +1,13 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* MINRES Technologies GmbH - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package com.minres.scviewer.database.ui;
|
||||
|
||||
public enum GotoDirection {PREV, NEXT, UP, DOWN}
|
@ -0,0 +1,19 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* MINRES Technologies GmbH - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package com.minres.scviewer.database.ui;
|
||||
|
||||
public interface ICursor {
|
||||
|
||||
public long getTime();
|
||||
|
||||
public void setTime(long time);
|
||||
|
||||
}
|
@ -0,0 +1,117 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* MINRES Technologies GmbH - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package com.minres.scviewer.database.ui;
|
||||
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
||||
import org.eclipse.jface.viewers.ISelectionProvider;
|
||||
import org.eclipse.swt.events.DisposeListener;
|
||||
import org.eclipse.swt.graphics.Point;
|
||||
import org.eclipse.swt.graphics.RGB;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
|
||||
import com.minres.scviewer.database.IWaveform;
|
||||
import com.minres.scviewer.database.RelationType;
|
||||
|
||||
public interface IWaveformView extends PropertyChangeListener, ISelectionProvider{
|
||||
|
||||
String CURSOR_PROPERTY = "cursor_time";
|
||||
|
||||
String MARKER_PROPERTY = "marker_time";
|
||||
|
||||
public static final RelationType NEXT_PREV_IN_STREAM = RelationType.create("Prev/Next in stream");
|
||||
|
||||
public void addSelectionChangedListener(ISelectionChangedListener listener);
|
||||
|
||||
public void removeSelectionChangedListener(ISelectionChangedListener listener);
|
||||
|
||||
public void update();
|
||||
|
||||
public Control getControl();
|
||||
|
||||
public Control getNameControl();
|
||||
|
||||
public Control getValueControl();
|
||||
|
||||
public Control getWaveformControl();
|
||||
|
||||
public ISelection getSelection();
|
||||
|
||||
public void setSelection(ISelection selection);
|
||||
|
||||
public void setSelection(ISelection selection, boolean showIfNeeded);
|
||||
|
||||
public void addToSelection(ISelection selection, boolean showIfNeeded);
|
||||
|
||||
public void moveSelection(GotoDirection direction);
|
||||
|
||||
public void moveSelection(GotoDirection direction, RelationType relationType);
|
||||
|
||||
public void moveCursor(GotoDirection direction);
|
||||
|
||||
public List<TrackEntry> getStreamList();
|
||||
|
||||
public TrackEntry getEntryForStream(IWaveform source);
|
||||
|
||||
public List<Object> getElementsAt(Point pt);
|
||||
|
||||
public void moveSelectedTrack(int i);
|
||||
|
||||
public void setHighliteRelation(RelationType relationType);
|
||||
|
||||
public long getMaxTime();
|
||||
|
||||
public void setMaxTime(long maxTime);
|
||||
|
||||
public void setZoomLevel(int scale);
|
||||
|
||||
public int getZoomLevel();
|
||||
|
||||
public void setCursorTime(long time);
|
||||
|
||||
public void setMarkerTime(long time, int index);
|
||||
|
||||
public long getCursorTime();
|
||||
|
||||
public int getSelectedMarkerId();
|
||||
|
||||
public long getMarkerTime(int index);
|
||||
|
||||
public void addPropertyChangeListener(PropertyChangeListener listener);
|
||||
|
||||
public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener);
|
||||
|
||||
public void removePropertyChangeListener(PropertyChangeListener listener);
|
||||
|
||||
public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener);
|
||||
|
||||
public String getScaledTime(long time);
|
||||
|
||||
public String[] getZoomLevels();
|
||||
|
||||
public List<ICursor> getCursorList();
|
||||
|
||||
public void setColors(HashMap<WaveformColors, RGB> colourMap);
|
||||
|
||||
public long getBaselineTime();
|
||||
|
||||
public void setBaselineTime(Long scale);
|
||||
|
||||
public void scrollHorizontal(int percent);
|
||||
|
||||
public void addDisposeListener( DisposeListener listener );
|
||||
|
||||
public void deleteSelectedTracks();
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* MINRES Technologies GmbH - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package com.minres.scviewer.database.ui;
|
||||
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
|
||||
public interface IWaveformViewFactory {
|
||||
public IWaveformView createPanel(Composite parent);
|
||||
}
|
@ -0,0 +1,132 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* MINRES Technologies GmbH - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package com.minres.scviewer.database.ui;
|
||||
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import com.minres.scviewer.database.ISignal;
|
||||
import com.minres.scviewer.database.ITxEvent;
|
||||
import com.minres.scviewer.database.ITxStream;
|
||||
import com.minres.scviewer.database.IWaveform;
|
||||
|
||||
public class TrackEntry {
|
||||
|
||||
// color info
|
||||
public static Color fallbackColor = new Color(200,0,0);
|
||||
public static Color highlightedFallbackColor = new Color(255,0,0);
|
||||
private Color[]signalColors;
|
||||
|
||||
// list of random colors
|
||||
private static Color[][] randomColors = {
|
||||
{ new Color( 170, 66, 37 ), new Color ( 190, 66, 37 ) },
|
||||
{ new Color( 96, 74, 110 ), new Color ( 96, 74, 130 ) },
|
||||
{ new Color( 133, 105, 128 ), new Color ( 153, 105, 128 ) },
|
||||
{ new Color( 0, 126, 135 ), new Color ( 0, 126, 155 ) },
|
||||
{ new Color( 243, 146, 75 ), new Color ( 255, 146, 75 ) },
|
||||
{ new Color( 206, 135, 163 ), new Color ( 226, 135, 163 ) },
|
||||
{ new Color( 124, 103, 74 ), new Color ( 144, 103, 74 ) },
|
||||
{ new Color( 194, 187, 169 ), new Color ( 214, 187, 169 ) },
|
||||
{ new Color( 104, 73, 71 ), new Color ( 124, 73, 71 ) },
|
||||
{ new Color( 75, 196, 213 ), new Color ( 75, 196, 233 ) },
|
||||
{ new Color( 206, 232, 229 ), new Color ( 206, 252, 229 ) },
|
||||
{ new Color( 169, 221, 199 ), new Color ( 169, 241, 199 ) },
|
||||
{ new Color( 100, 165, 197 ), new Color ( 100, 165, 217 ) },
|
||||
{ new Color( 150, 147, 178 ), new Color ( 150, 147, 198 ) },
|
||||
{ new Color( 200, 222, 182 ), new Color ( 200, 242, 182 ) },
|
||||
{ new Color( 147, 208, 197 ), new Color ( 147, 228, 197 ) }
|
||||
};
|
||||
|
||||
public static Color[] computeColor (String streamValue, Color fallback, Color highlightedFallback) {
|
||||
|
||||
Color[]result = new Color[2];
|
||||
|
||||
result[0] = fallback;
|
||||
result[1] = highlightedFallback;
|
||||
|
||||
// assign "random" color here, one name always results in the same color!
|
||||
if( streamValue!=null && randomColors.length > 0 ) {
|
||||
int index = Math.abs(streamValue.hashCode()) % randomColors.length;
|
||||
result[0] = randomColors[index][0];
|
||||
result[1] = randomColors[index][1];
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
public void setColor(Color changedColor, Color highlightColor) {
|
||||
signalColors[0] = changedColor;
|
||||
signalColors[1] = highlightColor;
|
||||
}
|
||||
|
||||
public Color[] getColors() {
|
||||
return signalColors;
|
||||
}
|
||||
|
||||
public enum ValueDisplay {
|
||||
DEFAULT, SIGNED, UNSIGNED
|
||||
|
||||
}
|
||||
|
||||
public enum WaveDisplay {
|
||||
DEFAULT, STEP_WISE, CONTINOUS
|
||||
}
|
||||
|
||||
final public IWaveform waveform;
|
||||
|
||||
public int vOffset;
|
||||
|
||||
public int height;
|
||||
|
||||
public boolean selected;
|
||||
|
||||
public String currentValue="";
|
||||
|
||||
public ValueDisplay valueDisplay = ValueDisplay.DEFAULT;
|
||||
|
||||
public WaveDisplay waveDisplay = WaveDisplay.DEFAULT;
|
||||
|
||||
public TrackEntry(IWaveform waveform) {
|
||||
this.waveform = waveform;
|
||||
vOffset=0;
|
||||
height=0;
|
||||
selected=false;
|
||||
signalColors = new Color[2];
|
||||
signalColors[0] = fallbackColor;
|
||||
signalColors[1] = highlightedFallbackColor;
|
||||
}
|
||||
|
||||
public boolean isStream(){
|
||||
return waveform instanceof ITxStream<?>;
|
||||
}
|
||||
|
||||
public ITxStream<? extends ITxEvent> getStream(){
|
||||
return (ITxStream<?>) waveform;
|
||||
}
|
||||
|
||||
public boolean isSignal(){
|
||||
return waveform instanceof ISignal<?>;
|
||||
}
|
||||
|
||||
public ISignal<?> getSignal(){
|
||||
return (ISignal<?>) waveform;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if(obj instanceof TrackEntry){
|
||||
TrackEntry o = (TrackEntry) obj;
|
||||
return waveform==o.waveform && vOffset==o.vOffset;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* MINRES Technologies GmbH - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package com.minres.scviewer.database.ui;
|
||||
|
||||
public enum WaveformColors {
|
||||
LINE, LINE_HIGHLITE,
|
||||
TRACK_BG_EVEN, TRACK_BG_ODD, TRACK_BG_HIGHLITE,
|
||||
TX_BG, TX_BG_HIGHLITE, TX_BORDER,
|
||||
SIGNAL0, SIGNAL1, SIGNALZ, SIGNALX, SIGNALU, SIGNAL_TEXT, SIGNAL_REAL, SIGNAL_NAN,
|
||||
CURSOR, CURSOR_DRAG, CURSOR_TEXT,
|
||||
MARKER, MARKER_TEXT, REL_ARROW, REL_ARROW_HIGHLITE
|
||||
}
|
Reference in New Issue
Block a user