// Path: src/org/jbookreader/ui/swing/actions/PageDownAction.java
// @SuppressWarnings("serial")
// public class PageDownAction extends AbstractAction {
// 	
// 	private PageDownAction() {
// 		putValue(NAME, Messages.getString("PageDownAction.Name")); //$NON-NLS-1$
// 		putValue(MNEMONIC_KEY, Messages.getString("PageDownAction.Mnemonic")); //$NON-NLS-1$
// 		putValue(SHORT_DESCRIPTION, Messages.getString("PageDownAction.Description")); //$NON-NLS-1$
// 	}
// 
// 	private static Action ourAction;
// 
// 	/**
// 	 * Returns the instance of this action type.
// 	 * @return the instance of this action type.
// 	 */
// 	public static Action getAction() {
// 		if (ourAction == null) {
// 			ourAction = new PageDownAction();
// 		}
// 
// 		return ourAction;
// 	}
// 
// 	public void actionPerformed(ActionEvent e) {
// 		MainWindow.getMainWindow().getBookComponent().scrollPageDown();
// 	}
// 
// }
// 
// Path: src/org/jbookreader/ui/swing/actions/PageUpAction.java
// @SuppressWarnings("serial")
// public class PageUpAction extends AbstractAction {
// 	
// 	private PageUpAction() {
// 		putValue(NAME, Messages.getString("PageUpAction.Name")); //$NON-NLS-1$
// 		putValue(MNEMONIC_KEY, Messages.getString("PageUpAction.Mnemonic")); //$NON-NLS-1$
// 		putValue(SHORT_DESCRIPTION, Messages.getString("PageUpAction.Description")); //$NON-NLS-1$
// 	}
// 
// 	private static Action ourAction;
// 
// 	/**
// 	 * Returns the instance of this action type.
// 	 * @return the instance of this action type.
// 	 */
// 	public static Action getAction() {
// 		if (ourAction == null) {
// 			ourAction = new PageUpAction();
// 		}
// 
// 		return ourAction;
// 	}
// 
// 	public void actionPerformed(ActionEvent e) {
// 		MainWindow.getMainWindow().getBookComponent().scrollPageUp();
// 	}
// 
// }
// 
// Path: src/org/jbookreader/ui/swing/actions/ScrollDownAction.java
// @SuppressWarnings("serial") 
// public class ScrollDownAction extends AbstractAction {
// 	
// 	private ScrollDownAction() {
// 		putValue(NAME, Messages.getString("ScrollDownAction.Name")); //$NON-NLS-1$
// 		putValue(SHORT_DESCRIPTION, Messages.getString("ScrollDownAction.Description")); //$NON-NLS-1$
// 	}
// 	
// 	private static Action ourAction;
// 
// 	/**
// 	 * Returns the instance of this action type.
// 	 * @return the instance of this action type.
// 	 */
// 	public static Action getAction() {
// 		if (ourAction == null) {
// 			ourAction = new ScrollDownAction();
// 		}
// 
// 		return ourAction;
// 	}
// 
// 	public void actionPerformed(ActionEvent e) {
// 		// XXX: change to system property
// 		MainWindow.getMainWindow().getBookComponent().scrollDown(12);
// 	}
// 
// }
// 
// Path: src/org/jbookreader/ui/swing/actions/ScrollUpAction.java
// @SuppressWarnings("serial") 
// public class ScrollUpAction extends AbstractAction {
// 	
// 	private ScrollUpAction() {
// 		putValue(NAME, Messages.getString("ScrollUpAction.Name")); //$NON-NLS-1$
// 		putValue(SHORT_DESCRIPTION, Messages.getString("ScrollUpAction.Description")); //$NON-NLS-1$
// 	}
// 
// 	private static Action ourAction;
// 
// 	/**
// 	 * Returns the instance of this action type.
// 	 * @return the instance of this action type.
// 	 */
// 	public static Action getAction() {
// 		if (ourAction == null) {
// 			ourAction = new ScrollUpAction();
// 		}
// 
// 		return ourAction;
// 	}
// 
// 	public void actionPerformed(ActionEvent e) {
// 		// XXX: change to system property
// 		MainWindow.getMainWindow().getBookComponent().scrollUp(12);
// 	}
// 
// }


import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;
import org.jbookreader.ui.swing.actions.PageDownAction;
import org.jbookreader.ui.swing.actions.PageUpAction;
import org.jbookreader.ui.swing.actions.ScrollDownAction;
import org.jbookreader.ui.swing.actions.ScrollUpAction;
/*
 * JBookReader - Java FictionBook Reader
 * Copyright (C) 2006 Dmitry Baryshkov
 *
 *   This program 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 2 of the License, or
 *   (at your option) any later version.
 *   
 *   This program 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 this program; if not, write to the Free Software
 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
/**
 * 
 */
package org.jbookreader.ui.swing;



