RKG_buttons.gau
Oct 12, 2001   version 1.2
by Robert K. Guy

What's New
__________
V1.2 fixes an error in the order of the bitmap numbers and fixes a minor logic
error.  You can now assign '0' as a parameter for any of the panel_id buttons to
reprogram that button to refer to the MAIN_PANEL.  This version replaces the
earlier version 1.0 dated 06/19/01 and replaces version 1.1 dated 10/04/01.
The button graphics have been entirely revised so as to be not so visually
similar to other copyrighted material.

A set of buttons gauge for FS2000/CFS2 only.
____________________________________________
This gauge file contains: standard panel switching buttons, NAV/GPS, Autopilot and
Flight Director buttons, hidden buttons, programable On/Off buttons, and programable
toggle switches.  The principal feature is that most buttons can have their key_id
reassigned by setting the parameter field (in the panel.cfg) so that a button can
operate any "thing" in MSFS that can respond to a key_id.  This gauge set was
designed to replace multiple copies of single button gauges that are hard-coded
and to allow more flexible use of buttons.  A second goal was to eliminate the need
to load a large gauge set just to use one button from it.

This gauge set is for FS2000 or CFS2 only, it contains no funky code that prevents
you from playing with it. You may rename it or replace or modify the
graphics.  All of the bitmaps used are opaque and the buttons may be
placed on any background bitmap.

All of these buttons share their code and resources - they effectively
become repeaters.  When multiple instances of a single button are installed in
a panel all of the instances of that single button share their settings.  A setting
on one button is repeated on the other.  If a single button is installed
(in a panel) more than once, the parameters of the last instance will be used for
all instances of that button.

Since this is an FS2000 gauge you may install as many instances of a
button as you like.  FS2000 regards this as a single gauge and will
maintain one copy in memory but will display multiple copies.  FS2000
will not make additional copies of the gauge file in order to display
multiple instances.

Most of these buttons can be reprogrammed by entering a number in the parameter
field.  All the buttons have default values which are listed below.  No parameter
is needed if the default is appropriate.  The result is undefined when any
parameter is not a valid number.  Ordinarily, the default will be used if the
parameter is not valid for the button.  Very little range checking will be made
on the parameter and no errors will be reported.

Any single button can be installed as may times on as many panels as you need.
Just remember that the parameter of the last instance of that single button
will apply to all instances of that single button.

Examples:

To use a button with the default parameter -

    gauge34=RKG_buttons!Copilot_button,  479,70,12

toggles the panel with ident=ANNUNCIATOR2_PANEL  (see Copilot_button below).

To use a button with a parameter -

    gauge34=RKG_buttons!Copilot_button,  479,70,12,12,32
or
    gauge34=RKG_buttons!Copilot_button,  479,70,12, ,32

toggles the panel with ident=32.  Note that there are two commas in the example above.
The format is 'xxxx, yyyy, wwww, hhhh, parameter'.  When the height is not explicitly
stated a blank field is retained and indicated by consecutive commas.



THE BUTTONS

The following can be reprogrammed with any panel ident (column 2 is the default)
______________________________________________________
RKG_buttons!Annunciator_button          toggles the panel with ident=ANNUNCIATOR_PANEL   =125
RKG_buttons!Annunciator2_button         toggles the panel with ident=ANNUNCIATOR2_PANEL  =150
RKG_buttons!Collective_button           toggles the panel with ident=COLLECTIVE_PANEL    =200
RKG_buttons!Compass_button              toggles the panel with ident=COMPASS_PANEL       =75
RKG_buttons!Copilot_button              toggles the panel with ident=ANNUNCIATOR2_PANEL  =150
RKG_buttons!Fuel_button                 toggles the panel with ident=COLLECTIVE_PANEL    =200
RKG_buttons!Gps_button                  toggles the panel with ident=GPS_PANEL           =225
RKG_buttons!IFR_button                  toggles the panel with ident=IFR_MAIN_PANEL      =175
RKG_buttons!Main_button                 toggles the panel with ident=MAIN_PANEL          =0
RKG_buttons!Mini_Controls_button        toggles the panel with ident=MINI_CONTROLS_PANEL =100
RKG_buttons!Overhead_button             toggles the panel with ident=OVERHEAD_PANEL      =250
RKG_buttons!Radio_button                toggles the panel with ident=RADIO_STACK_PANEL   =50
RKG_buttons!Throttle_button             toggles the panel with ident=THROTTLE_PANEL      =10


