Redefine the SelectTool cursor

Oh I replied to this comment here Redefine the SelectTool cursor

Yes. You need to set self.keyboardShortcut in the setting method of you plugin. It was missing in the plugin example.

Hey Georg, that wasn’t the question I’ll post it here :slight_smile:

Also anyone have any idea why the color changes from purple to red depending on how far I’m zoomed in, it should be red all the time, the RGBs are (0.5, 0, 0, 0.4)

http://quick.as/5OYDT1J1V

Same with any colors defined like this, it’s always somehow off


Edit, actually might be hardware problem? Screen recorder is showing it the right color, but the red is rendering as purple up until a certain zoom before it becomes red, and the green, is more blue before becoming green at a certain zoom. It seems as if there’s too much blue somehow?

That sounds indeed like a hardware problem. Try a different color profile in display settings.

How can I set the cursor in a reporter plugin? I just don’t really understand which graphicView is what. I tried to set it to the activeEditViewController().contentView(), its enclosingScrollView(), the contentView(), etc. In which ever view I try to print the default cursor, I just get None, which tells me that I am not looking in the correct view.

Once I know which view I need, I can do the rest myself. Or if it needs to be set to the documentCursor, then how, please? This doesn’t do anything in a reporter:

def standardCursor(self):
    return NSCursor.crosshairCursor()

this should work. what view is not important, you just need to get to the right scrollview.

activeEditViewController.contentView().enclosingScrollView().setDocumentCursor_(cursor)

Okay, thank you! Since you confirmed what I already had, I tried again in another spot where it indeed works. It just does nothing inside of my MOUSEMOVED notification (even though the notification is intact). So I just try to fire the cursor change in a different way then. Thank you @GeorgSeifert :slight_smile:

Glyphs set the cursor in the mouseMove method itself. So you change seems to come first. You could try to delay the setting through `performSelector_withObject_afterDelay_(“setCursor_”, cursor, 0.0)```
this will run the code in the next run loop. But that might result in a great flicker.

It seems that I need to add an API for it.

This sounds also cool.

What I did and what works is a toggle variable. Inside of the mousemoved I got another condition. This one sets the toggler to true, and in the foreground method I ask for this toggler’s state. No flickering and it seems to not slow anything down.

I’ll play around with your suggestion, too. But don’t rush with implementing it, I got it working. Thank you again! You’re the best.

I wonder how to keep the select tool behaviour when making a custom Glyphs Tool Plugin in objective-c

I manage to draw and get the mouse events, as well as having the temp tool. but what I cannot figure out is
a) How to be able to select and move elements with the own tool active?
b) how to keep the drawing when the temp tool is acitve (e.g. command key).

Somehow I want it to behave like a reporter, but since I got dragging operations, I really hate that I cannot override the selection marquee rect there.

Again, some little bricks that I need to fully understand the API in obj-c, soon I’ll shut my mouth. I’m already pretty far into it :slight_smile:

You might have a look at the plugins.py file from the wrapper. There you see all the API you need to have. And there are some protocols in the core docs that should have all the pieces.

1 Like

Looks like there is nothing that I haven’t already seen in the Xcode templates and by clicking myself through the definitions of the methods and types there :confused:

I don’t understand. I started a Select Tool from a template and it doesn’t do any selection at all. After digging the forum and some python plugins I saw the selectAtPoint_withModifier_, selectInRect_withModifier_, drawSelection and similar methods, but all one can read here about them is that you need to override them if you don’t want them to do their job. But I just want them to work, as well as the usual path operations. It seems that the Select Tool disables everything the user do with the layer.

*) working in objective-c, so I tried to apply/call/override the methods mentioned above not in python syntax, of course :slight_smile: