Merge branch 'develop' into feature/waveform_groups
This commit is contained in:
commit
dbae0f1666
|
@ -0,0 +1,21 @@
|
||||||
|
package com.minres.scviewer.database.ui;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.minres.scviewer.database.BlankWaveform;
|
||||||
|
|
||||||
|
public class TrackEntryGroup extends TrackEntry {
|
||||||
|
|
||||||
|
public List<TrackEntry> waveforms = new ArrayList<>();
|
||||||
|
|
||||||
|
public Boolean is_open = true;
|
||||||
|
|
||||||
|
public TrackEntryGroup(TrackEntry[] waveform, IWaveformStyleProvider styleProvider) {
|
||||||
|
super(new BlankWaveform(), styleProvider);
|
||||||
|
for (TrackEntry iWaveform : waveform) {
|
||||||
|
waveforms.add(iWaveform);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -16,5 +16,5 @@ public enum WaveformColors {
|
||||||
TX_BG, TX_BG_HIGHLITE, TX_BORDER,
|
TX_BG, TX_BG_HIGHLITE, TX_BORDER,
|
||||||
SIGNAL0, SIGNAL1, SIGNALZ, SIGNALX, SIGNALU, SIGNAL_TEXT, SIGNAL_REAL, SIGNAL_NAN,
|
SIGNAL0, SIGNAL1, SIGNALZ, SIGNALX, SIGNALU, SIGNAL_TEXT, SIGNAL_REAL, SIGNAL_NAN,
|
||||||
CURSOR, CURSOR_DRAG, CURSOR_TEXT,
|
CURSOR, CURSOR_DRAG, CURSOR_TEXT,
|
||||||
MARKER, MARKER_TEXT, REL_ARROW, REL_ARROW_HIGHLITE
|
MARKER, MARKER_TEXT, REL_ARROW, REL_ARROW_HIGHLITE, BLANK
|
||||||
}
|
}
|
|
@ -49,6 +49,7 @@ public class DefaultWaveformStyleProvider implements IWaveformStyleProvider {
|
||||||
colors[WaveformColors.MARKER_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
|
colors[WaveformColors.MARKER_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
|
||||||
colors[WaveformColors.REL_ARROW.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_MAGENTA);
|
colors[WaveformColors.REL_ARROW.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_MAGENTA);
|
||||||
colors[WaveformColors.REL_ARROW_HIGHLITE.ordinal()] = SWTResourceManager.getColor(255, 128, 255);
|
colors[WaveformColors.REL_ARROW_HIGHLITE.ordinal()] = SWTResourceManager.getColor(255, 128, 255);
|
||||||
|
colors[WaveformColors.BLANK.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_RED);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* needs redraw() afterwards
|
* needs redraw() afterwards
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2015-2021 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.swt.internal;
|
||||||
|
|
||||||
|
import org.eclipse.swt.SWT;
|
||||||
|
import org.eclipse.swt.graphics.Rectangle;
|
||||||
|
|
||||||
|
import com.minres.scviewer.database.ui.TrackEntry;
|
||||||
|
import com.minres.scviewer.database.ui.WaveformColors;
|
||||||
|
|
||||||
|
public class BlankPainter extends TrackPainter {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private final WaveformCanvas waveCanvas;
|
||||||
|
|
||||||
|
public BlankPainter(WaveformCanvas txDisplay, boolean even, TrackEntry trackEntry) {
|
||||||
|
super(trackEntry, even);
|
||||||
|
this.waveCanvas = txDisplay;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void paintArea(Projection proj, Rectangle area) {
|
||||||
|
if (trackEntry.selected)
|
||||||
|
proj.setBackground(this.waveCanvas.styleProvider.getColor(WaveformColors.TRACK_BG_HIGHLITE));
|
||||||
|
else
|
||||||
|
proj.setBackground(this.waveCanvas.styleProvider.getColor(even ? WaveformColors.TRACK_BG_EVEN : WaveformColors.TRACK_BG_ODD));
|
||||||
|
proj.setFillRule(SWT.FILL_EVEN_ODD);
|
||||||
|
proj.fillRectangle(area);
|
||||||
|
int trackHeight=trackEntry.height;
|
||||||
|
int txBase=trackHeight*2/5;
|
||||||
|
int txHeight=trackHeight/5;
|
||||||
|
Rectangle bb = new Rectangle(area.x, area.y+txBase, area.width, txHeight);
|
||||||
|
proj.setBackground(this.waveCanvas.styleProvider.getColor(WaveformColors.BLANK));
|
||||||
|
proj.fillRectangle(bb);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -47,7 +47,6 @@ import org.eclipse.swt.dnd.Transfer;
|
||||||
import org.eclipse.swt.events.ControlAdapter;
|
import org.eclipse.swt.events.ControlAdapter;
|
||||||
import org.eclipse.swt.events.ControlEvent;
|
import org.eclipse.swt.events.ControlEvent;
|
||||||
import org.eclipse.swt.events.DisposeListener;
|
import org.eclipse.swt.events.DisposeListener;
|
||||||
import org.eclipse.swt.events.MouseAdapter;
|
|
||||||
import org.eclipse.swt.events.MouseEvent;
|
import org.eclipse.swt.events.MouseEvent;
|
||||||
import org.eclipse.swt.events.MouseListener;
|
import org.eclipse.swt.events.MouseListener;
|
||||||
import org.eclipse.swt.events.PaintEvent;
|
import org.eclipse.swt.events.PaintEvent;
|
||||||
|
@ -91,6 +90,7 @@ import com.minres.scviewer.database.ui.IWaveformStyleProvider;
|
||||||
import com.minres.scviewer.database.ui.IWaveformView;
|
import com.minres.scviewer.database.ui.IWaveformView;
|
||||||
import com.minres.scviewer.database.ui.IWaveformZoom;
|
import com.minres.scviewer.database.ui.IWaveformZoom;
|
||||||
import com.minres.scviewer.database.ui.TrackEntry;
|
import com.minres.scviewer.database.ui.TrackEntry;
|
||||||
|
import com.minres.scviewer.database.ui.TrackEntryGroup;
|
||||||
import com.minres.scviewer.database.ui.swt.internal.slider.ZoomBar;
|
import com.minres.scviewer.database.ui.swt.internal.slider.ZoomBar;
|
||||||
|
|
||||||
public class WaveformView implements IWaveformView {
|
public class WaveformView implements IWaveformView {
|
||||||
|
@ -137,7 +137,7 @@ public class WaveformView implements IWaveformView {
|
||||||
|
|
||||||
protected TrackEntry lastClickedEntry;
|
protected TrackEntry lastClickedEntry;
|
||||||
|
|
||||||
protected MouseListener nameValueMouseListener = new MouseAdapter() {
|
protected MouseListener nameValueMouseListener = new MouseListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseDown(MouseEvent e) {
|
public void mouseDown(MouseEvent e) {
|
||||||
|
@ -173,6 +173,10 @@ public class WaveformView implements IWaveformView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mouseDoubleClick(MouseEvent e) {
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class WaveformMouseListener implements PaintListener, Listener {
|
class WaveformMouseListener implements PaintListener, Listener {
|
||||||
|
@ -551,29 +555,30 @@ public class WaveformView implements IWaveformView {
|
||||||
public void update() {
|
public void update() {
|
||||||
tracksVerticalHeight = 0;
|
tracksVerticalHeight = 0;
|
||||||
int nameMaxWidth = 0;
|
int nameMaxWidth = 0;
|
||||||
IWaveformPainter painter = null;
|
|
||||||
trackVerticalOffset.clear();
|
trackVerticalOffset.clear();
|
||||||
waveformCanvas.clearAllWaveformPainter(false);
|
waveformCanvas.clearAllWaveformPainter(false);
|
||||||
boolean even = true;
|
boolean even = true;
|
||||||
TextLayout tl = new TextLayout(waveformCanvas.getDisplay());
|
TextLayout tl = new TextLayout(waveformCanvas.getDisplay());
|
||||||
tl.setFont(styleProvider.getNameFont());
|
tl.setFont(styleProvider.getNameFont());
|
||||||
for (TrackEntry streamEntry : streams) {
|
for (TrackEntry streamEntry : streams) {
|
||||||
streamEntry.height = styleProvider.getTrackHeight();
|
if(streamEntry instanceof TrackEntryGroup && ((TrackEntryGroup)streamEntry).is_open) {
|
||||||
streamEntry.vOffset = tracksVerticalHeight;
|
TrackEntryGroup streamEntryGroup = (TrackEntryGroup)streamEntry;
|
||||||
if (streamEntry.waveform.getType() == WaveformType.TRANSACTION) {
|
for (TrackEntry trackEntry : streamEntryGroup.waveforms) {
|
||||||
streamEntry.currentValue = "";
|
addPainter(even, trackEntry);
|
||||||
streamEntry.height *= streamEntry.waveform.getRowCount();
|
trackVerticalOffset.put(tracksVerticalHeight, trackEntry);
|
||||||
painter = new StreamPainter(waveformCanvas, even, streamEntry);
|
tl.setText(trackEntry.waveform.getFullName());
|
||||||
} else if (streamEntry.waveform.getType() == WaveformType.SIGNAL) {
|
nameMaxWidth = Math.max(nameMaxWidth, tl.getBounds().width);
|
||||||
streamEntry.currentValue = "---";
|
tracksVerticalHeight += trackEntry.height;
|
||||||
painter = new SignalPainter(waveformCanvas, even, streamEntry);
|
even = !even;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
addPainter(even, streamEntry);
|
||||||
|
trackVerticalOffset.put(tracksVerticalHeight, streamEntry);
|
||||||
|
tl.setText(streamEntry.waveform.getFullName());
|
||||||
|
nameMaxWidth = Math.max(nameMaxWidth, tl.getBounds().width);
|
||||||
|
tracksVerticalHeight += streamEntry.height;
|
||||||
|
even = !even;
|
||||||
}
|
}
|
||||||
waveformCanvas.addWaveformPainter(painter, false);
|
|
||||||
trackVerticalOffset.put(tracksVerticalHeight, streamEntry);
|
|
||||||
tl.setText(streamEntry.waveform.getFullName());
|
|
||||||
nameMaxWidth = Math.max(nameMaxWidth, tl.getBounds().width);
|
|
||||||
tracksVerticalHeight += streamEntry.height;
|
|
||||||
even = !even;
|
|
||||||
}
|
}
|
||||||
waveformCanvas.syncSb();
|
waveformCanvas.syncSb();
|
||||||
nameList.setSize(nameMaxWidth + 15, tracksVerticalHeight);
|
nameList.setSize(nameMaxWidth + 15, tracksVerticalHeight);
|
||||||
|
@ -588,6 +593,23 @@ public class WaveformView implements IWaveformView {
|
||||||
tl.dispose();
|
tl.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void addPainter(boolean even, TrackEntry streamEntry) {
|
||||||
|
streamEntry.height = styleProvider.getTrackHeight();
|
||||||
|
streamEntry.vOffset = tracksVerticalHeight;
|
||||||
|
if (streamEntry.waveform.getType() == WaveformType.TRANSACTION) {
|
||||||
|
streamEntry.currentValue = "";
|
||||||
|
streamEntry.height *= streamEntry.waveform.getRowCount();
|
||||||
|
IWaveformPainter painter = new StreamPainter(waveformCanvas, even, streamEntry);
|
||||||
|
waveformCanvas.addWaveformPainter(painter, false);
|
||||||
|
} else if (streamEntry.waveform.getType() == WaveformType.SIGNAL) {
|
||||||
|
streamEntry.currentValue = "---";
|
||||||
|
waveformCanvas.addWaveformPainter(new SignalPainter(waveformCanvas, even, streamEntry), false);
|
||||||
|
} else if (streamEntry.waveform.getType() == WaveformType.BLANK) {
|
||||||
|
streamEntry.currentValue = "";
|
||||||
|
waveformCanvas.addWaveformPainter(new BlankPainter(waveformCanvas, even, streamEntry), false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private int calculateValueWidth() {
|
private int calculateValueWidth() {
|
||||||
TextLayout tl = new TextLayout(waveformCanvas.getDisplay());
|
TextLayout tl = new TextLayout(waveformCanvas.getDisplay());
|
||||||
tl.setFont(styleProvider.getNameFontHighlite());
|
tl.setFont(styleProvider.getNameFontHighlite());
|
||||||
|
|
|
@ -201,6 +201,13 @@
|
||||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_4ZeEQHabEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledmenuitem.previouschange" label="Previous Tx" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/reverse_green.png" command="_Gn3lEHXKEeWwZ-9vrAR2UQ">
|
<children xsi:type="menu:HandledMenuItem" xmi:id="_4ZeEQHabEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledmenuitem.previouschange" label="Previous Tx" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/reverse_green.png" command="_Gn3lEHXKEeWwZ-9vrAR2UQ">
|
||||||
<parameters xmi:id="_4ZeEQXabEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.5" name="com.minres.scviewer.e4.application.command.navigateTransCommand.parameter.dir" value="prev"/>
|
<parameters xmi:id="_4ZeEQXabEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.5" name="com.minres.scviewer.e4.application.command.navigateTransCommand.parameter.dir" value="prev"/>
|
||||||
</children>
|
</children>
|
||||||
|
<children xsi:type="menu:MenuSeparator" xmi:id="_cxgs4Lc0Ee294PIiYLxpfA" elementId="com.minres.scviewer.e4.application.menuseparator.1"/>
|
||||||
|
<children xsi:type="menu:HandledMenuItem" xmi:id="_NFfK0LcyEe294PIiYLxpfA" elementId="com.minres.scviewer.e4.application.handledmenuitem.add_blank" label="Add blank above" command="_vYAOQLcxEe294PIiYLxpfA">
|
||||||
|
<parameters xmi:id="_or7iYLcyEe294PIiYLxpfA" elementId="com.minres.scviewer.e4.application.parameter.15" name="com.minres.scviewer.e4.application.commandparameter.add_blank" value="before"/>
|
||||||
|
</children>
|
||||||
|
<children xsi:type="menu:HandledMenuItem" xmi:id="_ecbWkLc0Ee294PIiYLxpfA" elementId="com.minres.scviewer.e4.application.handledmenuitem.add_blank" visible="false" label="Add blank below" enabled="false" command="_vYAOQLcxEe294PIiYLxpfA">
|
||||||
|
<parameters xmi:id="_ecbWkbc0Ee294PIiYLxpfA" elementId="com.minres.scviewer.e4.application.parameter.15" name="com.minres.scviewer.e4.application.commandparameter.add_blank" value="after"/>
|
||||||
|
</children>
|
||||||
<children xsi:type="menu:MenuSeparator" xmi:id="__Ubd4M1eEei6rfTGo88R-w" elementId="com.minres.scviewer.e4.application.menuseparator.0"/>
|
<children xsi:type="menu:MenuSeparator" xmi:id="__Ubd4M1eEei6rfTGo88R-w" elementId="com.minres.scviewer.e4.application.menuseparator.0"/>
|
||||||
<children xsi:type="menu:Menu" xmi:id="_mAA6sM1bEei6rfTGo88R-w" elementId="com.minres.scviewer.e4.application.menu.view" label="View">
|
<children xsi:type="menu:Menu" xmi:id="_mAA6sM1bEei6rfTGo88R-w" elementId="com.minres.scviewer.e4.application.menu.view" label="View">
|
||||||
<visibleWhen xsi:type="ui:ImperativeExpression" xmi:id="_psvR0M1gEei6rfTGo88R-w" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.elements.WaveformPopupMenuContribution"/>
|
<visibleWhen xsi:type="ui:ImperativeExpression" xmi:id="_psvR0M1gEei6rfTGo88R-w" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.elements.WaveformPopupMenuContribution"/>
|
||||||
|
|
|
@ -84,6 +84,11 @@ public class Messages extends NLS {
|
||||||
public static String cursor;
|
public static String cursor;
|
||||||
public static String cursor_drag;
|
public static String cursor_drag;
|
||||||
public static String cursor_text;
|
public static String cursor_text;
|
||||||
|
public static String marker;
|
||||||
|
public static String marker_text;
|
||||||
|
public static String rel_arrow;
|
||||||
|
public static String rel_arrow_highlite;
|
||||||
|
public static String blank;
|
||||||
public static String HelpBrowser_0;
|
public static String HelpBrowser_0;
|
||||||
public static String HelpBrowser_1;
|
public static String HelpBrowser_1;
|
||||||
public static String HelpBrowser_2;
|
public static String HelpBrowser_2;
|
||||||
|
@ -92,10 +97,6 @@ public class Messages extends NLS {
|
||||||
public static String HelpBrowser_5;
|
public static String HelpBrowser_5;
|
||||||
public static String HelpBrowser_7;
|
public static String HelpBrowser_7;
|
||||||
public static String HelpBrowser_8;
|
public static String HelpBrowser_8;
|
||||||
public static String marker;
|
|
||||||
public static String marker_text;
|
|
||||||
public static String rel_arrow;
|
|
||||||
public static String rel_arrow_highlite;
|
|
||||||
public static String UpdateHandler_URI;
|
public static String UpdateHandler_URI;
|
||||||
public static String UpdateHandler_10;
|
public static String UpdateHandler_10;
|
||||||
public static String UpdateHandler_11;
|
public static String UpdateHandler_11;
|
||||||
|
|
|
@ -15,13 +15,12 @@ import javax.inject.Named;
|
||||||
|
|
||||||
import org.eclipse.e4.core.di.annotations.CanExecute;
|
import org.eclipse.e4.core.di.annotations.CanExecute;
|
||||||
import org.eclipse.e4.core.di.annotations.Execute;
|
import org.eclipse.e4.core.di.annotations.Execute;
|
||||||
|
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
|
||||||
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
||||||
import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
|
|
||||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
|
|
||||||
import com.minres.scviewer.database.BlankWaveform;
|
import com.minres.scviewer.database.BlankWaveform;
|
||||||
import com.minres.scviewer.database.IWaveform;
|
import com.minres.scviewer.database.IWaveform;
|
||||||
import com.minres.scviewer.database.tx.ITx;
|
|
||||||
import com.minres.scviewer.database.ui.TrackEntry;
|
import com.minres.scviewer.database.ui.TrackEntry;
|
||||||
import com.minres.scviewer.e4.application.parts.WaveformViewer;
|
import com.minres.scviewer.e4.application.parts.WaveformViewer;
|
||||||
|
|
||||||
|
@ -30,11 +29,15 @@ public class AddBlankWaveformHandler {
|
||||||
public static final String PARAM_WHERE_ID="com.minres.scviewer.e4.application.commandparameter.add_blank"; //$NON-NLS-1$
|
public static final String PARAM_WHERE_ID="com.minres.scviewer.e4.application.commandparameter.add_blank"; //$NON-NLS-1$
|
||||||
|
|
||||||
@CanExecute
|
@CanExecute
|
||||||
public Boolean canExecute(ESelectionService selectionService){
|
public Boolean canExecute(EPartService partService){
|
||||||
Object sel = selectionService.getSelection();
|
MPart part = partService.getActivePart();
|
||||||
if( sel instanceof IStructuredSelection) {
|
if(part!=null && part.getObject() instanceof WaveformViewer){
|
||||||
Object o= ((IStructuredSelection)sel).getFirstElement();
|
Object sel = ((WaveformViewer)part.getObject()).getSelection();
|
||||||
return o instanceof IWaveform || o instanceof ITx | o instanceof TrackEntry;
|
if( sel instanceof IStructuredSelection) {
|
||||||
|
if(((IStructuredSelection)sel).isEmpty()) return false;
|
||||||
|
Object o= ((IStructuredSelection)sel).getFirstElement();
|
||||||
|
return o instanceof TrackEntry;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,11 +17,8 @@ import org.eclipse.e4.core.di.annotations.CanExecute;
|
||||||
import org.eclipse.e4.core.di.annotations.Execute;
|
import org.eclipse.e4.core.di.annotations.Execute;
|
||||||
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
|
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
|
||||||
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
||||||
import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
|
|
||||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
|
|
||||||
import com.minres.scviewer.database.IWaveform;
|
|
||||||
import com.minres.scviewer.database.tx.ITx;
|
|
||||||
import com.minres.scviewer.database.ui.TrackEntry;
|
import com.minres.scviewer.database.ui.TrackEntry;
|
||||||
import com.minres.scviewer.e4.application.parts.WaveformViewer;
|
import com.minres.scviewer.e4.application.parts.WaveformViewer;
|
||||||
|
|
||||||
|
@ -30,11 +27,15 @@ public class MoveWaveformHandler {
|
||||||
static final String PARAMETER_ID="com.minres.scviewer.e4.application.command.movewaveformupCommand.parameter.dir"; //$NON-NLS-1$
|
static final String PARAMETER_ID="com.minres.scviewer.e4.application.command.movewaveformupCommand.parameter.dir"; //$NON-NLS-1$
|
||||||
|
|
||||||
@CanExecute
|
@CanExecute
|
||||||
public Boolean canExecute(ESelectionService selectionService){
|
public Boolean canExecute(EPartService partService){
|
||||||
Object sel = selectionService.getSelection();
|
MPart part = partService.getActivePart();
|
||||||
if( sel instanceof IStructuredSelection) {
|
if(part!=null && part.getObject() instanceof WaveformViewer){
|
||||||
Object o= ((IStructuredSelection)sel).getFirstElement();
|
Object sel = ((WaveformViewer)part.getObject()).getSelection();
|
||||||
return o instanceof IWaveform || o instanceof ITx | o instanceof TrackEntry;
|
if( sel instanceof IStructuredSelection) {
|
||||||
|
if(((IStructuredSelection)sel).isEmpty()) return false;
|
||||||
|
Object o= ((IStructuredSelection)sel).getFirstElement();
|
||||||
|
return o instanceof TrackEntry;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ WaveformPopupMenuContribution_10=No command found\!
|
||||||
WaveformPopupMenuContribution_12=Render {0}
|
WaveformPopupMenuContribution_12=Render {0}
|
||||||
WaveformPopupMenuContribution_15=No command found\!
|
WaveformPopupMenuContribution_15=No command found\!
|
||||||
WaveformPreferencesPage_description=Default Waveform Window Settings
|
WaveformPreferencesPage_description=Default Waveform Window Settings
|
||||||
WaveformPreferencesPage_1=Color for
|
WaveformPreferencesPage_1=Color for {0}
|
||||||
WaveformViewer_14=Database Load Cancelled
|
WaveformViewer_14=Database Load Cancelled
|
||||||
WaveformViewer_15=Database Load Job
|
WaveformViewer_15=Database Load Job
|
||||||
WaveformViewer_16=Loading
|
WaveformViewer_16=Loading
|
||||||
|
@ -78,18 +78,11 @@ signal_nan=Signal NaN Value
|
||||||
cursor=Cursor
|
cursor=Cursor
|
||||||
cursor_drag=dragged Cursor
|
cursor_drag=dragged Cursor
|
||||||
cursor_text=Cursor Text
|
cursor_text=Cursor Text
|
||||||
HelpBrowser_0=Back
|
|
||||||
HelpBrowser_1=Forward
|
|
||||||
HelpBrowser_2=Stop
|
|
||||||
HelpBrowser_3=Refresh
|
|
||||||
HelpBrowser_4=Go
|
|
||||||
HelpBrowser_5=Address
|
|
||||||
HelpBrowser_7=Error initializing help browser
|
|
||||||
HelpBrowser_8=An error occurred while initializing the help browser:
|
|
||||||
marker=Marker
|
marker=Marker
|
||||||
marker_text=Marker TExt
|
marker_text=Marker TExt
|
||||||
rel_arrow=Relation arrow
|
rel_arrow=Relation arrow
|
||||||
rel_arrow_highlite=highlighted Relation arrorw
|
rel_arrow_highlite=highlighted Relation arrorw
|
||||||
|
blank=blank waveform entry
|
||||||
UpdateHandler_URI=http://https://minres.github.io/SCViewer/repository
|
UpdateHandler_URI=http://https://minres.github.io/SCViewer/repository
|
||||||
UpdateHandler_10=Information
|
UpdateHandler_10=Information
|
||||||
UpdateHandler_11=Error
|
UpdateHandler_11=Error
|
||||||
|
@ -101,3 +94,11 @@ UpdateHandler_6=Updates installed, restart?
|
||||||
UpdateHandler_7=Updates have been installed successfully, do you want to restart?
|
UpdateHandler_7=Updates have been installed successfully, do you want to restart?
|
||||||
UpdateHandler_8=Couldn't get provisioning job:
|
UpdateHandler_8=Couldn't get provisioning job:
|
||||||
UpdateHandler_9=Couldn't resolve provisioning job
|
UpdateHandler_9=Couldn't resolve provisioning job
|
||||||
|
HelpBrowser_0=Back
|
||||||
|
HelpBrowser_1=Forward
|
||||||
|
HelpBrowser_2=Stop
|
||||||
|
HelpBrowser_3=Refresh
|
||||||
|
HelpBrowser_4=Go
|
||||||
|
HelpBrowser_5=Address
|
||||||
|
HelpBrowser_7=Error initializing help browser
|
||||||
|
HelpBrowser_8=An error occurred while initializing the help browser:
|
||||||
|
|
|
@ -16,6 +16,7 @@ import org.osgi.service.prefs.Preferences;
|
||||||
|
|
||||||
import com.minres.scviewer.database.ui.IWaveformStyleProvider;
|
import com.minres.scviewer.database.ui.IWaveformStyleProvider;
|
||||||
import com.minres.scviewer.database.ui.WaveformColors;
|
import com.minres.scviewer.database.ui.WaveformColors;
|
||||||
|
import com.minres.scviewer.database.ui.swt.DefaultWaveformStyleProvider;
|
||||||
import com.minres.scviewer.e4.application.preferences.PreferenceConstants;
|
import com.minres.scviewer.e4.application.preferences.PreferenceConstants;
|
||||||
|
|
||||||
public class WaveformStyleProvider implements IWaveformStyleProvider {
|
public class WaveformStyleProvider implements IWaveformStyleProvider {
|
||||||
|
@ -39,29 +40,9 @@ public class WaveformStyleProvider implements IWaveformStyleProvider {
|
||||||
Display display = Display.getCurrent();
|
Display display = Display.getCurrent();
|
||||||
|
|
||||||
nameFont = display.getSystemFont();
|
nameFont = display.getSystemFont();
|
||||||
colors[WaveformColors.LINE.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
|
DefaultWaveformStyleProvider x = new DefaultWaveformStyleProvider();
|
||||||
colors[WaveformColors.LINE_HIGHLITE.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_CYAN);
|
for (WaveformColors color : WaveformColors.values())
|
||||||
colors[WaveformColors.TRACK_BG_EVEN.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_BLACK);
|
colors[color.ordinal()] = x.getColor(color);
|
||||||
colors[WaveformColors.TRACK_BG_ODD.ordinal()] = SWTResourceManager.getColor(40, 40, 40);
|
|
||||||
colors[WaveformColors.TRACK_BG_HIGHLITE.ordinal()] = SWTResourceManager.getColor(40, 40, 80);
|
|
||||||
colors[WaveformColors.TX_BG.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GREEN);
|
|
||||||
colors[WaveformColors.TX_BG_HIGHLITE.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GREEN);
|
|
||||||
colors[WaveformColors.TX_BORDER.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
|
|
||||||
colors[WaveformColors.SIGNAL0.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GREEN);
|
|
||||||
colors[WaveformColors.SIGNAL1.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GREEN);
|
|
||||||
colors[WaveformColors.SIGNALZ.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_YELLOW);
|
|
||||||
colors[WaveformColors.SIGNALX.ordinal()] = SWTResourceManager.getColor(255, 51, 51);
|
|
||||||
colors[WaveformColors.SIGNALU.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_YELLOW);
|
|
||||||
colors[WaveformColors.SIGNAL_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
|
|
||||||
colors[WaveformColors.SIGNAL_REAL.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_YELLOW);
|
|
||||||
colors[WaveformColors.SIGNAL_NAN.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
|
|
||||||
colors[WaveformColors.CURSOR.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
|
|
||||||
colors[WaveformColors.CURSOR_DRAG.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GRAY);
|
|
||||||
colors[WaveformColors.CURSOR_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
|
|
||||||
colors[WaveformColors.MARKER.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GRAY);
|
|
||||||
colors[WaveformColors.MARKER_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
|
|
||||||
colors[WaveformColors.REL_ARROW.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_MAGENTA);
|
|
||||||
colors[WaveformColors.REL_ARROW_HIGHLITE.ordinal()] = SWTResourceManager.getColor(255, 128, 255);
|
|
||||||
randomColors = new Color[][] {
|
randomColors = new Color[][] {
|
||||||
{ SWTResourceManager.getColor( 170, 66, 37 ), SWTResourceManager.getColor( 190, 66, 37 ) },
|
{ SWTResourceManager.getColor( 170, 66, 37 ), SWTResourceManager.getColor( 190, 66, 37 ) },
|
||||||
{ SWTResourceManager.getColor( 96, 74, 110 ), SWTResourceManager.getColor( 96, 74, 130 ) },
|
{ SWTResourceManager.getColor( 96, 74, 110 ), SWTResourceManager.getColor( 96, 74, 130 ) },
|
||||||
|
|
|
@ -14,64 +14,30 @@ import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
|
||||||
import org.eclipse.core.runtime.preferences.DefaultScope;
|
import org.eclipse.core.runtime.preferences.DefaultScope;
|
||||||
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
|
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
|
||||||
import org.eclipse.jface.resource.StringConverter;
|
import org.eclipse.jface.resource.StringConverter;
|
||||||
import org.eclipse.swt.SWT;
|
|
||||||
import org.eclipse.swt.graphics.Color;
|
|
||||||
import org.eclipse.wb.swt.SWTResourceManager;
|
|
||||||
import org.osgi.framework.FrameworkUtil;
|
import org.osgi.framework.FrameworkUtil;
|
||||||
|
|
||||||
import com.minres.scviewer.database.ui.WaveformColors;
|
import com.minres.scviewer.database.ui.WaveformColors;
|
||||||
|
import com.minres.scviewer.database.ui.swt.DefaultWaveformStyleProvider;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class DefaultValuesInitializer.
|
* The Class DefaultValuesInitializer.
|
||||||
*/
|
*/
|
||||||
public class DefaultValuesInitializer extends AbstractPreferenceInitializer {
|
public class DefaultValuesInitializer extends AbstractPreferenceInitializer {
|
||||||
|
|
||||||
/** The default colors. */
|
|
||||||
public static final Color[] colors = new Color[WaveformColors.values().length];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Instantiates a new default values initializer.
|
|
||||||
*/
|
|
||||||
public DefaultValuesInitializer() {
|
|
||||||
colors[WaveformColors.LINE.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
|
|
||||||
colors[WaveformColors.LINE_HIGHLITE.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_CYAN);
|
|
||||||
colors[WaveformColors.TRACK_BG_EVEN.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_BLACK);
|
|
||||||
colors[WaveformColors.TRACK_BG_ODD.ordinal()] = SWTResourceManager.getColor(40, 40, 40);
|
|
||||||
colors[WaveformColors.TRACK_BG_HIGHLITE.ordinal()] = SWTResourceManager.getColor(40, 40, 80);
|
|
||||||
colors[WaveformColors.TX_BG.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GREEN);
|
|
||||||
colors[WaveformColors.TX_BG_HIGHLITE.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GREEN);
|
|
||||||
colors[WaveformColors.TX_BORDER.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
|
|
||||||
colors[WaveformColors.SIGNAL0.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GREEN);
|
|
||||||
colors[WaveformColors.SIGNAL1.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GREEN);
|
|
||||||
colors[WaveformColors.SIGNALZ.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_YELLOW);
|
|
||||||
colors[WaveformColors.SIGNALX.ordinal()] = SWTResourceManager.getColor(255, 51, 51);
|
|
||||||
colors[WaveformColors.SIGNALU.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_YELLOW);
|
|
||||||
colors[WaveformColors.SIGNAL_REAL.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_YELLOW);
|
|
||||||
colors[WaveformColors.SIGNAL_NAN.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
|
|
||||||
colors[WaveformColors.SIGNAL_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
|
|
||||||
colors[WaveformColors.SIGNAL_REAL.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_YELLOW);
|
|
||||||
colors[WaveformColors.CURSOR.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
|
|
||||||
colors[WaveformColors.CURSOR_DRAG.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GRAY);
|
|
||||||
colors[WaveformColors.CURSOR_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
|
|
||||||
colors[WaveformColors.MARKER.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GRAY);
|
|
||||||
colors[WaveformColors.MARKER_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
|
|
||||||
colors[WaveformColors.REL_ARROW.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_MAGENTA);
|
|
||||||
colors[WaveformColors.REL_ARROW_HIGHLITE.ordinal()] = SWTResourceManager.getColor(255, 128, 255);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
|
* @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void initializeDefaultPreferences() {
|
public void initializeDefaultPreferences() {
|
||||||
IEclipsePreferences store = DefaultScope.INSTANCE.getNode(FrameworkUtil.getBundle(getClass()).getSymbolicName());
|
IEclipsePreferences store = DefaultScope.INSTANCE.getNode(FrameworkUtil.getBundle(getClass()).getSymbolicName());
|
||||||
|
DefaultWaveformStyleProvider styleProvider = new DefaultWaveformStyleProvider();
|
||||||
|
|
||||||
store.putBoolean(PreferenceConstants.DATABASE_RELOAD, true);
|
store.putBoolean(PreferenceConstants.DATABASE_RELOAD, true);
|
||||||
store.putBoolean(PreferenceConstants.SHOW_HOVER, true);
|
store.putBoolean(PreferenceConstants.SHOW_HOVER, true);
|
||||||
store.putBoolean(PreferenceConstants.SHOW_TX_DETAILS, false);
|
store.putBoolean(PreferenceConstants.SHOW_TX_DETAILS, false);
|
||||||
store.putInt(PreferenceConstants.TRACK_HEIGHT, 30);
|
store.putInt(PreferenceConstants.TRACK_HEIGHT, 30);
|
||||||
for (WaveformColors c : WaveformColors.values()) {
|
for (WaveformColors c : WaveformColors.values()) {
|
||||||
store.put(c.name()+"_COLOR", StringConverter.asString(colors[c.ordinal()].getRGB())); //$NON-NLS-1$
|
store.put(c.name()+"_COLOR", StringConverter.asString(styleProvider.getColor(c).getRGB())); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,59 +32,5 @@ public class PreferenceConstants {
|
||||||
/** The Constant TRACK_HEIGHT. */
|
/** The Constant TRACK_HEIGHT. */
|
||||||
public static final String TRACK_HEIGHT="trackHeigth"; //$NON-NLS-1$
|
public static final String TRACK_HEIGHT="trackHeigth"; //$NON-NLS-1$
|
||||||
|
|
||||||
/** The Constant LINE_COLOR. */
|
|
||||||
public static final String LINE_COLOR="LINE_COLOR"; //$NON-NLS-1$
|
|
||||||
|
|
||||||
/** The Constant LINE_HIGHLITE_COLOR. */
|
|
||||||
public static final String LINE_HIGHLITE_COLOR="LINE_HIGHLITE_COLOR"; //$NON-NLS-1$
|
|
||||||
|
|
||||||
/** The Constant TRACK_BG_EVEN_COLOR. */
|
|
||||||
public static final String TRACK_BG_EVEN_COLOR="TRACK_BG_EVEN_COLOR"; //$NON-NLS-1$
|
|
||||||
|
|
||||||
/** The Constant TRACK_BG_ODD_COLOR. */
|
|
||||||
public static final String TRACK_BG_ODD_COLOR="TRACK_BG_ODD_COLOR"; //$NON-NLS-1$
|
|
||||||
|
|
||||||
/** The Constant TRACK_BG_HIGHLITE_COLOR. */
|
|
||||||
public static final String TRACK_BG_HIGHLITE_COLOR="TRACK_BG_HIGHLITE_COLOR"; //$NON-NLS-1$
|
|
||||||
|
|
||||||
/** The Constant TX_BG_COLOR. */
|
|
||||||
public static final String TX_BG_COLOR="TX_BG_COLOR"; //$NON-NLS-1$
|
|
||||||
|
|
||||||
/** The Constant TX_BG_HIGHLITE_COLOR. */
|
|
||||||
public static final String TX_BG_HIGHLITE_COLOR="TX_BG_HIGHLITE_COLOR"; //$NON-NLS-1$
|
|
||||||
|
|
||||||
/** The Constant TX_BORDER_COLOR. */
|
|
||||||
public static final String TX_BORDER_COLOR="TX_BORDER_COLOR"; //$NON-NLS-1$
|
|
||||||
|
|
||||||
/** The Constant SIGNAL0_COLOR. */
|
|
||||||
public static final String SIGNAL0_COLOR="SIGNAL0_COLOR"; //$NON-NLS-1$
|
|
||||||
|
|
||||||
/** The Constant SIGNAL1_COLOR. */
|
|
||||||
public static final String SIGNAL1_COLOR="SIGNAL1_COLOR"; //$NON-NLS-1$
|
|
||||||
|
|
||||||
/** The Constant SIGNALZ_COLOR. */
|
|
||||||
public static final String SIGNALZ_COLOR="SIGNALZ_COLOR"; //$NON-NLS-1$
|
|
||||||
|
|
||||||
/** The Constant SIGNALX_COLOR. */
|
|
||||||
public static final String SIGNALX_COLOR="SIGNALX_COLOR"; //$NON-NLS-1$
|
|
||||||
|
|
||||||
/** The Constant SIGNAL_TEXT_COLOR. */
|
|
||||||
public static final String SIGNAL_TEXT_COLOR="SIGNAL_TEXT_COLOR"; //$NON-NLS-1$
|
|
||||||
|
|
||||||
/** The Constant CURSOR_COLOR. */
|
|
||||||
public static final String CURSOR_COLOR="CURSOR_COLOR"; //$NON-NLS-1$
|
|
||||||
|
|
||||||
/** The Constant CURSOR_DRAG_COLOR. */
|
|
||||||
public static final String CURSOR_DRAG_COLOR="CURSOR_DRAG_COLOR"; //$NON-NLS-1$
|
|
||||||
|
|
||||||
/** The Constant CURSOR_TEXT_COLOR. */
|
|
||||||
public static final String CURSOR_TEXT_COLOR="CURSOR_TEXT_COLOR"; //$NON-NLS-1$
|
|
||||||
|
|
||||||
/** The Constant MARKER_COLOR. */
|
|
||||||
public static final String MARKER_COLOR="MARKER_COLOR"; //$NON-NLS-1$
|
|
||||||
|
|
||||||
/** The Constant MARKER_TEXT_COLOR. */
|
|
||||||
public static final String MARKER_TEXT_COLOR="MARKER_TEXT_COLOR"; //$NON-NLS-1$
|
|
||||||
|
|
||||||
private PreferenceConstants() {}
|
private PreferenceConstants() {}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ import java.util.HashMap;
|
||||||
|
|
||||||
import org.eclipse.jface.preference.ColorFieldEditor;
|
import org.eclipse.jface.preference.ColorFieldEditor;
|
||||||
import org.eclipse.jface.preference.FieldEditorPreferencePage;
|
import org.eclipse.jface.preference.FieldEditorPreferencePage;
|
||||||
|
import org.eclipse.osgi.util.NLS;
|
||||||
|
|
||||||
import com.minres.scviewer.database.ui.WaveformColors;
|
import com.minres.scviewer.database.ui.WaveformColors;
|
||||||
import com.minres.scviewer.e4.application.Messages;
|
import com.minres.scviewer.e4.application.Messages;
|
||||||
|
@ -48,7 +49,7 @@ public class WaveformPreferencesPage extends FieldEditorPreferencePage {
|
||||||
}
|
}
|
||||||
for (WaveformColors c : WaveformColors.values()) {
|
for (WaveformColors c : WaveformColors.values()) {
|
||||||
addField(new ColorFieldEditor(c.name() + "_COLOR",
|
addField(new ColorFieldEditor(c.name() + "_COLOR",
|
||||||
Messages.WaveformPreferencesPage_1 + staticFields.get(c.name().toLowerCase()), //$NON-NLS-1$
|
NLS.bind(Messages.WaveformPreferencesPage_1, staticFields.get(c.name().toLowerCase())), //$NON-NLS-1$
|
||||||
getFieldEditorParent()));
|
getFieldEditorParent()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue