Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend plugin API to allow contextual menus on waypoints, routes, tracks and AIS targets, #3586

Open
antipole2 opened this issue Jan 12, 2024 · 4 comments

Comments

@antipole2
Copy link

Presently, the plugin APIs allow a plugin to create, act on and remove additional menu items to the canvas contextual menu.
This works well and is really useful. For example, in JavaScript you can use this to create a boundaried area.

Please can we have the ability to do these for other contexts such as waypoint, route, track and AIS target? This would open up great possibilities for custom actions on these objected. As an example, it would be possible to have a custom action on an AIS target such as making a DSC call, collision avoidance calculations, logging details etc.

@Graham48
Copy link

I would second that as a very useful addition.
It may also be good to be able to add to the menu at the top if it's a temporary context...

@antipole2
Copy link
Author

In my recently published PointUtility script the user needs to select a waypoint. This is impossible at the moment. The script has to search through all waypoints working out which is the nearest. This is just one example of why this enhancement is needed.

@bdbcat
Copy link
Member

bdbcat commented Apr 6, 2024

Tony...
Suggest some API function prototypes, and we can talk about it.

@antipole2
Copy link
Author

Dave... the APIs I use are

  • AddCanvasContextMenuItem(wxMenuItem *pitem, opencpn_plugin *pplugin);
  • RemoveCanvasContextMenuItem( int item);
  • OnContextMenuItemCallback(int menuID)

The cleanest way forward could be to provide their equivalents for each of waypoints, routes and tracks, i.e.

  • AddWaypointContextMenuItem(wxMenuItem *pitem, opencpn_plugin *pplugin);
  • RemoveWaypointContextMenuItem( int item);
  • OnWaypointMenuItemCallback(int menuID)

I do not use the set viz and set grey options. I just remove the menu item when not applicable.

The above would be great.

This is how the canvas context menu looks when the PointUtility script is running
contextMenu
Copy mark would be moved to the waypoint context menu where it belongs.

Some of the ideas I am toying with might need a lot of menu items.
I have been reflecting on how it would be great if we could create sub-menus. This may be too much at this time, but while you are in there, perhaps you could think about this.

Thank you for looking at this RFE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants