| 1 |
# Copyright 2018 Stuart Buchanan |
| 2 |
# This file is part of FlightGear. |
| 3 |
# |
| 4 |
# FlightGear is free software: you can redistribute it and/or modify |
| 5 |
# it under the terms of the GNU General Public License as published by |
| 6 |
# the Free Software Foundation, either version 2 of the License, or |
| 7 |
# (at your option) any later version. |
| 8 |
# |
| 9 |
# FlightGear is distributed in the hope that it will be useful, |
| 10 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 |
# GNU General Public License for more details. |
| 13 |
# |
| 14 |
# You should have received a copy of the GNU General Public License |
| 15 |
# along with FlightGear. If not, see <http://www.gnu.org/licenses/>. |
| 16 |
# |
| 17 |
# Stormscope Controller |
| 18 |
var StormscopeController = |
| 19 |
{ |
| 20 |
new : func (page, svg) |
| 21 |
{ |
| 22 |
var obj = { |
| 23 |
parents : [ StormscopeController, MFDPageController.new(page) ], |
| 24 |
_crsrToggle : 0, |
| 25 |
_recipient : nil, |
| 26 |
_page : page, |
| 27 |
}; |
| 28 |
|
| 29 |
return obj; |
| 30 |
}, |
| 31 |
|
| 32 |
|
| 33 |
# Input Handling |
| 34 |
handleCRSR : func() { |
| 35 |
me._crsrToggle = (! me._crsrToggle); |
| 36 |
if (me._crsrToggle) { |
| 37 |
} else { |
| 38 |
me._page.hideCRSR(); |
| 39 |
} |
| 40 |
return emesary.Transmitter.ReceiptStatus_Finished; |
| 41 |
}, |
| 42 |
handleFMSInner : func(value) { |
| 43 |
if (me._crsrToggle == 1) { |
| 44 |
# Scroll through whatever is the current list |
| 45 |
return emesary.Transmitter.ReceiptStatus_Finished; |
| 46 |
} else { |
| 47 |
# Pass to the page group controller to display and scroll through the page group menu |
| 48 |
return me._page.mfd.SurroundController.handleFMSInner(value); |
| 49 |
} |
| 50 |
}, |
| 51 |
handleFMSOuter : func(value) { |
| 52 |
if (me._crsrToggle == 1) { |
| 53 |
return emesary.Transmitter.ReceiptStatus_Finished; |
| 54 |
} else { |
| 55 |
# Pass to the page group controller to display and scroll through the page group menu |
| 56 |
return me._page.mfd.SurroundController.handleFMSOuter(value); |
| 57 |
} |
| 58 |
}, |
| 59 |
handleEnter : func(value) { |
| 60 |
if (me._crsrToggle == 1) { |
| 61 |
return emesary.Transmitter.ReceiptStatus_Finished; |
| 62 |
} else { |
| 63 |
return emesary.Transmitter.ReceiptStatus_NotProcessed; |
| 64 |
} |
| 65 |
}, |
| 66 |
|
| 67 |
# Reset controller if required when the page is displayed or hidden |
| 68 |
ondisplay : func() { |
| 69 |
me.RegisterWithEmesary(); |
| 70 |
}, |
| 71 |
offdisplay : func() { |
| 72 |
me.DeRegisterWithEmesary(); |
| 73 |
}, |
| 74 |
|
| 75 |
}; |