Board index FlightGear Development Canvas

meta modes

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.

meta modes

Postby Hooray » Wed Jul 10, 2013 5:19 pm

Referring to:
Subject: Just a comment
Philosopher wrote in Wed Jul 10, 2013 1:31 pm:Actually a good "development extension" would be one that shows the position in pixels when you click on a Canvas -- so I could just say "I want my text *here* [click]"


Hooray wrote:
TheTom wrote in Wed Jul 10, 2013 2:04 pm:
Code: Select all
my_canvas.addEventListener("click", func(e) globals.gui.popupTip(sprintf("click (%.1f|%.1f)", e.clientX, e.clientY)));


...now change the event-listener callback to directly modify a PropertyList tree in the property tree, and you'll end up with a WYSIWYG-GUI editor that allows you placing canvas-elements on-screen while serializing everything to a runtime tree/XML file.


Thinking about it, a really useful feature would be allowing "meta modes" for groups that automatically affect placement/resizing, so that the bounding box for the corresponding group is rendered as a frame with hot spots (handles) for mouse drag/drop, so that the whole group becomes optionally resizable and draggable, without manually setting the corresponding properties directly - that would allow a simple widget/GUI designer to be provided on top of the canvas with very little work, just by accessing the top-level group - this could be all done through a single boolean property that transparently modifies the underlying properties and locks the thing afterwards. We could then even load our existing XML dialogs and drag/drop & resize widgets around, which would allow contributors to more easily update/port/edit dialogs and widgets.

I think this could be easily provided at the canvas/GUI level through a single parent class in Nasal, without touching the C++ code - Tom ?

Image
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: 11298
Joined: Tue Mar 25, 2008 8:40 am

Re: meta modes

Postby Hooray » Tue Jul 16, 2013 3:12 pm

Referring to the last PFD/FGCanvas discussions, I'd also suggest to support an optional "enable-fullscreen" attribute, which would be useful for fullscreen apps obviously - either as part of the Nasal canvas API tracking /sim/startup/xsize and ysize via listeners, or by adding it to the C++ code, so that we just need to:

my_canvas.set('enable-fullscreen',1);


This should help people like the ATC-FS guys who will need a fullscreen canvas window, and there are probably more applications, like an instructor console for example.

Also, I haven't looked at the GUI stuff in a while, but I noticed that most of the examples that are floating around tend to duplicate GUI-behavior in that GUI-event callbacks are separately registered for handling drag/drop, and window resizing - that would seem like another opportunity to generalize standard GUI behavior through a handful of flags/attribute of the GUI library, so that windows/dialogs can be set to be modal, resizable, dragable, or scrollable - that should reduce the amount of required specialized Nasal code quite a bit and would help lower the entry barrier for people new to Nasal/Canvas.

Looking at the window.new constructor, maybe one could look into not just supporting theming, but also support an optional vector with behavior attributes, so that certain standard behavior is enabled by default ?
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: 11298
Joined: Tue Mar 25, 2008 8:40 am


Return to Canvas

Who is online

Users browsing this forum: No registered users and 0 guests