From: giwoong.kim Date: Mon, 19 Nov 2012 07:34:48 +0000 (+0900) Subject: skin: simplify the dbi file of general skin X-Git-Tag: Tizen_Studio_1.3_Release_p2.3.1~1350 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e1ce12be4a95dd9991ea41ac1582d7b10d1415bf;p=sdk%2Femulator%2Fqemu.git skin: simplify the dbi file of general skin In dbi file of general skin, the Emulator uses portrait HW keys if the HW keys are not defined on non-portrait format. Signed-off-by: GiWoong Kim --- diff --git a/tizen/src/skin/client/skins/emul-general/default.dbi b/tizen/src/skin/client/skins/emul-general/default.dbi index 437bab3f4f..6522418d6f 100644 --- a/tizen/src/skin/client/skins/emul-general/default.dbi +++ b/tizen/src/skin/client/skins/emul-general/default.dbi @@ -35,92 +35,14 @@ - - - - 101 - Home - - - - - 103 - Power - - - - - 115 - Volume up - - - - - 114 - Volume down - - - - - - - 101 - Home - - - - - 103 - Power - - - - - 115 - Volume up - - - - - 114 - Volume down - - - - - - - 101 - Home - - - - - 103 - Power - - - - - 115 - Volume up - - - - - 114 - Volume down - - - diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/layout/GeneralPurposeSkinComposer.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/layout/GeneralPurposeSkinComposer.java index daa8024be5..c649c094fb 100644 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/layout/GeneralPurposeSkinComposer.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/layout/GeneralPurposeSkinComposer.java @@ -69,6 +69,7 @@ public class GeneralPurposeSkinComposer implements ISkinComposer { private EmulatorConfig config; private Shell shell; private Canvas lcdCanvas; + private Decorations decoration; private EmulatorSkinState currentState; private ImageRegistry imageRegistry; @@ -79,6 +80,7 @@ public class GeneralPurposeSkinComposer implements ISkinComposer { SocketCommunicator communicator) { this.config = config; this.shell = shell; + this.decoration = null; this.currentState = currentState; this.imageRegistry = imageRegistry; this.communicator = communicator; @@ -159,15 +161,20 @@ public class GeneralPurposeSkinComposer implements ISkinComposer { dataCanvas.height = lcdBounds.height; lcdCanvas.setLayoutData(dataCanvas); - Decorations decoration = new Decorations(shell, SWT.BORDER); - decoration.setLayout(new GridLayout(1, true)); + if (decoration != null) { + decoration.dispose(); + decoration = null; + } + + shell.pack(); - RotationType rotation = - SkinRotation.getRotation(currentState.getCurrentRotationId()); - List keyMapList = rotation.getKeyMapList().getKeyMap(); + List keyMapList = + SkinUtil.getHWKeyMapList(currentState.getCurrentRotationId()); - // TODO: function if (keyMapList != null && keyMapList.isEmpty() == false) { + decoration = new Decorations(shell, SWT.BORDER); + decoration.setLayout(new GridLayout(1, true)); + for (KeyMapType keyEntry : keyMapList) { Button hardKeyButton = new Button(decoration, SWT.FLAT); hardKeyButton.setText(keyEntry.getEventInfo().getKeyName()); @@ -197,13 +204,13 @@ public class GeneralPurposeSkinComposer implements ISkinComposer { } }); } + + FormData dataDecoration = new FormData(); + dataDecoration.left = new FormAttachment(lcdCanvas, 0); + dataDecoration.top = new FormAttachment(0, 0); + decoration.setLayoutData(dataDecoration); } - FormData dataDecoration = new FormData(); - dataDecoration.left = new FormAttachment(lcdCanvas, 0); - dataDecoration.top = new FormAttachment(0, 0); - decoration.setLayoutData(dataDecoration); - shell.redraw(); shell.pack(); } diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/util/SkinUtil.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/util/SkinUtil.java index b68b3ab950..5b96e6c3af 100644 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/util/SkinUtil.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/util/SkinUtil.java @@ -44,6 +44,7 @@ import org.tizen.emulator.skin.config.EmulatorConfig; import org.tizen.emulator.skin.config.EmulatorConfig.ArgsConstants; import org.tizen.emulator.skin.config.EmulatorConfig.SkinPropertiesConstants; import org.tizen.emulator.skin.dbi.EventInfoType; +import org.tizen.emulator.skin.dbi.KeyMapListType; import org.tizen.emulator.skin.dbi.KeyMapType; import org.tizen.emulator.skin.dbi.RegionType; import org.tizen.emulator.skin.dbi.RotationType; @@ -107,12 +108,37 @@ public class SkinUtil { return sdbPath; } + public static List getHWKeyMapList(short rotationId) { + RotationType rotation = SkinRotation.getRotation(rotationId); + if (rotation == null) { + return null; + } + + KeyMapListType list = rotation.getKeyMapList(); + if (list == null) { + /* try to using a KeyMapList of portrait */ + rotation = SkinRotation.getRotation(RotationInfo.PORTRAIT.id()); + if (rotation == null) { + return null; + } + + list = rotation.getKeyMapList(); + if (list == null) { + return null; + } + } + + return list.getKeyMap(); + } + public static HWKey getHWKey( int currentX, int currentY, short rotationId, int scale) { float convertedScale = convertScale(scale); - RotationType rotation = SkinRotation.getRotation(rotationId); - List keyMapList = rotation.getKeyMapList().getKeyMap(); + List keyMapList = getHWKeyMapList(rotationId); + if (keyMapList == null) { + return null; + } for (KeyMapType keyMap : keyMapList) { RegionType region = keyMap.getRegion();