Comms Log MFD
By phkb

Overview
========
Communication messages can sometimes happen very quickly. When this happens, the messages may scroll off the screen before they are viewed by the player. Or the player might be busy doing something else (like fighting off pirates) and miss seeing a request for help from his escort. This addon aims to solve these problems.

This oxp stores all communications received by the player and then displays them in an MFD which can be scrolled during flight with primable equipment. Press "B" to select the function and "N" to activate it. The available functions are:
	Scroll back mode:               Message list will be scrolled backwards.
	Scroll forward mode:            Message list will be scrolled forwards.
	Scroll to previous launch:      Message list will be scrolled back to your previous launch message.
	Scroll to next launch:          Message list will be scrolled forward to the next launch message.
	View current:                   Message list will be scrolled to the most current message.
	View oldest:                    Message list will be scrolled to the oldest message in the list.
	Clear log mode:                 This will clear all messages from the log.
	Write comms to lastest log:     This will write all messages to the "latest.log" file.
	Switch to message scrolling:    This will switch the list to scroll by messages.
	Switch to line scrolling:       This will switch the list to scroll by line.

When docked, a "Communications Log" item will appear in the Interfaces (F4) screen. When opened, all messages received by the player will be listed, in date order (oldest first, newest last). From this screen there are several options:
	Previous Page:                  Move the list back one page.
	Next Page:                      Move the list forward one page.
	First Page:                     Go to the first page of the list.
	Last Page:                      Go to the last page of the list.
	Write comms to latest log:      Write all messages to the latest log file.
	Clear the log:                  Clears all messages from the log.
	Set log size:                   Allows the user to define how big the log file will be. You will be asked to enter a number between 1 and 32.
	MFD currently in Active mode:   This means the MFD will be scrollable during flight using the primable equipment. Select this item to change the mode to Passive (see next item).
	MFD currently in Passive mode:  This means the MFD will not be scrollable during flight. There will be no primable equipment. Select this item to change the mode to Active (see previous item).

Only works with Oolite 1.79 or greater.

Installation
============
Install the OXP by copying CommsLogMFD.oxz to your AddOns folder, or downloading via the Expansion Manager in the game itself.

License
=======
This work is licensed under the Creative Commons Attribution-Noncommercial-Share Alike 4.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/

Image from http://simpleicon.com/radar.html

Version history
===============
1.8.1
- Fixed incorrect descriptions key lookup.

1.8
- Improved method of turning HUD on/off.
- Improved handling of comms messages with no sender.
- Moved all text into descriptions.plist for easier localisation.

1.7.10
- Updated background overlay image for Oolite 1.91.

1.7.9
- Made the current mode value readable by other OXP's.

1.7.8
- Fixed some potential referencing errors on mission screens.
- Fixed integration issue with "Interface Reordering OXP".
- Fixed some UI glitches when the log is empty.

1.7.7
- Code refactoring.

1.7.6
- Using an escape pod was showing "(adjusting)" in the log.

1.7.5
- Launching when the clock shows "(adjusting)" would include the incorrect launch date/time and this text would be included in the log.
- Code refactoring.

1.7.4
- Better handling of null values being passed to the commsMessageReceived event.

1.7.3
- Fixed error when attempting to remove the comms log MFD.
- Changed "==" comparisons to "===" for performance improvements.
- Sound effects added for mode/activate functions of MFD.

1.7.2
- Fixed Javascript bug called by mis-named function call.
- Updated check for "Allow Big GUI".

1.7.1
- Internal improvements to save game format (using JSON), and other code improvements.
- If the font is changed between saves, the MFD will have its text reformatted to suit.
- Added escape pod usage notification to comms log history.
- Updated screenID's to enable BGS background sounds.
- Renamed background overlay image to prevent possibility of future duplication.
- Toned down overlay image.
- Trimmed unnecessary items out of equipment.plist.

1.7.0
- Added overlay background image to interface screen.
- Changed color of menu items on interface screen, so it's less yellow.
- Fixed issue where last page of log was not visible on the interface screen.

1.6.1
- Added routine to use 1.83/4 code to check for big GUI HUD's.
- Fixed issue where "(adjusting)" was appearing in messages when docking.

1.6.0
- MFD can now be removed.
- MFD can be switched between active (MFD can be scrolled with primable equipment) and passive (MFD can't be scrolled - no primable equipment) via the "Communication Log" interface screen

1.5.2
- Code improvements as suggested by Wildeblood.

1.5.1
- You can now exit the comms log interface screen at any time using a function key. For real this time.

1.5
- Added ability to set the log file size.
- You can now exit the comms log interface screen at any time using a function key.

1.4
- Comms messages are now viewable in the dockside F4 Communications log, even if the scroller hasn't been purchased.
- Fixed bug where clearing the log while docked would hide the HUD.
- Fixed JS bug when clearing the log in flight.
- F4 comms log options will now show all options, with various items disabled based on the log viewing position and content.
- Code refactoring and cleanup.

1.3
- Whole MFD now puchasable equipment, not just the scroller.
- New price of 250cr, which, along with the previous point, make it feel more "real" in game
- New modes
	* Dump messages to log, which sends all current messages to the lastest log file
	* switch scroll mode to be either by message (default) or by line
- Added "Communications log" to the system interfaces (f4) screen, so you can view your comms log while docked.
- Code refactoring

1.2.1
- no functional changes, just removed some debug code

1.2
- Mode selection now changes scroll function between scroll back, scroll forward, scroll to previous launch, scroll to next launch, view current, view oldest, and clear log.
- If log is scrolled and left for 90 seconds, log will automatically revert to viewing the current message
- updated license reference in manifest.plist to match with the license specified in "comms_mfd.js"
- split up the js files, putting the MFD code in one, and the scroller code in another.
- fixed case when first line of first message might not be viewable in some circumstances
- improved speed and memory management

1.1
- Scrolling by message, rather than by line (can be changed to line by line if you change a setting)
- Better handling of local variables
- Fixed the name of the MFD used to be consistent with the OXP name
- Log is kept between launches (can be changed to clear on launch if you change a setting)
- Log size limit added
- Added "Launch" and "Dock" messages to the comms log to help delineate between message sections
- Corrected the readme file license link to match with the license specified in "comms_mfd.js"
- Adjusted the width setting to leave more of a margin on the right side of the box
