*/
public class LogicUICanvas extends ZoomableCanvas
{
- private static final boolean OPEN_DEBUG_SETHIGHLEVELSTATE_SHELL = false;
-
private final LogicModel model;
public LogicUICanvas(Composite parent, int style, LogicModel model)
addListener(SWT.MouseDown, this::mouseDown);
- if (OPEN_DEBUG_SETHIGHLEVELSTATE_SHELL)
+ if (Preferences.current().getBoolean("net.mograsim.logic.model.debug.openhlsshell"))
openDebugSetHighLevelStateShell(model);
}
* A pseudo-component containing all submodel interface pins on the submodel side.
*/
private final SubmodelInterface submodelInterface;
-
/**
* The factor by which the submodel is scaled when rendering.
*/
private double submodelScale;
- /**
- * If this {@link SubmodelComponent} fills at least this amount of the visible region vertically or horizontally, the submodel starts to
- * be visible.
- */
- private double maxVisibleRegionFillRatioForAlpha0;
- /**
- * If this {@link SubmodelComponent} fills at least this amount of the visible region vertically or horizontally, the submodel is fully
- * visible.
- */
- private double minVisibleRegionFillRatioForAlpha1;
/**
* The renderer used for rendering the submodel.
*/
private final LogicUIRenderer renderer;
-
/**
* The {@link Renderer} used to render the symbol of this SubmodelCoponent.
*/
this.submodelInterface = new SubmodelInterface(submodelModifiable);
this.submodelScale = 1;
- this.maxVisibleRegionFillRatioForAlpha0 = 0.8;
- this.minVisibleRegionFillRatioForAlpha1 = 0.9;
this.renderer = new LogicUIRenderer(submodelModifiable);
Consumer<Runnable> redrawHandlerChangedListener = submodelModifiable::setRedrawHandler;
GeneralGC tgc = new TranslatedGC(gc, getPosX(), getPosY(), submodelScale, true);
conf.reset(tgc);
double visibleRegionFillRatio = Math.max(getWidth() / visibleRegion.width, getHeight() / visibleRegion.height);
+ /**
+ * If this {@link SubmodelComponent} fills at least this amount of the visible region vertically or horizontally, the submodel
+ * starts to be visible.
+ */
+ double maxVisibleRegionFillRatioForAlpha0 = Preferences.current().getDouble("net.mograsim.logic.model.submodel.zoomalpha0");
+ /**
+ * If this {@link SubmodelComponent} fills at least this amount of the visible region vertically or horizontally, the submodel is
+ * fully visible.
+ */
+ double minVisibleRegionFillRatioForAlpha1 = Preferences.current().getDouble("net.mograsim.logic.model.submodel.zoomalpha1");
double alphaFactor = map(visibleRegionFillRatio, maxVisibleRegionFillRatioForAlpha0, minVisibleRegionFillRatioForAlpha1, 0, 1);
alphaFactor = Math.max(0, Math.min(1, alphaFactor));
// we need to take the old alpha into account to support nested submodules better.
{
case "net.mograsim.logic.model.improvetext":
return true;
+ case "net.mograsim.logic.model.debug.openhlsshell":
+ return false;
default:
throw new IllegalArgumentException("Unknown boolean preference name: " + name);
}
return 0.5;
case "net.mograsim.logic.model.linewidth.wire.multibit":
return 0.85;
+ case "net.mograsim.logic.model.submodel.zoomalpha0":
+ return 0.8;
+ case "net.mograsim.logic.model.submodel.zoomalpha1":
+ return 0.9;
default:
throw new IllegalArgumentException("Unknown double preference name: " + name);
}