Commit 5670c288 authored by Nico Mack's avatar Nico Mack

Further refinements of CalibrationScreen

parent 3819dc0e
......@@ -15,11 +15,11 @@ or the alignment of the physical objects on the table and their rendered digital
<b>Screen</b> system and to adjust the <b>Camera</b> system subsequently.</p>
<table>
<tr>
<td><img src="${AssetsURL}/s.png" width="32"/></td>
<td><img src="${AssetsURL}/s.png" height="32" width="32"/></td>
<td><p class="help">Selects the <b>Screen</b> system as the system to be adjusted.</p></td>
</tr>
<tr>
<td><img src="${AssetsURL}/c.png" width="32"/></td>
<td><img src="${AssetsURL}/c.png" height="32" width="32"/></td>
<td><p class="help">Selects the <b>Camera</b> system as the system to be adjusted.</p></td>
</tr>
</table>
......@@ -27,11 +27,11 @@ or the alignment of the physical objects on the table and their rendered digital
<p class="help">Once the system to be adjusted has been selected, the next step consists in selecting the corner to be adjusted.</p>
<table>
<tr>
<td><img src="${AssetsURL}/t.png" width="32"/></td>
<td><img src="${AssetsURL}/t.png" height="32" width="32"/></td>
<td><p class="help">Selects the <b>Top Left</b> corner as the corner to be adjusted.</p></td>
</tr>
<tr>
<td><img src="${AssetsURL}/b.png" width="32"/></td>
<td><img src="${AssetsURL}/b.png" height="32" width="32"/></td>
<td><p class="help">Selects the <b>Bottom Right</b> corner as the corner to be adjusted.</p></td>
</tr>
</table>
......@@ -39,29 +39,29 @@ or the alignment of the physical objects on the table and their rendered digital
<table>
<tr>
<td></td>
<td><img src="${AssetsURL}/arrow-3.png" width="32"/></td>
<td><img src="${AssetsURL}/arrow-3.png" height="32" width="32"/></td>
<td></td>
<td rowspan="2"><p class="help">Use the cursor keys to move the currently selected corner.</p></td>
</tr>
<tr>
<td><img src="${AssetsURL}/arrow-1.png" width="32"/></td>
<td><img src="${AssetsURL}/arrow-2.png" width="32"/></td>
<td><img src="${AssetsURL}/arrow-4.png" width="32"/></td>
<td><img src="${AssetsURL}/arrow-1.png" height="32" width="32"/></td>
<td><img src="${AssetsURL}/arrow-2.png" height="32" width="32"/></td>
<td><img src="${AssetsURL}/arrow-4.png" height="32" width="32"/></td>
</tr>
</table>
<h2 class="help">Exit</h2>
<p class="help">You may leave the calibration screen by pressing one of the following keys:</p>
<table>
<tr>
<td><img src="${AssetsURL}/enter-2.png" width="32"/></td>
<td><img src="${AssetsURL}/enter-2.png" height="32" width="32"/></td>
<td><p class="help">Returns to the application and keeps the current adjustments without saving them.</p></td>
</tr>
<tr>
<td><img src="${AssetsURL}/esc.png" width="32"/></td>
<td><img src="${AssetsURL}/esc.png" height="32" width="32"/></td>
<td><p class="help">Returns to the application and discards the current adjustments, reverting to the original calibration found in the calibration file.</p></td>
</tr>
<tr>
<td><img src="${AssetsURL}/ctrl-2.png" width="36"/><img src="${AssetsURL}/w.png" width="32"/></td>
<td><img src="${AssetsURL}/ctrl-2.png" height="32" width="36"/><img src="${AssetsURL}/w.png" height="32" width="32"/></td>
<td><p class="help">Returns to the application and saves the current adjustments to the calibration file.</p></td>
</tr>
......
......@@ -44,6 +44,7 @@ import org.slf4j.LoggerFactory;
import java.awt.FlowLayout;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
......@@ -319,6 +320,8 @@ public class TangibleInterfaceManager extends Stage {
switch (action) {
case REVERT:
Calibration.loadFromFile(calibrationFileURI);
this.bounds = Calibration.getScreenBounds();
this.setBounds();
this.hideCalibrationScreen();
break;
case SAVE:
......@@ -512,6 +515,13 @@ public class TangibleInterfaceManager extends Stage {
update(canvas);
if (calibrationShown) {
Rectangle screenBounds = Calibration.getScreenBounds();
if (!screenBounds.equals(this.bounds)) {
this.bounds = screenBounds;
setBounds();
}
calibrationScreen.repaint();
CalibrationScreen.ExitAction action = calibrationScreen.getExitAction();
......
/*******************************************************************************
* Copyright Luxembourg Institute of Science and Technology, 2017. All rights reserved.
*
* This file is part of TULIP.
*
* TULIP is free software: you can redistribute it and/or modify it under the terms of the GNU
* Lesser General Public License as published by the Free Software Foundation, version 3 of the
* License.
*
* TULIP is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
* General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with TULIP. If
* not, see <http://www.gnu.org/licenses/lgpl-3.0.html>.
******************************************************************************/
package lu.list.itis.dkd.tui.utility;
import lu.list.itis.dkd.tui.widget.corona.ShapeFactory;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.Shape;
import java.awt.geom.AffineTransform;
// ***************************************************************************
// * Class Definition and Members *
// ***************************************************************************
public class MessageGlassPane {
private String message;
private int width;
private int height;
private int cornerRadius;
private Color fillColour;
private Color textColour;
private Font textFont;
private boolean visible;
private Shape background;
private AffineTransform translate;
// ***************************************************************************
// * Constants *
// ***************************************************************************
// ---------------------------------------------------------------------------
// ***************************************************************************
// * Constructor(s) *
// ***************************************************************************
// ---------------------------------------------------------------------------
public MessageGlassPane(int width, int height, int cornerRadius) {
this.width = width;
this.height = height;
this.cornerRadius = cornerRadius;
this.fillColour = new Color(0, 0, 0, 100);
this.textColour = Color.WHITE;
this.textFont = new Font("Arial", Font.BOLD, 16);
this.background = ShapeFactory.buildRoundedRectangle(width, height, cornerRadius);
this.translate = AffineTransform.getTranslateInstance(0, 0);
}
// ---------------------------------------------------------------------------
// ***************************************************************************
// * Class Body *
// ***************************************************************************
// ---------------------------------------------------------------------------
public int getWidth() {
return this.width;
}
// ---------------------------------------------------------------------------
public int getHeight() {
return this.height;
}
// ---------------------------------------------------------------------------
public void setPosition(int x, int y) {
translate = AffineTransform.getTranslateInstance(x, y);
}
// ---------------------------------------------------------------------------
public void setMessage(String newMessage) {
this.message = newMessage;
}
// ---------------------------------------------------------------------------
public void setVisible(boolean isVisible) {
this.visible = isVisible;
}
// ---------------------------------------------------------------------------
public boolean isVisible() {
return this.visible;
}
// ---------------------------------------------------------------------------
public void setFillColour(Color newFillColour) {
this.fillColour = newFillColour;
}
// ---------------------------------------------------------------------------
public void setTextColour(Color newTextColour) {
this.textColour = newTextColour;
}
// ---------------------------------------------------------------------------
public void setFont(Font newFont) {
this.textFont = newFont;
}
// ---------------------------------------------------------------------------
public void paint(Graphics2D canvas) {
if (!visible) {
return;
}
AffineTransform original = canvas.getTransform();
canvas.setTransform(translate);
canvas.setColor(fillColour);
canvas.fill(background);
canvas.setFont(textFont);
canvas.setColor(textColour);
canvas.drawString(message, (-this.width / 2) + cornerRadius, (this.height / 2) - textFont.getSize());
canvas.setTransform(original);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment