Difference between revisions of "SymbolsDialog"
m (Fix markup ordering from my last edit (pre/code to code/pre)) |
|||
(3 intermediate revisions by 2 users not shown) | |||
Line 4: | Line 4: | ||
== Features == | == Features == | ||
Allows copying and pasting symbols (<symbol> elements) from both the document being edited and from symbol libraries. | Allows copying and pasting symbols (<code><symbol></code> elements) from both the document being edited and from symbol libraries. | ||
== Use == | == Use == | ||
* Open ''Symbol dialog'': | * Open ''Symbol dialog'': | ||
** Object | ** Object ▶︎ Symbol dialog..., or | ||
** Ctrl-Shift-Y. (Note, the shortcut was used for Edit | ** <kbd>Ctrl-Shift-Y</kbd>. (Note, the shortcut was used for Edit ▶︎ Undo. I am guessing that this shortcut is pretty unused.) | ||
* Select symbol set | * Select symbol set | ||
Line 17: | Line 17: | ||
* Copy and paste by | * Copy and paste by | ||
** Click on symbol to copy to clipboard | ** Click on symbol to copy to clipboard | ||
** Paste (Ctrl-V) to document. | ** Paste (<kbd>Ctrl-V</kbd>) to document. | ||
== Symbol Libraries == | == Symbol Libraries == | ||
Symbol libraries are sets of symbols located in one SVG document. Inkscape will look for libraries in the ''share/symbols'' directories (both system and personal). Any <symbol> elements defined in the <defs> section will be picked up. (<symbol> elements are allowed anywhere in an SVG document according to the spec, but Inkscape seems to have some trouble if they are not in the <defs> section.) | Symbol libraries are sets of symbols located in one SVG document. Inkscape will look for libraries in the ''share/symbols'' directories (both system and personal). Any <code><symbol></code> elements defined in the <code><defs></code> section will be picked up. (<code><symbol></code> elements are allowed anywhere in an SVG document according to the spec, but Inkscape seems to have some trouble if they are not in the <code><defs></code> section.) | ||
Note that since a symbol library is an ordinary SVG file, one can also include documentation and/or sample diagrams in the same file. | |||
There are two sample sets of symbols, one with Logic symbols and with AIGA/DOT transportation symbols. | |||
=== Symbols and Styles === | |||
In order to allow styling of symbols from within Inkscape, styling should be kept out of <code><symbol></code> elements as much as possible. It is then possible for a symbol to inherit the styling of the <code><use></code> element that references it. In order to provide a default style to a <code><symbol></code> one can either provide a general default style in the root <svg> element of the library or add a symbol specific default style by putting a style string in the <code>inkscape:symbol-style</code> attribute inside the <code><symbol></code> element. When a symbol is selected in the Symbol dialog, the style will be added to the <code><use></code> element in the clipboard. | |||
=== Other Sources of Symbols === | |||
Visio stencil files (<code>.vss</code>) can also be used as a source of symbols by dropping the files into the ''share/symbols'' directory (if libvisio has been linked in). | |||
== Editing Symbols == | == Editing Symbols == | ||
=== Original Draft & Implementation === | |||
Two commands are available to allow editing of symbols from within Inkscape: | Two commands are available to allow editing of symbols from within Inkscape: | ||
* '''Object | * '''Object ▶︎ Symbol to Group''': | ||
This converts the <code><symbol></code> referenced by the selected <code><use></code> element to a group located in the untransformed position of the symbol. The new group is left selected. Any <code><use></code> element (clone) that referenced the symbol should be left referencing the group. No default styling is applied to the group itself (since there is no <code><use></code> element to inherit it from). | |||
* '''Object ▶︎ Group to Symbol''' | |||
This converts | This converts a selected group to a <code><symbol></code> element. No <code><use></code> element is created. Any <code><use></code> elements that referenced the group will now reference the symbol. The new symbol can be selected in the Symbol dialog in the ''Current Document'' Symbol set. (You may need to unselect and then reselect the ''Current Document'' set to get the symbol to show.) | ||
A lot of alternative ways were tried to be able to round-trip symbols to groups and back. This method seemed the most straightforward and avoids issues with transforms and styling. | |||
Copying (<kbd>Ctrl-C</kbd>) and then pasting a symbol, or duplicating a symbol creates a new <code><use></code> element (clone) referencing the same symbol. | |||
To copy a <code><symbol></code> for creating a new <code><symbol></code>, first convert the symbol to a group, copy the group, edit the copied group, and convert both groups back to symbols (give the new group useful <code>id</code> and <code>title</code> attributes via the Object Properties dialog). | |||
=== Current implementation in 0.91 === | |||
The implementation of this feature was later changed (TODO: update with detailed description for current status in 0.91 - Bug #[https://bugs.launchpad.net/inkscape/+bug/1419345 1419345]). | |||
== Bugs/Issues == | == Bugs/Issues == | ||
Line 61: | Line 71: | ||
== Future Enhancements == | == Future Enhancements == | ||
* Generic symbols: It should be possible to extend the Symbol dialog to include <g> elements as well as <symbol> elements. A group could be marked as a symbol by adding an | * Generic symbols: It should be possible to extend the Symbol dialog to include <code><g></code> elements as well as <code><symbol></code> elements. A group could be marked as a symbol by adding an <code><inkscape:symbol></code> tag. In this way one can put place holders in for things like text: | ||
<pre> | <code><pre> | ||
<g role="inkscape:symbol"> | <g role="inkscape:symbol"> | ||
<symbol id="wrapperBox">...</symbol> | <symbol id="wrapperBox">...</symbol> | ||
<text id="label">...</text> | <text id="label">...</text> | ||
</g> | </g> | ||
</pre> | </pre></code> | ||
* Connectors: Symbols beg for the use of connectors. It would be easy to define connection points inside a symbol. The Logic symbols include extra nodes to make snapping of input/output lines to the correct places easier. These nodes would be better defined as connection points. Work on an [http://dev.w3.org/SVG/modules/connector/SVGConnector.html SVG Connector] proposal is in progress. | * Connectors: Symbols beg for the use of connectors. It would be easy to define connection points inside a symbol. The Logic symbols include extra nodes to make snapping of input/output lines to the correct places easier. These nodes would be better defined as connection points. Work on an [http://dev.w3.org/SVG/modules/connector/SVGConnector.html SVG Connector] proposal is in progress. | ||
[[Category:Dialogs]] | [[Category:Dialogs]] |
Latest revision as of 17:40, 15 January 2017
Symbols Dialog
Features
Allows copying and pasting symbols (<symbol>
elements) from both the document being edited and from symbol libraries.
Use
- Open Symbol dialog:
- Object ▶︎ Symbol dialog..., or
- Ctrl-Shift-Y. (Note, the shortcut was used for Edit ▶︎ Undo. I am guessing that this shortcut is pretty unused.)
- Select symbol set
- Drag and drop symbol into document, or
- Copy and paste by
- Click on symbol to copy to clipboard
- Paste (Ctrl-V) to document.
Symbol Libraries
Symbol libraries are sets of symbols located in one SVG document. Inkscape will look for libraries in the share/symbols directories (both system and personal). Any <symbol>
elements defined in the <defs>
section will be picked up. (<symbol>
elements are allowed anywhere in an SVG document according to the spec, but Inkscape seems to have some trouble if they are not in the <defs>
section.)
Note that since a symbol library is an ordinary SVG file, one can also include documentation and/or sample diagrams in the same file.
There are two sample sets of symbols, one with Logic symbols and with AIGA/DOT transportation symbols.
Symbols and Styles
In order to allow styling of symbols from within Inkscape, styling should be kept out of <symbol>
elements as much as possible. It is then possible for a symbol to inherit the styling of the <use>
element that references it. In order to provide a default style to a <symbol>
one can either provide a general default style in the root <svg> element of the library or add a symbol specific default style by putting a style string in the inkscape:symbol-style
attribute inside the <symbol>
element. When a symbol is selected in the Symbol dialog, the style will be added to the <use>
element in the clipboard.
Other Sources of Symbols
Visio stencil files (.vss
) can also be used as a source of symbols by dropping the files into the share/symbols directory (if libvisio has been linked in).
Editing Symbols
Original Draft & Implementation
Two commands are available to allow editing of symbols from within Inkscape:
- Object ▶︎ Symbol to Group:
This converts the <symbol>
referenced by the selected <use>
element to a group located in the untransformed position of the symbol. The new group is left selected. Any <use>
element (clone) that referenced the symbol should be left referencing the group. No default styling is applied to the group itself (since there is no <use>
element to inherit it from).
- Object ▶︎ Group to Symbol
This converts a selected group to a <symbol>
element. No <use>
element is created. Any <use>
elements that referenced the group will now reference the symbol. The new symbol can be selected in the Symbol dialog in the Current Document Symbol set. (You may need to unselect and then reselect the Current Document set to get the symbol to show.)
A lot of alternative ways were tried to be able to round-trip symbols to groups and back. This method seemed the most straightforward and avoids issues with transforms and styling.
Copying (Ctrl-C) and then pasting a symbol, or duplicating a symbol creates a new <use>
element (clone) referencing the same symbol.
To copy a <symbol>
for creating a new <symbol>
, first convert the symbol to a group, copy the group, edit the copied group, and convert both groups back to symbols (give the new group useful id
and title
attributes via the Object Properties dialog).
Current implementation in 0.91
The implementation of this feature was later changed (TODO: update with detailed description for current status in 0.91 - Bug #1419345).
Bugs/Issues
- Full list of Symbols Bugs: Launchpad Bug List
- Switching Desktop should switch Document Symbol set. (At the moment this is not an issue as each desktop gets its own Symbol dialog.)
- Symbol to Group/Group to Symbol should trigger an update to the symbols shown in the Symbol dialog when symbol set Current Document is selected.
- Editing a symbol should result in updating the image in the Symbol's dialog.
- Symbols have not been tested well inside Inkscape.
- Symbols referring to external elements (gradients, etc.) probably won't work.
- Symbols can have their own viewbox, this has not been tested.
Future Enhancements
- Generic symbols: It should be possible to extend the Symbol dialog to include
<g>
elements as well as<symbol>
elements. A group could be marked as a symbol by adding an<inkscape:symbol>
tag. In this way one can put place holders in for things like text:
<g role="inkscape:symbol">
<symbol id="wrapperBox">...</symbol>
<text id="label">...</text>
</g>
- Connectors: Symbols beg for the use of connectors. It would be easy to define connection points inside a symbol. The Logic symbols include extra nodes to make snapping of input/output lines to the correct places easier. These nodes would be better defined as connection points. Work on an SVG Connector proposal is in progress.