Hot Door CORE Forum

Full Version: working with tool "sets"
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm working on a plugin with five tools, which could easily share some of the callbacks that test what's under the cursor and change the cursor accordingly (each of the five tools has three cursors). I had expected to find a tool function to return the currently selected tool, but found:

virtual AIToolHandle aiToolHandle () const
Gets the tool handle around which the target object is wrapped.

I don't think this is what I'm looking for, but am puzzled and curious about what the description means.

That said, I imagine the best way to handle keeping track of the current tool is to just set a variable to keep track as tools are selected and deselected. Or is it not recommended practice to have different tools share a common callback?
There's no problem with various objects sharing callbacks, we do that in lots of places in our projects.

The method you're looking for is hdi::core:Tonguelugin::currentTool()

And, as the notes for the hdi::core::Tool::aiToolHandle() method state, you needn't worry about those internal data accessors (the vast majority of the time). The goal of CORE is to provide classes that wrap around Illustrator's objects/data/etc. and expose their functionality, and needing to access those internals runs counter to the goal. If something can be done with that internal data that is "typical", then that functionality should already be present in CORE or added if it isn't.