ClipboardManagerImpl::getFirstObjectID restricted to very few object types

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

ClipboardManagerImpl::getFirstObjectID restricted to very few object types

Inkscape - Dev mailing list
Dear Inkscape Team,

I try to make my bool LPE work with any objects, not just paths. I got
around most issues (like getting a PathVector from an SPItem), but I am
lost with ClipboardManagerImpl::getFirstObjectID which is used by
OriginalItemParam. It is restricted to very few object types
(g,path,use,text,image,rect). Since the clipboard is used to set the
operand path of the LPE, it is restricted to these types.

Is there a good reason for this restriction or is this a bug / non
feature? What would be an appropriate SVG tag list?

This function seems to be used only in very few places, so I guess it
wouldn't do a lot of harm to fix it? Would there be a better
implementation than checking for a list of literal SVG types?

Btw.: Is the LPE parameter type OriginalItemParam / ItemParam
operational or is this beta code I shouldn't use?

Best regards,

Michael

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Inkscape-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/inkscape-devel
Reply | Threaded
Open this post in threaded view
|

Re: ClipboardManagerImpl::getFirstObjectID restricted to very few object types

Inkscape - Dev mailing list
Dear Inkscape Team,

I solved the issue with getFirstObjectID by replacing it with
getShapeOrTextObjectId in ItemParam::on_link_button_click(). This works
as expected. I think ClipboardManagerImpl::getFirstObjectID should be
removed. It is only used in one other place (ObjectSet::relink()) and
likely doesn't do much good there either.

Best regards,

Michael

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Inkscape-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/inkscape-devel
Reply | Threaded
Open this post in threaded view
|

Re: ClipboardManagerImpl::getFirstObjectID restricted to very few object types

Jabier Arraiza
In reply to this post by Inkscape - Dev mailing list
Hi Michael:

On Sun, 2017-06-25 at 12:30 +0200, Michael Soegtrop via Inkscape-devel
wrote:
> Dear Inkscape Team,
>
> I try to make my bool LPE work with any objects, not just paths. I
> got
> around most issues (like getting a PathVector from an SPItem), but I
> am

SPCurve *c = NULL;
c = shape_origin->getCurve();
if (c) {
        Geom::PathVector c_pv = c->get_pathvector();                 
}

Also you can get the "d" attribute from repr and parse it

> ClipboardManagerImpl::getFirstObjectID which is used by
> OriginalItemParam. It is restricted to very few object types
> (g,path,use,text,image,rect). Since the clipboard is used to set the
> operand path of the LPE, it is restricted to these types.
>
> Is there a good reason for this restriction or is this a bug / non
> feature? What would be an appropriate SVG tag list?
>
> This function seems to be used only in very few places, so I guess it
> wouldn't do a lot of harm to fix it? Would there be a better
> implementation than checking for a list of literal SVG types?
>
> Btw.: Is the LPE parameter type OriginalItemParam / ItemParam
> operational or is this beta code I shouldn't use?

Not sure if I undertand but getFirstObjectID need to get from any type
item you have on clipboard not a reduced list

> Best regards,
>
> Michael
>
> -------------------------------------------------------------------
> -----------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Inkscape-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/inkscape-devel

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Inkscape-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/inkscape-devel
Reply | Threaded
Open this post in threaded view
|

Re: ClipboardManagerImpl::getFirstObjectID restricted to very few object types

Jabier Arraiza
In reply to this post by Inkscape - Dev mailing list
I think is better retain first function and add a item switch for text

On Sun, 2017-06-25 at 13:44 +0200, Michael Soegtrop via Inkscape-devel
wrote:

> Dear Inkscape Team,
>
> I solved the issue with getFirstObjectID by replacing it with
> getShapeOrTextObjectId in ItemParam::on_link_button_click(). This
> works
> as expected. I think ClipboardManagerImpl::getFirstObjectID should be
> removed. It is only used in one other place (ObjectSet::relink()) and
> likely doesn't do much good there either.
>
> Best regards,
>
> Michael
>
> -------------------------------------------------------------------
> -----------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Inkscape-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/inkscape-devel

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Inkscape-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/inkscape-devel
Reply | Threaded
Open this post in threaded view
|

Re: ClipboardManagerImpl::getFirstObjectID restricted to very few object types

Inkscape - Dev mailing list
Dear Jabier,

> I think is better retain first function and add a item switch for text

What would be the advantage of using ClipboardManagerImpl::getFirstObjectID?

Best regards,

Michael



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Inkscape-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/inkscape-devel
Reply | Threaded
Open this post in threaded view
|

Re: ClipboardManagerImpl::getFirstObjectID restricted to very few object types

Jabier Arraiza
Is not constrained by the type of element.

On Sun, 2017-06-25 at 21:44 +0200, Michael Soegtrop wrote:

> Dear Jabier,
>
> > I think is better retain first function and add a item switch for
> > text
>
> What would be the advantage of using
> ClipboardManagerImpl::getFirstObjectID?
>
> Best regards,
>
> Michael
>
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Inkscape-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/inkscape-devel

signature.asc (849 bytes) Download Attachment