Added description of available settings to the documentation.

This commit is contained in:
hneemann 2018-10-03 14:18:41 +02:00
parent f061e84f29
commit fb706c5a5e
5 changed files with 89 additions and 26 deletions

View File

@ -80,6 +80,13 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe
ATTR_LIST.add(Keys.PROGRAM_TO_PRELOAD);
}
/**
* @return returns the list of circuit attributes
*/
public static ArrayList<Key> getAttrList() {
return ATTR_LIST;
}
private static final String DEL_ACTION = "myDelAction";
private static final int MOUSE_BORDER_SMALL = 10;
private static final int MOUSE_BORDER_LARGE = 50;

View File

@ -1271,10 +1271,15 @@ Sind evtl. die Namen der Variablen nicht eindeutig?</string>
<string name="menu_delete">Löschen</string>
<string name="menu_delete_tt">Löscht ausgewählte Elemente</string>
<string name="menu_edit">Bearbeiten</string>
<string name="menu_editAttributes">Schaltungsattribute bearbeiten</string>
<string name="menu_editAttributes_tt">Diese Attribute beeinflussen die Schaltung, wenn sie in andere Schaltungen eingebettet wird.</string>
<string name="menu_editAttributes">Einstellungen der Schaltung</string>
<string name="menu_editAttributes_tt">Diese Attribute beeinflussen das Verhalten der aktuellen Schaltung.
So kann z.B. das Erscheiningsbild festgelegt werden, welche die Schaltung annimmt, wenn sie in andere
Schaltungen eingebettet wird. Diese Einstellungen werden in der aktuellen Schaltung gespeichert.
</string>
<string name="menu_editSettings">Einstellungen</string>
<string name="menu_editSettings_tt">Bearbeitet die globalen Einstellungen</string>
<string name="menu_editSettings_tt">Bearbeitet die globalen Einstellungen des Simulators. Hier können u.a.
Sprache, die zu verwendende Symbolform oder die Pfade externer Tools vorgegeben werden.
</string>
<string name="menu_element">Stoppen der Simulation</string>
<string name="menu_element_tt">Stoppt die Simulation und erlaubt das Bearbeiten der Schaltung.</string>
<string name="menu_elements">Bauteile</string>

View File

@ -1261,10 +1261,14 @@
<string name="menu_delete">Delete components</string>
<string name="menu_delete_tt">Delete selected single component or group of components.</string>
<string name="menu_edit">Edit</string>
<string name="menu_editAttributes">Edit circuit attributes</string>
<string name="menu_editAttributes_tt">These attributes effect the behavior if the circuit is included in other circuits.</string>
<string name="menu_editAttributes">Circuit specific settings</string>
<string name="menu_editAttributes_tt">These settings affect the behavior of the current circuit.
Thus, e.g. the appearance shape which the circuit assumes when embedded in other circuits.
These settings are stored in the current circuit.</string>
<string name="menu_editSettings">Settings</string>
<string name="menu_editSettings_tt">Edits Digitals preferences</string>
<string name="menu_editSettings_tt">Edits the global settings of the simulator.
Among other things, language, the symbol form to be used or the paths of external tools can be
specified here.</string>
<string name="menu_element">Stop Simulation</string>
<string name="menu_element_tt">Stops the simulation and allows to edits the circuit.</string>
<string name="menu_elements">Components</string>

View File

