[Title] screenshot window size correction
authorgiwoong.kim <giwoong.kim@samsung.com>
Thu, 17 May 2012 11:06:39 +0000 (20:06 +0900)
committergiwoong.kim <giwoong.kim@samsung.com>
Thu, 17 May 2012 11:11:37 +0000 (20:11 +0900)
[Type] enhancement
[Module] Emulator / skin
[Priority]
[Jira#]
[Redmine#] 4910
[Problem]
[Cause]
[Solution]
[TestCase]

tizen/src/skin/client/src/org/tizen/emulator/skin/screenshot/ScreenShotDialog.java

index e9714f0f4d8ec7efbf6e3cd351a6bb66960cff4b..84d353a5c2f5bd1a942554213797c9edae2f1036 100644 (file)
@@ -59,6 +59,7 @@ import org.eclipse.swt.widgets.Canvas;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Event;
 import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Listener;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.swt.widgets.ToolBar;
@@ -97,6 +98,7 @@ public class ScreenShotDialog {
        private Canvas imageCanvas;
        private Shell shell;
        private ScrolledComposite scrollComposite;
+       private Label label;
 
        private SocketCommunicator communicator;
        private EmulatorSkin emulatorSkin;
@@ -177,16 +179,31 @@ public class ScreenShotDialog {
                        throw e;
                }
 
+               label = new Label(shell, SWT.BORDER);
+
                shell.pack();
 
-               Rectangle  monitorBound = Display.getDefault().getBounds();
-               logger.info("current display size : " + monitorBound);
-               int x = parent.getLocation().x + parent.getSize().x + 20;
-               int y = parent.getLocation().y;
-               if ((x + shell.getSize().x) > (monitorBound.x + monitorBound.width)) {
-                       x = parent.getLocation().x - shell.getSize().x - 20;
+               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);
+
+               /* size correction */
+               shell.setSize(emulatorBound.width, emulatorBound.height);
+               dialogBound = shell.getBounds();
+               logger.info("current ScreenShot Dialog bound : " + dialogBound);
+
+               /* 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;
                }
                shell.setLocation(x, y);
+               dialogBound = shell.getBounds();
+               logger.info("current ScreenShot Dialog bound : " + dialogBound);
 
        }