Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

adjust debug windows size

  • Loading branch information...
commit 0ba9873a9c44c9f9297aa238783e93336a6c2a6a 1 parent e25eb7f
Michael Vogt neophob authored
5 src/main/java/com/neophob/PixelController.java
View
@@ -37,6 +37,7 @@
import com.neophob.sematrix.output.OutputDeviceEnum;
import com.neophob.sematrix.output.RainbowduinoDevice;
import com.neophob.sematrix.output.emulatorhelper.InternalDebugWindow;
+import com.neophob.sematrix.properties.ConfigConstant;
import com.neophob.sematrix.properties.PropertiesHelper;
/**
@@ -111,8 +112,8 @@ public void setup() {
new MatrixEmulator(ph, col.getPixelControllerOutput(), this.output.getBpp());
- if (ph.getProperty("show.debug.window").equalsIgnoreCase("true")) {
- new InternalDebugWindow(true);
+ if (ph.getProperty(ConfigConstant.SHOW_DEBUG_WINDOW).equalsIgnoreCase("true")) {
+ new InternalDebugWindow(true, ph.getDebugWindowMaximalXSize());
}
//start in random mode?
1  src/main/java/com/neophob/sematrix/output/emulatorhelper/InternalBuffer.java
View
@@ -97,6 +97,7 @@ public void draw() {
Collector col = Collector.getInstance();
int currentVisual = col.getCurrentVisual();
+ //set used to find out if visual is on screen
Set<Integer> outputId = new HashSet<Integer>();
for (OutputMapping om: col.getAllOutputMappings()) {
outputId.add(om.getVisualId());
38 src/main/java/com/neophob/sematrix/output/emulatorhelper/InternalDebugWindow.java
View
@@ -46,29 +46,38 @@
* Instantiates a new internal debug window.
*
* @param displayHoriz the display horiz
+ * @param the maximal x size of the window
*/
- public InternalDebugWindow(boolean displayHoriz) {
- super("debug buffer");
+ public InternalDebugWindow(boolean displayHoriz, int maximalXSize) {
+ super("debug buffer");
int nrOfScreens = Collector.getInstance().getAllVisuals().size();
Generator g = Collector.getInstance().getPixelControllerGenerator().getGenerator(0);
- int x = g.getInternalBufferXSize()*2;
- int y = g.getInternalBufferYSize()*2;
+ float aspect = (float)g.getInternalBufferXSize()/(float)g.getInternalBufferYSize();
+ int singleVisualXSize,singleVisualYSize;
+ singleVisualXSize=maximalXSize/nrOfScreens;
+ singleVisualYSize=(int)(maximalXSize/nrOfScreens/aspect);
+
+ int windowXSize=singleVisualXSize;
+ int windowYSize=singleVisualYSize;
+
if (displayHoriz) {
- x*=nrOfScreens;
+ windowXSize*=nrOfScreens;
} else {
- y*=nrOfScreens;
+ windowYSize*=nrOfScreens;
}
- x+=10;y+=55;
-
- LOG.log(Level.INFO, "create frame with size "+x+"/"+y);
- setBounds(0, 0, x, y);
+
+ //boarder stuff
+ windowXSize+=10;
+ windowYSize+=60;
+
+ LOG.log(Level.INFO, "create frame with size "+windowXSize+"/"+windowYSize+", aspect: "+aspect);
+ setBounds(0, 0, windowXSize, windowYSize);
this.setResizable(false);
- this.setSize(x, y);
+ this.setSize(windowXSize, windowYSize);
setLayout(new BorderLayout());
- PApplet embed = new InternalBuffer(displayHoriz, x, y,
- g.getInternalBufferXSize()*2, g.getInternalBufferYSize()*2);
+ PApplet embed = new InternalBuffer(displayHoriz, windowXSize, windowYSize, singleVisualXSize, singleVisualYSize);
add(embed, BorderLayout.CENTER);
@@ -77,7 +86,6 @@ public InternalDebugWindow(boolean displayHoriz) {
// that other internal variables are properly set.
embed.init();
- setVisible(true);
-
+ setVisible(true);
}
}
3  src/main/java/com/neophob/sematrix/properties/ConfigConstant.java
View
@@ -85,4 +85,7 @@ private ConfigConstant() {
/** The Constant ADDITIONAL_VISUAL_SCREENS. */
public static final String ADDITIONAL_VISUAL_SCREENS = "additional.visual.screens";
+ public static final String SHOW_DEBUG_WINDOW = "show.debug.window";
+
+ public static final String DEBUG_WINDOW_MAX_X_SIZE = "maximal.debug.window.xsize";
}
22 src/main/java/com/neophob/sematrix/properties/PropertiesHelper.java
View
@@ -184,7 +184,7 @@ private boolean parseBoolean(String property) {
* @param property the property
* @return the int
*/
- private int parseInt(String property) {
+ private int parseInt(String property, int defaultValue) {
String rawConfig = config.getProperty(property);
if (StringUtils.isNotBlank(rawConfig)) {
try {
@@ -193,7 +193,16 @@ private int parseInt(String property) {
LOG.log(Level.WARNING, FAILED_TO_PARSE, rawConfig);
}
}
- return 0;
+ return defaultValue;
+ }
+
+ /**
+ *
+ * @param property
+ * @return
+ */
+ private int parseInt(String property) {
+ return parseInt(property, 0);
}
@@ -495,9 +504,16 @@ public int getNrOfScreens() {
* @return the int
*/
public int getNrOfAdditionalVisuals() {
- return parseInt(ConfigConstant.ADDITIONAL_VISUAL_SCREENS);
+ return parseInt(ConfigConstant.ADDITIONAL_VISUAL_SCREENS, 0);
}
+ /**
+ *
+ * @return
+ */
+ public int getDebugWindowMaximalXSize() {
+ return parseInt(ConfigConstant.DEBUG_WINDOW_MAX_X_SIZE, 1024);
+ }
/**
* Gets the layout.
Please sign in to comment.
Something went wrong with that request. Please try again.