From: giwoong.kim Date: Thu, 1 Nov 2012 12:35:26 +0000 (+0900) Subject: skin: align the folding button in general skin X-Git-Tag: Tizen_Studio_1.3_Release_p2.3.1~1377^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4b351a8ee2f04ddf3dd959f6e0881fc7b52eb5cc;p=sdk%2Femulator%2Fqemu.git skin: align the folding button in general skin I aligned a folding button at middle of lcd height. Signed-off-by: GiWoong Kim --- diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java index 437a252bba..c618d81f84 100644 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java @@ -66,6 +66,7 @@ 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.layout.FormAttachment; import org.eclipse.swt.layout.FormData; import org.eclipse.swt.layout.FormLayout; @@ -395,7 +396,12 @@ public class EmulatorSkin { this.currentLcdHeight = resolutionH; this.currentScale = scale; this.currentRotationId = rotationId; - this.currentAngle = SkinRotation.getAngle( rotationId ); + this.currentAngle = SkinRotation.getAngle(rotationId); + + /* arrange the lcd */ + Rectangle lcdBounds = SkinUtil.adjustLcdGeometry( + lcdCanvas, currentLcdWidth, currentLcdHeight, scale, rotationId, + skinInfo.isPhoneShape()); if (skinInfo.isPhoneShape() == false) { /* folding button */ @@ -403,11 +409,6 @@ public class EmulatorSkin { foldingButton = new Button(shell, SWT.PUSH); foldingButton.setText(">"); - FormData dataFoldingButton = new FormData(); - dataFoldingButton.left = new FormAttachment(lcdCanvas, 0); - dataFoldingButton.top = new FormAttachment(0, 0); - foldingButton.setLayoutData(dataFoldingButton); - foldingButton.addMouseListener(new MouseListener() { @Override public void mouseDown(MouseEvent e) { @@ -418,11 +419,9 @@ public class EmulatorSkin { public void mouseUp(MouseEvent e) { if (skinInfo.getSkinOption() == 0) { skinInfo.setSkinOption(1); - foldingButton.setText("<"); } else { skinInfo.setSkinOption(0); - foldingButton.setText(">"); } @@ -438,8 +437,16 @@ public class EmulatorSkin { /* do nothing */ } }); + + shell.pack(); } + FormData dataFoldingButton = new FormData(); + dataFoldingButton.left = new FormAttachment(lcdCanvas, 0); + dataFoldingButton.top = new FormAttachment( + 0, (lcdBounds.height / 2) - (foldingButton.getSize().y / 2)); + foldingButton.setLayoutData(dataFoldingButton); + if (skinInfo.getSkinOption() == 0) { /* HW keys region */ if (decoration == null) { @@ -521,10 +528,6 @@ public class EmulatorSkin { SkinUtil.trimShell(shell, currentImage); } - /* arrange the lcd */ - SkinUtil.adjustLcdGeometry(lcdCanvas, currentLcdWidth, currentLcdHeight, - scale, rotationId, skinInfo.isPhoneShape()); - /* set window size */ if (null != currentImage) { ImageData imageData = currentImage.getImageData(); 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 169ecc1ae4..c5cd5630c0 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 @@ -110,12 +110,12 @@ public class SkinUtil { return sdbPath; } - public static void adjustLcdGeometry( + public static Rectangle adjustLcdGeometry( Canvas lcdCanvas, int resolutionW, int resolutionH, int scale, short rotationId, boolean isPhoneShape) { float convertedScale = convertScale(scale); - int l = 0, t = 0, w = 0, h = 0; + Rectangle lcdBounds = new Rectangle(0, 0, 0, 0); if (isPhoneShape == false) { RotationInfo rotation = RotationInfo.getValue(rotationId); @@ -123,11 +123,11 @@ public class SkinUtil { /* resoultion, that is lcd size in general skin mode */ if (RotationInfo.LANDSCAPE == rotation || RotationInfo.REVERSE_LANDSCAPE == rotation) { - w = (int)(resolutionH * convertedScale); - h = (int)(resolutionW * convertedScale); + lcdBounds.width = (int)(resolutionH * convertedScale); + lcdBounds.height = (int)(resolutionW * convertedScale); } else { - w = (int)(resolutionW * convertedScale); - h = (int)(resolutionH * convertedScale); + lcdBounds.width = (int)(resolutionW * convertedScale); + lcdBounds.height = (int)(resolutionH * convertedScale); } } else { RotationType rotation = SkinRotation.getRotation(rotationId); @@ -140,18 +140,20 @@ public class SkinUtil { Integer width = region.getWidth(); Integer height = region.getHeight(); - l = (int) (left * convertedScale); - t = (int) (top * convertedScale); - w = (int) (width * convertedScale); - h = (int) (height * convertedScale); + lcdBounds.x = (int) (left * convertedScale); + lcdBounds.y = (int) (top * convertedScale); + lcdBounds.width = (int) (width * convertedScale); + lcdBounds.height = (int) (height * convertedScale); } FormData data = new FormData(); - data.left = new FormAttachment(0, l); - data.top = new FormAttachment(0, t); - data.width = w; - data.height = h; + data.left = new FormAttachment(0, lcdBounds.x); + data.top = new FormAttachment(0, lcdBounds.y); + data.width = lcdBounds.width; + data.height = lcdBounds.height; lcdCanvas.setLayoutData(data); + + return lcdBounds; } public static SkinRegion getHardKeyArea( int currentX, int currentY, short rotationId, int scale ) {