File size: 1,627 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
-- ========== GENERATED BY XTemplate Editor (Alt-F3) DO NOT EDIT MANUALLY! ==========

PlaceObj('XTemplate', {
	group = "GedApps",
	id = "GedFileEditor",
	save_in = "Ged",
	PlaceObj('XTemplateWindow', {
		'__class', "GedApp",
		'LayoutMethod', "Box",
		'Translate', true,
		'Title', "File Editor",
	}, {
		PlaceObj('XTemplateAction', {
			'ActionId', "Save",
			'ActionName', T(987510172530, --[[XTemplate GedFileEditor ActionName]] "Save"),
			'ActionMenubar', "main",
			'ActionShortcut', "Ctrl-S",
			'OnAction', function (self, host, source, ...)
				local err, file = OSEncryptData(host.idFile:GetText(), "")
				err = err or AsyncStringToFile(host.file_name, file)
				host.idError:SetText(err or "")
			end,
		}),
		PlaceObj('XTemplateWindow', {
			'__class', "XMultiLineEdit",
			'Id', "idFile",
			'VScroll', "idScroll",
		}),
		PlaceObj('XTemplateWindow', {
			'__class', "XSleekScroll",
			'Id', "idScroll",
			'IdNode', false,
			'Dock', "right",
			'Target', "idFile",
		}),
		PlaceObj('XTemplateWindow', {
			'__class', "XText",
			'Id', "idError",
			'Dock', "top",
			'FoldWhenHidden', true,
			'TextStyle', "GedError",
			'HideOnEmpty', true,
		}),
		PlaceObj('XTemplateCode', {
			'comment', "read file",
			'run', function (self, parent, context)
				parent:SetTitle("File " .. context.file_name)
				local err, file = AsyncFileToString(context.file_name)
				if not err then
					local err, text = OSDecryptData(file, "")
					if not err then
						file = text
					end
				end
				parent.idError:SetText(err or "")
				parent.idFile:SetText(file or "")
				parent.idFile:SetFocus()
			end,
		}),
		}),
})