Board index FlightGear Development Canvas

Garmin GPSmap196

Canvas is FlightGear's new fully scriptable 2D drawing system that will allow you to easily create new instruments, HUDs and even GUI dialogs and custom GUI widgets, without having to write C++ code and without having to rebuild FlightGear.

Re: Garmin GPSmap196

Postby Hooray » Sat May 17, 2014 5:46 pm

right - but no hurry, I also didn't expect it to be so difficult to be honest, my Nasal experiments were pretty convoluted and embarrassing, too.
We don't have any good solution for the concept of "optional expiration" - despite having listeners, timers and even simulation time. So I had to use a combination of those.

On the C++/osgGA side, the mouse-dragging code could contain some hints ?
We could probably make it a separate event type, analogous to how clicks and button down/up events are tracked separately, for instance we could provide support for optional "timeout" parameters that are invoked if the mouse down event is held for a certain duration, so that the corresponding Nasal callback gets invoked that way, so that you can pass the usual data structure ?
Code: Select all
canvas_element.addEventListener(event:"mousedown", callback:foo, expire_after:3.0, expiry_callback:bar );

or really a new event type for "button held" + duration:
Code: Select all
canvas_element.addEventListener(event:"buttonheld", duration:3.0, callback:myCallback );
canvas_element.addEventListener(event:"click", callback:clickhandler );


that should not collide - internally, the "buttonheld" event would be a "mousedown" event that triggers an expiring timer (event_mgr) or registers a callbacks that check "duration" seconds later if the button is still held.

Separate events looks cleaner to me - but the problem is, we'll still need Nasal workarounds, because even if Canvas would support this, the <mod-up> stuff would also need updating, too
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: Garmin GPSmap196

Postby Philosopher » Sat May 17, 2014 6:56 pm

I have a nasal solution to essentially the same problem (plus a few extra goodies), but I have to get the Gitorious clone up again... Anyhow, it uses settimer() and some mod-up mod-down events to work, and it does work pretty well (for holding, double-pressing, regular events, etc...). Just if you want to do that - I agree C++ should work here too canvas-wise.
Philosopher
 
Posts: 1593
Joined: Sun Aug 12, 2012 7:29 pm

Re: Garmin GPSmap196

Postby Hooray » Sat May 17, 2014 7:09 pm

right, your JS stuff ?
If possible, I would prefer to see the C++ side extended accordingly, ideally not just Canvas but also the cockpit stuff - i.e. some generic solution would be useful here.
I had to use quite a few layers of indirection to make it work, and was very surprised seeing that it took me a few iterations that get right at all :-)

PS: we may want to extend the canvas dialog style to also show a "maximize" button (optionally) so that we can maximize such dialogs more easily
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: Garmin GPSmap196

Postby flyingfisch » Sat May 24, 2014 3:27 am

The wiki page says inkscape artists are needed? What pictures do you guys need?
Beechcraft A35 Bonanza
Wiki Page
GitHub Repo
Improving the 737-300
Forum Thread
All my projects
User avatar
flyingfisch
 
Posts: 306
Joined: Mon Oct 07, 2013 2:11 pm
IRC name: ffisch
Version: 3.0
OS: Ubuntu 12.04

Re: Garmin GPSmap196

Postby Hooray » Sat May 24, 2014 10:20 am

it would be helpful to download the GPSMap196 manual from the garmin website and then coordinate things with F-JJTH, we really only have the "panels" page so far - and even that is only very basic, so feel free to pick a page that you are interested in, I'd just ask you to talk to F-JJTH first and then "block" those pages/images by adding a short note to the wiki article, so that others are aware of your work & progress

http://wiki.flightgear.org/Garmin_GPSMap_196#Pages
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: Garmin GPSmap196

Postby F-JJTH » Sat May 24, 2014 10:54 pm

On my side I've worked on page-panel.svg but I'm not able to commit ( hitted by https://sourceforge.net/p/flightgear/ma ... /32344620/ bug :( )

Regards,
Clément
User avatar
F-JJTH
 
Posts: 696
Joined: Fri Sep 09, 2011 12:02 pm

Re: Garmin GPSmap196

Postby Hooray » Sat May 24, 2014 11:48 pm

Try committing to some other repo, e.g. "canvas-hackers" worked for me a few hours ago, and is still working apparently: https://gitorious.org/fg/canvas-hackers ... 4eda70e1e1
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: Garmin GPSmap196

Postby Hooray » Tue Jun 03, 2014 2:50 pm

@F-JJTH: Regarding your SVG panel work, as previously mentioned, for better code reuse/maintainability, it would be good to move those instruments to separate files. That would allow people to reuse such SVG instruments in other places, including other instruments, but also GUI dialogs and/or HUDs.

I think our svg.nas parser could also be extended to support external SVGs directly, i.e. using the <use> and <image> tags. The other concern here is performance - once instruments are self-contained and can be treated as such, we can also update them more selectively, i.e. we don't necessarily have to use timers for each individual element, but can instead update instruments in a holistic fashion.

Overall, that is something that would be very worthwhile to pursue, because we do have plans to re-implement the existing 2D panels C++ code using Canvas and Nasal, so any work even remotely related to this would help pave the way for this and establish the underlying structure and framework. Conceptually, it wouldn't matter if a "steam gauge" is a raster image (2D panels) or a SVG image, the required animations would be fairly similar.
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: Garmin GPSmap196

Postby Hooray » Sat Jun 07, 2014 11:16 pm

It really makes sense to use separate files for those instruments, because even different pages on the same instrument will reuse those instruments:

Image
Image

And I'd prefer handling those separately, i.e. not as part of different pages, but as a single group that is shown/hidden
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Previous

Return to Canvas

Who is online

Users browsing this forum: No registered users and 4 guests