The panel ident can be any valid ident not just those listed above. For example:

[Window04]
file=overhead.bmp
size_mm=998
position=6
visible=1
ident=35

This window has an ident of 35.  The proper syntax for a button is:

    gauge00=RKG_buttons!Overhead_button 10,10,19,,35

This places an Overhead_button on a panel and reprograms the panel_id to 35.

Graphics for the above buttons:
_______________________________
Annunciator_button --- "a1" (text)
Annunciator2_button -- "a2" (text)
Collective_button ---- a big yellow up arrow - the collective makes a helicopter go up
Compass_button ------- pointing to North
Copilot_button ------- a navigation instrument crosshair
Fuel_button ---------- a (blue) drop of fuel
Gps_button ----------- a satellite dish
IFR_button ----------- "ifr" (text)
Main_button ---------- a yoke
Mini_Controls_button - a red right-angle marker (looks like the minicontrol window)
Overhead_button ------ a miniture overhead panel
Radio_button --------- an antenna
Throttle_button ------ a tiny tiny little jet
****************************************************************************



The next button is invisible and can be programmed with any panel ident number.
There are ten buttons, 0..9, and each has a default listed below.  For example,
Hidden_Panel_Ident_5_button has a default parameter of 125 and toggles the window
with ident=ANNUNCIATOR_PANEL.  The parameter can be any valid panel ident.
________________________________________
RKG_buttons!Hidden_Panel_Ident_0_button
...
RKG_buttons!Hidden_Panel_Ident_9_button

button                            default
___________________________________________________________
Hidden_Panel_Ident_0_button       ident=0         =MAIN_PANEL
Hidden_Panel_Ident_1_button       ident=10        =THROTTLE_PANEL
Hidden_Panel_Ident_2_button       ident=50        =RADIO_STACK_PANEL
Hidden_Panel_Ident_3_button       ident=75        =COMPASS_PANEL
Hidden_Panel_Ident_4_button       ident=100       =MINI_CONTROLS_PANEL
Hidden_Panel_Ident_5_button       ident=125       =ANNUNCIATOR_PANEL
Hidden_Panel_Ident_6_button       ident=150       =ANNUNCIATOR2_PANEL
Hidden_Panel_Ident_7_button       ident=200       =COLLECTIVE_PANEL
Hidden_Panel_Ident_8_button       ident=225       =GPS_PANEL
Hidden_Panel_Ident_9_button       ident=250       =OVERHEAD_PANEL

AN EXAMPLE:

[Window04]
file=v767.Yoke.blue.bmp
size_mm=998
position=6
visible=1
ident=MINI_CONTROLS_PANEL

gauge00=RKG_buttons!Hidden_Panel_Ident_4_button,  148,39,40


This is a scrap from a panel which illustrates how to use the hidden_panel_ident
button.  This panel has no controls on it - it is just a picture of a yoke.
The hidden button forms a hotspot on the bitmap - just click on it and the
window closes.  Note that the panel 4 button by default refers to the
mini_controls panel and that no parameter is required.

The very same hidden button (4) could also be installed on the main panel so that
the yoke panel could be opened from the main panel by clicking on a hotspot.

Any single button can be installed as may times on as many panels as you need.
Just remember that the parameter of the last instance of that single button
will apply to all instances of that single button.

****************************************************************************



The next button is programmed with any panel ident number.  There are ten buttons,
0..9, and each has a default the same as the hidden panel button above.
For example, Panel_5_button has a default parameter of 125 and toggles
the panel with an ident=125.  The parameter can be any valid panel ident.  These
buttons have a text graphic of the number 0 to 9 and are not animated.
___________________________
RKG_buttons!Panel_0_button
...
RKG_buttons!Panel_9_button

****************************************************************************



The following can be reprogrammed with any key_id.
_________________________________________________
RKG_buttons!Hidden_Key_Id_0_button      0..9 buttons
RKG_buttons!Key_Id_0_button             0..9 buttons

RKG_buttons!Off_On_0_button             0..4 buttons (text)
RKG_buttons!Off_On_5_button             5..9 buttons (red/green)

RKG_buttons!On_Off_0_button             0..4 buttons (text)
RKG_buttons!On_Off_5_button             5..9 buttons (red/green)

RKG_buttons!Switch_down_0               0..9 buttons
RKG_buttons!Switch_up_0                 0..9 buttons


The above buttons are all ON/OFF toggle type buttons.  The designed key_ids below
allow the button to toggle their variables and respond to the current state of
their variables.  Ordinarily, OFF means a value of 0 and ON means a value of 1.
There is an OFF/ON button that starts out in the OFF state, and an ON/OFF button
that starts out in the ON state.  When used with the designed key_ids below this
becomes less significant since an OFF/ON button still reads ON in the variable's
ON state.  The ON/OFF and OFF/ON buttons have two sets of bitmaps. One has text
that reads 'On' in green and 'Off' in red.  The other is just a green/red light.

The buttons 'Key_Id_0_button..Key_Id_9_button' are not animated.
They have a text graphic '0'..'9'.

The buttons 'Hidden_Key_Id_0_button..Hidden_Key_Id_9_button' are invisible.  Place
these like hotspots on your panel or over built-in background bitmap graphics.

The 'Switch' buttons operate in an opposite sense.
The down switch is OFF when down.
The up switch is OFF when up.

For any of the key_id buttons the parameter may be a negative number.
When negative the button becomes 'un-hooked' from the driving variable.  It still
toggles the variable but is not driven by the variable.  Every click on the button
will toggle the button and toggle the state of the variable with no regard to the
previous state.  This can be useful for some odd conditions.  Note that if
the variable is changed by another method, such as a hot key, the button with
a negative parameter will not reflect this change.

To select a parameter for the key_id, look in the list below for the variable
of interest and use the number from column 1 or column 2 in the parameter field.
Column 2 is simply the same number as in column 1 plus 65536.

NOTE: A parameter of 0 will result in a dummy button/switch that does nothing
but alternate state when clicked.  The default parameter for key_id buttons is 0.
This could be used to place dummy switches on a panel.

Included within this archive is a file 'key_id.txt' which is a complete list of all
possible key_ids.  Note that variables that are not boolean (toggles) will not work
well (if at all) with any of these buttons.  The buttons in this gauge set can only
send a change state message to their respective variables and they can only respond
to an ON(not 0) or OFF(0) state returned by their variables.

****************************************************************************



The following are NOT RE-PROGRAMABLE
_____________________________________
RKG_buttons!AP_master_switch            toggles the autopilot
RKG_buttons!FD_button                   toggles the flight director
RKG_buttons!NavGps_button               toggles NAV/GPS autopilot feature
RKG_buttons!AutoStart_button            starts all engines as with CTRL-E (not animated)

****************************************************************************



The following is a list of key_ids that are implemented with driving variables
by this gauge set.

Normally, only key_ids that are toggles are used by buttons but any
key_id can be used - the result just may not be useful.

These key_ids, when set in the parameter field, cause the button to be
driven by their appropriate variable.  Any key_id can be used in the
parameter field but only those below allow the switch or button to
automatically respond to the state of the respective variable.  A key_id
not in this list will still function but the button will be dumb, simply
switching between on and off.  A dumb button will still act on the respective
variable but if the variable is changed through another method, such as
with a hot key or with another button, the dumb button will ignore that
change.  The dumb button will still work but may be reversed in the ON/OFF
sense.

The key_ids implemented below also have an appropriate help pop-up implemented.

