// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_ALT = 0x0001;
// 
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_CONTROL = 0x0002;
// 
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_NOREPEAT = 0x4000;
// 
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_SHIFT = 0x0004;
// 
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_WIN = 0x0008;
// 
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_NEXT_TRACK = 0xB0;
// 
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_PLAY_PAUSE = 0xB3;
// 
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_PREV_TRACK = 0xB1;
// 
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_STOP = 0xB2;
// 
// Path: jkeymaster/com/tulskiy/keymaster/common/HotKey.java
// public class HotKey {
//     private KeyStroke keyStroke;
//     private MediaKey mediaKey;
//     private HotKeyListener listener;
// 
//     public HotKey(KeyStroke keyStroke, HotKeyListener listener) {
//         this.keyStroke = keyStroke;
//         this.listener = listener;
//     }
// 
//     public HotKey(MediaKey mediaKey, HotKeyListener listener) {
//         this.mediaKey = mediaKey;
//         this.listener = listener;
//     }
// 
//     public boolean isMedia() {
//         return mediaKey != null;
//     }
//     
//     public KeyStroke getKeyStroke() {
// 		return keyStroke;
// 	}
// 
// 	public void setKeyStroke(KeyStroke keyStroke) {
// 		this.keyStroke = keyStroke;
// 	}
// 
// 	public MediaKey getMediaKey() {
// 		return mediaKey;
// 	}
// 
// 	public void setMediaKey(MediaKey mediaKey) {
// 		this.mediaKey = mediaKey;
// 	}
// 
// 	public HotKeyListener getListener() {
// 		return listener;
// 	}
// 
// 	public void setListener(HotKeyListener listener) {
//     	this.listener = listener;
//     }
// 
//     @Override
//     public String toString() {
//         final StringBuilder sb = new StringBuilder();
//         sb.append("HotKey");
//         if (keyStroke != null)
//             sb.append("{").append(keyStroke.toString().replaceAll("pressed ", ""));
//         if (mediaKey != null)
//             sb.append("{").append(mediaKey);
//         sb.append('}');
//         return sb.toString();
//     }
// }


import static com.tulskiy.keymaster.windows.User32.MOD_ALT;
import static com.tulskiy.keymaster.windows.User32.MOD_CONTROL;
import static com.tulskiy.keymaster.windows.User32.MOD_NOREPEAT;
import static com.tulskiy.keymaster.windows.User32.MOD_SHIFT;
import static com.tulskiy.keymaster.windows.User32.MOD_WIN;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_NEXT_TRACK;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_PLAY_PAUSE;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_PREV_TRACK;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_STOP;
import static java.awt.event.KeyEvent.VK_COMMA;
import static java.awt.event.KeyEvent.VK_DELETE;
import static java.awt.event.KeyEvent.VK_ENTER;
import static java.awt.event.KeyEvent.VK_INSERT;
import static java.awt.event.KeyEvent.VK_MINUS;
import static java.awt.event.KeyEvent.VK_PERIOD;
import static java.awt.event.KeyEvent.VK_PLUS;
import static java.awt.event.KeyEvent.VK_PRINTSCREEN;
import static java.awt.event.KeyEvent.VK_SEMICOLON;
import static java.awt.event.KeyEvent.VK_SLASH;
import java.awt.event.InputEvent;
import java.util.HashMap;
import java.util.Map;
import javax.swing.KeyStroke;
import com.tulskiy.keymaster.common.HotKey;
/*
 * Copyright (c) 2011 Denis Tulskiy
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 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 Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * version 3 along with this work.  If not, see <http://www.gnu.org/licenses/>.
 */

package com.tulskiy.keymaster.windows;





/**
 * Author: Denis Tulskiy
 * Date: 6/20/11
 */
public class KeyMap {
    @SuppressWarnings("serial")
	private static final Map<Integer, Integer> codeExceptions = new HashMap<Integer, Integer>() {{
		put(VK_PRINTSCREEN, 0x2C);
        put(VK_INSERT, 0x2D);
        put(VK_DELETE, 0x2E);
        put(VK_ENTER, 0x0D);
        put(VK_COMMA, 0xBC);
        put(VK_PERIOD, 0xBE);
        put(VK_PLUS, 0xBB);
        put(VK_MINUS, 0xBD);
        put(VK_SLASH, 0xBF);
        put(VK_SEMICOLON, 0xBA);
    }};

