import org.tizen.emulator.skin.comm.sock.data.KeyEventData;
import org.tizen.emulator.skin.dbi.KeyMapType;
import org.tizen.emulator.skin.image.GeneralKeyWindowImageRegistry;
-import org.tizen.emulator.skin.image.GeneralKeyWindowImageRegistry.KeyWindowImageName;
+import org.tizen.emulator.skin.image.GeneralKeyWindowImageRegistry.GeneralKeyWindowImageName;
import org.tizen.emulator.skin.layout.SkinPatches;
import org.tizen.emulator.skin.util.SwtUtil;
shell.setImage(parent.getImage());
/* load image for HW key button */
- imageNormal = imageRegistry.getKeyWindowImageData(
- KeyWindowImageName.KEYBUTTON_NORMAL);
- imageHover = imageRegistry.getKeyWindowImageData(
- KeyWindowImageName.KEYBUTTON_HOVER);
- imagePushed = imageRegistry.getKeyWindowImageData(
- KeyWindowImageName.KEYBUTTON_PUSHED);
+ imageNormal = imageRegistry.getGeneralKeyWindowImageData(
+ GeneralKeyWindowImageName.KEYBUTTON_NORMAL);
+ imageHover = imageRegistry.getGeneralKeyWindowImageData(
+ GeneralKeyWindowImageName.KEYBUTTON_HOVER);
+ imagePushed = imageRegistry.getGeneralKeyWindowImageData(
+ GeneralKeyWindowImageName.KEYBUTTON_PUSHED);
/* calculate the key window size */
widthBase = imageNormal.getImageData().width;
Image imagesScrollArrowUp[] = new Image[3];
Image imagesScrollArrowDown[] = new Image[3];
- imagesScrollArrowUp[0] = imageRegistry.getKeyWindowImageData(
- KeyWindowImageName.SCROLL_UPBUTTON_NORMAL);
- imagesScrollArrowUp[1] = imageRegistry.getKeyWindowImageData(
- KeyWindowImageName.SCROLL_UPBUTTON_HOVER);
- imagesScrollArrowUp[2] = imageRegistry.getKeyWindowImageData(
- KeyWindowImageName.SCROLL_UPBUTTON_PUSHED);
+ imagesScrollArrowUp[0] = imageRegistry.getGeneralKeyWindowImageData(
+ GeneralKeyWindowImageName.SCROLL_UPBUTTON_NORMAL);
+ imagesScrollArrowUp[1] = imageRegistry.getGeneralKeyWindowImageData(
+ GeneralKeyWindowImageName.SCROLL_UPBUTTON_HOVER);
+ imagesScrollArrowUp[2] = imageRegistry.getGeneralKeyWindowImageData(
+ GeneralKeyWindowImageName.SCROLL_UPBUTTON_PUSHED);
- imagesScrollArrowDown[0] = imageRegistry.getKeyWindowImageData(
- KeyWindowImageName.SCROLL_DOWNBUTTON_NORMAL);
- imagesScrollArrowDown[1] = imageRegistry.getKeyWindowImageData(
- KeyWindowImageName.SCROLL_DOWNBUTTON_HOVER);
- imagesScrollArrowDown[2] = imageRegistry.getKeyWindowImageData(
- KeyWindowImageName.SCROLL_DOWNBUTTON_PUSHED);
+ imagesScrollArrowDown[0] = imageRegistry.getGeneralKeyWindowImageData(
+ GeneralKeyWindowImageName.SCROLL_DOWNBUTTON_NORMAL);
+ imagesScrollArrowDown[1] = imageRegistry.getGeneralKeyWindowImageData(
+ GeneralKeyWindowImageName.SCROLL_DOWNBUTTON_HOVER);
+ imagesScrollArrowDown[2] = imageRegistry.getGeneralKeyWindowImageData(
+ GeneralKeyWindowImageName.SCROLL_DOWNBUTTON_PUSHED);
CustomScrolledComposite compositeScroll =
new CustomScrolledComposite(shell, SWT.NONE,
imagesScrollArrowUp, imagesScrollArrowDown,
- imageRegistry.getKeyWindowImageData(
- KeyWindowImageName.SCROLL_THUMB),
- imageRegistry.getKeyWindowImageData(
- KeyWindowImageName.SCROLL_SHAFT));
+ imageRegistry.getGeneralKeyWindowImageData(
+ GeneralKeyWindowImageName.SCROLL_THUMB),
+ imageRegistry.getGeneralKeyWindowImageData(
+ GeneralKeyWindowImageName.SCROLL_SHAFT));
compositeScroll.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, true, 1, 1));
Composite compositeBase = new Composite(compositeScroll, SWT.NONE);
shellListener = new ShellListener() {
@Override
public void shellClosed(ShellEvent event) {
- logger.info("Key Window is closed");
+ logger.info("General Key Window is closed");
dispose();
}
/**
+ * Special Key Window
*
- *
- * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (C) 2013 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact:
* GiWoong Kim <giwoong.kim@samsung.com>
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.graphics.Region;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.tizen.emulator.skin.EmulatorSkin;
import org.tizen.emulator.skin.comm.ICommunicator.KeyEventType;
import org.tizen.emulator.skin.dbi.EmulatorUI;
import org.tizen.emulator.skin.exception.JaxbException;
import org.tizen.emulator.skin.image.KeyWindowImageRegistry;
-import org.tizen.emulator.skin.image.KeyWindowImageRegistry.ImageType;
+import org.tizen.emulator.skin.image.KeyWindowImageRegistry.SpecailKeyWindowImageType;
import org.tizen.emulator.skin.layout.HWKey;
-import org.tizen.emulator.skin.layout.SkinPatches;
import org.tizen.emulator.skin.util.IOUtil;
import org.tizen.emulator.skin.util.JaxbUtil;
import org.tizen.emulator.skin.util.SpecialKeyWindowUtil;
import org.tizen.emulator.skin.util.SwtUtil;
public class SpecialKeyWindow extends SkinWindow {
- private static final String PATCH_IMAGES_PATH = "images/key-window/";
private static final String KEYWINDOW_LAYOUT = "keywindow-layout";
private static final String DBI_FILE_NAME = "default.dbi";
private EmulatorSkin skin;
- private SkinPatches frameMaker;
private HWKey currentPressedHWKey;
private int widthBase;
private int heightBase;
-
- private Image imageFrame; /* nine-patch image */
+
private Image keyWindowImage;
private Image keyWindowPressedImage;
private Color colorFrame;
+ private KeyWindowImageRegistry imageRegistry;
private SocketCommunicator communicator;
private ShellListener shellListener;
private boolean isGrabbedShell;
private Point grabPosition;
- public SpecialKeyWindow(EmulatorSkin skin, Shell parent, SocketCommunicator communicator, String path) {
- super(parent, SWT.RIGHT | SWT.CENTER);
+ public SpecialKeyWindow(EmulatorSkin skin, String layoutName) {
+ super(skin.getShell(), SWT.RIGHT | SWT.CENTER);
this.skin = skin;
- this.shell = new Shell(Display.getDefault(),
- SWT.NO_TRIM | SWT.RESIZE | SWT.TOOL);
- this.frameMaker = new SkinPatches(PATCH_IMAGES_PATH);
-
- this.communicator = communicator;
+ this.parent = skin.getShell();
+ if (SwtUtil.isMacPlatform() == false) {
+ this.shell = new Shell(parent,
+ SWT.NO_TRIM | SWT.RESIZE | SWT.TOOL);
+ } else {
+ this.shell = new Shell(parent.getDisplay(),
+ SWT.NO_TRIM | SWT.RESIZE | SWT.TOOL);
+ }
+
+ this.communicator = skin.communicator;
this.grabPosition = new Point(0, 0);
shell.setText(parent.getText());
shell.setImage(parent.getImage());
-
+
/* load dbi file */
String skinPath = skin.skinInfo.getSkinPath();
- String specialKeyWindowPath = skinPath + File.separator + KEYWINDOW_LAYOUT + File.separator + path;
+ String specialKeyWindowPath = skinPath + File.separator + KEYWINDOW_LAYOUT + File.separator + layoutName;
logger.info("special key window path : " + specialKeyWindowPath);
EmulatorUI dbiContents = loadXMLForKeyWindow(specialKeyWindowPath);
/* image init */
- KeyWindowImageRegistry.getInstance().initialize(dbiContents, specialKeyWindowPath);
+ this.imageRegistry = new KeyWindowImageRegistry(shell.getDisplay(), dbiContents, specialKeyWindowPath);
/* get keywindow image */
- keyWindowImage = KeyWindowImageRegistry.getInstance().getSpecialKeyWindowImage(EmulatorConfig.DEFAULT_WINDOW_ROTATION, ImageType.IMG_TYPE_MAIN);
- keyWindowPressedImage = KeyWindowImageRegistry.getInstance().getSpecialKeyWindowImage(EmulatorConfig.DEFAULT_WINDOW_ROTATION, ImageType.IMG_TYPE_PRESSED);
+ keyWindowImage = imageRegistry.getSpecialKeyWindowImage(EmulatorConfig.DEFAULT_WINDOW_ROTATION, SpecailKeyWindowImageType.SPECIAL_IMAGE_TYPE_NORMAL);
+ keyWindowPressedImage = imageRegistry.getSpecialKeyWindowImage(EmulatorConfig.DEFAULT_WINDOW_ROTATION, SpecailKeyWindowImageType.SPECIAL_IMAGE_TYPE_PRESSED);
SpecialKeyWindowUtil.trimShell(shell, keyWindowImage);
SpecialKeyWindowUtil.trimShell(shell, keyWindowPressedImage);
heightBase = keyWindowImage.getImageData().height;
/* make a frame image */
- this.imageFrame = frameMaker.getPatchedImage(
- widthBase,
- heightBase);
this.colorFrame = new Color(shell.getDisplay(), new RGB(38, 38, 38));
shell.setBackground(colorFrame);
-
- trimPatchedShell(shell, imageFrame);
addKeyWindowListener();
return emulatorUI;
}
- public static void trimPatchedShell(Shell shell, Image image) {
- if (null == image) {
- return;
- }
- ImageData imageData = image.getImageData();
-
- int width = imageData.width;
- int height = imageData.height;
-
- Region region = new Region();
- region.add(new Rectangle(0, 0, width, height));
-
- int r = shell.getDisplay().getSystemColor(SWT.COLOR_MAGENTA).getRed();
- int g = shell.getDisplay().getSystemColor(SWT.COLOR_MAGENTA).getGreen();
- int b = shell.getDisplay().getSystemColor(SWT.COLOR_MAGENTA).getBlue();
- int colorKey;
-
- if (SwtUtil.isWindowsPlatform()) {
- colorKey = r << 24 | g << 16 | b << 8;
- } else {
- colorKey = r << 16 | g << 8 | b;
- }
-
- for (int i = 0; i < width; i++) {
- for (int j = 0; j < height; j++) {
- int colorPixel = imageData.getPixel(i, j);
- if (colorPixel == colorKey /* magenta */) {
- region.subtract(i, j, 1, 1);
- }
- }
- }
-
- shell.setRegion(region);
- }
-
private void addKeyWindowListener() {
shellPaintListener = new PaintListener() {
@Override
public void shellClosed(ShellEvent event) {
logger.info("Special Key Window is closed");
- if (skin.pairTag != null) {
- skin.pairTag.setVisible(false);
- }
-
- if (null != shellPaintListener) {
- shell.removePaintListener(shellPaintListener);
- }
-
- if (null != shellListener) {
- shell.removeShellListener(shellListener);
- }
-
- if (null != shellMouseMoveListener) {
- shell.removeMouseMoveListener(shellMouseMoveListener);
- }
-
- if (null != shellMouseListener) {
- shell.removeMouseListener(shellMouseListener);
- }
-
- colorFrame.dispose();
-
- frameMaker.freePatches();
+ dispose();
}
@Override
int width = pressedHWKey.getRegion().width;
int height = pressedHWKey.getRegion().height;
int eventType;
-
+
if (SpecialKeyWindowUtil.isInGeometry(e.x, e.y, x, y, width, height)) {
eventType = MouseEventType.DRAG.value();
} else {
/* rollback a keyPressed image resion */
shell.redraw(x, y, width, height, false);
}
-
+
MouseEventData mouseEventData = new MouseEventData(
MouseButtonType.LEFT.value(), MouseEventType.DRAG.value(), e.x, e.y, e.x, e.y, 0);
communicator.sendToQEMU(SendCommand.SEND_MOUSE_EVENT, mouseEventData, false);
isGrabbedShell = false;
grabPosition.x = grabPosition.y = 0;
HWKey pressedHWKey = currentPressedHWKey;
-
+
if (pressedHWKey != null && pressedHWKey.getKeyCode() != SpecialKeyWindowUtil.UNKNOWN_KEYCODE) {
/* send event */
if (isTouch) {
KeyEventData keyEventData = new KeyEventData(KeyEventType.RELEASED.value(), pressedHWKey.getKeyCode(), 0, 0);
communicator.sendToQEMU(SendCommand.SEND_HARD_KEY_EVENT, keyEventData, false);
}
-
+
currentPressedHWKey = null;
-
+
/* rollback a keyPressed image resion */
shell.redraw(pressedHWKey.getRegion().x, pressedHWKey.getRegion().y,
pressedHWKey.getRegion().width, pressedHWKey.getRegion().height, false);
public void mouseDown(MouseEvent e) {
if (1 == e.button) { /* left button */
logger.info("MouseDown in SpecialKeyWindow : " + e.x + ", " + e.y);
-
+
/* HW key handling */
final HWKey hwKey = SpecialKeyWindowUtil.getHWKey(e.x, e.y, EmulatorConfig.DEFAULT_WINDOW_ROTATION);
if (hwKey == null) {
grabPosition.y = e.y;
return;
}
-
+
if (hwKey.getKeyCode() != SpecialKeyWindowUtil.UNKNOWN_KEYCODE) {
if (hwKey.getTooltip().equalsIgnoreCase("touch")) {
isTouch = true;
KeyEventData keyEventData = new KeyEventData(KeyEventType.PRESSED.value(), hwKey.getKeyCode(), 0, 0);
communicator.sendToQEMU(SendCommand.SEND_HARD_KEY_EVENT, keyEventData, false);
}
-
+
currentPressedHWKey = hwKey;
shell.setToolTipText(null);
-
+
/* draw the HW key region as the cropped keyPressed image area */
if(hwKey.getRegion() != null &&
hwKey.getRegion().width != 0 && hwKey.getRegion().height != 0) {
shell.addMouseListener(shellMouseListener);
}
+
+ private void dispose() {
+ if (skin.pairTag != null) {
+ skin.pairTag.setVisible(false);
+ }
+
+ if (null != shellPaintListener) {
+ shell.removePaintListener(shellPaintListener);
+ }
+
+ if (null != shellListener) {
+ shell.removeShellListener(shellListener);
+ }
+
+ if (null != shellMouseMoveListener) {
+ shell.removeMouseMoveListener(shellMouseMoveListener);
+ }
+
+ if (null != shellMouseListener) {
+ shell.removeMouseListener(shellMouseListener);
+ }
+
+ colorFrame.dispose();
+ imageRegistry.dispose();
+ }
}
private static Logger logger = SkinLogger.getSkinLogger(
GeneralKeyWindowImageRegistry.class).getLogger();
- public enum KeyWindowImageName {
+ public enum GeneralKeyWindowImageName {
KEYBUTTON_NORMAL("keybutton_nml.png"),
KEYBUTTON_HOVER("keybutton_hover.png"),
KEYBUTTON_PUSHED("keybutton_pushed.png"),
private String name;
- private KeyWindowImageName(String name) {
+ private GeneralKeyWindowImageName(String name) {
this.name = name;
}
this.keyWindowImageMap = new HashMap<String, Image>();
}
- public Image getKeyWindowImageData(KeyWindowImageName name) {
+ public Image getGeneralKeyWindowImageData(GeneralKeyWindowImageName name) {
if (keyWindowImageMap.size() == 0) {
/* load all of the images at once */
ClassLoader classLoader = this.getClass().getClassLoader();
InputStream is = null;
String imageName, imagePath;
- KeyWindowImageName[] values = KeyWindowImageName.values();
- for (KeyWindowImageName value : values) {
+ GeneralKeyWindowImageName[] values = GeneralKeyWindowImageName.values();
+ for (GeneralKeyWindowImageName value : values) {
imageName = value.getName();
imagePath = ImageRegistry.IMAGES_FOLDER + "/" +
KEYWINDOW_FOLDER + "/" + imageName;
/**
- * image resources management
+ * Image Resource Management For Special Key Window
*
- * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (C) 2013 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact:
* GiWoong Kim <giwoong.kim@samsung.com>
* YeongKyoon Lee <yeongkyoon.lee@samsung.com>
- * HyunJun Son
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
package org.tizen.emulator.skin.image;
import java.io.File;
-import java.io.InputStream;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.logging.Logger;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.widgets.Display;
-import org.tizen.emulator.skin.config.EmulatorConfig;
import org.tizen.emulator.skin.dbi.EmulatorUI;
import org.tizen.emulator.skin.dbi.ImageListType;
import org.tizen.emulator.skin.dbi.RotationType;
import org.tizen.emulator.skin.dbi.RotationsType;
import org.tizen.emulator.skin.log.SkinLogger;
-import org.tizen.emulator.skin.util.IOUtil;
import org.tizen.emulator.skin.util.KeyWindowRotation;
+import org.tizen.emulator.skin.util.SkinRotation;
/**
*
*/
public class KeyWindowImageRegistry {
- public static final String GENERAL_FOLDER = "emul-general-3btn";
- public static final String ICON_FOLDER = "icons";
- public static final String IMAGES_FOLDER = "images";
- public static final String KEYWINDOW_FOLDER = "key-window";
-
private static Logger logger =
SkinLogger.getSkinLogger(KeyWindowImageRegistry.class).getLogger();
- public enum ImageType {
- IMG_TYPE_MAIN,
- IMG_TYPE_PRESSED
- }
-
- public enum IconName {
- DETAIL_INFO("detail_info.png"),
- ROTATE("rotate.png"),
- SCALE("scale.png"),
- SHELL("shell.png"),
- ADVANCED("advanced.png"),
- CLOSE("close.png"),
- SCREENSHOT("screenshot.png"),
- USB_KEYBOARD("usb_keyboard.png"),
- HOST_KEYBOARD("host_keyboard.png"),
- DIAGNOSIS("diagnosis.png"),
- FORCE_CLOSE("force_close.png"),
- ABOUT("about.png"),
-
- COPY_SCREEN_SHOT("copy_screenshot_dialog.png"),
- REFRESH_SCREEN_SHOT("refresh_screenshot_dialog.png"),
- INCREASE_SCALE("increase_scale.png"),
- DECREASE_SCALE("decrease_scale.png"),
- SAVE_SCREEN_SHOT("save_screenshot_dialog.png"),
-
- EMULATOR_TITLE("emulator_icon.png"),
- EMULATOR_TITLE_ICO("emulator_icon.ico");
-
- private String name;
-
- private IconName(String name) {
- this.name = name;
- }
-
- public String getName() {
- return this.name;
- }
-
- }
-
- public enum KeyWindowImageName {
- KEYBUTTON_NORMAL("keybutton_nml.png"),
- KEYBUTTON_HOVER("keybutton_hover.png"),
- KEYBUTTON_PUSHED("keybutton_pushed.png"),
-
- SCROLL_UPBUTTON_NORMAL("scroll_button_up_nml.png"),
- SCROLL_UPBUTTON_HOVER("scroll_button_up_hover.png"),
- SCROLL_UPBUTTON_PUSHED("scroll_button_up_pushed.png"),
- SCROLL_DOWNBUTTON_NORMAL("scroll_button_down_nml.png"),
- SCROLL_DOWNBUTTON_HOVER("scroll_button_down_hover.png"),
- SCROLL_DOWNBUTTON_PUSHED("scroll_button_down_pushed.png"),
- SCROLL_THUMB("scroll_thumb.png"),
- SCROLL_SHAFT("scroll_back.png");
-
- private String name;
-
- private KeyWindowImageName(String name) {
- this.name = name;
- }
-
- public String getName() {
- return this.name;
- }
+ public enum SpecailKeyWindowImageType {
+ SPECIAL_IMAGE_TYPE_NORMAL,
+ SPECIAL_IMAGE_TYPE_PRESSED
}
private Display display;
+ private String skinPath;
private EmulatorUI dbiContents;
-
- private Map<String, Image> skinImageMap;
- private Map<String, Image> iconMap;
private Map<String, Image> keyWindowImageMap;
- private String skinPath;
-
- private static KeyWindowImageRegistry instance;
- private static boolean isInitialized;
-
- private KeyWindowImageRegistry() {
- /* do nothing */
- }
-
- public static KeyWindowImageRegistry getInstance() {
- if (null == instance) {
- instance = new KeyWindowImageRegistry();
- }
-
- return instance;
- }
-
- public void initialize(EmulatorUI dbiContents, String skinPath) {
- if (isInitialized)
- KeyWindowRotation.clear();
-
- isInitialized = true;
-
- this.display = Display.getDefault();
-
+ /**
+ * Constructor
+ */
+ public KeyWindowImageRegistry(
+ Display display, EmulatorUI dbiContents, String skinPath) {
+ this.display = display;
this.skinPath = skinPath;
this.dbiContents = dbiContents;
- this.skinImageMap = new HashMap<String, Image>();
- this.iconMap = new HashMap<String, Image>();
this.keyWindowImageMap = new HashMap<String, Image>();
- init(this.skinPath);
+ initialize(skinPath);
}
- private void init(String argSkinPath) {
-
+ private void initialize(String argSkinPath) {
RotationsType rotations = dbiContents.getRotations();
if (null == rotations) {
- logger.severe("Fail to loading rotations element from dbi.");
+ logger.severe("Fail to loading rotations element from XML");
return;
}
}
}
- public Image getSpecialKeyWindowImage(Short id, ImageType imageType) {
+ private String makeKey(Short id, SpecailKeyWindowImageType imageType) {
+ return id + ":" + imageType.ordinal();
+ }
- Image image = skinImageMap.get(makeKey(id, imageType));
+ public Image getSpecialKeyWindowImage(Short id, SpecailKeyWindowImageType imageType) {
+ Image image = keyWindowImageMap.get(makeKey(id, imageType));
- if (null != image) {
- return image;
- } else {
+ if (image == null) {
RotationsType rotations = dbiContents.getRotations();
if (null == rotations) {
- logger.severe("Fail to loading rotations element from dbi.");
+ logger.severe("Fail to loading rotations element from XML");
return null;
}
- logger.info("get image data of skin from " + skinPath);
+ logger.info("get skin image from " + skinPath);
- RotationType targetRotation = KeyWindowRotation.getRotation(id);
+ RotationType targetRotation = SkinRotation.getRotation(id);
List<RotationType> rotationList = rotations.getRotation();
for (RotationType rotation : rotationList) {
String keyPressedImage = imageList.getKeyPressedImage();
if (targetRotation.getName().value().equals(rotation.getName().value())) {
- String mainKey = makeKey(id, ImageType.IMG_TYPE_MAIN);
- skinImageMap.put(mainKey,
+ String mainKey = makeKey(id,
+ SpecailKeyWindowImageType.SPECIAL_IMAGE_TYPE_NORMAL);
+ keyWindowImageMap.put(mainKey,
new Image(display, skinPath + File.separator + mainImage));
- String pressedKey = makeKey(id, ImageType.IMG_TYPE_PRESSED);
- skinImageMap.put(pressedKey,
+ String pressedKey = makeKey(id,
+ SpecailKeyWindowImageType.SPECIAL_IMAGE_TYPE_PRESSED);
+ keyWindowImageMap.put(pressedKey,
new Image(display, skinPath + File.separator + keyPressedImage));
break;
}
}
- Image registeredImage = skinImageMap.get(makeKey(id, imageType));
-
- if (null != registeredImage) {
- return registeredImage;
- } else {
- return null;
- }
-
+ image = keyWindowImageMap.get(makeKey(id, imageType));
}
- }
- private String makeKey(Short id, ImageType imageType) {
- return id + ":" + imageType.ordinal();
+ return image;
}
public void dispose() {
- /* skin image */
- if (null != skinImageMap) {
- Collection<Image> images = skinImageMap.values();
+ if (null != keyWindowImageMap) {
+ Image image = null;
+ Collection<Image> images = keyWindowImageMap.values();
Iterator<Image> imageIterator = images.iterator();
while (imageIterator.hasNext()) {
- Image image = imageIterator.next();
- image.dispose();
- }
- }
-
- /* icon */
- if (null != iconMap) {
- Collection<Image> icons = iconMap.values();
-
- Iterator<Image> iconIterator = icons.iterator();
-
- while (iconIterator.hasNext()) {
- Image image = iconIterator.next();
- image.dispose();
- }
- }
-
- /* key window image */
- if (null != keyWindowImageMap) {
- Collection<Image> images = keyWindowImageMap.values();
-
- Iterator<Image> imagesIterator = images.iterator();
-
- while (imagesIterator.hasNext()) {
- Image image = imagesIterator.next();
+ image = imageIterator.next();
image.dispose();
}
}
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;
-import org.tizen.emulator.skin.config.EmulatorConfig;
import org.tizen.emulator.skin.dbi.EmulatorUI;
import org.tizen.emulator.skin.dbi.ImageListType;
import org.tizen.emulator.skin.dbi.RotationType;
/**
* Constructor
*/
- public ProfileSkinImageRegistry(EmulatorConfig config,
- Display display, String skinPath) {
+ public ProfileSkinImageRegistry(
+ Display display, EmulatorUI dbiContents, String skinPath) {
this.display = display;
this.skinPath = skinPath;
- this.dbiContents = config.getDbiContents();
+ this.dbiContents = dbiContents;
this.skinImageMap = new HashMap<String, Image>();
initialize(skinPath);
this.grabPosition = new Point(0, 0);
this.imageRegistry = new ProfileSkinImageRegistry(
- config, shell.getDisplay(), skin.skinInfo.getSkinPath());
+ shell.getDisplay(), config.getDbiContents(), skin.skinInfo.getSkinPath());
}
@Override
skin.getPopupMenu().keyWindowItem.getMenu().getItem(indexLayout).getText();
logger.info("generate a \'" + layoutName + "\' key window!");
- keyWindow = new SpecialKeyWindow(
- skin, skin.getShell(), skin.communicator, layoutName);
+ keyWindow = new SpecialKeyWindow(skin, layoutName);
}
selectKeyWindowMenu(skin.isKeyWindow = true);