adds binary render option

This commit is contained in:
Eyck Jentzsch 2023-02-28 07:06:48 +01:00
parent b268b4b677
commit ec471348f6
6 changed files with 48 additions and 17 deletions

View File

@ -18,7 +18,7 @@ public class TrackEntry {
IWaveformStyleProvider styleProvider; IWaveformStyleProvider styleProvider;
public enum ValueDisplay { public enum ValueDisplay {
DEFAULT, SIGNED, UNSIGNED DEFAULT, BINARY, SIGNED, UNSIGNED
} }

View File

@ -219,6 +219,9 @@ public class SignalPainter extends TrackPainter {
case UNSIGNED: case UNSIGNED:
label=Long.toString(last.toUnsignedValue()); label=Long.toString(last.toUnsignedValue());
break; break;
case BINARY:
label=last.toString();
break;
default: default:
label="h'"+last.toHexString(); label="h'"+last.toHexString();
} }

View File

@ -617,6 +617,9 @@ public class WaveformView implements IWaveformView {
case UNSIGNED: case UNSIGNED:
entry.currentValue = Long.toString(bv.toUnsignedValue()); entry.currentValue = Long.toString(bv.toUnsignedValue());
break; break;
case BINARY:
entry.currentValue=bv.toString();
break;
default: default:
entry.currentValue = "h'" + bv.toHexString(); entry.currentValue = "h'" + bv.toHexString();
} }

View File

@ -43,6 +43,17 @@ public class Messages extends NLS {
public static String TransactionDetails_21; public static String TransactionDetails_21;
public static String TransactionDetails_3; public static String TransactionDetails_3;
public static String TransactionDetails_4; public static String TransactionDetails_4;
public static String WaveformPopupMenuContribution_0;
public static String WaveformPopupMenuContribution_1;
public static String WaveformPopupMenuContribution_10;
public static String WaveformPopupMenuContribution_12;
public static String WaveformPopupMenuContribution_15;
public static String WaveformPopupMenuContribution_2;
public static String WaveformPopupMenuContribution_3;
public static String WaveformPopupMenuContribution_4;
public static String WaveformPopupMenuContribution_5;
public static String WaveformPopupMenuContribution_6;
public static String WaveformPopupMenuContribution_7;
public static String WaveformPreferencesPage_description; public static String WaveformPreferencesPage_description;
public static String WaveformPreferencesPage_1; public static String WaveformPreferencesPage_1;
public static String WaveformViewer_13; public static String WaveformViewer_13;

View File

@ -20,11 +20,13 @@ import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory;
import org.eclipse.e4.ui.workbench.modeling.EModelService; import org.eclipse.e4.ui.workbench.modeling.EModelService;
import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.osgi.util.NLS;
import com.minres.scviewer.database.BitVector; import com.minres.scviewer.database.BitVector;
import com.minres.scviewer.database.DoubleVal; import com.minres.scviewer.database.DoubleVal;
import com.minres.scviewer.database.WaveformType; import com.minres.scviewer.database.WaveformType;
import com.minres.scviewer.database.ui.TrackEntry; import com.minres.scviewer.database.ui.TrackEntry;
import com.minres.scviewer.e4.application.Messages;
import com.minres.scviewer.e4.application.parts.WaveformViewer; import com.minres.scviewer.e4.application.parts.WaveformViewer;
public class WaveformPopupMenuContribution { public class WaveformPopupMenuContribution {
@ -86,14 +88,15 @@ public class WaveformPopupMenuContribution {
ISelection sel = wfv.getSelection(); ISelection sel = wfv.getSelection();
TrackEntry elem = getSingleTrackEntry(sel); TrackEntry elem = getSingleTrackEntry(sel);
if(selHasBitVector(sel, false)) { if(selHasBitVector(sel, false)) {
addValueMenuItem(items, application, modelService, "hex", TrackEntry.ValueDisplay.DEFAULT, elem); addValueMenuItem(items, application, modelService, Messages.WaveformPopupMenuContribution_0, TrackEntry.ValueDisplay.BINARY, elem);
addValueMenuItem(items, application, modelService, "unsigned", TrackEntry.ValueDisplay.UNSIGNED, elem); addValueMenuItem(items, application, modelService, Messages.WaveformPopupMenuContribution_1, TrackEntry.ValueDisplay.DEFAULT, elem);
addValueMenuItem(items, application, modelService, "signed", TrackEntry.ValueDisplay.SIGNED, elem); addValueMenuItem(items, application, modelService, Messages.WaveformPopupMenuContribution_2, TrackEntry.ValueDisplay.UNSIGNED, elem);
addValueMenuItem(items, application, modelService, Messages.WaveformPopupMenuContribution_3, TrackEntry.ValueDisplay.SIGNED, elem);
items.add(MMenuFactory.INSTANCE.createMenuSeparator()); items.add(MMenuFactory.INSTANCE.createMenuSeparator());
addWaveMenuItem(items, application, modelService, "bit vector", TrackEntry.WaveDisplay.DEFAULT, elem); addWaveMenuItem(items, application, modelService, Messages.WaveformPopupMenuContribution_4, TrackEntry.WaveDisplay.DEFAULT, elem);
} }
addWaveMenuItem(items, application, modelService, "analog step-wise", TrackEntry.WaveDisplay.STEP_WISE, elem); addWaveMenuItem(items, application, modelService, Messages.WaveformPopupMenuContribution_5, TrackEntry.WaveDisplay.STEP_WISE, elem);
addWaveMenuItem(items, application, modelService, "analog continous", TrackEntry.WaveDisplay.CONTINOUS, elem); addWaveMenuItem(items, application, modelService, Messages.WaveformPopupMenuContribution_6, TrackEntry.WaveDisplay.CONTINOUS, elem);
} }
} }
@ -102,13 +105,13 @@ public class WaveformPopupMenuContribution {
MHandledMenuItem item = MMenuFactory.INSTANCE.createHandledMenuItem(); MHandledMenuItem item = MMenuFactory.INSTANCE.createHandledMenuItem();
item.setType(ItemType.RADIO); item.setType(ItemType.RADIO);
item.setSelected(elem != null && elem.valueDisplay == value); item.setSelected(elem != null && elem.valueDisplay == value);
item.setLabel("Show as "+label); item.setLabel(NLS.bind(Messages.WaveformPopupMenuContribution_7, label));
item.setContributorURI("platform:/plugin/com.minres.scviewer.e4.application"); item.setContributorURI("platform:/plugin/com.minres.scviewer.e4.application"); //$NON-NLS-1$
List<MCommand> cmds = modelService.findElements(application, "com.minres.scviewer.e4.application.command.changevaluedisplay", MCommand.class, null); List<MCommand> cmds = modelService.findElements(application, "com.minres.scviewer.e4.application.command.changevaluedisplay", MCommand.class, null); //$NON-NLS-1$
if(cmds.size()!=1) System.err.println("No command found!"); if(cmds.size()!=1) System.err.println(Messages.WaveformPopupMenuContribution_10);
else item.setCommand(cmds.get(0)); else item.setCommand(cmds.get(0));
MParameter param = MCommandsFactory.INSTANCE.createParameter(); MParameter param = MCommandsFactory.INSTANCE.createParameter();
param.setName("com.minres.scviewer.e4.application.commandparameter.changevaluedisplay"); param.setName("com.minres.scviewer.e4.application.commandparameter.changevaluedisplay"); //$NON-NLS-1$
param.setValue(value.toString()); param.setValue(value.toString());
item.getParameters().add(param); item.getParameters().add(param);
items.add(item); items.add(item);
@ -119,13 +122,13 @@ public class WaveformPopupMenuContribution {
MHandledMenuItem item = MMenuFactory.INSTANCE.createHandledMenuItem(); MHandledMenuItem item = MMenuFactory.INSTANCE.createHandledMenuItem();
item.setType(ItemType.RADIO); item.setType(ItemType.RADIO);
item.setSelected(elem != null && elem.waveDisplay==value); item.setSelected(elem != null && elem.waveDisplay==value);
item.setLabel("Render "+label); item.setLabel(NLS.bind(Messages.WaveformPopupMenuContribution_12, label));
item.setContributorURI("platform:/plugin/com.minres.scviewer.e4.application"); item.setContributorURI("platform:/plugin/com.minres.scviewer.e4.application"); //$NON-NLS-1$
List<MCommand> cmds = modelService.findElements(application, "com.minres.scviewer.e4.application.command.changewavedisplay", MCommand.class, null); List<MCommand> cmds = modelService.findElements(application, "com.minres.scviewer.e4.application.command.changewavedisplay", MCommand.class, null); //$NON-NLS-1$
if(cmds.size()!=1) System.err.println("No command found!"); if(cmds.size()!=1) System.err.println(Messages.WaveformPopupMenuContribution_15);
else item.setCommand(cmds.get(0)); else item.setCommand(cmds.get(0));
MParameter param = MCommandsFactory.INSTANCE.createParameter(); MParameter param = MCommandsFactory.INSTANCE.createParameter();
param.setName("com.minres.scviewer.e4.application.commandparameter.changewavedisplay"); param.setName("com.minres.scviewer.e4.application.commandparameter.changewavedisplay"); //$NON-NLS-1$
param.setValue(value.toString()); param.setValue(value.toString());
item.getParameters().add(param); item.getParameters().add(param);
items.add(item); items.add(item);

View File

@ -37,6 +37,17 @@ TransactionDetails_20=Time
TransactionDetails_21=End time TransactionDetails_21=End time
TransactionDetails_3=Value TransactionDetails_3=Value
TransactionDetails_4=Relation TransactionDetails_4=Relation
WaveformPopupMenuContribution_0=bin
WaveformPopupMenuContribution_1=hex
WaveformPopupMenuContribution_2=unsigned int
WaveformPopupMenuContribution_3=signed int
WaveformPopupMenuContribution_4=bit vector
WaveformPopupMenuContribution_5=analog step-wise
WaveformPopupMenuContribution_6=analog continous
WaveformPopupMenuContribution_7=Show as {0}
WaveformPopupMenuContribution_10=No command found\!
WaveformPopupMenuContribution_12=Render {0}
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
WaveformViewer_13=Database Load Status WaveformViewer_13=Database Load Status