Hi fellow wiki editors!

To help newly registered users get more familiar with the wiki (and maybe older users too) there is now a {{Welcome to the wiki}} template. Have a look at it and feel free to add it to new users discussion pages (and perhaps your own).

I have tried to keep the template short, but meaningful. /Johan G

Difference between revisions of "GUI Messages"

From FlightGear wiki
Jump to: navigation, search
(http://forum.flightgear.org/viewtopic.php?f=17&p=274786#p274786)
 
(Features)
 
(19 intermediate revisions by 2 users not shown)
Line 1: Line 1:
FlightGear is using a simple property-based messaging system which can render GUI messages using propoerty listenenrs and the [[PUI]] GUI system.
+
{{Stub}}
 +
{{Screenshot needed}}
 +
 
 +
On-screen '''GUI messages''' can be rendered in FlightGear using a simple property-based messaging system which is using property listeners and the [[PUI]] GUI system.
 +
 
 +
{{Note|Canvas event handlign conflicts with PUI event handling in the sense that it takes precedence - there never really was the intention to fix that, because all the people involved in the original discussion ended up agreeing that PUI should be retired ASAP, i.e. it would not be worth the hassle to make PUI&lt;-&gt;Canvas event handling work more properly.<ref>{{cite web
 +
  |url    =  https://forum.flightgear.org/viewtopic.php?p=289887#p289887
 +
  |title  =  <nowiki> Re: canvas vs. on-screen messages - 1:0 </nowiki>
 +
  |author =  <nowiki> Hooray </nowiki>
 +
  |date  =  Jul 1st, 2016
 +
  |added  =  Jul 1st, 2016
 +
  |script_version = 0.40
 +
  }}</ref>
 +
it's really not a new thing, and is indeed explicitly mentioned in the Canvas docs - however, most people will be unaware of the back-end (like you say), i.e. the corresponding messages basically being transparent PUI dialogs (IIRC), so that the corresponding limitations apply, without people necessarily being aware of the culprit.
 +
 
 +
<ref>{{cite web
 +
  |url    =  https://forum.flightgear.org/viewtopic.php?p=289887#p289887
 +
  |title  =  <nowiki> Re: canvas vs. on-screen messages - 1:0 </nowiki>
 +
  |author =  <nowiki> Hooray </nowiki>
 +
  |date  =  Jul 1st, 2016
 +
  |added  =  Jul 1st, 2016
 +
  |script_version = 0.40
 +
  }}</ref>
 +
 
 +
 
 +
}}
 +
 
 +
== Background ==
 +
 
 +
{{FGCquote
 +
|1= The ATC subsystem shouldn't really generate the message *and* display it, no matter which method is used. It should rather only set a property to the generated message, for example /sim/messages/atc. A different subsystem should then take this message and display it -- using the same code for ATC and other screen messages. It should be glue code that decides what to do with the message property (c++ and Nasal listeners). Send it to the screen like now, print it to the console, forward it to the speech synthesis module
 +
|2= {{cite web
 +
  | url    = http://sourceforge.net/p/flightgear/mailman/message/12101220/
 +
  | title  = <nowiki>[Flightgear-devel] Re: screen.nas: log windows</nowiki>
 +
  | author = <nowiki>Melchior FRANZ</nowiki>
 +
  | date  = Feb 4th, 2006
 +
  | added  = Feb 4th, 2006
 +
  | script_version = 0.23
 +
  }}
 +
}}
 +
 
 +
 
 +
Whatever is written to <code>/sim/messages/*</code> at runtime is shown on-screen for a few seconds, then moved away. When the next message is written to that node, that is moved on-screen.
 +
Behind the scenes, this works by using a property listener/callback that is triggered whenever the property tree branch is modified.
 +
 
 +
== Development ==
 +
It would make sense to use the Canvas tooltip framework and adapt the screen.nas code accordingly: [[Tooltips]]<ref>{{cite web
 +
  |url    =  https://forum.flightgear.org/viewtopic.php?p=289869#p289869
 +
  |title  =  <nowiki> Re: canvas vs. on-screen messages - 1:0 </nowiki>
 +
  |author =  <nowiki> Hooray </nowiki>
 +
  |date  =  Jul 1st, 2016
 +
  |added  =  Jul 1st, 2016
 +
  |script_version = 0.40
 +
  }}</ref>
 +
 
 +
== Features ==
 +
 
 +
This system is primarily used by the following features:
 +
 
 +
* [[Tutorials]]
 +
* Multiplayer chat messages [[Chat Menu]]
 +
* [[Howto:Define limits]]
 +
* Failure management (limits.nas)
 +
* [[Howto:Implement copilot announcements]]
 +
* ATC
 +
 
 +
None of those are hard-coded, those are all going through the property tree and gui.nas, so you can "disable" things there.
 +
The higher-level features are limits.nas (or the failure manager) and the tutorial system.
 +
 
 +
The corresponding code can be found in gui.nas and screen.nas
 +
 
 +
To change the font size {{FGCquote
 +
|1= Set /sim/gui/style[1]/fonts/message-display/name
 +
|2= {{cite web
 +
  | url    = http://sourceforge.net/p/flightgear/mailman/message/20878242/
 +
  | title  = <nowiki>Re: [Flightgear-devel] screen.window size of font</nowiki>
 +
  | author = <nowiki> Csaba Halász </nowiki>
 +
  | date  = Nov 23rd, 2008
 +
  | added  = Nov 23rd, 2008
 +
  | script_version = 0.23
 +
  }}
 +
}}
 +
 
 +
{{FGCquote
 +
|1= with TIMES_24
 +
|2= {{cite web
 +
  | url    = http://sourceforge.net/p/flightgear/mailman/message/20878379/
 +
  | title  = <nowiki>Re: [Flightgear-devel] screen.window size of font</nowiki>
 +
  | author = <nowiki>gerard robin</nowiki>
 +
  | date  = Nov 23rd, 2008
 +
  | added  = Nov 23rd, 2008
 +
  | script_version = 0.23
 +
  }}
 +
}}
 +
 
 +
To disable the system completely,  set <code>/sim/screen/nomap=true</code> to prevent default message mapping - e.g. as a startup option <code>--prop:/sim/screen/nomap=1</code> and/or by editing $FG_HOME/Preferences.xml
 +
 
 +
In addition, there's the tooltip system which is meanwhile using the [[Canvas]] 2D rendering API
 +
 
 +
== Related content ==
 +
=== Wiki articles ===
 +
* [[Chat Menu]]
 +
* [[Howto:Define limits]]
 +
* [[Howto:Implement copilot announcements]]
 +
* [[Tooltips]]
 +
* [[Tutorials]]
 +
 
 +
=== Forum topics ===
 +
* [http://forum.flightgear.org/viewtopic.php?f=17&t=28671 Hiding all notification messages (top of screen)]
 +
 
 +
=== Source code ===
 +
* {{fgdata file|Nasal/screen.nas}}
 +
 
 +
[[Category:FlightGear]]

Latest revision as of 12:48, 1 July 2016

This article is a stub. You can help the wiki by expanding it.
Note  This article needs a few screenshots


On-screen GUI messages can be rendered in FlightGear using a simple property-based messaging system which is using property listeners and the PUI GUI system.

Note  Canvas event handlign conflicts with PUI event handling in the sense that it takes precedence - there never really was the intention to fix that, because all the people involved in the original discussion ended up agreeing that PUI should be retired ASAP, i.e. it would not be worth the hassle to make PUI<->Canvas event handling work more properly.[1]

it's really not a new thing, and is indeed explicitly mentioned in the Canvas docs - however, most people will be unaware of the back-end (like you say), i.e. the corresponding messages basically being transparent PUI dialogs (IIRC), so that the corresponding limitations apply, without people necessarily being aware of the culprit.

[2]


Background

Cquote1.png The ATC subsystem shouldn't really generate the message *and* display it, no matter which method is used. It should rather only set a property to the generated message, for example /sim/messages/atc. A different subsystem should then take this message and display it -- using the same code for ATC and other screen messages. It should be glue code that decides what to do with the message property (c++ and Nasal listeners). Send it to the screen like now, print it to the console, forward it to the speech synthesis module
— Melchior FRANZ (Feb 4th, 2006). [Flightgear-devel] Re: screen.nas: log windows.
(powered by Instant-Cquotes)
Cquote2.png


Whatever is written to /sim/messages/* at runtime is shown on-screen for a few seconds, then moved away. When the next message is written to that node, that is moved on-screen. Behind the scenes, this works by using a property listener/callback that is triggered whenever the property tree branch is modified.

Development

It would make sense to use the Canvas tooltip framework and adapt the screen.nas code accordingly: Tooltips[3]

Features

This system is primarily used by the following features:

None of those are hard-coded, those are all going through the property tree and gui.nas, so you can "disable" things there. The higher-level features are limits.nas (or the failure manager) and the tutorial system.

The corresponding code can be found in gui.nas and screen.nas

To change the font size

Cquote1.png Set /sim/gui/style[1]/fonts/message-display/name
— Csaba Halász  (Nov 23rd, 2008). Re: [Flightgear-devel] screen.window size of font.
(powered by Instant-Cquotes)
Cquote2.png
Cquote1.png with TIMES_24
— gerard robin (Nov 23rd, 2008). Re: [Flightgear-devel] screen.window size of font.
(powered by Instant-Cquotes)
Cquote2.png

To disable the system completely, set /sim/screen/nomap=true to prevent default message mapping - e.g. as a startup option --prop:/sim/screen/nomap=1 and/or by editing $FG_HOME/Preferences.xml

In addition, there's the tooltip system which is meanwhile using the Canvas 2D rendering API

Related content

Wiki articles

Forum topics

Source code

  • Hooray  (Jul 1st, 2016).  Re: canvas vs. on-screen messages - 1:0 .
  • Hooray  (Jul 1st, 2016).  Re: canvas vs. on-screen messages - 1:0 .
  • Hooray  (Jul 1st, 2016).  Re: canvas vs. on-screen messages - 1:0 .