Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ImportedProjects
SVG
Commits
29a3026e
"Source/External/vscode:/vscode.git/clone" did not exist on "9fc47d84a1db96aa9d4cad6f5d699646ef7aa765"
Commit
29a3026e
authored
Dec 05, 2013
by
Tebjan Halm
Browse files
implemented insert for SvgElementCollection
parent
2bfed054
Changes
1
Show whitespace changes
Inline
Side-by-side
Source/SvgElementCollection.cs
View file @
29a3026e
...
@@ -53,7 +53,14 @@ namespace Svg
...
@@ -53,7 +53,14 @@ namespace Svg
/// <param name="item">The <see cref="SvgElement"/> to be added.</param>
/// <param name="item">The <see cref="SvgElement"/> to be added.</param>
public
void
Insert
(
int
index
,
SvgElement
item
)
public
void
Insert
(
int
index
,
SvgElement
item
)
{
{
InsertAddAndFixID
(
index
,
item
,
false
,
false
);
}
public
void
InsertAddAndFixID
(
int
index
,
SvgElement
item
,
bool
autoFixID
=
true
,
bool
autoFixChildrenID
=
true
,
Action
<
SvgElement
,
string
,
string
>
logElementOldIDNewID
=
null
)
{
AddToIdManager
(
item
,
autoFixID
,
autoFixChildrenID
,
logElementOldIDNewID
);
this
.
_elements
.
Insert
(
index
,
item
);
this
.
_elements
.
Insert
(
index
,
item
);
item
.
_parent
.
OnElementAdded
(
item
,
index
);
}
}
public
void
RemoveAt
(
int
index
)
public
void
RemoveAt
(
int
index
)
...
@@ -78,6 +85,13 @@ namespace Svg
...
@@ -78,6 +85,13 @@ namespace Svg
}
}
public
void
AddAndFixID
(
SvgElement
item
,
bool
autoFixID
=
true
,
bool
autoFixChildrenID
=
true
,
Action
<
SvgElement
,
string
,
string
>
logElementOldIDNewID
=
null
)
public
void
AddAndFixID
(
SvgElement
item
,
bool
autoFixID
=
true
,
bool
autoFixChildrenID
=
true
,
Action
<
SvgElement
,
string
,
string
>
logElementOldIDNewID
=
null
)
{
AddToIdManager
(
item
,
autoFixID
,
autoFixChildrenID
,
logElementOldIDNewID
);
this
.
_elements
.
Add
(
item
);
item
.
_parent
.
OnElementAdded
(
item
,
this
.
Count
-
1
);
}
private
void
AddToIdManager
(
SvgElement
item
,
bool
autoFixID
=
true
,
bool
autoFixChildrenID
=
true
,
Action
<
SvgElement
,
string
,
string
>
logElementOldIDNewID
=
null
)
{
{
if
(!
this
.
_mock
)
if
(!
this
.
_mock
)
{
{
...
@@ -85,7 +99,7 @@ namespace Svg
...
@@ -85,7 +99,7 @@ namespace Svg
{
{
this
.
_owner
.
OwnerDocument
.
IdManager
.
AddAndFixID
(
item
,
autoFixID
,
logElementOldIDNewID
);
this
.
_owner
.
OwnerDocument
.
IdManager
.
AddAndFixID
(
item
,
autoFixID
,
logElementOldIDNewID
);
if
(!(
item
is
SvgDocument
))
//don't add subtree of a document to parent document
if
(!(
item
is
SvgDocument
))
//don't add subtree of a document to parent document
{
{
foreach
(
var
child
in
item
.
Children
)
foreach
(
var
child
in
item
.
Children
)
{
{
...
@@ -96,10 +110,6 @@ namespace Svg
...
@@ -96,10 +110,6 @@ namespace Svg
item
.
_parent
=
this
.
_owner
;
item
.
_parent
=
this
.
_owner
;
}
}
item
.
_parent
.
OnElementAdded
(
item
,
this
.
Count
-
1
);
this
.
_elements
.
Add
(
item
);
}
}
public
void
Clear
()
public
void
Clear
()
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment