HenriAugusto / completion-plugin

Completion for Pure Data
BSD 3-Clause "New" or "Revised" License
19 stars 1 forks source link

Request: access help-patches through the drop-down menu #3

Open LGoodacre opened 5 years ago

LGoodacre commented 5 years ago

Would it be possible to allow the user to call a help-patch from the drop-down menu? I'm not sure how much work it would be, but it would be a really great feature if you could get it to work. Maybe if you right click on a menu item it could call the help-patch?

HenriAugusto commented 5 years ago

I think it would be possible but right now i can't get any modifier+click shortcut to work. Probably something to do with the tk/tcl's default input mappings.

Right know the plugin is rather minimal. Mostly i'm thinking about using shif/ctrl/alt+enter for basic functionality. And shift+enter is already taken so i have only 2 more shortcuts.

Just for curiosity, why do that instead of creating the object itself and accessing it's help file from the menu? Or autocomplete the object and type "-help" after it to create the help patch.

LGoodacre commented 5 years ago

I suppose that loading helpfiles would be useful for more or less the same reasons that the main function of the plugin is useful: it speeds things up. I was also specifically thinking that it might become more useful than the help browser for searching for objects (especially for new users).

LGoodacre commented 5 years ago

Having said this, it's clearly not a critical issue.

HenriAugusto commented 5 years ago

Hmm. I see.

While that might save two clicks when you want to create a help file you will get double your results on the completion list wich halves the amount of different suggestions you actually see on the screen.

How having the help files displayed would be better for having a list of objects? You mean a better alternative to the one you open with Ctrl+B or the one you open right clicking in an empty space and selecting help?

LGoodacre commented 5 years ago

I agree that having two entries for every object would be a terrible waste of space. I was thinking instead that you could launch the help file from the same menu, either by right clicking, or shift clicking on the same entry, or something else.

I was thinking that this would be a nice improvement on the browser you get with Ctrl+B. Back in the days of Extended, the help browser was searchable, which was tremendously helpful for new users especially. Now it's not searchable any more, but your tool could serve the same function. Like I say, it's not critical though.

HenriAugusto commented 4 years ago

Maybe if your search starts with h: when you select an entry it would open the help patch.

Edit:

Another idea would be to let the user configure the actions of shift+enter and ctrl+enter. One of the possible actions could be opening the help patch of selected obj.

(I'm didn't test yet but from the code review I've made a while ago i think using Alt shortcuts is very tricky)

One interesting problem is: some completions are not objects, like the ones defined in ./custom_completions. The plugin should be able to determine which completions are objects and which are not 🤔

would it be too bad to let this task to the user?

HenriAugusto commented 4 years ago

Although for .pd files it would be easy enough to open the help file "manually" using the paths stored in the plugin the best way is using the same code as the .popup. Not only it's more maintainable but it allows for opening the help patch of any external.

An example of the the relevant message is located in pdtk_canvas.tcl

proc ::pdtk_canvas::done_popup {mytoplevel action} {
    pdsend "$mytoplevel done-popup $action $::popup_xcanvas $::popup_ycanvas"
}

For our case the action argument is going to be 2 (as you can see looking in ::pdtk_canvas::create_popup)

If i recall correctly the x and y coordinates are already queried by the plugin in the variables ::editx and ::edity

One problem of this approach is that we actually need to create the object to open it's help patch so we can not open the help patch directly.