// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
// SPDX-License-Identifier: BSD-3-Clause

#include "vtkActor.h"
#include "vtkAppendPolyData.h"
#include "vtkCamera.h"
#include "vtkClipPolyData.h"
#include "vtkCommand.h"
#include "vtkConeSource.h"
#include "vtkFrustum.h"
#include "vtkGlyph3D.h"
#include "vtkImplicitFrustumRepresentation.h"
#include "vtkImplicitFrustumWidget.h"
#include "vtkInteractorEventRecorder.h"
#include "vtkPolyData.h"
#include "vtkPolyDataMapper.h"
#include "vtkProperty.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkRenderer.h"
#include "vtkSphereSource.h"

namespace
{

const char eventLog[] = "# StreamVersion 1.2\n"
                        "ExposeEvent 0 299 0 0 0 0 0\n"
                        "RenderEvent 0 299 0 0 0 0 0\n"
                        "MouseWheelBackwardEvent 176 156 0 0 0 0 0\n"
                        "MouseWheelBackwardEvent 176 156 0 0 0 0 0\n"
                        "MouseWheelBackwardEvent 176 156 0 0 0 0 0\n"
                        "RenderEvent 78 109 0 0 0 0 0\n"
                        "LeftButtonPressEvent 78 109 0 0 0 0 0\n"
                        "RenderEvent 78 109 0 0 0 0 0\n"
                        "MouseMoveEvent 78 109 0 0 0 0 0\n"
                        "RenderEvent 78 109 0 0 0 0 0\n"
                        "MouseMoveEvent 79 108 0 0 0 0 0\n"
                        "RenderEvent 79 108 0 0 0 0 0\n"
                        "MouseMoveEvent 84 103 0 0 0 0 0\n"
                        "RenderEvent 84 103 0 0 0 0 0\n"
                        "MouseMoveEvent 85 102 0 0 0 0 0\n"
                        "RenderEvent 85 102 0 0 0 0 0\n"
                        "MouseMoveEvent 86 101 0 0 0 0 0\n"
                        "RenderEvent 86 101 0 0 0 0 0\n"
                        "MouseMoveEvent 87 101 0 0 0 0 0\n"
                        "RenderEvent 87 101 0 0 0 0 0\n"
                        "MouseMoveEvent 87 100 0 0 0 0 0\n"
                        "RenderEvent 87 100 0 0 0 0 0\n"
                        "MouseMoveEvent 88 100 0 0 0 0 0\n"
                        "RenderEvent 88 100 0 0 0 0 0\n"
                        "MouseMoveEvent 88 99 0 0 0 0 0\n"
                        "RenderEvent 88 99 0 0 0 0 0\n"
                        "MouseMoveEvent 89 99 0 0 0 0 0\n"
                        "RenderEvent 89 99 0 0 0 0 0\n"
                        "MouseMoveEvent 90 98 0 0 0 0 0\n"
                        "RenderEvent 90 98 0 0 0 0 0\n"
                        "MouseMoveEvent 90 97 0 0 0 0 0\n"
                        "RenderEvent 90 97 0 0 0 0 0\n"
                        "MouseMoveEvent 91 97 0 0 0 0 0\n"
                        "RenderEvent 91 97 0 0 0 0 0\n"
                        "MouseMoveEvent 92 97 0 0 0 0 0\n"
                        "RenderEvent 92 97 0 0 0 0 0\n"
                        "MouseMoveEvent 92 97 0 0 0 0 0\n"
                        "RenderEvent 92 97 0 0 0 0 0\n"
                        "MouseMoveEvent 93 97 0 0 0 0 0\n"
                        "RenderEvent 93 97 0 0 0 0 0\n"
                        "MouseMoveEvent 93 96 0 0 0 0 0\n"
                        "RenderEvent 93 96 0 0 0 0 0\n"
                        "MouseMoveEvent 94 95 0 0 0 0 0\n"
                        "RenderEvent 94 95 0 0 0 0 0\n"
                        "MouseMoveEvent 94 94 0 0 0 0 0\n"
                        "RenderEvent 94 94 0 0 0 0 0\n"
                        "MouseMoveEvent 95 94 0 0 0 0 0\n"
                        "RenderEvent 95 94 0 0 0 0 0\n"
                        "MouseMoveEvent 95 93 0 0 0 0 0\n"
                        "RenderEvent 95 93 0 0 0 0 0\n"
                        "MouseMoveEvent 95 94 0 0 0 0 0\n"
                        "RenderEvent 95 94 0 0 0 0 0\n"
                        "MouseMoveEvent 95 94 0 0 0 0 0\n"
                        "RenderEvent 95 94 0 0 0 0 0\n"
                        "MouseMoveEvent 95 95 0 0 0 0 0\n"
                        "RenderEvent 95 95 0 0 0 0 0\n"
                        "LeftButtonReleaseEvent 95 95 0 0 0 0 0\n"
                        "RenderEvent 95 95 0 0 0 0 0\n"
                        "MouseMoveEvent 95 96 0 0 0 0 0\n"
                        "RenderEvent 95 96 0 0 0 0 0\n"
                        "MouseMoveEvent 94 98 0 0 0 0 0\n"
                        "MouseMoveEvent 94 100 0 0 0 0 0\n"
                        "RenderEvent 94 100 0 0 0 0 0\n"
                        "MouseMoveEvent 94 104 0 0 0 0 0\n"
                        "RenderEvent 94 104 0 0 0 0 0\n"
                        "MouseMoveEvent 94 107 0 0 0 0 0\n"
                        "RenderEvent 94 107 0 0 0 0 0\n"
                        "MouseMoveEvent 94 114 0 0 0 0 0\n"
                        "RenderEvent 94 114 0 0 0 0 0\n"
                        "MouseMoveEvent 95 123 0 0 0 0 0\n"
                        "RenderEvent 95 123 0 0 0 0 0\n"
                        "MouseMoveEvent 102 133 0 0 0 0 0\n"
                        "RenderEvent 102 133 0 0 0 0 0\n"
                        "MouseMoveEvent 110 141 0 0 0 0 0\n"
                        "RenderEvent 110 141 0 0 0 0 0\n"
                        "MouseMoveEvent 117 150 0 0 0 0 0\n"
                        "RenderEvent 117 150 0 0 0 0 0\n"
                        "MouseMoveEvent 122 155 0 0 0 0 0\n"
                        "RenderEvent 122 155 0 0 0 0 0\n"
                        "MouseMoveEvent 128 172 0 0 0 0 0\n"
                        "RenderEvent 128 172 0 0 0 0 0\n"
                        "MouseMoveEvent 129 190 0 0 0 0 0\n"
                        "RenderEvent 129 190 0 0 0 0 0\n"
                        "MouseMoveEvent 129 207 0 0 0 0 0\n"
                        "RenderEvent 129 207 0 0 0 0 0\n"
                        "MouseMoveEvent 129 221 0 0 0 0 0\n"
                        "RenderEvent 129 221 0 0 0 0 0\n"
                        "MouseMoveEvent 129 233 0 0 0 0 0\n"
                        "RenderEvent 129 233 0 0 0 0 0\n"
                        "MouseMoveEvent 130 242 0 0 0 0 0\n"
                        "RenderEvent 130 242 0 0 0 0 0\n"
                        "MouseMoveEvent 131 248 0 0 0 0 0\n"
                        "RenderEvent 131 248 0 0 0 0 0\n"
                        "MouseMoveEvent 131 253 0 0 0 0 0\n"
                        "RenderEvent 131 253 0 0 0 0 0\n"
                        "MouseMoveEvent 131 257 0 0 0 0 0\n"
                        "RenderEvent 131 257 0 0 0 0 0\n"
                        "MouseMoveEvent 130 258 0 0 0 0 0\n"
                        "RenderEvent 130 258 0 0 0 0 0\n"
                        "MouseMoveEvent 131 257 0 0 0 0 0\n"
                        "RenderEvent 131 257 0 0 0 0 0\n"
                        "MouseMoveEvent 131 256 0 0 0 0 0\n"
                        "RenderEvent 131 256 0 0 0 0 0\n"
                        "MouseMoveEvent 132 256 0 0 0 0 0\n"
                        "RenderEvent 132 256 0 0 0 0 0\n"
                        "MouseMoveEvent 134 254 0 0 0 0 0\n"
                        "RenderEvent 134 254 0 0 0 0 0\n"
                        "MouseMoveEvent 138 250 0 0 0 0 0\n"
                        "RenderEvent 138 250 0 0 0 0 0\n"
                        "MouseMoveEvent 145 246 0 0 0 0 0\n"
                        "RenderEvent 145 246 0 0 0 0 0\n"
                        "MouseMoveEvent 154 244 0 0 0 0 0\n"
                        "RenderEvent 154 244 0 0 0 0 0\n"
                        "MouseMoveEvent 160 244 0 0 0 0 0\n"
                        "RenderEvent 160 244 0 0 0 0 0\n"
                        "MouseMoveEvent 162 244 0 0 0 0 0\n"
                        "RenderEvent 162 244 0 0 0 0 0\n"
                        "MouseMoveEvent 163 246 0 0 0 0 0\n"
                        "RenderEvent 163 246 0 0 0 0 0\n"
                        "MouseMoveEvent 164 248 0 0 0 0 0\n"
                        "RenderEvent 164 248 0 0 0 0 0\n"
                        "MouseMoveEvent 165 249 0 0 0 0 0\n"
                        "RenderEvent 165 249 0 0 0 0 0\n"
                        "MouseMoveEvent 165 250 0 0 0 0 0\n"
                        "RenderEvent 165 250 0 0 0 0 0\n"
                        "MouseMoveEvent 166 251 0 0 0 0 0\n"
                        "RenderEvent 166 251 0 0 0 0 0\n"
                        "MouseMoveEvent 167 253 0 0 0 0 0\n"
                        "RenderEvent 167 253 0 0 0 0 0\n"
                        "MouseMoveEvent 169 256 0 0 0 0 0\n"
                        "RenderEvent 169 256 0 0 0 0 0\n"
                        "MouseMoveEvent 170 259 0 0 0 0 0\n"
                        "RenderEvent 170 259 0 0 0 0 0\n"
                        "MouseMoveEvent 172 262 0 0 0 0 0\n"
                        "RenderEvent 172 262 0 0 0 0 0\n"
                        "MouseMoveEvent 172 263 0 0 0 0 0\n"
                        "RenderEvent 172 263 0 0 0 0 0\n"
                        "MouseMoveEvent 172 265 0 0 0 0 0\n"
                        "RenderEvent 172 265 0 0 0 0 0\n"
                        "MouseMoveEvent 172 265 0 0 0 0 0\n"
                        "RenderEvent 172 265 0 0 0 0 0\n"
                        "MouseMoveEvent 172 266 0 0 0 0 0\n"
                        "RenderEvent 172 266 0 0 0 0 0\n"
                        "MouseMoveEvent 172 267 0 0 0 0 0\n"
                        "RenderEvent 172 267 0 0 0 0 0\n"
                        "MouseMoveEvent 173 266 0 0 0 0 0\n"
                        "RenderEvent 173 266 0 0 0 0 0\n"
                        "MouseMoveEvent 173 266 0 0 0 0 0\n"
                        "RenderEvent 173 266 0 0 0 0 0\n"
                        "MouseMoveEvent 173 265 0 0 0 0 0\n"
                        "RenderEvent 173 265 0 0 0 0 0\n"
                        "MouseMoveEvent 174 264 0 0 0 0 0\n"
                        "RenderEvent 174 264 0 0 0 0 0\n"
                        "MouseMoveEvent 174 262 0 0 0 0 0\n"
                        "RenderEvent 174 262 0 0 0 0 0\n"
                        "MouseMoveEvent 174 261 0 0 0 0 0\n"
                        "RenderEvent 174 261 0 0 0 0 0\n"
                        "LeftButtonPressEvent 174 261 0 0 0 0 0\n"
                        "RenderEvent 174 261 0 0 0 0 0\n"
                        "MouseMoveEvent 174 261 0 0 0 0 0\n"
                        "RenderEvent 174 261 0 0 0 0 0\n"
                        "MouseMoveEvent 176 258 0 0 0 0 0\n"
                        "RenderEvent 176 258 0 0 0 0 0\n"
                        "MouseMoveEvent 179 256 0 0 0 0 0\n"
                        "RenderEvent 179 256 0 0 0 0 0\n"
                        "MouseMoveEvent 181 254 0 0 0 0 0\n"
                        "RenderEvent 181 254 0 0 0 0 0\n"
                        "MouseMoveEvent 183 252 0 0 0 0 0\n"
                        "RenderEvent 183 252 0 0 0 0 0\n"
                        "MouseMoveEvent 184 251 0 0 0 0 0\n"
                        "RenderEvent 184 251 0 0 0 0 0\n"
                        "MouseMoveEvent 186 249 0 0 0 0 0\n"
                        "RenderEvent 186 249 0 0 0 0 0\n"
                        "MouseMoveEvent 188 248 0 0 0 0 0\n"
                        "RenderEvent 188 248 0 0 0 0 0\n"
                        "MouseMoveEvent 189 246 0 0 0 0 0\n"
                        "RenderEvent 189 246 0 0 0 0 0\n"
                        "MouseMoveEvent 192 243 0 0 0 0 0\n"
                        "RenderEvent 192 243 0 0 0 0 0\n"
                        "MouseMoveEvent 194 241 0 0 0 0 0\n"
                        "RenderEvent 194 241 0 0 0 0 0\n"
                        "MouseMoveEvent 195 240 0 0 0 0 0\n"
                        "RenderEvent 195 240 0 0 0 0 0\n"
                        "MouseMoveEvent 196 239 0 0 0 0 0\n"
                        "RenderEvent 196 239 0 0 0 0 0\n"
                        "MouseMoveEvent 196 240 0 0 0 0 0\n"
                        "RenderEvent 196 240 0 0 0 0 0\n"
                        "MouseMoveEvent 195 242 0 0 0 0 0\n"
                        "RenderEvent 195 242 0 0 0 0 0\n"
                        "LeftButtonReleaseEvent 195 242 0 0 0 0 0\n"
                        "RenderEvent 195 242 0 0 0 0 0\n"
                        "MouseMoveEvent 195 241 0 0 0 0 0\n"
                        "RenderEvent 195 241 0 0 0 0 0\n"
                        "MouseMoveEvent 195 240 0 0 0 0 0\n"
                        "RenderEvent 195 240 0 0 0 0 0\n"
                        "MouseMoveEvent 195 240 0 0 0 0 0\n"
                        "RenderEvent 195 240 0 0 0 0 0\n"
                        "MouseMoveEvent 195 239 0 0 0 0 0\n"
                        "RenderEvent 195 239 0 0 0 0 0\n"
                        "MouseMoveEvent 195 238 0 0 0 0 0\n"
                        "RenderEvent 195 238 0 0 0 0 0\n"
                        "MouseMoveEvent 195 237 0 0 0 0 0\n"
                        "RenderEvent 195 237 0 0 0 0 0\n"
                        "MouseMoveEvent 195 236 0 0 0 0 0\n"
                        "RenderEvent 195 236 0 0 0 0 0\n"
                        "MouseMoveEvent 195 236 0 0 0 0 0\n"
                        "RenderEvent 195 236 0 0 0 0 0\n"
                        "MouseMoveEvent 195 235 0 0 0 0 0\n"
                        "RenderEvent 195 235 0 0 0 0 0\n"
                        "MouseMoveEvent 194 234 0 0 0 0 0\n"
                        "RenderEvent 194 234 0 0 0 0 0\n"
                        "MouseMoveEvent 191 231 0 0 0 0 0\n"
                        "RenderEvent 191 231 0 0 0 0 0\n"
                        "MouseMoveEvent 188 229 0 0 0 0 0\n"
                        "RenderEvent 188 229 0 0 0 0 0\n"
                        "MouseMoveEvent 180 222 0 0 0 0 0\n"
                        "RenderEvent 180 222 0 0 0 0 0\n"
                        "MouseMoveEvent 174 218 0 0 0 0 0\n"
                        "RenderEvent 174 218 0 0 0 0 0\n"
                        "MouseMoveEvent 172 215 0 0 0 0 0\n"
                        "RenderEvent 172 215 0 0 0 0 0\n"
                        "MouseMoveEvent 168 212 0 0 0 0 0\n"
                        "RenderEvent 168 212 0 0 0 0 0\n"
                        "MouseMoveEvent 166 211 0 0 0 0 0\n"
                        "RenderEvent 166 211 0 0 0 0 0\n"
                        "MouseMoveEvent 165 211 0 0 0 0 0\n"
                        "RenderEvent 165 211 0 0 0 0 0\n"
                        "MouseMoveEvent 164 211 0 0 0 0 0\n"
                        "RenderEvent 164 211 0 0 0 0 0\n"
                        "MouseMoveEvent 161 211 0 0 0 0 0\n"
                        "RenderEvent 161 211 0 0 0 0 0\n"
                        "MouseMoveEvent 160 211 0 0 0 0 0\n"
                        "RenderEvent 160 211 0 0 0 0 0\n"
                        "MouseMoveEvent 159 211 0 0 0 0 0\n"
                        "RenderEvent 159 211 0 0 0 0 0\n"
                        "MouseMoveEvent 158 211 0 0 0 0 0\n"
                        "RenderEvent 158 211 0 0 0 0 0\n"
                        "MouseMoveEvent 157 212 0 0 0 0 0\n"
                        "RenderEvent 157 212 0 0 0 0 0\n"
                        "MouseMoveEvent 157 212 0 0 0 0 0\n"
                        "RenderEvent 157 212 0 0 0 0 0\n"
                        "MouseMoveEvent 155 212 0 0 0 0 0\n"
                        "RenderEvent 155 212 0 0 0 0 0\n"
                        "MouseMoveEvent 154 213 0 0 0 0 0\n"
                        "RenderEvent 154 213 0 0 0 0 0\n"
                        "MouseMoveEvent 153 213 0 0 0 0 0\n"
                        "RenderEvent 153 213 0 0 0 0 0\n"
                        "LeftButtonPressEvent 153 213 0 0 0 0 0\n"
                        "RenderEvent 153 213 0 0 0 0 0\n"
                        "MouseMoveEvent 154 213 0 0 0 0 0\n"
                        "RenderEvent 154 213 0 0 0 0 0\n"
                        "MouseMoveEvent 154 213 0 0 0 0 0\n"
                        "RenderEvent 154 213 0 0 0 0 0\n"
                        "MouseMoveEvent 155 213 0 0 0 0 0\n"
                        "RenderEvent 155 213 0 0 0 0 0\n"
                        "MouseMoveEvent 156 213 0 0 0 0 0\n"
                        "RenderEvent 156 213 0 0 0 0 0\n"
                        "MouseMoveEvent 157 213 0 0 0 0 0\n"
                        "RenderEvent 157 213 0 0 0 0 0\n"
                        "MouseMoveEvent 159 213 0 0 0 0 0\n"
                        "RenderEvent 159 213 0 0 0 0 0\n"
                        "MouseMoveEvent 165 213 0 0 0 0 0\n"
                        "RenderEvent 165 213 0 0 0 0 0\n"
                        "MouseMoveEvent 167 213 0 0 0 0 0\n"
                        "RenderEvent 167 213 0 0 0 0 0\n"
                        "MouseMoveEvent 169 213 0 0 0 0 0\n"
                        "RenderEvent 169 213 0 0 0 0 0\n"
                        "MouseMoveEvent 171 213 0 0 0 0 0\n"
                        "RenderEvent 171 213 0 0 0 0 0\n"
                        "MouseMoveEvent 172 213 0 0 0 0 0\n"
                        "RenderEvent 172 213 0 0 0 0 0\n"
                        "MouseMoveEvent 173 213 0 0 0 0 0\n"
                        "RenderEvent 173 213 0 0 0 0 0\n"
                        "MouseMoveEvent 174 213 0 0 0 0 0\n"
                        "RenderEvent 174 213 0 0 0 0 0\n"
                        "MouseMoveEvent 174 213 0 0 0 0 0\n"
                        "RenderEvent 174 213 0 0 0 0 0\n"
                        "MouseMoveEvent 175 213 0 0 0 0 0\n"
                        "RenderEvent 175 213 0 0 0 0 0\n"
                        "MouseMoveEvent 178 210 0 0 0 0 0\n"
                        "RenderEvent 178 210 0 0 0 0 0\n"
                        "MouseMoveEvent 179 209 0 0 0 0 0\n"
                        "RenderEvent 179 209 0 0 0 0 0\n"
                        "MouseMoveEvent 179 208 0 0 0 0 0\n"
                        "RenderEvent 179 208 0 0 0 0 0\n"
                        "MouseMoveEvent 180 207 0 0 0 0 0\n"
                        "RenderEvent 180 207 0 0 0 0 0\n"
                        "MouseMoveEvent 181 206 0 0 0 0 0\n"
                        "RenderEvent 181 206 0 0 0 0 0\n"
                        "MouseMoveEvent 182 205 0 0 0 0 0\n"
                        "RenderEvent 182 205 0 0 0 0 0\n"
                        "MouseMoveEvent 185 202 0 0 0 0 0\n"
                        "RenderEvent 185 202 0 0 0 0 0\n"
                        "MouseMoveEvent 187 201 0 0 0 0 0\n"
                        "RenderEvent 187 201 0 0 0 0 0\n"
                        "MouseMoveEvent 188 200 0 0 0 0 0\n"
                        "RenderEvent 188 200 0 0 0 0 0\n"
                        "MouseMoveEvent 189 198 0 0 0 0 0\n"
                        "RenderEvent 189 198 0 0 0 0 0\n"
                        "MouseMoveEvent 190 196 0 0 0 0 0\n"
                        "RenderEvent 190 196 0 0 0 0 0\n"
                        "MouseMoveEvent 192 195 0 0 0 0 0\n"
                        "RenderEvent 192 195 0 0 0 0 0\n"
                        "MouseMoveEvent 193 195 0 0 0 0 0\n"
                        "RenderEvent 193 195 0 0 0 0 0\n"
                        "MouseMoveEvent 193 195 0 0 0 0 0\n"
                        "RenderEvent 193 195 0 0 0 0 0\n"
                        "MouseMoveEvent 190 196 0 0 0 0 0\n"
                        "RenderEvent 190 196 0 0 0 0 0\n"
                        "MouseMoveEvent 184 197 0 0 0 0 0\n"
                        "RenderEvent 184 197 0 0 0 0 0\n"
                        "MouseMoveEvent 180 197 0 0 0 0 0\n"
                        "RenderEvent 180 197 0 0 0 0 0\n"
                        "MouseMoveEvent 178 197 0 0 0 0 0\n"
                        "RenderEvent 178 197 0 0 0 0 0\n"
                        "MouseMoveEvent 176 197 0 0 0 0 0\n"
                        "RenderEvent 176 197 0 0 0 0 0\n"
                        "MouseMoveEvent 173 198 0 0 0 0 0\n"
                        "RenderEvent 173 198 0 0 0 0 0\n"
                        "MouseMoveEvent 169 198 0 0 0 0 0\n"
                        "RenderEvent 169 198 0 0 0 0 0\n"
                        "MouseMoveEvent 167 199 0 0 0 0 0\n"
                        "RenderEvent 167 199 0 0 0 0 0\n"
                        "MouseMoveEvent 165 200 0 0 0 0 0\n"
                        "RenderEvent 165 200 0 0 0 0 0\n"
                        "MouseMoveEvent 163 200 0 0 0 0 0\n"
                        "RenderEvent 163 200 0 0 0 0 0\n"
                        "MouseMoveEvent 161 200 0 0 0 0 0\n"
                        "RenderEvent 161 200 0 0 0 0 0\n"
                        "MouseMoveEvent 159 201 0 0 0 0 0\n"
                        "RenderEvent 159 201 0 0 0 0 0\n"
                        "MouseMoveEvent 157 202 0 0 0 0 0\n"
                        "RenderEvent 157 202 0 0 0 0 0\n"
                        "MouseMoveEvent 153 202 0 0 0 0 0\n"
                        "RenderEvent 153 202 0 0 0 0 0\n"
                        "MouseMoveEvent 148 203 0 0 0 0 0\n"
                        "RenderEvent 148 203 0 0 0 0 0\n"
                        "MouseMoveEvent 145 203 0 0 0 0 0\n"
                        "RenderEvent 145 203 0 0 0 0 0\n"
                        "MouseMoveEvent 143 203 0 0 0 0 0\n"
                        "RenderEvent 143 203 0 0 0 0 0\n"
                        "MouseMoveEvent 141 203 0 0 0 0 0\n"
                        "RenderEvent 141 203 0 0 0 0 0\n"
                        "MouseMoveEvent 140 203 0 0 0 0 0\n"
                        "RenderEvent 140 203 0 0 0 0 0\n"
                        "MouseMoveEvent 139 203 0 0 0 0 0\n"
                        "RenderEvent 139 203 0 0 0 0 0\n"
                        "MouseMoveEvent 137 203 0 0 0 0 0\n"
                        "RenderEvent 137 203 0 0 0 0 0\n"
                        "MouseMoveEvent 135 203 0 0 0 0 0\n"
                        "RenderEvent 135 203 0 0 0 0 0\n"
                        "MouseMoveEvent 134 204 0 0 0 0 0\n"
                        "RenderEvent 134 204 0 0 0 0 0\n"
                        "MouseMoveEvent 132 204 0 0 0 0 0\n"
                        "RenderEvent 132 204 0 0 0 0 0\n"
                        "MouseMoveEvent 131 204 0 0 0 0 0\n"
                        "RenderEvent 131 204 0 0 0 0 0\n"
                        "MouseMoveEvent 130 204 0 0 0 0 0\n"
                        "RenderEvent 130 204 0 0 0 0 0\n"
                        "MouseMoveEvent 129 204 0 0 0 0 0\n"
                        "RenderEvent 129 204 0 0 0 0 0\n"
                        "MouseMoveEvent 128 204 0 0 0 0 0\n"
                        "RenderEvent 128 204 0 0 0 0 0\n"
                        "MouseMoveEvent 128 205 0 0 0 0 0\n"
                        "RenderEvent 128 205 0 0 0 0 0\n"
                        "MouseMoveEvent 127 205 0 0 0 0 0\n"
                        "RenderEvent 127 205 0 0 0 0 0\n"
                        "MouseMoveEvent 127 205 0 0 0 0 0\n"
                        "RenderEvent 127 205 0 0 0 0 0\n"
                        "MouseMoveEvent 126 205 0 0 0 0 0\n"
                        "RenderEvent 126 205 0 0 0 0 0\n"
                        "MouseMoveEvent 126 205 0 0 0 0 0\n"
                        "RenderEvent 126 205 0 0 0 0 0\n"
                        "MouseMoveEvent 125 205 0 0 0 0 0\n"
                        "RenderEvent 125 205 0 0 0 0 0\n"
                        "MouseMoveEvent 123 205 0 0 0 0 0\n"
                        "RenderEvent 123 205 0 0 0 0 0\n"
                        "MouseMoveEvent 122 204 0 0 0 0 0\n"
                        "RenderEvent 122 204 0 0 0 0 0\n"
                        "MouseMoveEvent 121 204 0 0 0 0 0\n"
                        "RenderEvent 121 204 0 0 0 0 0\n"
                        "MouseMoveEvent 120 204 0 0 0 0 0\n"
                        "RenderEvent 120 204 0 0 0 0 0\n"
                        "LeftButtonReleaseEvent 120 204 0 0 0 0 0\n"
                        "RenderEvent 120 204 0 0 0 0 0\n"
                        "MouseMoveEvent 120 204 0 0 0 0 0\n"
                        "RenderEvent 120 204 0 0 0 0 0\n"
                        "MouseMoveEvent 120 202 0 0 0 0 0\n"
                        "RenderEvent 120 202 0 0 0 0 0\n"
                        "MouseMoveEvent 119 196 0 0 0 0 0\n"
                        "RenderEvent 119 196 0 0 0 0 0\n"
                        "MouseMoveEvent 118 191 0 0 0 0 0\n"
                        "MouseMoveEvent 116 185 0 0 0 0 0\n"
                        "MouseMoveEvent 114 179 0 0 0 0 0\n"
                        "MouseMoveEvent 113 174 0 0 0 0 0\n"
                        "MouseMoveEvent 111 169 0 0 0 0 0\n"
                        "MouseMoveEvent 108 161 0 0 0 0 0\n"
                        "MouseMoveEvent 107 156 0 0 0 0 0\n"
                        "MouseMoveEvent 105 150 0 0 0 0 0\n"
                        "MouseMoveEvent 103 145 0 0 0 0 0\n"
                        "MouseMoveEvent 102 142 0 0 0 0 0\n"
                        "MouseMoveEvent 101 137 0 0 0 0 0\n"
                        "MouseMoveEvent 100 134 0 0 0 0 0\n"
                        "MouseMoveEvent 99 131 0 0 0 0 0\n"
                        "RenderEvent 99 131 0 0 0 0 0\n"
                        "MouseMoveEvent 99 125 0 0 0 0 0\n"
                        "RenderEvent 99 125 0 0 0 0 0\n"
                        "MouseMoveEvent 99 124 0 0 0 0 0\n"
                        "RenderEvent 99 124 0 0 0 0 0\n"
                        "MouseMoveEvent 99 123 0 0 0 0 0\n"
                        "RenderEvent 99 123 0 0 0 0 0\n"
                        "MouseMoveEvent 99 122 0 0 0 0 0\n"
                        "RenderEvent 99 122 0 0 0 0 0\n"
                        "MouseMoveEvent 99 122 0 0 0 0 0\n"
                        "RenderEvent 99 122 0 0 0 0 0\n"
                        "MouseMoveEvent 99 118 0 0 0 0 0\n"
                        "RenderEvent 99 118 0 0 0 0 0\n"
                        "MouseMoveEvent 100 115 0 0 0 0 0\n"
                        "RenderEvent 100 115 0 0 0 0 0\n"
                        "MouseMoveEvent 100 111 0 0 0 0 0\n"
                        "RenderEvent 100 111 0 0 0 0 0\n"
                        "MouseMoveEvent 100 107 0 0 0 0 0\n"
                        "RenderEvent 100 107 0 0 0 0 0\n"
                        "MouseMoveEvent 100 103 0 0 0 0 0\n"
                        "RenderEvent 100 103 0 0 0 0 0\n"
                        "MouseMoveEvent 100 99 0 0 0 0 0\n"
                        "RenderEvent 100 99 0 0 0 0 0\n"
                        "MouseMoveEvent 101 97 0 0 0 0 0\n"
                        "RenderEvent 101 97 0 0 0 0 0\n"
                        "MouseMoveEvent 101 96 0 0 0 0 0\n"
                        "RenderEvent 101 96 0 0 0 0 0\n"
                        "MouseMoveEvent 102 96 0 0 0 0 0\n"
                        "RenderEvent 102 96 0 0 0 0 0\n"
                        "MouseMoveEvent 102 95 0 0 0 0 0\n"
                        "RenderEvent 102 95 0 0 0 0 0\n"
                        "MouseMoveEvent 102 94 0 0 0 0 0\n"
                        "RenderEvent 102 94 0 0 0 0 0\n"
                        "MouseMoveEvent 101 94 0 0 0 0 0\n"
                        "RenderEvent 101 94 0 0 0 0 0\n"
                        "MouseMoveEvent 100 94 0 0 0 0 0\n"
                        "RenderEvent 100 94 0 0 0 0 0\n"
                        "MouseMoveEvent 100 93 0 0 0 0 0\n"
                        "RenderEvent 100 93 0 0 0 0 0\n"
                        "MouseMoveEvent 100 93 0 0 0 0 0\n"
                        "RenderEvent 100 93 0 0 0 0 0\n"
                        "MouseMoveEvent 99 93 0 0 0 0 0\n"
                        "RenderEvent 99 93 0 0 0 0 0\n"
                        "MouseMoveEvent 99 93 0 0 0 0 0\n"
                        "RenderEvent 99 93 0 0 0 0 0\n"
                        "MouseMoveEvent 99 94 0 0 0 0 0\n"
                        "RenderEvent 99 94 0 0 0 0 0\n"
                        "MouseMoveEvent 98 94 0 0 0 0 0\n"
                        "RenderEvent 98 94 0 0 0 0 0\n"
                        "MouseMoveEvent 97 94 0 0 0 0 0\n"
                        "RenderEvent 97 94 0 0 0 0 0\n"
                        "MouseMoveEvent 96 95 0 0 0 0 0\n"
                        "RenderEvent 96 95 0 0 0 0 0\n"
                        "MouseMoveEvent 95 96 0 0 0 0 0\n"
                        "RenderEvent 95 96 0 0 0 0 0\n"
                        "MouseMoveEvent 95 97 0 0 0 0 0\n"
                        "RenderEvent 95 97 0 0 0 0 0\n"
                        "MouseMoveEvent 95 97 0 0 0 0 0\n"
                        "RenderEvent 95 97 0 0 0 0 0\n"
                        "MouseMoveEvent 95 96 0 0 0 0 0\n"
                        "RenderEvent 95 96 0 0 0 0 0\n"
                        "MouseMoveEvent 95 95 0 0 0 0 0\n"
                        "RenderEvent 95 95 0 0 0 0 0\n"
                        "MouseMoveEvent 94 95 0 0 0 0 0\n"
                        "RenderEvent 94 95 0 0 0 0 0\n"
                        "MouseMoveEvent 93 95 0 0 0 0 0\n"
                        "RenderEvent 93 95 0 0 0 0 0\n"
                        "MouseMoveEvent 92 95 0 0 0 0 0\n"
                        "RenderEvent 92 95 0 0 0 0 0\n"
                        "MouseMoveEvent 92 96 0 0 0 0 0\n"
                        "RenderEvent 92 96 0 0 0 0 0\n"
                        "LeftButtonPressEvent 92 96 0 0 0 0 0\n"
                        "RenderEvent 92 96 0 0 0 0 0\n"
                        "MouseMoveEvent 93 96 0 0 0 0 0\n"
                        "RenderEvent 93 96 0 0 0 0 0\n"
                        "MouseMoveEvent 101 95 0 0 0 0 0\n"
                        "RenderEvent 101 95 0 0 0 0 0\n"
                        "MouseMoveEvent 104 95 0 0 0 0 0\n"
                        "RenderEvent 104 95 0 0 0 0 0\n"
                        "MouseMoveEvent 105 95 0 0 0 0 0\n"
                        "RenderEvent 105 95 0 0 0 0 0\n"
                        "MouseMoveEvent 106 95 0 0 0 0 0\n"
                        "RenderEvent 106 95 0 0 0 0 0\n"
                        "MouseMoveEvent 110 95 0 0 0 0 0\n"
                        "RenderEvent 110 95 0 0 0 0 0\n"
                        "MouseMoveEvent 115 96 0 0 0 0 0\n"
                        "RenderEvent 115 96 0 0 0 0 0\n"
                        "MouseMoveEvent 119 97 0 0 0 0 0\n"
                        "RenderEvent 119 97 0 0 0 0 0\n"
                        "MouseMoveEvent 122 98 0 0 0 0 0\n"
                        "RenderEvent 122 98 0 0 0 0 0\n"
                        "MouseMoveEvent 123 98 0 0 0 0 0\n"
                        "RenderEvent 123 98 0 0 0 0 0\n"
                        "MouseMoveEvent 124 98 0 0 0 0 0\n"
                        "RenderEvent 124 98 0 0 0 0 0\n"
                        "MouseMoveEvent 125 98 0 0 0 0 0\n"
                        "RenderEvent 125 98 0 0 0 0 0\n"
                        "MouseMoveEvent 126 98 0 0 0 0 0\n"
                        "RenderEvent 126 98 0 0 0 0 0\n"
                        "MouseMoveEvent 128 98 0 0 0 0 0\n"
                        "RenderEvent 128 98 0 0 0 0 0\n"
                        "MouseMoveEvent 130 98 0 0 0 0 0\n"
                        "RenderEvent 130 98 0 0 0 0 0\n"
                        "MouseMoveEvent 132 98 0 0 0 0 0\n"
                        "RenderEvent 132 98 0 0 0 0 0\n"
                        "MouseMoveEvent 134 97 0 0 0 0 0\n"
                        "RenderEvent 134 97 0 0 0 0 0\n"
                        "MouseMoveEvent 138 96 0 0 0 0 0\n"
                        "RenderEvent 138 96 0 0 0 0 0\n"
                        "MouseMoveEvent 140 95 0 0 0 0 0\n"
                        "RenderEvent 140 95 0 0 0 0 0\n"
                        "MouseMoveEvent 141 95 0 0 0 0 0\n"
                        "RenderEvent 141 95 0 0 0 0 0\n"
                        "MouseMoveEvent 143 94 0 0 0 0 0\n"
                        "RenderEvent 143 94 0 0 0 0 0\n"
                        "MouseMoveEvent 145 94 0 0 0 0 0\n"
                        "RenderEvent 145 94 0 0 0 0 0\n"
                        "MouseMoveEvent 146 94 0 0 0 0 0\n"
                        "RenderEvent 146 94 0 0 0 0 0\n"
                        "MouseMoveEvent 146 93 0 0 0 0 0\n"
                        "RenderEvent 146 93 0 0 0 0 0\n"
                        "MouseMoveEvent 147 93 0 0 0 0 0\n"
                        "RenderEvent 147 93 0 0 0 0 0\n"
                        "MouseMoveEvent 147 92 0 0 0 0 0\n"
                        "RenderEvent 147 92 0 0 0 0 0\n"
                        "MouseMoveEvent 148 92 0 0 0 0 0\n"
                        "RenderEvent 148 92 0 0 0 0 0\n"
                        "MouseMoveEvent 147 92 0 0 0 0 0\n"
                        "RenderEvent 147 92 0 0 0 0 0\n"
                        "MouseMoveEvent 147 92 0 0 0 0 0\n"
                        "RenderEvent 147 92 0 0 0 0 0\n"
                        "MouseMoveEvent 146 92 0 0 0 0 0\n"
                        "RenderEvent 146 92 0 0 0 0 0\n"
                        "MouseMoveEvent 145 92 0 0 0 0 0\n"
                        "RenderEvent 145 92 0 0 0 0 0\n"
                        "MouseMoveEvent 144 92 0 0 0 0 0\n"
                        "RenderEvent 144 92 0 0 0 0 0\n"
                        "MouseMoveEvent 145 92 0 0 0 0 0\n"
                        "RenderEvent 145 92 0 0 0 0 0\n"
                        "MouseMoveEvent 147 92 0 0 0 0 0\n"
                        "RenderEvent 147 92 0 0 0 0 0\n"
                        "MouseMoveEvent 151 92 0 0 0 0 0\n"
                        "RenderEvent 151 92 0 0 0 0 0\n"
                        "MouseMoveEvent 153 92 0 0 0 0 0\n"
                        "RenderEvent 153 92 0 0 0 0 0\n"
                        "MouseMoveEvent 155 92 0 0 0 0 0\n"
                        "RenderEvent 155 92 0 0 0 0 0\n"
                        "MouseMoveEvent 156 92 0 0 0 0 0\n"
                        "RenderEvent 156 92 0 0 0 0 0\n"
                        "MouseMoveEvent 156 92 0 0 0 0 0\n"
                        "RenderEvent 156 92 0 0 0 0 0\n"
                        "MouseMoveEvent 157 92 0 0 0 0 0\n"
                        "RenderEvent 157 92 0 0 0 0 0\n"
                        "MouseMoveEvent 158 92 0 0 0 0 0\n"
                        "RenderEvent 158 92 0 0 0 0 0\n"
                        "MouseMoveEvent 159 92 0 0 0 0 0\n"
                        "RenderEvent 159 92 0 0 0 0 0\n"
                        "MouseMoveEvent 159 91 0 0 0 0 0\n"
                        "RenderEvent 159 91 0 0 0 0 0\n"
                        "MouseMoveEvent 159 91 0 0 0 0 0\n"
                        "RenderEvent 159 91 0 0 0 0 0\n"
                        "MouseMoveEvent 157 91 0 0 0 0 0\n"
                        "RenderEvent 157 91 0 0 0 0 0\n"
                        "MouseMoveEvent 154 91 0 0 0 0 0\n"
                        "RenderEvent 154 91 0 0 0 0 0\n"
                        "MouseMoveEvent 151 91 0 0 0 0 0\n"
                        "RenderEvent 151 91 0 0 0 0 0\n"
                        "MouseMoveEvent 150 91 0 0 0 0 0\n"
                        "RenderEvent 150 91 0 0 0 0 0\n"
                        "MouseMoveEvent 150 91 0 0 0 0 0\n"
                        "RenderEvent 150 91 0 0 0 0 0\n"
                        "MouseMoveEvent 145 91 0 0 0 0 0\n"
                        "RenderEvent 145 91 0 0 0 0 0\n"
                        "MouseMoveEvent 142 92 0 0 0 0 0\n"
                        "RenderEvent 142 92 0 0 0 0 0\n"
                        "MouseMoveEvent 140 92 0 0 0 0 0\n"
                        "RenderEvent 140 92 0 0 0 0 0\n"
                        "MouseMoveEvent 140 93 0 0 0 0 0\n"
                        "RenderEvent 140 93 0 0 0 0 0\n"
                        "MouseMoveEvent 139 93 0 0 0 0 0\n"
                        "RenderEvent 139 93 0 0 0 0 0\n"
                        "MouseMoveEvent 139 93 0 0 0 0 0\n"
                        "RenderEvent 139 93 0 0 0 0 0\n"
                        "MouseMoveEvent 138 93 0 0 0 0 0\n"
                        "RenderEvent 138 93 0 0 0 0 0\n"
                        "MouseMoveEvent 137 93 0 0 0 0 0\n"
                        "RenderEvent 137 93 0 0 0 0 0\n"
                        "MouseMoveEvent 136 93 0 0 0 0 0\n"
                        "RenderEvent 136 93 0 0 0 0 0\n"
                        "MouseMoveEvent 136 93 0 0 0 0 0\n"
                        "RenderEvent 136 93 0 0 0 0 0\n"
                        "MouseMoveEvent 135 93 0 0 0 0 0\n"
                        "RenderEvent 135 93 0 0 0 0 0\n"
                        "MouseMoveEvent 134 93 0 0 0 0 0\n"
                        "RenderEvent 134 93 0 0 0 0 0\n"
                        "LeftButtonReleaseEvent 134 93 0 0 0 0 0\n"
                        "RenderEvent 134 93 0 0 0 0 0\n"
                        "MouseMoveEvent 134 93 0 0 0 0 0\n"
                        "RenderEvent 134 93 0 0 0 0 0\n"
                        "MouseMoveEvent 134 93 0 0 0 0 0\n"
                        "MouseMoveEvent 136 93 0 0 0 0 0\n"
                        "MouseMoveEvent 140 93 0 0 0 0 0\n"
                        "RenderEvent 140 93 0 0 0 0 0\n"
                        "MouseMoveEvent 148 93 0 0 0 0 0\n"
                        "RenderEvent 148 93 0 0 0 0 0\n"
                        "MouseMoveEvent 153 94 0 0 0 0 0\n"
                        "RenderEvent 153 94 0 0 0 0 0\n"
                        "MouseMoveEvent 157 94 0 0 0 0 0\n"
                        "RenderEvent 157 94 0 0 0 0 0\n"
                        "MouseMoveEvent 159 95 0 0 0 0 0\n"
                        "RenderEvent 159 95 0 0 0 0 0\n"
                        "MouseMoveEvent 160 95 0 0 0 0 0\n"
                        "RenderEvent 160 95 0 0 0 0 0\n"
                        "MouseMoveEvent 160 96 0 0 0 0 0\n"
                        "RenderEvent 160 96 0 0 0 0 0\n"
                        "MouseMoveEvent 161 97 0 0 0 0 0\n"
                        "RenderEvent 161 97 0 0 0 0 0\n"
                        "MouseMoveEvent 161 98 0 0 0 0 0\n"
                        "RenderEvent 161 98 0 0 0 0 0\n"
                        "MouseMoveEvent 161 99 0 0 0 0 0\n"
                        "RenderEvent 161 99 0 0 0 0 0\n"
                        "MouseMoveEvent 161 99 0 0 0 0 0\n"
                        "RenderEvent 161 99 0 0 0 0 0\n"
                        "MouseMoveEvent 161 100 0 0 0 0 0\n"
                        "RenderEvent 161 100 0 0 0 0 0\n"
                        "MouseMoveEvent 161 101 0 0 0 0 0\n"
                        "RenderEvent 161 101 0 0 0 0 0\n"
                        "MouseMoveEvent 161 101 0 0 0 0 0\n"
                        "RenderEvent 161 101 0 0 0 0 0\n"
                        "MouseMoveEvent 161 102 0 0 0 0 0\n"
                        "RenderEvent 161 102 0 0 0 0 0\n"
                        "MouseMoveEvent 161 103 0 0 0 0 0\n"
                        "RenderEvent 161 103 0 0 0 0 0\n"
                        "MouseMoveEvent 160 103 0 0 0 0 0\n"
                        "RenderEvent 160 103 0 0 0 0 0\n"
                        "MouseMoveEvent 160 104 0 0 0 0 0\n"
                        "RenderEvent 160 104 0 0 0 0 0\n"
                        "LeftButtonPressEvent 160 104 0 0 0 0 0\n"
                        "RenderEvent 160 104 0 0 0 0 0\n"
                        "MouseMoveEvent 161 104 0 0 0 0 0\n"
                        "RenderEvent 161 104 0 0 0 0 0\n"
                        "MouseMoveEvent 161 104 0 0 0 0 0\n"
                        "RenderEvent 161 104 0 0 0 0 0\n"
                        "MouseMoveEvent 161 105 0 0 0 0 0\n"
                        "RenderEvent 161 105 0 0 0 0 0\n"
                        "MouseMoveEvent 163 107 0 0 0 0 0\n"
                        "RenderEvent 163 107 0 0 0 0 0\n"
                        "MouseMoveEvent 165 109 0 0 0 0 0\n"
                        "RenderEvent 165 109 0 0 0 0 0\n"
                        "MouseMoveEvent 166 110 0 0 0 0 0\n"
                        "RenderEvent 166 110 0 0 0 0 0\n"
                        "MouseMoveEvent 167 110 0 0 0 0 0\n"
                        "RenderEvent 167 110 0 0 0 0 0\n"
                        "MouseMoveEvent 168 111 0 0 0 0 0\n"
                        "RenderEvent 168 111 0 0 0 0 0\n"
                        "MouseMoveEvent 169 112 0 0 0 0 0\n"
                        "RenderEvent 169 112 0 0 0 0 0\n"
                        "MouseMoveEvent 171 113 0 0 0 0 0\n"
                        "RenderEvent 171 113 0 0 0 0 0\n"
                        "MouseMoveEvent 178 115 0 0 0 0 0\n"
                        "RenderEvent 178 115 0 0 0 0 0\n"
                        "MouseMoveEvent 183 116 0 0 0 0 0\n"
                        "RenderEvent 183 116 0 0 0 0 0\n"
                        "MouseMoveEvent 187 118 0 0 0 0 0\n"
                        "RenderEvent 187 118 0 0 0 0 0\n"
                        "MouseMoveEvent 188 120 0 0 0 0 0\n"
                        "RenderEvent 188 120 0 0 0 0 0\n"
                        "MouseMoveEvent 189 121 0 0 0 0 0\n"
                        "RenderEvent 189 121 0 0 0 0 0\n"
                        "MouseMoveEvent 190 122 0 0 0 0 0\n"
                        "RenderEvent 190 122 0 0 0 0 0\n"
                        "MouseMoveEvent 190 122 0 0 0 0 0\n"
                        "RenderEvent 190 122 0 0 0 0 0\n"
                        "MouseMoveEvent 190 123 0 0 0 0 0\n"
                        "RenderEvent 190 123 0 0 0 0 0\n"
                        "MouseMoveEvent 191 124 0 0 0 0 0\n"
                        "RenderEvent 191 124 0 0 0 0 0\n"
                        "MouseMoveEvent 191 125 0 0 0 0 0\n"
                        "RenderEvent 191 125 0 0 0 0 0\n"
                        "MouseMoveEvent 192 125 0 0 0 0 0\n"
                        "RenderEvent 192 125 0 0 0 0 0\n"
                        "MouseMoveEvent 192 126 0 0 0 0 0\n"
                        "RenderEvent 192 126 0 0 0 0 0\n"
                        "MouseMoveEvent 192 127 0 0 0 0 0\n"
                        "RenderEvent 192 127 0 0 0 0 0\n"
                        "MouseMoveEvent 193 128 0 0 0 0 0\n"
                        "RenderEvent 193 128 0 0 0 0 0\n"
                        "MouseMoveEvent 194 128 0 0 0 0 0\n"
                        "RenderEvent 194 128 0 0 0 0 0\n"
                        "MouseMoveEvent 194 128 0 0 0 0 0\n"
                        "RenderEvent 194 128 0 0 0 0 0\n"
                        "MouseMoveEvent 194 128 0 0 0 0 0\n"
                        "RenderEvent 194 128 0 0 0 0 0\n"
                        "MouseMoveEvent 195 128 0 0 0 0 0\n"
                        "RenderEvent 195 128 0 0 0 0 0\n"
                        "MouseMoveEvent 195 129 0 0 0 0 0\n"
                        "RenderEvent 195 129 0 0 0 0 0\n"
                        "MouseMoveEvent 196 129 0 0 0 0 0\n"
                        "RenderEvent 196 129 0 0 0 0 0\n"
                        "MouseMoveEvent 196 129 0 0 0 0 0\n"
                        "RenderEvent 196 129 0 0 0 0 0\n"
                        "MouseMoveEvent 196 130 0 0 0 0 0\n"
                        "RenderEvent 196 130 0 0 0 0 0\n"
                        "MouseMoveEvent 197 130 0 0 0 0 0\n"
                        "RenderEvent 197 130 0 0 0 0 0\n"
                        "LeftButtonReleaseEvent 197 130 0 0 0 0 0\n"
                        "RenderEvent 197 130 0 0 0 0 0\n";

// This does the actual work: updates the vtkFrustum implicit function.
// This in turn causes the pipeline to update and clip the object.
// Callback for the interaction
class vtkTICWCallback : public vtkCommand
{
public:
  static vtkTICWCallback* New() { return new vtkTICWCallback; }