key_id - column 1 is the token number for the key_id
|        column 2 is the internal number for the key_id ( = token number + 65536 )
|        Either number may be used for the parameter.
|
|
|________
  0 65536   KEY_ID_MIN
  0         KEY_NULL                                (KEY_ID_MIN + 0)

 23 65559   KEY_SMOKE_TOGGLE                        SMOKE_ENABLE                    // TRUE=smoke system active
 24 65560   KEY_STROBES_TOGGLE                      STROBE_LIGHTS                   // TRUE=strobe lights on
 35 65571   KEY_ANTI_ICE_TOGGLE                     PANEL_ANTIICE_SWITCH,
 53 65589   KEY_SPOILERS_TOGGLE                     SPOILERS_HANDLE_POS             // 0=off
186 65722   KEY_AP_ATT_HOLD                         AUTOPILOT_ATTITUDE_HOLD         // attitude hold
187 65723   KEY_AP_LOC_HOLD                         AUTOPILOT_GLIDESLOPE_HOLD       // glideslope hold
188 65724   KEY_AP_APR_HOLD                         AUTOPILOT_APROACH_HOLD          // approach hold
189 65725   KEY_AP_HDG_HOLD                         AUTOPILOT_HEADING_LOCK          // heading lock on/off
190 65726   KEY_AP_ALT_HOLD                         AUTOPILOT_ALTITUDE_LOCK         // altitude lock on/off
191 65727   KEY_AP_WING_LEVELER                     AUTOPILOT_WING_LEVELER          // wing leveler on/off
192 65728   KEY_AP_BC_HOLD                          AUTOPILOT_BACKCOURSE_HOLD       // backcourse hold
193 65729   KEY_AP_NAV1_HOLD                        AUTOPILOT_NAV1_LOCK             // nav 1 lock on/off
214 65750   KEY_PANEL_LIGHTS_TOGGLE                 PANEL_LIGHTS                    // TRUE=panel lighting on
215 65751   KEY_LANDING_LIGHTS_TOGGLE               LANDING_LIGHTS                  // TRUE=landing lights on
216 65752   KEY_PARKING_BRAKES                      PARKING_BRAKE_POS               // 0=off 32k=full parking brakes
255 65791   KEY_AUTOPILOT_OFF
256 65792   KEY_AUTOPILOT_ON                        AUTOPILOT_ACTIVE                // autopilot master on/off
257 65793   KEY_YAW_DAMPER_TOGGLE                   AUTOPILOT_YAW_DAMPER            // yaw damper
317 65853   KEY_SPOILERS_ARM_TOGGLE                 SPOILERS_ARMED
322 65858   KEY_PITOT_HEAT_TOGGLE                   PITOT_HEAT                      // TRUE=pitot heat on
324 65860   KEY_AUTO_THROTTLE_ARM                   AUTOPILOT_AUTO_THROTTLE_ARM
325 65861   KEY_AUTO_THROTTLE_TO_GA                 AUTOPILOT_TAKEOFF_POWER_ACTIVE
382 65918   KEY_AP_MACH_HOLD                        AUTOPILOT_MACH_HOLD             // airspeed hold
563 66099   KEY_AP_VS_HOLD                          AUTOPILOT_VERTICAL_HOLD         // vertical hold
701 66237   KEY_FUEL_PUMP                           FUEL_PUMP                       // 0.0 -> 1.0 == off -> on
702 66238   KEY_ENGINE_PRIMER                       ENGINE_PRIMER                   // 0.0 -> 1.0 == in -> out
703 66239   KEY_TOGGLE_BEACON_LIGHTS                BEACON_LIGHTS                   // 0.0 -> 1.0 == off -> on
704 66240   KEY_TOGGLE_TAXI_LIGHTS                  TAXI_LIGHTS                     // 0.0 -> 1.0 == off -> on
705 66241   KEY_TOGGLE_MASTER_BATTERY               MASTER_BATTERY                  // 0.0 -> 1.0 == off -> on
706 66242   KEY_TOGGLE_MASTER_ALTERNATOR            MASTER_ALTERNATOR               // 0.0 -> 1.0 == off -> on
746 66282   KEY_RADIO_COMM1_AUTOSWITCH_TOGGLE       COM1_AUTOSWITCH_ON
747 66283   KEY_RADIO_NAV1_AUTOSWITCH_TOGGLE        NAV1_AUTOSWITCH_ON
748 66284   KEY_RADIO_COMM2_AUTOSWITCH_TOGGLE       COM2_AUTOSWITCH_ON
749 66285   KEY_RADIO_NAV2_AUTOSWITCH_TOGGLE        NAV2_AUTOSWITCH_ON
751 66287   KEY_TOGGLE_PROP_SYNC                    PROPSYNC_ACTIVE
752 66288   KEY_TOGGLE_FLIGHT_DIRECTOR              FLIGHT_DIRECTOR_ACTIVE
757 66293   KEY_TOGGLE_AVIONICS_MASTER              AVIONICS_MASTER_SWITCH
803 66339   KEY_TOGGLE_ELECT_FUEL_PUMP              FUEL_PUMP                       // 0.0 -> 1.0 == off -> on
808 66344   KEY_TOGGLE_PRIMER                       ENGINE_PRIMER                   // 0.0 -> 1.0 == in -> out
817 66353   KEY_AUTOPILOT_AIRSPEED_HOLD_CURRENT     AUTOPILOT_AIRSPEED_HOLD         // airspeed hold
818 66354   KEY_AUTOPILOT_AIRSPEED_ACQUIRE          AUTOPILOT_AIRSPEED_ACQUISITION  // boolean
820 66356   KEY_AUTOPILOT_MACH_HOLD_CURRENT         AUTOPILOT_AIRSPEED_HOLD_CURRENT // boolean
821 66357   KEY_AUTOPILOT_PANEL_MAX_SPEED           AUTOPILOT_MAX_SPEED             // boolean
822 66358   KEY_AUTOPILOT_PANEL_CRUISE_SPEED        AUTOPILOT_CRUISE_SPEED          // boolean
837 66373   KEY_TOGGLE_ATTITUDE_CAGE                ATTITUDE_CAGE_BUTTON
838 66374   KEY_TOGGLE_MASTER_BATTERY_ALTERNATOR    MASTER_ALTERNATOR               // 0.0 -> 1.0 == off -> on
839 66375   KEY_TOGGLE_GPS_DRIVES_NAV1              GPS_DRIVES_NAV1
840 66376   KEY_TOGGLE_LOGO_LIGHTS                  LOGO_LIGHTS
841 66377   KEY_TOGGLE_RECOGNITION_LIGHTS           RECOGNITION_LIGHTS
842 66378   KEY_TOGGLE_WING_LIGHTS                  WING_LIGHTS
843 66379   KEY_TOGGLE_NAV_LIGHTS                   NAV_LIGHTS

