[Title] Monitor size should be considered when determining the dialog location
authorgiwoong.kim <giwoong.kim@samsung.com>
Mon, 16 Apr 2012 06:03:17 +0000 (15:03 +0900)
committergiwoong.kim <giwoong.kim@samsung.com>
Mon, 16 Apr 2012 06:03:17 +0000 (15:03 +0900)
[Type] enhancement
[Module] Emulator / screenshot
[Priority]
[Jira#]
[Redmine#]
[Problem]
[Cause] resolution
[Solution]
[TestCase]

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

index a0b232411be6345fe59f3272184619cd7caadef2..6b131b4e32ced5646f6b6e2d1f3f53ea981368e9 100644 (file)
@@ -52,6 +52,7 @@ import org.eclipse.swt.graphics.Image;
 import org.eclipse.swt.graphics.ImageData;
 import org.eclipse.swt.graphics.ImageLoader;
 import org.eclipse.swt.graphics.PaletteData;
+import org.eclipse.swt.graphics.Rectangle;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Canvas;
@@ -115,7 +116,6 @@ public class ScreenShotDialog {
 
                shell = new Shell( Display.getDefault(), SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX );
                shell.setText( "Screen Shot - " + SkinUtil.makeEmulatorName( config ) );
-               shell.setLocation( parent.getLocation().x + parent.getSize().x + 30, parent.getLocation().y );
                shell.addListener( SWT.Close, new Listener() {
                        @Override
                        public void handleEvent( Event event ) {
@@ -175,6 +175,15 @@ public class ScreenShotDialog {
 
                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;
+               }
+               shell.setLocation(x, y);
+
        }
 
 //     private void drawRotatedImage( GC gc, int width, int height ) {
@@ -573,4 +582,4 @@ public class ScreenShotDialog {
                return shell;
        }
 
-}
\ No newline at end of file
+}