menu: change a parent of screenshot shell
authorGiWoong Kim <giwoong.kim@samsung.com>
Wed, 4 Sep 2013 08:35:54 +0000 (17:35 +0900)
committerGiWoong Kim <giwoong.kim@samsung.com>
Wed, 4 Sep 2013 08:41:29 +0000 (17:41 +0900)
change a parent of screenshot shell
and modified the init position

Change-Id: Ia0b1e7d314d918d963815fe399de7564a40aab44
Signed-off-by: GiWoong Kim <giwoong.kim@samsung.com>
tizen/src/skin/client/src/org/tizen/emulator/skin/dialog/SkinDialog.java
tizen/src/skin/client/src/org/tizen/emulator/skin/screenshot/ScreenShotDialog.java

index 3b1d792569cf5bd5a87bae16132e2c5c89038e6c..a74b47d00ea4382e1191f484aee84c03ba928e69 100644 (file)
@@ -127,7 +127,7 @@ public abstract class SkinDialog extends Dialog {
 
                        if (y < monitorBounds.y) {
                                y = monitorBounds.y;
-                       } else if ((y + width) > (monitorBounds.y + monitorBounds.height)) {
+                       } else if ((y + height) > (monitorBounds.y + monitorBounds.height)) {
                                y = (monitorBounds.y + monitorBounds.height) - height;
                        }
 
index d2a8a85494a64b5c418f192757ccc947d3f0860b..d1a5bc657bdcffe582b16b8f75304773d5eed1fb 100644 (file)
@@ -117,8 +117,7 @@ public class ScreenShotDialog {
                this.config = config;
                this.scaleLevel = 100d;
 
-               shell = new Shell(Display.getDefault(),
-                               SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX);
+               shell = new Shell(parent, SWT.SHELL_TRIM);
                shell.setText("Screen Shot - " + SkinUtil.makeEmulatorName(config));
 
                /* To prevent the icon switching on Mac */
@@ -228,28 +227,33 @@ public class ScreenShotDialog {
 //                             }
 //              });
 
-               Rectangle monitorBound = Display.getDefault().getBounds();
-               logger.info("host monitor display bound : " + monitorBound);
-               Rectangle emulatorBound = parent.getBounds();
-               logger.info("current Emulator window bound : " + emulatorBound);
-               Rectangle dialogBound = shell.getBounds();
-               logger.info("current ScreenShot Dialog bound : " + dialogBound);
+               Rectangle monitorBounds = Display.getDefault().getBounds();
+               logger.info("host monitor display bounds : " + monitorBounds);
+               Rectangle emulatorBounds = parent.getBounds();
+               logger.info("current Emulator window bounds : " + emulatorBounds);
+               Rectangle dialogBounds = shell.getBounds();
+               logger.info("current ScreenShot Dialog bounds : " + dialogBounds);
 
                /* size correction */
-               shell.setSize(emulatorBound.width, emulatorBound.height);
-               dialogBound = shell.getBounds();
-               logger.info("current ScreenShot Dialog bound : " + dialogBound);
+               shell.setSize(emulatorBounds.width, emulatorBounds.height);
+               dialogBounds = shell.getBounds();
+               logger.info("current ScreenShot Dialog bounds : " + dialogBounds);
 
                /* location correction */
-               int x = emulatorBound.x + emulatorBound.width + 20;
-               int y = emulatorBound.y;
-               if ((x + dialogBound.width) > (monitorBound.x + monitorBound.width)) {
-                       x = emulatorBound.x - dialogBound.width - 20;
+               int x = emulatorBounds.x + emulatorBounds.width + 20;
+               int y = emulatorBounds.y;
+               if ((x + dialogBounds.width) > (monitorBounds.x + monitorBounds.width)) {
+                       x = emulatorBounds.x - dialogBounds.width - 20;
+               }
+               if (y < monitorBounds.y) {
+                       y = monitorBounds.y;
+               } else if ((y + dialogBounds.height) > (monitorBounds.y + monitorBounds.height)) {
+                       y = (monitorBounds.y + monitorBounds.height) - dialogBounds.height;
                }
                shell.setLocation(x, y);
-               dialogBound = shell.getBounds();
-               logger.info("current ScreenShot Dialog bound : " + dialogBound);
 
+               dialogBounds = shell.getBounds();
+               logger.info("current ScreenShot Dialog bounds : " + dialogBounds);
        }
 
 //     private void drawRotatedImage( GC gc, int width, int height ) {