    public static int getCode(HotKey hotKey) {
        if (hotKey.isMedia()) {
            int code = 0;
            switch (hotKey.getMediaKey()) {
                case MEDIA_NEXT_TRACK:
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_ALT = 0x0001;
// 
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_CONTROL = 0x0002;
// 
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_NOREPEAT = 0x4000;
// 
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_SHIFT = 0x0004;
// 
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int MOD_WIN = 0x0008;
// 
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_NEXT_TRACK = 0xB0;
// 
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_PLAY_PAUSE = 0xB3;
// 
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_PREV_TRACK = 0xB1;
// 
// Path: jkeymaster/com/tulskiy/keymaster/windows/User32.java
// public static final int VK_MEDIA_STOP = 0xB2;
// 
// Path: jkeymaster/com/tulskiy/keymaster/common/HotKey.java
// public class HotKey {
//     private KeyStroke keyStroke;
//     private MediaKey mediaKey;
//     private HotKeyListener listener;
// 
//     public HotKey(KeyStroke keyStroke, HotKeyListener listener) {
//         this.keyStroke = keyStroke;
//         this.listener = listener;
//     }
// 
//     public HotKey(MediaKey mediaKey, HotKeyListener listener) {
//         this.mediaKey = mediaKey;
//         this.listener = listener;
//     }
// 
//     public boolean isMedia() {
//         return mediaKey != null;
//     }
//     
//     public KeyStroke getKeyStroke() {
// 		return keyStroke;
// 	}
// 
// 	public void setKeyStroke(KeyStroke keyStroke) {
// 		this.keyStroke = keyStroke;
// 	}
// 
// 	public MediaKey getMediaKey() {
// 		return mediaKey;
// 	}
// 
// 	public void setMediaKey(MediaKey mediaKey) {
// 		this.mediaKey = mediaKey;
// 	}
// 
// 	public HotKeyListener getListener() {
// 		return listener;
// 	}
// 
// 	public void setListener(HotKeyListener listener) {
//     	this.listener = listener;
//     }
// 
//     @Override
//     public String toString() {
//         final StringBuilder sb = new StringBuilder();
//         sb.append("HotKey");
//         if (keyStroke != null)
//             sb.append("{").append(keyStroke.toString().replaceAll("pressed ", ""));
//         if (mediaKey != null)
//             sb.append("{").append(mediaKey);
//         sb.append('}');
//         return sb.toString();
//     }
// }


// Path: jkeymaster/com/tulskiy/keymaster/windows/KeyMap.java
import static com.tulskiy.keymaster.windows.User32.MOD_ALT;
import static com.tulskiy.keymaster.windows.User32.MOD_CONTROL;
import static com.tulskiy.keymaster.windows.User32.MOD_NOREPEAT;
import static com.tulskiy.keymaster.windows.User32.MOD_SHIFT;
import static com.tulskiy.keymaster.windows.User32.MOD_WIN;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_NEXT_TRACK;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_PLAY_PAUSE;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_PREV_TRACK;
import static com.tulskiy.keymaster.windows.User32.VK_MEDIA_STOP;
import static java.awt.event.KeyEvent.VK_COMMA;
import static java.awt.event.KeyEvent.VK_DELETE;
import static java.awt.event.KeyEvent.VK_ENTER;
import static java.awt.event.KeyEvent.VK_INSERT;
import static java.awt.event.KeyEvent.VK_MINUS;
import static java.awt.event.KeyEvent.VK_PERIOD;
import static java.awt.event.KeyEvent.VK_PLUS;
import static java.awt.event.KeyEvent.VK_PRINTSCREEN;
import static java.awt.event.KeyEvent.VK_SEMICOLON;
import static java.awt.event.KeyEvent.VK_SLASH;
import java.awt.event.InputEvent;
import java.util.HashMap;
import java.util.Map;
import javax.swing.KeyStroke;
import com.tulskiy.keymaster.common.HotKey;

/*
 * Copyright (c) 2011 Denis Tulskiy
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 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 Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * version 3 along with this work.  If not, see <http://www.gnu.org/licenses/>.
 */

package com.tulskiy.keymaster.windows;





/**
 * Author: Denis Tulskiy
 * Date: 6/20/11
 */
public class KeyMap {
    @SuppressWarnings("serial")
	private static final Map<Integer, Integer> codeExceptions = new HashMap<Integer, Integer>() {{
		put(VK_PRINTSCREEN, 0x2C);
        put(VK_INSERT, 0x2D);
        put(VK_DELETE, 0x2E);
        put(VK_ENTER, 0x0D);
        put(VK_COMMA, 0xBC);
        put(VK_PERIOD, 0xBE);
        put(VK_PLUS, 0xBB);
        put(VK_MINUS, 0xBD);
        put(VK_SLASH, 0xBF);
        put(VK_SEMICOLON, 0xBA);
    }};

    public static int getCode(HotKey hotKey) {
        if (hotKey.isMedia()) {
            int code = 0;
            switch (hotKey.getMediaKey()) {
                case MEDIA_NEXT_TRACK:
                    code = VK_MEDIA_NEXT_TRACK;