From 593e0a0eb65ac4498e30424b230366c3b286c9e9 Mon Sep 17 00:00:00 2001 From: rlentieu Date: Sat, 21 May 2016 18:14:51 +0200 Subject: [PATCH] ajout fichiers projet --- WiimoteWhiteboard/WiimoteWhiteboard.jar | Bin 0 -> 1142393 bytes WiimoteWhiteboard/WiimoteWhiteboard.sh | 2 ++ WiimoteWhiteboard/src/apple/dts/samplecode/osxadapter/OSXAdapter.java | 152 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/apple/dts/samplecode/osxadapter/OSXAdapter.java~ | 152 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/javax/media/jai/PerspectiveTransform.java | 1095 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/javax/media/jai/PerspectiveTransform.java~ | 1439 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/WiimoteConnector.java | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/WiimoteConnector.java~ | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/WiimoteDataHandler.java | 314 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/WiimoteDataHandler.java~ | 339 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/WiimoteWhiteboard.java | 153 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/WiimoteWhiteboard.java~ | 159 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/CalibrationPersistence.java | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/CalibrationPersistence.java~ | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/PointClusterer.java | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/PointClusterer.java~ | 101 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/WiimoteCalibration.java | 511 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/WiimoteCalibration.java~ | 511 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/WiimoteCalibration.properties | 4 ++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/WiimoteCalibration_de.properties | 8 ++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/WiimoteCalibration_es.properties | 8 ++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/WiimoteCalibration_et.properties | 8 ++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/WiimoteCalibration_fr.properties | 8 ++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/WiimoteCalibration_in.properties | 8 ++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/WiimoteCalibration_it.properties | 8 ++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/WiimoteCalibration_pl.properties | 9 +++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/WiimoteCalibration_pt.properties | 8 ++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/WiimoteCalibration_ru.properties | 8 ++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/WiimoteCalibration_sl.properties | 8 ++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/icons/francisco-crosshair.png | Bin 0 -> 3627 bytes WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/icons/francisco-ok.png | Bin 0 -> 4427 bytes WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/icons/francisco-warning.png | Bin 0 -> 3748 bytes WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/icons/ok.png | Bin 0 -> 1019 bytes WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/icons/warning.png | Bin 0 -> 1220 bytes WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/ds/IRDot.java | 47 +++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/ds/IRDot.java~ | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/ds/Wiimote.java | 23 +++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/ds/Wiimote.java~ | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/AboutWindow.java | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/AboutWindow.java~ | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/CalibrationInfoWindow.java | 267 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/CalibrationInfoWindow.java~ | 267 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/CameraMonitor.java | 103 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/CameraMonitor.java~ | 128 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/HelpBook.java | 9 +++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/HelpBook.java~ | 34 ++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/HelpHandler.java | 24 ++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/HelpHandler.java~ | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/LightLabel.java | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/LightLabel.java~ | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/LogWindow.java | 134 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/LogWindow.java~ | 171 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/MainPanel.java | 332 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/MainPanel.java~ | 384 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/MenuBar.java | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/MenuBar.java~ | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/PreferencesWindow.java | 342 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/PreferencesWindow.java~ | 396 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/ScreenSelector.java | 206 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/ScreenSelector.java~ | 311 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/WarpedMonitor.java | 137 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/WarpedMonitor.java~ | 183 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/WiimoteIcon.java | 35 +++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/WiimoteIcon.java~ | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/AboutWindow.properties | 13 +++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/AboutWindow_de.properties | 4 ++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/AboutWindow_es.properties | 5 +++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/AboutWindow_et.properties | 4 ++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/AboutWindow_fr.properties | 4 ++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/AboutWindow_in.properties | 4 ++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/AboutWindow_it.properties | 4 ++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/AboutWindow_pl.properties | 4 ++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/AboutWindow_pt.properties | 4 ++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/AboutWindow_ru.properties | 4 ++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/AboutWindow_ru_bak.properties | 4 ++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/AboutWindow_sl.properties | 4 ++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CalibrationInfoWindow.properties | 24 ++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CalibrationInfoWindow_de.properties | 12 ++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CalibrationInfoWindow_es.properties | 12 ++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CalibrationInfoWindow_et.properties | 12 ++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CalibrationInfoWindow_fr.properties | 12 ++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CalibrationInfoWindow_in.properties | 12 ++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CalibrationInfoWindow_it.properties | 12 ++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CalibrationInfoWindow_pl.properties | 12 ++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CalibrationInfoWindow_pt.properties | 12 ++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CalibrationInfoWindow_ru.properties | 7 +++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CalibrationInfoWindow_sl.properties | 12 ++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CameraMonitor.properties | 2 ++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CameraMonitor_de.properties | 6 ++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CameraMonitor_es.properties | 6 ++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CameraMonitor_et.properties | 6 ++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CameraMonitor_fr.properties | 7 +++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CameraMonitor_in.properties | 6 ++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CameraMonitor_it.properties | 6 ++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CameraMonitor_pl.properties | 6 ++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CameraMonitor_pt.properties | 7 +++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CameraMonitor_ru.properties | 4 ++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CameraMonitor_sl.properties | 6 ++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/Credits.html | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/HelpHandler.properties | 3 +++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/HelpHandler_de.properties | 8 ++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/HelpHandler_es.properties | 9 +++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/HelpHandler_et.properties | 8 ++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/HelpHandler_fr.properties | 8 ++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/HelpHandler_in.properties | 8 ++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/HelpHandler_it.properties | 8 ++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/HelpHandler_pl.properties | 8 ++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/HelpHandler_pt.properties | 8 ++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/HelpHandler_ru.properties | 5 +++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/HelpHandler_sl.properties | 8 ++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/LogWindow.properties | 22 ++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/LogWindow_de.properties | 6 ++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/LogWindow_es.properties | 6 ++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/LogWindow_et.properties | 6 ++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/LogWindow_fr.properties | 6 ++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/LogWindow_in.properties | 6 ++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/LogWindow_it.properties | 6 ++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/LogWindow_pl.properties | 6 ++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/LogWindow_pt.properties | 7 +++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/LogWindow_ru.properties | 4 ++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/LogWindow_sl.properties | 6 ++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MainPanel.properties | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MainPanel_de.properties | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MainPanel_es.properties | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MainPanel_et.properties | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MainPanel_fr.properties | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MainPanel_in.properties | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MainPanel_it.properties | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MainPanel_pl.properties | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MainPanel_pt.properties | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MainPanel_ru.properties | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MainPanel_sl.properties | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MenuBar.properties | 1 + WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MenuBar_de.properties | 6 ++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MenuBar_es.properties | 6 ++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MenuBar_et.properties | 4 ++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MenuBar_fr.properties | 6 ++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MenuBar_in.properties | 4 ++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MenuBar_it.properties | 4 ++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MenuBar_pl.properties | 4 ++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MenuBar_pt.properties | 6 ++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MenuBar_ru.properties | 4 ++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MenuBar_sl.properties | 4 ++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/PreferencesWindow.properties | 101 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/PreferencesWindow_de.properties | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/PreferencesWindow_es.properties | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/PreferencesWindow_et.properties | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/PreferencesWindow_fr.properties | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/PreferencesWindow_in.properties | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/PreferencesWindow_it.properties | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/PreferencesWindow_pl.properties | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/PreferencesWindow_pt.properties | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/PreferencesWindow_ru.properties | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/PreferencesWindow_sl.properties | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/ScreenSelector.properties | 1 + WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/ScreenSelector_de.properties | 4 ++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/ScreenSelector_es.properties | 4 ++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/ScreenSelector_et.properties | 4 ++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/ScreenSelector_fr.properties | 4 ++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/ScreenSelector_in.properties | 4 ++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/ScreenSelector_it.properties | 4 ++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/ScreenSelector_pl.properties | 4 ++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/ScreenSelector_pt.properties | 4 ++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/ScreenSelector_ru.properties | 3 +++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/ScreenSelector_sl.properties | 4 ++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/WarpedMonitor.properties | 2 ++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/icons/ok.png | Bin 0 -> 612 bytes WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/icons/warning.png | Bin 0 -> 674 bytes WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/CursorControlStrategy.java | 9 +++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/CursorControlStrategy.java~ | 34 ++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/DefaultControlStrategy.java | 31 +++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/DefaultControlStrategy.java~ | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/Mouse.java | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/Mouse.java~ | 118 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/TouchpadControlStrategy.java | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/TouchpadControlStrategy.java~ | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/rightclick/AbstractRightClick.java | 47 +++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/rightclick/AbstractRightClick.java~ | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/rightclick/DefaultRightClick.java | 19 +++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/rightclick/DefaultRightClick.java~ | 44 ++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/rightclick/DragRightClick.java | 17 +++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/rightclick/DragRightClick.java~ | 42 ++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/rightclick/RightClickStrategy.java | 10 ++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/rightclick/RightClickStrategy.java~ | 35 +++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/smoothing/AdaptiveExponentialSmoothing.java | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/smoothing/AdaptiveExponentialSmoothing.java~ | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/smoothing/MouseSmoothingStrategy.java | 15 +++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/smoothing/MouseSmoothingStrategy.java~ | 39 +++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/smoothing/NoSmoothing.java | 15 +++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/smoothing/NoSmoothing.java~ | 40 ++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/smoothing/SimpleMovingAverage.java | 36 ++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/smoothing/SimpleMovingAverage.java~ | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/preferences/WWPreferences.java | 314 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/preferences/WWPreferences.java~ | 378 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/WiimoteWhiteboard.properties | 42 ++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/WiimoteWhiteboard_de.properties | 4 ++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/WiimoteWhiteboard_es.properties | 4 ++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/WiimoteWhiteboard_et.properties | 4 ++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/WiimoteWhiteboard_fr.properties | 4 ++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/WiimoteWhiteboard_in.properties | 4 ++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/WiimoteWhiteboard_it.properties | 4 ++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/WiimoteWhiteboard_pl.properties | 4 ++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/WiimoteWhiteboard_pt.properties | 4 ++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/WiimoteWhiteboard_ru.properties | 3 +++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/WiimoteWhiteboard_sl.properties | 4 ++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/icon_big.png | Bin 0 -> 11887 bytes WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/icon_small.png | Bin 0 -> 3884 bytes WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/tuio/TuioTransmitter.java | 175 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/tuio/TuioTransmitter.java~ | 209 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/BareBonesBrowserLaunch.java | 36 ++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/BareBonesBrowserLaunch.java~ | 46 ++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/UpdateNotifier.java | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/UpdateNotifier.java~ | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/Util.java | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/Util.java~ | 95 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/WiiRemoteJErrorHandler.java | 43 +++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/WiiRemoteJErrorHandler.java~ | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/resources/UpdateNotifier.properties | 2 ++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/resources/UpdateNotifier_de.properties | 6 ++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/resources/UpdateNotifier_es.properties | 6 ++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/resources/UpdateNotifier_et.properties | 6 ++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/resources/UpdateNotifier_fr.properties | 6 ++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/resources/UpdateNotifier_in.properties | 6 ++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/resources/UpdateNotifier_it.properties | 6 ++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/resources/UpdateNotifier_pl.properties | 6 ++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/resources/UpdateNotifier_pt.properties | 6 ++++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/resources/UpdateNotifier_ru.properties | 4 ++++ WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/resources/UpdateNotifier_sl.properties | 6 ++++++ 228 files changed, 14305 insertions(+), 0 deletions(-) create mode 100755 WiimoteWhiteboard/WiimoteWhiteboard.jar create mode 100755 WiimoteWhiteboard/WiimoteWhiteboard.sh create mode 100644 WiimoteWhiteboard/src/apple/dts/samplecode/osxadapter/OSXAdapter.java create mode 100644 WiimoteWhiteboard/src/apple/dts/samplecode/osxadapter/OSXAdapter.java~ create mode 100644 WiimoteWhiteboard/src/javax/media/jai/PerspectiveTransform.java create mode 100644 WiimoteWhiteboard/src/javax/media/jai/PerspectiveTransform.java~ create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/WiimoteConnector.java create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/WiimoteConnector.java~ create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/WiimoteDataHandler.java create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/WiimoteDataHandler.java~ create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/WiimoteWhiteboard.java create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/WiimoteWhiteboard.java~ create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/CalibrationPersistence.java create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/CalibrationPersistence.java~ create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/PointClusterer.java create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/PointClusterer.java~ create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/WiimoteCalibration.java create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/WiimoteCalibration.java~ create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/WiimoteCalibration.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/WiimoteCalibration_de.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/WiimoteCalibration_es.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/WiimoteCalibration_et.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/WiimoteCalibration_fr.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/WiimoteCalibration_in.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/WiimoteCalibration_it.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/WiimoteCalibration_pl.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/WiimoteCalibration_pt.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/WiimoteCalibration_ru.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/WiimoteCalibration_sl.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/icons/francisco-crosshair.png create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/icons/francisco-ok.png create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/icons/francisco-warning.png create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/icons/ok.png create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/icons/warning.png create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/ds/IRDot.java create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/ds/IRDot.java~ create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/ds/Wiimote.java create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/ds/Wiimote.java~ create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/AboutWindow.java create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/AboutWindow.java~ create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/CalibrationInfoWindow.java create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/CalibrationInfoWindow.java~ create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/CameraMonitor.java create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/CameraMonitor.java~ create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/HelpBook.java create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/HelpBook.java~ create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/HelpHandler.java create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/HelpHandler.java~ create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/LightLabel.java create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/LightLabel.java~ create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/LogWindow.java create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/LogWindow.java~ create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/MainPanel.java create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/MainPanel.java~ create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/MenuBar.java create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/MenuBar.java~ create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/PreferencesWindow.java create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/PreferencesWindow.java~ create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/ScreenSelector.java create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/ScreenSelector.java~ create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/WarpedMonitor.java create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/WarpedMonitor.java~ create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/WiimoteIcon.java create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/WiimoteIcon.java~ create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/AboutWindow.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/AboutWindow_de.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/AboutWindow_es.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/AboutWindow_et.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/AboutWindow_fr.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/AboutWindow_in.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/AboutWindow_it.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/AboutWindow_pl.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/AboutWindow_pt.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/AboutWindow_ru.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/AboutWindow_ru_bak.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/AboutWindow_sl.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CalibrationInfoWindow.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CalibrationInfoWindow_de.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CalibrationInfoWindow_es.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CalibrationInfoWindow_et.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CalibrationInfoWindow_fr.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CalibrationInfoWindow_in.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CalibrationInfoWindow_it.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CalibrationInfoWindow_pl.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CalibrationInfoWindow_pt.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CalibrationInfoWindow_ru.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CalibrationInfoWindow_sl.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CameraMonitor.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CameraMonitor_de.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CameraMonitor_es.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CameraMonitor_et.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CameraMonitor_fr.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CameraMonitor_in.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CameraMonitor_it.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CameraMonitor_pl.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CameraMonitor_pt.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CameraMonitor_ru.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CameraMonitor_sl.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/Credits.html create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/HelpHandler.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/HelpHandler_de.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/HelpHandler_es.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/HelpHandler_et.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/HelpHandler_fr.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/HelpHandler_in.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/HelpHandler_it.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/HelpHandler_pl.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/HelpHandler_pt.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/HelpHandler_ru.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/HelpHandler_sl.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/LogWindow.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/LogWindow_de.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/LogWindow_es.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/LogWindow_et.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/LogWindow_fr.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/LogWindow_in.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/LogWindow_it.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/LogWindow_pl.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/LogWindow_pt.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/LogWindow_ru.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/LogWindow_sl.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MainPanel.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MainPanel_de.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MainPanel_es.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MainPanel_et.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MainPanel_fr.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MainPanel_in.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MainPanel_it.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MainPanel_pl.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MainPanel_pt.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MainPanel_ru.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MainPanel_sl.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MenuBar.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MenuBar_de.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MenuBar_es.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MenuBar_et.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MenuBar_fr.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MenuBar_in.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MenuBar_it.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MenuBar_pl.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MenuBar_pt.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MenuBar_ru.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MenuBar_sl.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/PreferencesWindow.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/PreferencesWindow_de.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/PreferencesWindow_es.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/PreferencesWindow_et.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/PreferencesWindow_fr.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/PreferencesWindow_in.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/PreferencesWindow_it.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/PreferencesWindow_pl.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/PreferencesWindow_pt.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/PreferencesWindow_ru.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/PreferencesWindow_sl.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/ScreenSelector.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/ScreenSelector_de.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/ScreenSelector_es.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/ScreenSelector_et.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/ScreenSelector_fr.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/ScreenSelector_in.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/ScreenSelector_it.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/ScreenSelector_pl.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/ScreenSelector_pt.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/ScreenSelector_ru.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/ScreenSelector_sl.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/WarpedMonitor.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/icons/ok.png create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/icons/warning.png create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/CursorControlStrategy.java create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/CursorControlStrategy.java~ create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/DefaultControlStrategy.java create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/DefaultControlStrategy.java~ create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/Mouse.java create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/Mouse.java~ create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/TouchpadControlStrategy.java create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/TouchpadControlStrategy.java~ create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/rightclick/AbstractRightClick.java create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/rightclick/AbstractRightClick.java~ create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/rightclick/DefaultRightClick.java create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/rightclick/DefaultRightClick.java~ create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/rightclick/DragRightClick.java create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/rightclick/DragRightClick.java~ create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/rightclick/RightClickStrategy.java create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/rightclick/RightClickStrategy.java~ create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/smoothing/AdaptiveExponentialSmoothing.java create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/smoothing/AdaptiveExponentialSmoothing.java~ create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/smoothing/MouseSmoothingStrategy.java create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/smoothing/MouseSmoothingStrategy.java~ create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/smoothing/NoSmoothing.java create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/smoothing/NoSmoothing.java~ create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/smoothing/SimpleMovingAverage.java create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/smoothing/SimpleMovingAverage.java~ create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/preferences/WWPreferences.java create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/preferences/WWPreferences.java~ create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/WiimoteWhiteboard.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/WiimoteWhiteboard_de.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/WiimoteWhiteboard_es.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/WiimoteWhiteboard_et.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/WiimoteWhiteboard_fr.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/WiimoteWhiteboard_in.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/WiimoteWhiteboard_it.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/WiimoteWhiteboard_pl.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/WiimoteWhiteboard_pt.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/WiimoteWhiteboard_ru.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/WiimoteWhiteboard_sl.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/icon_big.png create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/icon_small.png create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/tuio/TuioTransmitter.java create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/tuio/TuioTransmitter.java~ create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/BareBonesBrowserLaunch.java create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/BareBonesBrowserLaunch.java~ create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/UpdateNotifier.java create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/UpdateNotifier.java~ create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/Util.java create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/Util.java~ create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/WiiRemoteJErrorHandler.java create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/WiiRemoteJErrorHandler.java~ create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/resources/UpdateNotifier.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/resources/UpdateNotifier_de.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/resources/UpdateNotifier_es.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/resources/UpdateNotifier_et.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/resources/UpdateNotifier_fr.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/resources/UpdateNotifier_in.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/resources/UpdateNotifier_it.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/resources/UpdateNotifier_pl.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/resources/UpdateNotifier_pt.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/resources/UpdateNotifier_ru.properties create mode 100644 WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/resources/UpdateNotifier_sl.properties diff --git a/WiimoteWhiteboard/WiimoteWhiteboard.jar b/WiimoteWhiteboard/WiimoteWhiteboard.jar new file mode 100755 index 0000000..a2ee9e7 Binary files /dev/null and b/WiimoteWhiteboard/WiimoteWhiteboard.jar differ diff --git a/WiimoteWhiteboard/WiimoteWhiteboard.sh b/WiimoteWhiteboard/WiimoteWhiteboard.sh new file mode 100755 index 0000000..f08f7a8 --- /dev/null +++ b/WiimoteWhiteboard/WiimoteWhiteboard.sh @@ -0,0 +1,2 @@ +#!/bin/sh +java -jar WiimoteWhiteboard.jar \ No newline at end of file diff --git a/WiimoteWhiteboard/src/apple/dts/samplecode/osxadapter/OSXAdapter.java b/WiimoteWhiteboard/src/apple/dts/samplecode/osxadapter/OSXAdapter.java new file mode 100644 index 0000000..c5e84e6 --- /dev/null +++ b/WiimoteWhiteboard/src/apple/dts/samplecode/osxadapter/OSXAdapter.java @@ -0,0 +1,152 @@ +package apple.dts.samplecode.osxadapter; + +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.lang.reflect.Proxy; + + +public class OSXAdapter implements InvocationHandler { + + protected Object targetObject; + protected Method targetMethod; + protected String proxySignature; + + static Object macOSXApplication; + + // Pass this method an Object and Method equipped to perform application shutdown logic + // The method passed should return a boolean stating whether or not the quit should occur + public static void setQuitHandler(Object target, Method quitHandler) { + setHandler(new OSXAdapter("handleQuit", target, quitHandler)); + } + + // Pass this method an Object and Method equipped to display application info + // They will be called when the About menu item is selected from the application menu + public static void setAboutHandler(Object target, Method aboutHandler) { + boolean enableAboutMenu = (target != null && aboutHandler != null); + if (enableAboutMenu) { + setHandler(new OSXAdapter("handleAbout", target, aboutHandler)); + } + // If we're setting a handler, enable the About menu item by calling + // com.apple.eawt.Application reflectively + try { + Method enableAboutMethod = macOSXApplication.getClass().getDeclaredMethod("setEnabledAboutMenu", new Class[] { boolean.class }); + enableAboutMethod.invoke(macOSXApplication, new Object[] { Boolean.valueOf(enableAboutMenu) }); + } catch (Exception ex) { + System.err.println("OSXAdapter could not access the About Menu"); + ex.printStackTrace(); + } + } + + // Pass this method an Object and a Method equipped to display application options + // They will be called when the Preferences menu item is selected from the application menu + public static void setPreferencesHandler(Object target, Method prefsHandler) { + boolean enablePrefsMenu = (target != null && prefsHandler != null); + if (enablePrefsMenu) { + setHandler(new OSXAdapter("handlePreferences", target, prefsHandler)); + } + // If we're setting a handler, enable the Preferences menu item by calling + // com.apple.eawt.Application reflectively + try { + Method enablePrefsMethod = macOSXApplication.getClass().getDeclaredMethod("setEnabledPreferencesMenu", new Class[] { boolean.class }); + enablePrefsMethod.invoke(macOSXApplication, new Object[] { Boolean.valueOf(enablePrefsMenu) }); + } catch (Exception ex) { + System.err.println("OSXAdapter could not access the About Menu"); + ex.printStackTrace(); + } + } + + // Pass this method an Object and a Method equipped to handle document events from the Finder + // Documents are registered with the Finder via the CFBundleDocumentTypes dictionary in the + // application bundle's Info.plist + public static void setFileHandler(Object target, Method fileHandler) { + setHandler(new OSXAdapter("handleOpenFile", target, fileHandler) { + // Override OSXAdapter.callTarget to send information on the + // file to be opened + @Override + public boolean callTarget(Object appleEvent) { + if (appleEvent != null) { + try { + Method getFilenameMethod = appleEvent.getClass().getDeclaredMethod("getFilename", (Class[])null); + String filename = (String) getFilenameMethod.invoke(appleEvent, (Object[])null); + this.targetMethod.invoke(this.targetObject, new Object[] { filename }); + } catch (Exception ex) { + + } + } + return true; + } + }); + } + + // setHandler creates a Proxy object from the passed OSXAdapter and adds it as an ApplicationListener + public static void setHandler(OSXAdapter adapter) { + try { + Class applicationClass = Class.forName("com.apple.eawt.Application"); + if (macOSXApplication == null) { + macOSXApplication = applicationClass.getConstructor((Class[])null).newInstance((Object[])null); + } + Class applicationListenerClass = Class.forName("com.apple.eawt.ApplicationListener"); + Method addListenerMethod = applicationClass.getDeclaredMethod("addApplicationListener", new Class[] { applicationListenerClass }); + // Create a proxy object around this handler that can be reflectively added as an Apple ApplicationListener + Object osxAdapterProxy = Proxy.newProxyInstance(OSXAdapter.class.getClassLoader(), new Class[] { applicationListenerClass }, adapter); + addListenerMethod.invoke(macOSXApplication, new Object[] { osxAdapterProxy }); + } catch (ClassNotFoundException cnfe) { + System.err.println("This version of Mac OS X does not support the Apple EAWT. ApplicationEvent handling has been disabled (" + cnfe + ")"); + } catch (Exception ex) { // Likely a NoSuchMethodException or an IllegalAccessException loading/invoking eawt.Application methods + System.err.println("Mac OS X Adapter could not talk to EAWT:"); + ex.printStackTrace(); + } + } + + // Each OSXAdapter has the name of the EAWT method it intends to listen for (handleAbout, for example), + // the Object that will ultimately perform the task, and the Method to be called on that Object + protected OSXAdapter(String proxySignature, Object target, Method handler) { + this.proxySignature = proxySignature; + this.targetObject = target; + this.targetMethod = handler; + } + + // Override this method to perform any operations on the event + // that comes with the various callbacks + // See setFileHandler above for an example + public boolean callTarget(Object appleEvent) throws InvocationTargetException, IllegalAccessException { + Object result = targetMethod.invoke(targetObject, (Object[])null); + if (result == null) { + return true; + } + return Boolean.valueOf(result.toString()).booleanValue(); + } + + // InvocationHandler implementation + // This is the entry point for our proxy object; it is called every time an ApplicationListener method is invoked + public Object invoke (Object proxy, Method method, Object[] args) throws Throwable { + if (isCorrectMethod(method, args)) { + boolean handled = callTarget(args[0]); + setApplicationEventHandled(args[0], handled); + } + // All of the ApplicationListener methods are void; return null regardless of what happens + return null; + } + + // Compare the method that was called to the intended method when the OSXAdapter instance was created + // (e.g. handleAbout, handleQuit, handleOpenFile, etc.) + protected boolean isCorrectMethod(Method method, Object[] args) { + return (targetMethod != null && proxySignature.equals(method.getName()) && args.length == 1); + } + + // It is important to mark the ApplicationEvent as handled and cancel the default behavior + // This method checks for a boolean result from the proxy method and sets the event accordingly + protected void setApplicationEventHandled(Object event, boolean handled) { + if (event != null) { + try { + Method setHandledMethod = event.getClass().getDeclaredMethod("setHandled", new Class[] { boolean.class }); + // If the target method returns a boolean, use that as a hint + setHandledMethod.invoke(event, new Object[] { Boolean.valueOf(handled) }); + } catch (Exception ex) { + System.err.println("OSXAdapter was unable to handle an ApplicationEvent: " + event); + ex.printStackTrace(); + } + } + } +} diff --git a/WiimoteWhiteboard/src/apple/dts/samplecode/osxadapter/OSXAdapter.java~ b/WiimoteWhiteboard/src/apple/dts/samplecode/osxadapter/OSXAdapter.java~ new file mode 100644 index 0000000..c5e84e6 --- /dev/null +++ b/WiimoteWhiteboard/src/apple/dts/samplecode/osxadapter/OSXAdapter.java~ @@ -0,0 +1,152 @@ +package apple.dts.samplecode.osxadapter; + +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.lang.reflect.Proxy; + + +public class OSXAdapter implements InvocationHandler { + + protected Object targetObject; + protected Method targetMethod; + protected String proxySignature; + + static Object macOSXApplication; + + // Pass this method an Object and Method equipped to perform application shutdown logic + // The method passed should return a boolean stating whether or not the quit should occur + public static void setQuitHandler(Object target, Method quitHandler) { + setHandler(new OSXAdapter("handleQuit", target, quitHandler)); + } + + // Pass this method an Object and Method equipped to display application info + // They will be called when the About menu item is selected from the application menu + public static void setAboutHandler(Object target, Method aboutHandler) { + boolean enableAboutMenu = (target != null && aboutHandler != null); + if (enableAboutMenu) { + setHandler(new OSXAdapter("handleAbout", target, aboutHandler)); + } + // If we're setting a handler, enable the About menu item by calling + // com.apple.eawt.Application reflectively + try { + Method enableAboutMethod = macOSXApplication.getClass().getDeclaredMethod("setEnabledAboutMenu", new Class[] { boolean.class }); + enableAboutMethod.invoke(macOSXApplication, new Object[] { Boolean.valueOf(enableAboutMenu) }); + } catch (Exception ex) { + System.err.println("OSXAdapter could not access the About Menu"); + ex.printStackTrace(); + } + } + + // Pass this method an Object and a Method equipped to display application options + // They will be called when the Preferences menu item is selected from the application menu + public static void setPreferencesHandler(Object target, Method prefsHandler) { + boolean enablePrefsMenu = (target != null && prefsHandler != null); + if (enablePrefsMenu) { + setHandler(new OSXAdapter("handlePreferences", target, prefsHandler)); + } + // If we're setting a handler, enable the Preferences menu item by calling + // com.apple.eawt.Application reflectively + try { + Method enablePrefsMethod = macOSXApplication.getClass().getDeclaredMethod("setEnabledPreferencesMenu", new Class[] { boolean.class }); + enablePrefsMethod.invoke(macOSXApplication, new Object[] { Boolean.valueOf(enablePrefsMenu) }); + } catch (Exception ex) { + System.err.println("OSXAdapter could not access the About Menu"); + ex.printStackTrace(); + } + } + + // Pass this method an Object and a Method equipped to handle document events from the Finder + // Documents are registered with the Finder via the CFBundleDocumentTypes dictionary in the + // application bundle's Info.plist + public static void setFileHandler(Object target, Method fileHandler) { + setHandler(new OSXAdapter("handleOpenFile", target, fileHandler) { + // Override OSXAdapter.callTarget to send information on the + // file to be opened + @Override + public boolean callTarget(Object appleEvent) { + if (appleEvent != null) { + try { + Method getFilenameMethod = appleEvent.getClass().getDeclaredMethod("getFilename", (Class[])null); + String filename = (String) getFilenameMethod.invoke(appleEvent, (Object[])null); + this.targetMethod.invoke(this.targetObject, new Object[] { filename }); + } catch (Exception ex) { + + } + } + return true; + } + }); + } + + // setHandler creates a Proxy object from the passed OSXAdapter and adds it as an ApplicationListener + public static void setHandler(OSXAdapter adapter) { + try { + Class applicationClass = Class.forName("com.apple.eawt.Application"); + if (macOSXApplication == null) { + macOSXApplication = applicationClass.getConstructor((Class[])null).newInstance((Object[])null); + } + Class applicationListenerClass = Class.forName("com.apple.eawt.ApplicationListener"); + Method addListenerMethod = applicationClass.getDeclaredMethod("addApplicationListener", new Class[] { applicationListenerClass }); + // Create a proxy object around this handler that can be reflectively added as an Apple ApplicationListener + Object osxAdapterProxy = Proxy.newProxyInstance(OSXAdapter.class.getClassLoader(), new Class[] { applicationListenerClass }, adapter); + addListenerMethod.invoke(macOSXApplication, new Object[] { osxAdapterProxy }); + } catch (ClassNotFoundException cnfe) { + System.err.println("This version of Mac OS X does not support the Apple EAWT. ApplicationEvent handling has been disabled (" + cnfe + ")"); + } catch (Exception ex) { // Likely a NoSuchMethodException or an IllegalAccessException loading/invoking eawt.Application methods + System.err.println("Mac OS X Adapter could not talk to EAWT:"); + ex.printStackTrace(); + } + } + + // Each OSXAdapter has the name of the EAWT method it intends to listen for (handleAbout, for example), + // the Object that will ultimately perform the task, and the Method to be called on that Object + protected OSXAdapter(String proxySignature, Object target, Method handler) { + this.proxySignature = proxySignature; + this.targetObject = target; + this.targetMethod = handler; + } + + // Override this method to perform any operations on the event + // that comes with the various callbacks + // See setFileHandler above for an example + public boolean callTarget(Object appleEvent) throws InvocationTargetException, IllegalAccessException { + Object result = targetMethod.invoke(targetObject, (Object[])null); + if (result == null) { + return true; + } + return Boolean.valueOf(result.toString()).booleanValue(); + } + + // InvocationHandler implementation + // This is the entry point for our proxy object; it is called every time an ApplicationListener method is invoked + public Object invoke (Object proxy, Method method, Object[] args) throws Throwable { + if (isCorrectMethod(method, args)) { + boolean handled = callTarget(args[0]); + setApplicationEventHandled(args[0], handled); + } + // All of the ApplicationListener methods are void; return null regardless of what happens + return null; + } + + // Compare the method that was called to the intended method when the OSXAdapter instance was created + // (e.g. handleAbout, handleQuit, handleOpenFile, etc.) + protected boolean isCorrectMethod(Method method, Object[] args) { + return (targetMethod != null && proxySignature.equals(method.getName()) && args.length == 1); + } + + // It is important to mark the ApplicationEvent as handled and cancel the default behavior + // This method checks for a boolean result from the proxy method and sets the event accordingly + protected void setApplicationEventHandled(Object event, boolean handled) { + if (event != null) { + try { + Method setHandledMethod = event.getClass().getDeclaredMethod("setHandled", new Class[] { boolean.class }); + // If the target method returns a boolean, use that as a hint + setHandledMethod.invoke(event, new Object[] { Boolean.valueOf(handled) }); + } catch (Exception ex) { + System.err.println("OSXAdapter was unable to handle an ApplicationEvent: " + event); + ex.printStackTrace(); + } + } + } +} diff --git a/WiimoteWhiteboard/src/javax/media/jai/PerspectiveTransform.java b/WiimoteWhiteboard/src/javax/media/jai/PerspectiveTransform.java new file mode 100644 index 0000000..2f87f81 --- /dev/null +++ b/WiimoteWhiteboard/src/javax/media/jai/PerspectiveTransform.java @@ -0,0 +1,1095 @@ +package javax.media.jai; +import java.awt.geom.AffineTransform; +import java.awt.geom.Point2D; +import java.awt.geom.NoninvertibleTransformException; +import java.io.Serializable; + +public final class PerspectiveTransform implements Cloneable, Serializable { + + private static final double PERSPECTIVE_DIVIDE_EPSILON = 1.0e-10; + + double m00, m01, m02, m10, m11, m12, m20, m21, m22; + + /** Constructs an identity PerspectiveTransform. */ + public PerspectiveTransform() { + m00 = m11 = m22 = 1.0; + m01 = m02 = m10 = m12 = m20 = m21 = 0.0; + } + + /** + * Constructs a new PerspectiveTransform from 9 floats. + */ + public PerspectiveTransform(float m00, float m01, float m02, + float m10, float m11, float m12, + float m20, float m21, float m22) { + this.m00 = m00; + this.m01 = m01; + this.m02 = m02; + this.m10 = m10; + this.m11 = m11; + this.m12 = m12; + this.m20 = m20; + this.m21 = m21; + this.m22 = m22; + } + + /** + * Constructs a new PerspectiveTransform from 9 doubles. + */ + public PerspectiveTransform(double m00, double m01, double m02, + double m10, double m11, double m12, + double m20, double m21, double m22) { + this.m00 = m00; + this.m01 = m01; + this.m02 = m02; + this.m10 = m10; + this.m11 = m11; + this.m12 = m12; + this.m20 = m20; + this.m21 = m21; + this.m22 = m22; + } + + public PerspectiveTransform(float[] flatmatrix) { + if ( flatmatrix == null ) { + throw new IllegalArgumentException(JaiI18N.getString("Generic0")); + } + + m00 = flatmatrix[0]; + m01 = flatmatrix[1]; + m02 = flatmatrix[2]; + m10 = flatmatrix[3]; + m11 = flatmatrix[4]; + m12 = flatmatrix[5]; + m20 = flatmatrix[6]; + m21 = flatmatrix[7]; + m22 = flatmatrix[8]; + } + + public PerspectiveTransform(float[][] matrix) { + if ( matrix == null ) { + throw new IllegalArgumentException(JaiI18N.getString("Generic0")); + } + + m00 = matrix[0][0]; + m01 = matrix[0][1]; + m02 = matrix[0][2]; + m10 = matrix[1][0]; + m11 = matrix[1][1]; + m12 = matrix[1][2]; + m20 = matrix[2][0]; + m21 = matrix[2][1]; + m22 = matrix[2][2]; + } + + public PerspectiveTransform(double[] flatmatrix) { + if ( flatmatrix == null ) { + throw new IllegalArgumentException(JaiI18N.getString("Generic0")); + } + + m00 = flatmatrix[0]; + m01 = flatmatrix[1]; + m02 = flatmatrix[2]; + m10 = flatmatrix[3]; + m11 = flatmatrix[4]; + m12 = flatmatrix[5]; + m20 = flatmatrix[6]; + m21 = flatmatrix[7]; + m22 = flatmatrix[8]; + } + + /** + * Constructs a new PerspectiveTransform from a two-dimensional + * array of doubles. + */ + public PerspectiveTransform(double[][] matrix) { + if ( matrix == null ) { + throw new IllegalArgumentException(JaiI18N.getString("Generic0")); + } + + m00 = matrix[0][0]; + m01 = matrix[0][1]; + m02 = matrix[0][2]; + m10 = matrix[1][0]; + m11 = matrix[1][1]; + m12 = matrix[1][2]; + m20 = matrix[2][0]; + m21 = matrix[2][1]; + m22 = matrix[2][2]; + } + + /** + * Constructs a new PerspectiveTransform with the same effect + * as an existing AffineTransform. + * @throws IllegalArgumentException if transform is null + */ + public PerspectiveTransform(AffineTransform transform) { + if ( transform == null ) { + throw new IllegalArgumentException(JaiI18N.getString("Generic0")); + } + + m00 = transform.getScaleX(); + m01 = transform.getShearX(); + m02 = transform.getTranslateX(); + m10 = transform.getShearY(); + m11 = transform.getScaleY(); + m12 = transform.getTranslateY(); + m20 = 0.0; + m21 = 0.0; + m22 = 1.0; + } + + /** + * Replaces the matrix with its adjoint. + */ + private final void makeAdjoint() { + double m00p = m11*m22 - m12*m21; + double m01p = m12*m20 - m10*m22; + double m02p = m10*m21 - m11*m20; + double m10p = m02*m21 - m01*m22; + double m11p = m00*m22 - m02*m20; + double m12p = m01*m20 - m00*m21; + double m20p = m01*m12 - m02*m11; + double m21p = m02*m10 - m00*m12; + double m22p = m00*m11 - m01*m10; + + m00 = m00p; + m01 = m10p; + m02 = m20p; + m10 = m01p; + m11 = m11p; + m12 = m21p; + m20 = m02p; + m21 = m12p; + m22 = m22p; + } + + private final void normalize() { + double invscale = 1.0/m22; + m00 *= invscale; + m01 *= invscale; + m02 *= invscale; + m10 *= invscale; + m11 *= invscale; + m12 *= invscale; + m20 *= invscale; + m21 *= invscale; + m22 = 1.0; + } + + private static final void getSquareToQuad(double x0, double y0, + double x1, double y1, + double x2, double y2, + double x3, double y3, + PerspectiveTransform tx) { + double dx3 = x0 - x1 + x2 - x3; + double dy3 = y0 - y1 + y2 - y3; + + tx.m22 = 1.0F; + + if ((dx3 == 0.0F) && (dy3 == 0.0F)) { + tx.m00 = x1 - x0; + tx.m01 = x2 - x1; + tx.m02 = x0; + tx.m10 = y1 - y0; + tx.m11 = y2 - y1; + tx.m12 = y0; + tx.m20 = 0.0F; + tx.m21 = 0.0F; + } else { + double dx1 = x1 - x2; + double dy1 = y1 - y2; + double dx2 = x3 - x2; + double dy2 = y3 - y2; + + double invdet = 1.0F/(dx1*dy2 - dx2*dy1); + tx.m20 = (dx3*dy2 - dx2*dy3)*invdet; + tx.m21 = (dx1*dy3 - dx3*dy1)*invdet; + tx.m00 = x1 - x0 + tx.m20*x1; + tx.m01 = x3 - x0 + tx.m21*x3; + tx.m02 = x0; + tx.m10 = y1 - y0 + tx.m20*y1; + tx.m11 = y3 - y0 + tx.m21*y3; + tx.m12 = y0; + } + } + + public static PerspectiveTransform getSquareToQuad(double x0, double y0, + double x1, double y1, + double x2, double y2, + double x3, double y3) { + PerspectiveTransform tx = new PerspectiveTransform(); + getSquareToQuad(x0, y0, x1, y1, x2, y2, x3, y3, tx); + return tx; + } + + + public static PerspectiveTransform getSquareToQuad(float x0, float y0, + float x1, float y1, + float x2, float y2, + float x3, float y3) { + return getSquareToQuad((double)x0, (double)y0, + (double)x1, (double)y1, + (double)x2, (double)y2, + (double)x3, (double)y3); + } + + + /** + * Creates a PerspectiveTransform that maps an arbitrary + * quadrilateral onto the unit square. + */ + public static PerspectiveTransform getQuadToSquare(double x0, double y0, + double x1, double y1, + double x2, double y2, + double x3, double y3) { + PerspectiveTransform tx = new PerspectiveTransform(); + getSquareToQuad(x0, y0, x1, y1, x2, y2, x3, y3, tx); + tx.makeAdjoint(); + return tx; + } + + /** + * Creates a PerspectiveTransform that maps an arbitrary + * quadrilateral onto the unit square. + */ + public static PerspectiveTransform getQuadToSquare(float x0, float y0, + float x1, float y1, + float x2, float y2, + float x3, float y3) { + return getQuadToSquare((double)x0, (double)y0, + (double)x1, (double)y1, + (double)x2, (double)y2, + (double)x3, (double)y3); + } + + /** + * Creates a PerspectiveTransform that maps an arbitrary + * quadrilateral onto another arbitrary quadrilateral. + */ + public static PerspectiveTransform getQuadToQuad(double x0, double y0, + double x1, double y1, + double x2, double y2, + double x3, double y3, + double x0p, double y0p, + double x1p, double y1p, + double x2p, double y2p, + double x3p, double y3p) { + PerspectiveTransform tx1 = + getQuadToSquare(x0, y0, x1, y1, x2, y2, x3, y3); + + PerspectiveTransform tx2 = + getSquareToQuad(x0p, y0p, x1p, y1p, x2p, y2p, x3p, y3p); + + tx1.concatenate(tx2); + return tx1; + } + + + /** + * Creates a PerspectiveTransform that maps an arbitrary + * quadrilateral onto another arbitrary quadrilateral. + */ + public static PerspectiveTransform getQuadToQuad(float x0, float y0, + float x1, float y1, + float x2, float y2, + float x3, float y3, + float x0p, float y0p, + float x1p, float y1p, + float x2p, float y2p, + float x3p, float y3p) { + return getQuadToQuad((double)x0, (double)y0, + (double)x1, (double)y1, + (double)x2, (double)y2, + (double)x3, (double)y3, + (double)x0p, (double)y0p, + (double)x1p, (double)y1p, + (double)x2p, (double)y2p, + (double)x3p, (double)y3p); + } + + /** + * Returns the determinant of the matrix representation of the + * transform. + */ + public double getDeterminant() { + return ( (m00 * ((m11 * m22) - (m12 * m21))) - + (m01 * ((m10 * m22) - (m12 * m20))) + + (m02 * ((m10 * m21) - (m11 * m20))) ); + + } + + /** + * Retrieves the 9 specifiable values in the 3x3 affine + * transformation matrix into an array of double precision values. + * The values are stored into the array as + * { m00 m01 m02 m10 m11 m12 m20 m21 m22 }. + */ + public double[] getMatrix(double[] flatmatrix) { + if (flatmatrix == null) { + flatmatrix = new double[9]; + } + + flatmatrix[0] = m00; + flatmatrix[1] = m01; + flatmatrix[2] = m02; + flatmatrix[3] = m10; + flatmatrix[4] = m11; + flatmatrix[5] = m12; + flatmatrix[6] = m20; + flatmatrix[7] = m21; + flatmatrix[8] = m22; + + return flatmatrix; + } + + /** + * Retrieves the 9 specifiable values in the 3x3 affine + * transformation matrix into a 2-dimensional array of double + * precision values. The values are stored into the 2-dimensional + * array using the row index as the first subscript and the column + * index as the second. + * + */ + public double[][] getMatrix(double[][] matrix) { + if (matrix == null) { + matrix = new double[3][3]; + } + + matrix[0][0] = m00; + matrix[0][1] = m01; + matrix[0][2] = m02; + matrix[1][0] = m10; + matrix[1][1] = m11; + matrix[1][2] = m12; + matrix[2][0] = m20; + matrix[2][1] = m21; + matrix[2][2] = m22; + + return matrix; + } + + /** + * Concatenates this transform with a translation transformation. + */ + public void translate(double tx, double ty) { + PerspectiveTransform Tx = new PerspectiveTransform(); + Tx.setToTranslation(tx, ty); + concatenate(Tx); + } + + /** + * Concatenates this transform with a rotation transformation. + */ + public void rotate(double theta) { + PerspectiveTransform Tx = new PerspectiveTransform(); + Tx.setToRotation(theta); + concatenate(Tx); + } + + /** + * Concatenates this transform with a translated rotation transformation. + */ + public void rotate(double theta, double x, double y) { + PerspectiveTransform Tx = new PerspectiveTransform(); + Tx.setToRotation(theta, x, y); + concatenate(Tx); + } + + /** + * Concatenates this transform with a scaling transformation. + */ + public void scale(double sx, double sy) { + PerspectiveTransform Tx = new PerspectiveTransform(); + Tx.setToScale(sx, sy); + concatenate(Tx); + } + + /** + * Concatenates this transform with a shearing transformation. + */ + public void shear(double shx, double shy) { + PerspectiveTransform Tx = new PerspectiveTransform(); + Tx.setToShear(shx, shy); + concatenate(Tx); + } + + /** + * Resets this transform to the Identity transform. + */ + public void setToIdentity() { + m00 = m11 = m22 = 1.0; + m01 = m10 = m02 = m20 = m12 = m21 = 0.0; + } + + /** + * Sets this transform to a translation transformation. + */ + public void setToTranslation(double tx, double ty) { + m00 = 1.0; + m01 = 0.0; + m02 = tx; + m10 = 0.0; + m11 = 1.0; + m12 = ty; + m20 = 0.0; + m21 = 0.0; + m22 = 1.0; + } + + /** + * Sets this transform to a rotation transformation. + */ + public void setToRotation(double theta) { + m00 = Math.cos(theta); + m01 = -Math.sin(theta); + m02 = 0.0; + m10 = - m01; + m11 = m00; + m12 = 0.0; + m20 = 0.0; + m21 = 0.0; + m22 = 1.0; + } + + public void setToRotation(double theta, double x, double y) { + setToRotation(theta); + double sin = m10; + double oneMinusCos = 1.0 - m00; + m02 = x * oneMinusCos + y * sin; + m12 = y * oneMinusCos - x * sin; + } + + public void setToScale(double sx, double sy) { + m00 = sx; + m01 = 0.0; + m02 = 0.0; + m10 = 0.0; + m11 = sy; + m12 = 0.0; + m20 = 0.0; + m21 = 0.0; + m22 = 1.0; + } + + /** + * Sets this transform to a shearing transformation + * with shear factors sx and sy. + */ + public void setToShear(double shx, double shy) { + m00 = 1.0; + m01 = shx; + m02 = 0.0; + m10 = shy; + m11 = 1.0; + m12 = 0.0; + m20 = 0.0; + m21 = 0.0; + m22 = 1.0; + } + + /** + * Sets this transform to a given AffineTransform. + * @throws IllegalArgumentException if Tx is null + */ + public void setTransform(AffineTransform Tx) { + if ( Tx == null ) { + throw new IllegalArgumentException(JaiI18N.getString("Generic0")); + } + + m00 = Tx.getScaleX(); + m01 = Tx.getShearX(); + m02 = Tx.getTranslateX(); + m10 = Tx.getShearY(); + m11 = Tx.getScaleY(); + m12 = Tx.getTranslateY(); + m20 = 0.0; + m21 = 0.0; + m22 = 1.0; + } + + /** + * Sets this transform to a given PerspectiveTransform. + * @throws IllegalArgumentException if Tx is null + */ + public void setTransform(PerspectiveTransform Tx) { + if ( Tx == null ) { + throw new IllegalArgumentException(JaiI18N.getString("Generic0")); + } + + m00 = Tx.m00; + m01 = Tx.m01; + m02 = Tx.m02; + m10 = Tx.m10; + m11 = Tx.m11; + m12 = Tx.m12; + m20 = Tx.m20; + m21 = Tx.m21; + m22 = Tx.m22; + } + + public void setTransform(float m00, float m10, float m20, + float m01, float m11, float m21, + float m02, float m12, float m22) { + this.m00 = (double)m00; + this.m01 = (double)m01; + this.m02 = (double)m02; + this.m10 = (double)m10; + this.m11 = (double)m11; + this.m12 = (double)m12; + this.m20 = (double)m20; + this.m21 = (double)m21; + this.m22 = (double)m22; + } + + public void setTransform(double[][] matrix) { + if ( matrix == null ) { + throw new IllegalArgumentException(JaiI18N.getString("Generic0")); + } + + m00 = matrix[0][0]; + m01 = matrix[0][1]; + m02 = matrix[0][2]; + m10 = matrix[1][0]; + m11 = matrix[1][1]; + m12 = matrix[1][2]; + m20 = matrix[2][0]; + m21 = matrix[2][1]; + m22 = matrix[2][2]; + } + + /** + * Post-concatenates a given AffineTransform to this transform. + * @throws IllegalArgumentException if Tx is null + */ + public void concatenate(AffineTransform Tx) { + if ( Tx == null ) { + throw new IllegalArgumentException(JaiI18N.getString("Generic0")); + } + + double tx_m00 = Tx.getScaleX(); + double tx_m01 = Tx.getShearX(); + double tx_m02 = Tx.getTranslateX(); + double tx_m10 = Tx.getShearY(); + double tx_m11 = Tx.getScaleY(); + double tx_m12 = Tx.getTranslateY(); + + double m00p = m00*tx_m00 + m10*tx_m01 + m20*tx_m02; + double m01p = m01*tx_m00 + m11*tx_m01 + m21*tx_m02; + double m02p = m02*tx_m00 + m12*tx_m01 + m22*tx_m02; + double m10p = m00*tx_m10 + m10*tx_m11 + m20*tx_m12; + double m11p = m01*tx_m10 + m11*tx_m11 + m21*tx_m12; + double m12p = m02*tx_m10 + m12*tx_m11 + m22*tx_m12; + double m20p = m20; + double m21p = m21; + double m22p = m22; + + m00 = m00p; + m10 = m10p; + m20 = m20p; + m01 = m01p; + m11 = m11p; + m21 = m21p; + m02 = m02p; + m12 = m12p; + m22 = m22p; + } + + /** + * Post-concatenates a given PerspectiveTransform to this transform. + * @throws IllegalArgumentException if Tx is null + */ + public void concatenate(PerspectiveTransform Tx) { + if ( Tx == null ) { + throw new IllegalArgumentException(JaiI18N.getString("Generic0")); + } + + double m00p = m00*Tx.m00 + m10*Tx.m01 + m20*Tx.m02; + double m10p = m00*Tx.m10 + m10*Tx.m11 + m20*Tx.m12; + double m20p = m00*Tx.m20 + m10*Tx.m21 + m20*Tx.m22; + double m01p = m01*Tx.m00 + m11*Tx.m01 + m21*Tx.m02; + double m11p = m01*Tx.m10 + m11*Tx.m11 + m21*Tx.m12; + double m21p = m01*Tx.m20 + m11*Tx.m21 + m21*Tx.m22; + double m02p = m02*Tx.m00 + m12*Tx.m01 + m22*Tx.m02; + double m12p = m02*Tx.m10 + m12*Tx.m11 + m22*Tx.m12; + double m22p = m02*Tx.m20 + m12*Tx.m21 + m22*Tx.m22; + + m00 = m00p; + m10 = m10p; + m20 = m20p; + m01 = m01p; + m11 = m11p; + m21 = m21p; + m02 = m02p; + m12 = m12p; + m22 = m22p; + } + + /** + * Pre-concatenates a given AffineTransform to this transform. + * @throws IllegalArgumentException if Tx is null + */ + public void preConcatenate(AffineTransform Tx) { + if ( Tx == null ) { + throw new IllegalArgumentException(JaiI18N.getString("Generic0")); + } + + // Extend Tx: Tx.m20 = 0, Tx.m21 = 0, Tx.m22 = 1 + + double tx_m00 = Tx.getScaleX(); + double tx_m01 = Tx.getShearX(); + double tx_m02 = Tx.getTranslateX(); + double tx_m10 = Tx.getShearY(); + double tx_m11 = Tx.getScaleY(); + double tx_m12 = Tx.getTranslateY(); + + double m00p = tx_m00*m00 + tx_m10*m01; + double m01p = tx_m01*m00 + tx_m11*m01; + double m02p = tx_m02*m00 + tx_m12*m01 + m02; + double m10p = tx_m00*m10 + tx_m10*m11; + double m11p = tx_m01*m10 + tx_m11*m11; + double m12p = tx_m02*m10 + tx_m12*m11 + m12; + double m20p = tx_m00*m20 + tx_m10*m21; + double m21p = tx_m01*m20 + tx_m11*m21; + double m22p = tx_m02*m20 + tx_m12*m21 + m22; + + m00 = m00p; + m10 = m10p; + m20 = m20p; + m01 = m01p; + m11 = m11p; + m21 = m21p; + m02 = m02p; + m12 = m12p; + m22 = m22p; + } + + /** + * Pre-concatenates a given PerspectiveTransform to this transform. + * @throws IllegalArgumentException if Tx is null + */ + public void preConcatenate(PerspectiveTransform Tx) { + if ( Tx == null ) { + throw new IllegalArgumentException(JaiI18N.getString("Generic0")); + } + + double m00p = Tx.m00*m00 + Tx.m10*m01 + Tx.m20*m02; + double m10p = Tx.m00*m10 + Tx.m10*m11 + Tx.m20*m12; + double m20p = Tx.m00*m20 + Tx.m10*m21 + Tx.m20*m22; + double m01p = Tx.m01*m00 + Tx.m11*m01 + Tx.m21*m02; + double m11p = Tx.m01*m10 + Tx.m11*m11 + Tx.m21*m12; + double m21p = Tx.m01*m20 + Tx.m11*m21 + Tx.m21*m22; + double m02p = Tx.m02*m00 + Tx.m12*m01 + Tx.m22*m02; + double m12p = Tx.m02*m10 + Tx.m12*m11 + Tx.m22*m12; + double m22p = Tx.m02*m20 + Tx.m12*m21 + Tx.m22*m22; + + m00 = m00p; + m10 = m10p; + m20 = m20p; + m01 = m01p; + m11 = m11p; + m21 = m21p; + m02 = m02p; + m12 = m12p; + m22 = m22p; + } + + /** + * Returns a new PerpectiveTransform that is the inverse + * of the current transform. + * @throws NoninvertibleTransformException if transform cannot be inverted + */ + public PerspectiveTransform createInverse() + throws NoninvertibleTransformException, CloneNotSupportedException { + + PerspectiveTransform tx = (PerspectiveTransform)clone(); + tx.makeAdjoint(); + if (Math.abs(tx.m22) < PERSPECTIVE_DIVIDE_EPSILON) { + throw new NoninvertibleTransformException(JaiI18N.getString("PerspectiveTransform0")); + } + tx.normalize(); + return tx; + } + + /** + * Returns a new PerpectiveTransform that is the adjoint, + * of the current transform. The adjoint is defined as + * the matrix of cofactors, which in turn are the determinants + * of the submatrices defined by removing the row and column + * of each element from the original matrix in turn. + */ + public PerspectiveTransform createAdjoint() + throws CloneNotSupportedException{ + + PerspectiveTransform tx = (PerspectiveTransform)clone(); + tx.makeAdjoint(); + return tx; + } + + /** + * Transforms the specified ptSrc and stores the result in ptDst. + * If ptDst is null, a new Point2D object will be allocated before + * storing. In either case, ptDst containing the transformed point + * is returned for convenience. + * Note that ptSrc and ptDst can the same. In this case, the input + * point will be overwritten with the transformed point. + * @throws IllegalArgumentException if ptSrc is null + */ + public Point2D transform(Point2D ptSrc, Point2D ptDst) { + if ( ptSrc == null ) { + throw new IllegalArgumentException(JaiI18N.getString("Generic0")); + } + + if (ptDst == null) { + if (ptSrc instanceof Point2D.Double) { + ptDst = new Point2D.Double(); + } else { + ptDst = new Point2D.Float(); + } + } + + double x = ptSrc.getX(); + double y = ptSrc.getY(); + double w = m20 * x + m21 * y + m22; + ptDst.setLocation((m00 * x + m01 * y + m02) / w, + (m10 * x + m11 * y + m12) / w); + + return ptDst; + } + + /** + * Transforms an array of point objects by this transform. + * @throws IllegalArgumentException if ptSrc is null + * @throws IllegalArgumentException if ptDst is null + * @throws ArrayIndexOutOfBoundsException if ptSrc is too small + */ + public void transform(Point2D[] ptSrc, int srcOff, + Point2D[] ptDst, int dstOff, + int numPts) { + + if ( ptSrc == null || ptDst == null ) { + throw new IllegalArgumentException(JaiI18N.getString("Generic0")); + } + + while (numPts-- > 0) { + Point2D src = ptSrc[srcOff++]; + Point2D dst = ptDst[dstOff++]; + if (dst == null) { + if (src instanceof Point2D.Double) { + dst = new Point2D.Double(); + } else { + dst = new Point2D.Float(); + } + ptDst[dstOff - 1] = dst; + } + + double x = src.getX(); + double y = src.getY(); + double w = m20 * x + m21 * y + m22; + + if (w == 0) { + dst.setLocation(x, y); + } else { + dst.setLocation((m00 * x + m01 * y + m02) / w, + (m10 * x + m11 * y + m12) / w); + } + } + } + + /** + * Transforms an array of floating point coordinates by this transform. + * @throws IllegalArgumentException if srcPts is null + * @throws ArrayIndexOutOfBoundsException if srcPts is too small + */ + public void transform(float[] srcPts, int srcOff, + float[] dstPts, int dstOff, + int numPts) { + + if ( srcPts == null ) { + throw new IllegalArgumentException(JaiI18N.getString("Generic0")); + } + + if (dstPts == null) { + dstPts = new float[numPts * 2 + dstOff]; + } + + while (numPts-- > 0) { + float x = srcPts[srcOff++]; + float y = srcPts[srcOff++]; + double w = m20 * x + m21 * y + m22; + + if (w == 0) { + dstPts[dstOff++] = x; + dstPts[dstOff++] = y; + } else { + dstPts[dstOff++] = (float)((m00 * x + m01 * y + m02) / w); + dstPts[dstOff++] = (float)((m10 * x + m11 * y + m12) / w); + } + } + } + + /** + * Transforms an array of double precision coordinates by this transform. + * @throws IllegalArgumentException if srcPts is null + * @throws ArrayIndexOutOfBoundsException if srcPts is too small + */ + public void transform(double[] srcPts, int srcOff, + double[] dstPts, int dstOff, + int numPts) { + + if ( srcPts == null ) { + throw new IllegalArgumentException(JaiI18N.getString("Generic0")); + } + + if (dstPts == null) { + dstPts = new double[numPts * 2 + dstOff]; + } + + while (numPts-- > 0) { + double x = srcPts[srcOff++]; + double y = srcPts[srcOff++]; + double w = m20 * x + m21 * y + m22; + + if (w == 0) { + dstPts[dstOff++] = x; + dstPts[dstOff++] = y; + } else { + dstPts[dstOff++] = (m00 * x + m01 * y + m02) / w; + dstPts[dstOff++] = (m10 * x + m11 * y + m12) / w; + } + } + } + + /** + * Transforms an array of floating point coordinates by this transform, + * storing the results into an array of doubles. + * @throws IllegalArgumentException if srcPts is null + * @throws ArrayIndexOutOfBoundsException if srcPts is too small + */ + public void transform(float[] srcPts, int srcOff, + double[] dstPts, int dstOff, + int numPts) { + + if ( srcPts == null ) { + throw new IllegalArgumentException(JaiI18N.getString("Generic0")); + } + + if (dstPts == null) { + dstPts = new double[numPts * 2 + dstOff]; + } + + while (numPts-- > 0) { + float x = srcPts[srcOff++]; + float y = srcPts[srcOff++]; + double w = m20 * x + m21 * y + m22; + + if (w == 0) { + dstPts[dstOff++] = x; + dstPts[dstOff++] = y; + } else { + dstPts[dstOff++] = (m00 * x + m01 * y + m02) / w; + dstPts[dstOff++] = (m10 * x + m11 * y + m12) / w; + } + } + } + + /** + * Transforms an array of double precision coordinates by this transform, + * storing the results into an array of floats. + * @throws IllegalArgumentException if srcPts is null + * @throws ArrayIndexOutOfBoundsException if srcPts is too small + */ + public void transform(double[] srcPts, int srcOff, + float[] dstPts, int dstOff, + int numPts) { + + if ( srcPts == null ) { + throw new IllegalArgumentException(JaiI18N.getString("Generic0")); + } + + if (dstPts == null) { + dstPts = new float[numPts * 2 + dstOff]; + } + + while (numPts-- > 0) { + double x = srcPts[srcOff++]; + double y = srcPts[srcOff++]; + double w = m20 * x + m21 * y + m22; + + if (w == 0) { + dstPts[dstOff++] = (float)x; + dstPts[dstOff++] = (float)y; + } else { + dstPts[dstOff++] = (float)((m00 * x + m01 * y + m02) / w); + dstPts[dstOff++] = (float)((m10 * x + m11 * y + m12) / w); + } + } + } + + /** + * Inverse transforms the specified ptSrc and stores the result in ptDst. + * If ptDst is null, a new Point2D object will be allocated before + * storing. In either case, ptDst containing the transformed point + * is returned for convenience. + + * @throws NoninvertibleTransformException if the matrix cannot be inverted. + * @throws IllegalArgumentException if ptSrc is null + */ + public Point2D inverseTransform(Point2D ptSrc, Point2D ptDst) + throws NoninvertibleTransformException + { + if ( ptSrc == null ) { + throw new IllegalArgumentException(JaiI18N.getString("Generic0")); + } + + if (ptDst == null) { + if (ptSrc instanceof Point2D.Double) { + ptDst = new Point2D.Double(); + } else { + ptDst = new Point2D.Float(); + } + } + // Copy source coords into local variables in case src == dst + double x = ptSrc.getX(); + double y = ptSrc.getY(); + + double tmp_x = (m11*m22 - m12*m21) * x + + (m02*m21 - m01*m22) * y + + (m01*m12 - m02*m11); + double tmp_y = (m12*m20 - m10*m22) * x + + (m00*m22 - m02*m20) * y + + (m02*m10 - m00*m12); + double w = (m10*m21 - m11*m20) * x + + (m01*m20 - m00*m21) * y + + (m00*m11 - m01*m10); + + double wabs = w; + if (w < 0) { + wabs = - w; + } + if (wabs < PERSPECTIVE_DIVIDE_EPSILON) { + throw new + NoninvertibleTransformException( + JaiI18N.getString("PerspectiveTransform1")); + } + + ptDst.setLocation(tmp_x/w, tmp_y/w); + + return ptDst; + } + + /** + * Inverse transforms an array of double precision coordinates by + * this transform. + * @throws NoninvertibleTransformException if the matrix cannot be inverted. + * @throws IllegalArgumentException if srcPts is null + * @throws ArrayIndexOutOfBoundsException if srcPts is too small + * @throws NoninvertibleTransformException transform cannot be inverted + */ + public void inverseTransform(double[] srcPts, int srcOff, + double[] dstPts, int dstOff, + int numPts) + throws NoninvertibleTransformException + { + if ( srcPts == null ) { + throw new IllegalArgumentException(JaiI18N.getString("Generic0")); + } + + if (dstPts == null) { + dstPts = new double[numPts * 2 + dstOff]; + } + + while (numPts-- > 0) { + double x = srcPts[srcOff++]; + double y = srcPts[srcOff++]; + + double tmp_x = (m11*m22 - m12*m21) * x + + (m02*m21 - m01*m22) * y + + (m01*m12 - m02*m11); + double tmp_y = (m12*m20 - m10*m22) * x + + (m00*m22 - m02*m20) * y + + (m02*m10 - m00*m12); + double w = (m10*m21 - m11*m20) * x + + (m01*m20 - m00*m21) * y + + (m00*m11 - m01*m10); + + double wabs = w; + if (w < 0) { + wabs = - w; + } + if (wabs < PERSPECTIVE_DIVIDE_EPSILON) { + throw new NoninvertibleTransformException( + JaiI18N.getString("PerspectiveTransform1")); + } + + dstPts[dstOff++] = tmp_x / w; + dstPts[dstOff++] = tmp_y / w; + } + } + + /** + * Returns a String that represents the value of this Object. + */ + public String toString() { + StringBuffer sb = new StringBuffer(); + sb.append("Perspective transform matrix\n"); + sb.append(this.m00); + sb.append("\t"); + sb.append(this.m01); + sb.append("\t"); + sb.append(this.m02); + sb.append("\n"); + sb.append(this.m10); + sb.append("\t"); + sb.append(this.m11); + sb.append("\t"); + sb.append(this.m12); + sb.append("\n"); + sb.append(this.m20); + sb.append("\t"); + sb.append(this.m21); + sb.append("\t"); + sb.append(this.m22); + sb.append("\n"); + return new String(sb); + } + + /** + * Returns the boolean true value if this PerspectiveTransform is an + * identity transform. Returns false otherwise. + */ + public boolean isIdentity() { + return m01 == 0.0 && m02 == 0.0 && + m10 == 0.0 && m12 == 0.0 && + m20 == 0.0 && m21 == 0.0 && + m22 != 0.0 && m00/m22 == 1.0 && m11/m22 == 1.0; + } + + /** + * Returns a copy of this PerspectiveTransform object. + */ + public Object clone() { + try { + return super.clone(); + } catch (CloneNotSupportedException e) { + // this shouldn't happen, since we are Cloneable + throw new InternalError(); + } + } + + + /** + * Tests if this PerspectiveTransform equals a supplied one. + */ + public boolean equals(Object obj) { + if (!(obj instanceof PerspectiveTransform)) { + return false; + } + + PerspectiveTransform a = (PerspectiveTransform)obj; + + return ((m00 == a.m00) && (m10 == a.m10) && (m20 == a.m20) && + (m01 == a.m01) && (m11 == a.m11) && (m21 == a.m21) && + (m02 == a.m02) && (m12 == a.m12) && (m22 == a.m22)); + } +} diff --git a/WiimoteWhiteboard/src/javax/media/jai/PerspectiveTransform.java~ b/WiimoteWhiteboard/src/javax/media/jai/PerspectiveTransform.java~ new file mode 100644 index 0000000..f5736ca --- /dev/null +++ b/WiimoteWhiteboard/src/javax/media/jai/PerspectiveTransform.java~ @@ -0,0 +1,1439 @@ +/* + * $RCSfile: PerspectiveTransform.java,v $ + * + * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved. + * + * Use is subject to license terms. + * + * $Revision: 1.1 $ + * $Date: 2005/02/11 04:57:15 $ + * $State: Exp $ + */ +package javax.media.jai; +import java.awt.geom.AffineTransform; +import java.awt.geom.Point2D; +import java.awt.geom.NoninvertibleTransformException; +import java.io.Serializable; + + +/** + * A 2D perspective (or projective) transform, used by various OpImages. + * + *

A perspective transformation is capable of mapping an arbitrary + * quadrilateral into another arbitrary quadrilateral, while + * preserving the straightness of lines. Unlike an affine + * transformation, the parallelism of lines in the source is not + * necessarily preserved in the output. + * + *

Such a coordinate transformation can be represented by a 3x3 + * matrix which transforms homogenous source coordinates + * (x, y, 1) into destination coordinates + * (x', y', w). To convert back into non-homogenous + * coordinates (X, Y), x' and y' are divided by + * w. + * + *

+ *	[ x']   [  m00  m01  m02  ] [ x ]   [ m00x + m01y + m02 ]
+ *	[ y'] = [  m10  m11  m12  ] [ y ] = [ m10x + m11y + m12 ]
+ *	[ w ]   [  m20  m21  m22  ] [ 1 ]   [ m20x + m21y + m22 ]
+ *
+ *	  x' = (m00x + m01y + m02)
+ *	  y' = (m10x + m11y + m12)
+ *
+ *        w  = (m20x + m21y + m22)
+ *
+ *        X = x' / w
+ *        Y = y' / w
+ * 
+ */ +public final class PerspectiveTransform implements Cloneable, Serializable { + + private static final double PERSPECTIVE_DIVIDE_EPSILON = 1.0e-10; + + /** An element of the transform matrix. */ + double m00, m01, m02, m10, m11, m12, m20, m21, m22; + + /** Constructs an identity PerspectiveTransform. */ + public PerspectiveTransform() { + m00 = m11 = m22 = 1.0; + m01 = m02 = m10 = m12 = m20 = m21 = 0.0; + } + + /** + * Constructs a new PerspectiveTransform from 9 floats. + * @deprecated as of JAI 1.1 Use PerspectiveTransform(double[][]) instead. + */ + public PerspectiveTransform(float m00, float m01, float m02, + float m10, float m11, float m12, + float m20, float m21, float m22) { + this.m00 = m00; + this.m01 = m01; + this.m02 = m02; + this.m10 = m10; + this.m11 = m11; + this.m12 = m12; + this.m20 = m20; + this.m21 = m21; + this.m22 = m22; + } + + /** + * Constructs a new PerspectiveTransform from 9 doubles. + * @deprecated as of JAI 1.1 Use PerspectiveTransform(double[][]) instead. + */ + public PerspectiveTransform(double m00, double m01, double m02, + double m10, double m11, double m12, + double m20, double m21, double m22) { + this.m00 = m00; + this.m01 = m01; + this.m02 = m02; + this.m10 = m10; + this.m11 = m11; + this.m12 = m12; + this.m20 = m20; + this.m21 = m21; + this.m22 = m22; + } + + /** + * Constructs a new PerspectiveTransform from a one-dimensional + * array of 9 floats, in row-major order. + * The values in the array are assumed to be + * { m00 m01 m02 m10 m11 m12 m20 m21 m22 }. + * @throws IllegalArgumentException if flatmatrix is null + * @throws ArrayIndexOutOfBoundsException if flatmatrix is too small + * @deprecated as of JAI 1.1 Use PerspectiveTransform(double[][]) instead. + */ + public PerspectiveTransform(float[] flatmatrix) { + if ( flatmatrix == null ) { + throw new IllegalArgumentException(JaiI18N.getString("Generic0")); + } + + m00 = flatmatrix[0]; + m01 = flatmatrix[1]; + m02 = flatmatrix[2]; + m10 = flatmatrix[3]; + m11 = flatmatrix[4]; + m12 = flatmatrix[5]; + m20 = flatmatrix[6]; + m21 = flatmatrix[7]; + m22 = flatmatrix[8]; + } + + /** + * Constructs a new PerspectiveTransform from a two-dimensional + * array of floats. + * @throws IllegalArgumentException if matrix is null + * @throws ArrayIndexOutOfBoundsException if matrix is too small + * + * @deprecated as of JAI 1.1 Use PerspectiveTransform(double[][]) instead. + */ + public PerspectiveTransform(float[][] matrix) { + if ( matrix == null ) { + throw new IllegalArgumentException(JaiI18N.getString("Generic0")); + } + + m00 = matrix[0][0]; + m01 = matrix[0][1]; + m02 = matrix[0][2]; + m10 = matrix[1][0]; + m11 = matrix[1][1]; + m12 = matrix[1][2]; + m20 = matrix[2][0]; + m21 = matrix[2][1]; + m22 = matrix[2][2]; + } + + /** + * Constructs a new PerspectiveTransform from a one-dimensional + * array of 9 doubles, in row-major order. + * The values in the array are assumed to be + * { m00 m01 m02 m10 m11 m12 m20 m21 m22 }. + * @throws IllegalArgumentException if flatmatrix is null + * @throws ArrayIndexOutOfBoundsException if flatmatrix is too small + * + * @deprecated as of JAI 1.1 Use PerspectiveTransform(double[][]) instead. + */ + public PerspectiveTransform(double[] flatmatrix) { + if ( flatmatrix == null ) { + throw new IllegalArgumentException(JaiI18N.getString("Generic0")); + } + + m00 = flatmatrix[0]; + m01 = flatmatrix[1]; + m02 = flatmatrix[2]; + m10 = flatmatrix[3]; + m11 = flatmatrix[4]; + m12 = flatmatrix[5]; + m20 = flatmatrix[6]; + m21 = flatmatrix[7]; + m22 = flatmatrix[8]; + } + + /** + * Constructs a new PerspectiveTransform from a two-dimensional + * array of doubles. + * @throws IllegalArgumentException if matrix is null + * @throws ArrayIndexOutOfBoundsException if matrix is too small + */ + public PerspectiveTransform(double[][] matrix) { + if ( matrix == null ) { + throw new IllegalArgumentException(JaiI18N.getString("Generic0")); + } + + m00 = matrix[0][0]; + m01 = matrix[0][1]; + m02 = matrix[0][2]; + m10 = matrix[1][0]; + m11 = matrix[1][1]; + m12 = matrix[1][2]; + m20 = matrix[2][0]; + m21 = matrix[2][1]; + m22 = matrix[2][2]; + } + + /** + * Constructs a new PerspectiveTransform with the same effect + * as an existing AffineTransform. + * @throws IllegalArgumentException if transform is null + */ + public PerspectiveTransform(AffineTransform transform) { + if ( transform == null ) { + throw new IllegalArgumentException(JaiI18N.getString("Generic0")); + } + + m00 = transform.getScaleX(); + m01 = transform.getShearX(); + m02 = transform.getTranslateX(); + m10 = transform.getShearY(); + m11 = transform.getScaleY(); + m12 = transform.getTranslateY(); + m20 = 0.0; + m21 = 0.0; + m22 = 1.0; + } + + /** + * Replaces the matrix with its adjoint. + */ + private final void makeAdjoint() { + double m00p = m11*m22 - m12*m21; + double m01p = m12*m20 - m10*m22; // flipped sign + double m02p = m10*m21 - m11*m20; + double m10p = m02*m21 - m01*m22; // flipped sign + double m11p = m00*m22 - m02*m20; + double m12p = m01*m20 - m00*m21; // flipped sign + double m20p = m01*m12 - m02*m11; + double m21p = m02*m10 - m00*m12; // flipped sign + double m22p = m00*m11 - m01*m10; + + // Transpose and copy sub-determinants + m00 = m00p; + m01 = m10p; + m02 = m20p; + m10 = m01p; + m11 = m11p; + m12 = m21p; + m20 = m02p; + m21 = m12p; + m22 = m22p; + } + + /** + * Scales the matrix elements so m22 is equal to 1.0. + * m22 must not be equal to 0. + */ + private final void normalize() { + double invscale = 1.0/m22; + m00 *= invscale; + m01 *= invscale; + m02 *= invscale; + m10 *= invscale; + m11 *= invscale; + m12 *= invscale; + m20 *= invscale; + m21 *= invscale; + m22 = 1.0; + } + + private static final void getSquareToQuad(double x0, double y0, + double x1, double y1, + double x2, double y2, + double x3, double y3, + PerspectiveTransform tx) { + double dx3 = x0 - x1 + x2 - x3; + double dy3 = y0 - y1 + y2 - y3; + + tx.m22 = 1.0F; + + if ((dx3 == 0.0F) && (dy3 == 0.0F)) { // to do: use tolerance + tx.m00 = x1 - x0; + tx.m01 = x2 - x1; + tx.m02 = x0; + tx.m10 = y1 - y0; + tx.m11 = y2 - y1; + tx.m12 = y0; + tx.m20 = 0.0F; + tx.m21 = 0.0F; + } else { + double dx1 = x1 - x2; + double dy1 = y1 - y2; + double dx2 = x3 - x2; + double dy2 = y3 - y2; + + double invdet = 1.0F/(dx1*dy2 - dx2*dy1); + tx.m20 = (dx3*dy2 - dx2*dy3)*invdet; + tx.m21 = (dx1*dy3 - dx3*dy1)*invdet; + tx.m00 = x1 - x0 + tx.m20*x1; + tx.m01 = x3 - x0 + tx.m21*x3; + tx.m02 = x0; + tx.m10 = y1 - y0 + tx.m20*y1; + tx.m11 = y3 - y0 + tx.m21*y3; + tx.m12 = y0; + } + } + + /** + * Creates a PerspectiveTransform that maps the unit square + * onto an arbitrary quadrilateral. + * + *
+     * (0, 0) -> (x0, y0)
+     * (1, 0) -> (x1, y1)
+     * (1, 1) -> (x2, y2)
+     * (0, 1) -> (x3, y3)
+     * 
+ */ + public static PerspectiveTransform getSquareToQuad(double x0, double y0, + double x1, double y1, + double x2, double y2, + double x3, double y3) { + PerspectiveTransform tx = new PerspectiveTransform(); + getSquareToQuad(x0, y0, x1, y1, x2, y2, x3, y3, tx); + return tx; + } + + + /** + * Creates a PerspectiveTransform that maps the unit square + * onto an arbitrary quadrilateral. + * + *
+     * (0, 0) -> (x0, y0)
+     * (1, 0) -> (x1, y1)
+     * (1, 1) -> (x2, y2)
+     * (0, 1) -> (x3, y3)
+     * 
+ */ + public static PerspectiveTransform getSquareToQuad(float x0, float y0, + float x1, float y1, + float x2, float y2, + float x3, float y3) { + return getSquareToQuad((double)x0, (double)y0, + (double)x1, (double)y1, + (double)x2, (double)y2, + (double)x3, (double)y3); + } + + + /** + * Creates a PerspectiveTransform that maps an arbitrary + * quadrilateral onto the unit square. + * + *
+     * (x0, y0) -> (0, 0)
+     * (x1, y1) -> (1, 0)
+     * (x2, y2) -> (1, 1)
+     * (x3, y3) -> (0, 1)
+     * 
+ */ + public static PerspectiveTransform getQuadToSquare(double x0, double y0, + double x1, double y1, + double x2, double y2, + double x3, double y3) { + PerspectiveTransform tx = new PerspectiveTransform(); + getSquareToQuad(x0, y0, x1, y1, x2, y2, x3, y3, tx); + tx.makeAdjoint(); + return tx; + } + + /** + * Creates a PerspectiveTransform that maps an arbitrary + * quadrilateral onto the unit square. + * + *
+     * (x0, y0) -> (0, 0)
+     * (x1, y1) -> (1, 0)
+     * (x2, y2) -> (1, 1)
+     * (x3, y3) -> (0, 1)
+     * 
+ */ + public static PerspectiveTransform getQuadToSquare(float x0, float y0, + float x1, float y1, + float x2, float y2, + float x3, float y3) { + return getQuadToSquare((double)x0, (double)y0, + (double)x1, (double)y1, + (double)x2, (double)y2, + (double)x3, (double)y3); + } + + /** + * Creates a PerspectiveTransform that maps an arbitrary + * quadrilateral onto another arbitrary quadrilateral. + * + *
+     * (x0, y0) -> (x0p, y0p)
+     * (x1, y1) -> (x1p, y1p)
+     * (x2, y2) -> (x2p, y2p)
+     * (x3, y3) -> (x3p, y3p)
+     * 
+ */ + public static PerspectiveTransform getQuadToQuad(double x0, double y0, + double x1, double y1, + double x2, double y2, + double x3, double y3, + double x0p, double y0p, + double x1p, double y1p, + double x2p, double y2p, + double x3p, double y3p) { + PerspectiveTransform tx1 = + getQuadToSquare(x0, y0, x1, y1, x2, y2, x3, y3); + + PerspectiveTransform tx2 = + getSquareToQuad(x0p, y0p, x1p, y1p, x2p, y2p, x3p, y3p); + + tx1.concatenate(tx2); + return tx1; + } + + + /** + * Creates a PerspectiveTransform that maps an arbitrary + * quadrilateral onto another arbitrary quadrilateral. + * + *
+     * (x0, y0) -> (x0p, y0p)
+     * (x1, y1) -> (x1p, y1p)
+     * (x2, y2) -> (x2p, y2p)
+     * (x3, y3) -> (x3p, y3p)
+     * 
+ */ + public static PerspectiveTransform getQuadToQuad(float x0, float y0, + float x1, float y1, + float x2, float y2, + float x3, float y3, + float x0p, float y0p, + float x1p, float y1p, + float x2p, float y2p, + float x3p, float y3p) { + return getQuadToQuad((double)x0, (double)y0, + (double)x1, (double)y1, + (double)x2, (double)y2, + (double)x3, (double)y3, + (double)x0p, (double)y0p, + (double)x1p, (double)y1p, + (double)x2p, (double)y2p, + (double)x3p, (double)y3p); + } + + /** + * Returns the determinant of the matrix representation of the + * transform. + */ + public double getDeterminant() { + return ( (m00 * ((m11 * m22) - (m12 * m21))) - + (m01 * ((m10 * m22) - (m12 * m20))) + + (m02 * ((m10 * m21) - (m11 * m20))) ); + + } + + /** + * Retrieves the 9 specifiable values in the 3x3 affine + * transformation matrix into an array of double precision values. + * The values are stored into the array as + * { m00 m01 m02 m10 m11 m12 m20 m21 m22 }. + * + * @param flatmatrix The double array used to store the returned + * values. The length of the array is assumed to be at + * least 9. + * @throws ArrayIndexOutOfBoundsException if flatmatrix is too small + * @deprecated as of JAI 1.1 Use double[][] getMatrix(double[][] matrix) instead. + */ + public double[] getMatrix(double[] flatmatrix) { + if (flatmatrix == null) { + flatmatrix = new double[9]; + } + + flatmatrix[0] = m00; + flatmatrix[1] = m01; + flatmatrix[2] = m02; + flatmatrix[3] = m10; + flatmatrix[4] = m11; + flatmatrix[5] = m12; + flatmatrix[6] = m20; + flatmatrix[7] = m21; + flatmatrix[8] = m22; + + return flatmatrix; + } + + /** + * Retrieves the 9 specifiable values in the 3x3 affine + * transformation matrix into a 2-dimensional array of double + * precision values. The values are stored into the 2-dimensional + * array using the row index as the first subscript and the column + * index as the second. + * + * @param matrix The 2-dimensional double array to store the + * returned values. The array is assumed to be at least 3x3. + * @throws ArrayIndexOutOfBoundsException if matrix is too small + */ + public double[][] getMatrix(double[][] matrix) { + if (matrix == null) { + matrix = new double[3][3]; + } + + matrix[0][0] = m00; + matrix[0][1] = m01; + matrix[0][2] = m02; + matrix[1][0] = m10; + matrix[1][1] = m11; + matrix[1][2] = m12; + matrix[2][0] = m20; + matrix[2][1] = m21; + matrix[2][2] = m22; + + return matrix; + } + + /** + * Concatenates this transform with a translation transformation. + * This is equivalent to calling concatenate(T), where T is an + * PerspectiveTransform represented by the following matrix: + *
+     *		[   1    0    tx  ]
+     *		[   0    1    ty  ]
+     *		[   0    0    1   ]
+     * 
+ */ + public void translate(double tx, double ty) { + PerspectiveTransform Tx = new PerspectiveTransform(); + Tx.setToTranslation(tx, ty); + concatenate(Tx); + } + + /** + * Concatenates this transform with a rotation transformation. + * This is equivalent to calling concatenate(R), where R is an + * PerspectiveTransform represented by the following matrix: + *
+     *		[   cos(theta)    -sin(theta)    0   ]
+     *		[   sin(theta)     cos(theta)    0   ]
+     *		[       0              0         1   ]
+     * 
+ * Rotating with a positive angle theta rotates points on the positive + * X axis toward the positive Y axis. + * + * @param theta The angle of rotation in radians. + */ + public void rotate(double theta) { + PerspectiveTransform Tx = new PerspectiveTransform(); + Tx.setToRotation(theta); + concatenate(Tx); + } + + /** + * Concatenates this transform with a translated rotation transformation. + * This is equivalent to the following sequence of calls: + *
+     *		translate(x, y);
+     *		rotate(theta);
+     *		translate(-x, -y);
+     * 
+ * Rotating with a positive angle theta rotates points on the positive + * X axis toward the positive Y axis. + * + * @param theta The angle of rotation in radians. + * @param x The X coordinate of the origin of the rotation + * @param y The Y coordinate of the origin of the rotation + */ + public void rotate(double theta, double x, double y) { + PerspectiveTransform Tx = new PerspectiveTransform(); + Tx.setToRotation(theta, x, y); + concatenate(Tx); + } + + /** + * Concatenates this transform with a scaling transformation. + * This is equivalent to calling concatenate(S), where S is an + * PerspectiveTransform represented by the following matrix: + *
+     *		[   sx   0    0   ]
+     *		[   0    sy   0   ]
+     *		[   0    0    1   ]
+     * 
+ * + * @param sx The X axis scale factor. + * @param sy The Y axis scale factor. + */ + public void scale(double sx, double sy) { + PerspectiveTransform Tx = new PerspectiveTransform(); + Tx.setToScale(sx, sy); + concatenate(Tx); + } + + /** + * Concatenates this transform with a shearing transformation. + * This is equivalent to calling concatenate(SH), where SH is an + * PerspectiveTransform represented by the following matrix: + *
+     *		[   1   shx   0   ]
+     *		[  shy   1    0   ]
+     *		[   0    0    1   ]
+     * 
+ * + * @param shx The factor by which coordinates are shifted towards + * the positive X axis direction according to their Y + * coordinate. + * @param shy The factor by which coordinates are shifted towards + * the positive Y axis direction according to their X + * coordinate. + */ + public void shear(double shx, double shy) { + PerspectiveTransform Tx = new PerspectiveTransform(); + Tx.setToShear(shx, shy); + concatenate(Tx); + } + + /** + * Resets this transform to the Identity transform. + */ + public void setToIdentity() { + m00 = m11 = m22 = 1.0; + m01 = m10 = m02 = m20 = m12 = m21 = 0.0; + } + + /** + * Sets this transform to a translation transformation. + * The matrix representing this transform becomes: + *
+     *		[   1    0    tx  ]
+     *		[   0    1    ty  ]
+     *		[   0    0    1   ]
+     * 
+ * @param tx The distance by which coordinates are translated in the + * X axis direction + * @param ty The distance by which coordinates are translated in the + * Y axis direction + */ + public void setToTranslation(double tx, double ty) { + m00 = 1.0; + m01 = 0.0; + m02 = tx; + m10 = 0.0; + m11 = 1.0; + m12 = ty; + m20 = 0.0; + m21 = 0.0; + m22 = 1.0; + } + + /** + * Sets this transform to a rotation transformation. + * The matrix representing this transform becomes: + *
+     *		[   cos(theta)    -sin(theta)    0   ]
+     *		[   sin(theta)     cos(theta)    0   ]
+     *		[       0              0         1   ]
+     * 
+ * Rotating with a positive angle theta rotates points on the positive + * X axis toward the positive Y axis. + * @param theta The angle of rotation in radians. + */ + public void setToRotation(double theta) { + m00 = Math.cos(theta); + m01 = -Math.sin(theta); + m02 = 0.0; + m10 = - m01; // Math.sin(theta); + m11 = m00; // Math.cos(theta); + m12 = 0.0; + m20 = 0.0; + m21 = 0.0; + m22 = 1.0; + } + + /** + * Sets this transform to a rotation transformation + * about a specified point (x, y). This is equivalent + * to the following sequence of calls: + * + *
+     *		setToTranslate(x, y);
+     *		rotate(theta);
+     *		translate(-x, -y);
+     * 
+ * + * Rotating with a positive angle theta rotates points on the positive + * X axis toward the positive Y axis. + * + * @param theta The angle of rotation in radians. + * @param x The X coordinate of the origin of the rotation + * @param y The Y coordinate of the origin of the rotation + */ + public void setToRotation(double theta, double x, double y) { + setToRotation(theta); + double sin = m10; + double oneMinusCos = 1.0 - m00; + m02 = x * oneMinusCos + y * sin; + m12 = y * oneMinusCos - x * sin; + } + + /** + * Sets this transform to a scale transformation + * with scale factors sx and sy. + * The matrix representing this transform becomes: + *
+     *		[   sx   0    0   ]
+     *		[   0    sy   0   ]
+     *		[   0    0    1   ]
+     * 
+ * + * @param sx The X axis scale factor. + * @param sy The Y axis scale factor. + */ + public void setToScale(double sx, double sy) { + m00 = sx; + m01 = 0.0; + m02 = 0.0; + m10 = 0.0; + m11 = sy; + m12 = 0.0; + m20 = 0.0; + m21 = 0.0; + m22 = 1.0; + } + + /** + * Sets this transform to a shearing transformation + * with shear factors sx and sy. + * The matrix representing this transform becomes: + *
+     *		[   1  shx    0   ]
+     *		[ shy    1    0   ]
+     *		[   0    0    1   ]
+     * 
+ * + * @param shx The factor by which coordinates are shifted towards + * the positive X axis direction according to their Y + * coordinate. + * @param shy The factor by which coordinates are shifted towards + * the positive Y axis direction according to their X + * coordinate. + */ + public void setToShear(double shx, double shy) { + m00 = 1.0; + m01 = shx; + m02 = 0.0; + m10 = shy; + m11 = 1.0; + m12 = 0.0; + m20 = 0.0; + m21 = 0.0; + m22 = 1.0; + } + + /** + * Sets this transform to a given AffineTransform. + * @throws IllegalArgumentException if Tx is null + */ + public void setTransform(AffineTransform Tx) { + if ( Tx == null ) { + throw new IllegalArgumentException(JaiI18N.getString("Generic0")); + } + + m00 = Tx.getScaleX(); + m01 = Tx.getShearX(); + m02 = Tx.getTranslateX(); + m10 = Tx.getShearY(); + m11 = Tx.getScaleY(); + m12 = Tx.getTranslateY(); + m20 = 0.0; + m21 = 0.0; + m22 = 1.0; + } + + /** + * Sets this transform to a given PerspectiveTransform. + * @throws IllegalArgumentException if Tx is null + */ + public void setTransform(PerspectiveTransform Tx) { + if ( Tx == null ) { + throw new IllegalArgumentException(JaiI18N.getString("Generic0")); + } + + m00 = Tx.m00; + m01 = Tx.m01; + m02 = Tx.m02; + m10 = Tx.m10; + m11 = Tx.m11; + m12 = Tx.m12; + m20 = Tx.m20; + m21 = Tx.m21; + m22 = Tx.m22; + } + + /** + * Sets this transform to a given PerspectiveTransform, + * expressed by the elements of its matrix. Important Note: The + * matrix elements in the argument list are in column-major order + * unlike those of the constructor, which are in row-major order. + * @deprecated as of JAI 1.1 Use double[][] getMatrix(double[][] matrix) instead. + */ + public void setTransform(float m00, float m10, float m20, + float m01, float m11, float m21, + float m02, float m12, float m22) { + this.m00 = (double)m00; + this.m01 = (double)m01; + this.m02 = (double)m02; + this.m10 = (double)m10; + this.m11 = (double)m11; + this.m12 = (double)m12; + this.m20 = (double)m20; + this.m21 = (double)m21; + this.m22 = (double)m22; + } + + /** + * Sets this transform using a two-dimensional array of double precision + * values. The row index is first, and the column index is second. + * + * @param matrix The 2D double array to be used for setting this transform. + * The array is assumed to be at least 3x3. + * @throws IllegalArgumentException if matrix is null + * @throws ArrayIndexOutOfBoundsException if matrix is too small + * @since JAI 1.1 + */ + public void setTransform(double[][] matrix) { + if ( matrix == null ) { + throw new IllegalArgumentException(JaiI18N.getString("Generic0")); + } + + m00 = matrix[0][0]; + m01 = matrix[0][1]; + m02 = matrix[0][2]; + m10 = matrix[1][0]; + m11 = matrix[1][1]; + m12 = matrix[1][2]; + m20 = matrix[2][0]; + m21 = matrix[2][1]; + m22 = matrix[2][2]; + } + + /** + * Post-concatenates a given AffineTransform to this transform. + * @throws IllegalArgumentException if Tx is null + */ + public void concatenate(AffineTransform Tx) { + if ( Tx == null ) { + throw new IllegalArgumentException(JaiI18N.getString("Generic0")); + } + + // Extend Tx: Tx.m20 = 0, Tx.m21 = 0, Tx.m22 = 1 + + double tx_m00 = Tx.getScaleX(); + double tx_m01 = Tx.getShearX(); + double tx_m02 = Tx.getTranslateX(); + double tx_m10 = Tx.getShearY(); + double tx_m11 = Tx.getScaleY(); + double tx_m12 = Tx.getTranslateY(); + + double m00p = m00*tx_m00 + m10*tx_m01 + m20*tx_m02; + double m01p = m01*tx_m00 + m11*tx_m01 + m21*tx_m02; + double m02p = m02*tx_m00 + m12*tx_m01 + m22*tx_m02; + double m10p = m00*tx_m10 + m10*tx_m11 + m20*tx_m12; + double m11p = m01*tx_m10 + m11*tx_m11 + m21*tx_m12; + double m12p = m02*tx_m10 + m12*tx_m11 + m22*tx_m12; + double m20p = m20; + double m21p = m21; + double m22p = m22; + + m00 = m00p; + m10 = m10p; + m20 = m20p; + m01 = m01p; + m11 = m11p; + m21 = m21p; + m02 = m02p; + m12 = m12p; + m22 = m22p; + } + + /** + * Post-concatenates a given PerspectiveTransform to this transform. + * @throws IllegalArgumentException if Tx is null + */ + public void concatenate(PerspectiveTransform Tx) { + if ( Tx == null ) { + throw new IllegalArgumentException(JaiI18N.getString("Generic0")); + } + + double m00p = m00*Tx.m00 + m10*Tx.m01 + m20*Tx.m02; + double m10p = m00*Tx.m10 + m10*Tx.m11 + m20*Tx.m12; + double m20p = m00*Tx.m20 + m10*Tx.m21 + m20*Tx.m22; + double m01p = m01*Tx.m00 + m11*Tx.m01 + m21*Tx.m02; + double m11p = m01*Tx.m10 + m11*Tx.m11 + m21*Tx.m12; + double m21p = m01*Tx.m20 + m11*Tx.m21 + m21*Tx.m22; + double m02p = m02*Tx.m00 + m12*Tx.m01 + m22*Tx.m02; + double m12p = m02*Tx.m10 + m12*Tx.m11 + m22*Tx.m12; + double m22p = m02*Tx.m20 + m12*Tx.m21 + m22*Tx.m22; + + m00 = m00p; + m10 = m10p; + m20 = m20p; + m01 = m01p; + m11 = m11p; + m21 = m21p; + m02 = m02p; + m12 = m12p; + m22 = m22p; + } + + /** + * Pre-concatenates a given AffineTransform to this transform. + * @throws IllegalArgumentException if Tx is null + */ + public void preConcatenate(AffineTransform Tx) { + if ( Tx == null ) { + throw new IllegalArgumentException(JaiI18N.getString("Generic0")); + } + + // Extend Tx: Tx.m20 = 0, Tx.m21 = 0, Tx.m22 = 1 + + double tx_m00 = Tx.getScaleX(); + double tx_m01 = Tx.getShearX(); + double tx_m02 = Tx.getTranslateX(); + double tx_m10 = Tx.getShearY(); + double tx_m11 = Tx.getScaleY(); + double tx_m12 = Tx.getTranslateY(); + + double m00p = tx_m00*m00 + tx_m10*m01; + double m01p = tx_m01*m00 + tx_m11*m01; + double m02p = tx_m02*m00 + tx_m12*m01 + m02; + double m10p = tx_m00*m10 + tx_m10*m11; + double m11p = tx_m01*m10 + tx_m11*m11; + double m12p = tx_m02*m10 + tx_m12*m11 + m12; + double m20p = tx_m00*m20 + tx_m10*m21; + double m21p = tx_m01*m20 + tx_m11*m21; + double m22p = tx_m02*m20 + tx_m12*m21 + m22; + + m00 = m00p; + m10 = m10p; + m20 = m20p; + m01 = m01p; + m11 = m11p; + m21 = m21p; + m02 = m02p; + m12 = m12p; + m22 = m22p; + } + + /** + * Pre-concatenates a given PerspectiveTransform to this transform. + * @throws IllegalArgumentException if Tx is null + */ + public void preConcatenate(PerspectiveTransform Tx) { + if ( Tx == null ) { + throw new IllegalArgumentException(JaiI18N.getString("Generic0")); + } + + double m00p = Tx.m00*m00 + Tx.m10*m01 + Tx.m20*m02; + double m10p = Tx.m00*m10 + Tx.m10*m11 + Tx.m20*m12; + double m20p = Tx.m00*m20 + Tx.m10*m21 + Tx.m20*m22; + double m01p = Tx.m01*m00 + Tx.m11*m01 + Tx.m21*m02; + double m11p = Tx.m01*m10 + Tx.m11*m11 + Tx.m21*m12; + double m21p = Tx.m01*m20 + Tx.m11*m21 + Tx.m21*m22; + double m02p = Tx.m02*m00 + Tx.m12*m01 + Tx.m22*m02; + double m12p = Tx.m02*m10 + Tx.m12*m11 + Tx.m22*m12; + double m22p = Tx.m02*m20 + Tx.m12*m21 + Tx.m22*m22; + + m00 = m00p; + m10 = m10p; + m20 = m20p; + m01 = m01p; + m11 = m11p; + m21 = m21p; + m02 = m02p; + m12 = m12p; + m22 = m22p; + } + + /** + * Returns a new PerpectiveTransform that is the inverse + * of the current transform. + * @throws NoninvertibleTransformException if transform cannot be inverted + */ + public PerspectiveTransform createInverse() + throws NoninvertibleTransformException, CloneNotSupportedException { + + PerspectiveTransform tx = (PerspectiveTransform)clone(); + tx.makeAdjoint(); + if (Math.abs(tx.m22) < PERSPECTIVE_DIVIDE_EPSILON) { + throw new NoninvertibleTransformException(JaiI18N.getString("PerspectiveTransform0")); + } + tx.normalize(); + return tx; + } + + /** + * Returns a new PerpectiveTransform that is the adjoint, + * of the current transform. The adjoint is defined as + * the matrix of cofactors, which in turn are the determinants + * of the submatrices defined by removing the row and column + * of each element from the original matrix in turn. + * + *

The adjoint is a scalar multiple of the inverse matrix. + * Because points to be transformed are converted into homogeneous + * coordinates, where scalar factors are irrelevant, the adjoint + * may be used in place of the true inverse. Since it is unnecessary + * to normalize the adjoint, it is both faster to compute and more + * numerically stable than the true inverse. + */ + public PerspectiveTransform createAdjoint() + throws CloneNotSupportedException{ + + PerspectiveTransform tx = (PerspectiveTransform)clone(); + tx.makeAdjoint(); + return tx; + } + + /** + * Transforms the specified ptSrc and stores the result in ptDst. + * If ptDst is null, a new Point2D object will be allocated before + * storing. In either case, ptDst containing the transformed point + * is returned for convenience. + * Note that ptSrc and ptDst can the same. In this case, the input + * point will be overwritten with the transformed point. + * + * @param ptSrc The array containing the source point objects. + * @param ptDst The array where the transform point objects are returned. + * @throws IllegalArgumentException if ptSrc is null + */ + public Point2D transform(Point2D ptSrc, Point2D ptDst) { + if ( ptSrc == null ) { + throw new IllegalArgumentException(JaiI18N.getString("Generic0")); + } + + if (ptDst == null) { + if (ptSrc instanceof Point2D.Double) { + ptDst = new Point2D.Double(); + } else { + ptDst = new Point2D.Float(); + } + } + + double x = ptSrc.getX(); + double y = ptSrc.getY(); + double w = m20 * x + m21 * y + m22; + ptDst.setLocation((m00 * x + m01 * y + m02) / w, + (m10 * x + m11 * y + m12) / w); + + return ptDst; + } + + /** + * Transforms an array of point objects by this transform. + * @param ptSrc The array containing the source point objects. + * @param ptDst The array where the transform point objects are returned. + * @param srcOff The offset to the first point object to be transformed + * in the source array. + * @param dstOff The offset to the location where the first transformed + * point object is stored in the destination array. + * @param numPts The number of point objects to be transformed. + * @throws IllegalArgumentException if ptSrc is null + * @throws IllegalArgumentException if ptDst is null + * @throws ArrayIndexOutOfBoundsException if ptSrc is too small + */ + public void transform(Point2D[] ptSrc, int srcOff, + Point2D[] ptDst, int dstOff, + int numPts) { + + if ( ptSrc == null || ptDst == null ) { + throw new IllegalArgumentException(JaiI18N.getString("Generic0")); + } + + while (numPts-- > 0) { + /* Copy source coords into local variables in case src == dst. */ + Point2D src = ptSrc[srcOff++]; + Point2D dst = ptDst[dstOff++]; + if (dst == null) { + if (src instanceof Point2D.Double) { + dst = new Point2D.Double(); + } else { + dst = new Point2D.Float(); + } + ptDst[dstOff - 1] = dst; + } + + double x = src.getX(); + double y = src.getY(); + double w = m20 * x + m21 * y + m22; + + if (w == 0) { + dst.setLocation(x, y); + } else { + dst.setLocation((m00 * x + m01 * y + m02) / w, + (m10 * x + m11 * y + m12) / w); + } + } + } + + /** + * Transforms an array of floating point coordinates by this transform. + * @param srcPts The array containing the source point coordinates. + * Each point is stored as a pair of x,y coordinates. + * @param srcOff The offset to the first point to be transformed + * in the source array. + * @param dstPts The array where the transformed point coordinates are + * returned. Each point is stored as a pair of x,y coordinates. + * @param dstOff The offset to the location where the first transformed + * point is stored in the destination array. + * @param numPts The number of points to be transformed. + * @throws IllegalArgumentException if srcPts is null + * @throws ArrayIndexOutOfBoundsException if srcPts is too small + */ + public void transform(float[] srcPts, int srcOff, + float[] dstPts, int dstOff, + int numPts) { + + if ( srcPts == null ) { + throw new IllegalArgumentException(JaiI18N.getString("Generic0")); + } + + if (dstPts == null) { + dstPts = new float[numPts * 2 + dstOff]; + } + + while (numPts-- > 0) { + float x = srcPts[srcOff++]; + float y = srcPts[srcOff++]; + double w = m20 * x + m21 * y + m22; + + if (w == 0) { + dstPts[dstOff++] = x; + dstPts[dstOff++] = y; + } else { + dstPts[dstOff++] = (float)((m00 * x + m01 * y + m02) / w); + dstPts[dstOff++] = (float)((m10 * x + m11 * y + m12) / w); + } + } + } + + /** + * Transforms an array of double precision coordinates by this transform. + * @param srcPts The array containing the source point coordinates. + * Each point is stored as a pair of x,y coordinates. + * @param dstPts The array where the transformed point coordinates are + * returned. Each point is stored as a pair of x,y coordinates. + * @param srcOff The offset to the first point to be transformed + * in the source array. + * @param dstOff The offset to the location where the first transformed + * point is stored in the destination array. + * @param numPts The number of point objects to be transformed. + * @throws IllegalArgumentException if srcPts is null + * @throws ArrayIndexOutOfBoundsException if srcPts is too small + */ + public void transform(double[] srcPts, int srcOff, + double[] dstPts, int dstOff, + int numPts) { + + if ( srcPts == null ) { + throw new IllegalArgumentException(JaiI18N.getString("Generic0")); + } + + if (dstPts == null) { + dstPts = new double[numPts * 2 + dstOff]; + } + + while (numPts-- > 0) { + double x = srcPts[srcOff++]; + double y = srcPts[srcOff++]; + double w = m20 * x + m21 * y + m22; + + if (w == 0) { + dstPts[dstOff++] = x; + dstPts[dstOff++] = y; + } else { + dstPts[dstOff++] = (m00 * x + m01 * y + m02) / w; + dstPts[dstOff++] = (m10 * x + m11 * y + m12) / w; + } + } + } + + /** + * Transforms an array of floating point coordinates by this transform, + * storing the results into an array of doubles. + * @param srcPts The array containing the source point coordinates. + * Each point is stored as a pair of x,y coordinates. + * @param srcOff The offset to the first point to be transformed + * in the source array. + * @param dstPts The array where the transformed point coordinates are + * returned. Each point is stored as a pair of x,y coordinates. + * @param dstOff The offset to the location where the first transformed + * point is stored in the destination array. + * @param numPts The number of points to be transformed. + * @throws IllegalArgumentException if srcPts is null + * @throws ArrayIndexOutOfBoundsException if srcPts is too small + */ + public void transform(float[] srcPts, int srcOff, + double[] dstPts, int dstOff, + int numPts) { + + if ( srcPts == null ) { + throw new IllegalArgumentException(JaiI18N.getString("Generic0")); + } + + if (dstPts == null) { + dstPts = new double[numPts * 2 + dstOff]; + } + + while (numPts-- > 0) { + float x = srcPts[srcOff++]; + float y = srcPts[srcOff++]; + double w = m20 * x + m21 * y + m22; + + if (w == 0) { + dstPts[dstOff++] = x; + dstPts[dstOff++] = y; + } else { + dstPts[dstOff++] = (m00 * x + m01 * y + m02) / w; + dstPts[dstOff++] = (m10 * x + m11 * y + m12) / w; + } + } + } + + /** + * Transforms an array of double precision coordinates by this transform, + * storing the results into an array of floats. + * @param srcPts The array containing the source point coordinates. + * Each point is stored as a pair of x,y coordinates. + * @param dstPts The array where the transformed point coordinates are + * returned. Each point is stored as a pair of x,y coordinates. + * @param srcOff The offset to the first point to be transformed + * in the source array. + * @param dstOff The offset to the location where the first transformed + * point is stored in the destination array. + * @param numPts The number of point objects to be transformed. + * @throws IllegalArgumentException if srcPts is null + * @throws ArrayIndexOutOfBoundsException if srcPts is too small + */ + public void transform(double[] srcPts, int srcOff, + float[] dstPts, int dstOff, + int numPts) { + + if ( srcPts == null ) { + throw new IllegalArgumentException(JaiI18N.getString("Generic0")); + } + + if (dstPts == null) { + dstPts = new float[numPts * 2 + dstOff]; + } + + while (numPts-- > 0) { + double x = srcPts[srcOff++]; + double y = srcPts[srcOff++]; + double w = m20 * x + m21 * y + m22; + + if (w == 0) { + dstPts[dstOff++] = (float)x; + dstPts[dstOff++] = (float)y; + } else { + dstPts[dstOff++] = (float)((m00 * x + m01 * y + m02) / w); + dstPts[dstOff++] = (float)((m10 * x + m11 * y + m12) / w); + } + } + } + + /** + * Inverse transforms the specified ptSrc and stores the result in ptDst. + * If ptDst is null, a new Point2D object will be allocated before + * storing. In either case, ptDst containing the transformed point + * is returned for convenience. + * Note that ptSrc and ptDst can the same. In this case, the input + * point will be overwritten with the transformed point. + * @param ptSrc The point to be inverse transformed. + * @param ptDst The resulting transformed point. + * @throws NoninvertibleTransformException if the matrix cannot be + * inverted. + * @throws IllegalArgumentException if ptSrc is null + */ + public Point2D inverseTransform(Point2D ptSrc, Point2D ptDst) + throws NoninvertibleTransformException + { + if ( ptSrc == null ) { + throw new IllegalArgumentException(JaiI18N.getString("Generic0")); + } + + if (ptDst == null) { + if (ptSrc instanceof Point2D.Double) { + ptDst = new Point2D.Double(); + } else { + ptDst = new Point2D.Float(); + } + } + // Copy source coords into local variables in case src == dst + double x = ptSrc.getX(); + double y = ptSrc.getY(); + + double tmp_x = (m11*m22 - m12*m21) * x + + (m02*m21 - m01*m22) * y + + (m01*m12 - m02*m11); + double tmp_y = (m12*m20 - m10*m22) * x + + (m00*m22 - m02*m20) * y + + (m02*m10 - m00*m12); + double w = (m10*m21 - m11*m20) * x + + (m01*m20 - m00*m21) * y + + (m00*m11 - m01*m10); + + double wabs = w; + if (w < 0) { + wabs = - w; + } + if (wabs < PERSPECTIVE_DIVIDE_EPSILON) { + throw new + NoninvertibleTransformException( + JaiI18N.getString("PerspectiveTransform1")); + } + + ptDst.setLocation(tmp_x/w, tmp_y/w); + + return ptDst; + } + + /** + * Inverse transforms an array of double precision coordinates by + * this transform. + * @param srcPts The array containing the source point coordinates. + * Each point is stored as a pair of x,y coordinates. + * @param dstPts The array where the transformed point coordinates are + * returned. Each point is stored as a pair of x,y coordinates. + * @param srcOff The offset to the first point to be transformed + * in the source array. + * @param dstOff The offset to the location where the first transformed + * point is stored in the destination array. + * @param numPts The number of point objects to be transformed. + * @throws NoninvertibleTransformException if the matrix cannot be + * inverted. + * @throws IllegalArgumentException if srcPts is null + * @throws ArrayIndexOutOfBoundsException if srcPts is too small + * @throws NoninvertibleTransformException transform cannot be inverted + */ + public void inverseTransform(double[] srcPts, int srcOff, + double[] dstPts, int dstOff, + int numPts) + throws NoninvertibleTransformException + { + if ( srcPts == null ) { + throw new IllegalArgumentException(JaiI18N.getString("Generic0")); + } + + if (dstPts == null) { + dstPts = new double[numPts * 2 + dstOff]; + } + + while (numPts-- > 0) { + double x = srcPts[srcOff++]; + double y = srcPts[srcOff++]; + + double tmp_x = (m11*m22 - m12*m21) * x + + (m02*m21 - m01*m22) * y + + (m01*m12 - m02*m11); + double tmp_y = (m12*m20 - m10*m22) * x + + (m00*m22 - m02*m20) * y + + (m02*m10 - m00*m12); + double w = (m10*m21 - m11*m20) * x + + (m01*m20 - m00*m21) * y + + (m00*m11 - m01*m10); + + double wabs = w; + if (w < 0) { + wabs = - w; + } + if (wabs < PERSPECTIVE_DIVIDE_EPSILON) { + throw new NoninvertibleTransformException( + JaiI18N.getString("PerspectiveTransform1")); + } + + dstPts[dstOff++] = tmp_x / w; + dstPts[dstOff++] = tmp_y / w; + } + } + + /** + * Returns a String that represents the value of this Object. + */ + public String toString() { + StringBuffer sb = new StringBuffer(); + sb.append("Perspective transform matrix\n"); + sb.append(this.m00); + sb.append("\t"); + sb.append(this.m01); + sb.append("\t"); + sb.append(this.m02); + sb.append("\n"); + sb.append(this.m10); + sb.append("\t"); + sb.append(this.m11); + sb.append("\t"); + sb.append(this.m12); + sb.append("\n"); + sb.append(this.m20); + sb.append("\t"); + sb.append(this.m21); + sb.append("\t"); + sb.append(this.m22); + sb.append("\n"); + return new String(sb); + } + + /** + * Returns the boolean true value if this PerspectiveTransform is an + * identity transform. Returns false otherwise. + */ + public boolean isIdentity() { + return m01 == 0.0 && m02 == 0.0 && + m10 == 0.0 && m12 == 0.0 && + m20 == 0.0 && m21 == 0.0 && + m22 != 0.0 && m00/m22 == 1.0 && m11/m22 == 1.0; + } + + /** + * Returns a copy of this PerspectiveTransform object. + */ + public Object clone() { + try { + return super.clone(); + } catch (CloneNotSupportedException e) { + // this shouldn't happen, since we are Cloneable + throw new InternalError(); + } + } + + + /** + * Tests if this PerspectiveTransform equals a supplied one. + * + * @param obj The PerspectiveTransform to be compared to this one. + */ + public boolean equals(Object obj) { + if (!(obj instanceof PerspectiveTransform)) { + return false; + } + + PerspectiveTransform a = (PerspectiveTransform)obj; + + return ((m00 == a.m00) && (m10 == a.m10) && (m20 == a.m20) && + (m01 == a.m01) && (m11 == a.m11) && (m21 == a.m21) && + (m02 == a.m02) && (m12 == a.m12) && (m22 == a.m22)); + } +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/WiimoteConnector.java b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/WiimoteConnector.java new file mode 100644 index 0000000..e866bf0 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/WiimoteConnector.java @@ -0,0 +1,51 @@ +package org.mote.wiimote.whiteboard; + +import org.mote.wiimote.whiteboard.preferences.WWPreferences; + +import wiiremotej.WiiRemote; +import wiiremotej.WiiRemoteJ; + +public class WiimoteConnector { + + private WiimoteDataHandler dh; + + public WiimoteConnector(WiimoteDataHandler dh) { + this.dh = dh; + } + + public void connect() { + if (!WWPreferences.WIIMOTE_BT_ADDRESSES.isEmpty()) { + WiimoteWhiteboard.getLogger().info(String.format("Directly connecting to bluetooth address(es) %s.", WWPreferences.WIIMOTE_BT_ADDRESSES)); + for (int i = 0; i < Math.min(WWPreferences.WIIMOTE_BT_ADDRESSES.size(), WWPreferences.WIIMOTES); i++) { + connect(WWPreferences.WIIMOTE_BT_ADDRESSES.get(i)); + } + } else { + WiiRemoteJ.findRemotes(dh, WWPreferences.WIIMOTES); + } + } + + private void connect(final String address) { + new Thread(new Runnable() { + private boolean done = false; + public void run() { + while (!done) { + try { + WiiRemote r = WiiRemoteJ.connectToRemote(address); + if (r != null && r.isConnected()) { + done = true; + dh.addRemote(r); + } + } catch (Exception e) { + + try { + Thread.sleep(1000); + } catch (InterruptedException e1) { + e1.printStackTrace(); + } + } + } + } + }).start(); + } + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/WiimoteConnector.java~ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/WiimoteConnector.java~ new file mode 100644 index 0000000..3964729 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/WiimoteConnector.java~ @@ -0,0 +1,55 @@ +package org.mote.wiimote.whiteboard; + +import org.mote.wiimote.whiteboard.preferences.WWPreferences; + +import wiiremotej.WiiRemote; +import wiiremotej.WiiRemoteJ; + +public class WiimoteConnector { + + private WiimoteDataHandler dh; + + public WiimoteConnector(WiimoteDataHandler dh) { + this.dh = dh; + } + + public void connect() { + if (!WWPreferences.WIIMOTE_BT_ADDRESSES.isEmpty()) { + WiimoteWhiteboard.getLogger().info(String.format("Directly connecting to bluetooth address(es) %s.", WWPreferences.WIIMOTE_BT_ADDRESSES)); + for (int i = 0; i < Math.min(WWPreferences.WIIMOTE_BT_ADDRESSES.size(), WWPreferences.WIIMOTES); i++) { + connect(WWPreferences.WIIMOTE_BT_ADDRESSES.get(i)); + } + } else { + WiiRemoteJ.findRemotes(dh, WWPreferences.WIIMOTES); + } + } + + private void connect(final String address) { + new Thread(new Runnable() { + private boolean done = false; + public void run() { + while (!done) { + try { + WiiRemote r = WiiRemoteJ.connectToRemote(address); + if (r != null && r.isConnected()) { + done = true; + dh.addRemote(r); + } + } catch (Exception e) { +// if (e.getCause().getMessage().startsWith("Failed to open baseband connection")) { +// // apparently simple timeout error +// } else { +// // "regular" connection error +// } + try { + Thread.sleep(1000); + } catch (InterruptedException e1) { + e1.printStackTrace(); + } + } + } + } + }).start(); + } + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/WiimoteDataHandler.java b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/WiimoteDataHandler.java new file mode 100644 index 0000000..1ce7d61 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/WiimoteDataHandler.java @@ -0,0 +1,314 @@ +package org.mote.wiimote.whiteboard; + +import java.awt.Point; +import java.util.Collection; +import java.util.Collections; +import java.util.EventObject; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Set; +import java.util.logging.Level; + +import org.jdesktop.application.Application; +import org.jdesktop.application.Application.ExitListener; +import org.mote.wiimote.whiteboard.calibration.WiimoteCalibration; +import org.mote.wiimote.whiteboard.ds.IRDot; +import org.mote.wiimote.whiteboard.ds.Wiimote; +import org.mote.wiimote.whiteboard.mouse.CursorControlStrategy; +import org.mote.wiimote.whiteboard.mouse.Mouse; +import org.mote.wiimote.whiteboard.mouse.smoothing.MouseSmoothingStrategy; +import org.mote.wiimote.whiteboard.preferences.WWPreferences; +import org.mote.wiimote.whiteboard.preferences.WWPreferences.PreferencesListener; + +import wiiremotej.WiiRemote; +import wiiremotej.WiiRemoteJ; +import wiiremotej.event.WRButtonEvent; +import wiiremotej.event.WRIREvent; +import wiiremotej.event.WRStatusEvent; +import wiiremotej.event.WiiDeviceDiscoveredEvent; +import wiiremotej.event.WiiDeviceDiscoveryListener; +import wiiremotej.event.WiiRemoteAdapter; + +public class WiimoteDataHandler extends WiiRemoteAdapter implements ExitListener, WiiDeviceDiscoveryListener, PreferencesListener { + + public static interface WiimoteDataListener { + public void wiimoteConnected(Wiimote wiimote); + public void wiimoteDisconnected(Wiimote wiimote); + public void irLights(Wiimote wiimote, IRDot[] lights); + public void irWarped(Map data, Point[] warped); + public void batteryLevel(Wiimote wiimote, double level); + } + + private Map remotes = new LinkedHashMap(WWPreferences.WIIMOTES, 1f); + private Map events = new LinkedHashMap(WWPreferences.WIIMOTES, 1f); + private final WiimoteCalibration calibration; + private static final WWPreferences prefs = WWPreferences.getPreferences(); + private final Set listener = Collections.synchronizedSet(new HashSet()); + + private boolean cursorControl = true; + + private MouseSmoothingStrategy mss[] = new MouseSmoothingStrategy[4]; + private CursorControlStrategy cursorControlStrategy; + + public WiimoteDataHandler(WiimoteCalibration calibration) { + this.calibration = calibration; + Application.getInstance().addExitListener(this); + prefs.addPreferencesListener(this); + preferencesChanged(); + new WiimoteConnector(this).connect(); + } + + public void enableIR(Wiimote wiimote) throws Exception { + if (wiimote != null && wiimote.getWiiRemote().isConnected()) { + wiimote.getWiiRemote().setIRSensorEnabled(true, WRIREvent.BASIC, WWPreferences.SENSITIVITY_SETTINGS); + } + WiimoteWhiteboard.getLogger().info(String.format("(Re-)Setting IR sensor of Wiimote %d: %s", wiimote.getId(), (wiimote != null && wiimote.getWiiRemote().isConnected() ? "done" : "not connected"))); + } + + void addRemote(final WiiRemote remote) { + try { + int id = remotes.size()+1; + final Wiimote wiimote = new Wiimote(remote, remote.getBluetoothAddress(), id); + remotes.put(remote, wiimote); + remote.setAccelerometerEnabled(false); + enableIR(wiimote); + remote.setLEDIlluminated(id-1, true); + remote.setUseMouse(false); + + synchronized (listener) { + for (WiimoteDataListener l : listener) + l.wiimoteConnected(wiimote); + } + + } catch (Exception e) { + e.printStackTrace(); + WiimoteWhiteboard.getLogger().log(Level.SEVERE, "Error on configuring Wii Remote", e); + } + + remote.addWiiRemoteListener(this); + + // update battery level every minute + new Thread(new Runnable() { + public void run() { + while (true) { + try { + // triggers #statusReported(WRStatusEvent) + if (remote.isConnected()) + remote.requestStatus(); + } catch (Exception e) { + e.printStackTrace(); + WiimoteWhiteboard.getLogger().log(Level.WARNING, "Error on requesting status from Wii Remote", e); + } + try { + Thread.sleep(60 * 1000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + }).start(); + } + + + /* + * EXIT + */ + + public void willExit(EventObject event) { + for (WiiRemote remote : remotes.keySet()) + remote.disconnect(); + } + + public boolean canExit(EventObject event) { + return true; + } + + + /* + * WIIREMOTEJ LISTENER + */ + + @Override + public synchronized void IRInputReceived(WRIREvent e) { + events.put(e.getSource(), e); + // wait till data from all connected wiimotes was received once and only process input on data from first wiimote to reduce the number of times the function gets called + if (events.size() == getNumberOfConnectedWiimotes() && remotes.get(e.getSource()).getId() == 1) + IRInputReceived(); + } + + private void IRInputReceived() { + boolean firstDotVisible = false; + Map data = new LinkedHashMap(); + for (WiiRemote r : events.keySet()) { + Wiimote wiimote = remotes.get(r); + IRDot[] dots = IRDot.getIRDots(events.get(r).getIRLights()); + + synchronized (listener) { + for (WiimoteDataListener l : listener) + l.irLights(wiimote, dots); + } + + // exclude points from uncalibrated wiimotes during "normal operation" + if (!calibration.isDone() || calibration.isCalibrated(wiimote)) { + firstDotVisible = firstDotVisible || dots[0] != null; + data.put(wiimote, dots); + } + } + + if (calibration.isDone()) { + // should always be true, but just in case... + if (calibration.isAnyCalibrated(data.keySet())) { + Point warped[] = calibration.warp(data); + for (int i = 0; i < 4; i++) { + if (warped[i] != null) { + warped[i] = mss[i].translate(warped[i]); + } else { + mss[i].reset(); + } + } + + if (isCursorControl()) { + cursorControlStrategy.process(warped[0]); + } else { +// if (Mouse.LEFT_BUTTON.isPressed()) + Mouse.LEFT_BUTTON.setPressed(false); +// if (Mouse.RIGHT_BUTTON.isPressed()) + Mouse.RIGHT_BUTTON.setPressed(false); + } + synchronized (listener) { + for (WiimoteDataListener l : listener) + l.irWarped(data, warped); + } + + } + } else if (calibration.inProgress()) { + if (firstDotVisible) + calibration.process(data); + } + + } + + @Override + public void statusReported(WRStatusEvent e) { + synchronized (listener) { + for (WiimoteDataListener l : listener) + l.batteryLevel(remotes.get(e.getSource()), e.getBatteryLevel()); + } + } + + @Override + public void buttonInputReceived(WRButtonEvent e) { + if (e.isOnlyPressed(WRButtonEvent.A)) { + calibration.start(getConnectedWiimotes()); + } else if (e.isOnlyPressed(WRButtonEvent.HOME)) { + Application.getInstance().exit(); + } + } + + public void wiiDeviceDiscovered(WiiDeviceDiscoveredEvent e) { + if (e.getWiiDevice() instanceof WiiRemote) { + addRemote((WiiRemote)e.getWiiDevice()); + } + } + + public void findFinished(int numberFound) { + } + + @Override + public void disconnected() { + WiiRemoteJ.stopFind(); + WiiRemote remove = null; + for (WiiRemote remote : remotes.keySet()) { + if (!remote.isConnected()) { + remove = remote; + synchronized (listener) { + for (WiimoteDataListener l : listener) + l.wiimoteDisconnected(remotes.get(remote)); + } + break; + } + } + if (remove != null) remotes.remove(remove); + } + + + /* + * LISTENER + */ + + public void addWiimoteDataListener(WiimoteDataListener l) { + listener.add(l); + } + + public void removeWiimoteDataListener(WiimoteDataListener l) { + listener.remove(l); + } + + /* + * PREFERENCES STUFF + */ + + public void preferencesChanged() { + updateMSS(); + updateCursorControlStrategy(); + + @SuppressWarnings("unchecked") + private void updateCursorControlStrategy() { + if (cursorControlStrategy == null || !cursorControlStrategy.getClass().getName().equals(prefs.getCursorControl())) { + try { + Class c = Class.forName(prefs.getCursorControl()); + cursorControlStrategy = ((Class)c).newInstance(); + } catch (Exception e) { + e.printStackTrace(); + WiimoteWhiteboard.getLogger().log(Level.SEVERE, "Cursor Control Method error.", e); + } + } + } + + @SuppressWarnings("unchecked") + private void updateMSS() { + if (mss[0] == null || !mss[0].getClass().getName().equals(prefs.getMouseSmoothing())) { + try { + Class c = Class.forName(prefs.getMouseSmoothing()); + for (int i = 0; i < 4; i++) + mss[i] = ((Class)c).newInstance(); + } catch (Exception e) { + e.printStackTrace(); + WiimoteWhiteboard.getLogger().log(Level.SEVERE, "Mouse Movement Smoothing error.", e); + } + } + } + + /* + * GETTER & SETTER + */ + + public boolean isConnected() { + for (WiiRemote remote : remotes.keySet()) { + if (remote.isConnected()) return true; + } + return false; + } + + public boolean isConnected(Wiimote wiimote) { + return wiimote != null && wiimote.getWiiRemote().isConnected(); + } + + public int getNumberOfConnectedWiimotes() { + return remotes.size(); + } + + public Collection getConnectedWiimotes() { + return remotes.values(); + } + + public boolean isCursorControl() { + return cursorControl; + } + + public void setCursorControl(boolean cursorControl) { + this.cursorControl = cursorControl; + } + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/WiimoteDataHandler.java~ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/WiimoteDataHandler.java~ new file mode 100644 index 0000000..c354c37 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/WiimoteDataHandler.java~ @@ -0,0 +1,339 @@ +package org.mote.wiimote.whiteboard; + +import java.awt.Point; +import java.util.Collection; +import java.util.Collections; +import java.util.EventObject; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Set; +import java.util.logging.Level; + +import org.jdesktop.application.Application; +import org.jdesktop.application.Application.ExitListener; +import org.mote.wiimote.whiteboard.calibration.WiimoteCalibration; +import org.mote.wiimote.whiteboard.ds.IRDot; +import org.mote.wiimote.whiteboard.ds.Wiimote; +import org.mote.wiimote.whiteboard.mouse.CursorControlStrategy; +import org.mote.wiimote.whiteboard.mouse.Mouse; +import org.mote.wiimote.whiteboard.mouse.smoothing.MouseSmoothingStrategy; +import org.mote.wiimote.whiteboard.preferences.WWPreferences; +import org.mote.wiimote.whiteboard.preferences.WWPreferences.PreferencesListener; + +import wiiremotej.WiiRemote; +import wiiremotej.WiiRemoteJ; +import wiiremotej.event.WRButtonEvent; +import wiiremotej.event.WRIREvent; +import wiiremotej.event.WRStatusEvent; +import wiiremotej.event.WiiDeviceDiscoveredEvent; +import wiiremotej.event.WiiDeviceDiscoveryListener; +import wiiremotej.event.WiiRemoteAdapter; + +public class WiimoteDataHandler extends WiiRemoteAdapter implements ExitListener, WiiDeviceDiscoveryListener, PreferencesListener { + + public static interface WiimoteDataListener { + public void wiimoteConnected(Wiimote wiimote); + public void wiimoteDisconnected(Wiimote wiimote); + public void irLights(Wiimote wiimote, IRDot[] lights); + public void irWarped(Map data, Point[] warped); + public void batteryLevel(Wiimote wiimote, double level); + } + + private Map remotes = new LinkedHashMap(WWPreferences.WIIMOTES, 1f); + private Map events = new LinkedHashMap(WWPreferences.WIIMOTES, 1f); + private final WiimoteCalibration calibration; + private static final WWPreferences prefs = WWPreferences.getPreferences(); + private final Set listener = Collections.synchronizedSet(new HashSet()); + + private boolean cursorControl = true; + + private MouseSmoothingStrategy mss[] = new MouseSmoothingStrategy[4]; + private CursorControlStrategy cursorControlStrategy; + + public WiimoteDataHandler(WiimoteCalibration calibration) { + this.calibration = calibration; + Application.getInstance().addExitListener(this); + prefs.addPreferencesListener(this); + preferencesChanged(); + new WiimoteConnector(this).connect(); + } + + public void enableIR(Wiimote wiimote) throws Exception { + if (wiimote != null && wiimote.getWiiRemote().isConnected()) { + wiimote.getWiiRemote().setIRSensorEnabled(true, WRIREvent.BASIC, WWPreferences.SENSITIVITY_SETTINGS); + } + WiimoteWhiteboard.getLogger().info(String.format("(Re-)Setting IR sensor of Wiimote %d: %s", wiimote.getId(), (wiimote != null && wiimote.getWiiRemote().isConnected() ? "done" : "not connected"))); + } + + void addRemote(final WiiRemote remote) { + try { + int id = remotes.size()+1; + final Wiimote wiimote = new Wiimote(remote, remote.getBluetoothAddress(), id); + remotes.put(remote, wiimote); + remote.setAccelerometerEnabled(false); + enableIR(wiimote); + remote.setLEDIlluminated(id-1, true); + remote.setUseMouse(false); + + synchronized (listener) { + for (WiimoteDataListener l : listener) + l.wiimoteConnected(wiimote); + } + + } catch (Exception e) { + e.printStackTrace(); + WiimoteWhiteboard.getLogger().log(Level.SEVERE, "Error on configuring Wii Remote", e); + } + + remote.addWiiRemoteListener(this); + + // update battery level every minute + new Thread(new Runnable() { + public void run() { + while (true) { + try { + // triggers #statusReported(WRStatusEvent) + if (remote.isConnected()) + remote.requestStatus(); + } catch (Exception e) { + e.printStackTrace(); + WiimoteWhiteboard.getLogger().log(Level.WARNING, "Error on requesting status from Wii Remote", e); + } + try { + Thread.sleep(60 * 1000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + }).start(); + } + + + /* + * EXIT + */ + + public void willExit(EventObject event) { + for (WiiRemote remote : remotes.keySet()) + remote.disconnect(); + } + + public boolean canExit(EventObject event) { + return true; + } + + + /* + * WIIREMOTEJ LISTENER + */ + + @Override + public synchronized void IRInputReceived(WRIREvent e) { + events.put(e.getSource(), e); + // wait till data from all connected wiimotes was received once and only process input on data from first wiimote to reduce the number of times the function gets called + if (events.size() == getNumberOfConnectedWiimotes() && remotes.get(e.getSource()).getId() == 1) + IRInputReceived(); + } + + private void IRInputReceived() { + boolean firstDotVisible = false; + Map data = new LinkedHashMap(); + for (WiiRemote r : events.keySet()) { + Wiimote wiimote = remotes.get(r); + IRDot[] dots = IRDot.getIRDots(events.get(r).getIRLights()); + + synchronized (listener) { + for (WiimoteDataListener l : listener) + l.irLights(wiimote, dots); + } + + // exclude points from uncalibrated wiimotes during "normal operation" + if (!calibration.isDone() || calibration.isCalibrated(wiimote)) { + firstDotVisible = firstDotVisible || dots[0] != null; + data.put(wiimote, dots); + } + } + + if (calibration.isDone()) { + // should always be true, but just in case... + if (calibration.isAnyCalibrated(data.keySet())) { + Point warped[] = calibration.warp(data); + for (int i = 0; i < 4; i++) { + if (warped[i] != null) { + warped[i] = mss[i].translate(warped[i]); + } else { + mss[i].reset(); + } + } + + if (isCursorControl()) { + cursorControlStrategy.process(warped[0]); + } else { +// if (Mouse.LEFT_BUTTON.isPressed()) + Mouse.LEFT_BUTTON.setPressed(false); +// if (Mouse.RIGHT_BUTTON.isPressed()) + Mouse.RIGHT_BUTTON.setPressed(false); + } + +// if (warped[0] != null) { +// // normal operation after calibration has been done +// if (isCursorControl()) { +// Mouse.move(warped[0]); +// rcs.process(warped[0]); +// if (prefs.isLeftClick() && !(prefs.isRightClick() && rcs.trigger())) { +// Mouse.LEFT_BUTTON.setPressed(true); +// } +// } +// } else { +// rcs.process(null); +// Mouse.LEFT_BUTTON.setPressed(false); +// } + + synchronized (listener) { + for (WiimoteDataListener l : listener) + l.irWarped(data, warped); + } + + } + } else if (calibration.inProgress()) { + if (firstDotVisible) + calibration.process(data); + } + + } + + @Override + public void statusReported(WRStatusEvent e) { + synchronized (listener) { + for (WiimoteDataListener l : listener) + l.batteryLevel(remotes.get(e.getSource()), e.getBatteryLevel()); + } + } + + @Override + public void buttonInputReceived(WRButtonEvent e) { + if (e.isOnlyPressed(WRButtonEvent.A)) { + calibration.start(getConnectedWiimotes()); + } else if (e.isOnlyPressed(WRButtonEvent.HOME)) { + Application.getInstance().exit(); + } + } + + public void wiiDeviceDiscovered(WiiDeviceDiscoveredEvent e) { + if (e.getWiiDevice() instanceof WiiRemote) { + addRemote((WiiRemote)e.getWiiDevice()); + } + } + + public void findFinished(int numberFound) { + } + + @Override + public void disconnected() { + // TODO support dis-/reconnecting? + WiiRemoteJ.stopFind(); + WiiRemote remove = null; + for (WiiRemote remote : remotes.keySet()) { + if (!remote.isConnected()) { + remove = remote; + synchronized (listener) { + for (WiimoteDataListener l : listener) + l.wiimoteDisconnected(remotes.get(remote)); + } + break; + } + } + if (remove != null) remotes.remove(remove); + } + + + /* + * LISTENER + */ + + public void addWiimoteDataListener(WiimoteDataListener l) { + listener.add(l); + } + + public void removeWiimoteDataListener(WiimoteDataListener l) { + listener.remove(l); + } + + /* + * PREFERENCES STUFF + */ + + public void preferencesChanged() { + updateMSS(); + updateCursorControlStrategy(); +// final int newNumWiimotes = prefs.getNumberOfWiimotes(); +// if (numWiimotes != newNumWiimotes) { +// WiiRemoteJ.stopFind(); +// if (newNumWiimotes > getNumberOfConnectedWiimotes()) { +// WiiRemoteJ.findRemotes(this, newNumWiimotes - getNumberOfConnectedWiimotes()); +// } +// numWiimotes = newNumWiimotes; +// } + } + + @SuppressWarnings("unchecked") + private void updateCursorControlStrategy() { + if (cursorControlStrategy == null || !cursorControlStrategy.getClass().getName().equals(prefs.getCursorControl())) { + try { + Class c = Class.forName(prefs.getCursorControl()); + cursorControlStrategy = ((Class)c).newInstance(); + } catch (Exception e) { + e.printStackTrace(); + WiimoteWhiteboard.getLogger().log(Level.SEVERE, "Cursor Control Method error.", e); + } + } + } + + @SuppressWarnings("unchecked") + private void updateMSS() { + if (mss[0] == null || !mss[0].getClass().getName().equals(prefs.getMouseSmoothing())) { + try { + Class c = Class.forName(prefs.getMouseSmoothing()); + for (int i = 0; i < 4; i++) + mss[i] = ((Class)c).newInstance(); + } catch (Exception e) { + e.printStackTrace(); + WiimoteWhiteboard.getLogger().log(Level.SEVERE, "Mouse Movement Smoothing error.", e); + } + } + } + + /* + * GETTER & SETTER + */ + + public boolean isConnected() { + for (WiiRemote remote : remotes.keySet()) { + if (remote.isConnected()) return true; + } + return false; + } + + public boolean isConnected(Wiimote wiimote) { + return wiimote != null && wiimote.getWiiRemote().isConnected(); + } + + public int getNumberOfConnectedWiimotes() { + return remotes.size(); + } + + public Collection getConnectedWiimotes() { + return remotes.values(); + } + + public boolean isCursorControl() { + return cursorControl; + } + + public void setCursorControl(boolean cursorControl) { + this.cursorControl = cursorControl; + } + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/WiimoteWhiteboard.java b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/WiimoteWhiteboard.java new file mode 100644 index 0000000..897ecc5 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/WiimoteWhiteboard.java @@ -0,0 +1,153 @@ +package org.mote.wiimote.whiteboard; + +import java.util.Locale; +import java.util.logging.Level; +import java.util.logging.Logger; + +import javax.swing.JFrame; +import javax.swing.JOptionPane; + +import org.jdesktop.application.Action; +import org.jdesktop.application.Application; +import org.jdesktop.application.SingleFrameApplication; +import org.mote.wiimote.whiteboard.calibration.CalibrationPersistence; +import org.mote.wiimote.whiteboard.calibration.WiimoteCalibration; +import org.mote.wiimote.whiteboard.calibration.WiimoteCalibration.CalibrationEvent; +import org.mote.wiimote.whiteboard.gui.AboutWindow; +import org.mote.wiimote.whiteboard.gui.HelpHandler; +import org.mote.wiimote.whiteboard.gui.LogWindow; +import org.mote.wiimote.whiteboard.gui.MainPanel; +import org.mote.wiimote.whiteboard.gui.MenuBar; +import org.mote.wiimote.whiteboard.gui.PreferencesWindow; +import org.mote.wiimote.whiteboard.mouse.Mouse; +import org.mote.wiimote.whiteboard.preferences.WWPreferences; +import org.mote.wiimote.whiteboard.tuio.TuioTransmitter; +import org.mote.wiimote.whiteboard.util.BareBonesBrowserLaunch; +import org.mote.wiimote.whiteboard.util.UpdateNotifier; +import org.mote.wiimote.whiteboard.util.Util; +import org.mote.wiimote.whiteboard.util.WiiRemoteJErrorHandler; + +import wiiremotej.WiiRemoteJ; +import apple.dts.samplecode.osxadapter.OSXAdapter; + +public class WiimoteWhiteboard extends SingleFrameApplication { + + public static void main(String args[]) { + if (Util.MAC_OS_X && !Util.INSIDE_APP_BUNDLE) { + System.setProperty("apple.laf.useScreenMenuBar", "true"); + System.setProperty("com.apple.mrj.application.apple.menu.about.name", getProperty("id")); + } + System.setProperty("bluecove.jsr82.psm_minimum_off", "true"); + + String lang = WWPreferences.getPreferences().getLanguage(); + if (lang.length() > 0) { + String[] langParts = lang.split("_"); + switch (langParts.length) { + case 1: + Locale.setDefault(new Locale(langParts[0])); + break; + case 2: + Locale.setDefault(new Locale(langParts[0], langParts[1])); + break; + } + } + Application.launch(WiimoteWhiteboard.class, args); + } + + @Override + protected void startup() { + try { + new Thread(new Runnable() { + public void run() { + // blocking + if (WWPreferences.getPreferences().checkForUpdates()) + UpdateNotifier.checkForUpdate(getProperty("version")); + } + }).start(); + + Logger.getLogger("wiimotewhiteboard").setUseParentHandlers(false); + + final JFrame f = getMainFrame(); + LogWindow lw = new LogWindow(); + + final WiimoteCalibration calibration = new WiimoteCalibration(); + WiimoteDataHandler dh = new WiimoteDataHandler(calibration); + +// new IRDotLogger(dh); + + MainPanel mp = new MainPanel(dh, calibration); + AboutWindow af = new AboutWindow(); + HelpHandler hh = new HelpHandler(); + PreferencesWindow pf = new PreferencesWindow(mp, hh); + f.setJMenuBar(new MenuBar(pf, af, hh, lw)); + registerForMacOSXEvents(pf, af); + + // update Mouse's screen + calibration.addCalibrationEventListener(new WiimoteCalibration.CalibrationEventListener() { + public void calibrationEvent(CalibrationEvent e) { + if (e == CalibrationEvent.SCREEN_CHANGED) + Mouse.setScreen(calibration.getScreen()); + } + }); + + new CalibrationPersistence(calibration); + calibration.setScreen(WiimoteCalibration.DEFAULT_SCREEN); + + new TuioTransmitter(dh, calibration); + + WiiRemoteJ.setConsoleLoggingErrors(); + Logger.getLogger("wiiremotej").setLevel(Level.ALL); + Logger.getLogger("wiiremotej").addHandler(new WiiRemoteJErrorHandler(dh)); + + try { + getContext().getSessionStorage().restore(f, "mainFrame.session.xml"); + } catch (Exception e) {} + + show(mp); + f.pack(); + + } catch (Exception e) { + e.printStackTrace(); + getLogger().log(Level.SEVERE, "Error on startup", e); + JOptionPane.showMessageDialog(null, e.getMessage(), getProperty("id"), JOptionPane.ERROR_MESSAGE); + exit(); + } + } + + /* + * MAC OS X HOOKS + */ + private void registerForMacOSXEvents(PreferencesWindow pf, AboutWindow af) { + if (Util.MAC_OS_X) { + try { + OSXAdapter.setQuitHandler(this, WiimoteWhiteboard.class.getDeclaredMethod("quitApp", (Class[])null)); + if (!Util.INSIDE_APP_BUNDLE) { + OSXAdapter.setAboutHandler(af, AboutWindow.class.getDeclaredMethod("about", (Class[])null)); + } + OSXAdapter.setPreferencesHandler(pf, PreferencesWindow.class.getDeclaredMethod("preferences", (Class[])null)); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + + @Action + public boolean quitApp() { + exit(); + return false; + } + + @Action + public void donate() { + BareBonesBrowserLaunch.openURL(getProperty("donateURL")); + } + + public static String getProperty(String key) { + return Util.getResourceMap(WiimoteWhiteboard.class).getString("Application."+key); + } + + public static Logger getLogger() { + return Logger.getLogger("wiimotewhiteboard"); + } + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/WiimoteWhiteboard.java~ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/WiimoteWhiteboard.java~ new file mode 100644 index 0000000..9974a30 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/WiimoteWhiteboard.java~ @@ -0,0 +1,159 @@ +package org.mote.wiimote.whiteboard; + +import java.util.Locale; +import java.util.logging.Level; +import java.util.logging.Logger; + +import javax.swing.JFrame; +import javax.swing.JOptionPane; + +import org.jdesktop.application.Action; +import org.jdesktop.application.Application; +import org.jdesktop.application.SingleFrameApplication; +import org.mote.wiimote.whiteboard.calibration.CalibrationPersistence; +import org.mote.wiimote.whiteboard.calibration.WiimoteCalibration; +import org.mote.wiimote.whiteboard.calibration.WiimoteCalibration.CalibrationEvent; +import org.mote.wiimote.whiteboard.gui.AboutWindow; +import org.mote.wiimote.whiteboard.gui.HelpHandler; +import org.mote.wiimote.whiteboard.gui.LogWindow; +import org.mote.wiimote.whiteboard.gui.MainPanel; +import org.mote.wiimote.whiteboard.gui.MenuBar; +import org.mote.wiimote.whiteboard.gui.PreferencesWindow; +import org.mote.wiimote.whiteboard.mouse.Mouse; +import org.mote.wiimote.whiteboard.preferences.WWPreferences; +import org.mote.wiimote.whiteboard.tuio.TuioTransmitter; +import org.mote.wiimote.whiteboard.util.BareBonesBrowserLaunch; +import org.mote.wiimote.whiteboard.util.UpdateNotifier; +import org.mote.wiimote.whiteboard.util.Util; +import org.mote.wiimote.whiteboard.util.WiiRemoteJErrorHandler; + +import wiiremotej.WiiRemoteJ; +import apple.dts.samplecode.osxadapter.OSXAdapter; + +public class WiimoteWhiteboard extends SingleFrameApplication { + + public static void main(String args[]) { + if (Util.MAC_OS_X && !Util.INSIDE_APP_BUNDLE) { + System.setProperty("apple.laf.useScreenMenuBar", "true"); + System.setProperty("com.apple.mrj.application.apple.menu.about.name", getProperty("id")); + } + System.setProperty("bluecove.jsr82.psm_minimum_off", "true"); + + String lang = WWPreferences.getPreferences().getLanguage(); + if (lang.length() > 0) { + String[] langParts = lang.split("_"); + switch (langParts.length) { + case 1: + Locale.setDefault(new Locale(langParts[0])); + break; + case 2: + Locale.setDefault(new Locale(langParts[0], langParts[1])); + break; + } + } + Application.launch(WiimoteWhiteboard.class, args); + } + + @Override + protected void startup() { + try { + new Thread(new Runnable() { + public void run() { + // blocking + if (WWPreferences.getPreferences().checkForUpdates()) + UpdateNotifier.checkForUpdate(getProperty("version")); + } + }).start(); + + Logger.getLogger("wiimotewhiteboard").setUseParentHandlers(false); + + final JFrame f = getMainFrame(); + LogWindow lw = new LogWindow(); + + final WiimoteCalibration calibration = new WiimoteCalibration(); + WiimoteDataHandler dh = new WiimoteDataHandler(calibration); + +// new IRDotLogger(dh); + + MainPanel mp = new MainPanel(dh, calibration); + AboutWindow af = new AboutWindow(); + HelpHandler hh = new HelpHandler(); + PreferencesWindow pf = new PreferencesWindow(mp, hh); + f.setJMenuBar(new MenuBar(pf, af, hh, lw)); + registerForMacOSXEvents(pf, af); + + // update Mouse's screen + calibration.addCalibrationEventListener(new WiimoteCalibration.CalibrationEventListener() { + public void calibrationEvent(CalibrationEvent e) { + if (e == CalibrationEvent.SCREEN_CHANGED) + Mouse.setScreen(calibration.getScreen()); + } + }); + + // add persistence as last listener because it indirectly generates new calibration events + new CalibrationPersistence(calibration); + // TODO save last used screen? + calibration.setScreen(WiimoteCalibration.DEFAULT_SCREEN); + + new TuioTransmitter(dh, calibration); + + WiiRemoteJ.setConsoleLoggingErrors(); + Logger.getLogger("wiiremotej").setLevel(Level.ALL); + Logger.getLogger("wiiremotej").addHandler(new WiiRemoteJErrorHandler(dh)); + + try { + // restore session manually before 'show' on the main panel is + // called. this is a fix to the problem that the session is not + // restored; apparently because mainFrame is not resizable + getContext().getSessionStorage().restore(f, "mainFrame.session.xml"); + } catch (Exception e) {} + + show(mp); + // f.pack() is called in 'show' above if f.isValid() == false + f.pack(); + + } catch (Exception e) { + e.printStackTrace(); + getLogger().log(Level.SEVERE, "Error on startup", e); + JOptionPane.showMessageDialog(null, e.getMessage(), getProperty("id"), JOptionPane.ERROR_MESSAGE); + exit(); + } + } + + /* + * MAC OS X HOOKS + */ + private void registerForMacOSXEvents(PreferencesWindow pf, AboutWindow af) { + if (Util.MAC_OS_X) { + try { + OSXAdapter.setQuitHandler(this, WiimoteWhiteboard.class.getDeclaredMethod("quitApp", (Class[])null)); + if (!Util.INSIDE_APP_BUNDLE) { + OSXAdapter.setAboutHandler(af, AboutWindow.class.getDeclaredMethod("about", (Class[])null)); + } + OSXAdapter.setPreferencesHandler(pf, PreferencesWindow.class.getDeclaredMethod("preferences", (Class[])null)); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + + @Action + public boolean quitApp() { + exit(); + return false; + } + + @Action + public void donate() { + BareBonesBrowserLaunch.openURL(getProperty("donateURL")); + } + + public static String getProperty(String key) { + return Util.getResourceMap(WiimoteWhiteboard.class).getString("Application."+key); + } + + public static Logger getLogger() { + return Logger.getLogger("wiimotewhiteboard"); + } + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/CalibrationPersistence.java b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/CalibrationPersistence.java new file mode 100644 index 0000000..1311774 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/CalibrationPersistence.java @@ -0,0 +1,53 @@ +package org.mote.wiimote.whiteboard.calibration; + +import java.awt.DisplayMode; +import java.io.IOException; + +import org.jdesktop.application.Application; +import org.mote.wiimote.whiteboard.calibration.WiimoteCalibration.CalibrationEvent; +import org.mote.wiimote.whiteboard.calibration.WiimoteCalibration.CalibrationEventListener; + +public class CalibrationPersistence implements CalibrationEventListener { + + WiimoteCalibration calibration; + + public CalibrationPersistence(WiimoteCalibration calibration) { + this.calibration = calibration; + calibration.addCalibrationEventListener(this); + } + + public void calibrationEvent(CalibrationEvent e) { + switch (e) { + case SCREEN_CHANGED: + loadCalibrationData(); + break; + case FINISHED: + saveCalibrationData(); + break; + } + } + + private String calibrationFileName() { + DisplayMode dm = calibration.getScreen().getDisplayMode(); + return String.format("calibration_%d_%dx%d.txt", calibration.getScreenNumber(), dm.getWidth(), dm.getHeight()); + } + + private void loadCalibrationData() { + try { + String fileName = calibrationFileName(); + calibration.load(Application.getInstance().getContext().getLocalStorage().openInputFile(fileName)); + } catch (IOException e) { + // ignore + } + } + + private void saveCalibrationData() { + try { + String fileName = calibrationFileName(); + calibration.save(Application.getInstance().getContext().getLocalStorage().openOutputFile(fileName)); + } catch (IOException e) { + // ignore + } + } + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/CalibrationPersistence.java~ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/CalibrationPersistence.java~ new file mode 100644 index 0000000..1d4c768 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/CalibrationPersistence.java~ @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2008-2009, Uwe Schmidt + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * The Software uses a third-party library (WiiRemoteJ) which is not part of + * the Software and is subject to its own license. + */ + +package org.uweschmidt.wiimote.whiteboard.calibration; + +import java.awt.DisplayMode; +import java.io.IOException; + +import org.jdesktop.application.Application; +import org.uweschmidt.wiimote.whiteboard.calibration.WiimoteCalibration.CalibrationEvent; +import org.uweschmidt.wiimote.whiteboard.calibration.WiimoteCalibration.CalibrationEventListener; + +public class CalibrationPersistence implements CalibrationEventListener { + + WiimoteCalibration calibration; + + public CalibrationPersistence(WiimoteCalibration calibration) { + this.calibration = calibration; + calibration.addCalibrationEventListener(this); + } + + public void calibrationEvent(CalibrationEvent e) { + switch (e) { + case SCREEN_CHANGED: + loadCalibrationData(); + break; + case FINISHED: + saveCalibrationData(); + break; + } + } + +// private String safeFilename(String rawName) { +// return rawName.replaceAll("[\\W]", "").toLowerCase(); +// } + + private String calibrationFileName() { + DisplayMode dm = calibration.getScreen().getDisplayMode(); + return String.format("calibration_%d_%dx%d.txt", calibration.getScreenNumber(), dm.getWidth(), dm.getHeight()); + } + + private void loadCalibrationData() { + try { + String fileName = calibrationFileName(); + calibration.load(Application.getInstance().getContext().getLocalStorage().openInputFile(fileName)); + } catch (IOException e) { + // ignore + } + } + + private void saveCalibrationData() { + try { + String fileName = calibrationFileName(); + calibration.save(Application.getInstance().getContext().getLocalStorage().openOutputFile(fileName)); + } catch (IOException e) { + // ignore + } + } + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/PointClusterer.java b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/PointClusterer.java new file mode 100644 index 0000000..3aee5f3 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/PointClusterer.java @@ -0,0 +1,72 @@ +package org.mote.wiimote.whiteboard.calibration; + +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import org.mote.wiimote.whiteboard.ds.IRDot; +import org.mote.wiimote.whiteboard.ds.Wiimote; +import org.mote.wiimote.whiteboard.preferences.WWPreferences; + +public class PointClusterer { + + static { + if (WWPreferences.WIIMOTES > 2) + throw new RuntimeException("Clustering for more than 2 Wiimotes not implemented yet."); + } + + public static IRDot[][] cluster(Map data) { + IRDot[][] cluster = new IRDot[4][]; + + if (data.size() == 1) { + IRDot[] values = data.values().iterator().next(); + int j = 0; + for (int i = 0; i < 4; i++) + if (values[i] != null) + cluster[j++] = new IRDot[] { values[i] }; + return cluster; + } + + Wiimote[] wiimotes = new Wiimote[data.keySet().size()]; + data.keySet().toArray(wiimotes); + + Set used = new HashSet(); + int c = 0; + + for (int a = 0; a < 2; a++) { + + for (int i = 0; i < 4; i++) { + IRDot dot1 = data.get(wiimotes[a])[i]; + if (dot1 == null || used.contains(dot1)) + continue; + + IRDot minDot = null; + double minDist = Double.POSITIVE_INFINITY; + + for (int j = 0; j < 4; j++) { + IRDot dot2 = data.get(wiimotes[(a+1)%2])[j]; + if (dot2 == null || used.contains(dot2)) + continue; + + double dist = dot1.distance(dot2); + if (dist < minDist) { + minDot = dot2; + minDist = dist; + } + } + + used.add(dot1); + if (minDot == null) { + cluster[c++] = new IRDot[] { dot1 }; + } else { + cluster[c++] = new IRDot[] { dot1, minDot }; + used.add(minDot); + } + + } + } + + return cluster; + } + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/PointClusterer.java~ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/PointClusterer.java~ new file mode 100644 index 0000000..2e86efa --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/PointClusterer.java~ @@ -0,0 +1,101 @@ +/* + * Copyright (C) 2008-2009, Uwe Schmidt + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * The Software uses a third-party library (WiiRemoteJ) which is not part of + * the Software and is subject to its own license. + */ + +package org.uweschmidt.wiimote.whiteboard.calibration; + +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import org.uweschmidt.wiimote.whiteboard.ds.IRDot; +import org.uweschmidt.wiimote.whiteboard.ds.Wiimote; +import org.uweschmidt.wiimote.whiteboard.preferences.WWPreferences; + +public class PointClusterer { + + static { + if (WWPreferences.WIIMOTES > 2) + throw new RuntimeException("Clustering for more than 2 Wiimotes not implemented yet."); + } + + /** + * @return array of clusters (first index = cluster number, second index = dots in cluster) + */ + public static IRDot[][] cluster(Map data) { + IRDot[][] cluster = new IRDot[4][]; + + // trivial case + if (data.size() == 1) { + IRDot[] values = data.values().iterator().next(); + int j = 0; + for (int i = 0; i < 4; i++) + if (values[i] != null) + cluster[j++] = new IRDot[] { values[i] }; + return cluster; + } + + Wiimote[] wiimotes = new Wiimote[data.keySet().size()]; + data.keySet().toArray(wiimotes); + + Set used = new HashSet(); + int c = 0; + + for (int a = 0; a < 2; a++) { + + for (int i = 0; i < 4; i++) { + IRDot dot1 = data.get(wiimotes[a])[i]; + if (dot1 == null || used.contains(dot1)) + continue; + + IRDot minDot = null; + double minDist = Double.POSITIVE_INFINITY; + + for (int j = 0; j < 4; j++) { + IRDot dot2 = data.get(wiimotes[(a+1)%2])[j]; + if (dot2 == null || used.contains(dot2)) + continue; + + double dist = dot1.distance(dot2); + if (dist < minDist) { + minDot = dot2; + minDist = dist; + } + } + + used.add(dot1); + if (minDot == null) { + cluster[c++] = new IRDot[] { dot1 }; + } else { + cluster[c++] = new IRDot[] { dot1, minDot }; + used.add(minDot); + } + + } + } + + return cluster; + } + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/WiimoteCalibration.java b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/WiimoteCalibration.java new file mode 100644 index 0000000..8cc7768 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/WiimoteCalibration.java @@ -0,0 +1,511 @@ +package org.mote.wiimote.whiteboard.calibration; +import java.awt.Color; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.GraphicsDevice; +import java.awt.GraphicsEnvironment; +import java.awt.Image; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.RenderingHints; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.awt.geom.Point2D; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.PrintStream; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.Locale; +import java.util.Map; +import java.util.Set; + +import javax.media.jai.PerspectiveTransform; +import javax.swing.Icon; +import javax.swing.ImageIcon; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.SwingConstants; + +import org.mote.wiimote.whiteboard.WiimoteWhiteboard; +import org.mote.wiimote.whiteboard.ds.IRDot; +import org.mote.wiimote.whiteboard.ds.Wiimote; +import org.mote.wiimote.whiteboard.util.Util; + +public class WiimoteCalibration { + + // list of all "rectangles" of the 3x3 calibration grid, larger to smaller + private static final CalibrationState[][] VALID_STATES = { + {CalibrationState.UPPER_LEFT, CalibrationState.UPPER_RIGHT, CalibrationState.LOWER_RIGHT, CalibrationState.LOWER_LEFT}, + {CalibrationState.UPPER_LEFT, CalibrationState.TOP_MIDDLE, CalibrationState.BOTTOM_MIDDLE, CalibrationState.LOWER_LEFT}, + {CalibrationState.TOP_MIDDLE, CalibrationState.UPPER_RIGHT, CalibrationState.LOWER_RIGHT, CalibrationState.BOTTOM_MIDDLE}, + {CalibrationState.UPPER_LEFT, CalibrationState.UPPER_RIGHT, CalibrationState.EAST_MIDDLE, CalibrationState.WEST_MIDDLE}, + {CalibrationState.WEST_MIDDLE, CalibrationState.EAST_MIDDLE, CalibrationState.LOWER_RIGHT, CalibrationState.LOWER_LEFT}, + {CalibrationState.WEST_MIDDLE, CalibrationState.CENTER, CalibrationState.BOTTOM_MIDDLE, CalibrationState.LOWER_LEFT}, + {CalibrationState.UPPER_LEFT, CalibrationState.TOP_MIDDLE, CalibrationState.CENTER, CalibrationState.WEST_MIDDLE}, + {CalibrationState.TOP_MIDDLE, CalibrationState.UPPER_RIGHT, CalibrationState.EAST_MIDDLE, CalibrationState.CENTER}, + {CalibrationState.CENTER, CalibrationState.EAST_MIDDLE, CalibrationState.LOWER_RIGHT, CalibrationState.BOTTOM_MIDDLE}, + }; + + public static final GraphicsDevice DEFAULT_SCREEN = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); + + public static enum CalibrationEvent { + SCREEN_CHANGED, STARTED, FINISHED, ABORTED, LOADED, SAVED; + }; + + public static interface CalibrationEventListener { + public void calibrationEvent(CalibrationEvent e); + } + + public static enum CalibrationState { + DONE(0, 0, null), CENTER(.5, .5, DONE), EAST_MIDDLE(.9, .5, CENTER), WEST_MIDDLE(.1, .5, EAST_MIDDLE), TOP_MIDDLE(.5, .1, WEST_MIDDLE), BOTTOM_MIDDLE(.5, .9, TOP_MIDDLE), LOWER_LEFT(.1, .9, BOTTOM_MIDDLE), LOWER_RIGHT(.9, .9, LOWER_LEFT), UPPER_RIGHT(.9, .1, LOWER_RIGHT), UPPER_LEFT(.1, .1, UPPER_RIGHT), PENDING(0, 0, UPPER_LEFT); + + public static final CalibrationState REGULAR_END = LOWER_LEFT; + private final double xMargin, yMargin; + private final CalibrationState next; + + private CalibrationState(double xMargin, double yMargin, CalibrationState next) { + this.xMargin = xMargin; + this.yMargin = yMargin; + this.next = next; + } + + public int getX(Rectangle bounds) { + return bounds.x + (int) Math.round(bounds.width * xMargin); + } + + public int getY(Rectangle bounds) { + return bounds.y + (int) Math.round(bounds.height * yMargin); + } + + public CalibrationState getNext() { + return next; + } + }; + + private static final double EPS = .05; + + private final CalibrationFrame calibrationFrame; + private final Set listener = new LinkedHashSet(); + + + private GraphicsDevice screen = null; + private int screenNumber = -1; + private Rectangle bounds; + private int sc = 0; + private boolean stepChange = false; + private boolean checkPoints = false; + private Collection wiimotes; + private CalibrationState state = CalibrationState.PENDING; + + // last calibration point for a wiimote, always non-null + private Map last = new HashMap(); + // transformer for wiimote + private Map transformer = new LinkedHashMap(); + // all visible calibration points for each wiimote (can be more than 4) + private Map> points = new LinkedHashMap>(); + // final 16 value double array (4<->4 mapping) for each wiimote, used to create transformer + private Map finals = new LinkedHashMap(); + + + + public WiimoteCalibration() { + calibrationFrame = new CalibrationFrame(); + } + + public boolean setScreen(GraphicsDevice screen) { + if (!inProgress()) { + this.screen = screen; + bounds = screen.getDefaultConfiguration().getBounds(); + calibrationFrame.setBounds(bounds); + + // get "screen number" + GraphicsDevice[] gds = GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices(); + for (int i = 0; i < gds.length; i++) { + if (gds[i] == screen) { + screenNumber = i + 1; + break; + } + } + + state = CalibrationState.PENDING; + transformer.clear(); + notifyListener(CalibrationEvent.SCREEN_CHANGED); + return true; + } else { + System.err.println("Calibration in Progress."); + return false; + } + } + + public GraphicsDevice getScreen() { + return screen; + } + + public int getScreenNumber() { + return screenNumber; + } + + @SuppressWarnings("serial") + private class CalibrationFrame extends JFrame { + private final ImageIcon VISIBLE = new ImageIcon(WiimoteCalibration.class.getResource("resources/icons/francisco-ok.png")); + private final ImageIcon NOT_VISIBLE = new ImageIcon(WiimoteCalibration.class.getResource("resources/icons/francisco-warning.png")); + private final Image CROSS_HAIR = new ImageIcon(WiimoteCalibration.class.getResource("resources/icons/francisco-crosshair.png")).getImage(); + + public CalibrationFrame() { + super("Calibration"); + setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); + setBackground(Color.WHITE); + ((JPanel)getContentPane()).setOpaque(true); + setLayout(null); + setUndecorated(true); + setAlwaysOnTop(true); + addKeyListener(new KeyAdapter() { + @Override + public void keyPressed(KeyEvent e) { + if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { + state = isAnyCalibrated(wiimotes) ? CalibrationState.DONE : CalibrationState.PENDING; + if (screen.getFullScreenWindow() == calibrationFrame) + screen.setFullScreenWindow(null); + setVisible(false); + notifyListener(CalibrationEvent.ABORTED); + } + } + }); + } + + private JLabel statusLabel(Icon icon, int id, int x, int y) { + JLabel l = new JLabel(icon, SwingConstants.LEFT); + if (wiimotes.size() > 1) l.setText(String.valueOf(id)); + int w = 100; + int h = icon.getIconHeight(); + x = x - icon.getIconWidth()/2; + y = y - wiimotes.size()*h/2; + l.setBounds(x, y + (id-1)*h, w, h); + return l; + } + + public void finished(CalibrationState s) { + int x = s.getX(bounds) - bounds.x; + int y = s.getY(bounds) - bounds.y; + + for (Wiimote wiimote : points.keySet()) { + add(statusLabel(points.get(wiimote).get(s) != null ? VISIBLE : NOT_VISIBLE, wiimote.getId(), x, y)); + } + + repaint(); + } + + public void reset() { + getContentPane().removeAll(); + JLabel info = Util.newComponent(JLabel.class, "infoLabel"); + info.setFont(info.getFont().deriveFont(20f)); + info.setHorizontalAlignment(SwingConstants.CENTER); + int w = bounds.width; + int h = 200; + info.setBounds(bounds.width/2 - w/2, bounds.height/3 - h/2, w, h); + add(info); + Util.getResourceMap(WiimoteCalibration.class).injectComponents(this); + } + + @Override + public void paint(Graphics g) { + super.paint(g); + ((Graphics2D) g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + + if (state != CalibrationState.DONE && state != CalibrationState.PENDING) { + int x = state.getX(bounds) - bounds.x; + int y = state.getY(bounds) - bounds.y; + g.drawImage(CROSS_HAIR, x - CROSS_HAIR.getWidth(null)/2 + 1, y - CROSS_HAIR.getHeight(null)/2 + 1, null); + } + } + + } + + public void start(Collection wiimotes) { + last.clear(); + points.clear(); + finals.clear(); + calibrationFrame.reset(); + stepChange = false; + sc = 0; + checkPoints = false; + state = CalibrationState.PENDING.getNext(); + + this.wiimotes = wiimotes; + for (Wiimote wiimote : wiimotes) { + points.put(wiimote, new LinkedHashMap()); + last.put(wiimote, new Point2D.Double(-1,-1)); + } + + if (screen == null) + setScreen(DEFAULT_SCREEN); + + if (Util.MAC_OS_X && screen == DEFAULT_SCREEN) + screen.setFullScreenWindow(calibrationFrame); + + calibrationFrame.repaint(); + calibrationFrame.setVisible(true); + notifyListener(CalibrationEvent.STARTED); + } + + public boolean inProgress() { + return !isPending() && !isDone(); + } + + public boolean isPending() { + return state == CalibrationState.PENDING; + } + + public boolean isDone() { + return state == CalibrationState.DONE; + } + + public Map getFinals() { + return finals; + } + + public boolean isCalibrated(Wiimote wiimote) { + return transformer.containsKey(wiimote.getAddress()); + } + + public boolean isAnyCalibrated(Collection wiimotes) { + for (Wiimote wiimote : wiimotes) { + if (isCalibrated(wiimote)) + return true; + } + return false; + } + + public boolean process(Map data) { + + if (inProgress()) { + + for (Wiimote wiimote : points.keySet()) { + Point2D lastP = last.get(wiimote); + Point2D currentP = data.get(wiimote)[0]; + + if (currentP != null && lastP.distance(currentP) > EPS) { + + points.get(wiimote).put(state, currentP); + last.put(wiimote, currentP); + stepChange = true; + } + } + + // process at least 5 points to not miss a signal + if (stepChange && ++sc > 5) { + sc = 0; + stepChange = false; + CalibrationState current = state; + state = state.getNext(); + calibrationFrame.finished(current); + + if (checkPoints || current == CalibrationState.REGULAR_END) { + checkPoints = true; + if (calculateQuadsForWiimotes()) { + // OK, calibration finished + state = CalibrationState.DONE; + calculateTransformation(); + if (screen.getFullScreenWindow() == calibrationFrame) + screen.setFullScreenWindow(null); + calibrationFrame.setVisible(false); + notifyListener(CalibrationEvent.FINISHED); + return true; + } else { + // Go on + } + } + } + + if (state == CalibrationState.DONE) { + // PROBLEM, no solution found + state = CalibrationState.PENDING; + if (screen.getFullScreenWindow() == calibrationFrame) + screen.setFullScreenWindow(null); + calibrationFrame.setVisible(false); + notifyListener(CalibrationEvent.ABORTED); + new Thread(new Runnable() { + public void run() { + JOptionPane.showMessageDialog(null, Util.getResourceMap(WiimoteCalibration.class).getString("coverageError"), Util.getResourceMap(WiimoteCalibration.class).getString("calibrationFailed"), JOptionPane.ERROR_MESSAGE); + } + }).start(); + } + + return true; + } + + return false; + } + + private static boolean checkExist(Map p, CalibrationState... states) { + for (CalibrationState s : states) { + if (p.get(s) == null) + return false; + } + return true; + } + + private boolean calculateQuadsForWiimotes() { + boolean success = true; + Set check = new HashSet(); + + for (Wiimote wiimote : points.keySet()) { + boolean ok = false; + + for (int i = 0; i < VALID_STATES.length; i++) { + if (checkExist(points.get(wiimote), VALID_STATES[i])) { + Map calibrated = points.get(wiimote); + CalibrationState[] states = VALID_STATES[i]; + check.addAll(Arrays.asList(states)); + finals.put(wiimote.getAddress(), new Double[] { + calibrated.get(states[0]).getX(), calibrated.get(states[0]).getY(), + calibrated.get(states[1]).getX(), calibrated.get(states[1]).getY(), + calibrated.get(states[2]).getX(), calibrated.get(states[2]).getY(), + calibrated.get(states[3]).getX(), calibrated.get(states[3]).getY(), + (double)states[0].getX(bounds), (double)states[0].getY(bounds), + (double)states[1].getX(bounds), (double)states[1].getY(bounds), + (double)states[2].getX(bounds), (double)states[2].getY(bounds), + (double)states[3].getX(bounds), (double)states[3].getY(bounds) + }); + ok = true; + break; + } + } + + success = success && ok; + } + // check also if the whole screen is covered + return success && check.containsAll(Arrays.asList(VALID_STATES[0])); + } + + private void calculateTransformation() { + transformer.clear(); + for (String address : finals.keySet()) { + Double[] d = finals.get(address); + transformer.put(address, PerspectiveTransform.getQuadToQuad(d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7], d[8], d[9], d[10], d[11], d[12], d[13], d[14], d[15])); + } + } + + public Map getTransformer() { + return transformer; + } + + public IRDot warp(int i, Wiimote wiimote, Map data) { + final PerspectiveTransform transform = transformer.get(wiimote.getAddress()); + if (transform == null || data.get(wiimote)[i] == null) return null; + else { + return (IRDot) transform.transform(data.get(wiimote)[i], new IRDot(data.get(wiimote)[i])); + } + } + + private Map warpIndividually(Map data) { + Map warped = new LinkedHashMap(); + IRDot[] p; + for (Wiimote wiimote : data.keySet()) { + warped.put(wiimote, p = new IRDot[4]); + for (int i = 0; i < 4; i++) { + p[i] = warp(i, wiimote, data); + } + } + return warped; + } + + public Point[] warp(Map data) { + Point[] warped = new Point[4]; + if (isDone() && isAnyCalibrated(data.keySet())) { + IRDot[][] cluster = PointClusterer.cluster(warpIndividually(data)); + + for (int i = 0; i < cluster.length; i++) { + if (cluster[i] == null) break; + double x = 0, y = 0; + int c = 0; + for (IRDot p : cluster[i]) { + x += p.getX(); + y += p.getY(); + c++; + break; + } + warped[i] = new Point((int) Math.round(x / c), (int) Math.round(y / c)); + } + } else { + System.err.println("Not calibrated."); + } + return warped; + } + + + public boolean load(InputStream is) throws IOException { + try { + BufferedReader in = new BufferedReader(new InputStreamReader(is)); + String address = null; + + while ((address = in.readLine()) != null) { + Double[] d = new Double[16]; + finals.put(address, d); + for (int i = 0; i < 4; i++) { + String[] p = in.readLine().split(" "); + for (int j = 0; j < 2; j++) { + d[i*2+j+0] = Double.valueOf(p[j+0]); + d[i*2+j+8] = Double.valueOf(p[j+2]); + } + } + } + + calculateTransformation(); + state = CalibrationState.DONE; + notifyListener(CalibrationEvent.LOADED); + return true; + + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + public void save(OutputStream os) throws IOException { + PrintStream out = new PrintStream(os); + + for (String address : finals.keySet()) { + out.print(address); + Double[] d = finals.get(address); + for (int i = 0; i < 4; i++) { + out.printf(Locale.ENGLISH, "\n%f %f %.0f %.0f", d[i*2+0+0], d[i*2+1+0], d[i*2+0+8], d[i*2+1+8]); + } + out.println(); + } + out.close(); + + notifyListener(CalibrationEvent.SAVED); + } + + + /* + * LISTENER + */ + + public void addCalibrationEventListener(CalibrationEventListener l) { + listener.add(l); + } + + public void removeCalibrationEventListener(CalibrationEventListener l) { + listener.remove(l); + } + + private void notifyListener(CalibrationEvent e) { + WiimoteWhiteboard.getLogger().info("Calibration Event: " + e); + for (CalibrationEventListener l : listener) { + l.calibrationEvent(e); + } + } + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/WiimoteCalibration.java~ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/WiimoteCalibration.java~ new file mode 100644 index 0000000..ce3e168 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/WiimoteCalibration.java~ @@ -0,0 +1,511 @@ +package org.mote.wiimote.whiteboard.calibration; +import java.awt.Color; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.GraphicsDevice; +import java.awt.GraphicsEnvironment; +import java.awt.Image; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.RenderingHints; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.awt.geom.Point2D; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.PrintStream; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.Locale; +import java.util.Map; +import java.util.Set; + +import javax.media.jai.PerspectiveTransform; +import javax.swing.Icon; +import javax.swing.ImageIcon; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.SwingConstants; + +import org.mote.wiimote.whiteboard.WiimoteWhiteboard; +import org.mote.wiimote.whiteboard.ds.IRDot; +import org.mote.wiimote.whiteboard.ds.Wiimote; +import org.mote.wiimote.whiteboard.util.Util; + +public class WiimoteCalibration { + + // list of all "rectangles" of the 3x3 calibration grid, larger to smaller + private static final CalibrationState[][] VALID_STATES = { + {CalibrationState.UPPER_LEFT, CalibrationState.UPPER_RIGHT, CalibrationState.LOWER_RIGHT, CalibrationState.LOWER_LEFT}, + {CalibrationState.UPPER_LEFT, CalibrationState.TOP_MIDDLE, CalibrationState.BOTTOM_MIDDLE, CalibrationState.LOWER_LEFT}, + {CalibrationState.TOP_MIDDLE, CalibrationState.UPPER_RIGHT, CalibrationState.LOWER_RIGHT, CalibrationState.BOTTOM_MIDDLE}, + {CalibrationState.UPPER_LEFT, CalibrationState.UPPER_RIGHT, CalibrationState.EAST_MIDDLE, CalibrationState.WEST_MIDDLE}, + {CalibrationState.WEST_MIDDLE, CalibrationState.EAST_MIDDLE, CalibrationState.LOWER_RIGHT, CalibrationState.LOWER_LEFT}, + {CalibrationState.WEST_MIDDLE, CalibrationState.CENTER, CalibrationState.BOTTOM_MIDDLE, CalibrationState.LOWER_LEFT}, + {CalibrationState.UPPER_LEFT, CalibrationState.TOP_MIDDLE, CalibrationState.CENTER, CalibrationState.WEST_MIDDLE}, + {CalibrationState.TOP_MIDDLE, CalibrationState.UPPER_RIGHT, CalibrationState.EAST_MIDDLE, CalibrationState.CENTER}, + {CalibrationState.CENTER, CalibrationState.EAST_MIDDLE, CalibrationState.LOWER_RIGHT, CalibrationState.BOTTOM_MIDDLE}, + }; + + public static final GraphicsDevice DEFAULT_SCREEN = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); + + public static enum CalibrationEvent { + SCREEN_CHANGED, STARTED, FINISHED, ABORTED, LOADED, SAVED; + }; + + public static interface CalibrationEventListener { + public void calibrationEvent(CalibrationEvent e); + } + + public static enum CalibrationState { + DONE(0, 0, null), CENTER(.5, .5, DONE), EAST_MIDDLE(.9, .5, CENTER), WEST_MIDDLE(.1, .5, EAST_MIDDLE), TOP_MIDDLE(.5, .1, WEST_MIDDLE), BOTTOM_MIDDLE(.5, .9, TOP_MIDDLE), LOWER_LEFT(.1, .9, BOTTOM_MIDDLE), LOWER_RIGHT(.9, .9, LOWER_LEFT), UPPER_RIGHT(.9, .1, LOWER_RIGHT), UPPER_LEFT(.1, .1, UPPER_RIGHT), PENDING(0, 0, UPPER_LEFT); + + public static final CalibrationState REGULAR_END = LOWER_LEFT; + private final double xMargin, yMargin; + private final CalibrationState next; + + private CalibrationState(double xMargin, double yMargin, CalibrationState next) { + this.xMargin = xMargin; + this.yMargin = yMargin; + this.next = next; + } + + public int getX(Rectangle bounds) { + return bounds.x + (int) Math.round(bounds.width * xMargin); + } + + public int getY(Rectangle bounds) { + return bounds.y + (int) Math.round(bounds.height * yMargin); + } + + public CalibrationState getNext() { + return next; + } + }; + + private static final double EPS = .05; + + private final CalibrationFrame calibrationFrame; + private final Set listener = new LinkedHashSet(); + + + private GraphicsDevice screen = null; + private int screenNumber = -1; + private Rectangle bounds; + private int sc = 0; + private boolean stepChange = false; + private boolean checkPoints = false; + private Collection wiimotes; + private CalibrationState state = CalibrationState.PENDING; + + // last calibration point for a wiimote, always non-null + private Map last = new HashMap(); + // transformer for wiimote + private Map transformer = new LinkedHashMap(); + // all visible calibration points for each wiimote (can be more than 4) + private Map> points = new LinkedHashMap>(); + // final 16 value double array (4<->4 mapping) for each wiimote, used to create transformer + private Map finals = new LinkedHashMap(); + + + + public WiimoteCalibration() { + calibrationFrame = new CalibrationFrame(); + } + + public boolean setScreen(GraphicsDevice screen) { + if (!inProgress()) { + this.screen = screen; + bounds = screen.getDefaultConfiguration().getBounds(); + calibrationFrame.setBounds(bounds); + + // get "screen number" + GraphicsDevice[] gds = GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices(); + for (int i = 0; i < gds.length; i++) { + if (gds[i] == screen) { + screenNumber = i + 1; + break; + } + } + + state = CalibrationState.PENDING; + transformer.clear(); + notifyListener(CalibrationEvent.SCREEN_CHANGED); + return true; + } else { + System.err.println("Calibration in Progress."); + return false; + } + } + + public GraphicsDevice getScreen() { + return screen; + } + + public int getScreenNumber() { + return screenNumber; + } + + @SuppressWarnings("serial") + private class CalibrationFrame extends JFrame { + private final ImageIcon VISIBLE = new ImageIcon(WiimoteCalibration.class.getResource("resources/icons/francisco-ok.png")); + private final ImageIcon NOT_VISIBLE = new ImageIcon(WiimoteCalibration.class.getResource("resources/icons/francisco-warning.png")); + private final Image CROSS_HAIR = new ImageIcon(WiimoteCalibration.class.getResource("resources/icons/francisco-crosshair.png")).getImage(); + + public CalibrationFrame() { + super("Calibration"); + setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); + setBackground(Color.WHITE); + ((JPanel)getContentPane()).setOpaque(true); + setLayout(null); + setUndecorated(true); + setAlwaysOnTop(true); + addKeyListener(new KeyAdapter() { + @Override + public void keyPressed(KeyEvent e) { + if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { + state = isAnyCalibrated(wiimotes) ? CalibrationState.DONE : CalibrationState.PENDING; + if (screen.getFullScreenWindow() == calibrationFrame) + screen.setFullScreenWindow(null); + setVisible(false); + notifyListener(CalibrationEvent.ABORTED); + } + } + }); + } + + private JLabel statusLabel(Icon icon, int id, int x, int y) { + JLabel l = new JLabel(icon, SwingConstants.LEFT); + if (wiimotes.size() > 1) l.setText(String.valueOf(id)); + int w = 100; + int h = icon.getIconHeight(); + x = x - icon.getIconWidth()/2; + y = y - wiimotes.size()*h/2; + l.setBounds(x, y + (id-1)*h, w, h); + return l; + } + + public void finished(CalibrationState s) { + int x = s.getX(bounds) - bounds.x; + int y = s.getY(bounds) - bounds.y; + + for (Wiimote wiimote : points.keySet()) { + add(statusLabel(points.get(wiimote).get(s) != null ? VISIBLE : NOT_VISIBLE, wiimote.getId(), x, y)); + } + + repaint(); + } + + public void reset() { + getContentPane().removeAll(); + JLabel info = Util.newComponent(JLabel.class, "infoLabel"); + info.setFont(info.getFont().deriveFont(20f)); + info.setHorizontalAlignment(SwingConstants.CENTER); + int w = bounds.width; + int h = 200; + info.setBounds(bounds.width/2 - w/2, bounds.height/3 - h/2, w, h); + add(info); + Util.getResourceMap(WiimoteCalibration.class).injectComponents(this); + } + + @Override + public void paint(Graphics g) { + super.paint(g); + ((Graphics2D) g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + + if (state != CalibrationState.DONE && state != CalibrationState.PENDING) { + int x = state.getX(bounds) - bounds.x; + int y = state.getY(bounds) - bounds.y; + g.drawImage(CROSS_HAIR, x - CROSS_HAIR.getWidth(null)/2 + 1, y - CROSS_HAIR.getHeight(null)/2 + 1, null); + } + } + + } + + public void start(Collection wiimotes) { + last.clear(); + points.clear(); + finals.clear(); + calibrationFrame.reset(); + stepChange = false; + sc = 0; + checkPoints = false; + state = CalibrationState.PENDING.getNext(); + + this.wiimotes = wiimotes; + for (Wiimote wiimote : wiimotes) { + points.put(wiimote, new LinkedHashMap()); + last.put(wiimote, new Point2D.Double(-1,-1)); + } + + if (screen == null) + setScreen(DEFAULT_SCREEN); + + if (Util.MAC_OS_X && screen == DEFAULT_SCREEN) + screen.setFullScreenWindow(calibrationFrame); + + calibrationFrame.repaint(); + calibrationFrame.setVisible(true); + notifyListener(CalibrationEvent.STARTED); + } + + public boolean inProgress() { + return !isPending() && !isDone(); + } + + public boolean isPending() { + return state == CalibrationState.PENDING; + } + + public boolean isDone() { + return state == CalibrationState.DONE; + } + + public Map getFinals() { + return finals; + } + + public boolean isCalibrated(Wiimote wiimote) { + return transformer.containsKey(wiimote.getAddress()); + } + + public boolean isAnyCalibrated(Collection wiimotes) { + for (Wiimote wiimote : wiimotes) { + if (isCalibrated(wiimote)) + return true; + } + return false; + } + + public boolean process(Map data) { + + if (inProgress()) { + + for (Wiimote wiimote : points.keySet()) { + Point2D lastP = last.get(wiimote); + Point2D currentP = data.get(wiimote)[0]; + + if (currentP != null && lastP.distance(currentP) > EPS) { + + points.get(wiimote).put(state, currentP); + last.put(wiimote, currentP); + stepChange = true; + } + } + + // process at least 5 points to not miss a signal + if (stepChange && ++sc > 5) { + sc = 0; + stepChange = false; + CalibrationState current = state; + state = state.getNext(); + calibrationFrame.finished(current); + + if (checkPoints || current == CalibrationState.REGULAR_END) { + checkPoints = true; + if (calculateQuadsForWiimotes()) { + // OK, calibration finished + state = CalibrationState.DONE; + calculateTransformation(); + if (screen.getFullScreenWindow() == calibrationFrame) + screen.setFullScreenWindow(null); + calibrationFrame.setVisible(false); + notifyListener(CalibrationEvent.FINISHED); + return true; + } else { + // Go on + } + } + } + + if (state == CalibrationState.DONE) { + // PROBLEM, no solution found + state = CalibrationState.PENDING; + if (screen.getFullScreenWindow() == calibrationFrame) + screen.setFullScreenWindow(null); + calibrationFrame.setVisible(false); + notifyListener(CalibrationEvent.ABORTED); + new Thread(new Runnable() { + public void run() { + JOptionPane.showMessageDialog(null, Util.getResourceMap(WiimoteCalibration.class).getString("coverageError"), Util.getResourceMap(WiimoteCalibration.class).getString("calibrationFailed"), JOptionPane.ERROR_MESSAGE); + } + }).start(); + } + + return true; + } + + return false; + } + + private static boolean checkExist(Map p, CalibrationState... states) { + for (CalibrationState s : states) { + if (p.get(s) == null) + return false; + } + return true; + } + + private boolean calculateQuadsForWiimotes() { + boolean success = true; + Set check = new HashSet(); + + for (Wiimote wiimote : points.keySet()) { + boolean ok = false; + + for (int i = 0; i < VALID_STATES.length; i++) { + if (checkExist(points.get(wiimote), VALID_STATES[i])) { + Map calibrated = points.get(wiimote); + CalibrationState[] states = VALID_STATES[i]; + check.addAll(Arrays.asList(states)); + finals.put(wiimote.getAddress(), new Double[] { + calibrated.get(states[0]).getX(), calibrated.get(states[0]).getY(), + calibrated.get(states[1]).getX(), calibrated.get(states[1]).getY(), + calibrated.get(states[2]).getX(), calibrated.get(states[2]).getY(), + calibrated.get(states[3]).getX(), calibrated.get(states[3]).getY(), + (double)states[0].getX(bounds), (double)states[0].getY(bounds), + (double)states[1].getX(bounds), (double)states[1].getY(bounds), + (double)states[2].getX(bounds), (double)states[2].getY(bounds), + (double)states[3].getX(bounds), (double)states[3].getY(bounds) + }); + ok = true; + break; + } + } + + success = success && ok; + } + // check also if the whole screen is covered + return success && check.containsAll(Arrays.asList(VALID_STATES[0])); + } + + private void calculateTransformation() { + transformer.clear(); + for (String address : finals.keySet()) { + Double[] d = finals.get(address); + transformer.put(address, PerspectiveTransform.getQuadToQuad(d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7], d[8], d[9], d[10], d[11], d[12], d[13], d[14], d[15])); + } + } + + public Map getTransformer() { + return transformer; + } + + public IRDot warp(int i, Wiimote wiimote, Map data) { + final PerspectiveTransform transform = transformer.get(wiimote.getAddress()); + if (transform == null || data.get(wiimote)[i] == null) return null; + else { + return (IRDot) transform.transform(data.get(wiimote)[i], new IRDot(data.get(wiimote)[i])); + } + } + + private Map warpIndividually(Map data) { + Map warped = new LinkedHashMap(); + IRDot[] p; + for (Wiimote wiimote : data.keySet()) { + warped.put(wiimote, p = new IRDot[4]); + for (int i = 0; i < 4; i++) { + p[i] = warp(i, wiimote, data); + } + } + return warped; + } + + public Point[] warp(Map data) { + Point[] warped = new Point[4]; + if (isDone() && isAnyCalibrated(data.keySet())) { + IRDot[][] cluster = PointClusterer.cluster(warpIndividually(data)); + + for (int i = 0; i < cluster.length; i++) { + if (cluster[i] == null) break; + double x = 0, y = 0; + int c = 0; + for (IRDot p : cluster[i]) { + x += p.getX(); + y += p.getY(); + c++; + break; + } + warped[i] = new Point((int) Math.round(x / c), (int) Math.round(y / c)); + } + } else { + System.err.println("Not calibrated."); + } + return warped; + } + + + public boolean load(InputStream is) throws IOException { + try { + BufferedReader in = new BufferedReader(new InputStreamReader(is)); + String address = null; + + while ((address = in.readLine()) != null) { + Double[] d = new Double[16]; + finals.put(address, d); + for (int i = 0; i < 4; i++) { + String[] p = in.readLine().split(" "); + for (int j = 0; j < 2; j++) { + d[i*2+j+0] = Double.valueOf(p[j+0]); + d[i*2+j+8] = Double.valueOf(p[j+2]); + } + } + } + + calculateTransformation(); + state = CalibrationState.DONE; + notifyListener(CalibrationEvent.LOADED); + return true; + + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + public void save(OutputStream os) throws IOException { + PrintStream out = new PrintStream(os); + + for (String address : finals.keySet()) { + out.print(address); + Double[] d = finals.get(address); + for (int i = 0; i < 4; i++) { + out.printf(Locale.ENGLISH, "\n%f %f %.0f %.0f", d[i*2+0+0], d[i*2+1+0], d[i*2+0+8], d[i*2+1+8]); + } + out.println(); + } + out.close(); + + notifyListener(CalibrationEvent.SAVED); + } + + + /* + * LISTENER STUFF + */ + + public void addCalibrationEventListener(CalibrationEventListener l) { + listener.add(l); + } + + public void removeCalibrationEventListener(CalibrationEventListener l) { + listener.remove(l); + } + + private void notifyListener(CalibrationEvent e) { + WiimoteWhiteboard.getLogger().info("Calibration Event: " + e); + for (CalibrationEventListener l : listener) { + l.calibrationEvent(e); + } + } + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/WiimoteCalibration.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/WiimoteCalibration.properties new file mode 100644 index 0000000..56d51ee --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/WiimoteCalibration.properties @@ -0,0 +1,4 @@ +infoLabel.text =

Press ESC to abort calibration.

Make sure all connected Wiimotes can see the screen.
+ +calibrationFailed = Calibration failed +coverageError = The Wiimotes don't seem to cover the whole screen.${nl}Try to reposition them and start again. diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/WiimoteCalibration_de.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/WiimoteCalibration_de.properties new file mode 100644 index 0000000..3046acc --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/WiimoteCalibration_de.properties @@ -0,0 +1,8 @@ +#:1265226421,Uwe + +infoLabel.text=
Dr\u00fccke ESC um die Kalibrierung abzubrechen.

Achte darauf dass alle Wiimotes den Bildschirm gut sehen k\u00f6nnen.
+ +calibrationFailed=Kalibrierung fehlgeschlagen + +coverageError=Die Wiimotes scheinen nicht den gesamten Bildschirm abzudecken.${nl}Versuche sie neu zu positionieren und starte dann nochmal. + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/WiimoteCalibration_es.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/WiimoteCalibration_es.properties new file mode 100644 index 0000000..8756385 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/WiimoteCalibration_es.properties @@ -0,0 +1,8 @@ +#:1224248803,Uwe + +infoLabel.text=
Oprime ESC para cancelar calibraci\u00f3n.

Aseg\u00farese de que todos los Wiimotes puedan ver la pantalla.
+ +calibrationFailed=La calibraci\u00f3n fallo + +coverageError=Los Wiimotes no parecen cubrir la pantalla entera.${nl}Cambien la posici\u00f3n de los Wiimotes y reinicie la calibraci\u00f3n. + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/WiimoteCalibration_et.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/WiimoteCalibration_et.properties new file mode 100644 index 0000000..d16bd34 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/WiimoteCalibration_et.properties @@ -0,0 +1,8 @@ +#:1248454359,Marko + +infoLabel.text=
Vajuta ESC klahvi kui soovid kalibreerimist katkestada.

Veendu, et k\u00f5ik Wii puldid n\u00e4evad kogu ekraani.
+ +calibrationFailed=Kalibreerimine eba\u00f5nnestus + +coverageError=K\u00f5ik Wii puldid ei n\u00e4e kogu ekraani.${nl}Proovi pultide asendit korrigeerida ning alusta kalibreerimist uuesti. + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/WiimoteCalibration_fr.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/WiimoteCalibration_fr.properties new file mode 100644 index 0000000..e6ae160 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/WiimoteCalibration_fr.properties @@ -0,0 +1,8 @@ +#:1265226429,Uwe + +infoLabel.text=
Presser ESC pour annuler la calibration.

V\u00e9rifier que toutes les Wiimotes connect\u00e9s peuvent capter l'\u00e9cran.
+ +calibrationFailed=La calibration a \u00e9chou\u00e9 + +coverageError=Les Wiimotes ne semblent pas capter la totalit\u00e9 de l'\u00e9cran.${nl}Essayer de les placer mieux et red\u00e9marrer la calibration. + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/WiimoteCalibration_in.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/WiimoteCalibration_in.properties new file mode 100644 index 0000000..e19c382 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/WiimoteCalibration_in.properties @@ -0,0 +1,8 @@ +#:1274618479,Bobby + +infoLabel.text=
Tekan ESC untuk membatalkan Kalibrasi.

Pastikan semua Wiimotes yang terhubung dapat melihat layar.
+ +calibrationFailed=Kalibrasi gagal + +coverageError=Wiimotes nampaknya tidak dapat melihat keseluruhan layar.${nl}Coba ubah posisinya dan mulai lagi dari awal. + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/WiimoteCalibration_it.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/WiimoteCalibration_it.properties new file mode 100644 index 0000000..ce1a7fc --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/WiimoteCalibration_it.properties @@ -0,0 +1,8 @@ +#:1240167662,Uwe + +infoLabel.text=
Premi ESC per interrompere la calibrazione.

Assicurati che tutti i Wiimote connessi possano "vedere" lo schermo.
+ +calibrationFailed=Calibrazione fallita + +coverageError=Il Wiimote non sembra coprire l'intero schermo.${nl}Prova a riposizionarlo, e ritenta. + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/WiimoteCalibration_pl.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/WiimoteCalibration_pl.properties new file mode 100644 index 0000000..1e6f399 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/WiimoteCalibration_pl.properties @@ -0,0 +1,9 @@ +#:1253207960,Grzegorz + +# Wiimote = Wiilot in Polish +infoLabel.text=
Naci\u015bnij ESC aby przerwa\u0107 kalibracj\u0119.

Sprawd\u017a czy wszystkie pod\u0142\u0105czone Wiiloty widz\u0105 ekran.
+ +calibrationFailed=Kalibracja nie powiod\u0142a si\u0119 + +coverageError=Wiiloty nie obejmuj\u0105 ca\u0142ego ekranu. Zmie\u0144 ich pozycj\u0119 i spr\u00f3buj ponownie. + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/WiimoteCalibration_pt.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/WiimoteCalibration_pt.properties new file mode 100644 index 0000000..6c455c0 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/WiimoteCalibration_pt.properties @@ -0,0 +1,8 @@ +#:1224248742,Uwe + +infoLabel.text=
Pressione ESC para abortar a calibra\u00e7\u00e3o.

Certifique-se que todos os Wiimotes conseguem ver o ecr\u00e3.
+ +calibrationFailed=Calibra\u00e7\u00e3o n\u00e3o efectuada + +coverageError=Os Wiimotes parecem n\u00e3o abranger toda a \u00e1rea do ecr\u00e3.${nl}Tente outra posi\u00e7\u00e3o e recomece. + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/WiimoteCalibration_ru.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/WiimoteCalibration_ru.properties new file mode 100644 index 0000000..b4892c6 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/WiimoteCalibration_ru.properties @@ -0,0 +1,8 @@ +#:1265227045,Uwe + +infoLabel.text=
\u041d\u0430\u0436\u043c\u0438\u0442\u0435 ESC \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0435\u0440\u0432\u0430\u0442\u044c \u043a\u0430\u043b\u0438\u0431\u0440\u043e\u0432\u043a\u0443.

\u0423\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u0432\u0441\u0435 \u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u043d\u044b\u0435 Wiimot'\u044b \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u044b \u043d\u0430 \u044d\u043a\u0440\u0430\u043d.
+ +calibrationFailed=\u041a\u0430\u043b\u0438\u0431\u0440\u043e\u0432\u043a\u0430 \u043d\u0435 \u0443\u0434\u0430\u043b\u0430\u0441\u044c + +coverageError=Wiimote \u043d\u0435 \u0432\u0438\u0434\u0438\u0442 \u0432\u0435\u0441\u044c \u044d\u043a\u0440\u0430\u043d \u0446\u0435\u043b\u0438\u043a\u043e\u043c.${nl}\u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0435\u0433\u043e \u0438 \u043d\u0430\u0447\u043d\u0438\u0442\u0435 \u043a\u0430\u043b\u0438\u0431\u0440\u043e\u0432\u043a\u0443 \u0441\u043d\u043e\u0432\u0430. + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/WiimoteCalibration_sl.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/WiimoteCalibration_sl.properties new file mode 100644 index 0000000..1023f45 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/WiimoteCalibration_sl.properties @@ -0,0 +1,8 @@ +#:1238601406,Samo + +infoLabel.text=
\u010ce \u017eelite prekiniti kalibracijo, pritisnite tipko ESC.

Poskrbite, da bodo vsi priklu\u010deni Wiimoti videli ekran ali projekcijsko povr\u0161ino.
+ +calibrationFailed=Povezava ni uspela + +coverageError=Senzorji Wiimotov ne zaznavajo celotnega ekrana ali projekcijske povr\u0161ine. ${nl}Postavite jih druga\u010de in poskusite znova. + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/icons/francisco-crosshair.png b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/icons/francisco-crosshair.png new file mode 100644 index 0000000..fa11606 Binary files /dev/null and b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/icons/francisco-crosshair.png differ diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/icons/francisco-ok.png b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/icons/francisco-ok.png new file mode 100644 index 0000000..52099b0 Binary files /dev/null and b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/icons/francisco-ok.png differ diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/icons/francisco-warning.png b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/icons/francisco-warning.png new file mode 100644 index 0000000..f2d37df Binary files /dev/null and b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/icons/francisco-warning.png differ diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/icons/ok.png b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/icons/ok.png new file mode 100644 index 0000000..696f944 Binary files /dev/null and b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/icons/ok.png differ diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/icons/warning.png b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/icons/warning.png new file mode 100644 index 0000000..2f0c0fa Binary files /dev/null and b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/calibration/resources/icons/warning.png differ diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/ds/IRDot.java b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/ds/IRDot.java new file mode 100644 index 0000000..aacafca --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/ds/IRDot.java @@ -0,0 +1,47 @@ +package org.mote.wiimote.whiteboard.ds; + +import java.awt.geom.Point2D; + +import wiiremotej.IRLight; + +public class IRDot extends Point2D.Double { + + private final int id; + private double size; + + public IRDot(int id, double x, double y, double size) { + super(x, y); + this.id = id; + this.size = size; + } + + public IRDot(IRDot dot) { + this(dot.getId(), dot.getX(), dot.getY(), dot.getSize()); + } + + public IRDot(int id, IRLight light) { + this(id, light.getX(), light.getY(), light.getSize()); + } + + @Override + public String toString() { + return String.format("[Dot%d: x = %.2f, y = %.2f, s = %.2f]", id, x, y, size); + } + + public double getSize() { + return size; + } + + public int getId() { + return id; + } + + public static IRDot[] getIRDots(IRLight[] lights) { + IRDot[] dots = new IRDot[lights.length]; + for (int i = 0; i < lights.length; i++) { + dots[i] = lights[i] == null ? null : new IRDot(i, lights[i]); + } + return dots; + } + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/ds/IRDot.java~ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/ds/IRDot.java~ new file mode 100644 index 0000000..0314594 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/ds/IRDot.java~ @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2008-2009, Uwe Schmidt + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * The Software uses a third-party library (WiiRemoteJ) which is not part of + * the Software and is subject to its own license. + */ + +package org.uweschmidt.wiimote.whiteboard.ds; + +import java.awt.geom.Point2D; + +import wiiremotej.IRLight; + +public class IRDot extends Point2D.Double { + + private final int id; + private double size; + + public IRDot(int id, double x, double y, double size) { + super(x, y); + this.id = id; + this.size = size; + } + + public IRDot(IRDot dot) { + this(dot.getId(), dot.getX(), dot.getY(), dot.getSize()); + } + + public IRDot(int id, IRLight light) { + this(id, light.getX(), light.getY(), light.getSize()); + } + + @Override + public String toString() { + return String.format("[Dot%d: x = %.2f, y = %.2f, s = %.2f]", id, x, y, size); + } + + public double getSize() { + return size; + } + + public int getId() { + return id; + } + + public static IRDot[] getIRDots(IRLight[] lights) { + IRDot[] dots = new IRDot[lights.length]; + for (int i = 0; i < lights.length; i++) { + dots[i] = lights[i] == null ? null : new IRDot(i, lights[i]); + } + return dots; + } + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/ds/Wiimote.java b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/ds/Wiimote.java new file mode 100644 index 0000000..f745305 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/ds/Wiimote.java @@ -0,0 +1,23 @@ +package org.mote.wiimote.whiteboard.ds; + +import wiiremotej.WiiRemote; + +public class Wiimote { + private final WiiRemote wiiremote; + private final String address; + private final int id; + public Wiimote(WiiRemote wiiremote, String address, int id) { + this.wiiremote = wiiremote; + this.address = address; + this.id = id; + } + public WiiRemote getWiiRemote() { + return wiiremote; + } + public String getAddress() { + return address; + } + public int getId() { + return id; + } +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/ds/Wiimote.java~ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/ds/Wiimote.java~ new file mode 100644 index 0000000..db8ad49 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/ds/Wiimote.java~ @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2008-2009, Uwe Schmidt + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * The Software uses a third-party library (WiiRemoteJ) which is not part of + * the Software and is subject to its own license. + */ + +package org.uweschmidt.wiimote.whiteboard.ds; + +import wiiremotej.WiiRemote; + +public class Wiimote { + private final WiiRemote wiiremote; + private final String address; + private final int id; + public Wiimote(WiiRemote wiiremote, String address, int id) { + this.wiiremote = wiiremote; + this.address = address; + this.id = id; + } + public WiiRemote getWiiRemote() { + return wiiremote; + } + public String getAddress() { + return address; + } + public int getId() { + return id; + } +} \ No newline at end of file diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/AboutWindow.java b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/AboutWindow.java new file mode 100644 index 0000000..f297f4a --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/AboutWindow.java @@ -0,0 +1,72 @@ +package org.mote.wiimote.whiteboard.gui; + +import java.awt.BorderLayout; +import java.awt.Font; +import java.net.URL; + +import javax.swing.JDialog; +import javax.swing.JEditorPane; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.event.HyperlinkEvent; +import javax.swing.event.HyperlinkListener; + +import net.miginfocom.swing.MigLayout; + +import org.jdesktop.application.Action; +import org.jdesktop.application.Application; +import org.mote.wiimote.whiteboard.WiimoteWhiteboard; +import org.mote.wiimote.whiteboard.util.BareBonesBrowserLaunch; +import org.mote.wiimote.whiteboard.util.Util; + +@SuppressWarnings("serial") +public class AboutWindow extends JDialog implements HyperlinkListener { + + public AboutWindow() { + super(Application.getInstance(WiimoteWhiteboard.class).getMainFrame()); + if (!Util.INSIDE_APP_BUNDLE) { + setName("aboutWindow"); + setLayout(new BorderLayout()); + final JPanel appPane = Util.newComponent(JPanel.class, "appPane"); + add(appPane, BorderLayout.NORTH); + appPane.setLayout(new MigLayout("insets i", "[center|center]")); + + JLabel appLabel = new JLabel(String.format("%s %s", WiimoteWhiteboard.getProperty("id"), WiimoteWhiteboard.getProperty("version"))); + appLabel.setFont(appLabel.getFont().deriveFont(Font.BOLD, 14f)); + JLabel crLabel = new JLabel(Util.getResourceMap(AboutWindow.class).getString("copyRight", WiimoteWhiteboard.getProperty("year"), WiimoteWhiteboard.getProperty("author"))); + crLabel.setFont(appLabel.getFont().deriveFont(10f)); + + appPane.add(appLabel, "flowy, split 2"); + appPane.add(crLabel, ""); + appPane.add(new JLabel(Util.getResourceMap(WiimoteWhiteboard.class).getImageIcon("icon")), "flowx, wrap"); + + try { + + JEditorPane tp = Util.newComponent(JEditorPane.class, "infoPane"); + tp.addHyperlinkListener(this); + + add(new JScrollPane(tp), BorderLayout.CENTER); + + Util.getResourceMap(AboutWindow.class).injectComponents(this); + + setResizable(false); + Util.placeDialogWindow(this, 295, 348); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + + public void hyperlinkUpdate(HyperlinkEvent e) { + if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { + + } + } + + @Action + public void about() { + setVisible(true); + } + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/AboutWindow.java~ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/AboutWindow.java~ new file mode 100644 index 0000000..0173846 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/AboutWindow.java~ @@ -0,0 +1,72 @@ +package org.mote.wiimote.whiteboard.gui; + +import java.awt.BorderLayout; +import java.awt.Font; +import java.net.URL; + +import javax.swing.JDialog; +import javax.swing.JEditorPane; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.event.HyperlinkEvent; +import javax.swing.event.HyperlinkListener; + +import net.miginfocom.swing.MigLayout; + +import org.jdesktop.application.Action; +import org.jdesktop.application.Application; +import org.mote.wiimote.whiteboard.WiimoteWhiteboard; +import org.mote.wiimote.whiteboard.util.BareBonesBrowserLaunch; +import org.mote.wiimote.whiteboard.util.Util; + +@SuppressWarnings("serial") +public class AboutWindow extends JDialog implements HyperlinkListener { + + public AboutWindow() { + super(Application.getInstance(WiimoteWhiteboard.class).getMainFrame()); + if (!Util.INSIDE_APP_BUNDLE) { + setName("aboutWindow"); + setLayout(new BorderLayout()); + final JPanel appPane = Util.newComponent(JPanel.class, "appPane"); + add(appPane, BorderLayout.NORTH); + appPane.setLayout(new MigLayout("insets i", "[center|center]")); + + JLabel appLabel = new JLabel(String.format("%s %s", WiimoteWhiteboard.getProperty("id"), WiimoteWhiteboard.getProperty("version"))); + appLabel.setFont(appLabel.getFont().deriveFont(Font.BOLD, 14f)); + JLabel crLabel = new JLabel(Util.getResourceMap(AboutWindow.class).getString("copyRight", WiimoteWhiteboard.getProperty("year"), WiimoteWhiteboard.getProperty("author"))); + crLabel.setFont(appLabel.getFont().deriveFont(10f)); + + appPane.add(appLabel, "flowy, split 2"); + appPane.add(crLabel, ""); + appPane.add(new JLabel(Util.getResourceMap(WiimoteWhiteboard.class).getImageIcon("icon")), "flowx, wrap"); + + try { + URL url = AboutWindow.class.getResource("resources/Credits.html"); + JEditorPane tp = Util.newComponent(JEditorPane.class, "infoPane"); + tp.addHyperlinkListener(this); + tp.setPage(url); + add(new JScrollPane(tp), BorderLayout.CENTER); + + Util.getResourceMap(AboutWindow.class).injectComponents(this); + + setResizable(false); + Util.placeDialogWindow(this, 295, 348); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + + public void hyperlinkUpdate(HyperlinkEvent e) { + if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { + BareBonesBrowserLaunch.openURL(e.getURL().toString()); + } + } + + @Action + public void about() { + setVisible(true); + } + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/CalibrationInfoWindow.java b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/CalibrationInfoWindow.java new file mode 100644 index 0000000..3f0c27e --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/CalibrationInfoWindow.java @@ -0,0 +1,267 @@ +package org.mote.wiimote.whiteboard.gui; + +import java.awt.Color; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Point; +import java.awt.RenderingHints; +import java.awt.SystemColor; +import java.awt.event.ComponentAdapter; +import java.awt.event.ComponentEvent; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.util.Map; +import java.util.Timer; +import java.util.TimerTask; + +import javax.swing.BorderFactory; +import javax.swing.JDialog; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JProgressBar; + +import net.miginfocom.swing.MigLayout; + +import org.jdesktop.application.Action; +import org.jdesktop.application.Application; +import org.mote.wiimote.whiteboard.WiimoteDataHandler; +import org.mote.wiimote.whiteboard.WiimoteWhiteboard; +import org.mote.wiimote.whiteboard.WiimoteDataHandler.WiimoteDataListener; +import org.mote.wiimote.whiteboard.calibration.WiimoteCalibration; +import org.mote.wiimote.whiteboard.calibration.WiimoteCalibration.CalibrationEvent; +import org.mote.wiimote.whiteboard.calibration.WiimoteCalibration.CalibrationEventListener; +import org.mote.wiimote.whiteboard.ds.IRDot; +import org.mote.wiimote.whiteboard.ds.Wiimote; +import org.mote.wiimote.whiteboard.preferences.WWPreferences; +import org.mote.wiimote.whiteboard.util.Util; + +@SuppressWarnings("serial") +public class CalibrationInfoWindow extends JDialog implements CalibrationEventListener, WiimoteDataListener { + + private static class WiimoteWrapper { + @SuppressWarnings("unused") + private int idx; + private JPanel panel; + private WiimoteIcon icon; + private JProgressBar trackingUtility; + private Double d[]; + private IRDot[] lights = new IRDot[4]; + private void setVisible(boolean visible) { + panel.setVisible(visible); + icon.setVisible(visible); + trackingUtility.setVisible(visible); + } + } + + private static final long REPAINT_FREQ = 1000 / 25; + + private static final Color CALIBRATED_COLOR = SystemColor.textHighlight; + private static final Color TRACKING_COLOR = SystemColor.text; + + private static final Color COLORS[] = {Color.blue, Color.red, Color.green, Color.orange, Color.black, Color.cyan, Color.magenta, Color.pink}; + + private WiimoteWrapper ww[] = new WiimoteWrapper[WWPreferences.WIIMOTES]; + private WiimoteCalibration calibration; + private WiimoteDataHandler dh; + private boolean calibrated = false; + +// private Matrix F; + + + public CalibrationInfoWindow(WiimoteCalibration calibration, WiimoteDataHandler dh) { + super(Application.getInstance(WiimoteWhiteboard.class).getMainFrame(), Util.getResourceMap(CalibrationInfoWindow.class).getString("info.Action.text")); + getRootPane().putClientProperty("Window.style", "small"); + this.calibration = calibration; + this.dh = dh; + calibration.addCalibrationEventListener(this); + dh.addWiimoteDataListener(this); + setLayout(new MigLayout("hidemode 3")); + // info labels + final JLabel taLabel = Util.newComponent(JLabel.class, "trackingAreaLabel"); + final JLabel csLabel = Util.newComponent(JLabel.class, "calibratedScreenLabel"); + taLabel.setBorder(BorderFactory.createLineBorder(Color.lightGray)); + csLabel.setBorder(BorderFactory.createLineBorder(Color.lightGray)); + taLabel.setBackground(TRACKING_COLOR); + csLabel.setBackground(CALIBRATED_COLOR); + taLabel.setForeground(SystemColor.textText); + csLabel.setForeground(SystemColor.textHighlightText); + add(taLabel, "sg 1, split, span, growx, pushx"); + add(csLabel, "sg 1, gapbefore 0, growx, pushx, wrap"); + + for (int i = 0; i < ww.length; i++) { + ww[i] = new WiimoteWrapper(); + ww[i].idx = i; + ww[i].icon = new WiimoteIcon(i+1); + ww[i].icon.displayConnected(true); + add(ww[i].panel = new InfoPanel(ww[i]), "flowy, w 400, h 300, grow, push"); + add(ww[i].icon, "cell "+i+" 1, growx, pushx"); + add(ww[i].trackingUtility = Util.newComponent(JProgressBar.class, "trackingUtility"), "cell "+i+" 1, growx, pushx"); + ww[i].setVisible(i == 0); + } + + addKeyListener(new KeyAdapter() { + @Override + public void keyPressed(KeyEvent e) { + if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { + setVisible(false); + } + } + }); + + addComponentListener(new ComponentAdapter() { + @Override + public void componentMoved(ComponentEvent e) { + componentResized(null); + } + @Override + public void componentResized(ComponentEvent e) { + repaintPanels(); + } + }); + + + Util.getResourceMap(CalibrationInfoWindow.class).injectComponents(this); + pack(); + Util.placeDialogWindow(this, getWidth(), getHeight()); + new Timer(true).schedule(new UpdateTask(), 0, REPAINT_FREQ); + } + + private class UpdateTask extends TimerTask { + @Override + public void run() { + if (isVisible()) { + repaintPanels(); + } + } + } + + private void repaintPanels() { + for (WiimoteWrapper wrapper : ww) { + if (wrapper.panel.isVisible()) + wrapper.panel.repaint(); + } + } + + @Action(enabledProperty="calibrated") + public void info() { + setVisible(true); + } + + public boolean isCalibrated() { + return calibrated; + } + + private void updateCalibrated() { + final boolean old = calibrated; + calibrated = dh.isConnected() && calibration.isDone() && calibration.isAnyCalibrated(dh.getConnectedWiimotes()); + firePropertyChange("calibrated", old, calibrated); + } + + public void calibrationEvent(CalibrationEvent e) { + switch (e) { + case LOADED: + update(); + case FINISHED: + update(); + break; + case SCREEN_CHANGED: + case STARTED: + case ABORTED: + case SAVED: + } + updateCalibrated(); + if (!isCalibrated()) + setVisible(false); + } + + public void batteryLevel(Wiimote wiimote, double level) {} + public void irLights(Wiimote wiimote, IRDot[] lights) { + ww[wiimote.getId()-1].lights = lights; + } + public void irWarped(Map data, Point[] warped) {} + public void wiimoteConnected(Wiimote wiimote) { + update(); + updateCalibrated(); + } + public void wiimoteDisconnected(Wiimote wiimote) {} + + private int r(double d) { + return (int)Math.round(d); + } + + private void update() { + Map finals = calibration.getFinals(); + + + + for (Wiimote wiimote : dh.getConnectedWiimotes()) { + WiimoteWrapper w = ww[wiimote.getId()-1]; + if (!calibration.isCalibrated(wiimote)) continue; + + w.d = finals.get(wiimote.getAddress()); + + double x0 = w.d[0]*1024, y0 = w.d[1]*768; + double x1 = w.d[2]*1024, y1 = w.d[3]*768; + double x3 = w.d[4]*1024, y3 = w.d[5]*768; + double x2 = w.d[6]*1024, y2 = w.d[7]*768; + double idealArea = 0.8 * 1024 * 0.8 * 768; + double calibratedArea = 0.5 * (Math.abs( + (x1 - x2) * (y0 - y3) - (x0 - x3) * (y1 - y2) + )); + + w.trackingUtility.setValue(r(calibratedArea)); + w.trackingUtility.setString(Util.getResourceMap(CalibrationInfoWindow.class).getString("trackingUtilString", 100 * (calibratedArea / idealArea))); + + if (!w.panel.isVisible()) { + w.setVisible(true); + pack(); + Util.placeDialogWindow(this, getWidth(), getHeight()); + } + } + repaintPanels(); + } + + private class InfoPanel extends JPanel { + private static final int DIAMETER = 6; + private WiimoteWrapper wrapper; + public InfoPanel(WiimoteWrapper wrapper) { + this.wrapper = wrapper; + setLayout(null); + setOpaque(true); + setBackground(TRACKING_COLOR); + setBorder(BorderFactory.createLineBorder(SystemColor.lightGray)); + } + @Override + protected void paintComponent(Graphics g) { + super.paintComponent(g); + if (wrapper.d != null) { + Graphics2D g2d = (Graphics2D)g; + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + final int w = getWidth(); + final int h = getHeight(); + int x[] = new int[5], y[] = new int[5]; + for (int i = 0; i < 4; i++) { + x[i] = r(wrapper.d[2*i]*w); + y[i] = r(h-wrapper.d[2*i+1]*h); + } + x[4] = x[0]; y[4] = y[0]; + + g2d.setColor(CALIBRATED_COLOR); + g2d.fillPolygon(x, y, 5); + + + for (int i = 0; i < 4; i++) { + IRDot dot = wrapper.lights[i]; + if (dot != null) { + g2d.setColor(COLORS[i]); + + g2d.fillOval(r(w*dot.x)-DIAMETER/2, r(h-h*dot.y)-DIAMETER/2, DIAMETER, DIAMETER); + + } + } + } + } + } + + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/CalibrationInfoWindow.java~ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/CalibrationInfoWindow.java~ new file mode 100644 index 0000000..3f0c27e --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/CalibrationInfoWindow.java~ @@ -0,0 +1,267 @@ +package org.mote.wiimote.whiteboard.gui; + +import java.awt.Color; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Point; +import java.awt.RenderingHints; +import java.awt.SystemColor; +import java.awt.event.ComponentAdapter; +import java.awt.event.ComponentEvent; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.util.Map; +import java.util.Timer; +import java.util.TimerTask; + +import javax.swing.BorderFactory; +import javax.swing.JDialog; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JProgressBar; + +import net.miginfocom.swing.MigLayout; + +import org.jdesktop.application.Action; +import org.jdesktop.application.Application; +import org.mote.wiimote.whiteboard.WiimoteDataHandler; +import org.mote.wiimote.whiteboard.WiimoteWhiteboard; +import org.mote.wiimote.whiteboard.WiimoteDataHandler.WiimoteDataListener; +import org.mote.wiimote.whiteboard.calibration.WiimoteCalibration; +import org.mote.wiimote.whiteboard.calibration.WiimoteCalibration.CalibrationEvent; +import org.mote.wiimote.whiteboard.calibration.WiimoteCalibration.CalibrationEventListener; +import org.mote.wiimote.whiteboard.ds.IRDot; +import org.mote.wiimote.whiteboard.ds.Wiimote; +import org.mote.wiimote.whiteboard.preferences.WWPreferences; +import org.mote.wiimote.whiteboard.util.Util; + +@SuppressWarnings("serial") +public class CalibrationInfoWindow extends JDialog implements CalibrationEventListener, WiimoteDataListener { + + private static class WiimoteWrapper { + @SuppressWarnings("unused") + private int idx; + private JPanel panel; + private WiimoteIcon icon; + private JProgressBar trackingUtility; + private Double d[]; + private IRDot[] lights = new IRDot[4]; + private void setVisible(boolean visible) { + panel.setVisible(visible); + icon.setVisible(visible); + trackingUtility.setVisible(visible); + } + } + + private static final long REPAINT_FREQ = 1000 / 25; + + private static final Color CALIBRATED_COLOR = SystemColor.textHighlight; + private static final Color TRACKING_COLOR = SystemColor.text; + + private static final Color COLORS[] = {Color.blue, Color.red, Color.green, Color.orange, Color.black, Color.cyan, Color.magenta, Color.pink}; + + private WiimoteWrapper ww[] = new WiimoteWrapper[WWPreferences.WIIMOTES]; + private WiimoteCalibration calibration; + private WiimoteDataHandler dh; + private boolean calibrated = false; + +// private Matrix F; + + + public CalibrationInfoWindow(WiimoteCalibration calibration, WiimoteDataHandler dh) { + super(Application.getInstance(WiimoteWhiteboard.class).getMainFrame(), Util.getResourceMap(CalibrationInfoWindow.class).getString("info.Action.text")); + getRootPane().putClientProperty("Window.style", "small"); + this.calibration = calibration; + this.dh = dh; + calibration.addCalibrationEventListener(this); + dh.addWiimoteDataListener(this); + setLayout(new MigLayout("hidemode 3")); + // info labels + final JLabel taLabel = Util.newComponent(JLabel.class, "trackingAreaLabel"); + final JLabel csLabel = Util.newComponent(JLabel.class, "calibratedScreenLabel"); + taLabel.setBorder(BorderFactory.createLineBorder(Color.lightGray)); + csLabel.setBorder(BorderFactory.createLineBorder(Color.lightGray)); + taLabel.setBackground(TRACKING_COLOR); + csLabel.setBackground(CALIBRATED_COLOR); + taLabel.setForeground(SystemColor.textText); + csLabel.setForeground(SystemColor.textHighlightText); + add(taLabel, "sg 1, split, span, growx, pushx"); + add(csLabel, "sg 1, gapbefore 0, growx, pushx, wrap"); + + for (int i = 0; i < ww.length; i++) { + ww[i] = new WiimoteWrapper(); + ww[i].idx = i; + ww[i].icon = new WiimoteIcon(i+1); + ww[i].icon.displayConnected(true); + add(ww[i].panel = new InfoPanel(ww[i]), "flowy, w 400, h 300, grow, push"); + add(ww[i].icon, "cell "+i+" 1, growx, pushx"); + add(ww[i].trackingUtility = Util.newComponent(JProgressBar.class, "trackingUtility"), "cell "+i+" 1, growx, pushx"); + ww[i].setVisible(i == 0); + } + + addKeyListener(new KeyAdapter() { + @Override + public void keyPressed(KeyEvent e) { + if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { + setVisible(false); + } + } + }); + + addComponentListener(new ComponentAdapter() { + @Override + public void componentMoved(ComponentEvent e) { + componentResized(null); + } + @Override + public void componentResized(ComponentEvent e) { + repaintPanels(); + } + }); + + + Util.getResourceMap(CalibrationInfoWindow.class).injectComponents(this); + pack(); + Util.placeDialogWindow(this, getWidth(), getHeight()); + new Timer(true).schedule(new UpdateTask(), 0, REPAINT_FREQ); + } + + private class UpdateTask extends TimerTask { + @Override + public void run() { + if (isVisible()) { + repaintPanels(); + } + } + } + + private void repaintPanels() { + for (WiimoteWrapper wrapper : ww) { + if (wrapper.panel.isVisible()) + wrapper.panel.repaint(); + } + } + + @Action(enabledProperty="calibrated") + public void info() { + setVisible(true); + } + + public boolean isCalibrated() { + return calibrated; + } + + private void updateCalibrated() { + final boolean old = calibrated; + calibrated = dh.isConnected() && calibration.isDone() && calibration.isAnyCalibrated(dh.getConnectedWiimotes()); + firePropertyChange("calibrated", old, calibrated); + } + + public void calibrationEvent(CalibrationEvent e) { + switch (e) { + case LOADED: + update(); + case FINISHED: + update(); + break; + case SCREEN_CHANGED: + case STARTED: + case ABORTED: + case SAVED: + } + updateCalibrated(); + if (!isCalibrated()) + setVisible(false); + } + + public void batteryLevel(Wiimote wiimote, double level) {} + public void irLights(Wiimote wiimote, IRDot[] lights) { + ww[wiimote.getId()-1].lights = lights; + } + public void irWarped(Map data, Point[] warped) {} + public void wiimoteConnected(Wiimote wiimote) { + update(); + updateCalibrated(); + } + public void wiimoteDisconnected(Wiimote wiimote) {} + + private int r(double d) { + return (int)Math.round(d); + } + + private void update() { + Map finals = calibration.getFinals(); + + + + for (Wiimote wiimote : dh.getConnectedWiimotes()) { + WiimoteWrapper w = ww[wiimote.getId()-1]; + if (!calibration.isCalibrated(wiimote)) continue; + + w.d = finals.get(wiimote.getAddress()); + + double x0 = w.d[0]*1024, y0 = w.d[1]*768; + double x1 = w.d[2]*1024, y1 = w.d[3]*768; + double x3 = w.d[4]*1024, y3 = w.d[5]*768; + double x2 = w.d[6]*1024, y2 = w.d[7]*768; + double idealArea = 0.8 * 1024 * 0.8 * 768; + double calibratedArea = 0.5 * (Math.abs( + (x1 - x2) * (y0 - y3) - (x0 - x3) * (y1 - y2) + )); + + w.trackingUtility.setValue(r(calibratedArea)); + w.trackingUtility.setString(Util.getResourceMap(CalibrationInfoWindow.class).getString("trackingUtilString", 100 * (calibratedArea / idealArea))); + + if (!w.panel.isVisible()) { + w.setVisible(true); + pack(); + Util.placeDialogWindow(this, getWidth(), getHeight()); + } + } + repaintPanels(); + } + + private class InfoPanel extends JPanel { + private static final int DIAMETER = 6; + private WiimoteWrapper wrapper; + public InfoPanel(WiimoteWrapper wrapper) { + this.wrapper = wrapper; + setLayout(null); + setOpaque(true); + setBackground(TRACKING_COLOR); + setBorder(BorderFactory.createLineBorder(SystemColor.lightGray)); + } + @Override + protected void paintComponent(Graphics g) { + super.paintComponent(g); + if (wrapper.d != null) { + Graphics2D g2d = (Graphics2D)g; + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + final int w = getWidth(); + final int h = getHeight(); + int x[] = new int[5], y[] = new int[5]; + for (int i = 0; i < 4; i++) { + x[i] = r(wrapper.d[2*i]*w); + y[i] = r(h-wrapper.d[2*i+1]*h); + } + x[4] = x[0]; y[4] = y[0]; + + g2d.setColor(CALIBRATED_COLOR); + g2d.fillPolygon(x, y, 5); + + + for (int i = 0; i < 4; i++) { + IRDot dot = wrapper.lights[i]; + if (dot != null) { + g2d.setColor(COLORS[i]); + + g2d.fillOval(r(w*dot.x)-DIAMETER/2, r(h-h*dot.y)-DIAMETER/2, DIAMETER, DIAMETER); + + } + } + } + } + } + + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/CameraMonitor.java b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/CameraMonitor.java new file mode 100644 index 0000000..d5085a1 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/CameraMonitor.java @@ -0,0 +1,103 @@ +package org.mote.wiimote.whiteboard.gui; + +import java.awt.Point; +import java.awt.SystemColor; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.util.Map; +import java.util.Timer; +import java.util.TimerTask; + +import javax.swing.BorderFactory; +import javax.swing.JDialog; +import javax.swing.JPanel; + +import net.miginfocom.swing.MigLayout; + +import org.jdesktop.application.Action; +import org.jdesktop.application.Application; +import org.mote.wiimote.whiteboard.WiimoteDataHandler; +import org.mote.wiimote.whiteboard.WiimoteWhiteboard; +import org.mote.wiimote.whiteboard.WiimoteDataHandler.WiimoteDataListener; +import org.mote.wiimote.whiteboard.ds.IRDot; +import org.mote.wiimote.whiteboard.ds.Wiimote; +import org.mote.wiimote.whiteboard.preferences.WWPreferences; +import org.mote.wiimote.whiteboard.util.Util; + +@SuppressWarnings("serial") +public class CameraMonitor extends JDialog implements WiimoteDataListener { + + private static final long REPAINT_FREQ = 1000 / 25; + + private JPanel canvas; + private IRDot[][] lights = new IRDot[WWPreferences.WIIMOTES+1][4]; + private LightLabel[][] labels = new LightLabel[WWPreferences.WIIMOTES+1][4]; + + public CameraMonitor(WiimoteDataHandler dh) { + super(Application.getInstance(WiimoteWhiteboard.class).getMainFrame(), Util.getResourceMap(CameraMonitor.class).getString("monitor.Action.text")); + getRootPane().putClientProperty("Window.style", "small"); + setLayout(new MigLayout()); + + dh.addWiimoteDataListener(this); + + canvas = new JPanel(null, true); + canvas.setOpaque(true); + canvas.setBorder(BorderFactory.createLineBorder(SystemColor.inactiveCaptionBorder)); + add(canvas, "w 50sp, h 50sp, grow, push"); + + addKeyListener(new KeyAdapter() { + @Override + public void keyPressed(KeyEvent e) { + if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { + setVisible(false); + } + } + }); + + pack(); + setLocationRelativeTo(null); + + new Timer(true).schedule(new UpdateTask(), 0, REPAINT_FREQ); + } + + @Action + public void monitor() { + setVisible(true); + } + + private class UpdateTask extends TimerTask { + @Override + public void run() { + if (isVisible()) { + for (int i = 1; i <= WWPreferences.WIIMOTES; i++) + for (int j = 0; j < 4; j++) { + if (labels[i][j] != null) + labels[i][j].update(); + } + } + } + } + + public void irLights(Wiimote wiimote, IRDot[] lights) { + this.lights[wiimote.getId()] = lights; + } + + public void irWarped(Map data, Point[] warped) { + } + + public void batteryLevel(Wiimote wiimote, double level) { + } + + public void wiimoteConnected(Wiimote wiimote) { + for (int i = 0; i < 4; i++) + canvas.add(labels[wiimote.getId()][i] = new LightLabel(canvas, lights, wiimote.getId(), i + 1)); + } + + public void wiimoteDisconnected(Wiimote wiimote) { + for (int i = 0; i < 4; i++) { + canvas.remove(labels[wiimote.getId()][i]); + labels[wiimote.getId()][i] = null; + } + } + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/CameraMonitor.java~ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/CameraMonitor.java~ new file mode 100644 index 0000000..58d5a6a --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/CameraMonitor.java~ @@ -0,0 +1,128 @@ +/* + * Copyright (C) 2008-2009, Uwe Schmidt + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * The Software uses a third-party library (WiiRemoteJ) which is not part of + * the Software and is subject to its own license. + */ + +package org.uweschmidt.wiimote.whiteboard.gui; + +import java.awt.Point; +import java.awt.SystemColor; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.util.Map; +import java.util.Timer; +import java.util.TimerTask; + +import javax.swing.BorderFactory; +import javax.swing.JDialog; +import javax.swing.JPanel; + +import net.miginfocom.swing.MigLayout; + +import org.jdesktop.application.Action; +import org.jdesktop.application.Application; +import org.uweschmidt.wiimote.whiteboard.WiimoteDataHandler; +import org.uweschmidt.wiimote.whiteboard.WiimoteWhiteboard; +import org.uweschmidt.wiimote.whiteboard.WiimoteDataHandler.WiimoteDataListener; +import org.uweschmidt.wiimote.whiteboard.ds.IRDot; +import org.uweschmidt.wiimote.whiteboard.ds.Wiimote; +import org.uweschmidt.wiimote.whiteboard.preferences.WWPreferences; +import org.uweschmidt.wiimote.whiteboard.util.Util; + +@SuppressWarnings("serial") +public class CameraMonitor extends JDialog implements WiimoteDataListener { + + private static final long REPAINT_FREQ = 1000 / 25; + + private JPanel canvas; + private IRDot[][] lights = new IRDot[WWPreferences.WIIMOTES+1][4]; + private LightLabel[][] labels = new LightLabel[WWPreferences.WIIMOTES+1][4]; + + public CameraMonitor(WiimoteDataHandler dh) { + super(Application.getInstance(WiimoteWhiteboard.class).getMainFrame(), Util.getResourceMap(CameraMonitor.class).getString("monitor.Action.text")); + getRootPane().putClientProperty("Window.style", "small"); + setLayout(new MigLayout()); + + dh.addWiimoteDataListener(this); + + canvas = new JPanel(null, true); + canvas.setOpaque(true); + canvas.setBorder(BorderFactory.createLineBorder(SystemColor.inactiveCaptionBorder)); + add(canvas, "w 50sp, h 50sp, grow, push"); + + addKeyListener(new KeyAdapter() { + @Override + public void keyPressed(KeyEvent e) { + if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { + setVisible(false); + } + } + }); + + pack(); + setLocationRelativeTo(null); + + new Timer(true).schedule(new UpdateTask(), 0, REPAINT_FREQ); + } + + @Action + public void monitor() { + setVisible(true); + } + + private class UpdateTask extends TimerTask { + @Override + public void run() { + if (isVisible()) { + for (int i = 1; i <= WWPreferences.WIIMOTES; i++) + for (int j = 0; j < 4; j++) { + if (labels[i][j] != null) + labels[i][j].update(); + } + } + } + } + + public void irLights(Wiimote wiimote, IRDot[] lights) { + this.lights[wiimote.getId()] = lights; + } + + public void irWarped(Map data, Point[] warped) { + } + + public void batteryLevel(Wiimote wiimote, double level) { + } + + public void wiimoteConnected(Wiimote wiimote) { + for (int i = 0; i < 4; i++) + canvas.add(labels[wiimote.getId()][i] = new LightLabel(canvas, lights, wiimote.getId(), i + 1)); + } + + public void wiimoteDisconnected(Wiimote wiimote) { + for (int i = 0; i < 4; i++) { + canvas.remove(labels[wiimote.getId()][i]); + labels[wiimote.getId()][i] = null; + } + } + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/HelpBook.java b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/HelpBook.java new file mode 100644 index 0000000..6c09106 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/HelpBook.java @@ -0,0 +1,9 @@ +package org.mote.wiimote.whiteboard.gui; + +public class HelpBook { + static { + System.loadLibrary("HelpBookJNI"); + } + + public static native void launchHelpViewer(); +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/HelpBook.java~ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/HelpBook.java~ new file mode 100644 index 0000000..189dc2b --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/HelpBook.java~ @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2008-2009, Uwe Schmidt + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * The Software uses a third-party library (WiiRemoteJ) which is not part of + * the Software and is subject to its own license. + */ + +package org.uweschmidt.wiimote.whiteboard.gui; + +public class HelpBook { + static { + System.loadLibrary("HelpBookJNI"); + } + + public static native void launchHelpViewer(); +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/HelpHandler.java b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/HelpHandler.java new file mode 100644 index 0000000..f1498f7 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/HelpHandler.java @@ -0,0 +1,24 @@ +package org.mote.wiimote.whiteboard.gui; + +import javax.swing.JOptionPane; + +import org.jdesktop.application.Action; +import org.mote.wiimote.whiteboard.WiimoteWhiteboard; +import org.mote.wiimote.whiteboard.util.BareBonesBrowserLaunch; +import org.mote.wiimote.whiteboard.util.Util; + +@SuppressWarnings("serial") +public class HelpHandler { + + @Action + public void help() { + if (Util.INSIDE_APP_BUNDLE) { + HelpBook.launchHelpViewer(); + } else { + if (JOptionPane.showConfirmDialog(null, Util.getResourceMap(HelpHandler.class).getString("helpQuestion"), Util.getResourceMap(HelpHandler.class).getString("help.Action.text"), JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { + BareBonesBrowserLaunch.openURL(WiimoteWhiteboard.getProperty("onlineHelp")); + } + } + } + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/HelpHandler.java~ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/HelpHandler.java~ new file mode 100644 index 0000000..ffbbfdc --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/HelpHandler.java~ @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2008-2009, Uwe Schmidt + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * The Software uses a third-party library (WiiRemoteJ) which is not part of + * the Software and is subject to its own license. + */ + +package org.uweschmidt.wiimote.whiteboard.gui; + +import javax.swing.JOptionPane; + +import org.jdesktop.application.Action; +import org.uweschmidt.wiimote.whiteboard.WiimoteWhiteboard; +import org.uweschmidt.wiimote.whiteboard.util.BareBonesBrowserLaunch; +import org.uweschmidt.wiimote.whiteboard.util.Util; + +@SuppressWarnings("serial") +public class HelpHandler { + + @Action + public void help() { + if (Util.INSIDE_APP_BUNDLE) { + HelpBook.launchHelpViewer(); + } else { + if (JOptionPane.showConfirmDialog(null, Util.getResourceMap(HelpHandler.class).getString("helpQuestion"), Util.getResourceMap(HelpHandler.class).getString("help.Action.text"), JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { + BareBonesBrowserLaunch.openURL(WiimoteWhiteboard.getProperty("onlineHelp")); + } + } + } + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/LightLabel.java b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/LightLabel.java new file mode 100644 index 0000000..0c93c8d --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/LightLabel.java @@ -0,0 +1,70 @@ +package org.mote.wiimote.whiteboard.gui; + +import java.awt.Color; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.RenderingHints; +import java.awt.geom.Point2D; + +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.SwingConstants; + +import org.uweschmidt.wiimote.whiteboard.ds.IRDot; + +@SuppressWarnings("serial") +public class LightLabel extends JLabel { + + private static final int RADIUS = 10; + + private final int id, number; + private Point2D[][] lights; + private JPanel canvas; + + public LightLabel(JPanel canvas, Point2D[][] lights, int id, int number) { + this(canvas, lights, id, number, WiimoteIcon.COLORS[id - 1]); + } + + public LightLabel(JPanel canvas, Point2D[][] lights, int id, int number, Color bg) { + super(String.valueOf(number)); + this.id = id; + this.number = number; + this.lights = lights; + this.canvas = canvas; + setHorizontalAlignment(SwingConstants.CENTER); + setForeground(Color.black); + setBackground(bg); + } + + public void update() { + Point2D l = lights[id][number - 1]; + if (l != null) { + int x = (int) Math.round(l.getX() * canvas.getWidth()); + int y = canvas.getHeight() - (int) Math.round(l.getY() * canvas.getHeight()); + this.setBounds(x - RADIUS, y - RADIUS, RADIUS * 2, RADIUS * 2); + setVisible(true); + } else { + setVisible(false); + } + } + + @Override + protected void paintComponent(Graphics g) { + Graphics2D g2d = (Graphics2D) g; + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + if (lights[id][number - 1] != null) { + g2d.setColor(this.getBackground()); + g2d.fillOval(1, 1, RADIUS * 2 - 2, RADIUS * 2 - 2); + g2d.setColor(this.getForeground()); + g2d.drawOval(1, 1, RADIUS * 2 - 2, RADIUS * 2 - 2); + + double scale = lights[id][number - 1] instanceof IRDot ? ((IRDot)lights[id][number - 1]).getSize() : -1; + if (scale != -1) { + g2d.setColor(Color.cyan); + final int d = (int)Math.round(RADIUS * scale * 10); + g2d.fillOval(RADIUS - d/2, RADIUS - d/2, d, d); + } + } + super.paintComponent(g); + } +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/LightLabel.java~ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/LightLabel.java~ new file mode 100644 index 0000000..5eb077d --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/LightLabel.java~ @@ -0,0 +1,98 @@ +/* + * Copyright (C) 2008-2009, Uwe Schmidt + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * The Software uses a third-party library (WiiRemoteJ) which is not part of + * the Software and is subject to its own license. + */ + +package org.uweschmidt.wiimote.whiteboard.gui; + +import java.awt.Color; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.RenderingHints; +import java.awt.geom.Point2D; + +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.SwingConstants; + +import org.uweschmidt.wiimote.whiteboard.ds.IRDot; + +@SuppressWarnings("serial") +public class LightLabel extends JLabel { + + private static final int RADIUS = 10; + + private final int id, number; + private Point2D[][] lights; + private JPanel canvas; + + public LightLabel(JPanel canvas, Point2D[][] lights, int id, int number) { + this(canvas, lights, id, number, WiimoteIcon.COLORS[id - 1]); + } + + public LightLabel(JPanel canvas, Point2D[][] lights, int id, int number, Color bg) { + super(String.valueOf(number)); + this.id = id; + this.number = number; + this.lights = lights; + this.canvas = canvas; + // setOpaque(true); + setHorizontalAlignment(SwingConstants.CENTER); + // setBorder(BorderFactory.createLineBorder(Color.black)); + setForeground(Color.black); + setBackground(bg); + } + + public void update() { + Point2D l = lights[id][number - 1]; + if (l != null) { + int x = (int) Math.round(l.getX() * canvas.getWidth()); + int y = canvas.getHeight() - (int) Math.round(l.getY() * canvas.getHeight()); + this.setBounds(x - RADIUS, y - RADIUS, RADIUS * 2, RADIUS * 2); + setVisible(true); + } else { + setVisible(false); + } + } + + @Override + protected void paintComponent(Graphics g) { + Graphics2D g2d = (Graphics2D) g; + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + if (lights[id][number - 1] != null) { + g2d.setColor(this.getBackground()); + g2d.fillOval(1, 1, RADIUS * 2 - 2, RADIUS * 2 - 2); + g2d.setColor(this.getForeground()); + g2d.drawOval(1, 1, RADIUS * 2 - 2, RADIUS * 2 - 2); + + // XXX explain cyan oval for size + double scale = lights[id][number - 1] instanceof IRDot ? ((IRDot)lights[id][number - 1]).getSize() : -1; + if (scale != -1) { + g2d.setColor(Color.cyan); + final int d = (int)Math.round(RADIUS * scale * 10); + g2d.fillOval(RADIUS - d/2, RADIUS - d/2, d, d); + } + } + super.paintComponent(g); + } +} \ No newline at end of file diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/LogWindow.java b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/LogWindow.java new file mode 100644 index 0000000..aa49abe --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/LogWindow.java @@ -0,0 +1,134 @@ +package org.mote.wiimote.whiteboard.gui; + +import java.awt.BorderLayout; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.io.Writer; +import java.util.Calendar; +import java.util.logging.Handler; +import java.util.logging.Level; +import java.util.logging.LogRecord; +import java.util.logging.Logger; + +import javax.swing.JDialog; +import javax.swing.JLabel; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; + +import net.miginfocom.swing.MigLayout; + +import org.jdesktop.application.Action; +import org.jdesktop.application.Application; +import org.mote.wiimote.whiteboard.WiimoteWhiteboard; +import org.mote.wiimote.whiteboard.preferences.WWPreferences; +import org.mote.wiimote.whiteboard.util.Util; + +@SuppressWarnings("serial") +public class LogWindow extends JDialog { + + private JTextArea log; + private JDialog failedDialog; + + public LogWindow() { + super(Application.getInstance(WiimoteWhiteboard.class).getMainFrame(), WiimoteWhiteboard.getProperty("id") + " " + Util.getResourceMap(LogWindow.class).getString("log.Action.text")); + getRootPane().putClientProperty("Window.style", "small"); + setLayout(new MigLayout()); + + log = Util.newComponent(JTextArea.class, "log"); + add(new JScrollPane(log), "w 66sp, h 33sp, grow, push"); + + Logger.getLogger("wiiremotej").addHandler(new LogHandler("WiiRemoteJ: ")); + WiimoteWhiteboard.getLogger().addHandler(new LogHandler("")); + + log.addKeyListener(new KeyAdapter() { + @Override + public void keyPressed(KeyEvent e) { + if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { + setVisible(false); + } + } + }); + + Util.getResourceMap(LogWindow.class).injectComponents(this); + pack(); + Util.placeDialogWindow(this, getWidth(), getHeight()); + + failedDialog = Util.newComponent(JDialog.class, "failedDialog"); + failedDialog.addKeyListener(new KeyAdapter() { + @Override + public void keyPressed(KeyEvent e) { + if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { + failedDialog.setVisible(false); + } + } + }); + failedDialog.setAlwaysOnTop(true); + failedDialog.getRootPane().putClientProperty("Window.style", "small"); + failedDialog.getRootPane().putClientProperty("Window.alpha", new Float(0.90)); + failedDialog.setLayout(new BorderLayout()); + failedDialog.add(Util.newComponent(JLabel.class, "failedLabel"), BorderLayout.CENTER); + Util.getResourceMap(LogWindow.class).injectComponents(failedDialog); + failedDialog.pack(); + failedDialog.setBounds(getX()+getWidth()/2-(failedDialog.getWidth()+20)/2, getY()+getHeight()+10, failedDialog.getWidth()+20, failedDialog.getHeight()+20); + } + + @Action + public void log() { + setVisible(!isVisible()); + } + + private class LogHandler extends Handler { + private static final String DIRECT_CONNECTION_TIMEOUT = "Failed to open baseband connection"; + private static final String CONNECTION_FAILED = "WiiRemote failed to connect!"; + private static final String CONNECTION_SUCCEEDED = "Initial connection complete."; + private final String name; + public LogHandler(String name) { + this.name = name; + setLevel(Level.ALL); + } + @Override + public void close() throws SecurityException {} + @Override + public void flush() {} + + @Override + public void publish(LogRecord record) { + Level level = record.getLevel(); + String msg = record.getMessage(); + Throwable e = record.getThrown(); + boolean failed = false; + + if (!WWPreferences.WIIMOTE_BT_ADDRESSES.isEmpty() && e != null && e.getCause() != null && e.getCause().getMessage().startsWith(DIRECT_CONNECTION_TIMEOUT)) + return; + + log.append(String.format("%7s %tT %s%s\n", level.getName(), Calendar.getInstance(), name, msg)); + if (e != null) { + log.append(getStackTrace(e)); + failed = CONNECTION_FAILED.equals(e.getMessage()); + } + log.setCaretPosition(log.getText().length()-1); + + if (!failed && level == Level.SEVERE) { + if (!LogWindow.this.isVisible()) { + LogWindow.this.setVisible(true); + } + } + + if (CONNECTION_SUCCEEDED.equals(msg)) { + failedDialog.setVisible(false); + } else if (failed) { + failedDialog.setVisible(true); + } + } + } + + private static String getStackTrace(Throwable e) { + final Writer result = new StringWriter(); + final PrintWriter printWriter = new PrintWriter(result); + e.printStackTrace(printWriter); + return result.toString(); + } + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/LogWindow.java~ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/LogWindow.java~ new file mode 100644 index 0000000..a743b4a --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/LogWindow.java~ @@ -0,0 +1,171 @@ +/* + * Copyright (C) 2008-2009, Uwe Schmidt + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * The Software uses a third-party library (WiiRemoteJ) which is not part of + * the Software and is subject to its own license. + */ + +package org.uweschmidt.wiimote.whiteboard.gui; + +import java.awt.BorderLayout; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.io.Writer; +import java.util.Calendar; +import java.util.logging.Handler; +import java.util.logging.Level; +import java.util.logging.LogRecord; +import java.util.logging.Logger; + +import javax.swing.JDialog; +import javax.swing.JLabel; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; + +import net.miginfocom.swing.MigLayout; + +import org.jdesktop.application.Action; +import org.jdesktop.application.Application; +import org.uweschmidt.wiimote.whiteboard.WiimoteWhiteboard; +import org.uweschmidt.wiimote.whiteboard.preferences.WWPreferences; +import org.uweschmidt.wiimote.whiteboard.util.Util; + +@SuppressWarnings("serial") +public class LogWindow extends JDialog { + + private JTextArea log; + private JDialog failedDialog; + + public LogWindow() { + super(Application.getInstance(WiimoteWhiteboard.class).getMainFrame(), WiimoteWhiteboard.getProperty("id") + " " + Util.getResourceMap(LogWindow.class).getString("log.Action.text")); + getRootPane().putClientProperty("Window.style", "small"); +// setLayout(new BorderLayout()); + setLayout(new MigLayout()); +// if (getContentPane() instanceof JPanel) { +// ((JPanel)getContentPane()).setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); +// } + + log = Util.newComponent(JTextArea.class, "log"); +// add(new JScrollPane(log), BorderLayout.CENTER); + add(new JScrollPane(log), "w 66sp, h 33sp, grow, push"); + + Logger.getLogger("wiiremotej").addHandler(new LogHandler("WiiRemoteJ: ")); + WiimoteWhiteboard.getLogger().addHandler(new LogHandler("")); + + log.addKeyListener(new KeyAdapter() { + @Override + public void keyPressed(KeyEvent e) { + if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { + setVisible(false); + } + } + }); + + Util.getResourceMap(LogWindow.class).injectComponents(this); + pack(); +// Util.placeDialogWindow(this, 500, 300); + Util.placeDialogWindow(this, getWidth(), getHeight()); + + failedDialog = Util.newComponent(JDialog.class, "failedDialog"); + failedDialog.addKeyListener(new KeyAdapter() { + @Override + public void keyPressed(KeyEvent e) { + if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { + failedDialog.setVisible(false); + } + } + }); + failedDialog.setAlwaysOnTop(true); + failedDialog.getRootPane().putClientProperty("Window.style", "small"); + failedDialog.getRootPane().putClientProperty("Window.alpha", new Float(0.90)); + failedDialog.setLayout(new BorderLayout()); + failedDialog.add(Util.newComponent(JLabel.class, "failedLabel"), BorderLayout.CENTER); + Util.getResourceMap(LogWindow.class).injectComponents(failedDialog); + failedDialog.pack(); +// failedDialog.setBounds(getX(), getY()+getHeight()+10, getWidth(), failedDialog.getHeight()+20); + failedDialog.setBounds(getX()+getWidth()/2-(failedDialog.getWidth()+20)/2, getY()+getHeight()+10, failedDialog.getWidth()+20, failedDialog.getHeight()+20); +// failedDialog.setVisible(true); + } + + @Action + public void log() { + setVisible(!isVisible()); + } + + private class LogHandler extends Handler { + private static final String DIRECT_CONNECTION_TIMEOUT = "Failed to open baseband connection"; + private static final String CONNECTION_FAILED = "WiiRemote failed to connect!"; + private static final String CONNECTION_SUCCEEDED = "Initial connection complete."; + private final String name; + public LogHandler(String name) { + this.name = name; + setLevel(Level.ALL); + } + @Override + public void close() throws SecurityException {} + @Override + public void flush() {} + + @Override + public void publish(LogRecord record) { + Level level = record.getLevel(); + String msg = record.getMessage(); + Throwable e = record.getThrown(); + boolean failed = false; + + // skip that error (apparently timeout on direct connection attempts) + if (!WWPreferences.WIIMOTE_BT_ADDRESSES.isEmpty() && e != null && e.getCause() != null && e.getCause().getMessage().startsWith(DIRECT_CONNECTION_TIMEOUT)) + return; + + log.append(String.format("%7s %tT %s%s\n", level.getName(), Calendar.getInstance(), name, msg)); + if (e != null) { + log.append(getStackTrace(e)); + failed = CONNECTION_FAILED.equals(e.getMessage()); + } + log.setCaretPosition(log.getText().length()-1); + + if (!failed && level == Level.SEVERE) { + if (!LogWindow.this.isVisible()) { +// LogWindow.this.pack(); +// Util.placeDialogWindow(LogWindow.this, LogWindow.this.getWidth(), LogWindow.this.getHeight()); + LogWindow.this.setVisible(true); + } + } + + if (CONNECTION_SUCCEEDED.equals(msg)) { +// LogWindow.this.setVisible(false); + failedDialog.setVisible(false); + } else if (failed) { + failedDialog.setVisible(true); + } + } + } + + private static String getStackTrace(Throwable e) { + final Writer result = new StringWriter(); + final PrintWriter printWriter = new PrintWriter(result); + e.printStackTrace(printWriter); + return result.toString(); + } + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/MainPanel.java b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/MainPanel.java new file mode 100644 index 0000000..e603614 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/MainPanel.java @@ -0,0 +1,332 @@ +package org.mote.wiimote.whiteboard.gui; + +import java.awt.Color; +import java.awt.Font; +import java.awt.Graphics; +import java.awt.Point; +import java.awt.SystemColor; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowEvent; +import java.awt.event.WindowFocusListener; +import java.util.Map; +import java.util.logging.Level; + +import javax.swing.BorderFactory; +import javax.swing.ButtonGroup; +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JCheckBox; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JProgressBar; +import javax.swing.JRadioButton; +import javax.swing.JSeparator; +import javax.swing.SwingConstants; + +import net.miginfocom.swing.MigLayout; + +import org.jdesktop.application.Action; +import org.jdesktop.application.Application; +import org.jdesktop.application.ResourceMap; +import org.mote.wiimote.whiteboard.WiimoteDataHandler; +import org.mote.wiimote.whiteboard.WiimoteWhiteboard; +import org.mote.wiimote.whiteboard.WiimoteDataHandler.WiimoteDataListener; +import org.mote.wiimote.whiteboard.calibration.WiimoteCalibration; +import org.mote.wiimote.whiteboard.calibration.WiimoteCalibration.CalibrationEvent; +import org.mote.wiimote.whiteboard.calibration.WiimoteCalibration.CalibrationEventListener; +import org.mote.wiimote.whiteboard.ds.IRDot; +import org.mote.wiimote.whiteboard.ds.Wiimote; +import org.mote.wiimote.whiteboard.preferences.WWPreferences; +import org.mote.wiimote.whiteboard.util.Util; + +@SuppressWarnings("serial") +public class MainPanel extends JPanel implements WiimoteDataListener, CalibrationEventListener { + + private static final ImageIcon CALIBRATED = new ImageIcon(MainPanel.class.getResource("resources/icons/ok.png")); + private static final ImageIcon NOT_CALIBRATED = new ImageIcon(MainPanel.class.getResource("resources/icons/warning.png")); + + private static final WWPreferences prefs = WWPreferences.getPreferences(); + + private DotLabel[] dotLabel = new DotLabel[4]; + private JProgressBar[] batteryLevel = new JProgressBar[WWPreferences.WIIMOTES]; + private JButton[] resetButton = new JButton[WWPreferences.WIIMOTES]; + private WiimoteIcon[] wiimoteIcon = new WiimoteIcon[WWPreferences.WIIMOTES]; + private JLabel[] statusLabel = new JLabel[WWPreferences.WIIMOTES]; + private JCheckBox cursorControl; + private JRadioButton moveMouse, leftClick; + private JButton calibrationButton, cameraButton + private ScreenSelector screenSelector; + + private boolean notifiedLowBattery = false; + + private Wiimote[] wiimotes = new Wiimote[WWPreferences.WIIMOTES]; + + private WiimoteDataHandler dh; + private WiimoteCalibration calibration; + private ResourceMap r = Util.getResourceMap(MainPanel.class); + + public MainPanel(WiimoteDataHandler dh, WiimoteCalibration calibration) { + this.dh = dh; + this.calibration = calibration; + + dh.addWiimoteDataListener(this); + calibration.addCalibrationEventListener(this); + + createComponents(); + + getValues(); + update(); + } + + public void getValues() { + cursorControl.setSelected(dh.isCursorControl()); + leftClick.setSelected(prefs.isLeftClick()); + moveMouse.setSelected(!prefs.isLeftClick()); + } + + public void calibrationEvent(CalibrationEvent e) { + switch (e) { + case FINISHED: + case LOADED: + cursorControl.setSelected(WWPreferences.MOUSE_CONTROL_AFTER_CALIBRATION); + case STARTED: + case SCREEN_CHANGED: + case ABORTED: + update(); + break; + } + } + + public void batteryLevel(Wiimote wiimote, double level) { + batteryLevel[wiimote.getId()-1].setValue((int) Math.round(level * 100)); + batteryLevel[wiimote.getId()-1].setString(r.getString("batteryLevel", level * 100)); + + if (!notifiedLowBattery && prefs.isLowBatteryWarning() && dh.isConnected(wiimote) && level <= .05) { + notifiedLowBattery = true; + WiimoteWhiteboard.getLogger().log(Level.WARNING, r.getString("lowBattery")); + new Thread(new Runnable() { + public void run() { + JOptionPane.showMessageDialog(null, r.getString("lowBattery"), WiimoteWhiteboard.getProperty("id"), JOptionPane.WARNING_MESSAGE); + } + }).start(); + } + } + + public void irLights(Wiimote wiimote, IRDot[] lights) { + for (int i = 0; i < lights.length; i++) { + dotLabel[i].update(wiimote, lights[i] != null); + } + } + + public void irWarped(Map data, Point[] warped) { + } + + public void wiimoteConnected(Wiimote wiimote) { + wiimotes[wiimote.getId()-1] = wiimote; + + if (wiimote.getId() > 1) { + for (int i = 0; i < wiimote.getId(); i++) { + wiimoteIcon[i].setVisible(true); + } + } + statusLabel[wiimote.getId()-1].setVisible(true); + + batteryLevel[wiimote.getId()-1].setVisible(true); + resetButton[wiimote.getId()-1].setVisible(true); + cursorControl.setSelected(WWPreferences.MOUSE_CONTROL_AFTER_CALIBRATION); + update(); + } + + public void wiimoteDisconnected(Wiimote wiimote) { + if (wiimote.getId() != 1) batteryLevel[wiimote.getId()-1].setVisible(false); + if (wiimote.getId() != 1) wiimoteIcon[wiimote.getId()-1].setVisible(false); + if (wiimote.getId() != 1) resetButton[wiimote.getId()-1].setVisible(false); + if (wiimote.getId() != 1) statusLabel[wiimote.getId()-1].setVisible(false); + update(); + JOptionPane.showMessageDialog(null, r.getString("disconnected", wiimote.getId()), WiimoteWhiteboard.getProperty("id"), JOptionPane.ERROR_MESSAGE); + Application.getInstance(WiimoteWhiteboard.class).exit(); + } + + + /* + * UPDATE UI WIDGETS + */ + + @Action + public void update() { + calibrationButton.setEnabled(dh.isConnected()); + for (int i = 0; i < WWPreferences.WIIMOTES; i++) { + resetButton[i].setEnabled(dh.isConnected(wiimotes[i])); + wiimoteIcon[i].displayConnected(dh.isConnected(wiimotes[i])); + if (dh.isConnected(wiimotes[i])) { + boolean calibrated = calibration.isCalibrated(wiimotes[i]); + statusLabel[i].setText(r.getString(calibrated ? "calibrated" : "notCalibrated")); + statusLabel[i].setIcon(calibrated ? CALIBRATED : NOT_CALIBRATED); + } + } + cameraButton.setEnabled(dh.isConnected()); + screenSelector.setEnabled(dh.isConnected() && !calibration.inProgress()); + + if (!dh.isConnected()) { + batteryLevel[0].setString(r.getString("searching")); + batteryLevel[0].setValue(0); + batteryLevel[0].setToolTipText(Util.getResourceMap(MainPanel.class).getString("batteryLevelBar.toolTipText")); + } else { + batteryLevel[0].setToolTipText(null); + } + + cursorControl.setEnabled(dh.isConnected() && calibration.isDone() && calibration.isAnyCalibrated(dh.getConnectedWiimotes())); + if (!cursorControl.isEnabled()) + cursorControl.setSelected(false); + + moveMouse.setEnabled(cursorControl.isSelected()); + leftClick.setEnabled(cursorControl.isSelected()); + + dh.setCursorControl(cursorControl.isSelected()); + prefs.setLeftClick(leftClick.isSelected()); + } + + /* + * MAIN PANEL + */ + + private void createComponents() { + setLayout(new MigLayout("nocache, hidemode 3, gap 0", "[fill]")); + + addHeadline(r.getString("wiimoteHeadline"), false); + + for (int i = 0; i < WWPreferences.WIIMOTES; i++) { + add(wiimoteIcon[i] = new WiimoteIcon(i+1), "split"); + if (i > 0) wiimoteIcon[i].setVisible(false); + } + + for (int i = 0; i < WWPreferences.WIIMOTES; i++) { + add(batteryLevel[i] = Util.newComponent(JProgressBar.class, "batteryLevelBar"), (i == 0 ? "newline related/2, " : "") + "split"); + if (i > 0) batteryLevel[i].setVisible(false); + } + + for (int i = 0; i < WWPreferences.WIIMOTES; i++) { + add(statusLabel[i] = Util.newComponent(JLabel.class, "statusLabel"), (i == 0 ? "newline related/2, split, " : "") + "sg, h 16!, center"); + statusLabel[i].setFont(statusLabel[i].getFont().deriveFont(10f)); + if (i > 0) statusLabel[i].setVisible(false); + } + + String gap = Util.MAC_OS_X_LEOPARD_OR_HIGHER ? "0" : "related/2"; + for (int i = 0; i < WWPreferences.WIIMOTES; i++) { + final int j = i; + add(resetButton[i] = Util.newComponent(JButton.class, "resetCameraButton"), (i == 0 ? "newline "+gap+", split, " : "") + ""); + resetButton[i].putClientProperty("JButton.buttonType", "textured"); + resetButton[i].putClientProperty("JComponent.sizeVariant", "small"); + resetButton[i].addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + try { + dh.enableIR(wiimotes[j]); + } catch (Exception e1) { + e1.printStackTrace(); + } + } + }); + if (i > 0) resetButton[i].setVisible(false); + } + + add(new JSeparator(), String.format("newline %s, span, growx, wrap related", Util.MAC_OS_X_LEOPARD_OR_HIGHER ? "related/3" : "related")); + + add(Util.newComponent(JLabel.class, "visibleDotsLabel"), "split" + (Util.MAC_OS_X ? ", gapleft 4" : "")); + add(dotLabel[0] = new DotLabel("1"), "w 18, h 18"); + add(dotLabel[1] = new DotLabel("2"), "w 18, h 18"); + add(dotLabel[2] = new DotLabel("3"), "w 18, h 18"); + add(dotLabel[3] = new DotLabel("4"), "w 18, h 18, wrap related" + (Util.MAC_OS_X ? ", gapright 4" : "")); + + add(cameraButton = new JButton(Util.getAction(new CameraMonitor(dh), "monitor")), ""); + cameraButton.putClientProperty("JButton.buttonType", "textured"); + + // CALIBRATION + + addHeadline(r.getString("calibrationHeadline")); + + + final JButton infoButton = new JButton(Util.getAction(new CalibrationInfoWindow(calibration, dh), "info")); + infoButton.putClientProperty("JButton.buttonType", "textured"); + infoButton.putClientProperty("JComponent.sizeVariant", "small"); + add(infoButton, "wrap related"); + + + add(screenSelector = new ScreenSelector(calibration, dh), "align center, grow 0, wrap related"); + + add(calibrationButton = Util.newComponent(JButton.class, "calibrationButton"), ""); + calibrationButton.putClientProperty("JButton.buttonType", "textured"); + calibrationButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + calibration.start(dh.getConnectedWiimotes()); + } + }); + + // MOUSE CONTROL + + addHeadline(r.getString("mouseControlHeadline")); + + add(cursorControl = Util.newComponent(JCheckBox.class, "cursorControl"), "wrap related"); + add(moveMouse = Util.newComponent(JRadioButton.class, "moveMouse"), "pad 0 20 0 0, wmin pref+20, wrap related"); + add(leftClick = Util.newComponent(JRadioButton.class, "leftClick"), "pad 0 20 0 0, wmin pref+20, wrap"); + + ButtonGroup group = new ButtonGroup(); + group.add(moveMouse); + group.add(leftClick); + + cursorControl.addActionListener(Util.getAction(this, "update")); + moveMouse.addActionListener(Util.getAction(this, "update")); + leftClick.addActionListener(Util.getAction(this, "update")); + + Application.getInstance(WiimoteWhiteboard.class).getMainFrame().addWindowFocusListener(new WindowFocusListener() { + public void windowGainedFocus(WindowEvent e) { + updateUI(); + } + public void windowLostFocus(WindowEvent e) {} + }); + + Util.getResourceMap(MainPanel.class).injectComponents(this); + } + + private JLabel addHeadline(String name) { + return addHeadline(name, true); + } + + private JLabel addHeadline(String name, boolean newline) { + final JLabel label = new JLabel(name); + label.setFont(label.getFont().deriveFont(Font.BOLD, 18f)); + add(label, (newline ? "newline unrelated, " : "") + "split, span"); + add(new JSeparator(), "growx, wrap related"); + return label; + } + + private class DotLabel extends JLabel { + + private boolean[] state = new boolean[WWPreferences.WIIMOTES]; + + public DotLabel(String name) { + setText(name); + setHorizontalAlignment(SwingConstants.CENTER); + setBorder(BorderFactory.createLineBorder(Color.lightGray)); + } + + public void update(Wiimote wiimote, boolean state) { + if (this.state[wiimote.getId() - 1] != state) { + this.state[wiimote.getId() - 1] = state; + repaint(); + } + } + + @Override + protected void paintComponent(Graphics g) { + final int n = Math.max(1, dh.getNumberOfConnectedWiimotes()); + for (int i = 1; i <= n; i++) { + g.setColor(state[i-1] ? WiimoteIcon.COLORS[i-1] : SystemColor.textInactiveText); + g.fillRect(0, (i-1)*this.getHeight()/n, this.getWidth(), this.getHeight()/n); + } + super.paintComponent(g); + } + + } +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/MainPanel.java~ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/MainPanel.java~ new file mode 100644 index 0000000..f253374 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/MainPanel.java~ @@ -0,0 +1,384 @@ +/* + * Copyright (C) 2008-2009, Uwe Schmidt + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * The Software uses a third-party library (WiiRemoteJ) which is not part of + * the Software and is subject to its own license. + */ + +package org.uweschmidt.wiimote.whiteboard.gui; + +import java.awt.Color; +import java.awt.Font; +import java.awt.Graphics; +import java.awt.Point; +import java.awt.SystemColor; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowEvent; +import java.awt.event.WindowFocusListener; +import java.util.Map; +import java.util.logging.Level; + +import javax.swing.BorderFactory; +import javax.swing.ButtonGroup; +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JCheckBox; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JProgressBar; +import javax.swing.JRadioButton; +import javax.swing.JSeparator; +import javax.swing.SwingConstants; + +import net.miginfocom.swing.MigLayout; + +import org.jdesktop.application.Action; +import org.jdesktop.application.Application; +import org.jdesktop.application.ResourceMap; +import org.uweschmidt.wiimote.whiteboard.WiimoteDataHandler; +import org.uweschmidt.wiimote.whiteboard.WiimoteWhiteboard; +import org.uweschmidt.wiimote.whiteboard.WiimoteDataHandler.WiimoteDataListener; +import org.uweschmidt.wiimote.whiteboard.calibration.WiimoteCalibration; +import org.uweschmidt.wiimote.whiteboard.calibration.WiimoteCalibration.CalibrationEvent; +import org.uweschmidt.wiimote.whiteboard.calibration.WiimoteCalibration.CalibrationEventListener; +import org.uweschmidt.wiimote.whiteboard.ds.IRDot; +import org.uweschmidt.wiimote.whiteboard.ds.Wiimote; +import org.uweschmidt.wiimote.whiteboard.preferences.WWPreferences; +import org.uweschmidt.wiimote.whiteboard.util.Util; + +@SuppressWarnings("serial") +public class MainPanel extends JPanel implements WiimoteDataListener, CalibrationEventListener { + + private static final ImageIcon CALIBRATED = new ImageIcon(MainPanel.class.getResource("resources/icons/ok.png")); + private static final ImageIcon NOT_CALIBRATED = new ImageIcon(MainPanel.class.getResource("resources/icons/warning.png")); + + private static final WWPreferences prefs = WWPreferences.getPreferences(); + + private DotLabel[] dotLabel = new DotLabel[4]; + private JProgressBar[] batteryLevel = new JProgressBar[WWPreferences.WIIMOTES]; + private JButton[] resetButton = new JButton[WWPreferences.WIIMOTES]; + private WiimoteIcon[] wiimoteIcon = new WiimoteIcon[WWPreferences.WIIMOTES]; + private JLabel[] statusLabel = new JLabel[WWPreferences.WIIMOTES]; + private JCheckBox cursorControl; + private JRadioButton moveMouse, leftClick; + private JButton calibrationButton, cameraButton /*,warpedButton, calibrationInfoButton*/; + private ScreenSelector screenSelector; + + private boolean notifiedLowBattery = false; +// private boolean donePack = false; + + private Wiimote[] wiimotes = new Wiimote[WWPreferences.WIIMOTES]; + + private WiimoteDataHandler dh; + private WiimoteCalibration calibration; + private ResourceMap r = Util.getResourceMap(MainPanel.class); + + public MainPanel(WiimoteDataHandler dh, WiimoteCalibration calibration) { + this.dh = dh; + this.calibration = calibration; + + dh.addWiimoteDataListener(this); + calibration.addCalibrationEventListener(this); + + createComponents(); + + getValues(); + update(); + } + + public void getValues() { + cursorControl.setSelected(dh.isCursorControl()); +// rightClick.setSelected(prefs.isRightClick()); + leftClick.setSelected(prefs.isLeftClick()); + moveMouse.setSelected(!prefs.isLeftClick()); + } + + public void calibrationEvent(CalibrationEvent e) { + switch (e) { + case FINISHED: + case LOADED: + cursorControl.setSelected(WWPreferences.MOUSE_CONTROL_AFTER_CALIBRATION); + case STARTED: + case SCREEN_CHANGED: + case ABORTED: + update(); + break; + } + } + + public void batteryLevel(Wiimote wiimote, double level) { + batteryLevel[wiimote.getId()-1].setValue((int) Math.round(level * 100)); + batteryLevel[wiimote.getId()-1].setString(r.getString("batteryLevel", level * 100)); + + if (!notifiedLowBattery && prefs.isLowBatteryWarning() && dh.isConnected(wiimote) && level <= .05) { + notifiedLowBattery = true; + WiimoteWhiteboard.getLogger().log(Level.WARNING, r.getString("lowBattery")); + new Thread(new Runnable() { + public void run() { + JOptionPane.showMessageDialog(null, r.getString("lowBattery"), WiimoteWhiteboard.getProperty("id"), JOptionPane.WARNING_MESSAGE); + } + }).start(); + } + } + + public void irLights(Wiimote wiimote, IRDot[] lights) { + for (int i = 0; i < lights.length; i++) { + dotLabel[i].update(wiimote, lights[i] != null); + } + } + + public void irWarped(Map data, Point[] warped) { + } + + public void wiimoteConnected(Wiimote wiimote) { + wiimotes[wiimote.getId()-1] = wiimote; + + if (wiimote.getId() > 1) { + for (int i = 0; i < wiimote.getId(); i++) { + wiimoteIcon[i].setVisible(true); + } + } + statusLabel[wiimote.getId()-1].setVisible(true); + +// Application.getInstance(WiimoteWhiteboard.class).getMainFrame().pack(); + + batteryLevel[wiimote.getId()-1].setVisible(true); + resetButton[wiimote.getId()-1].setVisible(true); + cursorControl.setSelected(WWPreferences.MOUSE_CONTROL_AFTER_CALIBRATION); + update(); + } + + public void wiimoteDisconnected(Wiimote wiimote) { + if (wiimote.getId() != 1) batteryLevel[wiimote.getId()-1].setVisible(false); + if (wiimote.getId() != 1) wiimoteIcon[wiimote.getId()-1].setVisible(false); + if (wiimote.getId() != 1) resetButton[wiimote.getId()-1].setVisible(false); + if (wiimote.getId() != 1) statusLabel[wiimote.getId()-1].setVisible(false); + update(); +// Application.getInstance(WiimoteWhiteboard.class).getMainFrame().pack(); +// WiimoteWhiteboard.getLogger().log(Level.SEVERE, r.getString("disconnected", id)); + JOptionPane.showMessageDialog(null, r.getString("disconnected", wiimote.getId()), WiimoteWhiteboard.getProperty("id"), JOptionPane.ERROR_MESSAGE); + Application.getInstance(WiimoteWhiteboard.class).exit(); + } + + + /* + * UPDATE UI WIDGETS + */ + + @Action + public void update() { + calibrationButton.setEnabled(dh.isConnected()); + for (int i = 0; i < WWPreferences.WIIMOTES; i++) { + resetButton[i].setEnabled(dh.isConnected(wiimotes[i])); + wiimoteIcon[i].displayConnected(dh.isConnected(wiimotes[i])); + if (dh.isConnected(wiimotes[i])) { + boolean calibrated = calibration.isCalibrated(wiimotes[i]); + statusLabel[i].setText(r.getString(calibrated ? "calibrated" : "notCalibrated")); + statusLabel[i].setIcon(calibrated ? CALIBRATED : NOT_CALIBRATED); + } + } + cameraButton.setEnabled(dh.isConnected()); +// warpedButton.setEnabled(dh.isConnected() && calibration.isDone() && calibration.isAnyCalibrated(dh.getConnectedWiimotes())); + screenSelector.setEnabled(dh.isConnected() && !calibration.inProgress()); + + if (!dh.isConnected()) { + batteryLevel[0].setString(r.getString("searching")); + batteryLevel[0].setValue(0); + batteryLevel[0].setToolTipText(Util.getResourceMap(MainPanel.class).getString("batteryLevelBar.toolTipText")); + } else { + batteryLevel[0].setToolTipText(null); + } + + cursorControl.setEnabled(dh.isConnected() && calibration.isDone() && calibration.isAnyCalibrated(dh.getConnectedWiimotes())); + if (!cursorControl.isEnabled()) + cursorControl.setSelected(false); + + moveMouse.setEnabled(cursorControl.isSelected()); + leftClick.setEnabled(cursorControl.isSelected()); +// rightClick.setEnabled(cursorControl.isSelected() && leftClick.isSelected()); + + dh.setCursorControl(cursorControl.isSelected()); + prefs.setLeftClick(leftClick.isSelected()); +// prefs.setRightClick(/*rightClick.isEnabled() && */rightClick.isSelected()); + } + + /* + * MAIN PANEL + */ + + private void createComponents() { + setLayout(new MigLayout("nocache, hidemode 3, gap 0", "[fill]")); + + addHeadline(r.getString("wiimoteHeadline"), false); + + for (int i = 0; i < WWPreferences.WIIMOTES; i++) { + add(wiimoteIcon[i] = new WiimoteIcon(i+1), "split"); + if (i > 0) wiimoteIcon[i].setVisible(false); + } + + for (int i = 0; i < WWPreferences.WIIMOTES; i++) { + add(batteryLevel[i] = Util.newComponent(JProgressBar.class, "batteryLevelBar"), (i == 0 ? "newline related/2, " : "") + "split"); + if (i > 0) batteryLevel[i].setVisible(false); + } + + for (int i = 0; i < WWPreferences.WIIMOTES; i++) { + add(statusLabel[i] = Util.newComponent(JLabel.class, "statusLabel"), (i == 0 ? "newline related/2, split, " : "") + "sg, h 16!, center"); + statusLabel[i].setFont(statusLabel[i].getFont().deriveFont(10f)); + if (i > 0) statusLabel[i].setVisible(false); + } + + String gap = Util.MAC_OS_X_LEOPARD_OR_HIGHER ? "0" : "related/2"; + for (int i = 0; i < WWPreferences.WIIMOTES; i++) { + final int j = i; + add(resetButton[i] = Util.newComponent(JButton.class, "resetCameraButton"), (i == 0 ? "newline "+gap+", split, " : "") + ""); + resetButton[i].putClientProperty("JButton.buttonType", "textured"); + resetButton[i].putClientProperty("JComponent.sizeVariant", "small"); + resetButton[i].addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + try { + dh.enableIR(wiimotes[j]); + } catch (Exception e1) { + e1.printStackTrace(); + } + } + }); + if (i > 0) resetButton[i].setVisible(false); + } + + add(new JSeparator(), String.format("newline %s, span, growx, wrap related", Util.MAC_OS_X_LEOPARD_OR_HIGHER ? "related/3" : "related")); + + add(Util.newComponent(JLabel.class, "visibleDotsLabel"), "split" + (Util.MAC_OS_X ? ", gapleft 4" : "")); + add(dotLabel[0] = new DotLabel("1"), "w 18, h 18"); + add(dotLabel[1] = new DotLabel("2"), "w 18, h 18"); + add(dotLabel[2] = new DotLabel("3"), "w 18, h 18"); + add(dotLabel[3] = new DotLabel("4"), "w 18, h 18, wrap related" + (Util.MAC_OS_X ? ", gapright 4" : "")); + + add(cameraButton = new JButton(Util.getAction(new CameraMonitor(dh), "monitor")), ""); + cameraButton.putClientProperty("JButton.buttonType", "textured"); + + // CALIBRATION + + addHeadline(r.getString("calibrationHeadline")); + +// add(warpedButton = new JButton(SC.getAction(new WarpedMonitor(dh, calibration), "monitor")), "wrap"); + + final JButton infoButton = new JButton(Util.getAction(new CalibrationInfoWindow(calibration, dh), "info")); +// final JToggleButton infoButton = new JToggleButton(Util.getAction(new CalibrationInfoWindow(calibration, dh), "info")); + infoButton.putClientProperty("JButton.buttonType", "textured"); + infoButton.putClientProperty("JComponent.sizeVariant", "small"); + add(infoButton, "wrap related"); +// add(new JSeparator(), "span, growx, wrap"); + + + add(screenSelector = new ScreenSelector(calibration, dh), "align center, grow 0, wrap related"); + + add(calibrationButton = Util.newComponent(JButton.class, "calibrationButton"), ""); + calibrationButton.putClientProperty("JButton.buttonType", "textured"); + calibrationButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + calibration.start(dh.getConnectedWiimotes()); + } + }); + + // MOUSE CONTROL + + addHeadline(r.getString("mouseControlHeadline")); + + add(cursorControl = Util.newComponent(JCheckBox.class, "cursorControl"), "wrap related"); + add(moveMouse = Util.newComponent(JRadioButton.class, "moveMouse"), "pad 0 20 0 0, wmin pref+20, wrap related"); + add(leftClick = Util.newComponent(JRadioButton.class, "leftClick"), "pad 0 20 0 0, wmin pref+20, wrap"); +// add(rightClick = SC.newComponent(JCheckBox.class, "rightClick"), "pad 0 20 0 0, wrap"); + +// add(new JSeparator(), "wrap"); +// final JButton exitButton = new JButton(SC.getAction(Application.getInstance(), "quitApp")); +// add(exitButton, "wrap"); + + ButtonGroup group = new ButtonGroup(); + group.add(moveMouse); + group.add(leftClick); + + cursorControl.addActionListener(Util.getAction(this, "update")); + moveMouse.addActionListener(Util.getAction(this, "update")); + leftClick.addActionListener(Util.getAction(this, "update")); +// rightClick.addActionListener(SC.getAction(this, "update")); + + // fixes issue that components stay grayed out although they're enabled + // (mac os x), only happens when mainFrame doesn't have focus on connect + // workaround for windows: pack() once frame gains focus, due to + // incorrect height apparently caused by non-resizability + Application.getInstance(WiimoteWhiteboard.class).getMainFrame().addWindowFocusListener(new WindowFocusListener() { + public void windowGainedFocus(WindowEvent e) { + updateUI(); +// if (!Util.MAC_OS_X && !donePack) { +// donePack = true; +// Application.getInstance(WiimoteWhiteboard.class).getMainFrame().pack(); +// } + } + public void windowLostFocus(WindowEvent e) {} + }); + + Util.getResourceMap(MainPanel.class).injectComponents(this); + } + + private JLabel addHeadline(String name) { + return addHeadline(name, true); + } + + private JLabel addHeadline(String name, boolean newline) { + final JLabel label = new JLabel(name); + label.setFont(label.getFont().deriveFont(Font.BOLD, 18f)); + add(label, (newline ? "newline unrelated, " : "") + "split, span"); + add(new JSeparator(), "growx, wrap related"); + return label; + } + + private class DotLabel extends JLabel { + + private boolean[] state = new boolean[WWPreferences.WIIMOTES]; + + public DotLabel(String name) { + setText(name); + setHorizontalAlignment(SwingConstants.CENTER); + setBorder(BorderFactory.createLineBorder(Color.lightGray)); + } + + public void update(Wiimote wiimote, boolean state) { + if (this.state[wiimote.getId() - 1] != state) { + this.state[wiimote.getId() - 1] = state; + repaint(); + } + } + + @Override + protected void paintComponent(Graphics g) { + final int n = Math.max(1, dh.getNumberOfConnectedWiimotes()); + for (int i = 1; i <= n; i++) { + g.setColor(state[i-1] ? WiimoteIcon.COLORS[i-1] : SystemColor.textInactiveText); + g.fillRect(0, (i-1)*this.getHeight()/n, this.getWidth(), this.getHeight()/n); +// g.fillRect((i-1)*this.getWidth()/n, 0, this.getWidth()/n, this.getHeight()); + } + super.paintComponent(g); + } + + } +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/MenuBar.java b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/MenuBar.java new file mode 100644 index 0000000..9e7ca8f --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/MenuBar.java @@ -0,0 +1,48 @@ +package org.mote.wiimote.whiteboard.gui; + +import java.awt.Toolkit; +import java.awt.event.KeyEvent; + +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.KeyStroke; + +import org.jdesktop.application.Application; +import org.mote.wiimote.whiteboard.WiimoteWhiteboard; +import org.mote.wiimote.whiteboard.util.Util; + +@SuppressWarnings("serial") +public class MenuBar extends JMenuBar { + + public MenuBar(PreferencesWindow pf, AboutWindow af, /*HelpHandler hh*/, LogWindow lw) { + JMenu menu; + JMenuItem item; + + if (!Util.MAC_OS_X) { + menu = new JMenu(Util.getResourceMap(MenuBar.class).getString("editMenu")); + menu.add(new JMenuItem(Util.getAction(pf, "preferences"))); + add(menu); + } + + //menu = new JMenu(Util.getResourceMap(HelpHandler.class).getString("help")); + + //menu.add(item = new JMenuItem(Util.getAction(hh, "help"))); + if (Util.MAC_OS_X) + item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_SLASH, KeyEvent.SHIFT_MASK | Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); + + //menu.addSeparator(); + + //if (!Util.MAC_OS_X) + // menu.add(new JMenuItem(Util.getAction(af, "about"))); + + //menu.add(new JMenuItem(Util.getAction(lw, "log"))); + + //menu.addSeparator(); + + //menu.add(new JMenuItem(Util.getAction(Application.getInstance(WiimoteWhiteboard.class), "donate"))); + + add(menu); + } + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/MenuBar.java~ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/MenuBar.java~ new file mode 100644 index 0000000..9e7ca8f --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/MenuBar.java~ @@ -0,0 +1,48 @@ +package org.mote.wiimote.whiteboard.gui; + +import java.awt.Toolkit; +import java.awt.event.KeyEvent; + +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.KeyStroke; + +import org.jdesktop.application.Application; +import org.mote.wiimote.whiteboard.WiimoteWhiteboard; +import org.mote.wiimote.whiteboard.util.Util; + +@SuppressWarnings("serial") +public class MenuBar extends JMenuBar { + + public MenuBar(PreferencesWindow pf, AboutWindow af, /*HelpHandler hh*/, LogWindow lw) { + JMenu menu; + JMenuItem item; + + if (!Util.MAC_OS_X) { + menu = new JMenu(Util.getResourceMap(MenuBar.class).getString("editMenu")); + menu.add(new JMenuItem(Util.getAction(pf, "preferences"))); + add(menu); + } + + //menu = new JMenu(Util.getResourceMap(HelpHandler.class).getString("help")); + + //menu.add(item = new JMenuItem(Util.getAction(hh, "help"))); + if (Util.MAC_OS_X) + item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_SLASH, KeyEvent.SHIFT_MASK | Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); + + //menu.addSeparator(); + + //if (!Util.MAC_OS_X) + // menu.add(new JMenuItem(Util.getAction(af, "about"))); + + //menu.add(new JMenuItem(Util.getAction(lw, "log"))); + + //menu.addSeparator(); + + //menu.add(new JMenuItem(Util.getAction(Application.getInstance(WiimoteWhiteboard.class), "donate"))); + + add(menu); + } + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/PreferencesWindow.java b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/PreferencesWindow.java new file mode 100644 index 0000000..0dc1ed6 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/PreferencesWindow.java @@ -0,0 +1,342 @@ +package org.mote.wiimote.whiteboard.gui; +import java.awt.BorderLayout; +import java.awt.FlowLayout; +import java.awt.Insets; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.awt.event.WindowEvent; +import java.awt.event.WindowFocusListener; +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.util.Dictionary; +import java.util.Hashtable; + +import javax.swing.BorderFactory; +import javax.swing.ButtonGroup; +import javax.swing.DefaultComboBoxModel; +import javax.swing.JButton; +import javax.swing.JCheckBox; +import javax.swing.JComboBox; +import javax.swing.JDialog; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.JSeparator; +import javax.swing.JSlider; +import javax.swing.JTabbedPane; +import javax.swing.JTextField; +import javax.swing.UIManager; +import javax.swing.border.Border; +import javax.swing.border.TitledBorder; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; + +import net.miginfocom.swing.MigLayout; + +import org.jdesktop.application.Action; +import org.jdesktop.application.Application; +import org.jdesktop.application.ResourceMap; +import org.mote.wiimote.whiteboard.WiimoteWhiteboard; +import org.mote.wiimote.whiteboard.mouse.DefaultControlStrategy; +import org.mote.wiimote.whiteboard.mouse.TouchpadControlStrategy; +import org.mote.wiimote.whiteboard.mouse.smoothing.AdaptiveExponentialSmoothing; +import org.mote.wiimote.whiteboard.mouse.smoothing.NoSmoothing; +import org.mote.wiimote.whiteboard.mouse.smoothing.SimpleMovingAverage; +import org.mote.wiimote.whiteboard.preferences.WWPreferences; +import org.mote.wiimote.whiteboard.preferences.WWPreferences.LocaleWrapper; +import org.mote.wiimote.whiteboard.util.Util; + +@SuppressWarnings("serial") +public class PreferencesWindow extends JDialog { + + private final static WWPreferences prefs = WWPreferences.getPreferences(); + private final static ResourceMap r = Util.getResourceMap(PreferencesWindow.class); + + private JSlider delaySlider; + private JTextField tuioHost; + private JButton defaultsButton; + private JCheckBox batteryWarning, checkForUpdates, tuioEnable, mouseSmoothing, touchpadMode, rightClicks, assistDoubleClicks; + private JRadioButton staticSmoothing, adaptiveSmoothing; + private JComboBox languages; + private JTabbedPane tabbedPane; + private boolean donePack = false; + + public PreferencesWindow(final MainPanel mp, final HelpHandler hh) { + super(Application.getInstance(WiimoteWhiteboard.class).getMainFrame(), r.getString("preferences.Action.text")); + + Border aquaBorder = UIManager.getBorder("TitledBorder.aquaVariant"); + if (aquaBorder != null) UIManager.put("TitledBorder.border", aquaBorder); + + // create panels + tabbedPane = new JTabbedPane(); + JPanel generalPanel = new JPanel(new MigLayout(Util.MAC_OS_X ? "insets para-10 para para para" : "")); + JPanel mousePanel = new JPanel(new MigLayout(Util.MAC_OS_X ? String.format("insets para-10 para %s para", Util.MAC_OS_X_LEOPARD_OR_HIGHER ? "para-10" : "para") : "")); + JPanel tuioPanel = new JPanel(new MigLayout(Util.MAC_OS_X ? "insets para-10 para para para" : "")); + generalPanel.setOpaque(false); + mousePanel.setOpaque(false); + tuioPanel.setOpaque(false); + tabbedPane.addTab(r.getString("generalTab"), generalPanel); + tabbedPane.addTab(r.getString("mouseTab"), mousePanel); + tabbedPane.addTab(r.getString("tuioTab"), tuioPanel); + + ((JPanel)getContentPane()).setBorder(BorderFactory.createEmptyBorder(8, 10, 10, 10)); + add(tabbedPane, BorderLayout.CENTER); + + /* + * GENERAL PANEL + */ + + // check for updates + generalPanel.add(checkForUpdates = Util.newComponent(JCheckBox.class, "checkForUpdates"), "wrap"); + checkForUpdates.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + prefs.setCheckForUpdates(checkForUpdates.isSelected()); + } + }); + + // low battery warning + generalPanel.add(batteryWarning = Util.newComponent(JCheckBox.class, "batteryWarning"), "wrap"); + batteryWarning.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + prefs.setLowBatteryWarning(batteryWarning.isSelected()); + } + }); + + generalPanel.add(new JSeparator(), "split, span, pushx, growx, wrap"); + + generalPanel.add(Util.newComponent(JLabel.class, "language"), "split, gapbottom 3, gapleft 6"); + generalPanel.add(languages = Util.newComponent(JComboBox.class, "languageBox"), "wrap"); + languages.setModel(new DefaultComboBoxModel(WWPreferences.LANGUAGES)); + languages.addItemListener(new ItemListener() { + public void itemStateChanged(ItemEvent e) { + if (e.getStateChange() == ItemEvent.SELECTED) { + prefs.setLanguage(((LocaleWrapper)languages.getSelectedItem()).getLocaleString()); + } + } + }); + generalPanel.add(Util.newComponent(JLabel.class, "languageRestartLabel"), "split, span, w 225, gapleft 6"); + + /* + * MOUSE CONTROL PANEL + */ + + // touchpad mode + mousePanel.add(touchpadMode = Util.newComponent(JCheckBox.class, "touchpadMode"), "wrap"); + touchpadMode.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + prefs.setCursorControl(touchpadMode.isSelected() ? TouchpadControlStrategy.class.getName() : DefaultControlStrategy.class.getName()); + } + }); + + mousePanel.add(assistDoubleClicks = Util.newComponent(JCheckBox.class, "assistDoubleClicks"), "wrap"); + assistDoubleClicks.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + prefs.setAssistDoubleClicks(assistDoubleClicks.isSelected()); + } + }); + + // mouse smoothing + final ButtonGroup smoothingGroup = new ButtonGroup(); + mousePanel.add(mouseSmoothing = Util.newComponent(JCheckBox.class, "mouseSmoothing"), "split"); + mouseSmoothing.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + staticSmoothing.setEnabled(mouseSmoothing.isSelected()); + adaptiveSmoothing.setEnabled(mouseSmoothing.isSelected()); + if (mouseSmoothing.isSelected()) { + if (smoothingGroup.getSelection() == null) + adaptiveSmoothing.doClick(); + else { + if (adaptiveSmoothing.isSelected()) adaptiveSmoothing.doClick(); + if (staticSmoothing.isSelected()) staticSmoothing.doClick(); + } + } else { + prefs.setMouseSmoothing(NoSmoothing.class.getName()); + } + } + }); + + mousePanel.add(staticSmoothing = Util.newComponent(JRadioButton.class, "staticSmoothing")); + staticSmoothing.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + prefs.setMouseSmoothing(SimpleMovingAverage.class.getName()); + } + }); + smoothingGroup.add(staticSmoothing); + + mousePanel.add(adaptiveSmoothing = Util.newComponent(JRadioButton.class, "adaptiveSmoothing")); + adaptiveSmoothing.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + prefs.setMouseSmoothing(AdaptiveExponentialSmoothing.class.getName()); + } + }); + smoothingGroup.add(adaptiveSmoothing); + + + + mousePanel.add(new JSeparator(), "newline, split, span, pushx, growx, wrap"); + + // right clicks + mousePanel.add(rightClicks = Util.newComponent(JCheckBox.class, "rightClicks"), "wrap"); + rightClicks.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + prefs.setRightClick(rightClicks.isSelected()); + } + }); + + // right click activation delay + JPanel wrapper = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0)); + wrapper.setOpaque(false); + final TitledBorder tb = BorderFactory.createTitledBorder(null, r.getString("rightClickDelay"), TitledBorder.CENTER, TitledBorder.DEFAULT_POSITION, new JLabel().getFont().deriveFont(11f)); + wrapper.setBorder(tb); + delaySlider = Util.newComponent(JSlider.class, "delaySlider"); + Dictionary labelTable = new Hashtable(); + labelTable.put(500, new JLabel("\u00bd")); + labelTable.put(1000, new JLabel("1")); + labelTable.put(2000, new JLabel("2")); + labelTable.put(3000, new JLabel("3")); + delaySlider.setLabelTable(labelTable); + delaySlider.addChangeListener(new ChangeListener() { + public void stateChanged(ChangeEvent e) { + if (!delaySlider.getValueIsAdjusting() && isVisible()) { + prefs.setRightClickDelay(delaySlider.getValue()); + } + } + }); + Insets tbInsets = tb.getBorderInsets(wrapper); + int tbWidth = tb.getMinimumSize(wrapper).width-tbInsets.left-tbInsets.right+(Util.MAC_OS_X_LEOPARD_OR_HIGHER ? 0 : 20); + wrapper.add(delaySlider); + mousePanel.add(wrapper, "center, growx, w " +tbWidth); + + /* + * TUIO/OSC PANEL + */ + + // enable tuio + tuioPanel.add(tuioEnable = Util.newComponent(JCheckBox.class, "tuioEnable"), "wrap"); + tuioEnable.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + if (tuioEnable.isSelected()) { + String[] s = tuioHost.getText().split(":"); + String errorTitle = null; + if ((s.length == 1 && s[0].length() == 0) || s.length > 2) { + errorTitle = r.getString("tuioInvalidFormat"); + } else { + try { + int port = 3333; + if (s.length == 2) { + port = Integer.valueOf(s[1]); + if (port < 0 || port > 0xFFFF) { + throw new NumberFormatException(); + } + } + InetAddress.getByName(s[0]); + + prefs.setTuioPort(port); + prefs.setTuioHost(s[0]); + prefs.setTuioEnabled(true); + } catch (NumberFormatException e) { + errorTitle = r.getString("tuioInvalidPort", s[1]); + } catch (UnknownHostException e) { + errorTitle = r.getString("tuioInvalidHost", s[0]); + } + } + + if (errorTitle != null) { + JOptionPane.showMessageDialog(PreferencesWindow.this, r.getString("tuioErrorMessage"), errorTitle, JOptionPane.ERROR_MESSAGE); + } + + } else { + prefs.setTuioEnabled(false); + } + update(); + } + }); + + // tuio host + tuioPanel.add(tuioHost = Util.newComponent(JTextField.class, "tuioHost"), "growx, pushx, wrap"); + + + JPanel bottomPanel = new JPanel(new MigLayout(Util.MAC_OS_X ? "insets 0 2 0 2, gap 0" : "insets i 0 0 0, gap 0")); + add(bottomPanel, BorderLayout.SOUTH); + + bottomPanel.add(defaultsButton = Util.newComponent(JButton.class, "resetButton")); + defaultsButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + prefs.reset(); + mp.update(); + update(); + } + }); + + JButton helpButton = new JButton(Util.getAction(hh, "help")); + bottomPanel.add(helpButton, "push, right"); + if (Util.MAC_OS_X_LEOPARD_OR_HIGHER) { + helpButton.setText(""); + helpButton.putClientProperty("JButton.buttonType", "help"); + } else { + helpButton.setText(Util.getResourceMap(HelpHandler.class).getString("help")); + } + + Util.getResourceMap(PreferencesWindow.class).injectComponents(this); + + pack(); + setResizable(false); + + if (Util.WINDOWS) { + addWindowFocusListener(new WindowFocusListener() { + public void windowGainedFocus(WindowEvent e) { + if (!donePack) { + donePack = true; + pack(); + Util.placeDialogWindow(PreferencesWindow.this, getWidth(), getHeight()); + } + } + public void windowLostFocus(WindowEvent e) {} + }); + } + } + + private void update() { + checkForUpdates.setSelected(prefs.checkForUpdates()); + batteryWarning.setSelected(prefs.isLowBatteryWarning()); + rightClicks.setSelected(prefs.isRightClick()); + assistDoubleClicks.setSelected(prefs.assistDoubleClicks()); + delaySlider.setValue((int)prefs.getRightClickDelay()); + tuioEnable.setSelected(prefs.isTuioEnabled()); + tuioHost.setText(String.format("%s:%d", prefs.getTuioHost(), prefs.getTuioPort())); + tuioHost.setEnabled(!tuioEnable.isSelected()); + tuioHost.setToolTipText(tuioHost.isEnabled() ? Util.getResourceMap(PreferencesWindow.class).getString("tuioHost.toolTipText") : r.getString("tuioDisableToEdit")); + + touchpadMode.setSelected(TouchpadControlStrategy.class.getName().equals(prefs.getCursorControl())); + + mouseSmoothing.setSelected(!NoSmoothing.class.getName().equals(prefs.getMouseSmoothing())); + adaptiveSmoothing.setSelected(true); + staticSmoothing.setSelected(SimpleMovingAverage.class.getName().equals(prefs.getMouseSmoothing())); + adaptiveSmoothing.setEnabled(mouseSmoothing.isSelected()); + staticSmoothing.setEnabled(mouseSmoothing.isSelected()); + + String lang = prefs.getLanguage(); + for (int i = 0; i < languages.getItemCount(); i++) { + LocaleWrapper lw = (LocaleWrapper)languages.getItemAt(i); + if (lang.equals(lw.getLocaleString())) { + languages.setSelectedIndex(i); + break; + } + } + } + + @Action + public void preferences() { + if (!isVisible()) { + update(); + pack(); + + Util.placeDialogWindow(this, getWidth(), getHeight()); + } + setVisible(true); + } + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/PreferencesWindow.java~ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/PreferencesWindow.java~ new file mode 100644 index 0000000..7b80e8e --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/PreferencesWindow.java~ @@ -0,0 +1,396 @@ +/* + * Copyright (C) 2008-2009, Uwe Schmidt + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * The Software uses a third-party library (WiiRemoteJ) which is not part of + * the Software and is subject to its own license. + */ + +package org.uweschmidt.wiimote.whiteboard.gui; +import java.awt.BorderLayout; +import java.awt.FlowLayout; +import java.awt.Insets; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.awt.event.WindowEvent; +import java.awt.event.WindowFocusListener; +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.util.Dictionary; +import java.util.Hashtable; + +import javax.swing.BorderFactory; +import javax.swing.ButtonGroup; +import javax.swing.DefaultComboBoxModel; +import javax.swing.JButton; +import javax.swing.JCheckBox; +import javax.swing.JComboBox; +import javax.swing.JDialog; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.JSeparator; +import javax.swing.JSlider; +import javax.swing.JTabbedPane; +import javax.swing.JTextField; +import javax.swing.UIManager; +import javax.swing.border.Border; +import javax.swing.border.TitledBorder; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; + +import net.miginfocom.swing.MigLayout; + +import org.jdesktop.application.Action; +import org.jdesktop.application.Application; +import org.jdesktop.application.ResourceMap; +import org.uweschmidt.wiimote.whiteboard.WiimoteWhiteboard; +import org.uweschmidt.wiimote.whiteboard.mouse.DefaultControlStrategy; +import org.uweschmidt.wiimote.whiteboard.mouse.TouchpadControlStrategy; +import org.uweschmidt.wiimote.whiteboard.mouse.smoothing.AdaptiveExponentialSmoothing; +import org.uweschmidt.wiimote.whiteboard.mouse.smoothing.NoSmoothing; +import org.uweschmidt.wiimote.whiteboard.mouse.smoothing.SimpleMovingAverage; +import org.uweschmidt.wiimote.whiteboard.preferences.WWPreferences; +import org.uweschmidt.wiimote.whiteboard.preferences.WWPreferences.LocaleWrapper; +import org.uweschmidt.wiimote.whiteboard.util.Util; + +@SuppressWarnings("serial") +public class PreferencesWindow extends JDialog { + + private final static WWPreferences prefs = WWPreferences.getPreferences(); + private final static ResourceMap r = Util.getResourceMap(PreferencesWindow.class); + + private JSlider delaySlider; + private JTextField tuioHost; + private JButton defaultsButton; + private JCheckBox batteryWarning, checkForUpdates, tuioEnable, mouseSmoothing, touchpadMode, rightClicks, assistDoubleClicks; + private JRadioButton staticSmoothing, adaptiveSmoothing; +// private JRadioButton[] wiimoteNumberButtons = new JRadioButton[WWPreferences.WIIMOTES]; + private JComboBox languages; + private JTabbedPane tabbedPane; + private boolean donePack = false; + + public PreferencesWindow(final MainPanel mp, final HelpHandler hh) { + super(Application.getInstance(WiimoteWhiteboard.class).getMainFrame(), r.getString("preferences.Action.text")); + + // use NSBox-like TitledBorder if available (Leopard) + Border aquaBorder = UIManager.getBorder("TitledBorder.aquaVariant"); + if (aquaBorder != null) UIManager.put("TitledBorder.border", aquaBorder); + + // create panels + tabbedPane = new JTabbedPane(); + JPanel generalPanel = new JPanel(new MigLayout(Util.MAC_OS_X ? "insets para-10 para para para" : "")); + // FIXME bottom insets too large, but only in French on Leopard?! + JPanel mousePanel = new JPanel(new MigLayout(Util.MAC_OS_X ? String.format("insets para-10 para %s para", Util.MAC_OS_X_LEOPARD_OR_HIGHER ? "para-10" : "para") : "")); + JPanel tuioPanel = new JPanel(new MigLayout(Util.MAC_OS_X ? "insets para-10 para para para" : "")); + generalPanel.setOpaque(false); + mousePanel.setOpaque(false); + tuioPanel.setOpaque(false); + tabbedPane.addTab(r.getString("generalTab"), generalPanel); + tabbedPane.addTab(r.getString("mouseTab"), mousePanel); + tabbedPane.addTab(r.getString("tuioTab"), tuioPanel); + + ((JPanel)getContentPane()).setBorder(BorderFactory.createEmptyBorder(8, 10, 10, 10)); + add(tabbedPane, BorderLayout.CENTER); + + /* + * GENERAL PANEL + */ + + // check for updates + generalPanel.add(checkForUpdates = Util.newComponent(JCheckBox.class, "checkForUpdates"), "wrap"); + checkForUpdates.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + prefs.setCheckForUpdates(checkForUpdates.isSelected()); + } + }); + + // low battery warning + generalPanel.add(batteryWarning = Util.newComponent(JCheckBox.class, "batteryWarning"), "wrap"); + batteryWarning.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + prefs.setLowBatteryWarning(batteryWarning.isSelected()); + } + }); + + generalPanel.add(new JSeparator(), "split, span, pushx, growx, wrap"); + + generalPanel.add(Util.newComponent(JLabel.class, "language"), "split, gapbottom 3, gapleft 6"); + generalPanel.add(languages = Util.newComponent(JComboBox.class, "languageBox"), "wrap"); +// languages.putClientProperty("JComboBox.isSquare", Boolean.TRUE); +// languages.putClientProperty("JComboBox.isPopDown", Boolean.TRUE); + languages.setModel(new DefaultComboBoxModel(WWPreferences.LANGUAGES)); + languages.addItemListener(new ItemListener() { + public void itemStateChanged(ItemEvent e) { + if (e.getStateChange() == ItemEvent.SELECTED) { + prefs.setLanguage(((LocaleWrapper)languages.getSelectedItem()).getLocaleString()); + } + } + }); + generalPanel.add(Util.newComponent(JLabel.class, "languageRestartLabel"), "split, span, w 225, gapleft 6"); + +// // number of wiimotes +// generalPanel.add(Util.newComponent(JLabel.class, "numberOfWiimotesLabel")); +// ButtonGroup bg = new ButtonGroup(); +// for (int i = 1; i <= WWPreferences.WIIMOTES; i++) { +// final int j = i-1; +// bg.add(wiimoteNumberButtons[j] = new JRadioButton(String.valueOf(i))); +// wiimoteNumberButtons[j].setOpaque(false); +// wiimoteNumberButtons[j].addActionListener(new ActionListener() { +// public void actionPerformed(ActionEvent e) { +// prefs.setNumberOfWiimotes(j+1); +// } +// }); +// generalPanel.add(wiimoteNumberButtons[j], i == 1 ? "split" : ""); +// } +// generalPanel.add(Util.newComponent(JLabel.class, "numberOfWiimotesExplLabel"), "newline, split, span, center, w 290"); + + /* + * MOUSE CONTROL PANEL + */ + + // touchpad mode + mousePanel.add(touchpadMode = Util.newComponent(JCheckBox.class, "touchpadMode"), "wrap"); + touchpadMode.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + prefs.setCursorControl(touchpadMode.isSelected() ? TouchpadControlStrategy.class.getName() : DefaultControlStrategy.class.getName()); + } + }); + + // assist double clicks + mousePanel.add(assistDoubleClicks = Util.newComponent(JCheckBox.class, "assistDoubleClicks"), "wrap"); + assistDoubleClicks.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + prefs.setAssistDoubleClicks(assistDoubleClicks.isSelected()); + } + }); + + // mouse smoothing + final ButtonGroup smoothingGroup = new ButtonGroup(); + mousePanel.add(mouseSmoothing = Util.newComponent(JCheckBox.class, "mouseSmoothing"), "split"); + mouseSmoothing.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + staticSmoothing.setEnabled(mouseSmoothing.isSelected()); + adaptiveSmoothing.setEnabled(mouseSmoothing.isSelected()); + if (mouseSmoothing.isSelected()) { + if (smoothingGroup.getSelection() == null) + adaptiveSmoothing.doClick(); + else { + // trigger actionlistener + if (adaptiveSmoothing.isSelected()) adaptiveSmoothing.doClick(); + if (staticSmoothing.isSelected()) staticSmoothing.doClick(); + } + } else { + prefs.setMouseSmoothing(NoSmoothing.class.getName()); + } + } + }); + + mousePanel.add(staticSmoothing = Util.newComponent(JRadioButton.class, "staticSmoothing")); + staticSmoothing.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + prefs.setMouseSmoothing(SimpleMovingAverage.class.getName()); + } + }); + smoothingGroup.add(staticSmoothing); + + mousePanel.add(adaptiveSmoothing = Util.newComponent(JRadioButton.class, "adaptiveSmoothing")); + adaptiveSmoothing.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + prefs.setMouseSmoothing(AdaptiveExponentialSmoothing.class.getName()); + } + }); + smoothingGroup.add(adaptiveSmoothing); + + + + mousePanel.add(new JSeparator(), "newline, split, span, pushx, growx, wrap"); + + // right clicks + mousePanel.add(rightClicks = Util.newComponent(JCheckBox.class, "rightClicks"), "wrap"); + rightClicks.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + prefs.setRightClick(rightClicks.isSelected()); + } + }); + + // right click activation delay + JPanel wrapper = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0)); + wrapper.setOpaque(false); + final TitledBorder tb = BorderFactory.createTitledBorder(null, r.getString("rightClickDelay"), TitledBorder.CENTER, TitledBorder.DEFAULT_POSITION, new JLabel().getFont().deriveFont(11f)); + wrapper.setBorder(tb); + delaySlider = Util.newComponent(JSlider.class, "delaySlider"); + Dictionary labelTable = new Hashtable(); + labelTable.put(500, new JLabel("\u00bd")); + labelTable.put(1000, new JLabel("1")); + labelTable.put(2000, new JLabel("2")); + labelTable.put(3000, new JLabel("3")); + delaySlider.setLabelTable(labelTable); + delaySlider.addChangeListener(new ChangeListener() { + public void stateChanged(ChangeEvent e) { + if (!delaySlider.getValueIsAdjusting() && isVisible()) { + prefs.setRightClickDelay(delaySlider.getValue()); + } + } + }); + Insets tbInsets = tb.getBorderInsets(wrapper); + int tbWidth = tb.getMinimumSize(wrapper).width-tbInsets.left-tbInsets.right+(Util.MAC_OS_X_LEOPARD_OR_HIGHER ? 0 : 20); + wrapper.add(delaySlider); + mousePanel.add(wrapper, "center, growx, w " +tbWidth); + + /* + * TUIO/OSC PANEL + */ + + // enable tuio + tuioPanel.add(tuioEnable = Util.newComponent(JCheckBox.class, "tuioEnable"), "wrap"); + tuioEnable.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + if (tuioEnable.isSelected()) { + String[] s = tuioHost.getText().split(":"); + String errorTitle = null; + if ((s.length == 1 && s[0].length() == 0) || s.length > 2) { + errorTitle = r.getString("tuioInvalidFormat"); + } else { + try { + int port = 3333; + if (s.length == 2) { + port = Integer.valueOf(s[1]); + if (port < 0 || port > 0xFFFF) { + throw new NumberFormatException(); + } + } + InetAddress.getByName(s[0]); + + prefs.setTuioPort(port); + prefs.setTuioHost(s[0]); + prefs.setTuioEnabled(true); + } catch (NumberFormatException e) { + errorTitle = r.getString("tuioInvalidPort", s[1]); + } catch (UnknownHostException e) { + errorTitle = r.getString("tuioInvalidHost", s[0]); + } + } + + if (errorTitle != null) { + JOptionPane.showMessageDialog(PreferencesWindow.this, r.getString("tuioErrorMessage"), errorTitle, JOptionPane.ERROR_MESSAGE); + } + + } else { + prefs.setTuioEnabled(false); + } + update(); + } + }); + + // tuio host + tuioPanel.add(tuioHost = Util.newComponent(JTextField.class, "tuioHost"), "growx, pushx, wrap"); + + + JPanel bottomPanel = new JPanel(new MigLayout(Util.MAC_OS_X ? "insets 0 2 0 2, gap 0" : "insets i 0 0 0, gap 0")); + add(bottomPanel, BorderLayout.SOUTH); + + bottomPanel.add(defaultsButton = Util.newComponent(JButton.class, "resetButton")); +// defaultsButton.putClientProperty("JButton.buttonType", "textured"); + defaultsButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + prefs.reset(); + // re-set currently chosen mouse control settings + // (probably not perceived as persistent preferences by user) + mp.update(); + update(); + } + }); + + JButton helpButton = new JButton(Util.getAction(hh, "help")); + bottomPanel.add(helpButton, "push, right"); + if (Util.MAC_OS_X_LEOPARD_OR_HIGHER) { + helpButton.setText(""); + helpButton.putClientProperty("JButton.buttonType", "help"); + } else { + helpButton.setText(Util.getResourceMap(HelpHandler.class).getString("help")); + } + + Util.getResourceMap(PreferencesWindow.class).injectComponents(this); + + pack(); + setResizable(false); + + if (Util.WINDOWS) { + addWindowFocusListener(new WindowFocusListener() { + public void windowGainedFocus(WindowEvent e) { + if (!donePack) { + donePack = true; + pack(); + Util.placeDialogWindow(PreferencesWindow.this, getWidth(), getHeight()); + } + } + public void windowLostFocus(WindowEvent e) {} + }); + } + } + + private void update() { + checkForUpdates.setSelected(prefs.checkForUpdates()); + batteryWarning.setSelected(prefs.isLowBatteryWarning()); + rightClicks.setSelected(prefs.isRightClick()); + assistDoubleClicks.setSelected(prefs.assistDoubleClicks()); + delaySlider.setValue((int)prefs.getRightClickDelay()); + tuioEnable.setSelected(prefs.isTuioEnabled()); + tuioHost.setText(String.format("%s:%d", prefs.getTuioHost(), prefs.getTuioPort())); + tuioHost.setEnabled(!tuioEnable.isSelected()); + tuioHost.setToolTipText(tuioHost.isEnabled() ? Util.getResourceMap(PreferencesWindow.class).getString("tuioHost.toolTipText") : r.getString("tuioDisableToEdit")); +// wiimoteNumberButtons[prefs.getNumberOfWiimotes()-1].setSelected(true); + + touchpadMode.setSelected(TouchpadControlStrategy.class.getName().equals(prefs.getCursorControl())); + + mouseSmoothing.setSelected(!NoSmoothing.class.getName().equals(prefs.getMouseSmoothing())); + adaptiveSmoothing.setSelected(true); + staticSmoothing.setSelected(SimpleMovingAverage.class.getName().equals(prefs.getMouseSmoothing())); + adaptiveSmoothing.setEnabled(mouseSmoothing.isSelected()); + staticSmoothing.setEnabled(mouseSmoothing.isSelected()); + + String lang = prefs.getLanguage(); + for (int i = 0; i < languages.getItemCount(); i++) { + LocaleWrapper lw = (LocaleWrapper)languages.getItemAt(i); + if (lang.equals(lw.getLocaleString())) { + languages.setSelectedIndex(i); + break; + } + } + } + + @Action + public void preferences() { + if (!isVisible()) { + update(); + pack(); +// if (Util.WINDOWS && !donePack) { +// setSize(getWidth(), 300); +// } + Util.placeDialogWindow(this, getWidth(), getHeight()); + } + setVisible(true); + } + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/ScreenSelector.java b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/ScreenSelector.java new file mode 100644 index 0000000..27a3199 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/ScreenSelector.java @@ -0,0 +1,206 @@ +package org.mote.wiimote.whiteboard.gui; + +import java.awt.BasicStroke; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.GraphicsDevice; +import java.awt.GraphicsEnvironment; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.RenderingHints; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.awt.geom.Point2D; +import java.awt.geom.Rectangle2D; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Timer; +import java.util.TimerTask; + +import javax.media.jai.PerspectiveTransform; +import javax.swing.BorderFactory; +import javax.swing.ButtonGroup; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.SwingConstants; + +import org.mote.wiimote.whiteboard.WiimoteDataHandler; +import org.mote.wiimote.whiteboard.WiimoteDataHandler.WiimoteDataListener; +import org.mote.wiimote.whiteboard.calibration.WiimoteCalibration; +import org.mote.wiimote.whiteboard.ds.IRDot; +import org.mote.wiimote.whiteboard.ds.Wiimote; +import org.mote.wiimote.whiteboard.util.Util; + +@SuppressWarnings("serial") +public class ScreenSelector extends JPanel implements WiimoteDataListener { + + private static final GraphicsDevice DEFAULT_SCREEN = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); + private static final int MAX_H = 130; + private static final int MAX_W = 185; + + private static final long REPAINT_FREQ = 1000 / 20; + + private WiimoteCalibration calibration; + private List screenBoxes = new LinkedList(); + private Point lastCursor = null, cursor = null; + + public ScreenSelector(WiimoteCalibration calibration, WiimoteDataHandler dh) { + super(null); + this.calibration = calibration; + dh.addWiimoteDataListener(this); + + final GraphicsDevice[] screens = GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices(); + + Rectangle r = new Rectangle(); + for (GraphicsDevice s : screens) { + r = r.union(s.getDefaultConfiguration().getBounds()); + } + + final int maxH = MAX_H - (screens.length == 1 ? 30 : 0); + int w = MAX_W; + int h = (int) Math.round((w * r.getHeight()) / r.getWidth()); + // if too high + if (h > maxH) { + h = maxH; + w = (int) Math.round((h * r.getWidth()) / r.getHeight()); + } + setPreferredSize(new Dimension(w, h)); + + PerspectiveTransform t = PerspectiveTransform.getQuadToQuad( + r.getMinX(), r.getMinY(), r.getMaxX(), r.getMinY(), + r.getMaxX(), r.getMaxY(), r.getMinX(), r.getMaxY(), + 0, 0, w, 0, w, h, 0, h); + + ButtonGroup bg = new ButtonGroup(); + for (int i = 0; i < screens.length; i++) { + Rectangle b = screens[i].getDefaultConfiguration().getBounds(); + final ScreenBox sb = new ScreenBox(screens[i], i, transformBounds(t, b), screens[i].equals(DEFAULT_SCREEN)); + bg.add(sb); + screenBoxes.add(sb); + add(sb); + } + + new Timer(true).schedule(new UpdateTask(), 0, REPAINT_FREQ); + } + + private class UpdateTask extends TimerTask { + @Override + public void run() { + if (cursor != lastCursor) { + for (ScreenBox sb : screenBoxes) { + if (sb.isSelected() && sb.isEnabled()) { + lastCursor = cursor; + sb.repaint(); + } + } + } + } + } + + private Rectangle transformBounds(PerspectiveTransform t, Rectangle b) { + Point2D ul = t.transform(new Point2D.Double(b.getMinX(), b.getMinY()), null); + Point2D ur = t.transform(new Point2D.Double(b.getMaxX(), b.getMinY()), null); + Point2D ll = t.transform(new Point2D.Double(b.getMinX(), b.getMaxY()), null); + return new Rectangle2D.Double(ul.getX(), ul.getY(), ul.distance(ur), ul.distance(ll)).getBounds(); + } + + @Override + public void setEnabled(boolean enabled) { + super.setEnabled(enabled); + enableScreenBoxes(enabled); + } + + private class ScreenBox extends JRadioButton { + private final BasicStroke STROKE = new BasicStroke(2f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER); + private static final int DIAMETER = 4; + private static final int MAX_TRACE = 1000 / (int)REPAINT_FREQ; + private LinkedList trace = new LinkedList(); + private GraphicsDevice screen; + private final Rectangle bounds; + public ScreenBox(GraphicsDevice screen, int i, Rectangle b, boolean selected) { + super(Util.getResourceMap(ScreenSelector.class).getString("screenText", i+1, (int)screen.getDefaultConfiguration().getBounds().getWidth(), (int)screen.getDefaultConfiguration().getBounds().getHeight())); + this.screen = screen; + bounds = screen.getDefaultConfiguration().getBounds(); + + setBounds(b); + setSelected(selected); + + setFocusable(false); + setHorizontalAlignment(SwingConstants.CENTER); + + if (!Util.MAC_OS_X) setBorder(BorderFactory.createEtchedBorder()); + setBorderPainted(true); + + addItemListener(new ItemListener() { + public void itemStateChanged(ItemEvent e) { + if (e.getStateChange() == ItemEvent.SELECTED) { + calibration.setScreen(ScreenBox.this.screen); + } + } + }); + } + + @Override + protected void paintComponent(Graphics g) { + super.paintComponent(g); + if (isSelected() && cursor != null) { + Graphics2D g2d = (Graphics2D)g; + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + try { + + int x = Math.max(0, Math.min(getWidth(), (int)Math.round(((cursor.x - bounds.x) / bounds.getWidth()) * getWidth()))); + int y = Math.max(0, Math.min(getHeight(), (int)Math.round(((cursor.y - bounds.y) / bounds.getHeight()) * getHeight()))); + + if (trace.size() > MAX_TRACE) + trace.removeFirst(); + + if (!trace.isEmpty()) { + g2d.setStroke(STROKE); + int inc = 255/MAX_TRACE, alpha = (MAX_TRACE - trace.size()) * inc; + Iterator it = trace.iterator(); + Point lp = it.next(); + while (it.hasNext()) { + Point p = it.next(); + g2d.setColor(new Color(0,0,255,alpha)); + g2d.drawLine(lp.x, lp.y, p.x, p.y); + lp = p; + alpha += inc; + } + g2d.setColor(Color.blue); + g2d.drawLine(lp.x, lp.y, x, y); + } + + g2d.setColor(Color.blue); + g2d.fillOval(x-DIAMETER/2, y-DIAMETER/2, DIAMETER, DIAMETER); + + trace.addLast(new Point(x,y)); + } catch (NullPointerException e) { + trace.clear(); + } + } else { + trace.clear(); + } + } + } + + private void enableScreenBoxes(boolean enabled) { + + for (ScreenBox b : screenBoxes) + b.setEnabled(enabled); + } + + public void irWarped(Map data, Point[] warped) { + cursor = warped[0]; + } + public void batteryLevel(Wiimote wiimote, double level) {} + public void irLights(Wiimote wiimote, IRDot[] lights) {} + public void wiimoteConnected(Wiimote wiimote) {} + public void wiimoteDisconnected(Wiimote wiimote) {} + + + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/ScreenSelector.java~ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/ScreenSelector.java~ new file mode 100644 index 0000000..e386ee4 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/ScreenSelector.java~ @@ -0,0 +1,311 @@ +/* + * Copyright (C) 2008-2009, Uwe Schmidt + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * The Software uses a third-party library (WiiRemoteJ) which is not part of + * the Software and is subject to its own license. + */ + +package org.uweschmidt.wiimote.whiteboard.gui; + +import java.awt.BasicStroke; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.GraphicsDevice; +import java.awt.GraphicsEnvironment; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.RenderingHints; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.awt.geom.Point2D; +import java.awt.geom.Rectangle2D; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Timer; +import java.util.TimerTask; + +import javax.media.jai.PerspectiveTransform; +import javax.swing.BorderFactory; +import javax.swing.ButtonGroup; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.SwingConstants; + +import org.uweschmidt.wiimote.whiteboard.WiimoteDataHandler; +import org.uweschmidt.wiimote.whiteboard.WiimoteDataHandler.WiimoteDataListener; +import org.uweschmidt.wiimote.whiteboard.calibration.WiimoteCalibration; +import org.uweschmidt.wiimote.whiteboard.ds.IRDot; +import org.uweschmidt.wiimote.whiteboard.ds.Wiimote; +import org.uweschmidt.wiimote.whiteboard.util.Util; + +@SuppressWarnings("serial") +public class ScreenSelector extends JPanel implements WiimoteDataListener { + + private static final GraphicsDevice DEFAULT_SCREEN = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); + private static final int MAX_H = 130; + private static final int MAX_W = 185; + + private static final long REPAINT_FREQ = 1000 / 20; + + private WiimoteCalibration calibration; +// private WiimoteDataHandler dh; + private List screenBoxes = new LinkedList(); + private Point lastCursor = null, cursor = null; + + public ScreenSelector(WiimoteCalibration calibration, WiimoteDataHandler dh) { + super(null); + this.calibration = calibration; +// this.dh = dh; + dh.addWiimoteDataListener(this); + + final GraphicsDevice[] screens = GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices(); + + // calculate maximum screen bounds (virtual device) + Rectangle r = new Rectangle(); + for (GraphicsDevice s : screens) { + r = r.union(s.getDefaultConfiguration().getBounds()); + } + + final int maxH = MAX_H - (screens.length == 1 ? 30 : 0); + // proportional bounds of panel + int w = MAX_W; + int h = (int) Math.round((w * r.getHeight()) / r.getWidth()); + // if too high + if (h > maxH) { + h = maxH; + w = (int) Math.round((h * r.getWidth()) / r.getHeight()); + } + setPreferredSize(new Dimension(w, h)); + + // map screen bounds to panel bounds + PerspectiveTransform t = PerspectiveTransform.getQuadToQuad( + r.getMinX(), r.getMinY(), r.getMaxX(), r.getMinY(), + r.getMaxX(), r.getMaxY(), r.getMinX(), r.getMaxY(), + 0, 0, w, 0, w, h, 0, h); + + // TODO temporary until multiple screens are allowed + ButtonGroup bg = new ButtonGroup(); + for (int i = 0; i < screens.length; i++) { + Rectangle b = screens[i].getDefaultConfiguration().getBounds(); + final ScreenBox sb = new ScreenBox(screens[i], i, transformBounds(t, b), screens[i].equals(DEFAULT_SCREEN)); + bg.add(sb); + screenBoxes.add(sb); + add(sb); + } + + new Timer(true).schedule(new UpdateTask(), 0, REPAINT_FREQ); + } + + private class UpdateTask extends TimerTask { + @Override + public void run() { + if (cursor != lastCursor) { + for (ScreenBox sb : screenBoxes) { + if (sb.isSelected() && sb.isEnabled()) { + lastCursor = cursor; + sb.repaint(); + } + } + } + } + } + + private Rectangle transformBounds(PerspectiveTransform t, Rectangle b) { + Point2D ul = t.transform(new Point2D.Double(b.getMinX(), b.getMinY()), null); + Point2D ur = t.transform(new Point2D.Double(b.getMaxX(), b.getMinY()), null); + Point2D ll = t.transform(new Point2D.Double(b.getMinX(), b.getMaxY()), null); + return new Rectangle2D.Double(ul.getX(), ul.getY(), ul.distance(ur), ul.distance(ll)).getBounds(); + } + + @Override + public void setEnabled(boolean enabled) { + super.setEnabled(enabled); + enableScreenBoxes(enabled); + } + + // TODO use JToggleButton instead of JRadioButton or JCheckBox + private class ScreenBox extends JRadioButton { + private final BasicStroke STROKE = new BasicStroke(2f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER); + private static final int DIAMETER = 4; + private static final int MAX_TRACE = 1000 / (int)REPAINT_FREQ; + private LinkedList trace = new LinkedList(); + private GraphicsDevice screen; + private final Rectangle bounds; +// private final int screenWidth, screenHeight; + public ScreenBox(GraphicsDevice screen, int i, Rectangle b, boolean selected) { + super(Util.getResourceMap(ScreenSelector.class).getString("screenText", i+1, (int)screen.getDefaultConfiguration().getBounds().getWidth(), (int)screen.getDefaultConfiguration().getBounds().getHeight())); + this.screen = screen; + bounds = screen.getDefaultConfiguration().getBounds(); +// screenWidth = (int)screen.getDefaultConfiguration().getBounds().getWidth(); +// screenHeight = (int)screen.getDefaultConfiguration().getBounds().getHeight(); + + setBounds(b); + setSelected(selected); + + setFocusable(false); + setHorizontalAlignment(SwingConstants.CENTER); + + if (!Util.MAC_OS_X) setBorder(BorderFactory.createEtchedBorder()); + setBorderPainted(true); + + addItemListener(new ItemListener() { + public void itemStateChanged(ItemEvent e) { + if (e.getStateChange() == ItemEvent.SELECTED) { + calibration.setScreen(ScreenBox.this.screen); + } +// enableScreenBoxes(true); + } + }); + } + + @Override + protected void paintComponent(Graphics g) { + super.paintComponent(g); + if (isSelected() && cursor != null) { + Graphics2D g2d = (Graphics2D)g; + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + try { +// g.setColor(new Color(255,255,255,75)); +// g.fillRect(0, 0, getWidth(), getHeight()); + + int x = Math.max(0, Math.min(getWidth(), (int)Math.round(((cursor.x - bounds.x) / bounds.getWidth()) * getWidth()))); + int y = Math.max(0, Math.min(getHeight(), (int)Math.round(((cursor.y - bounds.y) / bounds.getHeight()) * getHeight()))); + + if (trace.size() > MAX_TRACE) + trace.removeFirst(); + + if (!trace.isEmpty()) { + g2d.setStroke(STROKE); + int inc = 255/MAX_TRACE, alpha = (MAX_TRACE - trace.size()) * inc; + Iterator it = trace.iterator(); + Point lp = it.next(); + while (it.hasNext()) { + Point p = it.next(); + g2d.setColor(new Color(0,0,255,alpha)); + g2d.drawLine(lp.x, lp.y, p.x, p.y); + lp = p; + alpha += inc; + } + g2d.setColor(Color.blue); + g2d.drawLine(lp.x, lp.y, x, y); + } + + g2d.setColor(Color.blue); + g2d.fillOval(x-DIAMETER/2, y-DIAMETER/2, DIAMETER, DIAMETER); + + trace.addLast(new Point(x,y)); + } catch (NullPointerException e) { + // cursor can be null because of UpdateTask, no problem + trace.clear(); + } + } else { + trace.clear(); + } + } + } + + private void enableScreenBoxes(boolean enabled) { + + for (ScreenBox b : screenBoxes) + b.setEnabled(enabled); + +// if (!enabled) { +// for (ScreenBox b : screenBoxes) +// b.setEnabled(false); +// } else { +// LinkedList list = new LinkedList(); +// +// // enable all screens +// for (ScreenBox sb : screenBoxes) { +// sb.setEnabled(true); +// if (sb.isSelected()) list.add(sb); +// } +// +// // disallow deselection if only screen left +// if (list.size() == 1) +// list.getFirst().setEnabled(false); +// } + } + + public void irWarped(Map data, Point[] warped) { + cursor = warped[0]; + } + public void batteryLevel(Wiimote wiimote, double level) {} + public void irLights(Wiimote wiimote, IRDot[] lights) {} + public void wiimoteConnected(Wiimote wiimote) {} + public void wiimoteDisconnected(Wiimote wiimote) {} + + +// private class ScreenLabel extends JLabel { +// +// private boolean selected; +// private GraphicsDevice screen; +// +// public ScreenLabel(GraphicsDevice screen, int i, Rectangle b, boolean selected) { +// super(String.format("
Screen %d
%d x %d
", i+1, (int)screen.getDefaultConfiguration().getBounds().getWidth(), (int)screen.getDefaultConfiguration().getBounds().getHeight())); +// this.screen = screen; +// setSelected(selected); +// setBounds(b); +// setOpaque(true); +// setBorder(BorderFactory.createLineBorder(SystemColor.windowBorder)); +// setHorizontalAlignment(SwingConstants.CENTER); +// +// final ScreenLabel thisLabel = this; +// addMouseListener(new MouseAdapter() { +// @Override +// public void mousePressed(MouseEvent e) { +// if (thisLabel.isEnabled() && !thisLabel.isSelected()) { +// calibration.setScreen(thisLabel.screen); +// thisLabel.setSelected(true); +// repaint(); +// for (ScreenLabel l : screenLabels) { +// if (thisLabel != l) { +// l.setSelected(false); +// l.repaint(); +// } +// } +// } +// } +// }); +// } +// +// @Override +// public void setEnabled(boolean enabled) { +// super.setEnabled(enabled); +// setForeground(enabled ? SystemColor.textText : SystemColor.textInactiveText); +// } +// +// public void setSelected(boolean selected) { +// this.selected = selected; +// setBackground(selected ? SystemColor.textHighlight : SystemColor.window); +// } +// +// public boolean isSelected() { +// return selected; +// } +// +// } + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/WarpedMonitor.java b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/WarpedMonitor.java new file mode 100644 index 0000000..9fdb7af --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/WarpedMonitor.java @@ -0,0 +1,137 @@ +package org.mote.wiimote.whiteboard.gui; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.GraphicsDevice; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.awt.geom.Point2D; +import java.util.Map; +import java.util.Timer; +import java.util.TimerTask; + +import javax.swing.BorderFactory; +import javax.swing.JDialog; +import javax.swing.JPanel; + +import org.jdesktop.application.Action; +import org.jdesktop.application.Application; +import org.mote.wiimote.whiteboard.WiimoteDataHandler; +import org.mote.wiimote.whiteboard.WiimoteWhiteboard; +import org.mote.wiimote.whiteboard.WiimoteDataHandler.WiimoteDataListener; +import org.mote.wiimote.whiteboard.calibration.WiimoteCalibration; +import org.mote.wiimote.whiteboard.ds.IRDot; +import org.mote.wiimote.whiteboard.ds.Wiimote; +import org.mote.wiimote.whiteboard.preferences.WWPreferences; +import org.mote.wiimote.whiteboard.util.Util; + +@SuppressWarnings("serial") +public class WarpedMonitor extends JDialog implements WiimoteDataListener { + + private static final int REPAINT_FREQ = 1000 / 50; + static final int RADIUS = 10; + + private JPanel canvas; + private Point2D[][] lights = new Point2D[WWPreferences.WIIMOTES+1][4]; + private LightLabel[][] labels = new LightLabel[WWPreferences.WIIMOTES+1][4]; + private WiimoteCalibration calibration; + private WiimoteDataHandler dh; + + public WarpedMonitor(WiimoteDataHandler dh, final WiimoteCalibration calibration) { + super(Application.getInstance(WiimoteWhiteboard.class).getMainFrame(), "Warped Point Monitor"); + setLayout(new BorderLayout()); + dh.addWiimoteDataListener(this); + this.calibration = calibration; + this.dh = dh; + ((JPanel) getContentPane()).setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); + + canvas = new JPanel(null, true); + canvas.setBorder(BorderFactory.createLineBorder(Color.black)); + add(canvas, BorderLayout.CENTER); + + setUndecorated(true); + addKeyListener(new KeyAdapter() { + @Override + public void keyPressed(KeyEvent e) { + if (e.getKeyCode() == KeyEvent.VK_F || e.getKeyCode() == KeyEvent.VK_ESCAPE) { + GraphicsDevice screen = calibration.getScreen(); + if (screen != null) { + if (screen.getFullScreenWindow() == WarpedMonitor.this) { + ((JPanel) getContentPane()).setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); + screen.setFullScreenWindow(null); + Util.placeDialogWindow(WarpedMonitor.this, 640, 480); + } else { + if (e.getKeyCode() == KeyEvent.VK_ESCAPE) + WarpedMonitor.this.setVisible(false); + else { + ((JPanel) getContentPane()).setBorder(BorderFactory.createEmptyBorder()); + screen.setFullScreenWindow(WarpedMonitor.this); + } + } + } + } + } + }); + + Util.placeDialogWindow(this, 640, 480); + new Timer(true).schedule(new UpdateTask(), 0, REPAINT_FREQ); + } + + @Action + public void monitor() { + setVisible(true); + } + + private class UpdateTask extends TimerTask { + @Override + public void run() { + if (isVisible()) { + for (int i = WWPreferences.WIIMOTES; i >= 0; i--) + for (int j = 0; j < 4; j++) { + if (labels[i][j] != null) + labels[i][j].update(); + } + } + } + } + + public void irLights(Wiimote wiimote, IRDot[] lights) { + } + + public void irWarped(Map data, Point[] warped) { + if (isVisible()) { + Rectangle bounds = calibration.getScreen().getDefaultConfiguration().getBounds(); + for (int i = 0; i < 4; i++) { + final Point w = warped[i]; + this.lights[0][i] = w == null ? null : new Point2D.Double(w.getX() / bounds.getWidth(), 1 - w.getY() / bounds.getHeight()); + } + for (Wiimote wiimote : dh.getConnectedWiimotes()) { + for (int i = 0; i < 4; i++) { + final Point2D w = calibration.warp(i, wiimote, data); + this.lights[wiimote.getId()][i] = w == null ? null : new Point2D.Double(w.getX() / bounds.getWidth(), 1 - w.getY() / bounds.getHeight()); + } + } + } + } + + public void batteryLevel(Wiimote wiimote, double level) { + } + + public void wiimoteConnected(Wiimote wiimote) { + if (wiimote.getId() == 1) + for (int i = 0; i < 4; i++) + canvas.add(labels[0][i] = new LightLabel(canvas, lights, 0, i + 1, Color.red)); + for (int i = 0; i < 4; i++) + canvas.add(labels[wiimote.getId()][i] = new LightLabel(canvas, lights, wiimote.getId(), i + 1)); + } + + public void wiimoteDisconnected(Wiimote wiimote) { + for (int i = 0; i < 4; i++) { + canvas.remove(labels[wiimote.getId()][i]); + labels[wiimote.getId()][i] = null; + } + } + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/WarpedMonitor.java~ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/WarpedMonitor.java~ new file mode 100644 index 0000000..0c5301e --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/WarpedMonitor.java~ @@ -0,0 +1,183 @@ +/* + * Copyright (C) 2008-2009, Uwe Schmidt + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * The Software uses a third-party library (WiiRemoteJ) which is not part of + * the Software and is subject to its own license. + */ + +package org.uweschmidt.wiimote.whiteboard.gui; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.GraphicsDevice; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.awt.geom.Point2D; +import java.util.Map; +import java.util.Timer; +import java.util.TimerTask; + +import javax.swing.BorderFactory; +import javax.swing.JDialog; +import javax.swing.JPanel; + +import org.jdesktop.application.Action; +import org.jdesktop.application.Application; +import org.uweschmidt.wiimote.whiteboard.WiimoteDataHandler; +import org.uweschmidt.wiimote.whiteboard.WiimoteWhiteboard; +import org.uweschmidt.wiimote.whiteboard.WiimoteDataHandler.WiimoteDataListener; +import org.uweschmidt.wiimote.whiteboard.calibration.WiimoteCalibration; +import org.uweschmidt.wiimote.whiteboard.ds.IRDot; +import org.uweschmidt.wiimote.whiteboard.ds.Wiimote; +import org.uweschmidt.wiimote.whiteboard.preferences.WWPreferences; +import org.uweschmidt.wiimote.whiteboard.util.Util; + +@SuppressWarnings("serial") +public class WarpedMonitor extends JDialog implements WiimoteDataListener { + + private static final int REPAINT_FREQ = 1000 / 50; + static final int RADIUS = 10; + + private JPanel canvas; + private Point2D[][] lights = new Point2D[WWPreferences.WIIMOTES+1][4]; + private LightLabel[][] labels = new LightLabel[WWPreferences.WIIMOTES+1][4]; + private WiimoteCalibration calibration; + private WiimoteDataHandler dh; + + public WarpedMonitor(WiimoteDataHandler dh, final WiimoteCalibration calibration) { + super(Application.getInstance(WiimoteWhiteboard.class).getMainFrame(), "Warped Point Monitor"); + setLayout(new BorderLayout()); + dh.addWiimoteDataListener(this); + this.calibration = calibration; + this.dh = dh; + ((JPanel) getContentPane()).setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); + + canvas = new JPanel(null, true); + canvas.setBorder(BorderFactory.createLineBorder(Color.black)); + add(canvas, BorderLayout.CENTER); + + setUndecorated(true); + addKeyListener(new KeyAdapter() { + @Override + public void keyPressed(KeyEvent e) { + if (e.getKeyCode() == KeyEvent.VK_F || e.getKeyCode() == KeyEvent.VK_ESCAPE) { + GraphicsDevice screen = calibration.getScreen(); + if (screen != null) { + if (screen.getFullScreenWindow() == WarpedMonitor.this) { + ((JPanel) getContentPane()).setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); + screen.setFullScreenWindow(null); + Util.placeDialogWindow(WarpedMonitor.this, 640, 480); + } else { + if (e.getKeyCode() == KeyEvent.VK_ESCAPE) + WarpedMonitor.this.setVisible(false); + else { + ((JPanel) getContentPane()).setBorder(BorderFactory.createEmptyBorder()); + screen.setFullScreenWindow(WarpedMonitor.this); + } + } + } + } + } + }); + + Util.placeDialogWindow(this, 640, 480); + new Timer(true).schedule(new UpdateTask(), 0, REPAINT_FREQ); + } + + @Action + public void monitor() { + setVisible(true); + } + + private class UpdateTask extends TimerTask { + @Override + public void run() { + if (isVisible()) { + for (int i = WWPreferences.WIIMOTES; i >= 0; i--) + for (int j = 0; j < 4; j++) { + if (labels[i][j] != null) + labels[i][j].update(); + } + } + } + } + + public void irLights(Wiimote wiimote, IRDot[] lights) { + } + + public void irWarped(Map data, Point[] warped) { + if (isVisible()) { + Rectangle bounds = calibration.getScreen().getDefaultConfiguration().getBounds(); + for (int i = 0; i < 4; i++) { + final Point w = warped[i]; + this.lights[0][i] = w == null ? null : new Point2D.Double(w.getX() / bounds.getWidth(), 1 - w.getY() / bounds.getHeight()); + } +// Map warpedData = new LinkedHashMap(); + for (Wiimote wiimote : dh.getConnectedWiimotes()) { +// Point[] pArr = new Point[4]; + for (int i = 0; i < 4; i++) { + final Point2D w = calibration.warp(i, wiimote, data); +// pArr[i] = w; + this.lights[wiimote.getId()][i] = w == null ? null : new Point2D.Double(w.getX() / bounds.getWidth(), 1 - w.getY() / bounds.getHeight()); + } +// warpedData.put(address, pArr); + } +// +// Point[][] cluster = PointClusterer.cluster(warpedData); +// for (int i = 0; i < cluster.length; i++) { +// Point[] c = cluster[i]; +// double x = 0, y = 0; +// for (Point d : c) { +// x += d.getX(); +// y += d.getY(); +// } +// final Point2D w = new Point2D.Double(x/c.length, y/c.length); +// this.lights[0][i] = new Point2D.Double(w.getX() / bounds.getWidth(), 1 - w.getY() / bounds.getHeight()); +//// System.out.println(this.lights[0][i]); +// } +// for (int i = cluster.length; i < 4; i++) +// this.lights[0][i] = null; + + + } + } + + public void batteryLevel(Wiimote wiimote, double level) { + } + + public void wiimoteConnected(Wiimote wiimote) { + if (wiimote.getId() == 1) + for (int i = 0; i < 4; i++) + canvas.add(labels[0][i] = new LightLabel(canvas, lights, 0, i + 1, Color.red)); + for (int i = 0; i < 4; i++) + canvas.add(labels[wiimote.getId()][i] = new LightLabel(canvas, lights, wiimote.getId(), i + 1)); + } + + public void wiimoteDisconnected(Wiimote wiimote) { + for (int i = 0; i < 4; i++) { + canvas.remove(labels[wiimote.getId()][i]); + labels[wiimote.getId()][i] = null; + } + } + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/WiimoteIcon.java b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/WiimoteIcon.java new file mode 100644 index 0000000..3e1370b --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/WiimoteIcon.java @@ -0,0 +1,35 @@ +package org.mote.wiimote.whiteboard.gui; + +import java.awt.Color; +import java.awt.SystemColor; + +import javax.swing.BorderFactory; +import javax.swing.JLabel; +import javax.swing.JPanel; + +import net.miginfocom.swing.MigLayout; + +@SuppressWarnings("serial") +public class WiimoteIcon extends JPanel { + + public static final Color[] COLORS = { Color.white, Color.pink, Color.orange, Color.green }; + private JLabel idLabel; + + public WiimoteIcon(int id) { + setBackground(COLORS[id - 1]); + setBorder(BorderFactory.createLineBorder(Color.lightGray)); + setLayout(new MigLayout("insets 3, center")); + for (int i = 1; i <= 4; i++) { + JLabel l = new JLabel(); + l.setOpaque(true); + l.setBackground(SystemColor.textInactiveText); + add(l, "w 6!, h 6!"); + if (i == id) idLabel = l; + } + } + + public void displayConnected(boolean connected) { + idLabel.setBackground(connected ? Color.blue : SystemColor.textInactiveText); + } + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/WiimoteIcon.java~ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/WiimoteIcon.java~ new file mode 100644 index 0000000..bdef165 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/WiimoteIcon.java~ @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2008-2009, Uwe Schmidt + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * The Software uses a third-party library (WiiRemoteJ) which is not part of + * the Software and is subject to its own license. + */ + +package org.uweschmidt.wiimote.whiteboard.gui; + +import java.awt.Color; +import java.awt.SystemColor; + +import javax.swing.BorderFactory; +import javax.swing.JLabel; +import javax.swing.JPanel; + +import net.miginfocom.swing.MigLayout; + +@SuppressWarnings("serial") +public class WiimoteIcon extends JPanel { + + public static final Color[] COLORS = { Color.white, Color.pink, Color.orange, Color.green }; + private JLabel idLabel; + + public WiimoteIcon(int id) { + setBackground(COLORS[id - 1]); + setBorder(BorderFactory.createLineBorder(Color.lightGray)); + setLayout(new MigLayout("insets 3, center")); + for (int i = 1; i <= 4; i++) { + JLabel l = new JLabel(); + l.setOpaque(true); + l.setBackground(SystemColor.textInactiveText); + add(l, "w 6!, h 6!"); + if (i == id) idLabel = l; + } + } + + public void displayConnected(boolean connected) { + idLabel.setBackground(connected ? Color.blue : SystemColor.textInactiveText); + } + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/AboutWindow.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/AboutWindow.properties new file mode 100644 index 0000000..23c2809 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/AboutWindow.properties @@ -0,0 +1,13 @@ +about.Action.text = About +# no +aboutWindow.title = + +# no +appPane.opaque = false + +# no +infoPane.editable = false +# no +infoPane.contentType = text/html +# no +copyRight = Copyright \u00a9 %s %s diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/AboutWindow_de.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/AboutWindow_de.properties new file mode 100644 index 0000000..fa7eb0b --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/AboutWindow_de.properties @@ -0,0 +1,4 @@ +#:1223319130,Uwe + +about.Action.text=\u00dcber + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/AboutWindow_es.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/AboutWindow_es.properties new file mode 100644 index 0000000..da84e6d --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/AboutWindow_es.properties @@ -0,0 +1,5 @@ +#:1224611470,Descalzo + +# fuzzy +about.Action.text=Informaci\u00f3n + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/AboutWindow_et.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/AboutWindow_et.properties new file mode 100644 index 0000000..36ec9d6 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/AboutWindow_et.properties @@ -0,0 +1,4 @@ +#:1248461469,Marko + +about.Action.text=Programmist + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/AboutWindow_fr.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/AboutWindow_fr.properties new file mode 100644 index 0000000..c1044cd --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/AboutWindow_fr.properties @@ -0,0 +1,4 @@ +#:1223394792,Francois + +about.Action.text=A propos + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/AboutWindow_in.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/AboutWindow_in.properties new file mode 100644 index 0000000..74862d2 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/AboutWindow_in.properties @@ -0,0 +1,4 @@ +#:1274618503,Bobby + +about.Action.text=Tentang + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/AboutWindow_it.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/AboutWindow_it.properties new file mode 100644 index 0000000..219e9f9 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/AboutWindow_it.properties @@ -0,0 +1,4 @@ +#:1225965549,Francesco + +about.Action.text=Informazioni + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/AboutWindow_pl.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/AboutWindow_pl.properties new file mode 100644 index 0000000..6fe3252 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/AboutWindow_pl.properties @@ -0,0 +1,4 @@ +#:1253206914,Grzegorz + +about.Action.text=Info + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/AboutWindow_pt.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/AboutWindow_pt.properties new file mode 100644 index 0000000..6c46378 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/AboutWindow_pt.properties @@ -0,0 +1,4 @@ +#:1223492237,Francisco + +about.Action.text=Acerca + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/AboutWindow_ru.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/AboutWindow_ru.properties new file mode 100644 index 0000000..f2f2f18 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/AboutWindow_ru.properties @@ -0,0 +1,4 @@ +#:1265226935,Uwe + +about.Action.text=\u041e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435 + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/AboutWindow_ru_bak.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/AboutWindow_ru_bak.properties new file mode 100644 index 0000000..8af9f66 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/AboutWindow_ru_bak.properties @@ -0,0 +1,4 @@ +#Translated by Dmitry Pupinin (dlnsk@mail.ru) +#Mon Jan 25 00:31:50 NOVT 2010 +about.Action.text=\u041e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435 +copyRight=\u0410\u0432\u0442\u043e\u0440\u0441\u043a\u043e\u0435 \u043f\u0440\u0430\u0432\u043e \u00a9 %s %s diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/AboutWindow_sl.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/AboutWindow_sl.properties new file mode 100644 index 0000000..9e1e33a --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/AboutWindow_sl.properties @@ -0,0 +1,4 @@ +#:1238597107,Samo + +about.Action.text=O programu + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CalibrationInfoWindow.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CalibrationInfoWindow.properties new file mode 100644 index 0000000..fb7d1f9 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CalibrationInfoWindow.properties @@ -0,0 +1,24 @@ +info.Action.text = Calibration Details +info.Action.shortDescription = Shows details about the current calibration settings. + +# no +trackingUtility.minimum = 0 +# no +trackingUtility.maximum = 503316 +# no +trackingUtility.stringPainted = true +# no +trackingUtility.toolTipText = + +# no +trackingAreaLabel.horizontalAlignment = 0 +# no +calibratedScreenLabel.horizontalAlignment = 0 +# no +trackingAreaLabel.opaque = true +# no +calibratedScreenLabel.opaque = true + +trackingAreaLabel.text = Wiimote Tracking Area +calibratedScreenLabel.text = Calibrated Screen Area +trackingUtilString = Tracking Utilization: %.0f%% diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CalibrationInfoWindow_de.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CalibrationInfoWindow_de.properties new file mode 100644 index 0000000..01072ba --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CalibrationInfoWindow_de.properties @@ -0,0 +1,12 @@ +#:1223760565,Uwe + +info.Action.text=Kalibrierungs-Details + +info.Action.shortDescription=Zeigt Details \u00fcber die aktuelle Kalibrierung. + +trackingAreaLabel.text=Tracking-Bereich der Wiimote + +calibratedScreenLabel.text=Kalibrierter Bildschirm-Bereich + +trackingUtilString=Tracking-Nutzung: %.0f%% + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CalibrationInfoWindow_es.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CalibrationInfoWindow_es.properties new file mode 100644 index 0000000..45782fa --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CalibrationInfoWindow_es.properties @@ -0,0 +1,12 @@ +#:1224611921,Descalzo + +info.Action.text=Detalles de Calibraci\u00f3n + +info.Action.shortDescription=Las detalles de las posici\u00f3nes de la calibraci\u00f3n corriente. + +trackingAreaLabel.text=\u00c1rea de Rastreo del Wiimote + +calibratedScreenLabel.text=\u00c1rea de la Pantalla Calibrada + +trackingUtilString=Utilizaci\u00f3n de Rastreo: %.0f%% + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CalibrationInfoWindow_et.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CalibrationInfoWindow_et.properties new file mode 100644 index 0000000..84828a2 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CalibrationInfoWindow_et.properties @@ -0,0 +1,12 @@ +#:1248457890,Marko + +info.Action.text=Kalibreerimise \u00fcksikasjad + +info.Action.shortDescription=N\u00e4itab hetkel kehtiva kalibreeringu \u00fcksikasju. + +trackingAreaLabel.text=Wii puldi poolt j\u00e4lgitav ala + +calibratedScreenLabel.text=Kalibreeritud ekraani ala + +trackingUtilString=J\u00e4lgitava ala h\u00f5ivatus: %.0f%% + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CalibrationInfoWindow_fr.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CalibrationInfoWindow_fr.properties new file mode 100644 index 0000000..bc8a41e --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CalibrationInfoWindow_fr.properties @@ -0,0 +1,12 @@ +#:1223892916,Francois + +info.Action.text=D\u00e9tails de la calibration + +info.Action.shortDescription=Pr\u00e9sente en d\u00e9tail les param\u00e8tres de la calibration en cours. + +trackingAreaLabel.text=Aire suivie par la Wiimote + +calibratedScreenLabel.text=Aire d'\u00e9cran calibr\u00e9 + +trackingUtilString=Utilisation du suivi: %.0f%% + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CalibrationInfoWindow_in.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CalibrationInfoWindow_in.properties new file mode 100644 index 0000000..c94835c --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CalibrationInfoWindow_in.properties @@ -0,0 +1,12 @@ +#:1274618605,Bobby + +info.Action.text=Detail Kalibrasi + +info.Action.shortDescription=Menunjukkan informasi detail mengenai setting Kalibrasi yang digunakan. + +trackingAreaLabel.text=Area Tracking Wiimote + +calibratedScreenLabel.text=Area layar yang terkalibrasi + +trackingUtilString=Penggunaan Tracking: %.0f%% + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CalibrationInfoWindow_it.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CalibrationInfoWindow_it.properties new file mode 100644 index 0000000..6fadd7b --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CalibrationInfoWindow_it.properties @@ -0,0 +1,12 @@ +#:1225964626,Francesco + +info.Action.text=Dettagli della calibrazione + +info.Action.shortDescription=Mostra i dettagli della calibrazione corrente. + +trackingAreaLabel.text=Area di tracciamento del Wiimote + +calibratedScreenLabel.text=Area di calibrazione schermo + +trackingUtilString=Utilizzo del tracciamento: %.0f%% + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CalibrationInfoWindow_pl.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CalibrationInfoWindow_pl.properties new file mode 100644 index 0000000..4975b3f --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CalibrationInfoWindow_pl.properties @@ -0,0 +1,12 @@ +#:1253207905,Grzegorz + +info.Action.text=Szczeg\u00f3\u0142y kalibracji + +info.Action.shortDescription=Pokazuje szczeg\u00f3\u0142owe obszary wykonanej kalibracji. + +trackingAreaLabel.text=Pole widzenia Wiilot\u00f3w + +calibratedScreenLabel.text=Skalibrowane pole ekranu + +trackingUtilString=Optymalne wykorzystanie: %.0f%% + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CalibrationInfoWindow_pt.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CalibrationInfoWindow_pt.properties new file mode 100644 index 0000000..0ef74eb --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CalibrationInfoWindow_pt.properties @@ -0,0 +1,12 @@ +#:1223913940,Francisco + +info.Action.text=Detalhes da Calibra\u00e7\u00e3o + +info.Action.shortDescription=Apresenta os detalhes da presente calibra\u00e7\u00e3o. + +trackingAreaLabel.text=\u00c1rea de Visualiza\u00e7\u00e3o do Wiimote + +calibratedScreenLabel.text=\u00c1rea de Calibra\u00e7\u00e3o do Ecr\u00e3 + +trackingUtilString=Utiliza\u00e7\u00e3o da \u00c1rea de Visualiza\u00e7\u00e3o: %.0f%% + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CalibrationInfoWindow_ru.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CalibrationInfoWindow_ru.properties new file mode 100644 index 0000000..62cf4e9 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CalibrationInfoWindow_ru.properties @@ -0,0 +1,7 @@ +#Translated by Dmitry Pupinin (dlnsk@mail.ru) +#Mon Jan 25 00:14:24 NOVT 2010 +calibratedScreenLabel.text=\u041e\u0442\u043a\u0430\u043b\u0438\u0431\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u044d\u043a\u0440\u0430\u043d\u0430 +trackingAreaLabel.text=\u041e\u0431\u043b\u0430\u0441\u0442\u044c \u0441\u043b\u0435\u0436\u0435\u043d\u0438\u044f Wiimote +trackingUtilString=\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0430\u044f \u043e\u0431\u043b\u0430\u0441\u0442\u044c: %.0f%% +info.Action.text=\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u043a\u0430\u043b\u0438\u0431\u0440\u043e\u0432\u043a\u0438 +info.Action.shortDescription=\u041f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u043e \u0442\u0435\u043a\u0443\u0449\u0438\u0445 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 \u043a\u0430\u043b\u0438\u0431\u0440\u043e\u0432\u043a\u0438. diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CalibrationInfoWindow_sl.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CalibrationInfoWindow_sl.properties new file mode 100644 index 0000000..8fc5a03 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CalibrationInfoWindow_sl.properties @@ -0,0 +1,12 @@ +#:1238601491,Samo + +info.Action.text=Podrobnosti kalibracije + +info.Action.shortDescription=Prika\u017ee podrobnosti veljavne kalibracije. + +trackingAreaLabel.text=Obmo\u010dje zaznavanja + +calibratedScreenLabel.text=Kalibrirano obmo\u010dje + +trackingUtilString=Izkoristek obmo\u010dja zaznavanja: %.0f%% + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CameraMonitor.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CameraMonitor.properties new file mode 100644 index 0000000..609031e --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CameraMonitor.properties @@ -0,0 +1,2 @@ +monitor.Action.text = IR Camera Monitor +monitor.Action.shortDescription = Shows what the Wiimote's IR camera sees. Can assist you in finding a good position for the Wiimote. diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CameraMonitor_de.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CameraMonitor_de.properties new file mode 100644 index 0000000..bc0fcdf --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CameraMonitor_de.properties @@ -0,0 +1,6 @@ +#:1224191972,Uwe + +monitor.Action.text=IR Kamera Monitor + +monitor.Action.shortDescription=Zeigt was die Infrarot-Kamera der Wiimote sieht. Kann dabei helfen eine gute Position f\u00fcr die Wiimote zu finden. + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CameraMonitor_es.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CameraMonitor_es.properties new file mode 100644 index 0000000..646f6b3 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CameraMonitor_es.properties @@ -0,0 +1,6 @@ +#:1224192458,Uwe + +monitor.Action.text=Monitor de la C\u00e1mara de IR + +monitor.Action.shortDescription=Monitor de lo que ve la c\u00e1mara de infrarroja del Wiimote. Para asistir en encontrar la mejor posici\u00f3n del Wiimote. + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CameraMonitor_et.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CameraMonitor_et.properties new file mode 100644 index 0000000..c1bf5b5 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CameraMonitor_et.properties @@ -0,0 +1,6 @@ +#:1248457491,Marko + +monitor.Action.text=Infrapunakaamera monitor + +monitor.Action.shortDescription=N\u00e4itab mida Wii puldi infrapunakaamera n\u00e4eb. Aitab leida hea asetuse Wii puldile/pultidele. + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CameraMonitor_fr.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CameraMonitor_fr.properties new file mode 100644 index 0000000..7c705d6 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CameraMonitor_fr.properties @@ -0,0 +1,7 @@ +#:1224197209,Francois + +# 'Moniteur de la cam\u00e9ra IR' also OK? (need to save some space) +monitor.Action.text=Moniteur de la cam\u00e9ra IR + +monitor.Action.shortDescription=Vous indique ce que les cam\u00e9ras IR des Wiimotes enregistrent. Peut vous aider \u00e0 trouver la meilleure position pour les Wiimotes. + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CameraMonitor_in.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CameraMonitor_in.properties new file mode 100644 index 0000000..3f2938c --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CameraMonitor_in.properties @@ -0,0 +1,6 @@ +#:1275569889,Bobby + +monitor.Action.text=Monitor IR Camera + +monitor.Action.shortDescription=Menampikan apa yang dilihat oleh Kamera IR Wiimote. Dapat membantu anda dalam menemukan posisi yang bagus untuk Wiimote. + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CameraMonitor_it.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CameraMonitor_it.properties new file mode 100644 index 0000000..00f5832 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CameraMonitor_it.properties @@ -0,0 +1,6 @@ +#:1240346802,Uwe + +monitor.Action.text=Monitor videocamera a IR + +monitor.Action.shortDescription=Mostra cosa vede la videocamera a infrarossi del Wiimote. Pu\u00f2 aiutarti a trovare una buona posizione per il Wiimote. + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CameraMonitor_pl.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CameraMonitor_pl.properties new file mode 100644 index 0000000..94ce590 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CameraMonitor_pl.properties @@ -0,0 +1,6 @@ +#:1253209074,Grzegorz + +monitor.Action.text=Monitor czujnika IR + +monitor.Action.shortDescription=Pokazuje punkty rejestrowane przez czujnik. U\u0142atwia ustawienie Wiilot\u00f3w w optymalnej pozycji. + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CameraMonitor_pt.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CameraMonitor_pt.properties new file mode 100644 index 0000000..f5605b2 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CameraMonitor_pt.properties @@ -0,0 +1,7 @@ +#:1224239416,Francisco + +# 'Monitoriza\u00e7\u00e3o da C\u00e2mera de IV' also ok? +monitor.Action.text=Monitoriza\u00e7\u00e3o da C\u00e2mera de IV + +monitor.Action.shortDescription=Apresenta o que a c\u00e2mera de infravermelhos do Wiimote v\u00ea. Pode ajudar na escolha duma boa localiza\u00e7\u00e3o para o Wiimote. + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CameraMonitor_ru.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CameraMonitor_ru.properties new file mode 100644 index 0000000..9eafaf3 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CameraMonitor_ru.properties @@ -0,0 +1,4 @@ +#Translated by Dmitry Pupinin (dlnsk@mail.ru) +#Mon Jan 25 00:14:24 NOVT 2010 +monitor.Action.shortDescription=\u041f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0442\u043e, \u0447\u0442\u043e \u0432\u0438\u0434\u0438\u0442 \u0418\u041a-\u043a\u0430\u043c\u0435\u0440\u0430. \u041c\u043e\u0436\u0435\u0442 \u043f\u043e\u043c\u043e\u0447\u044c \u0432\u0430\u043c \u043d\u0430\u0439\u0442\u0438 \u0445\u043e\u0440\u043e\u0448\u0443\u044e \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0434\u043b\u044f Wiimote. +monitor.Action.text=\u041c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 \u0418\u041a-\u043a\u0430\u043c\u0435\u0440\u044b diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CameraMonitor_sl.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CameraMonitor_sl.properties new file mode 100644 index 0000000..5aad853 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/CameraMonitor_sl.properties @@ -0,0 +1,6 @@ +#:1238649529,Samo + +monitor.Action.text=Pogled IR kamere + +monitor.Action.shortDescription=Prika\u017ee vidno polje IR kamere. S tem pogledom in IR pisalom si lahko pomagate pri nastavitvi optimalnega polo\u017eaja Wiimotea. + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/Credits.html b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/Credits.html new file mode 100644 index 0000000..4aec7d4 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/Credits.html @@ -0,0 +1,86 @@ + + + +
+ +

+Website
+uweschmidt.org/wiimote-whiteboard +

+ +

+Developer
+Uwe Schmidt +

+ +

+Based on
+WiimoteWhiteboard by Johnny Lee +

+ +

+Translators
+Marko Puusaar (Estonian)
+
Francois Bocquet (French)
+
Uwe Schmidt (German)
+Bobby Adi Prabowo (Indonesian)
+Francesco Del Prato, Roberto Marcolin (Italian)
+Grzegorz Ciaglo (Polish)
+Francisco Cardoso Lima (Portuguese)
+Dmitry Pupinin (Russian)
+Samo Vesel (Slovene)
+Peter Skouson (Spanish)
+

+ +

+Third Party Software
+Bare Bones Browser Launch
+
BlueCove
+Java Advanced Imaging
+MiGLayout
+NetUtil
+OSXAdapter
+Swing Application Framework
+Swing Worker
+WiiRemoteJ
+

+ +

+Icons
+Crystal Project
+
Francisco Cardoso Lima - Application Icon, Calibration Icons +

+ +

+Warranty Information
+This software is licensed
+under a modified MIT License: +

+ +
+Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions:

+ +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software.

+ +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE.

+ +The Software uses a third-party library (WiiRemoteJ) which is not part of +the Software and is subject to its own license. +
+
+ + + + \ No newline at end of file diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/HelpHandler.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/HelpHandler.properties new file mode 100644 index 0000000..217e9f9 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/HelpHandler.properties @@ -0,0 +1,3 @@ +help = Help +help.Action.text = ${Application.id} ${help} +helpQuestion = Basic help was shipped with the application in form of HTML-files.${nl}Do you want to go to the website? diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/HelpHandler_de.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/HelpHandler_de.properties new file mode 100644 index 0000000..ba146e1 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/HelpHandler_de.properties @@ -0,0 +1,8 @@ +#:1224677835,Uwe + +help=Hilfe + +help.Action.text=${Application.id}-${help} + +helpQuestion=Grundlegende Hilfe ist dem Programm in Form von HTML-Dateien beigelegt.${nl}M\u00f6chtest du die Website \u00f6ffnen? + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/HelpHandler_es.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/HelpHandler_es.properties new file mode 100644 index 0000000..f1f34ea --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/HelpHandler_es.properties @@ -0,0 +1,9 @@ +#:1224677717,Uwe + +help=Ayuda + +help.Action.text=${help} ${Application.id} + +# fuzzy +helpQuestion=La ayuda b\u00e1sica lleg\u00f3 con la aplicac\u00edon en forma de archivos HTML.${nl}Quieres continuar al sitio de web? + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/HelpHandler_et.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/HelpHandler_et.properties new file mode 100644 index 0000000..b1d9626 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/HelpHandler_et.properties @@ -0,0 +1,8 @@ +#:1248461603,Marko + +help=Abi + +help.Action.text=${Application.id} ${help} + +helpQuestion=P\u00f5hiline abiinfo tuli programmiga kaasa HTML failidena.${nl}Soovid Sa minna kodulehek\u00fcljele? + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/HelpHandler_fr.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/HelpHandler_fr.properties new file mode 100644 index 0000000..8fb4509 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/HelpHandler_fr.properties @@ -0,0 +1,8 @@ +#:1224677674,Uwe + +help=Aide + +help.Action.text=${help} ${Application.id} + +helpQuestion=Une aide simple est fournie avec l'application en fichier HTML.${nl}Veux tu visiter le site web ? + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/HelpHandler_in.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/HelpHandler_in.properties new file mode 100644 index 0000000..0cc7b90 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/HelpHandler_in.properties @@ -0,0 +1,8 @@ +#:1274618776,Bobby + +help=Bantuan + +help.Action.text=${Application.id} ${help} + +helpQuestion=Bantuan dasar disertakan dalam aplikasi dalam bentuk file HTML.${nl}Apakah anda ingin menuju ke websitenya? + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/HelpHandler_it.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/HelpHandler_it.properties new file mode 100644 index 0000000..063343c --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/HelpHandler_it.properties @@ -0,0 +1,8 @@ +#:1225964854,Francesco + +help=Aiuto + +help.Action.text=${Application.id} ${help} + +helpQuestion=L'aiuto di base \u00e8 allegato al programma in forma di file HTML.${nl}Vuoi visitare il sito web? + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/HelpHandler_pl.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/HelpHandler_pl.properties new file mode 100644 index 0000000..b7e3672 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/HelpHandler_pl.properties @@ -0,0 +1,8 @@ +#:1253209629,Grzegorz + +help=Pomoc + +help.Action.text=${Application.id} ${help} + +helpQuestion=Pliki pomocy w formacie HTML s\u0105 umieszczone w folderze programu.${nl}Chcesz przej\u015b\u0107 do strony web? ${nl} + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/HelpHandler_pt.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/HelpHandler_pt.properties new file mode 100644 index 0000000..e820fe9 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/HelpHandler_pt.properties @@ -0,0 +1,8 @@ +#:1224677791,Uwe + +help=Ajuda + +help.Action.text=${help} ${Application.id} + +helpQuestion=O programa cont\u00e9m ficheiros HTML de ajuda.${nl}Pretende ir para o website? + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/HelpHandler_ru.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/HelpHandler_ru.properties new file mode 100644 index 0000000..017bbce --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/HelpHandler_ru.properties @@ -0,0 +1,5 @@ +#Translated by Dmitry Pupinin (dlnsk@mail.ru) +#Mon Jan 25 00:14:24 NOVT 2010 +help.Action.text=${Application.id}-${help} +help=\u0421\u043f\u0440\u0430\u0432\u043a\u0430 +helpQuestion=\u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0441\u043f\u0440\u0430\u0432\u043a\u0430 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043e\u0439 \u0432 \u0432\u0438\u0434\u0435 HTML-\u0444\u0430\u0439\u043b\u043e\u0432.${nl}\u0416\u0435\u043b\u0430\u0435\u0442\u0435 \u043f\u043e\u0441\u0435\u0442\u0438\u0442\u044c \u0432\u0435\u0431-\u0441\u0430\u0439\u0442? diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/HelpHandler_sl.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/HelpHandler_sl.properties new file mode 100644 index 0000000..1286cfe --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/HelpHandler_sl.properties @@ -0,0 +1,8 @@ +#:1238610569,Uwe + +help=Pomo\u010d + +help.Action.text=${Application.id} ${help} + +helpQuestion=Osnovno pomo\u010d v HTML obliki najdete v mapi programa.${nl}\u017delite obiskati spletno stran? + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/LogWindow.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/LogWindow.properties new file mode 100644 index 0000000..6f636b8 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/LogWindow.properties @@ -0,0 +1,22 @@ +log.Action.text = Log +# no +log.Action.accelerator = shortcut L + +#log.focusable = false +# no +log.editable = false +# no +log.font = Courier-PLAIN-12 + +# no +failedDialog.resizable = false +# no +failedDialog.modal = false +# no +failedDialog.title = ${Application.id} + +failedLabel.text = Connection failed. Please try again. +# no +failedLabel.horizontalAlignment = 0 +# no +failedLabel.font = PLAIN-18 diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/LogWindow_de.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/LogWindow_de.properties new file mode 100644 index 0000000..ae41a43 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/LogWindow_de.properties @@ -0,0 +1,6 @@ +#:1223326759,Uwe + +log.Action.text=Log + +failedLabel.text=Verbindung fehlgeschlagen. Bitte versuche es erneut. + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/LogWindow_es.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/LogWindow_es.properties new file mode 100644 index 0000000..361423e --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/LogWindow_es.properties @@ -0,0 +1,6 @@ +#:1224612036,Descalzo + +log.Action.text=Diario + +failedLabel.text=La conecci\u00f3n fall\u00f3. Por favor, vuelva a intentar. + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/LogWindow_et.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/LogWindow_et.properties new file mode 100644 index 0000000..9a8db64 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/LogWindow_et.properties @@ -0,0 +1,6 @@ +#:1248457179,Marko + +log.Action.text=Logi + +failedLabel.text=\u00dchendus eba\u00f5nnestus. Palun proovi uuesti. + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/LogWindow_fr.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/LogWindow_fr.properties new file mode 100644 index 0000000..8a80245 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/LogWindow_fr.properties @@ -0,0 +1,6 @@ +#:1223395031,Francois + +log.Action.text=Log + +failedLabel.text=La connexion a \u00e9chou\u00e9. Merci d'essayer \u00e0 nouveau. + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/LogWindow_in.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/LogWindow_in.properties new file mode 100644 index 0000000..2687dc7 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/LogWindow_in.properties @@ -0,0 +1,6 @@ +#:1274688096,Bobby + +log.Action.text=Catatan + +failedLabel.text=Koneksi Gagal. Harap coba lagi. + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/LogWindow_it.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/LogWindow_it.properties new file mode 100644 index 0000000..9203c6f --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/LogWindow_it.properties @@ -0,0 +1,6 @@ +#:1225964887,Francesco + +log.Action.text=Log + +failedLabel.text=Connessione fallita. Per favore prova di nuovo. + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/LogWindow_pl.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/LogWindow_pl.properties new file mode 100644 index 0000000..ba68b16 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/LogWindow_pl.properties @@ -0,0 +1,6 @@ +#:1253209821,Grzegorz + +log.Action.text=Log + +failedLabel.text=Po\u0142\u0105czenie nieudane. Spr\u00f3buj ponownie. + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/LogWindow_pt.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/LogWindow_pt.properties new file mode 100644 index 0000000..5d66742 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/LogWindow_pt.properties @@ -0,0 +1,7 @@ +#:1224239552,Francisco + +# http://pt.wikipedia.org/wiki/Log_de_dados +log.Action.text=Registo + +failedLabel.text=Liga\u00e7\u00e3o n\u00e3o estabelecida. Tente de novo. + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/LogWindow_ru.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/LogWindow_ru.properties new file mode 100644 index 0000000..5e93ab3 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/LogWindow_ru.properties @@ -0,0 +1,4 @@ +#Translated by Dmitry Pupinin (dlnsk@mail.ru) +#Mon Jan 25 00:14:24 NOVT 2010 +log.Action.text=\u041b\u043e\u0433 +failedLabel.text=\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u0438\u0442\u044c\u0441\u044f. \u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0441\u043d\u043e\u0432\u0430. diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/LogWindow_sl.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/LogWindow_sl.properties new file mode 100644 index 0000000..5837177 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/LogWindow_sl.properties @@ -0,0 +1,6 @@ +#:1238598078,Samo + +log.Action.text=Dnevnik + +failedLabel.text=Povezava ni uspela. Prosimo vas, da poskusite \u0161e enkrat. + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MainPanel.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MainPanel.properties new file mode 100644 index 0000000..9e1536f --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MainPanel.properties @@ -0,0 +1,49 @@ +wiimoteHeadline = Wiimotes + +# no +batteryLevelBar.minimum = 0 +# no +batteryLevelBar.maximum = 100 +# no +batteryLevelBar.stringPainted = true +batteryLevelBar.toolTipText = Connect your Wiimote by pushing the 1 and 2 buttons at the same time or press the red button under the battery case. + +searching = Searching +batteryLevel = Battery: %.0f%% + +resetCameraButton.text = Reset +resetCameraButton.toolTipText = Resets the Wiimote's IR camera. Use when you have problems with IR sensitivity. + +lowBattery = Battery is low +disconnected = Wiimote %d disconnected.${nl}Disconnecting Wiimotes may be possible in a future release.${nl}For now please restart the program. + + +calibrationHeadline = Calibration +screenBox.toolTipText = Select the screen to be used. +screen = Screen %d (%dx%d) +visibleDotsLabel.text = Visible IR dots: +visibleDotsLabel.toolTipText = Shows the visible IR dots, detected by the Wiimote's IR camera in real-time. +#lightLabel.horizontalAlignment = 0 +#lightLabel.opaque = true +calibrationButton.text = Calibrate +calibrationButton.toolTipText = Starts touch calibration using the currently selected screen. + +mouseControlHeadline = Mouse Control +cursorControl.text = Enabled +cursorControl.toolTipText = Activates mouse control.${nl}Requires calibration. +moveMouse.text = Move Only +moveMouse.toolTipText = Only move the mouse cursor. +leftClick.text = Move & Click +leftClick.toolTipText = Move the mouse cursor and press the left mouse button. +rightClick.text = Right Click +rightClick.toolTipText = Enables right clicks. + +statusLabel.text = Press buttons 1 & 2 +# no +statusLabel.horizontalAlignment = 0 +#statusLabel.icon = icons/info.png +#statusLabel.opaque = true +#statusLabel.visible = false + +calibrated = Calibrated +notCalibrated = Not calibrated diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MainPanel_de.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MainPanel_de.properties new file mode 100644 index 0000000..8d27d57 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MainPanel_de.properties @@ -0,0 +1,56 @@ +#:1224192099,Uwe + +wiimoteHeadline=Wiimotes + +batteryLevelBar.toolTipText=Verbinde die Wiimote durch gleichzeitiges Dr\u00fccken der Buttons 1 & 2, oder benutze den roten Knopf unter dem Batteriedeckel. + +searching=Suche + +batteryLevel=Batterie: %.0f%% + +resetCameraButton.text=Reset + +resetCameraButton.toolTipText=Re-Initialisiert die Infrarot-Kamera der Wiimote. Zu benutzen wenn es Probleme mit der IR Empfindlichkeit gibt. + +lowBattery=Batteriestand ist niedrig + +disconnected=Verbindung zu Wiimote %d wurde getrennt.${nl}Das Abschalten von Wiimotes ist vielleicht in einer zuk\u00fcnftigen Programmversion m\u00f6glich.${nl}Vorerst starte bitte das Programm neu. + +calibrationHeadline=Kalibrierung + +screenBox.toolTipText=W\u00e4hle den zu benutzenden Bildschirm. + +screen=Bildschirm %d (%dx%d) + +visibleDotsLabel.text=Sichtbare IR Punkte: + +visibleDotsLabel.toolTipText=Zeigt die Punkte im Sichtfeld der Infrarot-Kamera der Wiimote (in Echtzeit) an. + +calibrationButton.text=Kalibriere + +calibrationButton.toolTipText=Startet die Kalibrierung unter Verwendung des derzeit gew\u00e4hlten Bildschirms. + +mouseControlHeadline=Maussteuerung + +cursorControl.text=Aktiviert + +cursorControl.toolTipText=Aktiviert die Maussteuerung.${nl}Erfordert vorherige Kalibrierung. + +moveMouse.text=Nur Bewegen + +moveMouse.toolTipText=Nur den Mauszeiger bewegen. + +leftClick.text=Bewegen & Klicken + +leftClick.toolTipText=Bewegt den Mauszeiger und dr\u00fcckt die linke Maustaste. + +rightClick.text=Rechtsklick + +rightClick.toolTipText=Rechtsklicks aktivieren. + +statusLabel.text=Buttons 1 & 2 dr\u00fccken + +calibrated=Kalibriert + +notCalibrated=Nicht kalibriert + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MainPanel_es.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MainPanel_es.properties new file mode 100644 index 0000000..a684545 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MainPanel_es.properties @@ -0,0 +1,60 @@ +#:1224192641,Uwe + +wiimoteHeadline=Wiimotes + +batteryLevelBar.toolTipText=Conecte su Wiimote oprimiendo los botones 1 y 2 a la misma vez, o oprime el bot\u00f3n rojo dentro del compartamento de bater\u00eda. + +searching=Buscando + +batteryLevel=Bater\u00eda: %.0f%% + +resetCameraButton.text=Reiniciar + +resetCameraButton.toolTipText=Renicia la c\u00e1mara de IR del Wiimote. Si tiene problemas con sensitividad. + +lowBattery=Bater\u00eda baja + +disconnected=Wiimote %d disconectado.${nl}En versiones futuras, puede ser posible que la habilidad de desconectar sea incluida.${nl}Hasta entonces, reinicie el programa. + +calibrationHeadline=Calibraci\u00f3n + +screenBox.toolTipText=Seleccione la pantalla para usarse con el Wiimote. + +screen=Pantalla %d (%dx%d) + +visibleDotsLabel.text=Puntos visibles de IR: + +# I don't know how to say Real-Time in Spanish. -> No problem +visibleDotsLabel.toolTipText=Ense\u00f1a los puntos vistos por la c\u00e1mara de IR del Wiimote. + +calibrationButton.text=Calibrar + +calibrationButton.toolTipText=Comienza la calibraci\u00f3n usando la pantalla seleccionada. + +mouseControlHeadline=Control de Rat\u00f3n + +# I put Activated instead of Enabled. -> OK +# fuzzy +cursorControl.text=Activado + +cursorControl.toolTipText=Activa el control del rat\u00f3n.${nl}Requiere calibraci\u00f3n. + +moveMouse.text=Mover solamente + +# fuzzy +moveMouse.toolTipText=Solamente mueve la flecha del rat\u00f3n. + +leftClick.text=Mover y clic + +leftClick.toolTipText=Mueve la flecha del rat\u00f3n y oprima el bot\u00f3n de la izquierda. + +rightClick.text=Clic de la derecha + +rightClick.toolTipText=Activa el clic de la derecha. + +statusLabel.text=Oprima los bot\u00f3nes 1 y 2 + +calibrated=Calibrado + +notCalibrated=No calibrado + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MainPanel_et.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MainPanel_et.properties new file mode 100644 index 0000000..f963083 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MainPanel_et.properties @@ -0,0 +1,56 @@ +#:1248471392,Marko + +wiimoteHeadline=Wii puldid + +batteryLevelBar.toolTipText=\u00dchenda Wii puldid programmiga vajutades puldil korraga nuppe 1 ja 2 v\u00f5i vajutades punasele nupule patareikambris. + +searching=Otsin + +batteryLevel=Patareid: %.0f%% + +resetCameraButton.text=L\u00e4htesta + +resetCameraButton.toolTipText=L\u00e4htestab Wii puldi infrapunakaamera. Kasuta juhul kui infrapunakaamera tundlikkusega esineb probleeme. + +lowBattery=Patareid hakkavad t\u00fchjaks saama + +disconnected=Wii pult %d on lahti \u00fchendatud.${nl}Pultide lahti\u00fchendamine v\u00f5ib tulevikus v\u00f5imalik olla aga hetkel see toetatud ei ole.${nl}Hetkel palun taask\u00e4ivita programm. + +calibrationHeadline=Kalibreerimine + +screenBox.toolTipText=Vali millist ekraani kasutada. + +screen=Ekraan %d (%dx%d) + +visibleDotsLabel.text=N\u00e4htavad punktid: + +visibleDotsLabel.toolTipText=N\u00e4itab reaalajas Wii puldi kaamerale n\u00e4htavaid infrapuna punkte. + +calibrationButton.text=Kalibreeri + +calibrationButton.toolTipText=Alustab kalibreerimist hetkel valitud ekraanile. + +mouseControlHeadline=Hiire juhtimine + +cursorControl.text=Lubatud + +cursorControl.toolTipText=Aktiveerib hiire juhtimise.${nl}Vajab kalibreerimist. + +moveMouse.text=Ainult liiguta + +moveMouse.toolTipText=Liiguta hiirekursor n\u00e4idatud kohta. + +leftClick.text=Liiguta ja kliki + +leftClick.toolTipText=Liiguta hiirekursor n\u00e4idatud kohta ja soorita vasakklikk. + +rightClick.text=Paremklikk + +rightClick.toolTipText=Lubab paremklikid. + +statusLabel.text=Vajuta Wii puldil korraga nuppe 1 ja 2 + +calibrated=Kalibreeritud + +notCalibrated=Kalibreerimata + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MainPanel_fr.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MainPanel_fr.properties new file mode 100644 index 0000000..0ba5efd --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MainPanel_fr.properties @@ -0,0 +1,56 @@ +#:1223892965,Francois + +wiimoteHeadline=Wiimotes + +batteryLevelBar.toolTipText=Connecter votre Wiimote en pressant les boutons 1 et 2 en m\u00eame temps ou en pressant le bouton rouge sous le boitier de la batterie. + +searching=Recherche en cours + +batteryLevel=Batterie: %.0f%% + +resetCameraButton.text=Red\u00e9marrer + +resetCameraButton.toolTipText=Red\u00e9marrer les cam\u00e9ras infra-rouge des Wiimotes. A utiliser quand vous rencontrez un probl\u00e8me avec la sensibilit\u00e9 \u00e0 l'infra-rouge. + +lowBattery=Batterie faible + +disconnected=Wiimote %d deconnect\u00e9e.${nl}La d\u00e9connexion des Wiimotes devrait \u00eatre possible dans une future version.${nl}Pour le moment, merci de red\u00e9marrer le programme. + +calibrationHeadline=Calibration + +screenBox.toolTipText=Selectionner l'\u00e9cran \u00e0 utiliser. + +screen=Ecran %d (%dx%d) + +visibleDotsLabel.text=Points IR visibles: + +visibleDotsLabel.toolTipText=Pr\u00e9sente les points IR visibles, d\u00e9tect\u00e9s par la cam\u00e9ra infra-rouge de la Wiimote en temps r\u00e9el. + +calibrationButton.text=Calibrer + +calibrationButton.toolTipText=D\u00e9marre la calibration en utilisant l'\u00e9cran s\u00e9lectionn\u00e9. + +mouseControlHeadline=Contr\u00f4le de la souris + +cursorControl.text=Activ\u00e9 + +cursorControl.toolTipText=Active le contr\u00f4le de la souris.${nl}N\u00e9cessite une calibration. + +moveMouse.text=Seulement les d\u00e9placements + +moveMouse.toolTipText=D\u00e9placement du curseur de la souris seulement. + +leftClick.text=D\u00e9placement et clic + +leftClick.toolTipText=D\u00e9placement du curseur de la souris et clic sur le bouton gauche. + +rightClick.text=Cli droit + +rightClick.toolTipText=Active le clic droit. + +statusLabel.text=Enfoncer les boutons 1 et 2 + +calibrated=Calibration r\u00e9ussie + +notCalibrated=Calibration \u00e9chou\u00e9e + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MainPanel_in.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MainPanel_in.properties new file mode 100644 index 0000000..3413efb --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MainPanel_in.properties @@ -0,0 +1,56 @@ +#:1275565256,Uwe + +wiimoteHeadline=Wiimotes + +batteryLevelBar.toolTipText=Hubungkan Wiimote milik anda dengan cara menekan tombol 1 dan 2 secara bersamaan atau dengan menekan tombol merah yang berada dalam tempat battery. + +searching=Mencari + +batteryLevel=Battery: %.0f%% + +resetCameraButton.text=Reset + +resetCameraButton.toolTipText=me-Reset Kamera IR dari Wiimote. Gunakan ketika anda memiliki masalah dengan sensitifitas dari IR. + +lowBattery=Baterai sudah lemah + +disconnected=Wiimote %d telah terputus hubungan.${nl}Pemutus hubungan Wiimotes mungkin terjadi untuk release yang akan datang.${nl}Untuk saat ini tolong restart programnya. + +calibrationHeadline=Kalibrasi + +screenBox.toolTipText=Pilih layar yang akan digunakan. + +screen=Layar %d (%dx%d) + +visibleDotsLabel.text=Titik IR yang terlihat: + +visibleDotsLabel.toolTipText=Menampilkan Titik IR yang terlihat, dideteksi oleh Kamera IR Wiimote secara real-time. + +calibrationButton.text=Kalibrasi + +calibrationButton.toolTipText=Memulai Kalibrasi sentuhan menggunakan layar yang sedang digunakan. + +mouseControlHeadline=Pengendalian Mouse + +cursorControl.text=Digunakan + +cursorControl.toolTipText=Mengaktifkan pengendalian mouse.${nl}Kalibrasi dibutuhkan. + +moveMouse.text=Hanya gerakan + +moveMouse.toolTipText=Hanya gerakan dari kursor mouse. + +leftClick.text=Gerakan & Click + +leftClick.toolTipText=Gerakkan kursor mouse dan tekan tombol kiri mouse. + +rightClick.text=Click Kanan + +rightClick.toolTipText=Mengaktifkan klik kanan. + +statusLabel.text=Tekan tombol 1 & 2 + +calibrated=Terkalibrasi + +notCalibrated=Tidak terkalibrasi + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MainPanel_it.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MainPanel_it.properties new file mode 100644 index 0000000..c23661e --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MainPanel_it.properties @@ -0,0 +1,56 @@ +#:1240346767,Uwe + +wiimoteHeadline=Wiimotes + +batteryLevelBar.toolTipText=Connetti il tuo Wiimote premendo contemporaneamente i pulsanti 1 e 2, o premi il pulsante rosso sotto il vano pile. + +searching=Cerco... + +batteryLevel=Batteria: %.0f%% + +resetCameraButton.text=Reset + +resetCameraButton.toolTipText=Resetta la videocamera a infrarossi del Wiimote. Da usare in caso di problemi con la sensibilit\u00e0 degli infrarossi. + +lowBattery=Batteria scarica + +disconnected=Il Wiimote %d \u00e8 disconnesso.${nl}La disconnessione del Wiimote potrebbe essere possibile in una futura release.${nl}Per ora per favore riavvia l'applicazione. + +calibrationHeadline=Calibrazione + +screenBox.toolTipText=Seleziona lo schermo da usare. + +screen=Schermo %d (%dx%d) + +visibleDotsLabel.text=Punti IR visibili: + +visibleDotsLabel.toolTipText=Mostra i punti infrarossi visibili, individuati in tempo reale dalla videocamera a infrarossi. + +calibrationButton.text=Calibra + +calibrationButton.toolTipText=Avvia la calibrazione utilizzando lo schermo attualmente selezionato. + +mouseControlHeadline=Controllo del mouse + +cursorControl.text=Attivato + +cursorControl.toolTipText=Attiva il controllo del mouse.${nl}Richiede la calibrazione. + +moveMouse.text=Muovi e basta + +moveMouse.toolTipText=Muovi solo il cursore del mouse. + +leftClick.text=Muovi e clicca + +leftClick.toolTipText=Muovi il cursore del mouse e premi il tasto sinistro del mouse. + +rightClick.text=Tasto destro + +rightClick.toolTipText=Attiva il tasto destro. + +statusLabel.text=Premi i pulsanti 1 & 2 + +calibrated=Calibrato + +notCalibrated=Non calibrato + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MainPanel_pl.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MainPanel_pl.properties new file mode 100644 index 0000000..00cd833 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MainPanel_pl.properties @@ -0,0 +1,56 @@ +#:1253225305,Grzegorz + +wiimoteHeadline=Wiiloty + +batteryLevelBar.toolTipText=Po\u0142\u0105cz z Wiilotem naciskaj\u0105c jednocze\u015bnie przyciski 1 i 2 lub czerwony przycisk umieszczony pod obudow\u0105 baterii. + +searching=Wyszukiwanie + +batteryLevel=Baterie: %.0f%% + +resetCameraButton.text=Resetuj + +resetCameraButton.toolTipText=Resetuje czujnik podczerwieni Wiilot\u00f3w. Naci\u015bnij w razie problem\u00f3w z czu\u0142o\u015bci\u0105 czujnika. + +lowBattery=S\u0142abe baterie + +disconnected=Wiilot %d od\u0142\u0105czony.${nl}Od\u0142\u0105czanie Wiilot\u00f3w mo\u017ce zosta\u0107 wprowadzone w nowej wersji.${nl}Tymczasem prosz\u0119 zrestartowa\u0107 program. + +calibrationHeadline=Kalibracja + +screenBox.toolTipText=Wybierz aktywny ekran. + +screen=Ekran %d (%dx%d) + +visibleDotsLabel.text=Widoczne punkty IR: + +visibleDotsLabel.toolTipText=Wy\u015bwietla, w czasie rzeczywistym, punkty podczerwieni rejestrowane przez detektory Wiilot\u00f3w. + +calibrationButton.text=Kalibruj + +calibrationButton.toolTipText=Rozpocznij kalibracj\u0119 wybranego ekranu. + +mouseControlHeadline=Kontrola myszy + +cursorControl.text=W\u0142\u0105czona + +cursorControl.toolTipText=W\u0142\u0105cza kontrol\u0119 myszy.${nl}Wymaga skalibrowania. + +moveMouse.text=Tylko ruchy + +moveMouse.toolTipText=Tylko poruszanie kursorem myszy. + +leftClick.text=Ruchy i klikni\u0119cia + +leftClick.toolTipText=Poruszanie kursorem oraz klikanie lewym przyciskiem myszy. + +rightClick.text=Prawy przycisk myszy + +rightClick.toolTipText=W\u0142\u0105cza prawy przycisk myszy. + +statusLabel.text=Naci\u015bnij przyciski 1 i 2 + +calibrated=Skalibrowany + +notCalibrated=Nie skalibrowany + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MainPanel_pt.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MainPanel_pt.properties new file mode 100644 index 0000000..2f9fcf8 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MainPanel_pt.properties @@ -0,0 +1,56 @@ +#:1224239881,Francisco + +wiimoteHeadline=Wiimotes + +batteryLevelBar.toolTipText=Ligue o Wiimote carregando simultaneamente no bot\u00e3o 1 e 2 ou pressionando o bot\u00e3o vermelho dentro do compartimento da bateria. + +searching=\u00c0 procura + +batteryLevel=Bateria: %.0f%% + +resetCameraButton.text=Redefinir + +resetCameraButton.toolTipText=Redefine a c\u00e2mera de infravermelhos do Wiimote. Use quando experimenta problemas relacionados com a sensibilidade dos infravermelhos. + +lowBattery=Bateria fraca + +disconnected=Wiimote %d desligado.${nl}Desligar Wiimotes poder\u00e1 ser poss\u00edvel numa futura vers\u00e3o.${nl}Por enquanto, reinicie o programa. + +calibrationHeadline=Calibra\u00e7\u00e3o + +screenBox.toolTipText=Escolha o ecr\u00e3 a ser usado. + +screen=Ecr\u00e3 %d (%dx%d) + +visibleDotsLabel.text=Pontos IV: + +visibleDotsLabel.toolTipText=Apresenta os pontos infravermelhos vis\u00edveis detectados pela c\u00e2mera de infravermelhos do Wiimote em tempo real. + +calibrationButton.text=Calibra\u00e7\u00e3o + +calibrationButton.toolTipText=Inicia a calibra\u00e7\u00e3o utilizando o actual quadro seleccionado. + +mouseControlHeadline=Controlo do Rato + +cursorControl.text=Activo + +cursorControl.toolTipText=Activa o controlo do rato.${nl}Requer calibra\u00e7\u00e3o. + +moveMouse.text=S\u00f3 Mover + +moveMouse.toolTipText=Apenas move o cursor do rato. + +leftClick.text=Mover e Clicar + +leftClick.toolTipText=Mova o cursor e pressione o bot\u00e3o esquerdo do rato. + +rightClick.text=Bot\u00e3o Direito + +rightClick.toolTipText=Permitir o uso do bot\u00e3o direito. + +statusLabel.text=Pressione os bot\u00f5es 1 e 2 + +calibrated=Calibrado + +notCalibrated=N\u00e3o calibrado + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MainPanel_ru.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MainPanel_ru.properties new file mode 100644 index 0000000..c9be092 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MainPanel_ru.properties @@ -0,0 +1,56 @@ +#:1265228759,Dmitry + +wiimoteHeadline=Wiimotes + +batteryLevelBar.toolTipText=\u041f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u0438\u0442\u0435 \u0432\u0430\u0448 Wiimote \u043d\u0430\u0436\u0430\u0432 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043a\u043d\u043e\u043f\u043a\u0438 1 \u0438 2 \u0438\u043b\u0438 \u043a\u0440\u0430\u0441\u043d\u0443\u044e \u043a\u043d\u043e\u043f\u043a\u0443 \u043f\u043e\u0434 \u043a\u0440\u044b\u0448\u043a\u043e\u0439 \u043e\u0442\u0441\u0435\u043a\u0430 \u0434\u043b\u044f \u0431\u0430\u0442\u0430\u0440\u0435\u0439. + +searching=\u041f\u043e\u0438\u0441\u043a + +batteryLevel=\u0417\u0430\u0440\u044f\u0434 \u0431\u0430\u0442\u0430\u0440\u0435\u0438: %.0f%% + +resetCameraButton.text=\u0421\u0431\u0440\u043e\u0441 + +resetCameraButton.toolTipText=\u0421\u0431\u0440\u043e\u0441\u0438\u0442\u044c \u0418\u041a-\u043a\u0430\u043c\u0435\u0440\u0443. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u044d\u0442\u043e \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u0447\u0443\u0432\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e \u0418\u041a-\u043a\u0430\u043c\u0435\u0440\u044b. + +lowBattery=\u041d\u0438\u0437\u043a\u0438\u0439 \u0437\u0430\u0440\u044f\u0434 \u0431\u0430\u0442\u0430\u0440\u0435\u0438 + +disconnected=Wiimote %d \u043e\u0442\u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d.${nl}\u041e\u0442\u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 Wiimot'\u043e\u0432 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u0432 \u0431\u0443\u0434\u0443\u0449\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b.${nl}\u041f\u043e\u043a\u0430 \u0436\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b. + +calibrationHeadline=\u041a\u0430\u043b\u0438\u0431\u0440\u043e\u0432\u043a\u0430 + +screenBox.toolTipText=\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u044d\u043a\u0440\u0430\u043d. + +screen=\u042d\u043a\u0440\u0430\u043d %d (%dx%d) + +visibleDotsLabel.text=\u0412\u0438\u0434\u0438\u043c\u044b\u0435 \u0418\u041a \u0442\u043e\u0447\u043a\u0438: + +visibleDotsLabel.toolTipText=\u041f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0432\u0438\u0434\u0438\u043c\u044b\u0435 \u0418\u041a \u0442\u043e\u0447\u043a\u0438, \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0435 \u0418\u041a \u043a\u0430\u043c\u0435\u0440\u043e\u0439 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438. + +calibrationButton.text=\u041e\u0442\u043a\u0430\u043b\u0438\u0431\u0440\u043e\u0432\u0430\u0442\u044c + +calibrationButton.toolTipText=\u041d\u0430\u0447\u043d\u0438\u0442\u0435 \u043a\u0430\u043b\u0438\u0431\u0440\u043e\u0432\u043a\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0439 \u0432 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u044d\u043a\u0440\u0430\u043d. + +mouseControlHeadline=\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u044b\u0448\u044c\u044e + +cursorControl.text=\u0412\u043a\u043b\u044e\u0447\u0435\u043d\u043e + +cursorControl.toolTipText=\u0410\u043a\u0442\u0438\u0432\u0438\u0440\u0443\u0435\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u044b\u0448\u044c\u044e.${nl}\u0422\u0440\u0435\u0431\u0443\u0435\u0442 \u043a\u0430\u043b\u0438\u0431\u0440\u043e\u0432\u043a\u0438. + +moveMouse.text=\u0422\u043e\u043b\u044c\u043a\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u0435 + +moveMouse.toolTipText=\u0422\u043e\u043b\u044c\u043a\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u043a\u0443\u0440\u0441\u043e\u0440\u0430 \u043c\u044b\u0448\u0438. + +leftClick.text=\u041f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0438 \u0449\u0435\u043b\u0447\u043e\u043a + +leftClick.toolTipText=\u041f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u043a\u0443\u0440\u0441\u043e\u0440\u0430 \u043c\u044b\u0448\u0438 \u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0435 \u043d\u0430 \u0435\u0435 \u043b\u0435\u0432\u0443\u044e \u043a\u043d\u043e\u043f\u043a\u0443. + +rightClick.text=\u0429\u0435\u043b\u0447\u043e\u043a \u043f\u0440\u0430\u0432\u043e\u0439 \u043a\u043d\u043e\u043f\u043a\u043e\u0439 + +rightClick.toolTipText=\u0420\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c \u0449\u0435\u043b\u0447\u043e\u043a \u043f\u0440\u0430\u0432\u043e\u0439 \u043a\u043d\u043e\u043f\u043a\u043e\u0439. + +statusLabel.text=\u041d\u0430\u0436\u043c\u0438\u0442\u0435 \u043a\u043d\u043e\u043f\u043a\u0438 1 \u0438 2 + +calibrated=\u041e\u0442\u043a\u0430\u043b\u0438\u0431\u0440\u043e\u0432\u0430\u043d + +notCalibrated=\u041d\u0435 \u043e\u0442\u043a\u0430\u043b\u0438\u0431\u0440\u043e\u0432\u0430\u043d\u043e + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MainPanel_sl.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MainPanel_sl.properties new file mode 100644 index 0000000..e446eb1 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MainPanel_sl.properties @@ -0,0 +1,56 @@ +#:1238650994,Samo + +wiimoteHeadline=Wiimote + +batteryLevelBar.toolTipText=Napravo pove\u017eete tako, da na njej hkrati pritisnete tipki 1 in 2 ali pa pritisnete rde\u010d gumb pod pokrov\u010dkom baterij. + +searching=Iskanje + +batteryLevel=Baterija: %.0f%% + +resetCameraButton.text=Ponastavi + +resetCameraButton.toolTipText=S klikom na gumb lahko ponastavite IR kamero naprave. Uporabite, ko imate te\u017eave z zaznavanjem IR pisala. + +lowBattery=Baterija je prazna + +disconnected=Wiimote %d je odklopljen.${nl}Odklop naprave v programu bo morebiti mogo\u010d v kateri od prihodnjih verzij. ${nl}Za ponovni priklop ponovno za\u017eenite program. + +calibrationHeadline=Kalibracija + +screenBox.toolTipText=Izberite ekran, ki ga \u017eelite uporabiti. + +screen=Ekran %d (%dx%d) + +visibleDotsLabel.text=Vidne IR to\u010dke: + +visibleDotsLabel.toolTipText=Trenutni prikaz vidnih IR to\u010dk, ki jih zaznava kamera naprave. + +calibrationButton.text=Kalibriraj! + +calibrationButton.toolTipText=Za\u017eeni kalibracijo na izbranem ekranu ali projekcijski povr\u0161ini. + +mouseControlHeadline=Nadzor mi\u0161ke + +cursorControl.text=Omogo\u010deno + +cursorControl.toolTipText=Obkljukajte, \u010de \u017eelite z IR pisalom nadzorovati mi\u0161kin kazalec. Prej mora biti opravljena kalibracija. + +moveMouse.text=Samo premikanje + +moveMouse.toolTipText=Ozna\u010dite, \u010de \u017eelite zgolj premikati mi\u0161kin kazalec. + +leftClick.text=Premikanje & levi gumb + +leftClick.toolTipText=Ozna\u010dite, \u010de \u017eelite premikati mi\u0161kin kazalec in obenem simulirati pritisk na lev mi\u0161kin gumb (priporo\u010deno). + +rightClick.text=Desni mi\u0161kin gumb + +rightClick.toolTipText=Omogo\u010di uporabo desnega mi\u0161kinega gumba. + +statusLabel.text=Pritisni tipki 1 in 2 + +calibrated=Kalibrirano + +notCalibrated=Ni kalibrirano + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MenuBar.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MenuBar.properties new file mode 100644 index 0000000..e752d07 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MenuBar.properties @@ -0,0 +1 @@ +editMenu = Edit diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MenuBar_de.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MenuBar_de.properties new file mode 100644 index 0000000..ef57339 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MenuBar_de.properties @@ -0,0 +1,6 @@ +#:1223318877,Uwe + +editMenu=Bearbeiten + +helpMenu=Hilfe + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MenuBar_es.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MenuBar_es.properties new file mode 100644 index 0000000..696c822 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MenuBar_es.properties @@ -0,0 +1,6 @@ +#:1223579598,Descalzo + +editMenu=Editar + +helpMenu=Ayuda + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MenuBar_et.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MenuBar_et.properties new file mode 100644 index 0000000..1758e1f --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MenuBar_et.properties @@ -0,0 +1,4 @@ +#:1248455699,Marko + +editMenu=Redigeeri + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MenuBar_fr.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MenuBar_fr.properties new file mode 100644 index 0000000..7bf3b85 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MenuBar_fr.properties @@ -0,0 +1,6 @@ +#:1223396281,Francois + +editMenu=Editer + +helpMenu=Aide + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MenuBar_in.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MenuBar_in.properties new file mode 100644 index 0000000..0d4d348 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MenuBar_in.properties @@ -0,0 +1,4 @@ +#:1274688122,Bobby + +editMenu=Edit + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MenuBar_it.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MenuBar_it.properties new file mode 100644 index 0000000..5abd3f8 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MenuBar_it.properties @@ -0,0 +1,4 @@ +#:1225965528,Francesco + +editMenu=Modifica + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MenuBar_pl.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MenuBar_pl.properties new file mode 100644 index 0000000..27704ad --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MenuBar_pl.properties @@ -0,0 +1,4 @@ +#:1253212155,Grzegorz + +editMenu=Edycja + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MenuBar_pt.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MenuBar_pt.properties new file mode 100644 index 0000000..5f4773f --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MenuBar_pt.properties @@ -0,0 +1,6 @@ +#:1223501695,Francisco + +editMenu=Editar + +helpMenu=Ajuda + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MenuBar_ru.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MenuBar_ru.properties new file mode 100644 index 0000000..dcefc1f --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MenuBar_ru.properties @@ -0,0 +1,4 @@ +#Translated by Dmitry Pupinin (dlnsk@mail.ru) +#Mon Jan 25 00:14:24 NOVT 2010 +editMenu=\u041f\u0440\u0430\u0432\u043a\u0430 +helpMenu=? diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MenuBar_sl.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MenuBar_sl.properties new file mode 100644 index 0000000..71d9925 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/MenuBar_sl.properties @@ -0,0 +1,4 @@ +#:1238599534,Samo + +editMenu=Uredi + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/PreferencesWindow.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/PreferencesWindow.properties new file mode 100644 index 0000000..096b682 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/PreferencesWindow.properties @@ -0,0 +1,101 @@ +preferences.Action.text = Preferences + +generalTab = General +mouseTab = Mouse Control +# no +tuioTab = TUIO/OSC + +# no +language.opaque = false +language.text = Language: +default = Default + +# no +languageBox.opaque = false + +languageRestartLabel.text =
You need to restart the application for language changes to take effect.
+# no +languageRestartLabel.opaque = false + +rightClickDelay = Right click activation delay (seconds) +delaySlider.toolTipText = Sets the time that is needed to trigger a right mouse button click. +# no +delaySlider.orientation = 0 +# no +delaySlider.minimum = 500 +# no +delaySlider.maximum = 3000 +# no +delaySlider.paintLabels = true +# no +delaySlider.paintTicks = true +# no +delaySlider.majorTickSpacing = 500 +# no +delaySlider.opaque = false + +mouseSmoothing.text = Smoothing: +mouseSmoothing.toolTipText = Enables smoothing of mouse movements. +# no +mouseSmoothing.opaque = false +staticSmoothing.text = Static +staticSmoothing.toolTipText = Simple Moving Average of the last 7 points. +# no +staticSmoothing.opaque = false +adaptiveSmoothing.text = Adaptive +adaptiveSmoothing.toolTipText = Adaptive Exponential Smoothing; alpha is adjusted based on IR pen movement speed. +# no +adaptiveSmoothing.opaque = false + +touchpadMode.text = Touchpad Mode +touchpadMode.toolTipText = Use your IR pen like you'd use your fingers on a touchpad. +# no +touchpadMode.opaque = false + +rightClicks.text = Right Click +rightClicks.toolTipText = Enables right clicks to be triggered after a certain delay (see below). +# no +rightClicks.opaque = false + +assistDoubleClicks.text = Assist Double Clicks +assistDoubleClicks.toolTipText = Assists making double clicks. Not recommended if you use the application for drawing. +# no +assistDoubleClicks.opaque = false + +#thresholdLabel.text = Mouse movement threshold: +#thresholdLabel.toolTipText = Specifies the minimum distance the mouse cursor will be moved. +#pixelLabel.text = pixel +#mmThreshold.opaque = false + +checkForUpdates.text = Check for updates on startup +# no +checkForUpdates.opaque = false + +batteryWarning.text = Low battery warning +batteryWarning.toolTipText = Shows a warning message if the battery level falls below 5%. +# no +batteryWarning.opaque = false + +tuioEnable.text = Send TUIO/OSC messages to +tuioEnable.toolTipText = Sends out TUIO messages over UDP to the host and port specified below. Disable if you don't know what it is. +# no +tuioEnable.opaque = false + +tuioHost.toolTipText = Enter the name or IP of the host that is supposed to receive the TUIO/OSC messages. Providing a port is optional. +tuioDisableToEdit = Disable TUIO/OSC to edit. +tuioErrorMessage = Format: [:], e.g. \"localhost:3333\"${nl}${nl}The port number is optional and must be between 0 and 65535.${nl}If omitted, port 3333 will be used.${nl}The host must be a valid IP address or DNS name. +tuioInvalidFormat = Invalid format +tuioInvalidPort = Invalid port number "%s" +tuioInvalidHost = Invalid host name or IP "%s" + + +#numberOfWiimotesLabel.text = Number of Wiimotes to use: +#numberOfWiimotesLabel.toolTipText = The number of Wiimotes the application will search for and use if available. +## no +#numberOfWiimotesLabel.opaque = false +#numberOfWiimotesExplLabel.text =
You can still only use one Wiimote if you select "2" here. However, it could lead to unexpected behavior and error messages. This is due to an issue with an underlying library and will hopefully be fixed soon. The plan for a future version is to get rid of having to choose the number of Wiimotes in advance.
+## no +#numberIfWiimotesExplLabel.opaque = false + +resetButton.text = Restore All Defaults +resetButton.toolTipText = Sets default values for all settings. diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/PreferencesWindow_de.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/PreferencesWindow_de.properties new file mode 100644 index 0000000..44ad51f --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/PreferencesWindow_de.properties @@ -0,0 +1,68 @@ +#:1224785336,Uwe + +preferences.Action.text=Einstellungen + +generalTab=Allgemein + +mouseTab=Maussteuerung + +language.text=Sprache: + +default=Standard + +languageRestartLabel.text=
Die \u00c4nderung der Sprache wird erst nach Neustart des Programms aktiv.
+ +rightClickDelay=Rechtsklick Ausl\u00f6sungsverz\u00f6gerung (Sekunden) + +delaySlider.toolTipText=Setzt die Zeitspanne zur Ausl\u00f6sung eines Rechtsklicks. + +mouseSmoothing.text=Gl\u00e4ttung: + +mouseSmoothing.toolTipText=Aktiviert die Gl\u00e4ttung von Mausbewegungen. + +staticSmoothing.text=Statisch + +staticSmoothing.toolTipText=Gleitender Mittelwert der letzten 7 Punkte. + +adaptiveSmoothing.text=Adaptiv + +adaptiveSmoothing.toolTipText=Adaptive exponentielle Gl\u00e4ttung; alpha wird auf Basis der Geschwindigkeit der IR Stift Bewegungen angepasst. + +touchpadMode.text=Touchpad Modus + +touchpadMode.toolTipText=Benutze den IR Stift wie du deine Finger auf einem Touchpad benutzen w\u00fcrdest. + +rightClicks.text=Rechtsklick + +rightClicks.toolTipText=Aktiviert Rechtsklicks nach einer gew\u00e4hlten Zeitspanne (siehe unten). + +assistDoubleClicks.text=Doppelklicks erleichtern + +assistDoubleClicks.toolTipText=Erleichtert das Ausf\u00fchren von Doppelklicks. Nicht zu empfehlen falls du das Programm zum Zeichnen verwendest. + +checkForUpdates.text=Beim Programmstart nach Updates suchen + +batteryWarning.text=Warnung bei niedrigem Batteriestand + +batteryWarning.toolTipText=Zeigt eine Warnmeldung falls der Batteriestand unter 5% f\u00e4llt. + +tuioEnable.text=Sende TUIO/OSC Nachrichten an + +tuioEnable.toolTipText=Sendet TUIO Nachrichten \u00fcber UDP and den unten angegebenen Host und Port. Deaktiviere es falls du nicht weisst was es ist. + +tuioHost.toolTipText=Trage den Namen oder die IP des Host ein der die TUIO/OSC Nachrichten empfangen soll. Das Angeben eines Ports ist optional. + +tuioDisableToEdit=Deaktiviere TUIO/OSC um \u00c4nderungen vorzunehmen. + +tuioErrorMessage=Format: [:], z.B. \"localhost:3333\"${nl}${nl}Die Port-Nummer ist optional und muss zwischen 0 und 65535 liegen.${nl}Es wird Port 3333 verwendet, falls keiner anderer angegeben wird.${nl}Der Host muss eine g\u00fcltige IP-Addresse oder ein g\u00fcltiger DNS-Name sein. + +tuioInvalidFormat=Ung\u00fcltiges Format + +tuioInvalidPort=Ung\u00fcltige Port-Nummer "%s" + +tuioInvalidHost=Ung\u00fcltiger Hostname oder IP "%s" + +resetButton.text=Alle Einstellungen wiederherstellen + +resetButton.toolTipText=Setzt Standardwerte f\u00fcr alle Einstellungen. + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/PreferencesWindow_es.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/PreferencesWindow_es.properties new file mode 100644 index 0000000..4973f14 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/PreferencesWindow_es.properties @@ -0,0 +1,80 @@ +#:1224854473,Uwe + +preferences.Action.text=Preferencias + +generalTab=General + +mouseTab=Control de Rat\u00f3n + +language.text=Idioma: + +default=Opci\u00f3n por defecto + +languageRestartLabel.text=
Se necesita reiniciar la aplicaci\u00f3n para que se lleven a efecto los cambios de idioma.
+ +# That's as short as I know how to make it. +# fuzzy +rightClickDelay=Retraso de activaci\u00f3n de clic-derecho (segundos) + +# fuzzy +delaySlider.toolTipText=El tiempo necesario para iniciar un clic de la derecha. + +mouseSmoothing.text=Alisar: + +# fuzzy +mouseSmoothing.toolTipText=Activa el alisamiento de los movimientos del rat\u00f3n. + +staticSmoothing.text=Est\u00e1tico + +staticSmoothing.toolTipText=Promedio sencillo de los \u00faltimos 7 puntos. + +adaptiveSmoothing.text=Adaptivo + +# fuzzy +adaptiveSmoothing.toolTipText=Alisamiento Exponencial Adaptivo; se adjusta el alfa basado en la velocidad del movimiento de la pluma IR. + +# fuzzy +touchpadMode.text=Modo de Touchpad + +touchpadMode.toolTipText=Usa su pluma de IR como usar\u00eda sus dedos en un touchpad. + +# fuzzy +rightClicks.text=Clic de la derecha + +rightClicks.toolTipText=Dispara un clic de la derecha despu\u00e9s de un cierto tiempo (v\u00e9ase abajo). + +# fuzzy +assistDoubleClicks.text=Asistencia de doble-clic + +assistDoubleClicks.toolTipText=Asiste en el hacer doble-clic. No recomendado si usa la aplicaci\u00f3n para dibujar. + +# fuzzy +checkForUpdates.text=Busca actualizaci\u00f3nes al iniciar + +batteryWarning.text=Alerto de bater\u00eda baja + +# fuzzy +batteryWarning.toolTipText=Despliege una alerta si el nivel de la bater\u00eda llegue abajo de 5%. + +tuioEnable.text=Mandar mensajes de TUIO/OSC a + +# fuzzy +tuioEnable.toolTipText=Manda los mensajes de TUIO sobre UDP al servidor y puerto especificado a continuaci\u00f3n. No use esto si no lo entiende. + +# fuzzy +tuioHost.toolTipText=Pone el nombre o direcci\u00f3n IP del servidor que debe recibir los mensajes de TUIO/OSC. Proveer un puerto es opcional. + +tuioDisableToEdit=Apague TUIO/OSC para hacer cambios. + +tuioErrorMessage=Formato: [:], e.g. \"localhost:3333\"${nl}${nl}El n\u00famero de puerto es opcional y debe estar entre 0 and 65535.${nl}Si se omite, el puerto 3333 se usar\u00e1.${nl}El servidor tiene que ser una direcci\u00f3n. + +tuioInvalidFormat=Formato inv\u00e1lido + +tuioInvalidPort=N\u00famero de puerto "%s" inv\u00e1lido + +tuioInvalidHost=Nombre de servidor o IP inv\u00e1lido "%s" + +resetButton.text=Restaurar todos las opciones de defecto + +resetButton.toolTipText=Restaura los valores de defecto de todas las opciones. + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/PreferencesWindow_et.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/PreferencesWindow_et.properties new file mode 100644 index 0000000..94c7f2b --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/PreferencesWindow_et.properties @@ -0,0 +1,68 @@ +#:1249478383,Marko + +preferences.Action.text=Seadistused + +generalTab=\u00dcldine + +mouseTab=Hiire juhtimine + +language.text=Keel: + +default=Vaikev\u00e4\u00e4rtus + +languageRestartLabel.text=
Keelevaliku aktiveerimiseks tuleb programm sulgeda ja uuesti k\u00e4ivitada.
+ +rightClickDelay=Paremkliki aktiveerimise viivitus (sekundites) + +delaySlider.toolTipText=M\u00e4\u00e4rab viivitusaja peale mida aktiveeritakse paremklikk. + +mouseSmoothing.text=Silumine: + +mouseSmoothing.toolTipText=Lubab hiire liigutuste silumise. + +staticSmoothing.text=Staatiline + +staticSmoothing.toolTipText=Lihtne algoritm, mis arvestab hiire asukohta viimase 7 n\u00e4htud punkti alusel. + +adaptiveSmoothing.text=Kohanduv + +adaptiveSmoothing.toolTipText=Kohanduv eksponentsiaalne silumine: alfa v\u00e4\u00e4rtus muutub vastavalt infrapunapliiatsi liikumise kiirusele. + +touchpadMode.text=Puuteplaadi re\u017eiim + +touchpadMode.toolTipText=Kasuta infrapunapliiatsit nagu kasutaks Sa oma n\u00e4ppe s\u00fclearvuti puuteplaadil. + +rightClicks.text=Paremklikk + +rightClicks.toolTipText=Lubab aktiveerida paremkliki peale m\u00e4\u00e4ratud viiteaega (vaata altpoolt). + +assistDoubleClicks.text=Paremkliki abistamine + +assistDoubleClicks.toolTipText=Abistab paremkliki tegemisel. Pole soovitatav kui soovid kasutada joonistamisprogramme. + +checkForUpdates.text=Otsi uuendusi programmi k\u00e4ivitamisel + +batteryWarning.text=Hoiata patareid t\u00fchjaks saamisel + +batteryWarning.toolTipText=N\u00e4itab hoiatust kui patareide laetus langeb alla 5%. + +tuioEnable.text=Saada TUIO/OSC s\u00f5numid aadressile + +tuioEnable.toolTipText=Saadab v\u00e4lja TUIO s\u00f5numid (kasutades UDP protokolli) aadressile ja pordile, mida saab m\u00e4\u00e4rata allpool. Keela see \u00e4ra kui Sa ei tea mida sellega peale hakata. + +tuioHost.toolTipText=Sisesta TUIO/OSC s\u00f5numite sihtaadress ja port. Pordi sisestamine on valikuline. + +tuioDisableToEdit=Keelusta TUIO/OSC, et redigeerida v\u00e4\u00e4rtusi. + +tuioErrorMessage=Formaat: [:], n. \"localhost:3333\"${nl}${nl}Pordi m\u00e4\u00e4ramine on valikuline. Pordi v\u00e4\u00e4rtus peab j\u00e4\u00e4ma 0 ja 65535 vahele.${nl}Vaikev\u00e4\u00e4rtusena kasutatakse porti 3333.${nl}Aadress peab olema kehtiv nimetus v\u00f5i IP aadress. + +tuioInvalidFormat=Vigane formaat + +tuioInvalidPort=Vigane pordi number "%s" + +tuioInvalidHost=Vigane aadress "%s" + +resetButton.text=L\u00e4htesta k\u00f5ik vaikev\u00e4\u00e4rtused + +resetButton.toolTipText=L\u00e4htestab k\u00f5ik seadistused vaikev\u00e4\u00e4rtustele vastavaks. + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/PreferencesWindow_fr.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/PreferencesWindow_fr.properties new file mode 100644 index 0000000..ce164bb --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/PreferencesWindow_fr.properties @@ -0,0 +1,68 @@ +#:1224710993,Francois + +preferences.Action.text=Pr\u00e9f\u00e9rences + +generalTab=G\u00e9n\u00e9ral + +mouseTab=Contr\u00f4le de la souris + +language.text=Langue: + +default=D\u00e9faut + +languageRestartLabel.text=
Vous devez red\u00e9marrer l'application pour activer le changement de langues.
+ +rightClickDelay=D\u00e9lai d'activation du clic droit (en secondes) + +delaySlider.toolTipText=Fixe le temps n\u00e9cessaire pour \u00e9muler le clic droit de la souris. + +mouseSmoothing.text=Lissage: + +mouseSmoothing.toolTipText=Active le lissage des mouvements de la souris. + +staticSmoothing.text=Statique + +staticSmoothing.toolTipText=Moyenne des mouvements des 7 derniers points. + +adaptiveSmoothing.text=Adaptatif + +adaptiveSmoothing.toolTipText=Lissage adaptatif exponentiel ajust\u00e9 en fonction de la vitesse du mouvement du stylo infra-rouge. + +touchpadMode.text=Mode "pav\u00e9 tactile" + +touchpadMode.toolTipText=Utiliser votre stylo infra-rouge comme on utilise les doigts sur un pav\u00e9 tactile. + +rightClicks.text=Clic droit + +rightClicks.toolTipText=Active le clic droit apr\u00e8s un certain d\u00e9lai (voir plus bas). + +assistDoubleClicks.text=Assistance du double clic + +assistDoubleClicks.toolTipText=Assistance du double clic. Non recommand\u00e9 si vous utilisez l'application pour dessiner. + +checkForUpdates.text=V\u00e9rifier les mises \u00e0 jour au d\u00e9marrage + +batteryWarning.text=Avertissement de batteries faibles + +batteryWarning.toolTipText=Afficher un message d'alerte si le niveau de charge des batteries est inf\u00e9rieur \u00e0 5%. + +tuioEnable.text=Envoie les messages TUIO/OSC \u00e0 + +tuioEnable.toolTipText=Envoie les messages TUIO/OSC avec le protocole UDP \u00e0 l'h\u00f4te et au port sp\u00e9cifi\u00e9 ci-dessous. A d\u00e9sactiver si vous ne savez pas ce que c'est. + +tuioHost.toolTipText=Renseigner le nom ou l'adresse IP de l'h\u00f4te qui est suppos\u00e9 recevoir les messages TUIO/OSC. l'indication d'un port sp\u00e9cifique est optionnel. + +tuioDisableToEdit=D\u00e9sactiver TUIO/OSC pour \u00e9diter. + +tuioErrorMessage=Format: [:], e.g. \"localhost:3333\"${nl}${nl}Le num\u00e9ro du port est optionnel et doit \u00eatre compris entre 0 et 65535.${nl}Par d\u00e9faut, le port 3333 sera utilis\u00e9.${nl}L'h\u00f4te doit avoir un nom DNS ou une adresse IP valide. + +tuioInvalidFormat=Format invalide + +tuioInvalidPort=Nombre du port invalide "%s" + +tuioInvalidHost=Adresse IP ou nom d'h\u00f4te invalide "%s" + +resetButton.text=Restaurer les param\u00e8tres par d\u00e9faut + +resetButton.toolTipText=Restaure les param\u00e8tres par d\u00e9faut pour tous les r\u00e9glages. + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/PreferencesWindow_in.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/PreferencesWindow_in.properties new file mode 100644 index 0000000..4c9a7a5 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/PreferencesWindow_in.properties @@ -0,0 +1,68 @@ +#:1275565350,Uwe + +preferences.Action.text=Pemilihan Setting + +generalTab=Setting Umum + +mouseTab=Pengendalian Mouse + +language.text=Bahasa: + +default=Default + +languageRestartLabel.text=
Anda perlu melakukan restart aplikasiagar perubahan bahasa dapat terjadi.
+ +rightClickDelay=Jeda pengaktifan Klik Kanan (detik) + +delaySlider.toolTipText=Menetapkan waktu yang dibutuhkan untuk memicu klik kanan mouse. + +mouseSmoothing.text=Penghalusan: + +mouseSmoothing.toolTipText=memungkinkannya penghalusan dari gerakan mouse. + +staticSmoothing.text=Statis + +staticSmoothing.toolTipText=NIlai Rata-rata dari Pergerakan Sederhana 7 Titik terakhir. + +adaptiveSmoothing.text=Adaptif + +adaptiveSmoothing.toolTipText=Penghalusan Adaptif Eksponensial; nilai alpha disesuaikan berdasarkan kecepatan gerakan pena IR. + +touchpadMode.text=Mode Touchpad + +touchpadMode.toolTipText=Gunakan IR Pen seperti anda menggunakan jari atau Touchpad. + +rightClicks.text=Klik Kanan + +rightClicks.toolTipText=Memungkinkan klik kanan untuk dipicu setelah jeda waktu tertentu (lihat dibawah). + +assistDoubleClicks.text=Memandu Klik Ganda + +assistDoubleClicks.toolTipText=Memandu pembuatan Klik ganda. TIdak direkomendasikan jika anda ingin menggunakan aplikasi untuk menggambar. + +checkForUpdates.text=Memeriksa update pada saat aplikasi dinyalakan + +batteryWarning.text=Peringatan Baterai Lemah + +batteryWarning.toolTipText=Menunjukkan sebuah pesan peringatan jika tingkat betrai turun dibawah 5%. + +tuioEnable.text=Mengirimkan pesan TUIO/OSC kepada + +tuioEnable.toolTipText=Mengirimkan pesan TUIO melalui UDP kepada host dan port yang ditujukan dibawah. Matikan jika anda tidak tahu mengenai pernyataan sebelumnya. + +tuioHost.toolTipText=Masukkan nama atau IP dari host yang ditujukan untuk menerima pesan TUIO/OSC. penyediaan port bersifat opsional. + +tuioDisableToEdit=Mematikan TUIO/OSC yang akan diubah. + +tuioErrorMessage=Format: [:], seperti \"localhost:3333\"${nl}${nl}Nomor port bersifat opsional dan harus berada antara 0 dan 65535.${nl}jika tidak diberikan, maka port 3333 akan digunakan. Host haruslah IP yang valid atau sebuah nama DNS. + +tuioInvalidFormat=Format Salah + +tuioInvalidPort=Nomor port Salah "%s" + +tuioInvalidHost=Nama host atau Ip yang salah "%s" + +resetButton.text=Mengembalikan semua ke keadaan awal + +resetButton.toolTipText=Mengeset ke keadaan awal untuk semua setting. + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/PreferencesWindow_it.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/PreferencesWindow_it.properties new file mode 100644 index 0000000..653fd4a --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/PreferencesWindow_it.properties @@ -0,0 +1,73 @@ +#:1240167927,Uwe + +preferences.Action.text=Preferenze + +generalTab=Generali + +mouseTab=Controllo del mouse + +language.text=Lingua: + +default=Default + +languageRestartLabel.text=
E' necessario riavviare l'applicazione affinch\u00e8 le modifiche di linguaggio abbiano effetto.
+ +rightClickDelay=Ritardo nell'attivazione del click destro (secondi) + +delaySlider.toolTipText=Imposta il tempo necessario ad attivare un click col tasto destro. + +# fuzzy +mouseSmoothing.text=Scorrevolezza: + +# fuzzy +mouseSmoothing.toolTipText=Attiva il controllo della scorrevolezza per i movimenti del mouse. + +staticSmoothing.text=Statica + +# fuzzy +staticSmoothing.toolTipText=Media dei movimenti degli ultimi sette punti. + +# fuzzy +adaptiveSmoothing.text=Adattiva + +# fuzzy +adaptiveSmoothing.toolTipText=Scorrevolezza adattiva esponenziale; l'alpha viene aggiustato in base alla velocit\u00e0 di movimento della penna a infrarossi. + +touchpadMode.text=Modalit\u00e0 touchpad + +touchpadMode.toolTipText=Usa la tua penna a infrarossi come se usassi le tue dita su un touchpad. + +rightClicks.text=Click destro + +rightClicks.toolTipText=Abilita il click destro per farlo entrare in funzione dopo un certo ritardo (vedi avanti). + +assistDoubleClicks.text=Doppio click assistito + +assistDoubleClicks.toolTipText=Aiuta il doppio click. Non \u00e8 raccomandato se l'applicazione viene usata per disegnare. + +checkForUpdates.text=Controlla gli aggiornamenti all'avvio + +batteryWarning.text=Avviso batteria scarica + +batteryWarning.toolTipText=Mostra un avviso se il livello della batteria scende sotto il 5%. + +tuioEnable.text=Manda messaggi TUIO/OSC a + +tuioEnable.toolTipText=Manda messaggi TUIO attraverso UDP all'host e alla porta specificate pi\u00f9 avanti. Disabilita se non sai di cosa si tratta. + +tuioHost.toolTipText=Scrivi il nome o l'indirizzo IP dell'host che deve ricevere i messaggi TUIO/OSC. Inserire una porta \u00e8 opzionale. + +tuioDisableToEdit=Disabilita la possibilit\u00e0 di modifica per TUIO/OSC. + +tuioErrorMessage=Format: [:], e.g. \"localhost:3333\"${nl}${nl}Il numero della porta \u00e8 opzionale e deve essere compreso tra 0 e 65535.${nl}Se omesso, sar\u00e0 usata la porta 3333.${nl}L'host deve essere un indirizzo IP valido o un nome DNS. + +tuioInvalidFormat=Formato non valido + +tuioInvalidPort=Numero di porta "%s" non valido + +tuioInvalidHost=Nome host o indirizzo IP "%s" non valido + +resetButton.text=Ripristina tutti i valori di default + +resetButton.toolTipText=Imposta i valori di default per tutte le opzioni. + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/PreferencesWindow_pl.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/PreferencesWindow_pl.properties new file mode 100644 index 0000000..d8d667e --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/PreferencesWindow_pl.properties @@ -0,0 +1,70 @@ +#:1253225054,Grzegorz + +preferences.Action.text=Preferencje + +generalTab=Og\u00f3lne + +mouseTab=Kontrola Myszy + +language.text=J\u0119zyk: + +default=Domy\u015blny + +languageRestartLabel.text=
Zmiana j\u0119zyka wymaga ponownego uruchomienia programu.
+ +rightClickDelay=Op\u00f3\u017anienie aktywacji prawego przycisku (sekundy) + +delaySlider.toolTipText=Ustaw czas prze\u0142\u0105czenia wska\u017anika w tryb prawego przycisku myszy. + +mouseSmoothing.text=Wyg\u0142adzanie: + +mouseSmoothing.toolTipText=Umo\u017cliwia wyg\u0142adzanie ruch\u00f3w myszy. + +staticSmoothing.text=Statyczny + +staticSmoothing.toolTipText=U\u015brednia ruch wed\u0142ug 7 ostatnich punkt\u00f3w. + +# Adaptive = Adaptative? +# fuzzy +adaptiveSmoothing.text=Adaptacyjny + +adaptiveSmoothing.toolTipText=Adaptacyjne wyr\u00f3wnywanie wyk\u0142adnicze; alpha jest korygowana na podstawie szybko\u015bci wska\u017anika IR. + +touchpadMode.text=Tryb g\u0142adzika + +touchpadMode.toolTipText=U\u017cywaj wska\u017anik IR jak palce na g\u0142adziku. + +rightClicks.text=Prawy przycisk myszy + +rightClicks.toolTipText=W\u0142\u0105cza prawy przycisk myszy z pewnym op\u00f3\u017anieniem (zobacz ni\u017cej). + +assistDoubleClicks.text=Opcja podw\u00f3jnego klikni\u0119cia + +assistDoubleClicks.toolTipText=Nie zaleca si\u0119 stosowania opcji podw\u00f3jnego klikni\u0119cia w programach graficznych. + +checkForUpdates.text=Automatycznie sprawdzaj aktualizacje + +batteryWarning.text=Ostrze\u017cenie o niskim poziomie baterii + +batteryWarning.toolTipText=Pokazuj ostrze\u017cenie gdy poziom baterii spadnie poni\u017cej 5%. + +tuioEnable.text=Wy\u015blij pakiety TUIO/OSC + +tuioEnable.toolTipText=Wysy\u0142a pakiety TUIO poprzez UDP do hosta i wybranego portu. Odznacz je\u017celi nie wiesz co to jest. + +tuioHost.toolTipText=Wpisz nazw\u0119 lub IP hosta odbieraj\u0105cego pakiety TUIO/OSC. Podanie portu jest opcjonalne. + +tuioDisableToEdit=Zablokuj YUIO/OSC przed edycj\u0105. + +tuioErrorMessage=Format: [:], e.g. \"localhost:3333\"${nl}${nl}Numer portu jest opcjonalny i musi byc z zakresu od 0 do 65535.${nl}Je\u015bli pominiesz zostanie ustawiony port 3333.${nl}Host musi mie\u0107 prawid\u0142owe IP lub nazw\u0119 DNS. + +tuioInvalidFormat=B\u0142\u0119dny format + +tuioInvalidPort=B\u0142\u0119dny numer portu "%s" + +tuioInvalidHost=B\u0142\u0119dna nazwa hosta lub IP "%s" + +resetButton.text=Przywr\u00f3\u0107 ustawienia domy\u015blne + +resetButton.toolTipText=Przywraca ustawienia domy\u015blne dla wszystkich ustawie\u0144. + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/PreferencesWindow_pt.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/PreferencesWindow_pt.properties new file mode 100644 index 0000000..cc4aa74 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/PreferencesWindow_pt.properties @@ -0,0 +1,74 @@ +#:1224765105,Uwe + +preferences.Action.text=Prefer\u00eancias + +generalTab=Geral + +mouseTab=Rato + +language.text=Linguagem: + +default=Valor Padr\u00e3o + +languageRestartLabel.text=
Necess\u00e1rio reiniciar a aplica\u00e7\u00e3o para altera\u00e7\u00e3o de linguagem.
+ +rightClickDelay='Delay' para activa\u00e7\u00e3o do bot\u00e3o direito (segundos) + +delaySlider.toolTipText=Define o tempo necess\u00e1rio para activar o click do bot\u00e3o direito do rato. + +mouseSmoothing.text=Suavizar: + +mouseSmoothing.toolTipText=Permite suavizar os movimentos do rato. + +# Need context +staticSmoothing.text=Est\u00e1tico + +# Need context +staticSmoothing.toolTipText=M\u00e9dia do movimento dos \u00faltimos 7 pontos. + +# Need context +adaptiveSmoothing.text=Adapt\u00e1vel + +# Need context +adaptiveSmoothing.toolTipText=Suaviza\u00e7\u00e3o Exponencial Adapt\u00e1vel; 'alpha' \u00e9 ajustado com base na velocidade de movimentos da caneta de infravermelhos. + +touchpadMode.text=Modo 'Touchpad' + +touchpadMode.toolTipText=Use a sua caneta de infravermelhos como usa os seus dedos num 'touchpad'. + +rightClicks.text=Bot\u00e3o Direito + +rightClicks.toolTipText=Permite activar o bot\u00e3o direito depois de determinado 'delay' (ver em baixo). + +assistDoubleClicks.text=Auxiliar para Duplo Click + +assistDoubleClicks.toolTipText=Auxilia o uso do duplo click. N\u00e3o recomendado se usa este programa para desenho. + +checkForUpdates.text=Verificar a exist\u00eancia de novas vers\u00f5es ao iniciar + +batteryWarning.text=Aviso de bateria fraca + +batteryWarning.toolTipText=Apresenta uma mensagem de aviso quando a bateria atingir os 5%. + +tuioEnable.text=Enviar mensagens TUIO/OSC para + +tuioEnable.toolTipText=Envia mensagens TUIO por UDP para o 'host' e para a porta especificada em baixo. Desactive se n\u00e3o souber o que \u00e9. + +tuioHost.toolTipText=Introduza o nome ou o IP do 'host' que \u00e9 suposto receber a mensagem TUIO/OSC. Especificar uma porta \u00e9 opcional. + +tuioDisableToEdit=Desactivar TUIO/OSC para editar. + +tuioErrorMessage=Formato: <'host' ou IP>[:], e.g. \"localhost:3333\"${nl}${nl}O n\u00famero da porta \u00e9 opcional e deve ser entre 0 e 65535.${nl}Se n\u00e3o especificado, ser\u00e1 usada a porta 3333.${nl}O 'host' tem que ser um IP ou DNS v\u00e1lido. + +tuioInvalidFormat=Formato inv\u00e1lido + +tuioInvalidPort=N\u00famero da porta ("%s") inv\u00e1lido + +tuioInvalidHost='Host' ou IP ("%s") inv\u00e1lido + +# Need more info -> This is for the button in the preferences window to restore all default settings. +resetButton.text=Valores Padr\u00e3o + +# Need more info -> see above comment +resetButton.toolTipText=Restabelece todos os valores padr\u00e3o originais. + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/PreferencesWindow_ru.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/PreferencesWindow_ru.properties new file mode 100644 index 0000000..bb9219c --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/PreferencesWindow_ru.properties @@ -0,0 +1,68 @@ +#:1265389430,Dmitry + +preferences.Action.text=\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 + +generalTab=\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 + +mouseTab=\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u044b\u0448\u044c\u044e + +language.text=\u042f\u0437\u044b\u043a: + +default=\u041f\u043e-\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e + +languageRestartLabel.text=
\u041f\u043e\u0441\u043b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u044f\u0437\u044b\u043a\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443.
+ +rightClickDelay=\u0410\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u044f \u0449\u0435\u043b\u0447\u043a\u0430 \u043f\u0440\u0430\u0432\u043e\u0439 \u043a\u043d\u043e\u043f\u043a\u043e\u0439 (\u0441\u0435\u043a\u0443\u043d\u0434\u044b) + +delaySlider.toolTipText=\u0423\u043a\u0430\u0436\u0438\u0442\u0435 \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u043a\u0430\u043a \u0449\u0435\u043b\u0447\u043e\u043a \u043f\u0440\u0430\u0432\u043e\u0439 \u043a\u043d\u043e\u043f\u043a\u043e\u0439 \u043c\u044b\u0448\u0438. + +mouseSmoothing.text=\u0421\u0433\u043b\u0430\u0436\u0438\u0432\u0430\u043d\u0438\u0435: + +mouseSmoothing.toolTipText=\u0412\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0441\u0433\u043b\u0430\u0436\u0438\u0432\u0430\u043d\u0438\u0435 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f \u043c\u044b\u0448\u0438. + +staticSmoothing.text=\u0421\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 + +staticSmoothing.toolTipText=\u041f\u0440\u043e\u0441\u0442\u043e\u0435 \u0443\u0441\u0440\u0435\u0434\u043d\u0435\u043d\u0438\u0435 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f \u043f\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u043c 7 \u0442\u043e\u0447\u043a\u0430\u043c. + +adaptiveSmoothing.text=\u0410\u0434\u0430\u043f\u0442\u0438\u0432\u043d\u043e\u0435 + +adaptiveSmoothing.toolTipText=\u0410\u0434\u0430\u043f\u0442\u0438\u0432\u043d\u043e\u0435 \u044d\u043a\u0441\u043f\u043e\u043d\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0435 \u0441\u0433\u043b\u0430\u0436\u0438\u0432\u0430\u043d\u0438\u0435; \u0430\u043b\u044c\u0444\u0430 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u043f\u0435\u0440\u0435\u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f \u0418\u041a-\u043f\u0435\u0440\u0430. + +touchpadMode.text=\u0420\u0435\u0436\u0438\u043c \u0442\u0430\u0447\u043f\u0430\u0434\u0430 + +touchpadMode.toolTipText=\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u0432\u0430\u0448\u0435 \u0418\u041a-\u043f\u0435\u0440\u043e \u0442\u0430\u043a\u0436\u0435, \u043a\u0430\u043a \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 \u043f\u0430\u043b\u044c\u0446\u044b \u043d\u0430 \u0442\u0430\u0447\u043f\u0430\u0434\u0435. + +rightClicks.text=\u0429\u0435\u043b\u0447\u043e\u043a \u043f\u0440\u0430\u0432\u043e\u0439 \u043a\u043d\u043e\u043f\u043a\u043e\u0439 + +rightClicks.toolTipText=\u0412\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u0435 \u0449\u0435\u043b\u0447\u043a\u0430 \u043f\u0440\u0430\u0432\u043e\u0439 \u043a\u043d\u043e\u043f\u043a\u043e\u0439 \u043f\u043e\u0441\u043b\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0438 (\u0441\u043c. \u043d\u0438\u0436\u0435). + +assistDoubleClicks.text=\u041f\u043e\u043c\u043e\u0449\u044c \u0432 \u0434\u0432\u043e\u0439\u043d\u043e\u043c \u0449\u0435\u043b\u0447\u043a\u0435 + +assistDoubleClicks.toolTipText=\u041f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0434\u0432\u043e\u0439\u043d\u043e\u0439 \u0449\u0435\u043b\u0447\u043e\u043a. \u041d\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f, \u0435\u0441\u043b\u0438 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u0434\u043b\u044f \u0440\u0438\u0441\u043e\u0432\u0430\u043d\u0438\u044f. + +checkForUpdates.text=\u041f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 + +batteryWarning.text=\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u043e \u043d\u0438\u0437\u043a\u043e\u043c \u0437\u0430\u0440\u044f\u0434\u0435 \u0431\u0430\u0442\u0430\u0440\u0435\u0438 + +batteryWarning.toolTipText=\u041e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0430\u044e\u0449\u0435\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0435\u0441\u043b\u0438 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0431\u0430\u0442\u0430\u0440\u0435\u0438 \u0441\u0442\u0430\u043b \u043d\u0438\u0436\u0435 5%. + +tuioEnable.text=\u041e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c TUIO/OSC \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f + +tuioEnable.toolTipText=\u041e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c TUIO \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0447\u0435\u0440\u0435\u0437 UDP \u043d\u0430 \u0445\u043e\u0441\u0442 \u0438 \u043f\u043e\u0440\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u043d\u0438\u0436\u0435. \u041e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u0435, \u0435\u0441\u043b\u0438 \u0432\u044b \u043d\u0435 \u0437\u043d\u0430\u0435\u0442\u0435 \u0447\u0442\u043e \u044d\u0442\u043e. + +tuioHost.toolTipText=\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0438\u043c\u044f \u0438\u043b\u0438 IP \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u043c\u043e\u0433\u043e \u043f\u0440\u0438\u0435\u043c\u043d\u0438\u043a\u0430 TUIO/OSC \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439. \u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043f\u043e\u0440\u0442 \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e. + +tuioDisableToEdit=\u041e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c TUIO/OSC \u0434\u043b\u044f \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. + +tuioErrorMessage=\u0424\u043e\u0440\u043c\u0430\u0442: <\u0438\u043c\u044f \u0445\u043e\u0441\u0442\u0430 \u0438\u043b\u0438 IP>[:<\u043f\u043e\u0440\u0442>], \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 "localhost:3333"${nl}${nl}\u041d\u043e\u043c\u0435\u0440 \u043f\u043e\u0440\u0442\u0430 \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u0435\u043d \u0438 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0435 \u043e\u0442 0 \u0434\u043e 65535.${nl}\u0415\u0441\u043b\u0438 \u043e\u043f\u0443\u0449\u0435\u043d\u043e, \u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u043e\u0440\u0442 3333.${nl}\u0425\u043e\u0441\u0442 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0432\u0435\u0440\u043d\u044b\u043c IP \u0430\u0434\u0440\u0435\u0441\u043e\u043c \u0438\u043b\u0438 \u0438\u043c\u0435\u043d\u0435\u043c DNS. + +tuioInvalidFormat=\u041d\u0435\u0432\u0435\u0440\u043d\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 + +tuioInvalidPort=\u041d\u0435\u0432\u0435\u0440\u043d\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u043f\u043e\u0440\u0442\u0430 "%s" + +tuioInvalidHost=\u041d\u0435\u0432\u0435\u0440\u043d\u043e\u0435 \u0438\u043c\u044f \u0445\u043e\u0441\u0442\u0430 \u0438\u043b\u0438 IP "%s" + +resetButton.text=\u0412\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e-\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e + +resetButton.toolTipText=\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e-\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a. + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/PreferencesWindow_sl.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/PreferencesWindow_sl.properties new file mode 100644 index 0000000..d6c7e07 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/PreferencesWindow_sl.properties @@ -0,0 +1,68 @@ +#:1238650655,Samo + +preferences.Action.text=Nastavitve + +generalTab=Splo\u0161no + +mouseTab=Nadzor mi\u0161ke + +language.text=Jezik: + +default=Privzet + +languageRestartLabel.text=
Za zamenjavo jezika je potreben ponovni zagon programa.
+ +rightClickDelay=Zamik spro\u017eitve desnega gumba (s) + +delaySlider.toolTipText=Nastavite \u010das, v katerem se bo spro\u017eila simulacija pritiska na desni gumb mi\u0161ke. + +mouseSmoothing.text=Glajenje: + +mouseSmoothing.toolTipText=Omogo\u010di glajenje premikov mi\u0161kinega kazalca. + +staticSmoothing.text=Stati\u010dno + +staticSmoothing.toolTipText=Enostavno glajenje premikanja na osnovi zadnjih 7-ih to\u010dk. + +adaptiveSmoothing.text=Prilagodljivo + +adaptiveSmoothing.toolTipText=Prilagodljivo eksponentno glajenje; alpha se prilagaja hitrosti premikanja pisala IR. + +touchpadMode.text=Na\u010din sledilne plo\u0161\u010dice + +touchpadMode.toolTipText=IR pisalo uporabite na na\u010din, kot bi uporabljali prste na sledilni plo\u0161\u010dici prenosnika. + +rightClicks.text=Desni gumb + +rightClicks.toolTipText=Omogo\u010dite spro\u017eenje simulacije pritiska na desni gumb mi\u0161ke po dolo\u010denem zamiku (glej spodaj). + +assistDoubleClicks.text=Pomo\u010d pri dvokliku + +assistDoubleClicks.toolTipText=Pomo\u010d pri simulaciji dvojnega klika na gumb mi\u0161ke. Ne priporo\u010damo pri uporabi programov za risanje. + +checkForUpdates.text=Ob zagonu preveri posodobitve + +batteryWarning.text=Opozorilo o prazni bateriji + +batteryWarning.toolTipText=Prika\u017ee opozorilno sporo\u010dilo, ko se baterija izprazni pod 5% napolnjenosti. + +tuioEnable.text=Prejemnik TUIO/OSC sporo\u010dil: + +tuioEnable.toolTipText=Program po\u0161ilja sporo\u010dila TUIO preko UDP protokola spodaj navedenemu gostitelju na navedena vrata. \u010ce se vam ne sanja, za kaj gre, pustite izklopljeno. + +tuioHost.toolTipText=Vpi\u0161ite ime ali IP naslov gostitelja, ki bo prejemal TUIO/OSC sporo\u010dila. \u0160tevilka vrat je opcijska. + +tuioDisableToEdit=Onemogo\u010di urejanje TUIO/OSC. + +tuioErrorMessage=Oblika: [:], npr. \"localhost:3333\"${nl}${nl}\u0160tevika vrat je opcijska in mora biti med 0 in 65535.${nl}\u010ce \u0161t. vrat ne navedete, bodo uporabljena vrata 333.${nl}Gostitelj mora biti veljaven IP naslov ali DNS ime. + +tuioInvalidFormat=Nepravilna oblika + +tuioInvalidPort=Nepravilna \u0161t. vrat "%s" + +tuioInvalidHost=Nepravilno ime ali IP naslov gostitelja "%s" + +resetButton.text=Ponastavi vse nastavitve + +resetButton.toolTipText=Vse nastavitve nastavite na privzete vrednosti. + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/ScreenSelector.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/ScreenSelector.properties new file mode 100644 index 0000000..1a390d3 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/ScreenSelector.properties @@ -0,0 +1 @@ +screenText =
Screen %d
%d x %d
diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/ScreenSelector_de.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/ScreenSelector_de.properties new file mode 100644 index 0000000..814931e --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/ScreenSelector_de.properties @@ -0,0 +1,4 @@ +#:1224856416,Uwe + +screenText=
Monitor %d
%d x %d
+ diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/ScreenSelector_es.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/ScreenSelector_es.properties new file mode 100644 index 0000000..10f63a6 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/ScreenSelector_es.properties @@ -0,0 +1,4 @@ +#:1223612821,Descalzo + +screenText=
Pantalla %d
%d x %d
+ diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/ScreenSelector_et.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/ScreenSelector_et.properties new file mode 100644 index 0000000..176455b --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/ScreenSelector_et.properties @@ -0,0 +1,4 @@ +#:1248454473,Marko + +screenText=
Ekraan %d
%d x %d
+ diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/ScreenSelector_fr.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/ScreenSelector_fr.properties new file mode 100644 index 0000000..50696d4 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/ScreenSelector_fr.properties @@ -0,0 +1,4 @@ +#:1223398673,Francois + +screenText=
Ecran %d
%d x %d
+ diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/ScreenSelector_in.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/ScreenSelector_in.properties new file mode 100644 index 0000000..c4699ee --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/ScreenSelector_in.properties @@ -0,0 +1,4 @@ +#:1275563759,Bobby + +screenText=
Layar %d
%d x %d
+ diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/ScreenSelector_it.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/ScreenSelector_it.properties new file mode 100644 index 0000000..8a3498e --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/ScreenSelector_it.properties @@ -0,0 +1,4 @@ +#:1225966545,Francesco + +screenText=
Schermo %d
%d x %d
+ diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/ScreenSelector_pl.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/ScreenSelector_pl.properties new file mode 100644 index 0000000..697dc4a --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/ScreenSelector_pl.properties @@ -0,0 +1,4 @@ +#:1253216195,Grzegorz + +screenText=
Ekran %d
%d x %d
+ diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/ScreenSelector_pt.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/ScreenSelector_pt.properties new file mode 100644 index 0000000..5d0768e --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/ScreenSelector_pt.properties @@ -0,0 +1,4 @@ +#:1223915313,Francisco + +screenText=
Ecr\u00e3 %d
%d x %d
+ diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/ScreenSelector_ru.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/ScreenSelector_ru.properties new file mode 100644 index 0000000..b38fe3c --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/ScreenSelector_ru.properties @@ -0,0 +1,3 @@ +#Translated by Dmitry Pupinin (dlnsk@mail.ru) +#Mon Jan 25 00:14:24 NOVT 2010 +screenText=
\u042d\u043a\u0440\u0430\u043d %d
%d x %d
diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/ScreenSelector_sl.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/ScreenSelector_sl.properties new file mode 100644 index 0000000..55168c9 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/ScreenSelector_sl.properties @@ -0,0 +1,4 @@ +#:1238601223,Samo + +screenText=
Ekran %d
%d x %d
+ diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/WarpedMonitor.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/WarpedMonitor.properties new file mode 100644 index 0000000..b03753e --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/WarpedMonitor.properties @@ -0,0 +1,2 @@ +monitor.Action.text = Warped Point Monitor +monitor.Action.shortDescription = Shows the warped IR points of all calibrated Wiimote. diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/icons/ok.png b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/icons/ok.png new file mode 100644 index 0000000..2f86f0a Binary files /dev/null and b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/icons/ok.png differ diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/icons/warning.png b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/icons/warning.png new file mode 100644 index 0000000..722794f Binary files /dev/null and b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/gui/resources/icons/warning.png differ diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/CursorControlStrategy.java b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/CursorControlStrategy.java new file mode 100644 index 0000000..fcfff4c --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/CursorControlStrategy.java @@ -0,0 +1,9 @@ +package org.mote.wiimote.whiteboard.mouse; + +import java.awt.Point; + +public interface CursorControlStrategy { + + public void process(Point p); + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/CursorControlStrategy.java~ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/CursorControlStrategy.java~ new file mode 100644 index 0000000..4ea1b3e --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/CursorControlStrategy.java~ @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2008-2009, Uwe Schmidt + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * The Software uses a third-party library (WiiRemoteJ) which is not part of + * the Software and is subject to its own license. + */ + +package org.uweschmidt.wiimote.whiteboard.mouse; + +import java.awt.Point; + +public interface CursorControlStrategy { + + public void process(Point p); + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/DefaultControlStrategy.java b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/DefaultControlStrategy.java new file mode 100644 index 0000000..7e53ff6 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/DefaultControlStrategy.java @@ -0,0 +1,31 @@ +package org.mote.wiimote.whiteboard.mouse; + +import java.awt.Point; + +import org.mote.wiimote.whiteboard.mouse.rightclick.RightClickStrategy; +import org.mote.wiimote.whiteboard.preferences.WWPreferences; + +public class DefaultControlStrategy implements CursorControlStrategy { + + private static final WWPreferences prefs = WWPreferences.getPreferences(); + private RightClickStrategy rcs = WWPreferences.RIGHT_CLICK_STRATEGY; + + public void process(Point p) { + + rcs.process(p); + + if (p != null) { + Mouse.move(p); + if (prefs.isLeftClick() && !(prefs.isRightClick() && rcs.trigger())) { + if (WWPreferences.MOUSE_PRESS_DELAY > 0 && !Mouse.LEFT_BUTTON.isPressed()) { + Mouse.sleep(WWPreferences.MOUSE_PRESS_DELAY); + } + Mouse.LEFT_BUTTON.setPressed(true); + } + } else { + Mouse.LEFT_BUTTON.setPressed(false); + } + + } + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/DefaultControlStrategy.java~ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/DefaultControlStrategy.java~ new file mode 100644 index 0000000..4dfed17 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/DefaultControlStrategy.java~ @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2008-2009, Uwe Schmidt + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * The Software uses a third-party library (WiiRemoteJ) which is not part of + * the Software and is subject to its own license. + */ + +package org.uweschmidt.wiimote.whiteboard.mouse; + +import java.awt.Point; + +import org.uweschmidt.wiimote.whiteboard.mouse.rightclick.RightClickStrategy; +import org.uweschmidt.wiimote.whiteboard.preferences.WWPreferences; + +public class DefaultControlStrategy implements CursorControlStrategy { + + private static final WWPreferences prefs = WWPreferences.getPreferences(); + private RightClickStrategy rcs = WWPreferences.RIGHT_CLICK_STRATEGY; + + public void process(Point p) { + + rcs.process(p); + + if (p != null) { + Mouse.move(p); + if (prefs.isLeftClick() && !(prefs.isRightClick() && rcs.trigger())) { + if (WWPreferences.MOUSE_PRESS_DELAY > 0 && !Mouse.LEFT_BUTTON.isPressed()) { + Mouse.sleep(WWPreferences.MOUSE_PRESS_DELAY); + } + Mouse.LEFT_BUTTON.setPressed(true); + } + } else { + Mouse.LEFT_BUTTON.setPressed(false); + } + + } + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/Mouse.java b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/Mouse.java new file mode 100644 index 0000000..114f4ff --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/Mouse.java @@ -0,0 +1,83 @@ +package org.mote.wiimote.whiteboard.mouse; + +import java.awt.AWTException; +import java.awt.GraphicsDevice; +import java.awt.GraphicsEnvironment; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Robot; +import java.awt.event.InputEvent; + +import org.mote.wiimote.whiteboard.preferences.WWPreferences; + +public enum Mouse { + LEFT_BUTTON(InputEvent.BUTTON1_MASK), RIGHT_BUTTON(InputEvent.BUTTON3_MASK); + + private static final WWPreferences prefs = WWPreferences.getPreferences(); + private static Point position = new Point(Integer.MIN_VALUE, Integer.MIN_VALUE); + private static Robot r; + private static Rectangle bounds; + + private final int id; + private long lastReleased = -1, lastPressed = -1; + private boolean pressed; + + static { + final GraphicsDevice screen = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); + try { + r = new Robot(screen); + setScreen(screen); + } catch (AWTException e) { + e.printStackTrace(); + } + } + + private Mouse(int id) { + this.id = id; + } + + public static void setScreen(GraphicsDevice screen) { + + } + + public static void sleep(int ms) { + r.delay(ms); + } + + public static void move(Point p) { + if (!(prefs.assistDoubleClicks() && position.distance(p) < WWPreferences.PIXEL_MOVE_TOLERANCE && ( + (Mouse.LEFT_BUTTON.isPressed() && System.currentTimeMillis() - Mouse.LEFT_BUTTON.getLastPressed() < WWPreferences.SHORT_DELAY) || + (!Mouse.LEFT_BUTTON.isPressed() && System.currentTimeMillis() - Mouse.LEFT_BUTTON.getLastReleased() < WWPreferences.SHORT_DELAY) + ))) { + r.mouseMove(Math.min(Math.max(bounds.x, p.x), bounds.x+bounds.width-1), Math.min(Math.max(bounds.y, p.y), bounds.y+bounds.height-1)); + position = p; + } + } + + public static Point getPosition() { + return position; + } + + public boolean isPressed() { + return pressed; + } + + public void setPressed(boolean pressRequest) { + if (pressRequest && !pressed) { + r.mousePress(id); + lastPressed = System.currentTimeMillis(); + } else if (!pressRequest && pressed) { + r.mouseRelease(id); + lastReleased = System.currentTimeMillis(); + } + this.pressed = pressRequest; + } + + public long getLastPressed() { + return lastPressed; + } + + public long getLastReleased() { + return lastReleased; + } +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/Mouse.java~ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/Mouse.java~ new file mode 100644 index 0000000..525dfec --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/Mouse.java~ @@ -0,0 +1,118 @@ +/* + * Copyright (C) 2008-2009, Uwe Schmidt + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * The Software uses a third-party library (WiiRemoteJ) which is not part of + * the Software and is subject to its own license. + */ + +package org.uweschmidt.wiimote.whiteboard.mouse; + +import java.awt.AWTException; +import java.awt.GraphicsDevice; +import java.awt.GraphicsEnvironment; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Robot; +import java.awt.event.InputEvent; + +import org.uweschmidt.wiimote.whiteboard.preferences.WWPreferences; + +public enum Mouse { + LEFT_BUTTON(InputEvent.BUTTON1_MASK), RIGHT_BUTTON(InputEvent.BUTTON3_MASK); + + private static final WWPreferences prefs = WWPreferences.getPreferences(); + private static Point position = new Point(Integer.MIN_VALUE, Integer.MIN_VALUE); + private static Robot r; + private static Rectangle bounds; + + private final int id; + private long lastReleased = -1, lastPressed = -1; + private boolean pressed; + + static { + // TODO when screen changes, http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Robot.html#Robot(java.awt.GraphicsDevice) + final GraphicsDevice screen = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); + try { + r = new Robot(screen); + setScreen(screen); + } catch (AWTException e) { + e.printStackTrace(); + } + } + + private Mouse(int id) { + this.id = id; + } + + public static void setScreen(GraphicsDevice screen) { +// try { +// r = new Robot(screen); + bounds = screen.getDefaultConfiguration().getBounds(); +// System.out.printf("Mouse's new screen bounds: %s\n", bounds); +// } catch (AWTException e) { +// e.printStackTrace(); +// } + } + + public static void sleep(int ms) { + r.delay(ms); + } + + public static void move(Point p) { + // negated "don't move"-condition + if (!(prefs.assistDoubleClicks() && position.distance(p) < WWPreferences.PIXEL_MOVE_TOLERANCE && ( + (Mouse.LEFT_BUTTON.isPressed() && System.currentTimeMillis() - Mouse.LEFT_BUTTON.getLastPressed() < WWPreferences.SHORT_DELAY) || + (!Mouse.LEFT_BUTTON.isPressed() && System.currentTimeMillis() - Mouse.LEFT_BUTTON.getLastReleased() < WWPreferences.SHORT_DELAY) + ))) { + r.mouseMove(Math.min(Math.max(bounds.x, p.x), bounds.x+bounds.width-1), Math.min(Math.max(bounds.y, p.y), bounds.y+bounds.height-1)); + position = p; + } + } + + public static Point getPosition() { + return position; + } + + public boolean isPressed() { + return pressed; + } + + public void setPressed(boolean pressRequest) { + if (pressRequest && !pressed) { + r.mousePress(id); + lastPressed = System.currentTimeMillis(); +// WiimoteWhiteboard.getLogger().info(this + " pressed"); + } else if (!pressRequest && pressed) { + r.mouseRelease(id); + lastReleased = System.currentTimeMillis(); +// WiimoteWhiteboard.getLogger().info(this + " released"); + } + this.pressed = pressRequest; + } + + public long getLastPressed() { + return lastPressed; + } + + public long getLastReleased() { + return lastReleased; + } +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/TouchpadControlStrategy.java b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/TouchpadControlStrategy.java new file mode 100644 index 0000000..6a5a043 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/TouchpadControlStrategy.java @@ -0,0 +1,55 @@ +package org.mote.wiimote.whiteboard.mouse; + +import java.awt.Point; + +import org.mote.wiimote.whiteboard.mouse.rightclick.RightClickStrategy; +import org.mote.wiimote.whiteboard.preferences.WWPreferences; + +public class TouchpadControlStrategy implements CursorControlStrategy { + + private static final WWPreferences prefs = WWPreferences.getPreferences(); + private RightClickStrategy rcs = WWPreferences.RIGHT_CLICK_STRATEGY; + + private long lightOnTime = 0, lightOffTime = System.currentTimeMillis(); + + public void process(Point p) { + + final long now = System.currentTimeMillis(); + final boolean lightOnNow = p != null; + final boolean lightOnBefore = lightOnTime > lightOffTime; + + rcs.process(p); + + if (!lightOnBefore && lightOnNow) { + lightOnTime = now; + } else if (lightOnBefore && !lightOnNow) { + lightOffTime = now; + } + + // release mouse button + if (!lightOnNow && Mouse.LEFT_BUTTON.isPressed() && now - lightOffTime > WWPreferences.SHORT_DELAY) { + Mouse.LEFT_BUTTON.setPressed(false); + } + + if (lightOnNow) { + Mouse.move(p); + if (!prefs.isLeftClick() || (prefs.isRightClick() && rcs.trigger())) { + return; + } + } + + if (lightOnBefore && !lightOnNow) { + // short flash => left click + if (lightOffTime - lightOnTime < WWPreferences.SHORT_DELAY) { + if (Mouse.LEFT_BUTTON.isPressed()) { + Mouse.LEFT_BUTTON.setPressed(false); + } + Mouse.LEFT_BUTTON.setPressed(true); + } else { + Mouse.LEFT_BUTTON.setPressed(false); + } + + } + } + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/TouchpadControlStrategy.java~ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/TouchpadControlStrategy.java~ new file mode 100644 index 0000000..a81b945 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/TouchpadControlStrategy.java~ @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2008-2009, Uwe Schmidt + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * The Software uses a third-party library (WiiRemoteJ) which is not part of + * the Software and is subject to its own license. + */ + +package org.uweschmidt.wiimote.whiteboard.mouse; + +import java.awt.Point; + +import org.uweschmidt.wiimote.whiteboard.mouse.rightclick.RightClickStrategy; +import org.uweschmidt.wiimote.whiteboard.preferences.WWPreferences; + +public class TouchpadControlStrategy implements CursorControlStrategy { + + private static final WWPreferences prefs = WWPreferences.getPreferences(); + private RightClickStrategy rcs = WWPreferences.RIGHT_CLICK_STRATEGY; + + private long lightOnTime = 0, lightOffTime = System.currentTimeMillis(); + + public void process(Point p) { + + final long now = System.currentTimeMillis(); + final boolean lightOnNow = p != null; + final boolean lightOnBefore = lightOnTime > lightOffTime; + + rcs.process(p); + + // update time stamps + if (!lightOnBefore && lightOnNow) { + lightOnTime = now; + } else if (lightOnBefore && !lightOnNow) { + lightOffTime = now; + } + + // release mouse button + if (!lightOnNow && Mouse.LEFT_BUTTON.isPressed() && now - lightOffTime > WWPreferences.SHORT_DELAY) { + Mouse.LEFT_BUTTON.setPressed(false); + } + + if (lightOnNow) { + Mouse.move(p); + if (!prefs.isLeftClick() || (prefs.isRightClick() && rcs.trigger())) { + return; + } + } + + if (lightOnBefore && !lightOnNow) { + // short flash => left click + if (lightOffTime - lightOnTime < WWPreferences.SHORT_DELAY) { + // double-click (end current click, start a new one) + if (Mouse.LEFT_BUTTON.isPressed()) { + Mouse.LEFT_BUTTON.setPressed(false); + } + Mouse.LEFT_BUTTON.setPressed(true); + } else { + Mouse.LEFT_BUTTON.setPressed(false); + } + + } + } + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/rightclick/AbstractRightClick.java b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/rightclick/AbstractRightClick.java new file mode 100644 index 0000000..0512068 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/rightclick/AbstractRightClick.java @@ -0,0 +1,47 @@ + +package org.mote.wiimote.whiteboard.mouse.rightclick; + +import java.awt.Point; + +import org.mote.wiimote.whiteboard.mouse.Mouse; +import org.mote.wiimote.whiteboard.preferences.WWPreferences; + +public abstract class AbstractRightClick implements RightClickStrategy { + + private long lightStartTime = 0; + private Point lightStartPoint = null; + private boolean active = false; + + protected abstract void activate(); + protected abstract void deactivate(); + + public void process(Point p) { + if (p != null) { + // reset start point for potential right click + if (!active && (lightStartPoint == null || lightStartPoint.distance(p) > WWPreferences.PIXEL_MOVE_TOLERANCE)) { + lightStartPoint = p; + lightStartTime = System.currentTimeMillis(); + } + } else { + lightStartPoint = null; + if (active) { + active = false; + deactivate(); + } + } + } + + public boolean trigger() { + // light hasn't moved in the same area for long enough to trigger right click + if (lightStartPoint != null && System.currentTimeMillis() - lightStartTime > WWPreferences.getPreferences().getRightClickDelay()) { + if (!active) { + active = true; + Mouse.LEFT_BUTTON.setPressed(false); + activate(); + } + return true; + } + return false; + } + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/rightclick/AbstractRightClick.java~ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/rightclick/AbstractRightClick.java~ new file mode 100644 index 0000000..9e01796 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/rightclick/AbstractRightClick.java~ @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2008-2009, Uwe Schmidt + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * The Software uses a third-party library (WiiRemoteJ) which is not part of + * the Software and is subject to its own license. + */ + +package org.uweschmidt.wiimote.whiteboard.mouse.rightclick; + +import java.awt.Point; + +import org.uweschmidt.wiimote.whiteboard.mouse.Mouse; +import org.uweschmidt.wiimote.whiteboard.preferences.WWPreferences; + +public abstract class AbstractRightClick implements RightClickStrategy { + + private long lightStartTime = 0; + private Point lightStartPoint = null; + private boolean active = false; + + protected abstract void activate(); + protected abstract void deactivate(); + + public void process(Point p) { + if (p != null) { + // reset start point for potential right click + if (!active && (lightStartPoint == null || lightStartPoint.distance(p) > WWPreferences.PIXEL_MOVE_TOLERANCE)) { + lightStartPoint = p; + lightStartTime = System.currentTimeMillis(); + } + } else { + lightStartPoint = null; + if (active) { + active = false; + deactivate(); + } + } + } + + public boolean trigger() { + // light hasn't moved in the same area for long enough to trigger right click + if (lightStartPoint != null && System.currentTimeMillis() - lightStartTime > WWPreferences.getPreferences().getRightClickDelay()) { + if (!active) { + active = true; + Mouse.LEFT_BUTTON.setPressed(false); + activate(); + } + return true; + } + return false; + } + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/rightclick/DefaultRightClick.java b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/rightclick/DefaultRightClick.java new file mode 100644 index 0000000..01f98b9 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/rightclick/DefaultRightClick.java @@ -0,0 +1,19 @@ +package org.mote.wiimote.whiteboard.mouse.rightclick; + +import org.mote.wiimote.whiteboard.mouse.Mouse; + +public class DefaultRightClick extends AbstractRightClick { + + @Override + protected void activate() { + Mouse.RIGHT_BUTTON.setPressed(true); + Mouse.RIGHT_BUTTON.setPressed(false); + } + + @Override + protected void deactivate() { + Mouse.LEFT_BUTTON.setPressed(true); + Mouse.LEFT_BUTTON.setPressed(false); + } + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/rightclick/DefaultRightClick.java~ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/rightclick/DefaultRightClick.java~ new file mode 100644 index 0000000..f0c0602 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/rightclick/DefaultRightClick.java~ @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2008-2009, Uwe Schmidt + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * The Software uses a third-party library (WiiRemoteJ) which is not part of + * the Software and is subject to its own license. + */ + +package org.uweschmidt.wiimote.whiteboard.mouse.rightclick; + +import org.uweschmidt.wiimote.whiteboard.mouse.Mouse; + +public class DefaultRightClick extends AbstractRightClick { + + @Override + protected void activate() { + Mouse.RIGHT_BUTTON.setPressed(true); + Mouse.RIGHT_BUTTON.setPressed(false); + } + + @Override + protected void deactivate() { + Mouse.LEFT_BUTTON.setPressed(true); + Mouse.LEFT_BUTTON.setPressed(false); + } + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/rightclick/DragRightClick.java b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/rightclick/DragRightClick.java new file mode 100644 index 0000000..ce537af --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/rightclick/DragRightClick.java @@ -0,0 +1,17 @@ +package org.mote.wiimote.whiteboard.mouse.rightclick; + +import org.mote.wiimote.whiteboard.mouse.Mouse; + +public class DragRightClick extends AbstractRightClick { + + @Override + protected void activate() { + Mouse.RIGHT_BUTTON.setPressed(true); + } + + @Override + protected void deactivate() { + Mouse.RIGHT_BUTTON.setPressed(false); + } + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/rightclick/DragRightClick.java~ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/rightclick/DragRightClick.java~ new file mode 100644 index 0000000..f5a5a97 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/rightclick/DragRightClick.java~ @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2008-2009, Uwe Schmidt + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * The Software uses a third-party library (WiiRemoteJ) which is not part of + * the Software and is subject to its own license. + */ + +package org.uweschmidt.wiimote.whiteboard.mouse.rightclick; + +import org.uweschmidt.wiimote.whiteboard.mouse.Mouse; + +public class DragRightClick extends AbstractRightClick { + + @Override + protected void activate() { + Mouse.RIGHT_BUTTON.setPressed(true); + } + + @Override + protected void deactivate() { + Mouse.RIGHT_BUTTON.setPressed(false); + } + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/rightclick/RightClickStrategy.java b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/rightclick/RightClickStrategy.java new file mode 100644 index 0000000..bfdbf1b --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/rightclick/RightClickStrategy.java @@ -0,0 +1,10 @@ +package org.mote.wiimote.whiteboard.mouse.rightclick; + +import java.awt.Point; + +public interface RightClickStrategy { + + public void process(Point p); + public boolean trigger(); + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/rightclick/RightClickStrategy.java~ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/rightclick/RightClickStrategy.java~ new file mode 100644 index 0000000..42ce8a4 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/rightclick/RightClickStrategy.java~ @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2008-2009, Uwe Schmidt + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * The Software uses a third-party library (WiiRemoteJ) which is not part of + * the Software and is subject to its own license. + */ + +package org.uweschmidt.wiimote.whiteboard.mouse.rightclick; + +import java.awt.Point; + +public interface RightClickStrategy { + + public void process(Point p); + public boolean trigger(); + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/smoothing/AdaptiveExponentialSmoothing.java b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/smoothing/AdaptiveExponentialSmoothing.java new file mode 100644 index 0000000..de4462e --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/smoothing/AdaptiveExponentialSmoothing.java @@ -0,0 +1,48 @@ +package org.mote.wiimote.whiteboard.mouse.smoothing; + +import java.awt.Point; + +public class AdaptiveExponentialSmoothing implements MouseSmoothingStrategy { + + public final static String NAME = "Adaptive Exponential Smoothing"; + + private static final double alpha = .20d; + private static final double dAlpha = .1d; + + private double x, y, dx, dy; + private Point last; + + public AdaptiveExponentialSmoothing() { + reset(); + } + + public void reset() { + x = y = dx = dy = Double.NaN; + last = null; + } + + public Point translate(Point p) { + + double alpha = AdaptiveExponentialSmoothing.alpha; + + if (last == null) { + dx = dy = 0; + } else { + dx += dAlpha*((p.getX() - last.getX()) - dx); + dy += dAlpha*((p.getY() - last.getY()) - dy); + + alpha = alpha+.015 - (alpha+.015)*(1/(Math.max(Math.abs(dx), Math.abs(dy))+1)); + } + last = p; + + if (Double.isNaN(x)) { + x = p.getX(); + y = p.getY(); + } else { + x += alpha*(p.getX() - x); + y += alpha*(p.getY() - y); + } + return new Point((int)Math.round(x), (int)Math.round(y)); + } + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/smoothing/AdaptiveExponentialSmoothing.java~ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/smoothing/AdaptiveExponentialSmoothing.java~ new file mode 100644 index 0000000..1bd5429 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/smoothing/AdaptiveExponentialSmoothing.java~ @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2008-2009, Uwe Schmidt + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * The Software uses a third-party library (WiiRemoteJ) which is not part of + * the Software and is subject to its own license. + */ + +package org.uweschmidt.wiimote.whiteboard.mouse.smoothing; + +import java.awt.Point; + +public class AdaptiveExponentialSmoothing implements MouseSmoothingStrategy { + + public final static String NAME = "Adaptive Exponential Smoothing"; + + private static final double alpha = .20d; + private static final double dAlpha = .1d; + + private double x, y, dx, dy; + private Point last; + + public AdaptiveExponentialSmoothing() { + reset(); + } + + public void reset() { + x = y = dx = dy = Double.NaN; + last = null; + } + + public Point translate(Point p) { + + double alpha = AdaptiveExponentialSmoothing.alpha; + + // smoothed "velocities" of x and y movements + if (last == null) { + dx = dy = 0; + } else { + dx += dAlpha*((p.getX() - last.getX()) - dx); + dy += dAlpha*((p.getY() - last.getY()) - dy); + // slow movements => alpha is closer to 0, newer values are less important + // faster movements => alpha is closer to ExponentialSmoothing.alpha, newer values are more important + alpha = alpha+.015 - (alpha+.015)*(1/(Math.max(Math.abs(dx), Math.abs(dy))+1)); + } + last = p; + +// System.out.printf("%d\t%d\t%d\n", System.currentTimeMillis(), p.x, p.y); +// System.out.printf("dx = %7.3f, dy = %7.3f, alpha = %5.3f\n", dx, dy, alpha); + + // smoothed cursor position, alpha based on dx and dy + if (Double.isNaN(x)) { + x = p.getX(); + y = p.getY(); + } else { + x += alpha*(p.getX() - x); + y += alpha*(p.getY() - y); + } + return new Point((int)Math.round(x), (int)Math.round(y)); + } + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/smoothing/MouseSmoothingStrategy.java b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/smoothing/MouseSmoothingStrategy.java new file mode 100644 index 0000000..aa28817 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/smoothing/MouseSmoothingStrategy.java @@ -0,0 +1,15 @@ + +package org.mote.wiimote.whiteboard.mouse.smoothing; + +import java.awt.Point; +import java.util.LinkedHashMap; +import java.util.Map; + +public interface MouseSmoothingStrategy { + + public static final Map> REGISTERED = new LinkedHashMap>(); + + public Point translate(Point p); + public void reset(); + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/smoothing/MouseSmoothingStrategy.java~ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/smoothing/MouseSmoothingStrategy.java~ new file mode 100644 index 0000000..bdc7438 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/smoothing/MouseSmoothingStrategy.java~ @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2008-2009, Uwe Schmidt + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * The Software uses a third-party library (WiiRemoteJ) which is not part of + * the Software and is subject to its own license. + */ + +package org.uweschmidt.wiimote.whiteboard.mouse.smoothing; + +import java.awt.Point; +import java.util.LinkedHashMap; +import java.util.Map; + +public interface MouseSmoothingStrategy { + + public static final Map> REGISTERED = new LinkedHashMap>(); + + public Point translate(Point p); + public void reset(); + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/smoothing/NoSmoothing.java b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/smoothing/NoSmoothing.java new file mode 100644 index 0000000..c4ef64e --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/smoothing/NoSmoothing.java @@ -0,0 +1,15 @@ +package org.mote.wiimote.whiteboard.mouse.smoothing; + +import java.awt.Point; + +public class NoSmoothing implements MouseSmoothingStrategy { + + public final static String NAME = "None"; + + public Point translate(Point p) { + return p; + } + + public void reset() {} + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/smoothing/NoSmoothing.java~ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/smoothing/NoSmoothing.java~ new file mode 100644 index 0000000..3123f95 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/smoothing/NoSmoothing.java~ @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2008-2009, Uwe Schmidt + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * The Software uses a third-party library (WiiRemoteJ) which is not part of + * the Software and is subject to its own license. + */ + +package org.uweschmidt.wiimote.whiteboard.mouse.smoothing; + +import java.awt.Point; + +public class NoSmoothing implements MouseSmoothingStrategy { + + public final static String NAME = "None"; + + public Point translate(Point p) { + return p; + } + + public void reset() {} + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/smoothing/SimpleMovingAverage.java b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/smoothing/SimpleMovingAverage.java new file mode 100644 index 0000000..1e4c1bf --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/smoothing/SimpleMovingAverage.java @@ -0,0 +1,36 @@ +package org.mote.wiimote.whiteboard.mouse.smoothing; + +import java.awt.Point; +import java.util.LinkedList; + +public class SimpleMovingAverage implements MouseSmoothingStrategy { + + public final static String NAME = "Simple Moving Average"; + + private static final int N = 7; + private LinkedList points = new LinkedList(); + + public Point translate(Point p) { + return getAverage(p); + } + + public void reset() { + if (!points.isEmpty()) points.clear(); + } + + private Point getAverage(Point p) { + // add new and remove old + points.addLast(p); + if (points.size() > N) points.removeFirst(); + + // get average of last N points + int x = 0, y = 0; + for (Point o : points) { + x += o.x; + y += o.y; + } + + return new Point(Math.round((float)x / (float)points.size()), Math.round((float)y / (float)points.size())); + } + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/smoothing/SimpleMovingAverage.java~ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/smoothing/SimpleMovingAverage.java~ new file mode 100644 index 0000000..b4d515e --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/mouse/smoothing/SimpleMovingAverage.java~ @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2008-2009, Uwe Schmidt + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * The Software uses a third-party library (WiiRemoteJ) which is not part of + * the Software and is subject to its own license. + */ + +package org.uweschmidt.wiimote.whiteboard.mouse.smoothing; + +import java.awt.Point; +import java.util.LinkedList; + +public class SimpleMovingAverage implements MouseSmoothingStrategy { + + public final static String NAME = "Simple Moving Average"; + + // TODO allow user to change value + private static final int N = 7; + private LinkedList points = new LinkedList(); + + public Point translate(Point p) { + return getAverage(p); + } + + public void reset() { + if (!points.isEmpty()) points.clear(); + } + + // XXX inefficient, but shouldn't be an issue here + private Point getAverage(Point p) { + // add new and remove old + points.addLast(p); + if (points.size() > N) points.removeFirst(); + + // get average of last N points + int x = 0, y = 0; + for (Point o : points) { + x += o.x; + y += o.y; + } + + return new Point(Math.round((float)x / (float)points.size()), Math.round((float)y / (float)points.size())); + } + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/preferences/WWPreferences.java b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/preferences/WWPreferences.java new file mode 100644 index 0000000..1d9d908 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/preferences/WWPreferences.java @@ -0,0 +1,314 @@ +package org.mote.wiimote.whiteboard.preferences; + +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Locale; +import java.util.Set; +import java.util.prefs.BackingStoreException; +import java.util.prefs.Preferences; + +import org.mote.wiimote.whiteboard.WiimoteWhiteboard; +import org.mote.wiimote.whiteboard.gui.PreferencesWindow; +import org.mote.wiimote.whiteboard.mouse.DefaultControlStrategy; +import org.mote.wiimote.whiteboard.mouse.rightclick.DefaultRightClick; +import org.mote.wiimote.whiteboard.mouse.rightclick.DragRightClick; +import org.mote.wiimote.whiteboard.mouse.rightclick.RightClickStrategy; +import org.mote.wiimote.whiteboard.mouse.smoothing.AdaptiveExponentialSmoothing; +import org.mote.wiimote.whiteboard.mouse.smoothing.MouseSmoothingStrategy; +import org.mote.wiimote.whiteboard.mouse.smoothing.NoSmoothing; +import org.mote.wiimote.whiteboard.mouse.smoothing.SimpleMovingAverage; +import org.mote.wiimote.whiteboard.util.Util; + +import wiiremotej.IRSensitivitySettings; + +public class WWPreferences { + + public static class LocaleWrapper { + private final Locale locale; + private final String name; + public LocaleWrapper(Locale locale, String name) { + this.locale = locale; + this.name = name; + } + + public String getLocaleString() { + return locale != null ? locale.toString() : ""; + } + @Override + public String toString() { + return name != null ? name : Util.getResourceMap(PreferencesWindow.class).getString("default"); + } + } + + public static final LocaleWrapper[] LANGUAGES = { + new LocaleWrapper(null, null), + new LocaleWrapper(Locale.GERMAN, "Deutsch"), + new LocaleWrapper(new Locale("et"), "Eesti"), + new LocaleWrapper(Locale.ENGLISH, "English"), + new LocaleWrapper(new Locale("es"), "Espa\u00f1ol"), + new LocaleWrapper(Locale.FRENCH, "Fran\u00e7ais"), + new LocaleWrapper(new Locale("in"), "Bahasa Indonesia"), + new LocaleWrapper(Locale.ITALIAN, "Italiano"), + new LocaleWrapper(new Locale("pl"), "Polski"), + new LocaleWrapper(new Locale("pt"), "Portugu\u00eas"), + new LocaleWrapper(new Locale("ru"), "\u0420\u0443\u0441\u0441\u043a\u0438\u0439"), + new LocaleWrapper(new Locale("sl"), "Sloven\u0161\u010dina") + }; + + public static final int WIIMOTES;// = 2; + public static final int PIXEL_MOVE_TOLERANCE; + public static final int SHORT_DELAY; + public static final int MOUSE_PRESS_DELAY; + public static final boolean MOUSE_CONTROL_AFTER_CALIBRATION; + + private static final byte[] MAX_SENSITIVITY_BLOCK1 = new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, (byte) 0x90, 0x00, 0x41 }; + private static final byte[] MAX_SENSITIVITY_BLOCK2 = new byte[] { 0x40, 0x00 }; + public static final IRSensitivitySettings SENSITIVITY_SETTINGS; + + public static final RightClickStrategy RIGHT_CLICK_STRATEGY; + public static final List WIIMOTE_BT_ADDRESSES; + + static { + + int tolerance = -1; + try { + tolerance = Integer.parseInt(System.getProperty("org.mote.wiimote.whiteboard.pixelMoveTolerance")); + } catch (Exception e) {} + PIXEL_MOVE_TOLERANCE = tolerance < 0 ? 10 : tolerance; + + int delay = -1; + try { + delay = Integer.parseInt(System.getProperty("org.mote.wiimote.whiteboard.shortDelay")); + } catch (Exception e) {} + SHORT_DELAY = delay < 0 ? 200 : delay; + + int mouseDelay = -1; + try { + mouseDelay = Integer.parseInt(System.getProperty("org.mote.wiimote.whiteboard.mousePressDelay")); + } catch (Exception e) {} + MOUSE_PRESS_DELAY = mouseDelay < 0 ? 0 : mouseDelay; + + IRSensitivitySettings sensitivity = new IRSensitivitySettings(MAX_SENSITIVITY_BLOCK1, MAX_SENSITIVITY_BLOCK2); + try { + String str = System.getProperty("org.mote.wiimote.whiteboard.sensitivity"); + if (str != null) { + if (str.equals("wii1")) + sensitivity = IRSensitivitySettings.WII_LEVEL_1; + else if (str.equals("wii2")) + sensitivity = IRSensitivitySettings.WII_LEVEL_2; + else if (str.equals("wii3")) + sensitivity = IRSensitivitySettings.WII_LEVEL_3; + else if (str.equals("wii4")) + sensitivity = IRSensitivitySettings.WII_LEVEL_4; + else if (str.equals("wii5")) + sensitivity = IRSensitivitySettings.WII_LEVEL_5; + } + } catch (Exception e) {} + SENSITIVITY_SETTINGS = sensitivity; + + int wiimotes = 0; + try { + wiimotes = Integer.parseInt(System.getProperty("org.mote.wiimote.whiteboard.wiimotes")); + } catch (Exception e) {} + WIIMOTES = wiimotes == 1 || wiimotes == 2 ? wiimotes : 2; + + List addresses = Collections.emptyList(); + try { + String str = System.getProperty("org.mote.wiimote.whiteboard.wiimoteAddresses"); + if (str != null) { + addresses = Collections.unmodifiableList(Arrays.asList(str.toUpperCase().split(":"))); + } + } catch (Exception e) {} + WIIMOTE_BT_ADDRESSES = addresses; + + RightClickStrategy rcs = new DefaultRightClick(); + try { + String str = System.getProperty("org.mote.wiimote.whiteboard.rightClick"); + if (str != null && str.equals("drag")) { + rcs = new DragRightClick(); + } + } catch (Exception e) {} + RIGHT_CLICK_STRATEGY = rcs; + + boolean mc = true; + try { + String str = System.getProperty("org.mote.wiimote.whiteboard.mouseControlAfterCalibration"); + mc = !(str != null && str.equals("false")); + } catch (Exception e) {} + MOUSE_CONTROL_AFTER_CALIBRATION = mc; + + } + + private static final String RIGHT_CLICK_DELAY = "rightClickDelay"; + private static final String RIGHT_CLICK = "rightClick"; + private static final String LEFT_CLICK = "leftClick"; + private static final String LOW_BATTERY_WARNING = "lowBatteryWarning"; + private static final String CHECK_FOR_UPDATES = "checkForUpdates"; + private static final String MOUSE_SMOOTHING = "mouseSmoothing"; + private static final String TUIO_ENABLED = "tuioEnabled"; + private static final String TUIO_PORT = "tuioPort"; + private static final String TUIO_HOST = "tuioHost"; + private static final String CURSOR_CONTROL = "cursorControl"; + private static final String ASSIST_DOUBLE_CLICKS = "assistDoubleClicks"; + private static final String LANGUAGE = "language"; + + public static interface PreferencesListener { + public void preferencesChanged(); + } + + private final Set listener = new HashSet(); + private final static WWPreferences instance = new WWPreferences(); + private final Preferences settings; + + private WWPreferences() { + settings = Preferences.userNodeForPackage(WiimoteWhiteboard.class); + MouseSmoothingStrategy.REGISTERED.put(NoSmoothing.NAME, NoSmoothing.class); + MouseSmoothingStrategy.REGISTERED.put(SimpleMovingAverage.NAME, SimpleMovingAverage.class); + } + + public static WWPreferences getPreferences() { + return instance; + } + + public void reset() { + try { + settings.clear(); + notifyListener(); + } catch (BackingStoreException e) { + e.printStackTrace(); + } + } + + /* + * LISTENER + */ + + public void addPreferencesListener(PreferencesListener l) { + listener.add(l); + } + + public void removePreferencesListener(PreferencesListener l) { + listener.remove(l); + } + + private void notifyListener() { + for (Object l : listener.toArray()) + ((PreferencesListener)l).preferencesChanged(); + } + + /* + * GETTER & SETTER + */ + + public boolean isLeftClick() { + return settings.getBoolean(LEFT_CLICK, true); + } + + public void setLeftClick(boolean leftClick) { + settings.putBoolean(LEFT_CLICK, leftClick); + notifyListener(); + } + + public boolean isRightClick() { + return settings.getBoolean(RIGHT_CLICK, true); + } + + public void setRightClick(boolean rightClick) { + settings.putBoolean(RIGHT_CLICK, rightClick); + notifyListener(); + } + + public long getRightClickDelay() { + return settings.getLong(RIGHT_CLICK_DELAY, 1000L); + } + + public void setRightClickDelay(long rightClickDelay) { + settings.putLong(RIGHT_CLICK_DELAY, rightClickDelay); + notifyListener(); + } + + public boolean isLowBatteryWarning() { + return settings.getBoolean(LOW_BATTERY_WARNING, true); + } + + public void setLowBatteryWarning(boolean lowBatteryWarning) { + settings.putBoolean(LOW_BATTERY_WARNING, lowBatteryWarning); + notifyListener(); + } + + public boolean checkForUpdates() { + return settings.getBoolean(CHECK_FOR_UPDATES, true); + } + + public void setCheckForUpdates(boolean checkForUpdates) { + settings.putBoolean(CHECK_FOR_UPDATES, checkForUpdates); + notifyListener(); + } + + public String getMouseSmoothing() { + return settings.get(MOUSE_SMOOTHING, AdaptiveExponentialSmoothing.class.getName()); + } + + public void setMouseSmoothing(String mouseSmoothing) { + if (!getMouseSmoothing().equals(mouseSmoothing)) { + settings.put(MOUSE_SMOOTHING, mouseSmoothing); + notifyListener(); + } + } + + public boolean isTuioEnabled() { + return settings.getBoolean(TUIO_ENABLED, false); + } + + public void setTuioEnabled(boolean tuioEnabled) { + settings.putBoolean(TUIO_ENABLED, tuioEnabled); + notifyListener(); + } + + public int getTuioPort() { + return settings.getInt(TUIO_PORT, 3333); + } + + public void setTuioPort(int tuioPort) { + settings.putInt(TUIO_PORT, tuioPort); + } + + public String getTuioHost() { + return settings.get(TUIO_HOST, "localhost"); + } + + public void setTuioHost(String tuioHost) { + settings.put(TUIO_HOST, tuioHost); + } + + public String getCursorControl() { + return settings.get(CURSOR_CONTROL, DefaultControlStrategy.class.getName()); + } + + public void setCursorControl(String cursorControl) { + settings.put(CURSOR_CONTROL, cursorControl); + notifyListener(); + } + + public boolean assistDoubleClicks() { + return settings.getBoolean(ASSIST_DOUBLE_CLICKS, false); + } + + public void setAssistDoubleClicks(boolean assistDoubleClicks) { + settings.putBoolean(ASSIST_DOUBLE_CLICKS, assistDoubleClicks); + notifyListener(); + } + + public void setLanguage(String language) { + if (!getLanguage().equals(language)) { + settings.put(LANGUAGE, language); + notifyListener(); + } + } + + public String getLanguage() { + return settings.get(LANGUAGE, ""); + } +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/preferences/WWPreferences.java~ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/preferences/WWPreferences.java~ new file mode 100644 index 0000000..9bc5ac6 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/preferences/WWPreferences.java~ @@ -0,0 +1,378 @@ +/* + * Copyright (C) 2008-2009, Uwe Schmidt + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * The Software uses a third-party library (WiiRemoteJ) which is not part of + * the Software and is subject to its own license. + */ + +package org.uweschmidt.wiimote.whiteboard.preferences; + +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Locale; +import java.util.Set; +import java.util.prefs.BackingStoreException; +import java.util.prefs.Preferences; + +import org.uweschmidt.wiimote.whiteboard.WiimoteWhiteboard; +import org.uweschmidt.wiimote.whiteboard.gui.PreferencesWindow; +import org.uweschmidt.wiimote.whiteboard.mouse.DefaultControlStrategy; +import org.uweschmidt.wiimote.whiteboard.mouse.rightclick.DefaultRightClick; +import org.uweschmidt.wiimote.whiteboard.mouse.rightclick.DragRightClick; +import org.uweschmidt.wiimote.whiteboard.mouse.rightclick.RightClickStrategy; +import org.uweschmidt.wiimote.whiteboard.mouse.smoothing.AdaptiveExponentialSmoothing; +import org.uweschmidt.wiimote.whiteboard.mouse.smoothing.MouseSmoothingStrategy; +import org.uweschmidt.wiimote.whiteboard.mouse.smoothing.NoSmoothing; +import org.uweschmidt.wiimote.whiteboard.mouse.smoothing.SimpleMovingAverage; +import org.uweschmidt.wiimote.whiteboard.util.Util; + +import wiiremotej.IRSensitivitySettings; + +public class WWPreferences { + + public static class LocaleWrapper { + private final Locale locale; + private final String name; + public LocaleWrapper(Locale locale, String name) { + this.locale = locale; + this.name = name; + } +// public Locale getLocale() { +// return locale; +// } + public String getLocaleString() { + return locale != null ? locale.toString() : ""; + } + @Override + public String toString() { + return name != null ? name : Util.getResourceMap(PreferencesWindow.class).getString("default"); + } + } + + // TODO don't forget to update the ant build.xml script when a new language is added + public static final LocaleWrapper[] LANGUAGES = { + new LocaleWrapper(null, null), + new LocaleWrapper(Locale.GERMAN, "Deutsch"), + new LocaleWrapper(new Locale("et"), "Eesti"), + new LocaleWrapper(Locale.ENGLISH, "English"), + new LocaleWrapper(new Locale("es"), "Espa\u00f1ol"), + new LocaleWrapper(Locale.FRENCH, "Fran\u00e7ais"), + new LocaleWrapper(new Locale("in"), "Bahasa Indonesia"), + new LocaleWrapper(Locale.ITALIAN, "Italiano"), + new LocaleWrapper(new Locale("pl"), "Polski"), + new LocaleWrapper(new Locale("pt"), "Portugu\u00eas"), + new LocaleWrapper(new Locale("ru"), "\u0420\u0443\u0441\u0441\u043a\u0438\u0439"), + new LocaleWrapper(new Locale("sl"), "Sloven\u0161\u010dina") + }; + + public static final int WIIMOTES;// = 2; + public static final int PIXEL_MOVE_TOLERANCE; + public static final int SHORT_DELAY; + public static final int MOUSE_PRESS_DELAY; + public static final boolean MOUSE_CONTROL_AFTER_CALIBRATION; + + // max sensitivity according to http://wiibrew.org/index.php?title=Wiimote#Sensitivity_Settings + private static final byte[] MAX_SENSITIVITY_BLOCK1 = new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, (byte) 0x90, 0x00, 0x41 }; + private static final byte[] MAX_SENSITIVITY_BLOCK2 = new byte[] { 0x40, 0x00 }; + public static final IRSensitivitySettings SENSITIVITY_SETTINGS;// = new IRSensitivitySettings(MAX_SENSITIVITY_BLOCK1, MAX_SENSITIVITY_BLOCK2); + + public static final RightClickStrategy RIGHT_CLICK_STRATEGY; + public static final List WIIMOTE_BT_ADDRESSES; + + static { + + int tolerance = -1; + try { + tolerance = Integer.parseInt(System.getProperty("org.uweschmidt.wiimote.whiteboard.pixelMoveTolerance")); + } catch (Exception e) {} + PIXEL_MOVE_TOLERANCE = tolerance < 0 ? 10 : tolerance; + + int delay = -1; + try { + delay = Integer.parseInt(System.getProperty("org.uweschmidt.wiimote.whiteboard.shortDelay")); + } catch (Exception e) {} + SHORT_DELAY = delay < 0 ? 200 : delay; + + int mouseDelay = -1; + try { + mouseDelay = Integer.parseInt(System.getProperty("org.uweschmidt.wiimote.whiteboard.mousePressDelay")); + } catch (Exception e) {} + MOUSE_PRESS_DELAY = mouseDelay < 0 ? 0 : mouseDelay; + + IRSensitivitySettings sensitivity = new IRSensitivitySettings(MAX_SENSITIVITY_BLOCK1, MAX_SENSITIVITY_BLOCK2); + try { + String str = System.getProperty("org.uweschmidt.wiimote.whiteboard.sensitivity"); + if (str != null) { + if (str.equals("wii1")) + sensitivity = IRSensitivitySettings.WII_LEVEL_1; + else if (str.equals("wii2")) + sensitivity = IRSensitivitySettings.WII_LEVEL_2; + else if (str.equals("wii3")) + sensitivity = IRSensitivitySettings.WII_LEVEL_3; + else if (str.equals("wii4")) + sensitivity = IRSensitivitySettings.WII_LEVEL_4; + else if (str.equals("wii5")) + sensitivity = IRSensitivitySettings.WII_LEVEL_5; +// else if (str.equals("max")) +// ; + } + } catch (Exception e) {} + SENSITIVITY_SETTINGS = sensitivity; + + int wiimotes = 0; + try { + wiimotes = Integer.parseInt(System.getProperty("org.uweschmidt.wiimote.whiteboard.wiimotes")); + } catch (Exception e) {} + WIIMOTES = wiimotes == 1 || wiimotes == 2 ? wiimotes : 2; + + List addresses = Collections.emptyList(); + try { + String str = System.getProperty("org.uweschmidt.wiimote.whiteboard.wiimoteAddresses"); + if (str != null) { + addresses = Collections.unmodifiableList(Arrays.asList(str.toUpperCase().split(":"))); + } + } catch (Exception e) {} + WIIMOTE_BT_ADDRESSES = addresses; + + RightClickStrategy rcs = new DefaultRightClick(); + try { + String str = System.getProperty("org.uweschmidt.wiimote.whiteboard.rightClick"); + if (str != null && str.equals("drag")) { + rcs = new DragRightClick(); + } + } catch (Exception e) {} + RIGHT_CLICK_STRATEGY = rcs; + + boolean mc = true; + try { + String str = System.getProperty("org.uweschmidt.wiimote.whiteboard.mouseControlAfterCalibration"); + mc = !(str != null && str.equals("false")); + } catch (Exception e) {} + MOUSE_CONTROL_AFTER_CALIBRATION = mc; + + } + + private static final String RIGHT_CLICK_DELAY = "rightClickDelay"; + private static final String RIGHT_CLICK = "rightClick"; + private static final String LEFT_CLICK = "leftClick"; + private static final String LOW_BATTERY_WARNING = "lowBatteryWarning"; + private static final String CHECK_FOR_UPDATES = "checkForUpdates"; +// private static final String MOUSE_MOVE_THRESHOLD = "mouseMoveThreshold"; + private static final String MOUSE_SMOOTHING = "mouseSmoothing"; + private static final String TUIO_ENABLED = "tuioEnabled"; + private static final String TUIO_PORT = "tuioPort"; + private static final String TUIO_HOST = "tuioHost"; +// private static final String NUMBER_OF_WIIMOTES = "numberOfWiimotes"; +// private static final String BLUETOOTH_ADDRESS = "bluetoothAddress"; + private static final String CURSOR_CONTROL = "cursorControl"; + private static final String ASSIST_DOUBLE_CLICKS = "assistDoubleClicks"; + private static final String LANGUAGE = "language"; + + public static interface PreferencesListener { + public void preferencesChanged(); + } + + private final Set listener = new HashSet(); + private final static WWPreferences instance = new WWPreferences(); + private final Preferences settings; + + private WWPreferences() { + settings = Preferences.userNodeForPackage(WiimoteWhiteboard.class); + MouseSmoothingStrategy.REGISTERED.put(NoSmoothing.NAME, NoSmoothing.class); + MouseSmoothingStrategy.REGISTERED.put(SimpleMovingAverage.NAME, SimpleMovingAverage.class); + } + + public static WWPreferences getPreferences() { + return instance; + } + + public void reset() { + try { + settings.clear(); + notifyListener(); + } catch (BackingStoreException e) { + e.printStackTrace(); + } + } + + /* + * LISTENER STUFF + */ + + public void addPreferencesListener(PreferencesListener l) { + listener.add(l); + } + + public void removePreferencesListener(PreferencesListener l) { + listener.remove(l); + } + + private void notifyListener() { + for (Object l : listener.toArray()) + ((PreferencesListener)l).preferencesChanged(); + } + + /* + * GETTER & SETTER + */ + + public boolean isLeftClick() { + return settings.getBoolean(LEFT_CLICK, true); + } + + public void setLeftClick(boolean leftClick) { + settings.putBoolean(LEFT_CLICK, leftClick); + notifyListener(); + } + + public boolean isRightClick() { + return settings.getBoolean(RIGHT_CLICK, true); + } + + public void setRightClick(boolean rightClick) { + settings.putBoolean(RIGHT_CLICK, rightClick); + notifyListener(); + } + + public long getRightClickDelay() { + return settings.getLong(RIGHT_CLICK_DELAY, 1000L); + } + + public void setRightClickDelay(long rightClickDelay) { + settings.putLong(RIGHT_CLICK_DELAY, rightClickDelay); + notifyListener(); + } + + public boolean isLowBatteryWarning() { + return settings.getBoolean(LOW_BATTERY_WARNING, true); + } + + public void setLowBatteryWarning(boolean lowBatteryWarning) { + settings.putBoolean(LOW_BATTERY_WARNING, lowBatteryWarning); + notifyListener(); + } + + public boolean checkForUpdates() { + return settings.getBoolean(CHECK_FOR_UPDATES, true); + } + + public void setCheckForUpdates(boolean checkForUpdates) { + settings.putBoolean(CHECK_FOR_UPDATES, checkForUpdates); + notifyListener(); + } + +// public int getMouseMoveThreshold() { +// return settings.getInt(MOUSE_MOVE_THRESHOLD, 1); +// } +// +// public void setMouseMoveThreshold(int mouseMoveThreshold) { +// settings.putInt(MOUSE_MOVE_THRESHOLD, mouseMoveThreshold); +// notifyListener(); +// } + + public String getMouseSmoothing() { + return settings.get(MOUSE_SMOOTHING, AdaptiveExponentialSmoothing.class.getName()); + } + + public void setMouseSmoothing(String mouseSmoothing) { + if (!getMouseSmoothing().equals(mouseSmoothing)) { + settings.put(MOUSE_SMOOTHING, mouseSmoothing); + notifyListener(); + } + } + + public boolean isTuioEnabled() { + return settings.getBoolean(TUIO_ENABLED, false); + } + + public void setTuioEnabled(boolean tuioEnabled) { + settings.putBoolean(TUIO_ENABLED, tuioEnabled); + notifyListener(); + } + + public int getTuioPort() { + return settings.getInt(TUIO_PORT, 3333); + } + + public void setTuioPort(int tuioPort) { + settings.putInt(TUIO_PORT, tuioPort); + } + + public String getTuioHost() { + return settings.get(TUIO_HOST, "localhost"); + } + + public void setTuioHost(String tuioHost) { + settings.put(TUIO_HOST, tuioHost); + } + +// public int getNumberOfWiimotes() { +// return settings.getInt(NUMBER_OF_WIIMOTES, 1); +// } +// +// public void setNumberOfWiimotes(int numberOfWiimotes) { +// if (getNumberOfWiimotes() != numberOfWiimotes) { +// settings.putInt(NUMBER_OF_WIIMOTES, numberOfWiimotes); +// notifyListener(); +// } +// } + + public String getCursorControl() { + return settings.get(CURSOR_CONTROL, DefaultControlStrategy.class.getName()); + } + + public void setCursorControl(String cursorControl) { + settings.put(CURSOR_CONTROL, cursorControl); + notifyListener(); + } + + public boolean assistDoubleClicks() { + return settings.getBoolean(ASSIST_DOUBLE_CLICKS, false); + } + + public void setAssistDoubleClicks(boolean assistDoubleClicks) { + settings.putBoolean(ASSIST_DOUBLE_CLICKS, assistDoubleClicks); + notifyListener(); + } + + public void setLanguage(String language) { + if (!getLanguage().equals(language)) { + settings.put(LANGUAGE, language); + notifyListener(); + } + } + + public String getLanguage() { + return settings.get(LANGUAGE, ""); + } + + +// public void setBluetoothAddress(String address) { +// settings.put(BLUETOOTH_ADDRESS, address); +// } +// +// public String getBluetoothAddress() { +// return settings.get(BLUETOOTH_ADDRESS, null); +// } + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/WiimoteWhiteboard.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/WiimoteWhiteboard.properties new file mode 100644 index 0000000..4e327fd --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/WiimoteWhiteboard.properties @@ -0,0 +1,42 @@ +# define newline character +# no +nl = \n + +# no +Application.id = WiimoteWhiteboard +# no +Application.title = ${Application.id} +# no +Application.description = ${Application.id} +# no +Application.author = Uwe Schmidt +# no +Application.year = 2008-2010 +# no +Application.homepage = http://www.uweschmidt.org/wiimote-whiteboard +# no +Application.onlineHelp = http://wiki.uweschmidt.org/WiimoteWhiteboard/WiimoteWhiteboard +# no +Application.updateURL = http://www.uweschmidt.org/files/WiimoteWhiteboard.version +# no +Application.donateURL = https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3DM925S3C5YXY +# no +Application.lookAndFeel = system +# no +Application.version = 1.0.3 +# no +Application.vendor = Uwe Schmidt +# no +Application.vendorId = USchmidt + +# no +mainFrame.title = ${Application.id} +# no +mainFrame.resizable = false + +#quitApp.Action.text = Exit + +# no +icon = icon_small.png + +donate.Action.text = Donate diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/WiimoteWhiteboard_de.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/WiimoteWhiteboard_de.properties new file mode 100644 index 0000000..9f95693 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/WiimoteWhiteboard_de.properties @@ -0,0 +1,4 @@ +#:1223503936,Uwe + +donate.Action.text=Spenden + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/WiimoteWhiteboard_es.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/WiimoteWhiteboard_es.properties new file mode 100644 index 0000000..0ded891 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/WiimoteWhiteboard_es.properties @@ -0,0 +1,4 @@ +#:1223612830,Descalzo + +donate.Action.text=Donar + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/WiimoteWhiteboard_et.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/WiimoteWhiteboard_et.properties new file mode 100644 index 0000000..23553e5 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/WiimoteWhiteboard_et.properties @@ -0,0 +1,4 @@ +#:1248454452,Marko + +donate.Action.text=Palun anneta + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/WiimoteWhiteboard_fr.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/WiimoteWhiteboard_fr.properties new file mode 100644 index 0000000..b9cae5e --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/WiimoteWhiteboard_fr.properties @@ -0,0 +1,4 @@ +#:1223502297,Uwe + +donate.Action.text=Dons + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/WiimoteWhiteboard_in.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/WiimoteWhiteboard_in.properties new file mode 100644 index 0000000..7aa8a4e --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/WiimoteWhiteboard_in.properties @@ -0,0 +1,4 @@ +#:1275563773,Bobby + +donate.Action.text=Sumbang + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/WiimoteWhiteboard_it.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/WiimoteWhiteboard_it.properties new file mode 100644 index 0000000..6f6369d --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/WiimoteWhiteboard_it.properties @@ -0,0 +1,4 @@ +#:1225966614,Francesco + +donate.Action.text=Fai una donazione + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/WiimoteWhiteboard_pl.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/WiimoteWhiteboard_pl.properties new file mode 100644 index 0000000..f0dfdf1 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/WiimoteWhiteboard_pl.properties @@ -0,0 +1,4 @@ +#:1253216274,Grzegorz + +donate.Action.text=Darowizna + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/WiimoteWhiteboard_pt.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/WiimoteWhiteboard_pt.properties new file mode 100644 index 0000000..484b8c7 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/WiimoteWhiteboard_pt.properties @@ -0,0 +1,4 @@ +#:1223502262,Uwe + +donate.Action.text=Contribuir + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/WiimoteWhiteboard_ru.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/WiimoteWhiteboard_ru.properties new file mode 100644 index 0000000..c6a07a8 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/WiimoteWhiteboard_ru.properties @@ -0,0 +1,3 @@ +#Translated by Dmitry Pupinin (dlnsk@mail.ru) +#Mon Jan 25 00:10:40 NOVT 2010 +donate.Action.text=\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u0430\u0442\u044c diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/WiimoteWhiteboard_sl.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/WiimoteWhiteboard_sl.properties new file mode 100644 index 0000000..4a7dce8 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/WiimoteWhiteboard_sl.properties @@ -0,0 +1,4 @@ +#:1238601258,Samo + +donate.Action.text=Donirajte + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/icon_big.png b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/icon_big.png new file mode 100644 index 0000000..02192ce Binary files /dev/null and b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/icon_big.png differ diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/icon_small.png b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/icon_small.png new file mode 100644 index 0000000..69e0b72 Binary files /dev/null and b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/resources/icon_small.png differ diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/tuio/TuioTransmitter.java b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/tuio/TuioTransmitter.java new file mode 100644 index 0000000..e49a65b --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/tuio/TuioTransmitter.java @@ -0,0 +1,175 @@ +package org.mote.wiimote.whiteboard.tuio; + +import java.awt.GraphicsDevice; +import java.awt.Point; +import java.awt.Rectangle; +import java.io.IOException; +import java.net.InetSocketAddress; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.logging.Level; + +import org.mote.wiimote.whiteboard.WiimoteDataHandler; +import org.mote.wiimote.whiteboard.WiimoteWhiteboard; +import org.mote.wiimote.whiteboard.WiimoteDataHandler.WiimoteDataListener; +import org.mote.wiimote.whiteboard.calibration.WiimoteCalibration; +import org.mote.wiimote.whiteboard.calibration.WiimoteCalibration.CalibrationEvent; +import org.mote.wiimote.whiteboard.calibration.WiimoteCalibration.CalibrationEventListener; +import org.mote.wiimote.whiteboard.ds.IRDot; +import org.mote.wiimote.whiteboard.ds.Wiimote; +import org.mote.wiimote.whiteboard.preferences.WWPreferences; +import org.mote.wiimote.whiteboard.preferences.WWPreferences.PreferencesListener; + +import de.sciss.net.OSCBundle; +import de.sciss.net.OSCClient; +import de.sciss.net.OSCMessage; +import de.sciss.net.OSCServer; + +public class TuioTransmitter implements PreferencesListener, WiimoteDataListener, CalibrationEventListener { + + private static final OSCMessage SOURCE_PACKET = new OSCMessage("/tuio/2Dcur", new Object[] { "source", WiimoteWhiteboard.getProperty("id") }); + + private int fseq; + private int sseq; + private int[] sessions; + private Point[] last; + private float[] lastSpeed = {0f,0f,0f,0f}; + private OSCClient trans = null; + private int port = -1; + private String host = null; + + private Rectangle bounds; + private WiimoteDataHandler dh; + private WiimoteCalibration calibration; + private static final WWPreferences prefs = WWPreferences.getPreferences(); + + public TuioTransmitter(WiimoteDataHandler dh, WiimoteCalibration calibration) { + this.dh = dh; + this.calibration = calibration; + calibration.addCalibrationEventListener(this); + prefs.addPreferencesListener(this); + update(); + } + + private void update() { + try { + if (prefs.isTuioEnabled()) { + if (trans == null || prefs.getTuioPort() != port || !prefs.getTuioHost().equals(host)) { + if (trans != null) + trans.stop(); + + fseq = 0; + sseq = 0; + sessions = new int[4]; + last = new Point[4]; + port = prefs.getTuioPort(); + host = prefs.getTuioHost(); + getScreenSize(); + + trans = OSCClient.newUsing(OSCServer.UDP); + trans.setTarget(new InetSocketAddress(host, port)); + trans.start(); + dh.addWiimoteDataListener(this); + } + } else { + dh.removeWiimoteDataListener(this); + if (trans != null) + trans.stop(); + trans = null; + } + } catch (IOException e) { + e.printStackTrace(); + WiimoteWhiteboard.getLogger().log(Level.WARNING, "TUIO transmission error.", e); + } + } + + public void preferencesChanged() { + update(); + } + + public void calibrationEvent(CalibrationEvent e) { + if (e == CalibrationEvent.SCREEN_CHANGED) { + getScreenSize(); + } + } + + private void getScreenSize() { + GraphicsDevice screen = calibration.getScreen(); + if (screen != null) + bounds = screen.getDefaultConfiguration().getBounds(); + } + + public void irWarped(Map data, Point[] points) { + if (trans == null) return; + + // return if all lights are off now and were previously + if ((points[0] == null && points[1] == null && points[2] == null && points[3] == null) && + (last[0] == null && last[1] == null && last[2] == null && last[3] == null)) + return; + + OSCBundle b = new OSCBundle(); + + b.addPacket(SOURCE_PACKET); + + List alive = new ArrayList(); + alive.add("alive"); + for (int i = 0; i < 4; i++) { + if (points[i] != null) { + if (last[i] == null) + sessions[i] = ++sseq; + alive.add(sessions[i]); + } + } + b.addPacket(new OSCMessage("/tuio/2Dcur", alive.toArray())); + + for (int i = 0; i < 4; i++) { + Point p = points[i]; + Point l = last[i] != null ? last[i] : p; + if (p != null) { + p.translate(-bounds.x, -bounds.y); + float px = (float)Math.max(0, Math.min(p.x, bounds.width)) / bounds.width; + float py = (float)Math.max(0, Math.min(p.y, bounds.height)) / bounds.height; + float lx = (float)Math.max(0, Math.min(l.x, bounds.width)) / bounds.width; + float ly = (float)Math.max(0, Math.min(l.y, bounds.height)) / bounds.height; + float speed = (float)Math.sqrt(Math.pow(px - lx, 2) + Math.pow(py - ly, 2)); + b.addPacket(new OSCMessage("/tuio/2Dcur", new Object[] { + "set", + // s: session id + sessions[i], + // x, y: normalized position + px, py, + // X, Y: normalized motion speed + px - lx, py - ly, + // m: normalized motion acceleration + speed - lastSpeed[i] + })); + lastSpeed[i] = speed; + } else { + lastSpeed[i] = 0f; + } + last[i] = p; + } + + b.addPacket(new OSCMessage("/tuio/2Dcur", new Object[] { "fseq", fseq++ })); + + try { + trans.send(b); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public void batteryLevel(Wiimote wiimote, double level) { + } + + public void irLights(Wiimote wiimote, IRDot[] lights) { + } + + public void wiimoteConnected(Wiimote wiimote) { + } + + public void wiimoteDisconnected(Wiimote wiimote) { + } + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/tuio/TuioTransmitter.java~ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/tuio/TuioTransmitter.java~ new file mode 100644 index 0000000..f0f952f --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/tuio/TuioTransmitter.java~ @@ -0,0 +1,209 @@ +/* + * Copyright (C) 2008-2009, Uwe Schmidt + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * The Software uses a third-party library (WiiRemoteJ) which is not part of + * the Software and is subject to its own license. + */ + +package org.uweschmidt.wiimote.whiteboard.tuio; + +import java.awt.GraphicsDevice; +import java.awt.Point; +import java.awt.Rectangle; +import java.io.IOException; +import java.net.InetSocketAddress; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.logging.Level; + +import org.uweschmidt.wiimote.whiteboard.WiimoteDataHandler; +import org.uweschmidt.wiimote.whiteboard.WiimoteWhiteboard; +import org.uweschmidt.wiimote.whiteboard.WiimoteDataHandler.WiimoteDataListener; +import org.uweschmidt.wiimote.whiteboard.calibration.WiimoteCalibration; +import org.uweschmidt.wiimote.whiteboard.calibration.WiimoteCalibration.CalibrationEvent; +import org.uweschmidt.wiimote.whiteboard.calibration.WiimoteCalibration.CalibrationEventListener; +import org.uweschmidt.wiimote.whiteboard.ds.IRDot; +import org.uweschmidt.wiimote.whiteboard.ds.Wiimote; +import org.uweschmidt.wiimote.whiteboard.preferences.WWPreferences; +import org.uweschmidt.wiimote.whiteboard.preferences.WWPreferences.PreferencesListener; + +import de.sciss.net.OSCBundle; +import de.sciss.net.OSCClient; +import de.sciss.net.OSCMessage; +import de.sciss.net.OSCServer; + +public class TuioTransmitter implements PreferencesListener, WiimoteDataListener, CalibrationEventListener { + + private static final OSCMessage SOURCE_PACKET = new OSCMessage("/tuio/2Dcur", new Object[] { "source", WiimoteWhiteboard.getProperty("id") }); + + private int fseq; + private int sseq; + private int[] sessions; + private Point[] last; + private float[] lastSpeed = {0f,0f,0f,0f}; + private OSCClient trans = null; + private int port = -1; + private String host = null; + + private Rectangle bounds; + private WiimoteDataHandler dh; + private WiimoteCalibration calibration; + private static final WWPreferences prefs = WWPreferences.getPreferences(); + + public TuioTransmitter(WiimoteDataHandler dh, WiimoteCalibration calibration) { + this.dh = dh; + this.calibration = calibration; + calibration.addCalibrationEventListener(this); + prefs.addPreferencesListener(this); + update(); + } + + private void update() { + try { + if (prefs.isTuioEnabled()) { + if (trans == null || prefs.getTuioPort() != port || !prefs.getTuioHost().equals(host)) { + if (trans != null) + trans.stop(); + + fseq = 0; + sseq = 0; + sessions = new int[4]; + last = new Point[4]; + port = prefs.getTuioPort(); + host = prefs.getTuioHost(); + getScreenSize(); + + trans = OSCClient.newUsing(OSCServer.UDP); + trans.setTarget(new InetSocketAddress(host, port)); + trans.start(); + dh.addWiimoteDataListener(this); + } + } else { + dh.removeWiimoteDataListener(this); + if (trans != null) + trans.stop(); + trans = null; + } + } catch (IOException e) { + e.printStackTrace(); + WiimoteWhiteboard.getLogger().log(Level.WARNING, "TUIO transmission error.", e); + } + } + + public void preferencesChanged() { + update(); + } + + public void calibrationEvent(CalibrationEvent e) { + if (e == CalibrationEvent.SCREEN_CHANGED) { + getScreenSize(); + } + } + + private void getScreenSize() { + GraphicsDevice screen = calibration.getScreen(); + if (screen != null) + bounds = screen.getDefaultConfiguration().getBounds(); + } + + // implementation rationale: + // - http://www.tuio.org/specs.html + // - http://www.adrienm.net/emotion/forum/viewtopic.php?f=3&t=20&st=0&sk=t&sd=a&start=10 + public void irWarped(Map data, Point[] points) { + if (trans == null) return; + + // return if all lights are off now and were previously + if ((points[0] == null && points[1] == null && points[2] == null && points[3] == null) && + (last[0] == null && last[1] == null && last[2] == null && last[3] == null)) + return; + + OSCBundle b = new OSCBundle(); + + // (1) source name + b.addPacket(SOURCE_PACKET); + + // (2) alive sessions + List alive = new ArrayList(); + alive.add("alive"); + for (int i = 0; i < 4; i++) { + if (points[i] != null) { + if (last[i] == null) + sessions[i] = ++sseq; + alive.add(sessions[i]); + } + } + b.addPacket(new OSCMessage("/tuio/2Dcur", alive.toArray())); + + // (3) cursor data + for (int i = 0; i < 4; i++) { + Point p = points[i]; + Point l = last[i] != null ? last[i] : p; + if (p != null) { + p.translate(-bounds.x, -bounds.y); + // "l" is the last point and already translated, or p itself if not available + float px = (float)Math.max(0, Math.min(p.x, bounds.width)) / bounds.width; + float py = (float)Math.max(0, Math.min(p.y, bounds.height)) / bounds.height; + float lx = (float)Math.max(0, Math.min(l.x, bounds.width)) / bounds.width; + float ly = (float)Math.max(0, Math.min(l.y, bounds.height)) / bounds.height; + float speed = (float)Math.sqrt(Math.pow(px - lx, 2) + Math.pow(py - ly, 2)); + b.addPacket(new OSCMessage("/tuio/2Dcur", new Object[] { + "set", + // s: session id + sessions[i], + // x, y: normalized position, range 0..1 + px, py, + // X, Y: normalized motion speed (dt = 1) + px - lx, py - ly, + // m: normalized motion acceleration (dt = 1) + speed - lastSpeed[i] + })); + lastSpeed[i] = speed; + } else { + lastSpeed[i] = 0f; + } + last[i] = p; + } + + // (4) frame sequence number + b.addPacket(new OSCMessage("/tuio/2Dcur", new Object[] { "fseq", fseq++ })); + + try { +// OSCPacket.printTextOn(System.out, b); + trans.send(b); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public void batteryLevel(Wiimote wiimote, double level) { + } + + public void irLights(Wiimote wiimote, IRDot[] lights) { + } + + public void wiimoteConnected(Wiimote wiimote) { + } + + public void wiimoteDisconnected(Wiimote wiimote) { + } + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/BareBonesBrowserLaunch.java b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/BareBonesBrowserLaunch.java new file mode 100644 index 0000000..b624822 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/BareBonesBrowserLaunch.java @@ -0,0 +1,36 @@ +package org.mote.wiimote.whiteboard.util; + +import java.lang.reflect.Method; + +import javax.swing.JOptionPane; + +public class BareBonesBrowserLaunch { + + private static final String errMsg = "Error attempting to launch web browser"; + + public static void openURL(String url) { + String osName = System.getProperty("os.name"); + try { + if (osName.startsWith("Mac OS")) { + Class fileMgr = Class.forName("com.apple.eio.FileManager"); + Method openURL = fileMgr.getDeclaredMethod("openURL", new Class[] { String.class }); + openURL.invoke(null, new Object[] { url }); + } else if (osName.startsWith("Windows")) + Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + url); + else { / + String[] browsers = { "firefox", "opera", "konqueror", "epiphany", "mozilla", "netscape" }; + String browser = null; + for (int count = 0; count < browsers.length && browser == null; count++) + if (Runtime.getRuntime().exec(new String[] { "which", browsers[count] }).waitFor() == 0) + browser = browsers[count]; + if (browser == null) + throw new Exception("Could not find web browser"); + else + Runtime.getRuntime().exec(new String[] { browser, url }); + } + } catch (Exception e) { + JOptionPane.showMessageDialog(null, errMsg + ":\n" + e.getLocalizedMessage()); + } + } + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/BareBonesBrowserLaunch.java~ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/BareBonesBrowserLaunch.java~ new file mode 100644 index 0000000..5d5a21e --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/BareBonesBrowserLaunch.java~ @@ -0,0 +1,46 @@ +package org.uweschmidt.wiimote.whiteboard.util; + +import java.lang.reflect.Method; + +import javax.swing.JOptionPane; + +///////////////////////////////////////////////////////// +// Bare Bones Browser Launch // +// Version 1.5 (December 10, 2005) // +// By Dem Pilafian // +// Supports: Mac OS X, GNU/Linux, Unix, Windows XP // +// Example Usage: // +// String url = "http://www.centerkey.com/"; // +// BareBonesBrowserLaunch.openURL(url); // +// Public Domain Software -- Free to Use as You Like // +///////////////////////////////////////////////////////// +public class BareBonesBrowserLaunch { + + private static final String errMsg = "Error attempting to launch web browser"; + + public static void openURL(String url) { + String osName = System.getProperty("os.name"); + try { + if (osName.startsWith("Mac OS")) { + Class fileMgr = Class.forName("com.apple.eio.FileManager"); + Method openURL = fileMgr.getDeclaredMethod("openURL", new Class[] { String.class }); + openURL.invoke(null, new Object[] { url }); + } else if (osName.startsWith("Windows")) + Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + url); + else { //assume Unix or Linux + String[] browsers = { "firefox", "opera", "konqueror", "epiphany", "mozilla", "netscape" }; + String browser = null; + for (int count = 0; count < browsers.length && browser == null; count++) + if (Runtime.getRuntime().exec(new String[] { "which", browsers[count] }).waitFor() == 0) + browser = browsers[count]; + if (browser == null) + throw new Exception("Could not find web browser"); + else + Runtime.getRuntime().exec(new String[] { browser, url }); + } + } catch (Exception e) { + JOptionPane.showMessageDialog(null, errMsg + ":\n" + e.getLocalizedMessage()); + } + } + +} \ No newline at end of file diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/UpdateNotifier.java b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/UpdateNotifier.java new file mode 100644 index 0000000..d598022 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/UpdateNotifier.java @@ -0,0 +1,52 @@ +package org.mote.wiimote.whiteboard.util; + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.net.URL; + +import javax.swing.JOptionPane; + +import org.mote.wiimote.whiteboard.WiimoteWhiteboard; + +public class UpdateNotifier { + + public static void checkForUpdate(String version) { + try { + URL url = new URL(WiimoteWhiteboard.getProperty("updateURL")); + BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream())); + final String current = in.readLine(); + if (compare(version, current)) + showUpdateNotification(version, current); + in.close(); + } catch (Exception e) { + + } + } + + private static void showUpdateNotification(String program, String current) throws Exception { + String question = Util.getResourceMap(UpdateNotifier.class).getString("updateQuestion", WiimoteWhiteboard.getProperty("id")); + String title = Util.getResourceMap(UpdateNotifier.class).getString("updateTitle", WiimoteWhiteboard.getProperty("id"), current); + int response = JOptionPane.showConfirmDialog(null, question, title, JOptionPane.YES_NO_OPTION); + if (response == JOptionPane.YES_OPTION) { + BareBonesBrowserLaunch.openURL(WiimoteWhiteboard.getProperty("homepage")); + } + } + + private static boolean compare(String program, String current) throws Exception { + String[] psplit = program.split("\\."), csplit = current.split("\\."); + int[] p = new int[3], c = new int[3]; + for (int i = 0; i < 3; i++) { + p[i] = Integer.valueOf(psplit[i]); + c[i] = Integer.valueOf(csplit[i]); + } + if (c[0] > p[0]) return true; + if (c[0] == p[0]) { + if (c[1] > p[1]) return true; + if (c[1] == p[1]) { + if (c[2] > p[2]) return true; + } + } + return false; + } + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/UpdateNotifier.java~ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/UpdateNotifier.java~ new file mode 100644 index 0000000..43fbca3 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/UpdateNotifier.java~ @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2008-2009, Uwe Schmidt + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * The Software uses a third-party library (WiiRemoteJ) which is not part of + * the Software and is subject to its own license. + */ + +package org.uweschmidt.wiimote.whiteboard.util; + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.net.URL; + +import javax.swing.JOptionPane; + +import org.uweschmidt.wiimote.whiteboard.WiimoteWhiteboard; + +public class UpdateNotifier { + + public static void checkForUpdate(String version) { + try { + URL url = new URL(WiimoteWhiteboard.getProperty("updateURL")); + BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream())); + final String current = in.readLine(); + if (compare(version, current)) + showUpdateNotification(version, current); + in.close(); + } catch (Exception e) { + // ignore + } + } + + private static void showUpdateNotification(String program, String current) throws Exception { + String question = Util.getResourceMap(UpdateNotifier.class).getString("updateQuestion", WiimoteWhiteboard.getProperty("id")); + String title = Util.getResourceMap(UpdateNotifier.class).getString("updateTitle", WiimoteWhiteboard.getProperty("id"), current); + int response = JOptionPane.showConfirmDialog(null, question, title, JOptionPane.YES_NO_OPTION); + if (response == JOptionPane.YES_OPTION) { + BareBonesBrowserLaunch.openURL(WiimoteWhiteboard.getProperty("homepage")); + } + } + + private static boolean compare(String program, String current) throws Exception { + String[] psplit = program.split("\\."), csplit = current.split("\\."); + int[] p = new int[3], c = new int[3]; + for (int i = 0; i < 3; i++) { + p[i] = Integer.valueOf(psplit[i]); + c[i] = Integer.valueOf(csplit[i]); + } + if (c[0] > p[0]) return true; + if (c[0] == p[0]) { + if (c[1] > p[1]) return true; + if (c[1] == p[1]) { + if (c[2] > p[2]) return true; + } + } + return false; + } + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/Util.java b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/Util.java new file mode 100644 index 0000000..eaef6bd --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/Util.java @@ -0,0 +1,70 @@ +package org.mote.wiimote.whiteboard.util; + +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Point; +import java.awt.Toolkit; +import java.awt.Window; +import java.lang.reflect.Constructor; + +import javax.swing.Action; + +import org.jdesktop.application.Application; +import org.jdesktop.application.ResourceMap; + +public final class Util { + + private static final String OS_VERSION = System.getProperty("os.version"); + public static final boolean WINDOWS = System.getProperty("os.name").toLowerCase().startsWith("windows"); + public static final boolean MAC_OS_X = System.getProperty("os.name").toLowerCase().startsWith("mac os x"); + public static final boolean MAC_OS_X_INTEL = MAC_OS_X && System.getProperty("os.arch").equals("i386"); + public static final boolean MAC_OS_X_PPC = MAC_OS_X && System.getProperty("os.arch").equals("ppc"); + public static final boolean MAC_OS_X_TIGER = MAC_OS_X && OS_VERSION.startsWith("10.4"); + public static final boolean MAC_OS_X_LEOPARD = MAC_OS_X && OS_VERSION.startsWith("10.5"); + public static final boolean MAC_OS_X_LEOPARD_OR_HIGHER = MAC_OS_X && Float.parseFloat(OS_VERSION.substring(0, OS_VERSION.lastIndexOf('.'))) >= 10.5f; + public static final boolean INSIDE_APP_BUNDLE = MAC_OS_X && System.getProperty("org.mote.wiimote.whiteboard.insideBundle") != null && System.getProperty("org.mote.wiimote.whiteboard.insideBundle").equals("true"); + + private Util() {} + + public static ResourceMap getResourceMap(final Class c) { + return Application.getInstance().getContext().getResourceMap(c); + } + + public static Action getAction(final Object o, final Object key) { + return Application.getInstance().getContext().getActionMap(o).get(key); + } + + public static T newComponent(Class classT, String name) { + return newComponent(classT, name, null); + } + + public static T newComponent(Class classT, String name, Constructor con, Object... args) { + try { + T component = null; + if (con != null) { + component = con.newInstance(args); + } else { + component = classT.newInstance(); + } + component.setName(name); + return component; + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + public static void placeDialogWindow(Window window, int width, int height) { + + Dimension windowSize = new Dimension(width, height); + window.setSize(windowSize); + + Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); + + Point windowLocation = new Point(0, 0); + windowLocation.x = (screenSize.width - windowSize.width) / 2; + windowLocation.y = (screenSize.height / 3) - (windowSize.height / 2); + + window.setLocation(windowLocation); + } +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/Util.java~ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/Util.java~ new file mode 100644 index 0000000..925c4d8 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/Util.java~ @@ -0,0 +1,95 @@ +/* + * Copyright (C) 2008-2009, Uwe Schmidt + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * The Software uses a third-party library (WiiRemoteJ) which is not part of + * the Software and is subject to its own license. + */ + +package org.uweschmidt.wiimote.whiteboard.util; + +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Point; +import java.awt.Toolkit; +import java.awt.Window; +import java.lang.reflect.Constructor; + +import javax.swing.Action; + +import org.jdesktop.application.Application; +import org.jdesktop.application.ResourceMap; + +public final class Util { + + private static final String OS_VERSION = System.getProperty("os.version"); + public static final boolean WINDOWS = System.getProperty("os.name").toLowerCase().startsWith("windows"); + public static final boolean MAC_OS_X = System.getProperty("os.name").toLowerCase().startsWith("mac os x"); + public static final boolean MAC_OS_X_INTEL = MAC_OS_X && System.getProperty("os.arch").equals("i386"); + public static final boolean MAC_OS_X_PPC = MAC_OS_X && System.getProperty("os.arch").equals("ppc"); + public static final boolean MAC_OS_X_TIGER = MAC_OS_X && OS_VERSION.startsWith("10.4"); + public static final boolean MAC_OS_X_LEOPARD = MAC_OS_X && OS_VERSION.startsWith("10.5"); + public static final boolean MAC_OS_X_LEOPARD_OR_HIGHER = MAC_OS_X && Float.parseFloat(OS_VERSION.substring(0, OS_VERSION.lastIndexOf('.'))) >= 10.5f; + public static final boolean INSIDE_APP_BUNDLE = MAC_OS_X && System.getProperty("org.uweschmidt.wiimote.whiteboard.insideBundle") != null && System.getProperty("org.uweschmidt.wiimote.whiteboard.insideBundle").equals("true"); + + private Util() {} + + public static ResourceMap getResourceMap(final Class c) { + return Application.getInstance().getContext().getResourceMap(c); + } + + public static Action getAction(final Object o, final Object key) { + return Application.getInstance().getContext().getActionMap(o).get(key); + } + + public static T newComponent(Class classT, String name) { + return newComponent(classT, name, null); + } + + public static T newComponent(Class classT, String name, Constructor con, Object... args) { + try { + T component = null; + if (con != null) { + component = con.newInstance(args); + } else { + component = classT.newInstance(); + } + component.setName(name); + return component; + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + public static void placeDialogWindow(Window window, int width, int height) { + + Dimension windowSize = new Dimension(width, height); + window.setSize(windowSize); + + Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); + + Point windowLocation = new Point(0, 0); + windowLocation.x = (screenSize.width - windowSize.width) / 2; + windowLocation.y = (screenSize.height / 3) - (windowSize.height / 2); + + window.setLocation(windowLocation); + } +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/WiiRemoteJErrorHandler.java b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/WiiRemoteJErrorHandler.java new file mode 100644 index 0000000..9a1dfda --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/WiiRemoteJErrorHandler.java @@ -0,0 +1,43 @@ +package org.mote.wiimote.whiteboard.util; + +import java.util.logging.Handler; +import java.util.logging.Level; +import java.util.logging.LogRecord; + +import javax.swing.JOptionPane; + +import org.jdesktop.application.Application; +import org.mote.wiimote.whiteboard.WiimoteDataHandler; +import org.mote.wiimote.whiteboard.WiimoteWhiteboard; + +import com.intel.bluetooth.NotSupportedIOException; + +public class WiiRemoteJErrorHandler extends Handler { + + public WiiRemoteJErrorHandler(WiimoteDataHandler dh) { + setLevel(Level.SEVERE); + } + + @Override + public void close() throws SecurityException { + } + + @Override + public void flush() { + } + + @Override + public void publish(LogRecord record) { + final Throwable thrown = record.getThrown(); + if (thrown != null) { + thrown.printStackTrace(); + if (thrown.getCause() instanceof NotSupportedIOException) { + + String msg = thrown.getMessage() + "\n" + thrown.getCause().getMessage(); + JOptionPane.showMessageDialog(null, msg, WiimoteWhiteboard.getProperty("id"), JOptionPane.ERROR_MESSAGE); + Application.getInstance().exit(); + } + } + } + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/WiiRemoteJErrorHandler.java~ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/WiiRemoteJErrorHandler.java~ new file mode 100644 index 0000000..7fb3f14 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/WiiRemoteJErrorHandler.java~ @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2008-2009, Uwe Schmidt + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * The Software uses a third-party library (WiiRemoteJ) which is not part of + * the Software and is subject to its own license. + */ + +package org.uweschmidt.wiimote.whiteboard.util; + +import java.util.logging.Handler; +import java.util.logging.Level; +import java.util.logging.LogRecord; + +import javax.swing.JOptionPane; + +import org.jdesktop.application.Application; +import org.uweschmidt.wiimote.whiteboard.WiimoteDataHandler; +import org.uweschmidt.wiimote.whiteboard.WiimoteWhiteboard; + +import com.intel.bluetooth.NotSupportedIOException; + +public class WiiRemoteJErrorHandler extends Handler { + + public WiiRemoteJErrorHandler(WiimoteDataHandler dh) { + setLevel(Level.SEVERE); + } + + @Override + public void close() throws SecurityException { + } + + @Override + public void flush() { + } + + @Override + public void publish(LogRecord record) { + final Throwable thrown = record.getThrown(); + if (thrown != null) { + thrown.printStackTrace(); + if (thrown.getCause() instanceof NotSupportedIOException) { + // TODO say that BT stack and BlueCove are probably not compatible + String msg = thrown.getMessage() + "\n" + thrown.getCause().getMessage(); + JOptionPane.showMessageDialog(null, msg, WiimoteWhiteboard.getProperty("id"), JOptionPane.ERROR_MESSAGE); + Application.getInstance().exit(); + } + } + } + +} diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/resources/UpdateNotifier.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/resources/UpdateNotifier.properties new file mode 100644 index 0000000..69bc794 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/resources/UpdateNotifier.properties @@ -0,0 +1,2 @@ +updateQuestion = A new version of %s is available.${nl}Do you want to download it now? +updateTitle = %s %s available diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/resources/UpdateNotifier_de.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/resources/UpdateNotifier_de.properties new file mode 100644 index 0000000..b169217 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/resources/UpdateNotifier_de.properties @@ -0,0 +1,6 @@ +#:1224192325,Uwe + +updateQuestion=Eine neue Version von %s ist verf\u00fcgbar.${nl}M\u00f6chtest du sie jetzt herunterladen? + +updateTitle=%s %s verf\u00fcgbar + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/resources/UpdateNotifier_es.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/resources/UpdateNotifier_es.properties new file mode 100644 index 0000000..5023e98 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/resources/UpdateNotifier_es.properties @@ -0,0 +1,6 @@ +#:1223613184,Descalzo + +updateQuestion=Una nueva versi\u00f3n de %s est\u00e1 disponible.${nl}\u00bfQuiere bajarla ahora? + +updateTitle=%s %s disponible + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/resources/UpdateNotifier_et.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/resources/UpdateNotifier_et.properties new file mode 100644 index 0000000..7b7b95b --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/resources/UpdateNotifier_et.properties @@ -0,0 +1,6 @@ +#:1248454438,Marko + +updateQuestion=Uus versioon %s on saadaval.${nl}Soovid Sa selle kohe alla laadida? + +updateTitle=%s %s saadaval + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/resources/UpdateNotifier_fr.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/resources/UpdateNotifier_fr.properties new file mode 100644 index 0000000..6361d9a --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/resources/UpdateNotifier_fr.properties @@ -0,0 +1,6 @@ +#:1223410209,Francois + +updateQuestion=Une nouvelle version %s est disponible.${nl}Veux tu la t\u00e9l\u00e9charger ? + +updateTitle=%s %s disponible + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/resources/UpdateNotifier_in.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/resources/UpdateNotifier_in.properties new file mode 100644 index 0000000..76ae600 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/resources/UpdateNotifier_in.properties @@ -0,0 +1,6 @@ +#:1275563821,Bobby + +updateQuestion=Versi yang lebih baru %s telah tersedia.${nl}Apakah anda ingin mendownload nya sekarang? + +updateTitle=%s %s telah tersedia + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/resources/UpdateNotifier_it.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/resources/UpdateNotifier_it.properties new file mode 100644 index 0000000..ccb4334 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/resources/UpdateNotifier_it.properties @@ -0,0 +1,6 @@ +#:1225966650,Francesco + +updateQuestion=Una nuova versione di %s \u00e8 disponibile.${nl}Vuoi scaricarla adesso? + +updateTitle=%s %s disponibile + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/resources/UpdateNotifier_pl.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/resources/UpdateNotifier_pl.properties new file mode 100644 index 0000000..8bd9800 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/resources/UpdateNotifier_pl.properties @@ -0,0 +1,6 @@ +#:1253216555,Grzegorz + +updateQuestion=Dost\u0119pna jest nowa wersja %s.${nl}Chcesz j\u0105 pobra\u0107 teraz? + +updateTitle=%s %s dost\u0119pny + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/resources/UpdateNotifier_pt.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/resources/UpdateNotifier_pt.properties new file mode 100644 index 0000000..e7e8e42 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/resources/UpdateNotifier_pt.properties @@ -0,0 +1,6 @@ +#:1223499867,Francisco + +updateQuestion=Est\u00e1 dispon\u00edvel uma nova vers\u00e3o do %s.${nl}Pretende descarreg\u00e1-la agora? + +updateTitle=%s %s dispon\u00edvel + diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/resources/UpdateNotifier_ru.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/resources/UpdateNotifier_ru.properties new file mode 100644 index 0000000..03a0fb0 --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/resources/UpdateNotifier_ru.properties @@ -0,0 +1,4 @@ +#Translated by Dmitry Pupinin (dlnsk@mail.ru) +#Mon Jan 25 00:12:42 NOVT 2010 +updateTitle=%s %s \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 +updateQuestion=\u0414\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u043d\u043e\u0432\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f %s.${nl}\u0416\u0435\u043b\u0430\u0435\u0442\u0435 \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u0435\u0435 \u0441\u0435\u0439\u0447\u0430\u0441? diff --git a/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/resources/UpdateNotifier_sl.properties b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/resources/UpdateNotifier_sl.properties new file mode 100644 index 0000000..b3b0b5b --- /dev/null +++ b/WiimoteWhiteboard/src/org/mote/wiimote/whiteboard/util/resources/UpdateNotifier_sl.properties @@ -0,0 +1,6 @@ +#:1238649836,Samo + +updateQuestion=Na voljo je nova razli\u010dica %s.${nl}Ali jo \u017eelite prenesti? + +updateTitle=%s %s je na voljo + -- libgit2 0.21.2