X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=plugins%2Fnet.mograsim.plugin.core%2Fsrc%2Fnet%2Fmograsim%2Fplugin%2FMainPreferencePage.java;h=ce2ccd0d1eea01f16276c452c0f1158fd88e045c;hb=161ecd36b6dcfe0e38cee3fd6ea8ad42d0705777;hp=b5e89ad10159df6b3d27c930eae4733ce1b2c044;hpb=5799704ea3af4cce1cd89189c11f2727046009e8;p=Mograsim.git diff --git a/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/MainPreferencePage.java b/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/MainPreferencePage.java index b5e89ad1..ce2ccd0d 100644 --- a/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/MainPreferencePage.java +++ b/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/MainPreferencePage.java @@ -8,7 +8,10 @@ import static net.mograsim.logic.model.preferences.RenderPreferences.BIT_ZERO_DA import static net.mograsim.logic.model.preferences.RenderPreferences.BIT_Z_DASH; import static net.mograsim.logic.model.preferences.RenderPreferences.DEBUG_HLSSHELL_DEPTH; import static net.mograsim.logic.model.preferences.RenderPreferences.DEBUG_OPEN_HLSSHELL; +import static net.mograsim.logic.model.preferences.RenderPreferences.DEFAULT_LINE_WIDTH; import static net.mograsim.logic.model.preferences.RenderPreferences.DRAG_BUTTON; +import static net.mograsim.logic.model.preferences.RenderPreferences.WIRE_WIDTH_MULTIBIT; +import static net.mograsim.logic.model.preferences.RenderPreferences.WIRE_WIDTH_SINGLEBIT; import static net.mograsim.logic.model.preferences.RenderPreferences.ZOOM_BUTTON; import static net.mograsim.plugin.preferences.PluginPreferences.MPM_EDITOR_BITS_AS_COLUMN_NAME; @@ -30,6 +33,7 @@ import org.eclipse.ui.IWorkbenchPreferencePage; import net.mograsim.logic.model.preferences.RenderPreferences; import net.mograsim.plugin.preferences.PluginPreferences; +import net.mograsim.plugin.util.DoubleFieldEditor; import net.mograsim.preferences.Preferences; public class MainPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage @@ -53,35 +57,22 @@ public class MainPreferencePage extends FieldEditorPreferencePage implements IWo { Composite parent = getFieldEditorParent(); addBoolean(DEBUG_OPEN_HLSSHELL, "Open the debug HLS shell", parent); - addInt("Depth of components to list in the debug HLS shell (0: unbounded)", DEBUG_HLSSHELL_DEPTH, parent); + addInt(DEBUG_HLSSHELL_DEPTH, "Depth of components to list in the debug HLS shell (0: unbounded)", parent); addIntCombo(ACTION_BUTTON, "Mouse button for actions", MOUSE_BUTTONS, parent); addIntCombo(DRAG_BUTTON, "Mouse button for dragging", MOUSE_BUTTONS, parent); addIntCombo(ZOOM_BUTTON, "Mouse button for zooming", MOUSE_BUTTONS, parent); addBoolean(MPM_EDITOR_BITS_AS_COLUMN_NAME, "Use the raw bit indices of MPM columns as column titles in the MPM editor", parent); + + insertSeparator(parent); + addDouble(WIRE_WIDTH_SINGLEBIT, "Line width for single-bit wires", parent); + addDouble(WIRE_WIDTH_MULTIBIT, "Line width for multi-bit wires", parent); + addDouble(DEFAULT_LINE_WIDTH, "Line width for other wires", parent); addDashesGroup(parent); // TODO add other preferences } private void addDashesGroup(Composite parent) { -// Composite groupComposite = new Composite(parent, SWT.LEFT); -// GridDataFactory.fillDefaults().grab(true, false).applyTo(groupComposite); -// GridLayoutFactory.fillDefaults().numColumns(2).applyTo(groupComposite); -// GridLayout gl = ((GridLayout) groupComposite.getLayout()); -// gl.horizontalSpacing = 0; -// -// Group grpWindowTitle = new Group(groupComposite, SWT.NONE); -// grpWindowTitle.setText("Line dashes"); -// grpWindowTitle.setLayout(new GridLayout(1, false)); -// grpWindowTitle.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); -// -// // show workspace name -// Composite content = new Composite(grpWindowTitle, SWT.NONE); -// GridDataFactory.defaultsFor(content).indent(0, 0).grab(true, false).applyTo(content); -// GridLayout locationNameLayout = new GridLayout(2, false); -// content.setLayout(locationNameLayout); -// locationNameLayout.marginWidth = locationNameLayout.marginHeight = 0; - Composite dashesGroupParent = new Composite(parent, SWT.NONE); dashesGroupParent.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1)); GridLayout dashesGroupParentLayout = new GridLayout(); @@ -103,7 +94,7 @@ public class MainPreferencePage extends FieldEditorPreferencePage implements IWo Label dashesDescription = new Label(content, SWT.WRAP); dashesDescription.setText("Line dashes for single-bit wires displaying the respective value.\n" - + "Format: As comma-separated list of doubles. The first value is the width of the first segment,\n" + + "Format: A comma-separated list of doubles. The first value is the width of the first segment,\n" + "the second is the spacing between the first and second segments,\n" + "the third is the width of the second segment and so on."); dashesDescription.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 2, 1)); @@ -120,12 +111,18 @@ public class MainPreferencePage extends FieldEditorPreferencePage implements IWo addField(new BooleanFieldEditor(name, label, parent)); } - private void addInt(String label, String name, Composite parent) + private void addInt(String name, String label, Composite parent) { defaultsPreferenceStore(name).getInt(name); addField(new IntegerFieldEditor(name, label, parent)); } + private void addDouble(String name, String label, Composite parent) + { + defaultsPreferenceStore(name).getDouble(name); + addField(new DoubleFieldEditor(name, label, parent)); + } + private void addIntCombo(String name, String label, String[][] entryNamesAndValues, Composite parent) { addCombo(name, label, entryNamesAndValues, parent, defaultsPreferenceStore(name)::getInt); @@ -143,6 +140,11 @@ public class MainPreferencePage extends FieldEditorPreferencePage implements IWo addField(new StringFieldEditor(name, label, parent)); } + private static void insertSeparator(Composite parent) + { + new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL).setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1)); + } + private static Preferences defaultsPreferenceStore(String name) { // TODO is it a good idea to list all preference systems here?