/*
 * Copyright 2014-2015 Pawel Pastuszak
 *
 * This file is part of VisEditor.
 *
 * VisEditor is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * VisEditor is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with VisEditor.  If not, see <http://www.gnu.org/licenses/>.
 */

package com.kotcrab.vis.editor.ui.scene;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.InputListener;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.kotcrab.vis.editor.Editor;
import com.kotcrab.vis.editor.module.scene.SceneModuleContainer;
import com.kotcrab.vis.ui.widget.VisTextField;

public class SceneInputListener extends InputListener {
	private Table target;
	private SceneModuleContainer sceneMC;

	public SceneInputListener (Table focusTarget, SceneModuleContainer sceneMC) {
		this.target = focusTarget;
		this.sceneMC = sceneMC;
	}

	@Override
	public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {

		//we don't want to steal text field focus, so if event occurred on it, do not change focus
		if (event.getTarget() instanceof VisTextField == false)
			Editor.instance.getStage().setKeyboardFocus(target);

		Editor.instance.getStage().setScrollFocus(target);

		return sceneMC.touchDown(event, Gdx.input.getX(), Gdx.input.getY(), pointer, button);
	}

	@Override
	public void touchUp (InputEvent event, float x, float y, int pointer, int button) {
		sceneMC.touchUp(event, Gdx.input.getX(), Gdx.input.getY(), pointer, button);
	}

	@Override
	public void touchDragged (InputEvent event, float x, float y, int pointer) {
		sceneMC.touchDragged(event, Gdx.input.getX(), Gdx.input.getY(), pointer);
	}

	@Override
	public boolean mouseMoved (InputEvent event, float x, float y) {
		return sceneMC.mouseMoved(event, Gdx.input.getX(), Gdx.input.getY());
	}

	@Override
	public void enter (InputEvent event, float x, float y, int pointer, Actor fromActor) {
		sceneMC.enter(event, Gdx.input.getX(), Gdx.input.getY(), pointer, fromActor);
	}

	@Override
	public void exit (InputEvent event, float x, float y, int pointer, Actor toActor) {
		sceneMC.exit(event, Gdx.input.getX(), Gdx.input.getY(), pointer, toActor);
	}

	@Override
	public boolean scrolled (InputEvent event, float x, float y, int amount) {
		return sceneMC.scrolled(event, Gdx.input.getX(), Gdx.input.getY(), amount);
	}

	@Override
	public boolean keyDown (InputEvent event, int keycode) {
		return sceneMC.keyDown(event, keycode);
	}

	@Override
	public boolean keyUp (InputEvent event, int keycode) {
		return sceneMC.keyUp(event, keycode);
	}

	@Override
	public boolean keyTyped (InputEvent event, char character) {
		return sceneMC.keyTyped(event, character);
	}
}

@@ -1211,17 +1211,22 @@
 e Table 
-t
+focusT
 arget;%0A%09
@@ -1350,17 +1350,22 @@
 %0A%09%09this.
-t
+focusT
 arget = 
@@ -1703,25 +1703,30 @@
 yboardFocus(
-t
+focusT
 arget);%0A%0A%09%09E
@@ -1766,17 +1766,22 @@
 llFocus(
-t
+focusT
 arget);%0A

Rename variable