package org.tizen.emulator.skin;
import org.tizen.emulator.skin.config.EmulatorConfig;
+import org.tizen.emulator.skin.mode.SkinMode;
public class EmulatorSdlSkin extends EmulatorSkin {
/**
* Constructor
*/
- public EmulatorSdlSkin(EmulatorConfig config, boolean isOnTop) {
- super(config, isOnTop);
+ public EmulatorSdlSkin(EmulatorConfig config, SkinMode mode, boolean isOnTop) {
+ super(config, mode, isOnTop);
}
}
import org.eclipse.swt.graphics.Transform;
import org.eclipse.swt.widgets.Display;
import org.tizen.emulator.skin.config.EmulatorConfig;
+import org.tizen.emulator.skin.mode.SkinMode;
public class EmulatorShmSkin extends EmulatorSkin {
public static final int RED_MASK = 0x00FF0000;
/**
* Constructor
*/
- public EmulatorShmSkin(EmulatorConfig config, boolean isOnTop) {
- super(config, isOnTop);
+ public EmulatorShmSkin(EmulatorConfig config, SkinMode mode, boolean isOnTop) {
+ super(config, mode, isOnTop);
this.paletteData = new PaletteData(RED_MASK, GREEN_MASK, BLUE_MASK);
}
import org.tizen.emulator.skin.image.ImageRegistry.IconName;
import org.tizen.emulator.skin.image.ImageRegistry.ImageType;
import org.tizen.emulator.skin.log.SkinLogger;
+import org.tizen.emulator.skin.mode.SkinMode;
import org.tizen.emulator.skin.screenshot.ScreenShotDialog;
import org.tizen.emulator.skin.util.SkinRegion;
import org.tizen.emulator.skin.util.SkinRotation;
private Shell shell;
private ImageRegistry imageRegistry;
protected Canvas lcdCanvas;
+ private SkinMode skinMode;
private Image currentImage;
private Image currentKeyPressedImage;
private Color hoverColor;
* @param config : configuration of emulator skin
* @param isOnTop : always on top flag
*/
- protected EmulatorSkin( EmulatorConfig config, boolean isOnTop ) {
+ protected EmulatorSkin(EmulatorConfig config, SkinMode mode, boolean isOnTop) {
this.config = config;
+ this.skinMode = mode;
this.isDefaultHoverColor = true;
this.isOnTop = isOnTop;
this.pressedKeyEventList = new LinkedList<KeyEventData>();
tempKeyPressedImage.dispose();
}
- SkinUtil.trimShell( shell, currentImage );
- SkinUtil.adjustLcdGeometry( lcdCanvas, scale, rotationId );
+ /* custom window shape */
+ SkinUtil.trimShell(shell, currentImage);
+
+ /* not using a layout */
+ SkinUtil.adjustLcdGeometry(lcdCanvas, scale, rotationId);
if( null != currentImage ) {
ImageData imageData = currentImage.getImageData();
import org.tizen.emulator.skin.image.ImageRegistry;
import org.tizen.emulator.skin.log.SkinLogger;
import org.tizen.emulator.skin.log.SkinLogger.SkinLogLevel;
+import org.tizen.emulator.skin.mode.SkinMode;
import org.tizen.emulator.skin.util.IOUtil;
import org.tizen.emulator.skin.util.JaxbUtil;
import org.tizen.emulator.skin.util.StringUtil;
System.exit(-1);
}
-
+
SocketCommunicator communicator = null;
-
+
try {
String vmPath = getVmPath( args );
logger = SkinLogger.getSkinLogger( EmulatorSkinMain.class ).getLogger();
logger.info( "!!! Start Emualtor Skin !!!" );
-
+
+ /* startup arguments parsing */
Map<String, String> argsMap = parsArgs( args );
-
+
+ /* set emulator window skin property */
String skinPropFilePath = vmPath + File.separator + SKIN_PROPERTIES_FILE_NAME;
Properties skinProperties = loadProperties( skinPropFilePath, true );
if ( null == skinProperties ) {
System.exit( -1 );
}
+ /* set emulator window config property */
String configPropFilePath = vmPath + File.separator + CONFIG_PROPERTIES_FILE_NAME;
Properties configProperties = loadProperties( configPropFilePath, false );
EmulatorConfig.validateArgs( argsMap );
EmulatorConfig.validateSkinProperties( skinProperties );
EmulatorConfig.validateSkinConfigProperties( configProperties );
-
+
int lcdWidth = Integer.parseInt( argsMap.get( ArgsConstants.RESOLUTION_WIDTH ) );
int lcdHeight = Integer.parseInt( argsMap.get( ArgsConstants.RESOLUTION_HEIGHT ) );
String argSkinPath = (String) argsMap.get( ArgsConstants.SKIN_PATH );
EmulatorConfig config = new EmulatorConfig( argsMap, dbiContents, skinProperties, skinPropFilePath,
configProperties );
- ImageRegistry.getInstance().initialize( config );
-
- String onTopVal = config.getSkinProperty( SkinPropertiesConstants.WINDOW_ONTOP, Boolean.FALSE.toString() );
- boolean isOnTop = Boolean.parseBoolean( onTopVal );
+ /* load image resource */
+ ImageRegistry.getInstance().initialize(config);
+
+ String onTopVal = config.getSkinProperty(
+ SkinPropertiesConstants.WINDOW_ONTOP, Boolean.FALSE.toString());
+ boolean isOnTop = Boolean.parseBoolean(onTopVal);
+
+ /* determine skin mode */
+ SkinMode skinMode = SkinMode.getValue(argsMap.get(ArgsConstants.SKIN_MODE));
+ logger.info("skin mode is " + skinMode);
/* create skin */
EmulatorSkin skin;
if (SwtUtil.isMacPlatform()) {
- skin = new EmulatorShmSkin(config, isOnTop);
+ skin = new EmulatorShmSkin(config, skinMode, isOnTop);
} else { // linux & windows
- skin = new EmulatorSdlSkin(config, isOnTop);
+ skin = new EmulatorSdlSkin(config, skinMode, isOnTop);
}
long windowHandleId = skin.compose();
public static final String LOG_LEVEL = "log.level";
public static final String NET_BASE_PORT = "net.baseport";
public static final String SKIN_PATH = "skin.path";
+ public static final String SKIN_MODE = "skin.mode";
}
public interface SkinPropertiesConstants {
}
}
- public static void validateArgs( Map<String, String> args ) throws ConfigException {
- if ( null == args ) {
+ public static void validateArgs(Map<String, String> args) throws ConfigException {
+ if (null == args) {
return;
}
- if( args.containsKey( ArgsConstants.UID ) ) {
- String uid = args.get( ArgsConstants.UID );
+ if (args.containsKey(ArgsConstants.UID)) {
+ String uid = args.get(ArgsConstants.UID);
try {
- Integer.parseInt( uid );
- } catch ( NumberFormatException e ) {
+ Integer.parseInt(uid);
+ } catch (NumberFormatException e) {
String msg = ArgsConstants.UID + " argument is not numeric. : " + uid;
- throw new ConfigException( msg );
+ throw new ConfigException(msg);
}
}
- if( args.containsKey( ArgsConstants.SERVER_PORT ) ) {
- String serverPort = args.get( ArgsConstants.SERVER_PORT );
+ if (args.containsKey(ArgsConstants.SERVER_PORT)) {
+ String serverPort = args.get(ArgsConstants.SERVER_PORT);
try {
- Integer.parseInt( serverPort );
- } catch ( NumberFormatException e ) {
+ Integer.parseInt(serverPort);
+ } catch (NumberFormatException e) {
String msg = ArgsConstants.SERVER_PORT + " argument is not numeric. : " + serverPort;
- throw new ConfigException( msg );
+ throw new ConfigException(msg);
}
- }else {
+ } else {
String msg = ArgsConstants.SERVER_PORT + " is required argument.";
- throw new ConfigException( msg );
+ throw new ConfigException(msg);
}
- if( args.containsKey( ArgsConstants.RESOLUTION_WIDTH ) ) {
- String width = args.get( ArgsConstants.RESOLUTION_WIDTH );
+ if (args.containsKey(ArgsConstants.RESOLUTION_WIDTH)) {
+ String width = args.get(ArgsConstants.RESOLUTION_WIDTH);
try {
- Integer.parseInt( width );
- } catch ( NumberFormatException e ) {
+ Integer.parseInt(width);
+ } catch (NumberFormatException e) {
String msg = ArgsConstants.RESOLUTION_WIDTH + " argument is not numeric. : " + width;
- throw new ConfigException( msg );
+ throw new ConfigException(msg);
}
- }else {
+ } else {
String msg = ArgsConstants.RESOLUTION_WIDTH + " is required argument.";
- throw new ConfigException( msg );
+ throw new ConfigException(msg);
}
- if( args.containsKey( ArgsConstants.RESOLUTION_HEIGHT ) ) {
- String height = args.get( ArgsConstants.RESOLUTION_HEIGHT );
+ if (args.containsKey(ArgsConstants.RESOLUTION_HEIGHT)) {
+ String height = args.get(ArgsConstants.RESOLUTION_HEIGHT);
try {
- Integer.parseInt( height );
- } catch ( NumberFormatException e ) {
+ Integer.parseInt(height);
+ } catch (NumberFormatException e) {
String msg = ArgsConstants.RESOLUTION_HEIGHT + " argument is not numeric. : " + height;
- throw new ConfigException( msg );
+ throw new ConfigException(msg);
}
- }else {
+ } else {
String msg = ArgsConstants.RESOLUTION_HEIGHT + " is required argument.";
- throw new ConfigException( msg );
+ throw new ConfigException(msg);
}
-
}
public static void validateSkinProperties( Properties skinProperties ) throws ConfigException {
--- /dev/null
+/**
+ *
+ *
+ * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * GiWoong Kim <giwoong.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.emulator.skin.mode;
+
+/**
+ *
+ */
+public enum SkinMode {
+ NONE("none"),
+ FULLSCREEN("fullscreen"),
+ DEFAULT("default"),
+ CUSTOM("custom");
+
+ private String value;
+
+ SkinMode(String value) {
+ this.value = value;
+ }
+
+ public String value() {
+ return this.value;
+ }
+
+ public static SkinMode getValue(String val) {
+ SkinMode[] values = SkinMode.values();
+ for (int i = 0; i < values.length; i++) {
+ if (values[i].value.equalsIgnoreCase(val) == true) {
+ return values[i];
+ }
+ }
+
+ return SkinMode.DEFAULT;
+ }
+}
+