File size: 3,976 Bytes
b6a38d7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
-- ========== GENERATED BY XTemplate Editor (Alt-F3) DO NOT EDIT MANUALLY! ==========
PlaceObj('XTemplate', {
__is_kind_of = "XPropControl",
group = "Common",
id = "PropKeybinding",
save_in = "Common",
PlaceObj('XTemplateWindow', {
'__class', "XPropControl",
'BorderWidth', 2,
'LayoutMethod', "HList",
'Background', RGBA(255, 255, 255, 255),
'RolloverOnFocus', true,
'MouseCursor', "CommonAssets/UI/HandCursor.tga",
'FocusedBackground', RGBA(170, 170, 170, 255),
}, {
PlaceObj('XTemplateWindow', {
'__class', "XText",
'Id', "idName",
'MinWidth', 400,
'MaxWidth', 400,
'TextStyle', "GedTitle",
'Translate', true,
}),
PlaceObj('XTemplateWindow', {
'MinWidth', 400,
'MaxWidth', 400,
'LayoutMethod', "Grid",
'UniformColumnWidth', true,
}, {
PlaceObj('XTemplateWindow', {
'__class', "XText",
'Id', "idBinding1",
'HAlign', "center",
'TextStyle', "GedTitle",
'Translate', true,
'Shorten', true,
}, {
PlaceObj('XTemplateFunc', {
'name', "OnMouseButtonDown(self, pos, button)",
'func', function (self, pos, button)
if button == "L" then
self.desktop:SetMouseCapture(self)
self.binding = true
return "break"
end
end,
}),
PlaceObj('XTemplateFunc', {
'name', "OnMouseButtonUp(self, pos, button)",
'func', function (self, pos, button)
if button == "L" then
self.desktop:SetMouseCapture(false)
if self.binding then
RebindKeys(1, self.parent.parent)
end
return "break"
end
end,
}),
PlaceObj('XTemplateProperty', {
'id', "binding",
}),
}),
PlaceObj('XTemplateWindow', {
'__class', "XText",
'Id', "idBinding2",
'HAlign', "center",
'GridX', 2,
'TextStyle', "GedTitle",
'Translate', true,
'Shorten', true,
}, {
PlaceObj('XTemplateFunc', {
'name', "OnMouseButtonDown(self, pos, button)",
'func', function (self, pos, button)
if button == "L" then
self.desktop:SetMouseCapture(self)
self.binding = true
return "break"
end
end,
}),
PlaceObj('XTemplateFunc', {
'name', "OnMouseButtonUp(self, pos, button)",
'func', function (self, pos, button)
if button == "L" then
self.desktop:SetMouseCapture(false)
if self.binding then
RebindKeys(2, self.parent.parent)
end
return "break"
end
end,
}),
PlaceObj('XTemplateProperty', {
'id', "binding",
}),
}),
}),
PlaceObj('XTemplateFunc', {
'name', "OnPropUpdate(self, context, prop_meta, value)",
'func', function (self, context, prop_meta, value)
local binding_1, binding_2 = KeybindingName(value and value[1]), KeybindingName(value and value[2])
binding_1 = (binding_1 or "") ~= "" and binding_1
binding_2 = (binding_2 or "") ~= "" and binding_2
self.idBinding1:SetText(binding_1 or T(682820552090, "( )"))
self.idBinding2:SetText(binding_2 or T(682820552090, "( )"))
end,
}),
PlaceObj('XTemplateFunc', {
'name', "OnMouseButtonDown(self, pos, button)",
'func', function (self, pos, button)
XPropControl.OnMouseButtonDown(self, pos, button)
if button == "L" then
return self.idBinding1:OnMouseButtonDown(pos, button)
end
end,
}),
PlaceObj('XTemplateFunc', {
'name', "OnMouseButtonUp(self, pos, button)",
'func', function (self, pos, button)
if button == "L" then
return self.idBinding1:OnMouseButtonUp(pos, button)
end
end,
}),
PlaceObj('XTemplateFunc', {
'name', "OnShortcut(self, shortcut, source, ...)",
'func', function (self, shortcut, source, ...)
if shortcut == "ButtonA" then
self:OnMouseButtonDown(nil, "L")
self:OnMouseButtonUp(nil, "L")
end
end,
}),
PlaceObj('XTemplateFunc', {
'name', "SetSelected(self, selected)",
'func', function (self, selected)
self:SetFocus(selected)
end,
}),
}),
})
|