class MainWindowMouseWheelListener implements MouseWheelListener {
	public void mouseWheelMoved(MouseWheelEvent e) {
		if (e.getScrollType() == MouseWheelEvent.WHEEL_BLOCK_SCROLL) {
//			System.out.println("block scroll " + e.getWheelRotation());
			if (e.getWheelRotation() > 0) {
				PageUpAction.getAction().actionPerformed(null); // FIXME: provide cleaner way to do this!;
			} else {
				PageDownAction.getAction().actionPerformed(null); // FIXME: provide cleaner way to do this!;
			}
		} else {
// Path: src/org/jbookreader/ui/swing/actions/PageDownAction.java
// @SuppressWarnings("serial")
// public class PageDownAction extends AbstractAction {
// 	
// 	private PageDownAction() {
// 		putValue(NAME, Messages.getString("PageDownAction.Name")); //$NON-NLS-1$
// 		putValue(MNEMONIC_KEY, Messages.getString("PageDownAction.Mnemonic")); //$NON-NLS-1$
// 		putValue(SHORT_DESCRIPTION, Messages.getString("PageDownAction.Description")); //$NON-NLS-1$
// 	}
// 
// 	private static Action ourAction;
// 
// 	/**
// 	 * Returns the instance of this action type.
// 	 * @return the instance of this action type.
// 	 */
// 	public static Action getAction() {
// 		if (ourAction == null) {
// 			ourAction = new PageDownAction();
// 		}
// 
// 		return ourAction;
// 	}
// 
// 	public void actionPerformed(ActionEvent e) {
// 		MainWindow.getMainWindow().getBookComponent().scrollPageDown();
// 	}
// 
// }
// 
// Path: src/org/jbookreader/ui/swing/actions/PageUpAction.java
// @SuppressWarnings("serial")
// public class PageUpAction extends AbstractAction {
// 	
// 	private PageUpAction() {
// 		putValue(NAME, Messages.getString("PageUpAction.Name")); //$NON-NLS-1$
// 		putValue(MNEMONIC_KEY, Messages.getString("PageUpAction.Mnemonic")); //$NON-NLS-1$
// 		putValue(SHORT_DESCRIPTION, Messages.getString("PageUpAction.Description")); //$NON-NLS-1$
// 	}
// 
// 	private static Action ourAction;
// 
// 	/**
// 	 * Returns the instance of this action type.
// 	 * @return the instance of this action type.
// 	 */
// 	public static Action getAction() {
// 		if (ourAction == null) {
// 			ourAction = new PageUpAction();
// 		}
// 
// 		return ourAction;
// 	}
// 
// 	public void actionPerformed(ActionEvent e) {
// 		MainWindow.getMainWindow().getBookComponent().scrollPageUp();
// 	}
// 
// }
// 
// Path: src/org/jbookreader/ui/swing/actions/ScrollDownAction.java
// @SuppressWarnings("serial") 
// public class ScrollDownAction extends AbstractAction {
// 	
// 	private ScrollDownAction() {
// 		putValue(NAME, Messages.getString("ScrollDownAction.Name")); //$NON-NLS-1$
// 		putValue(SHORT_DESCRIPTION, Messages.getString("ScrollDownAction.Description")); //$NON-NLS-1$
// 	}
// 	
// 	private static Action ourAction;
// 
// 	/**
// 	 * Returns the instance of this action type.
// 	 * @return the instance of this action type.
// 	 */
// 	public static Action getAction() {
// 		if (ourAction == null) {
// 			ourAction = new ScrollDownAction();
// 		}
// 
// 		return ourAction;
// 	}
// 
// 	public void actionPerformed(ActionEvent e) {
// 		// XXX: change to system property
// 		MainWindow.getMainWindow().getBookComponent().scrollDown(12);
// 	}
// 
// }
// 
// Path: src/org/jbookreader/ui/swing/actions/ScrollUpAction.java
// @SuppressWarnings("serial") 
// public class ScrollUpAction extends AbstractAction {
// 	
// 	private ScrollUpAction() {
// 		putValue(NAME, Messages.getString("ScrollUpAction.Name")); //$NON-NLS-1$
// 		putValue(SHORT_DESCRIPTION, Messages.getString("ScrollUpAction.Description")); //$NON-NLS-1$
// 	}
// 
// 	private static Action ourAction;
// 
// 	/**
// 	 * Returns the instance of this action type.
// 	 * @return the instance of this action type.
// 	 */
// 	public static Action getAction() {
// 		if (ourAction == null) {
// 			ourAction = new ScrollUpAction();
// 		}
// 
// 		return ourAction;
// 	}
// 
// 	public void actionPerformed(ActionEvent e) {
// 		// XXX: change to system property
// 		MainWindow.getMainWindow().getBookComponent().scrollUp(12);
// 	}
// 
// }


// Path: src/org/jbookreader/ui/swing/MainWindowMouseWheelListener.java
import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;
import org.jbookreader.ui.swing.actions.PageDownAction;
import org.jbookreader.ui.swing.actions.PageUpAction;
import org.jbookreader.ui.swing.actions.ScrollDownAction;
import org.jbookreader.ui.swing.actions.ScrollUpAction;

/*
 * JBookReader - Java FictionBook Reader
 * Copyright (C) 2006 Dmitry Baryshkov
 *
 *   This program 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 2 of the License, or
 *   (at your option) any later version.
 *   
 *   This program 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 this program; if not, write to the Free Software
 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
/**
 * 
 */
package org.jbookreader.ui.swing;



class MainWindowMouseWheelListener implements MouseWheelListener {
	public void mouseWheelMoved(MouseWheelEvent e) {
		if (e.getScrollType() == MouseWheelEvent.WHEEL_BLOCK_SCROLL) {
//			System.out.println("block scroll " + e.getWheelRotation());
			if (e.getWheelRotation() > 0) {
				PageUpAction.getAction().actionPerformed(null); // FIXME: provide cleaner way to do this!;
			} else {
				PageDownAction.getAction().actionPerformed(null); // FIXME: provide cleaner way to do this!;
			}
		} else {
			int units = e.getUnitsToScroll();