@ -16,6 +16,8 @@ import de.neemann.digital.draw.library.ElementLibrary;
import de.neemann.digital.draw.library.LibraryNode;
import de.neemann.digital.draw.library.NumStringComparator;
import de.neemann.digital.draw.shapes.ShapeFactory;
import de.neemann.digital.gui.Settings;
import de.neemann.digital.gui.components.CircuitComponent;
import de.neemann.digital.integration.Resources;
import de.neemann.digital.lang.Lang;
import de.neemann.gui.language.Language;
@ -30,6 +32,8 @@ import javax.xml.transform.*;
import javax.xml.transform.sax.SAXResult;
import javax.xml.transform.stream.StreamSource;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
@ -73,6 +77,17 @@ public class DocuTest extends TestCase {
.append("\" static=\"").append(new File(Resources.getRoot(), "docu/static_" + language + ".xml").toURI().toString())
.append("\" library=\"").append(libFile.toURI().toString())
.append("\">\n");
w.append(" <settings name=\"").append(Lang.get("menu_editSettings")).append("\">\n");
w.append(" <main name=\"").append(Lang.get("menu_editSettings")).append("\" descr=\"").append(Lang.get("menu_editSettings_tt")).append("\">\n");
writeAttributes(w, Settings.getInstance().getKeys());
w.append(" </main>\n");
w.append(" <circuit name=\"").append(Lang.get("menu_editAttributes")).append("\" descr=\"").append(Lang.get("menu_editAttributes_tt")).append("\">\n");
writeAttributes(w, CircuitComponent.getAttrList());
w.append(" </circuit>\n");
w.append(" </settings>\n");
ElementLibrary library = new ElementLibrary();
ShapeFactory shapeFactory = new ShapeFactory(library, language.equals("en"));
String actPath = null;
@ -114,22 +129,7 @@ public class DocuTest extends TestCase {
}
if (etd.getAttributeList().size() > 0) {
w.append(" <attributes name=\"").append(Lang.get("elem_Help_attributes")).append("\">\n");
for (Key k : etd.getAttributeList()) {
if (!k.isSecondary()) {
w.append(" <attr name=\"").append(escapeHTML(k.getName())).append("\">");
w.append(escapeHTML(k.getDescription()));
w.append("</attr>\n");
}
}
for (Key k : etd.getAttributeList()) {
if (k.isSecondary()) {
w.append(" <attr name=\"").append(escapeHTML(k.getName())).append("\">");
w.append(escapeHTML(k.getDescription()));
w.append("</attr>\n");
}
}
w.append(" </attributes>\n");
writeAttributes(w, etd.getAttributeList());
}
w.append(" </element>\n");
@ -138,6 +138,25 @@ public class DocuTest extends TestCase {
w.append("</root>");
}
private void writeAttributes(Writer w, List<Key> keyList) throws IOException {
w.append(" <attributes name=\"").append(Lang.get("elem_Help_attributes")).append("\">\n");
for (Key k : keyList) {
if (!k.isSecondary()) {
w.append(" <attr name=\"").append(escapeHTML(k.getName())).append("\">");
w.append(escapeHTML(k.getDescription()));
w.append("</attr>\n");
}
}
for (Key k : keyList) {
if (k.isSecondary()) {
w.append(" <attr name=\"").append(escapeHTML(k.getName())).append("\">");
w.append(escapeHTML(k.getDescription()));
w.append("</attr>\n");
}
}
w.append(" </attributes>\n");
}
private void writeSVG(File imageFile, VisualElement ve) throws IOException {
try (FileOutputStream out = new FileOutputStream(imageFile)) {
try (GraphicSVG svg = new GraphicSVGIndex(out, null, 20)) {

View File

@ -84,12 +84,17 @@
</fo:block>
<xsl:apply-templates select="document(@static)/*" mode="toc"/>
<fo:block margin-top="2mm" margin-bottom="2mm" font-weight="bold">
B <fo:inline padding-left="1mm"><xsl:value-of select="@components"/></fo:inline>
<fo:basic-link show-destination="replace" internal-destination="chap_settings">
B <fo:inline padding-left="2mm"><xsl:value-of select="settings/@name"/></fo:inline>
</fo:basic-link>
</fo:block>
<fo:block margin-top="2mm" margin-bottom="2mm" font-weight="bold">
C <fo:inline padding-left="1mm"><xsl:value-of select="@components"/></fo:inline>
</fo:block>
<xsl:apply-templates select="lib" mode="toc"/>
<fo:block margin-top="2mm" margin-bottom="2mm" font-weight="bold">
<fo:basic-link show-destination="replace" internal-destination="chap_library">
C <fo:inline padding-left="2mm"><xsl:value-of select="@lib"/></fo:inline>
D <fo:inline padding-left="2mm"><xsl:value-of select="@lib"/></fo:inline>
</fo:basic-link>
</fo:block>
<fo:block page-break-before="always"/>
@ -98,12 +103,18 @@
A <fo:inline padding-left="2mm"><xsl:value-of select="@general"/></fo:inline>
</fo:block>
<xsl:apply-templates select="document(@static)/*" mode="full"/>
<fo:block margin-top="4mm" margin-bottom="4mm" font-size="16pt" font-weight="bold" id="chap_settings">
B <fo:inline padding-left="2mm"><xsl:value-of select="settings/@name"/></fo:inline>
</fo:block>
<xsl:apply-templates select="settings" mode="full"/>
<fo:block page-break-before="always" margin-bottom="4mm" font-size="16pt" font-weight="bold">
B <fo:inline padding-left="2mm"><xsl:value-of select="@components"/></fo:inline>
C <fo:inline padding-left="2mm"><xsl:value-of select="@components"/></fo:inline>
</fo:block>
<xsl:apply-templates select="lib" mode="full"/>
<fo:block page-break-before="always" margin-bottom="4mm" font-size="16pt" font-weight="bold" id="chap_library">
C <fo:inline padding-left="2mm"><xsl:value-of select="@lib"/></fo:inline>
D <fo:inline padding-left="2mm"><xsl:value-of select="@lib"/></fo:inline>
</fo:block>
<xsl:apply-templates select="document(@library)/*"/>
<fo:block id="LastPage"/>
@ -255,6 +266,23 @@
</fo:table-row>
</xsl:template>
<xsl:template match="settings" mode="full">
<fo:block margin-top="4mm" margin-bottom="4mm" font-size="12pt" font-weight="bold">
<xsl:value-of select="main/@name"/>
</fo:block>
<fo:block>
<xsl:value-of select="main/@descr"/>
</fo:block>
<xsl:apply-templates select="main/attributes"/>
<fo:block margin-top="4mm" margin-bottom="4mm" font-size="12pt" font-weight="bold">
<xsl:value-of select="circuit/@name"/>
</fo:block>
<fo:block>
<xsl:value-of select="circuit/@descr"/>
</fo:block>
<xsl:apply-templates select="circuit/attributes"/>
</xsl:template>
<xsl:template match="lib" mode="full">
<fo:block page-break-after="avoid" margin-top="4mm" margin-bottom="4mm" font-size="16pt" font-weight="bold">
<xsl:value-of select="position()"/>. <xsl:value-of select="@name"/>