screenshot: removed readAndDispatch on screenshot
authorgiwoong.kim <giwoong.kim@samsung.com>
Mon, 14 Jan 2013 01:54:59 +0000 (10:54 +0900)
committergiwoong.kim <giwoong.kim@samsung.com>
Mon, 14 Jan 2013 01:58:06 +0000 (10:58 +0900)
removed readAndDispatch function call on screenshot window

Signed-off-by: GiWoong Kim <giwoong.kim@samsung.com>
tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSdlSkin.java
tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorShmSkin.java
tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java
tizen/src/skin/client/src/org/tizen/emulator/skin/screenshot/ScreenShotDialog.java

index 8721eee..baf86ad 100644 (file)
@@ -121,6 +121,7 @@ public class EmulatorSdlSkin extends EmulatorSkin {
        @Override
        protected void openScreenShotWindow() {
                if (screenShotDialog != null) {
+                       logger.info("screenshot window was already opened");
                        return;
                }
 
@@ -130,18 +131,18 @@ public class EmulatorSdlSkin extends EmulatorSkin {
                        screenShotDialog.open();
 
                } catch (ScreenShotException ex) {
+                       screenShotDialog = null;
+
                        logger.log(Level.SEVERE, ex.getMessage(), ex);
                        SkinUtil.openMessage(shell, null,
                                        "Fail to create a screen shot.", SWT.ICON_ERROR, config);
-
                } catch (Exception ex) {
-                       // defense exception handling.
+                       screenShotDialog = null;
+
+                       /* defense exception handling */
                        logger.log(Level.SEVERE, ex.getMessage(), ex);
                        String errorMessage = "Internal Error.\n[" + ex.getMessage() + "]";
                        SkinUtil.openMessage(shell, null, errorMessage, SWT.ICON_ERROR, config);
-
-               } finally {
-                       screenShotDialog = null;
                }
        }
 
index 90eb1bd..0eb4dba 100644 (file)
@@ -238,6 +238,7 @@ public class EmulatorShmSkin extends EmulatorSkin {
        @Override
        protected void openScreenShotWindow() {
                if (screenShotDialog != null) {
+                       logger.info("screenshot window was already opened");
                        return;
                }
 
index ae00ddb..68d4136 100644 (file)
@@ -148,7 +148,7 @@ public class EmulatorSkin {
        public Color colorPairTag;
        public Canvas pairTagCanvas;
        public CustomProgressBar bootingProgress;
-       protected ScreenShotDialog screenShotDialog;
+       public ScreenShotDialog screenShotDialog;
 
        protected SocketCommunicator communicator;
        private Listener shellCloseListener;
index 08d3c95..9096420 100644 (file)
@@ -117,16 +117,17 @@ public class ScreenShotDialog {
         * @brief constructor
         * @param Image icon : screenshot window icon resource
        */
-       public ScreenShotDialog( Shell parent, SocketCommunicator communicator, EmulatorSkin emulatorSkin,
-                       EmulatorConfig config, Image icon ) throws ScreenShotException {
+       public ScreenShotDialog(Shell parent,
+                       SocketCommunicator communicator, final EmulatorSkin emulatorSkin,
+                       EmulatorConfig config, Image icon) throws ScreenShotException {
 
                this.communicator = communicator;
                this.emulatorSkin = emulatorSkin;
                this.config = config;
                scaleLevel = 100d;
 
-               shell = new Shell( Display.getDefault(), SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX );
-               shell.setText( "Screen Shot - " + SkinUtil.makeEmulatorName( config ) );
+               shell = new Shell(Display.getDefault(), SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX);
+               shell.setText("Screen Shot - " + SkinUtil.makeEmulatorName(config));
                if (icon != null) {
                        shell.setImage(icon);
                }
@@ -139,6 +140,8 @@ public class ScreenShotDialog {
                                                image.dispose();
                                        }
                                }
+
+                               emulatorSkin.screenShotDialog = null;
                        }
                } );
 
@@ -279,12 +282,12 @@ public class ScreenShotDialog {
                return scaleLevel;
        }
 
-       private void DownScaleLevel() {
+       private void downScaleLevel() {
                scaleLevel /= 2;
                logger.info("down scaling level : " + scaleLevel);
        }
        
-       private void UpScaleLevel() {
+       private void upScaleLevel() {
                scaleLevel *= 2;
                logger.info("up scaling level : " + scaleLevel);
        }
@@ -549,17 +552,18 @@ public class ScreenShotDialog {
                                double level = getScaleLevel();
                                Point dialogSize = shell.getSize();     
                                
-                               UpScaleLevel();
+                               upScaleLevel();
+
                                imageCanvas.redraw();
                                scaledImageLayout();
                                label.setText(" Resolution : " + config.getArgInt(ArgsConstants.RESOLUTION_WIDTH) +
                                                "x" + config.getArgInt(ArgsConstants.RESOLUTION_HEIGHT) + " " + scaleLevel + "%");
                                label.update();
                                
-                               if(level >= 400d) {
+                               if (level >= 400d) {
                                        IncreaseScaleItem.setEnabled(false);
                                        DecreaseScaleItem.setEnabled(true);
-                               }else {
+                               } else {
                                        IncreaseScaleItem.setEnabled(true);
                                        DecreaseScaleItem.setEnabled(true);     
                                }
@@ -581,17 +585,18 @@ public class ScreenShotDialog {
                                double level = getScaleLevel();
                                Point dialogSize = shell.getSize();
                                
-                               DownScaleLevel();
+                               downScaleLevel();
+
                                imageCanvas.redraw();
                                scaledImageLayout();
                                label.setText(" Resolution : " + config.getArgInt(ArgsConstants.RESOLUTION_WIDTH) +
                                                "x" + config.getArgInt(ArgsConstants.RESOLUTION_HEIGHT) + " " + scaleLevel + "%");
                                label.update();
                        
-                               if(level <= 25) {
+                               if (level <= 25) {
                                        DecreaseScaleItem.setEnabled(false);
                                        IncreaseScaleItem.setEnabled(true);
-                               }else {
+                               } else {
                                        DecreaseScaleItem.setEnabled(true);
                                        IncreaseScaleItem.setEnabled(true);
                                }
@@ -692,7 +697,7 @@ public class ScreenShotDialog {
 
                shell.open();
 
-               while ( !shell.isDisposed() ) {
+               /* while ( !shell.isDisposed() ) {
                        if ( !shell.getDisplay().readAndDispatch() ) {
                                if ( reserveImage ) {
                                        break;
@@ -700,7 +705,7 @@ public class ScreenShotDialog {
                                        shell.getDisplay().sleep();
                                }
                        }
-               }
+               } */
 
        }