861 66397   KEY_ID_MAX




TO INSTALL
__________
Unzip the file, RKG_buttons.gau, into your FS2000 gauges folder
or into your CFS2 gauges folder.
OR...
Unzip the zip file anywhere and move RKG_buttons.gau to your FS2000
(or CFS2) gauges folder.


A NOTE
______
I have done nothing slick in the code - it does not use FSUIPC or require any
special handling.  The bitmaps may be modified in any way you like.
The up/down switch bitmaps in particular are fairly rough.  The standard panel ident
button graphics now are not visually similar to those supplied by Microsoft.
They can be used instead of the Microsoft buttons or in addition to them.  With no
parameter they will perform the same function as the standard buttons
and with a parameter they can extend the number of functions you can implement
in a single window.  Of course, if you have the appropriate tools you can replace
the bitmaps with anything you like such as bitmaps more visually similar
to the standard MS gauges.  This should only be attempted by persons familiar
with the structure of .DLL's and gauges and with appropriate program tools.
I will not give any more instructions or advice on how to do this.



If you believe this gauge is causing your FS2000 or CFS2 to fail
just stop using it.  This gauge cannot do damage to your FS2000 installation.



Copyright 2001 Robert K. Guy.
You may not make money with this gauge in any way whatsoever but you
may freely distribute this gauge with any panel you design that is
exclusively freeware.  You are also free to upload this gauge to any
other FS site that does not charge a fee for access or for downloads.

This is Freeware.

Bob Guy
zbobg@juno.com
