allow to configure what object types to export in exportdialog

This commit is contained in:
honfika@gmail.com
2015-04-28 13:18:48 +02:00
parent ec8e49af91
commit c31d8020c9
5 changed files with 261 additions and 130 deletions

View File

@@ -226,7 +226,7 @@ public class Configuration {
@ConfigurationCategory("script")
public static final ConfigurationItem<String> registerNameFormat = null;
@ConfigurationDefaultInt(10)
@ConfigurationDefaultInt(15)
public static final ConfigurationItem<Integer> maxRecentFileCount = null;
public static final ConfigurationItem<String> recentFiles = null;

View File

@@ -35,7 +35,7 @@ public abstract class DefaultSVGShapeExporter extends ShapeExporterBase {
protected String currentDrawCommand = "";
protected String pathData;
protected StringBuilder pathData;
protected double zoom;
@@ -101,35 +101,37 @@ public abstract class DefaultSVGShapeExporter extends ShapeExporterBase {
@Override
public void moveTo(double x, double y) {
currentDrawCommand = "";
pathData += "M"
+ roundPixels20(x * zoom / SWF.unitDivisor) + " "
+ roundPixels20(y * zoom / SWF.unitDivisor) + " ";
pathData.append("M")
.append(roundPixels20(x * zoom / SWF.unitDivisor)).append(" ")
.append(roundPixels20(y * zoom / SWF.unitDivisor)).append(" ");
}
@Override
public void lineTo(double x, double y) {
if (!currentDrawCommand.equals(DRAW_COMMAND_L)) {
currentDrawCommand = DRAW_COMMAND_L;
pathData += "L";
pathData.append("L");
}
pathData += roundPixels20(x * zoom / SWF.unitDivisor) + " "
+ roundPixels20(y * zoom / SWF.unitDivisor) + " ";
pathData.append(roundPixels20(x * zoom / SWF.unitDivisor)).append(" ")
.append(roundPixels20(y * zoom / SWF.unitDivisor)).append(" ");
}
@Override
public void curveTo(double controlX, double controlY, double anchorX, double anchorY) {
if (!currentDrawCommand.equals(DRAW_COMMAND_Q)) {
currentDrawCommand = DRAW_COMMAND_Q;
pathData += "Q";
pathData.append("Q");
}
pathData += roundPixels20(controlX * zoom / SWF.unitDivisor) + " "
+ roundPixels20(controlY * zoom / SWF.unitDivisor) + " "
+ roundPixels20(anchorX * zoom / SWF.unitDivisor) + " "
+ roundPixels20(anchorY * zoom / SWF.unitDivisor) + " ";
pathData.append(roundPixels20(controlX * zoom / SWF.unitDivisor)).append(" ")
.append(roundPixels20(controlY * zoom / SWF.unitDivisor)).append(" ")
.append(roundPixels20(anchorX * zoom / SWF.unitDivisor)).append(" ")
.append(roundPixels20(anchorY * zoom / SWF.unitDivisor)).append(" ");
}
protected void finalizePath() {
pathData = "";
pathData = new StringBuilder();
currentDrawCommand = "";
}

View File

@@ -218,8 +218,8 @@ public class SVGShapeExporter extends DefaultSVGShapeExporter {
@Override
protected void finalizePath() {
if (path != null && !"".equals(pathData)) {
path.setAttribute("d", pathData.trim());
if (path != null && pathData.length() > 0) {
path.setAttribute("d", pathData.toString().trim());
exporter.addToGroup(path);
}
path = exporter.createElement("path");