<div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Hi, Kuntal!</div><div><br></div><br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Path selection tool rather follows a different implementation, starts<br>
the same by creating a local tool which inherits the KoCreatePathTool,<br>
which is then passed down to the KisDelegatedTool with local tool as<br>
delgate, then there is a wrapper around the delegated tool. The wrapper<br>
gets inherited by KisSelectToolBase, used to implement the corresponding<br>
selection tool just like the previous one.<br></blockquote><div><br></div><div>Yes, there is a tricky way to inherit from the tools. Ideally, we should have used something like "strategy" design pattern [0] for these tools, but something went wrong :) And in the end we use another tool as a strategy. It is done to avoid duplicating bezier curves functionality.</div><div><br></div><div>Whether or not to use this "third" way is actually depends on whether you tool will generate  bezier curves. If you are going to have bezier curves, then you should reuse the code from KoCreatePathTool. How to use it? This decision is up to you. You can either reuse it in the current (not very pretty approach) or just refactor the base tool into some kind of strategy that will be reused by both KisToolPath and your tool. <br></div><div></div><div><br></div><div>[0] - <a href="https://en.wikipedia.org/wiki/Strategy_pattern">https://en.wikipedia.org/wiki/Strategy_pattern</a><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">

The previous attempt to restore the Magnetic Lasso followed the third<br>
approach, which I don't think _if_ broken should be followed. So taking<br>
the fact the tool will work the following way,<br></blockquote><div><br></div><div>Well, the requirement is not "use this way like here", but "ensure that the code from KoCreatePathTool is not duplicated" :)<br></div><br clear="all"></div><br>-- <br><div dir="ltr" class="gmail_signature">Dmitry Kazakov</div></div></div>