@Override
protected void openScreenShotWindow() {
if (screenShotDialog != null) {
+ logger.info("screenshot window was already opened");
return;
}
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;
}
}
* @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);
}
image.dispose();
}
}
+
+ emulatorSkin.screenShotDialog = null;
}
} );
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);
}
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);
}
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);
}
shell.open();
- while ( !shell.isDisposed() ) {
+ /* while ( !shell.isDisposed() ) {
if ( !shell.getDisplay().readAndDispatch() ) {
if ( reserveImage ) {
break;
shell.getDisplay().sleep();
}
}
- }
+ } */
}