  void Execute(vtkObject* caller, unsigned long, void*) override
  {
    vtkImplicitFrustumWidget* frustumWidget = reinterpret_cast<vtkImplicitFrustumWidget*>(caller);
    vtkImplicitFrustumRepresentation* rep =
      reinterpret_cast<vtkImplicitFrustumRepresentation*>(frustumWidget->GetRepresentation());
    rep->GetFrustum(this->Frustum);
    this->Actor->VisibilityOn();
  }

  vtkFrustum* Frustum = nullptr;
  vtkActor* Actor = nullptr;
};

} // anonymous namespace

int TestImplicitFrustumWidget(int vtkNotUsed(argc), char* vtkNotUsed(argv)[])
{
  // Create a mace out of filters.
  vtkNew<vtkSphereSource> sphere;
  vtkNew<vtkConeSource> coneSource;
  vtkNew<vtkGlyph3D> glyph;
  glyph->SetInputConnection(sphere->GetOutputPort());
  glyph->SetSourceConnection(coneSource->GetOutputPort());
  glyph->SetVectorModeToUseNormal();
  glyph->SetScaleModeToScaleByVector();
  glyph->SetScaleFactor(0.25);
  glyph->Update();

  // The sphere and spikes are appended into a single polydata.
  // This just makes things simpler to manage.
  vtkNew<vtkAppendPolyData> apd;
  apd->AddInputConnection(glyph->GetOutputPort());
  apd->AddInputConnection(sphere->GetOutputPort());

  vtkNew<vtkPolyDataMapper> maceMapper;
  maceMapper->SetInputConnection(apd->GetOutputPort());

  vtkNew<vtkActor> maceActor;
  maceActor->SetMapper(maceMapper);
  maceActor->VisibilityOn();

  // This portion of the code clips the mace with the vtkFrustums
  // implicit function. The clipped region is colored green.
  vtkNew<vtkFrustum> frustum;

  vtkNew<vtkClipPolyData> clipper;
  clipper->SetInputConnection(apd->GetOutputPort());
  clipper->SetClipFunction(frustum);
  clipper->InsideOutOn();

  vtkNew<vtkPolyDataMapper> selectMapper;
  selectMapper->SetInputConnection(clipper->GetOutputPort());

  vtkNew<vtkActor> selectActor;
  selectActor->SetMapper(selectMapper);
  selectActor->GetProperty()->SetColor(0, 1, 0);
  selectActor->VisibilityOff();
  selectActor->SetScale(1.01, 1.01, 1.01);

  // Create the RenderWindow, Renderer and both Actors
  vtkNew<vtkRenderer> renderer;
  renderer->AddActor(maceActor);
  renderer->AddActor(selectActor);
  renderer->SetBackground(0.1, 0.2, 0.4);

  vtkNew<vtkRenderWindow> renWin;
  renWin->SetMultiSamples(0);
  renWin->SetSize(300, 300);
  renWin->AddRenderer(renderer);

  vtkNew<vtkRenderWindowInteractor> interactor;
  renWin->SetInteractor(interactor);

  renWin->Render();
  renderer->ResetCamera();

  // The SetInteractor method is how 3D widgets are associated with the render
  // window interactor. Internally, SetInteractor sets up a bunch of callbacks
  // using the Command/Observer mechanism (AddObserver()).
  vtkNew<vtkTICWCallback> myCallback;
  myCallback->Frustum = frustum;
  myCallback->Actor = selectActor;

  vtkNew<vtkImplicitFrustumRepresentation> rep;
  rep->SetPlaceFactor(1.25);
  rep->PlaceWidget(glyph->GetOutput()->GetBounds());
  // position origin outside of displayed geometry, for easier interactions
  rep->SetOrigin(-0.8, -0.8, 0);
  rep->SetOrientation(0, 0, -45);

  vtkNew<vtkImplicitFrustumWidget> frustumWidget;
  frustumWidget->SetInteractor(interactor);
  frustumWidget->SetRepresentation(rep);
  frustumWidget->AddObserver(vtkCommand::InteractionEvent, myCallback);
  frustumWidget->SetEnabled(true);

  vtkNew<vtkInteractorEventRecorder> recorder;
  recorder->SetInteractor(interactor);

#if 0 // change to 1 if recording
  recorder->SetFileName("./record.log");
  recorder->Record();

  interactor->Initialize();
  recorder->On();

  interactor->Start();
  recorder->Stop();

#else
  recorder->ReadFromInputStringOn();
  recorder->SetInputString(eventLog);

  // render the image
  interactor->Initialize();
  renWin->Render();
  // uncomment to see cursor
  // recorder->ShowCursorOn();
  recorder->Play();

  // Remove the observers so we can go interactive. Without this the "-I"
  // testing option fails.
  recorder->Off();

  interactor->Start();
#endif

  return EXIT_SUCCESS;
}
