SVG MFD UI from miChat
SVG files from Michat on the forum: Sat Jan 13, 2018 7:36 pm Me, Michat. I donate the so called garmin1000B.svg file created by me using GPL Inkscape software to FlightGear, the Free Flight Simulator as a present to the flightgear.org. Since now I derived all legal rights to FlightGear via two active developers representatives on this forum topic: Stuart and hooray. They will proceed to upload the file to the FG repository, choosing the best license in order to protect FlightGear from any scammer simulation software, if is possible. Having account the nature of the Flightgear project as public well. The 13TH of January 2018 in Madrid Spain. Michat.
This commit is contained in:
parent
d79ef2df0f
commit
9bd10f8273
11 changed files with 22693 additions and 1272 deletions
BIN
Aircraft/Instruments-3d/FG1000/Models/fascia.png
Normal file
BIN
Aircraft/Instruments-3d/FG1000/Models/fascia.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 136 KiB |
4543
Aircraft/Instruments-3d/FG1000/Models/fascia.svg
Normal file
4543
Aircraft/Instruments-3d/FG1000/Models/fascia.svg
Normal file
File diff suppressed because it is too large
Load diff
After Width: | Height: | Size: 240 KiB |
17918
Aircraft/Instruments-3d/FG1000/Models/surrounds.svg
Normal file
17918
Aircraft/Instruments-3d/FG1000/Models/surrounds.svg
Normal file
File diff suppressed because it is too large
Load diff
After Width: | Height: | Size: 1,004 KiB |
|
@ -72,6 +72,8 @@ var MFD =
|
||||||
};
|
};
|
||||||
|
|
||||||
obj._svg = myCanvas.createGroup("softkeys");
|
obj._svg = myCanvas.createGroup("softkeys");
|
||||||
|
obj._svg.set("clip-frame", canvas.Element.LOCAL);
|
||||||
|
obj._svg.set("clip", "rect(0px, 1024px, 768px, 0px)");
|
||||||
|
|
||||||
var fontmapper = func (family, weight) {
|
var fontmapper = func (family, weight) {
|
||||||
#if( family == "Liberation Sans" and weight == "narrow" ) {
|
#if( family == "Liberation Sans" and weight == "narrow" ) {
|
||||||
|
@ -126,17 +128,6 @@ var MFD =
|
||||||
obj.EIS.ondisplay();
|
obj.EIS.ondisplay();
|
||||||
obj._MFDDevice.selectPage(obj.NavigationMap);
|
obj._MFDDevice.selectPage(obj.NavigationMap);
|
||||||
|
|
||||||
|
|
||||||
# Add a wheel controller., which we will attach to the zoom.
|
|
||||||
myCanvas.addEventListener("wheel", func(e)
|
|
||||||
{
|
|
||||||
if (e.deltaY >0) {
|
|
||||||
obj._MFDDevice.current_page.controller.handleFMSInner(1);
|
|
||||||
} else {
|
|
||||||
obj._MFDDevice.current_page.controller.handleFMSInner(-1);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
},
|
},
|
||||||
getDevice : func () {
|
getDevice : func () {
|
||||||
|
|
|
@ -24,7 +24,7 @@ new : func (page)
|
||||||
|
|
||||||
#
|
#
|
||||||
handleNavVol : func (value) { return me.page.mfd.SurroundController.handleNavVol(value); },
|
handleNavVol : func (value) { return me.page.mfd.SurroundController.handleNavVol(value); },
|
||||||
handleNavVolToggle : func (value) { return me.page.mfd.SurroundController.handleNavVolToggle(value); },
|
handleNavID : func (value) { return me.page.mfd.SurroundController.handleNavID(value); },
|
||||||
handleNavFreqTransfer : func (value) { return me.page.mfd.SurroundController.handleNavFreqTransfer(value); },
|
handleNavFreqTransfer : func (value) { return me.page.mfd.SurroundController.handleNavFreqTransfer(value); },
|
||||||
handleNavOuter : func (value) { return me.page.mfd.SurroundController.handleNavOuter(value); },
|
handleNavOuter : func (value) { return me.page.mfd.SurroundController.handleNavOuter(value); },
|
||||||
handleNavInner : func (value) { return me.page.mfd.SurroundController.handleNavInner(value); },
|
handleNavInner : func (value) { return me.page.mfd.SurroundController.handleNavInner(value); },
|
||||||
|
@ -88,7 +88,7 @@ RegisterWithEmesary : func()
|
||||||
#printf("Button pressed " ~ id ~ " " ~ value);
|
#printf("Button pressed " ~ id ~ " " ~ value);
|
||||||
|
|
||||||
if (id == fg1000.FASCIA.NAV_VOL) return controller.handleNavVol(value);
|
if (id == fg1000.FASCIA.NAV_VOL) return controller.handleNavVol(value);
|
||||||
if (id == fg1000.FASCIA.NAV_VOL_TOGGLE) return controller.handleNavVolToggle(value);
|
if (id == fg1000.FASCIA.NAV_ID) return controller.handleNavID(value);
|
||||||
if (id == fg1000.FASCIA.NAV_FREQ_TRANSFER) return controller.handleNavFreqTransfer(value);
|
if (id == fg1000.FASCIA.NAV_FREQ_TRANSFER) return controller.handleNavFreqTransfer(value);
|
||||||
if (id == fg1000.FASCIA.NAV_OUTER) return controller.handleNavOuter(value);
|
if (id == fg1000.FASCIA.NAV_OUTER) return controller.handleNavOuter(value);
|
||||||
if (id == fg1000.FASCIA.NAV_INNER) return controller.handleNavInner(value);
|
if (id == fg1000.FASCIA.NAV_INNER) return controller.handleNavInner(value);
|
||||||
|
|
|
@ -11,6 +11,7 @@ var NavigationMap =
|
||||||
};
|
};
|
||||||
|
|
||||||
obj.MFDMap = obj._group.createChild("map");
|
obj.MFDMap = obj._group.createChild("map");
|
||||||
|
|
||||||
obj.MFDMap.setScreenRange(689/2.0);
|
obj.MFDMap.setScreenRange(689/2.0);
|
||||||
|
|
||||||
# Labels for map range and orientation. Two sets - one for the full display
|
# Labels for map range and orientation. Two sets - one for the full display
|
||||||
|
|
|
@ -78,7 +78,7 @@ var SurroundController =
|
||||||
return emesary.Transmitter.ReceiptStatus_Finished;
|
return emesary.Transmitter.ReceiptStatus_Finished;
|
||||||
},
|
},
|
||||||
|
|
||||||
handleNavVolToggle : func (value) {
|
handleNavID : func (value) {
|
||||||
var data={};
|
var data={};
|
||||||
|
|
||||||
if (me._navselected == 1) {
|
if (me._navselected == 1) {
|
||||||
|
|
|
@ -74,7 +74,7 @@ var MAX_NAV_FREQ = 118.000;
|
||||||
# Constants for the hard-buttons on the fascia
|
# Constants for the hard-buttons on the fascia
|
||||||
var FASCIA = {
|
var FASCIA = {
|
||||||
NAV_VOL : 0,
|
NAV_VOL : 0,
|
||||||
NAV_VOL_TOGGLE : 1,
|
NAV_ID : 1,
|
||||||
NAV_FREQ_TRANSFER :2,
|
NAV_FREQ_TRANSFER :2,
|
||||||
NAV_OUTER : 3,
|
NAV_OUTER : 3,
|
||||||
NAV_INNER : 4,
|
NAV_INNER : 4,
|
||||||
|
|
219
Aircraft/Instruments-3d/FG1000/Nasal/gui.nas
Normal file
219
Aircraft/Instruments-3d/FG1000/Nasal/gui.nas
Normal file
|
@ -0,0 +1,219 @@
|
||||||
|
|
||||||
|
io.include("constants.nas");
|
||||||
|
|
||||||
|
var MFDGUI =
|
||||||
|
{
|
||||||
|
|
||||||
|
# List of UI hotspots and their mapping to Emesary bridge notifications
|
||||||
|
WHEEL_HOT_SPOTS : [
|
||||||
|
{ notification: fg1000.FASCIA.NAV_VOL, shift: 0, top_left: [65, 45], bottom_right: [112, 90] },
|
||||||
|
{ notification: fg1000.FASCIA.NAV_INNER, shift: 0, top_left: [45, 168], bottom_right: [135, 250] },
|
||||||
|
{ notification: fg1000.FASCIA.NAV_OUTER, shift: 1, top_left: [45, 168], bottom_right: [135, 250] },
|
||||||
|
{ notification: fg1000.FASCIA.HEADING, shift: 0, top_left: [45, 338], bottom_right: [135, 411] },
|
||||||
|
{ notification: fg1000.FASCIA.ALT_INNER, shift: 0, top_left: [45, 800], bottom_right: [135, 880] },
|
||||||
|
{ notification: fg1000.FASCIA.ALT_OUTER, shift: 1, top_left: [45, 800], bottom_right: [135, 880] },
|
||||||
|
|
||||||
|
|
||||||
|
{ notification: fg1000.FASCIA.COM_VOL, shift: 0, top_left: [1290, 45], bottom_right: [1340, 90] },
|
||||||
|
{ notification: fg1000.FASCIA.COM_INNER, shift: 0, top_left: [1275, 170], bottom_right: [1355, 245] },
|
||||||
|
{ notification: fg1000.FASCIA.COM_OUTER, shift: 1, top_left: [1275, 170], bottom_right: [1355, 245] },
|
||||||
|
|
||||||
|
{ notification: fg1000.FASCIA.CRS, shift: 0, top_left: [1275, 331], bottom_right: [1355, 410] },
|
||||||
|
{ notification: fg1000.FASCIA.BARO, shift: 1, top_left: [1275, 331], bottom_right: [1355, 410] },
|
||||||
|
|
||||||
|
{ notification: fg1000.FASCIA.RANGE, shift: 0, top_left: [1275, 497], bottom_right: [1355, 554] },
|
||||||
|
|
||||||
|
{ notification: fg1000.FASCIA.FMS_INNER, shift: 0, top_left: [1275, 800], bottom_right: [1355, 880] },
|
||||||
|
{ notification: fg1000.FASCIA.FMS_OUTER, shift: 1, top_left: [1275, 800], bottom_right: [1355, 880] },
|
||||||
|
],
|
||||||
|
|
||||||
|
CLICK_HOT_SPOTS : [
|
||||||
|
{ notification: fg1000.FASCIA.NAV_ID, shift: 0, value: 1, top_left: [65, 47], bottom_right: [112, 90] },
|
||||||
|
{ notification: fg1000.FASCIA.NAV_FREQ_TRANSFER, shift: 0, value: 1, top_left: [100, 102], bottom_right: [150, 138] },
|
||||||
|
{ notification: fg1000.FASCIA.NAV_TOGGLE, shift: 0, value: 1, top_left: [45, 168], bottom_right: [135, 250] },
|
||||||
|
{ notification: fg1000.FASCIA.HEADING_PRESS, shift: 0, value: 1, top_left: [45, 338], bottom_right: [135, 411] },
|
||||||
|
|
||||||
|
{ notification: fg1000.FASCIA.COM_VOL_TOGGLE, shift: 0, value: 1, top_left: [1290, 45], bottom_right: [1340, 90] },
|
||||||
|
{ notification: fg1000.FASCIA.COM_FREQ_TRANSFER, shift: 0, value: 1, top_left: [1250, 100], bottom_right: [1300, 140] },
|
||||||
|
{ notification: fg1000.FASCIA.COM_FREQ_TRANSFER_HOLD, shift: 1, value: 1, top_left: [1250, 100], bottom_right: [1300, 140] },
|
||||||
|
{ notification: fg1000.FASCIA.CRS_CENTER, shift: 0, value: 1, top_left: [1275, 331], bottom_right: [1355, 410] },
|
||||||
|
|
||||||
|
{ notification: fg1000.FASCIA.JOYSTICK_PRESS, shift: 0, value: 1, top_left: [1295, 500], bottom_right: [1345, 550] },
|
||||||
|
|
||||||
|
{ notification: fg1000.FASCIA.JOYSTICK_HORIZONTAL, shift: 0, value: -1, top_left: [1255, 500], bottom_right: [1285, 550] },
|
||||||
|
{ notification: fg1000.FASCIA.JOYSTICK_HORIZONTAL, shift: 0, value: 1, top_left: [1345, 500], bottom_right: [1380, 550] },
|
||||||
|
|
||||||
|
{ notification: fg1000.FASCIA.JOYSTICK_VERTICAL, shift: 0, value: -1, top_left: [1295, 465], bottom_right: [1345, 500] },
|
||||||
|
{ notification: fg1000.FASCIA.JOYSTICK_VERTICAL, shift: 0, value: 1, top_left: [1295, 550], bottom_right: [1345, 585] },
|
||||||
|
|
||||||
|
{ notification: fg1000.FASCIA.DTO, shift: 0, value: 1, top_left: [1255, 620], bottom_right: [1305, 660] },
|
||||||
|
{ notification: fg1000.FASCIA.FPL, shift: 0, value: 1, top_left: [1255, 670], bottom_right: [1305, 710] },
|
||||||
|
{ notification: fg1000.FASCIA.CLR, shift: 0, value: 1, top_left: [1255, 720], bottom_right: [1305, 760] },
|
||||||
|
{ notification: fg1000.FASCIA.CLR_HOLD, shift: 1, value: 1, top_left: [1255, 720], bottom_right: [1305, 760] },
|
||||||
|
|
||||||
|
{ notification: fg1000.FASCIA.MENU, shift: 0, value: 1, top_left: [1325, 620], bottom_right: [1380, 660] },
|
||||||
|
{ notification: fg1000.FASCIA.PROC, shift: 0, value: 1, top_left: [1325, 670], bottom_right: [1380, 710] },
|
||||||
|
{ notification: fg1000.FASCIA.ENT, shift: 0, value: 1, top_left: [1325, 720], bottom_right: [1380, 760] },
|
||||||
|
|
||||||
|
{ notification: fg1000.FASCIA.FMS_CRSR, shift: 0, value: 1, top_left: [1275, 800], bottom_right: [1355, 880] },
|
||||||
|
],
|
||||||
|
|
||||||
|
SOFTKEY_HOTSPOTS : [
|
||||||
|
{ Id: 1, top_left: [205, 830], bottom_right: [265, 875] },
|
||||||
|
{ Id: 2, top_left: [290, 830], bottom_right: [350, 875] },
|
||||||
|
{ Id: 3, top_left: [375, 830], bottom_right: [435, 875] },
|
||||||
|
{ Id: 4, top_left: [460, 830], bottom_right: [520, 875] },
|
||||||
|
{ Id: 5, top_left: [545, 830], bottom_right: [605, 875] },
|
||||||
|
{ Id: 6, top_left: [630, 830], bottom_right: [690, 875] },
|
||||||
|
{ Id: 7, top_left: [715, 830], bottom_right: [775, 875] },
|
||||||
|
{ Id: 8, top_left: [800, 830], bottom_right: [860, 875] },
|
||||||
|
{ Id: 9, top_left: [885, 830], bottom_right: [945, 875] },
|
||||||
|
{ Id: 10, top_left: [970, 830], bottom_right: [1030, 875] },
|
||||||
|
{ Id: 11, top_left: [1055, 830], bottom_right: [1115, 875] },
|
||||||
|
{ Id: 12, top_left: [1145, 830], bottom_right: [1200, 875] },
|
||||||
|
],
|
||||||
|
|
||||||
|
new : func()
|
||||||
|
{
|
||||||
|
var obj = {
|
||||||
|
parents : [ MFDGUI ],
|
||||||
|
mfd : nil,
|
||||||
|
eisPublisher : nil,
|
||||||
|
navcomPublisher : nil,
|
||||||
|
navcomUpdater : nil,
|
||||||
|
navdataInterface : nil,
|
||||||
|
width : 1407,
|
||||||
|
height : 918,
|
||||||
|
};
|
||||||
|
|
||||||
|
obj.window = canvas.Window.new([obj.width,obj.height],"dialog").set('title',"FG1000 MFD");
|
||||||
|
|
||||||
|
obj.window.del = func() {
|
||||||
|
# Over-ride the window.del function so we clean up when the user closes the window
|
||||||
|
# Use call method to ensure we have the correct closure.
|
||||||
|
call(obj.cleanup, [], obj);
|
||||||
|
};
|
||||||
|
|
||||||
|
# creating the top-level/root group which will contain all other elements/group
|
||||||
|
obj.myCanvas = obj.window.createCanvas();
|
||||||
|
obj.root = obj.myCanvas.createGroup();
|
||||||
|
|
||||||
|
var nasal_dir = getprop("/sim/fg-root") ~ "/Aircraft/Instruments-3d/FG1000/Nasal/";
|
||||||
|
io.load_nasal(nasal_dir ~ 'MFD.nas', "fg1000");
|
||||||
|
io.load_nasal(nasal_dir ~ 'Interfaces/PropertyPublisher.nas', "fg1000");
|
||||||
|
io.load_nasal(nasal_dir ~ 'Interfaces/PropertyUpdater.nas', "fg1000");
|
||||||
|
io.load_nasal(nasal_dir ~ 'Interfaces/GenericEISPublisher.nas', "fg1000");
|
||||||
|
io.load_nasal(nasal_dir ~ 'Interfaces/GenericNavComPublisher.nas', "fg1000");
|
||||||
|
io.load_nasal(nasal_dir ~ 'Interfaces/GenericNavComUpdater.nas', "fg1000");
|
||||||
|
io.load_nasal(nasal_dir ~ 'Interfaces/NavDataInterface.nas', "fg1000");
|
||||||
|
|
||||||
|
# Now create the MFD itself
|
||||||
|
obj.mfd = fg1000.MFD.new(obj.myCanvas);
|
||||||
|
obj.mfd._svg.setTranslation(186,45);
|
||||||
|
obj.mfd._svg.set("z-index", 150);
|
||||||
|
|
||||||
|
# Create the surround fascia, which is just a PNG image;
|
||||||
|
var child = obj.root.createChild("image")
|
||||||
|
.setFile("Aircraft/Instruments-3d/FG1000/Models/fascia.png")
|
||||||
|
.set("z-index", 100)
|
||||||
|
.setTranslation(0, 0)
|
||||||
|
.setSize(obj.width,obj.height);
|
||||||
|
|
||||||
|
obj.eisPublisher = fg1000.GenericEISPublisher.new();
|
||||||
|
obj.eisPublisher.start();
|
||||||
|
|
||||||
|
obj.navcomPublisher = fg1000.GenericNavComPublisher.new();
|
||||||
|
obj.navcomPublisher.start();
|
||||||
|
|
||||||
|
obj.navcomUpdater = fg1000.GenericNavComUpdater.new(obj.mfd.getDevice());
|
||||||
|
obj.navcomUpdater.start();
|
||||||
|
|
||||||
|
obj.navdataInterface = fg1000.NavDataInterface.new(obj.mfd.getDevice());
|
||||||
|
obj.navdataInterface.start();
|
||||||
|
|
||||||
|
# Add a event listener for the mouse wheel, which is used for turning the
|
||||||
|
# knobs.
|
||||||
|
obj.myCanvas.addEventListener("wheel", func(e)
|
||||||
|
{
|
||||||
|
print("WHEEL: Local " ~ math.round(e.localX) ~ ", " ~ math.round(e.localY));
|
||||||
|
|
||||||
|
foreach(var hotspot; MFDGUI.WHEEL_HOT_SPOTS) {
|
||||||
|
if ((e.localX > hotspot.top_left[0]) and (e.localX < hotspot.bottom_right[0]) and
|
||||||
|
(e.localY > hotspot.top_left[1]) and (e.localY < hotspot.bottom_right[1]) and
|
||||||
|
(e.shiftKey == hotspot.shift))
|
||||||
|
{
|
||||||
|
# We've found the hotspot, so send a notification to deal with it
|
||||||
|
var notification = notifications.PFDEventNotification.new(
|
||||||
|
"MFD",
|
||||||
|
1,
|
||||||
|
notifications.PFDEventNotification.HardKeyPushed,
|
||||||
|
{ Id: hotspot.notification, Value: e.deltaY }
|
||||||
|
);
|
||||||
|
emesary.GlobalTransmitter.NotifyAll(notification);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
# Add a event listener for the mouse click, which is used for buttons
|
||||||
|
|
||||||
|
obj.myCanvas.addEventListener("click", func(e)
|
||||||
|
{
|
||||||
|
print("CLICK: Local " ~ math.round(e.localX) ~ ", " ~ math.round(e.localY));
|
||||||
|
|
||||||
|
foreach(var hotspot; MFDGUI.CLICK_HOT_SPOTS) {
|
||||||
|
if ((e.localX > hotspot.top_left[0]) and (e.localX < hotspot.bottom_right[0]) and
|
||||||
|
(e.localY > hotspot.top_left[1]) and (e.localY < hotspot.bottom_right[1]) and
|
||||||
|
(e.shiftKey == hotspot.shift))
|
||||||
|
{
|
||||||
|
# We've found the hotspot, so send a notification to deal with it
|
||||||
|
var notification = notifications.PFDEventNotification.new(
|
||||||
|
"MFD",
|
||||||
|
1,
|
||||||
|
notifications.PFDEventNotification.HardKeyPushed,
|
||||||
|
{ Id: hotspot.notification, Value: hotspot.value }
|
||||||
|
);
|
||||||
|
emesary.GlobalTransmitter.NotifyAll(notification);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach(var hotspot; MFDGUI.SOFTKEY_HOTSPOTS) {
|
||||||
|
if ((e.localX > hotspot.top_left[0]) and (e.localX < hotspot.bottom_right[0]) and
|
||||||
|
(e.localY > hotspot.top_left[1]) and (e.localY < hotspot.bottom_right[1]))
|
||||||
|
{
|
||||||
|
# We've found the hotspot, so send a notification to deal with it
|
||||||
|
var notification = notifications.PFDEventNotification.new(
|
||||||
|
"MFD",
|
||||||
|
1,
|
||||||
|
notifications.PFDEventNotification.SoftKeyPushed,
|
||||||
|
hotspot.Id
|
||||||
|
);
|
||||||
|
emesary.GlobalTransmitter.NotifyAll(notification);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return obj;
|
||||||
|
},
|
||||||
|
|
||||||
|
cleanup : func()
|
||||||
|
{
|
||||||
|
me.mfd.del();
|
||||||
|
me.eisPublisher.stop();
|
||||||
|
me.eisPublisher = nil;
|
||||||
|
|
||||||
|
me.navcomPublisher.stop();
|
||||||
|
me.navcomPublisher = nil;
|
||||||
|
|
||||||
|
me.navcomUpdater.stop();
|
||||||
|
me.navcomUpdater = nil;
|
||||||
|
|
||||||
|
me.navdataInterface.stop();
|
||||||
|
me.navdataInterface =nil;
|
||||||
|
|
||||||
|
# Clean up the window itself
|
||||||
|
call(canvas.Window.del, [], me.window);
|
||||||
|
},
|
||||||
|
};
|
File diff suppressed because it is too large
Load diff
|
@ -824,8 +824,12 @@
|
||||||
<item>
|
<item>
|
||||||
<name>fg1000</name>
|
<name>fg1000</name>
|
||||||
<binding>
|
<binding>
|
||||||
<command>dialog-show</command>
|
<command>nasal</command>
|
||||||
<dialog-name>fg1000</dialog-name>
|
<script>
|
||||||
|
var nasal_dir = getprop("/sim/fg-root") ~ "/Aircraft/Instruments-3d/FG1000/Nasal/";
|
||||||
|
io.load_nasal(nasal_dir ~ 'gui.nas', "fg1000");
|
||||||
|
var MFD_GUI = fg1000.MFDGUI.new();
|
||||||
|
</script>
|
||||||
</binding>
|
</binding>
|
||||||
</item>
|
</item>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue