this.currentState = new EmulatorSkinState();
setColorVM(); /* generate a identity color */
+
this.keyWindowKeeper = new KeyWindowKeeper(this);
}
}
public long initLayout() {
+ logger.info("initialize the skin layout");
+
imageRegistry = ImageRegistry.getInstance();
/* set emulator states */
isOnKbd = false;
popupMenu = new PopupMenu(config, this);
- getKeyWindowKeeper().determineLayout();
-
/* build a skin layout */
if (skinInfo.isGeneralPurposeSkin() == false) {
skinComposer = new ProfileSpecificSkinComposer(config, this);
/* close the Key Window */
if (getKeyWindowKeeper() != null) {
- getKeyWindowKeeper().closeKeyWindow();
+ getKeyWindowKeeper().dispose();
}
/* dispose the images */
import org.tizen.emulator.skin.util.SwtUtil;
public class GeneralKeyWindow extends SkinWindow {
- private static final String PATCH_IMAGES_PATH = "images/key-window/";
private static final int SHELL_MARGIN_BOTTOM = 3;
private static final int PAIRTAG_CIRCLE_SIZE = 8;
private static final int PAIRTAG_MARGIN_BOTTOM = 6;
private boolean isGrabbedShell;
private Point grabPosition;
- public GeneralKeyWindow(EmulatorSkin skin, List<KeyMapType> keyMapList) {
+ public GeneralKeyWindow(EmulatorSkin skin,
+ GeneralKeyWindowImageRegistry imageRegstry, List<KeyMapType> keyMapList) {
super(skin.getShell(), SWT.RIGHT | SWT.CENTER);
this.skin = skin;
this.shell = new Shell(parent.getDisplay() /* for Mac & Always on Top */,
SWT.NO_TRIM | SWT.RESIZE | SWT.TOOL | SWT.NO_FOCUS);
- this.imageRegistry = new GeneralKeyWindowImageRegistry(shell.getDisplay());
- this.frameMaker = new SkinPatches(PATCH_IMAGES_PATH);
+ this.imageRegistry = imageRegstry;
+ this.frameMaker = new SkinPatches(
+ imageRegistry.getKeyWindowImage(
+ GeneralKeyWindowImageName.KEYWINDOW_PATCH_LT),
+ imageRegistry.getKeyWindowImage(
+ GeneralKeyWindowImageName.KEYWINDOW_PATCH_T),
+ imageRegistry.getKeyWindowImage(
+ GeneralKeyWindowImageName.KEYWINDOW_PATCH_RT),
+ imageRegistry.getKeyWindowImage(
+ GeneralKeyWindowImageName.KEYWINDOW_PATCH_L),
+ imageRegistry.getKeyWindowImage(
+ GeneralKeyWindowImageName.KEYWINDOW_PATCH_R),
+ imageRegistry.getKeyWindowImage(
+ GeneralKeyWindowImageName.KEYWINDOW_PATCH_LB),
+ imageRegistry.getKeyWindowImage(
+ GeneralKeyWindowImageName.KEYWINDOW_PATCH_B),
+ imageRegistry.getKeyWindowImage(
+ GeneralKeyWindowImageName.KEYWINDOW_PATCH_RB));
this.keyMapList = keyMapList; //TODO: null
this.grabPosition = new Point(0, 0);
}
colorFrame.dispose();
-
- frameMaker.freePatches();
- imageRegistry.dispose();
}
}
GeneralKeyWindowImageRegistry.class).getLogger();
public enum GeneralKeyWindowImageName {
+ KEYWINDOW_PATCH_LT("LT.png"),
+ KEYWINDOW_PATCH_T("T.png"),
+ KEYWINDOW_PATCH_RT("RT.png"),
+ KEYWINDOW_PATCH_L("L.png"),
+ KEYWINDOW_PATCH_R("R.png"),
+ KEYWINDOW_PATCH_LB("LB.png"),
+ KEYWINDOW_PATCH_B("B.png"),
+ KEYWINDOW_PATCH_RB("RB.png"),
+
KEYBUTTON_NORMAL("keybutton_nml.png"),
KEYBUTTON_HOVER("keybutton_hover.png"),
KEYBUTTON_PUSHED("keybutton_pushed.png"),
}
public void dispose() {
+ logger.info("dispose");
+
if (null != keyWindowImageMap) {
Image image = null;
GeneralSkinImageRegistry.class).getLogger();
public enum GeneralSkinImageName {
+ SKIN_PATCH_LT("LT.png"),
+ SKIN_PATCH_T("T.png"),
+ SKIN_PATCH_RT("RT.png"),
+ SKIN_PATCH_L("L.png"),
+ SKIN_PATCH_R("R.png"),
+ SKIN_PATCH_LB("LB.png"),
+ SKIN_PATCH_B("B.png"),
+ SKIN_PATCH_RB("RB.png"),
+
TOGGLE_BUTTON_NORMAL("arrow_nml.png"),
TOGGLE_BUTTON_HOVER("arrow_hover.png"),
TOGGLE_BUTTON_PUSHED("arrow_pushed.png");
}
public void dispose() {
+ logger.info("dispose");
+
if (null != skinImageMap) {
Image image = null;
}
public void dispose() {
+ logger.info("dispose");
+
if (null != skinImageMap) {
Image image = null;
}
public void dispose() {
+ logger.info("dispose");
+
if (null != keyWindowImageMap) {
Image image = null;
import org.tizen.emulator.skin.util.SwtUtil;
public class GeneralPurposeSkinComposer implements ISkinComposer {
- private static final String PATCH_IMAGES_PATH = "images/emul-window/";
private static final int PAIR_TAG_POSITION_X = 26;
private static final int PAIR_TAG_POSITION_Y = 13;
this.imageRegistry =
new GeneralSkinImageRegistry(shell.getDisplay());
- this.frameMaker = new SkinPatches(PATCH_IMAGES_PATH);
+ this.frameMaker = new SkinPatches(
+ imageRegistry.getSkinImage(GeneralSkinImageName.SKIN_PATCH_LT),
+ imageRegistry.getSkinImage(GeneralSkinImageName.SKIN_PATCH_T),
+ imageRegistry.getSkinImage(GeneralSkinImageName.SKIN_PATCH_RT),
+ imageRegistry.getSkinImage(GeneralSkinImageName.SKIN_PATCH_L),
+ imageRegistry.getSkinImage(GeneralSkinImageName.SKIN_PATCH_R),
+ imageRegistry.getSkinImage(GeneralSkinImageName.SKIN_PATCH_LB),
+ imageRegistry.getSkinImage(GeneralSkinImageName.SKIN_PATCH_B),
+ imageRegistry.getSkinImage(GeneralSkinImageName.SKIN_PATCH_RB));
+
this.backgroundColor = new Color(shell.getDisplay(), new RGB(38, 38, 38));
}
backgroundColor.dispose();
}
- frameMaker.freePatches();
imageRegistry.dispose();
}
}
/**
+ * General Skin Frame Maker
*
- *
- * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact:
* GiWoong Kim <giwoong.kim@samsung.com>
SkinLogger.getSkinLogger(SkinPatches.class).getLogger();
private Display display;
- private String pathImage;
private int patchWidth;
private int patchHeight;
private Image imageB;
private Image imageRB;
- // TODO: configurable
- private static final String SKIN_PATCH_IMG_LT = "LT.png";
- private static final String SKIN_PATCH_IMG_T = "T.png";
- private static final String SKIN_PATCH_IMG_RT = "RT.png";
+ /**
+ * Constructor
+ */
+ public SkinPatches(
+ Image leftTop, Image middleTop, Image rightTop,
+ Image leftMiddle, Image rightMiddle,
+ Image leftBottom, Image middleBottom, Image rightBottom) {
+ this.display = Display.getCurrent();
- private static final String SKIN_PATCH_IMG_L = "L.png";
- private static final String SKIN_PATCH_IMG_R = "R.png";
+ imageLT = leftTop;
+ imageT = middleTop;
+ imageRT = rightTop;
- private static final String SKIN_PATCH_IMG_LB = "LB.png";
- private static final String SKIN_PATCH_IMG_B = "B.png";
- private static final String SKIN_PATCH_IMG_RB = "RB.png";
+ imageL = leftMiddle;
+ imageR = rightMiddle;
- public SkinPatches(String path) {
- this.display = Display.getCurrent();
- this.pathImage = path;
-
- loadPatches(pathImage);
+ imageLB = leftBottom;
+ imageB = middleBottom;
+ imageRB = rightBottom;
// TODO: configurable
this.patchWidth = imageLT.getImageData().width;
return patchedImage;
}
-
- private void loadPatches(String path) {
- ClassLoader loader = this.getClass().getClassLoader();
-
- imageLT = new Image(display,
- loader.getResourceAsStream(path + SKIN_PATCH_IMG_LT));
- logger.info("left-top image is loaded from " +
- path + SKIN_PATCH_IMG_LT);
- imageT = new Image(display,
- loader.getResourceAsStream(path + SKIN_PATCH_IMG_T));
- imageRT = new Image(display,
- loader.getResourceAsStream(path + SKIN_PATCH_IMG_RT));
-
- imageL = new Image(display,
- loader.getResourceAsStream(path + SKIN_PATCH_IMG_L));
- imageR = new Image(display,
- loader.getResourceAsStream(path + SKIN_PATCH_IMG_R));
-
- imageLB = new Image(display,
- loader.getResourceAsStream(path + SKIN_PATCH_IMG_LB));
- imageB = new Image(display,
- loader.getResourceAsStream(path + SKIN_PATCH_IMG_B));
- imageRB = new Image(display,
- loader.getResourceAsStream(path + SKIN_PATCH_IMG_RB));
- }
-
- public void freePatches() {
- imageLT.dispose();
- imageT.dispose();
- imageRT.dispose();
-
- imageL.dispose();
- imageR.dispose();
-
- imageLB.dispose();
- imageB.dispose();
- imageRB.dispose();
- }
}
import org.tizen.emulator.skin.custom.SkinWindow;
import org.tizen.emulator.skin.custom.SpecialKeyWindow;
import org.tizen.emulator.skin.dbi.KeyMapType;
+import org.tizen.emulator.skin.image.GeneralKeyWindowImageRegistry;
import org.tizen.emulator.skin.log.SkinLogger;
import org.tizen.emulator.skin.util.SkinUtil;
private int recentlyDocked;
private int indexLayout;
+ private GeneralKeyWindowImageRegistry imageRegstry;
+
/**
* Constructor
*/
this.skin = skin;
this.recentlyDocked = SWT.NONE;
this.indexLayout = -1;
+ this.imageRegstry = null;
}
public void openKeyWindow(int dockValue, boolean recreate) {
}
/* create a Key Window */
+ determineLayout();
+
if (isGeneralKeyWindow() == true) {
+ if (imageRegstry == null) {
+ logger.warning("GeneralKeyWindowImageRegistry is null");
+ return;
+ }
+
List<KeyMapType> keyMapList = SkinUtil.getHWKeyMapList(
skin.getEmulatorSkinState().getCurrentRotationId());
return;
}
- keyWindow = new GeneralKeyWindow(skin, keyMapList);
+ keyWindow = new GeneralKeyWindow(skin, imageRegstry, keyMapList);
} else {
// TODO:
String layoutName =
}
} else {
logger.info("key window has a general layout");
+
indexLayout = -1;
+
+ if (imageRegstry == null) {
+ imageRegstry = new GeneralKeyWindowImageRegistry(
+ skin.getShell().getDisplay());
+ }
}
return indexLayout;
public void setRecentlyDocked(int dockValue) {
recentlyDocked = dockValue;
}
+
+ public void dispose() {
+ closeKeyWindow();
+
+ if (imageRegstry != null) {
+ imageRegstry.dispose();
+ }
+ }
}