Menubar: Difference between revisions

Jump to navigation Jump to search
2,836 bytes added ,  1 June 2016
no edit summary
m (Robot: Cosmetic changes)
No edit summary
(12 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Note|The existing menubar is a hard-coded feature implemented using PLIB/PUI which we are hoping to get rid of eventually to help us [[Unifying the 2D rendering backend via canvas]] for better portability and performance. The PUI menubar can be partially customized by editing PropertyList/XML files for adding entries and styling purposes, but is otherwise fairly inflexible and doesn't support modern widgets like checkboxes, or even just sub-menus.
As of 09/2014, this feature is in the process of being ported to [[Canvas]], for details please check out [[Howto:Making a Canvas Menubar]].}}
The in-game '''menubar''' of [[FlightGear]] is located at the top of the screen.
The in-game '''menubar''' of [[FlightGear]] is located at the top of the screen.


== Styles ==
== Menu items ==
The menubar is available in various styles. Currently there are two styles (both are shown below) packaged with FlightGear. The blue/black one is standard, but most developers use the grey/white one. You could switch between styles by pressing Shift + F10.
* [[Autopilot]]
 
* [[Chat Menu]]
[[File:menubar1.jpg]]
* [[Instant Replay]]
[[File:menubar2.jpg]]
* [[Map]]
 
* [[Property browser]]
=== Creating your own ===
* [[Route Manager]]
It's very easy to make your own designs. Just copy one of the files that you find in <tt>data/gui/styles</tt> and change it to your needs.
Then, edit the follwing code in the <tt>data/preferences.xml</tt> file to fit your style. You could simply add a line like <tt><style n="0" include="gui/styles/anthrax.xml"/></tt>. The current-style tag specifies the style that should be used when FlightGear loads.
 
  <gui>
  <current-style type="int" userarchive="y">1</current-style>
  <style n="1" include="gui/styles/classic.xml"/>
  <style n="0" include="gui/styles/anthrax.xml"/>
  <devel-widgets type="bool" userarchive="y">false</devel-widgets>
  </gui>


== Add items ==
=== Add items ===
=== Aircraft dependent items ===
To add a menu for a specific plane only you have to enhance the planes <tt>-set.xml</tt> file. Add the follow lines (example for the [[Livery over MP|livery selection dialog]] in a [[Boeing 787]]), or any item that you want to show, above the </sim> tag. You can add as many items and menus as you like, but keep the menubar as small as possible, the larger the outside view will be.
To add a menu for a specific plane only you have to enhance the planes -set.xml file. Add the follow lines (example for the [[Livery over MP|livery selection dialog]] in a [[Boeing 787]]), or any item that you want to show, above the </sim> tag. You can add as many items and menus as you like, but keep the menubar as small as possible, the larger the outside view will be.


<syntaxhighlight lang="xml">
  <menubar>
  <menubar>
   <default>
   <default>
   <menu n="10">
   <menu n="10">
   <label>Boeing 787</label>
   <label>Boeing 787</label>
   <enabled type="bool">true</enabled>
   <enabled type="bool">true</enabled>
Line 36: Line 30:
     </item>
     </item>
   
   
   </menu>
   </menu>
   </default>
   </default>
  </menubar>
  </menubar>
</syntaxhighlight>
* '''menu n="10":''' creates an extra menu item, at the end of the menubar.
* '''aircraft.livery.dialog.open():''' the prefix 'aircraft' is coming from the tagname you choose inside the <nasal> section, eg:
<syntaxhighlight lang="xml">
    <nasal>
        <aircraft>
            <file>Aircraft/MyAircraft/Nasal/script.nas</file>
        </aircraft>
    </nasal>
</syntaxhighlight>
Use only characters that could be used to name and call a nasal function (eg: the '-' character is not valid).
== Styles ==
The menubar is available in various styles. Currently there are two styles (both are shown below) packaged with FlightGear. The lower one is standard, since FlightGear 1.0.0. You can switch between styles by pressing Shift-F10.
[[File:menubar1.jpg|517px]]
[[File:menubar2.jpg|517px]]
=== Creating your own ===
{{See also|PUI}}
[[File:Broken PUI.png|thumb|PUI fonts broken]]
It's very easy to make your own designs. Just copy one of the files that you find in <tt>[[$FG_ROOT]]/gui/styles</tt> and change it to your needs.
Then, edit the follwing code in the <tt>[[$FG_ROOT]]/preferences.xml</tt> file to fit your style. You could simply add a line like <tt><style n="0" include="gui/styles/anthrax.xml"/></tt>. The current-style tag specifies the style that should be used when FlightGear loads.
<syntaxhighlight lang="xml">
  <gui>
  <current-style type="int" userarchive="y">1</current-style>
  <style n="0" include="gui/styles/classic.xml"/>
  <style n="1" include="gui/styles/anthrax.xml"/>
  <devel-widgets type="bool" userarchive="y">false</devel-widgets>
  </gui>
</syntaxhighlight>
== Flickering Menubar text under Rembrandt / ALS ==
Due to problems that appear to be related to the internal bitmapped font not being rendering correctly on certain graphics card (e.g. AMD R9 290) it may be necessary to change the GUI style to use the TXF format[http://forum.flightgear.org/viewtopic.php?f=4&t=17536#p166346] fonts.
If there is an option on the Debug menu called *cycle gui* use this, ensure that you are using GUI style 1, i.e. in the preferences, or autosave the gui section should be as followed
<syntaxhighlight lang="xml">
    <gui>
      <current-style type="int">1</current-style>
      <devel-widgets type="bool">false</devel-widgets>
    </gui>
</syntaxhighlight>
== How to Change the Default Menubar Font Size ==
For those using bigger monitors or higher resolutions it may be necessary to increase the font size of the menubar. The change below can be applied and should be made before launching.
<syntaxhighlight lang="diff">
--- flightgear-data/fgdata/gui/styles/anthrax.xml.orig      2014-04-24 19:52:04.353028047 -0800
+++ flightgear-data/fgdata/gui/styles/anthrax.xml            2014-04-24 19:57:12.548002672 -0800
@@ -11,7 +11,7 @@
        <fonts>
                <gui>
-                      <name type="string">HELVETICA_12</name>
+                      <name type="string">HELVETICA_18</name>
                        <baseline-height type="float">21</baseline-height>
                </gui>
</syntaxhighlight>
Fonts available are based on what is installed in fgdata/Fonts in the tfx format.


== Menu items ==
<references/>
* [[Autopilot]]
* [[Chat Menu]]
* [[Instant Replay]]


[[Category:FlightGear feature]]
[[Category:FlightGear feature]]
[[Category:Menubar]]
[[Category:Menubar]]
1

edit

Navigation menu