package org.tizen.dynamicanalyzer.ui.toolbar.replayEditor;
+import java.io.File;
+import java.io.IOException;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
import org.eclipse.nebula.widgets.grid.GridItem;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
+import org.tizen.dynamicanalyzer.common.AnalyzerPaths;
+import org.tizen.dynamicanalyzer.common.CommonConstants;
import org.tizen.dynamicanalyzer.common.SnapshotConstants;
+import org.tizen.dynamicanalyzer.communicator.DACommunicator;
import org.tizen.dynamicanalyzer.nl.ReplayEditLabels;
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.ui.widgets.DAMessageBox;
import org.tizen.dynamicanalyzer.ui.widgets.table.DATableComposite;
import org.tizen.dynamicanalyzer.ui.widgets.table.DefaultTableComparator;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
public class ReplayEditSnapshotDialog extends DAMessageBox {
private DATableComposite snapShotTable = null;
int[] sortTypes = { AnalyzerConstants.SORT_TYPE_GRID };
int[] sourceColumns = { 0 };
- private String[] columnNames = { "" };//$NON-NLS-1$
+ private String[] columnNames = { CommonConstants.EMPTY };//$NON-NLS-1$
private int[] columnSizes = { SnapshotConstants.DEFAULT_IMAGE_WIDTH + 15 };
private boolean[] columnVisibility = { true };
protected GridItem item = null;
+ private String resolutionWidth = CommonConstants.EMPTY;
+ private String resolutionHeight = CommonConstants.EMPTY;
+
public ReplayEditSnapshotDialog(Shell parent, GridItem item) {
super(parent);
this.item = item;
snapShotTable.getTable().setItemHeight(
SnapshotConstants.DEFAULT_IMAGE_HEIGHT);
snapShotTable.updateTable();
+
+ getDeviceResolution();
+
return true;
}
int imgClickY = DisplyPt.y - tableY - 55;
int drawImagWidth = SnapshotConstants.DEFAULT_IMAGE_WIDTH;
int drawImagHeight = SnapshotConstants.DEFAULT_IMAGE_HEIGHT - 20;
+
int imgWidth = 720;
int imgHeight = 1280;
+ if (!resolutionWidth.equals(CommonConstants.EMPTY)) {
+ imgWidth = Integer.parseInt(resolutionWidth);
+ }
+
+ if (!resolutionHeight.equals(CommonConstants.EMPTY)) {
+ imgWidth = Integer.parseInt(resolutionHeight);
+ }
if ((0 <= imgClickX && imgClickX <= drawImagWidth)
&& (0 <= imgClickY && imgClickY <= drawImagHeight)) {
return this.snapShotTable;
}
+ private void getDeviceResolution() {
+ String selDeviceName = DACommunicator.getSelectedDevice().getIDevice()
+ .getDeviceName();
+ String resolutionInfoXmlPath = AnalyzerPaths.TIZEN_SDK_DATA_PATH
+ + File.separator + "emulator-vms" + File.separator + "vms"//$NON-NLS-1$
+ + File.separator + selDeviceName + File.separator
+ + "vm_config.xml";//$NON-NLS-1$
+
+ DocumentBuilder builder = null;
+ Document doc = null;
+
+ try {
+ builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+ doc = builder.parse(resolutionInfoXmlPath);
+ } catch (ParserConfigurationException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (SAXException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ if (null == doc) {
+ return;
+ }
+
+ Element root = doc.getDocumentElement();
+
+ NodeList deviceNode = root.getElementsByTagName("device");//$NON-NLS-1$
+ Element deviceElement = (Element) deviceNode.item(0);
+
+ NodeList displayNode = deviceElement.getElementsByTagName("display");//$NON-NLS-1$
+ Element displayElement = (Element) displayNode.item(0);
+
+ NodeList resolutionNode = displayElement
+ .getElementsByTagName("resolution");//$NON-NLS-1$
+ Element resolutionElement = (Element) resolutionNode.item(0);
+
+ NodeList widthNodeList = resolutionElement
+ .getElementsByTagName("width");//$NON-NLS-1$
+ Element widthElement = (Element) widthNodeList.item(0);
+ Node widthNode = widthElement.getFirstChild();
+ resolutionWidth = widthNode.getNodeValue();
+ NodeList heightNodeList = resolutionElement
+ .getElementsByTagName("height");//$NON-NLS-1$
+ Element heightElement = (Element) heightNodeList.item(0);
+ Node heightNode = heightElement.getFirstChild();
+ resolutionHeight = heightNode.getNodeValue();
+ }
+
}
\ No newline at end of file