trunk: swatches are duplicated again on paste and import (rev >= 13139)
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Inkscape |
Fix Released
|
Medium
|
David Mathog |
Bug Description
It should be possible to re-use the same swatches
- within the same document on copy & paste,
- across multiple documents on paste or import,
without them getting duplicated on import/paste.
1 -- changed behavior with rev >= 13139:
Steps to reproduce with multiple documents:
1) launch current trunk (default (new) prefs, default doc)
2) draw a rectangle (blue fill, black stroke)
3) open 'Fill & Stroke', convert to swatch
4) give the blue swatch a unique name
5) save as 'myswatch-orig.svg'
6) draw a circle (red fill, black stroke)
7) open 'View > Swatches' and apply the blue swatch as fill to the circle
8) delete the rectangle
9) save as 'myswatch-copy.svg'
a) copy & paste across documents:
10) open 'myswatch-orig.svg'
11) open 'myswatch-copy.svg'
12) copy the blue circle in 'myswatch-copy.svg'
13) paste the clipboard content in 'myswatch-orig.svg'
14) open 'Fill &Stroke' and check how many swatches are defined and in use
b) import document:
10) open 'myswatch-orig.svg'
11) import 'myswatch-copy.svg'
12) open 'Fill &Stroke' and check how many swatches are defined and in use
Expected result:
The pasted (or imported) object(s) with the same swatch (name) as already exists in the current document shares the existing definition.
Actual result:
The swatch of pasted (or imported) object(s) is added as a copy of the already existing swatch with the same name.
2 -- Additional changes with rev >= 13145:
Steps to reproduce (basic):
1) launch current trunk (default (new) prefs, default doc)
2) draw a rectangle (blue fill, black stroke)
3) open 'Fill & Stroke', convert to swatch
5) copy & paste the rectangle
6) open 'Fill &Stroke' and check how many swatches are defined and in use
Expected: 1 swatch, used 2x
Actual: 2 swatches, each used 1x
If multiple objects with the same swatch are pasted from the clipboard into a document which already has the same swatch definition as used by the objects on the clipboard, then for each inserted copy a new swatch is created (rev > 13145), though it is not referenced by any object.
Based on tests with archived builds on OS X 10.7.5
- not reproduced with rev <=13138,
- reproduced with rev >= 13139;
this change of behavior is related to the changes from revision 13139 and 13145:
<http://
<http://
Changed in inkscape: | |
status: | New → Confirmed |
importance: | Undecided → Medium |
Changed in inkscape: | |
status: | Confirmed → In Progress |
assignee: | nobody → David Mathog (mathog) |
Changed in inkscape: | |
status: | Fix Committed → Fix Released |
This patch works on my system.
The bigger issue is that Swatches are kind of strange. They seem to be a type of gradient with no stops. I don't know if that is generally true, but it was true for the test case. If it is not generally true this patch will not work in those cases. Moreover, while there are "what is this?" tests like this:
SP_IS_LINEARGRA DIENT(this) DIENT(this) ENT(this)
SP_IS_RADIALGRA
SP_IS_MESHGRADI
for other types of gradients there is no
SP_IS_SWATCH(this)
so the patch tests for gradients that have no stops and if it sees that assumes they are swatches. For all I know the code might use a radial gradient with no stops for something different than a lineargradient with no stops, which will break this section of code again.